update node modules

This commit is contained in:
s2
2020-07-20 16:20:39 +02:00
parent dcb748f037
commit f9fb05e4db
906 changed files with 124011 additions and 93468 deletions

3
node_modules/minifyfromhtml/example/css/more.css generated vendored Normal file
View File

@@ -0,0 +1,3 @@
#mywidget {
color: blue;
}

View File

@@ -1 +1 @@
#mywidget{border:2px solid red}
#mywidget{border:2px solid red}#mywidget{color:#00f}

File diff suppressed because one or more lines are too long

1
node_modules/minifyfromhtml/example/dist/dist.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -14,6 +14,7 @@
<!-- some css -->
<link rel="stylesheet" type="text/css" href="css/mywidget.css" />
<link rel="alternate stylesheet" type="text/css" href="css/mywidget.css" />
<link rel="stylesheet" type="text/css" href="css/more.css" />
</head>
<body>

View File

@@ -1,9 +1,10 @@
let argv = require('minimist')(process.argv.slice(2));
let fs = require('fs');
let path = require('path');
let Terser = require('terser');
let CleanCSS = require('clean-css');
let jsdom = require('jsdom');
let JSDOM = jsdom.JSDOM;
let minify = require('minify');
process.on('unhandledRejection', up => { throw up; });
@@ -65,8 +66,17 @@ readStdin(function(html) {
return elements;
};
let processJs = function(things, outFile) {
let terserOptions = {
output: {
comments: false
},
sourceMap: {
includeSources: true,
url: path.basename(outFile) + '.map'
}
};
let processThings = function(things, outFile) {
//remove exluded
excludeFiles.forEach(i => {
let index = things.indexOf(i);
@@ -75,37 +85,35 @@ readStdin(function(html) {
}
});
let processedThings = {};
let code = {};
for (let i = 0; i < things.length; i++) {
let thing = things[i];
code[thing] = fs.readFileSync(thing, 'utf8');
console.log(thing + ' -> ' + outFile);
}
minify(thing)
.then(function(data) {
processedThings[thing] = data;
const data = Terser.minify(code, terserOptions);
fs.writeFileSync(outFile, data.code);
if (data.map) {
fs.writeFileSync(outFile + '.map', data.map);
}
};
if (Object.keys(processedThings).length === things.length) {
//write things
//clear out dist file
fs.writeFileSync(outFile, '');
//write files
for (let i = 0; i < things.length; i++) {
const thing = things[i];
console.log(thing + ' -> ' + outFile);
fs.appendFileSync(outFile, processedThings[thing] + '\n');
}
}
});
let processCss = function(things, outFile) {
fs.writeFileSync(outFile, '');
for (let i = 0; i < things.length; i++) {
let thing = things[i];
console.log(thing + ' -> ' + outFile);
let minified = new CleanCSS().minify(fs.readFileSync(thing, 'utf8'));
fs.appendFileSync(outFile, minified.styles);
}
};
if (argv.js) {
processThings(getTagAttrs(dom, 'script', 'src'), argv.js);
processJs(getTagAttrs(dom, 'script', 'src'), argv.js);
}
if (argv.css) {
processThings(getTagAttrs(dom, 'link', 'href', {rel: 'stylesheet'}), argv.css);
processCss(getTagAttrs(dom, 'link', 'href', {rel: 'stylesheet'}), argv.css);
}
});

View File

@@ -1,32 +1,27 @@
{
"_args": [
[
"minifyfromhtml@1.3.0",
"D:\\Projects\\vanillajs-seed"
]
],
"_development": true,
"_from": "minifyfromhtml@1.3.0",
"_id": "minifyfromhtml@1.3.0",
"_from": "minifyfromhtml@latest",
"_id": "minifyfromhtml@2.0.4",
"_inBundle": false,
"_integrity": "sha512-Q253yAkQd5wdmo+kJgWgtKlcxH+zVjaZP1Jmnpv1r81kUxq8sJcGutKDNRz2VIvvsJIm4UgDyGZ59bQMmNDb/Q==",
"_integrity": "sha512-tg6rSm32T7f/5EiycLN+fVz8KRXqZ/3b/3EAP0v26RkM0ZbN7jl0WBwVz/i8HyRSydZaf9YOeBRurU1OJaaYxg==",
"_location": "/minifyfromhtml",
"_phantomChildren": {},
"_requested": {
"type": "version",
"type": "tag",
"registry": true,
"raw": "minifyfromhtml@1.3.0",
"raw": "minifyfromhtml@latest",
"name": "minifyfromhtml",
"escapedName": "minifyfromhtml",
"rawSpec": "1.3.0",
"rawSpec": "latest",
"saveSpec": null,
"fetchSpec": "1.3.0"
"fetchSpec": "latest"
},
"_requiredBy": [
"#DEV:/"
"#DEV:/",
"#USER"
],
"_resolved": "https://registry.npmjs.org/minifyfromhtml/-/minifyfromhtml-1.3.0.tgz",
"_spec": "1.3.0",
"_resolved": "https://registry.npmjs.org/minifyfromhtml/-/minifyfromhtml-2.0.4.tgz",
"_shasum": "00addc787dbc581c97aff981edf21fa6a0cd49e0",
"_spec": "minifyfromhtml@latest",
"_where": "D:\\Projects\\vanillajs-seed",
"author": "",
"bin": {
@@ -35,11 +30,14 @@
"bugs": {
"url": "https://github.com/S2-/minifyfromhtml/issues"
},
"bundleDependencies": false,
"dependencies": {
"jsdom": "^14.0.0",
"minify": "^5.1.0",
"minimist": "^1.2.0"
"clean-css": "^4.2.3",
"jsdom": "^16.3.0",
"minimist": "^1.2.2",
"terser": "^4.8.0"
},
"deprecated": false,
"description": "minify scripts and css starting from an html file",
"homepage": "https://github.com/S2-/minifyfromhtml#readme",
"keywords": [
@@ -59,5 +57,5 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"version": "1.3.0"
"version": "2.0.4"
}