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