weboptimizer 2.0.1235 → 2.0.1237
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/browser.js +20 -62
- package/configurator.js +53 -126
- package/ejsLoader.js +8 -52
- package/helper.js +53 -198
- package/index.js +31 -167
- package/jestEnvironmentBrowser.js +1 -12
- package/jestSetup.js +5 -7
- package/package.json +9 -2
- package/stylelintConfigurator.js +1 -6
- package/type.js +4 -4
- package/webpackConfigurator.js +99 -244
package/configurator.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// #!/usr/bin/env babel-node
|
|
2
2
|
// -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
3
|
/** @module configurator */
|
|
5
4
|
'use strict';
|
|
5
|
+
|
|
6
6
|
/* !
|
|
7
7
|
region header
|
|
8
8
|
Copyright Torben Sickert (info["~at~"]torben.website) 16.12.2012
|
|
@@ -16,42 +16,25 @@
|
|
|
16
16
|
endregion
|
|
17
17
|
*/
|
|
18
18
|
// region imports
|
|
19
|
-
|
|
20
19
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
21
|
-
|
|
22
20
|
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
23
|
-
|
|
24
21
|
Object.defineProperty(exports, "__esModule", {
|
|
25
22
|
value: true
|
|
26
23
|
});
|
|
27
24
|
exports.loadedConfiguration = exports.load = exports.get = exports["default"] = void 0;
|
|
28
|
-
|
|
29
25
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
30
|
-
|
|
31
26
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
32
|
-
|
|
33
27
|
var _clientnode = _interopRequireWildcard(require("clientnode"));
|
|
34
|
-
|
|
35
28
|
var _fs = _interopRequireWildcard(require("fs"));
|
|
36
|
-
|
|
37
29
|
var _path2 = _interopRequireWildcard(require("path"));
|
|
38
|
-
|
|
39
30
|
var _helper = _interopRequireDefault(require("./helper"));
|
|
40
|
-
|
|
41
31
|
var _package = require("./package.json");
|
|
42
|
-
|
|
43
32
|
var _type4 = require("./type");
|
|
44
|
-
|
|
45
33
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
46
|
-
|
|
47
34
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
48
|
-
|
|
49
35
|
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; } } }; }
|
|
50
|
-
|
|
51
36
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
52
|
-
|
|
53
37
|
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; }
|
|
54
|
-
|
|
55
38
|
// endregion
|
|
56
39
|
var loadedConfiguration = null;
|
|
57
40
|
/**
|
|
@@ -65,9 +48,7 @@ var loadedConfiguration = null;
|
|
|
65
48
|
*
|
|
66
49
|
* @returns Nothing.
|
|
67
50
|
*/
|
|
68
|
-
|
|
69
51
|
exports.loadedConfiguration = loadedConfiguration;
|
|
70
|
-
|
|
71
52
|
var load = function load(context) {
|
|
72
53
|
var currentWorkingDirectory = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : process.cwd();
|
|
73
54
|
var commandLineArguments = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : process.argv;
|
|
@@ -75,7 +56,6 @@ var load = function load(context) {
|
|
|
75
56
|
var environment = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : eval('process.env');
|
|
76
57
|
return function () {
|
|
77
58
|
var _specificConfiguratio, _specificConfiguratio2, _specificConfiguratio3;
|
|
78
|
-
|
|
79
59
|
// region determine application context location
|
|
80
60
|
if (context) _package.configuration["default"].path.context = context;else {
|
|
81
61
|
/*
|
|
@@ -85,12 +65,10 @@ var load = function load(context) {
|
|
|
85
65
|
directory and this library is located as a nested dependency.
|
|
86
66
|
*/
|
|
87
67
|
_package.configuration["default"].path.context = webOptimizerPath;
|
|
88
|
-
|
|
89
68
|
while (true) {
|
|
90
69
|
_package.configuration["default"].path.context = (0, _path2.resolve)(_package.configuration["default"].path.context, '../../');
|
|
91
70
|
if ((0, _path2.basename)((0, _path2.dirname)(_package.configuration["default"].path.context)) !== 'node_modules') break;
|
|
92
71
|
}
|
|
93
|
-
|
|
94
72
|
if ((0, _path2.basename)((0, _path2.dirname)(currentWorkingDirectory)) === 'node_modules' || (0, _path2.basename)((0, _path2.dirname)(currentWorkingDirectory)) === '.staging' && (0, _path2.basename)((0, _path2.dirname)((0, _path2.dirname)(currentWorkingDirectory))) === 'node_modules') {
|
|
95
73
|
/*
|
|
96
74
|
NOTE: If we are dealing was a dependency project use current
|
|
@@ -107,59 +85,55 @@ var load = function load(context) {
|
|
|
107
85
|
*/
|
|
108
86
|
try {
|
|
109
87
|
if ((0, _fs.lstatSync)((0, _path2.join)(currentWorkingDirectory, 'node_modules')).isSymbolicLink()) _package.configuration["default"].path.context = currentWorkingDirectory;
|
|
110
|
-
} catch (error) {
|
|
88
|
+
} catch (error) {
|
|
89
|
+
// Continue regardless of error.
|
|
111
90
|
}
|
|
112
|
-
}
|
|
91
|
+
}
|
|
92
|
+
// endregion
|
|
113
93
|
// region load application specific configuration
|
|
114
|
-
|
|
115
94
|
var specificConfiguration = {};
|
|
116
|
-
|
|
117
95
|
try {
|
|
118
96
|
specificConfiguration = (0, _clientnode.currentRequire)((0, _path2.join)(_package.configuration["default"].path.context, 'package'));
|
|
119
97
|
} catch (error) {
|
|
120
98
|
_package.configuration["default"].path.context = currentWorkingDirectory;
|
|
121
|
-
}
|
|
99
|
+
}
|
|
100
|
+
// endregion
|
|
122
101
|
// region determine application name and web optimizer configuration
|
|
123
|
-
|
|
124
|
-
|
|
125
102
|
var name = typeof specificConfiguration.name === 'string' ? specificConfiguration.name : typeof ((_specificConfiguratio = specificConfiguration.webOptimizer) === null || _specificConfiguratio === void 0 ? void 0 : _specificConfiguratio.name) === 'string' ? (_specificConfiguratio2 = specificConfiguration.webOptimizer) === null || _specificConfiguratio2 === void 0 ? void 0 : _specificConfiguratio2.name : 'mockup';
|
|
126
103
|
specificConfiguration = specificConfiguration.webOptimizer || {};
|
|
127
|
-
specificConfiguration.name = name;
|
|
104
|
+
specificConfiguration.name = name;
|
|
105
|
+
// endregion
|
|
128
106
|
// region determine debug mode
|
|
129
107
|
// NOTE: Given node command line arguments results in "npm_config_*"
|
|
130
108
|
// environment variables.
|
|
131
|
-
|
|
132
109
|
var debug = _package.configuration["default"].debug;
|
|
133
110
|
if (typeof specificConfiguration.debug === 'boolean') debug = specificConfiguration.debug;else if (environment.npm_config_dev === 'true' || typeof environment.NODE_ENV === 'string' && ['debug', 'dev', 'development'].includes(environment.NODE_ENV)) debug = true;
|
|
134
|
-
if (debug) environment.NODE_ENV = 'development';
|
|
111
|
+
if (debug) environment.NODE_ENV = 'development';
|
|
112
|
+
// endregion
|
|
135
113
|
// region loading default configuration
|
|
136
|
-
|
|
137
|
-
|
|
114
|
+
_package.configuration["default"].path.context += '/';
|
|
115
|
+
// Merges final default configuration object depending on given target
|
|
138
116
|
// environment.
|
|
139
|
-
|
|
140
117
|
var libraryConfiguration = _package.configuration.library;
|
|
141
118
|
var configuration;
|
|
142
119
|
if (debug) configuration = _clientnode["default"].extend(true, _clientnode["default"].modifyObject(_package.configuration["default"], _package.configuration.debug), _package.configuration.debug);else configuration = _package.configuration["default"];
|
|
143
120
|
configuration.debug = debug;
|
|
144
121
|
if ((0, _typeof2["default"])(configuration.library) === 'object') _clientnode["default"].extend(true, _clientnode["default"].modifyObject(libraryConfiguration, configuration.library), configuration.library);
|
|
145
|
-
if (configuration.library && ((_specificConfiguratio3 = specificConfiguration) === null || _specificConfiguratio3 === void 0 ? void 0 : _specificConfiguratio3.library) !== false) configuration = _clientnode["default"].extend(true, _clientnode["default"].modifyObject(configuration, libraryConfiguration), libraryConfiguration);
|
|
122
|
+
if (configuration.library && ((_specificConfiguratio3 = specificConfiguration) === null || _specificConfiguratio3 === void 0 ? void 0 : _specificConfiguratio3.library) !== false) configuration = _clientnode["default"].extend(true, _clientnode["default"].modifyObject(configuration, libraryConfiguration), libraryConfiguration);
|
|
123
|
+
// endregion
|
|
146
124
|
// region merging and evaluating task specific and dynamic configurations
|
|
147
125
|
/// region load additional dynamically given configuration
|
|
148
|
-
|
|
149
126
|
var count = 0;
|
|
150
127
|
var filePath = null;
|
|
151
|
-
|
|
152
128
|
while (true) {
|
|
153
129
|
var newFilePath = "".concat(configuration.path.context, ".dynamicConfiguration-").concat(count, ".json");
|
|
154
130
|
if (!_clientnode["default"].isFileSync(newFilePath)) break;
|
|
155
131
|
filePath = newFilePath;
|
|
156
132
|
count += 1;
|
|
157
133
|
}
|
|
158
|
-
|
|
159
134
|
var runtimeInformation = {
|
|
160
135
|
givenCommandLineArguments: commandLineArguments
|
|
161
136
|
};
|
|
162
|
-
|
|
163
137
|
if (filePath) {
|
|
164
138
|
runtimeInformation = JSON.parse((0, _fs.readFileSync)(filePath, {
|
|
165
139
|
encoding: configuration.encoding
|
|
@@ -167,14 +141,12 @@ var load = function load(context) {
|
|
|
167
141
|
(0, _fs.unlink)(filePath, function (error) {
|
|
168
142
|
if (error) throw error;
|
|
169
143
|
});
|
|
170
|
-
}
|
|
144
|
+
}
|
|
145
|
+
//// region task specific configuration
|
|
171
146
|
///// region apply task type specific configuration
|
|
172
|
-
|
|
173
|
-
|
|
174
147
|
if (runtimeInformation.givenCommandLineArguments.length > 2) {
|
|
175
148
|
var _iterator = _createForOfIteratorHelper(_type4.SubConfigurationTypes),
|
|
176
|
-
|
|
177
|
-
|
|
149
|
+
_step;
|
|
178
150
|
try {
|
|
179
151
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
180
152
|
var type = _step.value;
|
|
@@ -188,44 +160,36 @@ var load = function load(context) {
|
|
|
188
160
|
} finally {
|
|
189
161
|
_iterator.f();
|
|
190
162
|
}
|
|
191
|
-
}
|
|
163
|
+
}
|
|
164
|
+
///// endregion
|
|
192
165
|
///// region clear task type specific configurations
|
|
193
|
-
|
|
194
|
-
|
|
195
166
|
var _iterator2 = _createForOfIteratorHelper(_type4.SubConfigurationTypes),
|
|
196
|
-
|
|
197
|
-
|
|
167
|
+
_step2;
|
|
198
168
|
try {
|
|
199
169
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
200
170
|
var _type3 = _step2.value;
|
|
201
|
-
|
|
202
171
|
for (var _i7 = 0, _arr2 = [configuration, specificConfiguration]; _i7 < _arr2.length; _i7++) {
|
|
203
172
|
var _configurationTarget = _arr2[_i7];
|
|
204
173
|
if (Object.prototype.hasOwnProperty.call(_configurationTarget, _type3) && (0, _typeof2["default"])(_configurationTarget[_type3]) === 'object') delete _configurationTarget[_type3];
|
|
205
174
|
}
|
|
206
|
-
}
|
|
175
|
+
}
|
|
176
|
+
///// endregion
|
|
207
177
|
//// endregion
|
|
208
178
|
/// endregion
|
|
209
|
-
|
|
210
179
|
} catch (err) {
|
|
211
180
|
_iterator2.e(err);
|
|
212
181
|
} finally {
|
|
213
182
|
_iterator2.f();
|
|
214
183
|
}
|
|
215
|
-
|
|
216
184
|
_clientnode["default"].extend(true, _clientnode["default"].modifyObject(_clientnode["default"].modifyObject(configuration, specificConfiguration), runtimeInformation), specificConfiguration, runtimeInformation);
|
|
217
|
-
|
|
218
185
|
var result = null;
|
|
219
186
|
if (runtimeInformation.givenCommandLineArguments.length > 3) result = _clientnode["default"].stringParseEncodedObject(runtimeInformation.givenCommandLineArguments[runtimeInformation.givenCommandLineArguments.length - 1], configuration, 'configuration');
|
|
220
|
-
|
|
221
187
|
if (result !== null && (0, _typeof2["default"])(result) === 'object') {
|
|
222
188
|
if (Object.prototype.hasOwnProperty.call(result, '__reference__')) {
|
|
223
189
|
var referenceNames = [].concat(result.__reference__);
|
|
224
190
|
delete result.__reference__;
|
|
225
|
-
|
|
226
191
|
var _iterator3 = _createForOfIteratorHelper(referenceNames),
|
|
227
|
-
|
|
228
|
-
|
|
192
|
+
_step3;
|
|
229
193
|
try {
|
|
230
194
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
231
195
|
var _name = _step3.value;
|
|
@@ -237,52 +201,42 @@ var load = function load(context) {
|
|
|
237
201
|
_iterator3.f();
|
|
238
202
|
}
|
|
239
203
|
}
|
|
240
|
-
|
|
241
204
|
_clientnode["default"].extend(true, _clientnode["default"].modifyObject(configuration, result), result);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
205
|
+
}
|
|
206
|
+
// Removing comments (default key name to delete is "#").
|
|
207
|
+
configuration = _clientnode["default"].removeKeyPrefixes(configuration);
|
|
208
|
+
// endregion
|
|
246
209
|
/// region build absolute paths
|
|
247
|
-
|
|
248
210
|
configuration.path.base = (0, _path2.resolve)(configuration.path.context, configuration.path.base);
|
|
249
|
-
|
|
250
211
|
for (var _i2 = 0, _Object$entries = Object.entries(configuration.path); _i2 < _Object$entries.length; _i2++) {
|
|
251
212
|
var _Object$entries$_i = (0, _slicedToArray2["default"])(_Object$entries[_i2], 2),
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
213
|
+
key = _Object$entries$_i[0],
|
|
214
|
+
_path = _Object$entries$_i[1];
|
|
255
215
|
if (!['base', 'configuration'].includes(key)) if (typeof _path === 'string') configuration.path[key] = (0, _path2.resolve)(configuration.path.base, _path) + '/';else if (_clientnode["default"].isPlainObject(_path)) {
|
|
256
216
|
if (Object.prototype.hasOwnProperty.call(_path, 'base')) configuration.path[key].base = (0, _path2.resolve)(configuration.path.base, _path.base);
|
|
257
|
-
|
|
258
217
|
for (var _i3 = 0, _Object$entries2 = Object.entries(_path); _i3 < _Object$entries2.length; _i3++) {
|
|
259
218
|
var _Object$entries2$_i = (0, _slicedToArray2["default"])(_Object$entries2[_i3], 2),
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
219
|
+
subKey = _Object$entries2$_i[0],
|
|
220
|
+
subPath = _Object$entries2$_i[1];
|
|
263
221
|
if (!['base', 'public'].includes(subKey) && typeof subPath === 'string') _path[subKey] = (0, _path2.resolve)(_path.base, subPath) + '/';else if (subKey !== 'options' && _clientnode["default"].isPlainObject(subPath)) {
|
|
264
222
|
subPath.base = (0, _path2.resolve)(_path.base, subPath.base);
|
|
265
|
-
|
|
266
223
|
for (var _i4 = 0, _Object$entries3 = Object.entries(subPath); _i4 < _Object$entries3.length; _i4++) {
|
|
267
224
|
var _Object$entries3$_i = (0, _slicedToArray2["default"])(_Object$entries3[_i4], 2),
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
225
|
+
subSubKey = _Object$entries3$_i[0],
|
|
226
|
+
subSubPath = _Object$entries3$_i[1];
|
|
271
227
|
if (subSubKey !== 'base' && typeof subSubPath === 'string') subPath[subSubKey] = (0, _path2.resolve)(subPath.base, subSubPath) + '/';
|
|
272
228
|
}
|
|
273
229
|
}
|
|
274
230
|
}
|
|
275
231
|
}
|
|
276
|
-
}
|
|
232
|
+
}
|
|
233
|
+
/// endregion
|
|
277
234
|
// region evaluate dynamic configuration structures
|
|
278
|
-
|
|
279
|
-
|
|
280
235
|
var now = new Date();
|
|
281
236
|
/*
|
|
282
237
|
NOTE: The configuration is not yet fully resolved but will be
|
|
283
238
|
transformed in place in the following lines of code.
|
|
284
239
|
*/
|
|
285
|
-
|
|
286
240
|
var resolvedConfiguration = _clientnode["default"].evaluateDynamicData(configuration, {
|
|
287
241
|
currentPath: currentWorkingDirectory,
|
|
288
242
|
fileSystem: _fs["default"],
|
|
@@ -294,29 +248,25 @@ var load = function load(context) {
|
|
|
294
248
|
webOptimizerPath: webOptimizerPath,
|
|
295
249
|
now: now,
|
|
296
250
|
nowUTCTimestamp: _clientnode["default"].numberGetUTCTimestamp(now)
|
|
297
|
-
});
|
|
251
|
+
});
|
|
252
|
+
// endregion
|
|
298
253
|
// region consolidate file specific build configuration
|
|
299
254
|
// Apply default file level build configurations to all file type specific
|
|
300
255
|
// ones.
|
|
301
|
-
|
|
302
|
-
|
|
303
256
|
var defaultConfiguration = resolvedConfiguration.buildContext.types["default"];
|
|
304
257
|
delete resolvedConfiguration.buildContext.types["default"];
|
|
305
|
-
|
|
306
258
|
for (var _i5 = 0, _Object$entries4 = Object.entries(resolvedConfiguration.buildContext.types); _i5 < _Object$entries4.length; _i5++) {
|
|
307
259
|
var _Object$entries4$_i = (0, _slicedToArray2["default"])(_Object$entries4[_i5], 2),
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
260
|
+
_type = _Object$entries4$_i[0],
|
|
261
|
+
_context = _Object$entries4$_i[1];
|
|
311
262
|
resolvedConfiguration.buildContext.types[_type] = _clientnode["default"].extend(true, _clientnode["default"].copy(defaultConfiguration), _clientnode["default"].extend(true, {
|
|
312
263
|
extension: _type
|
|
313
264
|
}, _context, {
|
|
314
265
|
type: _type
|
|
315
266
|
}));
|
|
316
|
-
}
|
|
267
|
+
}
|
|
268
|
+
// endregion
|
|
317
269
|
// region resolve module location and which asset types are needed
|
|
318
|
-
|
|
319
|
-
|
|
320
270
|
resolvedConfiguration.module.locations = _helper["default"].determineModuleLocations(resolvedConfiguration.injection.entry.normalized, resolvedConfiguration.module.aliases, resolvedConfiguration.module.replacements.normal, {
|
|
321
271
|
file: resolvedConfiguration.extensions.file.internal
|
|
322
272
|
}, resolvedConfiguration.path.context, resolvedConfiguration.path.source.asset.base);
|
|
@@ -336,18 +286,15 @@ var load = function load(context) {
|
|
|
336
286
|
};
|
|
337
287
|
resolvedConfiguration.needed = {
|
|
338
288
|
javaScript: configuration.debug && ['serve', 'test:browser'].includes(resolvedConfiguration.givenCommandLineArguments[2])
|
|
339
|
-
};
|
|
340
|
-
|
|
289
|
+
};
|
|
290
|
+
/// region determine which asset types are needed
|
|
341
291
|
for (var _i6 = 0, _Object$values = Object.values(resolvedConfiguration.injection.entry.normalized); _i6 < _Object$values.length; _i6++) {
|
|
342
292
|
var chunk = _Object$values[_i6];
|
|
343
|
-
|
|
344
293
|
var _iterator4 = _createForOfIteratorHelper(chunk),
|
|
345
|
-
|
|
346
|
-
|
|
294
|
+
_step4;
|
|
347
295
|
try {
|
|
348
296
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
349
297
|
var moduleID = _step4.value;
|
|
350
|
-
|
|
351
298
|
var _filePath = _helper["default"].determineModuleFilePath(moduleID, resolvedConfiguration.module.aliases, resolvedConfiguration.module.replacements.normal, {
|
|
352
299
|
file: resolvedConfiguration.extensions.file.internal
|
|
353
300
|
}, resolvedConfiguration.path.context,
|
|
@@ -357,7 +304,6 @@ var load = function load(context) {
|
|
|
357
304
|
already have resolved all module ids.
|
|
358
305
|
*/
|
|
359
306
|
'', resolvedConfiguration.path.ignore, resolvedConfiguration.module.directoryNames, resolvedConfiguration["package"].main.fileNames, resolvedConfiguration["package"].main.propertyNames, resolvedConfiguration["package"].aliasPropertyNames, resolvedConfiguration.encoding);
|
|
360
|
-
|
|
361
307
|
var _type2 = null;
|
|
362
308
|
if (_filePath) _type2 = _helper["default"].determineAssetType(_filePath, resolvedConfiguration.buildContext.types, resolvedConfiguration.path);else throw new Error("Given request \"".concat(moduleID, "\" couldn't be resolved."));
|
|
363
309
|
if (_type2) resolvedConfiguration.needed[_type2] = true;
|
|
@@ -367,21 +313,17 @@ var load = function load(context) {
|
|
|
367
313
|
} finally {
|
|
368
314
|
_iterator4.f();
|
|
369
315
|
}
|
|
370
|
-
}
|
|
316
|
+
}
|
|
317
|
+
/// endregion
|
|
371
318
|
// endregion
|
|
372
319
|
// region adding special aliases
|
|
373
|
-
|
|
374
320
|
/*
|
|
375
321
|
NOTE: This alias couldn't be set in the "package.json" file since this
|
|
376
322
|
would result in an endless loop.
|
|
377
323
|
*/
|
|
378
|
-
|
|
379
|
-
|
|
380
324
|
resolvedConfiguration.loader.aliases.webOptimizerDefaultTemplateFileLoader = '';
|
|
381
|
-
|
|
382
325
|
var _iterator5 = _createForOfIteratorHelper(Array.isArray(resolvedConfiguration.files.defaultHTML.template.use) ? resolvedConfiguration.files.defaultHTML.template.use : [resolvedConfiguration.files.defaultHTML.template.use]),
|
|
383
|
-
|
|
384
|
-
|
|
326
|
+
_step5;
|
|
385
327
|
try {
|
|
386
328
|
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
387
329
|
var loader = _step5.value;
|
|
@@ -394,48 +336,38 @@ var load = function load(context) {
|
|
|
394
336
|
} finally {
|
|
395
337
|
_iterator5.f();
|
|
396
338
|
}
|
|
397
|
-
|
|
398
|
-
|
|
339
|
+
resolvedConfiguration.module.aliases.webOptimizerDefaultTemplateFilePath = resolvedConfiguration.files.defaultHTML.template.filePath;
|
|
340
|
+
// endregion
|
|
399
341
|
// region apply html webpack plugin workarounds
|
|
400
|
-
|
|
401
342
|
/*
|
|
402
343
|
NOTE: Provides a workaround to handle a bug with chained loader
|
|
403
344
|
configurations.
|
|
404
345
|
*/
|
|
405
|
-
|
|
406
346
|
var _iterator6 = _createForOfIteratorHelper(resolvedConfiguration.files.html),
|
|
407
|
-
|
|
408
|
-
|
|
347
|
+
_step6;
|
|
409
348
|
try {
|
|
410
349
|
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
411
350
|
var htmlConfiguration = _step6.value;
|
|
412
|
-
|
|
413
351
|
_clientnode["default"].extend(true, htmlConfiguration, resolvedConfiguration.files.defaultHTML);
|
|
414
|
-
|
|
415
352
|
htmlConfiguration.template.request = htmlConfiguration.template.filePath;
|
|
416
|
-
|
|
417
353
|
if (htmlConfiguration.template.filePath !== resolvedConfiguration.files.defaultHTML.template.filePath && htmlConfiguration.template.options) {
|
|
418
354
|
var requestString = new String(htmlConfiguration.template.request + _clientnode["default"].convertCircularObjectToJSON(htmlConfiguration.template.options));
|
|
419
355
|
/* eslint-disable @typescript-eslint/unbound-method */
|
|
420
|
-
|
|
421
356
|
requestString.replace = function (value) {
|
|
422
357
|
return function () {
|
|
423
358
|
return value;
|
|
424
359
|
};
|
|
425
360
|
}(htmlConfiguration.template.filePath);
|
|
426
361
|
/* eslint-enable @typescript-eslint/unbound-method */
|
|
427
|
-
|
|
428
|
-
|
|
429
362
|
htmlConfiguration.template.request = requestString;
|
|
430
363
|
}
|
|
431
|
-
}
|
|
432
|
-
|
|
364
|
+
}
|
|
365
|
+
// endregion
|
|
433
366
|
} catch (err) {
|
|
434
367
|
_iterator6.e(err);
|
|
435
368
|
} finally {
|
|
436
369
|
_iterator6.f();
|
|
437
370
|
}
|
|
438
|
-
|
|
439
371
|
return resolvedConfiguration;
|
|
440
372
|
}();
|
|
441
373
|
};
|
|
@@ -443,20 +375,15 @@ var load = function load(context) {
|
|
|
443
375
|
* Get cached or determined configuration object.
|
|
444
376
|
* @returns Nothing.
|
|
445
377
|
*/
|
|
446
|
-
|
|
447
|
-
|
|
448
378
|
exports.load = load;
|
|
449
|
-
|
|
450
379
|
var get = function get() {
|
|
451
380
|
if (loadedConfiguration) return loadedConfiguration;
|
|
452
381
|
exports.loadedConfiguration = loadedConfiguration = load();
|
|
453
382
|
return loadedConfiguration;
|
|
454
383
|
};
|
|
455
|
-
|
|
456
384
|
exports.get = get;
|
|
457
385
|
var _default = get; // region vim modline
|
|
458
386
|
// vim: set tabstop=4 shiftwidth=4 expandtab:
|
|
459
387
|
// vim: foldmethod=marker foldmarker=region,endregion:
|
|
460
388
|
// endregion
|
|
461
|
-
|
|
462
389
|
exports["default"] = _default;
|