@angular-devkit/build-angular 22.2.0-next.0 → 22.2.0-next.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 +10 -10
- package/src/tools/babel/plugins/adjust-static-class-members.d.ts +25 -0
- package/src/tools/babel/plugins/adjust-static-class-members.js +349 -0
- package/src/tools/babel/plugins/adjust-static-class-members.js.map +1 -0
- package/src/tools/babel/plugins/adjust-typescript-enums.d.ts +21 -0
- package/src/tools/babel/plugins/adjust-typescript-enums.js +113 -0
- package/src/tools/babel/plugins/adjust-typescript-enums.js.map +1 -0
- package/src/tools/babel/plugins/elide-angular-metadata.d.ts +23 -0
- package/src/tools/babel/plugins/elide-angular-metadata.js +110 -0
- package/src/tools/babel/plugins/elide-angular-metadata.js.map +1 -0
- package/src/tools/babel/plugins/pure-toplevel-functions.d.ts +13 -0
- package/src/tools/babel/plugins/pure-toplevel-functions.js +128 -0
- package/src/tools/babel/plugins/pure-toplevel-functions.js.map +1 -0
- package/src/tools/babel/plugins/types.d.ts +14 -0
- package/src/tools/babel/presets/application.js +7 -2
- package/src/tools/babel/presets/application.js.map +1 -1
- package/src/utils/normalize-cache.js +1 -1
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/build-angular",
|
|
3
|
-
"version": "22.2.0-next.
|
|
3
|
+
"version": "22.2.0-next.1",
|
|
4
4
|
"description": "Angular Webpack Build Facade",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"typings": "src/index.d.ts",
|
|
7
7
|
"builders": "builders.json",
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@ampproject/remapping": "2.3.0",
|
|
10
|
-
"@angular-devkit/architect": "0.2202.0-next.
|
|
11
|
-
"@angular-devkit/build-webpack": "0.2202.0-next.
|
|
12
|
-
"@angular-devkit/core": "22.2.0-next.
|
|
13
|
-
"@angular/build": "22.2.0-next.
|
|
10
|
+
"@angular-devkit/architect": "0.2202.0-next.1",
|
|
11
|
+
"@angular-devkit/build-webpack": "0.2202.0-next.1",
|
|
12
|
+
"@angular-devkit/core": "22.2.0-next.1",
|
|
13
|
+
"@angular/build": "22.2.0-next.1",
|
|
14
14
|
"@babel/core": "8.0.1",
|
|
15
15
|
"@babel/generator": "8.0.0",
|
|
16
16
|
"@babel/helper-annotate-as-pure": "8.0.0",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"@babel/preset-env": "8.0.2",
|
|
22
22
|
"@babel/runtime": "8.0.0",
|
|
23
23
|
"@discoveryjs/json-ext": "1.1.0",
|
|
24
|
-
"@ngtools/webpack": "22.2.0-next.
|
|
24
|
+
"@ngtools/webpack": "22.2.0-next.1",
|
|
25
25
|
"ansi-colors": "4.1.3",
|
|
26
26
|
"autoprefixer": "10.5.4",
|
|
27
27
|
"babel-loader": "10.1.1",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"ora": "9.4.1",
|
|
43
43
|
"picomatch": "4.0.5",
|
|
44
44
|
"piscina": "5.3.0",
|
|
45
|
-
"postcss": "8.5.
|
|
45
|
+
"postcss": "8.5.25",
|
|
46
46
|
"postcss-loader": "8.2.1",
|
|
47
47
|
"resolve-url-loader": "5.0.0",
|
|
48
48
|
"rxjs": "7.8.2",
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"tinyglobby": "0.2.17",
|
|
56
56
|
"tslib": "2.8.1",
|
|
57
57
|
"webpack": "5.109.2",
|
|
58
|
-
"webpack-dev-middleware": "8.1.
|
|
59
|
-
"webpack-dev-server": "
|
|
58
|
+
"webpack-dev-middleware": "8.1.1",
|
|
59
|
+
"webpack-dev-server": "6.0.0",
|
|
60
60
|
"webpack-merge": "6.0.1",
|
|
61
61
|
"webpack-subresource-integrity": "5.1.0"
|
|
62
62
|
},
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"@angular/platform-browser": "^22.0.0 || ^22.2.0-next.0",
|
|
71
71
|
"@angular/platform-server": "^22.0.0 || ^22.2.0-next.0",
|
|
72
72
|
"@angular/service-worker": "^22.0.0 || ^22.2.0-next.0",
|
|
73
|
-
"@angular/ssr": "^22.2.0-next.
|
|
73
|
+
"@angular/ssr": "^22.2.0-next.1",
|
|
74
74
|
"browser-sync": "^3.0.2",
|
|
75
75
|
"karma": "^6.3.0",
|
|
76
76
|
"ng-packagr": "^22.0.0 || ^22.2.0-next.0",
|
|
@@ -0,0 +1,25 @@
|
|
|
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.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import { PluginObject } from '@babel/core';
|
|
9
|
+
/**
|
|
10
|
+
* Provides one or more keywords that if found within the content of a source file indicate
|
|
11
|
+
* that this plugin should be used with a source file.
|
|
12
|
+
*
|
|
13
|
+
* @returns An a string iterable containing one or more keywords.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getKeywords(): Iterable<string>;
|
|
16
|
+
/**
|
|
17
|
+
* A babel plugin factory function for adjusting classes; primarily with Angular metadata.
|
|
18
|
+
* The adjustments include wrapping classes with known safe or no side effects with pure
|
|
19
|
+
* annotations to support dead code removal of unused classes. Angular compiler generated
|
|
20
|
+
* metadata static fields not required in AOT mode are also elided to better support bundler-
|
|
21
|
+
* level treeshaking.
|
|
22
|
+
*
|
|
23
|
+
* @returns A babel plugin object instance.
|
|
24
|
+
*/
|
|
25
|
+
export default function (): PluginObject;
|
|
@@ -0,0 +1,349 @@
|
|
|
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.dev/license
|
|
8
|
+
*/
|
|
9
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.getKeywords = getKeywords;
|
|
14
|
+
exports.default = default_1;
|
|
15
|
+
const core_1 = require("@babel/core");
|
|
16
|
+
const helper_annotate_as_pure_1 = __importDefault(require("@babel/helper-annotate-as-pure"));
|
|
17
|
+
const helper_split_export_declaration_1 = __importDefault(require("@babel/helper-split-export-declaration"));
|
|
18
|
+
/**
|
|
19
|
+
* The name of the Typescript decorator helper function created by the TypeScript compiler.
|
|
20
|
+
*/
|
|
21
|
+
const TSLIB_DECORATE_HELPER_NAME = '__decorate';
|
|
22
|
+
/**
|
|
23
|
+
* The set of Angular static fields that should always be wrapped.
|
|
24
|
+
* These fields may appear to have side effects but are safe to remove if the associated class
|
|
25
|
+
* is otherwise unused within the output.
|
|
26
|
+
*/
|
|
27
|
+
const angularStaticsToWrap = new Set([
|
|
28
|
+
'ɵcmp',
|
|
29
|
+
'ɵdir',
|
|
30
|
+
'ɵfac',
|
|
31
|
+
'ɵinj',
|
|
32
|
+
'ɵmod',
|
|
33
|
+
'ɵpipe',
|
|
34
|
+
'ɵprov',
|
|
35
|
+
'INJECTOR_KEY',
|
|
36
|
+
]);
|
|
37
|
+
/**
|
|
38
|
+
* An object map of static fields and related value checks for discovery of Angular generated
|
|
39
|
+
* JIT related static fields.
|
|
40
|
+
*/
|
|
41
|
+
const angularStaticsToElide = {
|
|
42
|
+
'ctorParameters'(path) {
|
|
43
|
+
return path.isFunctionExpression() || path.isArrowFunctionExpression();
|
|
44
|
+
},
|
|
45
|
+
'decorators'(path) {
|
|
46
|
+
return path.isArrayExpression();
|
|
47
|
+
},
|
|
48
|
+
'propDecorators'(path) {
|
|
49
|
+
return path.isObjectExpression();
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Provides one or more keywords that if found within the content of a source file indicate
|
|
54
|
+
* that this plugin should be used with a source file.
|
|
55
|
+
*
|
|
56
|
+
* @returns An a string iterable containing one or more keywords.
|
|
57
|
+
*/
|
|
58
|
+
function getKeywords() {
|
|
59
|
+
return ['class'];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Determines whether a property and its initializer value can be safely wrapped in a pure
|
|
63
|
+
* annotated IIFE. Values that may cause side effects are not considered safe to wrap.
|
|
64
|
+
* Wrapping such values may cause runtime errors and/or incorrect runtime behavior.
|
|
65
|
+
*
|
|
66
|
+
* @param propertyName The name of the property to analyze.
|
|
67
|
+
* @param assignmentValue The initializer value that will be assigned to the property.
|
|
68
|
+
* @returns If the property can be safely wrapped, then true; otherwise, false.
|
|
69
|
+
*/
|
|
70
|
+
function canWrapProperty(propertyName, assignmentValue) {
|
|
71
|
+
if (angularStaticsToWrap.has(propertyName)) {
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
const { leadingComments } = assignmentValue.node;
|
|
75
|
+
if (leadingComments?.some(
|
|
76
|
+
// `@pureOrBreakMyCode` is used by closure and is present in Angular code
|
|
77
|
+
({ value }) => value.includes('@__PURE__') ||
|
|
78
|
+
value.includes('#__PURE__') ||
|
|
79
|
+
value.includes('@pureOrBreakMyCode'))) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
return assignmentValue.isPure();
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Analyze the sibling nodes of a class to determine if any downlevel elements should be
|
|
86
|
+
* wrapped in a pure annotated IIFE. Also determines if any elements have potential side
|
|
87
|
+
* effects.
|
|
88
|
+
*
|
|
89
|
+
* @param origin The starting NodePath location for analyzing siblings.
|
|
90
|
+
* @param classIdentifier The identifier node that represents the name of the class.
|
|
91
|
+
* @param allowWrappingDecorators Whether to allow decorators to be wrapped.
|
|
92
|
+
* @returns An object containing the results of the analysis.
|
|
93
|
+
*/
|
|
94
|
+
function analyzeClassSiblings(origin, classIdentifier, allowWrappingDecorators) {
|
|
95
|
+
const wrapStatementPaths = [];
|
|
96
|
+
let hasPotentialSideEffects = false;
|
|
97
|
+
for (let i = 1;; ++i) {
|
|
98
|
+
const nextStatement = origin.getSibling(+(origin.key ?? 0) + i);
|
|
99
|
+
if (!nextStatement.isExpressionStatement()) {
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
// Valid sibling statements for class declarations are only assignment expressions
|
|
103
|
+
// and TypeScript decorator helper call expressions
|
|
104
|
+
const nextExpression = nextStatement.get('expression');
|
|
105
|
+
if (nextExpression.isCallExpression()) {
|
|
106
|
+
if (!core_1.types.isIdentifier(nextExpression.node.callee) ||
|
|
107
|
+
nextExpression.node.callee.name !== TSLIB_DECORATE_HELPER_NAME) {
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
if (allowWrappingDecorators) {
|
|
111
|
+
wrapStatementPaths.push(nextStatement);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
// Statement cannot be safely wrapped which makes wrapping the class unneeded.
|
|
115
|
+
// The statement will prevent even a wrapped class from being optimized away.
|
|
116
|
+
hasPotentialSideEffects = true;
|
|
117
|
+
}
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
else if (!nextExpression.isAssignmentExpression()) {
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
// Valid assignment expressions should be member access expressions using the class
|
|
124
|
+
// name as the object and an identifier as the property for static fields or only
|
|
125
|
+
// the class name for decorators.
|
|
126
|
+
const left = nextExpression.get('left');
|
|
127
|
+
if (left.isIdentifier()) {
|
|
128
|
+
if (!left.scope.bindingIdentifierEquals(left.node.name, classIdentifier) ||
|
|
129
|
+
!core_1.types.isCallExpression(nextExpression.node.right) ||
|
|
130
|
+
!core_1.types.isIdentifier(nextExpression.node.right.callee) ||
|
|
131
|
+
nextExpression.node.right.callee.name !== TSLIB_DECORATE_HELPER_NAME) {
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
if (allowWrappingDecorators) {
|
|
135
|
+
wrapStatementPaths.push(nextStatement);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
// Statement cannot be safely wrapped which makes wrapping the class unneeded.
|
|
139
|
+
// The statement will prevent even a wrapped class from being optimized away.
|
|
140
|
+
hasPotentialSideEffects = true;
|
|
141
|
+
}
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
else if (!left.isMemberExpression() ||
|
|
145
|
+
!core_1.types.isIdentifier(left.node.object) ||
|
|
146
|
+
!left.scope.bindingIdentifierEquals(left.node.object.name, classIdentifier) ||
|
|
147
|
+
!core_1.types.isIdentifier(left.node.property)) {
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
const propertyName = left.node.property.name;
|
|
151
|
+
const assignmentValue = nextExpression.get('right');
|
|
152
|
+
if (angularStaticsToElide[propertyName]?.(assignmentValue)) {
|
|
153
|
+
nextStatement.remove();
|
|
154
|
+
--i;
|
|
155
|
+
}
|
|
156
|
+
else if (canWrapProperty(propertyName, assignmentValue)) {
|
|
157
|
+
wrapStatementPaths.push(nextStatement);
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
// Statement cannot be safely wrapped which makes wrapping the class unneeded.
|
|
161
|
+
// The statement will prevent even a wrapped class from being optimized away.
|
|
162
|
+
hasPotentialSideEffects = true;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return { hasPotentialSideEffects, wrapStatementPaths };
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* The set of classes already visited and analyzed during the plugin's execution.
|
|
169
|
+
* This is used to prevent adjusted classes from being repeatedly analyzed which can lead
|
|
170
|
+
* to an infinite loop.
|
|
171
|
+
*/
|
|
172
|
+
const visitedClasses = new WeakSet();
|
|
173
|
+
/**
|
|
174
|
+
* A map of classes that have already been analyzed during the default export splitting step.
|
|
175
|
+
* This is used to avoid analyzing a class declaration twice if it is a direct default export.
|
|
176
|
+
*/
|
|
177
|
+
const exportDefaultAnalysis = new WeakMap();
|
|
178
|
+
/**
|
|
179
|
+
* A babel plugin factory function for adjusting classes; primarily with Angular metadata.
|
|
180
|
+
* The adjustments include wrapping classes with known safe or no side effects with pure
|
|
181
|
+
* annotations to support dead code removal of unused classes. Angular compiler generated
|
|
182
|
+
* metadata static fields not required in AOT mode are also elided to better support bundler-
|
|
183
|
+
* level treeshaking.
|
|
184
|
+
*
|
|
185
|
+
* @returns A babel plugin object instance.
|
|
186
|
+
*/
|
|
187
|
+
// eslint-disable-next-line max-lines-per-function
|
|
188
|
+
function default_1() {
|
|
189
|
+
return {
|
|
190
|
+
visitor: {
|
|
191
|
+
// When a class is converted to a variable declaration, the default export must be moved
|
|
192
|
+
// to a subsequent statement to prevent a JavaScript syntax error.
|
|
193
|
+
ExportDefaultDeclaration(path, state) {
|
|
194
|
+
const declaration = path.get('declaration');
|
|
195
|
+
if (!declaration.isClassDeclaration() || !declaration.node.id) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
const { wrapDecorators } = state.opts;
|
|
199
|
+
const analysis = analyzeClassSiblings(path, declaration.node.id, wrapDecorators);
|
|
200
|
+
exportDefaultAnalysis.set(declaration.node, analysis);
|
|
201
|
+
// Splitting the export declaration is not needed if the class will not be wrapped
|
|
202
|
+
if (analysis.hasPotentialSideEffects) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
(0, helper_split_export_declaration_1.default)(path);
|
|
206
|
+
},
|
|
207
|
+
ClassDeclaration(path, state) {
|
|
208
|
+
const { node: classNode, parentPath } = path;
|
|
209
|
+
const { wrapDecorators } = state.opts;
|
|
210
|
+
// Skip if already visited or has no name
|
|
211
|
+
if (visitedClasses.has(classNode) || !classNode.id) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
// Analyze sibling statements for elements of the class that were downleveled
|
|
215
|
+
const origin = parentPath.isExportNamedDeclaration() ? parentPath : path;
|
|
216
|
+
const { wrapStatementPaths, hasPotentialSideEffects } = exportDefaultAnalysis.get(classNode) ??
|
|
217
|
+
analyzeClassSiblings(origin, classNode.id, wrapDecorators);
|
|
218
|
+
visitedClasses.add(classNode);
|
|
219
|
+
// If no statements to wrap, check for static class properties.
|
|
220
|
+
if (hasPotentialSideEffects ||
|
|
221
|
+
(wrapStatementPaths.length === 0 && !analyzeClassStaticProperties(path).shouldWrap)) {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
const wrapStatementNodes = [];
|
|
225
|
+
for (const statementPath of wrapStatementPaths) {
|
|
226
|
+
wrapStatementNodes.push(statementPath.node);
|
|
227
|
+
statementPath.remove();
|
|
228
|
+
}
|
|
229
|
+
// Wrap class and safe static assignments in a pure annotated IIFE
|
|
230
|
+
const container = core_1.types.arrowFunctionExpression([], core_1.types.blockStatement([
|
|
231
|
+
classNode,
|
|
232
|
+
...wrapStatementNodes,
|
|
233
|
+
core_1.types.returnStatement(core_1.types.cloneNode(classNode.id)),
|
|
234
|
+
]));
|
|
235
|
+
const replacementInitializer = core_1.types.callExpression(core_1.types.parenthesizedExpression(container), []);
|
|
236
|
+
(0, helper_annotate_as_pure_1.default)(replacementInitializer);
|
|
237
|
+
// Replace class with IIFE wrapped class
|
|
238
|
+
const declaration = core_1.types.variableDeclaration('let', [
|
|
239
|
+
core_1.types.variableDeclarator(core_1.types.cloneNode(classNode.id), replacementInitializer),
|
|
240
|
+
]);
|
|
241
|
+
path.replaceWith(declaration);
|
|
242
|
+
},
|
|
243
|
+
ClassExpression(path, state) {
|
|
244
|
+
const { node: classNode, parentPath } = path;
|
|
245
|
+
const { wrapDecorators } = state.opts;
|
|
246
|
+
if (visitedClasses.has(classNode)) {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
if (!parentPath.isVariableDeclarator() || !core_1.types.isIdentifier(parentPath.node.id)) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
const origin = parentPath.parentPath;
|
|
253
|
+
if (!origin.isVariableDeclaration() || origin.node.declarations.length !== 1) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
const { wrapStatementPaths, hasPotentialSideEffects } = analyzeClassSiblings(origin, parentPath.node.id, wrapDecorators);
|
|
257
|
+
visitedClasses.add(classNode);
|
|
258
|
+
// If no statements to wrap, check for static class properties.
|
|
259
|
+
if (hasPotentialSideEffects ||
|
|
260
|
+
(wrapStatementPaths.length === 0 && !analyzeClassStaticProperties(path).shouldWrap)) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
const wrapStatementNodes = [];
|
|
264
|
+
for (const statementPath of wrapStatementPaths) {
|
|
265
|
+
wrapStatementNodes.push(statementPath.node);
|
|
266
|
+
statementPath.remove();
|
|
267
|
+
}
|
|
268
|
+
// Wrap class and safe static assignments in a pure annotated IIFE
|
|
269
|
+
const container = core_1.types.arrowFunctionExpression([], core_1.types.blockStatement([
|
|
270
|
+
core_1.types.variableDeclaration('let', [
|
|
271
|
+
core_1.types.variableDeclarator(core_1.types.cloneNode(parentPath.node.id), classNode),
|
|
272
|
+
]),
|
|
273
|
+
...wrapStatementNodes,
|
|
274
|
+
core_1.types.returnStatement(core_1.types.cloneNode(parentPath.node.id)),
|
|
275
|
+
]));
|
|
276
|
+
const replacementInitializer = core_1.types.callExpression(core_1.types.parenthesizedExpression(container), []);
|
|
277
|
+
(0, helper_annotate_as_pure_1.default)(replacementInitializer);
|
|
278
|
+
// Add the wrapped class directly to the variable declaration
|
|
279
|
+
parentPath.get('init').replaceWith(replacementInitializer);
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Static class properties may be downleveled at later stages in the build pipeline
|
|
286
|
+
* which results in additional function calls outside the class body. These calls
|
|
287
|
+
* then cause the class to be referenced and not eligible for removal. Since it is
|
|
288
|
+
* not known at this stage whether the class needs to be downleveled, the transform
|
|
289
|
+
* wraps classes preemptively to allow for potential removal within the optimization stages.
|
|
290
|
+
*/
|
|
291
|
+
function analyzeClassStaticProperties(path) {
|
|
292
|
+
let shouldWrap = false;
|
|
293
|
+
for (const element of path.get('body').get('body')) {
|
|
294
|
+
if (element.isClassProperty()) {
|
|
295
|
+
// Only need to analyze static properties
|
|
296
|
+
if (!element.node.static) {
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
// Check for potential side effects.
|
|
300
|
+
// These checks are conservative and could potentially be expanded in the future.
|
|
301
|
+
const elementKey = element.get('key');
|
|
302
|
+
const elementValue = element.get('value');
|
|
303
|
+
if (elementKey.isIdentifier() &&
|
|
304
|
+
(!elementValue.isExpression() || canWrapProperty(elementKey.node.name, elementValue))) {
|
|
305
|
+
shouldWrap = true;
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
// Not safe to wrap
|
|
309
|
+
shouldWrap = false;
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
else if (element.isStaticBlock()) {
|
|
314
|
+
// Only need to analyze static blocks
|
|
315
|
+
const body = element.get('body');
|
|
316
|
+
if (Array.isArray(body) && body.length > 1) {
|
|
317
|
+
// Not safe to wrap
|
|
318
|
+
shouldWrap = false;
|
|
319
|
+
break;
|
|
320
|
+
}
|
|
321
|
+
const expression = body.find((n) => n.isExpressionStatement());
|
|
322
|
+
const assignmentExpression = expression?.get('expression');
|
|
323
|
+
if (assignmentExpression?.isAssignmentExpression()) {
|
|
324
|
+
const left = assignmentExpression.get('left');
|
|
325
|
+
if (!left.isMemberExpression()) {
|
|
326
|
+
continue;
|
|
327
|
+
}
|
|
328
|
+
if (!left.get('object').isThisExpression()) {
|
|
329
|
+
// Not safe to wrap
|
|
330
|
+
shouldWrap = false;
|
|
331
|
+
break;
|
|
332
|
+
}
|
|
333
|
+
const element = left.get('property');
|
|
334
|
+
const right = assignmentExpression.get('right');
|
|
335
|
+
if (element.isIdentifier() &&
|
|
336
|
+
(!right.isExpression() || canWrapProperty(element.node.name, right))) {
|
|
337
|
+
shouldWrap = true;
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
// Not safe to wrap
|
|
341
|
+
shouldWrap = false;
|
|
342
|
+
break;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
return { shouldWrap };
|
|
348
|
+
}
|
|
349
|
+
//# sourceMappingURL=adjust-static-class-members.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adjust-static-class-members.js","sourceRoot":"","sources":["adjust-static-class-members.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;AAiDH,kCAEC;AAuJD,4BAwIC;AAhVD,sCAAwE;AACxE,6FAA4D;AAC5D,6GAA4E;AAE5E;;GAEG;AACH,MAAM,0BAA0B,GAAG,YAAY,CAAC;AAEhD;;;;GAIG;AACH,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC;IACnC,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,OAAO;IACP,cAAc;CACf,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,qBAAqB,GAAkE;IAC3F,gBAAgB,CAAC,IAAI;QACnB,OAAO,IAAI,CAAC,oBAAoB,EAAE,IAAI,IAAI,CAAC,yBAAyB,EAAE,CAAC;IACzE,CAAC;IACD,YAAY,CAAC,IAAI;QACf,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAClC,CAAC;IACD,gBAAgB,CAAC,IAAI;QACnB,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC;IACnC,CAAC;CACF,CAAC;AAEF;;;;;GAKG;AACH,SAAgB,WAAW;IACzB,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,eAAe,CAAC,YAAoB,EAAE,eAAyB;IACtE,IAAI,oBAAoB,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,EAAE,eAAe,EAAE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AI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,qBAAqB,EAAE,CAAC,CAAC;YAE/D,MAAM,oBAAoB,GAAG,UAAU,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;YAC3D,IAAI,oBAAoB,EAAE,sBAAsB,EAAE,EAAE,CAAC;gBACnD,MAAM,IAAI,GAAG,oBAAoB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;gBAC9C,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,EAAE,CAAC;oBAC/B,SAAS;gBACX,CAAC;gBAED,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,gBAAgB,EAAE,EAAE,CAAC;oBAC3C,mBAAmB;oBACnB,UAAU,GAAG,KAAK,CAAC;oBACnB,MAAM;gBACR,CAAC;gBAED,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;gBACrC,MAAM,KAAK,GAAG,oBAAoB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBAChD,IACE,OAAO,CAAC,YAAY,EAAE;oBACtB,CAAC,CAAC,KAAK,CAAC,YAAY,EAAE,IAAI,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,EACpE,CAAC;oBACD,UAAU,GAAG,IAAI,CAAC;gBACpB,CAAC;qBAAM,CAAC;oBACN,mBAAmB;oBACnB,UAAU,GAAG,KAAK,CAAC;oBACnB,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
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.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import { PluginObject } from '@babel/core';
|
|
9
|
+
/**
|
|
10
|
+
* Provides one or more keywords that if found within the content of a source file indicate
|
|
11
|
+
* that this plugin should be used with a source file.
|
|
12
|
+
*
|
|
13
|
+
* @returns An a string iterable containing one or more keywords.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getKeywords(): Iterable<string>;
|
|
16
|
+
/**
|
|
17
|
+
* A babel plugin factory function for adjusting TypeScript emitted enums.
|
|
18
|
+
*
|
|
19
|
+
* @returns A babel plugin object instance.
|
|
20
|
+
*/
|
|
21
|
+
export default function (): PluginObject;
|
|
@@ -0,0 +1,113 @@
|
|
|
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.dev/license
|
|
8
|
+
*/
|
|
9
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.getKeywords = getKeywords;
|
|
14
|
+
exports.default = default_1;
|
|
15
|
+
const core_1 = require("@babel/core");
|
|
16
|
+
const helper_annotate_as_pure_1 = __importDefault(require("@babel/helper-annotate-as-pure"));
|
|
17
|
+
/**
|
|
18
|
+
* Provides one or more keywords that if found within the content of a source file indicate
|
|
19
|
+
* that this plugin should be used with a source file.
|
|
20
|
+
*
|
|
21
|
+
* @returns An a string iterable containing one or more keywords.
|
|
22
|
+
*/
|
|
23
|
+
function getKeywords() {
|
|
24
|
+
return ['var'];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A babel plugin factory function for adjusting TypeScript emitted enums.
|
|
28
|
+
*
|
|
29
|
+
* @returns A babel plugin object instance.
|
|
30
|
+
*/
|
|
31
|
+
function default_1() {
|
|
32
|
+
return {
|
|
33
|
+
visitor: {
|
|
34
|
+
VariableDeclaration(path) {
|
|
35
|
+
const { parentPath, node } = path;
|
|
36
|
+
if (node.kind !== 'var' || node.declarations.length !== 1) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const declaration = path.get('declarations')[0];
|
|
40
|
+
if (declaration.node.init) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const declarationId = declaration.node.id;
|
|
44
|
+
if (!core_1.types.isIdentifier(declarationId)) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const hasExport = parentPath.isExportNamedDeclaration() || parentPath.isExportDefaultDeclaration();
|
|
48
|
+
const origin = hasExport ? parentPath : path;
|
|
49
|
+
const nextStatement = origin.getSibling(+(origin.key ?? 0) + 1);
|
|
50
|
+
if (!nextStatement.isExpressionStatement()) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const nextExpression = nextStatement.get('expression');
|
|
54
|
+
if (!nextExpression.isCallExpression() || nextExpression.node.arguments.length !== 1) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const enumCallArgument = nextExpression.get('arguments')[0];
|
|
58
|
+
if (!enumCallArgument.isLogicalExpression({ operator: '||' })) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const leftCallArgument = enumCallArgument.get('left');
|
|
62
|
+
const rightCallArgument = enumCallArgument.get('right');
|
|
63
|
+
// Check if identifiers match var declaration
|
|
64
|
+
if (!leftCallArgument.isIdentifier() ||
|
|
65
|
+
!nextExpression.scope.bindingIdentifierEquals(leftCallArgument.node.name, declarationId) ||
|
|
66
|
+
!rightCallArgument.isAssignmentExpression()) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const enumCallee = nextExpression.get('callee');
|
|
70
|
+
if (!enumCallee.isFunctionExpression() || enumCallee.node.params.length !== 1) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const parameterId = enumCallee.get('params')[0];
|
|
74
|
+
if (!parameterId.isIdentifier()) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
// Check if all enum member values are pure.
|
|
78
|
+
// If not, leave as-is due to potential side efects
|
|
79
|
+
let hasElements = false;
|
|
80
|
+
for (const enumStatement of enumCallee.get('body').get('body')) {
|
|
81
|
+
if (!enumStatement.isExpressionStatement()) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const enumValueAssignment = enumStatement.get('expression');
|
|
85
|
+
if (!enumValueAssignment.isAssignmentExpression() ||
|
|
86
|
+
!enumValueAssignment.get('right').isPure()) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
hasElements = true;
|
|
90
|
+
}
|
|
91
|
+
// If there are no enum elements then there is nothing to wrap
|
|
92
|
+
if (!hasElements) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
// Update right-side of initializer call argument to remove redundant assignment
|
|
96
|
+
if (rightCallArgument.get('left').isIdentifier()) {
|
|
97
|
+
rightCallArgument.replaceWith(rightCallArgument.get('right'));
|
|
98
|
+
}
|
|
99
|
+
// Add a return statement to the enum initializer block
|
|
100
|
+
enumCallee
|
|
101
|
+
.get('body')
|
|
102
|
+
.node.body.push(core_1.types.returnStatement(core_1.types.cloneNode(parameterId.node)));
|
|
103
|
+
// Remove existing enum initializer
|
|
104
|
+
const enumInitializer = nextExpression.node;
|
|
105
|
+
nextExpression.remove();
|
|
106
|
+
(0, helper_annotate_as_pure_1.default)(enumInitializer);
|
|
107
|
+
// Add the wrapped enum initializer directly to the variable declaration
|
|
108
|
+
declaration.get('init').replaceWith(enumInitializer);
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=adjust-typescript-enums.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adjust-typescript-enums.js","sourceRoot":"","sources":["adjust-typescript-enums.ts"],"names":[],"mappings":";AA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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.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import type { types as BabelTypes, PluginObject } from '@babel/core';
|
|
9
|
+
/**
|
|
10
|
+
* Provides one or more keywords that if found within the content of a source file indicate
|
|
11
|
+
* that this plugin should be used with a source file.
|
|
12
|
+
*
|
|
13
|
+
* @returns An a string iterable containing one or more keywords.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getKeywords(): Iterable<string>;
|
|
16
|
+
/**
|
|
17
|
+
* A babel plugin factory function for eliding the Angular class metadata function (`ɵsetClassMetadata`).
|
|
18
|
+
*
|
|
19
|
+
* @returns A babel plugin object instance.
|
|
20
|
+
*/
|
|
21
|
+
export default function ({ types: t }: {
|
|
22
|
+
types: typeof BabelTypes;
|
|
23
|
+
}): PluginObject;
|
|
@@ -0,0 +1,110 @@
|
|
|
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.dev/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.getKeywords = getKeywords;
|
|
11
|
+
exports.default = default_1;
|
|
12
|
+
/**
|
|
13
|
+
* The name of the Angular class metadata function created by the Angular compiler.
|
|
14
|
+
*/
|
|
15
|
+
const SET_CLASS_METADATA_NAME = 'ɵsetClassMetadata';
|
|
16
|
+
/**
|
|
17
|
+
* Name of the asynchronous Angular class metadata function created by the Angular compiler.
|
|
18
|
+
*/
|
|
19
|
+
const SET_CLASS_METADATA_ASYNC_NAME = 'ɵsetClassMetadataAsync';
|
|
20
|
+
/**
|
|
21
|
+
* Name of the function that sets debug information on classes.
|
|
22
|
+
*/
|
|
23
|
+
const SET_CLASS_DEBUG_INFO_NAME = 'ɵsetClassDebugInfo';
|
|
24
|
+
/**
|
|
25
|
+
* Provides one or more keywords that if found within the content of a source file indicate
|
|
26
|
+
* that this plugin should be used with a source file.
|
|
27
|
+
*
|
|
28
|
+
* @returns An a string iterable containing one or more keywords.
|
|
29
|
+
*/
|
|
30
|
+
function getKeywords() {
|
|
31
|
+
return Object.keys(angularMetadataFunctions);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* An object map of function names and related value checks for discovery of Angular generated
|
|
35
|
+
* metadata calls.
|
|
36
|
+
*/
|
|
37
|
+
const angularMetadataFunctions = {
|
|
38
|
+
[SET_CLASS_METADATA_NAME]: isSetClassMetadataCall,
|
|
39
|
+
[SET_CLASS_METADATA_ASYNC_NAME]: isSetClassMetadataAsyncCall,
|
|
40
|
+
[SET_CLASS_DEBUG_INFO_NAME]: isSetClassDebugInfoCall,
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* A babel plugin factory function for eliding the Angular class metadata function (`ɵsetClassMetadata`).
|
|
44
|
+
*
|
|
45
|
+
* @returns A babel plugin object instance.
|
|
46
|
+
*/
|
|
47
|
+
function default_1({ types: t }) {
|
|
48
|
+
return {
|
|
49
|
+
visitor: {
|
|
50
|
+
CallExpression(path) {
|
|
51
|
+
const callee = path.get('callee');
|
|
52
|
+
// The function being called must be the metadata function name
|
|
53
|
+
let calleeName;
|
|
54
|
+
if (callee.isMemberExpression()) {
|
|
55
|
+
const calleeProperty = callee.get('property');
|
|
56
|
+
if (calleeProperty.isIdentifier()) {
|
|
57
|
+
calleeName = calleeProperty.node.name;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else if (callee.isIdentifier()) {
|
|
61
|
+
calleeName = callee.node.name;
|
|
62
|
+
}
|
|
63
|
+
if (!calleeName) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (Object.hasOwn(angularMetadataFunctions, calleeName) &&
|
|
67
|
+
angularMetadataFunctions[calleeName](path.get('arguments'))) {
|
|
68
|
+
// The metadata function is always emitted inside a function expression
|
|
69
|
+
const parent = path.getFunctionParent();
|
|
70
|
+
if (parent && (parent.isFunctionExpression() || parent.isArrowFunctionExpression())) {
|
|
71
|
+
// Replace the metadata function with `void 0` which is the equivalent return value
|
|
72
|
+
// of the metadata function.
|
|
73
|
+
path.replaceWith(t.buildUndefinedNode());
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/** Determines if a function call is a call to `setClassMetadata`. */
|
|
81
|
+
function isSetClassMetadataCall(callArguments) {
|
|
82
|
+
// `setClassMetadata` calls have to meet the following criteria:
|
|
83
|
+
// * First must be an identifier
|
|
84
|
+
// * Second must be an array literal
|
|
85
|
+
return (callArguments.length === 4 &&
|
|
86
|
+
callArguments[0].isIdentifier() &&
|
|
87
|
+
callArguments[1].isArrayExpression());
|
|
88
|
+
}
|
|
89
|
+
/** Determines if a function call is a call to `setClassMetadataAsync`. */
|
|
90
|
+
function isSetClassMetadataAsyncCall(callArguments) {
|
|
91
|
+
// `setClassMetadataAsync` calls have to meet the following criteria:
|
|
92
|
+
// * First argument must be an identifier.
|
|
93
|
+
// * Second argument must be an inline function.
|
|
94
|
+
// * Third argument must be an inline function.
|
|
95
|
+
return (callArguments.length === 3 &&
|
|
96
|
+
callArguments[0].isIdentifier() &&
|
|
97
|
+
isInlineFunction(callArguments[1]) &&
|
|
98
|
+
isInlineFunction(callArguments[2]));
|
|
99
|
+
}
|
|
100
|
+
/** Determines if a function call is a call to `setClassDebugInfo`. */
|
|
101
|
+
function isSetClassDebugInfoCall(callArguments) {
|
|
102
|
+
return (callArguments.length === 2 &&
|
|
103
|
+
callArguments[0].isIdentifier() &&
|
|
104
|
+
callArguments[1].isObjectExpression());
|
|
105
|
+
}
|
|
106
|
+
/** Determines if a node is an inline function expression. */
|
|
107
|
+
function isInlineFunction(path) {
|
|
108
|
+
return path.isFunctionExpression() || path.isArrowFunctionExpression();
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=elide-angular-metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elide-angular-metadata.js","sourceRoot":"","sources":["elide-angular-metadata.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAyBH,kCAEC;AAiBD,4BAqCC;AA7ED;;GAEG;AACH,MAAM,uBAAuB,GAAG,mBAAmB,CAAC;AAEpD;;GAEG;AACH,MAAM,6BAA6B,GAAG,wBAAwB,CAAC;AAE/D;;GAEG;AACH,MAAM,yBAAyB,GAAG,oBAAoB,CAAC;AAEvD;;;;;GAKG;AACH,SAAgB,WAAW;IACzB,OAAO,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;AAC/C,CAAC;AAED;;;GAGG;AACH,MAAM,wBAAwB,GAAkD;IAC9E,CAAC,uBAAuB,CAAC,EAAE,sBAAsB;IACjD,CAAC,6BAA6B,CAAC,EAAE,2BAA2B;IAC5D,CAAC,yBAAyB,CAAC,EAAE,uBAAuB;CACrD,CAAC;AAEF;;;;GAIG;AACH,mBAAyB,EAAE,KAAK,EAAE,CAAC,EAAgC;IACjE,OAAO;QACL,OAAO,EAAE;YACP,cAAc,CAAC,IAAyC;gBACtD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;gBAElC,+DAA+D;gBAC/D,IAAI,UAAU,CAAC;gBACf,IAAI,MAAM,CAAC,kBAAkB,EAAE,EAAE,CAAC;oBAChC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;oBAC9C,IAAI,cAAc,CAAC,YAAY,EAAE,EAAE,CAAC;wBAClC,UAAU,GAAG,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC;oBACxC,CAAC;gBACH,CAAC;qBAAM,IAAI,MAAM,CAAC,YAAY,EAAE,EAAE,CAAC;oBACjC,UAAU,GAAG,MAAM,CAAC,IAAI,CAA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B;IACxD,OAAO,CACL,aAAa,CAAC,MAAM,KAAK,CAAC;QAC1B,aAAa,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE;QAC/B,aAAa,CAAC,CAAC,CAAC,CAAC,kBAAkB,EAAE,CACtC,CAAC;AACJ,CAAC;AAED,6DAA6D;AAC7D,SAAS,gBAAgB,CAAC,IAAc;IACtC,OAAO,IAAI,CAAC,oBAAoB,EAAE,IAAI,IAAI,CAAC,yBAAyB,EAAE,CAAC;AACzE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
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.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import type { PluginObject } from '@babel/core';
|
|
9
|
+
/**
|
|
10
|
+
* A babel plugin factory function for adding the PURE annotation to top-level new and call expressions.
|
|
11
|
+
* @returns A babel plugin object instance.
|
|
12
|
+
*/
|
|
13
|
+
export default function (): PluginObject;
|
|
@@ -0,0 +1,128 @@
|
|
|
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.dev/license
|
|
8
|
+
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
+
var ownKeys = function(o) {
|
|
27
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
+
var ar = [];
|
|
29
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
32
|
+
return ownKeys(o);
|
|
33
|
+
};
|
|
34
|
+
return function (mod) {
|
|
35
|
+
if (mod && mod.__esModule) return mod;
|
|
36
|
+
var result = {};
|
|
37
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
+
__setModuleDefault(result, mod);
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
42
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
43
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
44
|
+
};
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.default = default_1;
|
|
47
|
+
const helper_annotate_as_pure_1 = __importDefault(require("@babel/helper-annotate-as-pure"));
|
|
48
|
+
const tslib = __importStar(require("tslib"));
|
|
49
|
+
/**
|
|
50
|
+
* A set of constructor names that are considered to be side-effect free.
|
|
51
|
+
*/
|
|
52
|
+
const sideEffectFreeConstructors = new Set(['InjectionToken']);
|
|
53
|
+
/**
|
|
54
|
+
* A set of TypeScript helper function names used by the helper name matcher utility function.
|
|
55
|
+
*/
|
|
56
|
+
const tslibHelpers = new Set(Object.keys(tslib).filter((h) => h.startsWith('__')));
|
|
57
|
+
/**
|
|
58
|
+
* Determinates whether an identifier name matches one of the TypeScript helper function names.
|
|
59
|
+
*
|
|
60
|
+
* @param name The identifier name to check.
|
|
61
|
+
* @returns True, if the name matches a TypeScript helper name; otherwise, false.
|
|
62
|
+
*/
|
|
63
|
+
function isTslibHelperName(name) {
|
|
64
|
+
const nameParts = name.split('$');
|
|
65
|
+
const originalName = nameParts[0];
|
|
66
|
+
if (nameParts.length > 2 || (nameParts.length === 2 && isNaN(+nameParts[1]))) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
return tslibHelpers.has(originalName);
|
|
70
|
+
}
|
|
71
|
+
const babelHelpers = new Set(['_defineProperty']);
|
|
72
|
+
/**
|
|
73
|
+
* Determinates whether an identifier name matches one of the Babel helper function names.
|
|
74
|
+
*
|
|
75
|
+
* @param name The identifier name to check.
|
|
76
|
+
* @returns True, if the name matches a Babel helper name; otherwise, false.
|
|
77
|
+
*/
|
|
78
|
+
function isBabelHelperName(name) {
|
|
79
|
+
return babelHelpers.has(name);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* A babel plugin factory function for adding the PURE annotation to top-level new and call expressions.
|
|
83
|
+
* @returns A babel plugin object instance.
|
|
84
|
+
*/
|
|
85
|
+
function default_1() {
|
|
86
|
+
return {
|
|
87
|
+
visitor: {
|
|
88
|
+
CallExpression(path, state) {
|
|
89
|
+
const { topLevelSafeMode = false } = state.opts;
|
|
90
|
+
if (topLevelSafeMode) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
// If the expression has a function parent, it is not top-level
|
|
94
|
+
if (path.getFunctionParent()) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const callee = path.get('callee');
|
|
98
|
+
if ((callee.isFunctionExpression() || callee.isArrowFunctionExpression()) &&
|
|
99
|
+
path.node.arguments.length !== 0) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
// Do not annotate TypeScript helpers emitted by the TypeScript compiler or Babel helpers.
|
|
103
|
+
// They are intended to cause side effects.
|
|
104
|
+
if (callee.isIdentifier() &&
|
|
105
|
+
(isTslibHelperName(callee.node.name) || isBabelHelperName(callee.node.name))) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
(0, helper_annotate_as_pure_1.default)(path);
|
|
109
|
+
},
|
|
110
|
+
NewExpression(path, state) {
|
|
111
|
+
// If the expression has a function parent, it is not top-level
|
|
112
|
+
if (path.getFunctionParent()) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const { topLevelSafeMode = false } = state.opts;
|
|
116
|
+
if (!topLevelSafeMode) {
|
|
117
|
+
(0, helper_annotate_as_pure_1.default)(path);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const callee = path.get('callee');
|
|
121
|
+
if (callee.isIdentifier() && sideEffectFreeConstructors.has(callee.node.name)) {
|
|
122
|
+
(0, helper_annotate_as_pure_1.default)(path);
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=pure-toplevel-functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pure-toplevel-functions.js","sourceRoot":"","sources":["pure-toplevel-functions.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDH,4BAsDC;AAxGD,6FAA4D;AAC5D,6CAA+B;AAE/B;;GAEG;AACH,MAAM,0BAA0B,GAAG,IAAI,GAAG,CAAS,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAEvE;;GAEG;AACH,MAAM,YAAY,GAAG,IAAI,GAAG,CAAS,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AA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YAAY,EAAE;oBACrB,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAC5E,CAAC;oBACD,OAAO;gBACT,CAAC;gBAED,IAAA,iCAAc,EAAC,IAAI,CAAC,CAAC;YACvB,CAAC;YACD,aAAa,CAAC,IAAmC,EAAE,KAAyB;gBAC1E,+DAA+D;gBAC/D,IAAI,IAAI,CAAC,iBAAiB,EAAE,EAAE,CAAC;oBAC7B,OAAO;gBACT,CAAC;gBAED,MAAM,EAAE,gBAAgB,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC;gBAEhD,IAAI,CAAC,gBAAgB,EAAE,CAAC;oBACtB,IAAA,iCAAc,EAAC,IAAI,CAAC,CAAC;oBAErB,OAAO;gBACT,CAAC;gBAED,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;gBAClC,IAAI,MAAM,CAAC,YAAY,EAAE,IAAI,0BAA0B,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC9E,IAAA,iCAAc,EAAC,IAAI,CAAC,CAAC;gBACvB,CAAC;YACH,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -18,3 +18,17 @@ declare module 'istanbul-lib-instrument' {
|
|
|
18
18
|
options?: { inputSourceMap?: object | null },
|
|
19
19
|
): Visitor;
|
|
20
20
|
}
|
|
21
|
+
|
|
22
|
+
declare module '@babel/helper-annotate-as-pure' {
|
|
23
|
+
export default function annotateAsPure(
|
|
24
|
+
pathOrNode: import('@babel/types').Node | { node: import('@babel/types').Node },
|
|
25
|
+
): void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
declare module '@babel/helper-split-export-declaration' {
|
|
29
|
+
export default function splitExportDeclaration(
|
|
30
|
+
exportDeclaration: import('@babel/core').NodePath<
|
|
31
|
+
import('@babel/types').ExportDefaultDeclaration
|
|
32
|
+
>,
|
|
33
|
+
): void;
|
|
34
|
+
}
|
|
@@ -154,8 +154,13 @@ function default_1(api, options) {
|
|
|
154
154
|
needRuntimeTransform = true;
|
|
155
155
|
}
|
|
156
156
|
if (options.optimize) {
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
plugins.push([
|
|
158
|
+
require('../plugins/pure-toplevel-functions').default,
|
|
159
|
+
{ topLevelSafeMode: options.optimize.topLevelSafeMode },
|
|
160
|
+
], require('../plugins/elide-angular-metadata').default, require('../plugins/adjust-typescript-enums').default, [
|
|
161
|
+
require('../plugins/adjust-static-class-members').default,
|
|
162
|
+
{ wrapDecorators: options.optimize.wrapDecorators },
|
|
163
|
+
]);
|
|
159
164
|
}
|
|
160
165
|
if (options.instrumentCode) {
|
|
161
166
|
plugins.push(require('../plugins/add-code-coverage').default);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.js","sourceRoot":"","sources":["application.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiJH,4BA6FC;AAED,0CAaC;AApPD,8DAAiC;AACjC,sDAAyB;AACzB,0DAA6B;AAE7B;;GAEG;AACH,IAAI,YAAoF,CAAC;AAiDzF,SAAS,qBAAqB,CAAC,QAAwC;IACrE,MAAM,WAAW,GAAgB,IAAI,CAAC;QAC3B,QAAQ,GAA4B,EAAE,CAAC;QAChD,SAAS,GAAG,KAAK,CAAC;QAElB,GAAG,CAAC,IAAgC,EAAE,OAAe;YACnD,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACtB,OAAO;YACT,CAAC;YAED,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;YACtC,IAAI,CAAC,SAAS,KAAK,IAAI,KAAK,OAAO,CAAC;YACpC,QAAQ,EAAE,CAAC,IAAI,EAAE,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,CAAC,cAAc,EAAE;SACpD,CACF,CAAC;IACJ,CAAC;IAED,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;QAC3B,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,8BAA8B,CAAC,CAAC,OAAO,CAAC,CAAC;IAChE,CAAC;IAED,IAAI,oBAAoB,EAAE,CAAC;QACzB,0DAA0D;QAC1D,OAAO,CAAC,IAAI,CAAC;YACX,OAAO,CAAC,iCAAiC,CAAC,CAAC,OAAO;YAClD;gBACE,OAAO,EAAE,OAAO,CAAC,6BAA6B,CAAC,CAAC,OAAO;gBACvD,eAAe,EAAE,mBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC;aAC9E;SACF,CAAC,CAAC;IACL,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAC9B,CAAC;AAEM,KAAK,UAAU,eAAe,CAAC,IAAY,EAAE,MAAc;IAChE,iEAAiE;IACjE,gDAAgD;IAChD,IAAI,6CAA6C,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC7D,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,MAAM,YAAY,GAAG,wDAAa,8BAA8B,GAAC,CAAC;QAClE,YAAY,GAAG,YAAY,CAAC,YAAY,CAAC;IAC3C,CAAC;IAED,OAAO,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.normalizeCacheOptions = normalizeCacheOptions;
|
|
11
11
|
const node_path_1 = require("node:path");
|
|
12
12
|
/** Version placeholder is replaced during the build process with actual package version */
|
|
13
|
-
const VERSION = '22.2.0-next.
|
|
13
|
+
const VERSION = '22.2.0-next.1';
|
|
14
14
|
function hasCacheMetadata(value) {
|
|
15
15
|
return (!!value &&
|
|
16
16
|
typeof value === 'object' &&
|