@nx/next 23.0.0-beta.2 → 23.0.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/migrations.json +1 -1
- package/package.json +13 -13
- package/plugins/component-testing.js +6 -6
- package/src/executors/build/build.impl.d.ts.map +1 -1
- package/src/executors/build/build.impl.js +3 -2
- package/src/executors/build/schema.json +1 -0
- package/src/executors/server/schema.json +1 -0
- package/src/executors/server/server.impl.d.ts.map +1 -1
- package/src/executors/server/server.impl.js +4 -2
- package/src/generators/application/application.d.ts.map +1 -1
- package/src/generators/application/application.js +7 -8
- package/src/generators/application/lib/add-e2e.d.ts.map +1 -1
- package/src/generators/application/lib/add-e2e.js +5 -5
- package/src/generators/application/lib/add-linting.js +9 -10
- package/src/generators/application/lib/add-project.d.ts.map +1 -1
- package/src/generators/application/lib/add-project.js +4 -2
- package/src/generators/application/lib/create-application-files.js +3 -3
- package/src/generators/application/lib/normalize-options.js +5 -5
- package/src/generators/component/component.d.ts.map +1 -1
- package/src/generators/component/component.js +2 -2
- package/src/generators/convert-to-inferred/convert-to-inferred.js +4 -5
- package/src/generators/convert-to-inferred/lib/build-post-target-transformer.d.ts +1 -1
- package/src/generators/convert-to-inferred/lib/build-post-target-transformer.d.ts.map +1 -1
- package/src/generators/convert-to-inferred/lib/build-post-target-transformer.js +6 -6
- package/src/generators/convert-to-inferred/lib/serve-post-target-tranformer.d.ts +1 -2
- package/src/generators/convert-to-inferred/lib/serve-post-target-tranformer.d.ts.map +1 -1
- package/src/generators/convert-to-inferred/lib/update-next-config.d.ts +1 -1
- package/src/generators/convert-to-inferred/lib/update-next-config.d.ts.map +1 -1
- package/src/generators/custom-server/custom-server.d.ts.map +1 -1
- package/src/generators/custom-server/custom-server.js +9 -5
- package/src/generators/cypress-component-configuration/cypress-component-configuration.d.ts.map +1 -1
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js +6 -6
- package/src/generators/init/init.d.ts.map +1 -1
- package/src/generators/init/init.js +2 -2
- package/src/generators/library/lib/normalize-options.js +5 -5
- package/src/generators/library/library.d.ts.map +1 -1
- package/src/generators/library/library.js +7 -8
- package/src/generators/page/page.d.ts.map +1 -1
- package/src/generators/page/page.js +7 -6
- package/src/migrations/update-22-0-0/add-svgr-to-next-config.d.ts.map +1 -1
- package/src/migrations/update-22-0-0/add-svgr-to-next-config.js +2 -2
- package/src/plugins/plugin.d.ts.map +1 -1
- package/src/plugins/plugin.js +59 -33
- package/src/utils/add-swc-to-custom-server.d.ts.map +1 -1
- package/src/utils/add-swc-to-custom-server.js +6 -7
- package/src/utils/deprecation.d.ts +6 -0
- package/src/utils/deprecation.d.ts.map +1 -0
- package/src/utils/deprecation.js +25 -0
- package/tailwind.js +4 -4
- package/src/migrations/update-22-2-0/create-ai-instructions-for-next-16.d.ts +0 -3
- package/src/migrations/update-22-2-0/create-ai-instructions-for-next-16.d.ts.map +0 -1
- package/src/migrations/update-22-2-0/create-ai-instructions-for-next-16.js +0 -16
- package/src/migrations/update-22-2-0/files/ai-instructions-for-next-16.md +0 -845
package/src/generators/cypress-component-configuration/cypress-component-configuration.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cypress-component-configuration.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/generators/cypress-component-configuration/cypress-component-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAKjB,IAAI,EAGL,MAAM,YAAY,CAAC;AAMpB,OAAO,EAAE,4CAA4C,EAAE,MAAM,UAAU,CAAC;AAExE,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,4CAA4C,8BAMtD;AAED,wBAAsB,qCAAqC,CACzD,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,4CAA4C,8BAqDtD;
|
|
1
|
+
{"version":3,"file":"cypress-component-configuration.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/generators/cypress-component-configuration/cypress-component-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAKjB,IAAI,EAGL,MAAM,YAAY,CAAC;AAMpB,OAAO,EAAE,4CAA4C,EAAE,MAAM,UAAU,CAAC;AAExE,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,4CAA4C,8BAMtD;AAED,wBAAsB,qCAAqC,CACzD,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,4CAA4C,8BAqDtD;AA0FD,eAAe,6BAA6B,CAAC"}
|
|
@@ -36,7 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.cypressComponentConfiguration = cypressComponentConfiguration;
|
|
37
37
|
exports.cypressComponentConfigurationInternal = cypressComponentConfigurationInternal;
|
|
38
38
|
const devkit_1 = require("@nx/devkit");
|
|
39
|
-
const
|
|
39
|
+
const internal_1 = require("@nx/js/internal");
|
|
40
40
|
const react_1 = require("@nx/react");
|
|
41
41
|
const ct_utils_1 = require("@nx/react/src/utils/ct-utils");
|
|
42
42
|
const path_1 = require("path");
|
|
@@ -80,16 +80,16 @@ async function cypressComponentConfigurationInternal(tree, options) {
|
|
|
80
80
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
81
81
|
}
|
|
82
82
|
async function addFiles(tree, projectConfig, opts) {
|
|
83
|
-
const { addMountDefinition, addDefaultCTConfig } = await Promise.resolve().then(() => __importStar(require('@nx/cypress/
|
|
84
|
-
const { getInstalledCypressMajorVersion } = await Promise.resolve().then(() => __importStar(require('@nx/cypress/
|
|
83
|
+
const { addMountDefinition, addDefaultCTConfig } = await Promise.resolve().then(() => __importStar(require('@nx/cypress/internal')));
|
|
84
|
+
const { getInstalledCypressMajorVersion } = await Promise.resolve().then(() => __importStar(require('@nx/cypress/internal')));
|
|
85
85
|
const installedCypressMajorVersion = getInstalledCypressMajorVersion(tree);
|
|
86
86
|
const ctFile = (0, devkit_1.joinPathFragments)(projectConfig.root, 'cypress', 'support', 'component.ts');
|
|
87
87
|
const updatedCommandFile = await addMountDefinition(tree.read(ctFile, 'utf-8'));
|
|
88
88
|
const moduleSpecifier = installedCypressMajorVersion >= 14 ? 'cypress/react' : 'cypress/react18';
|
|
89
89
|
tree.write(ctFile, `import { mount } from '${moduleSpecifier}';\nimport './styles.ct.css';\n${updatedCommandFile}`);
|
|
90
90
|
const cyFile = (0, devkit_1.joinPathFragments)(projectConfig.root, 'cypress.config.ts');
|
|
91
|
-
const updatedCyConfig = await addDefaultCTConfig(tree.read(cyFile, 'utf-8'));
|
|
92
|
-
tree.write(cyFile,
|
|
91
|
+
const updatedCyConfig = await addDefaultCTConfig(tree.read(cyFile, 'utf-8'), undefined, '@nx/next/plugins/component-testing');
|
|
92
|
+
tree.write(cyFile, updatedCyConfig);
|
|
93
93
|
const isUsingTailwind = ['js', 'cjs'].some((ext) => tree.exists((0, devkit_1.joinPathFragments)(projectConfig.root, `tailwind.config.${ext}`)));
|
|
94
94
|
tree.write((0, devkit_1.joinPathFragments)(projectConfig.root, 'cypress', 'support', 'styles.ct.css'), `/* This is where you can load global styles to apply to all components. */
|
|
95
95
|
${isUsingTailwind
|
|
@@ -100,7 +100,7 @@ ${isUsingTailwind
|
|
|
100
100
|
`);
|
|
101
101
|
if (opts.generateTests) {
|
|
102
102
|
const filePaths = [];
|
|
103
|
-
const sourceRoot = (0,
|
|
103
|
+
const sourceRoot = (0, internal_1.getProjectSourceRoot)(projectConfig, tree);
|
|
104
104
|
(0, devkit_1.visitNotIgnoredFiles)(tree, sourceRoot, (filePath) => {
|
|
105
105
|
const fromProjectRootPath = (0, path_1.relative)(projectConfig.root, filePath);
|
|
106
106
|
// we don't generate tests for pages/server-side/appDir components
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/generators/init/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/generators/init/init.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,IAAI,EAGV,MAAM,YAAY,CAAC;AAQpB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAgC3C,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,8BAE/D;AAED,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,UAAU,8BA+CnB;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -35,8 +35,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.nextInitGenerator = nextInitGenerator;
|
|
37
37
|
exports.nextInitGeneratorInternal = nextInitGeneratorInternal;
|
|
38
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
38
39
|
const devkit_1 = require("@nx/devkit");
|
|
39
|
-
const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
|
|
40
40
|
const version_utils_1 = require("@nx/react/src/utils/version-utils");
|
|
41
41
|
const add_gitignore_entry_1 = require("../../utils/add-gitignore-entry");
|
|
42
42
|
const versions_1 = require("../../utils/versions");
|
|
@@ -65,7 +65,7 @@ async function nextInitGeneratorInternal(host, schema) {
|
|
|
65
65
|
schema.addPlugin ??= addPluginDefault;
|
|
66
66
|
if (schema.addPlugin) {
|
|
67
67
|
const { createNodesV2 } = await Promise.resolve().then(() => __importStar(require('../../plugins/plugin')));
|
|
68
|
-
await (0,
|
|
68
|
+
await (0, internal_1.addPlugin)(host, await (0, devkit_1.createProjectGraphAsync)(), '@nx/next/plugin', createNodesV2, {
|
|
69
69
|
startTargetName: ['start', 'next:start', 'next-start'],
|
|
70
70
|
buildTargetName: ['build', 'next:build', 'next-build'],
|
|
71
71
|
devTargetName: ['dev', 'next:dev', 'next-dev'],
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeOptions = normalizeOptions;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
|
+
const internal_2 = require("@nx/js/internal");
|
|
7
7
|
async function normalizeOptions(host, options) {
|
|
8
|
-
await (0,
|
|
9
|
-
const { projectRoot, importPath } = await (0,
|
|
8
|
+
await (0, internal_1.ensureRootProjectName)(options, 'library');
|
|
9
|
+
const { projectRoot, importPath } = await (0, internal_1.determineProjectNameAndRootOptions)(host, {
|
|
10
10
|
name: options.name,
|
|
11
11
|
projectType: 'library',
|
|
12
12
|
directory: options.directory,
|
|
@@ -16,7 +16,7 @@ async function normalizeOptions(host, options) {
|
|
|
16
16
|
const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
17
17
|
nxJson.useInferencePlugins !== false;
|
|
18
18
|
options.addPlugin ??= addPlugin;
|
|
19
|
-
const isUsingTsSolutionConfig = (0,
|
|
19
|
+
const isUsingTsSolutionConfig = (0, internal_2.isUsingTsSolutionSetup)(host);
|
|
20
20
|
return {
|
|
21
21
|
...options,
|
|
22
22
|
importPath,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/generators/library/library.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAGjB,IAAI,EAEL,MAAM,YAAY,CAAC;AASpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/generators/library/library.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAGjB,IAAI,EAEL,MAAM,YAAY,CAAC;AASpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAYlC,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,8BAMpE;AAED,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,8BAoL5E;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -10,8 +10,7 @@ const init_1 = require("../init/init");
|
|
|
10
10
|
const normalize_options_1 = require("./lib/normalize-options");
|
|
11
11
|
const update_vite_config_1 = require("./lib/update-vite-config");
|
|
12
12
|
const versions_2 = require("../../utils/versions");
|
|
13
|
-
const
|
|
14
|
-
const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
|
13
|
+
const internal_1 = require("@nx/js/internal");
|
|
15
14
|
async function libraryGenerator(host, rawOptions) {
|
|
16
15
|
return await libraryGeneratorInternal(host, {
|
|
17
16
|
addPlugin: false,
|
|
@@ -21,7 +20,7 @@ async function libraryGenerator(host, rawOptions) {
|
|
|
21
20
|
}
|
|
22
21
|
async function libraryGeneratorInternal(host, rawOptions) {
|
|
23
22
|
const tasks = [];
|
|
24
|
-
const addTsPlugin = (0,
|
|
23
|
+
const addTsPlugin = (0, internal_1.shouldConfigureTsSolutionSetup)(host, rawOptions.addPlugin);
|
|
25
24
|
const jsInitTask = await (0, js_1.initGenerator)(host, {
|
|
26
25
|
js: rawOptions.js,
|
|
27
26
|
addTsPlugin,
|
|
@@ -66,7 +65,7 @@ export async function HelloServer() {
|
|
|
66
65
|
return <h1>Hello Server</h1>;
|
|
67
66
|
}
|
|
68
67
|
`);
|
|
69
|
-
const isTsSolutionSetup = (0,
|
|
68
|
+
const isTsSolutionSetup = (0, internal_1.isUsingTsSolutionSetup)(host);
|
|
70
69
|
if (!options.skipTsConfig && !isTsSolutionSetup) {
|
|
71
70
|
(0, js_1.addTsConfigPath)(host, `${options.importPath}/server`, [serverEntryPath]);
|
|
72
71
|
}
|
|
@@ -86,7 +85,7 @@ export async function HelloServer() {
|
|
|
86
85
|
const serverExport = {};
|
|
87
86
|
// For TS Solution setups, include development condition
|
|
88
87
|
if (isTsSolutionSetup) {
|
|
89
|
-
const customConditionName = (0,
|
|
88
|
+
const customConditionName = (0, internal_1.getDefinedCustomConditionName)(host);
|
|
90
89
|
serverExport[customConditionName] = './src/server.ts';
|
|
91
90
|
}
|
|
92
91
|
serverExport.types = './dist/server.d.ts';
|
|
@@ -113,7 +112,7 @@ export async function HelloServer() {
|
|
|
113
112
|
];
|
|
114
113
|
return json;
|
|
115
114
|
});
|
|
116
|
-
(0,
|
|
115
|
+
(0, internal_1.updateTsconfigFiles)(host, options.projectRoot, 'tsconfig.lib.json', {
|
|
117
116
|
jsx: 'react-jsx',
|
|
118
117
|
module: 'esnext',
|
|
119
118
|
moduleResolution: 'bundler',
|
|
@@ -121,9 +120,9 @@ export async function HelloServer() {
|
|
|
121
120
|
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
122
121
|
: undefined);
|
|
123
122
|
if (options.isUsingTsSolutionConfig) {
|
|
124
|
-
await (0,
|
|
123
|
+
await (0, internal_1.addProjectToTsSolutionWorkspace)(host, options.projectRoot);
|
|
125
124
|
}
|
|
126
|
-
(0,
|
|
125
|
+
(0, internal_1.sortPackageJsonFields)(host, options.projectRoot);
|
|
127
126
|
if (!options.skipFormat) {
|
|
128
127
|
await (0, devkit_1.formatFiles)(host);
|
|
129
128
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/generators/page/page.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/generators/page/page.ts"],"names":[],"mappings":"AAKA,OAAO,EAKL,IAAI,EACL,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAOlC,wBAAsB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,mDAuB7D;AAwDD,eAAe,aAAa,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.pageGenerator = pageGenerator;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
4
5
|
const react_1 = require("@nx/react");
|
|
5
6
|
const devkit_1 = require("@nx/devkit");
|
|
6
7
|
const styles_1 = require("../../utils/styles");
|
|
7
|
-
const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
|
|
8
8
|
/*
|
|
9
9
|
* This schematic is basically the React component one, but for Next we need
|
|
10
10
|
* extra dependencies for css, sass, less style options, and make sure
|
|
@@ -33,7 +33,7 @@ async function pageGenerator(host, schema) {
|
|
|
33
33
|
}
|
|
34
34
|
async function normalizeOptions(host, options) {
|
|
35
35
|
// Get the project name first so we can determine the router directory
|
|
36
|
-
const { project: determinedProjectName } = await (0,
|
|
36
|
+
const { project: determinedProjectName } = await (0, internal_1.determineArtifactNameAndDirectoryOptions)(host, {
|
|
37
37
|
name: options.name,
|
|
38
38
|
path: options.path,
|
|
39
39
|
});
|
|
@@ -50,7 +50,7 @@ async function normalizeOptions(host, options) {
|
|
|
50
50
|
else {
|
|
51
51
|
// the user must have cd into a previously created directory, we need to
|
|
52
52
|
// resolve the cwd to get it
|
|
53
|
-
const cwd = (0,
|
|
53
|
+
const cwd = (0, internal_1.getRelativeCwd)();
|
|
54
54
|
if (cwd !== '.' && cwd !== '') {
|
|
55
55
|
pageSymbolName = cwd.split('/').pop();
|
|
56
56
|
}
|
|
@@ -62,12 +62,13 @@ async function normalizeOptions(host, options) {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
const fileName = options.fileName || (isAppRouter ? 'page' : 'index');
|
|
65
|
-
const {
|
|
65
|
+
const { js, ...rest } = options;
|
|
66
|
+
const { project: projectName, filePath } = await (0, internal_1.determineArtifactNameAndDirectoryOptions)(host, {
|
|
66
67
|
name: pageSymbolName,
|
|
67
|
-
path: (0, devkit_1.joinPathFragments)(options.path, `${fileName}.${
|
|
68
|
+
path: (0, devkit_1.joinPathFragments)(options.path, `${fileName}.${js ? 'jsx' : 'tsx'}`),
|
|
68
69
|
});
|
|
69
70
|
return {
|
|
70
|
-
...
|
|
71
|
+
...rest,
|
|
71
72
|
path: filePath,
|
|
72
73
|
projectName,
|
|
73
74
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-svgr-to-next-config.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/migrations/update-22-0-0/add-svgr-to-next-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-svgr-to-next-config.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/migrations/update-22-0-0/add-svgr-to-next-config.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,IAAI,EAMV,MAAM,YAAY,CAAC;AAIpB,wBAA8B,mBAAmB,CAAC,IAAI,EAAE,IAAI,iBAyQ3D"}
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = addSvgrToNextConfig;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
5
6
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
7
7
|
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
8
8
|
const ts = tslib_1.__importStar(require("typescript"));
|
|
9
9
|
async function addSvgrToNextConfig(tree) {
|
|
10
10
|
const projects = new Map();
|
|
11
11
|
// Find all Next.js projects using withNx that have svgr explicitly set to true or an options object
|
|
12
|
-
(0,
|
|
12
|
+
(0, internal_1.forEachExecutorOptions)(tree, '@nx/next:build', (options, project, target) => {
|
|
13
13
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, project);
|
|
14
14
|
const nextConfigPath = `${projectConfig.root}/next.config.js`;
|
|
15
15
|
if (!tree.exists(nextConfigPath))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/next/src/plugins/plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/next/src/plugins/plugin.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,kBAAkB,EAIlB,aAAa,EAKd,MAAM,YAAY,CAAC;AAWpB,MAAM,WAAW,iBAAiB;IAChC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAMD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,iBAAiB,CA6DxD,CAAC;AAEF,eAAO,MAAM,aAAa,kCAAc,CAAC"}
|
package/src/plugins/plugin.js
CHANGED
|
@@ -1,28 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createNodesV2 = exports.createNodes = exports.createDependencies = void 0;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
|
|
6
|
-
const config_utils_1 = require("@nx/devkit/src/utils/config-utils");
|
|
7
|
-
const get_named_inputs_1 = require("@nx/devkit/src/utils/get-named-inputs");
|
|
8
6
|
const js_1 = require("@nx/js");
|
|
9
|
-
const
|
|
10
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
7
|
+
const internal_2 = require("@nx/js/internal");
|
|
11
8
|
const fs_1 = require("fs");
|
|
12
9
|
const devkit_internals_1 = require("nx/src/devkit-internals");
|
|
13
10
|
const cache_directory_1 = require("nx/src/utils/cache-directory");
|
|
14
11
|
const path_1 = require("path");
|
|
15
12
|
const nextConfigBlob = '**/next.config.{ts,js,cjs,mjs}';
|
|
16
|
-
function readTargetsCache(cachePath) {
|
|
17
|
-
return (0, fs_1.existsSync)(cachePath) ? (0, devkit_1.readJsonFile)(cachePath) : {};
|
|
18
|
-
}
|
|
19
|
-
function writeTargetsToCache(cachePath, targetsCache) {
|
|
20
|
-
const oldCache = readTargetsCache(cachePath);
|
|
21
|
-
(0, devkit_1.writeJsonFile)(cachePath, {
|
|
22
|
-
...oldCache,
|
|
23
|
-
...targetsCache,
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
13
|
/**
|
|
27
14
|
* @deprecated The 'createDependencies' function is now a no-op. This functionality is included in 'createNodesV2'.
|
|
28
15
|
*/
|
|
@@ -35,48 +22,65 @@ exports.createNodes = [
|
|
|
35
22
|
async (configFiles, options, context) => {
|
|
36
23
|
const optionsHash = (0, devkit_internals_1.hashObject)(options);
|
|
37
24
|
const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `next-${optionsHash}.json`);
|
|
38
|
-
const targetsCache =
|
|
39
|
-
const isTsSolutionSetup = (0,
|
|
40
|
-
const
|
|
25
|
+
const targetsCache = new internal_1.PluginCache(cachePath);
|
|
26
|
+
const isTsSolutionSetup = (0, internal_2.isUsingTsSolutionSetup)();
|
|
27
|
+
const packageManager = (0, devkit_1.detectPackageManager)(context.workspaceRoot);
|
|
28
|
+
const pmc = (0, devkit_1.getPackageManagerCommand)(packageManager);
|
|
29
|
+
const lockFileName = (0, js_1.getLockFileName)(packageManager);
|
|
30
|
+
const normalizedOptions = normalizeOptions(options);
|
|
41
31
|
try {
|
|
42
|
-
|
|
32
|
+
const { entries, preErrors } = await filterNextConfigs(configFiles, context);
|
|
33
|
+
const projectHashes = await (0, internal_1.calculateHashesForCreateNodes)(entries.map((e) => e.projectRoot), normalizedOptions, context, entries.map(() => [lockFileName]));
|
|
34
|
+
let results = [];
|
|
35
|
+
let nodeErrors = [];
|
|
36
|
+
try {
|
|
37
|
+
results = await (0, devkit_1.createNodesFromFiles)((configFile, _, ctx, idx) => createNodesInternal(configFile, normalizedOptions, ctx, targetsCache, isTsSolutionSetup, pmc, projectHashes[idx]), entries.map((e) => e.configFile), options, context);
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
if (e instanceof devkit_1.AggregateCreateNodesError) {
|
|
41
|
+
results = e.partialResults ?? [];
|
|
42
|
+
nodeErrors = e.errors;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
throw e;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const allErrors = [...preErrors, ...nodeErrors];
|
|
49
|
+
if (allErrors.length > 0) {
|
|
50
|
+
throw new devkit_1.AggregateCreateNodesError(allErrors, results);
|
|
51
|
+
}
|
|
52
|
+
return results;
|
|
43
53
|
}
|
|
44
54
|
finally {
|
|
45
|
-
|
|
55
|
+
targetsCache.writeToDisk();
|
|
46
56
|
}
|
|
47
57
|
},
|
|
48
58
|
];
|
|
49
59
|
exports.createNodesV2 = exports.createNodes;
|
|
50
|
-
async function createNodesInternal(configFilePath, options, context, targetsCache, isTsSolutionSetup, pmc) {
|
|
60
|
+
async function createNodesInternal(configFilePath, options, context, targetsCache, isTsSolutionSetup, pmc, hash) {
|
|
51
61
|
const projectRoot = (0, path_1.dirname)(configFilePath);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (!siblingFiles.includes('package.json') &&
|
|
55
|
-
!siblingFiles.includes('project.json')) {
|
|
56
|
-
return {};
|
|
62
|
+
if (!targetsCache.has(hash)) {
|
|
63
|
+
targetsCache.set(hash, await buildNextTargets(configFilePath, projectRoot, options, context, isTsSolutionSetup, pmc));
|
|
57
64
|
}
|
|
58
|
-
options = normalizeOptions(options);
|
|
59
|
-
const hash = await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, context, [(0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot))]);
|
|
60
|
-
targetsCache[hash] ??= await buildNextTargets(configFilePath, projectRoot, options, context, isTsSolutionSetup, pmc);
|
|
61
65
|
return {
|
|
62
66
|
projects: {
|
|
63
67
|
[projectRoot]: {
|
|
64
68
|
root: projectRoot,
|
|
65
|
-
targets: targetsCache
|
|
69
|
+
targets: targetsCache.get(hash),
|
|
66
70
|
},
|
|
67
71
|
},
|
|
68
72
|
};
|
|
69
73
|
}
|
|
70
74
|
async function buildNextTargets(nextConfigPath, projectRoot, options, context, isTsSolutionSetup, pmc) {
|
|
71
75
|
const nextConfig = await getNextConfig(nextConfigPath, context);
|
|
72
|
-
const namedInputs = (0,
|
|
76
|
+
const namedInputs = (0, internal_1.getNamedInputs)(projectRoot, context);
|
|
73
77
|
const targets = {};
|
|
74
78
|
targets[options.buildTargetName] = await getBuildTargetConfig(namedInputs, projectRoot, nextConfig, isTsSolutionSetup);
|
|
75
79
|
targets[options.devTargetName] = getDevTargetConfig(projectRoot, isTsSolutionSetup);
|
|
76
80
|
const startTarget = getStartTargetConfig(options, projectRoot);
|
|
77
81
|
targets[options.startTargetName] = startTarget;
|
|
78
82
|
targets[options.serveStaticTargetName] = startTarget;
|
|
79
|
-
(0,
|
|
83
|
+
(0, internal_2.addBuildAndWatchDepsTargets)(context.workspaceRoot, projectRoot, targets, options, pmc);
|
|
80
84
|
return targets;
|
|
81
85
|
}
|
|
82
86
|
async function getBuildTargetConfig(namedInputs, projectRoot, nextConfig, isTsSolutionSetup) {
|
|
@@ -147,7 +151,29 @@ async function getOutputs(projectRoot, nextConfig) {
|
|
|
147
151
|
}
|
|
148
152
|
function getNextConfig(configFilePath, context) {
|
|
149
153
|
const resolvedPath = (0, path_1.join)(context.workspaceRoot, configFilePath);
|
|
150
|
-
return (0,
|
|
154
|
+
return (0, internal_1.loadConfigFile)(resolvedPath);
|
|
155
|
+
}
|
|
156
|
+
async function filterNextConfigs(configFiles, context) {
|
|
157
|
+
const preErrors = [];
|
|
158
|
+
const candidates = await Promise.all(configFiles.map(async (configFile) => {
|
|
159
|
+
try {
|
|
160
|
+
const projectRoot = (0, path_1.dirname)(configFile);
|
|
161
|
+
const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
|
|
162
|
+
if (!siblingFiles.includes('package.json') &&
|
|
163
|
+
!siblingFiles.includes('project.json')) {
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
return { configFile, projectRoot };
|
|
167
|
+
}
|
|
168
|
+
catch (e) {
|
|
169
|
+
preErrors.push([configFile, e]);
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
}));
|
|
173
|
+
return {
|
|
174
|
+
entries: candidates.filter((c) => c !== null),
|
|
175
|
+
preErrors,
|
|
176
|
+
};
|
|
151
177
|
}
|
|
152
178
|
function normalizeOptions(options) {
|
|
153
179
|
options ??= {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-swc-to-custom-server.d.ts","sourceRoot":"","sources":["../../../../../packages/next/src/utils/add-swc-to-custom-server.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EAKL,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"add-swc-to-custom-server.d.ts","sourceRoot":"","sources":["../../../../../packages/next/src/utils/add-swc-to-custom-server.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EAKL,MAAM,YAAY,CAAC;AAQpB,wBAAgB,eAAe,CAC7B,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,aAAa,SAAW,EACxB,gBAAgB,GAAE,MAAM,EAAO,cAyBhC"}
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.configureForSwc = configureForSwc;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
6
|
-
const add_swc_config_1 = require("@nx/js/src/utils/swc/add-swc-config");
|
|
5
|
+
const internal_1 = require("@nx/js/internal");
|
|
7
6
|
function configureForSwc(tree, projectRoot, swcConfigName = '.swcrc', additonalExludes = []) {
|
|
8
7
|
const swcConfigPath = (0, devkit_1.joinPathFragments)(projectRoot, swcConfigName);
|
|
9
8
|
const rootPackageJson = (0, devkit_1.readJson)(tree, 'package.json');
|
|
@@ -13,7 +12,7 @@ function configureForSwc(tree, projectRoot, swcConfigName = '.swcrc', additonalE
|
|
|
13
12
|
rootPackageJson.devDependencies?.['@swc/cli'];
|
|
14
13
|
if (!tree.exists(swcConfigPath)) {
|
|
15
14
|
// We need to create a swc config file specific for custom server
|
|
16
|
-
(0,
|
|
15
|
+
(0, internal_1.addSwcConfig)(tree, projectRoot, 'commonjs', false, swcConfigName, [
|
|
17
16
|
...additonalExludes,
|
|
18
17
|
'.*.d.ts$',
|
|
19
18
|
]);
|
|
@@ -25,10 +24,10 @@ function configureForSwc(tree, projectRoot, swcConfigName = '.swcrc', additonalE
|
|
|
25
24
|
}
|
|
26
25
|
function addSwcDependencies(tree) {
|
|
27
26
|
return (0, devkit_1.addDependenciesToPackageJson)(tree, {
|
|
28
|
-
'@swc/helpers':
|
|
27
|
+
'@swc/helpers': internal_1.swcHelpersVersion,
|
|
29
28
|
}, {
|
|
30
|
-
'@swc-node/register':
|
|
31
|
-
'@swc/cli':
|
|
32
|
-
'@swc/core':
|
|
29
|
+
'@swc-node/register': internal_1.swcNodeVersion,
|
|
30
|
+
'@swc/cli': internal_1.swcCliVersion,
|
|
31
|
+
'@swc/core': internal_1.swcCoreVersion,
|
|
33
32
|
});
|
|
34
33
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const NEXT_BUILD_EXECUTOR_DEPRECATION_MESSAGE = "The `@nx/next:build` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/next:convert-to-inferred` to migrate to the `@nx/next/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.";
|
|
2
|
+
export declare const NEXT_SERVER_EXECUTOR_DEPRECATION_MESSAGE = "The `@nx/next:server` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/next:convert-to-inferred` to migrate to the `@nx/next/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.";
|
|
3
|
+
export declare function warnNextBuildExecutorDeprecation(): void;
|
|
4
|
+
export declare function warnNextServerExecutorDeprecation(): void;
|
|
5
|
+
export declare function warnNextExecutorGenerating(): void;
|
|
6
|
+
//# sourceMappingURL=deprecation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deprecation.d.ts","sourceRoot":"","sources":["../../../../../packages/next/src/utils/deprecation.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,uCAAuC,4PACuM,CAAC;AAE5P,eAAO,MAAM,wCAAwC,6PACuM,CAAC;AAE7P,wBAAgB,gCAAgC,IAAI,IAAI,CAEvD;AAED,wBAAgB,iCAAiC,IAAI,IAAI,CAExD;AAMD,wBAAgB,0BAA0B,IAAI,IAAI,CAIjD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NEXT_SERVER_EXECUTOR_DEPRECATION_MESSAGE = exports.NEXT_BUILD_EXECUTOR_DEPRECATION_MESSAGE = void 0;
|
|
4
|
+
exports.warnNextBuildExecutorDeprecation = warnNextBuildExecutorDeprecation;
|
|
5
|
+
exports.warnNextServerExecutorDeprecation = warnNextServerExecutorDeprecation;
|
|
6
|
+
exports.warnNextExecutorGenerating = warnNextExecutorGenerating;
|
|
7
|
+
const devkit_1 = require("@nx/devkit");
|
|
8
|
+
// TODO(v24): Remove the @nx/next:build and @nx/next:server executors. The
|
|
9
|
+
// inferred plugin (@nx/next/plugin) and the convert-to-inferred generator
|
|
10
|
+
// stay supported.
|
|
11
|
+
exports.NEXT_BUILD_EXECUTOR_DEPRECATION_MESSAGE = 'The `@nx/next:build` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/next:convert-to-inferred` to migrate to the `@nx/next/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.';
|
|
12
|
+
exports.NEXT_SERVER_EXECUTOR_DEPRECATION_MESSAGE = 'The `@nx/next:server` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/next:convert-to-inferred` to migrate to the `@nx/next/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.';
|
|
13
|
+
function warnNextBuildExecutorDeprecation() {
|
|
14
|
+
devkit_1.logger.warn(exports.NEXT_BUILD_EXECUTOR_DEPRECATION_MESSAGE);
|
|
15
|
+
}
|
|
16
|
+
function warnNextServerExecutorDeprecation() {
|
|
17
|
+
devkit_1.logger.warn(exports.NEXT_SERVER_EXECUTOR_DEPRECATION_MESSAGE);
|
|
18
|
+
}
|
|
19
|
+
// Fired when the @nx/next:application generator is about to generate targets
|
|
20
|
+
// that use the deprecated executors — i.e. when @nx/next/plugin isn't
|
|
21
|
+
// registered in nx.json. Surfaces the deprecation at generation time rather
|
|
22
|
+
// than only when the user later runs the generated targets.
|
|
23
|
+
function warnNextExecutorGenerating() {
|
|
24
|
+
devkit_1.logger.warn('Generating targets that use the deprecated `@nx/next:build` and `@nx/next:server` executors. These executors will be removed in Nx v24. Run `nx g @nx/next:convert-to-inferred` next to migrate these targets to the `@nx/next/plugin` inferred plugin and prevent future generators from emitting executor targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.');
|
|
25
|
+
}
|
package/tailwind.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createGlobPatternsForDependencies = createGlobPatternsForDependencies;
|
|
4
|
-
const
|
|
4
|
+
const internal_1 = require("@nx/js/internal");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
let hasWarned = false;
|
|
7
7
|
/**
|
|
@@ -23,8 +23,8 @@ function createGlobPatternsForDependencies(dirPath, fileGlobPatternToInclude = '
|
|
|
23
23
|
if (majorVersion >= 4) {
|
|
24
24
|
try {
|
|
25
25
|
return [
|
|
26
|
-
...(0,
|
|
27
|
-
...(0,
|
|
26
|
+
...(0, internal_1.createGlobPatternsForDependencies)(dirPath, fileGlobPatternToInclude).map((glob) => (0, path_1.relative)(dirPath, glob)),
|
|
27
|
+
...(0, internal_1.createGlobPatternsForDependencies)(dirPath, fileGlobPatternToExclude).map((glob) => `!${(0, path_1.relative)(dirPath, glob)}`),
|
|
28
28
|
];
|
|
29
29
|
}
|
|
30
30
|
catch (e) {
|
|
@@ -44,7 +44,7 @@ function createGlobPatternsForDependencies(dirPath, fileGlobPatternToInclude = '
|
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
46
46
|
try {
|
|
47
|
-
return (0,
|
|
47
|
+
return (0, internal_1.createGlobPatternsForDependencies)(dirPath, fileGlobPatternToInclude);
|
|
48
48
|
}
|
|
49
49
|
catch (e) {
|
|
50
50
|
/**
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-ai-instructions-for-next-16.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/migrations/update-22-2-0/create-ai-instructions-for-next-16.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,wBAA8B,6BAA6B,CAAC,IAAI,EAAE,IAAI,qBAerE"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = createAiInstructionsForNext16;
|
|
4
|
-
const path_1 = require("path");
|
|
5
|
-
const fs_1 = require("fs");
|
|
6
|
-
async function createAiInstructionsForNext16(tree) {
|
|
7
|
-
const pathToAiInstructions = (0, path_1.join)(__dirname, 'files', 'ai-instructions-for-next-16.md');
|
|
8
|
-
if (!(0, fs_1.existsSync)(pathToAiInstructions)) {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
const contents = (0, fs_1.readFileSync)(pathToAiInstructions, 'utf-8');
|
|
12
|
-
tree.write('tools/ai-migrations/MIGRATE_NEXT_16.md', contents);
|
|
13
|
-
return [
|
|
14
|
-
`We created 'tools/ai-migrations/MIGRATE_NEXT_16.md' with instructions for an AI Agent to help migrate your Next.js projects to Next.js 16.`,
|
|
15
|
-
];
|
|
16
|
-
}
|