weboptimizer 2.0.1418 → 2.0.1419
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/package.json +5 -3
- package/type.d.ts +10 -0
- package/type.js +2 -0
- package/webpackConfigurator.js +55 -205
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weboptimizer",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1419",
|
|
4
4
|
"description": "A generic web optimizer, (module) bundler and development environment.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -42,6 +42,8 @@
|
|
|
42
42
|
"jestEnvironmentBrowser.js",
|
|
43
43
|
"jestSetup.d.ts",
|
|
44
44
|
"jestSetup.js",
|
|
45
|
+
"plufgins/HTMLTransformation.d.ts",
|
|
46
|
+
"plufgins/InPlaceAssetsIntoHTML.d.ts",
|
|
45
47
|
"stylelintConfigurator.d.ts",
|
|
46
48
|
"stylelintConfigurator.js",
|
|
47
49
|
"tsconfig.json",
|
|
@@ -61,13 +63,13 @@
|
|
|
61
63
|
},
|
|
62
64
|
"scripts": {
|
|
63
65
|
"build": "yarn build:types; yarn build:plain",
|
|
64
|
-
"build:plain": "command=\"babel --extensions '.ts' --plugins @babel/plugin-proposal-class-properties,@babel/plugin-syntax-top-level-await,@babel/plugin-transform-runtime,babel-plugin-transform-modern-regexp --presets @babel/preset-env,@babel/preset-typescript --out-file\" && $command browser.js browser.ts && $command configurator.js configurator.ts && $command ejsLoader.js ejsLoader.ts && $command helper.js helper.ts && $command index.js index.ts && $command jestEnvironmentBrowser.js jestEnvironmentBrowser.ts && $command jestSetup.js jestSetup.ts && $command stylelintConfigurator.js stylelintConfigurator.ts && $command type.js type.ts && $command webpackConfigurator.js webpackConfigurator.ts && shx chmod +x index.js && shx sed -i 's/(#!\\\\/usr\\\\/bin\\\\/env )babel-(node)/$1$2/' index.js 1>/dev/null",
|
|
66
|
+
"build:plain": "command=\"babel --extensions '.ts' --plugins @babel/plugin-proposal-class-properties,@babel/plugin-syntax-top-level-await,@babel/plugin-transform-runtime,babel-plugin-transform-modern-regexp --presets @babel/preset-env,@babel/preset-typescript --out-file\" && $command plugins/HTMLTransformation.js plugins/HTMLTransformation.ts && $command plugins/InPlaceAssetsIntoHTML.js plugins/InPlaceAssetsIntoHTML.ts && $command browser.js browser.ts && $command configurator.js configurator.ts && $command ejsLoader.js ejsLoader.ts && $command helper.js helper.ts && $command index.js index.ts && $command jestEnvironmentBrowser.js jestEnvironmentBrowser.ts && $command jestSetup.js jestSetup.ts && $command stylelintConfigurator.js stylelintConfigurator.ts && $command type.js type.ts && $command webpackConfigurator.js webpackConfigurator.ts && shx chmod +x index.js && shx sed -i 's/(#!\\\\/usr\\\\/bin\\\\/env )babel-(node)/$1$2/' index.js 1>/dev/null",
|
|
65
67
|
"build:test": "yarn clear && yarn build:plain && command='babel --extensions '.ts' --plugins @babel/plugin-proposal-class-properties,@babel/plugin-syntax-top-level-await,@babel/plugin-transform-runtime --presets @babel/preset-env,@babel/preset-typescript --source-root ../ --out-file' && cd test/simple && yarn; cd ../../ && cd test/scss && yarn; cd ../../ && rimraf node_modules/weboptimizer test/simple/node_modules/weboptimizer test/scss/node_modules/weboptimizer && shx mkdir -p node_modules/weboptimizer test/simple/node_modules/weboptimizer test/scss/node_modules/weboptimizer && copyCommand='shx cp *.ts *.js *.json *.ejs' && $copyCommand node_modules/weboptimizer/ && $copyCommand test/simple/node_modules/weboptimizer/ && $copyCommand test/scss/node_modules/weboptimizer/ && $command test/browser.js test/browser.ts && $command test/configurator.js test/configurator.ts && $command test/helper.js test/helper.ts && $command test/ejsLoader.js test/ejsLoader.ts && $command test/stylelintConfigurator.js test/stylelintConfigurator.ts && $command test/index.js test/index.ts && $command test/webpackConfigurator.js test/webpackConfigurator.ts",
|
|
66
68
|
"build:test:source-map": "yarn clear && yarn build:plain && command='babel --extensions '.ts' --plugins @babel/plugin-proposal-class-properties,@babel/plugin-syntax-top-level-await,@babel/plugin-transform-runtime --presets @babel/preset-env,@babel/preset-typescript --source-maps inline --source-root ../ --out-file' && rimraf node_modules/weboptimizer && shx mkdir -p node_modules/weboptimizer && shx cp *.ts *.js *.json *.ejs node_modules/weboptimizer/ && $command test/browser.js test/browser.ts && $command test/configurator.js test/configurator.ts && $command test/helper.js test/helper.ts && $command test/ejsLoader.js test/ejsLoader.ts && $command test/stylelintConfigurator.js test/stylelintConfigurator.ts && $command test/index.js test/index.ts && $command test/webpackConfigurator.js test/webpackConfigurator.ts",
|
|
67
69
|
"build:types": "tsc --declaration --emitDeclarationOnly",
|
|
68
70
|
"check": "yarn check:types; yarn lint",
|
|
69
71
|
"check:types": "tsc --noEmit",
|
|
70
|
-
"clear": "rimraf apiDocumentation browser.d.ts configurator.d.ts ejsLoader.d.ts helper.d.ts index.d.ts jestEnvironmentBrowser.d.ts stylelintConfigurator.d.ts type.d.ts webpackConfigurator.d.ts *.js *.compiled.* *.compiled test/*.js test/*.compiled.* test/*.d.ts *.html *.log node_modules/weboptimizer .coverage .nyc_output || true",
|
|
72
|
+
"clear": "rimraf apiDocumentation plugins/*.d.ts plugins/*.js browser.d.ts configurator.d.ts ejsLoader.d.ts helper.d.ts index.d.ts jestEnvironmentBrowser.d.ts stylelintConfigurator.d.ts type.d.ts webpackConfigurator.d.ts *.js *.compiled.* *.compiled test/*.js test/*.compiled.* test/*.d.ts *.html *.log node_modules/weboptimizer .coverage .nyc_output || true",
|
|
71
73
|
"document": "yarn build:plain && jsdoc --package ./package.json --readme ./readme.md --destination apiDocumentation *.js",
|
|
72
74
|
"lint": "yarn lint:base",
|
|
73
75
|
"lint:base": "eslint --ignore-pattern **/exclude/* --ignore-pattern '*.compiled.*' --ignore-pattern '*.d.ts' --ignore-pattern '*.js' --parser-options=project:tsconfig.json '*.ts' 'test/*.ts'",
|
package/type.d.ts
CHANGED
|
@@ -75,6 +75,16 @@ export interface InjectionConfiguration {
|
|
|
75
75
|
implicitExternalExcludePattern: Array<RegExp | string>;
|
|
76
76
|
implicitExternalIncludePattern: Array<RegExp | string>;
|
|
77
77
|
}
|
|
78
|
+
export interface HTMLTransformationOptions {
|
|
79
|
+
hashAlgorithm: string;
|
|
80
|
+
htmlPlugin: typeof HtmlWebpackPlugin;
|
|
81
|
+
files: Array<HTMLConfiguration>;
|
|
82
|
+
}
|
|
83
|
+
export interface InPlaceAssetsIntoHTMLOptions {
|
|
84
|
+
cascadingStyleSheet: InPlaceAssetConfiguration;
|
|
85
|
+
javaScript: InPlaceAssetConfiguration;
|
|
86
|
+
htmlPlugin: typeof HtmlWebpackPlugin;
|
|
87
|
+
}
|
|
78
88
|
export interface AssetPathConfiguration {
|
|
79
89
|
base: string;
|
|
80
90
|
cascadingStyleSheet: string;
|
package/type.js
CHANGED
package/webpackConfigurator.js
CHANGED
|
@@ -23,20 +23,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
23
23
|
exports.webpackConfiguration = exports.optionalRequire = exports["default"] = void 0;
|
|
24
24
|
var _construct2 = _interopRequireDefault(require("@babel/runtime/helpers/construct"));
|
|
25
25
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
26
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
27
26
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
28
|
-
var
|
|
29
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
27
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
30
28
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
31
29
|
var _clientnode = _interopRequireDefault(require("clientnode"));
|
|
32
|
-
var _jsdom = require("jsdom");
|
|
33
30
|
var _path = require("path");
|
|
34
31
|
var _util = _interopRequireDefault(require("util"));
|
|
35
32
|
var _webpack = require("webpack");
|
|
36
33
|
var _webpackSources = require("webpack-sources");
|
|
37
34
|
var _configurator = _interopRequireDefault(require("./configurator"));
|
|
38
35
|
var _helper = _interopRequireDefault(require("./helper"));
|
|
39
|
-
var
|
|
36
|
+
var _InPlaceAssetsIntoHTML = _interopRequireDefault(require("./plugins/InPlaceAssetsIntoHTML"));
|
|
37
|
+
var _HTMLTransformation = _interopRequireDefault(require("./plugins/HTMLTransformation"));
|
|
40
38
|
var _optionalRequire, _configuration$path$c, _configuration$cache$, _configuration$cache, _configuration$cache2, _configuration$cache3, _configuration$path$c2;
|
|
41
39
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
42
40
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -229,68 +227,11 @@ pluginInstances.push({
|
|
|
229
227
|
.replace(/##-#-#-##/g, '%>')
|
|
230
228
|
*/
|
|
231
229
|
|
|
232
|
-
if (htmlAvailable && !['serve', 'test:browser'].includes(configuration.givenCommandLineArguments[2]) && configuration.inPlace.cascadingStyleSheet && Object.keys(configuration.inPlace.cascadingStyleSheet).length || configuration.inPlace.javaScript && Object.keys(configuration.inPlace.javaScript).length) {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
(0, _createClass2["default"])(InPlaceAssetsIntoHTML, [{
|
|
238
|
-
key: "apply",
|
|
239
|
-
value: function apply(compiler) {
|
|
240
|
-
var _this = this;
|
|
241
|
-
var publicPath = compiler.options.output.publicPath || '';
|
|
242
|
-
if (publicPath && !publicPath.endsWith('/')) publicPath += '/';
|
|
243
|
-
compiler.hooks.compilation.tap('inPlaceHTMLAssets', function (compilation) {
|
|
244
|
-
var hooks = plugins.HTML.getHooks(compilation);
|
|
245
|
-
var inPlacedAssetNames = [];
|
|
246
|
-
hooks.alterAssetTagGroups.tap('inPlaceHTMLAssets', function (assets) {
|
|
247
|
-
var inPlace = function inPlace(type, tag) {
|
|
248
|
-
var settings;
|
|
249
|
-
var url = false;
|
|
250
|
-
if (tag.tagName === 'script') {
|
|
251
|
-
settings = configuration.inPlace.javaScript;
|
|
252
|
-
url = tag.attributes.src;
|
|
253
|
-
} else if (tag.tagName === 'style') {
|
|
254
|
-
settings = configuration.inPlace.cascadingStyleSheet;
|
|
255
|
-
url = tag.attributes.href;
|
|
256
|
-
}
|
|
257
|
-
if (!(url && typeof url === 'string')) return tag;
|
|
258
|
-
var name = publicPath ? url.replace(publicPath, '') : url;
|
|
259
|
-
if (compilation.assets[name] && settings[type] && [].concat(settings[type]).some(function (pattern) {
|
|
260
|
-
return new RegExp(pattern).test(name);
|
|
261
|
-
})) {
|
|
262
|
-
var newAttributes = _objectSpread({}, tag.attributes);
|
|
263
|
-
delete newAttributes.href;
|
|
264
|
-
delete newAttributes.src;
|
|
265
|
-
inPlacedAssetNames.push(name);
|
|
266
|
-
return _objectSpread(_objectSpread({}, tag), {}, {
|
|
267
|
-
attributes: newAttributes,
|
|
268
|
-
innerHTML: compilation.assets[name].source(),
|
|
269
|
-
tagName: 'script'
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
return tag;
|
|
273
|
-
};
|
|
274
|
-
assets.headTags = assets.headTags.map(inPlace.bind(_this, 'head'));
|
|
275
|
-
assets.bodyTags = assets.bodyTags.map(inPlace.bind(_this, 'body'));
|
|
276
|
-
return assets;
|
|
277
|
-
});
|
|
278
|
-
|
|
279
|
-
// NOTE: Avoid if you still want to emit the runtime chunks:
|
|
280
|
-
hooks.afterEmit.tap('inPlaceHTMLAssets', function (asset) {
|
|
281
|
-
for (var _i6 = 0, _inPlacedAssetNames = inPlacedAssetNames; _i6 < _inPlacedAssetNames.length; _i6++) {
|
|
282
|
-
var _name3 = _inPlacedAssetNames[_i6];
|
|
283
|
-
delete compilation.assets[_name3];
|
|
284
|
-
}
|
|
285
|
-
return asset;
|
|
286
|
-
});
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
}]);
|
|
290
|
-
return InPlaceAssetsIntoHTML;
|
|
291
|
-
}();
|
|
292
|
-
pluginInstances.push(new InPlaceAssetsIntoHTML());
|
|
293
|
-
}
|
|
230
|
+
if (htmlAvailable && !['serve', 'test:browser'].includes(configuration.givenCommandLineArguments[2]) && configuration.inPlace.cascadingStyleSheet && Object.keys(configuration.inPlace.cascadingStyleSheet).length || configuration.inPlace.javaScript && Object.keys(configuration.inPlace.javaScript).length) pluginInstances.push(new _InPlaceAssetsIntoHTML["default"]({
|
|
231
|
+
cascadingStyleSheet: configuration.inPlace.cascadingStyleSheet,
|
|
232
|
+
javaScript: configuration.inPlace.javaScript,
|
|
233
|
+
htmlPlugin: plugins.HTML
|
|
234
|
+
}));
|
|
294
235
|
///// endregion
|
|
295
236
|
///// region mark empty javaScript modules as dummy
|
|
296
237
|
if (!(configuration.needed.javaScript || configuration.needed.javaScriptExtension || configuration.needed.typeScript || configuration.needed.typeScriptExtension)) configuration.files.compose.javaScript = (0, _path.resolve)(configuration.path.target.asset.javaScript, '.__dummy__.compiled.js');
|
|
@@ -336,8 +277,8 @@ if (configuration.injection.external.modules === '__implicit__')
|
|
|
336
277
|
var filePath = _helper["default"].determineModuleFilePath(request, {}, {}, {
|
|
337
278
|
file: configuration.extensions.file.external
|
|
338
279
|
}, configuration.path.context, context, configuration.path.ignore, _module.directoryNames, configuration["package"].main.fileNames, configuration["package"].main.propertyNames, configuration["package"].aliasPropertyNames, configuration.encoding);
|
|
339
|
-
if (filePath) for (var
|
|
340
|
-
var _Object$entries5$_i = (0, _slicedToArray2["default"])(_Object$entries5[
|
|
280
|
+
if (filePath) for (var _i6 = 0, _Object$entries5 = Object.entries(configuration.injection.external.aliases); _i6 < _Object$entries5.length; _i6++) {
|
|
281
|
+
var _Object$entries5$_i = (0, _slicedToArray2["default"])(_Object$entries5[_i6], 2),
|
|
341
282
|
pattern = _Object$entries5$_i[0],
|
|
342
283
|
targetConfiguration = _Object$entries5$_i[1];
|
|
343
284
|
if (pattern.startsWith('^')) {
|
|
@@ -425,110 +366,19 @@ if (configuration.injection.external.modules === '__implicit__')
|
|
|
425
366
|
};
|
|
426
367
|
///// endregion
|
|
427
368
|
//// endregion
|
|
428
|
-
//// region apply final html
|
|
429
|
-
if (htmlAvailable) {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
(0, _createClass2["default"])(HTMLTransformation, [{
|
|
435
|
-
key: "apply",
|
|
436
|
-
value: function apply(compiler) {
|
|
437
|
-
compiler.hooks.compilation.tap('WebOptimizer', function (compilation) {
|
|
438
|
-
plugins.HTML.getHooks(compilation).beforeEmit.tap('WebOptimizerPostProcessHTML', function (data) {
|
|
439
|
-
/*
|
|
440
|
-
NOTE: We have to prevent creating native "style" dom nodes
|
|
441
|
-
to prevent jsdom from parsing the entire cascading style
|
|
442
|
-
sheet. Which is error prune and very resource intensive.
|
|
443
|
-
*/
|
|
444
|
-
var styleContents = [];
|
|
445
|
-
data.html = data.html.replace(/(<style[^>]*>)([\s\S]*?)(<\/style[^>]*>)/gi, function (match, startTag, content, endTag) {
|
|
446
|
-
styleContents.push(content);
|
|
447
|
-
return "".concat(startTag).concat(endTag);
|
|
448
|
-
});
|
|
449
|
-
var dom;
|
|
450
|
-
try {
|
|
451
|
-
/*
|
|
452
|
-
NOTE: We have to translate template delimiter to html
|
|
453
|
-
compatible sequences and translate it back later to
|
|
454
|
-
avoid unexpected escape sequences in resulting html.
|
|
455
|
-
*/
|
|
456
|
-
dom = new _jsdom.JSDOM(data.html.replace(/<%/g, '##+#+#+##').replace(/%>/g, '##-#-#-##'));
|
|
457
|
-
} catch (error) {
|
|
458
|
-
return data;
|
|
459
|
-
}
|
|
460
|
-
var linkables = {
|
|
461
|
-
link: 'href',
|
|
462
|
-
script: 'src'
|
|
463
|
-
};
|
|
464
|
-
for (var _i8 = 0, _Object$entries6 = Object.entries(linkables); _i8 < _Object$entries6.length; _i8++) {
|
|
465
|
-
var _Object$entries6$_i = (0, _slicedToArray2["default"])(_Object$entries6[_i8], 2),
|
|
466
|
-
tagName = _Object$entries6$_i[0],
|
|
467
|
-
attributeName = _Object$entries6$_i[1];
|
|
468
|
-
for (var _i9 = 0, _Array$from = Array.from(dom.window.document.querySelectorAll("".concat(tagName, "[").concat(attributeName, "*=\"?") + "".concat(configuration.hashAlgorithm, "=\"]"))); _i9 < _Array$from.length; _i9++) {
|
|
469
|
-
var domNode = _Array$from[_i9];
|
|
470
|
-
/*
|
|
471
|
-
NOTE: Removing symbols after a "&" in hash
|
|
472
|
-
string is necessary to match the generated
|
|
473
|
-
request strings in offline plugin.
|
|
474
|
-
*/
|
|
475
|
-
domNode.setAttribute(attributeName, domNode.getAttribute(attributeName).replace(new RegExp('(\\?' + "".concat(configuration.hashAlgorithm, "=") + '[^&]+).*$'), '$1'));
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
/*
|
|
479
|
-
NOTE: We have to restore template delimiter and style
|
|
480
|
-
contents.
|
|
481
|
-
*/
|
|
482
|
-
data.html = dom.serialize().replace(/##\+#\+#\+##/g, '<%').replace(/##-#-#-##/g, '%>').replace(/(<style[^>]*>)[\s\S]*?(<\/style[^>]*>)/gi, function (match, startTag, endTag) {
|
|
483
|
-
return "".concat(startTag).concat(styleContents.shift()) + endTag;
|
|
484
|
-
});
|
|
485
|
-
// region post compilation
|
|
486
|
-
var _iterator7 = _createForOfIteratorHelper(configuration.files.html),
|
|
487
|
-
_step7;
|
|
488
|
-
try {
|
|
489
|
-
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
490
|
-
var htmlFileSpecification = _step7.value;
|
|
491
|
-
if (htmlFileSpecification.filename === data.plugin.options.filename) {
|
|
492
|
-
var _iterator8 = _createForOfIteratorHelper([].concat(htmlFileSpecification.template.use)),
|
|
493
|
-
_step8;
|
|
494
|
-
try {
|
|
495
|
-
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
496
|
-
var _loaderConfiguration$;
|
|
497
|
-
var loaderConfiguration = _step8.value;
|
|
498
|
-
if ((_loaderConfiguration$ = loaderConfiguration.options) !== null && _loaderConfiguration$ !== void 0 && _loaderConfiguration$.compileSteps && typeof loaderConfiguration.options.compileSteps === 'number') data.html = _ejsLoader["default"].bind({
|
|
499
|
-
query: _clientnode["default"].extend(true, _clientnode["default"].copy(loaderConfiguration.options) || {}, htmlFileSpecification.template.postCompileOptions)
|
|
500
|
-
})(data.html);
|
|
501
|
-
}
|
|
502
|
-
} catch (err) {
|
|
503
|
-
_iterator8.e(err);
|
|
504
|
-
} finally {
|
|
505
|
-
_iterator8.f();
|
|
506
|
-
}
|
|
507
|
-
break;
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
// endregion
|
|
511
|
-
} catch (err) {
|
|
512
|
-
_iterator7.e(err);
|
|
513
|
-
} finally {
|
|
514
|
-
_iterator7.f();
|
|
515
|
-
}
|
|
516
|
-
return data;
|
|
517
|
-
});
|
|
518
|
-
});
|
|
519
|
-
}
|
|
520
|
-
}]);
|
|
521
|
-
return HTMLTransformation;
|
|
522
|
-
}();
|
|
523
|
-
pluginInstances.push(new HTMLTransformation());
|
|
524
|
-
}
|
|
369
|
+
//// region apply final html modifications/fixes
|
|
370
|
+
if (htmlAvailable) pluginInstances.push(new _HTMLTransformation["default"]({
|
|
371
|
+
hashAlgorithm: configuration.hashAlgorithm,
|
|
372
|
+
htmlPlugin: plugins.HTML,
|
|
373
|
+
files: configuration.files.html
|
|
374
|
+
}));
|
|
525
375
|
//// endregion
|
|
526
376
|
//// region context replacements
|
|
527
|
-
var
|
|
528
|
-
|
|
377
|
+
var _iterator7 = _createForOfIteratorHelper(_module.replacements.context),
|
|
378
|
+
_step7;
|
|
529
379
|
try {
|
|
530
|
-
for (
|
|
531
|
-
var contextReplacement =
|
|
380
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
381
|
+
var contextReplacement = _step7.value;
|
|
532
382
|
pluginInstances.push((0, _construct2["default"])(_webpack.ContextReplacementPlugin, (0, _toConsumableArray2["default"])(contextReplacement.map(function (value) {
|
|
533
383
|
var evaluated = _clientnode["default"].stringEvaluate(value, {
|
|
534
384
|
configuration: configuration,
|
|
@@ -548,9 +398,9 @@ try {
|
|
|
548
398
|
them as same dependency.
|
|
549
399
|
*/
|
|
550
400
|
} catch (err) {
|
|
551
|
-
|
|
401
|
+
_iterator7.e(err);
|
|
552
402
|
} finally {
|
|
553
|
-
|
|
403
|
+
_iterator7.f();
|
|
554
404
|
}
|
|
555
405
|
if (_module.enforceDeduplication) {
|
|
556
406
|
var absoluteContextPath = (0, _path.resolve)(configuration.path.context);
|
|
@@ -571,18 +421,18 @@ if (_module.enforceDeduplication) {
|
|
|
571
421
|
*/
|
|
572
422
|
pathPrefixes.pop();
|
|
573
423
|
var index = 0;
|
|
574
|
-
var
|
|
575
|
-
|
|
424
|
+
var _iterator8 = _createForOfIteratorHelper(pathPrefixes),
|
|
425
|
+
_step8;
|
|
576
426
|
try {
|
|
577
|
-
for (
|
|
578
|
-
var pathPrefix =
|
|
427
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
428
|
+
var pathPrefix = _step8.value;
|
|
579
429
|
if (index > 0) pathPrefixes[index] = (0, _path.resolve)(pathPrefixes[index - 1], pathPrefix);
|
|
580
430
|
index += 1;
|
|
581
431
|
}
|
|
582
432
|
} catch (err) {
|
|
583
|
-
|
|
433
|
+
_iterator8.e(err);
|
|
584
434
|
} finally {
|
|
585
|
-
|
|
435
|
+
_iterator8.f();
|
|
586
436
|
}
|
|
587
437
|
pathSuffix = targetPath.replace(/(?:^|.*\/)node_modules\/(.+$)/, '$1');
|
|
588
438
|
} else {
|
|
@@ -593,11 +443,11 @@ if (_module.enforceDeduplication) {
|
|
|
593
443
|
pathSuffix = targetPath.substring(_index).replace(/^.*\/node_modules\//, '');
|
|
594
444
|
}
|
|
595
445
|
var redundantRequest = null;
|
|
596
|
-
var
|
|
597
|
-
|
|
446
|
+
var _iterator9 = _createForOfIteratorHelper(pathPrefixes),
|
|
447
|
+
_step9;
|
|
598
448
|
try {
|
|
599
|
-
for (
|
|
600
|
-
var _pathPrefix =
|
|
449
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
450
|
+
var _pathPrefix = _step9.value;
|
|
601
451
|
var alternateTargetPath = (0, _path.resolve)(_pathPrefix, pathSuffix);
|
|
602
452
|
if (_clientnode["default"].isFileSync(alternateTargetPath)) {
|
|
603
453
|
var otherPackageDescriptor = _helper["default"].getClosestPackageDescriptor(alternateTargetPath);
|
|
@@ -622,9 +472,9 @@ if (_module.enforceDeduplication) {
|
|
|
622
472
|
}
|
|
623
473
|
}
|
|
624
474
|
} catch (err) {
|
|
625
|
-
|
|
475
|
+
_iterator9.e(err);
|
|
626
476
|
} finally {
|
|
627
|
-
|
|
477
|
+
_iterator9.f();
|
|
628
478
|
}
|
|
629
479
|
if (redundantRequest) console.warn('\nIncluding different versions of same package "' + "".concat(packageDescriptor.configuration.name, "\". Module \"") + "".concat(targetPath, "\" (version ") + "".concat(packageDescriptor.configuration.version, ") has ") + "redundancies with \"".concat(redundantRequest.path, "\" (") + "version ".concat(redundantRequest.version, ")."));
|
|
630
480
|
}
|
|
@@ -862,17 +712,17 @@ var genericLoader = {
|
|
|
862
712
|
include: function include(filePath) {
|
|
863
713
|
var result = evaluate(_module.preprocessor.javaScript.include, filePath);
|
|
864
714
|
if ([null, undefined].includes(result)) {
|
|
865
|
-
var
|
|
866
|
-
|
|
715
|
+
var _iterator10 = _createForOfIteratorHelper(getIncludingPaths(configuration.path.source.asset.javaScript)),
|
|
716
|
+
_step10;
|
|
867
717
|
try {
|
|
868
|
-
for (
|
|
869
|
-
var includePath =
|
|
718
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
719
|
+
var includePath = _step10.value;
|
|
870
720
|
if (filePath.startsWith(includePath)) return true;
|
|
871
721
|
}
|
|
872
722
|
} catch (err) {
|
|
873
|
-
|
|
723
|
+
_iterator10.e(err);
|
|
874
724
|
} finally {
|
|
875
|
-
|
|
725
|
+
_iterator10.f();
|
|
876
726
|
}
|
|
877
727
|
return false;
|
|
878
728
|
}
|
|
@@ -944,17 +794,17 @@ var genericLoader = {
|
|
|
944
794
|
include: function include(filePath) {
|
|
945
795
|
var result = evaluate(_module.cascadingStyleSheet.include, filePath);
|
|
946
796
|
if ([null, undefined].includes(result)) {
|
|
947
|
-
var
|
|
948
|
-
|
|
797
|
+
var _iterator11 = _createForOfIteratorHelper(getIncludingPaths(configuration.path.source.asset.cascadingStyleSheet)),
|
|
798
|
+
_step11;
|
|
949
799
|
try {
|
|
950
|
-
for (
|
|
951
|
-
var includePath =
|
|
800
|
+
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
801
|
+
var includePath = _step11.value;
|
|
952
802
|
if (filePath.startsWith(includePath)) return true;
|
|
953
803
|
}
|
|
954
804
|
} catch (err) {
|
|
955
|
-
|
|
805
|
+
_iterator11.e(err);
|
|
956
806
|
} finally {
|
|
957
|
-
|
|
807
|
+
_iterator11.f();
|
|
958
808
|
}
|
|
959
809
|
return false;
|
|
960
810
|
}
|
|
@@ -1104,11 +954,11 @@ if (htmlAvailable && configuration.debug && configuration.development.server.liv
|
|
|
1104
954
|
/// endregion
|
|
1105
955
|
// endregion
|
|
1106
956
|
// region plugins
|
|
1107
|
-
var
|
|
1108
|
-
|
|
957
|
+
var _iterator12 = _createForOfIteratorHelper(configuration.plugins),
|
|
958
|
+
_step12;
|
|
1109
959
|
try {
|
|
1110
|
-
for (
|
|
1111
|
-
var pluginConfiguration =
|
|
960
|
+
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
|
961
|
+
var pluginConfiguration = _step12.value;
|
|
1112
962
|
var _plugin = optionalRequire(pluginConfiguration.name.module);
|
|
1113
963
|
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.');
|
|
1114
964
|
}
|
|
@@ -1117,9 +967,9 @@ try {
|
|
|
1117
967
|
// NOTE: This plugin should be loaded at last to ensure that all emitted images
|
|
1118
968
|
// ran through.
|
|
1119
969
|
} catch (err) {
|
|
1120
|
-
|
|
970
|
+
_iterator12.e(err);
|
|
1121
971
|
} finally {
|
|
1122
|
-
|
|
972
|
+
_iterator12.f();
|
|
1123
973
|
}
|
|
1124
974
|
if (!_module.optimizer.minimizer) {
|
|
1125
975
|
_module.optimizer.minimizer = [];
|
|
@@ -1224,9 +1074,9 @@ var webpackConfiguration = exports.webpackConfiguration = _clientnode["default"]
|
|
|
1224
1074
|
cacheGroups: {
|
|
1225
1075
|
defaultVendors: {
|
|
1226
1076
|
chunks: function chunks(chunk) {
|
|
1227
|
-
if ((0, _typeof2["default"])(configuration.inPlace.javaScript) === 'object' && configuration.inPlace.javaScript !== null) for (var
|
|
1228
|
-
var
|
|
1229
|
-
if (
|
|
1077
|
+
if ((0, _typeof2["default"])(configuration.inPlace.javaScript) === 'object' && configuration.inPlace.javaScript !== null) for (var _i7 = 0, _Object$keys = Object.keys(configuration.inPlace.javaScript); _i7 < _Object$keys.length; _i7++) {
|
|
1078
|
+
var _name3 = _Object$keys[_i7];
|
|
1079
|
+
if (_name3 === '*' || _name3 === chunk.name) return false;
|
|
1230
1080
|
}
|
|
1231
1081
|
return true;
|
|
1232
1082
|
},
|