mirror of
https://github.com/ritz078/transform.git
synced 2026-11-21 00:32:56 +03:00
updated dependencies
This commit is contained in:
1 parent
27b46790f0
commit
8dd39ba0bc
6 files changed
+302
-328
No files matched your search
+1
-6
@@ -40,12 +40,7 @@ const config = {
|
||||
"java",
|
||||
"pug"
|
||||
],
|
||||
features: [
|
||||
"folding",
|
||||
"goToDefinitionMouse",
|
||||
"referenceSearch",
|
||||
"coreCommands"
|
||||
]
|
||||
features: ["folding"]
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
+1
-1
@@ -85,7 +85,7 @@
|
||||
"text-encoding-utf-8": "^1.0.2",
|
||||
"transform-json-types": "^0.7.0",
|
||||
"ts-json-schema-generator": "^0.58.1",
|
||||
"typescript": "3.5.3",
|
||||
"typescript": "3.9.2",
|
||||
"xml-js": "^1.6.11",
|
||||
"yaml": "^1.7.2"
|
||||
},
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
import html2pug from "html2pug";
|
||||
|
||||
export default (req: NextApiRequest, res: NextApiResponse) => {
|
||||
try {
|
||||
const { value, settings } = JSON.parse(req.body);
|
||||
const result = html2pug(value, settings);
|
||||
res.status(200).send(result);
|
||||
} catch (e) {
|
||||
res.status(500).send(e.message);
|
||||
}
|
||||
};
|
||||
@@ -3,8 +3,7 @@ import * as React from "react";
|
||||
import { useCallback } from "react";
|
||||
import { useSettings } from "@hooks/useSettings";
|
||||
import Form, { InputType } from "@components/Form";
|
||||
import html2pug from "html2pug";
|
||||
import minify from "@assets/vendor/html-minifier";
|
||||
import request from "@utils/request";
|
||||
|
||||
const formFields = [
|
||||
{
|
||||
@@ -55,10 +54,12 @@ export default function() {
|
||||
}, []);
|
||||
|
||||
const transformer = useCallback(
|
||||
async ({ value }) => {
|
||||
return html2pug(value, minify, settings);
|
||||
},
|
||||
[settings, minify]
|
||||
({ value }) =>
|
||||
request("/api/html-to-pug", {
|
||||
value,
|
||||
settings
|
||||
}),
|
||||
[settings]
|
||||
);
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
diff --git a/node_modules/html2pug/src/index.js b/node_modules/html2pug/src/index.js
|
||||
index 57a6b6a..d8a43c7 100644
|
||||
--- a/node_modules/html2pug/src/index.js
|
||||
+++ b/node_modules/html2pug/src/index.js
|
||||
@@ -1,4 +1,3 @@
|
||||
-const { minify } = require('html-minifier')
|
||||
const { parse, parseFragment } = require('parse5')
|
||||
const Pugify = require('./parser')
|
||||
|
||||
@@ -17,7 +16,7 @@ const defaultOptions = {
|
||||
preserveLineBreaks: true,
|
||||
}
|
||||
|
||||
-module.exports = (sourceHtml, options = {}) => {
|
||||
+module.exports = (sourceHtml,minify, options = {}) => {
|
||||
// Minify source HTML
|
||||
const opts = { ...defaultOptions, ...options }
|
||||
const html = minify(sourceHtml, opts)
|
||||
Reference in new issue
Block a user