@nx/angular 19.1.0-beta.1 → 19.1.0-beta.2
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/executors.json +1 -1
- package/migrations.json +82 -0
- package/package.json +14 -13
- package/src/builders/dev-server/dev-server.impl.js +1 -1
- package/src/builders/dev-server/schema.json +1 -1
- package/src/builders/module-federation-dev-ssr/module-federation-dev-ssr.impl.js +4 -1
- package/src/builders/utilities/module-federation.d.ts +2 -1
- package/src/builders/utilities/module-federation.js +17 -3
- package/src/builders/webpack-browser/schema.json +4 -3
- package/src/builders/webpack-browser/webpack-browser.impl.js +1 -1
- package/src/builders/webpack-server/schema.json +7 -6
- package/src/builders/webpack-server/webpack-server.impl.js +3 -5
- package/src/executors/application/application.impl.d.ts +2 -1
- package/src/executors/application/application.impl.js +2 -2
- package/src/executors/application/schema.json +4 -3
- package/src/executors/browser-esbuild/browser-esbuild.impl.d.ts +2 -7
- package/src/executors/browser-esbuild/browser-esbuild.impl.js +2 -2
- package/src/executors/browser-esbuild/schema.json +4 -3
- package/src/executors/extract-i18n/extract-i18n.impl.js +2 -2
- package/src/executors/module-federation-dev-server/lib/start-static-remotes-file-server.js +2 -1
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +8 -4
- package/src/executors/module-federation-dev-server/schema.json +1 -1
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-packagr.js +6 -6
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/compile-ngc.transform.js +3 -2
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/write-package.transform.js +2 -1
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/options.di.js +2 -1
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ngc/compile-source-files.d.ts +1 -2
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ngc/compile-source-files.js +5 -4
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/styles/stylesheet-processor.js +11 -11
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/v17+/ng-package/entry-point/write-package.transform.js +2 -1
- package/src/executors/ng-packagr-lite/schema.json +1 -1
- package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js +5 -4
- package/src/executors/package/ng-packagr-adjustments/ng-package/options.di.js +2 -1
- package/src/executors/package/ng-packagr-adjustments/ng-packagr.js +4 -4
- package/src/executors/package/ng-packagr-adjustments/ngc/compile-source-files.d.ts +1 -2
- package/src/executors/package/ng-packagr-adjustments/ngc/compile-source-files.js +5 -4
- package/src/executors/package/ng-packagr-adjustments/styles/stylesheet-processor.js +11 -11
- package/src/executors/utilities/esbuild-extensions.d.ts +2 -4
- package/src/executors/utilities/module-loader.d.ts +1 -2
- package/src/executors/utilities/ng-packagr/stylesheet-processor.js +22 -8
- package/src/executors/utilities/typescript.d.ts +1 -2
- package/src/executors/utilities/typescript.js +4 -3
- package/src/generators/add-linting/lib/create-eslint-configuration.d.ts +2 -2
- package/src/generators/add-linting/schema.json +1 -1
- package/src/generators/application/files/base-pre18/src/favicon.ico +0 -0
- package/src/generators/application/files/ng-module/src/main.ts__tpl__ +3 -1
- package/src/generators/application/files/standalone-components/src/app/app.config.ts__tpl__ +2 -2
- package/src/generators/application/lib/add-linting.js +2 -1
- package/src/generators/application/lib/create-files.js +7 -0
- package/src/generators/application/lib/create-project.js +12 -5
- package/src/generators/component-test/component-test.js +1 -1
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js +3 -3
- package/src/generators/federate-module/lib/add-remote.js +2 -1
- package/src/generators/host/host.js +3 -2
- package/src/generators/library/library.js +4 -3
- package/src/generators/ng-add/migrators/builders/angular-devkit-karma.migrator.js +3 -2
- package/src/generators/ng-add/migrators/migrator.d.ts +1 -1
- package/src/generators/ng-add/migrators/migrator.js +7 -7
- package/src/generators/ng-add/migrators/projects/app.migrator.js +2 -2
- package/src/generators/ng-add/migrators/projects/e2e.migrator.js +1 -1
- package/src/generators/ng-add/utilities/validation-logging.js +2 -1
- package/src/generators/ngrx-root-store/ngrx-root-store.js +2 -1
- package/src/generators/setup-mf/lib/add-remote-to-host.js +13 -4
- package/src/generators/setup-mf/lib/fix-bootstrap.d.ts +1 -1
- package/src/generators/setup-mf/lib/fix-bootstrap.js +12 -5
- package/src/generators/setup-mf/lib/setup-host-if-dynamic.js +5 -1
- package/src/generators/setup-mf/setup-mf.js +1 -1
- package/src/generators/setup-ssr/files/server/application-builder/__serverFileName__ +4 -3
- package/src/generators/setup-ssr/files/server/server-builder/v17+/__serverFileName__ +4 -3
- package/src/generators/setup-ssr/lib/add-dependencies.js +2 -1
- package/src/generators/setup-ssr/lib/generate-files.js +1 -7
- package/src/generators/setup-ssr/lib/index.d.ts +0 -1
- package/src/generators/setup-ssr/lib/index.js +0 -1
- package/src/generators/setup-ssr/lib/validate-options.js +0 -13
- package/src/generators/setup-ssr/schema.json +4 -3
- package/src/generators/setup-ssr/setup-ssr.js +0 -3
- package/src/generators/stories/stories.js +3 -2
- package/src/generators/storybook-configuration/lib/generate-stories.js +1 -1
- package/src/generators/utils/storybook-ast/tree-utilities.js +2 -1
- package/src/generators/utils/version-utils.js +4 -3
- package/src/migrations/update-15-2-0/remove-browserlist-config.js +1 -1
- package/src/migrations/update-15-2-0/remove-platform-server-exports.js +2 -1
- package/src/migrations/update-15-2-0/update-karma-main-file.js +2 -1
- package/src/migrations/update-16-1-0/remove-render-module-platform-server-exports.js +2 -1
- package/src/migrations/update-19-1-0/update-angular-cli.d.ts +3 -0
- package/src/migrations/update-19-1-0/update-angular-cli.js +23 -0
- package/src/utils/backward-compatible-versions.d.ts +10 -5
- package/src/utils/backward-compatible-versions.js +18 -19
- package/src/utils/file-change-recorder.js +2 -1
- package/src/utils/mf/with-module-federation.js +3 -2
- package/src/utils/version-utils.d.ts +2 -2
- package/src/utils/version-utils.js +2 -1
- package/src/utils/versions.d.ts +4 -4
- package/src/utils/versions.js +4 -4
- package/index.js +0 -8
- package/mf/index.js +0 -7
- package/mf/mf.js +0 -53
- package/src/builders/webpack-server/validate-options.d.ts +0 -2
- package/src/builders/webpack-server/validate-options.js +0 -33
- package/src/executors/utilities/ng-compiler-cli.d.ts +0 -1
- package/src/executors/utilities/ng-compiler-cli.js +0 -8
- package/src/generators/setup-ssr/files/ngmodule/pre-v15-2/src/main.ts__tpl__ +0 -14
- package/src/generators/setup-ssr/lib/update-app-module.d.ts +0 -3
- package/src/generators/setup-ssr/lib/update-app-module.js +0 -27
- package/src/runtime/nx/data-persistence.js +0 -350
- package/testing/index.js +0 -6
- package/testing/src/testing-utils.js +0 -40
- /package/src/generators/application/files/{base/src → base-18+/public}/favicon.ico +0 -0
- /package/src/generators/application/files/{base → base-pre18}/src/assets/.gitkeep__tpl__ +0 -0
- /package/src/generators/setup-ssr/files/ngmodule/{base/src → src}/__main__ +0 -0
- /package/src/generators/setup-ssr/files/ngmodule/{base/src → src}/app/__rootModuleFileName__ +0 -0
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.nxWritePackageTransform = void 0;
|
|
11
|
+
const tslib_1 = require("tslib");
|
|
11
12
|
const devkit_1 = require("@nx/devkit");
|
|
12
13
|
const node_1 = require("ng-packagr/lib/graph/node");
|
|
13
14
|
const transform_1 = require("ng-packagr/lib/graph/transform");
|
|
@@ -15,7 +16,7 @@ const nodes_1 = require("ng-packagr/lib/ng-package/nodes");
|
|
|
15
16
|
const fs_1 = require("ng-packagr/lib/utils/fs");
|
|
16
17
|
const glob_1 = require("ng-packagr/lib/utils/glob");
|
|
17
18
|
const path_1 = require("ng-packagr/lib/utils/path");
|
|
18
|
-
const path = require("path");
|
|
19
|
+
const path = tslib_1.__importStar(require("path"));
|
|
19
20
|
const angular_version_utils_1 = require("../../../../../utilities/angular-version-utils");
|
|
20
21
|
const nxWritePackageTransform = (options) => (0, transform_1.transformFromPromise)(async (graph) => {
|
|
21
22
|
const entryPoint = graph.find((0, nodes_1.isEntryPointInProgress)());
|
package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/options.di.js
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.NX_DEFAULT_OPTIONS_PROVIDER = exports.nxProvideOptions = exports.NX_OPTIONS_TOKEN = void 0;
|
|
10
|
-
const
|
|
10
|
+
const tslib_1 = require("tslib");
|
|
11
|
+
const findCacheDirectory = tslib_1.__importStar(require("find-cache-dir"));
|
|
11
12
|
const injection_js_1 = require("injection-js");
|
|
12
13
|
const os_1 = require("os");
|
|
13
14
|
const path_1 = require("path");
|
package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ngc/compile-source-files.d.ts
CHANGED
|
@@ -5,9 +5,8 @@
|
|
|
5
5
|
* - Use custom StylesheetProcessor instead of the one provided by ng-packagr.
|
|
6
6
|
* - Support Angular Compiler `incrementalDriver` for Angular < 16.
|
|
7
7
|
*/
|
|
8
|
-
import type { CompilerOptions, ParsedConfiguration } from '@angular/compiler-cli';
|
|
9
8
|
import { BuildGraph } from 'ng-packagr/lib/graph/build-graph';
|
|
10
9
|
import * as ts from 'typescript';
|
|
11
10
|
import { NgPackagrOptions } from '../ng-package/options.di';
|
|
12
11
|
import { StylesheetProcessor } from '../styles/stylesheet-processor';
|
|
13
|
-
export declare function compileSourceFiles(graph: BuildGraph, tsConfig:
|
|
12
|
+
export declare function compileSourceFiles(graph: BuildGraph, tsConfig: any, moduleResolutionCache: ts.ModuleResolutionCache, options: NgPackagrOptions, extraOptions?: Partial<ts.CompilerOptions>, stylesheetProcessor?: StylesheetProcessor): Promise<void>;
|
package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ngc/compile-source-files.js
CHANGED
|
@@ -8,15 +8,16 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.compileSourceFiles = void 0;
|
|
11
|
+
const tslib_1 = require("tslib");
|
|
11
12
|
const nodes_1 = require("ng-packagr/lib/ng-package/nodes");
|
|
12
13
|
const cache_compiler_host_1 = require("ng-packagr/lib/ts/cache-compiler-host");
|
|
13
|
-
const log = require("ng-packagr/lib/utils/log");
|
|
14
|
+
const log = tslib_1.__importStar(require("ng-packagr/lib/utils/log"));
|
|
14
15
|
const node_path_1 = require("node:path");
|
|
15
|
-
const ts = require("typescript");
|
|
16
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
16
17
|
const angular_version_utils_1 = require("../../../../utilities/angular-version-utils");
|
|
17
|
-
const
|
|
18
|
+
const module_loader_1 = require("../../../../utilities/module-loader");
|
|
18
19
|
async function compileSourceFiles(graph, tsConfig, moduleResolutionCache, options, extraOptions, stylesheetProcessor) {
|
|
19
|
-
const { NgtscProgram, formatDiagnostics } = await (0,
|
|
20
|
+
const { NgtscProgram, formatDiagnostics } = await (0, module_loader_1.loadEsmModule)('@angular/compiler-cli');
|
|
20
21
|
const { cacheDirectory, watch, cacheEnabled } = options;
|
|
21
22
|
const tsConfigOptions = {
|
|
22
23
|
...tsConfig.options,
|
package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/styles/stylesheet-processor.js
CHANGED
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.StylesheetProcessor = exports.InlineStyleLanguage = exports.CssUrl = void 0;
|
|
11
|
-
const
|
|
11
|
+
const tslib_1 = require("tslib");
|
|
12
|
+
const browserslist_1 = tslib_1.__importDefault(require("browserslist"));
|
|
12
13
|
const fs_1 = require("fs");
|
|
13
|
-
const esbuild_executor_1 = require("ng-packagr/lib/esbuild/esbuild-executor");
|
|
14
14
|
const cache_1 = require("ng-packagr/lib/utils/cache");
|
|
15
|
-
const log = require("ng-packagr/lib/utils/log");
|
|
15
|
+
const log = tslib_1.__importStar(require("ng-packagr/lib/utils/log"));
|
|
16
16
|
const path_1 = require("path");
|
|
17
|
-
const
|
|
18
|
-
const postcssUrl = require("postcss-url");
|
|
17
|
+
const autoprefixer_1 = tslib_1.__importDefault(require("autoprefixer"));
|
|
18
|
+
const postcssUrl = tslib_1.__importStar(require("postcss-url"));
|
|
19
19
|
const node_url_1 = require("node:url");
|
|
20
20
|
const tailwindcss_1 = require("../../../../utilities/ng-packagr/tailwindcss");
|
|
21
21
|
const postcss = require('postcss');
|
|
@@ -39,12 +39,12 @@ class StylesheetProcessor {
|
|
|
39
39
|
this.includePaths = includePaths;
|
|
40
40
|
this.cacheDirectory = cacheDirectory;
|
|
41
41
|
this.tailwindConfig = tailwindConfig;
|
|
42
|
-
this.esbuild = new
|
|
42
|
+
this.esbuild = new (require('ng-packagr/lib/esbuild/esbuild-executor').EsbuildExecutor)();
|
|
43
43
|
// By default, browserslist defaults are too inclusive
|
|
44
44
|
// https://github.com/browserslist/browserslist/blob/83764ea81ffaa39111c204b02c371afa44a4ff07/index.js#L516-L522
|
|
45
45
|
// We change the default query to browsers that Angular support.
|
|
46
46
|
// https://angular.io/guide/browser-support
|
|
47
|
-
|
|
47
|
+
browserslist_1.default.defaults = [
|
|
48
48
|
'last 2 Chrome versions',
|
|
49
49
|
'last 1 Firefox version',
|
|
50
50
|
'last 2 Edge major versions',
|
|
@@ -63,7 +63,7 @@ class StylesheetProcessor {
|
|
|
63
63
|
prevDir = currentDir;
|
|
64
64
|
currentDir = (0, path_1.dirname)(prevDir);
|
|
65
65
|
}
|
|
66
|
-
this.browserslistData =
|
|
66
|
+
this.browserslistData = (0, browserslist_1.default)(undefined, { path: this.basePath });
|
|
67
67
|
this.targets = transformSupportedBrowsersToTargets(this.browserslistData);
|
|
68
68
|
const tailwindSetup = (0, tailwindcss_1.getTailwindSetup)(this.projectBasePath, this.tailwindConfig);
|
|
69
69
|
if (tailwindSetup) {
|
|
@@ -137,7 +137,7 @@ class StylesheetProcessor {
|
|
|
137
137
|
if (this.cssUrl !== CssUrl.none) {
|
|
138
138
|
postCssPlugins.push(postcssUrl({ url: this.cssUrl }));
|
|
139
139
|
}
|
|
140
|
-
postCssPlugins.push(
|
|
140
|
+
postCssPlugins.push((0, autoprefixer_1.default)({
|
|
141
141
|
ignoreUnknownVersions: true,
|
|
142
142
|
overrideBrowserslist: this.browserslistData,
|
|
143
143
|
}));
|
|
@@ -148,14 +148,14 @@ class StylesheetProcessor {
|
|
|
148
148
|
switch (ext) {
|
|
149
149
|
case '.sass':
|
|
150
150
|
case '.scss': {
|
|
151
|
-
return (await
|
|
151
|
+
return (await import('sass')).compileString(css, {
|
|
152
152
|
url: (0, node_url_1.pathToFileURL)(filePath),
|
|
153
153
|
syntax: '.sass' === ext ? 'indented' : 'scss',
|
|
154
154
|
loadPaths: this.styleIncludePaths,
|
|
155
155
|
}).css;
|
|
156
156
|
}
|
|
157
157
|
case '.less': {
|
|
158
|
-
const { css: content } = await (await
|
|
158
|
+
const { css: content } = await (await import('less')).render(css, {
|
|
159
159
|
filename: filePath,
|
|
160
160
|
javascriptEnabled: true,
|
|
161
161
|
paths: this.styleIncludePaths,
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.nxWritePackageTransform = void 0;
|
|
10
|
+
const tslib_1 = require("tslib");
|
|
10
11
|
const devkit_1 = require("@nx/devkit");
|
|
11
12
|
const node_1 = require("ng-packagr/lib/graph/node");
|
|
12
13
|
const transform_1 = require("ng-packagr/lib/graph/transform");
|
|
@@ -14,7 +15,7 @@ const nodes_1 = require("ng-packagr/lib/ng-package/nodes");
|
|
|
14
15
|
const fs_1 = require("ng-packagr/lib/utils/fs");
|
|
15
16
|
const glob_1 = require("ng-packagr/lib/utils/glob");
|
|
16
17
|
const path_1 = require("ng-packagr/lib/utils/path");
|
|
17
|
-
const path = require("path");
|
|
18
|
+
const path = tslib_1.__importStar(require("path"));
|
|
18
19
|
const nxWritePackageTransform = (options) => (0, transform_1.transformFromPromise)(async (graph) => {
|
|
19
20
|
const entryPoint = graph.find((0, nodes_1.isEntryPointInProgress)());
|
|
20
21
|
const ngEntryPoint = entryPoint.data.entryPoint;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"outputCapture": "direct-nodejs",
|
|
4
4
|
"$schema": "https://json-schema.org/schema",
|
|
5
5
|
"title": "ng-packagr Target",
|
|
6
|
-
"description": "Builds an Angular library with support for incremental builds.\n\nThis executor is meant to be used with buildable libraries in an incremental build scenario. It is similar to the `@nx/angular:package` executor but
|
|
6
|
+
"description": "Builds an Angular library with support for incremental builds.\n\nThis executor is meant to be used with buildable libraries in an incremental build scenario. It is similar to the `@nx/angular:package` executor but it only produces ESM2022 bundles.",
|
|
7
7
|
"cli": "nx",
|
|
8
8
|
"type": "object",
|
|
9
9
|
"presets": [
|
package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js
CHANGED
|
@@ -9,18 +9,19 @@
|
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.compileNgcTransformFactory = void 0;
|
|
12
|
+
const tslib_1 = require("tslib");
|
|
12
13
|
const transform_1 = require("ng-packagr/lib/graph/transform");
|
|
13
14
|
const nodes_1 = require("ng-packagr/lib/ng-package/nodes");
|
|
14
15
|
const tsconfig_1 = require("ng-packagr/lib/ts/tsconfig");
|
|
15
|
-
const
|
|
16
|
-
const path = require("path");
|
|
17
|
-
const ts = require("typescript");
|
|
16
|
+
const ora_1 = tslib_1.__importDefault(require("ora"));
|
|
17
|
+
const path = tslib_1.__importStar(require("path"));
|
|
18
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
18
19
|
const angular_version_utils_1 = require("../../../../utilities/angular-version-utils");
|
|
19
20
|
const compile_source_files_1 = require("../../ngc/compile-source-files");
|
|
20
21
|
const ng_compiler_cli_1 = require("../../utils/ng-compiler-cli");
|
|
21
22
|
const compileNgcTransformFactory = (StylesheetProcessor, options) => {
|
|
22
23
|
return (0, transform_1.transformFromPromise)(async (graph) => {
|
|
23
|
-
const spinner =
|
|
24
|
+
const spinner = (0, ora_1.default)({
|
|
24
25
|
hideCursor: false,
|
|
25
26
|
discardStdin: false,
|
|
26
27
|
});
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.NX_DEFAULT_OPTIONS_PROVIDER = exports.nxProvideOptions = exports.NX_OPTIONS_TOKEN = void 0;
|
|
10
|
-
const
|
|
10
|
+
const tslib_1 = require("tslib");
|
|
11
|
+
const findCacheDirectory = tslib_1.__importStar(require("find-cache-dir"));
|
|
11
12
|
const injection_js_1 = require("injection-js");
|
|
12
13
|
const os_1 = require("os");
|
|
13
14
|
const path_1 = require("path");
|
|
@@ -6,14 +6,14 @@ const angular_version_utils_1 = require("../../utilities/angular-version-utils")
|
|
|
6
6
|
async function getNgPackagrInstance(options) {
|
|
7
7
|
const { major: angularMajorVersion } = (0, angular_version_utils_1.getInstalledAngularVersionInfo)();
|
|
8
8
|
if (angularMajorVersion >= 17) {
|
|
9
|
-
const { STYLESHEET_PROCESSOR } = await
|
|
9
|
+
const { STYLESHEET_PROCESSOR } = await import('../../utilities/ng-packagr/stylesheet-processor.di.js');
|
|
10
10
|
const packagr = (0, ng_packagr_1.ngPackagr)();
|
|
11
11
|
packagr.withProviders([STYLESHEET_PROCESSOR]);
|
|
12
12
|
return packagr;
|
|
13
13
|
}
|
|
14
|
-
const { NX_ENTRY_POINT_PROVIDERS } = await
|
|
15
|
-
const { nxProvideOptions } = await
|
|
16
|
-
const { NX_PACKAGE_PROVIDERS, NX_PACKAGE_TRANSFORM } = await
|
|
14
|
+
const { NX_ENTRY_POINT_PROVIDERS } = await import('./ng-package/entry-point/entry-point.di.js');
|
|
15
|
+
const { nxProvideOptions } = await import('./ng-package/options.di.js');
|
|
16
|
+
const { NX_PACKAGE_PROVIDERS, NX_PACKAGE_TRANSFORM } = await import('./ng-package/package.di.js');
|
|
17
17
|
const packagr = new ng_packagr_1.NgPackagr([
|
|
18
18
|
...NX_PACKAGE_PROVIDERS,
|
|
19
19
|
...NX_ENTRY_POINT_PROVIDERS,
|
|
@@ -6,9 +6,8 @@
|
|
|
6
6
|
* - Support ngcc for Angular < 16.
|
|
7
7
|
* - Support Angular Compiler `incrementalDriver` for Angular < 16.
|
|
8
8
|
*/
|
|
9
|
-
import type { CompilerOptions, ParsedConfiguration } from '@angular/compiler-cli';
|
|
10
9
|
import { BuildGraph } from 'ng-packagr/lib/graph/build-graph';
|
|
11
10
|
import * as ts from 'typescript';
|
|
12
11
|
import { NgPackagrOptions } from '../ng-package/options.di';
|
|
13
12
|
import { StylesheetProcessor } from '../styles/stylesheet-processor';
|
|
14
|
-
export declare function compileSourceFiles(graph: BuildGraph, tsConfig:
|
|
13
|
+
export declare function compileSourceFiles(graph: BuildGraph, tsConfig: any, moduleResolutionCache: ts.ModuleResolutionCache, options: NgPackagrOptions, extraOptions?: Partial<ts.CompilerOptions>, stylesheetProcessor?: StylesheetProcessor, ngccProcessor?: any): Promise<void>;
|
|
@@ -9,15 +9,16 @@
|
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.compileSourceFiles = void 0;
|
|
12
|
+
const tslib_1 = require("tslib");
|
|
12
13
|
const nodes_1 = require("ng-packagr/lib/ng-package/nodes");
|
|
13
|
-
const log = require("ng-packagr/lib/utils/log");
|
|
14
|
+
const log = tslib_1.__importStar(require("ng-packagr/lib/utils/log"));
|
|
14
15
|
const cache_compiler_host_1 = require("ng-packagr/lib/ts/cache-compiler-host");
|
|
15
16
|
const node_path_1 = require("node:path");
|
|
16
|
-
const ts = require("typescript");
|
|
17
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
17
18
|
const angular_version_utils_1 = require("../../../utilities/angular-version-utils");
|
|
18
|
-
const
|
|
19
|
+
const module_loader_1 = require("../../../utilities/module-loader");
|
|
19
20
|
async function compileSourceFiles(graph, tsConfig, moduleResolutionCache, options, extraOptions, stylesheetProcessor, ngccProcessor) {
|
|
20
|
-
const { NgtscProgram, formatDiagnostics } = await (0,
|
|
21
|
+
const { NgtscProgram, formatDiagnostics } = await (0, module_loader_1.loadEsmModule)('@angular/compiler-cli');
|
|
21
22
|
const { cacheDirectory, watch, cacheEnabled } = options;
|
|
22
23
|
const tsConfigOptions = {
|
|
23
24
|
...tsConfig.options,
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.StylesheetProcessor = exports.CssUrl = void 0;
|
|
11
|
-
const
|
|
11
|
+
const tslib_1 = require("tslib");
|
|
12
|
+
const browserslist_1 = tslib_1.__importDefault(require("browserslist"));
|
|
12
13
|
const fs_1 = require("fs");
|
|
13
|
-
const esbuild_executor_1 = require("ng-packagr/lib/esbuild/esbuild-executor");
|
|
14
14
|
const cache_1 = require("ng-packagr/lib/utils/cache");
|
|
15
|
-
const log = require("ng-packagr/lib/utils/log");
|
|
15
|
+
const log = tslib_1.__importStar(require("ng-packagr/lib/utils/log"));
|
|
16
16
|
const path_1 = require("path");
|
|
17
|
-
const
|
|
18
|
-
const postcssUrl = require("postcss-url");
|
|
17
|
+
const autoprefixer_1 = tslib_1.__importDefault(require("autoprefixer"));
|
|
18
|
+
const postcssUrl = tslib_1.__importStar(require("postcss-url"));
|
|
19
19
|
const node_url_1 = require("node:url");
|
|
20
20
|
const tailwindcss_1 = require("../../../utilities/ng-packagr/tailwindcss");
|
|
21
21
|
const postcss = require('postcss');
|
|
@@ -32,12 +32,12 @@ class StylesheetProcessor {
|
|
|
32
32
|
this.includePaths = includePaths;
|
|
33
33
|
this.cacheDirectory = cacheDirectory;
|
|
34
34
|
this.tailwindConfig = tailwindConfig;
|
|
35
|
-
this.esbuild = new
|
|
35
|
+
this.esbuild = new (require('ng-packagr/lib/esbuild/esbuild-executor').EsbuildExecutor)();
|
|
36
36
|
// By default, browserslist defaults are too inclusive
|
|
37
37
|
// https://github.com/browserslist/browserslist/blob/83764ea81ffaa39111c204b02c371afa44a4ff07/index.js#L516-L522
|
|
38
38
|
// We change the default query to browsers that Angular support.
|
|
39
39
|
// https://angular.io/guide/browser-support
|
|
40
|
-
|
|
40
|
+
browserslist_1.default.defaults = [
|
|
41
41
|
'last 2 Chrome versions',
|
|
42
42
|
'last 1 Firefox version',
|
|
43
43
|
'last 2 Edge major versions',
|
|
@@ -56,7 +56,7 @@ class StylesheetProcessor {
|
|
|
56
56
|
prevDir = currentDir;
|
|
57
57
|
currentDir = (0, path_1.dirname)(prevDir);
|
|
58
58
|
}
|
|
59
|
-
this.browserslistData =
|
|
59
|
+
this.browserslistData = (0, browserslist_1.default)(undefined, { path: this.basePath });
|
|
60
60
|
this.targets = transformSupportedBrowsersToTargets(this.browserslistData);
|
|
61
61
|
const tailwindSetup = (0, tailwindcss_1.getTailwindSetup)(this.projectBasePath, this.tailwindConfig);
|
|
62
62
|
if (tailwindSetup) {
|
|
@@ -130,7 +130,7 @@ class StylesheetProcessor {
|
|
|
130
130
|
if (this.cssUrl !== CssUrl.none) {
|
|
131
131
|
postCssPlugins.push(postcssUrl({ url: this.cssUrl }));
|
|
132
132
|
}
|
|
133
|
-
postCssPlugins.push(
|
|
133
|
+
postCssPlugins.push((0, autoprefixer_1.default)({
|
|
134
134
|
ignoreUnknownVersions: true,
|
|
135
135
|
overrideBrowserslist: this.browserslistData,
|
|
136
136
|
}));
|
|
@@ -141,14 +141,14 @@ class StylesheetProcessor {
|
|
|
141
141
|
switch (ext) {
|
|
142
142
|
case '.sass':
|
|
143
143
|
case '.scss': {
|
|
144
|
-
return (await
|
|
144
|
+
return (await import('sass')).compileString(css, {
|
|
145
145
|
url: (0, node_url_1.pathToFileURL)(filePath),
|
|
146
146
|
syntax: '.sass' === ext ? 'indented' : 'scss',
|
|
147
147
|
loadPaths: this.styleIncludePaths,
|
|
148
148
|
}).css;
|
|
149
149
|
}
|
|
150
150
|
case '.less': {
|
|
151
|
-
const { css: content } = await (await
|
|
151
|
+
const { css: content } = await (await import('less')).render(css, {
|
|
152
152
|
filename: filePath,
|
|
153
153
|
javascriptEnabled: true,
|
|
154
154
|
paths: this.styleIncludePaths,
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import type { IndexHtmlTransform } from '@angular-devkit/build-angular/src/utils/index-file/index-html-generator';
|
|
2
1
|
import type { Plugin } from 'esbuild';
|
|
3
|
-
import type { Connect } from 'vite';
|
|
4
2
|
export type PluginSpec = {
|
|
5
3
|
path: string;
|
|
6
4
|
options: any;
|
|
7
5
|
};
|
|
8
6
|
export declare function loadPlugins(plugins: string[] | PluginSpec[] | undefined, tsConfig: string): Promise<Plugin[]>;
|
|
9
|
-
export declare function loadMiddleware(middlewareFns: string[] | undefined, tsConfig: string): Promise<
|
|
10
|
-
export declare function loadIndexHtmlTransformer(indexHtmlTransformerPath: string, tsConfig: string): Promise<
|
|
7
|
+
export declare function loadMiddleware(middlewareFns: string[] | undefined, tsConfig: string): Promise<any[]>;
|
|
8
|
+
export declare function loadIndexHtmlTransformer(indexHtmlTransformerPath: string, tsConfig: string): Promise<any>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
export declare function loadModule<T = any>(path: string): Promise<T>;
|
|
3
2
|
/**
|
|
4
3
|
* This uses a dynamic import to load a module which may be ESM.
|
|
@@ -12,4 +11,4 @@ export declare function loadModule<T = any>(path: string): Promise<T>;
|
|
|
12
11
|
* @param modulePath The path of the module to load.
|
|
13
12
|
* @returns A Promise that resolves to the dynamically imported module.
|
|
14
13
|
*/
|
|
15
|
-
export declare function loadEsmModule<T>(modulePath: string | URL): Promise<T>;
|
|
14
|
+
export declare function loadEsmModule<T = any>(modulePath: string | URL): Promise<T>;
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.AsyncStylesheetProcessor = exports.StylesheetProcessor = exports.CssUrl = void 0;
|
|
11
|
-
const
|
|
11
|
+
const tslib_1 = require("tslib");
|
|
12
|
+
const browserslist_1 = tslib_1.__importDefault(require("browserslist"));
|
|
12
13
|
const fs_1 = require("fs");
|
|
13
14
|
const path_1 = require("path");
|
|
14
15
|
const Piscina = require('piscina');
|
|
@@ -38,7 +39,7 @@ class StylesheetProcessor {
|
|
|
38
39
|
// https://github.com/browserslist/browserslist/blob/83764ea81ffaa39111c204b02c371afa44a4ff07/index.js#L516-L522
|
|
39
40
|
// We change the default query to browsers that Angular support.
|
|
40
41
|
// https://angular.io/guide/browser-support
|
|
41
|
-
|
|
42
|
+
browserslist_1.default.defaults = [
|
|
42
43
|
'last 2 Chrome versions',
|
|
43
44
|
'last 1 Firefox version',
|
|
44
45
|
'last 2 Edge major versions',
|
|
@@ -70,12 +71,25 @@ class StylesheetProcessor {
|
|
|
70
71
|
prevDir = currentDir;
|
|
71
72
|
currentDir = (0, path_1.dirname)(prevDir);
|
|
72
73
|
}
|
|
73
|
-
const browserslistData =
|
|
74
|
+
const browserslistData = (0, browserslist_1.default)(undefined, { path: this.basePath });
|
|
74
75
|
const { version: ngPackagrVersion } = (0, angular_version_utils_1.getInstalledPackageVersionInfo)('ng-packagr');
|
|
76
|
+
let tailwindConfigPath;
|
|
75
77
|
let postcssConfiguration;
|
|
76
|
-
if ((0, semver_1.
|
|
78
|
+
if ((0, semver_1.gte)(ngPackagrVersion, '18.0.0')) {
|
|
79
|
+
const { findTailwindConfiguration, generateSearchDirectories, loadPostcssConfiguration, } = require('ng-packagr/lib/styles/postcss-configuration');
|
|
80
|
+
let searchDirs = generateSearchDirectories([this.projectBasePath]);
|
|
81
|
+
postcssConfiguration = loadPostcssConfiguration(searchDirs);
|
|
82
|
+
// (nx-specific): we support loading the TailwindCSS config from the root of the workspace
|
|
83
|
+
searchDirs = generateSearchDirectories([
|
|
84
|
+
this.projectBasePath,
|
|
85
|
+
devkit_1.workspaceRoot,
|
|
86
|
+
]);
|
|
87
|
+
tailwindConfigPath = findTailwindConfiguration(searchDirs);
|
|
88
|
+
}
|
|
89
|
+
else if ((0, semver_1.gt)(ngPackagrVersion, '17.2.0')) {
|
|
77
90
|
const { loadPostcssConfiguration, } = require('ng-packagr/lib/styles/postcss-configuration');
|
|
78
91
|
postcssConfiguration = loadPostcssConfiguration(this.projectBasePath);
|
|
92
|
+
tailwindConfigPath = (0, tailwindcss_1.getTailwindConfigPath)(this.projectBasePath, devkit_1.workspaceRoot);
|
|
79
93
|
}
|
|
80
94
|
this.renderWorker = new Piscina({
|
|
81
95
|
filename: require.resolve('ng-packagr/lib/styles/stylesheet-processor-worker'),
|
|
@@ -87,7 +101,7 @@ class StylesheetProcessor {
|
|
|
87
101
|
},
|
|
88
102
|
workerData: {
|
|
89
103
|
postcssConfiguration,
|
|
90
|
-
tailwindConfigPath
|
|
104
|
+
tailwindConfigPath,
|
|
91
105
|
projectBasePath: this.projectBasePath,
|
|
92
106
|
browserslistData,
|
|
93
107
|
targets: transformSupportedBrowsersToTargets(browserslistData),
|
|
@@ -116,7 +130,7 @@ class AsyncStylesheetProcessor {
|
|
|
116
130
|
// https://github.com/browserslist/browserslist/blob/83764ea81ffaa39111c204b02c371afa44a4ff07/index.js#L516-L522
|
|
117
131
|
// We change the default query to browsers that Angular support.
|
|
118
132
|
// https://angular.io/guide/browser-support
|
|
119
|
-
|
|
133
|
+
browserslist_1.default.defaults = [
|
|
120
134
|
'last 2 Chrome versions',
|
|
121
135
|
'last 1 Firefox version',
|
|
122
136
|
'last 2 Edge major versions',
|
|
@@ -148,11 +162,11 @@ class AsyncStylesheetProcessor {
|
|
|
148
162
|
prevDir = currentDir;
|
|
149
163
|
currentDir = (0, path_1.dirname)(prevDir);
|
|
150
164
|
}
|
|
151
|
-
const browserslistData =
|
|
165
|
+
const browserslistData = (0, browserslist_1.default)(undefined, { path: this.basePath });
|
|
152
166
|
const { version: ngPackagrVersion } = (0, angular_version_utils_1.getInstalledPackageVersionInfo)('ng-packagr');
|
|
153
167
|
let postcssConfiguration;
|
|
154
168
|
if (ngPackagrVersion === '17.2.0') {
|
|
155
|
-
const { loadPostcssConfiguration } =
|
|
169
|
+
const { loadPostcssConfiguration, } = require('ng-packagr/lib/styles/postcss-configuration');
|
|
156
170
|
postcssConfiguration = await loadPostcssConfiguration(this.projectBasePath);
|
|
157
171
|
}
|
|
158
172
|
this.renderWorker = new Piscina({
|
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
* - Added an extra function that updates the configFilePath in the returned parsed options
|
|
7
7
|
* to be the original tsconfig file.
|
|
8
8
|
*/
|
|
9
|
-
import type { ParsedConfiguration } from '@angular/compiler-cli';
|
|
10
9
|
/**
|
|
11
10
|
* Proxy function that ensures the configFilePath option points to the original file path.
|
|
12
11
|
*/
|
|
13
|
-
export declare function parseRemappedTsConfigAndMergeDefaults(workspaceRoot: string, originalFilePath: string, remappedFilePath: string): Promise<
|
|
12
|
+
export declare function parseRemappedTsConfigAndMergeDefaults(workspaceRoot: string, originalFilePath: string, remappedFilePath: string): Promise<any>;
|
|
@@ -9,9 +9,10 @@
|
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.parseRemappedTsConfigAndMergeDefaults = void 0;
|
|
12
|
+
const tslib_1 = require("tslib");
|
|
12
13
|
const path_1 = require("path");
|
|
13
|
-
const ts = require("typescript");
|
|
14
|
-
const
|
|
14
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
15
|
+
const module_loader_1 = require("./module-loader");
|
|
15
16
|
async function readDefaultTsConfig(fileName) {
|
|
16
17
|
// these options are mandatory
|
|
17
18
|
const extraOptions = {
|
|
@@ -29,7 +30,7 @@ async function readDefaultTsConfig(fileName) {
|
|
|
29
30
|
flatModuleId: 'AUTOGENERATED',
|
|
30
31
|
flatModuleOutFile: 'AUTOGENERATED',
|
|
31
32
|
};
|
|
32
|
-
const { readConfiguration } = await (0,
|
|
33
|
+
const { readConfiguration } = await (0, module_loader_1.loadEsmModule)('@angular/compiler-cli');
|
|
33
34
|
return readConfiguration(fileName, extraOptions);
|
|
34
35
|
}
|
|
35
36
|
/**
|
|
@@ -29,7 +29,7 @@ export declare const extendAngularEslintJson: (json: Linter.Config, options: Esl
|
|
|
29
29
|
[name: string]: boolean;
|
|
30
30
|
};
|
|
31
31
|
globals?: {
|
|
32
|
-
[name: string]: boolean | "
|
|
32
|
+
[name: string]: boolean | "off" | "readonly" | "readable" | "writable" | "writeable";
|
|
33
33
|
};
|
|
34
34
|
noInlineConfig?: boolean;
|
|
35
35
|
overrides?: Linter.ConfigOverride<Linter.RulesRecord>[];
|
|
@@ -61,7 +61,7 @@ export declare const extendAngularEslintJson: (json: Linter.Config, options: Esl
|
|
|
61
61
|
};
|
|
62
62
|
extends?: string | string[];
|
|
63
63
|
globals?: {
|
|
64
|
-
[name: string]: boolean | "
|
|
64
|
+
[name: string]: boolean | "off" | "readonly" | "readable" | "writable" | "writeable";
|
|
65
65
|
};
|
|
66
66
|
noInlineConfig?: boolean;
|
|
67
67
|
parser?: string;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"examples": [
|
|
9
9
|
{
|
|
10
10
|
"command": "nx g @nx/angular:add-linting --prefix=cool --projectName=cool-lib --projectRoot=libs/cool-lib",
|
|
11
|
-
"description": "Adds ESLint with Angular-specific rules for an existing project named `cool-lib` with the [prefix](https://angular.
|
|
11
|
+
"description": "Adds ESLint with Angular-specific rules for an existing project named `cool-lib` with the [prefix](https://angular.dev/style-guide#style-02-07) `cool`"
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
14
|
"properties": {
|
|
Binary file
|
|
@@ -2,5 +2,7 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|
|
2
2
|
import { AppModule } from './app/app.module';
|
|
3
3
|
|
|
4
4
|
platformBrowserDynamic()
|
|
5
|
-
.bootstrapModule(AppModule)
|
|
5
|
+
.bootstrapModule(AppModule<% if (useEventCoalescing) { %>, {
|
|
6
|
+
ngZoneEventCoalescing: true
|
|
7
|
+
}<% } %>)
|
|
6
8
|
.catch((err) => console.error(err));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ApplicationConfig
|
|
1
|
+
import { ApplicationConfig<% if (useEventCoalescing) { %>, provideZoneChangeDetection<% } %> } from '@angular/core';<% if (routing) { %>
|
|
2
2
|
import { provideRouter } from '@angular/router';
|
|
3
3
|
import { appRoutes } from './app.routes';<% } %>
|
|
4
4
|
|
|
5
5
|
export const appConfig: ApplicationConfig = {
|
|
6
|
-
providers: [<% if (routing) { %>provideRouter(appRoutes) <% } %>]
|
|
6
|
+
providers: [<% if (useEventCoalescing) { %>provideZoneChangeDetection({ eventCoalescing: true }), <% } %><% if (routing) { %>provideRouter(appRoutes) <% } %>]
|
|
7
7
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addLinting = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const eslint_1 = require("@nx/eslint");
|
|
5
|
-
const add_linting_1 = require("../../add-linting/add-linting");
|
|
6
|
+
const add_linting_1 = tslib_1.__importDefault(require("../../add-linting/add-linting"));
|
|
6
7
|
async function addLinting(host, options) {
|
|
7
8
|
if (options.linter === eslint_1.Linter.None) {
|
|
8
9
|
return;
|
|
@@ -29,9 +29,16 @@ async function createFiles(tree, options, rootOffset) {
|
|
|
29
29
|
angularMajorVersion,
|
|
30
30
|
rootOffset,
|
|
31
31
|
isUsingApplicationBuilder,
|
|
32
|
+
useEventCoalescing: angularMajorVersion >= 18,
|
|
32
33
|
tpl: '',
|
|
33
34
|
};
|
|
34
35
|
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '../files/base'), options.appProjectRoot, substitutions);
|
|
36
|
+
if (angularMajorVersion >= 18) {
|
|
37
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '../files/base-18+'), options.appProjectRoot, substitutions);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '../files/base-pre18'), options.appProjectRoot, substitutions);
|
|
41
|
+
}
|
|
35
42
|
if (options.standalone) {
|
|
36
43
|
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '../files/standalone-components'), options.appProjectRoot, substitutions);
|
|
37
44
|
}
|
|
@@ -56,12 +56,19 @@ function createProject(tree, options) {
|
|
|
56
56
|
index: `${options.appProjectSourceRoot}/index.html`,
|
|
57
57
|
[buildMainOptionName]: `${options.appProjectSourceRoot}/main.ts`,
|
|
58
58
|
polyfills: ['zone.js'],
|
|
59
|
-
tsConfig:
|
|
59
|
+
tsConfig: (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'),
|
|
60
60
|
inlineStyleLanguage,
|
|
61
|
-
assets:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
assets: angularMajorVersion >= 18
|
|
62
|
+
? [
|
|
63
|
+
{
|
|
64
|
+
glob: '**/*',
|
|
65
|
+
input: (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'public'),
|
|
66
|
+
},
|
|
67
|
+
]
|
|
68
|
+
: [
|
|
69
|
+
`${options.appProjectSourceRoot}/favicon.ico`,
|
|
70
|
+
`${options.appProjectSourceRoot}/assets`,
|
|
71
|
+
],
|
|
65
72
|
styles: [`${options.appProjectSourceRoot}/styles.${options.style}`],
|
|
66
73
|
scripts: [],
|
|
67
74
|
},
|
|
@@ -6,7 +6,7 @@ const versions_1 = require("../../utils/versions");
|
|
|
6
6
|
const storybook_inputs_1 = require("../utils/storybook-ast/storybook-inputs");
|
|
7
7
|
async function componentTestGenerator(tree, options) {
|
|
8
8
|
(0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
|
9
|
-
const { assertMinimumCypressVersion } =
|
|
9
|
+
const { assertMinimumCypressVersion } = require('@nx/cypress/src/utils/cypress-version');
|
|
10
10
|
assertMinimumCypressVersion(10);
|
|
11
11
|
const { root } = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
12
12
|
const componentDirPath = (0, devkit_1.joinPathFragments)(root, options.componentDir);
|
|
@@ -41,7 +41,7 @@ async function cypressComponentConfigurationInternal(tree, options) {
|
|
|
41
41
|
exports.cypressComponentConfigurationInternal = cypressComponentConfigurationInternal;
|
|
42
42
|
async function addFiles(tree, projectConfig, options) {
|
|
43
43
|
const componentFile = (0, devkit_1.joinPathFragments)(projectConfig.root, 'cypress', 'support', 'component.ts');
|
|
44
|
-
const { addMountDefinition } =
|
|
44
|
+
const { addMountDefinition } = require('@nx/cypress/src/utils/config');
|
|
45
45
|
const updatedCmpContents = await addMountDefinition(tree.read(componentFile, 'utf-8'));
|
|
46
46
|
tree.write(componentFile, `import { mount } from 'cypress/angular';\n${updatedCmpContents}`);
|
|
47
47
|
if (options.generateTests) {
|
|
@@ -69,7 +69,7 @@ async function addFiles(tree, projectConfig, options) {
|
|
|
69
69
|
async function configureCypressCT(tree, options) {
|
|
70
70
|
let found = { target: options.buildTarget, config: undefined };
|
|
71
71
|
if (!options.buildTarget) {
|
|
72
|
-
const { findBuildConfig } =
|
|
72
|
+
const { findBuildConfig } = require('@nx/cypress/src/utils/find-target-options');
|
|
73
73
|
found = await findBuildConfig(tree, {
|
|
74
74
|
project: options.project,
|
|
75
75
|
buildTarget: options.buildTarget,
|
|
@@ -95,7 +95,7 @@ async function configureCypressCT(tree, options) {
|
|
|
95
95
|
else {
|
|
96
96
|
ctConfigOptions.buildTarget = found.target;
|
|
97
97
|
}
|
|
98
|
-
const { addDefaultCTConfig, getProjectCypressConfigPath } =
|
|
98
|
+
const { addDefaultCTConfig, getProjectCypressConfigPath } = require('@nx/cypress/src/utils/config');
|
|
99
99
|
const cypressConfigPath = getProjectCypressConfigPath(tree, projectConfig.root);
|
|
100
100
|
const updatedCyConfig = await addDefaultCTConfig(tree.read(cypressConfigPath, 'utf-8'), ctConfigOptions);
|
|
101
101
|
tree.write(cypressConfigPath, `import { nxComponentTestingPreset } from '@nx/angular/plugins/component-testing';\n${updatedCyConfig}`);
|