@angular-devkit/build-optimizer 0.801.0-beta.3 → 0.801.2
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.801.
|
|
3
|
+
"version": "0.801.2",
|
|
4
4
|
"description": "Angular Build Optimizer",
|
|
5
5
|
"experimental": true,
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
"homepage": "https://github.com/angular/angular-cli",
|
|
38
38
|
"husky": {
|
|
39
39
|
"hooks": {
|
|
40
|
-
"pre-commit": "lint-staged",
|
|
41
40
|
"pre-push": "node ./bin/devkit-admin hooks/pre-push"
|
|
42
41
|
}
|
|
43
42
|
}
|
|
@@ -11,6 +11,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
11
11
|
const fs_1 = require("fs");
|
|
12
12
|
const path_1 = require("path");
|
|
13
13
|
const build_optimizer_1 = require("./build-optimizer");
|
|
14
|
+
// tslint:disable: no-console
|
|
14
15
|
if (process.argv.length < 3 || process.argv.length > 4) {
|
|
15
16
|
throw new Error(`
|
|
16
17
|
build-optimizer should be called with either one or two arguments:
|
|
@@ -26,7 +27,7 @@ if (!inputFile.match(tsOrJsRegExp)) {
|
|
|
26
27
|
throw new Error(`Input file must be .js or .ts.`);
|
|
27
28
|
}
|
|
28
29
|
// Use provided output file, or add the .bo suffix before the extension.
|
|
29
|
-
const outputFile = process.argv[3] || inputFile.replace(tsOrJsRegExp,
|
|
30
|
+
const outputFile = process.argv[3] || inputFile.replace(tsOrJsRegExp, subStr => `.bo${subStr}`);
|
|
30
31
|
const boOutput = build_optimizer_1.buildOptimizer({
|
|
31
32
|
inputFilePath: path_1.join(currentDir, inputFile),
|
|
32
33
|
outputFilePath: path_1.join(currentDir, outputFile),
|
|
@@ -29,12 +29,16 @@ function optimizer(options) {
|
|
|
29
29
|
const isAngularCoreFile = options.angularCoreModules &&
|
|
30
30
|
options.angularCoreModules.some(m => normalizedId.indexOf(m) >= 0);
|
|
31
31
|
const { content: code, sourceMap: map } = build_optimizer_1.buildOptimizer({
|
|
32
|
-
content,
|
|
32
|
+
content,
|
|
33
|
+
inputFilePath: id,
|
|
34
|
+
emitSourceMap: true,
|
|
35
|
+
isSideEffectFree,
|
|
36
|
+
isAngularCoreFile,
|
|
33
37
|
});
|
|
34
38
|
if (!code) {
|
|
35
39
|
if (DEBUG) {
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
// tslint:disable-next-line: no-console
|
|
41
|
+
console.error('no transforms produced by buildOptimizer for ' + path.relative(process.cwd(), id));
|
|
38
42
|
}
|
|
39
43
|
return null;
|
|
40
44
|
}
|
|
@@ -454,7 +454,7 @@ function createWrappedClass(hostNode, statements) {
|
|
|
454
454
|
const newStatement = [];
|
|
455
455
|
newStatement.push(ts.createVariableStatement(isDefault ? undefined : modifiers, ts.createVariableDeclarationList([
|
|
456
456
|
ts.createVariableDeclaration(name, undefined, pureIife),
|
|
457
|
-
], ts.NodeFlags.
|
|
457
|
+
], ts.NodeFlags.Let)));
|
|
458
458
|
if (isDefault) {
|
|
459
459
|
newStatement.push(ts.createExportAssignment(undefined, undefined, false, ts.createIdentifier(name)));
|
|
460
460
|
}
|