@angular-devkit/build-optimizer 0.1200.0-rc.0 → 0.1200.0

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/README.md CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  Angular Build Optimizer contains Angular optimizations applicable to JavaScript code as a TypeScript transform pipeline.
4
4
 
5
-
6
5
  ## Available optimizations
7
6
 
8
7
  Transformations applied depend on file content:
@@ -13,21 +12,26 @@ Transformations applied depend on file content:
13
12
  Some of these optimizations add `/*@__PURE__*/` comments.
14
13
  These are used by JS optimization tools to identify pure functions that can potentially be dropped.
15
14
 
16
-
17
15
  ### Class fold
18
16
 
19
17
  Static properties are folded into ES5 classes:
20
18
 
21
19
  ```typescript
22
20
  // input
23
- var Clazz = (function () { function Clazz() { } return Clazz; }());
21
+ var Clazz = (function () {
22
+ function Clazz() {}
23
+ return Clazz;
24
+ })();
24
25
  Clazz.prop = 1;
25
26
 
26
27
  // output
27
- var Clazz = (function () { function Clazz() { } Clazz.prop = 1; return Clazz; }());
28
+ var Clazz = (function () {
29
+ function Clazz() {}
30
+ Clazz.prop = 1;
31
+ return Clazz;
32
+ })();
28
33
  ```
29
34
 
30
-
31
35
  ### Scrub file
32
36
 
33
37
  Angular decorators, property decorators and constructor parameters are removed, while leaving non-Angular ones intact.
@@ -36,50 +40,59 @@ Angular decorators, property decorators and constructor parameters are removed,
36
40
  // input
37
41
  import { Injectable, Input, Component } from '@angular/core';
38
42
  import { NotInjectable, NotComponent, NotInput } from 'another-lib';
39
- var Clazz = (function () { function Clazz() { } return Clazz; }());
43
+ var Clazz = (function () {
44
+ function Clazz() {}
45
+ return Clazz;
46
+ })();
40
47
  Clazz.decorators = [{ type: Injectable }, { type: NotInjectable }];
41
48
  Clazz.propDecorators = { 'ngIf': [{ type: Input }] };
42
- Clazz.ctorParameters = function () { return [{type: Injector}]; };
49
+ Clazz.ctorParameters = function () {
50
+ return [{ type: Injector }];
51
+ };
43
52
  var ComponentClazz = (function () {
44
- function ComponentClazz() { }
45
- __decorate([
46
- Input(),
47
- __metadata("design:type", Object)
48
- ], Clazz.prototype, "selected", void 0);
49
- __decorate([
50
- NotInput(),
51
- __metadata("design:type", Object)
52
- ], Clazz.prototype, "notSelected", void 0);
53
- ComponentClazz = __decorate([
54
- NotComponent(),
55
- Component({
53
+ function ComponentClazz() {}
54
+ __decorate([Input(), __metadata('design:type', Object)], Clazz.prototype, 'selected', void 0);
55
+ __decorate(
56
+ [NotInput(), __metadata('design:type', Object)],
57
+ Clazz.prototype,
58
+ 'notSelected',
59
+ void 0,
60
+ );
61
+ ComponentClazz = __decorate(
62
+ [
63
+ NotComponent(),
64
+ Component({
56
65
  selector: 'app-root',
57
66
  templateUrl: './app.component.html',
58
- styleUrls: ['./app.component.css']
59
- })
60
- ], ComponentClazz);
67
+ styleUrls: ['./app.component.css'],
68
+ }),
69
+ ],
70
+ ComponentClazz,
71
+ );
61
72
  return ComponentClazz;
62
- }());
73
+ })();
63
74
 
64
75
  // output
65
76
  import { Injectable, Input, Component } from '@angular/core';
66
77
  import { NotInjectable, NotComponent } from 'another-lib';
67
- var Clazz = (function () { function Clazz() { } return Clazz; }());
78
+ var Clazz = (function () {
79
+ function Clazz() {}
80
+ return Clazz;
81
+ })();
68
82
  Clazz.decorators = [{ type: NotInjectable }];
69
83
  var ComponentClazz = (function () {
70
- function ComponentClazz() { }
71
- __decorate([
72
- NotInput(),
73
- __metadata("design:type", Object)
74
- ], Clazz.prototype, "notSelected", void 0);
75
- ComponentClazz = __decorate([
76
- NotComponent()
77
- ], ComponentClazz);
84
+ function ComponentClazz() {}
85
+ __decorate(
86
+ [NotInput(), __metadata('design:type', Object)],
87
+ Clazz.prototype,
88
+ 'notSelected',
89
+ void 0,
90
+ );
91
+ ComponentClazz = __decorate([NotComponent()], ComponentClazz);
78
92
  return ComponentClazz;
79
- }());
93
+ })();
80
94
  ```
81
95
 
82
-
83
96
  ### Prefix functions
84
97
 
85
98
  Adds `/*@__PURE__*/` comments to top level downleveled class declarations and instantiation.
@@ -88,17 +101,22 @@ Warning: this transform assumes the file is a pure module. It should not be used
88
101
 
89
102
  ```typescript
90
103
  // input
91
- var Clazz = (function () { function Clazz() { } return Clazz; }());
104
+ var Clazz = (function () {
105
+ function Clazz() {}
106
+ return Clazz;
107
+ })();
92
108
  var newClazz = new Clazz();
93
109
  var newClazzTwo = Clazz();
94
110
 
95
111
  // output
96
- var Clazz = /*@__PURE__*/ (function () { function Clazz() { } return Clazz; }());
112
+ var Clazz = /*@__PURE__*/ (function () {
113
+ function Clazz() {}
114
+ return Clazz;
115
+ })();
97
116
  var newClazz = /*@__PURE__*/ new Clazz();
