@ngrx/store-devtools 21.0.0-beta.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.
Files changed (40) hide show
  1. package/migrations/17_0_0-beta/index.js +66 -68
  2. package/migrations/17_0_0-beta/index.js.map +1 -1
  3. package/migrations/6_0_0/index.js +6 -3
  4. package/migrations/6_0_0/index.js.map +1 -1
  5. package/package.json +2 -2
  6. package/schematics/ng-add/index.js +86 -99
  7. package/schematics/ng-add/index.js.map +1 -1
  8. package/schematics/ng-add/schema.js +2 -0
  9. package/schematics-core/index.js +75 -24
  10. package/schematics-core/index.js.map +1 -1
  11. package/schematics-core/utility/ast-utils.js +234 -260
  12. package/schematics-core/utility/ast-utils.js.map +1 -1
  13. package/schematics-core/utility/change.js +82 -92
  14. package/schematics-core/utility/change.js.map +1 -1
  15. package/schematics-core/utility/config.js +13 -9
  16. package/schematics-core/utility/config.js.map +1 -1
  17. package/schematics-core/utility/find-component.js +35 -30
  18. package/schematics-core/utility/find-component.js.map +1 -1
  19. package/schematics-core/utility/find-module.js +38 -33
  20. package/schematics-core/utility/find-module.js.map +1 -1
  21. package/schematics-core/utility/json-utilts.js +8 -27
  22. package/schematics-core/utility/json-utilts.js.map +1 -1
  23. package/schematics-core/utility/libs-version.js +4 -1
  24. package/schematics-core/utility/libs-version.js.map +1 -1
  25. package/schematics-core/utility/ngrx-utils.js +129 -152
  26. package/schematics-core/utility/ngrx-utils.js.map +1 -1
  27. package/schematics-core/utility/package.js +6 -4
  28. package/schematics-core/utility/package.js.map +1 -1
  29. package/schematics-core/utility/parse-name.js +8 -5
  30. package/schematics-core/utility/parse-name.js.map +1 -1
  31. package/schematics-core/utility/project.js +23 -17
  32. package/schematics-core/utility/project.js.map +1 -1
  33. package/schematics-core/utility/standalone.js +141 -214
  34. package/schematics-core/utility/standalone.js.map +1 -1
  35. package/schematics-core/utility/strings.js +32 -21
  36. package/schematics-core/utility/strings.js.map +1 -1
  37. package/schematics-core/utility/update.js +18 -15
  38. package/schematics-core/utility/update.js.map +1 -1
  39. package/schematics-core/utility/visitors.js +104 -192
  40. package/schematics-core/utility/visitors.js.map +1 -1
@@ -1,45 +1,47 @@
1
- var __values = (this && this.__values) || function(o) {
2
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
3
- if (m) return m.call(o);
4
- if (o && typeof o.length === "number") return {
5
- next: function () {
6
- if (o && i >= o.length) o = void 0;
7
- return { value: o && o[i++], done: !o };
8
- }
9
- };
10
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
11
- };
12
- var __read = (this && this.__read) || function (o, n) {
13
- var m = typeof Symbol === "function" && o[Symbol.iterator];
14
- if (!m) return o;
15
- var i = m.call(o), r, ar = [], e;
16
- try {
17
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
18
- }
19
- catch (error) { e = { error: error }; }
20
- finally {
21
- try {
22
- if (r && !r.done && (m = i["return"])) m.call(i);
23
- }
24
- finally { if (e) throw e.error; }
1
+ "use strict";
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]; } };
25
7
  }
26
- return ar;
27
- };
28
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
29
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
30
- if (ar || !(i in from)) {
31
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
32
- ar[i] = from[i];
33
- }
34
- }
35
- return to.concat(ar || Array.prototype.slice.call(from));
36
- };
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
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.callsProvidersFunction = callsProvidersFunction;
37
+ exports.addFunctionalProvidersToStandaloneBootstrap = addFunctionalProvidersToStandaloneBootstrap;
38
+ exports.findBootstrapApplicationCall = findBootstrapApplicationCall;
37
39
  // copied from https://github.com/angular/angular-cli/blob/17.3.x/packages/schematics/angular/private/standalone.ts
