weboptimizer 2.0.1139 → 2.0.1140
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 +12 -12
- package/index.js +4 -4
- package/package.json +7 -2
- package/type.js +10 -10
- package/webpackConfigurator.js +38 -38
package/configurator.js
CHANGED
|
@@ -142,7 +142,7 @@ var load = function load(context) {
|
|
|
142
142
|
if ((0, _typeof2["default"])(configuration.library) === 'object') _clientnode["default"].extend(true, _clientnode["default"].modifyObject(libraryConfiguration, configuration.library), configuration.library);
|
|
143
143
|
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); // endregion
|
|
144
144
|
// region merging and evaluating task specific and dynamic configurations
|
|
145
|
-
|
|
145
|
+
/// region load additional dynamically given configuration
|
|
146
146
|
|
|
147
147
|
var count = 0;
|
|
148
148
|
var filePath = null;
|
|
@@ -165,8 +165,8 @@ var load = function load(context) {
|
|
|
165
165
|
(0, _fs.unlink)(filePath, function (error) {
|
|
166
166
|
if (error) throw error;
|
|
167
167
|
});
|
|
168
|
-
}
|
|
169
|
-
|
|
168
|
+
} //// region task specific configuration
|
|
169
|
+
///// region apply task type specific configuration
|
|
170
170
|
|
|
171
171
|
|
|
172
172
|
if (runtimeInformation.givenCommandLineArguments.length > 2) {
|
|
@@ -186,8 +186,8 @@ var load = function load(context) {
|
|
|
186
186
|
} finally {
|
|
187
187
|
_iterator.f();
|
|
188
188
|
}
|
|
189
|
-
}
|
|
190
|
-
|
|
189
|
+
} ///// endregion
|
|
190
|
+
///// region clear task type specific configurations
|
|
191
191
|
|
|
192
192
|
|
|
193
193
|
var _iterator2 = _createForOfIteratorHelper(_type4.SubConfigurationTypes),
|
|
@@ -201,9 +201,9 @@ var load = function load(context) {
|
|
|
201
201
|
var _configurationTarget = _arr2[_i2];
|
|
202
202
|
if (Object.prototype.hasOwnProperty.call(_configurationTarget, _type3) && (0, _typeof2["default"])(_configurationTarget[_type3]) === 'object') delete _configurationTarget[_type3];
|
|
203
203
|
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
|
|
204
|
+
} ///// endregion
|
|
205
|
+
//// endregion
|
|
206
|
+
/// endregion
|
|
207
207
|
|
|
208
208
|
} catch (err) {
|
|
209
209
|
_iterator2.e(err);
|
|
@@ -242,7 +242,7 @@ var load = function load(context) {
|
|
|
242
242
|
|
|
243
243
|
|
|
244
244
|
configuration = _clientnode["default"].removeKeyPrefixes(configuration); // endregion
|
|
245
|
-
|
|
245
|
+
/// region build absolute paths
|
|
246
246
|
|
|
247
247
|
configuration.path.base = (0, _path.resolve)(configuration.path.context, configuration.path.base);
|
|
248
248
|
|
|
@@ -260,7 +260,7 @@ var load = function load(context) {
|
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
|
-
}
|
|
263
|
+
} /// endregion
|
|
264
264
|
// region evaluate dynamic configuration structures
|
|
265
265
|
|
|
266
266
|
|
|
@@ -319,7 +319,7 @@ var load = function load(context) {
|
|
|
319
319
|
};
|
|
320
320
|
resolvedConfiguration.needed = {
|
|
321
321
|
javaScript: configuration.debug && ['serve', 'test:browser'].includes(resolvedConfiguration.givenCommandLineArguments[2])
|
|
322
|
-
};
|
|
322
|
+
}; /// region determine which asset types are needed
|
|
323
323
|
|
|
324
324
|
for (var chunkName in resolvedConfiguration.injection.entry.normalized) {
|
|
325
325
|
if (Object.prototype.hasOwnProperty.call(resolvedConfiguration.injection.entry.normalized, chunkName)) {
|
|
@@ -350,7 +350,7 @@ var load = function load(context) {
|
|
|
350
350
|
_iterator4.f();
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
|
-
}
|
|
353
|
+
} /// endregion
|
|
354
354
|
// endregion
|
|
355
355
|
// region adding special aliases
|
|
356
356
|
|
package/index.js
CHANGED
|
@@ -166,16 +166,16 @@ var main = /*#__PURE__*/function () {
|
|
|
166
166
|
return (0, _promises.writeFile)(filePath, JSON.stringify(dynamicConfiguration));
|
|
167
167
|
|
|
168
168
|
case 22:
|
|
169
|
-
additionalArguments = commandLineArguments.splice(3);
|
|
169
|
+
additionalArguments = commandLineArguments.splice(3); /// region register exit handler to tidy up
|
|
170
170
|
|
|
171
|
-
|
|
171
|
+
/// region register exit handler to tidy up
|
|
172
172
|
clear = function clear(error) {
|
|
173
173
|
// NOTE: Close handler have to be synchronous.
|
|
174
174
|
if (_clientnode["default"].isFileSync(filePath)) (0, _fs.unlinkSync)(filePath);
|
|
175
175
|
if (error) throw error;
|
|
176
176
|
};
|
|
177
177
|
|
|
178
|
-
closeEventHandlers.push(clear);
|
|
178
|
+
closeEventHandlers.push(clear); /// endregion
|
|
179
179
|
// endregion
|
|
180
180
|
// region handle clear
|
|
181
181
|
|
|
@@ -666,7 +666,7 @@ var main = /*#__PURE__*/function () {
|
|
|
666
666
|
} finally {
|
|
667
667
|
_iterator11.f();
|
|
668
668
|
}
|
|
669
|
-
};
|
|
669
|
+
}; /// region a-/synchronous
|
|
670
670
|
|
|
671
671
|
|
|
672
672
|
if (!['document', 'test', 'test:coverage', 'test:coverage:report'].includes(configuration.givenCommandLineArguments[2])) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weboptimizer",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1140",
|
|
4
4
|
"description": "A generic web optimizer, (module) bundler and development environment.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -1871,7 +1871,12 @@
|
|
|
1871
1871
|
"exceptions": [
|
|
1872
1872
|
"/usr/bin/env node"
|
|
1873
1873
|
]
|
|
1874
|
-
}
|
|
1874
|
+
},
|
|
1875
|
+
"markers": [
|
|
1876
|
+
"/",
|
|
1877
|
+
"//",
|
|
1878
|
+
"///"
|
|
1879
|
+
]
|
|
1875
1880
|
}
|
|
1876
1881
|
],
|
|
1877
1882
|
"space-infix-ops": 0,
|
package/type.js
CHANGED
|
@@ -23,18 +23,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
23
23
|
exports.TaskTypes = exports.SubConfigurationTypes = void 0;
|
|
24
24
|
// endregion
|
|
25
25
|
// region exports
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
/// region generic
|
|
27
|
+
/// endregion
|
|
28
|
+
/// region injection
|
|
29
|
+
/// endregion
|
|
30
|
+
/// region configuration
|
|
31
|
+
//// region path
|
|
32
|
+
//// endregion
|
|
33
|
+
//// region build
|
|
34
34
|
var SubConfigurationTypes = ['debug', 'document', 'test', 'test:browser'];
|
|
35
35
|
exports.SubConfigurationTypes = SubConfigurationTypes;
|
|
36
|
-
var TaskTypes = ['build', 'serve'].concat(SubConfigurationTypes);
|
|
37
|
-
|
|
36
|
+
var TaskTypes = ['build', 'serve'].concat(SubConfigurationTypes); //// endregion
|
|
37
|
+
//// region loader
|
|
38
38
|
// endregion
|
|
39
39
|
// region vim modline
|
|
40
40
|
// vim: set tabstop=4 shiftwidth=4 expandtab:
|
package/webpackConfigurator.js
CHANGED
|
@@ -104,16 +104,16 @@ if (plugins.Offline) {
|
|
|
104
104
|
|
|
105
105
|
var configuration = (0, _configurator["default"])();
|
|
106
106
|
var _module = configuration.module; // region initialisation
|
|
107
|
-
|
|
107
|
+
/// region determine library name
|
|
108
108
|
|
|
109
109
|
var libraryName;
|
|
110
110
|
if (configuration.libraryName) libraryName = configuration.libraryName;else if (Object.keys(configuration.injection.entry.normalized).length > 1) libraryName = '[name]';else {
|
|
111
111
|
libraryName = configuration.name;
|
|
112
112
|
if (['assign', 'global', 'this', 'var', 'window'].includes(configuration.exportFormat.self)) libraryName = _clientnode["default"].stringConvertToValidVariableName(libraryName);
|
|
113
|
-
}
|
|
114
|
-
|
|
113
|
+
} /// endregion
|
|
114
|
+
/// region plugins
|
|
115
115
|
|
|
116
|
-
var pluginInstances = [];
|
|
116
|
+
var pluginInstances = []; //// region define modules to ignore
|
|
117
117
|
|
|
118
118
|
var _iterator = _createForOfIteratorHelper([].concat(configuration.injection.ignorePattern)),
|
|
119
119
|
_step;
|
|
@@ -124,8 +124,8 @@ try {
|
|
|
124
124
|
if (typeof pattern.contextRegExp === 'string') pattern.contextRegExp = new RegExp(pattern.contextRegExp);
|
|
125
125
|
if (typeof pattern.resourceRegExp === 'string') pattern.resourceRegExp = new RegExp(pattern.resourceRegExp);
|
|
126
126
|
pluginInstances.push(new _webpack.IgnorePlugin(pattern));
|
|
127
|
-
}
|
|
128
|
-
|
|
127
|
+
} //// endregion
|
|
128
|
+
//// region define modules to replace
|
|
129
129
|
|
|
130
130
|
} catch (err) {
|
|
131
131
|
_iterator.e(err);
|
|
@@ -144,8 +144,8 @@ var _loop = function _loop(source) {
|
|
|
144
144
|
|
|
145
145
|
for (var source in _module.replacements.normal) {
|
|
146
146
|
_loop(source);
|
|
147
|
-
}
|
|
148
|
-
|
|
147
|
+
} //// endregion
|
|
148
|
+
//// region generate html file
|
|
149
149
|
|
|
150
150
|
|
|
151
151
|
var htmlAvailable = false;
|
|
@@ -163,8 +163,8 @@ try {
|
|
|
163
163
|
})));
|
|
164
164
|
htmlAvailable = true;
|
|
165
165
|
}
|
|
166
|
-
}
|
|
167
|
-
|
|
166
|
+
} //// endregion
|
|
167
|
+
//// region generate favicons
|
|
168
168
|
|
|
169
169
|
} catch (err) {
|
|
170
170
|
_iterator2.e(err);
|
|
@@ -172,8 +172,8 @@ try {
|
|
|
172
172
|
_iterator2.f();
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
if (htmlAvailable && configuration.favicon && plugins.Favicon && _clientnode["default"].isFileSync(configuration.favicon.logo)) pluginInstances.push(new plugins.Favicon(configuration.favicon));
|
|
176
|
-
|
|
175
|
+
if (htmlAvailable && configuration.favicon && plugins.Favicon && _clientnode["default"].isFileSync(configuration.favicon.logo)) pluginInstances.push(new plugins.Favicon(configuration.favicon)); //// endregion
|
|
176
|
+
//// region provide offline functionality
|
|
177
177
|
|
|
178
178
|
if (htmlAvailable && configuration.offline && plugins.Offline) {
|
|
179
179
|
if (!['serve', 'test:browser'].includes(configuration.givenCommandLineArguments[2])) for (var _i = 0, _Object$entries = Object.entries({
|
|
@@ -198,14 +198,14 @@ if (htmlAvailable && configuration.offline && plugins.Offline) {
|
|
|
198
198
|
}
|
|
199
199
|
if ([].concat(configuration.offline.use).includes('injectionManifest')) pluginInstances.push(new plugins.InjectManifest(_clientnode["default"].extend(true, configuration.offline.common, configuration.offline.injectionManifest)));
|
|
200
200
|
if ([].concat(configuration.offline.use).includes('generateServiceWorker')) pluginInstances.push(new plugins.GenerateServiceWorker(_clientnode["default"].extend(true, configuration.offline.common, configuration.offline.serviceWorker)));
|
|
201
|
-
}
|
|
202
|
-
|
|
201
|
+
} //// endregion
|
|
202
|
+
//// region provide build environment
|
|
203
203
|
|
|
204
204
|
|
|
205
205
|
if (configuration.buildContext.definitions) pluginInstances.push(new _webpack.DefinePlugin(configuration.buildContext.definitions));
|
|
206
|
-
if (_module.provide) pluginInstances.push(new _webpack.ProvidePlugin(_module.provide));
|
|
207
|
-
|
|
208
|
-
|
|
206
|
+
if (_module.provide) pluginInstances.push(new _webpack.ProvidePlugin(_module.provide)); //// endregion
|
|
207
|
+
//// region modules/assets
|
|
208
|
+
///// region apply module pattern
|
|
209
209
|
|
|
210
210
|
pluginInstances.push({
|
|
211
211
|
apply: function apply(compiler) {
|
|
@@ -225,8 +225,8 @@ pluginInstances.push({
|
|
|
225
225
|
}
|
|
226
226
|
});
|
|
227
227
|
}
|
|
228
|
-
});
|
|
229
|
-
|
|
228
|
+
}); ///// endregion
|
|
229
|
+
///// region in-place configured assets in the main html file
|
|
230
230
|
|
|
231
231
|
/*
|
|
232
232
|
TODO
|
|
@@ -313,17 +313,17 @@ if (htmlAvailable && !['serve', 'test:browser'].includes(configuration.givenComm
|
|
|
313
313
|
});
|
|
314
314
|
});
|
|
315
315
|
}
|
|
316
|
-
});
|
|
317
|
-
|
|
316
|
+
}); ///// endregion
|
|
317
|
+
///// region mark empty javaScript modules as dummy
|
|
318
318
|
|
|
319
|
-
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');
|
|
320
|
-
|
|
319
|
+
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'); ///// endregion
|
|
320
|
+
///// region extract cascading style sheets
|
|
321
321
|
|
|
322
322
|
var cssOutputPath = configuration.files.compose.cascadingStyleSheet;
|
|
323
323
|
if (cssOutputPath && plugins.MiniCSSExtract) pluginInstances.push(new plugins.MiniCSSExtract({
|
|
324
324
|
filename: typeof cssOutputPath === 'string' ? (0, _path.relative)(configuration.path.target.base, cssOutputPath) : cssOutputPath
|
|
325
|
-
}));
|
|
326
|
-
|
|
325
|
+
})); ///// endregion
|
|
326
|
+
///// region performs implicit external logic
|
|
327
327
|
|
|
328
328
|
if (configuration.injection.external.modules === '__implicit__')
|
|
329
329
|
/*
|
|
@@ -463,9 +463,9 @@ if (configuration.injection.external.modules === '__implicit__')
|
|
|
463
463
|
}
|
|
464
464
|
|
|
465
465
|
return callback();
|
|
466
|
-
};
|
|
467
|
-
|
|
468
|
-
|
|
466
|
+
}; ///// endregion
|
|
467
|
+
//// endregion
|
|
468
|
+
//// region apply final cascadingStyleSheet/dom/javaScript modifications/fixes
|
|
469
469
|
|
|
470
470
|
if (htmlAvailable) pluginInstances.push({
|
|
471
471
|
apply: function apply(compiler) {
|
|
@@ -561,8 +561,8 @@ if (htmlAvailable) pluginInstances.push({
|
|
|
561
561
|
});
|
|
562
562
|
});
|
|
563
563
|
}
|
|
564
|
-
});
|
|
565
|
-
|
|
564
|
+
}); //// endregion
|
|
565
|
+
//// region context replacements
|
|
566
566
|
|
|
567
567
|
var _iterator10 = _createForOfIteratorHelper(_module.replacements.context),
|
|
568
568
|
_step10;
|
|
@@ -580,8 +580,8 @@ try {
|
|
|
580
580
|
if (evaluated.error) throw new Error('Error occurred during processing given context ' + "replacement: ".concat(evaluated.error));
|
|
581
581
|
return evaluated.result;
|
|
582
582
|
}))));
|
|
583
|
-
}
|
|
584
|
-
|
|
583
|
+
} //// endregion
|
|
584
|
+
//// region consolidate duplicated module requests
|
|
585
585
|
|
|
586
586
|
/*
|
|
587
587
|
NOTE: Redundancies usually occur when symlinks aren't converted to their
|
|
@@ -786,9 +786,9 @@ new NormalModuleReplacementPlugin(
|
|
|
786
786
|
}
|
|
787
787
|
}
|
|
788
788
|
))*/
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
789
|
+
//// endregion
|
|
790
|
+
/// endregion
|
|
791
|
+
/// region loader helper
|
|
792
792
|
|
|
793
793
|
|
|
794
794
|
var isFilePathInDependencies = function isFilePathInDependencies(filePath) {
|
|
@@ -1157,8 +1157,8 @@ if (configuration.files.compose.cascadingStyleSheet && plugins.MiniCSSExtract) {
|
|
|
1157
1157
|
loader.style.use.unshift({
|
|
1158
1158
|
loader: plugins.MiniCSSExtract.loader
|
|
1159
1159
|
});
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1160
|
+
} /// endregion
|
|
1161
|
+
/// region apply runtime dev helper
|
|
1162
1162
|
|
|
1163
1163
|
/*
|
|
1164
1164
|
NOTE: Disable automatic injection to avoid injection in all chunks and as
|
|
@@ -1175,7 +1175,7 @@ if (htmlAvailable && configuration.debug && configuration.development.server.liv
|
|
|
1175
1175
|
configuration.development.server.hot = false;
|
|
1176
1176
|
pluginInstances.push(new _webpack.HotModuleReplacementPlugin());
|
|
1177
1177
|
}
|
|
1178
|
-
}
|
|
1178
|
+
} /// endregion
|
|
1179
1179
|
// endregion
|
|
1180
1180
|
// region plugins
|
|
1181
1181
|
|