@ngrx/store-devtools 17.1.1 → 18.0.0-beta.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/esm2022/src/actions.mjs +1 -1
- package/esm2022/src/config.mjs +10 -10
- package/esm2022/src/devtools-dispatcher.mjs +4 -4
- package/esm2022/src/devtools.mjs +4 -4
- package/esm2022/src/extension.mjs +4 -4
- package/esm2022/src/instrument.mjs +5 -5
- package/esm2022/src/provide-store-devtools.mjs +1 -1
- package/esm2022/src/reducer.mjs +1 -1
- package/esm2022/src/utils.mjs +1 -1
- package/fesm2022/ngrx-store-devtools.mjs +823 -980
- package/fesm2022/ngrx-store-devtools.mjs.map +7 -1
- package/migrations/17_0_0-beta/index.js.map +1 -1
- package/package.json +2 -2
- package/schematics/ng-add/index.js +3 -3
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics-core/utility/ast-utils.js.map +1 -1
- package/schematics-core/utility/change.js.map +1 -1
- package/schematics-core/utility/config.js.map +1 -1
- package/schematics-core/utility/find-component.js.map +1 -1
- package/schematics-core/utility/find-module.js.map +1 -1
- 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.map +1 -1
- package/schematics-core/utility/package.js.map +1 -1
- package/schematics-core/utility/project.js.map +1 -1
- package/schematics-core/utility/standalone.js +406 -7
- package/schematics-core/utility/standalone.js.map +1 -1
- package/schematics-core/utility/strings.js.map +1 -1
- package/schematics-core/utility/update.js.map +1 -1
- package/schematics-core/utility/visitors.js.map +1 -1
- package/src/utils.d.ts +1 -1
|
@@ -1,12 +1,411 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __values = (this && this.__values) || function(o) {
|
|
3
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
4
|
+
if (m) return m.call(o);
|
|
5
|
+
if (o && typeof o.length === "number") return {
|
|
6
|
+
next: function () {
|
|
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; }
|
|
26
|
+
}
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
30
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
31
|
+
if (ar || !(i in from)) {
|
|
32
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
33
|
+
ar[i] = from[i];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
37
|
+
};
|
|
2
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
39
|
+
exports.findBootstrapApplicationCall = exports.addFunctionalProvidersToStandaloneBootstrap = exports.callsProvidersFunction = void 0;
|
|
40
|
+
// copied from https://github.com/angular/angular-cli/blob/17.3.x/packages/schematics/angular/private/standalone.ts
|
|
41
|
+
var schematics_1 = require("@angular-devkit/schematics");
|
|
42
|
+
var path_1 = require("path");
|
|
43
|
+
var ast_utils_1 = require("./ast-utils");
|
|
44
|
+
var change_1 = require("./change");
|
|
4
45
|
var ts = require("typescript");
|
|
5
|
-
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Checks whether a providers function is being called in a `bootstrapApplication` call.
|
|
48
|
+
* @param tree File tree of the project.
|
|
49
|
+
* @param filePath Path of the file in which to check.
|
|
50
|
+
* @param functionName Name of the function to search for.
|
|
51
|
+
* @deprecated Private utility that will be removed. Use `addRootImport` or `addRootProvider` from
|
|
52
|
+
* `@schematics/angular/utility` instead.
|
|
53
|
+
*/
|
|
54
|
+
function callsProvidersFunction(tree, filePath, functionName) {
|
|
55
|
+
var sourceFile = createSourceFile(tree, filePath);
|
|
56
|
+
var bootstrapCall = findBootstrapApplicationCall(sourceFile);
|
|
57
|
+
var appConfig = bootstrapCall
|
|
58
|
+
? findAppConfig(bootstrapCall, tree, filePath)
|
|
59
|
+
: null;
|
|
60
|
+
var providersLiteral = appConfig
|
|
61
|
+
? findProvidersLiteral(appConfig.node)
|
|
62
|
+
: null;
|
|
63
|
+
return !!(providersLiteral === null || providersLiteral === void 0 ? void 0 : providersLiteral.elements.some(function (el) {
|
|
64
|
+
return ts.isCallExpression(el) &&
|
|
65
|
+
ts.isIdentifier(el.expression) &&
|
|
66
|
+
el.expression.text === functionName;
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
exports.callsProvidersFunction = callsProvidersFunction;
|
|
70
|
+
/**
|
|
71
|
+
* Adds a providers function call to the `bootstrapApplication` call.
|
|
72
|
+
* @param tree File tree of the project.
|
|
73
|
+
* @param filePath Path to the file that should be updated.
|
|
74
|
+
* @param functionName Name of the function that should be called.
|
|
75
|
+
* @param importPath Path from which to import the function.
|
|
76
|
+
* @param args Arguments to use when calling the function.
|
|
77
|
+
* @return The file path that the provider was added to.
|
|
78
|
+
* @deprecated Private utility that will be removed. Use `addRootImport` or `addRootProvider` from
|
|
79
|
+
* `@schematics/angular/utility` instead.
|
|
80
|
+
*/
|
|
81
|
+
function addFunctionalProvidersToStandaloneBootstrap(tree, filePath, functionName, importPath, args) {
|
|
82
|
+
if (args === void 0) { args = []; }
|
|
83
|
+
var sourceFile = createSourceFile(tree, filePath);
|
|
84
|
+
var bootstrapCall = findBootstrapApplicationCall(sourceFile);
|
|
85
|
+
var addImports = function (file, recorder) {
|
|
86
|
+
var change = (0, ast_utils_1.insertImport)(file, file.getText(), functionName, importPath);
|
|
87
|
+
if (change instanceof change_1.InsertChange) {
|
|
88
|
+
recorder.insertLeft(change.pos, change.toAdd);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
if (!bootstrapCall) {
|
|
92
|
+
throw new schematics_1.SchematicsException("Could not find bootstrapApplication call in ".concat(filePath));
|
|
93
|
+
}
|
|
94
|
+
var providersCall = ts.factory.createCallExpression(ts.factory.createIdentifier(functionName), undefined, args);
|
|
95
|
+
// If there's only one argument, we have to create a new object literal.
|
|
96
|
+
if (bootstrapCall.arguments.length === 1) {
|
|
97
|
+
var recorder_1 = tree.beginUpdate(filePath);
|
|
98
|
+
addNewAppConfigToCall(bootstrapCall, providersCall, recorder_1);
|
|
99
|
+
addImports(sourceFile, recorder_1);
|
|
100
|
+
tree.commitUpdate(recorder_1);
|
|
101
|
+
return filePath;
|
|
102
|
+
}
|
|
103
|
+
// If the config is a `mergeApplicationProviders` call, add another config to it.
|
|
104
|
+
if (isMergeAppConfigCall(bootstrapCall.arguments[1])) {
|
|
105
|
+
var recorder_2 = tree.beginUpdate(filePath);
|
|
106
|
+
addNewAppConfigToCall(bootstrapCall.arguments[1], providersCall, recorder_2);
|
|
107
|
+
addImports(sourceFile, recorder_2);
|
|
108
|
+
tree.commitUpdate(recorder_2);
|
|
109
|
+
return filePath;
|
|
110
|
+
}
|
|
111
|
+
// Otherwise attempt to merge into the current config.
|
|
112
|
+
var appConfig = findAppConfig(bootstrapCall, tree, filePath);
|
|
113
|
+
if (!appConfig) {
|
|
114
|
+
throw new schematics_1.SchematicsException("Could not statically analyze config in bootstrapApplication call in ".concat(filePath));
|
|
115
|
+
}
|
|
116
|
+
var configFilePath = appConfig.filePath, config = appConfig.node;
|
|
117
|
+
var recorder = tree.beginUpdate(configFilePath);
|
|
118
|
+
var providersLiteral = findProvidersLiteral(config);
|
|
119
|
+
addImports(config.getSourceFile(), recorder);
|
|
120
|
+
if (providersLiteral) {
|
|
121
|
+
// If there's a `providers` array, add the import to it.
|
|
122
|
+
addElementToArray(providersLiteral, providersCall, recorder);
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
// Otherwise add a `providers` array to the existing object literal.
|
|
126
|
+
addProvidersToObjectLiteral(config, providersCall, recorder);
|
|
127
|
+
}
|
|
128
|
+
tree.commitUpdate(recorder);
|
|
129
|
+
return configFilePath;
|
|
130
|
+
}
|
|
131
|
+
exports.addFunctionalProvidersToStandaloneBootstrap = addFunctionalProvidersToStandaloneBootstrap;
|
|
132
|
+
/**
|
|
133
|
+
* Finds the call to `bootstrapApplication` within a file.
|
|
134
|
+
* @deprecated Private utility that will be removed. Use `addRootImport` or `addRootProvider` from
|
|
135
|
+
* `@schematics/angular/utility` instead.
|
|
136
|
+
*/
|
|
137
|
+
function findBootstrapApplicationCall(sourceFile) {
|
|
138
|
+
var localName = findImportLocalName(sourceFile, 'bootstrapApplication', '@angular/platform-browser');
|
|
139
|
+
if (!localName) {
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
var result = null;
|
|
143
|
+
sourceFile.forEachChild(function walk(node) {
|
|
144
|
+
if (ts.isCallExpression(node) &&
|
|
145
|
+
ts.isIdentifier(node.expression) &&
|
|
146
|
+
node.expression.text === localName) {
|
|
147
|
+
result = node;
|
|
148
|
+
}
|
|
149
|
+
if (!result) {
|
|
150
|
+
node.forEachChild(walk);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
return result;
|
|
154
|
+
}
|
|
155
|
+
exports.findBootstrapApplicationCall = findBootstrapApplicationCall;
|
|
156
|
+
/** Finds the `providers` array literal within an application config. */
|
|
157
|
+
function findProvidersLiteral(config) {
|
|
158
|
+
var e_1, _a;
|
|
159
|
+
try {
|
|
160
|
+
for (var _b = __values(config.properties), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
161
|
+
var prop = _c.value;
|
|
162
|
+
if (ts.isPropertyAssignment(prop) &&
|
|
163
|
+
ts.isIdentifier(prop.name) &&
|
|
164
|
+
prop.name.text === 'providers' &&
|
|
165
|
+
ts.isArrayLiteralExpression(prop.initializer)) {
|
|
166
|
+
return prop.initializer;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
171
|
+
finally {
|
|
172
|
+
try {
|
|
173
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
174
|
+
}
|
|
175
|
+
finally { if (e_1) throw e_1.error; }
|
|
176
|
+
}
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Resolves the node that defines the app config from a bootstrap call.
|
|
181
|
+
* @param bootstrapCall Call for which to resolve the config.
|
|
182
|
+
* @param tree File tree of the project.
|
|
183
|
+
* @param filePath File path of the bootstrap call.
|
|
184
|
+
*/
|
|
185
|
+
function findAppConfig(bootstrapCall, tree, filePath) {
|
|
186
|
+
if (bootstrapCall.arguments.length > 1) {
|
|
187
|
+
var config = bootstrapCall.arguments[1];
|
|
188
|
+
if (ts.isObjectLiteralExpression(config)) {
|
|
189
|
+
return { filePath: filePath, node: config };
|
|
190
|
+
}
|
|
191
|
+
if (ts.isIdentifier(config)) {
|
|
192
|
+
return resolveAppConfigFromIdentifier(config, tree, filePath);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Resolves the app config from an identifier referring to it.
|
|
199
|
+
* @param identifier Identifier referring to the app config.
|
|
200
|
+
* @param tree File tree of the project.
|
|
201
|
+
* @param bootstapFilePath Path of the bootstrap call.
|
|
202
|
+
*/
|
|
203
|
+
function resolveAppConfigFromIdentifier(identifier, tree, bootstapFilePath) {
|
|
204
|
+
var e_2, _a, e_3, _b;
|
|
205
|
+
var _c;
|
|
206
|
+
var sourceFile = identifier.getSourceFile();
|
|
207
|
+
try {
|
|
208
|
+
for (var _d = __values(sourceFile.statements), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
209
|
+
var node = _e.value;
|
|
210
|
+
// Only look at relative imports. This will break if the app uses a path
|
|
211
|
+
// mapping to refer to the import, but in order to resolve those, we would
|
|
212
|
+
// need knowledge about the entire program.
|
|
213
|
+
if (!ts.isImportDeclaration(node) ||
|
|
214
|
+
!((_c = node.importClause) === null || _c === void 0 ? void 0 : _c.namedBindings) ||
|
|
215
|
+
!ts.isNamedImports(node.importClause.namedBindings) ||
|
|
216
|
+
!ts.isStringLiteralLike(node.moduleSpecifier) ||
|
|
217
|
+
!node.moduleSpecifier.text.startsWith('.')) {
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
try {
|
|
221
|
+
for (var _f = (e_3 = void 0, __values(node.importClause.namedBindings.elements)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
222
|
+
var specifier = _g.value;
|
|
223
|
+
if (specifier.name.text !== identifier.text) {
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
// Look for a variable with the imported name in the file. Note that ideally we would use
|
|
227
|
+
// the type checker to resolve this, but we can't because these utilities are set up to
|
|
228
|
+
// operate on individual files, not the entire program.
|
|
229
|
+
var filePath = (0, path_1.join)((0, path_1.dirname)(bootstapFilePath), node.moduleSpecifier.text + '.ts');
|
|
230
|
+
var importedSourceFile = createSourceFile(tree, filePath);
|
|
231
|
+
var resolvedVariable = findAppConfigFromVariableName(importedSourceFile, (specifier.propertyName || specifier.name).text);
|
|
232
|
+
if (resolvedVariable) {
|
|
233
|
+
return { filePath: filePath, node: resolvedVariable };
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
238
|
+
finally {
|
|
239
|
+
try {
|
|
240
|
+
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
241
|
+
}
|
|
242
|
+
finally { if (e_3) throw e_3.error; }
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
247
|
+
finally {
|
|
248
|
+
try {
|
|
249
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
250
|
+
}
|
|
251
|
+
finally { if (e_2) throw e_2.error; }
|
|
252
|
+
}
|
|
253
|
+
var variableInSameFile = findAppConfigFromVariableName(sourceFile, identifier.text);
|
|
254
|
+
return variableInSameFile
|
|
255
|
+
? { filePath: bootstapFilePath, node: variableInSameFile }
|
|
256
|
+
: null;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Finds an app config within the top-level variables of a file.
|
|
260
|
+
* @param sourceFile File in which to search for the config.
|
|
261
|
+
* @param variableName Name of the variable containing the config.
|
|
262
|
+
*/
|
|
263
|
+
function findAppConfigFromVariableName(sourceFile, variableName) {
|
|
264
|
+
var e_4, _a, e_5, _b;
|
|
265
|
+
try {
|
|
266
|
+
for (var _c = __values(sourceFile.statements), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
267
|
+
var node = _d.value;
|
|
268
|
+
if (ts.isVariableStatement(node)) {
|
|
269
|
+
try {
|
|
270
|
+
for (var _e = (e_5 = void 0, __values(node.declarationList.declarations)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
271
|
+
var decl = _f.value;
|
|
272
|
+
if (ts.isIdentifier(decl.name) &&
|
|
273
|
+
decl.name.text === variableName &&
|
|
274
|
+
decl.initializer &&
|
|
275
|
+
ts.isObjectLiteralExpression(decl.initializer)) {
|
|
276
|
+
return decl.initializer;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
281
|
+
finally {
|
|
282
|
+
try {
|
|
283
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
284
|
+
}
|
|
285
|
+
finally { if (e_5) throw e_5.error; }
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
291
|
+
finally {
|
|
292
|
+
try {
|
|
293
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
294
|
+
}
|
|
295
|
+
finally { if (e_4) throw e_4.error; }
|
|
296
|
+
}
|
|
297
|
+
return null;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Finds the local name of an imported symbol. Could be the symbol name itself or its alias.
|
|
301
|
+
* @param sourceFile File within which to search for the import.
|
|
302
|
+
* @param name Actual name of the import, not its local alias.
|
|
303
|
+
* @param moduleName Name of the module from which the symbol is imported.
|
|
304
|
+
*/
|
|
305
|
+
function findImportLocalName(sourceFile, name, moduleName) {
|
|
306
|
+
var e_6, _a, e_7, _b;
|
|
307
|
+
try {
|
|
308
|
+
for (var _c = __values(sourceFile.statements), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
309
|
+
var node = _d.value;
|
|
310
|
+
// Only look for top-level imports.
|
|
311
|
+
if (!ts.isImportDeclaration(node) ||
|
|
312
|
+
!ts.isStringLiteral(node.moduleSpecifier) ||
|
|
313
|
+
node.moduleSpecifier.text !== moduleName) {
|
|
314
|
+
continue;
|
|
315
|
+
}
|
|
316
|
+
// Filter out imports that don't have the right shape.
|
|
317
|
+
if (!node.importClause ||
|
|
318
|
+
!node.importClause.namedBindings ||
|
|
319
|
+
!ts.isNamedImports(node.importClause.namedBindings)) {
|
|
320
|
+
continue;
|
|
321
|
+
}
|
|
322
|
+
try {
|
|
323
|
+
// Look through the elements of the declaration for the specific import.
|
|
324
|
+
for (var _e = (e_7 = void 0, __values(node.importClause.namedBindings.elements)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
325
|
+
var element = _f.value;
|
|
326
|
+
if ((element.propertyName || element.name).text === name) {
|
|
327
|
+
// The local name is always in `name`.
|
|
328
|
+
return element.name.text;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
333
|
+
finally {
|
|
334
|
+
try {
|
|
335
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
336
|
+
}
|
|
337
|
+
finally { if (e_7) throw e_7.error; }
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
342
|
+
finally {
|
|
343
|
+
try {
|
|
344
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
345
|
+
}
|
|
346
|
+
finally { if (e_6) throw e_6.error; }
|
|
347
|
+
}
|
|
348
|
+
return null;
|
|
349
|
+
}
|
|
350
|
+
/** Creates a source file from a file path within a project. */
|
|
351
|
+
function createSourceFile(tree, filePath) {
|
|
352
|
+
return ts.createSourceFile(filePath, tree.readText(filePath), ts.ScriptTarget.Latest, true);
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Creates a new app config object literal and adds it to a call expression as an argument.
|
|
356
|
+
* @param call Call to which to add the config.
|
|
357
|
+
* @param expression Expression that should inserted into the new config.
|
|
358
|
+
* @param recorder Recorder to which to log the change.
|
|
359
|
+
*/
|
|
360
|
+
function addNewAppConfigToCall(call, expression, recorder) {
|
|
361
|
+
var newCall = ts.factory.updateCallExpression(call, call.expression, call.typeArguments, __spreadArray(__spreadArray([], __read(call.arguments), false), [
|
|
362
|
+
ts.factory.createObjectLiteralExpression([
|
|
363
|
+
ts.factory.createPropertyAssignment('providers', ts.factory.createArrayLiteralExpression([expression])),
|
|
364
|
+
], true),
|
|
365
|
+
], false));
|
|
366
|
+
recorder.remove(call.getStart(), call.getWidth());
|
|
367
|
+
recorder.insertRight(call.getStart(), ts
|
|
368
|
+
.createPrinter()
|
|
369
|
+
.printNode(ts.EmitHint.Unspecified, newCall, call.getSourceFile()));
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Adds an element to an array literal expression.
|
|
373
|
+
* @param node Array to which to add the element.
|
|
374
|
+
* @param element Element to be added.
|
|
375
|
+
* @param recorder Recorder to which to log the change.
|
|
376
|
+
*/
|
|
377
|
+
function addElementToArray(node, element, recorder) {
|
|
378
|
+
var newLiteral = ts.factory.updateArrayLiteralExpression(node, __spreadArray(__spreadArray([], __read(node.elements), false), [
|
|
379
|
+
element,
|
|
380
|
+
], false));
|
|
381
|
+
recorder.remove(node.getStart(), node.getWidth());
|
|
382
|
+
recorder.insertRight(node.getStart(), ts
|
|
383
|
+
.createPrinter()
|
|
384
|
+
.printNode(ts.EmitHint.Unspecified, newLiteral, node.getSourceFile()));
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Adds a `providers` property to an object literal.
|
|
388
|
+
* @param node Literal to which to add the `providers`.
|
|
389
|
+
* @param expression Provider that should be part of the generated `providers` array.
|
|
390
|
+
* @param recorder Recorder to which to log the change.
|
|
391
|
+
*/
|
|
392
|
+
function addProvidersToObjectLiteral(node, expression, recorder) {
|
|
393
|
+
var newOptionsLiteral = ts.factory.updateObjectLiteralExpression(node, __spreadArray(__spreadArray([], __read(node.properties), false), [
|
|
394
|
+
ts.factory.createPropertyAssignment('providers', ts.factory.createArrayLiteralExpression([expression])),
|
|
395
|
+
], false));
|
|
396
|
+
recorder.remove(node.getStart(), node.getWidth());
|
|
397
|
+
recorder.insertRight(node.getStart(), ts
|
|
398
|
+
.createPrinter()
|
|
399
|
+
.printNode(ts.EmitHint.Unspecified, newOptionsLiteral, node.getSourceFile()));
|
|
400
|
+
}
|
|
401
|
+
/** Checks whether a node is a call to `mergeApplicationConfig`. */
|
|
402
|
+
function isMergeAppConfigCall(node) {
|
|
403
|
+
if (!ts.isCallExpression(node)) {
|
|
404
|
+
return false;
|
|
405
|
+
}
|
|
406
|
+
var localName = findImportLocalName(node.getSourceFile(), 'mergeApplicationConfig', '@angular/core');
|
|
407
|
+
return (!!localName &&
|
|
408
|
+
ts.isIdentifier(node.expression) &&
|
|
409
|
+
node.expression.text === localName);
|
|
10
410
|
}
|
|
11
|
-
exports.isStandaloneApp = isStandaloneApp;
|
|
12
411
|
//# sourceMappingURL=standalone.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standalone.js","sourceRoot":"","sources":["../../../../../modules/store-devtools/schematics-core/utility/standalone.ts"],"names":[],"mappings":";;;AAAA,+BAAiC;AAEjC,qEAAsF;AAEtF,SAAgB,eAAe,CAAC,IAAU,EAAE,QAAgB;IAC1D,IAAM,MAAM,GAAG,EAAE,CAAC,gBAAgB,CAChC,QAAQ,EACR,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EACvB,EAAE,CAAC,YAAY,CAAC,MAAM,EACtB,IAAI,CACL,CAAC;IACF,IAAM,aAAa,GAAG,IAAA,yCAA4B,EAAC,MAAM,CAAC,CAAC;IAE3D,OAAO,aAAa,KAAK,IAAI,CAAC;AAChC,CAAC;AAVD,0CAUC","sourcesContent":["import * as ts from 'typescript';\nimport { Tree } from '@angular-devkit/schematics';\nimport { findBootstrapApplicationCall } from '@schematics/angular/private/standalone';\n\nexport function isStandaloneApp(host: Tree, mainPath: string): boolean {\n const source = ts.createSourceFile(\n mainPath,\n host.readText(mainPath),\n ts.ScriptTarget.Latest,\n true\n );\n const bootstrapCall = findBootstrapApplicationCall(source);\n\n return bootstrapCall !== null;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"standalone.js","sourceRoot":"","sources":["../../../../../modules/store-devtools/schematics-core/utility/standalone.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mHAAmH;AACnH,yDAIoC;AACpC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6BAA6B,CAAC,IAAI,yCAClE,IAAI,CAAC,UAAU;QAClB,EAAE,CAAC,OAAO,CAAC,wBAAwB,CACjC,WAAW,EACX,EAAE,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAAC,UAAU,CAAC,CAAC,CACtD;cACD,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,IAAM,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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strings.js","sourceRoot":"","sources":["../../../../../modules/store-devtools/schematics-core/utility/strings.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,IAAM,uBAAuB,GAAG,OAAO,CAAC;AACxC,IAAM,wBAAwB,GAAG,mBAAmB,CAAC;AACrD,IAAM,sBAAsB,GAAG,mBAAmB,CAAC;AACnD,IAAM,0BAA0B,GAAG,oBAAoB,CAAC;AACxD,IAAM,0BAA0B,GAAG,QAAQ,CAAC;AAE5C;;;;;;;;;GASG;AACH,SAAgB,UAAU,CAAC,GAAW;IACpC,OAAO,GAAG,CAAC,OAAO,CAAC,wBAAwB,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;AACtE,CAAC;AAFD,gCAEC;AAED;;;;;;;;;GASG;AACH,SAAgB,SAAS,CAAC,GAAY;IACpC,OAAO,UAAU,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;AACrE,CAAC;AAFD,8BAEC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,QAAQ,CAAC,GAAW;IAClC,OAAO,GAAG;SACP,OAAO,CACN,sBAAsB,EACtB,UAAC,MAAc,EAAE,UAAkB,EAAE,GAAW;QAC9C,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACtC,CAAC,CACF;SACA,OAAO,CAAC,UAAU,EAAE,UAAC,KAAa,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C,CAAC,IAAI,CAAC;AAC3C,CAAC;AAFD,sBAEC;AAED,SAAgB,WAAW,CACzB,KAA0B,EAC1B,IAAyB,EACzB,IAAY,EACZ,IAAY;IAEZ,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE;
|
|
1
|
+
{"version":3,"file":"strings.js","sourceRoot":"","sources":["../../../../../modules/store-devtools/schematics-core/utility/strings.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,IAAM,uBAAuB,GAAG,OAAO,CAAC;AACxC,IAAM,wBAAwB,GAAG,mBAAmB,CAAC;AACrD,IAAM,sBAAsB,GAAG,mBAAmB,CAAC;AACnD,IAAM,0BAA0B,GAAG,oBAAoB,CAAC;AACxD,IAAM,0BAA0B,GAAG,QAAQ,CAAC;AAE5C;;;;;;;;;GASG;AACH,SAAgB,UAAU,CAAC,GAAW;IACpC,OAAO,GAAG,CAAC,OAAO,CAAC,wBAAwB,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;AACtE,CAAC;AAFD,gCAEC;AAED;;;;;;;;;GASG;AACH,SAAgB,SAAS,CAAC,GAAY;IACpC,OAAO,UAAU,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;AACrE,CAAC;AAFD,8BAEC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,QAAQ,CAAC,GAAW;IAClC,OAAO,GAAG;SACP,OAAO,CACN,sBAAsB,EACtB,UAAC,MAAc,EAAE,UAAkB,EAAE,GAAW;QAC9C,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACtC,CAAC,CACF;SACA,OAAO,CAAC,UAAU,EAAE,UAAC,KAAa,IAAK,OAAA,KAAK,CAAC,WAAW,EAAE,EAAnB,CAAmB,CAAC,CAAC;AACjE,CAAC;AATD,4BASC;AAED;;;;;;;;;GASG;AACH,SAAgB,QAAQ,CAAC,G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AAK,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,OAAO,gBAAS,IAAI,cAAI,IAAI,MAAG,CAAC;IAClC,CAAC;IAED,OAAO,KAAK,CAAC,CAAC,CAAC,aAAM,IAAI,MAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AACtC,CAAC;AAXD,kCAWC","sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nconst STRING_DASHERIZE_REGEXP = /[ _]/g;\nconst STRING_DECAMELIZE_REGEXP = /([a-z\\d])([A-Z])/g;\nconst STRING_CAMELIZE_REGEXP = /(-|_|\\.|\\s)+(.)?/g;\nconst STRING_UNDERSCORE_REGEXP_1 = /([a-z\\d])([A-Z]+)/g;\nconst STRING_UNDERSCORE_REGEXP_2 = /-|\\s+/g;\n\n/**\n * Converts a camelized string into all lower case separated by underscores.\n *\n ```javascript\n decamelize('innerHTML'); // 'inner_html'\n decamelize('action_name'); // 'action_name'\n decamelize('css-class-name'); // 'css-class-name'\n decamelize('my favorite items'); // 'my favorite items'\n ```\n */\nexport function decamelize(str: string): string {\n return str.replace(STRING_DECAMELIZE_REGEXP, '$1_$2').toLowerCase();\n}\n\n/**\n Replaces underscores, spaces, or camelCase with dashes.\n\n ```javascript\n dasherize('innerHTML'); // 'inner-html'\n dasherize('action_name'); // 'action-name'\n dasherize('css-class-name'); // 'css-class-name'\n dasherize('my favorite items'); // 'my-favorite-items'\n ```\n */\nexport function dasherize(str?: string): string {\n return decamelize(str || '').replace(STRING_DASHERIZE_REGEXP, '-');\n}\n\n/**\n Returns the lowerCamelCase form of a string.\n\n ```javascript\n camelize('innerHTML'); // 'innerHTML'\n camelize('action_name'); // 'actionName'\n camelize('css-class-name'); // 'cssClassName'\n camelize('my favorite items'); // 'myFavoriteItems'\n camelize('My Favorite Items'); // 'myFavoriteItems'\n ```\n */\nexport function camelize(str: string): string {\n return str\n .replace(\n STRING_CAMELIZE_REGEXP,\n (_match: string, _separator: string, chr: string) => {\n return chr ? chr.toUpperCase() : '';\n }\n )\n .replace(/^([A-Z])/, (match: string) => match.toLowerCase());\n}\n\n/**\n Returns the UpperCamelCase form of a string.\n\n ```javascript\n 'innerHTML'.classify(); // 'InnerHTML'\n 'action_name'.classify(); // 'ActionName'\n 'css-class-name'.classify(); // 'CssClassName'\n 'my favorite items'.classify(); // 'MyFavoriteItems'\n ```\n */\nexport function classify(str: string): string {\n return str\n .split('.')\n .map((part) => capitalize(camelize(part)))\n .join('.');\n}\n\n/**\n More general than decamelize. Returns the lower\\_case\\_and\\_underscored\n form of a string.\n\n ```javascript\n 'innerHTML'.underscore(); // 'inner_html'\n 'action_name'.underscore(); // 'action_name'\n 'css-class-name'.underscore(); // 'css_class_name'\n 'my favorite items'.underscore(); // 'my_favorite_items'\n ```\n */\nexport function underscore(str: string): string {\n return str\n .replace(STRING_UNDERSCORE_REGEXP_1, '$1_$2')\n .replace(STRING_UNDERSCORE_REGEXP_2, '_')\n .toLowerCase();\n}\n\n/**\n Returns the Capitalized form of a string\n\n ```javascript\n 'innerHTML'.capitalize() // 'InnerHTML'\n 'action_name'.capitalize() // 'Action_name'\n 'css-class-name'.capitalize() // 'Css-class-name'\n 'my favorite items'.capitalize() // 'My favorite items'\n ```\n */\nexport function capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.substring(1);\n}\n\n/**\n Returns the plural form of a string\n\n ```javascript\n 'innerHTML'.pluralize() // 'innerHTMLs'\n 'action_name'.pluralize() // 'actionNames'\n 'css-class-name'.pluralize() // 'cssClassNames'\n 'regex'.pluralize() // 'regexes'\n 'user'.pluralize() // 'users'\n ```\n */\nexport function pluralize(str: string): string {\n return camelize(\n [/([^aeiou])y$/, /()fe?$/, /([^aeiou]o|[sxz]|[cs]h)$/].map(\n (c, i) => (str = str.replace(c, `$1${'iv'[i] || ''}e`))\n ) && str + 's'\n );\n}\n\nexport function group(name: string, group: string | undefined) {\n return group ? `${group}/${name}` : name;\n}\n\nexport function featurePath(\n group: boolean | undefined,\n flat: boolean | undefined,\n path: string,\n name: string\n) {\n if (group && !flat) {\n return `../../${path}/${name}/`;\n }\n\n return group ? `../${path}/` : './';\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../../../modules/store-devtools/schematics-core/utility/update.ts"],"names":[],"mappings":";;;AAAA,yDAKoC;AAEpC,SAAgB,aAAa,CAAC,IAAY;IACxC,OAAO,UAAC,IAAU,EAAE,OAAyB;QAC3C,IAAM,OAAO,GAAG,eAAe,CAAC;QAChC,IAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAClC,IAAI,MAAM,KAAK,IAAI,EAAE;
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../../../modules/store-devtools/schematics-core/utility/update.ts"],"names":[],"mappings":";;;AAAA,yDAKoC;AAEpC,SAAgB,aAAa,CAAC,IAAY;IACxC,OAAO,UAAC,IAAU,EAAE,OAAyB;QAC3C,IAAM,OAAO,GAAG,eAAe,CAAC;QAChC,IAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAClC,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;YACpB,MAAM,IAAI,gCAAmB,CAAC,6BAA6B,CAAC,CAAC;QAC/D,CAAC;QACD,IAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;QAClC,IAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAEhC,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YAClE,MAAM,IAAI,gCAAmB,CAAC,4BAA4B,CAAC,CAAC;QAC9D,CAAC;QAED,IAAM,oBAAoB,GAAG,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC;QAEjE,oBAAoB,CAAC,OAAO,CAAC,UAAC,QAAQ;YACpC,IAAM,WAAW,GAAG,gBAAS,IAAI,CAAE,CAAC;YAEpC,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC;gBAChD,IAAM,SAAS,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;gBAChD,IAAM,MAAM,GAAG,KAAK,CAAC,SAAS,EAAE,GAAG,CAAC,IAAI,KAAK,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;gBAE9D,GAAG,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,GAAG,UAAG,MAAM,UAAO,CAAC;YAChD,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAEtD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AA/BD,sCA+BC;AAED,SAAS,KAAK,CAAC,KAAa,EAAE,IAAY;IACxC,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;AACpC,CAAC","sourcesContent":["import {\n Rule,\n SchematicContext,\n Tree,\n SchematicsException,\n} from '@angular-devkit/schematics';\n\nexport function updatePackage(name: string): Rule {\n return (tree: Tree, context: SchematicContext) => {\n const pkgPath = '/package.json';\n const buffer = tree.read(pkgPath);\n if (buffer === null) {\n throw new SchematicsException('Could not read package.json');\n }\n const content = buffer.toString();\n const pkg = JSON.parse(content);\n\n if (pkg === null || typeof pkg !== 'object' || Array.isArray(pkg)) {\n throw new SchematicsException('Error reading package.json');\n }\n\n const dependencyCategories = ['dependencies', 'devDependencies'];\n\n dependencyCategories.forEach((category) => {\n const packageName = `@ngrx/${name}`;\n\n if (pkg[category] && pkg[category][packageName]) {\n const firstChar = pkg[category][packageName][0];\n const suffix = match(firstChar, '^') || match(firstChar, '~');\n\n pkg[category][packageName] = `${suffix}6.0.0`;\n }\n });\n\n tree.overwrite(pkgPath, JSON.stringify(pkg, null, 2));\n\n return tree;\n };\n}\n\nfunction match(value: string, test: string) {\n return value === test ? test : '';\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visitors.js","sourceRoot":"","sources":["../../../../../modules/store-devtools/schematics-core/utility/visitors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAiC;AACjC,6CAA0D;AAG1D,SAAgB,kBAAkB,CAChC,IAAU,EACV,OAIuB;;IAEvB,IAAI,MAAM,GAAuB,SAAS,CAAC;;QAC3C,KAAyB,IAAA,KAAA,SAAA,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,gBAAA,4BAAE;YAAtC,IAAM,UAAU,WAAA;YACnB,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;SAC5C;;;;;;;;;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAdD,gDAcC;AAED,SAAgB,cAAc,CAC5B,IAAU,EACV,OAQS;IAET,kBAAkB,CAAC,IAAI,EAAE,UAAC,MAAM;QAC9B,eAAe,CAAC,MAAM,EAAE,UAAC,CAAC,EAAE,uBAAuB;YACjD,EAAE,CAAC,YAAY,CAAC,uBAAuB,EAAE,SAAS,aAAa,CAAC,CAAC;gBAC/D,IAAI,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE;oBACzD,IACE,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU;wBAC1B,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC,WAAW,CAA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d,KAAA,SAAA,SAAS,CAAC,QAAQ,CAAA;;;;gBAA1B,IAAI;qBACT,CAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA,EAA/C,wBAA+C;gBAC3C,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;qBAC/B,KAAK,EAAL,wBAAK;gBACD,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;gBACxB,MAAM,GAAG,EAAE,CAAC,gBAAgB,CAChC,KAAK,CAAC,IAAI,EACV,OAAO,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,EACzC,EAAE,CAAC,YAAY,CAAC,MAAM,EACtB,IAAI,CACL,CAAC;gBACF,qBAAM,MAAM,EAAA;;gBAAZ,SAAY,CAAC;;;;;;;;;;;;;;;;;;gBAKA,KAAA,SAAA,SAAS,CAAC,OAAO,CAAA;;;;gBAAzB,IAAI;gBACb,IAAI,IAAI,KAAK,cAAc,EAAE;oBAC3B,yBAAS;iBACV;gBAED,sBAAA,SAAO,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA,EAAA;;gBAAjC,SAAiC,CAAC;;;;;;;;;;;;;;;;;;;CAErC","sourcesContent":["import * as ts from 'typescript';\nimport { normalize, resolve } from '@angular-devkit/core';\nimport { Tree, DirEntry } from '@angular-devkit/schematics';\n\nexport function visitTSSourceFiles<Result = void>(\n tree: Tree,\n visitor: (\n sourceFile: ts.SourceFile,\n tree: Tree,\n result?: Result\n ) => Result | undefined\n): Result | undefined {\n let result: Result | undefined = undefined;\n for (const sourceFile of visit(tree.root)) {\n result = visitor(sourceFile, tree, result);\n }\n\n return result;\n}\n\nexport function visitTemplates(\n tree: Tree,\n visitor: (\n template: {\n fileName: string;\n content: string;\n inline: boolean;\n start: number;\n },\n tree: Tree\n ) => void\n): void {\n visitTSSourceFiles(tree, (source) => {\n visitComponents(source, (_, decoratorExpressionNode) => {\n ts.forEachChild(decoratorExpressionNode, function findTemplates(n) {\n if (ts.isPropertyAssignment(n) && ts.isIdentifier(n.name)) {\n if (\n n.name.text === 'template' &&\n ts.isStringLiteralLike(n.initializer)\n ) {\n // Need to add an offset of one to the start because the template quotes are\n // not part of the template content.\n const templateStartIdx = n.initializer.getStart() + 1;\n visitor(\n {\n fileName: source.fileName,\n content: n.initializer.text,\n inline: true,\n start: templateStartIdx,\n },\n tree\n );\n return;\n } else if (\n n.name.text === 'templateUrl' &&\n ts.isStringLiteralLike(n.initializer)\n ) {\n const parts = normalize(source.fileName).split('/').slice(0, -1);\n const templatePath = resolve(\n normalize(parts.join('/')),\n normalize(n.initializer.text)\n );\n if (!tree.exists(templatePath)) {\n return;\n }\n\n const fileContent = tree.read(templatePath);\n if (!fileContent) {\n return;\n }\n\n visitor(\n {\n fileName: templatePath,\n content: fileContent.toString(),\n inline: false,\n start: 0,\n },\n tree\n );\n return;\n }\n }\n\n ts.forEachChild(n, findTemplates);\n });\n });\n });\n}\n\nexport function visitNgModuleImports(\n sourceFile: ts.SourceFile,\n callback: (\n importNode: ts.PropertyAssignment,\n elementExpressions: ts.NodeArray<ts.Expression>\n ) => void\n) {\n visitNgModuleProperty(sourceFile, callback, 'imports');\n}\n\nexport function visitNgModuleExports(\n sourceFile: ts.SourceFile,\n callback: (\n exportNode: ts.PropertyAssignment,\n elementExpressions: ts.NodeArray<ts.Expression>\n ) => void\n) {\n visitNgModuleProperty(sourceFile, callback, 'exports');\n}\n\nfunction visitNgModuleProperty(\n sourceFile: ts.SourceFile,\n callback: (\n nodes: ts.PropertyAssignment,\n elementExpressions: ts.NodeArray<ts.Expression>\n ) => void,\n property: string\n) {\n visitNgModules(sourceFile, (_, decoratorExpressionNode) => {\n ts.forEachChild(decoratorExpressionNode, function findTemplates(n) {\n if (\n ts.isPropertyAssignment(n) &&\n ts.isIdentifier(n.name) &&\n n.name.text === property &&\n ts.isArrayLiteralExpression(n.initializer)\n ) {\n callback(n, n.initializer.elements);\n return;\n }\n\n ts.forEachChild(n, findTemplates);\n });\n });\n}\nexport function visitComponents(\n sourceFile: ts.SourceFile,\n callback: (\n classDeclarationNode: ts.ClassDeclaration,\n decoratorExpressionNode: ts.ObjectLiteralExpression\n ) => void\n) {\n visitDecorator(sourceFile, 'Component', callback);\n}\n\nexport function visitNgModules(\n sourceFile: ts.SourceFile,\n callback: (\n classDeclarationNode: ts.ClassDeclaration,\n decoratorExpressionNode: ts.ObjectLiteralExpression\n ) => void\n) {\n visitDecorator(sourceFile, 'NgModule', callback);\n}\n\nexport function visitDecorator(\n sourceFile: ts.SourceFile,\n decoratorName: string,\n callback: (\n classDeclarationNode: ts.ClassDeclaration,\n decoratorExpressionNode: ts.ObjectLiteralExpression\n ) => void\n) {\n ts.forEachChild(sourceFile, function findClassDeclaration(node) {\n if (!ts.isClassDeclaration(node)) {\n ts.forEachChild(node, findClassDeclaration);\n }\n\n const classDeclarationNode = node as ts.ClassDeclaration;\n const decorators = ts.getDecorators(classDeclarationNode);\n\n if (!decorators || !decorators.length) {\n return;\n }\n\n const componentDecorator = decorators.find((d) => {\n return (\n ts.isCallExpression(d.expression) &&\n ts.isIdentifier(d.expression.expression) &&\n d.expression.expression.text === decoratorName\n );\n });\n\n if (!componentDecorator) {\n return;\n }\n\n const { expression } = componentDecorator;\n if (!ts.isCallExpression(expression)) {\n return;\n }\n\n const [arg] = expression.arguments;\n if (!arg || !ts.isObjectLiteralExpression(arg)) {\n return;\n }\n\n callback(classDeclarationNode, arg);\n });\n}\n\nfunction* visit(directory: DirEntry): IterableIterator<ts.SourceFile> {\n for (const path of directory.subfiles) {\n if (path.endsWith('.ts') && !path.endsWith('.d.ts')) {\n const entry = directory.file(path);\n if (entry) {\n const content = entry.content;\n const source = ts.createSourceFile(\n entry.path,\n content.toString().replace(/^\\uFEFF/, ''),\n ts.ScriptTarget.Latest,\n true\n );\n yield source;\n }\n }\n }\n\n for (const path of directory.subdirs) {\n if (path === 'node_modules') {\n continue;\n }\n\n yield* visit(directory.dir(path));\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"visitors.js","sourceRoot":"","sources":["../../../../../modules/store-devtools/schematics-core/utility/visitors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAiC;AACjC,6CAA0D;AAG1D,SAAgB,kBAAkB,CAChC,IAAU,EACV,OAIuB;;IAEvB,IAAI,MAAM,GAAuB,SAAS,CAAC;;QAC3C,KAAyB,IAAA,KAAA,SAAA,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,gBAAA,4BAAE,CAAC;YAAvC,IAAM,UAAU,WAAA;YACnB,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAC7C,CAAC;;;;;;;;;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAdD,gDAcC;AAED,SAAgB,cAAc,CAC5B,IAAU,EACV,OAQS;IAET,kBAAkB,CAAC,IAAI,EAAE,UAAC,MAAM;QAC9B,eAAe,CAAC,MAAM,EAAE,UAAC,CAAC,EAAE,uBAAuB;YACjD,EAAE,CAAC,YAAY,CAAC,uBAAuB,EAAE,SAAS,aAAa,CAAC,CAAC;gBAC/D,IAAI,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC1D,IACE,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU;wBAC1B,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC,WAAW,CAAC,EACrC,CAAC;wBACD,4EAA4E;wBAC5E,oCAAoC;wBACpC,IAAM,gBAAgB,GAAG,CAAC,CAAC,WAAW,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;wBACtD,OAAO,CACL;4BACE,QAAQ,EAAE,MAAM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BAA1B,IAAI;qBACT,CAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA,EAA/C,wBAA+C;gBAC3C,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;qBAC/B,KAAK,EAAL,wBAAK;gBACD,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;gBACxB,MAAM,GAAG,EAAE,CAAC,gBAAgB,CAChC,KAAK,CAAC,IAAI,EACV,OAAO,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,EACzC,EAAE,CAAC,YAAY,CAAC,MAAM,EACtB,IAAI,CACL,CAAC;gBACF,qBAAM,MAAM,EAAA;;gBAAZ,SAAY,CAAC;;;;;;;;;;;;;;;;;;gBAKA,KAAA,SAAA,SAAS,CAAC,OAAO,CAAA;;;;gBAAzB,IAAI;gBACb,IAAI,IAAI,KAAK,cAAc,EAAE,CAAC;oBAC5B,yBAAS;gBACX,CAAC;gBAED,sBAAA,SAAO,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA,EAAA;;gBAAjC,SAAiC,CAAC;;;;;;;;;;;;;;;;;;;CAErC","sourcesContent":["import * as ts from 'typescript';\nimport { normalize, resolve } from '@angular-devkit/core';\nimport { Tree, DirEntry } from '@angular-devkit/schematics';\n\nexport function visitTSSourceFiles<Result = void>(\n tree: Tree,\n visitor: (\n sourceFile: ts.SourceFile,\n tree: Tree,\n result?: Result\n ) => Result | undefined\n): Result | undefined {\n let result: Result | undefined = undefined;\n for (const sourceFile of visit(tree.root)) {\n result = visitor(sourceFile, tree, result);\n }\n\n return result;\n}\n\nexport function visitTemplates(\n tree: Tree,\n visitor: (\n template: {\n fileName: string;\n content: string;\n inline: boolean;\n start: number;\n },\n tree: Tree\n ) => void\n): void {\n visitTSSourceFiles(tree, (source) => {\n visitComponents(source, (_, decoratorExpressionNode) => {\n ts.forEachChild(decoratorExpressionNode, function findTemplates(n) {\n if (ts.isPropertyAssignment(n) && ts.isIdentifier(n.name)) {\n if (\n n.name.text === 'template' &&\n ts.isStringLiteralLike(n.initializer)\n ) {\n // Need to add an offset of one to the start because the template quotes are\n // not part of the template content.\n const templateStartIdx = n.initializer.getStart() + 1;\n visitor(\n {\n fileName: source.fileName,\n content: n.initializer.text,\n inline: true,\n start: templateStartIdx,\n },\n tree\n );\n return;\n } else if (\n n.name.text === 'templateUrl' &&\n ts.isStringLiteralLike(n.initializer)\n ) {\n const parts = normalize(source.fileName).split('/').slice(0, -1);\n const templatePath = resolve(\n normalize(parts.join('/')),\n normalize(n.initializer.text)\n );\n if (!tree.exists(templatePath)) {\n return;\n }\n\n const fileContent = tree.read(templatePath);\n if (!fileContent) {\n return;\n }\n\n visitor(\n {\n fileName: templatePath,\n content: fileContent.toString(),\n inline: false,\n start: 0,\n },\n tree\n );\n return;\n }\n }\n\n ts.forEachChild(n, findTemplates);\n });\n });\n });\n}\n\nexport function visitNgModuleImports(\n sourceFile: ts.SourceFile,\n callback: (\n importNode: ts.PropertyAssignment,\n elementExpressions: ts.NodeArray<ts.Expression>\n ) => void\n) {\n visitNgModuleProperty(sourceFile, callback, 'imports');\n}\n\nexport function visitNgModuleExports(\n sourceFile: ts.SourceFile,\n callback: (\n exportNode: ts.PropertyAssignment,\n elementExpressions: ts.NodeArray<ts.Expression>\n ) => void\n) {\n visitNgModuleProperty(sourceFile, callback, 'exports');\n}\n\nfunction visitNgModuleProperty(\n sourceFile: ts.SourceFile,\n callback: (\n nodes: ts.PropertyAssignment,\n elementExpressions: ts.NodeArray<ts.Expression>\n ) => void,\n property: string\n) {\n visitNgModules(sourceFile, (_, decoratorExpressionNode) => {\n ts.forEachChild(decoratorExpressionNode, function findTemplates(n) {\n if (\n ts.isPropertyAssignment(n) &&\n ts.isIdentifier(n.name) &&\n n.name.text === property &&\n ts.isArrayLiteralExpression(n.initializer)\n ) {\n callback(n, n.initializer.elements);\n return;\n }\n\n ts.forEachChild(n, findTemplates);\n });\n });\n}\nexport function visitComponents(\n sourceFile: ts.SourceFile,\n callback: (\n classDeclarationNode: ts.ClassDeclaration,\n decoratorExpressionNode: ts.ObjectLiteralExpression\n ) => void\n) {\n visitDecorator(sourceFile, 'Component', callback);\n}\n\nexport function visitNgModules(\n sourceFile: ts.SourceFile,\n callback: (\n classDeclarationNode: ts.ClassDeclaration,\n decoratorExpressionNode: ts.ObjectLiteralExpression\n ) => void\n) {\n visitDecorator(sourceFile, 'NgModule', callback);\n}\n\nexport function visitDecorator(\n sourceFile: ts.SourceFile,\n decoratorName: string,\n callback: (\n classDeclarationNode: ts.ClassDeclaration,\n decoratorExpressionNode: ts.ObjectLiteralExpression\n ) => void\n) {\n ts.forEachChild(sourceFile, function findClassDeclaration(node) {\n if (!ts.isClassDeclaration(node)) {\n ts.forEachChild(node, findClassDeclaration);\n }\n\n const classDeclarationNode = node as ts.ClassDeclaration;\n const decorators = ts.getDecorators(classDeclarationNode);\n\n if (!decorators || !decorators.length) {\n return;\n }\n\n const componentDecorator = decorators.find((d) => {\n return (\n ts.isCallExpression(d.expression) &&\n ts.isIdentifier(d.expression.expression) &&\n d.expression.expression.text === decoratorName\n );\n });\n\n if (!componentDecorator) {\n return;\n }\n\n const { expression } = componentDecorator;\n if (!ts.isCallExpression(expression)) {\n return;\n }\n\n const [arg] = expression.arguments;\n if (!arg || !ts.isObjectLiteralExpression(arg)) {\n return;\n }\n\n callback(classDeclarationNode, arg);\n });\n}\n\nfunction* visit(directory: DirEntry): IterableIterator<ts.SourceFile> {\n for (const path of directory.subfiles) {\n if (path.endsWith('.ts') && !path.endsWith('.d.ts')) {\n const entry = directory.file(path);\n if (entry) {\n const content = entry.content;\n const source = ts.createSourceFile(\n entry.path,\n content.toString().replace(/^\\uFEFF/, ''),\n ts.ScriptTarget.Latest,\n true\n );\n yield source;\n }\n }\n }\n\n for (const path of directory.subdirs) {\n if (path === 'node_modules') {\n continue;\n }\n\n yield* visit(directory.dir(path));\n }\n}\n"]}
|
package/src/utils.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export declare function sanitizeState(stateSanitizer: StateSanitizer, state: any
|
|
|
31
31
|
/**
|
|
32
32
|
* Read the config and tell if actions should be filtered
|
|
33
33
|
*/
|
|
34
|
-
export declare function shouldFilterActions(config: StoreDevtoolsConfig):
|
|
34
|
+
export declare function shouldFilterActions(config: StoreDevtoolsConfig): string[] | Predicate;
|
|
35
35
|
/**
|
|
36
36
|
* Return a full filtered lifted state
|
|
37
37
|
*/
|