@angular-devkit/build-angular 0.803.0-rc.0 → 0.803.3
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/package.json +10 -7
- package/src/angular-cli-files/models/es5-polyfills.js +3 -4
- package/src/angular-cli-files/models/webpack-configs/common.js +4 -1
- package/src/browser/index.js +129 -19
- package/src/protractor/schema.d.ts +0 -1
- package/src/protractor/schema.json +1 -2
- package/src/utils/mangle-options.d.ts +1 -0
- package/src/utils/mangle-options.js +11 -0
- package/src/utils/process-bundle.d.ts +14 -5
- package/src/utils/process-bundle.js +28 -7
package/package.json
CHANGED
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/build-angular",
|
|
3
|
-
"version": "0.803.
|
|
3
|
+
"version": "0.803.3",
|
|
4
4
|
"description": "Angular Webpack Build Facade",
|
|
5
5
|
"experimental": true,
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"typings": "src/index.d.ts",
|
|
8
8
|
"builders": "builders.json",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@angular-devkit/architect": "0.803.
|
|
11
|
-
"@angular-devkit/build-optimizer": "0.803.
|
|
12
|
-
"@angular-devkit/build-webpack": "0.803.
|
|
13
|
-
"@angular-devkit/core": "8.3.
|
|
10
|
+
"@angular-devkit/architect": "0.803.3",
|
|
11
|
+
"@angular-devkit/build-optimizer": "0.803.3",
|
|
12
|
+
"@angular-devkit/build-webpack": "0.803.3",
|
|
13
|
+
"@angular-devkit/core": "8.3.3",
|
|
14
14
|
"@babel/core": "7.5.5",
|
|
15
15
|
"@babel/preset-env": "7.5.5",
|
|
16
|
-
"@ngtools/webpack": "8.3.
|
|
16
|
+
"@ngtools/webpack": "8.3.3",
|
|
17
17
|
"ajv": "6.10.2",
|
|
18
18
|
"autoprefixer": "9.6.1",
|
|
19
19
|
"browserslist": "4.6.6",
|
|
20
|
+
"cacache": "12.0.2",
|
|
20
21
|
"caniuse-lite": "1.0.30000989",
|
|
21
22
|
"circular-dependency-plugin": "5.2.0",
|
|
22
23
|
"clean-css": "4.2.1",
|
|
23
24
|
"copy-webpack-plugin": "5.0.4",
|
|
24
25
|
"core-js": "3.2.1",
|
|
25
26
|
"file-loader": "4.2.0",
|
|
27
|
+
"find-cache-dir": "3.0.0",
|
|
26
28
|
"glob": "7.1.4",
|
|
27
29
|
"istanbul-instrumenter-loader": "3.0.1",
|
|
28
30
|
"karma-source-map-support": "1.4.0",
|
|
@@ -38,6 +40,7 @@
|
|
|
38
40
|
"postcss-import": "12.0.1",
|
|
39
41
|
"postcss-loader": "3.0.0",
|
|
40
42
|
"raw-loader": "3.1.0",
|
|
43
|
+
"regenerator-runtime": "0.13.3",
|
|
41
44
|
"rxjs": "6.4.0",
|
|
42
45
|
"sass": "1.22.9",
|
|
43
46
|
"sass-loader": "7.2.0",
|
|
@@ -59,7 +62,7 @@
|
|
|
59
62
|
"webpack-sources": "1.4.3",
|
|
60
63
|
"webpack-subresource-integrity": "1.1.0-rc.6",
|
|
61
64
|
"worker-farm": "1.7.0",
|
|
62
|
-
"worker-plugin": "3.
|
|
65
|
+
"worker-plugin": "3.2.0"
|
|
63
66
|
},
|
|
64
67
|
"peerDependencies": {
|
|
65
68
|
"@angular/compiler-cli": "^8.0.0-beta.0 || ^8.1.0-beta.0 || ^8.2.0-beta.0 || ^8.3.0-beta.0 || ^8.4.0-beta.0 || >=9.0.0-beta < 9",
|
|
@@ -7,10 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
// ES2015 symbol capabilities
|
|
10
|
-
import 'core-js/
|
|
11
|
-
import 'core-js/modules/es.symbol.description';
|
|
12
|
-
import 'core-js/modules/es.symbol.iterator';
|
|
13
|
-
import 'core-js/modules/es.symbol.to-string-tag';
|
|
10
|
+
import 'core-js/es/symbol';
|
|
14
11
|
|
|
15
12
|
// ES2015 function capabilities
|
|
16
13
|
import 'core-js/modules/es.function.bind';
|
|
@@ -103,3 +100,5 @@ import 'core-js/modules/web.dom-collections.for-each';
|
|
|
103
100
|
import 'core-js/modules/web.dom-collections.iterator';
|
|
104
101
|
import 'core-js/modules/es.promise';
|
|
105
102
|
import 'core-js/modules/es.json.to-string-tag';
|
|
103
|
+
|
|
104
|
+
import 'regenerator-runtime/runtime';
|
|
@@ -15,6 +15,7 @@ const typescript_1 = require("typescript");
|
|
|
15
15
|
const webpack_1 = require("webpack");
|
|
16
16
|
const webpack_sources_1 = require("webpack-sources");
|
|
17
17
|
const utils_1 = require("../../../utils");
|
|
18
|
+
const mangle_options_1 = require("../../../utils/mangle-options");
|
|
18
19
|
const bundle_budget_1 = require("../../plugins/bundle-budget");
|
|
19
20
|
const cleancss_webpack_plugin_1 = require("../../plugins/cleancss-webpack-plugin");
|
|
20
21
|
const named_chunks_plugin_1 = require("../../plugins/named-chunks-plugin");
|
|
@@ -271,6 +272,7 @@ function getCommonConfig(wco) {
|
|
|
271
272
|
compress: buildOptions.platform == 'server'
|
|
272
273
|
? {
|
|
273
274
|
global_defs: angularGlobalDefinitions,
|
|
275
|
+
keep_fnames: true,
|
|
274
276
|
}
|
|
275
277
|
: {
|
|
276
278
|
pure_getters: buildOptions.buildOptimizer,
|
|
@@ -281,7 +283,8 @@ function getCommonConfig(wco) {
|
|
|
281
283
|
},
|
|
282
284
|
// We also want to avoid mangling on server.
|
|
283
285
|
// Name mangling is handled within the browser builder
|
|
284
|
-
mangle:
|
|
286
|
+
mangle: !mangle_options_1.manglingDisabled &&
|
|
287
|
+
buildOptions.platform !== 'server' &&
|
|
285
288
|
(!differentialLoadingNeeded || (differentialLoadingNeeded && utils_1.fullDifferential)),
|
|
286
289
|
};
|
|
287
290
|
extraMinimizers.push(new TerserPlugin({
|
package/src/browser/index.js
CHANGED
|
@@ -11,6 +11,8 @@ const architect_1 = require("@angular-devkit/architect");
|
|
|
11
11
|
const build_webpack_1 = require("@angular-devkit/build-webpack");
|
|
12
12
|
const core_1 = require("@angular-devkit/core");
|
|
13
13
|
const node_1 = require("@angular-devkit/core/node");
|
|
14
|
+
const crypto_1 = require("crypto");
|
|
15
|
+
const findCacheDirectory = require("find-cache-dir");
|
|
14
16
|
const fs = require("fs");
|
|
15
17
|
const path = require("path");
|
|
16
18
|
const rxjs_1 = require("rxjs");
|
|
@@ -26,6 +28,9 @@ const stats_1 = require("../angular-cli-files/utilities/stats");
|
|
|
26
28
|
const utils_1 = require("../utils");
|
|
27
29
|
const version_1 = require("../utils/version");
|
|
28
30
|
const webpack_browser_config_1 = require("../utils/webpack-browser-config");
|
|
31
|
+
const cacache = require('cacache');
|
|
32
|
+
const cacheDownlevelPath = findCacheDirectory({ name: 'angular-build-dl' });
|
|
33
|
+
const packageVersion = require('../../package.json').version;
|
|
29
34
|
function createBrowserLoggingCallback(verbose, logger) {
|
|
30
35
|
return (stats, config) => {
|
|
31
36
|
// config.stats contains our own stats settings, added during buildWebpackConfig().
|
|
@@ -132,7 +137,9 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
132
137
|
else {
|
|
133
138
|
return rxjs_1.of();
|
|
134
139
|
}
|
|
135
|
-
}, { success: true }, 1), operators_1.bufferCount(configs.length),
|
|
140
|
+
}, { success: true }, 1), operators_1.bufferCount(configs.length),
|
|
141
|
+
// tslint:disable-next-line: no-big-function
|
|
142
|
+
operators_1.switchMap(async (buildEvents) => {
|
|
136
143
|
configs.length = 0;
|
|
137
144
|
const success = buildEvents.every(r => r.success);
|
|
138
145
|
if (success) {
|
|
@@ -158,10 +165,15 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
158
165
|
optimize: utils_1.normalizeOptimization(options.optimization).scripts,
|
|
159
166
|
sourceMaps: sourceMapOptions.scripts,
|
|
160
167
|
hiddenSourceMaps: sourceMapOptions.hidden,
|
|
168
|
+
vendorSourceMaps: sourceMapOptions.vendor,
|
|
161
169
|
};
|
|
162
170
|
const actions = [];
|
|
163
171
|
const seen = new Set();
|
|
164
172
|
for (const file of emittedFiles) {
|
|
173
|
+
// Assets are not processed nor injected into the index
|
|
174
|
+
if (file.asset) {
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
165
177
|
// Scripts and non-javascript files are not processed
|
|
166
178
|
if (file.extension !== '.js' ||
|
|
167
179
|
(file.name && scriptsEntryPointName.includes(file.name))) {
|
|
@@ -223,6 +235,7 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
223
235
|
code,
|
|
224
236
|
map,
|
|
225
237
|
runtime: file.file.startsWith('runtime'),
|
|
238
|
+
ignoreOriginal: es5Polyfills,
|
|
226
239
|
});
|
|
227
240
|
// Add the newly created ES5 bundles to the index as nomodule scripts
|
|
228
241
|
const newFilename = es5Polyfills
|
|
@@ -232,26 +245,123 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
232
245
|
}
|
|
233
246
|
// Execute the bundle processing actions
|
|
234
247
|
context.logger.info('Generating ES5 bundles for differential loading...');
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
248
|
+
const processActions = [];
|
|
249
|
+
const cacheActions = [];
|
|
250
|
+
for (const action of actions) {
|
|
251
|
+
// Create base cache key with elements:
|
|
252
|
+
// * package version - different build-angular versions cause different final outputs
|
|
253
|
+
// * code length/hash - ensure cached version matches the same input code
|
|
254
|
+
const codeHash = crypto_1.createHash('sha1')
|
|
255
|
+
.update(action.code)
|
|
256
|
+
.digest('hex');
|
|
257
|
+
const baseCacheKey = `${packageVersion}|${action.code.length}|${codeHash}`;
|
|
258
|
+
// Postfix added to sourcemap cache keys when vendor sourcemaps are present
|
|
259
|
+
// Allows non-destructive caching of both variants
|
|
260
|
+
const SourceMapVendorPostfix = !!action.sourceMaps && action.vendorSourceMaps ? '|vendor' : '';
|
|
261
|
+
// Determine cache entries required based on build settings
|
|
262
|
+
const cacheKeys = [];
|
|
263
|
+
// If optimizing and the original is not ignored, add original as required
|
|
264
|
+
if ((action.optimize || action.optimizeOnly) && !action.ignoreOriginal) {
|
|
265
|
+
cacheKeys[0 /* OriginalCode */] = baseCacheKey + '|orig';
|
|
266
|
+
// If sourcemaps are enabled, add original sourcemap as required
|
|
267
|
+
if (action.sourceMaps) {
|
|
268
|
+
cacheKeys[1 /* OriginalMap */] =
|
|
269
|
+
baseCacheKey + SourceMapVendorPostfix + '|orig-map';
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
// If not only optimizing, add downlevel as required
|
|
273
|
+
if (!action.optimizeOnly) {
|
|
274
|
+
cacheKeys[2 /* DownlevelCode */] = baseCacheKey + '|dl';
|
|
275
|
+
// If sourcemaps are enabled, add downlevel sourcemap as required
|
|
276
|
+
if (action.sourceMaps) {
|
|
277
|
+
cacheKeys[3 /* DownlevelMap */] =
|
|
278
|
+
baseCacheKey + SourceMapVendorPostfix + '|dl-map';
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
// Attempt to get required cache entries
|
|
282
|
+
const cacheEntries = [];
|
|
283
|
+
for (const key of cacheKeys) {
|
|
284
|
+
if (key) {
|
|
285
|
+
cacheEntries.push(await cacache.get.info(cacheDownlevelPath, key));
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
cacheEntries.push(null);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
// Check if required cache entries are present
|
|
292
|
+
let cached = cacheKeys.length > 0;
|
|
293
|
+
for (let i = 0; i < cacheKeys.length; ++i) {
|
|
294
|
+
if (cacheKeys[i] && !cacheEntries[i]) {
|
|
295
|
+
cached = false;
|
|
296
|
+
break;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
// If all required cached entries are present, use the cached entries
|
|
300
|
+
// Otherwise process the files
|
|
301
|
+
if (cached) {
|
|
302
|
+
if (cacheEntries[0 /* OriginalCode */]) {
|
|
303
|
+
cacheActions.push({
|
|
304
|
+
src: cacheEntries[0 /* OriginalCode */].path,
|
|
305
|
+
dest: action.filename,
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
if (cacheEntries[1 /* OriginalMap */]) {
|
|
309
|
+
cacheActions.push({
|
|
310
|
+
src: cacheEntries[1 /* OriginalMap */].path,
|
|
311
|
+
dest: action.filename + '.map',
|
|
312
|
+
});
|
|
247
313
|
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
314
|
+
if (cacheEntries[2 /* DownlevelCode */]) {
|
|
315
|
+
cacheActions.push({
|
|
316
|
+
src: cacheEntries[2 /* DownlevelCode */].path,
|
|
317
|
+
dest: action.filename.replace('es2015', 'es5'),
|
|
318
|
+
});
|
|
251
319
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
320
|
+
if (cacheEntries[3 /* DownlevelMap */]) {
|
|
321
|
+
cacheActions.push({
|
|
322
|
+
src: cacheEntries[3 /* DownlevelMap */].path,
|
|
323
|
+
dest: action.filename.replace('es2015', 'es5') + '.map',
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
processActions.push({
|
|
329
|
+
...action,
|
|
330
|
+
cacheKeys,
|
|
331
|
+
cachePath: cacheDownlevelPath || undefined,
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
for (const action of cacheActions) {
|
|
336
|
+
fs.copyFileSync(action.src, action.dest, fs.constants.COPYFILE_FICLONE);
|
|
337
|
+
if (process.platform !== 'win32') {
|
|
338
|
+
// The cache writes entries as readonly and when using copyFile the permissions will also be copied.
|
|
339
|
+
// See: https://github.com/npm/cacache/blob/073fbe1a9f789ba42d9a41de7b8429c93cf61579/lib/util/move-file.js#L36
|
|
340
|
+
fs.chmodSync(action.dest, 0o644);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
if (processActions.length > 0) {
|
|
344
|
+
await new Promise((resolve, reject) => {
|
|
345
|
+
const workerFile = require.resolve('../utils/process-bundle');
|
|
346
|
+
const workers = workerFarm({
|
|
347
|
+
maxRetries: 1,
|
|
348
|
+
}, path.extname(workerFile) !== '.ts'
|
|
349
|
+
? workerFile
|
|
350
|
+
: require.resolve('../utils/process-bundle-bootstrap'), ['process']);
|
|
351
|
+
let completed = 0;
|
|
352
|
+
const workCallback = (error) => {
|
|
353
|
+
if (error) {
|
|
354
|
+
workerFarm.end(workers);
|
|
355
|
+
reject(error);
|
|
356
|
+
}
|
|
357
|
+
else if (++completed === processActions.length) {
|
|
358
|
+
workerFarm.end(workers);
|
|
359
|
+
resolve();
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
processActions.forEach(action => workers['process'](action, workCallback));
|
|
363
|
+
});
|
|
364
|
+
}
|
|
255
365
|
context.logger.info('ES5 bundle generation complete.');
|
|
256
366
|
}
|
|
257
367
|
else {
|
|
@@ -45,8 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"baseUrl": {
|
|
47
47
|
"type": "string",
|
|
48
|
-
"description": "Base URL for protractor to connect to."
|
|
49
|
-
"x-deprecated": "Use \"baseUrl\" in the Protractor config file instead."
|
|
48
|
+
"description": "Base URL for protractor to connect to."
|
|
50
49
|
}
|
|
51
50
|
},
|
|
52
51
|
"additionalProperties": false,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const manglingDisabled: boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright Google Inc. All Rights Reserved.
|
|
6
|
+
*
|
|
7
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
8
|
+
* found in the LICENSE file at https://angular.io/license
|
|
9
|
+
*/
|
|
10
|
+
const mangleVariable = process.env['NG_BUILD_MANGLE'];
|
|
11
|
+
exports.manglingDisabled = !!mangleVariable && (mangleVariable === '0' || mangleVariable.toLowerCase() === 'false');
|
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
interface ProcessBundleOptions {
|
|
1
|
+
export interface ProcessBundleOptions {
|
|
2
2
|
filename: string;
|
|
3
3
|
code: string;
|
|
4
4
|
map?: string;
|
|
5
|
-
sourceMaps
|
|
6
|
-
hiddenSourceMaps
|
|
7
|
-
|
|
5
|
+
sourceMaps?: boolean;
|
|
6
|
+
hiddenSourceMaps?: boolean;
|
|
7
|
+
vendorSourceMaps?: boolean;
|
|
8
|
+
runtime?: boolean;
|
|
8
9
|
optimize: boolean;
|
|
9
10
|
optimizeOnly?: boolean;
|
|
11
|
+
ignoreOriginal?: boolean;
|
|
12
|
+
cacheKeys?: (string | null)[];
|
|
13
|
+
cachePath?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const enum CacheKey {
|
|
16
|
+
OriginalCode = 0,
|
|
17
|
+
OriginalMap = 1,
|
|
18
|
+
DownlevelCode = 2,
|
|
19
|
+
DownlevelMap = 3
|
|
10
20
|
}
|
|
11
21
|
export declare function process(options: ProcessBundleOptions, callback: (error: Error | null, result?: {}) => void): void;
|
|
12
|
-
export {};
|
|
@@ -11,12 +11,17 @@ const fs = require("fs");
|
|
|
11
11
|
const path = require("path");
|
|
12
12
|
const source_map_1 = require("source-map");
|
|
13
13
|
const terser_1 = require("terser");
|
|
14
|
+
const mangle_options_1 = require("./mangle-options");
|
|
14
15
|
const { transformAsync } = require('@babel/core');
|
|
16
|
+
const cacache = require('cacache');
|
|
15
17
|
function process(options, callback) {
|
|
16
18
|
processWorker(options).then(() => callback(null, {}), error => callback(error));
|
|
17
19
|
}
|
|
18
20
|
exports.process = process;
|
|
19
21
|
async function processWorker(options) {
|
|
22
|
+
if (!options.cacheKeys) {
|
|
23
|
+
options.cacheKeys = [];
|
|
24
|
+
}
|
|
20
25
|
// If no downlevelling required than just mangle code and return
|
|
21
26
|
if (options.optimizeOnly) {
|
|
22
27
|
return mangleOriginal(options);
|
|
@@ -88,11 +93,10 @@ async function processWorker(options) {
|
|
|
88
93
|
// estree -> terser is already supported; need babel -> estree/terser
|
|
89
94
|
// Mangle downlevel code
|
|
90
95
|
const result = terser_1.minify(code, {
|
|
91
|
-
compress:
|
|
96
|
+
compress: true,
|
|
92
97
|
ecma: 5,
|
|
93
|
-
mangle:
|
|
98
|
+
mangle: !mangle_options_1.manglingDisabled,
|
|
94
99
|
safari10: true,
|
|
95
|
-
toplevel: true,
|
|
96
100
|
output: {
|
|
97
101
|
ascii_only: true,
|
|
98
102
|
webkit: true,
|
|
@@ -108,7 +112,9 @@ async function processWorker(options) {
|
|
|
108
112
|
code = result.code;
|
|
109
113
|
map = result.map;
|
|
110
114
|
// Mangle original code
|
|
111
|
-
|
|
115
|
+
if (!options.ignoreOriginal) {
|
|
116
|
+
await mangleOriginal(options);
|
|
117
|
+
}
|
|
112
118
|
}
|
|
113
119
|
else if (map) {
|
|
114
120
|
map = JSON.stringify(map);
|
|
@@ -117,15 +123,21 @@ async function processWorker(options) {
|
|
|
117
123
|
if (!options.hiddenSourceMaps) {
|
|
118
124
|
code += `\n//# sourceMappingURL=${path.basename(newFilePath)}.map`;
|
|
119
125
|
}
|
|
126
|
+
if (options.cachePath && options.cacheKeys[3 /* DownlevelMap */]) {
|
|
127
|
+
await cacache.put(options.cachePath, options.cacheKeys[3 /* DownlevelMap */], map);
|
|
128
|
+
}
|
|
120
129
|
fs.writeFileSync(newFilePath + '.map', map);
|
|
121
130
|
}
|
|
131
|
+
if (options.cachePath && options.cacheKeys[2 /* DownlevelCode */]) {
|
|
132
|
+
await cacache.put(options.cachePath, options.cacheKeys[2 /* DownlevelCode */], code);
|
|
133
|
+
}
|
|
122
134
|
fs.writeFileSync(newFilePath, code);
|
|
123
135
|
}
|
|
124
|
-
function mangleOriginal(options) {
|
|
136
|
+
async function mangleOriginal(options) {
|
|
125
137
|
const resultOriginal = terser_1.minify(options.code, {
|
|
126
138
|
compress: false,
|
|
127
139
|
ecma: 6,
|
|
128
|
-
mangle:
|
|
140
|
+
mangle: !mangle_options_1.manglingDisabled,
|
|
129
141
|
safari10: true,
|
|
130
142
|
output: {
|
|
131
143
|
ascii_only: true,
|
|
@@ -140,8 +152,17 @@ function mangleOriginal(options) {
|
|
|
140
152
|
if (resultOriginal.error) {
|
|
141
153
|
throw resultOriginal.error;
|
|
142
154
|
}
|
|
143
|
-
fs.writeFileSync(options.filename, resultOriginal.code);
|
|
144
155
|
if (resultOriginal.map) {
|
|
156
|
+
if (!options.hiddenSourceMaps) {
|
|
157
|
+
resultOriginal.code += `\n//# sourceMappingURL=${path.basename(options.filename)}.map`;
|
|
158
|
+
}
|
|
159
|
+
if (options.cachePath && options.cacheKeys && options.cacheKeys[1 /* OriginalMap */]) {
|
|
160
|
+
await cacache.put(options.cachePath, options.cacheKeys[1 /* OriginalMap */], resultOriginal.map);
|
|
161
|
+
}
|
|
145
162
|
fs.writeFileSync(options.filename + '.map', resultOriginal.map);
|
|
146
163
|
}
|
|
164
|
+
if (options.cachePath && options.cacheKeys && options.cacheKeys[0 /* OriginalCode */]) {
|
|
165
|
+
await cacache.put(options.cachePath, options.cacheKeys[0 /* OriginalCode */], resultOriginal.code);
|
|
166
|
+
}
|
|
167
|
+
fs.writeFileSync(options.filename, resultOriginal.code);
|
|
147
168
|
}
|