weboptimizer 2.0.1594 → 2.0.1595
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 +22 -22
- package/index.js +137 -137
- package/package.json +15 -15
package/browser.js
CHANGED
|
@@ -29,7 +29,7 @@ var _clientnode = require("clientnode");
|
|
|
29
29
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, 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 o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
30
30
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
31
31
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
32
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var
|
|
32
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t3 in e) "default" !== _t3 && {}.hasOwnProperty.call(e, _t3) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t3)) && (i.get || i.set) ? o(f, _t3, i) : f[_t3] = e[_t3]); return f; })(e, t); }
|
|
33
33
|
// endregion
|
|
34
34
|
// region declaration
|
|
35
35
|
|
|
@@ -53,17 +53,17 @@ if (typeof TARGET_TECHNOLOGY === 'undefined' || TARGET_TECHNOLOGY === 'node')
|
|
|
53
53
|
"browser.initialized" at module loading time.
|
|
54
54
|
*/
|
|
55
55
|
(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
56
|
-
var _yield$Promise$all, _yield$Promise$all2, _yield$Promise$all2$, JSDOM, VirtualConsoleImplementation, path, virtualConsole, _iterator, _step, name, render, filePath, ejsLoader, content;
|
|
57
|
-
return _regenerator["default"].wrap(function
|
|
56
|
+
var _yield$Promise$all, _yield$Promise$all2, _yield$Promise$all2$, JSDOM, VirtualConsoleImplementation, path, virtualConsole, _iterator, _step, name, render, filePath, ejsLoader, content, _t, _t2;
|
|
57
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
58
58
|
while (1) switch (_context.prev = _context.next) {
|
|
59
59
|
case 0:
|
|
60
|
-
_context.next =
|
|
60
|
+
_context.next = 1;
|
|
61
61
|
return Promise.all([Promise.resolve().then(function () {
|
|
62
62
|
return _interopRequireWildcard(require('jsdom'));
|
|
63
63
|
}), Promise.resolve().then(function () {
|
|
64
64
|
return _interopRequireWildcard(require('path'));
|
|
65
65
|
})]);
|
|
66
|
-
case
|
|
66
|
+
case 1:
|
|
67
67
|
_yield$Promise$all = _context.sent;
|
|
68
68
|
_yield$Promise$all2 = (0, _slicedToArray2["default"])(_yield$Promise$all, 2);
|
|
69
69
|
_yield$Promise$all2$ = _yield$Promise$all2[0];
|
|
@@ -141,7 +141,7 @@ if (typeof TARGET_TECHNOLOGY === 'undefined' || TARGET_TECHNOLOGY === 'node')
|
|
|
141
141
|
});
|
|
142
142
|
};
|
|
143
143
|
if (!(typeof NAME === 'undefined' || NAME === 'webOptimizer')) {
|
|
144
|
-
_context.next =
|
|
144
|
+
_context.next = 5;
|
|
145
145
|
break;
|
|
146
146
|
}
|
|
147
147
|
filePath = path.join(__dirname, 'index.html.ejs');
|
|
@@ -149,38 +149,38 @@ if (typeof TARGET_TECHNOLOGY === 'undefined' || TARGET_TECHNOLOGY === 'node')
|
|
|
149
149
|
NOTE: We load dependencies now to avoid having file imports
|
|
150
150
|
after test runner has finished to isolate the environment.
|
|
151
151
|
*/
|
|
152
|
-
_context.next =
|
|
152
|
+
_context.next = 2;
|
|
153
153
|
return Promise.resolve().then(function () {
|
|
154
154
|
return _interopRequireWildcard(require('./ejsLoader'));
|
|
155
155
|
});
|
|
156
|
-
case
|
|
156
|
+
case 2:
|
|
157
157
|
ejsLoader = _context.sent["default"];
|
|
158
|
-
_context.next =
|
|
158
|
+
_context.next = 3;
|
|
159
159
|
return Promise.resolve().then(function () {
|
|
160
160
|
return _interopRequireWildcard(require('fs'));
|
|
161
161
|
});
|
|
162
|
-
case
|
|
163
|
-
_context.next =
|
|
162
|
+
case 3:
|
|
163
|
+
_context.next = 4;
|
|
164
164
|
return _context.sent.promises.readFile(filePath, {
|
|
165
165
|
encoding: 'utf-8'
|
|
166
166
|
});
|
|
167
|
-
case
|
|
167
|
+
case 4:
|
|
168
168
|
content = _context.sent;
|
|
169
169
|
render(ejsLoader.bind({
|
|
170
170
|
resourcePath: filePath
|
|
171
171
|
})(content));
|
|
172
|
-
_context.next =
|
|
172
|
+
_context.next = 7;
|
|
173
173
|
break;
|
|
174
|
-
case
|
|
175
|
-
|
|
176
|
-
_context.next =
|
|
174
|
+
case 5:
|
|
175
|
+
_t = render;
|
|
176
|
+
_context.next = 6;
|
|
177
177
|
return Promise.resolve().then(function () {
|
|
178
178
|
return _interopRequireWildcard(require('webOptimizerDefaultTemplateFilePath'));
|
|
179
179
|
});
|
|
180
|
-
case
|
|
181
|
-
|
|
182
|
-
(
|
|
183
|
-
case
|
|
180
|
+
case 6:
|
|
181
|
+
_t2 = _context.sent;
|
|
182
|
+
_t(_t2);
|
|
183
|
+
case 7:
|
|
184
184
|
case "end":
|
|
185
185
|
return _context.stop();
|
|
186
186
|
}
|
|
@@ -225,7 +225,7 @@ var getInitializedBrowser = exports.getInitializedBrowser = /*#__PURE__*/functio
|
|
|
225
225
|
promise,
|
|
226
226
|
wrappedCallback,
|
|
227
227
|
_args2 = arguments;
|
|
228
|
-
return _regenerator["default"].wrap(function
|
|
228
|
+
return _regenerator["default"].wrap(function (_context2) {
|
|
229
229
|
while (1) switch (_context2.prev = _context2.next) {
|
|
230
230
|
case 0:
|
|
231
231
|
replaceWindow = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : true;
|
|
@@ -242,7 +242,7 @@ var getInitializedBrowser = exports.getInitializedBrowser = /*#__PURE__*/functio
|
|
|
242
242
|
};
|
|
243
243
|
if (browser.initialized) wrappedCallback();else onCreatedListener.push(wrappedCallback);
|
|
244
244
|
return _context2.abrupt("return", promise);
|
|
245
|
-
case
|
|
245
|
+
case 1:
|
|
246
246
|
case "end":
|
|
247
247
|
return _context2.stop();
|
|
248
248
|
}
|
package/index.js
CHANGED
|
@@ -37,7 +37,7 @@ var _path = _interopRequireWildcard(require("path"));
|
|
|
37
37
|
var _rimraf = require("rimraf");
|
|
38
38
|
var _configurator = require("./configurator");
|
|
39
39
|
var _helper = require("./helper");
|
|
40
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var
|
|
40
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t0 in e) "default" !== _t0 && {}.hasOwnProperty.call(e, _t0) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t0)) && (i.get || i.set) ? o(f, _t0, i) : f[_t0] = e[_t0]); return f; })(e, t); }
|
|
41
41
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, 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 o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
42
42
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
43
43
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
@@ -63,14 +63,14 @@ var main = function main(context) {
|
|
|
63
63
|
var webOptimizerPath = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : __dirname;
|
|
64
64
|
var environment = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : eval('process.env');
|
|
65
65
|
return (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
66
|
-
var configuration, clear, processOptions, childProcessOptions, childProcesses, processPromises, possibleArguments, closeEventHandlers, dynamicConfiguration, count, filePath, additionalArguments, _iterator, _step, file, _iterator2, _step2, _filePath, buildConfigurations, tidiedUp, tidyUp, testModuleFilePaths, _iterator7, _step7, buildConfiguration, expression, _iterator8, _step8, _loop, handleTask, finished, closeHandler, _iterator1, _step1, closeEventName;
|
|
67
|
-
return _regenerator["default"].wrap(function
|
|
66
|
+
var configuration, clear, processOptions, childProcessOptions, childProcesses, processPromises, possibleArguments, closeEventHandlers, dynamicConfiguration, count, filePath, additionalArguments, _iterator, _step, file, _iterator2, _step2, _filePath, buildConfigurations, tidiedUp, tidyUp, testModuleFilePaths, _iterator7, _step7, buildConfiguration, expression, _iterator8, _step8, _loop, handleTask, finished, closeHandler, _iterator1, _step1, closeEventName, _t3, _t4, _t5, _t6, _t7, _t8, _t9;
|
|
67
|
+
return _regenerator["default"].wrap(function (_context3) {
|
|
68
68
|
while (1) switch (_context3.prev = _context3.next) {
|
|
69
69
|
case 0:
|
|
70
70
|
if (environment.PATH && !environment.PATH.includes(':node_modules/.bin')) environment.PATH += ':node_modules/.bin';else environment.PATH = 'node_modules/.bin';
|
|
71
71
|
configuration = (0, _configurator.load)(context, currentWorkingDirectory, commandLineArguments, webOptimizerPath, environment);
|
|
72
72
|
clear = (0, _clientnode.NOOP)();
|
|
73
|
-
_context3.prev =
|
|
73
|
+
_context3.prev = 1;
|
|
74
74
|
// region controller
|
|
75
75
|
processOptions = {
|
|
76
76
|
cwd: configuration.path.context,
|
|
@@ -85,7 +85,7 @@ var main = function main(context) {
|
|
|
85
85
|
possibleArguments = ['build', 'build:types', 'clear', 'document', 'lint', 'preinstall', 'serve', 'test', 'test:browser', 'test:coverage', 'test:coverage:report', 'check:types'];
|
|
86
86
|
closeEventHandlers = [];
|
|
87
87
|
if (!(configuration.givenCommandLineArguments.length > 2)) {
|
|
88
|
-
_context3.next =
|
|
88
|
+
_context3.next = 37;
|
|
89
89
|
break;
|
|
90
90
|
}
|
|
91
91
|
// region temporary save dynamically given configurations
|
|
@@ -96,28 +96,28 @@ var main = function main(context) {
|
|
|
96
96
|
if (configuration.givenCommandLineArguments.length > 3 && (0, _clientnode.parseEncodedObject)(configuration.givenCommandLineArguments[configuration.givenCommandLineArguments.length - 1], configuration, 'configuration')) configuration.givenCommandLineArguments.pop();
|
|
97
97
|
count = 0;
|
|
98
98
|
filePath = (0, _path.resolve)(configuration.path.context, ".dynamicConfiguration-".concat(String(count), ".json"));
|
|
99
|
-
case
|
|
99
|
+
case 2:
|
|
100
100
|
if (!(count < _clientnode.MAXIMAL_NUMBER_OF_ITERATIONS.value)) {
|
|
101
|
-
_context3.next =
|
|
101
|
+
_context3.next = 5;
|
|
102
102
|
break;
|
|
103
103
|
}
|
|
104
104
|
filePath = (0, _path.resolve)(configuration.path.context, ".dynamicConfiguration-".concat(String(count), ".json"));
|
|
105
|
-
_context3.next =
|
|
105
|
+
_context3.next = 3;
|
|
106
106
|
return (0, _clientnode.isFile)(filePath);
|
|
107
|
-
case
|
|
107
|
+
case 3:
|
|
108
108
|
if (_context3.sent) {
|
|
109
|
-
_context3.next =
|
|
109
|
+
_context3.next = 4;
|
|
110
110
|
break;
|
|
111
111
|
}
|
|
112
|
-
return _context3.abrupt("
|
|
113
|
-
case
|
|
112
|
+
return _context3.abrupt("continue", 5);
|
|
113
|
+
case 4:
|
|
114
114
|
count++;
|
|
115
|
-
_context3.next =
|
|
115
|
+
_context3.next = 2;
|
|
116
116
|
break;
|
|
117
|
-
case
|
|
118
|
-
_context3.next =
|
|
117
|
+
case 5:
|
|
118
|
+
_context3.next = 6;
|
|
119
119
|
return (0, _promises.writeFile)(filePath, JSON.stringify(dynamicConfiguration));
|
|
120
|
-
case
|
|
120
|
+
case 6:
|
|
121
121
|
additionalArguments = commandLineArguments.splice(3); /// region register exit handler to tidy up
|
|
122
122
|
clear = function clear(error) {
|
|
123
123
|
// NOTE: Close handler have to be synchronous.
|
|
@@ -136,18 +136,18 @@ var main = function main(context) {
|
|
|
136
136
|
during pre-install phase.
|
|
137
137
|
*/
|
|
138
138
|
if (!(!['build', 'build:types', 'lint', 'preinstall', 'serve', 'test', 'test:browser', 'test:coverage', 'test:coverage:report'].includes(configuration.givenCommandLineArguments[2]) && possibleArguments.includes(configuration.givenCommandLineArguments[2]))) {
|
|
139
|
-
_context3.next =
|
|
139
|
+
_context3.next = 20;
|
|
140
140
|
break;
|
|
141
141
|
}
|
|
142
142
|
if (!((0, _path.resolve)(configuration.path.target.base) === (0, _path.resolve)(configuration.path.context))) {
|
|
143
|
-
_context3.next =
|
|
143
|
+
_context3.next = 16;
|
|
144
144
|
break;
|
|
145
145
|
}
|
|
146
|
-
_context3.next =
|
|
146
|
+
_context3.next = 7;
|
|
147
147
|
return (0, _clientnode.walkDirectoryRecursively)(configuration.path.target.base, /*#__PURE__*/function () {
|
|
148
148
|
var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(file) {
|
|
149
|
-
var type, _file$stats;
|
|
150
|
-
return _regenerator["default"].wrap(function
|
|
149
|
+
var type, _file$stats, _t, _t2;
|
|
150
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
151
151
|
while (1) switch (_context.prev = _context.next) {
|
|
152
152
|
case 0:
|
|
153
153
|
if (!(0, _helper.isFilePathInLocation)(file.path, configuration.path.ignore.concat(configuration.module.directoryNames, configuration.loader.directoryNames).map(function (filePath) {
|
|
@@ -155,39 +155,39 @@ var main = function main(context) {
|
|
|
155
155
|
}).filter(function (filePath) {
|
|
156
156
|
return !configuration.path.context.startsWith(filePath);
|
|
157
157
|
}))) {
|
|
158
|
-
_context.next =
|
|
158
|
+
_context.next = 1;
|
|
159
159
|
break;
|
|
160
160
|
}
|
|
161
161
|
return _context.abrupt("return", false);
|
|
162
|
+
case 1:
|
|
163
|
+
_t = _regenerator["default"].keys(configuration.buildContext.types);
|
|
162
164
|
case 2:
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
if ((_context.t1 = _context.t0()).done) {
|
|
166
|
-
_context.next = 15;
|
|
165
|
+
if ((_t2 = _t()).done) {
|
|
166
|
+
_context.next = 7;
|
|
167
167
|
break;
|
|
168
168
|
}
|
|
169
|
-
type =
|
|
169
|
+
type = _t2.value;
|
|
170
170
|
if (!new RegExp(configuration.buildContext.types[type].filePathPattern).test(file.path)) {
|
|
171
|
-
_context.next =
|
|
171
|
+
_context.next = 6;
|
|
172
172
|
break;
|
|
173
173
|
}
|
|
174
174
|
if (!((_file$stats = file.stats) !== null && _file$stats !== void 0 && _file$stats.isDirectory())) {
|
|
175
|
-
_context.next =
|
|
175
|
+
_context.next = 4;
|
|
176
176
|
break;
|
|
177
177
|
}
|
|
178
|
-
_context.next =
|
|
178
|
+
_context.next = 3;
|
|
179
179
|
return (0, _rimraf.rimraf)(file.path);
|
|
180
|
-
case
|
|
180
|
+
case 3:
|
|
181
181
|
return _context.abrupt("return", false);
|
|
182
|
-
case
|
|
183
|
-
_context.next =
|
|
182
|
+
case 4:
|
|
183
|
+
_context.next = 5;
|
|
184
184
|
return (0, _promises.unlink)(file.path);
|
|
185
|
-
case
|
|
186
|
-
return _context.abrupt("
|
|
187
|
-
case
|
|
188
|
-
_context.next =
|
|
185
|
+
case 5:
|
|
186
|
+
return _context.abrupt("continue", 7);
|
|
187
|
+
case 6:
|
|
188
|
+
_context.next = 2;
|
|
189
189
|
break;
|
|
190
|
-
case
|
|
190
|
+
case 7:
|
|
191
191
|
case "end":
|
|
192
192
|
return _context.stop();
|
|
193
193
|
}
|
|
@@ -197,60 +197,60 @@ var main = function main(context) {
|
|
|
197
197
|
return _ref2.apply(this, arguments);
|
|
198
198
|
};
|
|
199
199
|
}());
|
|
200
|
-
case
|
|
201
|
-
|
|
202
|
-
_context3.next =
|
|
200
|
+
case 7:
|
|
201
|
+
_t3 = _createForOfIteratorHelper;
|
|
202
|
+
_context3.next = 8;
|
|
203
203
|
return (0, _clientnode.walkDirectoryRecursively)(configuration.path.target.base, function () {
|
|
204
204
|
return false;
|
|
205
205
|
}, configuration.encoding);
|
|
206
|
-
case
|
|
207
|
-
|
|
208
|
-
_iterator = (
|
|
209
|
-
_context3.prev =
|
|
206
|
+
case 8:
|
|
207
|
+
_t4 = _context3.sent;
|
|
208
|
+
_iterator = _t3(_t4);
|
|
209
|
+
_context3.prev = 9;
|
|
210
210
|
_iterator.s();
|
|
211
|
-
case
|
|
211
|
+
case 10:
|
|
212
212
|
if ((_step = _iterator.n()).done) {
|
|
213
|
-
_context3.next =
|
|
213
|
+
_context3.next = 12;
|
|
214
214
|
break;
|
|
215
215
|
}
|
|
216
216
|
file = _step.value;
|
|
217
217
|
if (!file.name.startsWith('npm-debug')) {
|
|
218
|
-
_context3.next =
|
|
218
|
+
_context3.next = 11;
|
|
219
219
|
break;
|
|
220
220
|
}
|
|
221
|
-
_context3.next =
|
|
221
|
+
_context3.next = 11;
|
|
222
222
|
return (0, _promises.unlink)(file.path);
|
|
223
|
-
case
|
|
224
|
-
_context3.next =
|
|
223
|
+
case 11:
|
|
224
|
+
_context3.next = 10;
|
|
225
225
|
break;
|
|
226
|
-
case
|
|
227
|
-
_context3.next =
|
|
226
|
+
case 12:
|
|
227
|
+
_context3.next = 14;
|
|
228
228
|
break;
|
|
229
|
-
case
|
|
230
|
-
_context3.prev =
|
|
231
|
-
|
|
232
|
-
_iterator.e(
|
|
233
|
-
case
|
|
234
|
-
_context3.prev =
|
|
229
|
+
case 13:
|
|
230
|
+
_context3.prev = 13;
|
|
231
|
+
_t5 = _context3["catch"](9);
|
|
232
|
+
_iterator.e(_t5);
|
|
233
|
+
case 14:
|
|
234
|
+
_context3.prev = 14;
|
|
235
235
|
_iterator.f();
|
|
236
|
-
return _context3.finish(
|
|
237
|
-
case
|
|
238
|
-
_context3.next =
|
|
236
|
+
return _context3.finish(14);
|
|
237
|
+
case 15:
|
|
238
|
+
_context3.next = 17;
|
|
239
239
|
break;
|
|
240
|
-
case
|
|
241
|
-
_context3.next =
|
|
240
|
+
case 16:
|
|
241
|
+
_context3.next = 17;
|
|
242
242
|
return (0, _rimraf.rimraf)(configuration.path.target.base);
|
|
243
|
-
case
|
|
244
|
-
_context3.next =
|
|
243
|
+
case 17:
|
|
244
|
+
_context3.next = 18;
|
|
245
245
|
return (0, _clientnode.isDirectory)(configuration.path.apiDocumentation);
|
|
246
|
-
case
|
|
246
|
+
case 18:
|
|
247
247
|
if (!_context3.sent) {
|
|
248
|
-
_context3.next =
|
|
248
|
+
_context3.next = 19;
|
|
249
249
|
break;
|
|
250
250
|
}
|
|
251
|
-
_context3.next =
|
|
251
|
+
_context3.next = 19;
|
|
252
252
|
return (0, _rimraf.rimraf)(configuration.path.apiDocumentation);
|
|
253
|
-
case
|
|
253
|
+
case 19:
|
|
254
254
|
_iterator2 = _createForOfIteratorHelper(configuration.path.tidyUpOnClear);
|
|
255
255
|
try {
|
|
256
256
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
@@ -265,7 +265,7 @@ var main = function main(context) {
|
|
|
265
265
|
_iterator2.f();
|
|
266
266
|
}
|
|
267
267
|
(0, _rimraf.sync)((0, _globAll.sync)(configuration.path.tidyUpOnClearGlobs));
|
|
268
|
-
case
|
|
268
|
+
case 20:
|
|
269
269
|
// endregion
|
|
270
270
|
// region handle build
|
|
271
271
|
buildConfigurations = (0, _helper.resolveBuildConfigurationFilePaths)(configuration.buildContext.types, configuration.path.source.asset.base, configuration.path.ignore.concat(configuration.module.directoryNames, configuration.loader.directoryNames).map(function (filePath) {
|
|
@@ -274,7 +274,7 @@ var main = function main(context) {
|
|
|
274
274
|
return !configuration.path.context.startsWith(filePath);
|
|
275
275
|
}), configuration["package"].main.fileNames);
|
|
276
276
|
if (!['build', 'document', 'test', 'test:coverage', 'test:coverage:report'].includes(commandLineArguments[2])) {
|
|
277
|
-
_context3.next =
|
|
277
|
+
_context3.next = 21;
|
|
278
278
|
break;
|
|
279
279
|
}
|
|
280
280
|
tidiedUp = false;
|
|
@@ -390,11 +390,11 @@ var main = function main(context) {
|
|
|
390
390
|
}));
|
|
391
391
|
// endregion
|
|
392
392
|
// region handle pre-install
|
|
393
|
-
_context3.next =
|
|
393
|
+
_context3.next = 34;
|
|
394
394
|
break;
|
|
395
|
-
case
|
|
395
|
+
case 21:
|
|
396
396
|
if (!(configuration.library && configuration.givenCommandLineArguments[2] === 'preinstall')) {
|
|
397
|
-
_context3.next =
|
|
397
|
+
_context3.next = 34;
|
|
398
398
|
break;
|
|
399
399
|
}
|
|
400
400
|
// Perform all file specific preprocessing stuff.
|
|
@@ -403,25 +403,25 @@ var main = function main(context) {
|
|
|
403
403
|
file: configuration.extensions.file.internal
|
|
404
404
|
}, configuration.path.context, configuration.path.source.asset.base, configuration.path.ignore).filePaths;
|
|
405
405
|
_iterator7 = _createForOfIteratorHelper(buildConfigurations);
|
|
406
|
-
_context3.prev =
|
|
406
|
+
_context3.prev = 22;
|
|
407
407
|
_iterator7.s();
|
|
408
|
-
case
|
|
408
|
+
case 23:
|
|
409
409
|
if ((_step7 = _iterator7.n()).done) {
|
|
410
|
-
_context3.next =
|
|
410
|
+
_context3.next = 31;
|
|
411
411
|
break;
|
|
412
412
|
}
|
|
413
413
|
buildConfiguration = _step7.value;
|
|
414
414
|
expression = buildConfiguration[configuration.givenCommandLineArguments[2]].trim();
|
|
415
415
|
_iterator8 = _createForOfIteratorHelper(buildConfiguration.filePaths);
|
|
416
|
-
_context3.prev =
|
|
416
|
+
_context3.prev = 24;
|
|
417
417
|
_loop = /*#__PURE__*/_regenerator["default"].mark(function _loop() {
|
|
418
418
|
var filePath, evaluated;
|
|
419
|
-
return _regenerator["default"].wrap(function
|
|
419
|
+
return _regenerator["default"].wrap(function (_context2) {
|
|
420
420
|
while (1) switch (_context2.prev = _context2.next) {
|
|
421
421
|
case 0:
|
|
422
422
|
filePath = _step8.value;
|
|
423
423
|
if (testModuleFilePaths.includes(filePath)) {
|
|
424
|
-
_context2.next =
|
|
424
|
+
_context2.next = 2;
|
|
425
425
|
break;
|
|
426
426
|
}
|
|
427
427
|
evaluated = (0, _clientnode.evaluate)("`".concat(expression, "`"), {
|
|
@@ -433,11 +433,11 @@ var main = function main(context) {
|
|
|
433
433
|
filePath: filePath
|
|
434
434
|
});
|
|
435
435
|
if (!evaluated.error) {
|
|
436
|
-
_context2.next =
|
|
436
|
+
_context2.next = 1;
|
|
437
437
|
break;
|
|
438
438
|
}
|
|
439
439
|
throw new Error('Error occurred during processing given ' + "command: ".concat(evaluated.error));
|
|
440
|
-
case
|
|
440
|
+
case 1:
|
|
441
441
|
console.info("Running \"".concat(evaluated.result, "\""));
|
|
442
442
|
processPromises.push(new Promise(function (resolve, reject) {
|
|
443
443
|
return [(0, _clientnode.handleChildProcess)((0, _child_process.exec)(evaluated.result, _objectSpread({
|
|
@@ -449,48 +449,48 @@ var main = function main(context) {
|
|
|
449
449
|
});
|
|
450
450
|
}))];
|
|
451
451
|
}));
|
|
452
|
-
case
|
|
452
|
+
case 2:
|
|
453
453
|
case "end":
|
|
454
454
|
return _context2.stop();
|
|
455
455
|
}
|
|
456
456
|
}, _loop);
|
|
457
457
|
});
|
|
458
458
|
_iterator8.s();
|
|
459
|
-
case
|
|
459
|
+
case 25:
|
|
460
460
|
if ((_step8 = _iterator8.n()).done) {
|
|
461
|
-
_context3.next =
|
|
461
|
+
_context3.next = 27;
|
|
462
462
|
break;
|
|
463
463
|
}
|
|
464
|
-
return _context3.delegateYield(_loop(), "
|
|
465
|
-
case
|
|
466
|
-
_context3.next =
|
|
464
|
+
return _context3.delegateYield(_loop(), "t0", 26);
|
|
465
|
+
case 26:
|
|
466
|
+
_context3.next = 25;
|
|
467
467
|
break;
|
|
468
|
-
case
|
|
469
|
-
_context3.next =
|
|
468
|
+
case 27:
|
|
469
|
+
_context3.next = 29;
|
|
470
470
|
break;
|
|
471
|
-
case
|
|
472
|
-
_context3.prev =
|
|
473
|
-
|
|
474
|
-
_iterator8.e(
|
|
475
|
-
case
|
|
476
|
-
_context3.prev =
|
|
471
|
+
case 28:
|
|
472
|
+
_context3.prev = 28;
|
|
473
|
+
_t6 = _context3["catch"](24);
|
|
474
|
+
_iterator8.e(_t6);
|
|
475
|
+
case 29:
|
|
476
|
+
_context3.prev = 29;
|
|
477
477
|
_iterator8.f();
|
|
478
|
-
return _context3.finish(
|
|
479
|
-
case
|
|
480
|
-
_context3.next =
|
|
478
|
+
return _context3.finish(29);
|
|
479
|
+
case 30:
|
|
480
|
+
_context3.next = 23;
|
|
481
481
|
break;
|
|
482
|
-
case
|
|
483
|
-
_context3.next =
|
|
482
|
+
case 31:
|
|
483
|
+
_context3.next = 33;
|
|
484
484
|
break;
|
|
485
|
-
case
|
|
486
|
-
_context3.prev =
|
|
487
|
-
|
|
488
|
-
_iterator7.e(
|
|
489
|
-
case
|
|
490
|
-
_context3.prev =
|
|
485
|
+
case 32:
|
|
486
|
+
_context3.prev = 32;
|
|
487
|
+
_t7 = _context3["catch"](22);
|
|
488
|
+
_iterator7.e(_t7);
|
|
489
|
+
case 33:
|
|
490
|
+
_context3.prev = 33;
|
|
491
491
|
_iterator7.f();
|
|
492
|
-
return _context3.finish(
|
|
493
|
-
case
|
|
492
|
+
return _context3.finish(33);
|
|
493
|
+
case 34:
|
|
494
494
|
// endregion
|
|
495
495
|
// region handle remaining tasks
|
|
496
496
|
handleTask = function handleTask(type) {
|
|
@@ -537,18 +537,18 @@ var main = function main(context) {
|
|
|
537
537
|
}
|
|
538
538
|
}; /// region a-/synchronous
|
|
539
539
|
if (!['document', 'test', 'test:coverage', 'test:coverage:report'].includes(configuration.givenCommandLineArguments[2])) {
|
|
540
|
-
_context3.next =
|
|
540
|
+
_context3.next = 36;
|
|
541
541
|
break;
|
|
542
542
|
}
|
|
543
|
-
_context3.next =
|
|
543
|
+
_context3.next = 35;
|
|
544
544
|
return Promise.all(processPromises);
|
|
545
|
-
case
|
|
545
|
+
case 35:
|
|
546
546
|
handleTask(configuration.givenCommandLineArguments[2]);
|
|
547
|
-
_context3.next =
|
|
547
|
+
_context3.next = 37;
|
|
548
548
|
break;
|
|
549
|
-
case
|
|
549
|
+
case 36:
|
|
550
550
|
if (['build:types', 'check:types', 'lint', 'serve', 'test:browser'].includes(configuration.givenCommandLineArguments[2])) handleTask(configuration.givenCommandLineArguments[2]);
|
|
551
|
-
case
|
|
551
|
+
case 37:
|
|
552
552
|
finished = false;
|
|
553
553
|
closeHandler = function closeHandler() {
|
|
554
554
|
if (!finished) for (var _i2 = 0, _closeEventHandlers = closeEventHandlers; _i2 < _closeEventHandlers.length; _i2++) {
|
|
@@ -571,37 +571,37 @@ var main = function main(context) {
|
|
|
571
571
|
if (require.main === module && (configuration.givenCommandLineArguments.length < 3 || !possibleArguments.includes(configuration.givenCommandLineArguments[2]))) console.info("Give one of \"".concat(possibleArguments.join('", "'), "\" as command ") + 'line argument. You can provide a json string as second ' + 'parameter to dynamically overwrite some configurations.\n');
|
|
572
572
|
// endregion
|
|
573
573
|
// region forward nested return codes
|
|
574
|
-
_context3.prev =
|
|
575
|
-
_context3.next =
|
|
574
|
+
_context3.prev = 38;
|
|
575
|
+
_context3.next = 39;
|
|
576
576
|
return Promise.all(processPromises);
|
|
577
|
-
case
|
|
578
|
-
_context3.next =
|
|
577
|
+
case 39:
|
|
578
|
+
_context3.next = 41;
|
|
579
579
|
break;
|
|
580
|
-
case
|
|
581
|
-
_context3.prev =
|
|
582
|
-
|
|
583
|
-
console.error(
|
|
584
|
-
process.exit(
|
|
585
|
-
case
|
|
586
|
-
_context3.next =
|
|
580
|
+
case 40:
|
|
581
|
+
_context3.prev = 40;
|
|
582
|
+
_t8 = _context3["catch"](38);
|
|
583
|
+
console.error(_t8);
|
|
584
|
+
process.exit(_t8.returnCode);
|
|
585
|
+
case 41:
|
|
586
|
+
_context3.next = 44;
|
|
587
587
|
break;
|
|
588
|
-
case
|
|
589
|
-
_context3.prev =
|
|
590
|
-
|
|
588
|
+
case 42:
|
|
589
|
+
_context3.prev = 42;
|
|
590
|
+
_t9 = _context3["catch"](1);
|
|
591
591
|
if (!configuration.debug) {
|
|
592
|
-
_context3.next =
|
|
592
|
+
_context3.next = 43;
|
|
593
593
|
break;
|
|
594
594
|
}
|
|
595
|
-
throw
|
|
596
|
-
case
|
|
597
|
-
console.error(
|
|
598
|
-
case
|
|
595
|
+
throw _t9;
|
|
596
|
+
case 43:
|
|
597
|
+
console.error(_t9);
|
|
598
|
+
case 44:
|
|
599
599
|
return _context3.abrupt("return", clear);
|
|
600
|
-
case
|
|
600
|
+
case 45:
|
|
601
601
|
case "end":
|
|
602
602
|
return _context3.stop();
|
|
603
603
|
}
|
|
604
|
-
}, _callee2, null, [[
|
|
604
|
+
}, _callee2, null, [[1, 42], [9, 13, 14, 15], [22, 32, 33, 34], [24, 28, 29, 30], [38, 40]]);
|
|
605
605
|
}))();
|
|
606
606
|
} catch (e) {
|
|
607
607
|
return Promise.reject(e);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weboptimizer",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1595",
|
|
4
4
|
"description": "A generic web optimizer, (module) bundler and development environment.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -86,19 +86,19 @@
|
|
|
86
86
|
},
|
|
87
87
|
"runkitExample": "require('@babel/runtime/package.json')\n\nconst {default: main} = require('weboptimizer')\n\nawait main('./', './', ['clear'])",
|
|
88
88
|
"dependencies": {
|
|
89
|
-
"@babel/core": "^7.
|
|
89
|
+
"@babel/core": "^7.28.0",
|
|
90
90
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
91
|
-
"@babel/plugin-proposal-decorators": "^7.
|
|
91
|
+
"@babel/plugin-proposal-decorators": "^7.28.0",
|
|
92
92
|
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
|
|
93
93
|
"@babel/plugin-syntax-top-level-await": "^7.14.5",
|
|
94
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
95
|
-
"@babel/preset-env": "^7.
|
|
94
|
+
"@babel/plugin-transform-runtime": "^7.28.0",
|
|
95
|
+
"@babel/preset-env": "^7.28.0",
|
|
96
96
|
"@babel/preset-typescript": "^7.27.1",
|
|
97
97
|
"@babel/runtime": "^7.27.6",
|
|
98
98
|
"babel-loader": "^10.0.0",
|
|
99
99
|
"babel-plugin-transform-modern-regexp": "^0.0.6",
|
|
100
100
|
"babel-preset-minify": "^0.5.2",
|
|
101
|
-
"clientnode": "3.0.
|
|
101
|
+
"clientnode": "3.0.1299",
|
|
102
102
|
"ejs": "^3.1.10",
|
|
103
103
|
"exports-loader": "^5.0.0",
|
|
104
104
|
"extract-loader": "^5.1.0",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"html-minifier": "^4.0.0",
|
|
108
108
|
"html-webpack-plugin": "^5.6.3",
|
|
109
109
|
"imports-loader": "^5.0.0",
|
|
110
|
-
"jest-environment-jsdom": "^30.0.
|
|
110
|
+
"jest-environment-jsdom": "^30.0.4",
|
|
111
111
|
"rimraf": "^6.0.1",
|
|
112
112
|
"script-loader": "^0.7.2",
|
|
113
113
|
"typescript": "^5.8.3",
|
|
@@ -116,15 +116,15 @@
|
|
|
116
116
|
"webpack-sources": "^3.3.3"
|
|
117
117
|
},
|
|
118
118
|
"devDependencies": {
|
|
119
|
-
"@babel/cli": "^7.
|
|
120
|
-
"@babel/eslint-parser": "^7.
|
|
119
|
+
"@babel/cli": "^7.28.0",
|
|
120
|
+
"@babel/eslint-parser": "^7.28.0",
|
|
121
121
|
"@stylistic/eslint-plugin": "^5.1.0",
|
|
122
122
|
"@types/ejs": "^3.1.5",
|
|
123
123
|
"@types/eslint": "^9.6.1",
|
|
124
124
|
"@types/html-minifier": "^4.0.5",
|
|
125
125
|
"@types/html-minifier-terser": "^7.0.2",
|
|
126
126
|
"@types/imagemin": "^9.0.1",
|
|
127
|
-
"@types/node": "^24.0.
|
|
127
|
+
"@types/node": "^24.0.10",
|
|
128
128
|
"@types/postcss-import": "^14.0.3",
|
|
129
129
|
"@types/postcss-url": "^10.0.4",
|
|
130
130
|
"@types/webpack-env": "^1.18.8",
|
|
@@ -132,15 +132,15 @@
|
|
|
132
132
|
"@typescript-eslint/parser": "^8.35.1",
|
|
133
133
|
"css-loader": "^7.1.2",
|
|
134
134
|
"cssnano": "^7.0.7",
|
|
135
|
-
"documentation-website": "^1.0.
|
|
136
|
-
"eslint": "^9.30.
|
|
135
|
+
"documentation-website": "^1.0.392",
|
|
136
|
+
"eslint": "^9.30.1",
|
|
137
137
|
"eslint-config-google": "^0.14.0",
|
|
138
|
-
"eslint-plugin-jsdoc": "^51.3.
|
|
138
|
+
"eslint-plugin-jsdoc": "^51.3.3",
|
|
139
139
|
"favicons": "^7.2.0",
|
|
140
140
|
"favicons-webpack-plugin": "^6.0.1",
|
|
141
141
|
"globals": "^16.3.0",
|
|
142
142
|
"image-minimizer-webpack-plugin": "^4.1.3",
|
|
143
|
-
"jest": "^30.0.
|
|
143
|
+
"jest": "^30.0.4",
|
|
144
144
|
"jsdoc": "^4.0.4",
|
|
145
145
|
"mini-css-extract-plugin": "^2.9.2",
|
|
146
146
|
"mkdirp": "^3.0.1",
|
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
"postcss-url": "^10.1.3",
|
|
155
155
|
"shx": "^0.4.0",
|
|
156
156
|
"style-loader": "^4.0.0",
|
|
157
|
-
"stylelint": "^16.21.
|
|
157
|
+
"stylelint": "^16.21.1",
|
|
158
158
|
"stylelint-config-standard": "^38.0.0",
|
|
159
159
|
"stylelint-config-standard-scss": "^15.0.1",
|
|
160
160
|
"typescript-eslint": "^8.35.1",
|