@ngrx/store-devtools 20.1.0 → 21.0.0-rc.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/fesm2022/ngrx-store-devtools.mjs +13 -13
- package/migrations/17_0_0-beta/index.js +58 -63
- package/migrations/17_0_0-beta/index.js.map +1 -1
- package/migrations/6_0_0/index.js +1 -1
- package/migrations/6_0_0/index.js.map +1 -1
- package/package.json +5 -5
- package/schematics/ng-add/index.js +71 -87
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics-core/index.js +1 -1
- package/schematics-core/index.js.map +1 -1
- package/schematics-core/utility/ast-utils.js +198 -240
- package/schematics-core/utility/ast-utils.js.map +1 -1
- package/schematics-core/utility/change.js +68 -85
- package/schematics-core/utility/change.js.map +1 -1
- package/schematics-core/utility/config.js +7 -7
- package/schematics-core/utility/config.js.map +1 -1
- package/schematics-core/utility/find-component.js +20 -20
- package/schematics-core/utility/find-component.js.map +1 -1
- package/schematics-core/utility/find-module.js +21 -21
- package/schematics-core/utility/find-module.js.map +1 -1
- package/schematics-core/utility/json-utilts.js +4 -26
- package/schematics-core/utility/json-utilts.js.map +1 -1
- package/schematics-core/utility/libs-version.js +1 -1
- package/schematics-core/utility/libs-version.js.map +1 -1
- package/schematics-core/utility/ngrx-utils.js +110 -141
- package/schematics-core/utility/ngrx-utils.js.map +1 -1
- package/schematics-core/utility/package.js +2 -3
- package/schematics-core/utility/package.js.map +1 -1
- package/schematics-core/utility/parse-name.js +3 -3
- package/schematics-core/utility/parse-name.js.map +1 -1
- package/schematics-core/utility/project.js +13 -13
- package/schematics-core/utility/project.js.map +1 -1
- package/schematics-core/utility/standalone.js +133 -211
- package/schematics-core/utility/standalone.js.map +1 -1
- package/schematics-core/utility/strings.js +12 -12
- package/schematics-core/utility/strings.js.map +1 -1
- package/schematics-core/utility/update.js +12 -12
- package/schematics-core/utility/update.js.map +1 -1
- package/schematics-core/utility/visitors.js +78 -180
- package/schematics-core/utility/visitors.js.map +1 -1
- package/types/ngrx-store-devtools.d.ts +252 -0
- package/index.d.ts +0 -6
- package/public_api.d.ts +0 -1
- package/src/actions.d.ts +0 -79
- package/src/config.d.ts +0 -126
- package/src/devtools-dispatcher.d.ts +0 -6
- package/src/devtools.d.ts +0 -35
- package/src/extension.d.ts +0 -52
- package/src/index.d.ts +0 -6
- package/src/instrument.d.ts +0 -9
- package/src/provide-store-devtools.d.ts +0 -26
- package/src/reducer.d.ts +0 -47
- package/src/utils.d.ts +0 -42
- package/src/zone-config.d.ts +0 -9
|
@@ -1,50 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (
|
|
6
|
-
|
|
7
|
-
if (o && i >= o.length) o = void 0;
|
|
8
|
-
return { value: o && o[i++], done: !o };
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
12
|
-
};
|
|
13
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
14
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
15
|
-
if (!m) return o;
|
|
16
|
-
var i = m.call(o), r, ar = [], e;
|
|
17
|
-
try {
|
|
18
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
19
|
-
}
|
|
20
|
-
catch (error) { e = { error: error }; }
|
|
21
|
-
finally {
|
|
22
|
-
try {
|
|
23
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
24
|
-
}
|
|
25
|
-
finally { if (e) throw e.error; }
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
26
7
|
}
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
38
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
36
|
exports.callsProvidersFunction = callsProvidersFunction;
|
|
40
37
|
exports.addFunctionalProvidersToStandaloneBootstrap = addFunctionalProvidersToStandaloneBootstrap;
|
|
41
38
|
exports.findBootstrapApplicationCall = findBootstrapApplicationCall;
|
|
42
39
|
// copied from https://github.com/angular/angular-cli/blob/17.3.x/packages/schematics/angular/private/standalone.ts
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
41
|
+
const path_1 = require("path");
|
|
42
|
+
const ast_utils_1 = require("./ast-utils");
|
|
43
|
+
const change_1 = require("./change");
|
|
44
|
+
const ts = __importStar(require("typescript"));
|
|
48
45
|
/**
|
|
49
46
|
* Checks whether a providers function is being called in a `bootstrapApplication` call.
|
|
50
47
|
* @param tree File tree of the project.
|
|
@@ -54,19 +51,17 @@ var ts = require("typescript");
|
|
|
54
51
|
* `@schematics/angular/utility` instead.
|
|
55
52
|
*/
|
|
56
53
|
function callsProvidersFunction(tree, filePath, functionName) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
54
|
+
const sourceFile = createSourceFile(tree, filePath);
|
|
55
|
+
const bootstrapCall = findBootstrapApplicationCall(sourceFile);
|
|
56
|
+
const appConfig = bootstrapCall
|
|
60
57
|
? findAppConfig(bootstrapCall, tree, filePath)
|
|
61
58
|
: null;
|
|
62
|
-
|
|
59
|
+
const providersLiteral = appConfig
|
|
63
60
|
? findProvidersLiteral(appConfig.node)
|
|
64
61
|
: null;
|
|
65
|
-
return !!
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
el.expression.text === functionName;
|
|
69
|
-
}));
|
|
62
|
+
return !!providersLiteral?.elements.some((el) => ts.isCallExpression(el) &&
|
|
63
|
+
ts.isIdentifier(el.expression) &&
|
|
64
|
+
el.expression.text === functionName);
|
|
70
65
|
}
|
|
71
66
|
/**
|
|
72
67
|
* Adds a providers function call to the `bootstrapApplication` call.
|
|
@@ -79,44 +74,43 @@ function callsProvidersFunction(tree, filePath, functionName) {
|
|
|
79
74
|
* @deprecated Private utility that will be removed. Use `addRootImport` or `addRootProvider` from
|
|
80
75
|
* `@schematics/angular/utility` instead.
|
|
81
76
|
*/
|
|
82
|
-
function addFunctionalProvidersToStandaloneBootstrap(tree, filePath, functionName, importPath, args) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
var change = (0, ast_utils_1.insertImport)(file, file.getText(), functionName, importPath);
|
|
77
|
+
function addFunctionalProvidersToStandaloneBootstrap(tree, filePath, functionName, importPath, args = []) {
|
|
78
|
+
const sourceFile = createSourceFile(tree, filePath);
|
|
79
|
+
const bootstrapCall = findBootstrapApplicationCall(sourceFile);
|
|
80
|
+
const addImports = (file, recorder) => {
|
|
81
|
+
const change = (0, ast_utils_1.insertImport)(file, file.getText(), functionName, importPath);
|
|
88
82
|
if (change instanceof change_1.InsertChange) {
|
|
89
83
|
recorder.insertLeft(change.pos, change.toAdd);
|
|
90
84
|
}
|
|
91
85
|
};
|
|
92
86
|
if (!bootstrapCall) {
|
|
93
|
-
throw new schematics_1.SchematicsException(
|
|
87
|
+
throw new schematics_1.SchematicsException(`Could not find bootstrapApplication call in ${filePath}`);
|
|
94
88
|
}
|
|
95
|
-
|
|
89
|
+
const providersCall = ts.factory.createCallExpression(ts.factory.createIdentifier(functionName), undefined, args);
|
|
96
90
|
// If there's only one argument, we have to create a new object literal.
|
|
97
91
|
if (bootstrapCall.arguments.length === 1) {
|
|
98
|
-
|
|
99
|
-
addNewAppConfigToCall(bootstrapCall, providersCall,
|
|
100
|
-
addImports(sourceFile,
|
|
101
|
-
tree.commitUpdate(
|
|
92
|
+
const recorder = tree.beginUpdate(filePath);
|
|
93
|
+
addNewAppConfigToCall(bootstrapCall, providersCall, recorder);
|
|
94
|
+
addImports(sourceFile, recorder);
|
|
95
|
+
tree.commitUpdate(recorder);
|
|
102
96
|
return filePath;
|
|
103
97
|
}
|
|
104
98
|
// If the config is a `mergeApplicationProviders` call, add another config to it.
|
|
105
99
|
if (isMergeAppConfigCall(bootstrapCall.arguments[1])) {
|
|
106
|
-
|
|
107
|
-
addNewAppConfigToCall(bootstrapCall.arguments[1], providersCall,
|
|
108
|
-
addImports(sourceFile,
|
|
109
|
-
tree.commitUpdate(
|
|
100
|
+
const recorder = tree.beginUpdate(filePath);
|
|
101
|
+
addNewAppConfigToCall(bootstrapCall.arguments[1], providersCall, recorder);
|
|
102
|
+
addImports(sourceFile, recorder);
|
|
103
|
+
tree.commitUpdate(recorder);
|
|
110
104
|
return filePath;
|
|
111
105
|
}
|
|
112
106
|
// Otherwise attempt to merge into the current config.
|
|
113
|
-
|
|
107
|
+
const appConfig = findAppConfig(bootstrapCall, tree, filePath);
|
|
114
108
|
if (!appConfig) {
|
|
115
|
-
throw new schematics_1.SchematicsException(
|
|
109
|
+
throw new schematics_1.SchematicsException(`Could not statically analyze config in bootstrapApplication call in ${filePath}`);
|
|
116
110
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
111
|
+
const { filePath: configFilePath, node: config } = appConfig;
|
|
112
|
+
const recorder = tree.beginUpdate(configFilePath);
|
|
113
|
+
const providersLiteral = findProvidersLiteral(config);
|
|
120
114
|
addImports(config.getSourceFile(), recorder);
|
|
121
115
|
if (providersLiteral) {
|
|
122
116
|
// If there's a `providers` array, add the import to it.
|
|
@@ -135,11 +129,11 @@ function addFunctionalProvidersToStandaloneBootstrap(tree, filePath, functionNam
|
|
|
135
129
|
* `@schematics/angular/utility` instead.
|
|
136
130
|
*/
|
|
137
131
|
function findBootstrapApplicationCall(sourceFile) {
|
|
138
|
-
|
|
132
|
+
const localName = findImportLocalName(sourceFile, 'bootstrapApplication', '@angular/platform-browser');
|
|
139
133
|
if (!localName) {
|
|
140
134
|
return null;
|
|
141
135
|
}
|
|
142
|
-
|
|
136
|
+
let result = null;
|
|
143
137
|
sourceFile.forEachChild(function walk(node) {
|
|
144
138
|
if (ts.isCallExpression(node) &&
|
|
145
139
|
ts.isIdentifier(node.expression) &&
|
|
@@ -154,24 +148,13 @@ function findBootstrapApplicationCall(sourceFile) {
|
|
|
154
148
|
}
|
|
155
149
|
/** Finds the `providers` array literal within an application config. */
|
|
156
150
|
function findProvidersLiteral(config) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
prop.name.text === 'providers' &&
|
|
164
|
-
ts.isArrayLiteralExpression(prop.initializer)) {
|
|
165
|
-
return prop.initializer;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
170
|
-
finally {
|
|
171
|
-
try {
|
|
172
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
151
|
+
for (const prop of config.properties) {
|
|
152
|
+
if (ts.isPropertyAssignment(prop) &&
|
|
153
|
+
ts.isIdentifier(prop.name) &&
|
|
154
|
+
prop.name.text === 'providers' &&
|
|
155
|
+
ts.isArrayLiteralExpression(prop.initializer)) {
|
|
156
|
+
return prop.initializer;
|
|
173
157
|
}
|
|
174
|
-
finally { if (e_1) throw e_1.error; }
|
|
175
158
|
}
|
|
176
159
|
return null;
|
|
177
160
|
}
|
|
@@ -183,9 +166,9 @@ function findProvidersLiteral(config) {
|
|
|
183
166
|
*/
|
|
184
167
|
function findAppConfig(bootstrapCall, tree, filePath) {
|
|
185
168
|
if (bootstrapCall.arguments.length > 1) {
|
|
186
|
-
|
|
169
|
+
const config = bootstrapCall.arguments[1];
|
|
187
170
|
if (ts.isObjectLiteralExpression(config)) {
|
|
188
|
-
return { filePath
|
|
171
|
+
return { filePath, node: config };
|
|
189
172
|
}
|
|
190
173
|
if (ts.isIdentifier(config)) {
|
|
191
174
|
return resolveAppConfigFromIdentifier(config, tree, filePath);
|
|
@@ -200,56 +183,34 @@ function findAppConfig(bootstrapCall, tree, filePath) {
|
|
|
200
183
|
* @param bootstapFilePath Path of the bootstrap call.
|
|
201
184
|
*/
|
|
202
185
|
function resolveAppConfigFromIdentifier(identifier, tree, bootstapFilePath) {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
186
|
+
const sourceFile = identifier.getSourceFile();
|
|
187
|
+
for (const node of sourceFile.statements) {
|
|
188
|
+
// Only look at relative imports. This will break if the app uses a path
|
|
189
|
+
// mapping to refer to the import, but in order to resolve those, we would
|
|
190
|
+
// need knowledge about the entire program.
|
|
191
|
+
if (!ts.isImportDeclaration(node) ||
|
|
192
|
+
!node.importClause?.namedBindings ||
|
|
193
|
+
!ts.isNamedImports(node.importClause.namedBindings) ||
|
|
194
|
+
!ts.isStringLiteralLike(node.moduleSpecifier) ||
|
|
195
|
+
!node.moduleSpecifier.text.startsWith('.')) {
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
for (const specifier of node.importClause.namedBindings.elements) {
|
|
199
|
+
if (specifier.name.text !== identifier.text) {
|
|
217
200
|
continue;
|
|
218
201
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
// operate on individual files, not the entire program.
|
|
228
|
-
var filePath = (0, path_1.join)((0, path_1.dirname)(bootstapFilePath), node.moduleSpecifier.text + '.ts');
|
|
229
|
-
var importedSourceFile = createSourceFile(tree, filePath);
|
|
230
|
-
var resolvedVariable = findAppConfigFromVariableName(importedSourceFile, (specifier.propertyName || specifier.name).text);
|
|
231
|
-
if (resolvedVariable) {
|
|
232
|
-
return { filePath: filePath, node: resolvedVariable };
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
237
|
-
finally {
|
|
238
|
-
try {
|
|
239
|
-
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
240
|
-
}
|
|
241
|
-
finally { if (e_3) throw e_3.error; }
|
|
202
|
+
// Look for a variable with the imported name in the file. Note that ideally we would use
|
|
203
|
+
// the type checker to resolve this, but we can't because these utilities are set up to
|
|
204
|
+
// operate on individual files, not the entire program.
|
|
205
|
+
const filePath = (0, path_1.join)((0, path_1.dirname)(bootstapFilePath), node.moduleSpecifier.text + '.ts');
|
|
206
|
+
const importedSourceFile = createSourceFile(tree, filePath);
|
|
207
|
+
const resolvedVariable = findAppConfigFromVariableName(importedSourceFile, (specifier.propertyName || specifier.name).text);
|
|
208
|
+
if (resolvedVariable) {
|
|
209
|
+
return { filePath, node: resolvedVariable };
|
|
242
210
|
}
|
|
243
211
|
}
|
|
244
212
|
}
|
|
245
|
-
|
|
246
|
-
finally {
|
|
247
|
-
try {
|
|
248
|
-
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
249
|
-
}
|
|
250
|
-
finally { if (e_2) throw e_2.error; }
|
|
251
|
-
}
|
|
252
|
-
var variableInSameFile = findAppConfigFromVariableName(sourceFile, identifier.text);
|
|
213
|
+
const variableInSameFile = findAppConfigFromVariableName(sourceFile, identifier.text);
|
|
253
214
|
return variableInSameFile
|
|
254
215
|
? { filePath: bootstapFilePath, node: variableInSameFile }
|
|
255
216
|
: null;
|
|
@@ -260,39 +221,18 @@ function resolveAppConfigFromIdentifier(identifier, tree, bootstapFilePath) {
|
|
|
260
221
|
* @param variableName Name of the variable containing the config.
|
|
261
222
|
*/
|
|
262
223
|
function findAppConfigFromVariableName(sourceFile, variableName) {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
if (ts.isIdentifier(decl.name) &&
|
|
272
|
-
decl.name.text === variableName &&
|
|
273
|
-
decl.initializer &&
|
|
274
|
-
ts.isObjectLiteralExpression(decl.initializer)) {
|
|
275
|
-
return decl.initializer;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
280
|
-
finally {
|
|
281
|
-
try {
|
|
282
|
-
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
283
|
-
}
|
|
284
|
-
finally { if (e_5) throw e_5.error; }
|
|
224
|
+
for (const node of sourceFile.statements) {
|
|
225
|
+
if (ts.isVariableStatement(node)) {
|
|
226
|
+
for (const decl of node.declarationList.declarations) {
|
|
227
|
+
if (ts.isIdentifier(decl.name) &&
|
|
228
|
+
decl.name.text === variableName &&
|
|
229
|
+
decl.initializer &&
|
|
230
|
+
ts.isObjectLiteralExpression(decl.initializer)) {
|
|
231
|
+
return decl.initializer;
|
|
285
232
|
}
|
|
286
233
|
}
|
|
287
234
|
}
|
|
288
235
|
}
|
|
289
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
290
|
-
finally {
|
|
291
|
-
try {
|
|
292
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
293
|
-
}
|
|
294
|
-
finally { if (e_4) throw e_4.error; }
|
|
295
|
-
}
|
|
296
236
|
return null;
|
|
297
237
|
}
|
|
298
238
|
/**
|
|
@@ -302,47 +242,26 @@ function findAppConfigFromVariableName(sourceFile, variableName) {
|
|
|
302
242
|
* @param moduleName Name of the module from which the symbol is imported.
|
|
303
243
|
*/
|
|
304
244
|
function findImportLocalName(sourceFile, name, moduleName) {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
!ts.isStringLiteral(node.moduleSpecifier) ||
|
|
312
|
-
node.moduleSpecifier.text !== moduleName) {
|
|
313
|
-
continue;
|
|
314
|
-
}
|
|
315
|
-
// Filter out imports that don't have the right shape.
|
|
316
|
-
if (!node.importClause ||
|
|
317
|
-
!node.importClause.namedBindings ||
|
|
318
|
-
!ts.isNamedImports(node.importClause.namedBindings)) {
|
|
319
|
-
continue;
|
|
320
|
-
}
|
|
321
|
-
try {
|
|
322
|
-
// Look through the elements of the declaration for the specific import.
|
|
323
|
-
for (var _e = (e_7 = void 0, __values(node.importClause.namedBindings.elements)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
324
|
-
var element = _f.value;
|
|
325
|
-
if ((element.propertyName || element.name).text === name) {
|
|
326
|
-
// The local name is always in `name`.
|
|
327
|
-
return element.name.text;
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
332
|
-
finally {
|
|
333
|
-
try {
|
|
334
|
-
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
335
|
-
}
|
|
336
|
-
finally { if (e_7) throw e_7.error; }
|
|
337
|
-
}
|
|
245
|
+
for (const node of sourceFile.statements) {
|
|
246
|
+
// Only look for top-level imports.
|
|
247
|
+
if (!ts.isImportDeclaration(node) ||
|
|
248
|
+
!ts.isStringLiteral(node.moduleSpecifier) ||
|
|
249
|
+
node.moduleSpecifier.text !== moduleName) {
|
|
250
|
+
continue;
|
|
338
251
|
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
252
|
+
// Filter out imports that don't have the right shape.
|
|
253
|
+
if (!node.importClause ||
|
|
254
|
+
!node.importClause.namedBindings ||
|
|
255
|
+
!ts.isNamedImports(node.importClause.namedBindings)) {
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
// Look through the elements of the declaration for the specific import.
|
|
259
|
+
for (const element of node.importClause.namedBindings.elements) {
|
|
260
|
+
if ((element.propertyName || element.name).text === name) {
|
|
261
|
+
// The local name is always in `name`.
|
|
262
|
+
return element.name.text;
|
|
263
|
+
}
|
|
344
264
|
}
|
|
345
|
-
finally { if (e_6) throw e_6.error; }
|
|
346
265
|
}
|
|
347
266
|
return null;
|
|
348
267
|
}
|
|
@@ -357,11 +276,12 @@ function createSourceFile(tree, filePath) {
|
|
|
357
276
|
* @param recorder Recorder to which to log the change.
|
|
358
277
|
*/
|
|
359
278
|
function addNewAppConfigToCall(call, expression, recorder) {
|
|
360
|
-
|
|
279
|
+
const newCall = ts.factory.updateCallExpression(call, call.expression, call.typeArguments, [
|
|
280
|
+
...call.arguments,
|
|
361
281
|
ts.factory.createObjectLiteralExpression([
|
|
362
282
|
ts.factory.createPropertyAssignment('providers', ts.factory.createArrayLiteralExpression([expression])),
|
|
363
283
|
], true),
|
|
364
|
-
]
|
|
284
|
+
]);
|
|
365
285
|
recorder.remove(call.getStart(), call.getWidth());
|
|
366
286
|
recorder.insertRight(call.getStart(), ts
|
|
367
287
|
.createPrinter()
|
|
@@ -374,9 +294,10 @@ function addNewAppConfigToCall(call, expression, recorder) {
|
|
|
374
294
|
* @param recorder Recorder to which to log the change.
|
|
375
295
|
*/
|
|
376
296
|
function addElementToArray(node, element, recorder) {
|
|
377
|
-
|
|
297
|
+
const newLiteral = ts.factory.updateArrayLiteralExpression(node, [
|
|
298
|
+
...node.elements,
|
|
378
299
|
element,
|
|
379
|
-
]
|
|
300
|
+
]);
|
|
380
301
|
recorder.remove(node.getStart(), node.getWidth());
|
|
381
302
|
recorder.insertRight(node.getStart(), ts
|
|
382
303
|
.createPrinter()
|
|
@@ -389,9 +310,10 @@ function addElementToArray(node, element, recorder) {
|
|
|
389
310
|
* @param recorder Recorder to which to log the change.
|
|
390
311
|
*/
|
|
391
312
|
function addProvidersToObjectLiteral(node, expression, recorder) {
|
|
392
|
-
|
|
313
|
+
const newOptionsLiteral = ts.factory.updateObjectLiteralExpression(node, [
|
|
314
|
+
...node.properties,
|
|
393
315
|
ts.factory.createPropertyAssignment('providers', ts.factory.createArrayLiteralExpression([expression])),
|
|
394
|
-
]
|
|
316
|
+
]);
|
|
395
317
|
recorder.remove(node.getStart(), node.getWidth());
|
|
396
318
|
recorder.insertRight(node.getStart(), ts
|
|
397
319
|
.createPrinter()
|
|
@@ -402,7 +324,7 @@ function isMergeAppConfigCall(node) {
|
|
|
402
324
|
if (!ts.isCallExpression(node)) {
|
|
403
325
|
return false;
|
|
404
326
|
}
|
|
405
|
-
|
|
327
|
+
const localName = findImportLocalName(node.getSourceFile(), 'mergeApplicationConfig', '@angular/core');
|
|
406
328
|
return (!!localName &&
|
|
407
329
|
ts.isIdentifier(node.expression) &&
|
|
408
330
|
node.expression.text === localName);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standalone.js","sourceRoot":"","sources":["../../../../../modules/store-devtools/schematics-core/utility/standalone.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,wDAoBC;AAaD,kGA2EC;AAOD,oEA8BC;AA7KD,mHAAmH;AACnH,yDAIoC;AACpC,6BAAqC;AACrC,yCAA2C;AAC3C,mCAAwC;AACxC,+BAAiC;AAWjC;;;;;;;GAOG;AACH,SAAgB,sBAAsB,CACpC,IAAU,EACV,QAAgB,EAChB,YAAoB;IAEpB,IAAM,UAAU,GAAG,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACpD,IAAM,aAAa,GAAG,4BAA4B,CAAC,UAAU,CAAC,CAAC;IAC/D,IAAM,SAAS,GAAG,aAAa;QAC7B,CAAC,CAAC,aAAa,CAAC,aAAa,EAAE,IAAI,EAAE,QAAQ,CAAC;QAC9C,CAAC,CAAC,IAAI,CAAC;IACT,IAAM,gBAAgB,GAAG,SAAS;QAChC,CAAC,CAAC,oBAAoB,CAAC,SAAS,CAAC,IAAI,CAAC;QACtC,CAAC,CAAC,IAAI,CAAC;IAET,OAAO,CAAC,CAAC,CAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,QAAQ,CAAC,IAAI,CACtC,UAAC,EAAE;QACD,OAAA,EAAE,CAAC,gBAAgB,CAAC,EAAE,CAAC;YACvB,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC,UAAU,CAAC;YAC9B,EAAE,CAAC,UAAU,CAAC,IAAI,KAAK,YAAY;IAFnC,CAEmC,CACtC,CAAA,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,2CAA2C,CACzD,IAAU,EACV,QAAg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ob/17.3.x/packages/schematics/angular/private/standalone.ts\nimport {\n SchematicsException,\n Tree,\n UpdateRecorder,\n} from '@angular-devkit/schematics';\nimport { dirname, join } from 'path';\nimport { insertImport } from './ast-utils';\nimport { InsertChange } from './change';\nimport * as ts from 'typescript';\n\n/** App config that was resolved to its source node. */\ninterface ResolvedAppConfig {\n /** Tree-relative path of the file containing the app config. */\n filePath: string;\n\n /** Node defining the app config. */\n node: ts.ObjectLiteralExpression;\n}\n\n/**\n * Checks whether a providers function is being called in a `bootstrapApplication` call.\n * @param tree File tree of the project.\n * @param filePath Path of the file in which to check.\n * @param functionName Name of the function to search for.\n * @deprecated Private utility that will be removed. Use `addRootImport` or `addRootProvider` from\n * `@schematics/angular/utility` instead.\n */\nexport function callsProvidersFunction(\n tree: Tree,\n filePath: string,\n functionName: string\n): boolean {\n const sourceFile = createSourceFile(tree, filePath);\n const bootstrapCall = findBootstrapApplicationCall(sourceFile);\n const appConfig = bootstrapCall\n ? findAppConfig(bootstrapCall, tree, filePath)\n : null;\n const providersLiteral = appConfig\n ? findProvidersLiteral(appConfig.node)\n : null;\n\n return !!providersLiteral?.elements.some(\n (el) =>\n ts.isCallExpression(el) &&\n ts.isIdentifier(el.expression) &&\n el.expression.text === functionName\n );\n}\n\n/**\n * Adds a providers function call to the `bootstrapApplication` call.\n * @param tree File tree of the project.\n * @param filePath Path to the file that should be updated.\n * @param functionName Name of the function that should be called.\n * @param importPath Path from which to import the function.\n * @param args Arguments to use when calling the function.\n * @return The file path that the provider was added to.\n * @deprecated Private utility that will be removed. Use `addRootImport` or `addRootProvider` from\n * `@schematics/angular/utility` instead.\n */\nexport function addFunctionalProvidersToStandaloneBootstrap(\n tree: Tree,\n filePath: string,\n functionName: string,\n importPath: string,\n args: ts.Expression[] = []\n): string {\n const sourceFile = createSourceFile(tree, filePath);\n const bootstrapCall = findBootstrapApplicationCall(sourceFile);\n const addImports = (file: ts.SourceFile, recorder: UpdateRecorder) => {\n const change = insertImport(file, file.getText(), functionName, importPath);\n\n if (change instanceof InsertChange) {\n recorder.insertLeft(change.pos, change.toAdd);\n }\n };\n\n if (!bootstrapCall) {\n throw new SchematicsException(\n `Could not find bootstrapApplication call in ${filePath}`\n );\n }\n\n const providersCall = ts.factory.createCallExpression(\n ts.factory.createIdentifier(functionName),\n undefined,\n args\n );\n\n // If there's only one argument, we have to create a new object literal.\n if (bootstrapCall.arguments.length === 1) {\n const recorder = tree.beginUpdate(filePath);\n addNewAppConfigToCall(bootstrapCall, providersCall, recorder);\n addImports(sourceFile, recorder);\n tree.commitUpdate(recorder);\n\n return filePath;\n }\n\n // If the config is a `mergeApplicationProviders` call, add another config to it.\n if (isMergeAppConfigCall(bootstrapCall.arguments[1])) {\n const recorder = tree.beginUpdate(filePath);\n addNewAppConfigToCall(bootstrapCall.arguments[1], providersCall, recorder);\n addImports(sourceFile, recorder);\n tree.commitUpdate(recorder);\n\n return filePath;\n }\n\n // Otherwise attempt to merge into the current config.\n const appConfig = findAppConfig(bootstrapCall, tree, filePath);\n\n if (!appConfig) {\n throw new SchematicsException(\n `Could not statically analyze config in bootstrapApplication call in ${filePath}`\n );\n }\n\n const { filePath: configFilePath, node: config } = appConfig;\n const recorder = tree.beginUpdate(configFilePath);\n const providersLiteral = findProvidersLiteral(config);\n\n addImports(config.getSourceFile(), recorder);\n\n if (providersLiteral) {\n // If there's a `providers` array, add the import to it.\n addElementToArray(providersLiteral, providersCall, recorder);\n } else {\n // Otherwise add a `providers` array to the existing object literal.\n addProvidersToObjectLiteral(config, providersCall, recorder);\n }\n\n tree.commitUpdate(recorder);\n\n return configFilePath;\n}\n\n/**\n * Finds the call to `bootstrapApplication` within a file.\n * @deprecated Private utility that will be removed. Use `addRootImport` or `addRootProvider` from\n * `@schematics/angular/utility` instead.\n */\nexport function findBootstrapApplicationCall(\n sourceFile: ts.SourceFile\n): ts.CallExpression | null {\n const localName = findImportLocalName(\n sourceFile,\n 'bootstrapApplication',\n '@angular/platform-browser'\n );\n\n if (!localName) {\n return null;\n }\n\n let result: ts.CallExpression | null = null;\n\n sourceFile.forEachChild(function walk(node) {\n if (\n ts.isCallExpression(node) &&\n ts.isIdentifier(node.expression) &&\n node.expression.text === localName\n ) {\n result = node;\n }\n\n if (!result) {\n node.forEachChild(walk);\n }\n });\n\n return result;\n}\n\n/** Finds the `providers` array literal within an application config. */\nfunction findProvidersLiteral(\n config: ts.ObjectLiteralExpression\n): ts.ArrayLiteralExpression | null {\n for (const prop of config.properties) {\n if (\n ts.isPropertyAssignment(prop) &&\n ts.isIdentifier(prop.name) &&\n prop.name.text === 'providers' &&\n ts.isArrayLiteralExpression(prop.initializer)\n ) {\n return prop.initializer;\n }\n }\n\n return null;\n}\n\n/**\n * Resolves the node that defines the app config from a bootstrap call.\n * @param bootstrapCall Call for which to resolve the config.\n * @param tree File tree of the project.\n * @param filePath File path of the bootstrap call.\n */\nfunction findAppConfig(\n bootstrapCall: ts.CallExpression,\n tree: Tree,\n filePath: string\n): ResolvedAppConfig | null {\n if (bootstrapCall.arguments.length > 1) {\n const config = bootstrapCall.arguments[1];\n\n if (ts.isObjectLiteralExpression(config)) {\n return { filePath, node: config };\n }\n\n if (ts.isIdentifier(config)) {\n return resolveAppConfigFromIdentifier(config, tree, filePath);\n }\n }\n\n return null;\n}\n\n/**\n * Resolves the app config from an identifier referring to it.\n * @param identifier Identifier referring to the app config.\n * @param tree File tree of the project.\n * @param bootstapFilePath Path of the bootstrap call.\n */\nfunction resolveAppConfigFromIdentifier(\n identifier: ts.Identifier,\n tree: Tree,\n bootstapFilePath: string\n): ResolvedAppConfig | null {\n const sourceFile = identifier.getSourceFile();\n\n for (const node of sourceFile.statements) {\n // Only look at relative imports. This will break if the app uses a path\n // mapping to refer to the import, but in order to resolve those, we would\n // need knowledge about the entire program.\n if (\n !ts.isImportDeclaration(node) ||\n !node.importClause?.namedBindings ||\n !ts.isNamedImports(node.importClause.namedBindings) ||\n !ts.isStringLiteralLike(node.moduleSpecifier) ||\n !node.moduleSpecifier.text.startsWith('.')\n ) {\n continue;\n }\n\n for (const specifier of node.importClause.namedBindings.elements) {\n if (specifier.name.text !== identifier.text) {\n continue;\n }\n\n // Look for a variable with the imported name in the file. Note that ideally we would use\n // the type checker to resolve this, but we can't because these utilities are set up to\n // operate on individual files, not the entire program.\n const filePath = join(\n dirname(bootstapFilePath),\n node.moduleSpecifier.text + '.ts'\n );\n const importedSourceFile = createSourceFile(tree, filePath);\n const resolvedVariable = findAppConfigFromVariableName(\n importedSourceFile,\n (specifier.propertyName || specifier.name).text\n );\n\n if (resolvedVariable) {\n return { filePath, node: resolvedVariable };\n }\n }\n }\n\n const variableInSameFile = findAppConfigFromVariableName(\n sourceFile,\n identifier.text\n );\n\n return variableInSameFile\n ? { filePath: bootstapFilePath, node: variableInSameFile }\n : null;\n}\n\n/**\n * Finds an app config within the top-level variables of a file.\n * @param sourceFile File in which to search for the config.\n * @param variableName Name of the variable containing the config.\n */\nfunction findAppConfigFromVariableName(\n sourceFile: ts.SourceFile,\n variableName: string\n): ts.ObjectLiteralExpression | null {\n for (const node of sourceFile.statements) {\n if (ts.isVariableStatement(node)) {\n for (const decl of node.declarationList.declarations) {\n if (\n ts.isIdentifier(decl.name) &&\n decl.name.text === variableName &&\n decl.initializer &&\n ts.isObjectLiteralExpression(decl.initializer)\n ) {\n return decl.initializer;\n }\n }\n }\n }\n\n return null;\n}\n\n/**\n * Finds the local name of an imported symbol. Could be the symbol name itself or its alias.\n * @param sourceFile File within which to search for the import.\n * @param name Actual name of the import, not its local alias.\n * @param moduleName Name of the module from which the symbol is imported.\n */\nfunction findImportLocalName(\n sourceFile: ts.SourceFile,\n name: string,\n moduleName: string\n): string | null {\n for (const node of sourceFile.statements) {\n // Only look for top-level imports.\n if (\n !ts.isImportDeclaration(node) ||\n !ts.isStringLiteral(node.moduleSpecifier) ||\n node.moduleSpecifier.text !== moduleName\n ) {\n continue;\n }\n\n // Filter out imports that don't have the right shape.\n if (\n !node.importClause ||\n !node.importClause.namedBindings ||\n !ts.isNamedImports(node.importClause.namedBindings)\n ) {\n continue;\n }\n\n // Look through the elements of the declaration for the specific import.\n for (const element of node.importClause.namedBindings.elements) {\n if ((element.propertyName || element.name).text === name) {\n // The local name is always in `name`.\n return element.name.text;\n }\n }\n }\n\n return null;\n}\n\n/** Creates a source file from a file path within a project. */\nfunction createSourceFile(tree: Tree, filePath: string): ts.SourceFile {\n return ts.createSourceFile(\n filePath,\n tree.readText(filePath),\n ts.ScriptTarget.Latest,\n true\n );\n}\n\n/**\n * Creates a new app config object literal and adds it to a call expression as an argument.\n * @param call Call to which to add the config.\n * @param expression Expression that should inserted into the new config.\n * @param recorder Recorder to which to log the change.\n */\nfunction addNewAppConfigToCall(\n call: ts.CallExpression,\n expression: ts.Expression,\n recorder: UpdateRecorder\n): void {\n const newCall = ts.factory.updateCallExpression(\n call,\n call.expression,\n call.typeArguments,\n [\n ...call.arguments,\n ts.factory.createObjectLiteralExpression(\n [\n ts.factory.createPropertyAssignment(\n 'providers',\n ts.factory.createArrayLiteralExpression([expression])\n ),\n ],\n true\n ),\n ]\n );\n\n recorder.remove(call.getStart(), call.getWidth());\n recorder.insertRight(\n call.getStart(),\n ts\n .createPrinter()\n .printNode(ts.EmitHint.Unspecified, newCall, call.getSourceFile())\n );\n}\n\n/**\n * Adds an element to an array literal expression.\n * @param node Array to which to add the element.\n * @param element Element to be added.\n * @param recorder Recorder to which to log the change.\n */\nfunction addElementToArray(\n node: ts.ArrayLiteralExpression,\n element: ts.Expression,\n recorder: UpdateRecorder\n): void {\n const newLiteral = ts.factory.updateArrayLiteralExpression(node, [\n ...node.elements,\n element,\n ]);\n recorder.remove(node.getStart(), node.getWidth());\n recorder.insertRight(\n node.getStart(),\n ts\n .createPrinter()\n .printNode(ts.EmitHint.Unspecified, newLiteral, node.getSourceFile())\n );\n}\n\n/**\n * Adds a `providers` property to an object literal.\n * @param node Literal to which to add the `providers`.\n * @param expression Provider that should be part of the generated `providers` array.\n * @param recorder Recorder to which to log the change.\n */\nfunction addProvidersToObjectLiteral(\n node: ts.ObjectLiteralExpression,\n expression: ts.Expression,\n recorder: UpdateRecorder\n) {\n const newOptionsLiteral = ts.factory.updateObjectLiteralExpression(node, [\n ...node.properties,\n ts.factory.createPropertyAssignment(\n 'providers',\n ts.factory.createArrayLiteralExpression([expression])\n ),\n ]);\n recorder.remove(node.getStart(), node.getWidth());\n recorder.insertRight(\n node.getStart(),\n ts\n .createPrinter()\n .printNode(\n ts.EmitHint.Unspecified,\n newOptionsLiteral,\n node.getSourceFile()\n )\n );\n}\n\n/** Checks whether a node is a call to `mergeApplicationConfig`. */\nfunction isMergeAppConfigCall(node: ts.Node): node is ts.CallExpression {\n if (!ts.isCallExpression(node)) {\n return false;\n }\n\n const localName = findImportLocalName(\n node.getSourceFile(),\n 'mergeApplicationConfig',\n '@angular/core'\n );\n\n return (\n !!localName &&\n ts.isIdentifier(node.expression) &&\n node.expression.text === localName\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"standalone.js","sourceRoot":"","sources":["../../../../../modules/store-devtools/schematics-core/utility/standalone.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,wDAoBC;AAaD,kGA2EC;AAOD,oEA8BC;AA7KD,mHAAmH;AACnH,2DAIoC;AACpC,+BAAqC;AACrC,2CAA2C;AAC3C,qCAAwC;AACxC,+CAAiC;AAWjC;;;;;;;GAOG;AACH,SAAgB,sBAAsB,CACpC,IAAU,EACV,QAAgB,EAChB,YAAoB;IAEpB,MAAM,UAAU,GAAG,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACpD,MAAM,aAAa,GAAG,4BAA4B,CAAC,UAAU,CAAC,CAAC;IAC/D,MAAM,SAAS,GAAG,aAAa;QAC7B,CAAC,CAAC,aAAa,CAAC,aAAa,EAAE,IAAI,EAAE,QAAQ,CAAC;QAC9C,CAAC,CAAC,IAAI,CAAC;IACT,MAAM,gBAAgB,GAAG,SAAS;QAChC,CAAC,CAAC,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ACC,aAAa,EAAE;SACf,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,UAAU,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC,CACxE,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAS,2BAA2B,CAClC,IAAgC,EAChC,UAAyB,EACzB,QAAwB;IAExB,MAAM,iBAAiB,GAAG,EAAE,CAAC,OAAO,CAAC,6BAA6B,CAAC,IAAI,EAAE;QACvE,GAAG,IAAI,CAAC,UAAU;QAClB,EAAE,CAAC,OAAO,CAAC,wBAAwB,CACjC,WAAW,EACX,EAAE,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAAC,UAAU,CAAC,CAAC,CACtD;KACF,CAAC,CAAC;IACH,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IAClD,QAAQ,CAAC,WAAW,CAClB,IAAI,CAAC,QAAQ,EAAE,EACf,EAAE;SACC,aAAa,EAAE;SACf,SAAS,CACR,EAAE,CAAC,QAAQ,CAAC,WAAW,EACvB,iBAAiB,EACjB,IAAI,CAAC,aAAa,EAAE,CACrB,CACJ,CAAC;AACJ,CAAC;AAED,mEAAmE;AACnE,SAAS,oBAAoB,CAAC,IAAa;IACzC,IAAI,CAAC,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,SAAS,GAAG,mBAAmB,CACnC,IAAI,CAAC,aAAa,EAAE,EACpB,wBAAwB,EACxB,eAAe,CAChB,CAAC;IAEF,OAAO,CACL,CAAC,CAAC,SAAS;QACX,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC;QAChC,IAAI,CAAC,UAAU,CAAC,IAAI,KAAK,SAAS,CACnC,CAAC;AACJ,CAAC","sourcesContent":["// copied from https://github.com/angular/angular-cli/blob/17.3.x/packages/schematics/angular/private/standalone.ts\nimport {\n SchematicsException,\n Tree,\n UpdateRecorder,\n} from '@angular-devkit/schematics';\nimport { dirname, join } from 'path';\nimport { insertImport } from './ast-utils';\nimport { InsertChange } from './change';\nimport * as ts from 'typescript';\n\n/** App config that was resolved to its source node. */\ninterface ResolvedAppConfig {\n /** Tree-relative path of the file containing the app config. */\n filePath: string;\n\n /** Node defining the app config. */\n node: ts.ObjectLiteralExpression;\n}\n\n/**\n * Checks whether a providers function is being called in a `bootstrapApplication` call.\n * @param tree File tree of the project.\n * @param filePath Path of the file in which to check.\n * @param functionName Name of the function to search for.\n * @deprecated Private utility that will be removed. Use `addRootImport` or `addRootProvider` from\n * `@schematics/angular/utility` instead.\n */\nexport function callsProvidersFunction(\n tree: Tree,\n filePath: string,\n functionName: string\n): boolean {\n const sourceFile = createSourceFile(tree, filePath);\n const bootstrapCall = findBootstrapApplicationCall(sourceFile);\n const appConfig = bootstrapCall\n ? findAppConfig(bootstrapCall, tree, filePath)\n : null;\n const providersLiteral = appConfig\n ? findProvidersLiteral(appConfig.node)\n : null;\n\n return !!providersLiteral?.elements.some(\n (el) =>\n ts.isCallExpression(el) &&\n ts.isIdentifier(el.expression) &&\n el.expression.text === functionName\n );\n}\n\n/**\n * Adds a providers function call to the `bootstrapApplication` call.\n * @param tree File tree of the project.\n * @param filePath Path to the file that should be updated.\n * @param functionName Name of the function that should be called.\n * @param importPath Path from which to import the function.\n * @param args Arguments to use when calling the function.\n * @return The file path that the provider was added to.\n * @deprecated Private utility that will be removed. Use `addRootImport` or `addRootProvider` from\n * `@schematics/angular/utility` instead.\n */\nexport function addFunctionalProvidersToStandaloneBootstrap(\n tree: Tree,\n filePath: string,\n functionName: string,\n importPath: string,\n args: ts.Expression[] = []\n): string {\n const sourceFile = createSourceFile(tree, filePath);\n const bootstrapCall = findBootstrapApplicationCall(sourceFile);\n const addImports = (file: ts.SourceFile, recorder: UpdateRecorder) => {\n const change = insertImport(file, file.getText(), functionName, importPath);\n\n if (change instanceof InsertChange) {\n recorder.insertLeft(change.pos, change.toAdd);\n }\n };\n\n if (!bootstrapCall) {\n throw new SchematicsException(\n `Could not find bootstrapApplication call in ${filePath}`\n );\n }\n\n const providersCall = ts.factory.createCallExpression(\n ts.factory.createIdentifier(functionName),\n undefined,\n args\n );\n\n // If there's only one argument, we have to create a new object literal.\n if (bootstrapCall.arguments.length === 1) {\n const recorder = tree.beginUpdate(filePath);\n addNewAppConfigToCall(bootstrapCall, providersCall, recorder);\n addImports(sourceFile, recorder);\n tree.commitUpdate(recorder);\n\n return filePath;\n }\n\n // If the config is a `mergeApplicationProviders` call, add another config to it.\n if (isMergeAppConfigCall(bootstrapCall.arguments[1])) {\n const recorder = tree.beginUpdate(filePath);\n addNewAppConfigToCall(bootstrapCall.arguments[1], providersCall, recorder);\n addImports(sourceFile, recorder);\n tree.commitUpdate(recorder);\n\n return filePath;\n }\n\n // Otherwise attempt to merge into the current config.\n const appConfig = findAppConfig(bootstrapCall, tree, filePath);\n\n if (!appConfig) {\n throw new SchematicsException(\n `Could not statically analyze config in bootstrapApplication call in ${filePath}`\n );\n }\n\n const { filePath: configFilePath, node: config } = appConfig;\n const recorder = tree.beginUpdate(configFilePath);\n const providersLiteral = findProvidersLiteral(config);\n\n addImports(config.getSourceFile(), recorder);\n\n if (providersLiteral) {\n // If there's a `providers` array, add the import to it.\n addElementToArray(providersLiteral, providersCall, recorder);\n } else {\n // Otherwise add a `providers` array to the existing object literal.\n addProvidersToObjectLiteral(config, providersCall, recorder);\n }\n\n tree.commitUpdate(recorder);\n\n return configFilePath;\n}\n\n/**\n * Finds the call to `bootstrapApplication` within a file.\n * @deprecated Private utility that will be removed. Use `addRootImport` or `addRootProvider` from\n * `@schematics/angular/utility` instead.\n */\nexport function findBootstrapApplicationCall(\n sourceFile: ts.SourceFile\n): ts.CallExpression | null {\n const localName = findImportLocalName(\n sourceFile,\n 'bootstrapApplication',\n '@angular/platform-browser'\n );\n\n if (!localName) {\n return null;\n }\n\n let result: ts.CallExpression | null = null;\n\n sourceFile.forEachChild(function walk(node) {\n if (\n ts.isCallExpression(node) &&\n ts.isIdentifier(node.expression) &&\n node.expression.text === localName\n ) {\n result = node;\n }\n\n if (!result) {\n node.forEachChild(walk);\n }\n });\n\n return result;\n}\n\n/** Finds the `providers` array literal within an application config. */\nfunction findProvidersLiteral(\n config: ts.ObjectLiteralExpression\n): ts.ArrayLiteralExpression | null {\n for (const prop of config.properties) {\n if (\n ts.isPropertyAssignment(prop) &&\n ts.isIdentifier(prop.name) &&\n prop.name.text === 'providers' &&\n ts.isArrayLiteralExpression(prop.initializer)\n ) {\n return prop.initializer;\n }\n }\n\n return null;\n}\n\n/**\n * Resolves the node that defines the app config from a bootstrap call.\n * @param bootstrapCall Call for which to resolve the config.\n * @param tree File tree of the project.\n * @param filePath File path of the bootstrap call.\n */\nfunction findAppConfig(\n bootstrapCall: ts.CallExpression,\n tree: Tree,\n filePath: string\n): ResolvedAppConfig | null {\n if (bootstrapCall.arguments.length > 1) {\n const config = bootstrapCall.arguments[1];\n\n if (ts.isObjectLiteralExpression(config)) {\n return { filePath, node: config };\n }\n\n if (ts.isIdentifier(config)) {\n return resolveAppConfigFromIdentifier(config, tree, filePath);\n }\n }\n\n return null;\n}\n\n/**\n * Resolves the app config from an identifier referring to it.\n * @param identifier Identifier referring to the app config.\n * @param tree File tree of the project.\n * @param bootstapFilePath Path of the bootstrap call.\n */\nfunction resolveAppConfigFromIdentifier(\n identifier: ts.Identifier,\n tree: Tree,\n bootstapFilePath: string\n): ResolvedAppConfig | null {\n const sourceFile = identifier.getSourceFile();\n\n for (const node of sourceFile.statements) {\n // Only look at relative imports. This will break if the app uses a path\n // mapping to refer to the import, but in order to resolve those, we would\n // need knowledge about the entire program.\n if (\n !ts.isImportDeclaration(node) ||\n !node.importClause?.namedBindings ||\n !ts.isNamedImports(node.importClause.namedBindings) ||\n !ts.isStringLiteralLike(node.moduleSpecifier) ||\n !node.moduleSpecifier.text.startsWith('.')\n ) {\n continue;\n }\n\n for (const specifier of node.importClause.namedBindings.elements) {\n if (specifier.name.text !== identifier.text) {\n continue;\n }\n\n // Look for a variable with the imported name in the file. Note that ideally we would use\n // the type checker to resolve this, but we can't because these utilities are set up to\n // operate on individual files, not the entire program.\n const filePath = join(\n dirname(bootstapFilePath),\n node.moduleSpecifier.text + '.ts'\n );\n const importedSourceFile = createSourceFile(tree, filePath);\n const resolvedVariable = findAppConfigFromVariableName(\n importedSourceFile,\n (specifier.propertyName || specifier.name).text\n );\n\n if (resolvedVariable) {\n return { filePath, node: resolvedVariable };\n }\n }\n }\n\n const variableInSameFile = findAppConfigFromVariableName(\n sourceFile,\n identifier.text\n );\n\n return variableInSameFile\n ? { filePath: bootstapFilePath, node: variableInSameFile }\n : null;\n}\n\n/**\n * Finds an app config within the top-level variables of a file.\n * @param sourceFile File in which to search for the config.\n * @param variableName Name of the variable containing the config.\n */\nfunction findAppConfigFromVariableName(\n sourceFile: ts.SourceFile,\n variableName: string\n): ts.ObjectLiteralExpression | null {\n for (const node of sourceFile.statements) {\n if (ts.isVariableStatement(node)) {\n for (const decl of node.declarationList.declarations) {\n if (\n ts.isIdentifier(decl.name) &&\n decl.name.text === variableName &&\n decl.initializer &&\n ts.isObjectLiteralExpression(decl.initializer)\n ) {\n return decl.initializer;\n }\n }\n }\n }\n\n return null;\n}\n\n/**\n * Finds the local name of an imported symbol. Could be the symbol name itself or its alias.\n * @param sourceFile File within which to search for the import.\n * @param name Actual name of the import, not its local alias.\n * @param moduleName Name of the module from which the symbol is imported.\n */\nfunction findImportLocalName(\n sourceFile: ts.SourceFile,\n name: string,\n moduleName: string\n): string | null {\n for (const node of sourceFile.statements) {\n // Only look for top-level imports.\n if (\n !ts.isImportDeclaration(node) ||\n !ts.isStringLiteral(node.moduleSpecifier) ||\n node.moduleSpecifier.text !== moduleName\n ) {\n continue;\n }\n\n // Filter out imports that don't have the right shape.\n if (\n !node.importClause ||\n !node.importClause.namedBindings ||\n !ts.isNamedImports(node.importClause.namedBindings)\n ) {\n continue;\n }\n\n // Look through the elements of the declaration for the specific import.\n for (const element of node.importClause.namedBindings.elements) {\n if ((element.propertyName || element.name).text === name) {\n // The local name is always in `name`.\n return element.name.text;\n }\n }\n }\n\n return null;\n}\n\n/** Creates a source file from a file path within a project. */\nfunction createSourceFile(tree: Tree, filePath: string): ts.SourceFile {\n return ts.createSourceFile(\n filePath,\n tree.readText(filePath),\n ts.ScriptTarget.Latest,\n true\n );\n}\n\n/**\n * Creates a new app config object literal and adds it to a call expression as an argument.\n * @param call Call to which to add the config.\n * @param expression Expression that should inserted into the new config.\n * @param recorder Recorder to which to log the change.\n */\nfunction addNewAppConfigToCall(\n call: ts.CallExpression,\n expression: ts.Expression,\n recorder: UpdateRecorder\n): void {\n const newCall = ts.factory.updateCallExpression(\n call,\n call.expression,\n call.typeArguments,\n [\n ...call.arguments,\n ts.factory.createObjectLiteralExpression(\n [\n ts.factory.createPropertyAssignment(\n 'providers',\n ts.factory.createArrayLiteralExpression([expression])\n ),\n ],\n true\n ),\n ]\n );\n\n recorder.remove(call.getStart(), call.getWidth());\n recorder.insertRight(\n call.getStart(),\n ts\n .createPrinter()\n .printNode(ts.EmitHint.Unspecified, newCall, call.getSourceFile())\n );\n}\n\n/**\n * Adds an element to an array literal expression.\n * @param node Array to which to add the element.\n * @param element Element to be added.\n * @param recorder Recorder to which to log the change.\n */\nfunction addElementToArray(\n node: ts.ArrayLiteralExpression,\n element: ts.Expression,\n recorder: UpdateRecorder\n): void {\n const newLiteral = ts.factory.updateArrayLiteralExpression(node, [\n ...node.elements,\n element,\n ]);\n recorder.remove(node.getStart(), node.getWidth());\n recorder.insertRight(\n node.getStart(),\n ts\n .createPrinter()\n .printNode(ts.EmitHint.Unspecified, newLiteral, node.getSourceFile())\n );\n}\n\n/**\n * Adds a `providers` property to an object literal.\n * @param node Literal to which to add the `providers`.\n * @param expression Provider that should be part of the generated `providers` array.\n * @param recorder Recorder to which to log the change.\n */\nfunction addProvidersToObjectLiteral(\n node: ts.ObjectLiteralExpression,\n expression: ts.Expression,\n recorder: UpdateRecorder\n) {\n const newOptionsLiteral = ts.factory.updateObjectLiteralExpression(node, [\n ...node.properties,\n ts.factory.createPropertyAssignment(\n 'providers',\n ts.factory.createArrayLiteralExpression([expression])\n ),\n ]);\n recorder.remove(node.getStart(), node.getWidth());\n recorder.insertRight(\n node.getStart(),\n ts\n .createPrinter()\n .printNode(\n ts.EmitHint.Unspecified,\n newOptionsLiteral,\n node.getSourceFile()\n )\n );\n}\n\n/** Checks whether a node is a call to `mergeApplicationConfig`. */\nfunction isMergeAppConfigCall(node: ts.Node): node is ts.CallExpression {\n if (!ts.isCallExpression(node)) {\n return false;\n }\n\n const localName = findImportLocalName(\n node.getSourceFile(),\n 'mergeApplicationConfig',\n '@angular/core'\n );\n\n return (\n !!localName &&\n ts.isIdentifier(node.expression) &&\n node.expression.text === localName\n );\n}\n"]}
|