@nx/nuxt 23.0.0-pr.35413.460eeef → 23.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/{index.d.ts → dist/index.d.ts} +0 -1
  2. package/{plugin.d.ts → dist/plugin.d.ts} +0 -1
  3. package/{src → dist/src}/generators/application/application.d.ts +0 -1
  4. package/{src → dist/src}/generators/application/application.js +10 -9
  5. package/{src → dist/src}/generators/application/lib/add-e2e.d.ts +0 -1
  6. package/{src → dist/src}/generators/application/lib/add-e2e.js +5 -5
  7. package/{src → dist/src}/generators/application/lib/add-vitest.d.ts +0 -1
  8. package/{src → dist/src}/generators/application/lib/add-vitest.js +1 -34
  9. package/{src → dist/src}/generators/application/lib/ensure-dependencies.d.ts +0 -1
  10. package/{src → dist/src}/generators/application/lib/ensure-dependencies.js +2 -4
  11. package/{src → dist/src}/generators/application/lib/normalize-options.d.ts +0 -1
  12. package/{src → dist/src}/generators/application/lib/normalize-options.js +5 -5
  13. package/{src → dist/src}/generators/application/schema.d.ts +1 -1
  14. package/{src → dist/src}/generators/application/schema.json +2 -5
  15. package/{src → dist/src}/generators/init/init.d.ts +0 -1
  16. package/{src → dist/src}/generators/init/init.js +4 -2
  17. package/{src → dist/src}/generators/init/lib/utils.d.ts +0 -1
  18. package/{src → dist/src}/generators/init/lib/utils.js +1 -1
  19. package/{src → dist/src}/generators/init/schema.json +1 -1
  20. package/{src → dist/src}/generators/storybook-configuration/configuration.d.ts +0 -1
  21. package/{src → dist/src}/generators/storybook-configuration/configuration.js +2 -0
  22. package/dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes.d.ts +9 -0
  23. package/dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes.js +223 -0
  24. package/dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes.md +25 -0
  25. package/{src → dist/src}/plugins/plugin.d.ts +3 -4
  26. package/{src → dist/src}/plugins/plugin.js +67 -33
  27. package/{src → dist/src}/utils/add-linting.d.ts +0 -1
  28. package/{src → dist/src}/utils/add-linting.js +12 -13
  29. package/dist/src/utils/assert-supported-nuxt-version.d.ts +2 -0
  30. package/dist/src/utils/assert-supported-nuxt-version.js +8 -0
  31. package/{src → dist/src}/utils/create-ts-config.d.ts +0 -1
  32. package/{src → dist/src}/utils/create-ts-config.js +1 -1
  33. package/{src → dist/src}/utils/executor-utils.d.ts +0 -1
  34. package/{src → dist/src}/utils/update-gitignore.d.ts +0 -1
  35. package/{src → dist/src}/utils/version-utils.d.ts +1 -1
  36. package/{src → dist/src}/utils/version-utils.js +2 -0
  37. package/{src → dist/src}/utils/versions.d.ts +4 -1
  38. package/{src → dist/src}/utils/versions.js +13 -2
  39. package/generators.json +6 -6
  40. package/migrations.json +10 -1
  41. package/package.json +49 -22
  42. package/index.d.ts.map +0 -1
  43. package/plugin.d.ts.map +0 -1
  44. package/src/generators/application/application.d.ts.map +0 -1
  45. package/src/generators/application/lib/add-e2e.d.ts.map +0 -1
  46. package/src/generators/application/lib/add-vitest.d.ts.map +0 -1
  47. package/src/generators/application/lib/ensure-dependencies.d.ts.map +0 -1
  48. package/src/generators/application/lib/normalize-options.d.ts.map +0 -1
  49. package/src/generators/init/init.d.ts.map +0 -1
  50. package/src/generators/init/lib/utils.d.ts.map +0 -1
  51. package/src/generators/storybook-configuration/configuration.d.ts.map +0 -1
  52. package/src/migrations/update-18-1-0/add-include-tsconfig.d.ts +0 -3
  53. package/src/migrations/update-18-1-0/add-include-tsconfig.d.ts.map +0 -1
  54. package/src/migrations/update-18-1-0/add-include-tsconfig.js +0 -48
  55. package/src/migrations/update-22-2-0/create-ai-instructions-for-nuxt-4.d.ts +0 -3
  56. package/src/migrations/update-22-2-0/create-ai-instructions-for-nuxt-4.d.ts.map +0 -1
  57. package/src/migrations/update-22-2-0/create-ai-instructions-for-nuxt-4.js +0 -16
  58. package/src/plugins/plugin.d.ts.map +0 -1
  59. package/src/utils/add-linting.d.ts.map +0 -1
  60. package/src/utils/create-ts-config.d.ts.map +0 -1
  61. package/src/utils/executor-utils.d.ts.map +0 -1
  62. package/src/utils/update-gitignore.d.ts.map +0 -1
  63. package/src/utils/version-utils.d.ts.map +0 -1
  64. package/src/utils/versions.d.ts.map +0 -1
  65. /package/{LICENSE → dist/LICENSE} +0 -0
  66. /package/{index.js → dist/index.js} +0 -0
  67. /package/{plugin.js → dist/plugin.js} +0 -0
  68. /package/{src → dist/src}/generators/application/files/app-dir/__dot__npmrc +0 -0
  69. /package/{src → dist/src}/generators/application/files/app-dir/app/app.vue__tmpl__ +0 -0
  70. /package/{src → dist/src}/generators/application/files/app-dir/app/assets/css/styles.__style__ +0 -0
  71. /package/{src → dist/src}/generators/application/files/app-dir/app/pages/about.vue__tmpl__ +0 -0
  72. /package/{src → dist/src}/generators/application/files/app-dir/app/pages/index.vue__tmpl__ +0 -0
  73. /package/{src → dist/src}/generators/application/files/app-dir/nuxt.config.ts__tmpl__ +0 -0
  74. /package/{src → dist/src}/generators/application/files/app-dir/public/__dot__gitkeep +0 -0
  75. /package/{src → dist/src}/generators/application/files/app-dir/public/favicon.ico__tmpl__ +0 -0
  76. /package/{src → dist/src}/generators/application/files/app-dir/server/api/greet.ts__tmpl__ +0 -0
  77. /package/{src → dist/src}/generators/application/files/app-dir/server/tsconfig.json__tmpl__ +0 -0
  78. /package/{src → dist/src}/generators/application/files/base/__dot__npmrc +0 -0
  79. /package/{src → dist/src}/generators/application/files/base/nuxt.config.ts__tmpl__ +0 -0
  80. /package/{src → dist/src}/generators/application/files/base/src/app.vue__tmpl__ +0 -0
  81. /package/{src → dist/src}/generators/application/files/base/src/assets/css/styles.__style__ +0 -0
  82. /package/{src → dist/src}/generators/application/files/base/src/pages/about.vue__tmpl__ +0 -0
  83. /package/{src → dist/src}/generators/application/files/base/src/pages/index.vue__tmpl__ +0 -0
  84. /package/{src → dist/src}/generators/application/files/base/src/public/__dot__gitkeep +0 -0
  85. /package/{src → dist/src}/generators/application/files/base/src/public/favicon.ico__tmpl__ +0 -0
  86. /package/{src → dist/src}/generators/application/files/base/src/server/api/greet.ts__tmpl__ +0 -0
  87. /package/{src → dist/src}/generators/application/files/base/src/server/tsconfig.json__tmpl__ +0 -0
  88. /package/{src → dist/src}/generators/application/files/nx-welcome/claimed/src/components/NxWelcome.vue__tmpl__ +0 -0
  89. /package/{src → dist/src}/generators/application/files/nx-welcome/not-configured/src/components/NxWelcome.vue__tmpl__ +0 -0
  90. /package/{src → dist/src}/generators/application/files/nx-welcome/unclaimed/src/components/NxWelcome.vue__tmpl__ +0 -0
  91. /package/{src → dist/src}/generators/application/files/nx-welcome-app-dir/claimed/app/components/NxWelcome.vue__tmpl__ +0 -0
  92. /package/{src → dist/src}/generators/application/files/nx-welcome-app-dir/not-configured/app/components/NxWelcome.vue__tmpl__ +0 -0
  93. /package/{src → dist/src}/generators/application/files/nx-welcome-app-dir/unclaimed/app/components/NxWelcome.vue__tmpl__ +0 -0
  94. /package/{src → dist/src}/generators/init/schema.d.ts +0 -0
  95. /package/{src → dist/src}/generators/storybook-configuration/schema.d.ts +0 -0
  96. /package/{src → dist/src}/generators/storybook-configuration/schema.json +0 -0
  97. /package/{src/migrations/update-22-2-0/files → dist/src/migrations/update-22-2-0}/ai-instructions-for-nuxt-4.md +0 -0
  98. /package/{src → dist/src}/utils/executor-utils.js +0 -0
  99. /package/{src → dist/src}/utils/update-gitignore.js +0 -0
