@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/migrations.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"next": ">=16.0.0"
|
|
14
14
|
},
|
|
15
15
|
"description": "Create AI Instructions to help migrate users workspaces to Next.js 16.",
|
|
16
|
-
"
|
|
16
|
+
"prompt": "./src/migrations/update-22-2-0/ai-instructions-for-next-16.md"
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"packageJsonUpdates": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/next",
|
|
3
|
-
"version": "23.0.0-beta.
|
|
3
|
+
"version": "23.0.0-beta.21",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Next.js plugin for Nx contains executors and generators for managing Next.js applications and libraries within an Nx workspace. It provides:\n\n\n- Scaffolding for creating, building, serving, linting, and testing Next.js applications.\n\n- Integration with building, serving, and exporting a Next.js application.\n\n- Integration with React libraries within the workspace. \n\nWhen using Next.js in Nx, you get the out-of-the-box support for TypeScript, Playwright, Cypress, and Jest. No need to configure anything: watch mode, source maps, and typings just work.",
|
|
6
6
|
"repository": {
|
|
@@ -36,25 +36,25 @@
|
|
|
36
36
|
"next": ">=14.0.0 <17.0.0"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@nx/devkit": "23.0.0-beta.
|
|
39
|
+
"@nx/devkit": "23.0.0-beta.21",
|
|
40
40
|
"@babel/plugin-proposal-decorators": "^7.22.7",
|
|
41
|
-
"@svgr/webpack": "^8.1
|
|
41
|
+
"@svgr/webpack": "^8.0.1",
|
|
42
42
|
"copy-webpack-plugin": "^14.0.0",
|
|
43
|
-
"ignore": "^
|
|
43
|
+
"ignore": "^7.0.5",
|
|
44
44
|
"semver": "^7.6.3",
|
|
45
45
|
"tslib": "^2.3.0",
|
|
46
46
|
"webpack-merge": "^5.8.0",
|
|
47
|
-
"@nx/js": "23.0.0-beta.
|
|
48
|
-
"@nx/eslint": "23.0.0-beta.
|
|
49
|
-
"@nx/react": "23.0.0-beta.
|
|
50
|
-
"@nx/web": "23.0.0-beta.
|
|
51
|
-
"@nx/webpack": "23.0.0-beta.
|
|
52
|
-
"@phenomnomnominal/tsquery": "~6.
|
|
47
|
+
"@nx/js": "23.0.0-beta.21",
|
|
48
|
+
"@nx/eslint": "23.0.0-beta.21",
|
|
49
|
+
"@nx/react": "23.0.0-beta.21",
|
|
50
|
+
"@nx/web": "23.0.0-beta.21",
|
|
51
|
+
"@nx/webpack": "23.0.0-beta.21",
|
|
52
|
+
"@phenomnomnominal/tsquery": "~6.2.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@nx/cypress": "23.0.0-beta.
|
|
56
|
-
"@nx/playwright": "23.0.0-beta.
|
|
57
|
-
"nx": "23.0.0-beta.
|
|
55
|
+
"@nx/cypress": "23.0.0-beta.21",
|
|
56
|
+
"@nx/playwright": "23.0.0-beta.21",
|
|
57
|
+
"nx": "23.0.0-beta.21"
|
|
58
58
|
},
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.nxComponentTestingPreset = nxComponentTestingPreset;
|
|
4
4
|
const cypress_preset_1 = require("@nx/cypress/plugins/cypress-preset");
|
|
5
|
-
const
|
|
5
|
+
const internal_1 = require("@nx/cypress/internal");
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const
|
|
7
|
+
const internal_2 = require("@nx/js/internal");
|
|
8
8
|
const react_1 = require("@nx/react");
|
|
9
9
|
const webpack_1 = require("@nx/webpack");
|
|
10
10
|
const configuration_1 = require("nx/src/config/configuration");
|
|
@@ -16,10 +16,10 @@ function nxComponentTestingPreset(pathToConfig, options) {
|
|
|
16
16
|
return (0, cypress_preset_1.nxBaseCypressPreset)(pathToConfig);
|
|
17
17
|
}
|
|
18
18
|
const graph = (0, devkit_1.readCachedProjectGraph)();
|
|
19
|
-
const { targets: ctTargets, name: ctProjectName } = (0,
|
|
19
|
+
const { targets: ctTargets, name: ctProjectName } = (0, internal_1.getProjectConfigByPath)(graph, pathToConfig);
|
|
20
20
|
const ctTargetName = options?.ctTargetName || 'component-test';
|
|
21
21
|
const ctConfigurationName = process.env.NX_CYPRESS_TARGET_CONFIGURATION;
|
|
22
|
-
const ctExecutorContext = (0,
|
|
22
|
+
const ctExecutorContext = (0, internal_1.createExecutorContext)(graph, ctTargets, ctProjectName, ctTargetName, ctConfigurationName);
|
|
23
23
|
let buildTarget = options?.buildTarget;
|
|
24
24
|
if (!buildTarget) {
|
|
25
25
|
const ctExecutorOptions = (0, devkit_1.readTargetOptions)({
|
|
@@ -50,7 +50,7 @@ function nxComponentTestingPreset(pathToConfig, options) {
|
|
|
50
50
|
]}' project is not using the '@nx/next:build' executor. ` +
|
|
51
51
|
`Please make sure to use '@nx/next:build' executor in that target to use Cypress Component Testing.`);
|
|
52
52
|
}
|
|
53
|
-
const buildExecutorContext = (0,
|
|
53
|
+
const buildExecutorContext = (0, internal_1.createExecutorContext)(graph, buildProjectConfig.targets, parsedBuildTarget.project, parsedBuildTarget.target, parsedBuildTarget.configuration);
|
|
54
54
|
const buildExecutorOptions = (0, devkit_1.readTargetOptions)({
|
|
55
55
|
project: parsedBuildTarget.project,
|
|
56
56
|
target: parsedBuildTarget.target,
|
|
@@ -69,7 +69,7 @@ Able to find CT project, ${!!ctProjectConfig}.`);
|
|
|
69
69
|
const webpackOptions = {
|
|
70
70
|
root: ctExecutorContext.root,
|
|
71
71
|
projectRoot: ctProjectConfig.root,
|
|
72
|
-
sourceRoot: (0,
|
|
72
|
+
sourceRoot: (0, internal_2.getProjectSourceRoot)(ctProjectConfig),
|
|
73
73
|
main: '',
|
|
74
74
|
useTsconfigPaths: undefined,
|
|
75
75
|
fileReplacements: buildFileReplacements,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/executors/build/build.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAKhB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"build.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/executors/build/build.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAKhB,MAAM,YAAY,CAAC;AAUpB,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAS5D,wBAA8B,aAAa,CACzC,OAAO,EAAE,uBAAuB,EAChC,OAAO,EAAE,eAAe;;GAsGzB"}
|
|
@@ -7,7 +7,6 @@ const path_1 = require("path");
|
|
|
7
7
|
const node_fs_1 = require("node:fs");
|
|
8
8
|
const promises_1 = require("node:fs/promises");
|
|
9
9
|
const semver_1 = require("semver");
|
|
10
|
-
const semver_2 = require("@nx/devkit/src/utils/semver");
|
|
11
10
|
const update_package_json_1 = require("./lib/update-package-json");
|
|
12
11
|
const create_next_config_file_1 = require("./lib/create-next-config-file");
|
|
13
12
|
const check_project_1 = require("./lib/check-project");
|
|
@@ -15,8 +14,10 @@ const child_process_1 = require("child_process");
|
|
|
15
14
|
const create_cli_options_1 = require("../../utils/create-cli-options");
|
|
16
15
|
const internal_1 = require("@nx/devkit/internal");
|
|
17
16
|
const runtime_version_utils_1 = require("../../utils/runtime-version-utils");
|
|
17
|
+
const deprecation_1 = require("../../utils/deprecation");
|
|
18
18
|
let childProcess;
|
|
19
19
|
async function buildExecutor(options, context) {
|
|
20
|
+
(0, deprecation_1.warnNextBuildExecutorDeprecation)();
|
|
20
21
|
// Cast to any to overwrite NODE_ENV
|
|
21
22
|
process.env.NODE_ENV ||= 'production';
|
|
22
23
|
const projectRoot = context.projectGraph.nodes[context.projectName].data.root;
|
|
@@ -30,7 +31,7 @@ async function buildExecutor(options, context) {
|
|
|
30
31
|
const reactDomVersion = packageJson?.dependencies?.['react-dom'] ??
|
|
31
32
|
rootPackageJson.dependencies?.['react-dom'];
|
|
32
33
|
const hasReact18 = reactDomVersion &&
|
|
33
|
-
(0, semver_1.gte)((0,
|
|
34
|
+
(0, semver_1.gte)((0, internal_1.checkAndCleanWithSemver)('react-dom', reactDomVersion), '18.0.0');
|
|
34
35
|
if (hasReact18) {
|
|
35
36
|
process.env['__NEXT_REACT_ROOT'] ||= 'true';
|
|
36
37
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"title": "Next Build",
|
|
7
7
|
"description": "Build a Next.js app.",
|
|
8
8
|
"type": "object",
|
|
9
|
+
"x-deprecated": "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 plugin. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.",
|
|
9
10
|
"properties": {
|
|
10
11
|
"outputPath": {
|
|
11
12
|
"type": "string",
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"title": "Next Serve",
|
|
7
7
|
"description": "Serve a Next.js app.",
|
|
8
8
|
"type": "object",
|
|
9
|
+
"x-deprecated": "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 plugin. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.",
|
|
9
10
|
"properties": {
|
|
10
11
|
"dev": {
|
|
11
12
|
"type": "boolean",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/executors/server/server.impl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/executors/server/server.impl.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EAIhB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAEL,uBAAuB,EACxB,MAAM,mBAAmB,CAAC;AAQ3B,wBAA+B,aAAa,CAC1C,OAAO,EAAE,uBAAuB,EAChC,OAAO,EAAE,eAAe;;;cAuHzB"}
|
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = serveExecutor;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
5
6
|
const devkit_1 = require("@nx/devkit");
|
|
6
7
|
const path_1 = require("path");
|
|
7
8
|
const child_process_1 = require("child_process");
|
|
8
9
|
const custom_server_impl_1 = tslib_1.__importDefault(require("./custom-server.impl"));
|
|
9
10
|
const create_cli_options_1 = require("../../utils/create-cli-options");
|
|
10
|
-
const async_iterable_1 = require("@nx/devkit/src/utils/async-iterable");
|
|
11
11
|
const wait_for_port_open_1 = require("@nx/web/src/utils/wait-for-port-open");
|
|
12
12
|
const runtime_version_utils_1 = require("../../utils/runtime-version-utils");
|
|
13
|
+
const deprecation_1 = require("../../utils/deprecation");
|
|
13
14
|
async function* serveExecutor(options, context) {
|
|
15
|
+
(0, deprecation_1.warnNextServerExecutorDeprecation)();
|
|
14
16
|
const buildOptions = (0, devkit_1.readTargetOptions)((0, devkit_1.parseTargetString)(options.buildTarget, context), context);
|
|
15
17
|
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
16
18
|
// This is required for the default custom server to work. See the @nx/next:app generator.
|
|
@@ -64,7 +66,7 @@ async function* serveExecutor(options, context) {
|
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
68
|
const nextBin = require.resolve('next/dist/bin/next');
|
|
67
|
-
yield* (0,
|
|
69
|
+
yield* (0, internal_1.createAsyncIterable)(async ({ done, next, error }) => {
|
|
68
70
|
const server = (0, child_process_1.fork)(nextBin, [
|
|
69
71
|
mode,
|
|
70
72
|
...args,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/generators/application/application.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/generators/application/application.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,iBAAiB,EAGjB,IAAI,EACL,MAAM,YAAY,CAAC;AASpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAsBlC,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAMpE;AAED,wBAAsB,4BAA4B,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAkH5E"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.applicationGenerator = applicationGenerator;
|
|
4
4
|
exports.applicationGeneratorInternal = applicationGeneratorInternal;
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
5
6
|
const devkit_1 = require("@nx/devkit");
|
|
6
7
|
const js_1 = require("@nx/js");
|
|
7
8
|
const versions_1 = require("@nx/react/src/utils/versions");
|
|
@@ -18,9 +19,7 @@ const add_linting_1 = require("./lib/add-linting");
|
|
|
18
19
|
const custom_server_1 = require("../custom-server/custom-server");
|
|
19
20
|
const update_cypress_tsconfig_1 = require("./lib/update-cypress-tsconfig");
|
|
20
21
|
const versions_2 = require("../../utils/versions");
|
|
21
|
-
const
|
|
22
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
23
|
-
const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
|
22
|
+
const internal_2 = require("@nx/js/internal");
|
|
24
23
|
const add_swc_to_custom_server_1 = require("../../utils/add-swc-to-custom-server");
|
|
25
24
|
const jest_config_util_1 = require("../../utils/jest-config-util");
|
|
26
25
|
async function applicationGenerator(host, schema) {
|
|
@@ -32,7 +31,7 @@ async function applicationGenerator(host, schema) {
|
|
|
32
31
|
}
|
|
33
32
|
async function applicationGeneratorInternal(host, schema) {
|
|
34
33
|
const tasks = [];
|
|
35
|
-
const addTsPlugin = (0,
|
|
34
|
+
const addTsPlugin = (0, internal_2.shouldConfigureTsSolutionSetup)(host, schema.addPlugin, schema.useTsSolution);
|
|
36
35
|
const jsInitTask = await (0, js_1.initGenerator)(host, {
|
|
37
36
|
js: schema.js,
|
|
38
37
|
skipPackageJson: schema.skipPackageJson,
|
|
@@ -53,7 +52,7 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
53
52
|
// If we are using the new TS solution
|
|
54
53
|
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
55
54
|
if (options.isTsSolutionSetup) {
|
|
56
|
-
await (0,
|
|
55
|
+
await (0, internal_2.addProjectToTsSolutionWorkspace)(host, options.appProjectRoot);
|
|
57
56
|
}
|
|
58
57
|
const lintTask = await (0, add_linting_1.addLinting)(host, options);
|
|
59
58
|
tasks.push(lintTask);
|
|
@@ -91,19 +90,19 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
91
90
|
}
|
|
92
91
|
tasks.push((0, devkit_1.addDependenciesToPackageJson)(host, { tslib: versions_2.tsLibVersion }, devDependencies));
|
|
93
92
|
}
|
|
94
|
-
(0,
|
|
93
|
+
(0, internal_2.updateTsconfigFiles)(host, options.appProjectRoot, 'tsconfig.json', {
|
|
95
94
|
jsx: 'preserve',
|
|
96
95
|
module: 'esnext',
|
|
97
96
|
moduleResolution: 'bundler',
|
|
98
97
|
}, options.linter === 'eslint'
|
|
99
98
|
? ['.next', 'eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
100
99
|
: ['.next'], options.src ? 'src' : '.');
|
|
101
|
-
(0,
|
|
100
|
+
(0, internal_2.sortPackageJsonFields)(host, options.appProjectRoot);
|
|
102
101
|
if (!options.skipFormat) {
|
|
103
102
|
await (0, devkit_1.formatFiles)(host);
|
|
104
103
|
}
|
|
105
104
|
tasks.push(() => {
|
|
106
|
-
(0,
|
|
105
|
+
(0, internal_1.logShowProjectCommand)(options.projectName);
|
|
107
106
|
});
|
|
108
107
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
109
108
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-e2e.d.ts","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/add-e2e.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-e2e.d.ts","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/add-e2e.ts"],"names":[],"mappings":"AAIA,OAAO,EAKL,IAAI,EACJ,iBAAiB,EAElB,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,wBAAsB,MAAM,CAC1B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CA8H5B"}
|
|
@@ -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 web_1 = require("@nx/web");
|
|
7
7
|
const versions_1 = require("../../../utils/versions");
|
|
8
8
|
async function addE2e(host, options) {
|
|
@@ -107,11 +107,11 @@ async function getNextE2EWebServerInfo(tree, projectName, configFilePath, isPlug
|
|
|
107
107
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
108
108
|
let e2ePort = isPluginBeingAdded ? 3000 : 4200;
|
|
109
109
|
const defaultServeTarget = isPluginBeingAdded ? 'dev' : 'serve';
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
e2ePort =
|
|
110
|
+
const serveTargetOptions = (0, internal_1.readTargetDefaultsForTarget)(defaultServeTarget, nxJson.targetDefaults)?.options;
|
|
111
|
+
if (serveTargetOptions?.port) {
|
|
112
|
+
e2ePort = serveTargetOptions.port;
|
|
113
113
|
}
|
|
114
|
-
return (0,
|
|
114
|
+
return (0, internal_1.getE2EWebServerInfo)(tree, projectName, {
|
|
115
115
|
plugin: '@nx/next/plugin',
|
|
116
116
|
serveTargetName: 'devTargetName',
|
|
117
117
|
serveStaticTargetName: 'startTargetName',
|
|
@@ -4,9 +4,8 @@ exports.addLinting = addLinting;
|
|
|
4
4
|
const eslint_1 = require("@nx/eslint");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const lint_1 = require("@nx/react/src/utils/lint");
|
|
7
|
-
const
|
|
7
|
+
const internal_1 = require("@nx/eslint/internal");
|
|
8
8
|
const version_utils_1 = require("../../../utils/version-utils");
|
|
9
|
-
const flat_config_1 = require("@nx/eslint/src/utils/flat-config");
|
|
10
9
|
async function addLinting(host, options) {
|
|
11
10
|
if (options.linter !== 'eslint')
|
|
12
11
|
return () => { };
|
|
@@ -23,15 +22,15 @@ async function addLinting(host, options) {
|
|
|
23
22
|
setParserOptionsProject: options.setParserOptionsProject,
|
|
24
23
|
addPlugin: options.addPlugin,
|
|
25
24
|
}));
|
|
26
|
-
if (options.linter === 'eslint' && (0,
|
|
27
|
-
if ((0,
|
|
28
|
-
(0,
|
|
25
|
+
if (options.linter === 'eslint' && (0, internal_1.isEslintConfigSupported)(host)) {
|
|
26
|
+
if ((0, internal_1.useFlatConfig)(host)) {
|
|
27
|
+
(0, internal_1.addPredefinedConfigToFlatLintConfig)(host, options.appProjectRoot, 'flat/react-typescript', { checkBaseConfig: true });
|
|
29
28
|
if (await (0, version_utils_1.isNext16)(host)) {
|
|
30
|
-
(0,
|
|
29
|
+
(0, internal_1.addPluginsToLintConfig)(host, options.appProjectRoot, ['@next/next']);
|
|
31
30
|
}
|
|
32
31
|
else {
|
|
33
32
|
// Since Next.js < 16 does not support flat configs yet, we need to use compat fixup.
|
|
34
|
-
const addExtendsTask = (0,
|
|
33
|
+
const addExtendsTask = (0, internal_1.addExtendsToLintConfig)(host, options.appProjectRoot, [
|
|
35
34
|
{ name: 'next', needCompatFixup: true },
|
|
36
35
|
{
|
|
37
36
|
name: 'next/core-web-vitals',
|
|
@@ -42,14 +41,14 @@ async function addLinting(host, options) {
|
|
|
42
41
|
}
|
|
43
42
|
}
|
|
44
43
|
else {
|
|
45
|
-
const addExtendsTask = (0,
|
|
44
|
+
const addExtendsTask = (0, internal_1.addExtendsToLintConfig)(host, options.appProjectRoot, [
|
|
46
45
|
'plugin:@nx/react-typescript',
|
|
47
46
|
{ name: 'next', needCompatFixup: true },
|
|
48
47
|
{ name: 'next/core-web-vitals', needCompatFixup: true },
|
|
49
48
|
]);
|
|
50
49
|
tasks.push(addExtendsTask);
|
|
51
50
|
}
|
|
52
|
-
(0,
|
|
51
|
+
(0, internal_1.updateOverrideInLintConfig)(host, options.appProjectRoot, (o) => Array.isArray(o.files) &&
|
|
53
52
|
o.files.some((f) => f.match(/\*\.ts$/)) &&
|
|
54
53
|
o.files.some((f) => f.match(/\*\.tsx$/)) &&
|
|
55
54
|
o.files.some((f) => f.match(/\*\.js$/)) &&
|
|
@@ -63,7 +62,7 @@ async function addLinting(host, options) {
|
|
|
63
62
|
],
|
|
64
63
|
},
|
|
65
64
|
}));
|
|
66
|
-
(0,
|
|
65
|
+
(0, internal_1.addIgnoresToLintConfig)(host, options.appProjectRoot, [
|
|
67
66
|
'.next/**/*',
|
|
68
67
|
...(options.isTsSolutionSetup ? ['**/out-tsc'] : []),
|
|
69
68
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-project.d.ts","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/add-project.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-project.d.ts","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/add-project.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAKL,IAAI,EAEL,MAAM,YAAY,CAAC;AAOpB,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,QA4F/D"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addProject = addProject;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
|
|
6
6
|
const versions_1 = require("../../../utils/versions");
|
|
7
|
+
const deprecation_1 = require("../../../utils/deprecation");
|
|
7
8
|
const react_1 = require("@nx/react");
|
|
8
9
|
function addProject(host, options) {
|
|
9
10
|
const targets = {};
|
|
@@ -14,7 +15,8 @@ function addProject(host, options) {
|
|
|
14
15
|
? p === '@nx/next/plugin'
|
|
15
16
|
: p.plugin === '@nx/next/plugin');
|
|
16
17
|
if (!hasPlugin) {
|
|
17
|
-
(0,
|
|
18
|
+
(0, deprecation_1.warnNextExecutorGenerating)();
|
|
19
|
+
(0, internal_1.addBuildTargetDefaults)(host, '@nx/next:build');
|
|
18
20
|
targets.build = {
|
|
19
21
|
executor: '@nx/next:build',
|
|
20
22
|
outputs: ['{options.outputPath}'],
|
|
@@ -5,13 +5,13 @@ const path_1 = require("path");
|
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const js_1 = require("@nx/js");
|
|
7
7
|
const create_application_files_helpers_1 = require("./create-application-files.helpers");
|
|
8
|
-
const
|
|
8
|
+
const internal_1 = require("@nx/js/internal");
|
|
9
9
|
const version_utils_1 = require("../../../utils/version-utils");
|
|
10
10
|
async function createApplicationFiles(host, options) {
|
|
11
11
|
const offsetFromRoot = (0, devkit_1.offsetFromRoot)(options.appProjectRoot);
|
|
12
12
|
const layoutTypeSrcPath = (0, devkit_1.joinPathFragments)(offsetFromRoot, options.appProjectRoot, '.next/types/**/*.ts');
|
|
13
13
|
const layoutTypeDistPath = (0, devkit_1.joinPathFragments)(offsetFromRoot, options.outputPath, '.next/types/**/*.ts');
|
|
14
|
-
const rootPath = options.rootProject || (0,
|
|
14
|
+
const rootPath = options.rootProject || (0, internal_1.isUsingTsSolutionSetup)(host)
|
|
15
15
|
? options.src
|
|
16
16
|
? 'src/'
|
|
17
17
|
: options.appDir
|
|
@@ -33,7 +33,7 @@ async function createApplicationFiles(host, options) {
|
|
|
33
33
|
styleContent: (0, create_application_files_helpers_1.createStyleRules)(),
|
|
34
34
|
pageStyleContent: `.page {}`,
|
|
35
35
|
stylesExt: 'css',
|
|
36
|
-
isUsingTsSolutionSetup: (0,
|
|
36
|
+
isUsingTsSolutionSetup: (0, internal_1.isUsingTsSolutionSetup)(host),
|
|
37
37
|
isNext16: await (0, version_utils_1.isNext16)(host),
|
|
38
38
|
};
|
|
39
39
|
const generatedAppFilePath = options.src
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeOptions = normalizeOptions;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
6
|
const assertion_1 = require("@nx/react/src/utils/assertion");
|
|
7
|
-
const
|
|
7
|
+
const internal_2 = require("@nx/js/internal");
|
|
8
8
|
async function normalizeOptions(host, options) {
|
|
9
|
-
await (0,
|
|
10
|
-
const { projectName, names: projectNames, projectRoot: appProjectRoot, importPath, } = await (0,
|
|
9
|
+
await (0, internal_1.ensureRootProjectName)(options, 'application');
|
|
10
|
+
const { projectName, names: projectNames, projectRoot: appProjectRoot, importPath, } = await (0, internal_1.determineProjectNameAndRootOptions)(host, {
|
|
11
11
|
name: options.name,
|
|
12
12
|
projectType: 'application',
|
|
13
13
|
directory: options.directory,
|
|
@@ -18,7 +18,7 @@ async function normalizeOptions(host, options) {
|
|
|
18
18
|
const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
19
19
|
nxJson.useInferencePlugins !== false;
|
|
20
20
|
options.addPlugin ??= addPlugin;
|
|
21
|
-
const isTsSolutionSetup = options.useTsSolution || (0,
|
|
21
|
+
const isTsSolutionSetup = options.useTsSolution || (0, internal_2.isUsingTsSolutionSetup)(host);
|
|
22
22
|
const appProjectName = !isTsSolutionSetup || options.name ? projectName : importPath;
|
|
23
23
|
const e2eProjectName = options.rootProject ? 'e2e' : `${appProjectName}-e2e`;
|
|
24
24
|
const e2eProjectRoot = options.rootProject ? 'e2e' : `${appProjectRoot}-e2e`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/generators/component/component.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/generators/component/component.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,IAAI,EACL,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAIjD,UAAU,MAAM;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,eAAe,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAMD,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,mDA0BnE;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.componentGenerator = componentGenerator;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
|
|
6
6
|
const react_1 = require("@nx/react");
|
|
7
7
|
const styles_1 = require("../../utils/styles");
|
|
8
8
|
/*
|
|
@@ -12,7 +12,7 @@ const styles_1 = require("../../utils/styles");
|
|
|
12
12
|
async function componentGenerator(host, options) {
|
|
13
13
|
// we only need to provide the path to get the project, we let the react
|
|
14
14
|
// generator handle the rest
|
|
15
|
-
const { project: projectName } = await (0,
|
|
15
|
+
const { project: projectName } = await (0, internal_1.determineArtifactNameAndDirectoryOptions)(host, {
|
|
16
16
|
path: options.path,
|
|
17
17
|
});
|
|
18
18
|
const componentInstall = await (0, react_1.componentGenerator)(host, {
|
|
@@ -2,15 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.convertToInferred = convertToInferred;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
6
|
-
const executor_to_plugin_migrator_1 = require("@nx/devkit/src/generators/plugin-migrations/executor-to-plugin-migrator");
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
7
6
|
const plugin_1 = require("../../plugins/plugin");
|
|
8
7
|
const build_post_target_transformer_1 = require("./lib/build-post-target-transformer");
|
|
9
8
|
const serve_post_target_tranformer_1 = require("./lib/serve-post-target-tranformer");
|
|
10
9
|
async function convertToInferred(tree, options) {
|
|
11
10
|
const projectGraph = await (0, devkit_1.createProjectGraphAsync)();
|
|
12
|
-
const migrationLogs = new
|
|
13
|
-
const migratedProjects = await (0,
|
|
11
|
+
const migrationLogs = new internal_1.AggregatedLog();
|
|
12
|
+
const migratedProjects = await (0, internal_1.migrateProjectExecutorsToPlugin)(tree, projectGraph, '@nx/next/plugin', plugin_1.createNodesV2, {
|
|
14
13
|
buildTargetName: 'build',
|
|
15
14
|
devTargetName: 'dev',
|
|
16
15
|
startTargetName: 'start',
|
|
@@ -32,7 +31,7 @@ async function convertToInferred(tree, options) {
|
|
|
32
31
|
},
|
|
33
32
|
], options.project);
|
|
34
33
|
if (migratedProjects.size === 0) {
|
|
35
|
-
throw new
|
|
34
|
+
throw new internal_1.NoTargetsToMigrateError();
|
|
36
35
|
}
|
|
37
36
|
if (!options.skipFormat) {
|
|
38
37
|
await (0, devkit_1.formatFiles)(tree);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TargetConfiguration, Tree } from '@nx/devkit';
|
|
2
|
-
import { AggregatedLog } from '@nx/devkit/
|
|
2
|
+
import { AggregatedLog } from '@nx/devkit/internal';
|
|
3
3
|
import { NextBuildBuilderOptions } from '../../../utils/types';
|
|
4
4
|
export declare function buildPostTargetTransformer(migrationLogs: AggregatedLog): (target: TargetConfiguration<NextBuildBuilderOptions>, tree: Tree, projectDetails: {
|
|
5
5
|
projectName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-post-target-transformer.d.ts","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/convert-to-inferred/lib/build-post-target-transformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,
|
|
1
|
+
{"version":3,"file":"build-post-target-transformer.d.ts","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/convert-to-inferred/lib/build-post-target-transformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EACL,aAAa,EAGd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAG/D,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,aAAa,IAEnE,QAAQ,mBAAmB,CAAC,uBAAuB,CAAC,EACpD,MAAM,IAAI,EACV,gBAAgB;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACrD,6BAA6B,mBAAmB,kDAgEnD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildPostTargetTransformer = buildPostTargetTransformer;
|
|
4
|
-
const
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
5
5
|
const update_next_config_1 = require("./update-next-config");
|
|
6
6
|
function buildPostTargetTransformer(migrationLogs) {
|
|
7
7
|
return (target, tree, projectDetails, inferredTargetConfiguration) => {
|
|
@@ -27,7 +27,7 @@ function buildPostTargetTransformer(migrationLogs) {
|
|
|
27
27
|
}
|
|
28
28
|
if (target.outputs) {
|
|
29
29
|
target.outputs = target.outputs.filter((out) => !out.includes('options.outputPath'));
|
|
30
|
-
(0,
|
|
30
|
+
(0, internal_1.processTargetOutputs)(target, [], inferredTargetConfiguration, {
|
|
31
31
|
projectName: projectDetails.projectName,
|
|
32
32
|
projectRoot: projectDetails.root,
|
|
33
33
|
});
|
|
@@ -61,8 +61,8 @@ function handlePropertiesFromTargetOptions(options, projectDetails, migrationLog
|
|
|
61
61
|
if ('fileReplacements' in options) {
|
|
62
62
|
configMap['fileReplacements'] = options.fileReplacements.map(({ replace: replacePath, with: withPath }) => {
|
|
63
63
|
return {
|
|
64
|
-
replace: (0,
|
|
65
|
-
with: (0,
|
|
64
|
+
replace: (0, internal_1.toProjectRelativePath)(replacePath, projectDetails.root),
|
|
65
|
+
with: (0, internal_1.toProjectRelativePath)(withPath, projectDetails.root),
|
|
66
66
|
};
|
|
67
67
|
});
|
|
68
68
|
delete options.fileReplacements;
|
|
@@ -74,8 +74,8 @@ function handlePropertiesFromTargetOptions(options, projectDetails, migrationLog
|
|
|
74
74
|
configMap['assets'] = options.assets.map((asset) => {
|
|
75
75
|
return {
|
|
76
76
|
...asset,
|
|
77
|
-
input: (0,
|
|
78
|
-
output: (0,
|
|
77
|
+
input: (0, internal_1.toProjectRelativePath)(asset.input, projectDetails.root),
|
|
78
|
+
output: (0, internal_1.toProjectRelativePath)(asset.output, projectDetails.root),
|
|
79
79
|
};
|
|
80
80
|
});
|
|
81
81
|
delete options.assets;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { TargetConfiguration, Tree } from '@nx/devkit';
|
|
2
|
-
import { AggregatedLog } from '@nx/devkit/
|
|
2
|
+
import { AggregatedLog, type InferredTargetConfiguration } from '@nx/devkit/internal';
|
|
3
3
|
import type { NextServeBuilderOptions } from '../../../utils/types';
|
|
4
|
-
import type { InferredTargetConfiguration } from '@nx/devkit/src/generators/plugin-migrations/executor-to-plugin-migrator';
|
|
5
4
|
export declare function servePosTargetTransformer(migrationLogs: AggregatedLog): (target: TargetConfiguration<NextServeBuilderOptions>, _tree: Tree, projectDetails: {
|
|
6
5
|
projectName: string;
|
|
7
6
|
root: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve-post-target-tranformer.d.ts","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/convert-to-inferred/lib/serve-post-target-tranformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,
|
|
1
|
+
{"version":3,"file":"serve-post-target-tranformer.d.ts","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/convert-to-inferred/lib/serve-post-target-tranformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EACL,aAAa,EACb,KAAK,2BAA2B,EACjC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEpE,wBAAgB,yBAAyB,CAAC,aAAa,EAAE,aAAa,IAElE,QAAQ,mBAAmB,CAAC,uBAAuB,CAAC,EACpD,OAAO,IAAI,EACX,gBAAgB;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACrD,6BAA6B,2BAA2B,kDAoC3D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
|
-
import { AggregatedLog } from '@nx/devkit/
|
|
2
|
+
import { AggregatedLog } from '@nx/devkit/internal';
|
|
3
3
|
export declare function updateNextConfig(tree: Tree, updatedConfigFileContents: string, project: {
|
|
4
4
|
projectName: string;
|
|
5
5
|
root: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-next-config.d.ts","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/convert-to-inferred/lib/update-next-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"update-next-config.d.ts","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/convert-to-inferred/lib/update-next-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAKpD,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,IAAI,EACV,yBAAyB,EAAE,MAAM,EACjC,OAAO,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAC9C,aAAa,EAAE,aAAa,QA6G7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-server.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/generators/custom-server/custom-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,IAAI,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"custom-server.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/generators/custom-server/custom-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,IAAI,EAAE,MAAM,YAAY,CAAC;AAYrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAK9C,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,kBAAkB,uBAgJ5B"}
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.customServerGenerator = customServerGenerator;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
5
6
|
const devkit_2 = require("@nx/devkit");
|
|
6
7
|
const path_1 = require("path");
|
|
7
8
|
const add_swc_to_custom_server_1 = require("../../utils/add-swc-to-custom-server");
|
|
8
|
-
const
|
|
9
|
+
const internal_2 = require("@nx/js/internal");
|
|
9
10
|
async function customServerGenerator(host, options) {
|
|
10
11
|
const project = (0, devkit_2.readProjectConfiguration)(host, options.project);
|
|
11
12
|
const swcServerName = '.server.swcrc';
|
|
@@ -39,7 +40,7 @@ async function customServerGenerator(host, options) {
|
|
|
39
40
|
? `../../${(0, devkit_2.offsetFromRoot)(project.root)}${project.root}`
|
|
40
41
|
: `${(0, devkit_2.offsetFromRoot)(`dist/${project.root}`)}${project.root}`;
|
|
41
42
|
const offset = (0, devkit_2.offsetFromRoot)(project.root);
|
|
42
|
-
const isTsSolution = (0,
|
|
43
|
+
const isTsSolution = (0, internal_2.isUsingTsSolutionSetup)(host);
|
|
43
44
|
(0, devkit_2.generateFiles)(host, (0, path_1.join)(__dirname, 'files'), project.root, {
|
|
44
45
|
...options,
|
|
45
46
|
hasPlugin,
|
|
@@ -101,11 +102,14 @@ async function customServerGenerator(host, options) {
|
|
|
101
102
|
json.tasksRunnerOptions?.default?.options?.cacheableOperations) {
|
|
102
103
|
json.tasksRunnerOptions.default.options.cacheableOperations.push('build-custom-server');
|
|
103
104
|
}
|
|
104
|
-
json.targetDefaults ??= {};
|
|
105
|
-
json.targetDefaults['build-custom-server'] ??= {};
|
|
106
|
-
json.targetDefaults['build-custom-server'].cache ??= true;
|
|
107
105
|
return json;
|
|
108
106
|
});
|
|
107
|
+
const updatedNxJson = (0, devkit_2.readNxJson)(host) ?? {};
|
|
108
|
+
(0, internal_1.upsertTargetDefault)(host, updatedNxJson, {
|
|
109
|
+
target: 'build-custom-server',
|
|
110
|
+
cache: true,
|
|
111
|
+
});
|
|
112
|
+
(0, devkit_2.updateNxJson)(host, updatedNxJson);
|
|
109
113
|
if (options.compiler === 'swc') {
|
|
110
114
|
// Update app swc to exlude server files
|
|
111
115
|
(0, devkit_2.updateJson)(host, (0, path_1.join)(project.root, '.swcrc'), (json) => {
|