weboptimizer 4.0.85 → 4.0.86

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/browser.js CHANGED
@@ -46,7 +46,7 @@ if (typeof TARGET_TECHNOLOGY === 'undefined' || TARGET_TECHNOLOGY === 'node') {
46
46
  const virtualConsole = new VirtualConsoleImplementation();
47
47
  for (const name of CONSOLE_METHODS) virtualConsole.on(name, console[name].bind(console));
48
48
  virtualConsole.on('error', error => {
49
- if (!browser.debug && ['XMLHttpRequest', 'resource loading'].includes(error.type)) log.warn(`Loading resource failed: ${error.toString()}.`);else log.error(error.stack, error.detail);
49
+ if (!browser.debug && ['XMLHttpRequest', 'resource loading'].includes(error.type)) void log.warn(`Loading resource failed: ${error.toString()}.`);else void log.error(error.stack, error.detail);
50
50
  });
51
51
  const render = template => {
52
52
  browser.DOM = JSDOM;
package/configurator.js CHANGED
@@ -166,7 +166,7 @@ environment = eval('process.env')) => {
166
166
  if (Object.prototype.hasOwnProperty.call(result, '__reference__')) {
167
167
  const referenceNames = [].concat(result.__reference__);
168
168
  delete result.__reference__;
169
- for (const name of referenceNames) if (Object.prototype.hasOwnProperty.call(configuration, name)) extend(true, result, configuration[name]);else if (await isFile(name)) extend(true, result, JSON.parse(await readFile(name, configuration.encoding)));else log.warn(`Given dynamic referenced configuration "${name}"`, 'could not be resolved.');
169
+ for (const name of referenceNames) if (Object.prototype.hasOwnProperty.call(configuration, name)) extend(true, result, configuration[name]);else if (await isFile(name)) extend(true, result, JSON.parse(await readFile(name, configuration.encoding)));else void log.warn(`Given dynamic referenced configuration "${name}"`, 'could not be resolved.');
170
170
  }
171
171
  extend(true, modifyObject(configuration, result), result);
172
172
  }
package/ejsLoader.js CHANGED
@@ -85,7 +85,7 @@ export const loader = async function (source) {
85
85
  template
86
86
  }
87
87
  });
88
- if (evaluated.error) log.warn('Error occurred during processing given query:', evaluated.error);else if (evaluated.result) extend(true, nestedLocals, evaluated.result);
88
+ if (evaluated.error) void log.warn('Error occurred during processing given query:', evaluated.error);else if (evaluated.result) extend(true, nestedLocals, evaluated.result);
89
89
  }
90
90
  let nestedOptions = copy(options);
91
91
  delete nestedOptions.client;
package/helper.js CHANGED
@@ -473,7 +473,7 @@ export const determineModuleFilePathInPackage = (packagePath, packageMainPropert
473
473
  encoding
474
474
  }));
475
475
  } catch (error) {
476
- log.warn(`Package configuration file "${pathToPackageJSON}"`, `could not parsed: ${represent(error)}`);
476
+ void log.warn(`Package configuration file "${pathToPackageJSON}"`, `could not parsed: ${represent(error)}`);
477
477
  }
