@nx/angular 23.0.0-beta.11 → 23.0.0-beta.13
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/migrations.json +0 -533
- package/package.json +8 -8
- package/plugins/component-testing.js +2 -2
- package/src/builders/utilities/buildable-libs.d.ts +1 -1
- package/src/builders/utilities/buildable-libs.d.ts.map +1 -1
- package/src/builders/utilities/buildable-libs.js +3 -3
- package/src/builders/utilities/module-federation.d.ts.map +1 -1
- package/src/builders/utilities/module-federation.js +2 -3
- package/src/builders/utilities/webpack.js +1 -1
- package/src/executors/delegate-build/delegate-build.impl.js +3 -3
- package/src/executors/ng-packagr-lite/ng-packagr-lite.impl.js +2 -2
- package/src/executors/package/package.impl.d.ts +1 -1
- package/src/executors/package/package.impl.d.ts.map +1 -1
- package/src/executors/package/package.impl.js +3 -3
- package/src/executors/utilities/buildable-libs.d.ts +1 -1
- package/src/executors/utilities/buildable-libs.d.ts.map +1 -1
- package/src/executors/utilities/buildable-libs.js +3 -3
- package/src/executors/utilities/esbuild-extensions.js +1 -1
- package/src/generators/application/lib/add-e2e.d.ts.map +1 -1
- package/src/generators/application/lib/add-e2e.js +4 -6
- package/src/generators/application/lib/update-tsconfig-files.js +3 -3
- package/src/generators/component/lib/component.js +2 -2
- package/src/generators/convert-to-with-mf/lib/check-name-matches.js +2 -2
- package/src/generators/convert-to-with-mf/lib/check-shared-npm-packages.js +2 -2
- package/src/generators/convert-to-with-mf/lib/is-host-remote-config.js +4 -4
- package/src/generators/convert-to-with-mf/lib/parse-ast-webpack-config.js +2 -2
- package/src/generators/federate-module/lib/add-path-to-exposes.js +6 -6
- package/src/generators/host/lib/update-ssr-setup.js +2 -2
- package/src/generators/library/lib/add-children.js +2 -2
- package/src/generators/library/lib/add-load-children.js +2 -2
- package/src/generators/library/lib/add-project.js +2 -2
- package/src/generators/library/lib/create-files.js +2 -2
- package/src/generators/library/lib/update-tsconfig-files.js +3 -3
- package/src/generators/library/library.js +2 -2
- package/src/generators/move/lib/update-module-name.js +2 -2
- package/src/generators/ng-add/migrators/migrator.d.ts.map +1 -1
- package/src/generators/ng-add/migrators/migrator.js +10 -5
- package/src/generators/ng-add/migrators/projects/e2e.migrator.js +6 -6
- package/src/generators/ng-add/utilities/workspace.js +6 -6
- package/src/generators/ngrx-feature-store/lib/add-exports-barrel.js +2 -2
- package/src/generators/ngrx-feature-store/lib/add-imports.js +2 -2
- package/src/generators/ngrx-root-store/lib/add-imports.js +2 -2
- package/src/generators/ngrx-root-store/lib/normalize-options.js +2 -2
- package/src/generators/remote/lib/update-ssr-setup.js +2 -2
- package/src/generators/remote/remote.js +2 -2
- package/src/generators/scam/lib/convert-component-to-scam.js +2 -2
- package/src/generators/scam-directive/lib/convert-directive-to-scam.js +2 -2
- package/src/generators/scam-pipe/lib/convert-pipe-to-scam.js +2 -2
- package/src/generators/setup-mf/lib/add-cypress-workaround.js +2 -2
- package/src/generators/setup-mf/lib/add-remote-to-host.d.ts.map +1 -1
- package/src/generators/setup-mf/lib/add-remote-to-host.js +5 -6
- package/src/generators/setup-mf/lib/remove-dead-code-from-remote.js +2 -2
- package/src/generators/setup-ssr/lib/add-hydration.d.ts.map +1 -1
- package/src/generators/setup-ssr/lib/add-hydration.js +3 -4
- package/src/generators/setup-ssr/lib/add-server-file.js +2 -2
- package/src/generators/setup-ssr/lib/generate-files.js +2 -2
- package/src/generators/setup-ssr/lib/generate-server-ts-config.js +2 -2
- package/src/generators/setup-ssr/lib/update-project-config.d.ts.map +1 -1
- package/src/generators/setup-ssr/lib/update-project-config.js +19 -7
- package/src/generators/utils/add-mf-env-to-inputs.d.ts.map +1 -1
- package/src/generators/utils/add-mf-env-to-inputs.js +16 -9
- package/src/generators/utils/add-vitest.d.ts.map +1 -1
- package/src/generators/utils/add-vitest.js +16 -9
- package/src/generators/utils/app-components-info.js +2 -2
- package/src/generators/utils/find-module.js +2 -2
- package/src/generators/utils/insert-ngmodule-import.js +6 -6
- package/src/generators/utils/storybook-ast/component-info.js +5 -5
- package/src/generators/utils/storybook-ast/module-info.js +9 -9
- package/src/generators/utils/storybook-ast/storybook-inputs.js +4 -4
- package/src/generators/utils/testing.js +2 -2
- package/src/generators/utils/tsconfig-utils.js +2 -2
- package/src/generators/utils/validations.js +2 -2
- package/src/migrations/update-19-6-1/ensure-depends-on-for-mf.d.ts.map +1 -1
- package/src/migrations/update-19-6-1/ensure-depends-on-for-mf.js +25 -18
- package/src/migrations/update-20-2-0/remove-tailwind-config-from-ng-packagr-executors.d.ts.map +1 -1
- package/src/migrations/update-20-2-0/remove-tailwind-config-from-ng-packagr-executors.js +43 -10
- package/src/migrations/update-21-0-0/change-data-persistence-operators-imports-to-ngrx-router-store-data-persistence.js +2 -2
- package/src/migrations/update-21-5-0/utils/karma-config-analyzer.js +2 -2
- package/src/migrations/update-22-3-0/update-module-resolution.js +2 -2
- package/src/migrations/update-22-3-0/update-ssr-webpack-config.js +2 -2
- package/src/utils/nx-devkit/ast-utils.d.ts.map +1 -1
- package/src/utils/nx-devkit/ast-utils.js +17 -18
- package/src/utils/nx-devkit/route-utils.js +3 -3
- package/tailwind.js +2 -2
- package/src/migrations/update-17-1-0/browser-target-to-build-target.d.ts +0 -4
- package/src/migrations/update-17-1-0/browser-target-to-build-target.d.ts.map +0 -1
- package/src/migrations/update-17-1-0/browser-target-to-build-target.js +0 -50
- package/src/migrations/update-17-1-0/replace-nguniversal-builders.d.ts +0 -3
- package/src/migrations/update-17-1-0/replace-nguniversal-builders.d.ts.map +0 -1
- package/src/migrations/update-17-1-0/replace-nguniversal-builders.js +0 -75
- package/src/migrations/update-17-1-0/replace-nguniversal-engines.d.ts +0 -3
- package/src/migrations/update-17-1-0/replace-nguniversal-engines.d.ts.map +0 -1
- package/src/migrations/update-17-1-0/replace-nguniversal-engines.js +0 -184
- package/src/migrations/update-17-1-0/update-angular-cli.d.ts +0 -4
- package/src/migrations/update-17-1-0/update-angular-cli.d.ts.map +0 -1
- package/src/migrations/update-17-1-0/update-angular-cli.js +0 -14
- package/src/migrations/update-17-1-0/update-zone-js-deep-import.d.ts +0 -3
- package/src/migrations/update-17-1-0/update-zone-js-deep-import.d.ts.map +0 -1
- package/src/migrations/update-17-1-0/update-zone-js-deep-import.js +0 -37
- package/src/migrations/update-17-2-0/rename-webpack-dev-server.d.ts +0 -3
- package/src/migrations/update-17-2-0/rename-webpack-dev-server.d.ts.map +0 -1
- package/src/migrations/update-17-2-0/rename-webpack-dev-server.js +0 -40
- package/src/migrations/update-17-3-0/add-autoprefixer-dependency.d.ts +0 -3
- package/src/migrations/update-17-3-0/add-autoprefixer-dependency.d.ts.map +0 -1
- package/src/migrations/update-17-3-0/add-autoprefixer-dependency.js +0 -25
- package/src/migrations/update-17-3-0/add-browser-sync-dependency.d.ts +0 -3
- package/src/migrations/update-17-3-0/add-browser-sync-dependency.d.ts.map +0 -1
- package/src/migrations/update-17-3-0/add-browser-sync-dependency.js +0 -25
- package/src/migrations/update-17-3-0/update-angular-cli.d.ts +0 -4
- package/src/migrations/update-17-3-0/update-angular-cli.d.ts.map +0 -1
- package/src/migrations/update-17-3-0/update-angular-cli.js +0 -14
- package/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.d.ts +0 -3
- package/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.d.ts.map +0 -1
- package/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.js +0 -26
- package/src/migrations/update-18-1-0/update-angular-cli.d.ts +0 -4
- package/src/migrations/update-18-1-0/update-angular-cli.d.ts.map +0 -1
- package/src/migrations/update-18-1-0/update-angular-cli.js +0 -14
- package/src/migrations/update-18-1-1/fix-target-defaults-inputs.d.ts +0 -3
- package/src/migrations/update-18-1-1/fix-target-defaults-inputs.d.ts.map +0 -1
- package/src/migrations/update-18-1-1/fix-target-defaults-inputs.js +0 -53
- package/src/migrations/update-18-2-0/update-angular-cli.d.ts +0 -4
- package/src/migrations/update-18-2-0/update-angular-cli.d.ts.map +0 -1
- package/src/migrations/update-18-2-0/update-angular-cli.js +0 -14
- package/src/migrations/update-19-1-0/update-angular-cli.d.ts +0 -4
- package/src/migrations/update-19-1-0/update-angular-cli.d.ts.map +0 -1
- package/src/migrations/update-19-1-0/update-angular-cli.js +0 -14
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getComponentsInfo = getComponentsInfo;
|
|
4
4
|
exports.getStandaloneComponentsInfo = getStandaloneComponentsInfo;
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const
|
|
6
|
+
const internal_1 = require("@nx/js/internal");
|
|
7
7
|
const path_1 = require("path");
|
|
8
8
|
const ast_utils_1 = require("../../../utils/nx-devkit/ast-utils");
|
|
9
9
|
const module_info_1 = require("./module-info");
|
|
@@ -19,7 +19,7 @@ function getComponentsInfo(tree, entryPoint, moduleFilePaths, projectName) {
|
|
|
19
19
|
return undefined;
|
|
20
20
|
}
|
|
21
21
|
if (!tsModule) {
|
|
22
|
-
tsModule = (0,
|
|
22
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
23
23
|
}
|
|
24
24
|
const imports = file.statements.filter((statement) => statement.kind === tsModule.SyntaxKind.ImportDeclaration);
|
|
25
25
|
const componentsInfo = moduleDeclarations.map((maybeComponentName) => tryGetComponentInfo(tree, entryPoint, file, imports, moduleFilePath, maybeComponentName));
|
|
@@ -56,7 +56,7 @@ function getStandaloneComponentsInfo(tree, entryPoint) {
|
|
|
56
56
|
}
|
|
57
57
|
function getStandaloneComponents(tree, filePath) {
|
|
58
58
|
if (!tsqueryAst) {
|
|
59
|
-
(0,
|
|
59
|
+
(0, internal_1.ensureTypescript)();
|
|
60
60
|
const tsqueryModule = require('@phenomnomnominal/tsquery');
|
|
61
61
|
tsqueryAst = tsqueryModule.ast;
|
|
62
62
|
tsqueryQuery = tsqueryModule.query;
|
|
@@ -70,7 +70,7 @@ function getStandaloneComponents(tree, filePath) {
|
|
|
70
70
|
}
|
|
71
71
|
function getComponentImportPath(componentName, imports) {
|
|
72
72
|
if (!tsModule) {
|
|
73
|
-
tsModule = (0,
|
|
73
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
74
74
|
}
|
|
75
75
|
const componentImportStatement = imports.find((statement) => {
|
|
76
76
|
const namedImports = statement
|
|
@@ -98,7 +98,7 @@ function getComponentImportPath(componentName, imports) {
|
|
|
98
98
|
function tryGetComponentInfo(tree, entryPoint, sourceFile, imports, moduleFilePath, symbolName) {
|
|
99
99
|
try {
|
|
100
100
|
if (!tsqueryQuery) {
|
|
101
|
-
(0,
|
|
101
|
+
(0, internal_1.ensureTypescript)();
|
|
102
102
|
const tsqueryModule = require('@phenomnomnominal/tsquery');
|
|
103
103
|
tsqueryAst = tsqueryModule.ast;
|
|
104
104
|
tsqueryQuery = tsqueryModule.query;
|
|
@@ -6,7 +6,7 @@ const devkit_1 = require("@nx/devkit");
|
|
|
6
6
|
const js_1 = require("@nx/js");
|
|
7
7
|
const path_1 = require("path");
|
|
8
8
|
const ast_utils_1 = require("../../../utils/nx-devkit/ast-utils");
|
|
9
|
-
const
|
|
9
|
+
const internal_1 = require("@nx/js/internal");
|
|
10
10
|
let tsModule;
|
|
11
11
|
function getModuleDeclarations(file, moduleFilePath, projectName) {
|
|
12
12
|
const ngModuleDecorator = getNgModuleDecorator(file, moduleFilePath);
|
|
@@ -36,7 +36,7 @@ function getModuleFilePaths(tree, entryPoint) {
|
|
|
36
36
|
return moduleFilePaths;
|
|
37
37
|
}
|
|
38
38
|
function hasNgModule(tree, filePath) {
|
|
39
|
-
(0,
|
|
39
|
+
(0, internal_1.ensureTypescript)();
|
|
40
40
|
const { ast, query } = require('@phenomnomnominal/tsquery');
|
|
41
41
|
const fileContent = tree.read(filePath, 'utf-8');
|
|
42
42
|
const sourceFile = ast(fileContent);
|
|
@@ -45,7 +45,7 @@ function hasNgModule(tree, filePath) {
|
|
|
45
45
|
}
|
|
46
46
|
function getDeclaredComponentNodes(declarationsArray) {
|
|
47
47
|
if (!tsModule) {
|
|
48
|
-
tsModule = (0,
|
|
48
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
49
49
|
}
|
|
50
50
|
const cmps = declarationsArray
|
|
51
51
|
.getChildren()
|
|
@@ -88,7 +88,7 @@ function flatten(arr) {
|
|
|
88
88
|
}
|
|
89
89
|
function getDeclarationsArray(file, declarationsPropertyAssignment, moduleFilePath, projectName) {
|
|
90
90
|
if (!tsModule) {
|
|
91
|
-
tsModule = (0,
|
|
91
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
92
92
|
}
|
|
93
93
|
let declarationArray = declarationsPropertyAssignment
|
|
94
94
|
.getChildren()
|
|
@@ -113,7 +113,7 @@ function getDeclarationsArray(file, declarationsPropertyAssignment, moduleFilePa
|
|
|
113
113
|
*/
|
|
114
114
|
function getModuleDeclaredComponentsFromVariable(file, declarationsPropertyAssignment) {
|
|
115
115
|
if (!tsModule) {
|
|
116
|
-
tsModule = (0,
|
|
116
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
117
117
|
}
|
|
118
118
|
let declarationsVariable = declarationsPropertyAssignment
|
|
119
119
|
.getChildren()
|
|
@@ -137,7 +137,7 @@ function getModuleDeclaredComponentsFromVariable(file, declarationsPropertyAssig
|
|
|
137
137
|
*/
|
|
138
138
|
function getModuleDeclaredComponentsFromClass(file, declarationsPropertyAssignment) {
|
|
139
139
|
if (!tsModule) {
|
|
140
|
-
tsModule = (0,
|
|
140
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
141
141
|
}
|
|
142
142
|
const propertyAccessExpression = declarationsPropertyAssignment
|
|
143
143
|
.getChildren()
|
|
@@ -169,7 +169,7 @@ function getModuleDeclaredComponentsFromClass(file, declarationsPropertyAssignme
|
|
|
169
169
|
}
|
|
170
170
|
function getClassDeclaration(className, file) {
|
|
171
171
|
if (!tsModule) {
|
|
172
|
-
tsModule = (0,
|
|
172
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
173
173
|
}
|
|
174
174
|
const classDeclaration = (0, js_1.findNodes)(file, tsModule.SyntaxKind.ClassDeclaration).find((classDeclaration) => classDeclaration
|
|
175
175
|
.getChildren()
|
|
@@ -179,7 +179,7 @@ function getClassDeclaration(className, file) {
|
|
|
179
179
|
}
|
|
180
180
|
function getVariableDeclaration(variableName, file) {
|
|
181
181
|
if (!tsModule) {
|
|
182
|
-
tsModule = (0,
|
|
182
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
183
183
|
}
|
|
184
184
|
const variableDeclaration = (0, js_1.findNodes)(file, tsModule.SyntaxKind.VariableDeclaration).find((variableDeclaration) => variableDeclaration
|
|
185
185
|
.getChildren()
|
|
@@ -189,7 +189,7 @@ function getVariableDeclaration(variableName, file) {
|
|
|
189
189
|
}
|
|
190
190
|
function getNgModuleDeclarationsPropertyAssignment(ngModuleDecorator, moduleFilePath, projectName) {
|
|
191
191
|
if (!tsModule) {
|
|
192
|
-
tsModule = (0,
|
|
192
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
193
193
|
}
|
|
194
194
|
const syntaxList = ngModuleDecorator.getChildren().find((node) => {
|
|
195
195
|
return node.kind === tsModule.SyntaxKind.SyntaxList;
|
|
@@ -6,11 +6,11 @@ exports.getArgType = getArgType;
|
|
|
6
6
|
exports.getArgsDefaultValue = getArgsDefaultValue;
|
|
7
7
|
const js_1 = require("@nx/js");
|
|
8
8
|
const ast_utils_1 = require("../../../utils/nx-devkit/ast-utils");
|
|
9
|
-
const
|
|
9
|
+
const internal_1 = require("@nx/js/internal");
|
|
10
10
|
let tsModule;
|
|
11
11
|
function getInputPropertyDeclarations(tree, path) {
|
|
12
12
|
if (!tsModule) {
|
|
13
|
-
tsModule = (0,
|
|
13
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
14
14
|
}
|
|
15
15
|
const file = (0, ast_utils_1.getTsSourceFile)(tree, path);
|
|
16
16
|
const decorators = (0, js_1.getSourceNodes)(file).filter((node) => node.kind === tsModule.SyntaxKind.Decorator);
|
|
@@ -20,7 +20,7 @@ function getInputPropertyDeclarations(tree, path) {
|
|
|
20
20
|
}
|
|
21
21
|
function getComponentProps(tree, componentPath, getArgsDefaultValueFn = getArgsDefaultValue, useDecoratorName = true) {
|
|
22
22
|
if (!tsModule) {
|
|
23
|
-
tsModule = (0,
|
|
23
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
24
24
|
}
|
|
25
25
|
const props = getInputPropertyDeclarations(tree, componentPath).map((node) => {
|
|
26
26
|
const decoratorContent = (0, js_1.findNodes)((0, js_1.findNodes)(node, tsModule.SyntaxKind.Decorator).find((n) => n.getText().startsWith('@Input')), tsModule.SyntaxKind.StringLiteral);
|
|
@@ -41,7 +41,7 @@ function getComponentProps(tree, componentPath, getArgsDefaultValueFn = getArgsD
|
|
|
41
41
|
}
|
|
42
42
|
function getArgType(property) {
|
|
43
43
|
if (!tsModule) {
|
|
44
|
-
tsModule = (0,
|
|
44
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
45
45
|
}
|
|
46
46
|
if (property.type) {
|
|
47
47
|
const typeName = property.type.getText();
|
|
@@ -7,7 +7,7 @@ exports.generateTestLibrary = generateTestLibrary;
|
|
|
7
7
|
exports.createStorybookTestWorkspaceForLib = createStorybookTestWorkspaceForLib;
|
|
8
8
|
const devkit_1 = require("@nx/devkit");
|
|
9
9
|
const testing_1 = require("@nx/devkit/testing");
|
|
10
|
-
const
|
|
10
|
+
const internal_1 = require("@nx/js/internal");
|
|
11
11
|
const test_runners_1 = require("../../utils/test-runners");
|
|
12
12
|
const application_1 = require("../application/application");
|
|
13
13
|
const component_1 = require("../component/component");
|
|
@@ -226,7 +226,7 @@ export class StaticMemberDeclarationsModule {
|
|
|
226
226
|
function generateModule(tree, options) {
|
|
227
227
|
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
228
228
|
if (options.path === undefined) {
|
|
229
|
-
const sourceRoot = (0,
|
|
229
|
+
const sourceRoot = (0, internal_1.getProjectSourceRoot)(project, tree);
|
|
230
230
|
const projectDirName = project.projectType === 'application' ? 'app' : 'lib';
|
|
231
231
|
options.path = `${sourceRoot}/${projectDirName}`;
|
|
232
232
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getDefinedCompilerOption = getDefinedCompilerOption;
|
|
4
4
|
exports.readCompilerOptionsFromTsConfig = readCompilerOptionsFromTsConfig;
|
|
5
|
-
const
|
|
5
|
+
const internal_1 = require("@nx/js/internal");
|
|
6
6
|
const node_path_1 = require("node:path");
|
|
7
7
|
/**
|
|
8
8
|
* Gets the resolved value of a specific compiler option from the TypeScript configuration hierarchy.
|
|
@@ -17,7 +17,7 @@ function getDefinedCompilerOption(tree, tsConfigPath, optionName) {
|
|
|
17
17
|
return compilerOptions[optionName];
|
|
18
18
|
}
|
|
19
19
|
function readCompilerOptionsFromTsConfig(tree, tsConfigPath) {
|
|
20
|
-
const ts = (0,
|
|
20
|
+
const ts = (0, internal_1.ensureTypescript)();
|
|
21
21
|
const tsSysFromTree = {
|
|
22
22
|
...ts.sys,
|
|
23
23
|
readDirectory: () => [],
|
|
@@ -4,7 +4,7 @@ exports.validateProject = validateProject;
|
|
|
4
4
|
exports.validateClassName = validateClassName;
|
|
5
5
|
exports.assertNotUsingTsSolutionSetup = assertNotUsingTsSolutionSetup;
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const
|
|
7
|
+
const internal_1 = require("@nx/js/internal");
|
|
8
8
|
function validateProject(tree, projectName) {
|
|
9
9
|
const projects = (0, devkit_1.getProjects)(tree);
|
|
10
10
|
if (!projects.has(projectName)) {
|
|
@@ -22,7 +22,7 @@ function validateClassName(className) {
|
|
|
22
22
|
}
|
|
23
23
|
function assertNotUsingTsSolutionSetup(tree, generatorName) {
|
|
24
24
|
if (process.env.NX_IGNORE_UNSUPPORTED_TS_SETUP === 'true' ||
|
|
25
|
-
!(0,
|
|
25
|
+
!(0, internal_1.isUsingTsSolutionSetup)(tree)) {
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
const artifactString = generatorName === 'init'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensure-depends-on-for-mf.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/migrations/update-19-6-1/ensure-depends-on-for-mf.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,IAAI,EAAgB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"ensure-depends-on-for-mf.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/migrations/update-19-6-1/ensure-depends-on-for-mf.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,IAAI,EAAgB,MAAM,YAAY,CAAC;AAQ9E,yBAA+B,IAAI,EAAE,IAAI,iBAyExC"}
|
|
@@ -5,7 +5,7 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const internal_1 = require("@nx/devkit/internal");
|
|
6
6
|
async function default_1(tree) {
|
|
7
7
|
let usesModuleFederation = false;
|
|
8
|
-
(0, internal_1.forEachExecutorOptions)(tree, '@nx/angular:webpack-browser', (options
|
|
8
|
+
(0, internal_1.forEachExecutorOptions)(tree, '@nx/angular:webpack-browser', (options) => {
|
|
9
9
|
const webpackConfig = options.webpackConfig;
|
|
10
10
|
if (!webpackConfig) {
|
|
11
11
|
return;
|
|
@@ -18,34 +18,41 @@ async function default_1(tree) {
|
|
|
18
18
|
if (!usesModuleFederation) {
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
21
|
+
const nxJson = (0, devkit_1.readNxJson)(tree) ?? {};
|
|
22
22
|
const nxMFDevRemotesEnvVar = 'NX_MF_DEV_REMOTES';
|
|
23
|
-
const
|
|
23
|
+
const webpackExecutor = '@nx/angular:webpack-browser';
|
|
24
|
+
const defaultInputs = [
|
|
24
25
|
...(nxJson.namedInputs && 'production' in nxJson.namedInputs
|
|
25
26
|
? ['production', '^production']
|
|
26
27
|
: ['default', '^default']),
|
|
27
28
|
{ env: nxMFDevRemotesEnvVar },
|
|
28
29
|
];
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
const existing = (0, internal_1.normalizeTargetDefaults)(nxJson.targetDefaults).find((e) => e.executor === webpackExecutor &&
|
|
31
|
+
e.target === undefined &&
|
|
32
|
+
e.projects === undefined &&
|
|
33
|
+
e.plugin === undefined);
|
|
34
|
+
if (!existing) {
|
|
35
|
+
(0, internal_1.upsertTargetDefault)(tree, nxJson, {
|
|
36
|
+
executor: webpackExecutor,
|
|
33
37
|
cache: true,
|
|
34
|
-
inputs,
|
|
38
|
+
inputs: defaultInputs,
|
|
35
39
|
dependsOn: ['^build'],
|
|
36
|
-
};
|
|
40
|
+
});
|
|
37
41
|
}
|
|
38
42
|
else {
|
|
39
|
-
|
|
40
|
-
if (!
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
nxJson.targetDefaults['@nx/angular:webpack-browser'].inputs.push({
|
|
46
|
-
env: nxMFDevRemotesEnvVar,
|
|
47
|
-
});
|
|
43
|
+
const dependsOn = [...(existing.dependsOn ?? [])];
|
|
44
|
+
if (!dependsOn.includes('^build'))
|
|
45
|
+
dependsOn.push('^build');
|
|
46
|
+
const inputs = [...(existing.inputs ?? [])];
|
|
47
|
+
if (!inputs.find((i) => typeof i === 'string' ? false : i['env'] === nxMFDevRemotesEnvVar)) {
|
|
48
|
+
inputs.push({ env: nxMFDevRemotesEnvVar });
|
|
48
49
|
}
|
|
50
|
+
(0, internal_1.upsertTargetDefault)(tree, nxJson, {
|
|
51
|
+
executor: webpackExecutor,
|
|
52
|
+
...(existing.cache !== undefined ? { cache: existing.cache } : {}),
|
|
53
|
+
inputs,
|
|
54
|
+
dependsOn,
|
|
55
|
+
});
|
|
49
56
|
}
|
|
50
57
|
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
51
58
|
await (0, devkit_1.formatFiles)(tree);
|
package/src/migrations/update-20-2-0/remove-tailwind-config-from-ng-packagr-executors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove-tailwind-config-from-ng-packagr-executors.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/migrations/update-20-2-0/remove-tailwind-config-from-ng-packagr-executors.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,SAAS,UAAyD,CAAC;AAEhF,yBAA+B,IAAI,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"remove-tailwind-config-from-ng-packagr-executors.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/migrations/update-20-2-0/remove-tailwind-config-from-ng-packagr-executors.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,SAAS,UAAyD,CAAC;AAEhF,yBAA+B,IAAI,EAAE,IAAI,iBAgIxC"}
|
|
@@ -39,11 +39,7 @@ async function default_1(tree) {
|
|
|
39
39
|
if (!nxJson.targetDefaults) {
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
if (!exports.executors.includes(targetOrExecutor) &&
|
|
44
|
-
!exports.executors.includes(targetConfig.executor)) {
|
|
45
|
-
continue;
|
|
46
|
-
}
|
|
42
|
+
const cleanEntry = (targetConfig) => {
|
|
47
43
|
if (targetConfig.options) {
|
|
48
44
|
delete targetConfig.options.tailwindConfig;
|
|
49
45
|
if (!Object.keys(targetConfig.options).length) {
|
|
@@ -59,14 +55,51 @@ async function default_1(tree) {
|
|
|
59
55
|
if (!Object.keys(targetConfig.configurations ?? {}).length) {
|
|
60
56
|
delete targetConfig.configurations;
|
|
61
57
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
Object.keys(targetConfig)
|
|
65
|
-
|
|
58
|
+
return {
|
|
59
|
+
empty: !Object.keys(targetConfig).length ||
|
|
60
|
+
(Object.keys(targetConfig).length === 1 &&
|
|
61
|
+
Object.keys(targetConfig)[0] === 'executor'),
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
if (Array.isArray(nxJson.targetDefaults)) {
|
|
65
|
+
const remaining = [];
|
|
66
|
+
for (const entry of nxJson.targetDefaults) {
|
|
67
|
+
const matches = exports.executors.includes(entry.executor) || exports.executors.includes(entry.target);
|
|
68
|
+
if (!matches) {
|
|
69
|
+
remaining.push(entry);
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
const { empty } = cleanEntry(entry);
|
|
73
|
+
// Empty entries that only described executor/target wrappers are dropped.
|
|
74
|
+
const onlyKeys = Object.keys(entry).filter((k) => k !== 'target' &&
|
|
75
|
+
k !== 'executor' &&
|
|
76
|
+
k !== 'projects' &&
|
|
77
|
+
k !== 'plugin');
|
|
78
|
+
if (empty && onlyKeys.length === 0)
|
|
79
|
+
continue;
|
|
80
|
+
remaining.push(entry);
|
|
66
81
|
}
|
|
67
|
-
if (
|
|
82
|
+
if (remaining.length === 0) {
|
|
68
83
|
delete nxJson.targetDefaults;
|
|
69
84
|
}
|
|
85
|
+
else {
|
|
86
|
+
nxJson.targetDefaults = remaining;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
for (const [targetOrExecutor, targetConfig] of Object.entries(nxJson.targetDefaults)) {
|
|
91
|
+
if (!exports.executors.includes(targetOrExecutor) &&
|
|
92
|
+
!exports.executors.includes(targetConfig.executor)) {
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
const { empty } = cleanEntry(targetConfig);
|
|
96
|
+
if (empty) {
|
|
97
|
+
delete nxJson.targetDefaults[targetOrExecutor];
|
|
98
|
+
}
|
|
99
|
+
if (!Object.keys(nxJson.targetDefaults).length) {
|
|
100
|
+
delete nxJson.targetDefaults;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
70
103
|
}
|
|
71
104
|
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
72
105
|
await (0, devkit_1.formatFiles)(tree);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = default_1;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
5
|
+
const internal_1 = require("@nx/js/internal");
|
|
6
6
|
const project_graph_1 = require("nx/src/config/project-graph");
|
|
7
7
|
const nx_deps_cache_1 = require("nx/src/project-graph/nx-deps-cache");
|
|
8
8
|
const version_utils_1 = require("../../generators/utils/version-utils");
|
|
@@ -23,7 +23,7 @@ async function default_1(tree) {
|
|
|
23
23
|
if (!projects.length) {
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
|
-
(0,
|
|
26
|
+
(0, internal_1.ensureTypescript)();
|
|
27
27
|
const tsqueryModule = require('@phenomnomnominal/tsquery');
|
|
28
28
|
tsqueryAst = tsqueryModule.ast;
|
|
29
29
|
tsqueryQuery = tsqueryModule.query;
|
|
@@ -11,7 +11,7 @@ exports.analyzeKarmaConfig = analyzeKarmaConfig;
|
|
|
11
11
|
/**
|
|
12
12
|
* Adapts the private utility from Angular CLI to be used in the migration.
|
|
13
13
|
*/
|
|
14
|
-
const
|
|
14
|
+
const internal_1 = require("@nx/js/internal");
|
|
15
15
|
let ts;
|
|
16
16
|
/**
|
|
17
17
|
* Analyzes the content of a Karma configuration file to extract its settings.
|
|
@@ -21,7 +21,7 @@ let ts;
|
|
|
21
21
|
*/
|
|
22
22
|
function analyzeKarmaConfig(content) {
|
|
23
23
|
if (!ts) {
|
|
24
|
-
ts = (0,
|
|
24
|
+
ts = (0, internal_1.ensureTypescript)();
|
|
25
25
|
}
|
|
26
26
|
const sourceFile = ts.createSourceFile('karma.conf.js', content, ts.ScriptTarget.Latest, true);
|
|
27
27
|
const settings = new Map();
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = default_1;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
5
|
+
const internal_1 = require("@nx/js/internal");
|
|
6
6
|
const tsconfig_utils_1 = require("../../generators/utils/tsconfig-utils");
|
|
7
7
|
const targets_1 = require("../../utils/targets");
|
|
8
8
|
const projects_1 = require("../utils/projects");
|
|
@@ -43,7 +43,7 @@ async function default_1(tree) {
|
|
|
43
43
|
await (0, devkit_1.formatFiles)(tree);
|
|
44
44
|
}
|
|
45
45
|
function updateModuleAndModuleResolution(tree, tsConfigPath) {
|
|
46
|
-
const ts = (0,
|
|
46
|
+
const ts = (0, internal_1.ensureTypescript)();
|
|
47
47
|
// Read the resolved compiler options from the tsconfig
|
|
48
48
|
const compilerOptions = (0, tsconfig_utils_1.readCompilerOptionsFromTsConfig)(tree, tsConfigPath);
|
|
49
49
|
// Check if both module and moduleResolution are already set correctly
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = default_1;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
5
|
+
const internal_1 = require("@nx/js/internal");
|
|
6
6
|
const tsconfig_utils_1 = require("../../generators/utils/tsconfig-utils");
|
|
7
7
|
const file_change_recorder_1 = require("../../utils/file-change-recorder");
|
|
8
8
|
const targets_1 = require("../../utils/targets");
|
|
@@ -52,7 +52,7 @@ async function default_1(tree) {
|
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
// Second pass: process each project
|
|
55
|
-
ts = (0,
|
|
55
|
+
ts = (0, internal_1.ensureTypescript)();
|
|
56
56
|
for (const { tsConfigPath, serverFiles } of projectFilesMap.values()) {
|
|
57
57
|
const wasUpdated = updateTsConfigServer(tree, tsConfigPath);
|
|
58
58
|
// Only update server files if tsconfig was actually modified
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast-utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/utils/nx-devkit/ast-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,IAAI,EACL,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"ast-utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/utils/nx-devkit/ast-utils.ts"],"names":[],"mappings":"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"}
|
|
@@ -25,13 +25,12 @@ exports.getDecoratorPropertyValueNode = getDecoratorPropertyValueNode;
|
|
|
25
25
|
exports.getTsSourceFile = getTsSourceFile;
|
|
26
26
|
const devkit_1 = require("@nx/devkit");
|
|
27
27
|
const js_1 = require("@nx/js");
|
|
28
|
-
const
|
|
29
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
28
|
+
const internal_1 = require("@nx/js/internal");
|
|
30
29
|
const path_1 = require("path");
|
|
31
30
|
let tsModule;
|
|
32
31
|
function _angularImportsFromNode(node, _sourceFile) {
|
|
33
32
|
if (!tsModule) {
|
|
34
|
-
tsModule = (0,
|
|
33
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
35
34
|
}
|
|
36
35
|
const ms = node.moduleSpecifier;
|
|
37
36
|
let modulePath;
|
|
@@ -94,7 +93,7 @@ function isStandalone(tree, sourceFile, decoratorName) {
|
|
|
94
93
|
}
|
|
95
94
|
function getDecoratorMetadata(source, identifier, module) {
|
|
96
95
|
if (!tsModule) {
|
|
97
|
-
tsModule = (0,
|
|
96
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
98
97
|
}
|
|
99
98
|
const angularImports = (0, js_1.findNodes)(source, tsModule.SyntaxKind.ImportDeclaration)
|
|
100
99
|
.map((node) => _angularImportsFromNode(node, source))
|
|
@@ -142,7 +141,7 @@ function _addSymbolToDecoratorMetadata(host, source, filePath, metadataField, ex
|
|
|
142
141
|
return source;
|
|
143
142
|
}
|
|
144
143
|
if (!tsModule) {
|
|
145
|
-
tsModule = (0,
|
|
144
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
146
145
|
}
|
|
147
146
|
// Get all the children property assignment of object literals.
|
|
148
147
|
const matchingProperties = node.properties
|
|
@@ -311,7 +310,7 @@ function addImportToModule(host, source, modulePath, symbolName) {
|
|
|
311
310
|
}
|
|
312
311
|
function addImportToTestBed(host, source, specPath, symbolName) {
|
|
313
312
|
if (!tsModule) {
|
|
314
|
-
tsModule = (0,
|
|
313
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
315
314
|
}
|
|
316
315
|
const allCalls = ((0, js_1.findNodes)(source, tsModule.SyntaxKind.CallExpression));
|
|
317
316
|
const configureTestingModuleObjectLiterals = allCalls
|
|
@@ -330,7 +329,7 @@ function addImportToTestBed(host, source, specPath, symbolName) {
|
|
|
330
329
|
}
|
|
331
330
|
function addDeclarationsToTestBed(host, source, specPath, symbolName) {
|
|
332
331
|
if (!tsModule) {
|
|
333
|
-
tsModule = (0,
|
|
332
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
334
333
|
}
|
|
335
334
|
const allCalls = ((0, js_1.findNodes)(source, tsModule.SyntaxKind.CallExpression));
|
|
336
335
|
const configureTestingModuleObjectLiterals = allCalls
|
|
@@ -349,7 +348,7 @@ function addDeclarationsToTestBed(host, source, specPath, symbolName) {
|
|
|
349
348
|
}
|
|
350
349
|
function replaceIntoToTestBed(host, source, specPath, newSymbol, previousSymbol) {
|
|
351
350
|
if (!tsModule) {
|
|
352
|
-
tsModule = (0,
|
|
351
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
353
352
|
}
|
|
354
353
|
const allCalls = ((0, js_1.findNodes)(source, tsModule.SyntaxKind.CallExpression));
|
|
355
354
|
const configureTestingModuleObjectLiterals = allCalls
|
|
@@ -400,7 +399,7 @@ function addRouteToNgModule(host, ngModulePath, source, route) {
|
|
|
400
399
|
}
|
|
401
400
|
function getListOfRoutes(source) {
|
|
402
401
|
if (!tsModule) {
|
|
403
|
-
tsModule = (0,
|
|
402
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
404
403
|
}
|
|
405
404
|
const imports = getMatchingProperty(source, 'imports', 'NgModule', '@angular/core');
|
|
406
405
|
if (imports?.initializer.kind === tsModule.SyntaxKind.ArrayLiteralExpression) {
|
|
@@ -441,14 +440,14 @@ function isNgStandaloneApp(tree, projectName) {
|
|
|
441
440
|
hasMainFile = true;
|
|
442
441
|
}
|
|
443
442
|
else {
|
|
444
|
-
const sourceRoot = (0,
|
|
443
|
+
const sourceRoot = (0, internal_1.getProjectSourceRoot)(project, tree);
|
|
445
444
|
mainFile = (0, devkit_1.joinPathFragments)(sourceRoot, 'main.ts');
|
|
446
445
|
hasMainFile = tree.exists(mainFile);
|
|
447
446
|
}
|
|
448
447
|
if (project.projectType !== 'application' || !hasMainFile) {
|
|
449
448
|
return false;
|
|
450
449
|
}
|
|
451
|
-
(0,
|
|
450
|
+
(0, internal_1.ensureTypescript)();
|
|
452
451
|
const { ast, query } = require('@phenomnomnominal/tsquery');
|
|
453
452
|
const mainFileContents = tree.read(mainFile, 'utf-8');
|
|
454
453
|
const BOOTSTRAP_APPLICATION_SELECTOR = 'CallExpression:has(Identifier[name=bootstrapApplication])';
|
|
@@ -463,7 +462,7 @@ function isNgStandaloneApp(tree, projectName) {
|
|
|
463
462
|
* @param providerToAdd Provider to add
|
|
464
463
|
*/
|
|
465
464
|
function addProviderToBootstrapApplication(tree, filePath, providerToAdd) {
|
|
466
|
-
(0,
|
|
465
|
+
(0, internal_1.ensureTypescript)();
|
|
467
466
|
const { ast, query } = require('@phenomnomnominal/tsquery');
|
|
468
467
|
const PROVIDERS_ARRAY_SELECTOR = 'CallExpression:has(Identifier[name=bootstrapApplication]) ObjectLiteralExpression > PropertyAssignment:has(Identifier[name=providers]) > ArrayLiteralExpression';
|
|
469
468
|
const fileContents = tree.read(filePath, 'utf-8');
|
|
@@ -484,7 +483,7 @@ function addProviderToBootstrapApplication(tree, filePath, providerToAdd) {
|
|
|
484
483
|
* @param providerToAdd Provider to add
|
|
485
484
|
*/
|
|
486
485
|
function addProviderToAppConfig(tree, filePath, providerToAdd) {
|
|
487
|
-
(0,
|
|
486
|
+
(0, internal_1.ensureTypescript)();
|
|
488
487
|
const { ast, query } = require('@phenomnomnominal/tsquery');
|
|
489
488
|
const PROVIDERS_ARRAY_SELECTOR = 'VariableDeclaration:has(TypeReference > Identifier[name=ApplicationConfig]) > ObjectLiteralExpression PropertyAssignment:has(Identifier[name=providers]) > ArrayLiteralExpression';
|
|
490
489
|
const fileContents = tree.read(filePath, 'utf-8');
|
|
@@ -535,7 +534,7 @@ function addEntryComponents(host, source, modulePath, symbolName) {
|
|
|
535
534
|
}
|
|
536
535
|
function readBootstrapInfo(host, app) {
|
|
537
536
|
if (!tsModule) {
|
|
538
|
-
tsModule = (0,
|
|
537
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
539
538
|
}
|
|
540
539
|
const config = (0, devkit_1.readProjectConfiguration)(host, app);
|
|
541
540
|
let mainPath;
|
|
@@ -544,7 +543,7 @@ function readBootstrapInfo(host, app) {
|
|
|
544
543
|
config.targets.build.options?.main ??
|
|
545
544
|
config.targets.build.options?.browser;
|
|
546
545
|
if (!mainPath) {
|
|
547
|
-
const sourceRoot = (0,
|
|
546
|
+
const sourceRoot = (0, internal_1.getProjectSourceRoot)(config, host);
|
|
548
547
|
mainPath = (0, devkit_1.joinPathFragments)(sourceRoot, 'main.ts');
|
|
549
548
|
}
|
|
550
549
|
}
|
|
@@ -582,7 +581,7 @@ function readBootstrapInfo(host, app) {
|
|
|
582
581
|
}
|
|
583
582
|
function getDecoratorPropertyValueNode(host, modulePath, identifier, property, module) {
|
|
584
583
|
if (!tsModule) {
|
|
585
|
-
tsModule = (0,
|
|
584
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
586
585
|
}
|
|
587
586
|
const moduleSourceText = host.read(modulePath).toString('utf-8');
|
|
588
587
|
const moduleSource = tsModule.createSourceFile(modulePath, moduleSourceText, tsModule.ScriptTarget.Latest, true);
|
|
@@ -591,7 +590,7 @@ function getDecoratorPropertyValueNode(host, modulePath, identifier, property, m
|
|
|
591
590
|
}
|
|
592
591
|
function getMatchingObjectLiteralElement(node, source, property) {
|
|
593
592
|
if (!tsModule) {
|
|
594
|
-
tsModule = (0,
|
|
593
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
595
594
|
}
|
|
596
595
|
return (node.properties
|
|
597
596
|
.filter((prop) => prop.kind == tsModule.SyntaxKind.PropertyAssignment)
|
|
@@ -610,7 +609,7 @@ function getMatchingObjectLiteralElement(node, source, property) {
|
|
|
610
609
|
}
|
|
611
610
|
function getTsSourceFile(host, path) {
|
|
612
611
|
if (!tsModule) {
|
|
613
|
-
tsModule = (0,
|
|
612
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
614
613
|
}
|
|
615
614
|
const buffer = host.read(path);
|
|
616
615
|
if (!buffer) {
|
|
@@ -4,7 +4,7 @@ exports.addRoute = addRoute;
|
|
|
4
4
|
exports.addProviderToRoute = addProviderToRoute;
|
|
5
5
|
const js_1 = require("@nx/js");
|
|
6
6
|
const ast_utils_1 = require("./ast-utils");
|
|
7
|
-
const
|
|
7
|
+
const internal_1 = require("@nx/js/internal");
|
|
8
8
|
let tsModule;
|
|
9
9
|
/**
|
|
10
10
|
* Add a new route to a routes definition
|
|
@@ -20,7 +20,7 @@ function addRoute(tree, routesFile, route, lazy = true, routesConst, importPath)
|
|
|
20
20
|
throw new Error(`Path to parent routing declaration (${routesFile}) does not exist. Please ensure path is correct.`);
|
|
21
21
|
}
|
|
22
22
|
if (!tsModule) {
|
|
23
|
-
tsModule = (0,
|
|
23
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
24
24
|
}
|
|
25
25
|
const { ast, query } = require('@phenomnomnominal/tsquery');
|
|
26
26
|
let routesFileContents = tree.read(routesFile, 'utf-8');
|
|
@@ -58,7 +58,7 @@ function addProviderToRoute(tree, routesFile, routeToAddProviderTo, providerToAd
|
|
|
58
58
|
if (!tree.exists(routesFile)) {
|
|
59
59
|
throw new Error(`Path to parent routing declaration (${routesFile}) does not exist. Please ensure path is correct.`);
|
|
60
60
|
}
|
|
61
|
-
(0,
|
|
61
|
+
(0, internal_1.ensureTypescript)();
|
|
62
62
|
const { ast, query } = require('@phenomnomnominal/tsquery');
|
|
63
63
|
let routesFileContents = tree.read(routesFile, 'utf-8');
|
|
64
64
|
const sourceFile = ast(routesFileContents);
|