@angular-devkit/build-optimizer 0.900.0-rc.7 → 0.900.1
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/build-optimizer",
|
|
3
|
-
"version": "0.900.
|
|
3
|
+
"version": "0.900.1",
|
|
4
4
|
"description": "Angular Build Optimizer",
|
|
5
5
|
"experimental": true,
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"engines": {
|
|
30
30
|
"node": ">= 10.13.0",
|
|
31
31
|
"npm": ">= 6.11.0",
|
|
32
|
-
"pnpm": ">= 3.2.0",
|
|
33
32
|
"yarn": ">= 1.13.0"
|
|
34
33
|
},
|
|
35
34
|
"author": "Angular Authors",
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
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 source_map_1 = require("source-map");
|
|
3
|
+
const webpack_sources_1 = require("webpack-sources");
|
|
11
4
|
const loaderUtils = require('loader-utils');
|
|
12
5
|
const build_optimizer_1 = require("./build-optimizer");
|
|
13
6
|
exports.buildOptimizerLoaderPath = __filename;
|
|
@@ -34,14 +27,11 @@ function buildOptimizerLoader(content, previousSourceMap) {
|
|
|
34
27
|
return;
|
|
35
28
|
}
|
|
36
29
|
const options = loaderUtils.getOptions(this) || {};
|
|
37
|
-
// Make up names of the intermediate files so we can chain the sourcemaps.
|
|
38
|
-
const inputFilePath = this.resourcePath + '.pre-build-optimizer.js';
|
|
39
|
-
const outputFilePath = this.resourcePath + '.post-build-optimizer.js';
|
|
40
30
|
const boOutput = build_optimizer_1.buildOptimizer({
|
|
41
31
|
content,
|
|
42
32
|
originalFilePath: this.resourcePath,
|
|
43
|
-
inputFilePath,
|
|
44
|
-
outputFilePath,
|
|
33
|
+
inputFilePath: this.resourcePath,
|
|
34
|
+
outputFilePath: this.resourcePath,
|
|
45
35
|
emitSourceMap: options.sourceMap,
|
|
46
36
|
isSideEffectFree: this._module && this._module.factoryMeta && this._module.factoryMeta.sideEffectFree,
|
|
47
37
|
});
|
|
@@ -57,24 +47,10 @@ function buildOptimizerLoader(content, previousSourceMap) {
|
|
|
57
47
|
// Webpack doesn't need sourceMappingURL since we pass them on explicitely.
|
|
58
48
|
newContent = newContent.replace(/^\/\/# sourceMappingURL=[^\r\n]*/gm, '');
|
|
59
49
|
if (previousSourceMap) {
|
|
60
|
-
// If there's a previous sourcemap, we have to chain them.
|
|
61
|
-
// See https://github.com/mozilla/source-map/issues/216#issuecomment-150839869 for a simple
|
|
62
|
-
// source map chaining example.
|
|
63
50
|
// Use http://sokra.github.io/source-map-visualization/ to validate sourcemaps make sense.
|
|
64
|
-
//
|
|
65
|
-
//
|
|
66
|
-
|
|
67
|
-
previousSourceMap.file = inputFilePath;
|
|
68
|
-
// Chain the sourcemaps.
|
|
69
|
-
source_map_1.SourceMapConsumer.with(intermediateSourceMap, null, intermediate => {
|
|
70
|
-
return source_map_1.SourceMapConsumer.with(previousSourceMap, null, previous => {
|
|
71
|
-
const generator = source_map_1.SourceMapGenerator.fromSourceMap(intermediate);
|
|
72
|
-
generator.applySourceMap(previous);
|
|
73
|
-
return generator.toJSON();
|
|
74
|
-
});
|
|
75
|
-
// tslint:disable-next-line: no-any
|
|
76
|
-
}).then(map => callback(null, newContent, map), error => callback(error));
|
|
77
|
-
return;
|
|
51
|
+
// The last argument is not yet in the typings
|
|
52
|
+
// tslint:disable-next-line: no-any
|
|
53
|
+
newSourceMap = new webpack_sources_1.SourceMapSource(newContent, this.resourcePath, intermediateSourceMap, content, previousSourceMap, true).map();
|
|
78
54
|
}
|
|
79
55
|
else {
|
|
80
56
|
// Otherwise just return our generated sourcemap.
|