98
117
  var newClazzTwo = /*@__PURE__*/ Clazz();
99
118
  ```
100
119
 
101
-
102
120
  ### Prefix Classes
103
121
 
104
122
  Adds `/*@__PURE__*/` to downleveled TypeScript classes.
@@ -106,38 +124,41 @@ Adds `/*@__PURE__*/` to downleveled TypeScript classes.
106
124
  ```typescript
107
125
  // input
108
126
  var ReplayEvent = (function () {
109
- function ReplayEvent(time, value) {
110
- this.time = time;
111
- this.value = value;
112
- }
113
- return ReplayEvent;
114
- }());
127
+ function ReplayEvent(time, value) {
128
+ this.time = time;
129
+ this.value = value;
130
+ }
131
+ return ReplayEvent;
132
+ })();
115
133
 
116
134
  // output
117
135
  var ReplayEvent = /*@__PURE__*/ (function () {
118
- function ReplayEvent(time, value) {
119
- this.time = time;
120
- this.value = value;
121
- }
122
- return ReplayEvent;
123
- }());
136
+ function ReplayEvent(time, value) {
137
+ this.time = time;
138
+ this.value = value;
139
+ }
140
+ return ReplayEvent;
141
+ })();
124
142
  ```
125
143
 
126
-
127
144
  ### Import tslib
128
145
 
129
146
  TypeScript helpers (`__extends/__decorate/__metadata/__param`) are replaced with `tslib` imports whenever found.
130
147
 
131
148
  ```typescript
132
149
  // input
133
- var __extends = (this && this.__extends) || function (d, b) {
134
- for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
135
- function __() { this.constructor = d; }
136
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
137
- };
150
+ var __extends =
151
+ (this && this.__extends) ||
152
+ function (d, b) {
153
+ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
154
+ function __() {
155
+ this.constructor = d;
156
+ }
157
+ d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
158
+ };
138
159
 
139
160
  // output
140
- import { __extends } from "tslib";
161
+ import { __extends } from 'tslib';
141
162
  ```
142
163
 
143
164
  ### Wrap enums
@@ -148,20 +169,19 @@ Wrap downleveled TypeScript enums in a function, and adds `/*@__PURE__*/` commen
148
169
  // input
149
170
  var ChangeDetectionStrategy;
150
171
  (function (ChangeDetectionStrategy) {
151
- ChangeDetectionStrategy[ChangeDetectionStrategy["OnPush"] = 0] = "OnPush";
152
- ChangeDetectionStrategy[ChangeDetectionStrategy["Default"] = 1] = "Default";
172
+ ChangeDetectionStrategy[(ChangeDetectionStrategy['OnPush'] = 0)] = 'OnPush';
173
+ ChangeDetectionStrategy[(ChangeDetectionStrategy['Default'] = 1)] = 'Default';
153
174
  })(ChangeDetectionStrategy || (ChangeDetectionStrategy = {}));
154
175
 
155
176
  // output
156
177
  var ChangeDetectionStrategy = /*@__PURE__*/ (function () {
157
178
  var ChangeDetectionStrategy = {};
158
- ChangeDetectionStrategy[ChangeDetectionStrategy["OnPush"] = 0] = "OnPush";
159
- ChangeDetectionStrategy[ChangeDetectionStrategy["Default"] = 1] = "Default";
179
+ ChangeDetectionStrategy[(ChangeDetectionStrategy['OnPush'] = 0)] = 'OnPush';
180
+ ChangeDetectionStrategy[(ChangeDetectionStrategy['Default'] = 1)] = 'Default';
160
181
  return ChangeDetectionStrategy;
161
182
  })();
162
183
  ```
163
184
 
164
-
165
185
  ## Library Usage
166
186
 
167
187
  ```typescript
@@ -171,6 +191,7 @@ const transpiledContent = buildOptimizer({ content: input }).content;
171
191
  ```
172
192
 
173
193
  Available options:
194
+
174
195
  ```typescript
175
196
  export interface BuildOptimizerOptions {
176
197
  content?: string;
@@ -182,7 +203,6 @@ export interface BuildOptimizerOptions {
182
203
  }
183
204
  ```
184
205
 
185
-
186
206
  ## Webpack loader usage:
187
207
 
188
208
  ```typescript
@@ -206,7 +226,6 @@ module.exports = {
206
226
  }
207
227
  ```
208
228
 
209
-
210
229
  ## CLI usage
211
230
 
212
231
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-devkit/build-optimizer",
3
- "version": "0.1200.0-rc.0",
3
+ "version": "0.1200.0",
4
4
  "description": "Angular Build Optimizer",
5
5
  "experimental": true,
6
6
  "main": "src/index.js",
@@ -33,7 +33,7 @@
33
33
  "url": "https://github.com/angular/angular-cli.git"
34
34
  },
35
35
  "engines": {
36
- "node": ">= 12.13.0",
36
+ "node": "^12.14.1 || ^14.0.0",
37
37
  "npm": "^6.11.0 || ^7.5.6",
38
38
  "yarn": ">= 1.13.0"
39
39
  },
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright Google Inc. All Rights Reserved.
3
+ * Copyright Google LLC All Rights Reserved.
4
4
  *
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
@@ -1,4 +1,11 @@
1
1
  "use strict";
2
+ /**
3
+ * @license
4
+ * Copyright Google LLC All Rights Reserved.
5
+ *
6
+ * Use of this source code is governed by an MIT-style license that can be
7
+ * found in the LICENSE file at https://angular.io/license
8
+ */
2
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
10
  if (k2 === undefined) k2 = k;
4
11
  Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
@@ -11,13 +18,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
18
  };
12
19
  Object.defineProperty(exports, "__esModule", { value: true });
13
20
  exports.default = void 0;
