weboptimizer 2.0.1417 → 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 +7 -5
- package/type.d.ts +10 -0
- package/type.js +2 -0
- package/webpackConfigurator.js +56 -190
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'",
|
|
@@ -560,7 +562,7 @@
|
|
|
560
562
|
"directory": {
|
|
561
563
|
"__evaluate__": "path.resolve(self.path.base, self.module.directoryNames[0])"
|
|
562
564
|
},
|
|
563
|
-
"watch":
|
|
565
|
+
"watch": false
|
|
564
566
|
}
|
|
565
567
|
],
|
|
566
568
|
"watchFiles": {
|
|
@@ -887,7 +889,7 @@
|
|
|
887
889
|
"node_modules"
|
|
888
890
|
],
|
|
889
891
|
"enforceDeduplication": {
|
|
890
|
-
"__evaluate__": "
|
|
892
|
+
"__evaluate__": "self.module.resolveSymlinks"
|
|
891
893
|
},
|
|
892
894
|
"html": {
|
|
893
895
|
"additional": {
|
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,26 +23,19 @@ 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"));
|
|
27
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
28
28
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
29
29
|
var _clientnode = _interopRequireDefault(require("clientnode"));
|
|
30
|
-
var _jsdom = require("jsdom");
|
|
31
30
|
var _path = require("path");
|
|
32
31
|
var _util = _interopRequireDefault(require("util"));
|
|
33
32
|
var _webpack = require("webpack");
|
|
34
33
|
var _webpackSources = require("webpack-sources");
|
|
35
34
|
var _configurator = _interopRequireDefault(require("./configurator"));
|
|
36
35
|
var _helper = _interopRequireDefault(require("./helper"));
|
|
37
|
-
var
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
_configuration$path$c,
|
|
41
|
-
_configuration$cache$,
|
|
42
|
-
_configuration$cache,
|
|
43
|
-
_configuration$cache2,
|
|
44
|
-
_configuration$cache3,
|
|
45
|
-
_configuration$path$c2;
|
|
36
|
+
var _InPlaceAssetsIntoHTML = _interopRequireDefault(require("./plugins/InPlaceAssetsIntoHTML"));
|
|
37
|
+
var _HTMLTransformation = _interopRequireDefault(require("./plugins/HTMLTransformation"));
|
|
38
|
+
var _optionalRequire, _configuration$path$c, _configuration$cache$, _configuration$cache, _configuration$cache2, _configuration$cache3, _configuration$path$c2;
|
|
46
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; }
|
|
47
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; }
|
|
48
41
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
@@ -234,57 +227,11 @@ pluginInstances.push({
|
|
|
234
227
|
.replace(/##-#-#-##/g, '%>')
|
|
235
228
|
*/
|
|
236
229
|
|
|
237
|
-
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({
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
var hooks = plugins.HTML.getHooks(compilation);
|
|
243
|
-
var inPlacedAssetNames = [];
|
|
244
|
-
hooks.alterAssetTagGroups.tap('inPlaceHTMLAssets', function (assets) {
|
|
245
|
-
var inPlace = function inPlace(type, tag) {
|
|
246
|
-
var settings;
|
|
247
|
-
var url = false;
|
|
248
|
-
if (tag.tagName === 'script') {
|
|
249
|
-
settings = configuration.inPlace.javaScript;
|
|
250
|
-
url = tag.attributes.src;
|
|
251
|
-
} else if (tag.tagName === 'style') {
|
|
252
|
-
settings = configuration.inPlace.cascadingStyleSheet;
|
|
253
|
-
url = tag.attributes.href;
|
|
254
|
-
}
|
|
255
|
-
if (!(url && typeof url === 'string')) return tag;
|
|
256
|
-
var name = publicPath ? url.replace(publicPath, '') : url;
|
|
257
|
-
if (compilation.assets[name] && settings[type] && [].concat(settings[type]).some(function (pattern) {
|
|
258
|
-
return new RegExp(pattern).test(name);
|
|
259
|
-
})) {
|
|
260
|
-
var newAttributes = _objectSpread({}, tag.attributes);
|
|
261
|
-
delete newAttributes.href;
|
|
262
|
-
delete newAttributes.src;
|
|
263
|
-
inPlacedAssetNames.push(name);
|
|
264
|
-
return _objectSpread(_objectSpread({}, tag), {}, {
|
|
265
|
-
attributes: newAttributes,
|
|
266
|
-
innerHTML: compilation.assets[name].source(),
|
|
267
|
-
tagName: 'script'
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
return tag;
|
|
271
|
-
};
|
|
272
|
-
assets.headTags = assets.headTags.map(inPlace.bind(_this, 'head'));
|
|
273
|
-
assets.bodyTags = assets.bodyTags.map(inPlace.bind(_this, 'body'));
|
|
274
|
-
return assets;
|
|
275
|
-
});
|
|
276
|
-
|
|
277
|
-
// NOTE: Avoid if you still want to emit the runtime chunks:
|
|
278
|
-
hooks.afterEmit.tap('inPlaceHTMLAssets', function (asset) {
|
|
279
|
-
for (var _i6 = 0, _inPlacedAssetNames = inPlacedAssetNames; _i6 < _inPlacedAssetNames.length; _i6++) {
|
|
280
|
-
var _name3 = _inPlacedAssetNames[_i6];
|
|
281
|
-
delete compilation.assets[_name3];
|
|
282
|
-
}
|
|
283
|
-
return asset;
|
|
284
|
-
});
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
});
|
|
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
|
+
}));
|
|
288
235
|
///// endregion
|
|
289
236
|
///// region mark empty javaScript modules as dummy
|
|
290
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');
|
|
@@ -330,8 +277,8 @@ if (configuration.injection.external.modules === '__implicit__')
|
|
|
330
277
|
var filePath = _helper["default"].determineModuleFilePath(request, {}, {}, {
|
|
331
278
|
file: configuration.extensions.file.external
|
|
332
279
|
}, configuration.path.context, context, configuration.path.ignore, _module.directoryNames, configuration["package"].main.fileNames, configuration["package"].main.propertyNames, configuration["package"].aliasPropertyNames, configuration.encoding);
|
|
333
|
-
if (filePath) for (var
|
|
334
|
-
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),
|
|
335
282
|
pattern = _Object$entries5$_i[0],
|
|
336
283
|
targetConfiguration = _Object$entries5$_i[1];
|
|
337
284
|
if (pattern.startsWith('^')) {
|
|
@@ -419,100 +366,19 @@ if (configuration.injection.external.modules === '__implicit__')
|
|
|
419
366
|
};
|
|
420
367
|
///// endregion
|
|
421
368
|
//// endregion
|
|
422
|
-
//// region apply final
|
|
423
|
-
if (htmlAvailable) pluginInstances.push({
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
NOTE: We have to prevent creating native "style" dom nodes
|
|
429
|
-
to prevent jsdom from parsing the entire cascading style
|
|
430
|
-
sheet. Which is error prune and very resource intensive.
|
|
431
|
-
*/
|
|
432
|
-
var styleContents = [];
|
|
433
|
-
data.html = data.html.replace(/(<style[^>]*>)([\s\S]*?)(<\/style[^>]*>)/gi, function (match, startTag, content, endTag) {
|
|
434
|
-
styleContents.push(content);
|
|
435
|
-
return "".concat(startTag).concat(endTag);
|
|
436
|
-
});
|
|
437
|
-
var dom;
|
|
438
|
-
try {
|
|
439
|
-
/*
|
|
440
|
-
NOTE: We have to translate template delimiter to html
|
|
441
|
-
compatible sequences and translate it back later to
|
|
442
|
-
avoid unexpected escape sequences in resulting html.
|
|
443
|
-
*/
|
|
444
|
-
dom = new _jsdom.JSDOM(data.html.replace(/<%/g, '##+#+#+##').replace(/%>/g, '##-#-#-##'));
|
|
445
|
-
} catch (error) {
|
|
446
|
-
return data;
|
|
447
|
-
}
|
|
448
|
-
var linkables = {
|
|
449
|
-
link: 'href',
|
|
450
|
-
script: 'src'
|
|
451
|
-
};
|
|
452
|
-
for (var _i8 = 0, _Object$entries6 = Object.entries(linkables); _i8 < _Object$entries6.length; _i8++) {
|
|
453
|
-
var _Object$entries6$_i = (0, _slicedToArray2["default"])(_Object$entries6[_i8], 2),
|
|
454
|
-
tagName = _Object$entries6$_i[0],
|
|
455
|
-
attributeName = _Object$entries6$_i[1];
|
|
456
|
-
for (var _i9 = 0, _Array$from = Array.from(dom.window.document.querySelectorAll("".concat(tagName, "[").concat(attributeName, "*=\"?") + "".concat(configuration.hashAlgorithm, "=\"]"))); _i9 < _Array$from.length; _i9++) {
|
|
457
|
-
var domNode = _Array$from[_i9];
|
|
458
|
-
/*
|
|
459
|
-
NOTE: Removing symbols after a "&" in hash
|
|
460
|
-
string is necessary to match the generated
|
|
461
|
-
request strings in offline plugin.
|
|
462
|
-
*/
|
|
463
|
-
domNode.setAttribute(attributeName, domNode.getAttribute(attributeName).replace(new RegExp('(\\?' + "".concat(configuration.hashAlgorithm, "=") + '[^&]+).*$'), '$1'));
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
/*
|
|
467
|
-
NOTE: We have to restore template delimiter and style
|
|
468
|
-
contents.
|
|
469
|
-
*/
|
|
470
|
-
data.html = dom.serialize().replace(/##\+#\+#\+##/g, '<%').replace(/##-#-#-##/g, '%>').replace(/(<style[^>]*>)[\s\S]*?(<\/style[^>]*>)/gi, function (match, startTag, endTag) {
|
|
471
|
-
return "".concat(startTag).concat(styleContents.shift()) + endTag;
|
|
472
|
-
});
|
|
473
|
-
// region post compilation
|
|
474
|
-
var _iterator7 = _createForOfIteratorHelper(configuration.files.html),
|
|
475
|
-
_step7;
|
|
476
|
-
try {
|
|
477
|
-
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
478
|
-
var htmlFileSpecification = _step7.value;
|
|
479
|
-
if (htmlFileSpecification.filename === data.plugin.options.filename) {
|
|
480
|
-
var _iterator8 = _createForOfIteratorHelper([].concat(htmlFileSpecification.template.use)),
|
|
481
|
-
_step8;
|
|
482
|
-
try {
|
|
483
|
-
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
484
|
-
var _loaderConfiguration$;
|
|
485
|
-
var loaderConfiguration = _step8.value;
|
|
486
|
-
if ((_loaderConfiguration$ = loaderConfiguration.options) !== null && _loaderConfiguration$ !== void 0 && _loaderConfiguration$.compileSteps && typeof loaderConfiguration.options.compileSteps === 'number') data.html = _ejsLoader["default"].bind({
|
|
487
|
-
query: _clientnode["default"].extend(true, _clientnode["default"].copy(loaderConfiguration.options) || {}, htmlFileSpecification.template.postCompileOptions)
|
|
488
|
-
})(data.html);
|
|
489
|
-
}
|
|
490
|
-
} catch (err) {
|
|
491
|
-
_iterator8.e(err);
|
|
492
|
-
} finally {
|
|
493
|
-
_iterator8.f();
|
|
494
|
-
}
|
|
495
|
-
break;
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
// endregion
|
|
499
|
-
} catch (err) {
|
|
500
|
-
_iterator7.e(err);
|
|
501
|
-
} finally {
|
|
502
|
-
_iterator7.f();
|
|
503
|
-
}
|
|
504
|
-
return data;
|
|
505
|
-
});
|
|
506
|
-
});
|
|
507
|
-
}
|
|
508
|
-
});
|
|
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
|
+
}));
|
|
509
375
|
//// endregion
|
|
510
376
|
//// region context replacements
|
|
511
|
-
var
|
|
512
|
-
|
|
377
|
+
var _iterator7 = _createForOfIteratorHelper(_module.replacements.context),
|
|
378
|
+
_step7;
|
|
513
379
|
try {
|
|
514
|
-
for (
|
|
515
|
-
var contextReplacement =
|
|
380
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
381
|
+
var contextReplacement = _step7.value;
|
|
516
382
|
pluginInstances.push((0, _construct2["default"])(_webpack.ContextReplacementPlugin, (0, _toConsumableArray2["default"])(contextReplacement.map(function (value) {
|
|
517
383
|
var evaluated = _clientnode["default"].stringEvaluate(value, {
|
|
518
384
|
configuration: configuration,
|
|
@@ -532,9 +398,9 @@ try {
|
|
|
532
398
|
them as same dependency.
|
|
533
399
|
*/
|
|
534
400
|
} catch (err) {
|
|
535
|
-
|
|
401
|
+
_iterator7.e(err);
|
|
536
402
|
} finally {
|
|
537
|
-
|
|
403
|
+
_iterator7.f();
|
|
538
404
|
}
|
|
539
405
|
if (_module.enforceDeduplication) {
|
|
540
406
|
var absoluteContextPath = (0, _path.resolve)(configuration.path.context);
|
|
@@ -555,18 +421,18 @@ if (_module.enforceDeduplication) {
|
|
|
555
421
|
*/
|
|
556
422
|
pathPrefixes.pop();
|
|
557
423
|
var index = 0;
|
|
558
|
-
var
|
|
559
|
-
|
|
424
|
+
var _iterator8 = _createForOfIteratorHelper(pathPrefixes),
|
|
425
|
+
_step8;
|
|
560
426
|
try {
|
|
561
|
-
for (
|
|
562
|
-
var pathPrefix =
|
|
427
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
428
|
+
var pathPrefix = _step8.value;
|
|
563
429
|
if (index > 0) pathPrefixes[index] = (0, _path.resolve)(pathPrefixes[index - 1], pathPrefix);
|
|
564
430
|
index += 1;
|
|
565
431
|
}
|
|
566
432
|
} catch (err) {
|
|
567
|
-
|
|
433
|
+
_iterator8.e(err);
|
|
568
434
|
} finally {
|
|
569
|
-
|
|
435
|
+
_iterator8.f();
|
|
570
436
|
}
|
|
571
437
|
pathSuffix = targetPath.replace(/(?:^|.*\/)node_modules\/(.+$)/, '$1');
|
|
572
438
|
} else {
|
|
@@ -577,11 +443,11 @@ if (_module.enforceDeduplication) {
|
|
|
577
443
|
pathSuffix = targetPath.substring(_index).replace(/^.*\/node_modules\//, '');
|
|
578
444
|
}
|
|
579
445
|
var redundantRequest = null;
|
|
580
|
-
var
|
|
581
|
-
|
|
446
|
+
var _iterator9 = _createForOfIteratorHelper(pathPrefixes),
|
|
447
|
+
_step9;
|
|
582
448
|
try {
|
|
583
|
-
for (
|
|
584
|
-
var _pathPrefix =
|
|
449
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
450
|
+
var _pathPrefix = _step9.value;
|
|
585
451
|
var alternateTargetPath = (0, _path.resolve)(_pathPrefix, pathSuffix);
|
|
586
452
|
if (_clientnode["default"].isFileSync(alternateTargetPath)) {
|
|
587
453
|
var otherPackageDescriptor = _helper["default"].getClosestPackageDescriptor(alternateTargetPath);
|
|
@@ -606,9 +472,9 @@ if (_module.enforceDeduplication) {
|
|
|
606
472
|
}
|
|
607
473
|
}
|
|
608
474
|
} catch (err) {
|
|
609
|
-
|
|
475
|
+
_iterator9.e(err);
|
|
610
476
|
} finally {
|
|
611
|
-
|
|
477
|
+
_iterator9.f();
|
|
612
478
|
}
|
|
613
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, ")."));
|
|
614
480
|
}
|
|
@@ -846,17 +712,17 @@ var genericLoader = {
|
|
|
846
712
|
include: function include(filePath) {
|
|
847
713
|
var result = evaluate(_module.preprocessor.javaScript.include, filePath);
|
|
848
714
|
if ([null, undefined].includes(result)) {
|
|
849
|
-
var
|
|
850
|
-
|
|
715
|
+
var _iterator10 = _createForOfIteratorHelper(getIncludingPaths(configuration.path.source.asset.javaScript)),
|
|
716
|
+
_step10;
|
|
851
717
|
try {
|
|
852
|
-
for (
|
|
853
|
-
var includePath =
|
|
718
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
719
|
+
var includePath = _step10.value;
|
|
854
720
|
if (filePath.startsWith(includePath)) return true;
|
|
855
721
|
}
|
|
856
722
|
} catch (err) {
|
|
857
|
-
|
|
723
|
+
_iterator10.e(err);
|
|
858
724
|
} finally {
|
|
859
|
-
|
|
725
|
+
_iterator10.f();
|
|
860
726
|
}
|
|
861
727
|
return false;
|
|
862
728
|
}
|
|
@@ -928,17 +794,17 @@ var genericLoader = {
|
|
|
928
794
|
include: function include(filePath) {
|
|
929
795
|
var result = evaluate(_module.cascadingStyleSheet.include, filePath);
|
|
930
796
|
if ([null, undefined].includes(result)) {
|
|
931
|
-
var
|
|
932
|
-
|
|
797
|
+
var _iterator11 = _createForOfIteratorHelper(getIncludingPaths(configuration.path.source.asset.cascadingStyleSheet)),
|
|
798
|
+
_step11;
|
|
933
799
|
try {
|
|
934
|
-
for (
|
|
935
|
-
var includePath =
|
|
800
|
+
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
801
|
+
var includePath = _step11.value;
|
|
936
802
|
if (filePath.startsWith(includePath)) return true;
|
|
937
803
|
}
|
|
938
804
|
} catch (err) {
|
|
939
|
-
|
|
805
|
+
_iterator11.e(err);
|
|
940
806
|
} finally {
|
|
941
|
-
|
|
807
|
+
_iterator11.f();
|
|
942
808
|
}
|
|
943
809
|
return false;
|
|
944
810
|
}
|
|
@@ -1088,11 +954,11 @@ if (htmlAvailable && configuration.debug && configuration.development.server.liv
|
|
|
1088
954
|
/// endregion
|
|
1089
955
|
// endregion
|
|
1090
956
|
// region plugins
|
|
1091
|
-
var
|
|
1092
|
-
|
|
957
|
+
var _iterator12 = _createForOfIteratorHelper(configuration.plugins),
|
|
958
|
+
_step12;
|
|
1093
959
|
try {
|
|
1094
|
-
for (
|
|
1095
|
-
var pluginConfiguration =
|
|
960
|
+
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
|
961
|
+
var pluginConfiguration = _step12.value;
|
|
1096
962
|
var _plugin = optionalRequire(pluginConfiguration.name.module);
|
|
1097
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.');
|
|
1098
964
|
}
|
|
@@ -1101,9 +967,9 @@ try {
|
|
|
1101
967
|
// NOTE: This plugin should be loaded at last to ensure that all emitted images
|
|
1102
968
|
// ran through.
|
|
1103
969
|
} catch (err) {
|
|
1104
|
-
|
|
970
|
+
_iterator12.e(err);
|
|
1105
971
|
} finally {
|
|
1106
|
-
|
|
972
|
+
_iterator12.f();
|
|
1107
973
|
}
|
|
1108
974
|
if (!_module.optimizer.minimizer) {
|
|
1109
975
|
_module.optimizer.minimizer = [];
|
|
@@ -1208,9 +1074,9 @@ var webpackConfiguration = exports.webpackConfiguration = _clientnode["default"]
|
|
|
1208
1074
|
cacheGroups: {
|
|
1209
1075
|
defaultVendors: {
|
|
1210
1076
|
chunks: function chunks(chunk) {
|
|
1211
|
-
if ((0, _typeof2["default"])(configuration.inPlace.javaScript) === 'object' && configuration.inPlace.javaScript !== null) for (var
|
|
1212
|
-
var
|
|
1213
|
-
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;
|
|
1214
1080
|
}
|
|
1215
1081
|
return true;
|
|
1216
1082
|
},
|