weboptimizer 2.0.1107 → 2.0.1111
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.d.ts +21 -2
- package/configurator.js +344 -295
- package/ejsLoader.js +6 -5
- package/index.d.ts +10 -1
- package/index.js +646 -572
- package/package.json +23 -3
- package/stylelintConfigurator.js +2 -1
- package/type.d.ts +5 -1
- package/webpackConfigurator.js +143 -143
package/index.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
See https://creativecommons.org/licenses/by/3.0/deed.de
|
|
18
18
|
endregion
|
|
19
19
|
*/
|
|
20
|
-
// region
|
|
20
|
+
// region imports
|
|
21
21
|
|
|
22
22
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
23
23
|
|
|
@@ -46,7 +46,7 @@ var _path = _interopRequireWildcard(require("path"));
|
|
|
46
46
|
|
|
47
47
|
var _rimraf = _interopRequireWildcard(require("rimraf"));
|
|
48
48
|
|
|
49
|
-
var _configurator =
|
|
49
|
+
var _configurator = require("./configurator");
|
|
50
50
|
|
|
51
51
|
var _helper = _interopRequireDefault(require("./helper"));
|
|
52
52
|
|
|
@@ -69,647 +69,721 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
69
69
|
process.env.UV_THREADPOOL_SIZE = '128';
|
|
70
70
|
/**
|
|
71
71
|
* Main entry point.
|
|
72
|
+
* @param context - Location from where to build current application.
|
|
73
|
+
* @param currentWorkingDirectory - Current working directory to use as
|
|
74
|
+
* reference.
|
|
75
|
+
* @param commandLineArguments - Arguments to take into account.
|
|
76
|
+
* @param webOptimizerPath - Current optimizer context path.
|
|
77
|
+
* @param environment - Environment variables to take into account.
|
|
78
|
+
*
|
|
72
79
|
* @returns Nothing.
|
|
73
80
|
*/
|
|
74
81
|
|
|
75
82
|
var main = /*#__PURE__*/function () {
|
|
76
|
-
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
77
|
-
|
|
83
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(context) {
|
|
84
|
+
var currentWorkingDirectory,
|
|
85
|
+
commandLineArguments,
|
|
86
|
+
webOptimizerPath,
|
|
87
|
+
environment,
|
|
88
|
+
_args4 = arguments;
|
|
89
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
78
90
|
while (1) {
|
|
79
|
-
switch (
|
|
91
|
+
switch (_context4.prev = _context4.next) {
|
|
80
92
|
case 0:
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
93
|
+
currentWorkingDirectory = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : process.cwd();
|
|
94
|
+
commandLineArguments = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : process.argv;
|
|
95
|
+
webOptimizerPath = _args4.length > 3 && _args4[3] !== undefined ? _args4[3] : __dirname;
|
|
96
|
+
environment = _args4.length > 4 && _args4[4] !== undefined ? _args4[4] : eval('process.env');
|
|
97
|
+
return _context4.abrupt("return", (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
98
|
+
var configuration, clear;
|
|
99
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
86
100
|
while (1) {
|
|
87
|
-
switch (
|
|
101
|
+
switch (_context3.prev = _context3.next) {
|
|
88
102
|
case 0:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
case 11:
|
|
118
|
-
if (!true) {
|
|
119
|
-
_context2.next = 20;
|
|
120
|
-
break;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
filePath = (0, _path.resolve)(_configurator["default"].path.context, ".dynamicConfiguration-".concat(count, ".json"));
|
|
124
|
-
_context2.next = 15;
|
|
125
|
-
return _clientnode["default"].isFile(filePath);
|
|
126
|
-
|
|
127
|
-
case 15:
|
|
128
|
-
if (_context2.sent) {
|
|
129
|
-
_context2.next = 17;
|
|
130
|
-
break;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
return _context2.abrupt("break", 20);
|
|
134
|
-
|
|
135
|
-
case 17:
|
|
136
|
-
count += 1;
|
|
137
|
-
_context2.next = 11;
|
|
138
|
-
break;
|
|
139
|
-
|
|
140
|
-
case 20:
|
|
141
|
-
_context2.next = 22;
|
|
142
|
-
return (0, _promises.writeFile)(filePath, JSON.stringify(dynamicConfiguration));
|
|
143
|
-
|
|
144
|
-
case 22:
|
|
145
|
-
additionalArguments = process.argv.splice(3); // / region register exit handler to tidy up
|
|
146
|
-
|
|
147
|
-
closeEventHandlers.push(function (error) {
|
|
148
|
-
// NOTE: Close handler have to be synchronous.
|
|
149
|
-
if (_clientnode["default"].isFileSync(filePath)) (0, _fs.unlinkSync)(filePath);
|
|
150
|
-
if (error) throw error;
|
|
151
|
-
}); // / endregion
|
|
152
|
-
// endregion
|
|
153
|
-
// region handle clear
|
|
154
|
-
|
|
155
|
-
/*
|
|
156
|
-
NOTE: Some tasks could depend on previously created artefacts
|
|
157
|
-
packages so a preceding clear should not be performed in that
|
|
158
|
-
cases.
|
|
159
|
-
NOTE: If we have a dependency cycle we need to preserve files
|
|
160
|
-
during pre-install phase.
|
|
161
|
-
*/
|
|
162
|
-
|
|
163
|
-
if (!(!['build', 'build:types', 'preinstall', 'serve', 'test', 'test:browser', 'test:coverage', 'test:coverage:report'].includes(_configurator["default"].givenCommandLineArguments[2]) && possibleArguments.includes(_configurator["default"].givenCommandLineArguments[2]))) {
|
|
164
|
-
_context2.next = 63;
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
103
|
+
configuration = (0, _configurator.load)(context, currentWorkingDirectory, commandLineArguments, webOptimizerPath, environment);
|
|
104
|
+
clear = _clientnode["default"].noop();
|
|
105
|
+
_context3.prev = 2;
|
|
106
|
+
return _context3.delegateYield( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
107
|
+
var processOptions, childProcessOptions, childProcesses, processPromises, possibleArguments, closeEventHandlers, dynamicConfiguration, count, filePath, additionalArguments, _iterator, _step, file, _iterator2, _step2, _filePath, _iterator3, _step3, filePathPattern, buildConfigurations, tidiedUp, tidyUp, testModuleFilePaths, _iterator9, _step9, buildConfiguration, expression, _iterator10, _step10, _filePath6, handleTask, finished, closeHandler, _iterator14, _step14, closeEventName;
|
|
108
|
+
|
|
109
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
110
|
+
while (1) {
|
|
111
|
+
switch (_context2.prev = _context2.next) {
|
|
112
|
+
case 0:
|
|
113
|
+
// region controller
|
|
114
|
+
processOptions = {
|
|
115
|
+
cwd: configuration.path.context,
|
|
116
|
+
env: environment
|
|
117
|
+
};
|
|
118
|
+
childProcessOptions = _objectSpread({
|
|
119
|
+
shell: true,
|
|
120
|
+
stdio: 'inherit'
|
|
121
|
+
}, processOptions);
|
|
122
|
+
childProcesses = [];
|
|
123
|
+
processPromises = [];
|
|
124
|
+
possibleArguments = ['build', 'build:types', 'clear', 'document', 'lint', 'preinstall', 'serve', 'test', 'test:browser', 'test:coverage', 'test:coverage:report', 'check:types'];
|
|
125
|
+
closeEventHandlers = [];
|
|
126
|
+
|
|
127
|
+
if (!(configuration.givenCommandLineArguments.length > 2)) {
|
|
128
|
+
_context2.next = 74;
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
167
131
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
132
|
+
// region temporary save dynamically given configurations
|
|
133
|
+
// NOTE: We need a copy of given arguments array.
|
|
134
|
+
dynamicConfiguration = {
|
|
135
|
+
givenCommandLineArguments: configuration.givenCommandLineArguments.slice()
|
|
136
|
+
};
|
|
137
|
+
if (configuration.givenCommandLineArguments.length > 3 && _clientnode["default"].stringParseEncodedObject(configuration.givenCommandLineArguments[configuration.givenCommandLineArguments.length - 1], configuration, 'configuration')) configuration.givenCommandLineArguments.pop();
|
|
138
|
+
count = 0;
|
|
139
|
+
filePath = (0, _path.resolve)(configuration.path.context, ".dynamicConfiguration-".concat(count, ".json"));
|
|
140
|
+
|
|
141
|
+
case 11:
|
|
142
|
+
if (!true) {
|
|
143
|
+
_context2.next = 20;
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
172
146
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
var type, _file$stats;
|
|
177
|
-
|
|
178
|
-
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
179
|
-
while (1) {
|
|
180
|
-
switch (_context.prev = _context.next) {
|
|
181
|
-
case 0:
|
|
182
|
-
if (!_helper["default"].isFilePathInLocation(file.path, _configurator["default"].path.ignore.concat(_configurator["default"].module.directoryNames, _configurator["default"].loader.directoryNames).map(function (filePath) {
|
|
183
|
-
return (0, _path.resolve)(_configurator["default"].path.context, filePath);
|
|
184
|
-
}).filter(function (filePath) {
|
|
185
|
-
return !_configurator["default"].path.context.startsWith(filePath);
|
|
186
|
-
}))) {
|
|
187
|
-
_context.next = 2;
|
|
188
|
-
break;
|
|
189
|
-
}
|
|
147
|
+
filePath = (0, _path.resolve)(configuration.path.context, ".dynamicConfiguration-".concat(count, ".json"));
|
|
148
|
+
_context2.next = 15;
|
|
149
|
+
return _clientnode["default"].isFile(filePath);
|
|
190
150
|
|
|
191
|
-
|
|
151
|
+
case 15:
|
|
152
|
+
if (_context2.sent) {
|
|
153
|
+
_context2.next = 17;
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
192
156
|
|
|
193
|
-
|
|
194
|
-
|
|
157
|
+
return _context2.abrupt("break", 20);
|
|
158
|
+
|
|
159
|
+
case 17:
|
|
160
|
+
count += 1;
|
|
161
|
+
_context2.next = 11;
|
|
162
|
+
break;
|
|
163
|
+
|
|
164
|
+
case 20:
|
|
165
|
+
_context2.next = 22;
|
|
166
|
+
return (0, _promises.writeFile)(filePath, JSON.stringify(dynamicConfiguration));
|
|
167
|
+
|
|
168
|
+
case 22:
|
|
169
|
+
additionalArguments = commandLineArguments.splice(3); // / region register exit handler to tidy up
|
|
170
|
+
|
|
171
|
+
// / region register exit handler to tidy up
|
|
172
|
+
clear = function clear(error) {
|
|
173
|
+
// NOTE: Close handler have to be synchronous.
|
|
174
|
+
if (_clientnode["default"].isFileSync(filePath)) (0, _fs.unlinkSync)(filePath);
|
|
175
|
+
if (error) throw error;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
closeEventHandlers.push(clear); // / endregion
|
|
179
|
+
// endregion
|
|
180
|
+
// region handle clear
|
|
181
|
+
|
|
182
|
+
/*
|
|
183
|
+
NOTE: Some tasks could depend on previously created artefacts
|
|
184
|
+
packages so a preceding clear should not be performed in that
|
|
185
|
+
cases.
|
|
186
|
+
NOTE: If we have a dependency cycle we need to preserve files
|
|
187
|
+
during pre-install phase.
|
|
188
|
+
*/
|
|
189
|
+
|
|
190
|
+
if (!(!['build', 'build:types', 'preinstall', 'serve', 'test', 'test:browser', 'test:coverage', 'test:coverage:report'].includes(configuration.givenCommandLineArguments[2]) && possibleArguments.includes(configuration.givenCommandLineArguments[2]))) {
|
|
191
|
+
_context2.next = 64;
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
195
194
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}
|
|
195
|
+
if (!((0, _path.resolve)(configuration.path.target.base) === (0, _path.resolve)(configuration.path.context))) {
|
|
196
|
+
_context2.next = 53;
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
201
199
|
|
|
202
|
-
|
|
200
|
+
_context2.next = 29;
|
|
201
|
+
return _clientnode["default"].walkDirectoryRecursively(configuration.path.target.base, /*#__PURE__*/function () {
|
|
202
|
+
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(file) {
|
|
203
|
+
var type, _file$stats;
|
|
204
|
+
|
|
205
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
206
|
+
while (1) {
|
|
207
|
+
switch (_context.prev = _context.next) {
|
|
208
|
+
case 0:
|
|
209
|
+
if (!_helper["default"].isFilePathInLocation(file.path, configuration.path.ignore.concat(configuration.module.directoryNames, configuration.loader.directoryNames).map(function (filePath) {
|
|
210
|
+
return (0, _path.resolve)(configuration.path.context, filePath);
|
|
211
|
+
}).filter(function (filePath) {
|
|
212
|
+
return !configuration.path.context.startsWith(filePath);
|
|
213
|
+
}))) {
|
|
214
|
+
_context.next = 2;
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return _context.abrupt("return", false);
|
|
219
|
+
|
|
220
|
+
case 2:
|
|
221
|
+
_context.t0 = _regenerator["default"].keys(configuration.buildContext.types);
|
|
222
|
+
|
|
223
|
+
case 3:
|
|
224
|
+
if ((_context.t1 = _context.t0()).done) {
|
|
225
|
+
_context.next = 15;
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
type = _context.t1.value;
|
|
230
|
+
|
|
231
|
+
if (!new RegExp(configuration.buildContext.types[type].filePathPattern).test(file.path)) {
|
|
232
|
+
_context.next = 13;
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (!((_file$stats = file.stats) !== null && _file$stats !== void 0 && _file$stats.isDirectory())) {
|
|
237
|
+
_context.next = 10;
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
_context.next = 9;
|
|
242
|
+
return new Promise(function (resolve, reject) {
|
|
243
|
+
return (0, _rimraf["default"])(file.path, {
|
|
244
|
+
glob: false
|
|
245
|
+
}, function (error) {
|
|
246
|
+
return error ? reject(error) : resolve();
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
case 9:
|
|
251
|
+
return _context.abrupt("return", false);
|
|
252
|
+
|
|
253
|
+
case 10:
|
|
254
|
+
_context.next = 12;
|
|
255
|
+
return (0, _promises.unlink)(file.path);
|
|
256
|
+
|
|
257
|
+
case 12:
|
|
258
|
+
return _context.abrupt("break", 15);
|
|
259
|
+
|
|
260
|
+
case 13:
|
|
261
|
+
_context.next = 3;
|
|
262
|
+
break;
|
|
263
|
+
|
|
264
|
+
case 15:
|
|
265
|
+
case "end":
|
|
266
|
+
return _context.stop();
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}, _callee);
|
|
270
|
+
}));
|
|
271
|
+
|
|
272
|
+
return function (_x2) {
|
|
273
|
+
return _ref3.apply(this, arguments);
|
|
274
|
+
};
|
|
275
|
+
}());
|
|
276
|
+
|
|
277
|
+
case 29:
|
|
278
|
+
_context2.t0 = _createForOfIteratorHelper;
|
|
279
|
+
_context2.next = 32;
|
|
280
|
+
return _clientnode["default"].walkDirectoryRecursively(configuration.path.target.base, function () {
|
|
281
|
+
return false;
|
|
282
|
+
}, configuration.encoding);
|
|
283
|
+
|
|
284
|
+
case 32:
|
|
285
|
+
_context2.t1 = _context2.sent;
|
|
286
|
+
_iterator = (0, _context2.t0)(_context2.t1);
|
|
287
|
+
_context2.prev = 34;
|
|
288
|
+
|
|
289
|
+
_iterator.s();
|
|
290
|
+
|
|
291
|
+
case 36:
|
|
292
|
+
if ((_step = _iterator.n()).done) {
|
|
293
|
+
_context2.next = 43;
|
|
294
|
+
break;
|
|
295
|
+
}
|
|
203
296
|
|
|
204
|
-
|
|
205
|
-
_context.next = 13;
|
|
206
|
-
break;
|
|
207
|
-
}
|
|
297
|
+
file = _step.value;
|
|
208
298
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
299
|
+
if (!file.name.startsWith('npm-debug')) {
|
|
300
|
+
_context2.next = 41;
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
213
303
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
return (0, _rimraf["default"])(file.path, {
|
|
217
|
-
glob: false
|
|
218
|
-
}, function (error) {
|
|
219
|
-
return error ? reject(error) : resolve();
|
|
220
|
-
});
|
|
221
|
-
});
|
|
304
|
+
_context2.next = 41;
|
|
305
|
+
return (0, _promises.unlink)(file.path);
|
|
222
306
|
|
|
223
|
-
|
|
224
|
-
|
|
307
|
+
case 41:
|
|
308
|
+
_context2.next = 36;
|
|
309
|
+
break;
|
|
225
310
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
311
|
+
case 43:
|
|
312
|
+
_context2.next = 48;
|
|
313
|
+
break;
|
|
229
314
|
|
|
230
|
-
|
|
231
|
-
|
|
315
|
+
case 45:
|
|
316
|
+
_context2.prev = 45;
|
|
317
|
+
_context2.t2 = _context2["catch"](34);
|
|
232
318
|
|
|
233
|
-
|
|
234
|
-
_context.next = 3;
|
|
235
|
-
break;
|
|
319
|
+
_iterator.e(_context2.t2);
|
|
236
320
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
return _context.stop();
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}, _callee);
|
|
243
|
-
}));
|
|
244
|
-
|
|
245
|
-
return function (_x) {
|
|
246
|
-
return _ref2.apply(this, arguments);
|
|
247
|
-
};
|
|
248
|
-
}());
|
|
249
|
-
|
|
250
|
-
case 28:
|
|
251
|
-
_context2.t0 = _createForOfIteratorHelper;
|
|
252
|
-
_context2.next = 31;
|
|
253
|
-
return _clientnode["default"].walkDirectoryRecursively(_configurator["default"].path.target.base, function () {
|
|
254
|
-
return false;
|
|
255
|
-
}, _configurator["default"].encoding);
|
|
256
|
-
|
|
257
|
-
case 31:
|
|
258
|
-
_context2.t1 = _context2.sent;
|
|
259
|
-
_iterator = (0, _context2.t0)(_context2.t1);
|
|
260
|
-
_context2.prev = 33;
|
|
261
|
-
|
|
262
|
-
_iterator.s();
|
|
263
|
-
|
|
264
|
-
case 35:
|
|
265
|
-
if ((_step = _iterator.n()).done) {
|
|
266
|
-
_context2.next = 42;
|
|
267
|
-
break;
|
|
268
|
-
}
|
|
321
|
+
case 48:
|
|
322
|
+
_context2.prev = 48;
|
|
269
323
|
|
|
270
|
-
|
|
324
|
+
_iterator.f();
|
|
271
325
|
|
|
272
|
-
|
|
273
|
-
_context2.next = 40;
|
|
274
|
-
break;
|
|
275
|
-
}
|
|
326
|
+
return _context2.finish(48);
|
|
276
327
|
|
|
277
|
-
|
|
278
|
-
|
|
328
|
+
case 51:
|
|
329
|
+
_context2.next = 55;
|
|
330
|
+
break;
|
|
279
331
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
332
|
+
case 53:
|
|
333
|
+
_context2.next = 55;
|
|
334
|
+
return new Promise(function (resolve, reject) {
|
|
335
|
+
return (0, _rimraf["default"])(configuration.path.target.base, {
|
|
336
|
+
glob: false
|
|
337
|
+
}, function (error) {
|
|
338
|
+
return error ? reject(error) : resolve();
|
|
339
|
+
});
|
|
340
|
+
});
|
|
283
341
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
342
|
+
case 55:
|
|
343
|
+
_context2.next = 57;
|
|
344
|
+
return _clientnode["default"].isDirectory(configuration.path.apiDocumentation);
|
|
287
345
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
346
|
+
case 57:
|
|
347
|
+
if (!_context2.sent) {
|
|
348
|
+
_context2.next = 60;
|
|
349
|
+
break;
|
|
350
|
+
}
|
|
291
351
|
|
|
292
|
-
|
|
352
|
+
_context2.next = 60;
|
|
353
|
+
return new Promise(function (resolve, reject) {
|
|
354
|
+
return (0, _rimraf["default"])(configuration.path.apiDocumentation, {
|
|
355
|
+
glob: false
|
|
356
|
+
}, function (error) {
|
|
357
|
+
return error ? reject(error) : resolve();
|
|
358
|
+
});
|
|
359
|
+
});
|
|
293
360
|
|
|
294
|
-
|
|
295
|
-
|
|
361
|
+
case 60:
|
|
362
|
+
_iterator2 = _createForOfIteratorHelper(configuration.path.tidyUpOnClear);
|
|
296
363
|
|
|
297
|
-
|
|
364
|
+
try {
|
|
365
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
366
|
+
_filePath = _step2.value;
|
|
367
|
+
if (_filePath) if (_clientnode["default"].isFileSync(_filePath)) // NOTE: Close handler have to be synchronous.
|
|
368
|
+
(0, _fs.unlinkSync)(_filePath);else if (_clientnode["default"].isDirectorySync(_filePath)) (0, _rimraf.sync)(_filePath, {
|
|
369
|
+
glob: false
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
} catch (err) {
|
|
373
|
+
_iterator2.e(err);
|
|
374
|
+
} finally {
|
|
375
|
+
_iterator2.f();
|
|
376
|
+
}
|
|
298
377
|
|
|
299
|
-
|
|
378
|
+
_iterator3 = _createForOfIteratorHelper(configuration.path.tidyUpOnClearGlobs.pattern);
|
|
300
379
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
380
|
+
try {
|
|
381
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
382
|
+
filePathPattern = _step3.value;
|
|
383
|
+
if (filePathPattern) (0, _rimraf.sync)(filePathPattern, configuration.path.tidyUpOnClearGlobs.options);
|
|
384
|
+
}
|
|
385
|
+
} catch (err) {
|
|
386
|
+
_iterator3.e(err);
|
|
387
|
+
} finally {
|
|
388
|
+
_iterator3.f();
|
|
389
|
+
}
|
|
304
390
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
});
|
|
314
|
-
|
|
315
|
-
case 54:
|
|
316
|
-
_context2.next = 56;
|
|
317
|
-
return _clientnode["default"].isDirectory(_configurator["default"].path.apiDocumentation);
|
|
318
|
-
|
|
319
|
-
case 56:
|
|
320
|
-
if (!_context2.sent) {
|
|
321
|
-
_context2.next = 59;
|
|
322
|
-
break;
|
|
323
|
-
}
|
|
391
|
+
case 64:
|
|
392
|
+
// endregion
|
|
393
|
+
// region handle build
|
|
394
|
+
buildConfigurations = _helper["default"].resolveBuildConfigurationFilePaths(configuration.buildContext.types, configuration.path.source.asset.base, configuration.path.ignore.concat(configuration.module.directoryNames, configuration.loader.directoryNames).map(function (filePath) {
|
|
395
|
+
return (0, _path.resolve)(configuration.path.context, filePath);
|
|
396
|
+
}).filter(function (filePath) {
|
|
397
|
+
return !configuration.path.context.startsWith(filePath);
|
|
398
|
+
}), configuration["package"].main.fileNames);
|
|
324
399
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
return (0, _rimraf["default"])(_configurator["default"].path.apiDocumentation, {
|
|
328
|
-
glob: false
|
|
329
|
-
}, function (error) {
|
|
330
|
-
return error ? reject(error) : resolve();
|
|
331
|
-
});
|
|
332
|
-
});
|
|
333
|
-
|
|
334
|
-
case 59:
|
|
335
|
-
_iterator2 = _createForOfIteratorHelper(_configurator["default"].path.tidyUpOnClear);
|
|
336
|
-
|
|
337
|
-
try {
|
|
338
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
339
|
-
_filePath = _step2.value;
|
|
340
|
-
if (_filePath) if (_clientnode["default"].isFileSync(_filePath)) // NOTE: Close handler have to be synchronous.
|
|
341
|
-
(0, _fs.unlinkSync)(_filePath);else if (_clientnode["default"].isDirectorySync(_filePath)) (0, _rimraf.sync)(_filePath, {
|
|
342
|
-
glob: false
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
} catch (err) {
|
|
346
|
-
_iterator2.e(err);
|
|
347
|
-
} finally {
|
|
348
|
-
_iterator2.f();
|
|
349
|
-
}
|
|
400
|
+
if (['build', 'document', 'test', 'test:coverage', 'test:coverage:report'].includes(commandLineArguments[2])) {
|
|
401
|
+
tidiedUp = false;
|
|
350
402
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
403
|
+
tidyUp = function tidyUp() {
|
|
404
|
+
/*
|
|
405
|
+
Determines all none javaScript entities which have been
|
|
406
|
+
emitted as single module to remove.
|
|
407
|
+
*/
|
|
408
|
+
if (tidiedUp) return;
|
|
409
|
+
tidiedUp = true;
|
|
410
|
+
|
|
411
|
+
for (var chunkName in configuration.injection.entry.normalized) {
|
|
412
|
+
if (Object.prototype.hasOwnProperty.call(configuration.injection.entry.normalized, chunkName)) {
|
|
413
|
+
var _iterator4 = _createForOfIteratorHelper(configuration.injection.entry.normalized[chunkName]),
|
|
414
|
+
_step4;
|
|
415
|
+
|
|
416
|
+
try {
|
|
417
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
418
|
+
var moduleID = _step4.value;
|
|
419
|
+
|
|
420
|
+
var _filePath2 = _helper["default"].determineModuleFilePath(moduleID, configuration.module.aliases, configuration.module.replacements.normal, {
|
|
421
|
+
file: configuration.extensions.file.internal
|
|
422
|
+
}, configuration.path.context, configuration.path.source.asset.base, configuration.path.ignore, configuration.module.directoryNames, configuration["package"].main.fileNames, configuration["package"].main.propertyNames, configuration["package"].aliasPropertyNames, configuration.encoding);
|
|
423
|
+
|
|
424
|
+
var type = null;
|
|
425
|
+
if (_filePath2) type = _helper["default"].determineAssetType(_filePath2, configuration.buildContext.types, configuration.path);
|
|
426
|
+
|
|
427
|
+
if (typeof type === 'string' && configuration.buildContext.types[type]) {
|
|
428
|
+
var _filePath3 = _helper["default"].renderFilePathTemplate(_helper["default"].stripLoader(configuration.files.compose.javaScript), {
|
|
429
|
+
'[name]': chunkName
|
|
430
|
+
});
|
|
431
|
+
/*
|
|
432
|
+
NOTE: Close handler have to be
|
|
433
|
+
synchronous.
|
|
434
|
+
*/
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
/*
|
|
438
|
+
NOTE: Close handler have to be
|
|
439
|
+
synchronous.
|
|
440
|
+
*/
|
|
441
|
+
if (configuration.buildContext.types[type].outputExtension === 'js' && _clientnode["default"].isFileSync(_filePath3)) (0, _fs.chmodSync)(_filePath3, '755');
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
} catch (err) {
|
|
445
|
+
_iterator4.e(err);
|
|
446
|
+
} finally {
|
|
447
|
+
_iterator4.f();
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
var _iterator5 = _createForOfIteratorHelper(configuration.path.tidyUp),
|
|
453
|
+
_step5;
|
|
454
|
+
|
|
455
|
+
try {
|
|
456
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
457
|
+
var _filePath4 = _step5.value;
|
|
458
|
+
if (_filePath4) if (_clientnode["default"].isFileSync(_filePath4)) // NOTE: Close handler have to be synchronous.
|
|
459
|
+
(0, _fs.unlinkSync)(_filePath4);else if (_clientnode["default"].isDirectorySync(_filePath4)) (0, _rimraf.sync)(_filePath4, {
|
|
460
|
+
glob: false
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
} catch (err) {
|
|
464
|
+
_iterator5.e(err);
|
|
465
|
+
} finally {
|
|
466
|
+
_iterator5.f();
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
var _iterator6 = _createForOfIteratorHelper(configuration.path.tidyUpGlobs.pattern),
|
|
470
|
+
_step6;
|
|
471
|
+
|
|
472
|
+
try {
|
|
473
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
474
|
+
var _filePathPattern = _step6.value;
|
|
475
|
+
if (_filePathPattern) (0, _rimraf.sync)(_filePathPattern, configuration.path.tidyUpOnClearGlobs.options);
|
|
476
|
+
}
|
|
477
|
+
} catch (err) {
|
|
478
|
+
_iterator6.e(err);
|
|
479
|
+
} finally {
|
|
480
|
+
_iterator6.f();
|
|
481
|
+
}
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
closeEventHandlers.push(tidyUp);
|
|
485
|
+
/*
|
|
486
|
+
Triggers complete asset compiling and bundles them into the
|
|
487
|
+
final productive output.
|
|
488
|
+
*/
|
|
489
|
+
|
|
490
|
+
/*
|
|
491
|
+
Triggers complete asset compiling and bundles them into the
|
|
492
|
+
final productive output.
|
|
493
|
+
*/
|
|
494
|
+
processPromises.push(new Promise(function (resolve, reject) {
|
|
495
|
+
var commandLineArguments = (configuration.commandLine.build.arguments || []).concat(additionalArguments);
|
|
496
|
+
console.info('Running "' + ("".concat(configuration.commandLine.build.command, " ") + commandLineArguments.join(' ')).trim() + '"');
|
|
497
|
+
/*
|
|
498
|
+
NOTE: Take current weboptimizer's dependencies into
|
|
499
|
+
account.
|
|
500
|
+
*/
|
|
363
501
|
|
|
364
|
-
case 63:
|
|
365
|
-
// endregion
|
|
366
|
-
// region handle build
|
|
367
|
-
buildConfigurations = _helper["default"].resolveBuildConfigurationFilePaths(_configurator["default"].buildContext.types, _configurator["default"].path.source.asset.base, _configurator["default"].path.ignore.concat(_configurator["default"].module.directoryNames, _configurator["default"].loader.directoryNames).map(function (filePath) {
|
|
368
|
-
return (0, _path.resolve)(_configurator["default"].path.context, filePath);
|
|
369
|
-
}).filter(function (filePath) {
|
|
370
|
-
return !_configurator["default"].path.context.startsWith(filePath);
|
|
371
|
-
}), _configurator["default"]["package"].main.fileNames);
|
|
372
|
-
|
|
373
|
-
if (['build', 'document', 'test', 'test:coverage', 'test:coverage:report'].includes(process.argv[2])) {
|
|
374
|
-
tidiedUp = false;
|
|
375
|
-
|
|
376
|
-
tidyUp = function tidyUp() {
|
|
377
|
-
/*
|
|
378
|
-
Determines all none javaScript entities which have been
|
|
379
|
-
emitted as single module to remove.
|
|
380
|
-
*/
|
|
381
|
-
if (tidiedUp) return;
|
|
382
|
-
tidiedUp = true;
|
|
383
|
-
|
|
384
|
-
for (var chunkName in _configurator["default"].injection.entry.normalized) {
|
|
385
|
-
if (Object.prototype.hasOwnProperty.call(_configurator["default"].injection.entry.normalized, chunkName)) {
|
|
386
|
-
var _iterator4 = _createForOfIteratorHelper(_configurator["default"].injection.entry.normalized[chunkName]),
|
|
387
|
-
_step4;
|
|
388
|
-
|
|
389
|
-
try {
|
|
390
|
-
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
391
|
-
var moduleID = _step4.value;
|
|
392
|
-
|
|
393
|
-
var _filePath2 = _helper["default"].determineModuleFilePath(moduleID, _configurator["default"].module.aliases, _configurator["default"].module.replacements.normal, {
|
|
394
|
-
file: _configurator["default"].extensions.file.internal
|
|
395
|
-
}, _configurator["default"].path.context, _configurator["default"].path.source.asset.base, _configurator["default"].path.ignore, _configurator["default"].module.directoryNames, _configurator["default"]["package"].main.fileNames, _configurator["default"]["package"].main.propertyNames, _configurator["default"]["package"].aliasPropertyNames, _configurator["default"].encoding);
|
|
396
|
-
|
|
397
|
-
var type = null;
|
|
398
|
-
if (_filePath2) type = _helper["default"].determineAssetType(_filePath2, _configurator["default"].buildContext.types, _configurator["default"].path);
|
|
399
|
-
|
|
400
|
-
if (typeof type === 'string' && _configurator["default"].buildContext.types[type]) {
|
|
401
|
-
var _filePath3 = _helper["default"].renderFilePathTemplate(_helper["default"].stripLoader(_configurator["default"].files.compose.javaScript), {
|
|
402
|
-
'[name]': chunkName
|
|
403
|
-
});
|
|
404
502
|
/*
|
|
405
|
-
NOTE:
|
|
406
|
-
|
|
503
|
+
NOTE: Take current weboptimizer's dependencies into
|
|
504
|
+
account.
|
|
407
505
|
*/
|
|
506
|
+
childProcessOptions.env.PATH += ":".concat(webOptimizerPath, "/node_modules/.bin");
|
|
507
|
+
var childProcess = (0, _child_process.spawn)(configuration.commandLine.build.command, commandLineArguments, childProcessOptions);
|
|
508
|
+
|
|
509
|
+
var copyAdditionalFilesAndTidyUp = function copyAdditionalFilesAndTidyUp() {
|
|
510
|
+
var _iterator7 = _createForOfIteratorHelper(configuration.files.additionalPaths),
|
|
511
|
+
_step7;
|
|
512
|
+
|
|
513
|
+
try {
|
|
514
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
515
|
+
var _filePath5 = _step7.value;
|
|
516
|
+
var sourcePath = (0, _path.join)(configuration.path.source.base, _filePath5);
|
|
517
|
+
var targetPath = (0, _path.join)(configuration.path.target.base, _filePath5); // NOTE: Close handler have to be synchronous.
|
|
518
|
+
|
|
519
|
+
// NOTE: Close handler have to be synchronous.
|
|
520
|
+
if (_clientnode["default"].isDirectorySync(sourcePath)) {
|
|
521
|
+
if (_clientnode["default"].isDirectorySync(targetPath)) (0, _rimraf.sync)(targetPath, {
|
|
522
|
+
glob: false
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
_clientnode["default"].copyDirectoryRecursiveSync(sourcePath, targetPath);
|
|
526
|
+
} else if (_clientnode["default"].isFileSync(sourcePath)) _clientnode["default"].copyFileSync(sourcePath, targetPath);
|
|
527
|
+
}
|
|
528
|
+
} catch (err) {
|
|
529
|
+
_iterator7.e(err);
|
|
530
|
+
} finally {
|
|
531
|
+
_iterator7.f();
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
tidyUp();
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
var closeHandler = _clientnode["default"].getProcessCloseHandler(resolve, reject, null, commandLineArguments[2] === 'build' ? copyAdditionalFilesAndTidyUp : tidyUp);
|
|
538
|
+
|
|
539
|
+
var _iterator8 = _createForOfIteratorHelper(_clientnode.CloseEventNames),
|
|
540
|
+
_step8;
|
|
541
|
+
|
|
542
|
+
try {
|
|
543
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
544
|
+
var closeEventName = _step8.value;
|
|
545
|
+
childProcess.on(closeEventName, closeHandler);
|
|
546
|
+
}
|
|
547
|
+
} catch (err) {
|
|
548
|
+
_iterator8.e(err);
|
|
549
|
+
} finally {
|
|
550
|
+
_iterator8.f();
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
childProcesses.push(childProcess);
|
|
554
|
+
return childProcesses;
|
|
555
|
+
})); // endregion
|
|
556
|
+
// region handle pre-install
|
|
557
|
+
} else if (configuration.library && configuration.givenCommandLineArguments[2] === 'preinstall') {
|
|
558
|
+
// Perform all file specific preprocessing stuff.
|
|
559
|
+
testModuleFilePaths = [];
|
|
560
|
+
if (_clientnode["default"].isPlainObject(configuration['test:browser'].injection) && configuration['test:browser'].injection.entry) testModuleFilePaths = _helper["default"].determineModuleLocations(configuration['test:browser'].injection.entry, configuration.module.aliases, configuration.module.replacements.normal, {
|
|
561
|
+
file: configuration.extensions.file.internal
|
|
562
|
+
}, configuration.path.context, configuration.path.source.asset.base, configuration.path.ignore).filePaths;
|
|
563
|
+
_iterator9 = _createForOfIteratorHelper(buildConfigurations);
|
|
564
|
+
|
|
565
|
+
try {
|
|
566
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
567
|
+
buildConfiguration = _step9.value;
|
|
568
|
+
expression = buildConfiguration[configuration.givenCommandLineArguments[2]].trim();
|
|
569
|
+
_iterator10 = _createForOfIteratorHelper(buildConfiguration.filePaths);
|
|
570
|
+
|
|
571
|
+
try {
|
|
572
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
573
|
+
_filePath6 = _step10.value;
|
|
574
|
+
|
|
575
|
+
if (!testModuleFilePaths.includes(_filePath6)) {
|
|
576
|
+
(function () {
|
|
577
|
+
var evaluated = _clientnode["default"].stringEvaluate("`".concat(expression, "`"), {
|
|
578
|
+
global: global,
|
|
579
|
+
self: configuration,
|
|
580
|
+
buildConfiguration: buildConfiguration,
|
|
581
|
+
path: _path["default"],
|
|
582
|
+
additionalArguments: additionalArguments,
|
|
583
|
+
filePath: _filePath6
|
|
584
|
+
});
|
|
585
|
+
|
|
586
|
+
if (evaluated.error) throw new Error('Error occurred during processing given ' + "command: ".concat(evaluated.error));
|
|
587
|
+
console.info("Running \"".concat(evaluated.result, "\""));
|
|
588
|
+
processPromises.push(new Promise(function (resolve, reject) {
|
|
589
|
+
return [_clientnode["default"].handleChildProcess((0, _child_process.exec)(evaluated.result, _objectSpread({
|
|
590
|
+
encoding: configuration.encoding
|
|
591
|
+
}, processOptions), function (error) {
|
|
592
|
+
return error ? reject(error) : resolve({
|
|
593
|
+
reason: 'Finished.',
|
|
594
|
+
parameters: []
|
|
595
|
+
});
|
|
596
|
+
}))];
|
|
597
|
+
}));
|
|
598
|
+
})();
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
} catch (err) {
|
|
602
|
+
_iterator10.e(err);
|
|
603
|
+
} finally {
|
|
604
|
+
_iterator10.f();
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
} catch (err) {
|
|
608
|
+
_iterator9.e(err);
|
|
609
|
+
} finally {
|
|
610
|
+
_iterator9.f();
|
|
611
|
+
}
|
|
612
|
+
} // endregion
|
|
613
|
+
// region handle remaining tasks
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
// endregion
|
|
617
|
+
// region handle remaining tasks
|
|
618
|
+
handleTask = function handleTask(type) {
|
|
619
|
+
var tasks = Array.isArray(configuration.commandLine[type]) ? configuration.commandLine[type] : [configuration.commandLine[type]];
|
|
620
|
+
|
|
621
|
+
var _iterator11 = _createForOfIteratorHelper(tasks),
|
|
622
|
+
_step11;
|
|
623
|
+
|
|
624
|
+
try {
|
|
625
|
+
var _loop = function _loop() {
|
|
626
|
+
var task = _step11.value;
|
|
627
|
+
|
|
628
|
+
var evaluated = _clientnode["default"].stringEvaluate(Object.prototype.hasOwnProperty.call(task, 'indicator') ? task.indicator : 'true', {
|
|
629
|
+
global: global,
|
|
630
|
+
self: configuration,
|
|
631
|
+
path: _path["default"]
|
|
632
|
+
});
|
|
633
|
+
|
|
634
|
+
if (evaluated.error) throw new Error('Error occurred during processing given task: ' + evaluated.error);
|
|
635
|
+
if (evaluated.result) processPromises.push(new Promise(function (resolve, reject) {
|
|
636
|
+
var commandLineArguments = (task.arguments || []).concat(additionalArguments);
|
|
637
|
+
console.info('Running "' + ("".concat(task.command, " ") + commandLineArguments.join(' ')).trim() + '"');
|
|
638
|
+
var childProcess = (0, _child_process.spawn)(task.command, commandLineArguments, childProcessOptions);
|
|
639
|
+
|
|
640
|
+
var closeHandler = _clientnode["default"].getProcessCloseHandler(resolve, reject);
|
|
641
|
+
|
|
642
|
+
var _iterator12 = _createForOfIteratorHelper(_clientnode.CloseEventNames),
|
|
643
|
+
_step12;
|
|
644
|
+
|
|
645
|
+
try {
|
|
646
|
+
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
|
647
|
+
var closeEventName = _step12.value;
|
|
648
|
+
childProcess.on(closeEventName, closeHandler);
|
|
649
|
+
}
|
|
650
|
+
} catch (err) {
|
|
651
|
+
_iterator12.e(err);
|
|
652
|
+
} finally {
|
|
653
|
+
_iterator12.f();
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
childProcesses.push(childProcess);
|
|
657
|
+
return childProcesses;
|
|
658
|
+
}));
|
|
659
|
+
};
|
|
660
|
+
|
|
661
|
+
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
662
|
+
_loop();
|
|
663
|
+
}
|
|
664
|
+
} catch (err) {
|
|
665
|
+
_iterator11.e(err);
|
|
666
|
+
} finally {
|
|
667
|
+
_iterator11.f();
|
|
668
|
+
}
|
|
669
|
+
}; // / region a-/synchronous
|
|
408
670
|
|
|
409
671
|
|
|
410
|
-
|
|
411
|
-
|
|
672
|
+
if (!['document', 'test', 'test:coverage', 'test:coverage:report'].includes(configuration.givenCommandLineArguments[2])) {
|
|
673
|
+
_context2.next = 73;
|
|
674
|
+
break;
|
|
412
675
|
}
|
|
413
|
-
} catch (err) {
|
|
414
|
-
_iterator4.e(err);
|
|
415
|
-
} finally {
|
|
416
|
-
_iterator4.f();
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
676
|
|
|
421
|
-
|
|
422
|
-
|
|
677
|
+
_context2.next = 70;
|
|
678
|
+
return Promise.all(processPromises);
|
|
679
|
+
|
|
680
|
+
case 70:
|
|
681
|
+
handleTask(configuration.givenCommandLineArguments[2]);
|
|
682
|
+
_context2.next = 74;
|
|
683
|
+
break;
|
|
684
|
+
|
|
685
|
+
case 73:
|
|
686
|
+
if (['build:types', 'check:types', 'lint', 'serve', 'test:browser'].includes(configuration.givenCommandLineArguments[2])) handleTask(configuration.givenCommandLineArguments[2]);
|
|
687
|
+
|
|
688
|
+
case 74:
|
|
689
|
+
finished = false;
|
|
690
|
+
|
|
691
|
+
closeHandler = function closeHandler() {
|
|
692
|
+
if (!finished) {
|
|
693
|
+
var _iterator13 = _createForOfIteratorHelper(closeEventHandlers),
|
|
694
|
+
_step13;
|
|
695
|
+
|
|
696
|
+
try {
|
|
697
|
+
for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
|
|
698
|
+
var closeEventHandler = _step13.value;
|
|
699
|
+
closeEventHandler.apply(void 0, arguments);
|
|
700
|
+
}
|
|
701
|
+
} catch (err) {
|
|
702
|
+
_iterator13.e(err);
|
|
703
|
+
} finally {
|
|
704
|
+
_iterator13.f();
|
|
705
|
+
}
|
|
706
|
+
}
|
|
423
707
|
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
var _filePath4 = _step5.value;
|
|
427
|
-
if (_filePath4) if (_clientnode["default"].isFileSync(_filePath4)) // NOTE: Close handler have to be synchronous.
|
|
428
|
-
(0, _fs.unlinkSync)(_filePath4);else if (_clientnode["default"].isDirectorySync(_filePath4)) (0, _rimraf.sync)(_filePath4, {
|
|
429
|
-
glob: false
|
|
430
|
-
});
|
|
431
|
-
}
|
|
432
|
-
} catch (err) {
|
|
433
|
-
_iterator5.e(err);
|
|
434
|
-
} finally {
|
|
435
|
-
_iterator5.f();
|
|
436
|
-
}
|
|
437
|
-
};
|
|
438
|
-
|
|
439
|
-
closeEventHandlers.push(tidyUp);
|
|
440
|
-
/*
|
|
441
|
-
Triggers complete asset compiling and bundles them into the
|
|
442
|
-
final productive output.
|
|
443
|
-
*/
|
|
444
|
-
|
|
445
|
-
processPromises.push(new Promise(function (resolve, reject) {
|
|
446
|
-
var commandLineArguments = (_configurator["default"].commandLine.build.arguments || []).concat(additionalArguments);
|
|
447
|
-
console.info('Running "' + ("".concat(_configurator["default"].commandLine.build.command, " ") + commandLineArguments.join(' ')).trim() + '"');
|
|
448
|
-
var childProcess = (0, _child_process.spawn)(_configurator["default"].commandLine.build.command, commandLineArguments, childProcessOptions);
|
|
449
|
-
|
|
450
|
-
var copyAdditionalFilesAndTidyUp = function copyAdditionalFilesAndTidyUp() {
|
|
451
|
-
var _iterator6 = _createForOfIteratorHelper(_configurator["default"].files.additionalPaths),
|
|
452
|
-
_step6;
|
|
453
|
-
|
|
454
|
-
try {
|
|
455
|
-
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
456
|
-
var _filePath5 = _step6.value;
|
|
457
|
-
var sourcePath = (0, _path.join)(_configurator["default"].path.source.base, _filePath5);
|
|
458
|
-
var targetPath = (0, _path.join)(_configurator["default"].path.target.base, _filePath5); // NOTE: Close handler have to be synchronous.
|
|
459
|
-
|
|
460
|
-
if (_clientnode["default"].isDirectorySync(sourcePath)) {
|
|
461
|
-
if (_clientnode["default"].isDirectorySync(targetPath)) (0, _rimraf.sync)(targetPath, {
|
|
462
|
-
glob: false
|
|
463
|
-
});
|
|
708
|
+
finished = true;
|
|
709
|
+
};
|
|
464
710
|
|
|
465
|
-
|
|
466
|
-
} else if (_clientnode["default"].isFileSync(sourcePath)) _clientnode["default"].copyFileSync(sourcePath, targetPath);
|
|
467
|
-
}
|
|
468
|
-
} catch (err) {
|
|
469
|
-
_iterator6.e(err);
|
|
470
|
-
} finally {
|
|
471
|
-
_iterator6.f();
|
|
472
|
-
}
|
|
711
|
+
_iterator14 = _createForOfIteratorHelper(_clientnode.CloseEventNames);
|
|
473
712
|
|
|
474
|
-
|
|
475
|
-
|
|
713
|
+
try {
|
|
714
|
+
for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
|
|
715
|
+
closeEventName = _step14.value;
|
|
716
|
+
process.on(closeEventName, closeHandler);
|
|
717
|
+
}
|
|
718
|
+
} catch (err) {
|
|
719
|
+
_iterator14.e(err);
|
|
720
|
+
} finally {
|
|
721
|
+
_iterator14.f();
|
|
722
|
+
}
|
|
476
723
|
|
|
477
|
-
|
|
724
|
+
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'); // endregion
|
|
725
|
+
// region forward nested return codes
|
|
478
726
|
|
|
479
|
-
|
|
480
|
-
|
|
727
|
+
_context2.prev = 79;
|
|
728
|
+
_context2.next = 82;
|
|
729
|
+
return Promise.all(processPromises);
|
|
481
730
|
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
childProcess.on(closeEventName, closeHandler);
|
|
486
|
-
}
|
|
487
|
-
} catch (err) {
|
|
488
|
-
_iterator7.e(err);
|
|
489
|
-
} finally {
|
|
490
|
-
_iterator7.f();
|
|
491
|
-
}
|
|
731
|
+
case 82:
|
|
732
|
+
_context2.next = 88;
|
|
733
|
+
break;
|
|
492
734
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
// Perform all file specific preprocessing stuff.
|
|
499
|
-
testModuleFilePaths = [];
|
|
500
|
-
if (_clientnode["default"].isPlainObject(_configurator["default"]['test:browser'].injection) && _configurator["default"]['test:browser'].injection.entry) testModuleFilePaths = _helper["default"].determineModuleLocations(_configurator["default"]['test:browser'].injection.entry, _configurator["default"].module.aliases, _configurator["default"].module.replacements.normal, {
|
|
501
|
-
file: _configurator["default"].extensions.file.internal
|
|
502
|
-
}, _configurator["default"].path.context, _configurator["default"].path.source.asset.base, _configurator["default"].path.ignore).filePaths;
|
|
503
|
-
_iterator8 = _createForOfIteratorHelper(buildConfigurations);
|
|
504
|
-
|
|
505
|
-
try {
|
|
506
|
-
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
507
|
-
buildConfiguration = _step8.value;
|
|
508
|
-
expression = buildConfiguration[_configurator["default"].givenCommandLineArguments[2]].trim();
|
|
509
|
-
_iterator9 = _createForOfIteratorHelper(buildConfiguration.filePaths);
|
|
510
|
-
|
|
511
|
-
try {
|
|
512
|
-
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
513
|
-
_filePath6 = _step9.value;
|
|
514
|
-
|
|
515
|
-
if (!testModuleFilePaths.includes(_filePath6)) {
|
|
516
|
-
(function () {
|
|
517
|
-
var evaluated = _clientnode["default"].stringEvaluate("`".concat(expression, "`"), {
|
|
518
|
-
global: global,
|
|
519
|
-
self: _configurator["default"],
|
|
520
|
-
buildConfiguration: buildConfiguration,
|
|
521
|
-
path: _path["default"],
|
|
522
|
-
additionalArguments: additionalArguments,
|
|
523
|
-
filePath: _filePath6
|
|
524
|
-
});
|
|
735
|
+
case 84:
|
|
736
|
+
_context2.prev = 84;
|
|
737
|
+
_context2.t3 = _context2["catch"](79);
|
|
738
|
+
console.error(_context2.t3);
|
|
739
|
+
process.exit(_context2.t3.returnCode);
|
|
525
740
|
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
return [_clientnode["default"].handleChildProcess((0, _child_process.exec)(evaluated.result, _objectSpread({
|
|
530
|
-
encoding: _configurator["default"].encoding
|
|
531
|
-
}, processOptions), function (error) {
|
|
532
|
-
return error ? reject(error) : resolve({
|
|
533
|
-
reason: 'Finished.',
|
|
534
|
-
parameters: []
|
|
535
|
-
});
|
|
536
|
-
}))];
|
|
537
|
-
}));
|
|
538
|
-
})();
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
} catch (err) {
|
|
542
|
-
_iterator9.e(err);
|
|
543
|
-
} finally {
|
|
544
|
-
_iterator9.f();
|
|
741
|
+
case 88:
|
|
742
|
+
case "end":
|
|
743
|
+
return _context2.stop();
|
|
545
744
|
}
|
|
546
745
|
}
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
} finally {
|
|
550
|
-
_iterator8.f();
|
|
551
|
-
}
|
|
552
|
-
} // endregion
|
|
553
|
-
// region handle remaining tasks
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
handleTask = function handleTask(type) {
|
|
557
|
-
var tasks = Array.isArray(_configurator["default"].commandLine[type]) ? _configurator["default"].commandLine[type] : [_configurator["default"].commandLine[type]];
|
|
558
|
-
|
|
559
|
-
var _iterator10 = _createForOfIteratorHelper(tasks),
|
|
560
|
-
_step10;
|
|
561
|
-
|
|
562
|
-
try {
|
|
563
|
-
var _loop = function _loop() {
|
|
564
|
-
var task = _step10.value;
|
|
565
|
-
|
|
566
|
-
var evaluated = _clientnode["default"].stringEvaluate(Object.prototype.hasOwnProperty.call(task, 'indicator') ? task.indicator : 'true', {
|
|
567
|
-
global: global,
|
|
568
|
-
self: _configurator["default"],
|
|
569
|
-
path: _path["default"]
|
|
570
|
-
});
|
|
571
|
-
|
|
572
|
-
if (evaluated.error) throw new Error('Error occurred during processing given task: ' + evaluated.error);
|
|
573
|
-
if (evaluated.result) processPromises.push(new Promise(function (resolve, reject) {
|
|
574
|
-
var commandLineArguments = (task.arguments || []).concat(additionalArguments);
|
|
575
|
-
console.info('Running "' + ("".concat(task.command, " ") + commandLineArguments.join(' ')).trim() + '"');
|
|
576
|
-
var childProcess = (0, _child_process.spawn)(task.command, commandLineArguments, childProcessOptions);
|
|
577
|
-
|
|
578
|
-
var closeHandler = _clientnode["default"].getProcessCloseHandler(resolve, reject);
|
|
579
|
-
|
|
580
|
-
var _iterator11 = _createForOfIteratorHelper(_clientnode.CloseEventNames),
|
|
581
|
-
_step11;
|
|
582
|
-
|
|
583
|
-
try {
|
|
584
|
-
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
585
|
-
var closeEventName = _step11.value;
|
|
586
|
-
childProcess.on(closeEventName, closeHandler);
|
|
587
|
-
}
|
|
588
|
-
} catch (err) {
|
|
589
|
-
_iterator11.e(err);
|
|
590
|
-
} finally {
|
|
591
|
-
_iterator11.f();
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
childProcesses.push(childProcess);
|
|
595
|
-
return childProcesses;
|
|
596
|
-
}));
|
|
597
|
-
};
|
|
598
|
-
|
|
599
|
-
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
600
|
-
_loop();
|
|
601
|
-
}
|
|
602
|
-
} catch (err) {
|
|
603
|
-
_iterator10.e(err);
|
|
604
|
-
} finally {
|
|
605
|
-
_iterator10.f();
|
|
606
|
-
}
|
|
607
|
-
}; // / region a-/synchronous
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
if (!['document', 'test', 'test:coverage', 'test:coverage:report'].includes(_configurator["default"].givenCommandLineArguments[2])) {
|
|
611
|
-
_context2.next = 72;
|
|
612
|
-
break;
|
|
613
|
-
}
|
|
746
|
+
}, _callee2, null, [[34, 45, 48, 51], [79, 84]]);
|
|
747
|
+
})(), "t0", 4);
|
|
614
748
|
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
case 69:
|
|
619
|
-
handleTask(_configurator["default"].givenCommandLineArguments[2]);
|
|
620
|
-
_context2.next = 73;
|
|
749
|
+
case 4:
|
|
750
|
+
_context3.next = 13;
|
|
621
751
|
break;
|
|
622
752
|
|
|
623
|
-
case
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
case 73:
|
|
627
|
-
finished = false;
|
|
753
|
+
case 6:
|
|
754
|
+
_context3.prev = 6;
|
|
755
|
+
_context3.t1 = _context3["catch"](2);
|
|
628
756
|
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
_step12;
|
|
633
|
-
|
|
634
|
-
try {
|
|
635
|
-
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
|
636
|
-
var closeEventHandler = _step12.value;
|
|
637
|
-
closeEventHandler.apply(void 0, arguments);
|
|
638
|
-
}
|
|
639
|
-
} catch (err) {
|
|
640
|
-
_iterator12.e(err);
|
|
641
|
-
} finally {
|
|
642
|
-
_iterator12.f();
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
finished = true;
|
|
647
|
-
};
|
|
648
|
-
|
|
649
|
-
_iterator13 = _createForOfIteratorHelper(_clientnode.CloseEventNames);
|
|
650
|
-
|
|
651
|
-
try {
|
|
652
|
-
for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
|
|
653
|
-
closeEventName = _step13.value;
|
|
654
|
-
process.on(closeEventName, closeHandler);
|
|
655
|
-
}
|
|
656
|
-
} catch (err) {
|
|
657
|
-
_iterator13.e(err);
|
|
658
|
-
} finally {
|
|
659
|
-
_iterator13.f();
|
|
757
|
+
if (!configuration.debug) {
|
|
758
|
+
_context3.next = 12;
|
|
759
|
+
break;
|
|
660
760
|
}
|
|
661
761
|
|
|
662
|
-
|
|
663
|
-
// region forward nested return codes
|
|
762
|
+
throw _context3.t1;
|
|
664
763
|
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
return Promise.all(processPromises);
|
|
764
|
+
case 12:
|
|
765
|
+
console.error(_context3.t1);
|
|
668
766
|
|
|
669
|
-
case
|
|
670
|
-
|
|
671
|
-
break;
|
|
767
|
+
case 13:
|
|
768
|
+
return _context3.abrupt("return", clear);
|
|
672
769
|
|
|
673
|
-
case
|
|
674
|
-
_context2.prev = 83;
|
|
675
|
-
_context2.t3 = _context2["catch"](78);
|
|
676
|
-
process.exit(_context2.t3.returnCode);
|
|
677
|
-
|
|
678
|
-
case 86:
|
|
770
|
+
case 14:
|
|
679
771
|
case "end":
|
|
680
|
-
return
|
|
772
|
+
return _context3.stop();
|
|
681
773
|
}
|
|
682
774
|
}
|
|
683
|
-
},
|
|
684
|
-
})()
|
|
685
|
-
|
|
686
|
-
case 2:
|
|
687
|
-
_context3.next = 11;
|
|
688
|
-
break;
|
|
689
|
-
|
|
690
|
-
case 4:
|
|
691
|
-
_context3.prev = 4;
|
|
692
|
-
_context3.t1 = _context3["catch"](0);
|
|
693
|
-
|
|
694
|
-
if (!_configurator["default"].debug) {
|
|
695
|
-
_context3.next = 10;
|
|
696
|
-
break;
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
throw _context3.t1;
|
|
700
|
-
|
|
701
|
-
case 10:
|
|
702
|
-
console.error(_context3.t1);
|
|
775
|
+
}, _callee3, null, [[2, 6]]);
|
|
776
|
+
}))());
|
|
703
777
|
|
|
704
|
-
case
|
|
778
|
+
case 5:
|
|
705
779
|
case "end":
|
|
706
|
-
return
|
|
780
|
+
return _context4.stop();
|
|
707
781
|
}
|
|
708
782
|
}
|
|
709
|
-
},
|
|
783
|
+
}, _callee4);
|
|
710
784
|
}));
|
|
711
785
|
|
|
712
|
-
return function main() {
|
|
786
|
+
return function main(_x) {
|
|
713
787
|
return _ref.apply(this, arguments);
|
|
714
788
|
};
|
|
715
789
|
}();
|