@nx/angular 17.3.0-beta.5 → 17.3.0-beta.8

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.
Files changed (28) hide show
  1. package/ng-package.json +2 -1
  2. package/package.json +12 -11
  3. package/src/builders/dev-server/dev-server.impl.js +10 -1
  4. package/src/builders/dev-server/schema.d.ts +1 -0
  5. package/src/builders/dev-server/schema.json +8 -0
  6. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/styles/stylesheet-processor.js +1 -12
  7. package/src/executors/package/ng-packagr-adjustments/ng-packagr.d.ts +3 -0
  8. package/src/executors/package/ng-packagr-adjustments/ng-packagr.js +28 -0
  9. package/src/executors/package/ng-packagr-adjustments/styles/stylesheet-processor.js +1 -12
  10. package/src/executors/package/package.impl.d.ts +1 -1
  11. package/src/executors/package/package.impl.js +5 -15
  12. package/src/executors/package/schema.json +2 -2
  13. package/src/executors/utilities/esbuild-extensions.d.ts +2 -0
  14. package/src/executors/utilities/esbuild-extensions.js +14 -1
  15. package/src/executors/utilities/ng-packagr/stylesheet-processor.d.ts +27 -0
  16. package/src/executors/utilities/ng-packagr/stylesheet-processor.di.d.ts +2 -0
  17. package/src/executors/utilities/ng-packagr/stylesheet-processor.di.js +10 -0
  18. package/src/executors/utilities/ng-packagr/stylesheet-processor.js +121 -0
  19. package/src/executors/utilities/{tailwindcss.d.ts → ng-packagr/tailwindcss.d.ts} +1 -0
  20. package/src/executors/utilities/{tailwindcss.js → ng-packagr/tailwindcss.js} +2 -1
  21. package/src/generators/add-linting/lib/create-eslint-configuration.d.ts +2 -2
  22. package/src/generators/application/lib/create-project.d.ts +1 -1
  23. package/src/generators/application/lib/create-project.js +2 -0
  24. package/src/generators/init/init.js +1 -1
  25. package/src/generators/init/schema.d.ts +1 -0
  26. package/src/generators/init/schema.json +7 -2
  27. package/src/generators/setup-ssr/files/server/application-builder/__serverFileName__ +2 -0
  28. package/src/generators/stories/stories.js +2 -2
package/ng-package.json CHANGED
@@ -24,7 +24,8 @@
24
24
  "http-server",
25
25
  "magic-string",
26
26
  "enquirer",
27
- "find-cache-dir"
27
+ "find-cache-dir",
28
+ "piscina"
28
29
  ],
29
30
  "keepLifecycleScripts": true
30
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/angular",
3
- "version": "17.3.0-beta.5",
3
+ "version": "17.3.0-beta.8",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, and Cypress. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Upgrading AngularJS applications \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
6
6
  "repository": {
@@ -73,20 +73,21 @@
73
73
  "find-cache-dir": "^3.3.2",
74
74
  "ignore": "^5.0.4",
75
75
  "magic-string": "~0.30.2",
76
- "minimatch": "3.0.5",
76
+ "minimatch": "9.0.3",
77
77
  "semver": "7.5.3",
78
78
  "tslib": "^2.3.0",
79
79
  "webpack": "^5.80.0",
80
80
  "webpack-merge": "^5.8.0",
81
- "@nx/devkit": "17.3.0-beta.5",
82
- "@nx/cypress": "17.3.0-beta.5",
83
- "@nx/jest": "17.3.0-beta.5",
84
- "@nx/js": "17.3.0-beta.5",
85
- "@nx/eslint": "17.3.0-beta.5",
86
- "@nx/webpack": "17.3.0-beta.5",
87
- "@nx/web": "17.3.0-beta.5",
88
- "@nx/workspace": "17.3.0-beta.5",
89
- "@nrwl/angular": "17.3.0-beta.5"
81
+ "@nx/devkit": "17.3.0-beta.8",
82
+ "@nx/cypress": "17.3.0-beta.8",
83
+ "@nx/jest": "17.3.0-beta.8",
84
+ "@nx/js": "17.3.0-beta.8",
85
+ "@nx/eslint": "17.3.0-beta.8",
86
+ "@nx/webpack": "17.3.0-beta.8",
87
+ "@nx/web": "17.3.0-beta.8",
88
+ "@nx/workspace": "17.3.0-beta.8",
89
+ "piscina": "^4.2.1",
90
+ "@nrwl/angular": "17.3.0-beta.8"
90
91
  },