@@ -3,4 +3,3 @@ export { applicationGenerator } from './src/generators/application/application';
3
3
  export { type InitSchema } from './src/generators/init/schema';
4
4
  export { nuxtInitGenerator } from './src/generators/init/init';
5
5
  export { storybookConfigurationGenerator } from './src/generators/storybook-configuration/configuration';
6
- //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1 @@
1
1
  export { createNodes, createNodesV2, NuxtPluginOptions, } from './src/plugins/plugin';
2
- //# sourceMappingURL=plugin.d.ts.map
@@ -3,4 +3,3 @@ import { Schema } from './schema';
3
3
  export declare function applicationGenerator(tree: Tree, schema: Schema): Promise<GeneratorCallback>;
4
4
  export declare function applicationGeneratorInternal(tree: Tree, schema: Schema): Promise<GeneratorCallback>;
5
5
  export default applicationGenerator;
6
- //# sourceMappingURL=application.d.ts.map
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.applicationGenerator = applicationGenerator;
4
4
  exports.applicationGeneratorInternal = applicationGeneratorInternal;
5
5
  const tslib_1 = require("tslib");
6
+ const internal_1 = require("@nx/devkit/internal");
6
7
  const devkit_1 = require("@nx/devkit");
7
8
  const init_1 = tslib_1.__importDefault(require("../init/init"));
