weboptimizer 4.0.88 → 4.0.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +34 -11
- package/package.json +8 -9
package/index.js
CHANGED
|
@@ -20,14 +20,13 @@
|
|
|
20
20
|
// region imports
|
|
21
21
|
import { exec as execChildProcess, spawn as spawnChildProcess } from 'child_process';
|
|
22
22
|
import { CLOSE_EVENT_NAMES, copyDirectoryRecursiveSync, copyFileSync, evaluate, getProcessCloseHandler, handleChildProcess, importFilesystemAPI, isDirectory, isDirectorySync, isFile, isFileSync, isPlainObject, Logger, MAXIMAL_NUMBER_OF_ITERATIONS, NOOP, parseEncodedObject, walkDirectoryRecursively } from 'clientnode';
|
|
23
|
-
import { chmodSync, unlinkSync } from 'fs';
|
|
24
|
-
import { writeFile, unlink } from 'fs/promises';
|
|
23
|
+
import { chmodSync, rmSync as removeSync, unlinkSync } from 'fs';
|
|
24
|
+
import { rm as remove, writeFile, unlink } from 'fs/promises';
|
|
25
25
|
import globAll from 'glob-all';
|
|
26
26
|
const {
|
|
27
27
|
sync: globAllSync
|
|
28
28
|
} = globAll;
|
|
29
29
|
import path, { join, resolve } from 'path';
|
|
30
|
-
import { rimraf as removeDirectoryRecursively, sync as removeDirectoryRecursivelySync } from 'rimraf';
|
|
31
30
|
import { load as loadConfiguration } from "./configurator.js";
|
|
32
31
|
import { determineAssetType, determineModuleFilePath, determineModuleLocations, isFilePathInLocation, renderFilePathTemplate, resolveBuildConfigurationFilePaths, stripLoader } from "./helper.js";
|
|
33
32
|
// endregion
|
|
@@ -123,7 +122,10 @@ environment = eval('process.env')) => {
|
|
|
123
122
|
if (isFilePathInLocation(file.path, configuration.path.ignore.concat(configuration.module.directoryNames, configuration.loader.directoryNames).map(filePath => resolve(configuration.path.context, filePath)).filter(filePath => !configuration.path.context.startsWith(filePath)))) return false;
|
|
124
123
|
for (const type in configuration.buildContext.types) if (new RegExp(configuration.buildContext.types[type].filePathPattern).test(file.path)) {
|
|
125
124
|
if (file.stats?.isDirectory()) {
|
|
126
|
-
await
|
|
125
|
+
await remove(file.path, {
|
|
126
|
+
force: true,
|
|
127
|
+
recursive: true
|
|
128
|
+
});
|
|
127
129
|
return false;
|
|
128
130
|
}
|
|
129
131
|
await unlink(file.path);
|
|
@@ -131,12 +133,24 @@ environment = eval('process.env')) => {
|
|
|
131
133
|
}
|
|
132
134
|
});
|
|
133
135
|
for (const file of await walkDirectoryRecursively(configuration.path.target.base, () => false, configuration.encoding)) if (file.name.startsWith('npm-debug')) await unlink(file.path);
|
|
134
|
-
} else await
|
|
135
|
-
|
|
136
|
+
} else await remove(configuration.path.target.base, {
|
|
137
|
+
force: true,
|
|
138
|
+
recursive: true
|
|
139
|
+
});
|
|
140
|
+
if (await isDirectory(configuration.path.apiDocumentation)) await remove(configuration.path.apiDocumentation, {
|
|
141
|
+
force: true,
|
|
142
|
+
recursive: true
|
|
143
|
+
});
|
|
136
144
|
for (const filePath of configuration.path.tidyUpOnClear) if (filePath) if (isFileSync(filePath))
|
|
137
145
|
// NOTE: Close handler have to be synchronous.
|
|
138
|
-
unlinkSync(filePath);else if (isDirectorySync(filePath))
|
|
139
|
-
|
|
146
|
+
unlinkSync(filePath);else if (isDirectorySync(filePath)) removeSync(filePath, {
|
|
147
|
+
force: true,
|
|
148
|
+
recursive: true
|
|
149
|
+
});
|
|
150
|
+
for (const filePath of globAllSync(configuration.path.tidyUpOnClearGlobs)) removeSync(filePath, {
|
|
151
|
+
force: true,
|
|
152
|
+
recursive: true
|
|
153
|
+
});
|
|
140
154
|
}
|
|
141
155
|
// endregion
|
|
142
156
|
// region handle build
|
|
@@ -169,8 +183,14 @@ environment = eval('process.env')) => {
|
|
|
169
183
|
}
|
|
170
184
|
for (const filePath of configuration.path.tidyUp) if (filePath) if (isFileSync(filePath))
|
|
171
185
|
// NOTE: Close handler have to be synchronous.
|
|
172
|
-
unlinkSync(filePath);else if (isDirectorySync(filePath))
|
|
173
|
-
|
|
186
|
+
unlinkSync(filePath);else if (isDirectorySync(filePath)) removeSync(filePath, {
|
|
187
|
+
force: true,
|
|
188
|
+
recursive: true
|
|
189
|
+
});
|
|
190
|
+
for (const filePath of globAllSync(configuration.path.tidyUpGlobs)) removeSync(filePath, {
|
|
191
|
+
force: true,
|
|
192
|
+
recursive: true
|
|
193
|
+
});
|
|
174
194
|
};
|
|
175
195
|
closeEventHandlers.push(tidyUp);
|
|
176
196
|
|
|
@@ -197,7 +217,10 @@ environment = eval('process.env')) => {
|
|
|
197
217
|
|
|
198
218
|
// NOTE: Close handler have to be synchronous.
|
|
199
219
|
if (isDirectorySync(sourcePath)) {
|
|
200
|
-
if (isDirectorySync(targetPath))
|
|
220
|
+
if (isDirectorySync(targetPath)) removeSync(targetPath, {
|
|
221
|
+
force: true,
|
|
222
|
+
recursive: true
|
|
223
|
+
});
|
|
201
224
|
copyDirectoryRecursiveSync(sourcePath, targetPath);
|
|
202
225
|
} else if (isFileSync(sourcePath)) copyFileSync(sourcePath, targetPath);
|
|
203
226
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weboptimizer",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.90",
|
|
4
4
|
"description": "A generic web optimizer, (module) bundler and development environment.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"sideEffects": true,
|
|
75
75
|
"scripts": {
|
|
76
76
|
"build": "yarn build:types && yarn build:lint && yarn build:plain",
|
|
77
|
-
"build:copy-test-artefacts": "cd test/simple && shx touch yarn.lock &&
|
|
77
|
+
"build:copy-test-artefacts": "cd test/simple && shx touch yarn.lock && shx rm -rf node_modules && YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install; cd ../../ && cd test/scss && shx touch yarn.lock && shx rm -rf node_modules && YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install; cd ../../ && shx rm -rf node_modules/weboptimizer test/simple/node_modules/weboptimizer test/scss/node_modules/weboptimizer && shx mkdir -p node_modules/weboptimizer test/simple/node_modules/weboptimizer test/scss/node_modules/weboptimizer && copyCommand='shx cp -r plugins *.ts *.js *.json *.ejs' && $copyCommand node_modules/weboptimizer/ && $copyCommand test/simple/node_modules/weboptimizer/ && $copyCommand test/scss/node_modules/weboptimizer/",
|
|
78
78
|
"build:lint": " babel --extensions '.ts' --out-file eslint.config.js eslint.config.ts",
|
|
79
79
|
"build:plain": "command=\"babel --extensions '.ts' --out-file\" && $command browser.js browser.ts && $command configurator.js configurator.ts && $command ejsLoader.js ejsLoader.ts && $command helper.js helper.ts && $command index.js index.ts && $command jestSetup.js jestSetup.ts && $command plugins/HTMLTransformation.js plugins/HTMLTransformation.ts && $command plugins/InPlaceAssetsIntoHTML.js plugins/InPlaceAssetsIntoHTML.ts && $command stylelintConfigurator.js stylelintConfigurator.ts && $command type.js type.ts && $command webpackConfigurator.js webpackConfigurator.ts && shx chmod +x index.js && shx sed -i 's/(#!\\\\/usr\\\\/bin\\\\/env )babel-(node)/$1$2/' index.js 1>/dev/null",
|
|
80
80
|
"build:test": " yarn clear && yarn build && command='babel --extensions '.ts' --source-root ../ --out-file' && yarn build:copy-test-artefacts && $command test/browser.js test/browser.ts && $command test/configurator.js test/configurator.ts && $command test/helper.js test/helper.ts && $command test/ejsLoader.js test/ejsLoader.ts && $command test/stylelintConfigurator.js test/stylelintConfigurator.ts && $command test/index.js test/index.ts && $command test/webpackConfigurator.js test/webpackConfigurator.ts",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"build:types": "tsc --declaration --emitDeclarationOnly",
|
|
83
83
|
"check": "yarn check:types && yarn lint",
|
|
84
84
|
"check:types": "tsc --noEmit",
|
|
85
|
-
"clear": "
|
|
85
|
+
"clear": "shx rm -rf apiDocumentation browser.d.ts configurator.d.ts ejsLoader.d.ts eslint.config.d.ts helper.d.ts index.d.ts jestSetup.d.ts 'plugins/*.d.ts' 'plugins/*.js' stylelintConfigurator.d.ts 'test/*.js' 'test/*.compiled.*' 'test/*.d.ts' 'test/**/yarn.lock' 'test/**/node_modules' type.d.ts webpackConfigurator.d.ts '*.compiled.*' '*.compiled' '*.html' '*.js' '*.log' node_modules/weboptimizer .coverage .nyc_output",
|
|
86
86
|
"document": "yarn build:plain && jsdoc --package ./package.json --readme ./readme.md --destination apiDocumentation *.js",
|
|
87
87
|
"lint": "yarn build:lint && yarn lint:base",
|
|
88
88
|
"lint:base": "eslint --no-warn-ignored *.ts */*.ts test/*/*.ts",
|
|
@@ -106,9 +106,9 @@
|
|
|
106
106
|
"babel-loader": "^10.1.1",
|
|
107
107
|
"babel-plugin-polyfill-corejs3": "^1.0.0",
|
|
108
108
|
"babel-plugin-transform-rewrite-imports": "^1.5.4",
|
|
109
|
-
"clientnode": "4.0.
|
|
109
|
+
"clientnode": "4.0.1523",
|
|
110
110
|
"core-js": "^3.50.0",
|
|
111
|
-
"ejs": "^7.0.
|
|
111
|
+
"ejs": "^7.0.2",
|
|
112
112
|
"exports-loader": "^5.0.0",
|
|
113
113
|
"extract-loader": "^5.1.0",
|
|
114
114
|
"glob-all": "^3.3.1",
|
|
@@ -117,7 +117,6 @@
|
|
|
117
117
|
"html-webpack-plugin": "^5.6.8",
|
|
118
118
|
"imports-loader": "^5.0.0",
|
|
119
119
|
"jest-environment-jsdom": "^30.5.2",
|
|
120
|
-
"rimraf": "^6.1.3",
|
|
121
120
|
"script-loader": "^0.7.2",
|
|
122
121
|
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
123
122
|
"webpack": "5.112.0",
|
|
@@ -144,7 +143,7 @@
|
|
|
144
143
|
"cssnano": "^9.9.0",
|
|
145
144
|
"eslint": "^10.13.0",
|
|
146
145
|
"eslint-config-google": "^0.14.0",
|
|
147
|
-
"eslint-plugin-jsdoc": "^65.3.
|
|
146
|
+
"eslint-plugin-jsdoc": "^65.3.12",
|
|
148
147
|
"favicons": "^7.3.1",
|
|
149
148
|
"favicons-webpack-plugin": "^6.0.1",
|
|
150
149
|
"globals": "^17.13.0",
|
|
@@ -169,7 +168,7 @@
|
|
|
169
168
|
"terser-webpack-plugin": "^5.6.1",
|
|
170
169
|
"typescript-eslint": "^8.71.2",
|
|
171
170
|
"typescript-plugin-css-modules": "^5.2.0",
|
|
172
|
-
"web-documentation": "^1.0.
|
|
171
|
+
"web-documentation": "^1.0.63",
|
|
173
172
|
"workbox-webpack-plugin": "^7.4.1"
|
|
174
173
|
},
|
|
175
174
|
"peerDependencies": {
|
|
@@ -1781,5 +1780,5 @@
|
|
|
1781
1780
|
"webDocumentation": {
|
|
1782
1781
|
"trackingCode": "UA-40192634-11"
|
|
1783
1782
|
},
|
|
1784
|
-
"packageManager": "yarn@4.18.
|
|
1783
|
+
"packageManager": "yarn@4.18.1+sha512.b2e1e7524f654f2749d32b4ebcb4622473cb5bcbc485df2007e12a154e50162a4d795526768bc5f5b8f81717bfd79deb2472813d86fb5ae2eb551fa9c872b08f"
|
|
1785
1784
|
}
|