91
92
  "peerDependencies": {
92
93
  "@angular-devkit/build-angular": ">= 15.0.0 < 18.0.0",
@@ -16,6 +16,13 @@ const buildable_libs_1 = require("../utilities/buildable-libs");
16
16
  const webpack_1 = require("../utilities/webpack");
17
17
  const lib_1 = require("./lib");
18
18
  function executeDevServerBuilder(rawOptions, context) {
19
+ if (rawOptions.esbuildMiddleware) {
20
+ const { major: angularMajorVersion, version: angularVersion } = (0, angular_version_utils_1.getInstalledAngularVersionInfo)();
21
+ if (angularMajorVersion < 17) {
22
+ throw new Error((0, devkit_1.stripIndents) `The "esbuildMiddleware" option is only supported in Angular >= 17.0.0. You are currently using "${angularVersion}".
23
+ You can resolve this error by removing the "esbuildMiddleware" option or by migrating to Angular 17.0.0.`);
24
+ }
25
+ }
19
26
  process.env.NX_TSCONFIG_PATH = (0, js_1.getRootTsConfigPath)();
20
27
  const options = (0, lib_1.normalizeOptions)(rawOptions);
21
28
  const parsedBuildTarget = (0, devkit_1.parseTargetString)(options.buildTarget, {
@@ -96,7 +103,8 @@ function executeDevServerBuilder(rawOptions, context) {
96
103
  return (0, rxjs_1.combineLatest)([
97
104
  (0, rxjs_1.from)(Promise.resolve().then(() => require('@angular-devkit/build-angular'))),
98
105
  (0, rxjs_1.from)((0, esbuild_extensions_1.loadPlugins)(buildTargetOptions.plugins, buildTargetOptions.tsConfig)),
99
- ]).pipe((0, operators_2.switchMap)(([{ executeDevServerBuilder }, plugins]) => executeDevServerBuilder(delegateBuilderOptions, context, {
106
+ (0, rxjs_1.from)((0, esbuild_extensions_1.loadMiddleware)(options.esbuildMiddleware, buildTargetOptions.tsConfig)),
107
+ ]).pipe((0, operators_2.switchMap)(([{ executeDevServerBuilder }, plugins, middleware]) => executeDevServerBuilder(delegateBuilderOptions, context, {
100
108
  webpackConfiguration: isUsingWebpackBuilder
101
109
  ? async (baseWebpackConfig) => {
102
110
  if (!buildLibsFromSource) {
@@ -126,6 +134,7 @@ function executeDevServerBuilder(rawOptions, context) {
126
134
  : {}),
127
135
  }, {
128
136
  buildPlugins: plugins,
137
+ middleware,
129
138
  })));
130
139
  }
131
140
  exports.executeDevServerBuilder = executeDevServerBuilder;
@@ -17,6 +17,7 @@ interface BaseSchema {
17
17
  watch?: boolean;
18
18
  poll?: number;
19
19
  buildLibsFromSource?: boolean;
20
+ esbuildMiddleware?: string[];
20
21
  }
21
22
 
22
23
  export type SchemaWithBrowserTarget = BaseSchema & {
@@ -115,6 +115,14 @@
115
115
  "type": "boolean",
116
116
  "description": "Read buildable libraries from source instead of building them separately. If not set, it will take the value specified in the `browserTarget` options, or it will default to `true` if it's also not set in the `browserTarget` options.",
117
117
  "x-priority": "important"
118
+ },
119
+ "esbuildMiddleware": {
120
+ "description": "A list of HTTP request middleware functions. _Note: this is only supported in Angular versions >= 17.0.0_.",
121
+ "type": "array",
122
+ "items": {
123
+ "type": "string",
124
+ "description": "The path to the middleware function. Relative to the workspace root."
125
+ }
118
126
  }
119
127
  },
120
128
  "additionalProperties": false,
@@ -19,7 +19,7 @@ const path_1 = require("path");
19
19
  const postcssPresetEnv = require("postcss-preset-env");
20
20
  const postcssUrl = require("postcss-url");
21
21
  const node_url_1 = require("node:url");
22
- const tailwindcss_1 = require("../../../utilities/tailwindcss");
22
+ const tailwindcss_1 = require("../../../utilities/ng-packagr/tailwindcss");
23
23
  const postcss = require('postcss');
24
24
  var CssUrl;
25
25
  (function (CssUrl) {
@@ -222,14 +222,3 @@ function transformSupportedBrowsersToTargets(supportedBrowsers) {
222
222
  }
223
223
  return transformed.length ? transformed : undefined;
224
224
  }
225
- function customSassImporter(url, prev) {
226
- // NB: Sass importer should always be sync as otherwise it will cause
227
- // sass to go in the async path which is slower.
228
- if (url[0] !== '~') {
229
- return undefined;
230
- }
231
- return {
232
- file: url.slice(1),
233
- prev,
234
- };
235
- }
@@ -0,0 +1,3 @@
1
+ import { NgPackagr } from 'ng-packagr';
2
+ import type { BuildAngularLibraryExecutorOptions } from '../../package/schema';
3
+ export declare function getNgPackagrInstance(options: BuildAngularLibraryExecutorOptions): Promise<NgPackagr>;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getNgPackagrInstance = void 0;
4
+ const ng_packagr_1 = require("ng-packagr");
5
+ const angular_version_utils_1 = require("../../utilities/angular-version-utils");
6
+ const stylesheet_processor_di_1 = require("../../utilities/ng-packagr/stylesheet-processor.di");
7
+ async function getNgPackagrInstance(options) {
8
+ const { major: angularMajorVersion } = (0, angular_version_utils_1.getInstalledAngularVersionInfo)();
9
+ if (angularMajorVersion >= 17) {
10
+ const packagr = (0, ng_packagr_1.ngPackagr)();
11
+ packagr.withProviders([stylesheet_processor_di_1.STYLESHEET_PROCESSOR]);
12
+ return packagr;
13
+ }
14
+ const { NX_ENTRY_POINT_PROVIDERS } = await Promise.resolve().then(() => require('./ng-package/entry-point/entry-point.di'));
15
+ const { nxProvideOptions } = await Promise.resolve().then(() => require('./ng-package/options.di'));
16
+ const { NX_PACKAGE_PROVIDERS, NX_PACKAGE_TRANSFORM } = await Promise.resolve().then(() => require('./ng-package/package.di'));
17
+ const packagr = new ng_packagr_1.NgPackagr([
18
+ ...NX_PACKAGE_PROVIDERS,
19
+ ...NX_ENTRY_POINT_PROVIDERS,
20
+ nxProvideOptions({
21
+ tailwindConfig: options.tailwindConfig,
22
+ watch: options.watch,
23
+ }),
24
+ ]);
25
+ packagr.withBuildTransform(NX_PACKAGE_TRANSFORM.provide);
26
+ return packagr;
27
+ }
28
+ exports.getNgPackagrInstance = getNgPackagrInstance;
@@ -19,7 +19,7 @@ const path_1 = require("path");
19
19
  const postcssPresetEnv = require("postcss-preset-env");
20
20
  const postcssUrl = require("postcss-url");
21
21
  const node_url_1 = require("node:url");
22
- const tailwindcss_1 = require("../../../utilities/tailwindcss");
22
+ const tailwindcss_1 = require("../../../utilities/ng-packagr/tailwindcss");
23
23
  const postcss = require('postcss');
24
24
  var CssUrl;
25
25
  (function (CssUrl) {
@@ -215,14 +215,3 @@ function transformSupportedBrowsersToTargets(supportedBrowsers) {
215
215
  }
216
216
  return transformed.length ? transformed : undefined;
217
217
  }
218
- function customSassImporter(url, prev) {
219
- // NB: Sass importer should always be sync as otherwise it will cause
220
- // sass to go in the async path which is slower.
221
- if (url[0] !== '~') {
222
- return undefined;
223
- }
224
- return {
225
- file: url.slice(1),
226
- prev,
227
- };
228
- }
@@ -1,5 +1,5 @@
1
1
  import type { ExecutorContext } from '@nx/devkit';
2
- import { DependentBuildableProjectNode } from '@nx/js/src/utils/buildable-libs-utils';
2
+ import { type DependentBuildableProjectNode } from '@nx/js/src/utils/buildable-libs-utils';
3
3
  import type { NgPackagr } from 'ng-packagr';
4
4
  import type { BuildAngularLibraryExecutorOptions } from './schema';
5
5
  /**
@@ -7,26 +7,16 @@ const path_1 = require("path");
7
7
  const rxjs_1 = require("rxjs");
8
8
  const operators_1 = require("rxjs/operators");
9
9
  const typescript_1 = require("../utilities/typescript");
10
- const entry_point_di_1 = require("./ng-packagr-adjustments/ng-package/entry-point/entry-point.di");
11
- const options_di_1 = require("./ng-packagr-adjustments/ng-package/options.di");
12
- const package_di_1 = require("./ng-packagr-adjustments/ng-package/package.di");
10
+ const ng_packagr_1 = require("./ng-packagr-adjustments/ng-packagr");
13
11
  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);
12
+ const ngPackagr = await (0, ng_packagr_1.getNgPackagrInstance)(options);
13
+ ngPackagr.forProject((0, path_1.resolve)(context.root, options.project));
24
14
  if (options.tsConfig) {
25
15
  const remappedTsConfigFilePath = (0, buildable_libs_utils_1.createTmpTsConfig)(options.tsConfig, context.root, context.projectsConfigurations.projects[context.projectName].root, projectDependencies);
26
16
  const tsConfig = await (0, typescript_1.parseRemappedTsConfigAndMergeDefaults)(context.root, options.tsConfig, remappedTsConfigFilePath);
27
- packager.withTsConfig(tsConfig);
17
+ ngPackagr.withTsConfig(tsConfig);
28
18
  }
29
- return packager;
19
+ return ngPackagr;
30
20
  }
31
21
  /**
32
22
  * Creates an executor function that executes the library build of an Angular
@@ -35,9 +35,9 @@
35
35
  },
36
36
  "tailwindConfig": {
37
37
  "type": "string",
38
- "description": "The full path for the Tailwind configuration file, relative to the workspace root. If not provided and a `tailwind.config.js` file exists in the project or workspace root, it will be used. Otherwise, Tailwind will not be configured.",
38
+ "description": "The full path for the Tailwind configuration file, relative to the workspace root. If not provided and a `tailwind.config.js` file exists in the project or workspace root, it will be used. Otherwise, Tailwind will not be configured. _Note: starting with Angular v17, this option is no longer used and the configuration will be picked up if exists at the project or workspace root_.",
39
39
  "x-completion-type": "file",
40
- "x-completion-glob": "tailwind.config.js"
40
+ "x-completion-glob": "tailwind.config@(.js|.cjs|.mjs|.ts)"
41
41
  }
42
42
  },
43
43
  "additionalProperties": false,
@@ -1,6 +1,8 @@
1
1
  import type { Plugin } from 'esbuild';
2
+ import type { Connect } from 'vite';
2
3
  export type PluginSpec = {
3
4
  path: string;
4
5
  options: any;
5
6
  };
6
7
  export declare function loadPlugins(plugins: string[] | PluginSpec[] | undefined, tsConfig: string): Promise<Plugin[]>;
8
+ export declare function loadMiddleware(middlewareFns: string[] | undefined, tsConfig: string): Promise<Connect.NextHandleFunction[]>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadPlugins = void 0;
3
+ exports.loadMiddleware = exports.loadPlugins = void 0;
4
4
  const internal_1 = require("@nx/js/src/internal");
5
5
  const module_loader_1 = require("./module-loader");
6
6
  async function loadPlugins(plugins, tsConfig) {
@@ -25,3 +25,16 @@ async function loadPlugin(pluginSpec) {
25
25
  }
26
26
  return plugin;
27
27
  }
28
+ async function loadMiddleware(middlewareFns, tsConfig) {
29
+ if (!middlewareFns?.length) {
30
+ return [];
31
+ }
32
+ const cleanupTranspiler = (0, internal_1.registerTsProject)(tsConfig);
33
+ try {
34
+ return await Promise.all(middlewareFns.map((fnPath) => (0, module_loader_1.loadModule)(fnPath)));
35
+ }
36
+ finally {
37
+ cleanupTranspiler();
38
+ }
39
+ }
40
+ exports.loadMiddleware = loadMiddleware;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Adapted from the original ng-packagr source.
3
+ *
4
+ * Changes made:
5
+ * - Use our own function to get the TailwindCSS config path to support a
6
+ * config at the root of the workspace.
7
+ */
8
+ export declare enum CssUrl {
9
+ inline = "inline",
10
+ none = "none"
11
+ }
12
+ export declare class StylesheetProcessor {
13
+ private readonly projectBasePath;
14
+ private readonly basePath;
15
+ private readonly cssUrl?;
16
+ private readonly includePaths?;
17
+ private readonly cacheDirectory?;
18
+ private renderWorker;
19
+ constructor(projectBasePath: string, basePath: string, cssUrl?: CssUrl, includePaths?: string[], cacheDirectory?: string | false);
20
+ process({ filePath, content, }: {
21
+ filePath: string;
22
+ content: string;
23
+ }): Promise<string>;
24
+ /** Destory workers in pool. */
25
+ destroy(): void;
26
+ private createRenderWorker;
27
+ }
@@ -0,0 +1,2 @@
1
+ import { FactoryProvider } from 'injection-js';
2
+ export declare const STYLESHEET_PROCESSOR: FactoryProvider;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.STYLESHEET_PROCESSOR = void 0;
4
+ const stylesheet_processor_di_1 = require("ng-packagr/lib/styles/stylesheet-processor.di");
5
+ const stylesheet_processor_1 = require("./stylesheet-processor");
6
+ exports.STYLESHEET_PROCESSOR = {
7
+ provide: stylesheet_processor_di_1.STYLESHEET_PROCESSOR_TOKEN,
8
+ useFactory: () => stylesheet_processor_1.StylesheetProcessor,
9
+ deps: [],
10
+ };
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ /**
3
+ * Adapted from the original ng-packagr source.
4
+ *
5
+ * Changes made:
6
+ * - Use our own function to get the TailwindCSS config path to support a
7
+ * config at the root of the workspace.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.StylesheetProcessor = exports.CssUrl = void 0;
11
+ const browserslist = require("browserslist");
12
+ const fs_1 = require("fs");
13
+ const path_1 = require("path");
14
+ const Piscina = require('piscina');
15
+ const color_1 = require("ng-packagr/lib/utils/color");
16
+ // using this instead of the one from ng-packagr
17
+ const tailwindcss_1 = require("./tailwindcss");
18
+ const devkit_1 = require("@nx/devkit");
19
+ const maxWorkersVariable = process.env['NG_BUILD_MAX_WORKERS'];
20
+ const maxThreads = typeof maxWorkersVariable === 'string' && maxWorkersVariable !== ''
21
+ ? +maxWorkersVariable
22
+ : 4;
23
+ var CssUrl;
24
+ (function (CssUrl) {
25
+ CssUrl["inline"] = "inline";
26
+ CssUrl["none"] = "none";
27
+ })(CssUrl || (exports.CssUrl = CssUrl = {}));
28
+ class StylesheetProcessor {
29
+ constructor(projectBasePath, basePath, cssUrl, includePaths, cacheDirectory) {
30
+ this.projectBasePath = projectBasePath;
31
+ this.basePath = basePath;
32
+ this.cssUrl = cssUrl;
33
+ this.includePaths = includePaths;
34
+ this.cacheDirectory = cacheDirectory;
35
+ // By default, browserslist defaults are too inclusive
36
+ // https://github.com/browserslist/browserslist/blob/83764ea81ffaa39111c204b02c371afa44a4ff07/index.js#L516-L522
37
+ // We change the default query to browsers that Angular support.
38
+ // https://angular.io/guide/browser-support
39
+ browserslist.defaults = [
40
+ 'last 2 Chrome versions',
41
+ 'last 1 Firefox version',
42
+ 'last 2 Edge major versions',
43
+ 'last 2 Safari major versions',
44
+ 'last 2 iOS major versions',
45
+ 'Firefox ESR',
46
+ ];
47
+ }
48
+ async process({ filePath, content, }) {
49
+ this.createRenderWorker();
50
+ return this.renderWorker.run({ content, filePath });
51
+ }
52
+ /** Destory workers in pool. */
53
+ destroy() {
54
+ void this.renderWorker?.destroy();
55
+ }
56
+ createRenderWorker() {
57
+ if (this.renderWorker) {
58
+ return;
59
+ }
60
+ const styleIncludePaths = [...this.includePaths];
61
+ let prevDir = null;
62
+ let currentDir = this.basePath;
63
+ while (currentDir !== prevDir) {
64
+ const p = (0, path_1.join)(currentDir, 'node_modules');
65
+ if ((0, fs_1.existsSync)(p)) {
66
+ styleIncludePaths.push(p);
67
+ }
68
+ prevDir = currentDir;
69
+ currentDir = (0, path_1.dirname)(prevDir);
70
+ }
71
+ const browserslistData = browserslist(undefined, { path: this.basePath });
72
+ this.renderWorker = new Piscina({
73
+ filename: require.resolve('ng-packagr/lib/styles/stylesheet-processor-worker'),
74
+ maxThreads,
75
+ env: {
76
+ ...process.env,
77
+ FORCE_COLOR: '' + color_1.colors.enabled,
78
+ },
79
+ workerData: {
80
+ tailwindConfigPath: (0, tailwindcss_1.getTailwindConfigPath)(this.projectBasePath, devkit_1.workspaceRoot),
81
+ projectBasePath: this.projectBasePath,
82
+ browserslistData,
83
+ targets: transformSupportedBrowsersToTargets(browserslistData),
84
+ cacheDirectory: this.cacheDirectory,
85
+ cssUrl: this.cssUrl,
86
+ styleIncludePaths,
87
+ },
88
+ });
89
+ }
90
+ }
91
+ exports.StylesheetProcessor = StylesheetProcessor;
92
+ function transformSupportedBrowsersToTargets(supportedBrowsers) {
93
+ const transformed = [];
94
+ // https://esbuild.github.io/api/#target
95
+ const esBuildSupportedBrowsers = new Set([
96
+ 'safari',
97
+ 'firefox',
98
+ 'edge',
99
+ 'chrome',
100
+ 'ios',
101
+ ]);
102
+ for (const browser of supportedBrowsers) {
103
+ let [browserName, version] = browser.split(' ');
104
+ // browserslist uses the name `ios_saf` for iOS Safari whereas esbuild uses `ios`
105
+ if (browserName === 'ios_saf') {
106
+ browserName = 'ios';
107
+ }
108
+ // browserslist uses ranges `15.2-15.3` versions but only the lowest is required
109
+ // to perform minimum supported feature checks. esbuild also expects a single version.
110
+ [version] = version.split('-');
111
+ if (esBuildSupportedBrowsers.has(browserName)) {
112
+ if (browserName === 'safari' && version === 'tp') {
113
+ // esbuild only supports numeric versions so `TP` is converted to a high number (999) since
114
+ // a Technology Preview (TP) of Safari is assumed to support all currently known features.
115
+ version = '999';
116
+ }
117
+ transformed.push(browserName + version);
118
+ }
119
+ }
120
+ return transformed.length ? transformed : undefined;
121
+ }
@@ -4,4 +4,5 @@ export interface TailwindSetup {
4
4
  }
5
5
  export declare const tailwindDirectives: string[];
6
6
  export declare function getTailwindSetup(basePath: string, tailwindConfig?: string): TailwindSetup | undefined;
7
+ export declare function getTailwindConfigPath(projectRoot: string, workspaceRoot: string): string | undefined;
7
8
  export declare function getTailwindPostCssPlugins({ tailwindConfigPath, tailwindPackagePath }: TailwindSetup, includePaths?: string[], watch?: boolean): any[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getTailwindPostCssPlugins = exports.getTailwindSetup = exports.tailwindDirectives = void 0;
3
+ exports.getTailwindPostCssPlugins = exports.getTailwindConfigPath = exports.getTailwindSetup = exports.tailwindDirectives = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const devkit_2 = require("@nx/devkit");
6
6
  const fs_1 = require("fs");
@@ -58,6 +58,7 @@ function getTailwindConfigPath(projectRoot, workspaceRoot) {
58
58
  }
59
59
  return undefined;
60
60
  }
61
+ exports.getTailwindConfigPath = getTailwindConfigPath;
61
62
  function getTailwindPostCssPlugins({ tailwindConfigPath, tailwindPackagePath }, includePaths, watch) {
62
63
  if (process.env['TAILWIND_MODE'] === undefined) {
63
64
  process.env['TAILWIND_MODE'] = watch ? 'watch' : 'build';
@@ -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 | "off" | "readonly" | "readable" | "writable" | "writeable";
32
+ [name: string]: boolean | "readable" | "off" | "readonly" | "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 | "off" | "readonly" | "readable" | "writable" | "writeable";
64
+ [name: string]: boolean | "readable" | "off" | "readonly" | "writable" | "writeable";
65
65
  };
66
66
  noInlineConfig?: boolean;
67
67
  parser?: string;
@@ -1,3 +1,3 @@
1
- import type { Tree } from '@nx/devkit';
1
+ import { Tree } from '@nx/devkit';
2
2
  import type { NormalizedSchema } from './normalized-schema';
3
3
  export declare function createProject(tree: Tree, options: NormalizedSchema): void;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createProject = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const version_utils_1 = require("../../utils/version-utils");
6
+ const add_build_target_defaults_1 = require("@nx/devkit/src/generators/add-build-target-defaults");
6
7
  function createProject(tree, options) {
7
8
  const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
8
9
  const buildExecutor = options.bundler === 'webpack'
@@ -14,6 +15,7 @@ function createProject(tree, options) {
14
15
  const buildMainOptionName = angularMajorVersion >= 17 && options.bundler === 'esbuild'
15
16
  ? 'browser'
16
17
  : 'main';
18
+ (0, add_build_target_defaults_1.addBuildTargetDefaults)(tree, buildExecutor);
17
19
  let budgets = undefined;
18
20
  if (options.bundler === 'webpack' || angularMajorVersion >= 17) {
19
21
  if (options.strict) {
@@ -25,7 +25,7 @@ function installAngularDevkitCoreIfMissing(tree, options) {
25
25
  // @schematics/angular cannot be required so this fails but this will still allow wrapping the schematic later on
26
26
  }
27
27
  if (!options.skipPackageJson) {
28
- return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { ['@angular-devkit/core']: devkitVersion });
28
+ return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { ['@angular-devkit/core']: devkitVersion }, undefined, options.keepExistingVersions);
29
29
  }
30
30
  }
31
31
  return () => { };
@@ -2,4 +2,5 @@ export interface Schema {
2
2
  skipFormat?: boolean;
3
3
  skipInstall?: boolean;
4
4
  skipPackageJson?: boolean;
5
+ keepExistingVersions?: boolean;
5
6
  }
@@ -23,7 +23,12 @@
23
23
  "default": false,
24
24
  "description": "Do not add dependencies to `package.json`.",
25
25
  "x-priority": "internal"
26
+ },
27
+ "keepExistingVersions": {
28
+ "type": "boolean",
29
+ "x-priority": "internal",
30
+ "description": "Keep existing dependencies versions",
31
+ "default": false
26
32
  }
27
- },
28
- "additionalProperties": false
33
+ }
29
34
  }
@@ -52,3 +52,5 @@ function run(): void {
52
52
  console.log(`Node Express server listening on http://localhost:${port}`);
53
53
  });
54
54
  }
55
+
56
+ run();
@@ -8,7 +8,7 @@ const component_info_1 = require("../utils/storybook-ast/component-info");
8
8
  const entry_point_1 = require("../utils/storybook-ast/entry-point");
9
9
  const get_e2e_project_1 = require("./lib/get-e2e-project");
10
10
  const module_info_1 = require("../utils/storybook-ast/module-info");
11
- const minimatch = require("minimatch");
11
+ const minimatch_1 = require("minimatch");
12
12
  const versions_1 = require("../../utils/versions");
13
13
  async function angularStoriesGenerator(tree, options) {
14
14
  const e2eProjectName = options.cypressProject ?? `${options.name}-e2e`;
@@ -23,7 +23,7 @@ async function angularStoriesGenerator(tree, options) {
23
23
  devkit_1.logger.info(`There was no e2e project "${e2eProjectName}" found, so cypress specs will not be generated. Pass "--cypressProject" to specify a different e2e project name.`);
24
24
  }
25
25
  const componentInfos = componentsInfo.filter((f) => !options.ignorePaths?.some((pattern) => {
26
- const shouldIgnorePath = minimatch((0, devkit_1.joinPathFragments)(f.moduleFolderPath, f.path, `${f.componentFileName}.ts`), pattern);
26
+ const shouldIgnorePath = (0, minimatch_1.minimatch)((0, devkit_1.joinPathFragments)(f.moduleFolderPath, f.path, `${f.componentFileName}.ts`), pattern);
27
27
  return shouldIgnorePath;
28
28
  }));
29
29
  for (const info of componentInfos) {