weboptimizer 2.0.1093 → 2.0.1097
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 +72 -21
- package/type.d.ts +64 -5
- package/type.js +1 -1
- package/webpackConfigurator.js +129 -128
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.1097",
|
|
4
4
|
"description": "A generic web optimizer, (module) bundler and development environment.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -116,6 +116,7 @@
|
|
|
116
116
|
"@types/html-minifier-terser": "*",
|
|
117
117
|
"@types/jest": "*",
|
|
118
118
|
"@types/jsdom": "*",
|
|
119
|
+
"@types/mini-css-extract-plugin": "*",
|
|
119
120
|
"@types/node": "*",
|
|
120
121
|
"@types/postcss-import": "*",
|
|
121
122
|
"@types/postcss-url": "*",
|
|
@@ -133,6 +134,7 @@
|
|
|
133
134
|
"eslint-plugin-jsdoc": "*",
|
|
134
135
|
"favicons": "*",
|
|
135
136
|
"favicons-webpack-plugin": "*",
|
|
137
|
+
"image-minimizer-webpack-plugin": "*",
|
|
136
138
|
"jest": "*",
|
|
137
139
|
"jsdoc": "*",
|
|
138
140
|
"mini-css-extract-plugin": "*",
|
|
@@ -160,6 +162,7 @@
|
|
|
160
162
|
"@types/html-minifier": "*",
|
|
161
163
|
"@types/jest": "*",
|
|
162
164
|
"@types/jsdom": "*",
|
|
165
|
+
"@types/mini-css-extract-plugin": "*",
|
|
163
166
|
"@types/node": "*",
|
|
164
167
|
"@types/webpack-env": "*",
|
|
165
168
|
"@types/workbox-webpack-plugin": "*",
|
|
@@ -172,7 +175,7 @@
|
|
|
172
175
|
"eslint-plugin-jsdoc": "*",
|
|
173
176
|
"favicons-webpack-plugin": "*",
|
|
174
177
|
"identity-obj-proxy": "*",
|
|
175
|
-
"
|
|
178
|
+
"image-minimizer-webpack-plugin": "*",
|
|
176
179
|
"jest": "*",
|
|
177
180
|
"jsdoc": "*",
|
|
178
181
|
"mini-css-extract-plugin": "*",
|
|
@@ -247,7 +250,7 @@
|
|
|
247
250
|
"identity-obj-proxy": {
|
|
248
251
|
"optional": true
|
|
249
252
|
},
|
|
250
|
-
"
|
|
253
|
+
"image-minimizer-webpack-plugin": {
|
|
251
254
|
"optional": true
|
|
252
255
|
},
|
|
253
256
|
"jest": {
|
|
@@ -994,24 +997,40 @@
|
|
|
994
997
|
},
|
|
995
998
|
"image": {
|
|
996
999
|
"content": {
|
|
997
|
-
"
|
|
998
|
-
"
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
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
|
+
]
|
|
1011
1030
|
},
|
|
1012
|
-
"
|
|
1013
|
-
|
|
1014
|
-
|
|
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
|
+
}
|
|
1015
1034
|
},
|
|
1016
1035
|
"loader": []
|
|
1017
1036
|
},
|
|
@@ -1376,8 +1395,40 @@
|
|
|
1376
1395
|
"extends": "stylelint-config-standard",
|
|
1377
1396
|
"ignoreFiles": "**/node_modules/*",
|
|
1378
1397
|
"rules": {
|
|
1398
|
+
"at-rule-empty-line-before": [
|
|
1399
|
+
"always",
|
|
1400
|
+
{
|
|
1401
|
+
"except": [
|
|
1402
|
+
"after-same-name",
|
|
1403
|
+
"first-nested"
|
|
1404
|
+
],
|
|
1405
|
+
"ignore": [
|
|
1406
|
+
"after-comment",
|
|
1407
|
+
"blockless-after-same-name-blockless"
|
|
1408
|
+
]
|
|
1409
|
+
}
|
|
1410
|
+
],
|
|
1379
1411
|
"comment-empty-line-before": "never",
|
|
1380
|
-
"
|
|
1412
|
+
"declaration-empty-line-before": [
|
|
1413
|
+
"always",
|
|
1414
|
+
{
|
|
1415
|
+
"except": [
|
|
1416
|
+
"first-nested"
|
|
1417
|
+
],
|
|
1418
|
+
"ignore": [
|
|
1419
|
+
"after-comment",
|
|
1420
|
+
"after-declaration",
|
|
1421
|
+
"inside-single-line-block"
|
|
1422
|
+
]
|
|
1423
|
+
}
|
|
1424
|
+
],
|
|
1425
|
+
"indentation": 4,
|
|
1426
|
+
"selector-class-pattern": [
|
|
1427
|
+
"^([a-z][a-z0-9]*)(((--?)|(__))[a-z0-9]+)*$",
|
|
1428
|
+
{
|
|
1429
|
+
"message": "Expected class selector to follow the \"BEM\" naming."
|
|
1430
|
+
}
|
|
1431
|
+
]
|
|
1381
1432
|
}
|
|
1382
1433
|
},
|
|
1383
1434
|
"targetTechnology": {
|
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,12 +48,12 @@ 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
|
|
|
55
|
+
var _ejsLoader = _interopRequireDefault(require("./ejsLoader"));
|
|
56
|
+
|
|
57
57
|
var _this = void 0,
|
|
58
58
|
_configuration$path$c,
|
|
59
59
|
_configuration$cache,
|
|
@@ -75,7 +75,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
75
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; }
|
|
76
76
|
|
|
77
77
|
var postcssCSSnano = (0, _clientnode.optionalRequire)('cssnano');
|
|
78
|
-
var
|
|
78
|
+
var postcssFontpath = (0, _clientnode.optionalRequire)('postcss-fontpath');
|
|
79
79
|
var postcssImport = (0, _clientnode.optionalRequire)('postcss-import');
|
|
80
80
|
var postcssSprites = (0, _clientnode.optionalRequire)('postcss-sprites');
|
|
81
81
|
var postcssURL = (0, _clientnode.optionalRequire)('postcss-url');
|
|
@@ -83,31 +83,27 @@ var pluginNameResourceMapping = {
|
|
|
83
83
|
HTML: 'html-webpack-plugin',
|
|
84
84
|
MiniCSSExtract: 'mini-css-extract-plugin',
|
|
85
85
|
Favicon: 'favicons-webpack-plugin',
|
|
86
|
-
|
|
86
|
+
ImageMinimizer: 'image-minimizer-webpack-plugin',
|
|
87
87
|
Offline: 'workbox-webpack-plugin'
|
|
88
88
|
};
|
|
89
89
|
var plugins = {};
|
|
90
90
|
|
|
91
91
|
for (var name in pluginNameResourceMapping) {
|
|
92
92
|
if (Object.prototype.hasOwnProperty.call(pluginNameResourceMapping, name)) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (plugins[name] === null) {
|
|
96
|
-
delete plugins[name];
|
|
97
|
-
console.debug("Optional webpack plugin \"".concat(name, "\" not available."));
|
|
98
|
-
}
|
|
93
|
+
var plugin = (0, _clientnode.optionalRequire)(pluginNameResourceMapping[name]);
|
|
94
|
+
if (plugin) plugins[name] = plugin;else console.debug("Optional webpack plugin \"".concat(name, "\" not available."));
|
|
99
95
|
}
|
|
100
96
|
}
|
|
101
97
|
|
|
102
98
|
if (plugins.Offline) {
|
|
103
99
|
plugins.GenerateServiceWorker = plugins.Offline.GenerateSW;
|
|
104
100
|
plugins.InjectManifest = plugins.Offline.InjectManifest;
|
|
105
|
-
}
|
|
101
|
+
} // endregion
|
|
106
102
|
|
|
107
|
-
|
|
108
|
-
//
|
|
109
|
-
// region initialisation
|
|
103
|
+
|
|
104
|
+
var _module = _configurator["default"].module; // region initialisation
|
|
110
105
|
// / region determine library name
|
|
106
|
+
|
|
111
107
|
var libraryName;
|
|
112
108
|
if (_configurator["default"].libraryName) libraryName = _configurator["default"].libraryName;else if (Object.keys(_configurator["default"].injection.entry.normalized).length > 1) libraryName = '[name]';else {
|
|
113
109
|
libraryName = _configurator["default"].name;
|
|
@@ -136,15 +132,15 @@ try {
|
|
|
136
132
|
}
|
|
137
133
|
|
|
138
134
|
var _loop = function _loop(source) {
|
|
139
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
135
|
+
if (Object.prototype.hasOwnProperty.call(_module.replacements.normal, source)) {
|
|
140
136
|
var search = new RegExp(source);
|
|
141
137
|
pluginInstances.push(new _webpack.NormalModuleReplacementPlugin(search, function (resource) {
|
|
142
|
-
resource.request = resource.request.replace(search,
|
|
138
|
+
resource.request = resource.request.replace(search, _module.replacements.normal[source]);
|
|
143
139
|
}));
|
|
144
140
|
}
|
|
145
141
|
};
|
|
146
142
|
|
|
147
|
-
for (var source in
|
|
143
|
+
for (var source in _module.replacements.normal) {
|
|
148
144
|
_loop(source);
|
|
149
145
|
} // // endregion
|
|
150
146
|
// // region generate html file
|
|
@@ -206,7 +202,7 @@ if (htmlAvailable && _configurator["default"].offline && plugins.Offline) {
|
|
|
206
202
|
|
|
207
203
|
|
|
208
204
|
if (_configurator["default"].buildContext.definitions) pluginInstances.push(new _webpack.DefinePlugin(_configurator["default"].buildContext.definitions));
|
|
209
|
-
if (
|
|
205
|
+
if (_module.provide) pluginInstances.push(new _webpack.ProvidePlugin(_module.provide)); // // endregion
|
|
210
206
|
// // region modules/assets
|
|
211
207
|
// /// region apply module pattern
|
|
212
208
|
|
|
@@ -217,12 +213,12 @@ pluginInstances.push({
|
|
|
217
213
|
if (Object.prototype.hasOwnProperty.call(compilation.assets, request)) {
|
|
218
214
|
var filePath = request.replace(/\?[^?]+$/, '');
|
|
219
215
|
|
|
220
|
-
var
|
|
216
|
+
var _type2 = _helper["default"].determineAssetType(filePath, _configurator["default"].buildContext.types, _configurator["default"].path);
|
|
221
217
|
|
|
222
|
-
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)) {
|
|
223
219
|
var _source = compilation.assets[request].source();
|
|
224
220
|
|
|
225
|
-
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, '$$$')));
|
|
226
222
|
}
|
|
227
223
|
}
|
|
228
224
|
}
|
|
@@ -342,7 +338,7 @@ if (_configurator["default"].injection.external.modules === '__implicit__')
|
|
|
342
338
|
request = request.replace(/^!+/, '');
|
|
343
339
|
if (request.startsWith('/')) request = (0, _path.relative)(_configurator["default"].path.context, request);
|
|
344
340
|
|
|
345
|
-
var _iterator4 = _createForOfIteratorHelper(
|
|
341
|
+
var _iterator4 = _createForOfIteratorHelper(_module.directoryNames),
|
|
346
342
|
_step4;
|
|
347
343
|
|
|
348
344
|
try {
|
|
@@ -364,25 +360,29 @@ if (_configurator["default"].injection.external.modules === '__implicit__')
|
|
|
364
360
|
|
|
365
361
|
var filePath = _helper["default"].determineModuleFilePath(request, {}, {}, {
|
|
366
362
|
file: _configurator["default"].extensions.file.external
|
|
367
|
-
}, _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);
|
|
368
364
|
|
|
369
|
-
if (filePath) for (var
|
|
370
|
-
|
|
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];
|
|
369
|
+
|
|
370
|
+
if (pattern.startsWith('^')) {
|
|
371
371
|
var regularExpression = new RegExp(pattern);
|
|
372
372
|
|
|
373
373
|
if (regularExpression.test(filePath)) {
|
|
374
374
|
var match = false;
|
|
375
|
-
var
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
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);
|
|
379
379
|
|
|
380
380
|
if (target.startsWith('?')) {
|
|
381
381
|
target = target.substring(1);
|
|
382
382
|
var aliasedRequest = request.replace(replacementRegularExpression, target);
|
|
383
383
|
if (aliasedRequest !== request) match = Boolean(_helper["default"].determineModuleFilePath(aliasedRequest, {}, {}, {
|
|
384
384
|
file: _configurator["default"].extensions.file.external
|
|
385
|
-
}, _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));
|
|
386
386
|
} else match = true;
|
|
387
387
|
|
|
388
388
|
if (match) {
|
|
@@ -393,7 +393,7 @@ if (_configurator["default"].injection.external.modules === '__implicit__')
|
|
|
393
393
|
}
|
|
394
394
|
} // endregion
|
|
395
395
|
|
|
396
|
-
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);
|
|
397
397
|
|
|
398
398
|
if (resolvedRequest) {
|
|
399
399
|
var keys = ['amd', 'commonjs', 'commonjs2', 'root'];
|
|
@@ -425,8 +425,8 @@ if (_configurator["default"].injection.external.modules === '__implicit__')
|
|
|
425
425
|
|
|
426
426
|
try {
|
|
427
427
|
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
428
|
-
var
|
|
429
|
-
result[
|
|
428
|
+
var _key2 = _step6.value;
|
|
429
|
+
result[_key2] = _configurator["default"].injection.external.aliases[request](request, _key2);
|
|
430
430
|
}
|
|
431
431
|
} catch (err) {
|
|
432
432
|
_iterator6.e(err);
|
|
@@ -441,8 +441,8 @@ if (_configurator["default"].injection.external.modules === '__implicit__')
|
|
|
441
441
|
|
|
442
442
|
try {
|
|
443
443
|
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
444
|
-
var
|
|
445
|
-
if (!Object.prototype.hasOwnProperty.call(result,
|
|
444
|
+
var _key3 = _step7.value;
|
|
445
|
+
if (!Object.prototype.hasOwnProperty.call(result, _key3)) result[_key3] = result["default"];
|
|
446
446
|
}
|
|
447
447
|
} catch (err) {
|
|
448
448
|
_iterator7.e(err);
|
|
@@ -457,7 +457,7 @@ if (_configurator["default"].injection.external.modules === '__implicit__')
|
|
|
457
457
|
return _clientnode["default"].stringConvertToValidVariableName(name);
|
|
458
458
|
});
|
|
459
459
|
var exportFormat = _configurator["default"].exportFormat.external || _configurator["default"].exportFormat.self;
|
|
460
|
-
return callback(
|
|
460
|
+
return callback(undefined, exportFormat === 'umd' || typeof result === 'string' ? result : result[exportFormat], exportFormat);
|
|
461
461
|
}
|
|
462
462
|
|
|
463
463
|
return callback();
|
|
@@ -498,17 +498,15 @@ if (htmlAvailable) pluginInstances.push({
|
|
|
498
498
|
};
|
|
499
499
|
|
|
500
500
|
for (var tagName in linkables) {
|
|
501
|
-
if (Object.prototype.hasOwnProperty.call(linkables, tagName)) for (var
|
|
502
|
-
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];
|
|
503
503
|
|
|
504
504
|
/*
|
|
505
505
|
NOTE: Removing symbols after a "&" in hash
|
|
506
506
|
string is necessary to match the generated
|
|
507
507
|
request strings in offline plugin.
|
|
508
508
|
*/
|
|
509
|
-
domNode.setAttribute(linkables[tagName],
|
|
510
|
-
// "null" even when we cast explicitly.
|
|
511
|
-
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'));
|
|
512
510
|
}
|
|
513
511
|
}
|
|
514
512
|
/*
|
|
@@ -566,10 +564,10 @@ if (htmlAvailable) pluginInstances.push({
|
|
|
566
564
|
// NOTE: This plugin should be loaded at last to ensure that all emitted images
|
|
567
565
|
// ran through.
|
|
568
566
|
|
|
569
|
-
if (plugins.
|
|
567
|
+
if (plugins.ImageMinimizer) pluginInstances.push(new plugins.ImageMinimizer(_module.optimizer.image.content)); // // endregion
|
|
570
568
|
// // region context replacements
|
|
571
569
|
|
|
572
|
-
var _iterator10 = _createForOfIteratorHelper(
|
|
570
|
+
var _iterator10 = _createForOfIteratorHelper(_module.replacements.context),
|
|
573
571
|
_step10;
|
|
574
572
|
|
|
575
573
|
try {
|
|
@@ -582,7 +580,7 @@ try {
|
|
|
582
580
|
__filename: __filename
|
|
583
581
|
});
|
|
584
582
|
|
|
585
|
-
if (evaluated.
|
|
583
|
+
if (evaluated.error) throw new Error('Error occurred during processing given context ' + "replacement: ".concat(evaluated.error));
|
|
586
584
|
return evaluated.result;
|
|
587
585
|
}))));
|
|
588
586
|
} // // endregion
|
|
@@ -601,7 +599,7 @@ try {
|
|
|
601
599
|
_iterator10.f();
|
|
602
600
|
}
|
|
603
601
|
|
|
604
|
-
if (
|
|
602
|
+
if (_module.enforceDeduplication) {
|
|
605
603
|
var absoluteContextPath = (0, _path.resolve)(_configurator["default"].path.context);
|
|
606
604
|
|
|
607
605
|
var consolidator = function consolidator(result) {
|
|
@@ -679,7 +677,7 @@ if (_configurator["default"].module.enforceDeduplication) {
|
|
|
679
677
|
not always work.
|
|
680
678
|
*/
|
|
681
679
|
|
|
682
|
-
result.request = result.createData.
|
|
680
|
+
result.request = result.createData.rawRequest = result.createData.request = result.createData.resource = result.createData.userRequest = alternateTargetPath;
|
|
683
681
|
return;
|
|
684
682
|
}
|
|
685
683
|
|
|
@@ -798,7 +796,7 @@ new NormalModuleReplacementPlugin(
|
|
|
798
796
|
|
|
799
797
|
var isFilePathInDependencies = function isFilePathInDependencies(filePath) {
|
|
800
798
|
filePath = _helper["default"].stripLoader(filePath);
|
|
801
|
-
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) {
|
|
802
800
|
return (0, _path.resolve)(_configurator["default"].path.context, filePath);
|
|
803
801
|
}).filter(function (filePath) {
|
|
804
802
|
return !_configurator["default"].path.context.startsWith(filePath);
|
|
@@ -821,7 +819,7 @@ var evaluate = function evaluate(object) {
|
|
|
821
819
|
filePath: filePath
|
|
822
820
|
}, scope));
|
|
823
821
|
|
|
824
|
-
if (evaluated.
|
|
822
|
+
if (evaluated.error) throw new Error('Error occurred during processing given expression: ' + evaluated.error);
|
|
825
823
|
return evaluated.result;
|
|
826
824
|
}
|
|
827
825
|
|
|
@@ -835,7 +833,7 @@ var evaluateMapper = function evaluateMapper(value) {
|
|
|
835
833
|
var evaluateAdditionalLoaderConfiguration = function evaluateAdditionalLoaderConfiguration(loaderConfiguration) {
|
|
836
834
|
return {
|
|
837
835
|
exclude: function exclude(filePath) {
|
|
838
|
-
return evaluate(loaderConfiguration.exclude
|
|
836
|
+
return Boolean(evaluate(loaderConfiguration.exclude, filePath));
|
|
839
837
|
},
|
|
840
838
|
include: loaderConfiguration.include && evaluate(loaderConfiguration.include) || _configurator["default"].path.source.base,
|
|
841
839
|
test: new RegExp(evaluate(loaderConfiguration.test)),
|
|
@@ -843,35 +841,40 @@ var evaluateAdditionalLoaderConfiguration = function evaluateAdditionalLoaderCon
|
|
|
843
841
|
};
|
|
844
842
|
};
|
|
845
843
|
|
|
846
|
-
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));
|
|
847
845
|
|
|
848
|
-
var cssUse =
|
|
849
|
-
loader:
|
|
850
|
-
options:
|
|
846
|
+
var cssUse = _module.preprocessor.cascadingStyleSheet.additional.pre.map(evaluateMapper).concat({
|
|
847
|
+
loader: _module.style.loader,
|
|
848
|
+
options: _module.style.options || {}
|
|
851
849
|
}, {
|
|
852
|
-
loader:
|
|
853
|
-
options:
|
|
854
|
-
},
|
|
855
|
-
loader:
|
|
850
|
+
loader: _module.cascadingStyleSheet.loader,
|
|
851
|
+
options: _module.cascadingStyleSheet.options || {}
|
|
852
|
+
}, _module.preprocessor.cascadingStyleSheet.loader ? {
|
|
853
|
+
loader: _module.preprocessor.cascadingStyleSheet.loader,
|
|
856
854
|
options: _clientnode["default"].extend(true, (0, _clientnode.optionalRequire)('postcss') ? {
|
|
857
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
|
+
*/
|
|
858
861
|
plugins: [].concat(postcssImport ? postcssImport({
|
|
859
862
|
root: _configurator["default"].path.context
|
|
860
|
-
}) : [],
|
|
863
|
+
}) : [], _module.preprocessor.cascadingStyleSheet.additional.plugins.pre.map(evaluateMapper),
|
|
861
864
|
/*
|
|
862
865
|
NOTE: Checking path doesn't work if fonts
|
|
863
866
|
are referenced in libraries provided in
|
|
864
867
|
another location than the project itself
|
|
865
868
|
like the "node_modules" folder.
|
|
866
869
|
*/
|
|
867
|
-
|
|
870
|
+
postcssFontpath ? postcssFontpath({
|
|
868
871
|
checkPath: false,
|
|
869
872
|
formats: [{
|
|
870
|
-
|
|
871
|
-
|
|
873
|
+
ext: 'woff2',
|
|
874
|
+
type: 'woff2'
|
|
872
875
|
}, {
|
|
873
|
-
|
|
874
|
-
|
|
876
|
+
ext: 'woff',
|
|
877
|
+
type: 'woff'
|
|
875
878
|
}]
|
|
876
879
|
}) : [], postcssURL ? postcssURL({
|
|
877
880
|
url: 'rebase'
|
|
@@ -888,10 +891,10 @@ var cssUse = _configurator["default"].module.preprocessor.cascadingStyleSheet.ad
|
|
|
888
891
|
},
|
|
889
892
|
stylesheetPath: _configurator["default"].path.source.asset.cascadingStyleSheet,
|
|
890
893
|
spritePath: _configurator["default"].path.source.asset.image
|
|
891
|
-
}) : [],
|
|
894
|
+
}) : [], _module.preprocessor.cascadingStyleSheet.additional.plugins.post.map(evaluateMapper), _module.optimizer.cssnano && postcssCSSnano ? postcssCSSnano(_module.optimizer.cssnano) : [])
|
|
892
895
|
}
|
|
893
|
-
} : {},
|
|
894
|
-
} : [],
|
|
896
|
+
} : {}, _module.preprocessor.cascadingStyleSheet.options || {})
|
|
897
|
+
} : [], _module.preprocessor.cascadingStyleSheet.additional.post.map(evaluateMapper));
|
|
895
898
|
|
|
896
899
|
var genericLoader = {
|
|
897
900
|
// Convert to compatible native web types.
|
|
@@ -900,29 +903,29 @@ var genericLoader = {
|
|
|
900
903
|
exclude: function exclude(filePath) {
|
|
901
904
|
return _helper["default"].normalizePaths(_configurator["default"].files.html.concat(_configurator["default"].files.defaultHTML).map(function (htmlConfiguration) {
|
|
902
905
|
return htmlConfiguration.template.filePath;
|
|
903
|
-
})).includes(filePath) ||
|
|
906
|
+
})).includes(filePath) || _module.preprocessor.ejs.exclude === null ? false : Boolean(evaluate(_module.preprocessor.ejs.exclude, filePath));
|
|
904
907
|
},
|
|
905
908
|
include: includingPaths,
|
|
906
909
|
test: /^(?!.+\.html\.ejs$).+\.ejs$/i,
|
|
907
|
-
use:
|
|
908
|
-
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 : {
|
|
909
912
|
compileSteps: 2
|
|
910
913
|
}).compileSteps % 2 ? '.js' : '') + "?".concat(_configurator["default"].hashAlgorithm, "=[chunkhash]")
|
|
911
914
|
}, {
|
|
912
915
|
loader: 'extract'
|
|
913
916
|
}, {
|
|
914
|
-
loader:
|
|
915
|
-
options:
|
|
916
|
-
},
|
|
917
|
+
loader: _module.preprocessor.ejs.loader,
|
|
918
|
+
options: _module.preprocessor.ejs.options || {}
|
|
919
|
+
}, _module.preprocessor.ejs.additional.post.map(evaluateMapper))
|
|
917
920
|
},
|
|
918
921
|
// endregion
|
|
919
922
|
// region script
|
|
920
923
|
script: {
|
|
921
924
|
exclude: function exclude(filePath) {
|
|
922
|
-
return evaluate(
|
|
925
|
+
return Boolean(evaluate(_module.preprocessor.javaScript.exclude, filePath));
|
|
923
926
|
},
|
|
924
927
|
include: function include(filePath) {
|
|
925
|
-
var result = evaluate(
|
|
928
|
+
var result = evaluate(_module.preprocessor.javaScript.include, filePath);
|
|
926
929
|
|
|
927
930
|
if ([null, undefined].includes(result)) {
|
|
928
931
|
var _iterator13 = _createForOfIteratorHelper(includingPaths),
|
|
@@ -944,11 +947,11 @@ var genericLoader = {
|
|
|
944
947
|
|
|
945
948
|
return Boolean(result);
|
|
946
949
|
},
|
|
947
|
-
test: new RegExp(
|
|
948
|
-
use:
|
|
949
|
-
loader:
|
|
950
|
-
options:
|
|
951
|
-
},
|
|
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))
|
|
952
955
|
},
|
|
953
956
|
// endregion
|
|
954
957
|
// region html template
|
|
@@ -962,42 +965,42 @@ var genericLoader = {
|
|
|
962
965
|
exclude: function exclude(filePath) {
|
|
963
966
|
return _helper["default"].normalizePaths(_configurator["default"].files.html.concat(_configurator["default"].files.defaultHTML).map(function (htmlConfiguration) {
|
|
964
967
|
return htmlConfiguration.template.filePath;
|
|
965
|
-
})).includes(filePath) || (
|
|
968
|
+
})).includes(filePath) || (_module.preprocessor.html.exclude === null ? false : Boolean(evaluate(_module.preprocessor.html.exclude, filePath)));
|
|
966
969
|
},
|
|
967
970
|
include: _configurator["default"].path.source.asset.template,
|
|
968
971
|
test: /\.html\.ejs(?:\?.*)?$/i,
|
|
969
|
-
use:
|
|
970
|
-
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 : {
|
|
971
974
|
compileSteps: 2
|
|
972
975
|
}).compileSteps % 2 ? '.js' : '') + "?".concat(_configurator["default"].hashAlgorithm, "=[chunkhash]"))
|
|
973
|
-
}, (_clientnode["default"].isPlainObject(
|
|
976
|
+
}, (_clientnode["default"].isPlainObject(_module.preprocessor.html.options) ? _module.preprocessor.html.options : {
|
|
974
977
|
compileSteps: 2
|
|
975
978
|
}).compileSteps % 2 ? [] : [{
|
|
976
979
|
loader: 'extract'
|
|
977
980
|
}, {
|
|
978
|
-
loader:
|
|
979
|
-
options:
|
|
981
|
+
loader: _module.html.loader,
|
|
982
|
+
options: _module.html.options || {}
|
|
980
983
|
}], {
|
|
981
|
-
loader:
|
|
982
|
-
options:
|
|
983
|
-
},
|
|
984
|
+
loader: _module.preprocessor.html.loader,
|
|
985
|
+
options: _module.preprocessor.html.options || {}
|
|
986
|
+
}, _module.preprocessor.html.additional.post.map(evaluateMapper))
|
|
984
987
|
},
|
|
985
988
|
html: {
|
|
986
989
|
exclude: function exclude(filePath) {
|
|
987
990
|
return _helper["default"].normalizePaths(_configurator["default"].files.html.concat(_configurator["default"].files.defaultHTML).map(function (htmlConfiguration) {
|
|
988
991
|
return htmlConfiguration.template.filePath;
|
|
989
|
-
})).includes(filePath) || (
|
|
992
|
+
})).includes(filePath) || (_module.html.exclude === null ? true : Boolean(evaluate(_module.html.exclude, filePath)));
|
|
990
993
|
},
|
|
991
994
|
include: _configurator["default"].path.source.asset.template,
|
|
992
995
|
test: /\.html(?:\?.*)?$/i,
|
|
993
|
-
use:
|
|
996
|
+
use: _module.html.additional.pre.map(evaluateMapper).concat({
|
|
994
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]')
|
|
995
998
|
}, {
|
|
996
999
|
loader: 'extract'
|
|
997
1000
|
}, {
|
|
998
|
-
loader:
|
|
999
|
-
options:
|
|
1000
|
-
},
|
|
1001
|
+
loader: _module.html.loader,
|
|
1002
|
+
options: _module.html.options || {}
|
|
1003
|
+
}, _module.html.additional.post.map(evaluateMapper))
|
|
1001
1004
|
}
|
|
1002
1005
|
},
|
|
1003
1006
|
// endregion
|
|
@@ -1005,10 +1008,10 @@ var genericLoader = {
|
|
|
1005
1008
|
// region style
|
|
1006
1009
|
style: {
|
|
1007
1010
|
exclude: function exclude(filePath) {
|
|
1008
|
-
return
|
|
1011
|
+
return _module.cascadingStyleSheet.exclude === null ? isFilePathInDependencies(filePath) : Boolean(evaluate(_module.cascadingStyleSheet.exclude, filePath));
|
|
1009
1012
|
},
|
|
1010
1013
|
include: function include(filePath) {
|
|
1011
|
-
var result = evaluate(
|
|
1014
|
+
var result = evaluate(_module.cascadingStyleSheet.include, filePath);
|
|
1012
1015
|
|
|
1013
1016
|
if ([null, undefined].includes(result)) {
|
|
1014
1017
|
var _iterator14 = _createForOfIteratorHelper(includingPaths),
|
|
@@ -1039,7 +1042,7 @@ var genericLoader = {
|
|
|
1039
1042
|
font: {
|
|
1040
1043
|
eot: {
|
|
1041
1044
|
exclude: function exclude(filePath) {
|
|
1042
|
-
return
|
|
1045
|
+
return _module.optimizer.font.eot.exclude === null ? false : Boolean(evaluate(_module.optimizer.font.eot.exclude, filePath));
|
|
1043
1046
|
},
|
|
1044
1047
|
generator: {
|
|
1045
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]")
|
|
@@ -1051,11 +1054,11 @@ var genericLoader = {
|
|
|
1051
1054
|
maxSize: _configurator["default"].inPlace.otherMaximumFileSizeLimitInByte
|
|
1052
1055
|
}
|
|
1053
1056
|
},
|
|
1054
|
-
use:
|
|
1057
|
+
use: _module.optimizer.font.eot.loader.map(evaluateMapper)
|
|
1055
1058
|
},
|
|
1056
1059
|
svg: {
|
|
1057
1060
|
exclude: function exclude(filePath) {
|
|
1058
|
-
return
|
|
1061
|
+
return _module.optimizer.font.svg.exclude === null ? false : Boolean(evaluate(_module.optimizer.font.svg.exclude, filePath));
|
|
1059
1062
|
},
|
|
1060
1063
|
include: _configurator["default"].path.source.asset.font,
|
|
1061
1064
|
generator: {
|
|
@@ -1069,11 +1072,11 @@ var genericLoader = {
|
|
|
1069
1072
|
},
|
|
1070
1073
|
test: /\.svg(?:\?.*)?$/i,
|
|
1071
1074
|
type: 'asset/resource',
|
|
1072
|
-
use:
|
|
1075
|
+
use: _module.optimizer.font.svg.loader.map(evaluateMapper)
|
|
1073
1076
|
},
|
|
1074
1077
|
ttf: {
|
|
1075
1078
|
exclude: function exclude(filePath) {
|
|
1076
|
-
return
|
|
1079
|
+
return _module.optimizer.font.ttf.exclude === null ? false : Boolean(evaluate(_module.optimizer.font.ttf.exclude, filePath));
|
|
1077
1080
|
},
|
|
1078
1081
|
generator: {
|
|
1079
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]")
|
|
@@ -1086,11 +1089,11 @@ var genericLoader = {
|
|
|
1086
1089
|
maxSize: _configurator["default"].inPlace.otherMaximumFileSizeLimitInByte
|
|
1087
1090
|
}
|
|
1088
1091
|
},
|
|
1089
|
-
use:
|
|
1092
|
+
use: _module.optimizer.font.ttf.loader.map(evaluateMapper)
|
|
1090
1093
|
},
|
|
1091
1094
|
woff: {
|
|
1092
1095
|
exclude: function exclude(filePath) {
|
|
1093
|
-
return
|
|
1096
|
+
return _module.optimizer.font.woff.exclude === null ? false : Boolean(evaluate(_module.optimizer.font.woff.exclude, filePath));
|
|
1094
1097
|
},
|
|
1095
1098
|
generator: {
|
|
1096
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]")
|
|
@@ -1102,14 +1105,14 @@ var genericLoader = {
|
|
|
1102
1105
|
maxSize: _configurator["default"].inPlace.otherMaximumFileSizeLimitInByte
|
|
1103
1106
|
}
|
|
1104
1107
|
},
|
|
1105
|
-
use:
|
|
1108
|
+
use: _module.optimizer.font.woff.loader.map(evaluateMapper)
|
|
1106
1109
|
}
|
|
1107
1110
|
},
|
|
1108
1111
|
// endregion
|
|
1109
1112
|
// region image
|
|
1110
1113
|
image: {
|
|
1111
1114
|
exclude: function exclude(filePath) {
|
|
1112
|
-
return
|
|
1115
|
+
return _module.optimizer.image.exclude === null ? isFilePathInDependencies(filePath) : Boolean(evaluate(_module.optimizer.image.exclude, filePath));
|
|
1113
1116
|
},
|
|
1114
1117
|
generator: {
|
|
1115
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]")
|
|
@@ -1122,14 +1125,14 @@ var genericLoader = {
|
|
|
1122
1125
|
maxSize: _configurator["default"].inPlace.otherMaximumFileSizeLimitInByte
|
|
1123
1126
|
}
|
|
1124
1127
|
},
|
|
1125
|
-
use:
|
|
1128
|
+
use: _module.optimizer.image.loader.map(evaluateMapper)
|
|
1126
1129
|
},
|
|
1127
1130
|
// endregion
|
|
1128
1131
|
// region data
|
|
1129
1132
|
data: {
|
|
1130
1133
|
exclude: function exclude(filePath) {
|
|
1131
1134
|
if (typeof filePath !== 'string') return false;
|
|
1132
|
-
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)));
|
|
1133
1136
|
},
|
|
1134
1137
|
generator: {
|
|
1135
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]")
|
|
@@ -1141,7 +1144,7 @@ var genericLoader = {
|
|
|
1141
1144
|
maxSize: _configurator["default"].inPlace.otherMaximumFileSizeLimitInByte
|
|
1142
1145
|
}
|
|
1143
1146
|
},
|
|
1144
|
-
use:
|
|
1147
|
+
use: _module.optimizer.data.loader.map(evaluateMapper)
|
|
1145
1148
|
} // endregion
|
|
1146
1149
|
|
|
1147
1150
|
};
|
|
@@ -1186,7 +1189,10 @@ var _iterator15 = _createForOfIteratorHelper(_configurator["default"].plugins),
|
|
|
1186
1189
|
try {
|
|
1187
1190
|
for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
|
|
1188
1191
|
var pluginConfiguration = _step15.value;
|
|
1189
|
-
|
|
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.');
|
|
1190
1196
|
} // region configuration
|
|
1191
1197
|
|
|
1192
1198
|
} catch (err) {
|
|
@@ -1200,7 +1206,7 @@ if ((_configuration$path$c = _configurator["default"].path.configuration) !== nu
|
|
|
1200
1206
|
require.resolve(_configurator["default"].path.configuration.json);
|
|
1201
1207
|
|
|
1202
1208
|
try {
|
|
1203
|
-
customConfiguration =
|
|
1209
|
+
customConfiguration = (0, _clientnode.currentRequire)(_configurator["default"].path.configuration.json);
|
|
1204
1210
|
} catch (error) {
|
|
1205
1211
|
console.debug('Importing provided json webpack configuration file path ' + "under \"".concat(_configurator["default"].path.configuration.json, "\" failed: ") + _clientnode["default"].represent(error));
|
|
1206
1212
|
}
|
|
@@ -1220,13 +1226,13 @@ var webpackConfiguration = _clientnode["default"].extend(true, {
|
|
|
1220
1226
|
entry: _configurator["default"].injection.entry.normalized,
|
|
1221
1227
|
externals: _configurator["default"].injection.external.modules,
|
|
1222
1228
|
resolve: {
|
|
1223
|
-
alias:
|
|
1229
|
+
alias: _module.aliases,
|
|
1224
1230
|
aliasFields: _configurator["default"]["package"].aliasPropertyNames,
|
|
1225
1231
|
extensions: _configurator["default"].extensions.file.internal,
|
|
1226
1232
|
mainFields: _configurator["default"]["package"].main.propertyNames,
|
|
1227
1233
|
mainFiles: _configurator["default"]["package"].main.fileNames,
|
|
1228
|
-
modules: _helper["default"].normalizePaths(
|
|
1229
|
-
symlinks:
|
|
1234
|
+
modules: _helper["default"].normalizePaths(_module.directoryNames),
|
|
1235
|
+
symlinks: _module.resolveSymlinks,
|
|
1230
1236
|
unsafeCache: Boolean((_configuration$cache = _configurator["default"].cache) === null || _configuration$cache === void 0 ? void 0 : _configuration$cache.unsafe)
|
|
1231
1237
|
},
|
|
1232
1238
|
resolveLoader: {
|
|
@@ -1264,7 +1270,7 @@ var webpackConfiguration = _clientnode["default"].extend(true, {
|
|
|
1264
1270
|
// endregion
|
|
1265
1271
|
mode: _configurator["default"].debug ? 'development' : 'production',
|
|
1266
1272
|
module: {
|
|
1267
|
-
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))
|
|
1268
1274
|
},
|
|
1269
1275
|
node: _configurator["default"].nodeEnvironment,
|
|
1270
1276
|
optimization: _objectSpread({
|
|
@@ -1280,10 +1286,10 @@ var webpackConfiguration = _clientnode["default"].extend(true, {
|
|
|
1280
1286
|
chunks: 'all',
|
|
1281
1287
|
cacheGroups: {
|
|
1282
1288
|
defaultVendors: {
|
|
1283
|
-
chunks: function chunks(
|
|
1284
|
-
if ((0, _typeof2["default"])(_configurator["default"].inPlace.javaScript) === 'object' && _configurator["default"].inPlace.javaScript !== null) for (var
|
|
1285
|
-
var _name4 = _Object$keys[
|
|
1286
|
-
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;
|
|
1287
1293
|
}
|
|
1288
1294
|
return true;
|
|
1289
1295
|
},
|
|
@@ -1293,7 +1299,7 @@ var webpackConfiguration = _clientnode["default"].extend(true, {
|
|
|
1293
1299
|
}
|
|
1294
1300
|
}
|
|
1295
1301
|
}, _configurator["default"].injection.chunks)
|
|
1296
|
-
}, _clientnode["default"].mask(
|
|
1302
|
+
}, _clientnode["default"].mask(_module.optimizer, {
|
|
1297
1303
|
exclude: {
|
|
1298
1304
|
babelMinify: true,
|
|
1299
1305
|
cssnano: true,
|
|
@@ -1310,19 +1316,14 @@ var webpackConfiguration = _clientnode["default"].extend(true, {
|
|
|
1310
1316
|
|
|
1311
1317
|
exports.webpackConfiguration = webpackConfiguration;
|
|
1312
1318
|
if (_configurator["default"].nodeENV !== null) webpackConfiguration.optimization.nodeEnv = _configurator["default"].nodeENV;
|
|
1313
|
-
if (!Array.isArray(
|
|
1319
|
+
if (!Array.isArray(_module.skipParseRegularExpressions) || _module.skipParseRegularExpressions.length) webpackConfiguration.module.noParse = _module.skipParseRegularExpressions;
|
|
1314
1320
|
if ((_configuration$path$c2 = _configurator["default"].path.configuration) !== null && _configuration$path$c2 !== void 0 && _configuration$path$c2.javaScript) try {
|
|
1315
1321
|
require.resolve(_configurator["default"].path.configuration.javaScript);
|
|
1316
1322
|
|
|
1317
|
-
var result;
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
} catch (error) {
|
|
1322
|
-
console.debug('Failed to load given JavaScript configuration file path "' + "".concat(_configurator["default"].path.configuration.javaScript, "\": ") + _clientnode["default"].represent(error));
|
|
1323
|
-
}
|
|
1324
|
-
|
|
1325
|
-
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, "\"."));
|
|
1326
1327
|
} catch (error) {
|
|
1327
1328
|
console.debug('Optional configuration file script "' + "".concat(_configurator["default"].path.configuration.javaScript, "\" not available."));
|
|
1328
1329
|
}
|