weboptimizer 2.0.1092 → 2.0.1096
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 +0 -1
- package/declarations.d.ts +32 -6
- package/helper.js +1 -3
- package/index.js +4 -3
- package/package.json +39 -21
- package/type.d.ts +64 -5
- package/type.js +1 -1
- package/webpackConfigurator.js +126 -150
package/configurator.js
CHANGED
|
@@ -369,7 +369,6 @@ try {
|
|
|
369
369
|
if (htmlConfiguration.template.filePath !== resolvedConfiguration.files.defaultHTML.template.filePath && htmlConfiguration.template.options) {
|
|
370
370
|
var requestString = new String(htmlConfiguration.template.request + _clientnode["default"].convertCircularObjectToJSON(htmlConfiguration.template.options));
|
|
371
371
|
/* eslint-disable @typescript-eslint/unbound-method */
|
|
372
|
-
// @ts-ignore: Monkeypatching is not allowed by typescript.
|
|
373
372
|
|
|
374
373
|
requestString.replace = function (value) {
|
|
375
374
|
return function () {
|
package/declarations.d.ts
CHANGED
|
@@ -1,14 +1,40 @@
|
|
|
1
1
|
// -*- coding: utf-8 -*-
|
|
2
|
-
/** @module declarations */
|
|
3
|
-
declare module 'babel-preset-minify'
|
|
4
|
-
declare module 'html-loader'
|
|
5
|
-
declare module 'loader-utils'
|
|
6
|
-
declare module 'webOptimizerDefaultTemplateFilePath'
|
|
7
2
|
/*
|
|
8
3
|
NOTE: We have to avoid importing this from "clientnode/type" to avoid a
|
|
9
4
|
dependency cycle.
|
|
10
5
|
*/
|
|
11
|
-
type Mapping = {[key:string]:
|
|
6
|
+
type Mapping<T = string> = {[key:string]:T}
|
|
7
|
+
interface PostcssTransformer {
|
|
8
|
+
postcssPlugin: string
|
|
9
|
+
postcssVersion: string
|
|
10
|
+
|
|
11
|
+
(root:object, result:object):Promise<void>|void
|
|
12
|
+
}
|
|
13
|
+
/** @module declarations */
|
|
14
|
+
declare module 'babel-preset-minify'
|
|
15
|
+
declare module 'html-loader'
|
|
16
|
+
declare module 'postcss-fontpath' {
|
|
17
|
+
export default function(options:Partial<{
|
|
18
|
+
checkPath:boolean
|
|
19
|
+
formats:Array<{
|
|
20
|
+
ext:string
|
|
21
|
+
type:string
|
|
22
|
+
}>
|
|
23
|
+
}>):PostcssTransformer
|
|
24
|
+
}
|
|
25
|
+
declare module 'postcss-sprites' {
|
|
26
|
+
export default function(options:Partial<{
|
|
27
|
+
filterBy:() => Promise<void>
|
|
28
|
+
hooks:{onSaveSpritesheet:(_image:Mapping) => string}
|
|
29
|
+
spritePath:string
|
|
30
|
+
stylesheetPath:null|string
|
|
31
|
+
verbose:boolean
|
|
32
|
+
}>):PostcssTransformer
|
|
33
|
+
}
|
|
34
|
+
declare module 'webOptimizerDefaultTemplateFilePath'
|
|
35
|
+
declare module 'svgo' {
|
|
36
|
+
export type Options = any
|
|
37
|
+
}
|
|
12
38
|
declare module '*.module' {
|
|
13
39
|
const classes:Mapping
|
|
14
40
|
export default classes
|
package/helper.js
CHANGED
|
@@ -1078,9 +1078,7 @@ var Helper = /*#__PURE__*/function () {
|
|
|
1078
1078
|
if (moduleID === false) return moduleID;
|
|
1079
1079
|
|
|
1080
1080
|
for (var replacement in replacements) {
|
|
1081
|
-
if (Object.prototype.hasOwnProperty.call(replacements, replacement)) moduleID = moduleID.replace(
|
|
1082
|
-
// issues/22378
|
|
1083
|
-
new RegExp(replacement), replacements[replacement]);
|
|
1081
|
+
if (Object.prototype.hasOwnProperty.call(replacements, replacement)) moduleID = moduleID.replace(new RegExp(replacement), replacements[replacement]);
|
|
1084
1082
|
}
|
|
1085
1083
|
|
|
1086
1084
|
return moduleID;
|
package/index.js
CHANGED
|
@@ -529,7 +529,10 @@ var main = /*#__PURE__*/function () {
|
|
|
529
529
|
return [_clientnode["default"].handleChildProcess((0, _child_process.exec)(evaluated.result, _objectSpread({
|
|
530
530
|
encoding: _configurator["default"].encoding
|
|
531
531
|
}, processOptions), function (error) {
|
|
532
|
-
return error ? reject(error) : resolve(
|
|
532
|
+
return error ? reject(error) : resolve({
|
|
533
|
+
reason: 'Finished.',
|
|
534
|
+
parameters: []
|
|
535
|
+
});
|
|
533
536
|
}))];
|
|
534
537
|
}));
|
|
535
538
|
})();
|
|
@@ -648,8 +651,6 @@ var main = /*#__PURE__*/function () {
|
|
|
648
651
|
try {
|
|
649
652
|
for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
|
|
650
653
|
closeEventName = _step13.value;
|
|
651
|
-
// @ts-ignore: Accepts only "NodeSignals" but other strings are
|
|
652
|
-
// available.
|
|
653
654
|
process.on(closeEventName, closeHandler);
|
|
654
655
|
}
|
|
655
656
|
} catch (err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weboptimizer",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1096",
|
|
4
4
|
"description": "A generic web optimizer, (module) bundler and development environment.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -99,7 +99,6 @@
|
|
|
99
99
|
"html-webpack-plugin": "*",
|
|
100
100
|
"imports-loader": "*",
|
|
101
101
|
"jsdom": "^16.6.0",
|
|
102
|
-
"loader-utils": "*",
|
|
103
102
|
"rimraf": "*",
|
|
104
103
|
"script-loader": "*",
|
|
105
104
|
"typescript": "*",
|
|
@@ -117,6 +116,7 @@
|
|
|
117
116
|
"@types/html-minifier-terser": "*",
|
|
118
117
|
"@types/jest": "*",
|
|
119
118
|
"@types/jsdom": "*",
|
|
119
|
+
"@types/mini-css-extract-plugin": "*",
|
|
120
120
|
"@types/node": "*",
|
|
121
121
|
"@types/postcss-import": "*",
|
|
122
122
|
"@types/postcss-url": "*",
|
|
@@ -134,6 +134,7 @@
|
|
|
134
134
|
"eslint-plugin-jsdoc": "*",
|
|
135
135
|
"favicons": "*",
|
|
136
136
|
"favicons-webpack-plugin": "*",
|
|
137
|
+
"image-minimizer-webpack-plugin": "*",
|
|
137
138
|
"jest": "*",
|
|
138
139
|
"jsdoc": "*",
|
|
139
140
|
"mini-css-extract-plugin": "*",
|
|
@@ -161,6 +162,7 @@
|
|
|
161
162
|
"@types/html-minifier": "*",
|
|
162
163
|
"@types/jest": "*",
|
|
163
164
|
"@types/jsdom": "*",
|
|
165
|
+
"@types/mini-css-extract-plugin": "*",
|
|
164
166
|
"@types/node": "*",
|
|
165
167
|
"@types/webpack-env": "*",
|
|
166
168
|
"@types/workbox-webpack-plugin": "*",
|
|
@@ -173,7 +175,7 @@
|
|
|
173
175
|
"eslint-plugin-jsdoc": "*",
|
|
174
176
|
"favicons-webpack-plugin": "*",
|
|
175
177
|
"identity-obj-proxy": "*",
|
|
176
|
-
"
|
|
178
|
+
"image-minimizer-webpack-plugin": "*",
|
|
177
179
|
"jest": "*",
|
|
178
180
|
"jsdoc": "*",
|
|
179
181
|
"mini-css-extract-plugin": "*",
|
|
@@ -248,7 +250,7 @@
|
|
|
248
250
|
"identity-obj-proxy": {
|
|
249
251
|
"optional": true
|
|
250
252
|
},
|
|
251
|
-
"
|
|
253
|
+
"image-minimizer-webpack-plugin": {
|
|
252
254
|
"optional": true
|
|
253
255
|
},
|
|
254
256
|
"jest": {
|
|
@@ -995,24 +997,40 @@
|
|
|
995
997
|
},
|
|
996
998
|
"image": {
|
|
997
999
|
"content": {
|
|
998
|
-
"
|
|
999
|
-
"
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1000
|
+
"minimizerOptions": {
|
|
1001
|
+
"plugins": [
|
|
1002
|
+
[
|
|
1003
|
+
"gifsicle",
|
|
1004
|
+
{
|
|
1005
|
+
"colors": 256,
|
|
1006
|
+
"interlanced": false,
|
|
1007
|
+
"optimizationLevel": 3
|
|
1008
|
+
}
|
|
1009
|
+
],
|
|
1010
|
+
[
|
|
1011
|
+
"jpegtran",
|
|
1012
|
+
{
|
|
1013
|
+
"arithmetic": true,
|
|
1014
|
+
"progressive": true
|
|
1015
|
+
}
|
|
1016
|
+
],
|
|
1017
|
+
[
|
|
1018
|
+
"optipng",
|
|
1019
|
+
{
|
|
1020
|
+
"optimizationLevel": 7
|
|
1021
|
+
}
|
|
1022
|
+
],
|
|
1023
|
+
[
|
|
1024
|
+
"svgo",
|
|
1025
|
+
{
|
|
1026
|
+
"plugins": []
|
|
1027
|
+
}
|
|
1028
|
+
]
|
|
1029
|
+
]
|
|
1012
1030
|
},
|
|
1013
|
-
"
|
|
1014
|
-
|
|
1015
|
-
|
|
1031
|
+
"exclude": {
|
|
1032
|
+
"__evaluate__": "self.debug || 2 < self.givenCommandLineArguments.length && self.givenCommandLineArguments[2] !== 'build' ? /.*/ : self.debug && console.warn(`Image compression disabled. Use configuration: \"{module:{optimizer:{image:{content:{exclude:undefined}}}}}\" to enable default image file including.`) || /.*/"
|
|
1033
|
+
}
|
|
1016
1034
|
},
|
|
1017
1035
|
"loader": []
|
|
1018
1036
|
},
|
package/type.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="webpack-env" />
|
|
1
3
|
import { AnyFunction, Encoding, Mapping, PlainObject, SecondParameter } from 'clientnode/type';
|
|
2
4
|
import { FaviconOptions } from 'favicons';
|
|
5
|
+
import FaviconWebpackPlugin from 'favicons-webpack-plugin';
|
|
3
6
|
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
7
|
+
import ImageMinimizerWebpackPlugin from 'image-minimizer-webpack-plugin';
|
|
4
8
|
import { JSDOM } from 'jsdom';
|
|
5
|
-
import
|
|
9
|
+
import MiniCSSExtractPlugin from 'mini-css-extract-plugin';
|
|
6
10
|
import { Options as RemoveDirectoryRecursivelyOptions } from 'rimraf';
|
|
7
|
-
import {
|
|
11
|
+
import { DefinePlugin as WebpackDefinePlugin, Configuration as BaseWebpackConfiguration, IgnorePlugin as WebpackIgnorePlugin, library as webpackLibrary, ModuleOptions as WebpackModuleOptions, RuleSetRule as WebpackRuleSetRule, RuleSetUseItem as WebpackRuleSetUseItem, WebpackOptionsNormalized } from 'webpack';
|
|
12
|
+
import OfflinePlugin, { CommonOptions as WorkboxCommonOptions, GenerateSWOptions as WorkboxGenerateSWOptions, InjectManifestOptions as WorkboxInjectManifestOptions } from 'workbox-webpack-plugin';
|
|
8
13
|
export interface Browser {
|
|
9
14
|
debug: boolean;
|
|
10
15
|
domContentLoaded: boolean;
|
|
@@ -35,7 +40,7 @@ export interface RedundantRequest {
|
|
|
35
40
|
path: string;
|
|
36
41
|
version: string;
|
|
37
42
|
}
|
|
38
|
-
export declare type ExternalAliases = Mapping<Mapping
|
|
43
|
+
export declare type ExternalAliases = Mapping<Mapping | string | ((_request: string, _key: string) => string)>;
|
|
39
44
|
export declare type GivenInjection = AnyFunction | string | Array<string> | Mapping<string | Array<string>>;
|
|
40
45
|
export declare type NormalizedGivenInjection = Mapping<Array<string>>;
|
|
41
46
|
export interface GivenInjectionConfiguration {
|
|
@@ -124,7 +129,7 @@ export interface AdditionalLoaderConfiguration {
|
|
|
124
129
|
exclude?: BooleanExpression;
|
|
125
130
|
include?: BooleanExpression;
|
|
126
131
|
test: string;
|
|
127
|
-
use:
|
|
132
|
+
use: Array<WebpackLoader> | WebpackLoader | string;
|
|
128
133
|
}
|
|
129
134
|
export interface AdditionalLoaderConfigurations {
|
|
130
135
|
post: Array<AdditionalLoaderConfiguration>;
|
|
@@ -136,7 +141,7 @@ export interface AdditionalLoader {
|
|
|
136
141
|
}
|
|
137
142
|
export interface WebpackLoader {
|
|
138
143
|
loader: string;
|
|
139
|
-
options?:
|
|
144
|
+
options?: Mapping<unknown>;
|
|
140
145
|
}
|
|
141
146
|
export declare type ResourceLoaderConfiguration = WebpackLoader & {
|
|
142
147
|
exclude: BooleanExpression;
|
|
@@ -390,6 +395,38 @@ export interface WebpackConfiguration extends BaseWebpackConfiguration {
|
|
|
390
395
|
devServer: Mapping<unknown>;
|
|
391
396
|
replaceWebOptimizer: WebpackConfiguration;
|
|
392
397
|
}
|
|
398
|
+
export declare type RuleSet = Array<WebpackRuleSetUseItem>;
|
|
399
|
+
export declare type RuleSetRule = WebpackRuleSetRule & {
|
|
400
|
+
use: RuleSet;
|
|
401
|
+
};
|
|
402
|
+
export interface GenericLoader {
|
|
403
|
+
ejs: RuleSetRule;
|
|
404
|
+
script: RuleSetRule;
|
|
405
|
+
html: {
|
|
406
|
+
ejs: RuleSetRule;
|
|
407
|
+
html: RuleSetRule;
|
|
408
|
+
main: {
|
|
409
|
+
test: RegExp;
|
|
410
|
+
use: Array<WebpackLoader> | WebpackLoader;
|
|
411
|
+
};
|
|
412
|
+
};
|
|
413
|
+
style: RuleSetRule;
|
|
414
|
+
font: {
|
|
415
|
+
eot: RuleSetRule;
|
|
416
|
+
svg: RuleSetRule;
|
|
417
|
+
ttf: RuleSetRule;
|
|
418
|
+
woff: RuleSetRule;
|
|
419
|
+
};
|
|
420
|
+
image: RuleSetRule;
|
|
421
|
+
data: RuleSetRule;
|
|
422
|
+
}
|
|
423
|
+
export declare type Loader = GenericLoader & Mapping<WebpackRuleSetRule>;
|
|
424
|
+
export interface EvaluationScope {
|
|
425
|
+
configuration: ResolvedConfiguration;
|
|
426
|
+
isFilePathInDependencies: (_filePath: string) => boolean;
|
|
427
|
+
loader: Loader;
|
|
428
|
+
require: typeof require;
|
|
429
|
+
}
|
|
393
430
|
export interface WebpackBaseAssets {
|
|
394
431
|
outputName: string;
|
|
395
432
|
plugin: HtmlWebpackPlugin;
|
|
@@ -401,6 +438,28 @@ export interface WebpackAssets extends WebpackBaseAssets {
|
|
|
401
438
|
publicPath: string;
|
|
402
439
|
plugin: HtmlWebpackPlugin;
|
|
403
440
|
}
|
|
441
|
+
export declare type WebpackPlugin = webpackLibrary.AbstractLibraryPlugin<unknown> & Mapping<unknown>;
|
|
442
|
+
export declare type WebpackPlugins = Mapping<WebpackPlugin> & {
|
|
443
|
+
Favicon?: typeof FaviconWebpackPlugin;
|
|
444
|
+
GenerateServiceWorker?: typeof OfflinePlugin.GenerateSW;
|
|
445
|
+
HTML?: typeof HtmlWebpackPlugin;
|
|
446
|
+
ImageMinimizer?: typeof ImageMinimizerWebpackPlugin;
|
|
447
|
+
InjectManifest?: typeof OfflinePlugin.InjectManifest;
|
|
448
|
+
Offline?: {
|
|
449
|
+
GenerateSW: typeof OfflinePlugin.GenerateSW;
|
|
450
|
+
InjectManifest: typeof OfflinePlugin.InjectManifest;
|
|
451
|
+
};
|
|
452
|
+
MiniCSSExtract?: typeof MiniCSSExtractPlugin;
|
|
453
|
+
};
|
|
454
|
+
export declare type WebpackResolveData = Parameters<WebpackIgnorePlugin['checkIgnore']>[0];
|
|
455
|
+
export declare type WebpackExtendedResolveData = WebpackResolveData & {
|
|
456
|
+
createData: {
|
|
457
|
+
rawRequest: string;
|
|
458
|
+
request: string;
|
|
459
|
+
resource: string;
|
|
460
|
+
userRequest: string;
|
|
461
|
+
};
|
|
462
|
+
};
|
|
404
463
|
export interface HTMLWebpackPluginAssetTagGroupsData {
|
|
405
464
|
bodyTags: HtmlWebpackPlugin.HtmlTagObject[];
|
|
406
465
|
headTags: HtmlWebpackPlugin.HtmlTagObject[];
|
package/type.js
CHANGED
package/webpackConfigurator.js
CHANGED
|
@@ -48,15 +48,11 @@ var _webpack = require("webpack");
|
|
|
48
48
|
|
|
49
49
|
var _webpackSources = require("webpack-sources");
|
|
50
50
|
|
|
51
|
-
var _ejsLoader = _interopRequireDefault(require("./ejsLoader"));
|
|
52
|
-
|
|
53
51
|
var _configurator = _interopRequireDefault(require("./configurator"));
|
|
54
52
|
|
|
55
53
|
var _helper = _interopRequireDefault(require("./helper"));
|
|
56
54
|
|
|
57
|
-
var
|
|
58
|
-
|
|
59
|
-
var _loaderUtils = _interopRequireDefault(require("loader-utils"));
|
|
55
|
+
var _ejsLoader = _interopRequireDefault(require("./ejsLoader"));
|
|
60
56
|
|
|
61
57
|
var _this = void 0,
|
|
62
58
|
_configuration$path$c,
|
|
@@ -79,7 +75,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
79
75
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
80
76
|
|
|
81
77
|
var postcssCSSnano = (0, _clientnode.optionalRequire)('cssnano');
|
|
82
|
-
var
|
|
78
|
+
var postcssFontpath = (0, _clientnode.optionalRequire)('postcss-fontpath');
|
|
83
79
|
var postcssImport = (0, _clientnode.optionalRequire)('postcss-import');
|
|
84
80
|
var postcssSprites = (0, _clientnode.optionalRequire)('postcss-sprites');
|
|
85
81
|
var postcssURL = (0, _clientnode.optionalRequire)('postcss-url');
|
|
@@ -87,50 +83,25 @@ var pluginNameResourceMapping = {
|
|
|
87
83
|
HTML: 'html-webpack-plugin',
|
|
88
84
|
MiniCSSExtract: 'mini-css-extract-plugin',
|
|
89
85
|
Favicon: 'favicons-webpack-plugin',
|
|
90
|
-
|
|
86
|
+
ImageMinimizer: 'image-minimizer-webpack-plugin',
|
|
91
87
|
Offline: 'workbox-webpack-plugin'
|
|
92
88
|
};
|
|
93
89
|
var plugins = {};
|
|
94
90
|
|
|
95
91
|
for (var name in pluginNameResourceMapping) {
|
|
96
92
|
if (Object.prototype.hasOwnProperty.call(pluginNameResourceMapping, name)) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if (plugins[name] === null) {
|
|
100
|
-
delete plugins[name];
|
|
101
|
-
console.debug("Optional webpack plugin \"".concat(name, "\" not available."));
|
|
102
|
-
}
|
|
93
|
+
var plugin = (0, _clientnode.optionalRequire)(pluginNameResourceMapping[name]);
|
|
94
|
+
if (plugin) plugins[name] = plugin;else console.debug("Optional webpack plugin \"".concat(name, "\" not available."));
|
|
103
95
|
}
|
|
104
96
|
}
|
|
105
97
|
|
|
106
98
|
if (plugins.Offline) {
|
|
107
99
|
plugins.GenerateServiceWorker = plugins.Offline.GenerateSW;
|
|
108
100
|
plugins.InjectManifest = plugins.Offline.InjectManifest;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (plugins.Imagemin) plugins.Imagemin = plugins.Imagemin["default"];
|
|
112
|
-
if (require.cache && require.resolve('html-loader') in require.cache) require.cache[require.resolve('html-loader')].exports = function () {
|
|
113
|
-
_clientnode["default"].extend(true, this.options, module, this.options);
|
|
114
|
-
|
|
115
|
-
for (var _len = arguments.length, parameters = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
116
|
-
parameters[_key] = arguments[_key];
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return _htmlLoader["default"].call.apply(_htmlLoader["default"], [this].concat(parameters));
|
|
120
|
-
}; // Monkey-Patch loader-utils to define which url is a local request.
|
|
101
|
+
} // endregion
|
|
121
102
|
|
|
122
|
-
var loaderUtilsIsUrlRequestBackup = _loaderUtils["default"].isUrlRequest;
|
|
123
|
-
if (require.cache && require.resolve('loader-utils') in require.cache) require.cache[require.resolve('loader-utils')].exports.isUrlRequest = function (url) {
|
|
124
|
-
if (/^[a-z]+:.+/.exec(url)) return false;
|
|
125
103
|
|
|
126
|
-
|
|
127
|
-
parameters[_key2 - 1] = arguments[_key2];
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return loaderUtilsIsUrlRequestBackup.call.apply(loaderUtilsIsUrlRequestBackup, [_loaderUtils["default"], url].concat(parameters));
|
|
131
|
-
}; // / endregion
|
|
132
|
-
// endregion
|
|
133
|
-
// region initialisation
|
|
104
|
+
var _module = _configurator["default"].module; // region initialisation
|
|
134
105
|
// / region determine library name
|
|
135
106
|
|
|
136
107
|
var libraryName;
|
|
@@ -161,15 +132,15 @@ try {
|
|
|
161
132
|
}
|
|
162
133
|
|
|
163
134
|
var _loop = function _loop(source) {
|
|
164
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
135
|
+
if (Object.prototype.hasOwnProperty.call(_module.replacements.normal, source)) {
|
|
165
136
|
var search = new RegExp(source);
|
|
166
137
|
pluginInstances.push(new _webpack.NormalModuleReplacementPlugin(search, function (resource) {
|
|
167
|
-
resource.request = resource.request.replace(search,
|
|
138
|
+
resource.request = resource.request.replace(search, _module.replacements.normal[source]);
|
|
168
139
|
}));
|
|
169
140
|
}
|
|
170
141
|
};
|
|
171
142
|
|
|
172
|
-
for (var source in
|
|
143
|
+
for (var source in _module.replacements.normal) {
|
|
173
144
|
_loop(source);
|
|
174
145
|
} // // endregion
|
|
175
146
|
// // region generate html file
|
|
@@ -231,7 +202,7 @@ if (htmlAvailable && _configurator["default"].offline && plugins.Offline) {
|
|
|
231
202
|
|
|
232
203
|
|
|
233
204
|
if (_configurator["default"].buildContext.definitions) pluginInstances.push(new _webpack.DefinePlugin(_configurator["default"].buildContext.definitions));
|
|
234
|
-
if (
|
|
205
|
+
if (_module.provide) pluginInstances.push(new _webpack.ProvidePlugin(_module.provide)); // // endregion
|
|
235
206
|
// // region modules/assets
|
|
236
207
|
// /// region apply module pattern
|
|
237
208
|
|
|
@@ -242,12 +213,12 @@ pluginInstances.push({
|
|
|
242
213
|
if (Object.prototype.hasOwnProperty.call(compilation.assets, request)) {
|
|
243
214
|
var filePath = request.replace(/\?[^?]+$/, '');
|
|
244
215
|
|
|
245
|
-
var
|
|
216
|
+
var _type2 = _helper["default"].determineAssetType(filePath, _configurator["default"].buildContext.types, _configurator["default"].path);
|
|
246
217
|
|
|
247
|
-
if (
|
|
218
|
+
if (_type2 && _configurator["default"].assetPattern[_type2] && new RegExp(_configurator["default"].assetPattern[_type2].includeFilePathRegularExpression).test(filePath) && !new RegExp(_configurator["default"].assetPattern[_type2].excludeFilePathRegularExpression).test(filePath)) {
|
|
248
219
|
var _source = compilation.assets[request].source();
|
|
249
220
|
|
|
250
|
-
if (typeof _source === 'string') compilation.assets[request] = new _webpackSources.RawSource(_configurator["default"].assetPattern[
|
|
221
|
+
if (typeof _source === 'string') compilation.assets[request] = new _webpackSources.RawSource(_configurator["default"].assetPattern[_type2].pattern.replace(/\{1\}/g, _source.replace(/\$/g, '$$$')));
|
|
251
222
|
}
|
|
252
223
|
}
|
|
253
224
|
}
|
|
@@ -367,7 +338,7 @@ if (_configurator["default"].injection.external.modules === '__implicit__')
|
|
|
367
338
|
request = request.replace(/^!+/, '');
|
|
368
339
|
if (request.startsWith('/')) request = (0, _path.relative)(_configurator["default"].path.context, request);
|
|
369
340
|
|
|
370
|
-
var _iterator4 = _createForOfIteratorHelper(
|
|
341
|
+
var _iterator4 = _createForOfIteratorHelper(_module.directoryNames),
|
|
371
342
|
_step4;
|
|
372
343
|
|
|
373
344
|
try {
|
|
@@ -389,25 +360,29 @@ if (_configurator["default"].injection.external.modules === '__implicit__')
|
|
|
389
360
|
|
|
390
361
|
var filePath = _helper["default"].determineModuleFilePath(request, {}, {}, {
|
|
391
362
|
file: _configurator["default"].extensions.file.external
|
|
392
|
-
}, _configurator["default"].path.context, context, _configurator["default"].path.ignore,
|
|
363
|
+
}, _configurator["default"].path.context, context, _configurator["default"].path.ignore, _module.directoryNames, _configurator["default"]["package"].main.fileNames, _configurator["default"]["package"].main.propertyNames, _configurator["default"]["package"].aliasPropertyNames, _configurator["default"].encoding);
|
|
364
|
+
|
|
365
|
+
if (filePath) for (var _i3 = 0, _Object$entries2 = Object.entries(_configurator["default"].injection.external.aliases); _i3 < _Object$entries2.length; _i3++) {
|
|
366
|
+
var _Object$entries2$_i = (0, _slicedToArray2["default"])(_Object$entries2[_i3], 2),
|
|
367
|
+
pattern = _Object$entries2$_i[0],
|
|
368
|
+
targetConfiguration = _Object$entries2$_i[1];
|
|
393
369
|
|
|
394
|
-
|
|
395
|
-
if (Object.prototype.hasOwnProperty.call(_configurator["default"].injection.external.aliases, pattern) && pattern.startsWith('^')) {
|
|
370
|
+
if (pattern.startsWith('^')) {
|
|
396
371
|
var regularExpression = new RegExp(pattern);
|
|
397
372
|
|
|
398
373
|
if (regularExpression.test(filePath)) {
|
|
399
374
|
var match = false;
|
|
400
|
-
var
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
var
|
|
375
|
+
var firstKey = Object.keys(targetConfiguration)[0];
|
|
376
|
+
var target = targetConfiguration[firstKey];
|
|
377
|
+
if (typeof target !== 'string') break;
|
|
378
|
+
var replacementRegularExpression = new RegExp(firstKey);
|
|
404
379
|
|
|
405
380
|
if (target.startsWith('?')) {
|
|
406
381
|
target = target.substring(1);
|
|
407
382
|
var aliasedRequest = request.replace(replacementRegularExpression, target);
|
|
408
383
|
if (aliasedRequest !== request) match = Boolean(_helper["default"].determineModuleFilePath(aliasedRequest, {}, {}, {
|
|
409
384
|
file: _configurator["default"].extensions.file.external
|
|
410
|
-
}, _configurator["default"].path.context, context, _configurator["default"].path.ignore,
|
|
385
|
+
}, _configurator["default"].path.context, context, _configurator["default"].path.ignore, _module.directoryNames, _configurator["default"]["package"].main.fileNames, _configurator["default"]["package"].main.propertyNames, _configurator["default"]["package"].aliasPropertyNames, _configurator["default"].encoding));
|
|
411
386
|
} else match = true;
|
|
412
387
|
|
|
413
388
|
if (match) {
|
|
@@ -418,7 +393,7 @@ if (_configurator["default"].injection.external.modules === '__implicit__')
|
|
|
418
393
|
}
|
|
419
394
|
} // endregion
|
|
420
395
|
|
|
421
|
-
var resolvedRequest = _helper["default"].determineExternalRequest(request, _configurator["default"].path.context, context, _configurator["default"].injection.entry.normalized,
|
|
396
|
+
var resolvedRequest = _helper["default"].determineExternalRequest(request, _configurator["default"].path.context, context, _configurator["default"].injection.entry.normalized, _module.directoryNames, _module.aliases, _module.replacements.normal, _configurator["default"].extensions, _configurator["default"].path.source.asset.base, _configurator["default"].path.ignore, _module.directoryNames, _configurator["default"]["package"].main.fileNames, _configurator["default"]["package"].main.propertyNames, _configurator["default"]["package"].aliasPropertyNames, _configurator["default"].injection.external.implicit.pattern.include, _configurator["default"].injection.external.implicit.pattern.exclude, _configurator["default"].inPlace.externalLibrary.normal, _configurator["default"].inPlace.externalLibrary.dynamic, _configurator["default"].encoding);
|
|
422
397
|
|
|
423
398
|
if (resolvedRequest) {
|
|
424
399
|
var keys = ['amd', 'commonjs', 'commonjs2', 'root'];
|
|
@@ -450,8 +425,8 @@ if (_configurator["default"].injection.external.modules === '__implicit__')
|
|
|
450
425
|
|
|
451
426
|
try {
|
|
452
427
|
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
453
|
-
var
|
|
454
|
-
result[
|
|
428
|
+
var _key2 = _step6.value;
|
|
429
|
+
result[_key2] = _configurator["default"].injection.external.aliases[request](request, _key2);
|
|
455
430
|
}
|
|
456
431
|
} catch (err) {
|
|
457
432
|
_iterator6.e(err);
|
|
@@ -466,8 +441,8 @@ if (_configurator["default"].injection.external.modules === '__implicit__')
|
|
|
466
441
|
|
|
467
442
|
try {
|
|
468
443
|
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
469
|
-
var
|
|
470
|
-
if (!Object.prototype.hasOwnProperty.call(result,
|
|
444
|
+
var _key3 = _step7.value;
|
|
445
|
+
if (!Object.prototype.hasOwnProperty.call(result, _key3)) result[_key3] = result["default"];
|
|
471
446
|
}
|
|
472
447
|
} catch (err) {
|
|
473
448
|
_iterator7.e(err);
|
|
@@ -482,7 +457,7 @@ if (_configurator["default"].injection.external.modules === '__implicit__')
|
|
|
482
457
|
return _clientnode["default"].stringConvertToValidVariableName(name);
|
|
483
458
|
});
|
|
484
459
|
var exportFormat = _configurator["default"].exportFormat.external || _configurator["default"].exportFormat.self;
|
|
485
|
-
return callback(
|
|
460
|
+
return callback(undefined, exportFormat === 'umd' || typeof result === 'string' ? result : result[exportFormat], exportFormat);
|
|
486
461
|
}
|
|
487
462
|
|
|
488
463
|
return callback();
|
|
@@ -523,17 +498,15 @@ if (htmlAvailable) pluginInstances.push({
|
|
|
523
498
|
};
|
|
524
499
|
|
|
525
500
|
for (var tagName in linkables) {
|
|
526
|
-
if (Object.prototype.hasOwnProperty.call(linkables, tagName)) for (var
|
|
527
|
-
var domNode = _Array$from[
|
|
501
|
+
if (Object.prototype.hasOwnProperty.call(linkables, tagName)) for (var _i4 = 0, _Array$from = Array.from(dom.window.document.querySelectorAll("".concat(tagName, "[").concat(linkables[tagName], "*=\"?") + "".concat(_configurator["default"].hashAlgorithm, "=\"]"))); _i4 < _Array$from.length; _i4++) {
|
|
502
|
+
var domNode = _Array$from[_i4];
|
|
528
503
|
|
|
529
504
|
/*
|
|
530
505
|
NOTE: Removing symbols after a "&" in hash
|
|
531
506
|
string is necessary to match the generated
|
|
532
507
|
request strings in offline plugin.
|
|
533
508
|
*/
|
|
534
|
-
domNode.setAttribute(linkables[tagName],
|
|
535
|
-
// "null" even when we cast explicitly.
|
|
536
|
-
domNode.getAttribute(linkables[tagName]).replace(new RegExp('(\\?' + "".concat(_configurator["default"].hashAlgorithm, "=") + '[^&]+).*$'), '$1'));
|
|
509
|
+
domNode.setAttribute(linkables[tagName], domNode.getAttribute(linkables[tagName]).replace(new RegExp('(\\?' + "".concat(_configurator["default"].hashAlgorithm, "=") + '[^&]+).*$'), '$1'));
|
|
537
510
|
}
|
|
538
511
|
}
|
|
539
512
|
/*
|
|
@@ -591,10 +564,10 @@ if (htmlAvailable) pluginInstances.push({
|
|
|
591
564
|
// NOTE: This plugin should be loaded at last to ensure that all emitted images
|
|
592
565
|
// ran through.
|
|
593
566
|
|
|
594
|
-
if (plugins.
|
|
567
|
+
if (plugins.ImageMinimizer) pluginInstances.push(new plugins.ImageMinimizer(_module.optimizer.image.content)); // // endregion
|
|
595
568
|
// // region context replacements
|
|
596
569
|
|
|
597
|
-
var _iterator10 = _createForOfIteratorHelper(
|
|
570
|
+
var _iterator10 = _createForOfIteratorHelper(_module.replacements.context),
|
|
598
571
|
_step10;
|
|
599
572
|
|
|
600
573
|
try {
|
|
@@ -607,7 +580,7 @@ try {
|
|
|
607
580
|
__filename: __filename
|
|
608
581
|
});
|
|
609
582
|
|
|
610
|
-
if (evaluated.
|
|
583
|
+
if (evaluated.error) throw new Error('Error occurred during processing given context ' + "replacement: ".concat(evaluated.error));
|
|
611
584
|
return evaluated.result;
|
|
612
585
|
}))));
|
|
613
586
|
} // // endregion
|
|
@@ -626,7 +599,7 @@ try {
|
|
|
626
599
|
_iterator10.f();
|
|
627
600
|
}
|
|
628
601
|
|
|
629
|
-
if (
|
|
602
|
+
if (_module.enforceDeduplication) {
|
|
630
603
|
var absoluteContextPath = (0, _path.resolve)(_configurator["default"].path.context);
|
|
631
604
|
|
|
632
605
|
var consolidator = function consolidator(result) {
|
|
@@ -704,7 +677,7 @@ if (_configurator["default"].module.enforceDeduplication) {
|
|
|
704
677
|
not always work.
|
|
705
678
|
*/
|
|
706
679
|
|
|
707
|
-
result.request = result.createData.
|
|
680
|
+
result.request = result.createData.rawRequest = result.createData.request = result.createData.resource = result.createData.userRequest = alternateTargetPath;
|
|
708
681
|
return;
|
|
709
682
|
}
|
|
710
683
|
|
|
@@ -823,7 +796,7 @@ new NormalModuleReplacementPlugin(
|
|
|
823
796
|
|
|
824
797
|
var isFilePathInDependencies = function isFilePathInDependencies(filePath) {
|
|
825
798
|
filePath = _helper["default"].stripLoader(filePath);
|
|
826
|
-
return _helper["default"].isFilePathInLocation(filePath, _configurator["default"].path.ignore.concat(
|
|
799
|
+
return _helper["default"].isFilePathInLocation(filePath, _configurator["default"].path.ignore.concat(_module.directoryNames, _configurator["default"].loader.directoryNames).map(function (filePath) {
|
|
827
800
|
return (0, _path.resolve)(_configurator["default"].path.context, filePath);
|
|
828
801
|
}).filter(function (filePath) {
|
|
829
802
|
return !_configurator["default"].path.context.startsWith(filePath);
|
|
@@ -846,7 +819,7 @@ var evaluate = function evaluate(object) {
|
|
|
846
819
|
filePath: filePath
|
|
847
820
|
}, scope));
|
|
848
821
|
|
|
849
|
-
if (evaluated.
|
|
822
|
+
if (evaluated.error) throw new Error('Error occurred during processing given expression: ' + evaluated.error);
|
|
850
823
|
return evaluated.result;
|
|
851
824
|
}
|
|
852
825
|
|
|
@@ -860,7 +833,7 @@ var evaluateMapper = function evaluateMapper(value) {
|
|
|
860
833
|
var evaluateAdditionalLoaderConfiguration = function evaluateAdditionalLoaderConfiguration(loaderConfiguration) {
|
|
861
834
|
return {
|
|
862
835
|
exclude: function exclude(filePath) {
|
|
863
|
-
return evaluate(loaderConfiguration.exclude
|
|
836
|
+
return Boolean(evaluate(loaderConfiguration.exclude, filePath));
|
|
864
837
|
},
|
|
865
838
|
include: loaderConfiguration.include && evaluate(loaderConfiguration.include) || _configurator["default"].path.source.base,
|
|
866
839
|
test: new RegExp(evaluate(loaderConfiguration.test)),
|
|
@@ -868,35 +841,40 @@ var evaluateAdditionalLoaderConfiguration = function evaluateAdditionalLoaderCon
|
|
|
868
841
|
};
|
|
869
842
|
};
|
|
870
843
|
|
|
871
|
-
var includingPaths = _helper["default"].normalizePaths([_configurator["default"].path.source.asset.javaScript].concat(
|
|
844
|
+
var includingPaths = _helper["default"].normalizePaths([_configurator["default"].path.source.asset.javaScript].concat(_module.locations.directoryPaths));
|
|
872
845
|
|
|
873
|
-
var cssUse =
|
|
874
|
-
loader:
|
|
875
|
-
options:
|
|
846
|
+
var cssUse = _module.preprocessor.cascadingStyleSheet.additional.pre.map(evaluateMapper).concat({
|
|
847
|
+
loader: _module.style.loader,
|
|
848
|
+
options: _module.style.options || {}
|
|
876
849
|
}, {
|
|
877
|
-
loader:
|
|
878
|
-
options:
|
|
879
|
-
},
|
|
880
|
-
loader:
|
|
850
|
+
loader: _module.cascadingStyleSheet.loader,
|
|
851
|
+
options: _module.cascadingStyleSheet.options || {}
|
|
852
|
+
}, _module.preprocessor.cascadingStyleSheet.loader ? {
|
|
853
|
+
loader: _module.preprocessor.cascadingStyleSheet.loader,
|
|
881
854
|
options: _clientnode["default"].extend(true, (0, _clientnode.optionalRequire)('postcss') ? {
|
|
882
855
|
postcssOptions: {
|
|
856
|
+
/*
|
|
857
|
+
NOTE: Some plugins like "postcss-import" are
|
|
858
|
+
not yet ported to postcss 8. Let the final
|
|
859
|
+
consumer decide which distribution suites most.
|
|
860
|
+
*/
|
|
883
861
|
plugins: [].concat(postcssImport ? postcssImport({
|
|
884
862
|
root: _configurator["default"].path.context
|
|
885
|
-
}) : [],
|
|
863
|
+
}) : [], _module.preprocessor.cascadingStyleSheet.additional.plugins.pre.map(evaluateMapper),
|
|
886
864
|
/*
|
|
887
865
|
NOTE: Checking path doesn't work if fonts
|
|
888
866
|
are referenced in libraries provided in
|
|
889
867
|
another location than the project itself
|
|
890
868
|
like the "node_modules" folder.
|
|
891
869
|
*/
|
|
892
|
-
|
|
870
|
+
postcssFontpath ? postcssFontpath({
|
|
893
871
|
checkPath: false,
|
|
894
872
|
formats: [{
|
|
895
|
-
|
|
896
|
-
|
|
873
|
+
ext: 'woff2',
|
|
874
|
+
type: 'woff2'
|
|
897
875
|
}, {
|
|
898
|
-
|
|
899
|
-
|
|
876
|
+
ext: 'woff',
|
|
877
|
+
type: 'woff'
|
|
900
878
|
}]
|
|
901
879
|
}) : [], postcssURL ? postcssURL({
|
|
902
880
|
url: 'rebase'
|
|
@@ -913,10 +891,10 @@ var cssUse = _configurator["default"].module.preprocessor.cascadingStyleSheet.ad
|
|
|
913
891
|
},
|
|
914
892
|
stylesheetPath: _configurator["default"].path.source.asset.cascadingStyleSheet,
|
|
915
893
|
spritePath: _configurator["default"].path.source.asset.image
|
|
916
|
-
}) : [],
|
|
894
|
+
}) : [], _module.preprocessor.cascadingStyleSheet.additional.plugins.post.map(evaluateMapper), _module.optimizer.cssnano && postcssCSSnano ? postcssCSSnano(_module.optimizer.cssnano) : [])
|
|
917
895
|
}
|
|
918
|
-
} : {},
|
|
919
|
-
} : [],
|
|
896
|
+
} : {}, _module.preprocessor.cascadingStyleSheet.options || {})
|
|
897
|
+
} : [], _module.preprocessor.cascadingStyleSheet.additional.post.map(evaluateMapper));
|
|
920
898
|
|
|
921
899
|
var genericLoader = {
|
|
922
900
|
// Convert to compatible native web types.
|
|
@@ -925,29 +903,29 @@ var genericLoader = {
|
|
|
925
903
|
exclude: function exclude(filePath) {
|
|
926
904
|
return _helper["default"].normalizePaths(_configurator["default"].files.html.concat(_configurator["default"].files.defaultHTML).map(function (htmlConfiguration) {
|
|
927
905
|
return htmlConfiguration.template.filePath;
|
|
928
|
-
})).includes(filePath) ||
|
|
906
|
+
})).includes(filePath) || _module.preprocessor.ejs.exclude === null ? false : Boolean(evaluate(_module.preprocessor.ejs.exclude, filePath));
|
|
929
907
|
},
|
|
930
908
|
include: includingPaths,
|
|
931
909
|
test: /^(?!.+\.html\.ejs$).+\.ejs$/i,
|
|
932
|
-
use:
|
|
933
|
-
loader: 'file?name=[path][name]' + ((_clientnode["default"].isPlainObject(
|
|
910
|
+
use: _module.preprocessor.ejs.additional.pre.map(evaluateMapper).concat({
|
|
911
|
+
loader: 'file?name=[path][name]' + ((_clientnode["default"].isPlainObject(_module.preprocessor.ejs.options) ? _module.preprocessor.ejs.options : {
|
|
934
912
|
compileSteps: 2
|
|
935
913
|
}).compileSteps % 2 ? '.js' : '') + "?".concat(_configurator["default"].hashAlgorithm, "=[chunkhash]")
|
|
936
914
|
}, {
|
|
937
915
|
loader: 'extract'
|
|
938
916
|
}, {
|
|
939
|
-
loader:
|
|
940
|
-
options:
|
|
941
|
-
},
|
|
917
|
+
loader: _module.preprocessor.ejs.loader,
|
|
918
|
+
options: _module.preprocessor.ejs.options || {}
|
|
919
|
+
}, _module.preprocessor.ejs.additional.post.map(evaluateMapper))
|
|
942
920
|
},
|
|
943
921
|
// endregion
|
|
944
922
|
// region script
|
|
945
923
|
script: {
|
|
946
924
|
exclude: function exclude(filePath) {
|
|
947
|
-
return evaluate(
|
|
925
|
+
return Boolean(evaluate(_module.preprocessor.javaScript.exclude, filePath));
|
|
948
926
|
},
|
|
949
927
|
include: function include(filePath) {
|
|
950
|
-
var result = evaluate(
|
|
928
|
+
var result = evaluate(_module.preprocessor.javaScript.include, filePath);
|
|
951
929
|
|
|
952
930
|
if ([null, undefined].includes(result)) {
|
|
953
931
|
var _iterator13 = _createForOfIteratorHelper(includingPaths),
|
|
@@ -969,11 +947,11 @@ var genericLoader = {
|
|
|
969
947
|
|
|
970
948
|
return Boolean(result);
|
|
971
949
|
},
|
|
972
|
-
test: new RegExp(
|
|
973
|
-
use:
|
|
974
|
-
loader:
|
|
975
|
-
options:
|
|
976
|
-
},
|
|
950
|
+
test: new RegExp(_module.preprocessor.javaScript.regularExpression, 'i'),
|
|
951
|
+
use: _module.preprocessor.javaScript.additional.pre.map(evaluateMapper).concat({
|
|
952
|
+
loader: _module.preprocessor.javaScript.loader,
|
|
953
|
+
options: _module.preprocessor.javaScript.options || {}
|
|
954
|
+
}, _module.preprocessor.javaScript.additional.post.map(evaluateMapper))
|
|
977
955
|
},
|
|
978
956
|
// endregion
|
|
979
957
|
// region html template
|
|
@@ -987,42 +965,42 @@ var genericLoader = {
|
|
|
987
965
|
exclude: function exclude(filePath) {
|
|
988
966
|
return _helper["default"].normalizePaths(_configurator["default"].files.html.concat(_configurator["default"].files.defaultHTML).map(function (htmlConfiguration) {
|
|
989
967
|
return htmlConfiguration.template.filePath;
|
|
990
|
-
})).includes(filePath) || (
|
|
968
|
+
})).includes(filePath) || (_module.preprocessor.html.exclude === null ? false : Boolean(evaluate(_module.preprocessor.html.exclude, filePath)));
|
|
991
969
|
},
|
|
992
970
|
include: _configurator["default"].path.source.asset.template,
|
|
993
971
|
test: /\.html\.ejs(?:\?.*)?$/i,
|
|
994
|
-
use:
|
|
995
|
-
loader: 'file?name=' + (0, _path.join)((0, _path.relative)(_configurator["default"].path.target.asset.base, _configurator["default"].path.target.asset.template), '[name]' + ((_clientnode["default"].isPlainObject(
|
|
972
|
+
use: _module.preprocessor.html.additional.pre.map(evaluateMapper).concat({
|
|
973
|
+
loader: 'file?name=' + (0, _path.join)((0, _path.relative)(_configurator["default"].path.target.asset.base, _configurator["default"].path.target.asset.template), '[name]' + ((_clientnode["default"].isPlainObject(_module.preprocessor.html.options) ? _module.preprocessor.html.options : {
|
|
996
974
|
compileSteps: 2
|
|
997
975
|
}).compileSteps % 2 ? '.js' : '') + "?".concat(_configurator["default"].hashAlgorithm, "=[chunkhash]"))
|
|
998
|
-
}, (_clientnode["default"].isPlainObject(
|
|
976
|
+
}, (_clientnode["default"].isPlainObject(_module.preprocessor.html.options) ? _module.preprocessor.html.options : {
|
|
999
977
|
compileSteps: 2
|
|
1000
978
|
}).compileSteps % 2 ? [] : [{
|
|
1001
979
|
loader: 'extract'
|
|
1002
980
|
}, {
|
|
1003
|
-
loader:
|
|
1004
|
-
options:
|
|
981
|
+
loader: _module.html.loader,
|
|
982
|
+
options: _module.html.options || {}
|
|
1005
983
|
}], {
|
|
1006
|
-
loader:
|
|
1007
|
-
options:
|
|
1008
|
-
},
|
|
984
|
+
loader: _module.preprocessor.html.loader,
|
|
985
|
+
options: _module.preprocessor.html.options || {}
|
|
986
|
+
}, _module.preprocessor.html.additional.post.map(evaluateMapper))
|
|
1009
987
|
},
|
|
1010
988
|
html: {
|
|
1011
989
|
exclude: function exclude(filePath) {
|
|
1012
990
|
return _helper["default"].normalizePaths(_configurator["default"].files.html.concat(_configurator["default"].files.defaultHTML).map(function (htmlConfiguration) {
|
|
1013
991
|
return htmlConfiguration.template.filePath;
|
|
1014
|
-
})).includes(filePath) || (
|
|
992
|
+
})).includes(filePath) || (_module.html.exclude === null ? true : Boolean(evaluate(_module.html.exclude, filePath)));
|
|
1015
993
|
},
|
|
1016
994
|
include: _configurator["default"].path.source.asset.template,
|
|
1017
995
|
test: /\.html(?:\?.*)?$/i,
|
|
1018
|
-
use:
|
|
996
|
+
use: _module.html.additional.pre.map(evaluateMapper).concat({
|
|
1019
997
|
loader: 'file?name=' + (0, _path.join)((0, _path.relative)(_configurator["default"].path.target.base, _configurator["default"].path.target.asset.template), "[name][ext]?".concat(_configurator["default"].hashAlgorithm, "=") + '[chunkhash]')
|
|
1020
998
|
}, {
|
|
1021
999
|
loader: 'extract'
|
|
1022
1000
|
}, {
|
|
1023
|
-
loader:
|
|
1024
|
-
options:
|
|
1025
|
-
},
|
|
1001
|
+
loader: _module.html.loader,
|
|
1002
|
+
options: _module.html.options || {}
|
|
1003
|
+
}, _module.html.additional.post.map(evaluateMapper))
|
|
1026
1004
|
}
|
|
1027
1005
|
},
|
|
1028
1006
|
// endregion
|
|
@@ -1030,10 +1008,10 @@ var genericLoader = {
|
|
|
1030
1008
|
// region style
|
|
1031
1009
|
style: {
|
|
1032
1010
|
exclude: function exclude(filePath) {
|
|
1033
|
-
return
|
|
1011
|
+
return _module.cascadingStyleSheet.exclude === null ? isFilePathInDependencies(filePath) : Boolean(evaluate(_module.cascadingStyleSheet.exclude, filePath));
|
|
1034
1012
|
},
|
|
1035
1013
|
include: function include(filePath) {
|
|
1036
|
-
var result = evaluate(
|
|
1014
|
+
var result = evaluate(_module.cascadingStyleSheet.include, filePath);
|
|
1037
1015
|
|
|
1038
1016
|
if ([null, undefined].includes(result)) {
|
|
1039
1017
|
var _iterator14 = _createForOfIteratorHelper(includingPaths),
|
|
@@ -1064,7 +1042,7 @@ var genericLoader = {
|
|
|
1064
1042
|
font: {
|
|
1065
1043
|
eot: {
|
|
1066
1044
|
exclude: function exclude(filePath) {
|
|
1067
|
-
return
|
|
1045
|
+
return _module.optimizer.font.eot.exclude === null ? false : Boolean(evaluate(_module.optimizer.font.eot.exclude, filePath));
|
|
1068
1046
|
},
|
|
1069
1047
|
generator: {
|
|
1070
1048
|
filename: (0, _path.join)((0, _path.relative)(_configurator["default"].path.target.base, _configurator["default"].path.target.asset.font), '[name][ext]') + "?".concat(_configurator["default"].hashAlgorithm, "=[chunkhash]")
|
|
@@ -1076,11 +1054,11 @@ var genericLoader = {
|
|
|
1076
1054
|
maxSize: _configurator["default"].inPlace.otherMaximumFileSizeLimitInByte
|
|
1077
1055
|
}
|
|
1078
1056
|
},
|
|
1079
|
-
use:
|
|
1057
|
+
use: _module.optimizer.font.eot.loader.map(evaluateMapper)
|
|
1080
1058
|
},
|
|
1081
1059
|
svg: {
|
|
1082
1060
|
exclude: function exclude(filePath) {
|
|
1083
|
-
return
|
|
1061
|
+
return _module.optimizer.font.svg.exclude === null ? false : Boolean(evaluate(_module.optimizer.font.svg.exclude, filePath));
|
|
1084
1062
|
},
|
|
1085
1063
|
include: _configurator["default"].path.source.asset.font,
|
|
1086
1064
|
generator: {
|
|
@@ -1094,11 +1072,11 @@ var genericLoader = {
|
|
|
1094
1072
|
},
|
|
1095
1073
|
test: /\.svg(?:\?.*)?$/i,
|
|
1096
1074
|
type: 'asset/resource',
|
|
1097
|
-
use:
|
|
1075
|
+
use: _module.optimizer.font.svg.loader.map(evaluateMapper)
|
|
1098
1076
|
},
|
|
1099
1077
|
ttf: {
|
|
1100
1078
|
exclude: function exclude(filePath) {
|
|
1101
|
-
return
|
|
1079
|
+
return _module.optimizer.font.ttf.exclude === null ? false : Boolean(evaluate(_module.optimizer.font.ttf.exclude, filePath));
|
|
1102
1080
|
},
|
|
1103
1081
|
generator: {
|
|
1104
1082
|
filename: (0, _path.join)((0, _path.relative)(_configurator["default"].path.target.base, _configurator["default"].path.target.asset.font), '[name][ext]') + "?".concat(_configurator["default"].hashAlgorithm, "=[chunkhash]")
|
|
@@ -1111,11 +1089,11 @@ var genericLoader = {
|
|
|
1111
1089
|
maxSize: _configurator["default"].inPlace.otherMaximumFileSizeLimitInByte
|
|
1112
1090
|
}
|
|
1113
1091
|
},
|
|
1114
|
-
use:
|
|
1092
|
+
use: _module.optimizer.font.ttf.loader.map(evaluateMapper)
|
|
1115
1093
|
},
|
|
1116
1094
|
woff: {
|
|
1117
1095
|
exclude: function exclude(filePath) {
|
|
1118
|
-
return
|
|
1096
|
+
return _module.optimizer.font.woff.exclude === null ? false : Boolean(evaluate(_module.optimizer.font.woff.exclude, filePath));
|
|
1119
1097
|
},
|
|
1120
1098
|
generator: {
|
|
1121
1099
|
filename: (0, _path.join)((0, _path.relative)(_configurator["default"].path.target.base, _configurator["default"].path.target.asset.font), '[name][ext]') + "?".concat(_configurator["default"].hashAlgorithm, "=[chunkhash]")
|
|
@@ -1127,14 +1105,14 @@ var genericLoader = {
|
|
|
1127
1105
|
maxSize: _configurator["default"].inPlace.otherMaximumFileSizeLimitInByte
|
|
1128
1106
|
}
|
|
1129
1107
|
},
|
|
1130
|
-
use:
|
|
1108
|
+
use: _module.optimizer.font.woff.loader.map(evaluateMapper)
|
|
1131
1109
|
}
|
|
1132
1110
|
},
|
|
1133
1111
|
// endregion
|
|
1134
1112
|
// region image
|
|
1135
1113
|
image: {
|
|
1136
1114
|
exclude: function exclude(filePath) {
|
|
1137
|
-
return
|
|
1115
|
+
return _module.optimizer.image.exclude === null ? isFilePathInDependencies(filePath) : Boolean(evaluate(_module.optimizer.image.exclude, filePath));
|
|
1138
1116
|
},
|
|
1139
1117
|
generator: {
|
|
1140
1118
|
filename: (0, _path.join)((0, _path.relative)(_configurator["default"].path.target.base, _configurator["default"].path.target.asset.image), '[name][ext]') + "?".concat(_configurator["default"].hashAlgorithm, "=[chunkhash]")
|
|
@@ -1147,14 +1125,14 @@ var genericLoader = {
|
|
|
1147
1125
|
maxSize: _configurator["default"].inPlace.otherMaximumFileSizeLimitInByte
|
|
1148
1126
|
}
|
|
1149
1127
|
},
|
|
1150
|
-
use:
|
|
1128
|
+
use: _module.optimizer.image.loader.map(evaluateMapper)
|
|
1151
1129
|
},
|
|
1152
1130
|
// endregion
|
|
1153
1131
|
// region data
|
|
1154
1132
|
data: {
|
|
1155
1133
|
exclude: function exclude(filePath) {
|
|
1156
1134
|
if (typeof filePath !== 'string') return false;
|
|
1157
|
-
return _configurator["default"].extensions.file.internal.includes((0, _path.extname)(_helper["default"].stripLoader(filePath))) || (
|
|
1135
|
+
return _configurator["default"].extensions.file.internal.includes((0, _path.extname)(_helper["default"].stripLoader(filePath))) || (_module.optimizer.data.exclude === null ? isFilePathInDependencies(filePath) : Boolean(evaluate(_module.optimizer.data.exclude, filePath)));
|
|
1158
1136
|
},
|
|
1159
1137
|
generator: {
|
|
1160
1138
|
filename: (0, _path.join)((0, _path.relative)(_configurator["default"].path.target.base, _configurator["default"].path.target.asset.data), '[name][ext]') + "?".concat(_configurator["default"].hashAlgorithm, "=[chunkhash]")
|
|
@@ -1166,7 +1144,7 @@ var genericLoader = {
|
|
|
1166
1144
|
maxSize: _configurator["default"].inPlace.otherMaximumFileSizeLimitInByte
|
|
1167
1145
|
}
|
|
1168
1146
|
},
|
|
1169
|
-
use:
|
|
1147
|
+
use: _module.optimizer.data.loader.map(evaluateMapper)
|
|
1170
1148
|
} // endregion
|
|
1171
1149
|
|
|
1172
1150
|
};
|
|
@@ -1211,7 +1189,10 @@ var _iterator15 = _createForOfIteratorHelper(_configurator["default"].plugins),
|
|
|
1211
1189
|
try {
|
|
1212
1190
|
for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
|
|
1213
1191
|
var pluginConfiguration = _step15.value;
|
|
1214
|
-
|
|
1192
|
+
|
|
1193
|
+
var _plugin = (0, _clientnode.optionalRequire)(pluginConfiguration.name.module);
|
|
1194
|
+
|
|
1195
|
+
if (_plugin) pluginInstances.push((0, _construct2["default"])(_plugin[pluginConfiguration.name.initializer], (0, _toConsumableArray2["default"])(pluginConfiguration.parameters)));else console.warn("Configured plugin module \"".concat(pluginConfiguration.name.module, "\" ") + 'could not be loaded.');
|
|
1215
1196
|
} // region configuration
|
|
1216
1197
|
|
|
1217
1198
|
} catch (err) {
|
|
@@ -1225,7 +1206,7 @@ if ((_configuration$path$c = _configurator["default"].path.configuration) !== nu
|
|
|
1225
1206
|
require.resolve(_configurator["default"].path.configuration.json);
|
|
1226
1207
|
|
|
1227
1208
|
try {
|
|
1228
|
-
customConfiguration =
|
|
1209
|
+
customConfiguration = (0, _clientnode.currentRequire)(_configurator["default"].path.configuration.json);
|
|
1229
1210
|
} catch (error) {
|
|
1230
1211
|
console.debug('Importing provided json webpack configuration file path ' + "under \"".concat(_configurator["default"].path.configuration.json, "\" failed: ") + _clientnode["default"].represent(error));
|
|
1231
1212
|
}
|
|
@@ -1245,13 +1226,13 @@ var webpackConfiguration = _clientnode["default"].extend(true, {
|
|
|
1245
1226
|
entry: _configurator["default"].injection.entry.normalized,
|
|
1246
1227
|
externals: _configurator["default"].injection.external.modules,
|
|
1247
1228
|
resolve: {
|
|
1248
|
-
alias:
|
|
1229
|
+
alias: _module.aliases,
|
|
1249
1230
|
aliasFields: _configurator["default"]["package"].aliasPropertyNames,
|
|
1250
1231
|
extensions: _configurator["default"].extensions.file.internal,
|
|
1251
1232
|
mainFields: _configurator["default"]["package"].main.propertyNames,
|
|
1252
1233
|
mainFiles: _configurator["default"]["package"].main.fileNames,
|
|
1253
|
-
modules: _helper["default"].normalizePaths(
|
|
1254
|
-
symlinks:
|
|
1234
|
+
modules: _helper["default"].normalizePaths(_module.directoryNames),
|
|
1235
|
+
symlinks: _module.resolveSymlinks,
|
|
1255
1236
|
unsafeCache: Boolean((_configuration$cache = _configurator["default"].cache) === null || _configuration$cache === void 0 ? void 0 : _configuration$cache.unsafe)
|
|
1256
1237
|
},
|
|
1257
1238
|
resolveLoader: {
|
|
@@ -1289,7 +1270,7 @@ var webpackConfiguration = _clientnode["default"].extend(true, {
|
|
|
1289
1270
|
// endregion
|
|
1290
1271
|
mode: _configurator["default"].debug ? 'development' : 'production',
|
|
1291
1272
|
module: {
|
|
1292
|
-
rules:
|
|
1273
|
+
rules: _module.additional.pre.map(evaluateAdditionalLoaderConfiguration).concat(loader.ejs, loader.script, loader.html.main, loader.html.ejs, loader.html.html, loader.style, loader.font.eot, loader.font.svg, loader.font.ttf, loader.font.woff, loader.image, loader.data, _module.additional.post.map(evaluateAdditionalLoaderConfiguration))
|
|
1293
1274
|
},
|
|
1294
1275
|
node: _configurator["default"].nodeEnvironment,
|
|
1295
1276
|
optimization: _objectSpread({
|
|
@@ -1305,10 +1286,10 @@ var webpackConfiguration = _clientnode["default"].extend(true, {
|
|
|
1305
1286
|
chunks: 'all',
|
|
1306
1287
|
cacheGroups: {
|
|
1307
1288
|
defaultVendors: {
|
|
1308
|
-
chunks: function chunks(
|
|
1309
|
-
if ((0, _typeof2["default"])(_configurator["default"].inPlace.javaScript) === 'object' && _configurator["default"].inPlace.javaScript !== null) for (var
|
|
1310
|
-
var _name4 = _Object$keys[
|
|
1311
|
-
if (_name4 === '*' || _name4 ===
|
|
1289
|
+
chunks: function chunks(chunk) {
|
|
1290
|
+
if ((0, _typeof2["default"])(_configurator["default"].inPlace.javaScript) === 'object' && _configurator["default"].inPlace.javaScript !== null) for (var _i5 = 0, _Object$keys = Object.keys(_configurator["default"].inPlace.javaScript); _i5 < _Object$keys.length; _i5++) {
|
|
1291
|
+
var _name4 = _Object$keys[_i5];
|
|
1292
|
+
if (_name4 === '*' || _name4 === chunk.name) return false;
|
|
1312
1293
|
}
|
|
1313
1294
|
return true;
|
|
1314
1295
|
},
|
|
@@ -1318,7 +1299,7 @@ var webpackConfiguration = _clientnode["default"].extend(true, {
|
|
|
1318
1299
|
}
|
|
1319
1300
|
}
|
|
1320
1301
|
}, _configurator["default"].injection.chunks)
|
|
1321
|
-
}, _clientnode["default"].mask(
|
|
1302
|
+
}, _clientnode["default"].mask(_module.optimizer, {
|
|
1322
1303
|
exclude: {
|
|
1323
1304
|
babelMinify: true,
|
|
1324
1305
|
cssnano: true,
|
|
@@ -1335,19 +1316,14 @@ var webpackConfiguration = _clientnode["default"].extend(true, {
|
|
|
1335
1316
|
|
|
1336
1317
|
exports.webpackConfiguration = webpackConfiguration;
|
|
1337
1318
|
if (_configurator["default"].nodeENV !== null) webpackConfiguration.optimization.nodeEnv = _configurator["default"].nodeENV;
|
|
1338
|
-
if (!Array.isArray(
|
|
1319
|
+
if (!Array.isArray(_module.skipParseRegularExpressions) || _module.skipParseRegularExpressions.length) webpackConfiguration.module.noParse = _module.skipParseRegularExpressions;
|
|
1339
1320
|
if ((_configuration$path$c2 = _configurator["default"].path.configuration) !== null && _configuration$path$c2 !== void 0 && _configuration$path$c2.javaScript) try {
|
|
1340
1321
|
require.resolve(_configurator["default"].path.configuration.javaScript);
|
|
1341
1322
|
|
|
1342
|
-
var result;
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
} catch (error) {
|
|
1347
|
-
console.debug('Failed to load given JavaScript configuration file path "' + "".concat(_configurator["default"].path.configuration.javaScript, "\": ") + _clientnode["default"].represent(error));
|
|
1348
|
-
}
|
|
1349
|
-
|
|
1350
|
-
if (_clientnode["default"].isPlainObject(result)) if (Object.prototype.hasOwnProperty.call(result, 'replaceWebOptimizer')) exports.webpackConfiguration = webpackConfiguration = result.replaceWebOptimizer;else _clientnode["default"].extend(true, webpackConfiguration, result);
|
|
1323
|
+
var result = (0, _clientnode.optionalRequire)(_configurator["default"].path.configuration.javaScript);
|
|
1324
|
+
if (_clientnode["default"].isPlainObject(result)) {
|
|
1325
|
+
if (Object.prototype.hasOwnProperty.call(result, 'replaceWebOptimizer')) exports.webpackConfiguration = webpackConfiguration = result.replaceWebOptimizer;else _clientnode["default"].extend(true, webpackConfiguration, result);
|
|
1326
|
+
} else console.debug('Failed to load given JavaScript configuration file path "' + "".concat(_configurator["default"].path.configuration.javaScript, "\"."));
|
|
1351
1327
|
} catch (error) {
|
|
1352
1328
|
console.debug('Optional configuration file script "' + "".concat(_configurator["default"].path.configuration.javaScript, "\" not available."));
|
|
1353
1329
|
}
|