weboptimizer 2.0.1498 → 2.0.1500
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 +1 -1
- package/declarations.d.ts +27 -27
- package/ejsLoader.js +1 -1
- package/eslint.config.mjs +3 -13
- package/index.js +7 -7
- package/package.json +17 -16
- package/type.d.ts +1 -1
- package/webpackConfigurator.js +34 -34
package/configurator.js
CHANGED
|
@@ -150,7 +150,7 @@ var load = exports.load = function load(context) {
|
|
|
150
150
|
try {
|
|
151
151
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
152
152
|
var type = _step.value;
|
|
153
|
-
if (runtimeInformation.givenCommandLineArguments[2] === type || debug && type === 'debug' || type === 'test' && runtimeInformation.givenCommandLineArguments[2].startsWith('test:') && runtimeInformation.givenCommandLineArguments[2] !== 'test:browser') for (var _i = 0, _arr = [configuration, specificConfiguration]; _i < _arr.length; _i++) {
|
|
153
|
+
if (runtimeInformation.givenCommandLineArguments[2] === type || debug && type === 'debug' || type === 'test' && runtimeInformation.givenCommandLineArguments[2].startsWith('test: ') && runtimeInformation.givenCommandLineArguments[2] !== 'test:browser') for (var _i = 0, _arr = [configuration, specificConfiguration]; _i < _arr.length; _i++) {
|
|
154
154
|
var configurationTarget = _arr[_i];
|
|
155
155
|
if ((0, _clientnode.isPlainObject)(configurationTarget[type])) (0, _clientnode.extend)(true, (0, _clientnode.modifyObject)(configurationTarget, configurationTarget[type]), configurationTarget[type]);
|
|
156
156
|
}
|
package/declarations.d.ts
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
type Mapping<T = string> = Record<string, T>
|
|
7
7
|
|
|
8
8
|
interface PostcssTransformer {
|
|
9
|
-
postcssPlugin:string
|
|
10
|
-
postcssVersion:string
|
|
9
|
+
postcssPlugin: string
|
|
10
|
+
postcssVersion: string
|
|
11
11
|
|
|
12
|
-
(root:object, result:object):Promise<void>|void
|
|
12
|
+
(root: object, result: object): Promise<void>|void
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
/** @module declarations */
|
|
@@ -19,58 +19,58 @@ declare module '@typescript-eslint/parser'
|
|
|
19
19
|
declare module 'babel-preset-minify'
|
|
20
20
|
declare module 'eslint-config-google'
|
|
21
21
|
declare module 'glob-all' {
|
|
22
|
-
export default function(globs:Array<string>):Promise<Array<string>>
|
|
23
|
-
export function sync(globs:Array<string>):Array<string>
|
|
22
|
+
export default function(globs: Array<string>): Promise<Array<string>>
|
|
23
|
+
export function sync(globs: Array<string>): Array<string>
|
|
24
24
|
}
|
|
25
25
|
declare module 'html-loader'
|
|
26
26
|
declare module 'postcss-fontpath' {
|
|
27
|
-
export default function(options:Partial<{
|
|
28
|
-
checkPath:boolean
|
|
29
|
-
formats:Array<{
|
|
30
|
-
ext:string
|
|
31
|
-
type:string
|
|
27
|
+
export default function(options: Partial<{
|
|
28
|
+
checkPath: boolean
|
|
29
|
+
formats: Array<{
|
|
30
|
+
ext: string
|
|
31
|
+
type: string
|
|
32
32
|
}>
|
|
33
|
-
}>):PostcssTransformer
|
|
33
|
+
}>): PostcssTransformer
|
|
34
34
|
}
|
|
35
35
|
declare module 'postcss-sprites' {
|
|
36
|
-
export default function(options:Partial<{
|
|
37
|
-
filterBy:() => Promise<void>
|
|
38
|
-
hooks:{
|
|
39
|
-
onSaveSpritesheet:(
|
|
40
|
-
onUpdateRule:(
|
|
41
|
-
|
|
36
|
+
export default function(options: Partial<{
|
|
37
|
+
filterBy: () => Promise<void>
|
|
38
|
+
hooks: {
|
|
39
|
+
onSaveSpritesheet: (image: Mapping<unknown>) => string
|
|
40
|
+
onUpdateRule: (
|
|
41
|
+
rule: PostcssNode, token: PostcssNode, image: Mapping<unknown>
|
|
42
42
|
) => void
|
|
43
43
|
}
|
|
44
|
-
spritePath:string
|
|
45
|
-
stylesheetPath:null|string
|
|
46
|
-
verbose:boolean
|
|
47
|
-
}>):PostcssTransformer
|
|
44
|
+
spritePath: string
|
|
45
|
+
stylesheetPath: null|string
|
|
46
|
+
verbose: boolean
|
|
47
|
+
}>): PostcssTransformer
|
|
48
48
|
}
|
|
49
49
|
declare module 'svgo' {
|
|
50
50
|
export type Options = unknown
|
|
51
51
|
}
|
|
52
52
|
declare module 'webOptimizerDefaultTemplateFilePath'
|
|
53
53
|
declare module '*.module' {
|
|
54
|
-
const classes:Mapping
|
|
54
|
+
const classes: Mapping
|
|
55
55
|
export default classes
|
|
56
56
|
}
|
|
57
57
|
declare module '*.module.css' {
|
|
58
|
-
const classes:Mapping
|
|
58
|
+
const classes: Mapping
|
|
59
59
|
export default classes
|
|
60
60
|
}
|
|
61
61
|
declare module '*.module.scss' {
|
|
62
|
-
const classes:Mapping
|
|
62
|
+
const classes: Mapping
|
|
63
63
|
export default classes
|
|
64
64
|
}
|
|
65
65
|
declare module '*.module.sass' {
|
|
66
|
-
const classes:Mapping
|
|
66
|
+
const classes: Mapping
|
|
67
67
|
export default classes
|
|
68
68
|
}
|
|
69
69
|
declare module '*.module.less' {
|
|
70
|
-
const classes:Mapping
|
|
70
|
+
const classes: Mapping
|
|
71
71
|
export default classes
|
|
72
72
|
}
|
|
73
73
|
declare module '*.module.styl' {
|
|
74
|
-
const classes:Mapping
|
|
74
|
+
const classes: Mapping
|
|
75
75
|
export default classes
|
|
76
76
|
}
|
package/ejsLoader.js
CHANGED
|
@@ -216,7 +216,7 @@ var loader = exports.loader = function loader(source) {
|
|
|
216
216
|
return "".concat(options.strict ? "'use strict';\n" : '').concat(code);
|
|
217
217
|
}
|
|
218
218
|
if (typeof result === 'string') {
|
|
219
|
-
result = result.replace(new RegExp("<script +processing-workaround *" + "(
|
|
219
|
+
result = result.replace(new RegExp("<script +processing-workaround *" + "(?: = *(?: \" *\"|' *') *)?>([\\s\\S]*?)</ *script *>", 'ig'), '$1').replace(new RegExp("<script +processing(-+)-workaround *" + "(?: = *(?: \" *\"|' *') *)?>([\\s\\S]*?)</ *script *>", 'ig'), '<script processing$1workaround>$2</script>');
|
|
220
220
|
return result;
|
|
221
221
|
}
|
|
222
222
|
return '';
|
package/eslint.config.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import eslintjs from '@eslint/js';
|
|
2
2
|
import typescriptPlugin from '@stylistic/eslint-plugin-ts';
|
|
3
3
|
import typescriptParser from '@typescript-eslint/parser';
|
|
4
|
-
import tseslint from 'typescript-eslint';
|
|
5
4
|
import google from 'eslint-config-google';
|
|
6
5
|
import jsdoc from 'eslint-plugin-jsdoc';
|
|
7
6
|
import { readFile, stat } from 'fs/promises';
|
|
@@ -38,8 +37,8 @@ for (const filePath of ['./tsconfig.json', './node_modules/weboptimizer/tsconfig
|
|
|
38
37
|
tsConfigFilePath = filePath;
|
|
39
38
|
break;
|
|
40
39
|
}
|
|
41
|
-
export const config =
|
|
42
|
-
extends: [eslintjs.configs.recommended, ...typescript.configs.strictTypeChecked, ...
|
|
40
|
+
export const config = typescript.config({
|
|
41
|
+
extends: [eslintjs.configs.recommended, ...typescript.configs.strictTypeChecked, ...typescript.configs.strict, ...typescript.configs.stylistic, jsdoc.configs['flat/recommended']],
|
|
43
42
|
files: ['**/*.{ts,tsx,html}'],
|
|
44
43
|
languageOptions: {
|
|
45
44
|
ecmaVersion: 'latest',
|
|
@@ -66,16 +65,7 @@ export const config = tseslint.config({
|
|
|
66
65
|
...googleRules,
|
|
67
66
|
'@/no-implied-eval': 'error',
|
|
68
67
|
'@stylistic/no-non-null-assertion': 'off',
|
|
69
|
-
'@stylistic/type-annotation-spacing':
|
|
70
|
-
after: false,
|
|
71
|
-
before: false,
|
|
72
|
-
overrides: {
|
|
73
|
-
arrow: {
|
|
74
|
-
after: true,
|
|
75
|
-
before: true
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}],
|
|
68
|
+
'@stylistic/type-annotation-spacing': 'error',
|
|
79
69
|
'@typescript-eslint/array-type': ['error', {
|
|
80
70
|
default: 'generic'
|
|
81
71
|
}],
|
package/index.js
CHANGED
|
@@ -68,7 +68,7 @@ var main = function main(context) {
|
|
|
68
68
|
return _regenerator["default"].wrap(function _callee2$(_context3) {
|
|
69
69
|
while (1) switch (_context3.prev = _context3.next) {
|
|
70
70
|
case 0:
|
|
71
|
-
if (environment.PATH && !environment.PATH.includes(':node_modules/.bin')) environment.PATH += ':node_modules/.bin';else environment.PATH = 'node_modules/.bin';
|
|
71
|
+
if (environment.PATH && !environment.PATH.includes(': node_modules/.bin')) environment.PATH += ': node_modules/.bin';else environment.PATH = 'node_modules/.bin';
|
|
72
72
|
configuration = (0, _configurator.load)(context, currentWorkingDirectory, commandLineArguments, webOptimizerPath, environment);
|
|
73
73
|
clear = (0, _clientnode.NOOP)();
|
|
74
74
|
_context3.prev = 3;
|
|
@@ -83,7 +83,7 @@ var main = function main(context) {
|
|
|
83
83
|
}, processOptions);
|
|
84
84
|
childProcesses = [];
|
|
85
85
|
processPromises = [];
|
|
86
|
-
possibleArguments = ['build', 'build:types', 'clear', 'document', 'lint', 'preinstall', 'serve', 'test', 'test:browser', 'test:coverage', 'test:coverage:report', 'check:types'];
|
|
86
|
+
possibleArguments = ['build', 'build: types', 'clear', 'document', 'lint', 'preinstall', 'serve', 'test', 'test:browser', 'test: coverage', 'test: coverage: report', 'check: types'];
|
|
87
87
|
closeEventHandlers = [];
|
|
88
88
|
if (!(configuration.givenCommandLineArguments.length > 2)) {
|
|
89
89
|
_context3.next = 118;
|
|
@@ -136,7 +136,7 @@ var main = function main(context) {
|
|
|
136
136
|
NOTE: If we have a dependency cycle we need to preserve files
|
|
137
137
|
during pre-install phase.
|
|
138
138
|
*/
|
|
139
|
-
if (!(!['build', 'build:types', 'preinstall', 'serve', 'test', 'test:browser', 'test:coverage', 'test:coverage:report'].includes(configuration.givenCommandLineArguments[2]) && possibleArguments.includes(configuration.givenCommandLineArguments[2]))) {
|
|
139
|
+
if (!(!['build', 'build: types', 'preinstall', 'serve', 'test', 'test:browser', 'test: coverage', 'test: coverage: report'].includes(configuration.givenCommandLineArguments[2]) && possibleArguments.includes(configuration.givenCommandLineArguments[2]))) {
|
|
140
140
|
_context3.next = 67;
|
|
141
141
|
break;
|
|
142
142
|
}
|
|
@@ -274,7 +274,7 @@ var main = function main(context) {
|
|
|
274
274
|
}).filter(function (filePath) {
|
|
275
275
|
return !configuration.path.context.startsWith(filePath);
|
|
276
276
|
}), configuration["package"].main.fileNames);
|
|
277
|
-
if (!['build', 'document', 'test', 'test:coverage', 'test:coverage:report'].includes(commandLineArguments[2])) {
|
|
277
|
+
if (!['build', 'document', 'test', 'test: coverage', 'test: coverage: report'].includes(commandLineArguments[2])) {
|
|
278
278
|
_context3.next = 75;
|
|
279
279
|
break;
|
|
280
280
|
}
|
|
@@ -349,7 +349,7 @@ var main = function main(context) {
|
|
|
349
349
|
*/
|
|
350
350
|
if (!childProcessOptions.env) childProcessOptions.env = {};
|
|
351
351
|
if (typeof childProcessOptions.env.PATH !== 'string') childProcessOptions.env.PATH = '';
|
|
352
|
-
childProcessOptions.env.PATH += ":".concat(webOptimizerPath, "/node_modules/.bin");
|
|
352
|
+
childProcessOptions.env.PATH += ": ".concat(webOptimizerPath, "/node_modules/.bin");
|
|
353
353
|
var childProcess = (0, _child_process.spawn)(configuration.commandLine.build.command, commandLineArguments, childProcessOptions);
|
|
354
354
|
var copyAdditionalFilesAndTidyUp = function copyAdditionalFilesAndTidyUp() {
|
|
355
355
|
var _iterator5 = _createForOfIteratorHelper(configuration.files.additionalPaths),
|
|
@@ -537,7 +537,7 @@ var main = function main(context) {
|
|
|
537
537
|
_iterator9.f();
|
|
538
538
|
}
|
|
539
539
|
}; /// region a-/synchronous
|
|
540
|
-
if (!['document', 'test', 'test:coverage', 'test:coverage:report'].includes(configuration.givenCommandLineArguments[2])) {
|
|
540
|
+
if (!['document', 'test', 'test: coverage', 'test: coverage: report'].includes(configuration.givenCommandLineArguments[2])) {
|
|
541
541
|
_context3.next = 117;
|
|
542
542
|
break;
|
|
543
543
|
}
|
|
@@ -548,7 +548,7 @@ var main = function main(context) {
|
|
|
548
548
|
_context3.next = 118;
|
|
549
549
|
break;
|
|
550
550
|
case 117:
|
|
551
|
-
if (['build:types', 'check:types', 'lint', 'serve', 'test:browser'].includes(configuration.givenCommandLineArguments[2])) handleTask(configuration.givenCommandLineArguments[2]);
|
|
551
|
+
if (['build: types', 'check: types', 'lint', 'serve', 'test:browser'].includes(configuration.givenCommandLineArguments[2])) handleTask(configuration.givenCommandLineArguments[2]);
|
|
552
552
|
case 118:
|
|
553
553
|
finished = false;
|
|
554
554
|
closeHandler = function closeHandler() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weboptimizer",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1500",
|
|
4
4
|
"description": "A generic web optimizer, (module) bundler and development environment.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -93,14 +93,14 @@
|
|
|
93
93
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
94
94
|
"@babel/plugin-proposal-decorators": "^7.24.7",
|
|
95
95
|
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
|
|
96
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
97
|
-
"@babel/preset-env": "^7.25.
|
|
96
|
+
"@babel/plugin-transform-runtime": "^7.25.4",
|
|
97
|
+
"@babel/preset-env": "^7.25.4",
|
|
98
98
|
"@babel/preset-typescript": "^7.24.7",
|
|
99
|
-
"@babel/runtime": "^7.25.
|
|
99
|
+
"@babel/runtime": "^7.25.6",
|
|
100
100
|
"babel-loader": "^9.1.3",
|
|
101
101
|
"babel-plugin-transform-modern-regexp": "^0.0.6",
|
|
102
102
|
"babel-preset-minify": "^0.5.2",
|
|
103
|
-
"clientnode": "3.0.
|
|
103
|
+
"clientnode": "3.0.1178",
|
|
104
104
|
"ejs": "^3.1.10",
|
|
105
105
|
"exports-loader": "^5.0.0",
|
|
106
106
|
"extract-loader": "^5.1.0",
|
|
@@ -113,29 +113,30 @@
|
|
|
113
113
|
"rimraf": "^6.0.1",
|
|
114
114
|
"script-loader": "^0.7.2",
|
|
115
115
|
"typescript": "^5.5.4",
|
|
116
|
-
"webpack": "^5.
|
|
116
|
+
"webpack": "^5.94.0",
|
|
117
117
|
"webpack-cli": "^5.1.4",
|
|
118
118
|
"webpack-sources": "^3.2.3"
|
|
119
119
|
},
|
|
120
120
|
"devDependencies": {
|
|
121
|
-
"@babel/cli": "^7.
|
|
121
|
+
"@babel/cli": "^7.25.6",
|
|
122
122
|
"@babel/eslint-parser": "^7.25.1",
|
|
123
|
-
"@stylistic/eslint-plugin": "^2.
|
|
123
|
+
"@stylistic/eslint-plugin": "^2.7.2",
|
|
124
|
+
"@stylistic/eslint-plugin-ts": "^2.7.2",
|
|
124
125
|
"@types/ejs": "^3.1.5",
|
|
125
|
-
"@types/eslint": "^9.6.
|
|
126
|
+
"@types/eslint": "^9.6.1",
|
|
126
127
|
"@types/html-minifier": "^4.0.5",
|
|
127
128
|
"@types/html-minifier-terser": "^7.0.2",
|
|
128
129
|
"@types/imagemin": "^9.0.0",
|
|
129
|
-
"@types/node": "^22.
|
|
130
|
+
"@types/node": "^22.5.3",
|
|
130
131
|
"@types/postcss-import": "^14.0.3",
|
|
131
132
|
"@types/postcss-url": "^10.0.4",
|
|
132
133
|
"@types/webpack-env": "^1.18.5",
|
|
133
134
|
"@types/webpack-sources": "^3.2.3",
|
|
134
|
-
"@typescript-eslint/parser": "^8.
|
|
135
|
+
"@typescript-eslint/parser": "^8.4.0",
|
|
135
136
|
"css-loader": "^7.1.2",
|
|
136
137
|
"cssnano": "^7.0.5",
|
|
137
|
-
"documentation-website": "^1.0.
|
|
138
|
-
"eslint": "^9.9.
|
|
138
|
+
"documentation-website": "^1.0.332",
|
|
139
|
+
"eslint": "^9.9.1",
|
|
139
140
|
"eslint-config-google": "^0.14.0",
|
|
140
141
|
"eslint-plugin-jsdoc": "^50.2.2",
|
|
141
142
|
"favicons": "^7.2.0",
|
|
@@ -147,7 +148,7 @@
|
|
|
147
148
|
"mini-css-extract-plugin": "^2.9.1",
|
|
148
149
|
"mkdirp": "^3.0.1",
|
|
149
150
|
"node-fetch": "^3.3.2",
|
|
150
|
-
"postcss": "^8.4.
|
|
151
|
+
"postcss": "^8.4.45",
|
|
151
152
|
"postcss-fontpath": "^1.0.0",
|
|
152
153
|
"postcss-import": "^16.1.0",
|
|
153
154
|
"postcss-loader": "^8.1.1",
|
|
@@ -156,10 +157,10 @@
|
|
|
156
157
|
"postcss-url": "^10.1.3",
|
|
157
158
|
"shx": "^0.3.4",
|
|
158
159
|
"style-loader": "^4.0.0",
|
|
159
|
-
"stylelint": "^16.
|
|
160
|
+
"stylelint": "^16.9.0",
|
|
160
161
|
"stylelint-config-standard": "^36.0.1",
|
|
161
162
|
"stylelint-config-standard-scss": "^13.1.0",
|
|
162
|
-
"typescript-eslint": "^8.
|
|
163
|
+
"typescript-eslint": "^8.4.0",
|
|
163
164
|
"typescript-plugin-css-modules": "^5.1.0",
|
|
164
165
|
"workbox-webpack-plugin": "^7.1.0"
|
|
165
166
|
},
|
package/type.d.ts
CHANGED
|
@@ -182,7 +182,7 @@ export interface CommandLineArguments {
|
|
|
182
182
|
serve: Array<Command> | Command;
|
|
183
183
|
test: Array<Command> | Command;
|
|
184
184
|
'test:browser': Array<Command> | Command;
|
|
185
|
-
'check:types': Array<Command> | Command;
|
|
185
|
+
'check: types': Array<Command> | Command;
|
|
186
186
|
}
|
|
187
187
|
export type NodeEnvironment = BaseWebpackConfiguration['node'] & {
|
|
188
188
|
'#': string;
|
package/webpackConfigurator.js
CHANGED
|
@@ -217,7 +217,7 @@ pluginInstances.push({
|
|
|
217
217
|
sequences and translate it back later to avoid unexpected escape
|
|
218
218
|
sequences in resulting html.
|
|
219
219
|
/
|
|
220
|
-
const window:DOMWindow = (new DOM(
|
|
220
|
+
const window: DOMWindow = (new DOM(
|
|
221
221
|
content
|
|
222
222
|
.replace(/<%/g, '##+#+#+##')
|
|
223
223
|
.replace(/%>/g, '##-#-#-##')
|
|
@@ -412,13 +412,13 @@ if (_module.enforceDeduplication) {
|
|
|
412
412
|
var absoluteContextPath = (0, _path.resolve)(configuration.path.context);
|
|
413
413
|
var consolidator = function consolidator(result) {
|
|
414
414
|
var targetPath = result.createData.resource;
|
|
415
|
-
if (targetPath && /((
|
|
415
|
+
if (targetPath && /((?: ^|\/)node_modules\/.+)/.test(targetPath) && (!targetPath.startsWith(absoluteContextPath) || /((?: ^|\/)node_modules\/.+){2}/.test(targetPath)) && (0, _clientnode.isFileSync)(targetPath)) {
|
|
416
416
|
var packageDescriptor = (0, _helper.getClosestPackageDescriptor)(targetPath);
|
|
417
417
|
if (packageDescriptor) {
|
|
418
418
|
var pathPrefixes;
|
|
419
419
|
var pathSuffix;
|
|
420
420
|
if (targetPath.startsWith(absoluteContextPath)) {
|
|
421
|
-
var _matches2 = targetPath.match(/((
|
|
421
|
+
var _matches2 = targetPath.match(/((?: ^|.*?\/)node_modules\/)/g);
|
|
422
422
|
if (_matches2 === null) return;
|
|
423
423
|
pathPrefixes = Array.from(_matches2);
|
|
424
424
|
/*
|
|
@@ -440,7 +440,7 @@ if (_module.enforceDeduplication) {
|
|
|
440
440
|
} finally {
|
|
441
441
|
_iterator8.f();
|
|
442
442
|
}
|
|
443
|
-
pathSuffix = targetPath.replace(/(
|
|
443
|
+
pathSuffix = targetPath.replace(/(?: ^|.*\/)node_modules\/(.+$)/, '$1');
|
|
444
444
|
} else {
|
|
445
445
|
pathPrefixes = [(0, _path.resolve)(absoluteContextPath, 'node_modules')];
|
|
446
446
|
// Find longest common prefix.
|
|
@@ -497,45 +497,45 @@ if (_module.enforceDeduplication) {
|
|
|
497
497
|
/*
|
|
498
498
|
new NormalModuleReplacementPlugin(
|
|
499
499
|
/.+/,
|
|
500
|
-
(result:{
|
|
501
|
-
context:string
|
|
502
|
-
createData:{resource:string}
|
|
503
|
-
request:string
|
|
504
|
-
}):void => {
|
|
505
|
-
const isResource:boolean = Boolean(result.createData.resource)
|
|
506
|
-
const targetPath:string = isResource ?
|
|
500
|
+
(result: {
|
|
501
|
+
context: string
|
|
502
|
+
createData: {resource: string}
|
|
503
|
+
request: string
|
|
504
|
+
}): void => {
|
|
505
|
+
const isResource: boolean = Boolean(result.createData.resource)
|
|
506
|
+
const targetPath: string = isResource ?
|
|
507
507
|
result.createData.resource :
|
|
508
508
|
resolve(result.context, result.request)
|
|
509
509
|
if (
|
|
510
510
|
targetPath &&
|
|
511
|
-
/((
|
|
511
|
+
/((?: ^|\/)node_modules\/.+){2}/.test(targetPath) &&
|
|
512
512
|
isFileSync(targetPath)
|
|
513
513
|
) {
|
|
514
|
-
const packageDescriptor:null|PackageDescriptor =
|
|
514
|
+
const packageDescriptor: null|PackageDescriptor =
|
|
515
515
|
Helper.getClosestPackageDescriptor(targetPath)
|
|
516
516
|
if (packageDescriptor) {
|
|
517
|
-
const pathPrefixes:null|RegExpMatchArray = targetPath.match(
|
|
518
|
-
/((
|
|
517
|
+
const pathPrefixes: null|RegExpMatchArray = targetPath.match(
|
|
518
|
+
/((?: ^|.*?\/)node_modules\/)/g
|
|
519
519
|
)
|
|
520
520
|
if (pathPrefixes === null)
|
|
521
521
|
return
|
|
522
522
|
// Avoid finding the same artefact.
|
|
523
523
|
pathPrefixes.pop()
|
|
524
|
-
let index:number = 0
|
|
524
|
+
let index: number = 0
|
|
525
525
|
for (const pathPrefix of pathPrefixes) {
|
|
526
526
|
if (index > 0)
|
|
527
527
|
pathPrefixes[index] =
|
|
528
528
|
resolve(pathPrefixes[index - 1], pathPrefix)
|
|
529
529
|
index += 1
|
|
530
530
|
}
|
|
531
|
-
const pathSuffix:string =
|
|
532
|
-
targetPath.replace(/(
|
|
533
|
-
let redundantRequest:null|PlainObject = null
|
|
531
|
+
const pathSuffix: string =
|
|
532
|
+
targetPath.replace(/(?: ^|.*\/)node_modules\/(.+$)/, '$1')
|
|
533
|
+
let redundantRequest: null|PlainObject = null
|
|
534
534
|
for (const pathPrefix of pathPrefixes) {
|
|
535
|
-
const alternateTargetPath:string =
|
|
535
|
+
const alternateTargetPath: string =
|
|
536
536
|
resolve(pathPrefix, pathSuffix)
|
|
537
537
|
if (isFileSync(alternateTargetPath)) {
|
|
538
|
-
const otherPackageDescriptor:null|PackageDescriptor =
|
|
538
|
+
const otherPackageDescriptor: null|PackageDescriptor =
|
|
539
539
|
Helper.getClosestPackageDescriptor(
|
|
540
540
|
alternateTargetPath
|
|
541
541
|
)
|
|
@@ -745,7 +745,7 @@ var genericLoader = {
|
|
|
745
745
|
html: {
|
|
746
746
|
// NOTE: This is only for the main entry template.
|
|
747
747
|
main: {
|
|
748
|
-
test: new RegExp('^' + (0, _clientnode.escapeRegularExpressions)(configuration.files.defaultHTML.template.filePath) + '(
|
|
748
|
+
test: new RegExp('^' + (0, _clientnode.escapeRegularExpressions)(configuration.files.defaultHTML.template.filePath) + '(?: \\?.*)?$'),
|
|
749
749
|
use: configuration.files.defaultHTML.template.use
|
|
750
750
|
},
|
|
751
751
|
ejs: {
|
|
@@ -755,7 +755,7 @@ var genericLoader = {
|
|
|
755
755
|
})).includes(filePath) || (_module.preprocessor.html.exclude === null ? false : evaluateAnThrow(_module.preprocessor.html.exclude, filePath));
|
|
756
756
|
},
|
|
757
757
|
include: configuration.path.source.asset.template,
|
|
758
|
-
test: /\.html\.ejs(
|
|
758
|
+
test: /\.html\.ejs(?: \?.*)?$/i,
|
|
759
759
|
use: _module.preprocessor.html.additional.pre.map(evaluateMapper).concat({
|
|
760
760
|
loader: 'file?name=' + (0, _path.join)((0, _path.relative)(configuration.path.target.asset.base, configuration.path.target.asset.template), '[name]' + (((0, _clientnode.isPlainObject)(_module.preprocessor.html.options) ? _module.preprocessor.html.options : {
|
|
761
761
|
compileSteps: 2
|
|
@@ -779,7 +779,7 @@ var genericLoader = {
|
|
|
779
779
|
})).includes(filePath) || (_module.html.exclude === null ? true : evaluateAnThrow(_module.html.exclude, filePath));
|
|
780
780
|
},
|
|
781
781
|
include: configuration.path.source.asset.template,
|
|
782
|
-
test: /\.html(
|
|
782
|
+
test: /\.html(?: \?.*)?$/i,
|
|
783
783
|
use: _module.html.additional.pre.map(evaluateMapper).concat({
|
|
784
784
|
loader: 'file?name=' + (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.template), "[name][ext]?".concat(configuration.hashAlgorithm, "=") + '[contenthash]')
|
|
785
785
|
}, {
|
|
@@ -816,7 +816,7 @@ var genericLoader = {
|
|
|
816
816
|
}
|
|
817
817
|
return Boolean(result);
|
|
818
818
|
},
|
|
819
|
-
test: /\.s?css(
|
|
819
|
+
test: /\.s?css(?: \?.*)?$/i,
|
|
820
820
|
use: cssUse
|
|
821
821
|
},
|
|
822
822
|
// endregion
|
|
@@ -830,7 +830,7 @@ var genericLoader = {
|
|
|
830
830
|
generator: {
|
|
831
831
|
filename: (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.font), '[name][ext]') + "?".concat(configuration.hashAlgorithm, "=[contenthash]")
|
|
832
832
|
},
|
|
833
|
-
test: /\.eot(
|
|
833
|
+
test: /\.eot(?: \?.*)?$/i,
|
|
834
834
|
type: 'asset/resource',
|
|
835
835
|
parser: {
|
|
836
836
|
dataUrlCondition: {
|
|
@@ -853,7 +853,7 @@ var genericLoader = {
|
|
|
853
853
|
maxSize: configuration.inPlace.otherMaximumFileSizeLimitInByte
|
|
854
854
|
}
|
|
855
855
|
},
|
|
856
|
-
test: /\.svg(
|
|
856
|
+
test: /\.svg(?: \?.*)?$/i,
|
|
857
857
|
type: 'asset/resource',
|
|
858
858
|
use: _module.optimizer.font.svg.loader.map(evaluateMapper)
|
|
859
859
|
},
|
|
@@ -864,7 +864,7 @@ var genericLoader = {
|
|
|
864
864
|
generator: {
|
|
865
865
|
filename: (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.font), '[name][ext]') + "?".concat(configuration.hashAlgorithm, "=[contenthash]")
|
|
866
866
|
},
|
|
867
|
-
test: /\.ttf(
|
|
867
|
+
test: /\.ttf(?: \?.*)?$/i,
|
|
868
868
|
type: 'asset/resource',
|
|
869
869
|
mimetype: 'application/octet-stream',
|
|
870
870
|
parser: {
|
|
@@ -881,7 +881,7 @@ var genericLoader = {
|
|
|
881
881
|
generator: {
|
|
882
882
|
filename: (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.font), '[name][ext]') + "?".concat(configuration.hashAlgorithm, "=[contenthash]")
|
|
883
883
|
},
|
|
884
|
-
test: /\.woff2?(
|
|
884
|
+
test: /\.woff2?(?: \?.*)?$/i,
|
|
885
885
|
type: 'asset/resource',
|
|
886
886
|
parser: {
|
|
887
887
|
dataUrlCondition: {
|
|
@@ -901,7 +901,7 @@ var genericLoader = {
|
|
|
901
901
|
filename: (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.image), '[name][ext]') + "?".concat(configuration.hashAlgorithm, "=[contenthash]")
|
|
902
902
|
},
|
|
903
903
|
include: configuration.path.source.asset.image,
|
|
904
|
-
test: /\.(?:gif|ico|jpg|png|svg)(
|
|
904
|
+
test: /\.(?: gif|ico|jpg|png|svg)(?: \?.*)?$/i,
|
|
905
905
|
type: 'asset/resource',
|
|
906
906
|
parser: {
|
|
907
907
|
dataUrlCondition: {
|
|
@@ -950,7 +950,7 @@ if (configuration.files.compose.cascadingStyleSheet && plugins.MiniCSSExtract) {
|
|
|
950
950
|
So we inject live reload and hot module replacement manually.
|
|
951
951
|
*/
|
|
952
952
|
if (htmlAvailable && configuration.debug && configuration.development.server.liveReload && !Object.prototype.hasOwnProperty.call(configuration.injection.entry.normalized, 'developmentHandler') && (configuration.development.includeClient || typeof configuration.development.includeClient !== 'boolean' && ['serve', 'test:browser'].includes(configuration.givenCommandLineArguments[2]))) {
|
|
953
|
-
configuration.injection.entry.normalized.developmentHandler = ['webpack-dev-server/client/index.js?' + 'live-reload=true' + "&hot=".concat(configuration.development.server.hot ? 'true' : 'false') + "&http".concat(configuration.development.server.https ? 's' : '', "
|
|
953
|
+
configuration.injection.entry.normalized.developmentHandler = ['webpack-dev-server/client/index.js?' + 'live-reload=true' + "&hot=".concat(configuration.development.server.hot ? 'true' : 'false') + "&http".concat(configuration.development.server.https ? 's' : '', ": //") + "".concat(configuration.development.server.host, ": ") + String(configuration.development.server.port)];
|
|
954
954
|
if (configuration.development.server.hot) {
|
|
955
955
|
configuration.injection.entry.normalized.developmentHandler.push('webpack/hot/dev-server.js');
|
|
956
956
|
configuration.development.server.hot = false;
|
|
@@ -985,7 +985,7 @@ if (!_module.optimizer.minimizer) {
|
|
|
985
985
|
webpack plugin throwing to not get markup as intermediate result.
|
|
986
986
|
*/
|
|
987
987
|
_module.optimizer.minimizer.push(new plugins.Terser({
|
|
988
|
-
exclude: /\\.html(
|
|
988
|
+
exclude: /\\.html(?: \\.js)?(?: \\?.*)?$/,
|
|
989
989
|
extractComments: false,
|
|
990
990
|
parallel: true
|
|
991
991
|
}));
|
|
@@ -1122,11 +1122,11 @@ if (configuration.path.configuration.javaScript) try {
|
|
|
1122
1122
|
console.debug('Optional configuration file script "' + "".concat(configuration.path.configuration.javaScript, "\" not available."));
|
|
1123
1123
|
}
|
|
1124
1124
|
if (configuration.showConfiguration) {
|
|
1125
|
-
console.info('Using internal configuration:', _util["default"].inspect(configuration, {
|
|
1125
|
+
console.info('Using internal configuration: ', _util["default"].inspect(configuration, {
|
|
1126
1126
|
depth: null
|
|
1127
1127
|
}));
|
|
1128
1128
|
console.info('-----------------------------------------------------------');
|
|
1129
|
-
console.info('Using webpack configuration:', _util["default"].inspect(webpackConfiguration, {
|
|
1129
|
+
console.info('Using webpack configuration: ', _util["default"].inspect(webpackConfiguration, {
|
|
1130
1130
|
depth: null
|
|
1131
1131
|
}));
|
|
1132
1132
|
}
|