14
- /**
15
- * @license
16
- * Copyright Google Inc. All Rights Reserved.
17
- *
18
- * Use of this source code is governed by an MIT-style license that can be
19
- * found in the LICENSE file at https://angular.io/license
20
- */
21
21
  __exportStar(require("./index"), exports);
22
22
  var webpack_loader_1 = require("./build-optimizer/webpack-loader");
23
23
  Object.defineProperty(exports, "default", { enumerable: true, get: function () { return webpack_loader_1.default; } });
@@ -1,3 +1,10 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
1
8
  import { TransformJavascriptOutput } from '../helpers/transform-javascript';
2
9
  export interface BuildOptimizerOptions {
3
10
  content?: string;
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildOptimizer = void 0;
4
2
  /**
5
3
  * @license
6
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
7
5
  *
8
6
  * Use of this source code is governed by an MIT-style license that can be
9
7
  * found in the LICENSE file at https://angular.io/license
10
8
  */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.buildOptimizer = void 0;
11
11
  const fs_1 = require("fs");
12
12
  const transform_javascript_1 = require("../helpers/transform-javascript");
13
13
  const prefix_classes_1 = require("../transforms/prefix-classes");
@@ -1,2 +1,9 @@
1
1
  #!/usr/bin/env node
2
+ /**
3
+ * @license
4
+ * Copyright Google LLC All Rights Reserved.
5
+ *
6
+ * Use of this source code is governed by an MIT-style license that can be
7
+ * found in the LICENSE file at https://angular.io/license
8
+ */
2
9
  export {};
@@ -1,17 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
3
  /**
5
4
  * @license
6
- * Copyright Google Inc. All Rights Reserved.
5
+ * Copyright Google LLC All Rights Reserved.
7
6
  *
8
7
  * Use of this source code is governed by an MIT-style license that can be
9
8
  * found in the LICENSE file at https://angular.io/license
10
9
  */
10
+ 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
+ /* eslint-disable no-console */
15
15
  if (process.argv.length < 3 || process.argv.length > 4) {
16
16
  throw new Error(`
17
17
  build-optimizer should be called with either one or two arguments:
@@ -27,7 +27,7 @@ if (!inputFile.match(tsOrJsRegExp)) {
27
27
  throw new Error(`Input file must be .js or .ts.`);
28
28
  }
29
29
  // Use provided output file, or add the .bo suffix before the extension.
30
- const outputFile = process.argv[3] || inputFile.replace(tsOrJsRegExp, subStr => `.bo${subStr}`);
30
+ const outputFile = process.argv[3] || inputFile.replace(tsOrJsRegExp, (subStr) => `.bo${subStr}`);
31
31
  const boOutput = build_optimizer_1.buildOptimizer({
32
32
  inputFilePath: path_1.join(currentDir, inputFile),
33
33
  outputFilePath: path_1.join(currentDir, outputFile),
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright Google Inc. All Rights Reserved.
3
+ * Copyright Google LLC All Rights Reserved.
4
4
  *
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /**
3
3
  * @license
4
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
5
5
  *
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.io/license
@@ -18,16 +18,16 @@ const DEBUG = false;
18
18
  function optimizer(options) {
19
19
  // Normalize paths for comparison.
20
20
  if (options.sideEffectFreeModules) {
21
- options.sideEffectFreeModules = options.sideEffectFreeModules.map(p => p.replace(/\\/g, '/'));
21
+ options.sideEffectFreeModules = options.sideEffectFreeModules.map((p) => p.replace(/\\/g, '/'));
22
22
  }
23
23
  return {
24
24
  name: 'build-optimizer',
25
25
  transform: (content, id) => {
26
26
  const normalizedId = id.replace(/\\/g, '/');
27
27
  const isSideEffectFree = options.sideEffectFreeModules &&
28
- options.sideEffectFreeModules.some(m => normalizedId.indexOf(m) >= 0);
28
+ options.sideEffectFreeModules.some((m) => normalizedId.indexOf(m) >= 0);
29
29
  const isAngularCoreFile = options.angularCoreModules &&
30
- options.angularCoreModules.some(m => normalizedId.indexOf(m) >= 0);
30
+ options.angularCoreModules.some((m) => normalizedId.indexOf(m) >= 0);
31
31
  const { content: code, sourceMap: map } = build_optimizer_1.buildOptimizer({
32
32
  content,
33
33
  inputFilePath: id,
@@ -37,7 +37,7 @@ function optimizer(options) {
37
37
  });
38
38
  if (!code) {
39
39
  if (DEBUG) {
40
- // tslint:disable-next-line: no-console
40
+ // eslint-disable-next-line no-console
41
41
  console.error('no transforms produced by buildOptimizer for ' + path.relative(process.cwd(), id));
42
42
  }
43
43
  return null;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright Google Inc. All Rights Reserved.
3
+ * Copyright Google LLC All Rights Reserved.
4
4
  *
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
@@ -1,4 +1,11 @@
1
1
  "use strict";
2
+ /**
3
+ * @license
4
+ * Copyright Google LLC All Rights Reserved.
5
+ *
6
+ * Use of this source code is governed by an MIT-style license that can be
7
+ * found in the LICENSE file at https://angular.io/license
8
+ */
2
9
  Object.defineProperty(exports, "__esModule", { value: true });
3
10
  exports.buildOptimizerLoaderPath = void 0;
4
11
  const webpack_1 = require("webpack");
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright Google Inc. All Rights Reserved.
3
+ * Copyright Google LLC All Rights Reserved.
4
4
  *
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
@@ -1,10 +1,16 @@
1
1
  "use strict";
2
+ /**
3
+ * @license
4
+ * Copyright Google LLC All Rights Reserved.
5
+ *
6
+ * Use of this source code is governed by an MIT-style license that can be
7
+ * found in the LICENSE file at https://angular.io/license
8
+ */
2
9
  Object.defineProperty(exports, "__esModule", { value: true });
3
10
  exports.BuildOptimizerWebpackPlugin = void 0;
4
11
  class BuildOptimizerWebpackPlugin {
5
12
  apply(compiler) {
6
- compiler.hooks.normalModuleFactory.tap('BuildOptimizerWebpackPlugin', nmf => {
7
- // tslint:disable-next-line: no-any
13
+ compiler.hooks.normalModuleFactory.tap('BuildOptimizerWebpackPlugin', (nmf) => {
8
14
  nmf.hooks.module.tap('BuildOptimizerWebpackPlugin', (module, data) => {
9
15
  var _a;
10
16
  if ((_a = data.resourceResolveData) === null || _a === void 0 ? void 0 : _a.descriptionFileData) {
@@ -1,3 +1,10 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
1
8
  import * as ts from 'typescript';
2
9
  export declare function collectDeepNodes<T extends ts.Node>(node: ts.Node, kind: ts.SyntaxKind): T[];
3
10
  export declare function addPureComment<T extends ts.Node>(node: T): T;
@@ -1,19 +1,19 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCleanHelperName = exports.isHelperName = exports.hasPureComment = exports.addPureComment = exports.collectDeepNodes = void 0;
4
2
  /**
5
3
  * @license
6
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
7
5
  *
8
6
  * Use of this source code is governed by an MIT-style license that can be
9
7
  * found in the LICENSE file at https://angular.io/license
10
8
  */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.getCleanHelperName = exports.isHelperName = exports.hasPureComment = exports.addPureComment = exports.collectDeepNodes = void 0;
11
11
  const tslib = require("tslib");
12
12
  const ts = require("typescript");
13
13
  const pureFunctionComment = '@__PURE__';
14
14
  // We include only exports that start with '__' because tslib helpers
15
15
  // all start with a suffix of two underscores.
16
- const tslibHelpers = new Set(Object.keys(tslib).filter(h => h.startsWith('__')));
16
+ const tslibHelpers = new Set(Object.keys(tslib).filter((h) => h.startsWith('__')));
17
17
  // Find all nodes from the AST in the subtree of node of SyntaxKind kind.
18
18
  function collectDeepNodes(node, kind) {
19
19
  const nodes = [];
@@ -36,7 +36,7 @@ function hasPureComment(node) {
36
36
  return false;
37
37
  }
38
38
  const leadingComment = ts.getSyntheticLeadingComments(node);
39
- return !!leadingComment && leadingComment.some(comment => comment.text === pureFunctionComment);
39
+ return !!leadingComment && leadingComment.some((comment) => comment.text === pureFunctionComment);
40
40
  }
41
41
  exports.hasPureComment = hasPureComment;
42
42
  function isHelperName(name) {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright Google Inc. All Rights Reserved.
3
+ * Copyright Google LLC All Rights Reserved.
4
4
  *
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
@@ -1,10 +1,17 @@
1
1
  "use strict";
2
+ /**
3
+ * @license
4
+ * Copyright Google LLC All Rights Reserved.
5
+ *
6
+ * Use of this source code is governed by an MIT-style license that can be
7
+ * found in the LICENSE file at https://angular.io/license
8
+ */
2
9
  Object.defineProperty(exports, "__esModule", { value: true });
3
10
  exports.transformJavascript = void 0;
4
11
  const ts = require("typescript");
5
12
  function validateDiagnostics(diagnostics, strict) {
6
13
  // Print error diagnostics.
7
- const hasError = diagnostics.some(diag => diag.category === ts.DiagnosticCategory.Error);
14
+ const hasError = diagnostics.some((diag) => diag.category === ts.DiagnosticCategory.Error);
8
15
  if (hasError) {
9
16
  // Throw only if we're in strict mode, otherwise return original content.
10
17
  if (strict) {
@@ -26,7 +33,7 @@ function validateDiagnostics(diagnostics, strict) {
26
33
  return true;
27
34
  }
28
35
  function transformJavascript(options) {
29
- const { content, getTransforms, emitSourceMap, inputFilePath, outputFilePath, strict, } = options;
36
+ const { content, getTransforms, emitSourceMap, inputFilePath, outputFilePath, strict } = options;
30
37
  // Bail if there's no transform to do.
31
38
  if (getTransforms.length === 0) {
32
39
  return {
package/src/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright Google Inc. All Rights Reserved.
3
+ * Copyright Google LLC All Rights Reserved.
4
4
  *
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
package/src/index.js CHANGED
@@ -1,4 +1,11 @@
1
1
  "use strict";
2
+ /**
3
+ * @license
4
+ * Copyright Google LLC All Rights Reserved.
5
+ *
6
+ * Use of this source code is governed by an MIT-style license that can be
7
+ * found in the LICENSE file at https://angular.io/license
8
+ */
2
9
  Object.defineProperty(exports, "__esModule", { value: true });
3
10
  exports.getScrubFileTransformerForCore = exports.getScrubFileTransformer = exports.getWrapEnumsTransformer = exports.getPrefixFunctionsTransformer = exports.getPrefixClassesTransformer = exports.transformJavascript = exports.buildOptimizer = exports.BuildOptimizerWebpackPlugin = exports.buildOptimizerLoaderPath = exports.buildOptimizerLoader = void 0;
4
11
  const scrub_file_1 = require("./transforms/scrub-file");
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright Google Inc. All Rights Reserved.
3
+ * Copyright Google LLC All Rights Reserved.
4
4
  *
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPrefixClassesTransformer = exports.testPrefixClasses = void 0;
4
2
  /**
5
3
  * @license
6
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
7
5
  *
8
6
  * Use of this source code is governed by an MIT-style license that can be
9
7
  * found in the LICENSE file at https://angular.io/license
10
8
  */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.getPrefixClassesTransformer = exports.testPrefixClasses = void 0;
11
11
  const ts = require("typescript");
12
12
  const ast_utils_1 = require("../helpers/ast-utils");
13
13
  function testPrefixClasses(content) {
@@ -17,20 +17,27 @@ function testPrefixClasses(content) {
17
17
  const regexes = [
18
18
  [
19
19
  /^/,
20
- exportVarSetter, multiLineComment,
21
- /\(/, multiLineComment,
22
- /\s*function \(\) {/, newLine,
20
+ exportVarSetter,
23
21
  multiLineComment,
24
- /function (?:\S+)\([^\)]*\) \{/, newLine,
22
+ /\(/,
23
+ multiLineComment,
24
+ /\s*function \(\) {/,
25
+ newLine,
26
+ multiLineComment,
27
+ /function (?:\S+)\([^\)]*\) \{/,
28
+ newLine,
25
29
  ],
26
30
  [
27
31
  /^/,
28
- exportVarSetter, multiLineComment,
29
- /\(/, multiLineComment,
30
- /\s*function \(_super\) {/, newLine,
32
+ exportVarSetter,
33
+ multiLineComment,
34
+ /\(/,
35
+ multiLineComment,
36
+ /\s*function \(_super\) {/,
37
+ newLine,
31
38
  /\S*\.?__extends\(\S+, _super\);/,
32
39
  ],
33
- ].map(arr => new RegExp(arr.map(x => x.source).join(''), 'm'));
40
+ ].map((arr) => new RegExp(arr.map((x) => x.source).join(''), 'm'));
34
41
  return regexes.some((regex) => regex.test(content));
35
42
  }
36
43
  exports.testPrefixClasses = testPrefixClasses;
@@ -69,8 +76,7 @@ function isDownleveledClass(node) {
69
76
  return false;
70
77
  }
71
78
  const variableDeclaration = node.declarationList.declarations[0];
72
- if (!ts.isIdentifier(variableDeclaration.name)
73
- || !variableDeclaration.initializer) {
79
+ if (!ts.isIdentifier(variableDeclaration.name) || !variableDeclaration.initializer) {
74
80
  return false;
75
81
  }
76
82
  let potentialClass = variableDeclaration.initializer;
@@ -87,8 +93,8 @@ function isDownleveledClass(node) {
87
93
  if (ts.isFunctionExpression(potentialClass.expression)) {
88
94
  wrapperBody = potentialClass.expression.body;
89
95
  }
90
- else if (ts.isArrowFunction(potentialClass.expression)
91
- && ts.isBlock(potentialClass.expression.body)) {
96
+ else if (ts.isArrowFunction(potentialClass.expression) &&
97
+ ts.isBlock(potentialClass.expression.body)) {
92
98
  wrapperBody = potentialClass.expression.body;
93
99
  }
94
100
  else {
@@ -112,24 +118,24 @@ function isDownleveledClass(node) {
112
118
  break;
113
119
  }
114
120
  }
115
- if (returnStatement == undefined
116
- || returnStatement.expression == undefined
117
- || !ts.isIdentifier(returnStatement.expression)) {
121
+ if (returnStatement == undefined ||
122
+ returnStatement.expression == undefined ||
123
+ !ts.isIdentifier(returnStatement.expression)) {
118
124
  return false;
119
125
  }
120
126
  if (functionExpression.parameters.length === 0) {
121
127
  // potential non-extended class or wrapped es2015 class
122
- return (ts.isFunctionDeclaration(firstStatement) || ts.isClassDeclaration(firstStatement))
123
- && firstStatement.name !== undefined
124
- && returnStatement.expression.text === firstStatement.name.text;
128
+ return ((ts.isFunctionDeclaration(firstStatement) || ts.isClassDeclaration(firstStatement)) &&
129
+ firstStatement.name !== undefined &&
130
+ returnStatement.expression.text === firstStatement.name.text);
125
131
  }
126
132
  else if (functionExpression.parameters.length !== 1) {
127
133
  return false;
128
134
  }
129
135
  // Potential extended class
130
136
  const functionParameter = functionExpression.parameters[0];
131
- if (!ts.isIdentifier(functionParameter.name)
132
- || functionParameter.name.text !== superParameterName) {
137
+ if (!ts.isIdentifier(functionParameter.name) ||
138
+ functionParameter.name.text !== superParameterName) {
133
139
  return false;
134
140
  }
135
141
  if (functionStatements.length < 3 || !ts.isExpressionStatement(firstStatement)) {
@@ -157,7 +163,7 @@ function isDownleveledClass(node) {
157
163
  return false;
158
164
  }
159
165
  const secondStatement = functionStatements[1];
160
- return ts.isFunctionDeclaration(secondStatement)
161
- && secondStatement.name !== undefined
162
- && returnStatement.expression.text === secondStatement.name.text;
166
+ return (ts.isFunctionDeclaration(secondStatement) &&
167
+ secondStatement.name !== undefined &&
168
+ returnStatement.expression.text === secondStatement.name.text);
163
169
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright Google Inc. All Rights Reserved.
3
+ * Copyright Google LLC All Rights Reserved.
4
4
  *
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findTopLevelFunctions = exports.getPrefixFunctionsTransformer = void 0;
4
2
  /**
5
3
  * @license
6
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
7
5
  *
8
6
  * Use of this source code is governed by an MIT-style license that can be
9
7
  * found in the LICENSE file at https://angular.io/license
10
8
  */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.findTopLevelFunctions = exports.getPrefixFunctionsTransformer = void 0;
11
11
  const ts = require("typescript");
12
12
  const ast_utils_1 = require("../helpers/ast-utils");
13
13
  function getPrefixFunctionsTransformer() {
@@ -39,10 +39,10 @@ function findTopLevelFunctions(parentNode) {
39
39
  // need to mark function calls inside them as pure.
40
40
  // Class static initializers in ES2015 are an exception we don't cover. They would need similar
41
41
  // processing as enums to prevent property setting from causing the class to be retained.
42
- if (ts.isFunctionLike(node)
43
- || ts.isClassLike(node)
44
- || ts.isArrowFunction(node)
45
- || ts.isMethodDeclaration(node)) {
42
+ if (ts.isFunctionLike(node) ||
43
+ ts.isClassLike(node) ||
44
+ ts.isArrowFunction(node) ||
45
+ ts.isMethodDeclaration(node)) {
46
46
  return;
47
47
  }
48
48
  let noPureComment = !ast_utils_1.hasPureComment(node);
@@ -54,8 +54,8 @@ function findTopLevelFunctions(parentNode) {
54
54
  if (!innerNode) {
55
55
  return;
56
56
  }
57
- if ((ts.isFunctionExpression(innerNode) || ts.isArrowFunction(innerNode))
58
- && ts.isParenthesizedExpression(node)) {
57
+ if ((ts.isFunctionExpression(innerNode) || ts.isArrowFunction(innerNode)) &&
58
+ ts.isParenthesizedExpression(node)) {
59
59
  // pure functions can be wrapped in parentizes
60
60
  // we should not add pure comments to this sort of syntax.
61
61
  // example var foo = (() => x)
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright Google Inc. All Rights Reserved.
3
+ * Copyright Google LLC All Rights Reserved.
4
4
  *
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.expect = exports.createScrubFileTransformerFactory = exports.testScrubFile = void 0;
4
2
  /**
5
3
  * @license
6
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
7
5
  *
8
6
  * Use of this source code is governed by an MIT-style license that can be
9
7
  * found in the LICENSE file at https://angular.io/license
10
8
  */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.expect = exports.createScrubFileTransformerFactory = exports.testScrubFile = void 0;
11
11
  const ts = require("typescript");
12
12
  const ast_utils_1 = require("../helpers/ast-utils");
13
13
  function testScrubFile(content) {
@@ -210,7 +210,7 @@ function isAngularDecoratorExpression(exprStmt, ngMetadata, tslibImports, checke
210
210
  if (decorateArray.elements.length === 0 || !ts.isCallExpression(decorateArray.elements[0])) {
211
211
  return false;
212
212
  }
213
- return decorateArray.elements.some(decoratorCall => {
213
+ return decorateArray.elements.some((decoratorCall) => {
214
214
  if (!ts.isCallExpression(decoratorCall) || !ts.isIdentifier(decoratorCall.expression)) {
215
215
  return false;
216
216
  }
@@ -235,8 +235,8 @@ function isCtorParamsAssignmentExpression(exprStmt) {
235
235
  return false;
236
236
  }
237
237
  const expr = exprStmt.expression;
238
- if (expr.right.kind !== ts.SyntaxKind.FunctionExpression
239
- && expr.right.kind !== ts.SyntaxKind.ArrowFunction) {
238
+ if (expr.right.kind !== ts.SyntaxKind.FunctionExpression &&
239
+ expr.right.kind !== ts.SyntaxKind.ArrowFunction) {
240
240
  return false;
241
241
  }
242
242
  return true;
@@ -305,12 +305,12 @@ function isIvyPrivateCallExpression(expression, name) {
305
305
  function pickDecorationNodesToRemove(exprStmt, ngMetadata, checker) {
306
306
  const expr = expect(exprStmt.expression, ts.SyntaxKind.BinaryExpression);
307
307
  const literal = expect(expr.right, ts.SyntaxKind.ArrayLiteralExpression);
308
- if (!literal.elements.every(elem => ts.isObjectLiteralExpression(elem))) {
308
+ if (!literal.elements.every((elem) => ts.isObjectLiteralExpression(elem))) {
309
309
  return [];
310
310
  }
311
311
  const elements = literal.elements;
312
312
  const ngDecorators = elements.filter((elem) => isAngularDecorator(elem, ngMetadata, checker));
313
- return (elements.length > ngDecorators.length) ? ngDecorators : [exprStmt];
313
+ return elements.length > ngDecorators.length ? ngDecorators : [exprStmt];
314
314
  }
315
315
  // Remove Angular decorators from `Clazz = __decorate([...], Clazz)`, or expression itself if all
316
316
  // are removed.
@@ -370,15 +370,14 @@ function pickDecorateNodesToRemove(exprStmt, tslibImports, ngMetadata, checker)
370
370
  // statement so that it is removed in entirety.
371
371
  // If not then only remove the Angular decorators.
372
372
  // The metadata and param calls may be used by the non-Angular decorators.
373
- return (elements.length === callCount) ? [exprStmt] : ngDecoratorCalls;
373
+ return elements.length === callCount ? [exprStmt] : ngDecoratorCalls;
374
374
  }
375
375
  // Remove Angular decorators from`Clazz.propDecorators = [...];`, or expression itself if all
376
376
  // are removed.
377
377
  function pickPropDecorationNodesToRemove(exprStmt, ngMetadata, checker) {
378
378
  const expr = expect(exprStmt.expression, ts.SyntaxKind.BinaryExpression);
379
379
  const literal = expect(expr.right, ts.SyntaxKind.ObjectLiteralExpression);
380
- if (!literal.properties.every(elem => ts.isPropertyAssignment(elem)
381
- && ts.isArrayLiteralExpression(elem.initializer))) {
380
+ if (!literal.properties.every((elem) => ts.isPropertyAssignment(elem) && ts.isArrayLiteralExpression(elem.initializer))) {
382
381
  return [];
383
382
  }
384
383
  const assignments = literal.properties;
@@ -403,7 +402,8 @@ function pickPropDecorationNodesToRemove(exprStmt, ngMetadata, checker) {
403
402
  // If every node to be removed is a property assignment (full property's decorators) and
404
403
  // all properties are accounted for, remove the whole assignment. Otherwise, remove the
405
404
  // nodes which were marked as safe.
406
- if (toRemove.length === assignments.length && toRemove.every((node) => ts.isPropertyAssignment(node))) {
405
+ if (toRemove.length === assignments.length &&
406
+ toRemove.every((node) => ts.isPropertyAssignment(node))) {
407
407
  return [exprStmt];
408
408
  }
409
409
  return toRemove;
@@ -436,14 +436,12 @@ function identifierIsMetadata(id, metadata, checker) {
436
436
  if (!symbol || !symbol.declarations || !symbol.declarations.length) {
437
437
  return false;
438
438
  }
439
- return symbol
440
- .declarations
441
- .some((spec) => metadata.includes(spec));
439
+ return symbol.declarations.some((spec) => metadata.includes(spec));
442
440
  }
443
441
  // Find all named imports for `tslib`.
444
442
  function findTslibImports(node) {
445
443
  const imports = [];
446
- ts.forEachChild(node, child => {
444
+ ts.forEachChild(node, (child) => {
447
445
  var _a, _b;
448
446
  if (ts.isImportDeclaration(child) &&
449
447
  child.moduleSpecifier &&
@@ -467,7 +465,7 @@ function isTslibHelper(callExpr, helper, tslibImports, checker) {
467
465
  return false;
468
466
  }
469
467
  for (const dec of symbol.declarations) {
470
- if (ts.isImportSpecifier(dec) && tslibImports.some(name => name.elements.includes(dec))) {
468
+ if (ts.isImportSpecifier(dec) && tslibImports.some((name) => name.elements.includes(dec))) {
471
469
  return true;
472
470
  }
473
471
  // Handle inline helpers `var __decorate = (this...`
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright Google Inc. All Rights Reserved.
3
+ * Copyright Google LLC All Rights Reserved.
4
4
  *
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
@@ -1,25 +1,25 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getWrapEnumsTransformer = void 0;
4
2
  /**
5
3
  * @license
6
- * Copyright Google Inc. All Rights Reserved.
4
+ * Copyright Google LLC All Rights Reserved.
7
5
  *
8
6
  * Use of this source code is governed by an MIT-style license that can be
9
7
  * found in the LICENSE file at https://angular.io/license
10
8
  */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.getWrapEnumsTransformer = void 0;
11
11
  const ts = require("typescript");
12
12
  const ast_utils_1 = require("../helpers/ast-utils");
13
13
  function isBlockLike(node) {
14
- return node.kind === ts.SyntaxKind.Block
15
- || node.kind === ts.SyntaxKind.ModuleBlock
16
- || node.kind === ts.SyntaxKind.CaseClause
17
- || node.kind === ts.SyntaxKind.DefaultClause
18
- || node.kind === ts.SyntaxKind.SourceFile;
14
+ return (node.kind === ts.SyntaxKind.Block ||
15
+ node.kind === ts.SyntaxKind.ModuleBlock ||
16
+ node.kind === ts.SyntaxKind.CaseClause ||
17
+ node.kind === ts.SyntaxKind.DefaultClause ||
18
+ node.kind === ts.SyntaxKind.SourceFile);
19
19
  }
20
20
  function getWrapEnumsTransformer() {
21
21
  return (context) => {
22
- const transformer = sf => {
22
+ const transformer = (sf) => {
23
23
  const result = visitBlockStatements(sf.statements, context);
24
24
  return context.factory.updateSourceFile(sf, ts.setTextRange(result, sf.statements));
25
25
  };
@@ -75,8 +75,8 @@ function visitBlockStatements(statements, context) {
75
75
  // * have only one declaration
76
76
  // * have an ClassExpression or BinaryExpression and a right
77
77
  // of kind ClassExpression as a initializer
78
- if (ts.isVariableStatement(currentStatement)
79
- && currentStatement.declarationList.declarations.length === 1) {
78
+ if (ts.isVariableStatement(currentStatement) &&
79
+ currentStatement.declarationList.declarations.length === 1) {
80
80
  const variableDeclaration = currentStatement.declarationList.declarations[0];
81
81
  const initializer = variableDeclaration.initializer;
82
82
  if (ts.isIdentifier(variableDeclaration.name)) {
@@ -91,9 +91,8 @@ function visitBlockStatements(statements, context) {
91
91
  oIndex++;
92
92
  }
93
93
  }
94
- else if (ts.isClassExpression(initializer)
95
- || (ts.isBinaryExpression(initializer)
96
- && ts.isClassExpression(initializer.right))) {
94
+ else if (ts.isClassExpression(initializer) ||
95
+ (ts.isBinaryExpression(initializer) && ts.isClassExpression(initializer.right))) {
97
96
  const classStatements = findStatements(name, statements, oIndex);
98
97
  if (!classStatements) {
99
98
  continue;
@@ -121,7 +120,7 @@ function visitBlockStatements(statements, context) {
121
120
  updatedStatements.splice(uIndex, oldStatementsLength, ...newStatement);
122
121
  // When having more than a single new statement
123
122
  // we need to update the update Index
124
- uIndex += (newStatement ? newStatement.length - 1 : 0);
123
+ uIndex += newStatement ? newStatement.length - 1 : 0;
125
124
  }
126
125
  const result = ts.visitNode(currentStatement, visitor);
127
126
  if (result !== currentStatement) {
@@ -161,14 +160,15 @@ function findEnumIife(name, statement) {
161
160
  }
162
161
  const parameterName = parameter.name.text;
163
162
  let argument = callExpression.arguments[0];
164
- if (!ts.isBinaryExpression(argument)
165
- || !ts.isIdentifier(argument.left)
166
- || argument.left.text !== name) {
163
+ if (!ts.isBinaryExpression(argument) ||
164
+ !ts.isIdentifier(argument.left) ||
165
+ argument.left.text !== name) {
167
166
  return null;
168
167
  }
169
168
  let potentialExport = false;
170
169
  if (argument.operatorToken.kind === ts.SyntaxKind.FirstAssignment) {
171
- if (ts.isBinaryExpression(argument.right) && argument.right.operatorToken.kind !== ts.SyntaxKind.BarBarToken) {
170
+ if (ts.isBinaryExpression(argument.right) &&
171
+ argument.right.operatorToken.kind !== ts.SyntaxKind.BarBarToken) {
172
172
  return null;
173
173
  }
174
174
  potentialExport = true;
@@ -185,9 +185,9 @@ function findEnumIife(name, statement) {
185
185
  }
186
186
  // Go through all the statements and check that all match the name
187
187
  for (const statement of functionExpression.body.statements) {
188
- if (!ts.isExpressionStatement(statement)
189
- || !ts.isBinaryExpression(statement.expression)
190
- || !ts.isElementAccessExpression(statement.expression.left)) {
188
+ if (!ts.isExpressionStatement(statement) ||
189
+ !ts.isBinaryExpression(statement.expression) ||
190
+ !ts.isElementAccessExpression(statement.expression.left)) {
191
191
  return null;
192
192
  }
193
193
  const leftExpression = statement.expression.left.expression;
@@ -234,7 +234,7 @@ function findStatements(name, statements, statementIndex, offset = 0) {
234
234
  // __decorate$1([propDecorator()], FooClass, "propertyName", void 0);
235
235
  const args = expression.arguments;
236
236
  if (args.length > 2) {
237
- const isReferenced = args.some(arg => {
237
+ const isReferenced = args.some((arg) => {
238
238
  const potentialIdentifier = ts.isPropertyAccessExpression(arg) ? arg.expression : arg;
239
239
  return ts.isIdentifier(potentialIdentifier) && potentialIdentifier.text === name;
240
240
  });
@@ -245,15 +245,13 @@ function findStatements(name, statements, statementIndex, offset = 0) {
245
245
  }
246
246
  }
247
247
  else if (ts.isBinaryExpression(expression)) {
248
- const node = ts.isBinaryExpression(expression.left)
249
- ? expression.left.left
250
- : expression.left;
248
+ const node = ts.isBinaryExpression(expression.left) ? expression.left.left : expression.left;
251
249
  const leftExpression = ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)
252
- // Static Properties // Ex: Foo.bar = 'value';
253
- // ENUM Property // Ex: ChangeDetectionStrategy[ChangeDetectionStrategy.Default] = "Default";
254
- ? node.expression
255
- // Ex: FooClass = __decorate([Component()], FooClass);
256
- : node;
250
+ ? // Static Properties // Ex: Foo.bar = 'value';
251
+ // ENUM Property // Ex: ChangeDetectionStrategy[ChangeDetectionStrategy.Default] = "Default";
252
+ node.expression
253
+ : // Ex: FooClass = __decorate([Component()], FooClass);
254
+ node;
257
255
  if (ts.isIdentifier(leftExpression) && leftExpression.text === name) {
258
256
  count++;
259
257
  continue;
@@ -267,13 +265,13 @@ function findStatements(name, statements, statementIndex, offset = 0) {
267
265
  return undefined;
268
266
  }
269
267
  function updateEnumIife(nodeFactory, hostNode, iife, exportAssignment) {
270
- if (!ts.isParenthesizedExpression(iife.expression)
271
- || !ts.isFunctionExpression(iife.expression.expression)) {
268
+ if (!ts.isParenthesizedExpression(iife.expression) ||
269
+ !ts.isFunctionExpression(iife.expression.expression)) {
272
270
  throw new Error('Invalid IIFE Structure');
273
271
  }
274
272
  // Ignore export assignment if variable is directly exported
275
- if (hostNode.modifiers
276
- && hostNode.modifiers.findIndex(m => m.kind == ts.SyntaxKind.ExportKeyword) != -1) {
273
+ if (hostNode.modifiers &&
274
+ hostNode.modifiers.findIndex((m) => m.kind == ts.SyntaxKind.ExportKeyword) != -1) {
277
275
  exportAssignment = undefined;
278
276
  }
279
277
  const expression = iife.expression.expression;
@@ -303,12 +301,9 @@ function createWrappedClass(nodeFactory, hostNode, statements) {
303
301
  nodeFactory.createReturnStatement(nodeFactory.createIdentifier(name)),
304
302
  ]));
305
303
  const modifiers = hostNode.modifiers;
306
- const isDefault = !!modifiers
307
- && modifiers.some(x => x.kind === ts.SyntaxKind.DefaultKeyword);
304
+ const isDefault = !!modifiers && modifiers.some((x) => x.kind === ts.SyntaxKind.DefaultKeyword);
308
305
  const newStatement = [];
309
- newStatement.push(nodeFactory.createVariableStatement(isDefault ? undefined : modifiers, nodeFactory.createVariableDeclarationList([
310
- nodeFactory.createVariableDeclaration(name, undefined, undefined, pureIife),
311
- ], ts.NodeFlags.Let)));
306
+ newStatement.push(nodeFactory.createVariableStatement(isDefault ? undefined : modifiers, nodeFactory.createVariableDeclarationList([nodeFactory.createVariableDeclaration(name, undefined, undefined, pureIife)], ts.NodeFlags.Let)));
312
307
  if (isDefault) {
313
308
  newStatement.push(nodeFactory.createExportAssignment(undefined, undefined, false, nodeFactory.createIdentifier(name)));
314
309
  }