@nx/angular 16.8.0-beta.4 → 16.8.0-beta.6
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/mf/mf.js +31 -36
- package/package.json +10 -10
- package/plugins/component-testing.d.ts +0 -1
- package/plugins/component-testing.js +48 -40
- package/src/builders/module-federation-dev-server/module-federation-dev-server.impl.js +4 -6
- package/src/builders/module-federation-dev-ssr/module-federation-dev-ssr.impl.js +4 -6
- package/src/builders/utilities/buildable-libs.js +1 -2
- package/src/builders/utilities/module-federation.js +2 -3
- package/src/builders/utilities/webpack.js +16 -21
- package/src/builders/webpack-browser/webpack-browser.impl.js +13 -13
- package/src/builders/webpack-dev-server/lib/normalize-options.js +8 -1
- package/src/builders/webpack-dev-server/webpack-dev-server.impl.js +24 -18
- package/src/builders/webpack-server/webpack-server.impl.js +5 -7
- package/src/executors/browser-esbuild/browser-esbuild.impl.js +19 -23
- package/src/executors/browser-esbuild/lib/buildable-libs.js +1 -2
- package/src/executors/delegate-build/delegate-build.impl.js +9 -12
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js +4 -7
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/entry-point.transform.js +4 -5
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-package.transform.js +158 -156
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/options.di.js +6 -3
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ngc/compile-source-files.js +118 -118
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/styles/stylesheet-processor.js +96 -103
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ts/cache-compiler-host.js +20 -12
- package/src/executors/ng-packagr-lite/ng-packagr-lite.impl.js +18 -21
- package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js +6 -9
- package/src/executors/package/ng-packagr-adjustments/ng-package/options.di.js +6 -3
- package/src/executors/package/ng-packagr-adjustments/ngc/compile-source-files.js +122 -122
- package/src/executors/package/ng-packagr-adjustments/styles/stylesheet-processor.js +96 -103
- package/src/executors/package/ng-packagr-adjustments/ts/cache-compiler-host.js +21 -13
- package/src/executors/package/ng-packagr-adjustments/utils/ng-compiler-cli.js +5 -8
- package/src/executors/package/package.impl.js +33 -38
- package/src/executors/utilities/angular-version-utils.js +1 -1
- package/src/executors/utilities/tailwindcss.js +2 -2
- package/src/executors/utilities/typescript.js +23 -28
- package/src/generators/add-linting/add-linting.js +76 -74
- package/src/generators/add-linting/lib/create-eslint-configuration.js +12 -4
- package/src/generators/application/application.js +56 -55
- package/src/generators/application/lib/add-e2e.js +36 -40
- package/src/generators/application/lib/add-linting.js +12 -15
- package/src/generators/application/lib/add-proxy-config.js +4 -1
- package/src/generators/application/lib/add-unit-test-runner.js +15 -18
- package/src/generators/application/lib/create-files.js +44 -47
- package/src/generators/application/lib/enable-strict-type-checking.js +2 -2
- package/src/generators/application/lib/normalize-options.js +37 -25
- package/src/generators/application/lib/set-app-strict-default.js +1 -2
- package/src/generators/application/lib/update-editor-tsconfig.js +1 -2
- package/src/generators/component/component.js +40 -43
- package/src/generators/component/lib/normalize-options.js +15 -5
- package/src/generators/component-cypress-spec/component-cypress-spec.js +25 -28
- package/src/generators/component-story/component-story.js +19 -22
- package/src/generators/convert-to-with-mf/convert-to-with-mf.js +19 -22
- package/src/generators/convert-to-with-mf/lib/get-webpack-config-path.js +3 -4
- package/src/generators/convert-tslint-to-eslint/convert-tslint-to-eslint.js +103 -106
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js +59 -62
- package/src/generators/directive/directive.js +21 -24
- package/src/generators/directive/lib/normalize-options.js +11 -5
- package/src/generators/host/host.js +77 -67
- package/src/generators/host/lib/add-ssr.js +32 -35
- package/src/generators/init/init.js +101 -92
- package/src/generators/library/lib/add-standalone-component.js +18 -13
- package/src/generators/library/lib/enable-strict-type-checking.js +17 -5
- package/src/generators/library/lib/normalize-options.js +68 -53
- package/src/generators/library/library.js +89 -92
- package/src/generators/library-secondary-entry-point/lib/add-files.js +5 -1
- package/src/generators/library-secondary-entry-point/lib/normalize-options.js +6 -3
- package/src/generators/library-secondary-entry-point/lib/update-linting-file-patterns.js +1 -2
- package/src/generators/library-secondary-entry-point/library-secondary-entry-point.js +6 -9
- package/src/generators/move/lib/normalize-schema.js +5 -1
- package/src/generators/move/lib/update-module-name.js +1 -1
- package/src/generators/move/lib/update-ng-package.js +1 -2
- package/src/generators/move/lib/update-secondary-entry-points.js +1 -2
- package/src/generators/move/move.js +9 -12
- package/src/generators/ng-add/migrate-from-angular-cli.js +54 -53
- package/src/generators/ng-add/migrators/builders/angular-devkit-karma.migrator.js +4 -3
- package/src/generators/ng-add/migrators/builders/angular-devkit-ng-packagr.migrator.js +11 -12
- package/src/generators/ng-add/migrators/builders/angular-eslint-lint.migrator.js +39 -42
- package/src/generators/ng-add/migrators/builders/builder.migrator.js +1 -2
- package/src/generators/ng-add/migrators/migrator.js +7 -11
- package/src/generators/ng-add/migrators/projects/app.migrator.js +39 -43
- package/src/generators/ng-add/migrators/projects/e2e.migrator.js +115 -91
- package/src/generators/ng-add/migrators/projects/lib.migrator.js +23 -31
- package/src/generators/ng-add/migrators/projects/project.migrator.js +10 -14
- package/src/generators/ng-add/ng-add.js +5 -8
- package/src/generators/ng-add/utilities/dependencies.js +2 -3
- package/src/generators/ng-add/utilities/format-files-task.js +1 -1
- package/src/generators/ng-add/utilities/projects.js +1 -1
- package/src/generators/ng-add/utilities/workspace.js +25 -36
- package/src/generators/ngrx/lib/add-imports-to-module.js +1 -2
- package/src/generators/ngrx/lib/add-ngrx-to-package-json.js +1 -3
- package/src/generators/ngrx/lib/generate-files.js +11 -2
- package/src/generators/ngrx/lib/normalize-options.js +9 -4
- package/src/generators/ngrx/lib/validate-options.js +3 -3
- package/src/generators/ngrx/ngrx.js +18 -21
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.actions.ts__tmpl__ +1 -1
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.effects.spec.ts__tmpl__ +2 -2
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.effects.ts__tmpl__ +2 -2
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.facade.spec.ts__tmpl__ +6 -6
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.facade.ts__tmpl__ +3 -3
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.reducer.spec.ts__tmpl__ +3 -3
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.reducer.ts__tmpl__ +2 -2
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.selectors.spec.ts__tmpl__ +3 -3
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.selectors.ts__tmpl__ +1 -1
- package/src/generators/ngrx-feature-store/files/no-inject/__directory__/__fileName__.effects.ts__tmpl__ +2 -2
- package/src/generators/ngrx-feature-store/files/no-inject/__directory__/__fileName__.facade.ts__tmpl__ +3 -3
- package/src/generators/ngrx-feature-store/lib/add-exports-barrel.js +4 -1
- package/src/generators/ngrx-feature-store/lib/add-imports.js +1 -1
- package/src/generators/ngrx-feature-store/lib/add-ngrx-to-package-json.js +1 -3
- package/src/generators/ngrx-feature-store/lib/generate-files.js +20 -4
- package/src/generators/ngrx-feature-store/lib/normalize-options.d.ts +1 -0
- package/src/generators/ngrx-feature-store/lib/normalize-options.js +22 -3
- package/src/generators/ngrx-feature-store/lib/validate-options.js +2 -2
- package/src/generators/ngrx-feature-store/ngrx-feature-store.js +18 -21
- package/src/generators/ngrx-root-store/lib/add-ngrx-to-package-json.js +8 -6
- package/src/generators/ngrx-root-store/lib/normalize-options.js +8 -4
- package/src/generators/ngrx-root-store/lib/validate-options.js +2 -2
- package/src/generators/ngrx-root-store/ngrx-root-store.js +27 -30
- package/src/generators/pipe/lib/normalize-options.js +9 -3
- package/src/generators/pipe/pipe.js +21 -24
- package/src/generators/remote/lib/add-ssr.js +46 -47
- package/src/generators/remote/lib/find-next-available-port.js +1 -2
- package/src/generators/remote/remote.js +52 -49
- package/src/generators/scam/lib/convert-component-to-scam.js +1 -2
- package/src/generators/scam/lib/normalize-options.js +11 -4
- package/src/generators/scam/scam.js +15 -12
- package/src/generators/scam-directive/lib/normalize-options.js +12 -4
- package/src/generators/scam-directive/scam-directive.js +13 -10
- package/src/generators/scam-pipe/lib/normalize-options.js +12 -4
- package/src/generators/scam-pipe/scam-pipe.js +13 -10
- package/src/generators/scam-to-standalone/scam-to-standalone.js +23 -26
- package/src/generators/setup-mf/lib/add-cypress-workaround.js +1 -1
- package/src/generators/setup-mf/lib/add-remote-to-host.js +4 -1
- package/src/generators/setup-mf/lib/change-build-target.js +10 -4
- package/src/generators/setup-mf/lib/generate-config.js +1 -1
- package/src/generators/setup-mf/lib/get-remotes-with-ports.js +1 -2
- package/src/generators/setup-mf/lib/normalize-options.js +5 -2
- package/src/generators/setup-mf/lib/set-tsconfig-target.js +7 -1
- package/src/generators/setup-mf/lib/setup-host-if-dynamic.js +1 -2
- package/src/generators/setup-mf/lib/setup-serve-target.js +11 -4
- package/src/generators/setup-mf/setup-mf.js +32 -35
- package/src/generators/setup-ssr/lib/generate-files.js +8 -5
- package/src/generators/setup-ssr/lib/normalize-options.js +9 -10
- package/src/generators/setup-ssr/lib/update-project-config.js +21 -17
- package/src/generators/setup-ssr/setup-ssr.js +26 -27
- package/src/generators/setup-tailwind/lib/add-tailwind-config-path-to-project.js +6 -4
- package/src/generators/setup-tailwind/lib/detect-tailwind-installed-version.js +1 -2
- package/src/generators/setup-tailwind/lib/normalize-options.js +4 -1
- package/src/generators/setup-tailwind/lib/update-application-styles.js +5 -6
- package/src/generators/setup-tailwind/setup-tailwind.js +20 -23
- package/src/generators/stories/lib/get-e2e-project.js +1 -1
- package/src/generators/stories/stories.js +43 -50
- package/src/generators/storybook-configuration/lib/assert-compatible-storybook-version.js +1 -1
- package/src/generators/storybook-configuration/lib/generate-stories.js +10 -13
- package/src/generators/storybook-configuration/lib/generate-storybook-configuration.js +12 -15
- package/src/generators/storybook-configuration/storybook-configuration.js +20 -16
- package/src/generators/utils/create-ts-config.js +1 -1
- package/src/generators/utils/entry-point.js +1 -2
- package/src/generators/utils/export-scam.js +1 -1
- package/src/generators/utils/insert-ngmodule-import.js +1 -1
- package/src/generators/utils/path.js +3 -3
- package/src/generators/utils/project.js +2 -3
- package/src/generators/utils/selector.js +1 -1
- package/src/generators/utils/storybook-ast/component-info.js +1 -2
- package/src/generators/utils/storybook-ast/entry-point.js +1 -2
- package/src/generators/utils/storybook-ast/module-info.js +1 -2
- package/src/generators/utils/storybook-ast/tree-utilities.js +1 -1
- package/src/generators/utils/testing.js +141 -139
- package/src/generators/utils/validations.js +1 -1
- package/src/generators/utils/version-utils.js +5 -7
- package/src/generators/web-worker/lib/normalize-options.js +6 -3
- package/src/generators/web-worker/web-worker.js +25 -28
- package/src/migrations/update-14-2-0/remove-show-circular-dependencies-option.js +10 -13
- package/src/migrations/update-14-2-0/update-angular-cli.js +14 -18
- package/src/migrations/update-14-2-0/update-libraries-secondary-entrypoints.js +22 -26
- package/src/migrations/update-14-2-0/update-ngcc-target.js +10 -14
- package/src/migrations/update-14-2-0/update-router-initial-navigation.js +31 -39
- package/src/migrations/update-14-2-0/update-tsconfig-target.js +48 -56
- package/src/migrations/update-14-5-0/migrate-mfe-to-mf.js +14 -17
- package/src/migrations/update-14-5-2/update-angular-cli.js +14 -18
- package/src/migrations/update-14-6-0/update-angular-cli.js +14 -18
- package/src/migrations/update-15-0-0/add-karma-inputs.js +27 -32
- package/src/migrations/update-15-0-0/switch-to-jasmine-marbles.js +62 -68
- package/src/migrations/update-15-2-0/remove-browserlist-config.js +34 -37
- package/src/migrations/update-15-2-0/remove-platform-server-exports.js +49 -52
- package/src/migrations/update-15-2-0/update-angular-cli.js +14 -18
- package/src/migrations/update-15-2-0/update-karma-main-file.js +11 -12
- package/src/migrations/update-15-2-0/update-typescript-target.js +40 -39
- package/src/migrations/update-15-2-0/update-workspace-config.js +16 -19
- package/src/migrations/update-15-5-0/update-angular-cli.js +14 -18
- package/src/migrations/update-15-7-0/install-required-packages.js +26 -28
- package/src/migrations/update-15-8-0/update-angular-cli.js +14 -18
- package/src/migrations/update-15-9-0/update-file-server-executor.js +31 -35
- package/src/migrations/update-15-9-0/update-testing-tsconfig.js +17 -22
- package/src/migrations/update-16-0-0/remove-karma-defaults.js +15 -18
- package/src/migrations/update-16-0-0/remove-library-generator-simple-module-name-option.js +22 -25
- package/src/migrations/update-16-0-0/remove-protractor-defaults.js +15 -18
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +3 -6
- package/src/migrations/update-16-1-0/extract-standalone-config-from-bootstrap.js +38 -42
- package/src/migrations/update-16-1-0/remove-ngcc-invocation.js +15 -19
- package/src/migrations/update-16-1-0/remove-render-module-platform-server-exports.js +49 -52
- package/src/migrations/update-16-1-0/update-angular-cli.js +14 -18
- package/src/migrations/update-16-1-0/update-server-executor-config.js +13 -16
- package/src/migrations/update-16-2-0/switch-data-persistence-operators-imports-to-ngrx-router-store.js +25 -29
- package/src/migrations/update-16-4-0/rename-angular-eslint-accesibility-rules.js +13 -16
- package/src/migrations/update-16-4-0/update-angular-cli.js +14 -18
- package/src/migrations/update-16-6-0/explicitly-set-projects-to-update-buildable-deps.js +19 -24
- package/src/migrations/update-16-7-0/update-angular-cli.js +14 -18
- package/src/migrations/utils/projects.js +9 -15
- package/src/utils/get-mf-projects.js +1 -2
- package/src/utils/mf/utils.js +43 -44
- package/src/utils/mf/with-module-federation-ssr.js +39 -24
- package/src/utils/mf/with-module-federation.js +40 -21
- package/src/utils/nx-devkit/ast-utils.js +2 -3
- package/src/utils/version-utils.js +2 -4
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.augmentProgramWithVersioning = exports.cacheCompilerHost = void 0;
|
|
10
|
-
const tslib_1 = require("tslib");
|
|
11
10
|
const crypto_1 = require("crypto");
|
|
12
11
|
const node_1 = require("ng-packagr/lib/graph/node");
|
|
13
12
|
const nodes_1 = require("ng-packagr/lib/ng-package/nodes");
|
|
@@ -36,7 +35,8 @@ function cacheCompilerHost(graph, entryPoint, compilerOptions, moduleResolutionC
|
|
|
36
35
|
const flatModuleFileDtsFilename = `${flatModuleFile}.d.ts`;
|
|
37
36
|
const flatModuleFileDtsPath = (0, path_1.ensureUnixPath)(path.join(destinationPath, flatModuleFileDtsFilename));
|
|
38
37
|
const hasIndexEntryFile = path.basename(entryFile.toLowerCase()) === 'index.ts';
|
|
39
|
-
return
|
|
38
|
+
return {
|
|
39
|
+
...compilerHost,
|
|
40
40
|
// ts specific
|
|
41
41
|
fileExists: (fileName) => {
|
|
42
42
|
const cache = sourcesFileCache.getOrCreate(fileName);
|
|
@@ -44,14 +44,16 @@ function cacheCompilerHost(graph, entryPoint, compilerOptions, moduleResolutionC
|
|
|
44
44
|
cache.exists = compilerHost.fileExists.call(this, fileName);
|
|
45
45
|
}
|
|
46
46
|
return cache.exists;
|
|
47
|
-
},
|
|
47
|
+
},
|
|
48
|
+
getSourceFile: (fileName, languageVersion) => {
|
|
48
49
|
addDependee(fileName);
|
|
49
50
|
const cache = sourcesFileCache.getOrCreate(fileName);
|
|
50
51
|
if (!cache.sourceFile) {
|
|
51
52
|
cache.sourceFile = compilerHost.getSourceFile.call(this, fileName, languageVersion);
|
|
52
53
|
}
|
|
53
54
|
return cache.sourceFile;
|
|
54
|
-
},
|
|
55
|
+
},
|
|
56
|
+
writeFile: (fileName, data, writeByteOrderMark, onError, sourceFiles) => {
|
|
55
57
|
if (fileName.endsWith('.d.ts')) {
|
|
56
58
|
if (fileName === flatModuleFileDtsPath) {
|
|
57
59
|
if (hasIndexEntryFile) {
|
|
@@ -83,7 +85,7 @@ function cacheCompilerHost(graph, entryPoint, compilerOptions, moduleResolutionC
|
|
|
83
85
|
if (fileName.endsWith('.mjs')) {
|
|
84
86
|
const cachedData = outputCache.get(fileName);
|
|
85
87
|
map =
|
|
86
|
-
|
|
88
|
+
cachedData?.version === version
|
|
87
89
|
? cachedData.map
|
|
88
90
|
: require('convert-source-map').fromComment(data).toJSON();
|
|
89
91
|
}
|
|
@@ -101,25 +103,29 @@ function cacheCompilerHost(graph, entryPoint, compilerOptions, moduleResolutionC
|
|
|
101
103
|
}
|
|
102
104
|
}
|
|
103
105
|
compilerHost.writeFile.call(this, fileName, data, writeByteOrderMark, onError, sourceFiles);
|
|
104
|
-
},
|
|
106
|
+
},
|
|
107
|
+
readFile: (fileName) => {
|
|
105
108
|
addDependee(fileName);
|
|
106
109
|
const cache = sourcesFileCache.getOrCreate(fileName);
|
|
107
110
|
if (cache.content === undefined) {
|
|
108
111
|
cache.content = compilerHost.readFile.call(this, fileName);
|
|
109
112
|
}
|
|
110
113
|
return cache.content;
|
|
111
|
-
},
|
|
114
|
+
},
|
|
115
|
+
resolveModuleNames: (moduleNames, containingFile) => {
|
|
112
116
|
return moduleNames.map((moduleName) => {
|
|
113
117
|
const { resolvedModule } = ts.resolveModuleName(moduleName, (0, path_1.ensureUnixPath)(containingFile), compilerOptions, compilerHost, moduleResolutionCache);
|
|
114
118
|
return resolvedModule;
|
|
115
119
|
});
|
|
116
|
-
},
|
|
120
|
+
},
|
|
121
|
+
resourceNameToFileName: (resourceName, containingFilePath) => {
|
|
117
122
|
const resourcePath = path.resolve(path.dirname(containingFilePath), resourceName);
|
|
118
123
|
const containingNode = getNode(containingFilePath);
|
|
119
124
|
const resourceNode = getNode(resourcePath);
|
|
120
125
|
containingNode.dependsOn(resourceNode);
|
|
121
126
|
return resourcePath;
|
|
122
|
-
},
|
|
127
|
+
},
|
|
128
|
+
readResource: async (fileName) => {
|
|
123
129
|
addDependee(fileName);
|
|
124
130
|
const cache = sourcesFileCache.getOrCreate(fileName);
|
|
125
131
|
if (cache.content === undefined) {
|
|
@@ -132,7 +138,7 @@ function cacheCompilerHost(graph, entryPoint, compilerOptions, moduleResolutionC
|
|
|
132
138
|
}
|
|
133
139
|
else {
|
|
134
140
|
// stylesheet
|
|
135
|
-
cache.content =
|
|
141
|
+
cache.content = await stylesheetProcessor.process({
|
|
136
142
|
filePath: fileName,
|
|
137
143
|
content: compilerHost.readFile.call(this, fileName),
|
|
138
144
|
});
|
|
@@ -140,7 +146,8 @@ function cacheCompilerHost(graph, entryPoint, compilerOptions, moduleResolutionC
|
|
|
140
146
|
cache.exists = true;
|
|
141
147
|
}
|
|
142
148
|
return cache.content;
|
|
143
|
-
}
|
|
149
|
+
},
|
|
150
|
+
transformResource: async (data, context) => {
|
|
144
151
|
if (context.resourceFile || context.type !== 'style') {
|
|
145
152
|
return null;
|
|
146
153
|
}
|
|
@@ -149,7 +156,7 @@ function cacheCompilerHost(graph, entryPoint, compilerOptions, moduleResolutionC
|
|
|
149
156
|
const fileName = `${context.containingFile}-${key}.${inlineStyleLanguage}`;
|
|
150
157
|
const cache = sourcesFileCache.getOrCreate(fileName);
|
|
151
158
|
if (cache.content === undefined) {
|
|
152
|
-
cache.content =
|
|
159
|
+
cache.content = await stylesheetProcessor.process({
|
|
153
160
|
filePath: context.containingFile,
|
|
154
161
|
content: data,
|
|
155
162
|
});
|
|
@@ -161,7 +168,8 @@ function cacheCompilerHost(graph, entryPoint, compilerOptions, moduleResolutionC
|
|
|
161
168
|
return { content: cache.content };
|
|
162
169
|
}
|
|
163
170
|
return null;
|
|
164
|
-
}
|
|
171
|
+
},
|
|
172
|
+
};
|
|
165
173
|
}
|
|
166
174
|
exports.cacheCompilerHost = cacheCompilerHost;
|
|
167
175
|
function augmentProgramWithVersioning(program) {
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ngccCompilerCli = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
? compilerCliModule
|
|
10
|
-
: compilerCliModule.default;
|
|
11
|
-
});
|
|
4
|
+
async function ngccCompilerCli() {
|
|
5
|
+
const compilerCliModule = await new Function(`return import('@angular/compiler-cli/ngcc');`)();
|
|
6
|
+
return compilerCliModule.process
|
|
7
|
+
? compilerCliModule
|
|
8
|
+
: compilerCliModule.default;
|
|
12
9
|
}
|
|
13
10
|
exports.ngccCompilerCli = ngccCompilerCli;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.packageExecutor = exports.createLibraryExecutor = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const rxjs_for_await_1 = require("@nx/devkit/src/utils/rxjs-for-await");
|
|
6
5
|
const buildable_libs_utils_1 = require("@nx/js/src/utils/buildable-libs-utils");
|
|
7
6
|
const path_1 = require("path");
|
|
@@ -11,25 +10,23 @@ const typescript_1 = require("../utilities/typescript");
|
|
|
11
10
|
const entry_point_di_1 = require("./ng-packagr-adjustments/ng-package/entry-point/entry-point.di");
|
|
12
11
|
const options_di_1 = require("./ng-packagr-adjustments/ng-package/options.di");
|
|
13
12
|
const package_di_1 = require("./ng-packagr-adjustments/ng-package/package.di");
|
|
14
|
-
function initializeNgPackagr(options, context, projectDependencies) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return packager;
|
|
32
|
-
});
|
|
13
|
+
async function initializeNgPackagr(options, context, projectDependencies) {
|
|
14
|
+
const packager = new (await Promise.resolve().then(() => require('ng-packagr'))).NgPackagr([
|
|
15
|
+
...package_di_1.NX_PACKAGE_PROVIDERS,
|
|
16
|
+
...entry_point_di_1.NX_ENTRY_POINT_PROVIDERS,
|
|
17
|
+
(0, options_di_1.nxProvideOptions)({
|
|
18
|
+
tailwindConfig: options.tailwindConfig,
|
|
19
|
+
watch: options.watch,
|
|
20
|
+
}),
|
|
21
|
+
]);
|
|
22
|
+
packager.forProject((0, path_1.resolve)(context.root, options.project));
|
|
23
|
+
packager.withBuildTransform(package_di_1.NX_PACKAGE_TRANSFORM.provide);
|
|
24
|
+
if (options.tsConfig) {
|
|
25
|
+
const remappedTsConfigFilePath = (0, buildable_libs_utils_1.createTmpTsConfig)(options.tsConfig, context.root, context.projectsConfigurations.projects[context.projectName].root, projectDependencies);
|
|
26
|
+
const tsConfig = await (0, typescript_1.parseRemappedTsConfigAndMergeDefaults)(context.root, options.tsConfig, remappedTsConfigFilePath);
|
|
27
|
+
packager.withTsConfig(tsConfig);
|
|
28
|
+
}
|
|
29
|
+
return packager;
|
|
33
30
|
}
|
|
34
31
|
/**
|
|
35
32
|
* Creates an executor function that executes the library build of an Angular
|
|
@@ -37,25 +34,23 @@ function initializeNgPackagr(options, context, projectDependencies) {
|
|
|
37
34
|
* @param initializeNgPackagr function that returns an ngPackagr instance to use for the build.
|
|
38
35
|
*/
|
|
39
36
|
function createLibraryExecutor(initializeNgPackagr) {
|
|
40
|
-
return function (options, context) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
(0, buildable_libs_utils_1.updateBuildableProjectPackageJsonDependencies)(context.root, context.projectName, context.targetName, context.configurationName, target, topLevelDependencies, options.buildableProjectDepsInPackageJsonType);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (options.watch) {
|
|
53
|
-
return yield tslib_1.__await(yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues((0, rxjs_for_await_1.eachValueFrom)((0, rxjs_1.from)(initializeNgPackagr(options, context, dependencies)).pipe((0, operators_1.switchMap)((packagr) => packagr.watch()), (0, operators_1.tap)(() => updatePackageJson()), (0, operators_1.mapTo)({ success: true })))))));
|
|
37
|
+
return async function* (options, context) {
|
|
38
|
+
const { target, dependencies, topLevelDependencies } = (0, buildable_libs_utils_1.calculateProjectBuildableDependencies)(context.taskGraph, context.projectGraph, context.root, context.projectName, context.targetName, context.configurationName);
|
|
39
|
+
if (!(0, buildable_libs_utils_1.checkDependentProjectsHaveBeenBuilt)(context.root, context.projectName, context.targetName, dependencies)) {
|
|
40
|
+
return Promise.resolve({ success: false });
|
|
41
|
+
}
|
|
42
|
+
function updatePackageJson() {
|
|
43
|
+
if (topLevelDependencies.length > 0 &&
|
|
44
|
+
options.updateBuildableProjectDepsInPackageJson) {
|
|
45
|
+
(0, buildable_libs_utils_1.updateBuildableProjectPackageJsonDependencies)(context.root, context.projectName, context.targetName, context.configurationName, target, topLevelDependencies, options.buildableProjectDepsInPackageJsonType);
|
|
54
46
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
47
|
+
}
|
|
48
|
+
if (options.watch) {
|
|
49
|
+
return yield* (0, rxjs_for_await_1.eachValueFrom)((0, rxjs_1.from)(initializeNgPackagr(options, context, dependencies)).pipe((0, operators_1.switchMap)((packagr) => packagr.watch()), (0, operators_1.tap)(() => updatePackageJson()), (0, operators_1.mapTo)({ success: true })));
|
|
50
|
+
}
|
|
51
|
+
return (0, rxjs_1.from)(initializeNgPackagr(options, context, dependencies))
|
|
52
|
+
.pipe((0, operators_1.switchMap)((packagr) => packagr.build()), (0, operators_1.tap)(() => updatePackageJson()), (0, operators_1.mapTo)({ success: true }))
|
|
53
|
+
.toPromise();
|
|
59
54
|
};
|
|
60
55
|
}
|
|
61
56
|
exports.createLibraryExecutor = createLibraryExecutor;
|
|
@@ -12,7 +12,7 @@ function getInstalledPackageVersionInfo(pkgName) {
|
|
|
12
12
|
const { packageJson: { version }, } = (0, package_json_1.readModulePackageJson)(pkgName);
|
|
13
13
|
return { major: (0, semver_1.major)(version), version };
|
|
14
14
|
}
|
|
15
|
-
catch
|
|
15
|
+
catch {
|
|
16
16
|
return null;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -27,7 +27,7 @@ function getTailwindSetup(basePath, tailwindConfig) {
|
|
|
27
27
|
try {
|
|
28
28
|
tailwindPackagePath = require.resolve('tailwindcss');
|
|
29
29
|
}
|
|
30
|
-
catch
|
|
30
|
+
catch {
|
|
31
31
|
const relativeTailwindConfigPath = (0, path_1.relative)(devkit_2.workspaceRoot, tailwindConfigPath);
|
|
32
32
|
devkit_1.logger.warn(`Tailwind CSS configuration file found (${relativeTailwindConfigPath})` +
|
|
33
33
|
` but the 'tailwindcss' package is not installed.` +
|
|
@@ -64,7 +64,7 @@ function getTailwindPostCssPlugins({ tailwindConfigPath, tailwindPackagePath },
|
|
|
64
64
|
}
|
|
65
65
|
return [
|
|
66
66
|
postcssImport({
|
|
67
|
-
addModulesDirectories: includePaths
|
|
67
|
+
addModulesDirectories: includePaths ?? [],
|
|
68
68
|
resolve: (url) => (url.startsWith('~') ? url.substring(1) : url),
|
|
69
69
|
}),
|
|
70
70
|
require(tailwindPackagePath)({ config: tailwindConfigPath }),
|
|
@@ -9,40 +9,35 @@
|
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.parseRemappedTsConfigAndMergeDefaults = void 0;
|
|
12
|
-
const tslib_1 = require("tslib");
|
|
13
12
|
const ng_compiler_cli_1 = require("ng-packagr/lib/utils/ng-compiler-cli");
|
|
14
13
|
const path_1 = require("path");
|
|
15
14
|
const ts = require("typescript");
|
|
16
|
-
function readDefaultTsConfig(fileName) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return readConfiguration(fileName, extraOptions);
|
|
36
|
-
});
|
|
15
|
+
async function readDefaultTsConfig(fileName) {
|
|
16
|
+
// these options are mandatory
|
|
17
|
+
const extraOptions = {
|
|
18
|
+
target: ts.ScriptTarget.ES2020,
|
|
19
|
+
experimentalDecorators: true,
|
|
20
|
+
// sourcemaps
|
|
21
|
+
sourceMap: false,
|
|
22
|
+
inlineSources: true,
|
|
23
|
+
inlineSourceMap: true,
|
|
24
|
+
outDir: '',
|
|
25
|
+
declaration: true,
|
|
26
|
+
// ng compiler to options
|
|
27
|
+
enableResourceInlining: true,
|
|
28
|
+
// these are required to set the appropriate EmitFlags
|
|
29
|
+
flatModuleId: 'AUTOGENERATED',
|
|
30
|
+
flatModuleOutFile: 'AUTOGENERATED',
|
|
31
|
+
};
|
|
32
|
+
const { readConfiguration } = await (0, ng_compiler_cli_1.ngCompilerCli)();
|
|
33
|
+
return readConfiguration(fileName, extraOptions);
|
|
37
34
|
}
|
|
38
35
|
/**
|
|
39
36
|
* Proxy function that ensures the configFilePath option points to the original file path.
|
|
40
37
|
*/
|
|
41
|
-
function parseRemappedTsConfigAndMergeDefaults(workspaceRoot, originalFilePath, remappedFilePath) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return parsedConfiguration;
|
|
46
|
-
});
|
|
38
|
+
async function parseRemappedTsConfigAndMergeDefaults(workspaceRoot, originalFilePath, remappedFilePath) {
|
|
39
|
+
const parsedConfiguration = await readDefaultTsConfig(remappedFilePath);
|
|
40
|
+
parsedConfiguration.options.configFilePath = (0, path_1.resolve)(workspaceRoot, originalFilePath);
|
|
41
|
+
return parsedConfiguration;
|
|
47
42
|
}
|
|
48
43
|
exports.parseRemappedTsConfigAndMergeDefaults = parseRemappedTsConfigAndMergeDefaults;
|
|
@@ -1,92 +1,94 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addLintingGenerator = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const linter_1 = require("@nx/linter");
|
|
7
6
|
const lint_project_1 = require("@nx/linter/src/generators/lint-project/lint-project");
|
|
8
7
|
const add_angular_eslint_dependencies_1 = require("./lib/add-angular-eslint-dependencies");
|
|
9
8
|
const eslint_file_1 = require("@nx/linter/src/generators/utils/eslint-file");
|
|
10
9
|
const string_utils_1 = require("@nx/devkit/src/utils/string-utils");
|
|
11
|
-
function addLintingGenerator(tree, options) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
10
|
+
async function addLintingGenerator(tree, options) {
|
|
11
|
+
const tasks = [];
|
|
12
|
+
const rootProject = options.projectRoot === '.' || options.projectRoot === '';
|
|
13
|
+
const lintTask = await (0, linter_1.lintProjectGenerator)(tree, {
|
|
14
|
+
linter: linter_1.Linter.EsLint,
|
|
15
|
+
project: options.projectName,
|
|
16
|
+
tsConfigPaths: [
|
|
17
|
+
(0, devkit_1.joinPathFragments)(options.projectRoot, 'tsconfig.app.json'),
|
|
18
|
+
],
|
|
19
|
+
unitTestRunner: options.unitTestRunner,
|
|
20
|
+
eslintFilePatterns: [
|
|
21
|
+
(0, lint_project_1.mapLintPattern)(options.projectRoot, 'ts', rootProject),
|
|
22
|
+
(0, lint_project_1.mapLintPattern)(options.projectRoot, 'html', rootProject),
|
|
23
|
+
],
|
|
24
|
+
setParserOptionsProject: options.setParserOptionsProject,
|
|
25
|
+
skipFormat: true,
|
|
26
|
+
rootProject: rootProject,
|
|
27
|
+
});
|
|
28
|
+
tasks.push(lintTask);
|
|
29
|
+
if ((0, eslint_file_1.isEslintConfigSupported)(tree)) {
|
|
30
|
+
const eslintFile = (0, eslint_file_1.findEslintFile)(tree, options.projectRoot);
|
|
31
|
+
// keep parser options if they exist
|
|
32
|
+
const hasParserOptions = tree
|
|
33
|
+
.read((0, devkit_1.joinPathFragments)(options.projectRoot, eslintFile), 'utf8')
|
|
34
|
+
.includes(`${options.projectRoot}/tsconfig.*?.json`);
|
|
35
|
+
(0, eslint_file_1.replaceOverridesInLintConfig)(tree, options.projectRoot, [
|
|
36
|
+
{
|
|
37
|
+
files: ['*.json'],
|
|
38
|
+
parser: 'jsonc-eslint-parser',
|
|
39
|
+
rules: {},
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
files: ['*.ts'],
|
|
43
|
+
...(hasParserOptions
|
|
44
44
|
? {
|
|
45
45
|
parserOptions: {
|
|
46
46
|
project: [`${options.projectRoot}/tsconfig.*?.json`],
|
|
47
47
|
},
|
|
48
48
|
}
|
|
49
|
-
: {})
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
files: ['*.html'],
|
|
72
|
-
extends: ['plugin:@nx/angular-template'],
|
|
73
|
-
/**
|
|
74
|
-
* Having an empty rules object present makes it more obvious to the user where they would
|
|
75
|
-
* extend things from if they needed to
|
|
76
|
-
*/
|
|
77
|
-
rules: {},
|
|
49
|
+
: {}),
|
|
50
|
+
extends: [
|
|
51
|
+
'plugin:@nx/angular',
|
|
52
|
+
'plugin:@angular-eslint/template/process-inline-templates',
|
|
53
|
+
],
|
|
54
|
+
rules: {
|
|
55
|
+
'@angular-eslint/directive-selector': [
|
|
56
|
+
'error',
|
|
57
|
+
{
|
|
58
|
+
type: 'attribute',
|
|
59
|
+
prefix: (0, string_utils_1.camelize)(options.prefix),
|
|
60
|
+
style: 'camelCase',
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
'@angular-eslint/component-selector': [
|
|
64
|
+
'error',
|
|
65
|
+
{
|
|
66
|
+
type: 'element',
|
|
67
|
+
prefix: (0, string_utils_1.dasherize)(options.prefix),
|
|
68
|
+
style: 'kebab-case',
|
|
69
|
+
},
|
|
70
|
+
],
|
|
78
71
|
},
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
files: ['*.html'],
|
|
75
|
+
extends: ['plugin:@nx/angular-template'],
|
|
76
|
+
/**
|
|
77
|
+
* Having an empty rules object present makes it more obvious to the user where they would
|
|
78
|
+
* extend things from if they needed to
|
|
79
|
+
*/
|
|
80
|
+
rules: {},
|
|
81
|
+
},
|
|
82
|
+
]);
|
|
83
|
+
}
|
|
84
|
+
if (!options.skipPackageJson) {
|
|
85
|
+
const installTask = (0, add_angular_eslint_dependencies_1.addAngularEsLintDependencies)(tree);
|
|
86
|
+
tasks.push(installTask);
|
|
87
|
+
}
|
|
88
|
+
if (!options.skipFormat) {
|
|
89
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
90
|
+
}
|
|
91
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
90
92
|
}
|
|
91
93
|
exports.addLintingGenerator = addLintingGenerator;
|
|
92
94
|
exports.default = addLintingGenerator;
|
|
@@ -8,11 +8,15 @@ const string_utils_1 = require("@nx/devkit/src/utils/string-utils");
|
|
|
8
8
|
*/
|
|
9
9
|
const extendAngularEslintJson = (json, options) => {
|
|
10
10
|
const overrides = [
|
|
11
|
-
|
|
11
|
+
{
|
|
12
|
+
...json.overrides[0],
|
|
13
|
+
files: ['*.ts'],
|
|
14
|
+
extends: [
|
|
12
15
|
...(json.overrides[0].extends || []),
|
|
13
16
|
'plugin:@nx/angular',
|
|
14
17
|
'plugin:@angular-eslint/template/process-inline-templates',
|
|
15
|
-
],
|
|
18
|
+
],
|
|
19
|
+
rules: {
|
|
16
20
|
'@angular-eslint/directive-selector': [
|
|
17
21
|
'error',
|
|
18
22
|
{
|
|
@@ -29,7 +33,8 @@ const extendAngularEslintJson = (json, options) => {
|
|
|
29
33
|
style: 'kebab-case',
|
|
30
34
|
},
|
|
31
35
|
],
|
|
32
|
-
}
|
|
36
|
+
},
|
|
37
|
+
},
|
|
33
38
|
{
|
|
34
39
|
files: ['*.html'],
|
|
35
40
|
extends: ['plugin:@nx/angular-template'],
|
|
@@ -40,7 +45,10 @@ const extendAngularEslintJson = (json, options) => {
|
|
|
40
45
|
rules: {},
|
|
41
46
|
},
|
|
42
47
|
];
|
|
43
|
-
return
|
|
48
|
+
return {
|
|
49
|
+
...json,
|
|
50
|
+
overrides,
|
|
51
|
+
};
|
|
44
52
|
};
|
|
45
53
|
exports.extendAngularEslintJson = extendAngularEslintJson;
|
|
46
54
|
/**
|