weboptimizer 4.0.57 → 4.0.59
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/configurator.js +5 -5
- package/ejsLoader.js +7 -5
- package/index.js +13 -9
- package/package.json +9 -9
- package/webpackConfigurator.js +9 -5
package/configurator.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
// region imports
|
|
19
19
|
import { convertCircularObjectToJSON, copy, evaluateAsyncDynamicData, evaluateDynamicData, extend, getUTCTimestamp, importFilesystemAPI, isFileSync, isObject, isPlainObject, Logger, MAXIMAL_NUMBER_OF_ITERATIONS, modifyObject, optionalImport, parseEncodedObject, removeKeyPrefixes, UTILITY_SCOPE } from 'clientnode';
|
|
20
|
-
import fileSystem, {
|
|
20
|
+
import fileSystem, { lstat, readFile, unlink } from 'fs/promises';
|
|
21
21
|
import path, { basename, dirname, join, resolve } from 'path';
|
|
22
22
|
import { determineAssetType, determineModuleFilePath, determineModuleLocations, resolveAutoInjection, resolveBuildConfigurationFilePaths, resolveModulesInFolders, normalizeGivenInjection, normalizePaths } from "./helper.js";
|
|
23
23
|
import packageConfiguration from './package.json' with { type: 'json' };
|
|
@@ -79,7 +79,7 @@ environment = eval('process.env')) => {
|
|
|
79
79
|
hierarchy.
|
|
80
80
|
*/
|
|
81
81
|
try {
|
|
82
|
-
if (
|
|
82
|
+
if ((await lstat(join(currentWorkingDirectory, 'node_modules'))).isSymbolicLink()) metaConfiguration.default.path.context = currentWorkingDirectory;
|
|
83
83
|
} catch {
|
|
84
84
|
// Continue regardless of error.
|
|
85
85
|
}
|
|
@@ -143,11 +143,11 @@ environment = eval('process.env')) => {
|
|
|
143
143
|
givenCommandLineArguments: commandLineArguments
|
|
144
144
|
};
|
|
145
145
|
if (filePath) {
|
|
146
|
-
const fileContent =
|
|
146
|
+
const fileContent = await readFile(filePath, {
|
|
147
147
|
encoding: configuration.encoding
|
|
148
148
|
});
|
|
149
149
|
runtimeInformation = JSON.parse(fileContent);
|
|
150
|
-
|
|
150
|
+
await unlink(filePath);
|
|
151
151
|
}
|
|
152
152
|
//// region task specific configuration
|
|
153
153
|
///// region apply task type specific configuration
|
|
@@ -165,7 +165,7 @@ environment = eval('process.env')) => {
|
|
|
165
165
|
if (Object.prototype.hasOwnProperty.call(result, '__reference__')) {
|
|
166
166
|
const referenceNames = [].concat(result.__reference__);
|
|
167
167
|
delete result.__reference__;
|
|
168
|
-
for (const name of referenceNames) if (Object.prototype.hasOwnProperty.call(configuration, name)) extend(true, result, configuration[name]);else if (isFileSync(name)) extend(true, result, JSON.parse(
|
|
168
|
+
for (const name of referenceNames) if (Object.prototype.hasOwnProperty.call(configuration, name)) extend(true, result, configuration[name]);else if (isFileSync(name)) extend(true, result, JSON.parse(await readFile(name, configuration.encoding)));else log.warn(`Given dynamic referenced configuration "${name}"`, 'could not be resolved.');
|
|
169
169
|
}
|
|
170
170
|
extend(true, modifyObject(configuration, result), result);
|
|
171
171
|
}
|
package/ejsLoader.js
CHANGED
|
@@ -77,11 +77,13 @@ export const loader = async function (source) {
|
|
|
77
77
|
const queryMatch = /^[^?]+\?(.+)$/.exec(request);
|
|
78
78
|
if (queryMatch) {
|
|
79
79
|
const evaluated = evaluate(queryMatch[1], {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
scope: {
|
|
81
|
+
compile,
|
|
82
|
+
locals,
|
|
83
|
+
request,
|
|
84
|
+
source,
|
|
85
|
+
template
|
|
86
|
+
}
|
|
85
87
|
});
|
|
86
88
|
if (evaluated.error) log.warn('Error occurred during processing given query:', evaluated.error);else if (evaluated.result) extend(true, nestedLocals, evaluated.result);
|
|
87
89
|
}
|
package/index.js
CHANGED
|
@@ -220,12 +220,14 @@ environment = eval('process.env')) => {
|
|
|
220
220
|
const expression = buildConfiguration[configuration.givenCommandLineArguments[2]].trim();
|
|
221
221
|
for (const filePath of buildConfiguration.filePaths) if (!testModuleFilePaths.includes(filePath)) {
|
|
222
222
|
const evaluated = evaluate(`\`${expression}\``, {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
223
|
+
scope: {
|
|
224
|
+
global,
|
|
225
|
+
self: configuration,
|
|
226
|
+
buildConfiguration,
|
|
227
|
+
path,
|
|
228
|
+
additionalArguments,
|
|
229
|
+
filePath
|
|
230
|
+
}
|
|
229
231
|
});
|
|
230
232
|
if (evaluated.error) throw new Error('Error occurred during processing given ' + `command: ${evaluated.error}`);
|
|
231
233
|
log.info(`Running "${evaluated.result}"`);
|
|
@@ -247,9 +249,11 @@ environment = eval('process.env')) => {
|
|
|
247
249
|
const tasks = Array.isArray(configuration.commandLine[type]) ? configuration.commandLine[type] : [configuration.commandLine[type]];
|
|
248
250
|
for (const task of tasks) {
|
|
249
251
|
const evaluated = evaluate(Object.prototype.hasOwnProperty.call(task, 'indicator') ? task.indicator : 'true', {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
252
|
+
scope: {
|
|
253
|
+
global,
|
|
254
|
+
self: configuration,
|
|
255
|
+
path
|
|
256
|
+
}
|
|
253
257
|
});
|
|
254
258
|
if (evaluated.error) throw new Error('Error occurred during processing given task: ' + evaluated.error);
|
|
255
259
|
if (evaluated.result) processPromises.push(new Promise((resolve, reject) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weboptimizer",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.59",
|
|
4
4
|
"description": "A generic web optimizer, (module) bundler and development environment.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"babel-loader": "^10.1.1",
|
|
103
103
|
"babel-plugin-polyfill-corejs3": "^1.0.0",
|
|
104
104
|
"babel-plugin-transform-rewrite-imports": "^1.5.4",
|
|
105
|
-
"clientnode": "4.0.
|
|
105
|
+
"clientnode": "4.0.1490",
|
|
106
106
|
"core-js": "^3.50.0",
|
|
107
107
|
"ejs": "^6.0.1",
|
|
108
108
|
"exports-loader": "^5.0.0",
|
|
@@ -130,15 +130,15 @@
|
|
|
130
130
|
"@types/html-minifier": "^4.0.6",
|
|
131
131
|
"@types/html-minifier-terser": "^7.0.2",
|
|
132
132
|
"@types/imagemin": "^9.0.1",
|
|
133
|
-
"@types/node": "^26.
|
|
133
|
+
"@types/node": "^26.3.0",
|
|
134
134
|
"@types/postcss-import": "^14.0.3",
|
|
135
135
|
"@types/postcss-url": "^10.0.4",
|
|
136
136
|
"@types/webpack-env": "^1.18.8",
|
|
137
137
|
"@types/webpack-sources": "^3.2.3",
|
|
138
|
-
"@typescript-eslint/parser": "^8.
|
|
138
|
+
"@typescript-eslint/parser": "^8.68.0",
|
|
139
139
|
"css-loader": "^7.1.4",
|
|
140
140
|
"cssnano": "^8.0.8",
|
|
141
|
-
"eslint": "^10.9.
|
|
141
|
+
"eslint": "^10.9.1",
|
|
142
142
|
"eslint-config-google": "^0.14.0",
|
|
143
143
|
"eslint-plugin-jsdoc": "^64.2.1",
|
|
144
144
|
"favicons": "^7.3.1",
|
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
"postcss-fontpath": "^1.0.0",
|
|
155
155
|
"postcss-import": "^17.0.0",
|
|
156
156
|
"postcss-loader": "^8.2.1",
|
|
157
|
-
"postcss-preset-env": "^11.
|
|
157
|
+
"postcss-preset-env": "^11.5.0",
|
|
158
158
|
"postcss-sprites": "^4.2.1",
|
|
159
159
|
"postcss-url": "^10.1.4",
|
|
160
160
|
"shx": "^0.4.0",
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
"stylelint-config-standard": "^40.0.0",
|
|
164
164
|
"stylelint-config-standard-scss": "^17.0.0",
|
|
165
165
|
"terser-webpack-plugin": "^5.6.1",
|
|
166
|
-
"typescript-eslint": "^8.
|
|
166
|
+
"typescript-eslint": "^8.68.0",
|
|
167
167
|
"typescript-plugin-css-modules": "^5.2.0",
|
|
168
168
|
"web-documentation": "^1.0.49",
|
|
169
169
|
"workbox-webpack-plugin": "^7.4.1"
|
|
@@ -989,7 +989,7 @@
|
|
|
989
989
|
"cssnano": {
|
|
990
990
|
"preset": [
|
|
991
991
|
{
|
|
992
|
-
"__await_evaluate__": "module.optionalImport('cssnano-preset-default')
|
|
992
|
+
"__await_evaluate__": "(await module.optionalImport('cssnano-preset-default'))?.default"
|
|
993
993
|
},
|
|
994
994
|
"#: The autoprefixer has to be disabled in this context since it would remove all needed vendor prefixes from the preceding processing (every prefix should be needed here).",
|
|
995
995
|
{
|
|
@@ -1140,7 +1140,7 @@
|
|
|
1140
1140
|
"pre": []
|
|
1141
1141
|
},
|
|
1142
1142
|
"loader": {
|
|
1143
|
-
"__await_evaluate__": "module.optionalImport('postcss-loader')
|
|
1143
|
+
"__await_evaluate__": "(await module.optionalImport('postcss-loader')) ? 'postcss-loader' : null"
|
|
1144
1144
|
},
|
|
1145
1145
|
"options": {}
|
|
1146
1146
|
},
|
package/webpackConfigurator.js
CHANGED
|
@@ -272,8 +272,10 @@ if (htmlAvailable && plugins.HTML) pluginInstances.push(new HTMLTransformation({
|
|
|
272
272
|
//// region context replacements
|
|
273
273
|
for (const contextReplacement of module.replacements.context) pluginInstances.push(new ContextReplacementPlugin(...contextReplacement.map(value => {
|
|
274
274
|
const evaluated = evaluate(value, {
|
|
275
|
-
|
|
276
|
-
|
|
275
|
+
scope: {
|
|
276
|
+
configuration,
|
|
277
|
+
metaImport: import.meta
|
|
278
|
+
}
|
|
277
279
|
});
|
|
278
280
|
if (evaluated.error) throw new Error('Error occurred during processing given context ' + `replacement: ${evaluated.error}`);
|
|
279
281
|
return evaluated.result;
|
|
@@ -375,9 +377,11 @@ const evaluateOrThrowOnError = (object, givenOptions = {}) => {
|
|
|
375
377
|
};
|
|
376
378
|
if (typeof object === 'string') {
|
|
377
379
|
const evaluated = evaluate(object, {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
380
|
+
scope: {
|
|
381
|
+
filePath: options.filePath,
|
|
382
|
+
...scope,
|
|
383
|
+
type: options.type
|
|
384
|
+
}
|
|
381
385
|
});
|
|
382
386
|
if (evaluated.error) throw new Error('Error occurred during processing given expression: ' + evaluated.error);
|
|
383
387
|
return evaluated.result;
|