478
478
  for (const propertyName of packageMainPropertyNames) if (Object.prototype.hasOwnProperty.call(localConfiguration, propertyName) && typeof localConfiguration[propertyName] === 'string' && localConfiguration[propertyName]) {
479
479
  result.fileName = localConfiguration[propertyName];
package/index.js CHANGED
@@ -180,7 +180,7 @@ environment = eval('process.env')) => {
180
180
  */
181
181
  processPromises.push(new Promise((resolve, reject) => {
182
182
  const commandLineArguments = (configuration.commandLine.build.arguments || []).concat(additionalArguments);
183
- log.info('Running "' + (`${configuration.commandLine.build.command} ` + commandLineArguments.join(' ')).trim() + '"');
183
+ void log.info('Running "' + (`${configuration.commandLine.build.command} ` + commandLineArguments.join(' ')).trim() + '"');
184
184
 
185
185
  /*
186
186
  NOTE: Take current weboptimizer's dependencies into
@@ -230,7 +230,7 @@ environment = eval('process.env')) => {
230
230
  }
231
231
  });
232
232
  if (evaluated.error) throw new Error('Error occurred during processing given ' + `command: ${evaluated.error}`);
233
- log.info(`Running "${evaluated.result}"`);
233
+ void log.info(`Running "${evaluated.result}"`);
234
234
  processPromises.push(new Promise((resolve, reject) => [handleChildProcess(execChildProcess(evaluated.result, {
235
235
  encoding: configuration.encoding,
236
236
  ...processOptions
@@ -258,7 +258,7 @@ environment = eval('process.env')) => {
258
258
  if (evaluated.error) throw new Error('Error occurred during processing given task: ' + evaluated.error);
259
259
  if (evaluated.result) processPromises.push(new Promise((resolve, reject) => {
260
260
  const commandLineArguments = (task.arguments || []).concat(additionalArguments);
261
- log.info('Running "' + (`${task.command} ` + commandLineArguments.join(' ')).trim() + '"');
261
+ void log.info('Running "' + (`${task.command} ` + commandLineArguments.join(' ')).trim() + '"');
262
262
  const childProcess = spawnChildProcess(task.command, commandLineArguments, childProcessOptions);
263
263
  const closeHandler = getProcessCloseHandler(resolve, reject);
264
264
  for (const closeEventName of CLOSE_EVENT_NAMES) childProcess.on(closeEventName, closeHandler);
@@ -281,19 +281,19 @@ environment = eval('process.env')) => {
281
281
  finished = true;
282
282
  };
283
283
  for (const closeEventName of CLOSE_EVENT_NAMES) process.on(closeEventName, closeHandler);
284
- if (import.meta.main && (configuration.givenCommandLineArguments.length < 3 || !possibleArguments.includes(configuration.givenCommandLineArguments[2]))) log.info(`Give one of "${possibleArguments.join('", "')}" as command`, 'line argument. You can provide a json string as second', 'parameter to dynamically overwrite some configurations.\n');
284
+ if (import.meta.main && (configuration.givenCommandLineArguments.length < 3 || !possibleArguments.includes(configuration.givenCommandLineArguments[2]))) void log.info(`Give one of "${possibleArguments.join('", "')}" as command`, 'line argument. You can provide a json string as second', 'parameter to dynamically overwrite some configurations.\n');
285
285
  // endregion
286
286
  // region forward nested return codes
287
287
  try {
288
288
  await Promise.all(processPromises);
289
289
  } catch (error) {
290
- log.error(error);
290
+ void log.error(error);
291
291
  process.exit(error.returnCode);
292
292
  }
293
293
  // endregion
294
294
  } catch (error) {
295
295
  if (configuration.debug) throw error;else {
296
- log.error(error);
296
+ void log.error(error);
297
297
 
298
298
  // NOTE: Forward nested return codes.
299
299
  process.exitCode = error.returnCode ?? 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weboptimizer",
3
- "version": "4.0.85",
3
+ "version": "4.0.86",
4
4
  "description": "A generic web optimizer, (module) bundler and development environment.",
5
5
  "keywords": [
6
6
  "webpack",
@@ -73,14 +73,14 @@
73
73
  ],
74
74
  "sideEffects": true,
75
75
  "scripts": {
76
- "build": "yarn build:types; yarn build:lint; yarn build:plain",
76
+ "build": "yarn build:types && yarn build:lint && yarn build:plain",
77
77
  "build:copy-test-artefacts": "cd test/simple && shx touch yarn.lock && rimraf node_modules && YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install; cd ../../ && cd test/scss && shx touch yarn.lock && rimraf node_modules && YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install; cd ../../ && rimraf 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",
81
81
  "build:test:source-map": "yarn clear && yarn build && command='babel --extensions '.ts' --source-maps inline --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
82
  "build:types": "tsc --declaration --emitDeclarationOnly",
83
- "check": "yarn check:types; yarn lint",
83
+ "check": "yarn check:types && yarn lint",
84
84
  "check:types": "tsc --noEmit",
85
85
  "clear": "rimraf --glob 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",
@@ -106,7 +106,7 @@
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.1517",
109
+ "clientnode": "4.0.1521",
110
110
  "core-js": "^3.50.0",
111
111
  "ejs": "^6.0.1",
112
112
  "exports-loader": "^5.0.0",
@@ -134,17 +134,17 @@
134
134
  "@types/html-minifier": "^4.0.6",
135
135
  "@types/html-minifier-terser": "^7.0.2",
136
136
  "@types/imagemin": "^9.0.1",
137
- "@types/node": "^26.5.1",
137
+ "@types/node": "^26.6.1",
138
138
  "@types/postcss-import": "^14.0.3",
139
139
  "@types/postcss-url": "^10.0.4",
140
140
  "@types/webpack-env": "^1.18.8",
141
141
  "@types/webpack-sources": "^3.2.3",
142
142
  "@typescript-eslint/parser": "^8.70.0",
143
143
  "css-loader": "^7.1.5",
144
- "cssnano": "^9.0.4",
144
+ "cssnano": "^9.0.5",
145
145
  "eslint": "^10.10.0",
146
146
  "eslint-config-google": "^0.14.0",
147
- "eslint-plugin-jsdoc": "^64.4.0",
147
+ "eslint-plugin-jsdoc": "^64.5.2",
148
148
  "favicons": "^7.3.1",
149
149
  "favicons-webpack-plugin": "^6.0.1",
150
150
  "globals": "^17.12.0",
@@ -169,7 +169,7 @@
169
169
  "terser-webpack-plugin": "^5.6.1",
170
170
  "typescript-eslint": "^8.70.0",
171
171
  "typescript-plugin-css-modules": "^5.2.0",
172
- "web-documentation": "^1.0.55",
172
+ "web-documentation": "^1.0.60",
173
173
  "workbox-webpack-plugin": "^7.4.1"
174
174
  },
175
175
  "peerDependencies": {
package/readme.md CHANGED
@@ -10,7 +10,8 @@ This library written by Torben Sickert stands under a creative commons naming
10
10
  3.0 unported license. See https://creativecommons.org/licenses/by/3.0/deed.de
11
11
  endregion -->
12
12
 
13
- Project status
13
+ <!--|deDE:Projektstatus-->
14
+ Project Status
14
15
  --------------
15
16
 
16
17
  [![npm](https://img.shields.io/npm/v/weboptimizer?color=%23d55e5d&label=npm%20package%20version&logoColor=%23d55e5d&style=for-the-badge)](https://www.npmjs.com/package/weboptimizer)
@@ -30,6 +31,7 @@ Project status
30
31
 
31
32
  [![Open in CodeSandbox](https://img.shields.io/badge/Open%20in-CodeSandbox-blue?style=for-the-badge&logo=codesandbox)](https://githubbox.com/thaibault/weboptimizer)
32
33
 
34
+ <!--|deDE:Verwendung-->
33
35
  Use case
34
36
  --------
35
37
 
@@ -39,10 +41,9 @@ or node. All native web types like html, css and JavaScript are supported
39
41
  natively in their latest language specification through preconfigured
40
42
  transpiler.
41
43
 
42
- <!--Place for automatic generated table of contents.-->
43
- <div class="doc-toc" style="display:none">
44
- <!--|deDE:Inhalt-->
45
- <h2 id="content">Content</h2>
44
+ <div class="wd-table-of-contents">
45
+ <h2 id="content">Content<!--deDE:Inhalt--><!--frFR:Contenu--></h2>
46
+ <!--wd-table-of-contents-->
46
47
  </div>
47
48
 
48
49
  Features
@@ -96,22 +97,23 @@ Features
96
97
  Installation
97
98
  ------------
98
99
 
99
- Edit your **package.json** to add **one** dependency:
100
+ You can install via package manager, simply download the compiled version as
101
+ zip file here and inject or request via CDN in HTML:
102
+ <!--deDE:
103
+ Sie können das Paket über den Paketmanager installieren oder einfach die
104
+ kompilierte Version als ZIP-Datei hier herunterladen und in HTML einbinden
105
+ oder über ein CDN abrufen:
106
+ -->
107
+ <!--frFR:
108
+ Vous pouvez installer le paquet via le gestionnaire de paquets ou
109
+ simplement télécharger ici la version compilée sous forme de fichier ZIP,
110
+ puis l'intégrer dans une page HTML ou la récupérer via un CDN:
111
+ -->
100
112
 
101
- ```JSON
102
- ...
103
- "dependencies": {
104
- ...
105
- "weboptimizer": "latest",
106
- ...
107
- },
108
- ...
113
+ ```bash
114
+ npm install weboptimizer
109
115
  ```
110
116
 
111
- Update your **packages** via npm and have fun:
112
-
113
- npm update
114
-
115
117
  Configuration
116
118
  -------------
117
119
 
@@ -93,7 +93,7 @@ for (const [name, alias] of Object.entries(pluginNameResourceMapping)) {
93
93
  const plugin = await optionalImport(alias);
94
94
  if (plugin) {
95
95
  if ('default' in plugin) plugins[name] = plugin.default;else plugins[name] = plugin;
96
- } else log.debug(`Optional webpack plugin "${name}" not available.`);
96
+ } else void log.debug(`Optional webpack plugin "${name}" not available.`);
97
97
  }
98
98
 
99
99
  // endregion
@@ -350,7 +350,7 @@ if (module.enforceDeduplication) {
350
350
  const otherPackageDescriptor = await getClosestPackageDescriptor(alternateTargetPath);
351
351
  if (otherPackageDescriptor) {
352
352
  if (packageDescriptor.configuration.version === otherPackageDescriptor.configuration.version) {
353
- log.info('\nConsolidate module request', `"${targetPath}" to`, `"${alternateTargetPath}".`);
353
+ void log.info('\nConsolidate module request', `"${targetPath}" to`, `"${alternateTargetPath}".`);
354
354
  /*
355
355
  NOTE: Only overwriting
356
356
  "result.createData.resource" like
@@ -368,7 +368,7 @@ if (module.enforceDeduplication) {
368
368
  }
369
369
  }
370
370
  }
371
- if (redundantRequest) log.warn('\nIncluding different versions of same package', `"${packageDescriptor.configuration.name}". Module`, `"${targetPath}" (version`, `${packageDescriptor.configuration.version}) has`, `redundancies with "${redundantRequest.path}"`, `(version ${redundantRequest.version}).`);
371
+ if (redundantRequest) void log.warn('\nIncluding different versions of same package', `"${packageDescriptor.configuration.name}". Module`, `"${targetPath}" (version`, `${packageDescriptor.configuration.version}) has`, `redundancies with "${redundantRequest.path}"`, `(version ${redundantRequest.version}).`);
372
372
  }
373
373
  }
374
374
  };
@@ -758,7 +758,7 @@ for (const pluginConfiguration of configuration.plugins) {
758
758
  if (plugin) {
759
759
  if ('default' in plugin) plugin = plugin.default;
760
760
  pluginInstances.push(new plugin[pluginConfiguration.name.initializer](...pluginConfiguration.parameters));
761
- } else log.warn(`Configured plugin module "${pluginConfiguration.name.module}"`, 'could not be loaded.');
761
+ } else void log.warn(`Configured plugin module "${pluginConfiguration.name.module}"`, 'could not be loaded.');
762
762
  }
763
763
  // endregion
764
764
  // region minimizer and image compression
@@ -785,10 +785,10 @@ if (configuration.path.configuration.json) try {
785
785
  try {
786
786
  customConfiguration = await import(configuration.path.configuration.json);
787
787
  } catch (error) {
788
- log.debug('Importing provided json webpack configuration file path', `under "${configuration.path.configuration.json}" failed:`, represent(error));
788
+ void log.debug('Importing provided json webpack configuration file path', `under "${configuration.path.configuration.json}" failed:`, represent(error));
789
789
  }
790
790
  } catch {
791
- log.debug('Optional configuration file', `"${configuration.path.configuration.json}" not available.`);
791
+ void log.debug('Optional configuration file', `"${configuration.path.configuration.json}" not available.`);
792
792
  }
793
793
 
794
794
  // region collapse multi-module ("multi-main") entry chunks into a barrel
@@ -838,7 +838,7 @@ if (generatedBarrelModuleFilePaths.length) pluginInstances.push({
838
838
  force: true
839
839
  });
840
840
  } catch (error) {
841
- log.debug('Removing generated barrel entry module ' + `"${filePath}" failed:`, represent(error));
841
+ void log.debug('Removing generated barrel entry module ' + `"${filePath}" failed:`, represent(error));
842
842
  }
843
843
  };
844
844
 
@@ -1019,15 +1019,15 @@ if (configuration.path.configuration.javaScript) try {
1019
1019
  if (isPlainObject(result)) {
1020
1020
  if ('default' in result) result = result.default;
1021
1021
  if ('replaceWebOptimizer' in result) webpackConfiguration = result.replaceWebOptimizer;else extend(true, webpackConfiguration, result);
1022
- } else log.debug('Failed to load given JavaScript configuration file path', `"${configuration.path.configuration.javaScript}".`);
1022
+ } else void log.debug('Failed to load given JavaScript configuration file path', `"${configuration.path.configuration.javaScript}".`);
1023
1023
  } catch {
1024
- log.debug('Optional configuration file script', `"${configuration.path.configuration.javaScript}" not available.`);
1024
+ void log.debug('Optional configuration file script', `"${configuration.path.configuration.javaScript}" not available.`);
1025
1025
  }
1026
- log.debug('Using internal configuration:', util.inspect(configuration, {
1026
+ void log.debug('Using internal configuration:', util.inspect(configuration, {
1027
1027
  depth: null
1028
1028
  }));
1029
- log.debug('-----------------------------------------------------------');
1030
- log.debug('Using webpack configuration:', util.inspect(webpackConfiguration, {
1029
+ void log.debug('-----------------------------------------------------------');
1030
+ void log.debug('Using webpack configuration:', util.inspect(webpackConfiguration, {
1031
1031
  depth: null
1032
1032
  }));
1033
1033