38
- import { SchematicsException, } from '@angular-devkit/schematics';
39
- import { dirname, join } from 'path';
40
- import { insertImport } from './ast-utils';
41
- import { InsertChange } from './change';
42
- import * as ts from 'typescript';
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"));
43
45
  /**
44
46
  * Checks whether a providers function is being called in a `bootstrapApplication` call.
45
47
  * @param tree File tree of the project.
@@ -48,20 +50,18 @@ import * as ts from 'typescript';
48
50
  * @deprecated Private utility that will be removed. Use `addRootImport` or `addRootProvider` from
49
51
  * `@schematics/angular/utility` instead.
50
52
  */
51
- export function callsProvidersFunction(tree, filePath, functionName) {
52
- var sourceFile = createSourceFile(tree, filePath);
53
- var bootstrapCall = findBootstrapApplicationCall(sourceFile);
54
- var appConfig = bootstrapCall
53
+ function callsProvidersFunction(tree, filePath, functionName) {
54
+ const sourceFile = createSourceFile(tree, filePath);
55
+ const bootstrapCall = findBootstrapApplicationCall(sourceFile);
56
+ const appConfig = bootstrapCall
55
57
  ? findAppConfig(bootstrapCall, tree, filePath)
56
58
  : null;
57
- var providersLiteral = appConfig
59
+ const providersLiteral = appConfig
58
60
  ? findProvidersLiteral(appConfig.node)
59
61
  : null;
60
- return !!(providersLiteral === null || providersLiteral === void 0 ? void 0 : providersLiteral.elements.some(function (el) {
61
- return ts.isCallExpression(el) &&
62
- ts.isIdentifier(el.expression) &&
63
- el.expression.text === functionName;
64
- }));
62
+ return !!providersLiteral?.elements.some((el) => ts.isCallExpression(el) &&
63
+ ts.isIdentifier(el.expression) &&
64
+ el.expression.text === functionName);
65
65
  }
66
66
  /**
67
67
  * Adds a providers function call to the `bootstrapApplication` call.
@@ -74,44 +74,43 @@ export function callsProvidersFunction(tree, filePath, functionName) {
74
74
  * @deprecated Private utility that will be removed. Use `addRootImport` or `addRootProvider` from
75
75
  * `@schematics/angular/utility` instead.
76
76
  */
77
- export function addFunctionalProvidersToStandaloneBootstrap(tree, filePath, functionName, importPath, args) {
78
- if (args === void 0) { args = []; }
79
- var sourceFile = createSourceFile(tree, filePath);
80
- var bootstrapCall = findBootstrapApplicationCall(sourceFile);
81
- var addImports = function (file, recorder) {
82
- var change = insertImport(file, file.getText(), functionName, importPath);
83
- if (change instanceof InsertChange) {
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);
82
+ if (change instanceof change_1.InsertChange) {
84
83
  recorder.insertLeft(change.pos, change.toAdd);
85
84
  }
86
85
  };
87
86
  if (!bootstrapCall) {
88
- throw new SchematicsException("Could not find bootstrapApplication call in ".concat(filePath));
87
+ throw new schematics_1.SchematicsException(`Could not find bootstrapApplication call in ${filePath}`);
89
88
  }
90
- var providersCall = ts.factory.createCallExpression(ts.factory.createIdentifier(functionName), undefined, args);
89
+ const providersCall = ts.factory.createCallExpression(ts.factory.createIdentifier(functionName), undefined, args);
91
90
  // If there's only one argument, we have to create a new object literal.
92
91
  if (bootstrapCall.arguments.length === 1) {
93
- var recorder_1 = tree.beginUpdate(filePath);
94
- addNewAppConfigToCall(bootstrapCall, providersCall, recorder_1);
95
- addImports(sourceFile, recorder_1);
96
- tree.commitUpdate(recorder_1);
92
+ const recorder = tree.beginUpdate(filePath);
93
+ addNewAppConfigToCall(bootstrapCall, providersCall, recorder);
94
+ addImports(sourceFile, recorder);
95
+ tree.commitUpdate(recorder);
97
96
  return filePath;
98
97
  }
99
98
  // If the config is a `mergeApplicationProviders` call, add another config to it.
100
99
  if (isMergeAppConfigCall(bootstrapCall.arguments[1])) {
101
- var recorder_2 = tree.beginUpdate(filePath);
102
- addNewAppConfigToCall(bootstrapCall.arguments[1], providersCall, recorder_2);
103
- addImports(sourceFile, recorder_2);
104
- tree.commitUpdate(recorder_2);
100
+ const recorder = tree.beginUpdate(filePath);
101
+ addNewAppConfigToCall(bootstrapCall.arguments[1], providersCall, recorder);
102
+ addImports(sourceFile, recorder);
103
+ tree.commitUpdate(recorder);
105
104
  return filePath;
106
105
  }
107
106
  // Otherwise attempt to merge into the current config.
108
- var appConfig = findAppConfig(bootstrapCall, tree, filePath);
107
+ const appConfig = findAppConfig(bootstrapCall, tree, filePath);
109
108
  if (!appConfig) {
110
- throw new SchematicsException("Could not statically analyze config in bootstrapApplication call in ".concat(filePath));
109
+ throw new schematics_1.SchematicsException(`Could not statically analyze config in bootstrapApplication call in ${filePath}`);
111
110
  }
112
- var configFilePath = appConfig.filePath, config = appConfig.node;
113
- var recorder = tree.beginUpdate(configFilePath);
114
- var providersLiteral = findProvidersLiteral(config);
111
+ const { filePath: configFilePath, node: config } = appConfig;
112
+ const recorder = tree.beginUpdate(configFilePath);
113
+ const providersLiteral = findProvidersLiteral(config);
115
114
  addImports(config.getSourceFile(), recorder);
116
115
  if (providersLiteral) {
117
116
  // If there's a `providers` array, add the import to it.
@@ -129,12 +128,12 @@ export function addFunctionalProvidersToStandaloneBootstrap(tree, filePath, func
129
128
  * @deprecated Private utility that will be removed. Use `addRootImport` or `addRootProvider` from
130
129
  * `@schematics/angular/utility` instead.
131
130
  */
132
- export function findBootstrapApplicationCall(sourceFile) {
133
- var localName = findImportLocalName(sourceFile, 'bootstrapApplication', '@angular/platform-browser');
131
+ function findBootstrapApplicationCall(sourceFile) {
132
+ const localName = findImportLocalName(sourceFile, 'bootstrapApplication', '@angular/platform-browser');
134
133
  if (!localName) {
135
134
  return null;
136
135
  }
137
- var result = null;
136
+ let result = null;
138
137
  sourceFile.forEachChild(function walk(node) {
139
138
  if (ts.isCallExpression(node) &&
140
139
  ts.isIdentifier(node.expression) &&
@@ -149,24 +148,13 @@ export function findBootstrapApplicationCall(sourceFile) {
149
148
  }
150
149
  /** Finds the `providers` array literal within an application config. */
151
150
  function findProvidersLiteral(config) {
152
- var e_1, _a;
153
- try {
154
- for (var _b = __values(config.properties), _c = _b.next(); !_c.done; _c = _b.next()) {
155
- var prop = _c.value;
156
- if (ts.isPropertyAssignment(prop) &&
157
- ts.isIdentifier(prop.name) &&
158
- prop.name.text === 'providers' &&
159
- ts.isArrayLiteralExpression(prop.initializer)) {
160
- return prop.initializer;
161
- }
162
- }
163
- }
164
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
165
- finally {
166
- try {
167
- 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;
168
157
  }
169
- finally { if (e_1) throw e_1.error; }
170
158
  }
171
159
  return null;
172
160
  }
@@ -178,9 +166,9 @@ function findProvidersLiteral(config) {
178
166
  */
179
167
  function findAppConfig(bootstrapCall, tree, filePath) {
180
168
  if (bootstrapCall.arguments.length > 1) {
181
- var config = bootstrapCall.arguments[1];
169
+ const config = bootstrapCall.arguments[1];
182
170
  if (ts.isObjectLiteralExpression(config)) {
183
- return { filePath: filePath, node: config };
171
+ return { filePath, node: config };
184
172
  }
185
173
  if (ts.isIdentifier(config)) {
186
174
  return resolveAppConfigFromIdentifier(config, tree, filePath);
@@ -195,56 +183,34 @@ function findAppConfig(bootstrapCall, tree, filePath) {
195
183
  * @param bootstapFilePath Path of the bootstrap call.
196
184
  */
197
185
  function resolveAppConfigFromIdentifier(identifier, tree, bootstapFilePath) {
198
- var e_2, _a, e_3, _b;
199
- var _c;
200
- var sourceFile = identifier.getSourceFile();
201
- try {
202
- for (var _d = __values(sourceFile.statements), _e = _d.next(); !_e.done; _e = _d.next()) {
203
- var node = _e.value;
204
- // Only look at relative imports. This will break if the app uses a path
205
- // mapping to refer to the import, but in order to resolve those, we would
206
- // need knowledge about the entire program.
207
- if (!ts.isImportDeclaration(node) ||
208
- !((_c = node.importClause) === null || _c === void 0 ? void 0 : _c.namedBindings) ||
209
- !ts.isNamedImports(node.importClause.namedBindings) ||
210
- !ts.isStringLiteralLike(node.moduleSpecifier) ||
211
- !node.moduleSpecifier.text.startsWith('.')) {
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) {
212
200
  continue;
213
201
  }
214
- try {
215
- for (var _f = (e_3 = void 0, __values(node.importClause.namedBindings.elements)), _g = _f.next(); !_g.done; _g = _f.next()) {
216
- var specifier = _g.value;
217
- if (specifier.name.text !== identifier.text) {
218
- continue;
219
- }
220
- // Look for a variable with the imported name in the file. Note that ideally we would use
221
- // the type checker to resolve this, but we can't because these utilities are set up to
222
- // operate on individual files, not the entire program.
223
- var filePath = join(dirname(bootstapFilePath), node.moduleSpecifier.text + '.ts');
224
- var importedSourceFile = createSourceFile(tree, filePath);
225
- var resolvedVariable = findAppConfigFromVariableName(importedSourceFile, (specifier.propertyName || specifier.name).text);
226
- if (resolvedVariable) {
227
- return { filePath: filePath, node: resolvedVariable };
228
- }
229
- }
230
- }
231
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
232
- finally {
233
- try {
234
- if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
235
- }
236
- 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 };
237
210
  }
238
211
  }
239
212
  }
240
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
241
- finally {
242
- try {
243
- if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
244
- }
245
- finally { if (e_2) throw e_2.error; }
246
- }
247
- var variableInSameFile = findAppConfigFromVariableName(sourceFile, identifier.text);
213
+ const variableInSameFile = findAppConfigFromVariableName(sourceFile, identifier.text);
248
214
  return variableInSameFile
249
215
  ? { filePath: bootstapFilePath, node: variableInSameFile }
250
216
  : null;
@@ -255,39 +221,18 @@ function resolveAppConfigFromIdentifier(identifier, tree, bootstapFilePath) {
255
221
  * @param variableName Name of the variable containing the config.
256
222
  */
257
223
  function findAppConfigFromVariableName(sourceFile, variableName) {
258
- var e_4, _a, e_5, _b;
259
- try {
260
- for (var _c = __values(sourceFile.statements), _d = _c.next(); !_d.done; _d = _c.next()) {
261
- var node = _d.value;
262
- if (ts.isVariableStatement(node)) {
263
- try {
264
- for (var _e = (e_5 = void 0, __values(node.declarationList.declarations)), _f = _e.next(); !_f.done; _f = _e.next()) {
265
- var decl = _f.value;
266
- if (ts.isIdentifier(decl.name) &&
267
- decl.name.text === variableName &&
268
- decl.initializer &&
269
- ts.isObjectLiteralExpression(decl.initializer)) {
270
- return decl.initializer;
271
- }
272
- }
273
- }
274
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
275
- finally {
276
- try {
277
- if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
278
- }
279
- 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;
280
232
  }
281
233
  }
282
234
  }
283
235
  }
284
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
285
- finally {
286
- try {
287
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
288
- }
289
- finally { if (e_4) throw e_4.error; }
290
- }
291
236
  return null;
292
237
  }
293
238
  /**
@@ -297,47 +242,26 @@ function findAppConfigFromVariableName(sourceFile, variableName) {
297
242
  * @param moduleName Name of the module from which the symbol is imported.
298
243
  */
299
244
  function findImportLocalName(sourceFile, name, moduleName) {
300
- var e_6, _a, e_7, _b;
301
- try {
302
- for (var _c = __values(sourceFile.statements), _d = _c.next(); !_d.done; _d = _c.next()) {
303
- var node = _d.value;
304
- // Only look for top-level imports.
305
- if (!ts.isImportDeclaration(node) ||
306
- !ts.isStringLiteral(node.moduleSpecifier) ||
307
- node.moduleSpecifier.text !== moduleName) {
308
- continue;
309
- }
310
- // Filter out imports that don't have the right shape.
311
- if (!node.importClause ||
312
- !node.importClause.namedBindings ||
313
- !ts.isNamedImports(node.importClause.namedBindings)) {
314
- continue;
315
- }
316
- try {
317
- // Look through the elements of the declaration for the specific import.
318
- for (var _e = (e_7 = void 0, __values(node.importClause.namedBindings.elements)), _f = _e.next(); !_f.done; _f = _e.next()) {
319
- var element = _f.value;
320
- if ((element.propertyName || element.name).text === name) {
321
- // The local name is always in `name`.
322
- return element.name.text;
323
- }
324
- }
325
- }
326
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
327
- finally {
328
- try {
329
- if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
330
- }
331
- finally { if (e_7) throw e_7.error; }
332
- }
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;
333
251
  }
334
- }
335
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
336
- finally {
337
- try {
338
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
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
+ }
339
264
  }
340
- finally { if (e_6) throw e_6.error; }
341
265
  }
342
266
  return null;
343
267
  }
@@ -352,11 +276,12 @@ function createSourceFile(tree, filePath) {
352
276
  * @param recorder Recorder to which to log the change.
353
277
  */
354
278
  function addNewAppConfigToCall(call, expression, recorder) {
355
- var newCall = ts.factory.updateCallExpression(call, call.expression, call.typeArguments, __spreadArray(__spreadArray([], __read(call.arguments), false), [
279
+ const newCall = ts.factory.updateCallExpression(call, call.expression, call.typeArguments, [
280
+ ...call.arguments,
356
281
  ts.factory.createObjectLiteralExpression([
357
282
  ts.factory.createPropertyAssignment('providers', ts.factory.createArrayLiteralExpression([expression])),
358
283
  ], true),
359
- ], false));
284
+ ]);
360
285
  recorder.remove(call.getStart(), call.getWidth());
361
286
  recorder.insertRight(call.getStart(), ts
362
287
  .createPrinter()
@@ -369,9 +294,10 @@ function addNewAppConfigToCall(call, expression, recorder) {
369
294
  * @param recorder Recorder to which to log the change.
370
295
  */
371
296
  function addElementToArray(node, element, recorder) {
372
- var newLiteral = ts.factory.updateArrayLiteralExpression(node, __spreadArray(__spreadArray([], __read(node.elements), false), [
297
+ const newLiteral = ts.factory.updateArrayLiteralExpression(node, [
298
+ ...node.elements,
373
299
  element,
374
- ], false));
300
+ ]);
375
301
  recorder.remove(node.getStart(), node.getWidth());
376
302
  recorder.insertRight(node.getStart(), ts
377
303
  .createPrinter()
@@ -384,9 +310,10 @@ function addElementToArray(node, element, recorder) {
384
310
  * @param recorder Recorder to which to log the change.
385
311
  */
386
312
  function addProvidersToObjectLiteral(node, expression, recorder) {
387
- var newOptionsLiteral = ts.factory.updateObjectLiteralExpression(node, __spreadArray(__spreadArray([], __read(node.properties), false), [
313
+ const newOptionsLiteral = ts.factory.updateObjectLiteralExpression(node, [
314
+ ...node.properties,
388
315
  ts.factory.createPropertyAssignment('providers', ts.factory.createArrayLiteralExpression([expression])),
389
- ], false));
316
+ ]);
390
317
  recorder.remove(node.getStart(), node.getWidth());
391
318
  recorder.insertRight(node.getStart(), ts
392
319
  .createPrinter()
@@ -397,7 +324,7 @@ function isMergeAppConfigCall(node) {
397
324
  if (!ts.isCallExpression(node)) {
398
325
  return false;
399
326
  }
400
- var localName = findImportLocalName(node.getSourceFile(), 'mergeApplicationConfig', '@angular/core');
327
+ const localName = findImportLocalName(node.getSourceFile(), 'mergeApplicationConfig', '@angular/core');
401
328
  return (!!localName &&
402
329
  ts.isIdentifier(node.expression) &&
403
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mHAAmH;AACnH,OAAO,EACL,mBAAmB,GAGpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAWjC;;;;;;;GAOG;AACH,MAAM,UAAU,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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AAY,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"]}
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,CA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C;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"]}