@ngrx/store-devtools 20.0.1 → 21.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/fesm2022/ngrx-store-devtools.mjs +13 -13
- package/fesm2022/ngrx-store-devtools.mjs.map +1 -1
- package/migrations/17_0_0-beta/index.js +11 -14
- package/migrations/17_0_0-beta/index.js.map +1 -1
- package/migrations/6_0_0/index.js +3 -6
- package/migrations/6_0_0/index.js.map +1 -1
- package/package.json +5 -5
- package/schematics/ng-add/index.js +30 -33
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics/ng-add/schema.js +0 -2
- package/schematics-core/index.js +24 -75
- package/schematics-core/index.js.map +1 -1
- package/schematics-core/utility/ast-utils.js +28 -44
- package/schematics-core/utility/ast-utils.js.map +1 -1
- package/schematics-core/utility/change.js +8 -15
- package/schematics-core/utility/change.js.map +1 -1
- package/schematics-core/utility/config.js +4 -8
- package/schematics-core/utility/config.js.map +1 -1
- package/schematics-core/utility/find-component.js +17 -22
- package/schematics-core/utility/find-component.js.map +1 -1
- package/schematics-core/utility/find-module.js +19 -24
- package/schematics-core/utility/find-module.js.map +1 -1
- package/schematics-core/utility/json-utilts.js +1 -4
- package/schematics-core/utility/json-utilts.js.map +1 -1
- package/schematics-core/utility/libs-version.js +1 -4
- package/schematics-core/utility/libs-version.js.map +1 -1
- package/schematics-core/utility/ngrx-utils.js +28 -36
- package/schematics-core/utility/ngrx-utils.js.map +1 -1
- package/schematics-core/utility/package.js +1 -4
- package/schematics-core/utility/package.js.map +1 -1
- package/schematics-core/utility/parse-name.js +5 -8
- package/schematics-core/utility/parse-name.js.map +1 -1
- package/schematics-core/utility/project.js +9 -15
- package/schematics-core/utility/project.js.map +1 -1
- package/schematics-core/utility/standalone.js +13 -18
- package/schematics-core/utility/standalone.js.map +1 -1
- package/schematics-core/utility/strings.js +9 -20
- package/schematics-core/utility/strings.js.map +1 -1
- package/schematics-core/utility/update.js +4 -7
- package/schematics-core/utility/update.js.map +1 -1
- package/schematics-core/utility/visitors.js +16 -30
- package/schematics-core/utility/visitors.js.map +1 -1
- package/types/ngrx-store-devtools.d.ts +252 -0
- package/index.d.ts +0 -6
- package/public_api.d.ts +0 -1
- package/src/actions.d.ts +0 -79
- package/src/config.d.ts +0 -126
- package/src/devtools-dispatcher.d.ts +0 -6
- package/src/devtools.d.ts +0 -35
- package/src/extension.d.ts +0 -52
- package/src/index.d.ts +0 -6
- package/src/instrument.d.ts +0 -9
- package/src/provide-store-devtools.d.ts +0 -26
- package/src/reducer.d.ts +0 -47
- package/src/utils.d.ts +0 -42
- package/src/zone-config.d.ts +0 -9
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __values = (this && this.__values) || function(o) {
|
|
3
2
|
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
4
3
|
if (m) return m.call(o);
|
|
@@ -35,16 +34,12 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
35
34
|
}
|
|
36
35
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
37
36
|
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.callsProvidersFunction = callsProvidersFunction;
|
|
40
|
-
exports.addFunctionalProvidersToStandaloneBootstrap = addFunctionalProvidersToStandaloneBootstrap;
|
|
41
|
-
exports.findBootstrapApplicationCall = findBootstrapApplicationCall;
|
|
42
37
|
// copied from https://github.com/angular/angular-cli/blob/17.3.x/packages/schematics/angular/private/standalone.ts
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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';
|
|
48
43
|
/**
|
|
49
44
|
* Checks whether a providers function is being called in a `bootstrapApplication` call.
|
|
50
45
|
* @param tree File tree of the project.
|
|
@@ -53,7 +48,7 @@ var ts = require("typescript");
|
|
|
53
48
|
* @deprecated Private utility that will be removed. Use `addRootImport` or `addRootProvider` from
|
|
54
49
|
* `@schematics/angular/utility` instead.
|
|
55
50
|
*/
|
|
56
|
-
function callsProvidersFunction(tree, filePath, functionName) {
|
|
51
|
+
export function callsProvidersFunction(tree, filePath, functionName) {
|
|
57
52
|
var sourceFile = createSourceFile(tree, filePath);
|
|
58
53
|
var bootstrapCall = findBootstrapApplicationCall(sourceFile);
|
|
59
54
|
var appConfig = bootstrapCall
|
|
@@ -79,18 +74,18 @@ function callsProvidersFunction(tree, filePath, functionName) {
|
|
|
79
74
|
* @deprecated Private utility that will be removed. Use `addRootImport` or `addRootProvider` from
|
|
80
75
|
* `@schematics/angular/utility` instead.
|
|
81
76
|
*/
|
|
82
|
-
function addFunctionalProvidersToStandaloneBootstrap(tree, filePath, functionName, importPath, args) {
|
|
77
|
+
export function addFunctionalProvidersToStandaloneBootstrap(tree, filePath, functionName, importPath, args) {
|
|
83
78
|
if (args === void 0) { args = []; }
|
|
84
79
|
var sourceFile = createSourceFile(tree, filePath);
|
|
85
80
|
var bootstrapCall = findBootstrapApplicationCall(sourceFile);
|
|
86
81
|
var addImports = function (file, recorder) {
|
|
87
|
-
var change =
|
|
88
|
-
if (change instanceof
|
|
82
|
+
var change = insertImport(file, file.getText(), functionName, importPath);
|
|
83
|
+
if (change instanceof InsertChange) {
|
|
89
84
|
recorder.insertLeft(change.pos, change.toAdd);
|
|
90
85
|
}
|
|
91
86
|
};
|
|
92
87
|
if (!bootstrapCall) {
|
|
93
|
-
throw new
|
|
88
|
+
throw new SchematicsException("Could not find bootstrapApplication call in ".concat(filePath));
|
|
94
89
|
}
|
|
95
90
|
var providersCall = ts.factory.createCallExpression(ts.factory.createIdentifier(functionName), undefined, args);
|
|
96
91
|
// If there's only one argument, we have to create a new object literal.
|
|
@@ -112,7 +107,7 @@ function addFunctionalProvidersToStandaloneBootstrap(tree, filePath, functionNam
|
|
|
112
107
|
// Otherwise attempt to merge into the current config.
|
|
113
108
|
var appConfig = findAppConfig(bootstrapCall, tree, filePath);
|
|
114
109
|
if (!appConfig) {
|
|
115
|
-
throw new
|
|
110
|
+
throw new SchematicsException("Could not statically analyze config in bootstrapApplication call in ".concat(filePath));
|
|
116
111
|
}
|
|
117
112
|
var configFilePath = appConfig.filePath, config = appConfig.node;
|
|
118
113
|
var recorder = tree.beginUpdate(configFilePath);
|
|
@@ -134,7 +129,7 @@ function addFunctionalProvidersToStandaloneBootstrap(tree, filePath, functionNam
|
|
|
134
129
|
* @deprecated Private utility that will be removed. Use `addRootImport` or `addRootProvider` from
|
|
135
130
|
* `@schematics/angular/utility` instead.
|
|
136
131
|
*/
|
|
137
|
-
function findBootstrapApplicationCall(sourceFile) {
|
|
132
|
+
export function findBootstrapApplicationCall(sourceFile) {
|
|
138
133
|
var localName = findImportLocalName(sourceFile, 'bootstrapApplication', '@angular/platform-browser');
|
|
139
134
|
if (!localName) {
|
|
140
135
|
return null;
|
|
@@ -225,7 +220,7 @@ function resolveAppConfigFromIdentifier(identifier, tree, bootstapFilePath) {
|
|
|
225
220
|
// Look for a variable with the imported name in the file. Note that ideally we would use
|
|
226
221
|
// the type checker to resolve this, but we can't because these utilities are set up to
|
|
227
222
|
// operate on individual files, not the entire program.
|
|
228
|
-
var filePath =
|
|
223
|
+
var filePath = join(dirname(bootstapFilePath), node.moduleSpecifier.text + '.ts');
|
|
229
224
|
var importedSourceFile = createSourceFile(tree, filePath);
|
|
230
225
|
var resolvedVariable = findAppConfigFromVariableName(importedSourceFile, (specifier.propertyName || specifier.name).text);
|
|
231
226
|
if (resolvedVariable) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standalone.js","sourceRoot":"","sources":["../../../../../modules/store-devtools/schematics-core/utility/standalone.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AM,iBAAiB,GAAG,EAAE,CAAC,OAAO,CAAC,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
|
+
{"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,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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,14 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.decamelize = decamelize;
|
|
4
|
-
exports.dasherize = dasherize;
|
|
5
|
-
exports.camelize = camelize;
|
|
6
|
-
exports.classify = classify;
|
|
7
|
-
exports.underscore = underscore;
|
|
8
|
-
exports.capitalize = capitalize;
|
|
9
|
-
exports.pluralize = pluralize;
|
|
10
|
-
exports.group = group;
|
|
11
|
-
exports.featurePath = featurePath;
|
|
12
1
|
/**
|
|
13
2
|
* @license
|
|
14
3
|
* Copyright Google Inc. All Rights Reserved.
|
|
@@ -31,7 +20,7 @@ var STRING_UNDERSCORE_REGEXP_2 = /-|\s+/g;
|
|
|
31
20
|
decamelize('my favorite items'); // 'my favorite items'
|
|
32
21
|
```
|
|
33
22
|
*/
|
|
34
|
-
function decamelize(str) {
|
|
23
|
+
export function decamelize(str) {
|
|
35
24
|
return str.replace(STRING_DECAMELIZE_REGEXP, '$1_$2').toLowerCase();
|
|
36
25
|
}
|
|
37
26
|
/**
|
|
@@ -44,7 +33,7 @@ function decamelize(str) {
|
|
|
44
33
|
dasherize('my favorite items'); // 'my-favorite-items'
|
|
45
34
|
```
|
|
46
35
|
*/
|
|
47
|
-
function dasherize(str) {
|
|
36
|
+
export function dasherize(str) {
|
|
48
37
|
return decamelize(str || '').replace(STRING_DASHERIZE_REGEXP, '-');
|
|
49
38
|
}
|
|
50
39
|
/**
|
|
@@ -58,7 +47,7 @@ function dasherize(str) {
|
|
|
58
47
|
camelize('My Favorite Items'); // 'myFavoriteItems'
|
|
59
48
|
```
|
|
60
49
|
*/
|
|
61
|
-
function camelize(str) {
|
|
50
|
+
export function camelize(str) {
|
|
62
51
|
return str
|
|
63
52
|
.replace(STRING_CAMELIZE_REGEXP, function (_match, _separator, chr) {
|
|
64
53
|
return chr ? chr.toUpperCase() : '';
|
|
@@ -75,7 +64,7 @@ function camelize(str) {
|
|
|
75
64
|
'my favorite items'.classify(); // 'MyFavoriteItems'
|
|
76
65
|
```
|
|
77
66
|
*/
|
|
78
|
-
function classify(str) {
|
|
67
|
+
export function classify(str) {
|
|
79
68
|
return str
|
|
80
69
|
.split('.')
|
|
81
70
|
.map(function (part) { return capitalize(camelize(part)); })
|
|
@@ -92,7 +81,7 @@ function classify(str) {
|
|
|
92
81
|
'my favorite items'.underscore(); // 'my_favorite_items'
|
|
93
82
|
```
|
|
94
83
|
*/
|
|
95
|
-
function underscore(str) {
|
|
84
|
+
export function underscore(str) {
|
|
96
85
|
return str
|
|
97
86
|
.replace(STRING_UNDERSCORE_REGEXP_1, '$1_$2')
|
|
98
87
|
.replace(STRING_UNDERSCORE_REGEXP_2, '_')
|
|
@@ -108,7 +97,7 @@ function underscore(str) {
|
|
|
108
97
|
'my favorite items'.capitalize() // 'My favorite items'
|
|
109
98
|
```
|
|
110
99
|
*/
|
|
111
|
-
function capitalize(str) {
|
|
100
|
+
export function capitalize(str) {
|
|
112
101
|
return str.charAt(0).toUpperCase() + str.substring(1);
|
|
113
102
|
}
|
|
114
103
|
/**
|
|
@@ -122,13 +111,13 @@ function capitalize(str) {
|
|
|
122
111
|
'user'.pluralize() // 'users'
|
|
123
112
|
```
|
|
124
113
|
*/
|
|
125
|
-
function pluralize(str) {
|
|
114
|
+
export function pluralize(str) {
|
|
126
115
|
return camelize([/([^aeiou])y$/, /()fe?$/, /([^aeiou]o|[sxz]|[cs]h)$/].map(function (c, i) { return (str = str.replace(c, "$1".concat('iv'[i] || '', "e"))); }) && str + 's');
|
|
127
116
|
}
|
|
128
|
-
function group(name, group) {
|
|
117
|
+
export function group(name, group) {
|
|
129
118
|
return group ? "".concat(group, "/").concat(name) : name;
|
|
130
119
|
}
|
|
131
|
-
function featurePath(group, flat, path, name) {
|
|
120
|
+
export function featurePath(group, flat, path, name) {
|
|
132
121
|
if (group && !flat) {
|
|
133
122
|
return "../../".concat(path, "/").concat(name, "/");
|
|
134
123
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strings.js","sourceRoot":"","sources":["../../../../../modules/store-devtools/schematics-core/utility/strings.ts"],"names":[],"mappings":"
|
|
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,0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MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AACxD,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,OAAO,QAAQ,CACb,CAAC,cAAc,EAAE,QAAQ,EAAE,0BAA0B,CAAC,CAAC,GAAG,CACxD,UAAC,CAAC,EAAE,CAAC,IAAK,OAAA,CAAC,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,YAAK,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,MAAG,CAAC,CAAC,EAA7C,CAA6C,CACxD,IAAI,GAAG,GAAG,GAAG,CACf,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,IAAY,EAAE,KAAyB;IAC3D,OAAO,KAAK,CAAC,CAAC,CAAC,UAAG,KAAK,cAAI,IAAI,CAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,WAAW,CACzB,KAA0B,EAC1B,IAAyB,EACzB,IAAY,EACZ,IAAY;IAEZ,IAAI,KAAK,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","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,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.updatePackage = updatePackage;
|
|
4
|
-
var schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
-
function updatePackage(name) {
|
|
1
|
+
import { SchematicsException, } from '@angular-devkit/schematics';
|
|
2
|
+
export function updatePackage(name) {
|
|
6
3
|
return function (tree, context) {
|
|
7
4
|
var pkgPath = '/package.json';
|
|
8
5
|
var buffer = tree.read(pkgPath);
|
|
9
6
|
if (buffer === null) {
|
|
10
|
-
throw new
|
|
7
|
+
throw new SchematicsException('Could not read package.json');
|
|
11
8
|
}
|
|
12
9
|
var content = buffer.toString();
|
|
13
10
|
var pkg = JSON.parse(content);
|
|
14
11
|
if (pkg === null || typeof pkg !== 'object' || Array.isArray(pkg)) {
|
|
15
|
-
throw new
|
|
12
|
+
throw new SchematicsException('Error reading package.json');
|
|
16
13
|
}
|
|
17
14
|
var dependencyCategories = ['dependencies', 'devDependencies'];
|
|
18
15
|
dependencyCategories.forEach(function (category) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../../../modules/store-devtools/schematics-core/utility/update.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../../../modules/store-devtools/schematics-core/utility/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,UAAU,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,mBAAmB,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,mBAAmB,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;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,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
3
2
|
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
4
3
|
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
@@ -53,22 +52,9 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
53
52
|
}
|
|
54
53
|
return ar;
|
|
55
54
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
exports.visitNgModuleImports = visitNgModuleImports;
|
|
60
|
-
exports.visitNgModuleExports = visitNgModuleExports;
|
|
61
|
-
exports.visitComponents = visitComponents;
|
|
62
|
-
exports.visitNgModules = visitNgModules;
|
|
63
|
-
exports.visitDecorator = visitDecorator;
|
|
64
|
-
exports.visitImportDeclaration = visitImportDeclaration;
|
|
65
|
-
exports.visitImportSpecifier = visitImportSpecifier;
|
|
66
|
-
exports.visitTypeReference = visitTypeReference;
|
|
67
|
-
exports.visitTypeLiteral = visitTypeLiteral;
|
|
68
|
-
exports.visitCallExpression = visitCallExpression;
|
|
69
|
-
var ts = require("typescript");
|
|
70
|
-
var core_1 = require("@angular-devkit/core");
|
|
71
|
-
function visitTSSourceFiles(tree, visitor) {
|
|
55
|
+
import * as ts from 'typescript';
|
|
56
|
+
import { normalize, resolve } from '@angular-devkit/core';
|
|
57
|
+
export function visitTSSourceFiles(tree, visitor) {
|
|
72
58
|
var e_1, _a;
|
|
73
59
|
var result = undefined;
|
|
74
60
|
try {
|
|
@@ -86,7 +72,7 @@ function visitTSSourceFiles(tree, visitor) {
|
|
|
86
72
|
}
|
|
87
73
|
return result;
|
|
88
74
|
}
|
|
89
|
-
function visitTemplates(tree, visitor) {
|
|
75
|
+
export function visitTemplates(tree, visitor) {
|
|
90
76
|
visitTSSourceFiles(tree, function (source) {
|
|
91
77
|
visitComponents(source, function (_, decoratorExpressionNode) {
|
|
92
78
|
ts.forEachChild(decoratorExpressionNode, function findTemplates(n) {
|
|
@@ -106,8 +92,8 @@ function visitTemplates(tree, visitor) {
|
|
|
106
92
|
}
|
|
107
93
|
else if (n.name.text === 'templateUrl' &&
|
|
108
94
|
ts.isStringLiteralLike(n.initializer)) {
|
|
109
|
-
var parts =
|
|
110
|
-
var templatePath =
|
|
95
|
+
var parts = normalize(source.fileName).split('/').slice(0, -1);
|
|
96
|
+
var templatePath = resolve(normalize(parts.join('/')), normalize(n.initializer.text));
|
|
111
97
|
if (!tree.exists(templatePath)) {
|
|
112
98
|
return;
|
|
113
99
|
}
|
|
@@ -129,10 +115,10 @@ function visitTemplates(tree, visitor) {
|
|
|
129
115
|
});
|
|
130
116
|
});
|
|
131
117
|
}
|
|
132
|
-
function visitNgModuleImports(sourceFile, callback) {
|
|
118
|
+
export function visitNgModuleImports(sourceFile, callback) {
|
|
133
119
|
visitNgModuleProperty(sourceFile, callback, 'imports');
|
|
134
120
|
}
|
|
135
|
-
function visitNgModuleExports(sourceFile, callback) {
|
|
121
|
+
export function visitNgModuleExports(sourceFile, callback) {
|
|
136
122
|
visitNgModuleProperty(sourceFile, callback, 'exports');
|
|
137
123
|
}
|
|
138
124
|
function visitNgModuleProperty(sourceFile, callback, property) {
|
|
@@ -149,13 +135,13 @@ function visitNgModuleProperty(sourceFile, callback, property) {
|
|
|
149
135
|
});
|
|
150
136
|
});
|
|
151
137
|
}
|
|
152
|
-
function visitComponents(sourceFile, callback) {
|
|
138
|
+
export function visitComponents(sourceFile, callback) {
|
|
153
139
|
visitDecorator(sourceFile, 'Component', callback);
|
|
154
140
|
}
|
|
155
|
-
function visitNgModules(sourceFile, callback) {
|
|
141
|
+
export function visitNgModules(sourceFile, callback) {
|
|
156
142
|
visitDecorator(sourceFile, 'NgModule', callback);
|
|
157
143
|
}
|
|
158
|
-
function visitDecorator(sourceFile, decoratorName, callback) {
|
|
144
|
+
export function visitDecorator(sourceFile, decoratorName, callback) {
|
|
159
145
|
ts.forEachChild(sourceFile, function findClassDeclaration(node) {
|
|
160
146
|
if (!ts.isClassDeclaration(node)) {
|
|
161
147
|
ts.forEachChild(node, findClassDeclaration);
|
|
@@ -184,7 +170,7 @@ function visitDecorator(sourceFile, decoratorName, callback) {
|
|
|
184
170
|
callback(classDeclarationNode, arg);
|
|
185
171
|
});
|
|
186
172
|
}
|
|
187
|
-
function visitImportDeclaration(node, callback) {
|
|
173
|
+
export function visitImportDeclaration(node, callback) {
|
|
188
174
|
if (ts.isImportDeclaration(node)) {
|
|
189
175
|
var moduleSpecifier = node.moduleSpecifier.getText();
|
|
190
176
|
var moduleName = moduleSpecifier.replaceAll('"', '').replaceAll("'", '');
|
|
@@ -194,7 +180,7 @@ function visitImportDeclaration(node, callback) {
|
|
|
194
180
|
visitImportDeclaration(child, callback);
|
|
195
181
|
});
|
|
196
182
|
}
|
|
197
|
-
function visitImportSpecifier(node, callback) {
|
|
183
|
+
export function visitImportSpecifier(node, callback) {
|
|
198
184
|
var e_2, _a, e_3, _b;
|
|
199
185
|
var importClause = node.importClause;
|
|
200
186
|
if (!importClause) {
|
|
@@ -232,7 +218,7 @@ function visitImportSpecifier(node, callback) {
|
|
|
232
218
|
finally { if (e_2) throw e_2.error; }
|
|
233
219
|
}
|
|
234
220
|
}
|
|
235
|
-
function visitTypeReference(node, callback) {
|
|
221
|
+
export function visitTypeReference(node, callback) {
|
|
236
222
|
if (ts.isTypeReferenceNode(node)) {
|
|
237
223
|
callback(node);
|
|
238
224
|
}
|
|
@@ -240,7 +226,7 @@ function visitTypeReference(node, callback) {
|
|
|
240
226
|
visitTypeReference(child, callback);
|
|
241
227
|
});
|
|
242
228
|
}
|
|
243
|
-
function visitTypeLiteral(node, callback) {
|
|
229
|
+
export function visitTypeLiteral(node, callback) {
|
|
244
230
|
if (ts.isTypeLiteralNode(node)) {
|
|
245
231
|
callback(node);
|
|
246
232
|
}
|
|
@@ -248,7 +234,7 @@ function visitTypeLiteral(node, callback) {
|
|
|
248
234
|
visitTypeLiteral(child, callback);
|
|
249
235
|
});
|
|
250
236
|
}
|
|
251
|
-
function visitCallExpression(node, callback) {
|
|
237
|
+
export function visitCallExpression(node, callback) {
|
|
252
238
|
if (ts.isCallExpression(node)) {
|
|
253
239
|
callback(node);
|
|
254
240
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visitors.js","sourceRoot":"","sources":["../../../../../modules/store-devtools/schematics-core/utility/visitors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,gDAcC;AAED,wCAoEC;AAED,oDAQC;AAED,oDAQC;AA0BD,0CAQC;AAED,wCAQC;AAED,wCA4CC;AAED,wDAiBC;AAED,oDAoBC;AAED,gDAWC;AAED,4CAWC;AAED,kDAWC;AAtRD,+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;AAED,SAAgB,cAAc,CAC5B,IAAU,EACV,OAQS;IAET,k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IACvC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAU,KAAK,CAAC,SAAmB;;;;;;;gBACd,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,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\nexport function visitImportDeclaration(\n node: ts.Node,\n callback: (\n importDeclaration: ts.ImportDeclaration,\n moduleName?: string\n ) => void\n) {\n if (ts.isImportDeclaration(node)) {\n const moduleSpecifier = node.moduleSpecifier.getText();\n const moduleName = moduleSpecifier.replaceAll('\"', '').replaceAll(\"'\", '');\n\n callback(node, moduleName);\n }\n\n ts.forEachChild(node, (child) => {\n visitImportDeclaration(child, callback);\n });\n}\n\nexport function visitImportSpecifier(\n node: ts.ImportDeclaration,\n callback: (importSpecifier: ts.ImportSpecifier) => void\n) {\n const { importClause } = node;\n if (!importClause) {\n return;\n }\n\n const importClauseChildren = importClause.getChildren();\n for (const namedImport of importClauseChildren) {\n if (ts.isNamedImports(namedImport)) {\n const namedImportChildren = namedImport.elements;\n for (const importSpecifier of namedImportChildren) {\n if (ts.isImportSpecifier(importSpecifier)) {\n callback(importSpecifier);\n }\n }\n }\n }\n}\n\nexport function visitTypeReference(\n node: ts.Node,\n callback: (typeReference: ts.TypeReferenceNode) => void\n) {\n if (ts.isTypeReferenceNode(node)) {\n callback(node);\n }\n\n ts.forEachChild(node, (child) => {\n visitTypeReference(child, callback);\n });\n}\n\nexport function visitTypeLiteral(\n node: ts.Node,\n callback: (typeLiteral: ts.TypeLiteralNode) => void\n) {\n if (ts.isTypeLiteralNode(node)) {\n callback(node);\n }\n\n ts.forEachChild(node, (child) => {\n visitTypeLiteral(child, callback);\n });\n}\n\nexport function visitCallExpression(\n node: ts.Node,\n callback: (callExpression: ts.CallExpression) => void\n) {\n if (ts.isCallExpression(node)) {\n callback(node);\n }\n\n ts.forEachChild(node, (child) => {\n visitCallExpression(child, callback);\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":["../../../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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\nexport function visitImportDeclaration(\n node: ts.Node,\n callback: (\n importDeclaration: ts.ImportDeclaration,\n moduleName?: string\n ) => void\n) {\n if (ts.isImportDeclaration(node)) {\n const moduleSpecifier = node.moduleSpecifier.getText();\n const moduleName = moduleSpecifier.replaceAll('\"', '').replaceAll(\"'\", '');\n\n callback(node, moduleName);\n }\n\n ts.forEachChild(node, (child) => {\n visitImportDeclaration(child, callback);\n });\n}\n\nexport function visitImportSpecifier(\n node: ts.ImportDeclaration,\n callback: (importSpecifier: ts.ImportSpecifier) => void\n) {\n const { importClause } = node;\n if (!importClause) {\n return;\n }\n\n const importClauseChildren = importClause.getChildren();\n for (const namedImport of importClauseChildren) {\n if (ts.isNamedImports(namedImport)) {\n const namedImportChildren = namedImport.elements;\n for (const importSpecifier of namedImportChildren) {\n if (ts.isImportSpecifier(importSpecifier)) {\n callback(importSpecifier);\n }\n }\n }\n }\n}\n\nexport function visitTypeReference(\n node: ts.Node,\n callback: (typeReference: ts.TypeReferenceNode) => void\n) {\n if (ts.isTypeReferenceNode(node)) {\n callback(node);\n }\n\n ts.forEachChild(node, (child) => {\n visitTypeReference(child, callback);\n });\n}\n\nexport function visitTypeLiteral(\n node: ts.Node,\n callback: (typeLiteral: ts.TypeLiteralNode) => void\n) {\n if (ts.isTypeLiteralNode(node)) {\n callback(node);\n }\n\n ts.forEachChild(node, (child) => {\n visitTypeLiteral(child, callback);\n });\n}\n\nexport function visitCallExpression(\n node: ts.Node,\n callback: (callExpression: ts.CallExpression) => void\n) {\n if (ts.isCallExpression(node)) {\n callback(node);\n }\n\n ts.forEachChild(node, (child) => {\n visitCallExpression(child, callback);\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"]}
|