8
9
  const normalize_options_1 = require("./lib/normalize-options");
@@ -14,12 +15,11 @@ const add_linting_1 = require("../../utils/add-linting");
14
15
  const add_vitest_1 = require("./lib/add-vitest");
15
16
  const vue_1 = require("@nx/vue");
16
17
  const ensure_dependencies_1 = require("./lib/ensure-dependencies");
17
- const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
18
+ const assert_supported_nuxt_version_1 = require("../../utils/assert-supported-nuxt-version");
18
19
  const node_child_process_1 = require("node:child_process");
19
20
  const node_path_1 = require("node:path");
20
21
  const onboarding_1 = require("nx/src/nx-cloud/utilities/onboarding");
21
- const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
22
- const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
22
+ const internal_2 = require("@nx/js/internal");
23
23
  async function applicationGenerator(tree, schema) {
24
24
  return await applicationGeneratorInternal(tree, {
25
25
  useProjectJson: true,
@@ -27,8 +27,9 @@ async function applicationGenerator(tree, schema) {
27
27
  });
28
28
  }
29
29
  async function applicationGeneratorInternal(tree, schema) {
30
+ (0, assert_supported_nuxt_version_1.assertSupportedNuxtVersion)(tree);
30
31
  const tasks = [];
31
- const addTsPlugin = (0, ts_solution_setup_1.shouldConfigureTsSolutionSetup)(tree, true, // nuxt always adds plugins
32
+ const addTsPlugin = (0, internal_2.shouldConfigureTsSolutionSetup)(tree, true, // nuxt always adds plugins
32
33
  schema.useTsSolution);
33
34
  const jsInitTask = await (0, js_1.initGenerator)(tree, {
34
35
  ...schema,
@@ -113,7 +114,7 @@ async function applicationGeneratorInternal(tree, schema) {
113
114
  // If we are using the new TS solution
114
115
  // We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
115
116
  if (options.isUsingTsSolutionConfig) {
116
- await (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.appProjectRoot);
117
+ await (0, internal_2.addProjectToTsSolutionWorkspace)(tree, options.appProjectRoot);
117
118
  }
118
119
  tasks.push(await (0, add_linting_1.addLinting)(tree, {
119
120
  projectName: options.projectName,
@@ -126,7 +127,7 @@ async function applicationGeneratorInternal(tree, schema) {
126
127
  tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
127
128
  '@vue/test-utils': vue_1.vueTestUtilsVersion,
128
129
  '@vitejs/plugin-vue': vue_1.vitePluginVueVersion,
129
- }));
130
+ }, undefined, true));
130
131
  tasks.push(await (0, add_vitest_1.addVitest)(tree, options));
131
132
  }
132
133
  const nuxtInitTask = await (0, init_1.default)(tree, {
@@ -138,7 +139,7 @@ async function applicationGeneratorInternal(tree, schema) {
138
139
  if (options.js)
139
140
  (0, devkit_1.toJS)(tree);
140
141
  if (options.isUsingTsSolutionConfig) {
141
- (0, ts_solution_setup_1.updateTsconfigFiles)(tree, options.appProjectRoot, 'tsconfig.app.json', {
142
+ (0, internal_2.updateTsconfigFiles)(tree, options.appProjectRoot, 'tsconfig.app.json', {
142
143
  jsx: 'preserve',
143
144
  jsxImportSource: 'vue',
144
145
  module: 'esnext',
@@ -148,7 +149,7 @@ async function applicationGeneratorInternal(tree, schema) {
148
149
  ? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
149
150
  : undefined);
150
151
  }
151
- (0, sort_fields_1.sortPackageJsonFields)(tree, options.appProjectRoot);
152
+ (0, internal_2.sortPackageJsonFields)(tree, options.appProjectRoot);
152
153
  if (!options.skipFormat)
153
154
  await (0, devkit_1.formatFiles)(tree);
154
155
  tasks.push(() => {
@@ -163,7 +164,7 @@ async function applicationGeneratorInternal(tree, schema) {
163
164
  }
164
165
  });
165
166
  tasks.push(() => {
166
- (0, log_show_project_command_1.logShowProjectCommand)(options.projectName);
167
+ (0, internal_1.logShowProjectCommand)(options.projectName);
167
168
  });
168
169
  return (0, devkit_1.runTasksInSerial)(...tasks);
169
170
  }
@@ -1,4 +1,3 @@
1
1
  import { GeneratorCallback, Tree } from '@nx/devkit';
2
2
  import { NormalizedSchema } from '../schema';
3
3
  export declare function addE2e(host: Tree, options: NormalizedSchema): Promise<GeneratorCallback>;
4
- //# sourceMappingURL=add-e2e.d.ts.map
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addE2e = addE2e;
4
+ const internal_1 = require("@nx/devkit/internal");
4
5
  const devkit_1 = require("@nx/devkit");
5
- const e2e_web_server_info_utils_1 = require("@nx/devkit/src/generators/e2e-web-server-info-utils");
6
6
  const versions_1 = require("../../../utils/versions");
7
7
  async function addE2e(host, options) {
8
8
  const e2eWebServerInfo = await getNuxtE2EWebServerInfo(host, options.projectName, (0, devkit_1.joinPathFragments)(options.appProjectRoot, `nuxt.config.${options.js ? 'js' : 'ts'}`));
@@ -92,11 +92,11 @@ async function addE2e(host, options) {
92
92
  async function getNuxtE2EWebServerInfo(tree, projectName, configFilePath) {
93
93
  const nxJson = (0, devkit_1.readNxJson)(tree);
94
94
  let e2ePort = 4200;
95
- if (nxJson.targetDefaults?.['serve'] &&
96
- nxJson.targetDefaults?.['serve'].options?.port) {
97
- e2ePort = nxJson.targetDefaults?.['serve'].options?.port;
95
+ const serveTargetOptions = (0, internal_1.readTargetDefaultsForTarget)('serve', nxJson.targetDefaults)?.options;
96
+ if (serveTargetOptions?.port) {
97
+ e2ePort = serveTargetOptions.port;
98
98
  }
99
- return (0, e2e_web_server_info_utils_1.getE2EWebServerInfo)(tree, projectName, {
99
+ return (0, internal_1.getE2EWebServerInfo)(tree, projectName, {
100
100
  plugin: '@nx/nuxt/plugin',
101
101
  serveTargetName: 'serveTargetName',
102
102
  serveStaticTargetName: 'serveStaticTargetName',
@@ -1,4 +1,3 @@
1
1
  import { Tree } from '@nx/devkit';
2
2
  import { NormalizedSchema } from '../schema';
3
3
  export declare function addVitest(tree: Tree, options: NormalizedSchema): Promise<import("@nx/devkit").GeneratorCallback>;
4
- //# sourceMappingURL=add-vitest.d.ts.map
@@ -1,37 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
3
  exports.addVitest = addVitest;
37
4
  const devkit_1 = require("@nx/devkit");
@@ -45,7 +12,7 @@ async function addVitest(tree, options) {
45
12
  : p.plugin === '@nx/nuxt/plugin');
46
13
  const { createOrEditViteConfig } = (0, devkit_1.ensurePackage)('@nx/vite', versions_1.nxVersion);
47
14
  (0, devkit_1.ensurePackage)('@nx/vitest', versions_1.nxVersion);
48
- const { configurationGenerator } = await Promise.resolve().then(() => __importStar(require('@nx/vitest/generators')));
15
+ const { configurationGenerator, } = require('@nx/vitest/generators');
49
16
  const vitestTask = await configurationGenerator(tree, {
50
17
  project: options.projectName,
51
18
  uiFramework: 'none',
@@ -1,4 +1,3 @@
1
1
  import { type Tree } from '@nx/devkit';
2
2
  import type { NormalizedSchema } from '../schema';
3
3
  export declare function ensureDependencies(host: Tree, options: NormalizedSchema): Promise<import("@nx/devkit").GeneratorCallback>;
4
- //# sourceMappingURL=ensure-dependencies.d.ts.map
@@ -11,6 +11,7 @@ async function ensureDependencies(host, options) {
11
11
  '@nx/vite': versions_1.nxVersion, // needed for the nxViteTsPaths plugin and @nx/vite/plugin
12
12
  '@nuxt/devtools': nuxtVersions.nuxtDevtools,
13
13
  '@nuxt/kit': nuxtVersions.nuxtKit,
14
+ '@nuxt/schema': nuxtVersions.nuxtSchema,
14
15
  '@nuxt/ui-templates': nuxtVersions.nuxtUiTemplates,
15
16
  nuxt: nuxtVersions.nuxt,
16
17
  h3: nuxtVersions.h3,
@@ -21,8 +22,5 @@ async function ensureDependencies(host, options) {
21
22
  if (options.style === 'scss') {
22
23
  devDependencies['sass'] = vue_1.sassVersion;
23
24
  }
24
- else if (options.style === 'less') {
25
- devDependencies['less'] = vue_1.lessVersion;
26
- }
27
- return (0, devkit_1.addDependenciesToPackageJson)(host, {}, devDependencies);
25
+ return (0, devkit_1.addDependenciesToPackageJson)(host, {}, devDependencies, undefined, true);
28
26
  }
@@ -1,4 +1,3 @@
1
1
  import { Tree } from '@nx/devkit';
2
2
  import { NormalizedSchema, Schema } from '../schema';
3
3
  export declare function normalizeOptions(host: Tree, options: Schema): Promise<NormalizedSchema>;
4
- //# sourceMappingURL=normalize-options.d.ts.map
@@ -1,19 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizeOptions = normalizeOptions;
4
- const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
5
- const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
4
+ const internal_1 = require("@nx/devkit/internal");
5
+ const internal_2 = require("@nx/js/internal");
6
6
  const version_utils_1 = require("../../../utils/version-utils");
7
7
  async function normalizeOptions(host, options) {
8
- await (0, project_name_and_root_utils_1.ensureRootProjectName)(options, 'application');
9
- const { projectName, names: projectNames, projectRoot: appProjectRoot, importPath, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
8
+ await (0, internal_1.ensureRootProjectName)(options, 'application');
9
+ const { projectName, names: projectNames, projectRoot: appProjectRoot, importPath, } = await (0, internal_1.determineProjectNameAndRootOptions)(host, {
10
10
  name: options.name,
11
11
  projectType: 'application',
12
12
  directory: options.directory,
13
13
  rootProject: options.rootProject,
14
14
  });
15
15
  options.rootProject = appProjectRoot === '.';
16
- const isUsingTsSolutionConfig = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host);
16
+ const isUsingTsSolutionConfig = (0, internal_2.isUsingTsSolutionSetup)(host);
17
17
  const appProjectName = !isUsingTsSolutionConfig || options.name ? projectName : importPath;
18
18
  const e2eProjectName = options.rootProject ? 'e2e' : `${appProjectName}-e2e`;
19
19
  const e2eProjectRoot = options.rootProject ? 'e2e' : `${appProjectRoot}-e2e`;
@@ -13,7 +13,7 @@ export interface Schema {
13
13
  skipPackageJson?: boolean;
14
14
  rootProject?: boolean;
15
15
  setParserOptionsProject?: boolean;
16
- style?: 'css' | 'scss' | 'less' | 'none';
16
+ style?: 'css' | 'scss' | 'none';
17
17
  nxCloudToken?: string;
18
18
  useTsSolution?: boolean;
19
19
  useProjectJson?: boolean;
@@ -79,6 +79,7 @@
79
79
  "type": "string",
80
80
  "alias": "s",
81
81
  "default": "css",
82
+ "enum": ["css", "scss", "none"],
82
83
  "x-prompt": {
83
84
  "message": "Which stylesheet format would you like to use?",
84
85
  "type": "list",
@@ -89,11 +90,7 @@
89
90
  },
90
91
  {
91
92
  "value": "scss",
92
- "label": "SASS(.scss) [ https://sass-lang.com ]"
93
- },
94
- {
95
- "value": "less",
96
- "label": "LESS [ https://lesscss.org ]"
93
+ "label": "SASS(.scss) [ https://sass-lang.com ]"
97
94
  },
98
95
  {
99
96
  "value": "none",
@@ -2,4 +2,3 @@ import { GeneratorCallback, Tree } from '@nx/devkit';
2
2
  import { InitSchema } from './schema';
3
3
  export declare function nuxtInitGenerator(host: Tree, schema: InitSchema): Promise<GeneratorCallback>;
4
4
  export default nuxtInitGenerator;
5
- //# sourceMappingURL=init.d.ts.map
@@ -2,11 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.nuxtInitGenerator = nuxtInitGenerator;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
5
+ const internal_1 = require("@nx/devkit/internal");
6
6
  const plugin_1 = require("../../plugins/plugin");
7
7
  const utils_1 = require("./lib/utils");
8
+ const assert_supported_nuxt_version_1 = require("../../utils/assert-supported-nuxt-version");
8
9
  async function nuxtInitGenerator(host, schema) {
9
- await (0, add_plugin_1.addPlugin)(host, await (0, devkit_1.createProjectGraphAsync)(), '@nx/nuxt/plugin', plugin_1.createNodesV2, {
10
+ (0, assert_supported_nuxt_version_1.assertSupportedNuxtVersion)(host);
11
+ await (0, internal_1.addPlugin)(host, await (0, devkit_1.createProjectGraphAsync)(), '@nx/nuxt/plugin', plugin_1.createNodesV2, {
10
12
  buildTargetName: ['build', 'nuxt:build', 'nuxt-build'],
11
13
  serveTargetName: ['serve', 'nuxt:serve', 'nuxt-serve'],
12
14
  buildDepsTargetName: ['build-deps', 'nuxt:build-deps', 'nuxt-build-deps'],
@@ -3,4 +3,3 @@ import { InitSchema } from '../schema';
3
3
  export declare function updateDependencies(host: Tree, schema: InitSchema): Promise<import("@nx/devkit").GeneratorCallback>;
4
4
  export declare function addVitestTargetDefaults(tree: Tree): void;
5
5
  export declare function addPlugin(tree: Tree): void;
6
- //# sourceMappingURL=utils.d.ts.map
@@ -12,7 +12,7 @@ async function updateDependencies(host, schema) {
12
12
  '@nx/nuxt': versions_1.nxVersion,
13
13
  nuxt: nuxtVersions.nuxt,
14
14
  '@nx/vite': versions_1.nxVersion,
15
- }, undefined, schema.keepExistingVersions);
15
+ }, undefined, schema.keepExistingVersions ?? true);
16
16
  }
17
17
  function addVitestTargetDefaults(tree) {
18
18
  const nxJson = (0, devkit_1.readNxJson)(tree);
@@ -20,7 +20,7 @@
20
20
  "type": "boolean",
21
21
  "x-priority": "internal",
22
22
  "description": "Keep existing dependencies versions",
23
- "default": false
23
+ "default": true
24
24
  },
25
25
  "updatePackageScripts": {
26
26
  "type": "boolean",
@@ -2,4 +2,3 @@ import { Tree } from '@nx/devkit';
2
2
  import { Schema } from './schema';
3
3
  export declare function storybookConfigurationGenerator(tree: Tree, options: Schema): Promise<import("@nx/devkit").GeneratorCallback>;
4
4
  export default storybookConfigurationGenerator;
5
- //# sourceMappingURL=configuration.d.ts.map
@@ -3,11 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.storybookConfigurationGenerator = storybookConfigurationGenerator;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const vue_1 = require("@nx/vue");
6
+ const assert_supported_nuxt_version_1 = require("../../utils/assert-supported-nuxt-version");
6
7
  /*
7
8
  * This generator is basically the Vue one, but for Nuxt we
8
9
  * are just adding the styles in `.storybook/preview.ts`
9
10
  */
10
11
  async function storybookConfigurationGenerator(tree, options) {
12
+ (0, assert_supported_nuxt_version_1.assertSupportedNuxtVersion)(tree);
11
13
  const { root, sourceRoot } = (0, devkit_1.readProjectConfiguration)(tree, options.project);
12
14
  // Determine the source directory (app/ for Nuxt v4, src/ for Nuxt v3)
13
15
  const sourceDir = sourceRoot?.endsWith('/app')
@@ -0,0 +1,9 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ export default function migrateCreateNodesV2ToCreateNodes(tree: Tree): Promise<void>;
3
+ /**
4
+ * Rewrites named imports and re-exports of `createNodesV2` to `createNodes`
5
+ * when they come from one of the given module specifiers. Only the named
6
+ * bindings are touched — the module specifier, the `import`/`export` keyword,
7
+ * any `type` modifier, and any default import are left untouched.
8
+ */
9
+ export declare function rewriteCreateNodesV2Imports(source: string, specifiers: ReadonlySet<string>): string;
@@ -0,0 +1,223 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = migrateCreateNodesV2ToCreateNodes;
4
+ exports.rewriteCreateNodesV2Imports = rewriteCreateNodesV2Imports;
5
+ const devkit_1 = require("@nx/devkit");
6
+ const TS_EXTENSIONS = ['.ts', '.tsx', '.cts', '.mts'];
7
+ const DEPRECATED_NAME = 'createNodesV2';
8
+ const CANONICAL_NAME = 'createNodes';
9
+ // Module specifiers from which `@nx/nuxt` publicly exposes `createNodesV2`.
10
+ // A named import or re-export of `createNodesV2` from one of these is rewritten
11
+ // to the canonical `createNodes` export.
12
+ const TARGET_SPECIFIERS = new Set(['@nx/nuxt/plugin']);
13
+ let ts;
14
+ async function migrateCreateNodesV2ToCreateNodes(tree) {
15
+ let touchedCount = 0;
16
+ (0, devkit_1.visitNotIgnoredFiles)(tree, '.', (filePath) => {
17
+ if (!TS_EXTENSIONS.some((ext) => filePath.endsWith(ext))) {
18
+ return;
19
+ }
20
+ const original = tree.read(filePath, 'utf-8');
21
+ if (!original || !original.includes(DEPRECATED_NAME)) {
22
+ return;
23
+ }
24
+ const updated = rewriteCreateNodesV2Imports(original, TARGET_SPECIFIERS);
25
+ if (updated !== original) {
26
+ tree.write(filePath, updated);
27
+ touchedCount += 1;
28
+ }
29
+ });
30
+ if (touchedCount > 0) {
31
+ devkit_1.logger.info(`Renamed \`${DEPRECATED_NAME}\` imports to \`${CANONICAL_NAME}\` in ${touchedCount} file(s).`);
32
+ }
33
+ await (0, devkit_1.formatFiles)(tree);
34
+ }
35
+ /**
36
+ * Rewrites named imports and re-exports of `createNodesV2` to `createNodes`
37
+ * when they come from one of the given module specifiers. Only the named
38
+ * bindings are touched — the module specifier, the `import`/`export` keyword,
39
+ * any `type` modifier, and any default import are left untouched.
40
+ */
41
+ function rewriteCreateNodesV2Imports(source, specifiers) {
42
+ ts ??= (0, devkit_1.ensurePackage)('typescript', '*');
43
+ const sourceFile = ts.createSourceFile('tmp.ts', source, ts.ScriptTarget.Latest,
44
+ /* setParentNodes */ true, ts.ScriptKind.TSX);
45
+ const changes = [];
46
+ let renameLocalUsages = false;
47
+ for (const stmt of sourceFile.statements) {
48
+ if (ts.isImportDeclaration(stmt)) {
49
+ renameLocalUsages =
50
+ collectImportRewrite(sourceFile, stmt, specifiers, changes) ||
51
+ renameLocalUsages;
52
+ }
53
+ else if (ts.isExportDeclaration(stmt)) {
54
+ collectExportRewrite(sourceFile, stmt, specifiers, changes);
55
+ }
56
+ }
57
+ // Renaming a local `createNodesV2` import binding to `createNodes` (a lone
58
+ // `{ createNodesV2 }`, or one deduped against an existing `createNodes`)
59
+ // changes the name in scope, so value references to `createNodesV2` in the
60
+ // file body must be renamed too — otherwise they dangle. Aliased imports and
61
+ // re-exports keep their local name, so they never trigger this.
62
+ if (renameLocalUsages) {
63
+ collectValueUsageRewrites(sourceFile, changes);
64
+ }
65
+ return changes.length > 0 ? (0, devkit_1.applyChangesToString)(source, changes) : source;
66
+ }
67
+ function isTargetSpecifier(node, specifiers) {
68
+ return ts.isStringLiteral(node) && specifiers.has(node.text);
69
+ }
70
+ function collectImportRewrite(sourceFile, stmt, specifiers, changes) {
71
+ if (!isTargetSpecifier(stmt.moduleSpecifier, specifiers)) {
72
+ return false;
73
+ }
74
+ const namedBindings = stmt.importClause?.namedBindings;
75
+ // Only `import { ... }` carries renameable named bindings. `import x`,
76
+ // `import * as ns`, and side-effect imports reference the module wholesale
77
+ // and keep working through the `createNodesV2` runtime alias, so we leave
78
+ // them be. A mixed `import def, { createNodesV2 }` still has its named
79
+ // bindings rewritten below — the default binding is untouched.
80
+ if (!namedBindings || !ts.isNamedImports(namedBindings)) {
81
+ return false;
82
+ }
83
+ // The local `createNodesV2` binding only disappears when it is imported
84
+ // without an alias — a lone `{ createNodesV2 }` or one deduped against an
85
+ // existing `createNodes`. `{ createNodesV2 as x }` keeps the local `x`, so
86
+ // its in-file usages are unaffected and must not be rewritten.
87
+ const localBindingRenamed = namedBindings.elements.some((el) => el.name.text === DEPRECATED_NAME &&
88
+ (el.propertyName ?? el.name).text === DEPRECATED_NAME);
89
+ rewriteNamedBindings(sourceFile, namedBindings, changes);
90
+ return localBindingRenamed;
91
+ }
92
+ function collectExportRewrite(sourceFile, stmt, specifiers, changes) {
93
+ if (!stmt.moduleSpecifier ||
94
+ !isTargetSpecifier(stmt.moduleSpecifier, specifiers)) {
95
+ return;
96
+ }
97
+ // `export { ... } from '...'` can be rewritten; `export * from '...'` has no
98
+ // named bindings to rename.
99
+ if (!stmt.exportClause || !ts.isNamedExports(stmt.exportClause)) {
100
+ return;
101
+ }
102
+ rewriteNamedBindings(sourceFile, stmt.exportClause, changes);
103
+ }
104
+ /**
105
+ * Re-renders the `{ ... }` of a named import/export, renaming any
106
+ * `createNodesV2` specifier to `createNodes`. If renaming would collide with a
107
+ * `createNodes` that is already present (e.g. `{ createNodes, createNodesV2 }`),
108
+ * the duplicate is dropped. Returns without recording a change when the binding
109
+ * list contains no `createNodesV2`.
110
+ */
111
+ function rewriteNamedBindings(sourceFile, namedBindings, changes) {
112
+ const elements = namedBindings.elements;
113
+ const hasDeprecated = elements.some((el) => (el.propertyName ?? el.name).text === DEPRECATED_NAME);
114
+ if (!hasDeprecated) {
115
+ return;
116
+ }
117
+ const seen = new Set();
118
+ const rendered = [];
119
+ for (const el of elements) {
120
+ const text = renderSpecifier(el);
121
+ if (!seen.has(text)) {
122
+ seen.add(text);
123
+ rendered.push(text);
124
+ }
125
+ }
126
+ const start = namedBindings.getStart(sourceFile);
127
+ changes.push({
128
+ type: devkit_1.ChangeType.Delete,
129
+ start,
130
+ length: namedBindings.getEnd() - start,
131
+ }, {
132
+ type: devkit_1.ChangeType.Insert,
133
+ index: start,
134
+ text: `{ ${rendered.join(', ')} }`,
135
+ });
136
+ }
137
+ function renderSpecifier(el) {
138
+ const typePrefix = el.isTypeOnly ? 'type ' : '';
139
+ const rename = (name) => name === DEPRECATED_NAME ? CANONICAL_NAME : name;
140
+ // `{ name }` — no alias, so the local binding follows the rename.
141
+ if (!el.propertyName) {
142
+ return `${typePrefix}${rename(el.name.text)}`;
143
+ }
144
+ // `{ propertyName as name }` — only the imported (left) side is renamed; the
145
+ // local alias is preserved. A now-redundant alias such as
146
+ // `createNodesV2 as createNodes` collapses to `createNodes`.
147
+ const canonicalImported = rename(el.propertyName.text);
148
+ const localName = el.name.text;
149
+ return canonicalImported === localName
150
+ ? `${typePrefix}${localName}`
151
+ : `${typePrefix}${canonicalImported} as ${localName}`;
152
+ }
153
+ /**
154
+ * Renames value references of `createNodesV2` to `createNodes` in the file
155
+ * body. Only called once a local `createNodesV2` import binding has actually
156
+ * been renamed, so these references would otherwise dangle. Occurrences that
157
+ * are not references to that binding are skipped: the import/export
158
+ * declarations themselves, property accesses (`x.createNodesV2`), qualified
159
+ * type names, object-literal keys, and declaration names that shadow the
160
+ * import. A shorthand property (`{ createNodesV2 }`) is expanded to
161
+ * `{ createNodesV2: createNodes }` so the property key is preserved. Strings
162
+ * and comments are never `Identifier` nodes, so they are left alone.
163
+ */
164
+ function collectValueUsageRewrites(sourceFile, changes) {
165
+ const visit = (node) => {
166
+ if (ts.isIdentifier(node) &&
167
+ node.text === DEPRECATED_NAME &&
168
+ isRenamableValueUsage(node)) {
169
+ const start = node.getStart(sourceFile);
170
+ changes.push({
171
+ type: devkit_1.ChangeType.Delete,
172
+ start,
173
+ length: node.getEnd() - start,
174
+ }, {
175
+ type: devkit_1.ChangeType.Insert,
176
+ index: start,
177
+ text: ts.isShorthandPropertyAssignment(node.parent)
178
+ ? `${DEPRECATED_NAME}: ${CANONICAL_NAME}`
179
+ : CANONICAL_NAME,
180
+ });
181
+ }
182
+ node.forEachChild(visit);
183
+ };
184
+ sourceFile.forEachChild(visit);
185
+ }
186
+ /**
187
+ * Whether a `createNodesV2` identifier is a value reference to the renamed
188
+ * import binding, as opposed to a position that must be left untouched.
189
+ */
190
+ function isRenamableValueUsage(node) {
191
+ const parent = node.parent;
192
+ if (!parent) {
193
+ return false;
194
+ }
195
+ // Import/export bindings — already handled by the declaration rewrite.
196
+ if (ts.isImportSpecifier(parent) ||
197
+ ts.isExportSpecifier(parent) ||
198
+ ts.isImportClause(parent) ||
199
+ ts.isNamespaceImport(parent)) {
200
+ return false;
201
+ }
202
+ // `x.createNodesV2` / `X.createNodesV2` — a member name, not the binding.
203
+ if (ts.isPropertyAccessExpression(parent) && parent.name === node) {
204
+ return false;
205
+ }
206
+ if (ts.isQualifiedName(parent) && parent.right === node) {
207
+ return false;
208
+ }
209
+ // `{ createNodesV2: ... }` — an object-literal key, not the binding.
210
+ if (ts.isPropertyAssignment(parent) && parent.name === node) {
211
+ return false;
212
+ }
213
+ // A declaration whose name shadows the import (variable, param, etc.).
214
+ if ((ts.isVariableDeclaration(parent) ||
215
+ ts.isParameter(parent) ||
216
+ ts.isBindingElement(parent) ||
217
+ ts.isFunctionDeclaration(parent) ||
218
+ ts.isClassDeclaration(parent)) &&
219
+ parent.name === node) {
220
+ return false;
221
+ }
222
+ return true;
223
+ }
@@ -0,0 +1,25 @@
1
+ #### Rename `createNodesV2` imports to `createNodes`
2
+
3
+ `@nx/nuxt` renamed its primary inferred-plugin export from `createNodesV2` to `createNodes`. The `createNodesV2` name is preserved as a deprecated alias for now, but new code should use `createNodes`.
4
+
5
+ This migration scans every `.ts`, `.tsx`, `.cts`, and `.mts` file in your workspace and rewrites named imports and re-exports of `createNodesV2` from `@nx/nuxt/plugin` to `createNodes`.
6
+
7
+ #### Sample Code Changes
8
+
9
+ ##### Before
10
+
11
+ ```ts
12
+ import { createNodesV2 } from '@nx/nuxt/plugin';
13
+ ```
14
+
15
+ ##### After
16
+
17
+ ```ts
18
+ import { createNodes } from '@nx/nuxt/plugin';
19
+ ```
20
+
21
+ Aliases are preserved (`createNodesV2 as cn` becomes `createNodes as cn`), and if a file already imports both names (`{ createNodes, createNodesV2 }`) the redundant binding is dropped.
22
+
23
+ #### What is not rewritten
24
+
25
+ Only static `import`/`export` named bindings from `@nx/nuxt/plugin` are rewritten. Namespace imports, dynamic `import(...)`, `require(...)` destructuring, and property access such as `plugin.createNodesV2` are left untouched — they keep working through the `createNodesV2` runtime alias. Update those by hand if you want to drop the deprecated name everywhere.
@@ -1,4 +1,4 @@
1
- import { CreateNodesV2 } from '@nx/devkit';
1
+ import { CreateNodes } from '@nx/devkit';
2
2
  export interface NuxtPluginOptions {
3
3
  buildTargetName?: string;
4
4
  serveTargetName?: string;
@@ -7,6 +7,5 @@ export interface NuxtPluginOptions {
7
7
  buildDepsTargetName?: string;
8
8
  watchDepsTargetName?: string;
9
9
  }
10
- export declare const createNodes: CreateNodesV2<NuxtPluginOptions>;
11
- export declare const createNodesV2: CreateNodesV2<NuxtPluginOptions>;
12
- //# sourceMappingURL=plugin.d.ts.map
10
+ export declare const createNodes: CreateNodes<NuxtPluginOptions>;
11
+ export declare const createNodesV2: CreateNodes<NuxtPluginOptions>;