@nx/remix 23.0.0-beta.2 → 23.0.0-beta.20
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/package.json +8 -8
- package/src/executors/build/build.impl.d.ts.map +1 -1
- package/src/executors/build/build.impl.js +10 -2
- package/src/executors/build/schema.json +1 -0
- package/src/executors/serve/schema.json +1 -0
- package/src/executors/serve/serve.impl.d.ts.map +1 -1
- package/src/executors/serve/serve.impl.js +4 -2
- package/src/generators/application/application.impl.d.ts.map +1 -1
- package/src/generators/application/application.impl.js +9 -11
- 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/ignore-vite-temp-files.js +2 -2
- package/src/generators/application/lib/normalize-options.js +5 -5
- 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 +2 -2
- package/src/generators/convert-to-inferred/lib/serve-post-target-transformer.d.ts +1 -1
- package/src/generators/convert-to-inferred/lib/serve-post-target-transformer.d.ts.map +1 -1
- package/src/generators/init/init.d.ts.map +1 -1
- package/src/generators/init/init.js +2 -2
- package/src/generators/library/lib/add-tsconfig-entry-points.js +2 -2
- package/src/generators/library/lib/normalize-options.js +5 -5
- package/src/generators/library/library.impl.js +5 -6
- package/src/generators/resource-route/resource-route.impl.js +2 -2
- package/src/generators/route/route.impl.d.ts.map +1 -1
- package/src/generators/route/route.impl.js +2 -3
- package/src/generators/style/style.impl.d.ts.map +1 -1
- package/src/generators/style/style.impl.js +2 -2
- package/src/plugins/plugin.d.ts.map +1 -1
- package/src/plugins/plugin.js +63 -33
- package/src/utils/deprecation.d.ts +5 -0
- package/src/utils/deprecation.d.ts.map +1 -0
- package/src/utils/deprecation.js +17 -0
- package/src/utils/testing-config-utils.js +5 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/remix",
|
|
3
|
-
"version": "23.0.0-beta.
|
|
3
|
+
"version": "23.0.0-beta.20",
|
|
4
4
|
"description": "The Remix plugin for Nx contains executors and generators for managing Remix applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Vitest, Jest, Playwright, Cypress, and Storybook.\n\n- Generators for applications, libraries, routes, loaders, and more.\n\n- Library build support for publishing packages to npm or other registries.\n\n- Utilities for automatic workspace refactoring.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,16 +30,16 @@
|
|
|
30
30
|
"migrations": "./migrations.json"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@nx/devkit": "23.0.0-beta.
|
|
34
|
-
"@nx/js": "23.0.0-beta.
|
|
35
|
-
"@nx/react": "23.0.0-beta.
|
|
36
|
-
"@nx/workspace": "23.0.0-beta.2",
|
|
33
|
+
"@nx/devkit": "23.0.0-beta.20",
|
|
34
|
+
"@nx/js": "23.0.0-beta.20",
|
|
35
|
+
"@nx/react": "23.0.0-beta.20",
|
|
37
36
|
"tslib": "^2.3.0",
|
|
38
|
-
"@phenomnomnominal/tsquery": "~6.
|
|
37
|
+
"@phenomnomnominal/tsquery": "~6.2.0"
|
|
39
38
|
},
|
|
40
39
|
"devDependencies": {
|
|
41
|
-
"nx": "23.0.0-beta.
|
|
42
|
-
"
|
|
40
|
+
"@nx/eslint": "23.0.0-beta.20",
|
|
41
|
+
"nx": "23.0.0-beta.20",
|
|
42
|
+
"@nx/vitest": "23.0.0-beta.20"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@remix-run/dev": "^2.17.3"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/remix/src/executors/build/build.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"build.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/remix/src/executors/build/build.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,YAAY,CAAC;AAMpB,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAgCjD,wBAA8B,aAAa,CACzC,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,eAAe;;GAiFzB"}
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.default = buildExecutor;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const js_1 = require("@nx/js");
|
|
6
|
-
const fileutils_1 = require("@nx/workspace/src/utilities/fileutils");
|
|
7
6
|
const child_process_1 = require("child_process");
|
|
8
7
|
const fs_extra_1 = require("fs-extra");
|
|
9
8
|
const path_1 = require("path");
|
|
9
|
+
const deprecation_1 = require("../../utils/deprecation");
|
|
10
10
|
function buildRemixBuildArgs(options) {
|
|
11
11
|
const args = ['build'];
|
|
12
12
|
if (options.sourcemap) {
|
|
@@ -32,6 +32,7 @@ async function runBuild(options, context) {
|
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
async function buildExecutor(options, context) {
|
|
35
|
+
(0, deprecation_1.warnRemixBuildExecutorDeprecation)();
|
|
35
36
|
const projectRoot = context.projectGraph.nodes[context.projectName].data.root;
|
|
36
37
|
try {
|
|
37
38
|
await runBuild(options, context);
|
|
@@ -40,7 +41,14 @@ async function buildExecutor(options, context) {
|
|
|
40
41
|
devkit_1.logger.error(`Error occurred while trying to build application. See above for more details.`);
|
|
41
42
|
return { success: false };
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
+
let outputIsDirectory = false;
|
|
45
|
+
try {
|
|
46
|
+
outputIsDirectory = (0, fs_extra_1.statSync)(options.outputPath).isDirectory();
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
// path does not exist; will be created below
|
|
50
|
+
}
|
|
51
|
+
if (!outputIsDirectory) {
|
|
44
52
|
(0, fs_extra_1.mkdir)(options.outputPath);
|
|
45
53
|
}
|
|
46
54
|
let packageJson;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"title": "Remix Build",
|
|
7
7
|
"description": "Build a Remix app.",
|
|
8
8
|
"type": "object",
|
|
9
|
+
"x-deprecated": "The `@nx/remix:build` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/remix:convert-to-inferred` to migrate to the `@nx/remix/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": "Remix Serve",
|
|
7
7
|
"description": "Serve a Remix app.",
|
|
8
8
|
"type": "object",
|
|
9
|
+
"x-deprecated": "The `@nx/remix:serve` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/remix:convert-to-inferred` to migrate to the `@nx/remix/plugin` inferred plugin. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.",
|
|
9
10
|
"properties": {
|
|
10
11
|
"port": {
|
|
11
12
|
"type": "number",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/remix/src/executors/serve/serve.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAKjE,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"serve.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/remix/src/executors/serve/serve.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAKjE,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AA0CjD,wBAA+B,aAAa,CAC1C,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,eAAe;aAgBc,OAAO;aAAW,MAAM;cAiC/D"}
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = serveExecutor;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
6
|
const wait_for_port_open_1 = require("@nx/web/src/utils/wait-for-port-open");
|
|
7
7
|
const node_child_process_1 = require("node:child_process");
|
|
8
8
|
const node_path_1 = require("node:path");
|
|
9
|
+
const deprecation_1 = require("../../utils/deprecation");
|
|
9
10
|
function normalizeOptions(schema) {
|
|
10
11
|
return {
|
|
11
12
|
...schema,
|
|
@@ -37,6 +38,7 @@ function buildRemixDevArgs(options) {
|
|
|
37
38
|
return args;
|
|
38
39
|
}
|
|
39
40
|
async function* serveExecutor(schema, context) {
|
|
41
|
+
(0, deprecation_1.warnRemixServeExecutorDeprecation)();
|
|
40
42
|
const options = normalizeOptions(schema);
|
|
41
43
|
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
42
44
|
const remixBin = require.resolve('@remix-run/dev/dist/cli');
|
|
@@ -46,7 +48,7 @@ async function* serveExecutor(schema, context) {
|
|
|
46
48
|
? process.env.NODE_ENV
|
|
47
49
|
: 'development';
|
|
48
50
|
process.env.PORT = `${options.port}`;
|
|
49
|
-
yield* (0,
|
|
51
|
+
yield* (0, internal_1.createAsyncIterable)(async ({ done, next, error }) => {
|
|
50
52
|
const server = (0, node_child_process_1.fork)(remixBin, ['dev', ...args], {
|
|
51
53
|
cwd: (0, node_path_1.join)(devkit_1.workspaceRoot, projectRoot),
|
|
52
54
|
stdio: 'inherit',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/application/application.impl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"application.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/application/application.impl.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,iBAAiB,EAMjB,IAAI,EAGL,MAAM,YAAY,CAAC;AA2BpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAOlD,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,sBAAsB,8BAOhC;AAED,wBAAsB,iCAAiC,CACrD,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,sBAAsB,8BA6SjC;AAED,eAAe,yBAAyB,CAAC"}
|
|
@@ -3,18 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.remixApplicationGenerator = remixApplicationGenerator;
|
|
4
4
|
exports.remixApplicationGeneratorInternal = remixApplicationGeneratorInternal;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
7
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
|
8
8
|
const js_1 = require("@nx/js");
|
|
9
|
-
const create_ts_config_1 = require("@nx/js/src/utils/typescript/create-ts-config");
|
|
10
9
|
const onboarding_1 = require("nx/src/nx-cloud/utilities/onboarding");
|
|
11
10
|
const testing_config_utils_1 = require("../../utils/testing-config-utils");
|
|
12
11
|
const versions_1 = require("../../utils/versions");
|
|
13
12
|
const init_1 = tslib_1.__importDefault(require("../init/init"));
|
|
14
13
|
const update_dependencies_1 = require("../utils/update-dependencies");
|
|
15
14
|
const lib_1 = require("./lib");
|
|
16
|
-
const
|
|
17
|
-
const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
|
15
|
+
const internal_2 = require("@nx/js/internal");
|
|
18
16
|
function remixApplicationGenerator(tree, options) {
|
|
19
17
|
return remixApplicationGeneratorInternal(tree, {
|
|
20
18
|
addPlugin: true,
|
|
@@ -23,7 +21,7 @@ function remixApplicationGenerator(tree, options) {
|
|
|
23
21
|
});
|
|
24
22
|
}
|
|
25
23
|
async function remixApplicationGeneratorInternal(tree, _options) {
|
|
26
|
-
const addTsPlugin = (0,
|
|
24
|
+
const addTsPlugin = (0, internal_2.shouldConfigureTsSolutionSetup)(tree, _options.addPlugin, _options.useTsSolution);
|
|
27
25
|
const tasks = [
|
|
28
26
|
await (0, init_1.default)(tree, {
|
|
29
27
|
skipFormat: true,
|
|
@@ -43,7 +41,7 @@ async function remixApplicationGeneratorInternal(tree, _options) {
|
|
|
43
41
|
// If we are using the new TS solution
|
|
44
42
|
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
45
43
|
if (options.isUsingTsSolutionConfig) {
|
|
46
|
-
await (0,
|
|
44
|
+
await (0, internal_2.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
|
|
47
45
|
}
|
|
48
46
|
if (options.useProjectJson) {
|
|
49
47
|
(0, devkit_1.addProjectConfiguration)(tree, options.projectName, {
|
|
@@ -151,7 +149,7 @@ async function remixApplicationGeneratorInternal(tree, _options) {
|
|
|
151
149
|
}
|
|
152
150
|
if (options.linter !== 'none') {
|
|
153
151
|
const { lintProjectGenerator } = (0, devkit_1.ensurePackage)('@nx/eslint', versions_1.nxVersion);
|
|
154
|
-
const { addIgnoresToLintConfig } = await Promise.resolve().then(() => tslib_1.__importStar(require('@nx/eslint/
|
|
152
|
+
const { addIgnoresToLintConfig } = await Promise.resolve().then(() => tslib_1.__importStar(require('@nx/eslint/internal')));
|
|
155
153
|
const eslintTask = await lintProjectGenerator(tree, {
|
|
156
154
|
linter: options.linter,
|
|
157
155
|
project: options.projectName,
|
|
@@ -197,7 +195,7 @@ async function remixApplicationGeneratorInternal(tree, _options) {
|
|
|
197
195
|
}
|
|
198
196
|
else {
|
|
199
197
|
// Otherwise, extract the tsconfig.base.json from tsconfig.json so we can share settings.
|
|
200
|
-
(0,
|
|
198
|
+
(0, js_1.extractTsConfigBase)(tree);
|
|
201
199
|
}
|
|
202
200
|
if (options.rootProject) {
|
|
203
201
|
(0, devkit_1.updateJson)(tree, `package.json`, (json) => {
|
|
@@ -213,19 +211,19 @@ export default {...nxPreset};
|
|
|
213
211
|
}
|
|
214
212
|
tasks.push(await (0, lib_1.addE2E)(tree, options));
|
|
215
213
|
await (0, lib_1.ignoreViteTempFiles)(tree, options.projectRoot);
|
|
216
|
-
(0,
|
|
214
|
+
(0, internal_2.updateTsconfigFiles)(tree, options.projectRoot, 'tsconfig.app.json', {
|
|
217
215
|
jsx: 'react-jsx',
|
|
218
216
|
module: 'esnext',
|
|
219
217
|
moduleResolution: 'bundler',
|
|
220
218
|
}, options.linter === 'eslint'
|
|
221
219
|
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
222
220
|
: undefined, '.');
|
|
223
|
-
(0,
|
|
221
|
+
(0, internal_2.sortPackageJsonFields)(tree, options.projectRoot);
|
|
224
222
|
if (!options.skipFormat) {
|
|
225
223
|
await (0, devkit_1.formatFiles)(tree);
|
|
226
224
|
}
|
|
227
225
|
tasks.push(() => {
|
|
228
|
-
(0,
|
|
226
|
+
(0, internal_1.logShowProjectCommand)(options.projectName);
|
|
229
227
|
});
|
|
230
228
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
231
229
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-e2e.d.ts","sourceRoot":"","sources":["../../../../../../../packages/remix/src/generators/application/lib/add-e2e.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-e2e.d.ts","sourceRoot":"","sources":["../../../../../../../packages/remix/src/generators/application/lib/add-e2e.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,IAAI,EAIT,iBAAiB,EAGlB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAI5D,wBAAsB,MAAM,CAC1B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CAoH5B"}
|
|
@@ -1,9 +1,9 @@
|
|
|
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
6
|
const versions_1 = require("../../../utils/versions");
|
|
6
|
-
const e2e_web_server_info_utils_1 = require("@nx/devkit/src/generators/e2e-web-server-info-utils");
|
|
7
7
|
async function addE2E(tree, options) {
|
|
8
8
|
const hasRemixPlugin = (0, devkit_1.readNxJson)(tree).plugins?.find((p) => typeof p === 'string'
|
|
9
9
|
? p === '@nx/remix/plugin'
|
|
@@ -98,11 +98,11 @@ async function getRemixE2EWebServerInfo(tree, projectName, configFilePath, isPlu
|
|
|
98
98
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
99
99
|
let e2ePort = isPluginBeingAdded ? 3000 : 4200;
|
|
100
100
|
const defaultServeTarget = isPluginBeingAdded ? 'dev' : 'serve';
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
e2ePort =
|
|
101
|
+
const serveTargetOptions = (0, internal_1.readTargetDefaultsForTarget)(defaultServeTarget, nxJson.targetDefaults)?.options;
|
|
102
|
+
if (serveTargetOptions?.port) {
|
|
103
|
+
e2ePort = serveTargetOptions.port;
|
|
104
104
|
}
|
|
105
|
-
return (0,
|
|
105
|
+
return (0, internal_1.getE2EWebServerInfo)(tree, projectName, {
|
|
106
106
|
plugin: '@nx/remix/plugin',
|
|
107
107
|
serveTargetName: 'serveTargetName',
|
|
108
108
|
serveStaticTargetName: 'serveStaticTargetName',
|
|
@@ -60,11 +60,11 @@ async function ignoreViteTempFilesInEslintConfig(tree, projectRoot) {
|
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
(0, devkit_1.ensurePackage)('@nx/eslint', versions_1.nxVersion);
|
|
63
|
-
const { addIgnoresToLintConfig, isEslintConfigSupported } = await Promise.resolve().then(() => __importStar(require('@nx/eslint/
|
|
63
|
+
const { addIgnoresToLintConfig, isEslintConfigSupported } = await Promise.resolve().then(() => __importStar(require('@nx/eslint/internal')));
|
|
64
64
|
if (!isEslintConfigSupported(tree)) {
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
-
const { useFlatConfig } = await Promise.resolve().then(() => __importStar(require('@nx/eslint/
|
|
67
|
+
const { useFlatConfig } = await Promise.resolve().then(() => __importStar(require('@nx/eslint/internal')));
|
|
68
68
|
const isUsingFlatConfig = useFlatConfig(tree);
|
|
69
69
|
if (!projectRoot && !isUsingFlatConfig) {
|
|
70
70
|
// root eslintrc files ignore all files and the root eslintrc files add
|
|
@@ -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(tree, options) {
|
|
8
|
-
await (0,
|
|
9
|
-
const { projectName, projectRoot, importPath } = await (0,
|
|
8
|
+
await (0, internal_1.ensureRootProjectName)(options, 'application');
|
|
9
|
+
const { projectName, projectRoot, importPath } = await (0, internal_1.determineProjectNameAndRootOptions)(tree, {
|
|
10
10
|
name: options.name,
|
|
11
11
|
projectType: 'application',
|
|
12
12
|
directory: options.directory,
|
|
@@ -17,7 +17,7 @@ async function normalizeOptions(tree, options) {
|
|
|
17
17
|
const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
18
18
|
nxJson.useInferencePlugins !== false;
|
|
19
19
|
options.addPlugin ??= addPluginDefault;
|
|
20
|
-
const isUsingTsSolutionConfig = (0,
|
|
20
|
+
const isUsingTsSolutionConfig = (0, internal_2.isUsingTsSolutionSetup)(tree);
|
|
21
21
|
const appProjectName = !isUsingTsSolutionConfig || options.name ? projectName : importPath;
|
|
22
22
|
const e2eProjectName = options.rootProject ? 'e2e' : `${appProjectName}-e2e`;
|
|
23
23
|
const e2eProjectRoot = options.rootProject ? 'e2e' : `${projectRoot}-e2e`;
|
|
@@ -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_transformer_1 = require("./lib/serve-post-target-transformer");
|
|
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/remix/plugin', plugin_1.createNodesV2, {
|
|
14
13
|
buildTargetName: 'build',
|
|
15
14
|
devTargetName: 'dev',
|
|
16
15
|
startTargetName: 'start',
|
|
@@ -33,7 +32,7 @@ async function convertToInferred(tree, options) {
|
|
|
33
32
|
},
|
|
34
33
|
], options.project);
|
|
35
34
|
if (migratedProjects.size === 0) {
|
|
36
|
-
throw new
|
|
35
|
+
throw new internal_1.NoTargetsToMigrateError();
|
|
37
36
|
}
|
|
38
37
|
if (!options.skipFormat) {
|
|
39
38
|
await (0, devkit_1.formatFiles)(tree);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Tree, type TargetConfiguration } from '@nx/devkit';
|
|
2
|
-
import { AggregatedLog } from '@nx/devkit/
|
|
2
|
+
import { AggregatedLog } from '@nx/devkit/internal';
|
|
3
3
|
export declare function buildPostTargetTransformer(migrationLogs: AggregatedLog): (target: TargetConfiguration, tree: Tree, projectDetails: {
|
|
4
4
|
projectName: string;
|
|
5
5
|
root: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-post-target-transformer.d.ts","sourceRoot":"","sources":["../../../../../../../packages/remix/src/generators/convert-to-inferred/lib/build-post-target-transformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"build-post-target-transformer.d.ts","sourceRoot":"","sources":["../../../../../../../packages/remix/src/generators/convert-to-inferred/lib/build-post-target-transformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,aAAa,EAAwB,MAAM,qBAAqB,CAAC;AAG1E,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,aAAa,IAEnE,QAAQ,mBAAmB,EAC3B,MAAM,IAAI,EACV,gBAAgB;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACrD,6BAA6B,mBAAmB,8BAqDnD"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildPostTargetTransformer = buildPostTargetTransformer;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
4
5
|
const utils_1 = require("./utils");
|
|
5
|
-
const plugin_migration_utils_1 = require("@nx/devkit/src/generators/plugin-migrations/plugin-migration-utils");
|
|
6
6
|
function buildPostTargetTransformer(migrationLogs) {
|
|
7
7
|
return (target, tree, projectDetails, inferredTargetConfiguration) => {
|
|
8
8
|
const remixConfigPath = (0, utils_1.getConfigFilePath)(tree, projectDetails.root);
|
|
@@ -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
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Tree, type TargetConfiguration } from '@nx/devkit';
|
|
2
|
-
import { AggregatedLog } from '@nx/devkit/
|
|
2
|
+
import { AggregatedLog } from '@nx/devkit/internal';
|
|
3
3
|
export declare function servePostTargetTransformer(migrationLogs: AggregatedLog): (target: TargetConfiguration, tree: Tree, projectDetails: {
|
|
4
4
|
projectName: string;
|
|
5
5
|
root: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve-post-target-transformer.d.ts","sourceRoot":"","sources":["../../../../../../../packages/remix/src/generators/convert-to-inferred/lib/serve-post-target-transformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"serve-post-target-transformer.d.ts","sourceRoot":"","sources":["../../../../../../../packages/remix/src/generators/convert-to-inferred/lib/serve-post-target-transformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,aAAa,IAEnE,QAAQ,mBAAmB,EAC3B,MAAM,IAAI,EACV,gBAAgB;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACrD,6BAA6B,mBAAmB,8BAwCnD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/init/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/init/init.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,iBAAiB,EAGjB,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,8BAE7D;AAED,wBAAsB,0BAA0B,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,8BAgE3E;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.remixInitGenerator = remixInitGenerator;
|
|
4
4
|
exports.remixInitGeneratorInternal = remixInitGeneratorInternal;
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
5
6
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
|
|
7
7
|
const plugin_1 = require("../../plugins/plugin");
|
|
8
8
|
const versions_1 = require("../../utils/versions");
|
|
9
9
|
function remixInitGenerator(tree, options) {
|
|
@@ -25,7 +25,7 @@ async function remixInitGeneratorInternal(tree, options) {
|
|
|
25
25
|
nxJson.useInferencePlugins !== false;
|
|
26
26
|
options.addPlugin ??= addPluginDefault;
|
|
27
27
|
if (options.addPlugin) {
|
|
28
|
-
await (0,
|
|
28
|
+
await (0, internal_1.addPlugin)(tree, await (0, devkit_1.createProjectGraphAsync)(), '@nx/remix/plugin', plugin_1.createNodesV2, {
|
|
29
29
|
startTargetName: ['start', 'remix:start', 'remix-start'],
|
|
30
30
|
buildTargetName: ['build', 'remix:build', 'remix-build'],
|
|
31
31
|
devTargetName: ['dev', 'remix:dev', 'remix-dev'],
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.addTsconfigEntryPoints = addTsconfigEntryPoints;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const js_1 = require("@nx/js");
|
|
6
|
-
const
|
|
6
|
+
const internal_1 = require("@nx/js/internal");
|
|
7
7
|
function addTsconfigEntryPoints(tree, options) {
|
|
8
8
|
const project = (0, devkit_1.readProjectConfiguration)(tree, options.projectName);
|
|
9
|
-
const projectSourceRoot = (0,
|
|
9
|
+
const projectSourceRoot = (0, internal_1.getProjectSourceRoot)(project, tree);
|
|
10
10
|
const serverFilePath = (0, devkit_1.joinPathFragments)(projectSourceRoot, 'server.ts');
|
|
11
11
|
tree.write(serverFilePath, `// This file should be used to export ONLY server-code from the library.`);
|
|
12
12
|
const baseTsConfig = (0, js_1.getRootTsConfigPathInTree)(tree);
|
|
@@ -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(tree, options) {
|
|
8
|
-
await (0,
|
|
9
|
-
const { projectName, projectRoot, importPath } = await (0,
|
|
8
|
+
await (0, internal_1.ensureRootProjectName)(options, 'application');
|
|
9
|
+
const { projectName, projectRoot, importPath } = await (0, internal_1.determineProjectNameAndRootOptions)(tree, {
|
|
10
10
|
name: options.name,
|
|
11
11
|
projectType: 'library',
|
|
12
12
|
directory: options.directory,
|
|
@@ -15,7 +15,7 @@ async function normalizeOptions(tree, options) {
|
|
|
15
15
|
const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
16
16
|
nxJson.useInferencePlugins !== false;
|
|
17
17
|
options.addPlugin ??= addPluginDefault;
|
|
18
|
-
const isUsingTsSolutionConfig = (0,
|
|
18
|
+
const isUsingTsSolutionConfig = (0, internal_2.isUsingTsSolutionSetup)(tree);
|
|
19
19
|
return {
|
|
20
20
|
...options,
|
|
21
21
|
unitTestRunner: options.unitTestRunner ?? 'vitest',
|
|
@@ -6,8 +6,7 @@ const devkit_1 = require("@nx/devkit");
|
|
|
6
6
|
const js_1 = require("@nx/js");
|
|
7
7
|
const react_1 = require("@nx/react");
|
|
8
8
|
const lib_1 = require("./lib");
|
|
9
|
-
const
|
|
10
|
-
const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
|
9
|
+
const internal_1 = require("@nx/js/internal");
|
|
11
10
|
const update_dependencies_1 = require("../utils/update-dependencies");
|
|
12
11
|
async function remixLibraryGenerator(tree, schema) {
|
|
13
12
|
return remixLibraryGeneratorInternal(tree, {
|
|
@@ -18,7 +17,7 @@ async function remixLibraryGenerator(tree, schema) {
|
|
|
18
17
|
}
|
|
19
18
|
async function remixLibraryGeneratorInternal(tree, schema) {
|
|
20
19
|
const tasks = [];
|
|
21
|
-
const addTsPlugin = (0,
|
|
20
|
+
const addTsPlugin = (0, internal_1.shouldConfigureTsSolutionSetup)(tree, schema.addPlugin);
|
|
22
21
|
const installTask = (0, update_dependencies_1.updateDependencies)(tree);
|
|
23
22
|
tasks.push(installTask);
|
|
24
23
|
const jsInitTask = await (0, js_1.initGenerator)(tree, {
|
|
@@ -29,7 +28,7 @@ async function remixLibraryGeneratorInternal(tree, schema) {
|
|
|
29
28
|
tasks.push(jsInitTask);
|
|
30
29
|
const options = await (0, lib_1.normalizeOptions)(tree, schema);
|
|
31
30
|
if (options.isUsingTsSolutionConfig) {
|
|
32
|
-
await (0,
|
|
31
|
+
await (0, internal_1.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
|
|
33
32
|
}
|
|
34
33
|
const libGenTask = await (0, react_1.libraryGenerator)(tree, {
|
|
35
34
|
directory: options.directory,
|
|
@@ -56,14 +55,14 @@ async function remixLibraryGeneratorInternal(tree, schema) {
|
|
|
56
55
|
if (options.bundler === 'rollup' || options.buildable) {
|
|
57
56
|
(0, lib_1.updateBuildableConfig)(tree, options);
|
|
58
57
|
}
|
|
59
|
-
(0,
|
|
58
|
+
(0, internal_1.updateTsconfigFiles)(tree, options.projectRoot, 'tsconfig.lib.json', {
|
|
60
59
|
jsx: 'react-jsx',
|
|
61
60
|
module: 'esnext',
|
|
62
61
|
moduleResolution: 'bundler',
|
|
63
62
|
}, options.linter === 'eslint'
|
|
64
63
|
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
65
64
|
: undefined);
|
|
66
|
-
(0,
|
|
65
|
+
(0, internal_1.sortPackageJsonFields)(tree, options.projectRoot);
|
|
67
66
|
if (!options.skipFormat) {
|
|
68
67
|
await (0, devkit_1.formatFiles)(tree);
|
|
69
68
|
}
|
|
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.default = default_1;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
7
7
|
const remix_route_utils_1 = require("../../utils/remix-route-utils");
|
|
8
8
|
const action_impl_1 = tslib_1.__importDefault(require("../action/action.impl"));
|
|
9
9
|
const loader_impl_1 = tslib_1.__importDefault(require("../loader/loader.impl"));
|
|
10
10
|
async function default_1(tree, options) {
|
|
11
|
-
const { filePath: routeFilePath } = await (0,
|
|
11
|
+
const { filePath: routeFilePath } = await (0, internal_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
12
12
|
path: options.path.replace(/^\//, '').replace(/\/$/, ''),
|
|
13
13
|
allowedFileExtensions: ['ts', 'tsx'],
|
|
14
14
|
fileExtension: 'tsx',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/route/route.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,IAAI,EAAE,MAAM,YAAY,CAAC;AAQpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,yBAA+B,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"route.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/route/route.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,IAAI,EAAE,MAAM,YAAY,CAAC;AAQpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,yBAA+B,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,iBAkEnE"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.default = default_1;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
7
7
|
const path_1 = require("path");
|
|
8
8
|
const remix_route_utils_1 = require("../../utils/remix-route-utils");
|
|
9
9
|
const action_impl_1 = tslib_1.__importDefault(require("../action/action.impl"));
|
|
@@ -11,7 +11,7 @@ const loader_impl_1 = tslib_1.__importDefault(require("../loader/loader.impl"));
|
|
|
11
11
|
const meta_impl_1 = tslib_1.__importDefault(require("../meta/meta.impl"));
|
|
12
12
|
const style_impl_1 = tslib_1.__importDefault(require("../style/style.impl"));
|
|
13
13
|
async function default_1(tree, options) {
|
|
14
|
-
const { artifactName: name, filePath: routeFilePath } = await (0,
|
|
14
|
+
const { artifactName: name, filePath: routeFilePath } = await (0, internal_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
15
15
|
path: options.path.replace(/^\//, '').replace(/\/$/, ''),
|
|
16
16
|
allowedFileExtensions: ['ts', 'tsx'],
|
|
17
17
|
fileExtension: 'tsx',
|
|
@@ -24,7 +24,6 @@ async function default_1(tree, options) {
|
|
|
24
24
|
throw new Error(`Path already exists: ${routeFilePath}`);
|
|
25
25
|
tree.write(routeFilePath, (0, devkit_1.stripIndents) `
|
|
26
26
|
|
|
27
|
-
|
|
28
27
|
export default function ${componentName}() {
|
|
29
28
|
${options.loader
|
|
30
29
|
? `
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/style/style.impl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"style.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/style/style.impl.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,IAAI,EACL,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAU5C,yBAA+B,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,iBAoEnE"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = default_1;
|
|
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 path_1 = require("path");
|
|
7
7
|
const insert_import_1 = require("../../utils/insert-import");
|
|
8
8
|
const insert_statement_after_imports_1 = require("../../utils/insert-statement-after-imports");
|
|
9
9
|
const remix_route_utils_1 = require("../../utils/remix-route-utils");
|
|
10
10
|
async function default_1(tree, options) {
|
|
11
|
-
const { project: projectName, directory, fileName, } = await (0,
|
|
11
|
+
const { project: projectName, directory, fileName, } = await (0, internal_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
12
12
|
path: options.path,
|
|
13
13
|
});
|
|
14
14
|
const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/remix/src/plugins/plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/remix/src/plugins/plugin.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,KAAK,kBAAkB,EAIvB,aAAa,EAOd,MAAM,YAAY,CAAC;AAUpB,MAAM,WAAW,kBAAkB;IACjC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAID;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAIF,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,kBAAkB,CA+DzD,CAAC;AAEF,eAAO,MAAM,aAAa,mCAAc,CAAC"}
|
package/src/plugins/plugin.js
CHANGED
|
@@ -1,24 +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 cache_directory_1 = require("nx/src/utils/cache-directory");
|
|
5
6
|
const file_hasher_1 = require("nx/src/hasher/file-hasher");
|
|
6
7
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
|
|
8
|
-
const get_named_inputs_1 = require("@nx/devkit/src/utils/get-named-inputs");
|
|
9
|
-
const config_utils_1 = require("@nx/devkit/src/utils/config-utils");
|
|
10
8
|
const js_1 = require("@nx/js");
|
|
11
9
|
const path_1 = require("path");
|
|
12
10
|
const fs_1 = require("fs");
|
|
13
11
|
const executor_utils_1 = require("../utils/executor-utils");
|
|
14
|
-
const
|
|
15
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
16
|
-
function readTargetsCache(cachePath) {
|
|
17
|
-
return (0, fs_1.existsSync)(cachePath) ? (0, devkit_1.readJsonFile)(cachePath) : {};
|
|
18
|
-
}
|
|
19
|
-
function writeTargetsToCache(cachePath, results) {
|
|
20
|
-
(0, devkit_1.writeJsonFile)(cachePath, results);
|
|
21
|
-
}
|
|
12
|
+
const internal_2 = require("@nx/js/internal");
|
|
22
13
|
/**
|
|
23
14
|
* @deprecated The 'createDependencies' function is now a no-op. This functionality is included in 'createNodesV2'.
|
|
24
15
|
*/
|
|
@@ -32,34 +23,47 @@ exports.createNodes = [
|
|
|
32
23
|
async (configFilePaths, options, context) => {
|
|
33
24
|
const optionsHash = (0, file_hasher_1.hashObject)(options);
|
|
34
25
|
const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `remix-${optionsHash}.hash`);
|
|
35
|
-
const targetsCache =
|
|
36
|
-
const
|
|
26
|
+
const targetsCache = new internal_1.PluginCache(cachePath);
|
|
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 isUsingTsSolutionSetup = (0, internal_2.isUsingTsSolutionSetup)();
|
|
31
|
+
const normalizedOptions = normalizeOptions(options);
|
|
37
32
|
try {
|
|
38
|
-
|
|
33
|
+
const { entries, preErrors } = await filterRemixConfigs(configFilePaths, context);
|
|
34
|
+
const projectHashes = await (0, internal_1.calculateHashesForCreateNodes)(entries.map((e) => e.projectRoot), { ...normalizedOptions, isUsingTsSolutionSetup }, context, entries.map(() => [lockFileName]));
|
|
35
|
+
let results = [];
|
|
36
|
+
let nodeErrors = [];
|
|
37
|
+
try {
|
|
38
|
+
results = await (0, devkit_1.createNodesFromFiles)((configFile, _, ctx, idx) => createNodesInternal(configFile, normalizedOptions, ctx, targetsCache, isUsingTsSolutionSetup, pmc, entries[idx].siblingFiles, entries[idx].remixCompiler, projectHashes[idx] + configFile), entries.map((e) => e.configFile), options, context);
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
if (e instanceof devkit_1.AggregateCreateNodesError) {
|
|
42
|
+
results = e.partialResults ?? [];
|
|
43
|
+
nodeErrors = e.errors;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
throw e;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const allErrors = [...preErrors, ...nodeErrors];
|
|
50
|
+
if (allErrors.length > 0) {
|
|
51
|
+
throw new devkit_1.AggregateCreateNodesError(allErrors, results);
|
|
52
|
+
}
|
|
53
|
+
return results;
|
|
39
54
|
}
|
|
40
55
|
finally {
|
|
41
|
-
|
|
56
|
+
targetsCache.writeToDisk();
|
|
42
57
|
}
|
|
43
58
|
},
|
|
44
59
|
];
|
|
45
60
|
exports.createNodesV2 = exports.createNodes;
|
|
46
|
-
async function createNodesInternal(configFilePath, options, context, targetsCache, isUsingTsSolutionSetup, pmc) {
|
|
61
|
+
async function createNodesInternal(configFilePath, options, context, targetsCache, isUsingTsSolutionSetup, pmc, siblingFiles, remixCompiler, hash) {
|
|
47
62
|
const projectRoot = (0, path_1.dirname)(configFilePath);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const siblingFiles = (0, fs_1.readdirSync)(fullyQualifiedProjectRoot);
|
|
51
|
-
if (!siblingFiles.includes('package.json') &&
|
|
52
|
-
!siblingFiles.includes('project.json')) {
|
|
53
|
-
return {};
|
|
54
|
-
}
|
|
55
|
-
options = normalizeOptions(options);
|
|
56
|
-
const remixCompiler = determineIsRemixVite(configFilePath, context.workspaceRoot);
|
|
57
|
-
if (remixCompiler === RemixCompiler.IsNotRemix) {
|
|
58
|
-
return {};
|
|
63
|
+
if (!targetsCache.has(hash)) {
|
|
64
|
+
targetsCache.set(hash, await buildRemixTargets(configFilePath, projectRoot, options, context, siblingFiles, remixCompiler, isUsingTsSolutionSetup, pmc));
|
|
59
65
|
}
|
|
60
|
-
const
|
|
61
|
-
targetsCache[hash] ??= await buildRemixTargets(configFilePath, projectRoot, options, context, siblingFiles, remixCompiler, isUsingTsSolutionSetup, pmc);
|
|
62
|
-
const { targets, metadata } = targetsCache[hash];
|
|
66
|
+
const { targets, metadata } = targetsCache.get(hash);
|
|
63
67
|
const project = {
|
|
64
68
|
root: projectRoot,
|
|
65
69
|
targets,
|
|
@@ -72,7 +76,7 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
|
|
|
72
76
|
};
|
|
73
77
|
}
|
|
74
78
|
async function buildRemixTargets(configFilePath, projectRoot, options, context, siblingFiles, remixCompiler, isUsingTsSolutionSetup, pmc) {
|
|
75
|
-
const namedInputs = (0,
|
|
79
|
+
const namedInputs = (0, internal_1.getNamedInputs)(projectRoot, context);
|
|
76
80
|
const { buildDirectory, assetsBuildDirectory, serverBuildPath } = await getBuildPaths(configFilePath, projectRoot, context.workspaceRoot, remixCompiler);
|
|
77
81
|
const targets = {};
|
|
78
82
|
targets[options.buildTargetName] = buildTarget(options.buildTargetName, projectRoot, buildDirectory, assetsBuildDirectory, namedInputs, remixCompiler, isUsingTsSolutionSetup);
|
|
@@ -80,7 +84,7 @@ async function buildRemixTargets(configFilePath, projectRoot, options, context,
|
|
|
80
84
|
targets[options.startTargetName] = startTarget(projectRoot, serverBuildPath, options.buildTargetName, remixCompiler, isUsingTsSolutionSetup);
|
|
81
85
|
targets[options.serveStaticTargetName] = startTarget(projectRoot, serverBuildPath, options.buildTargetName, remixCompiler, isUsingTsSolutionSetup);
|
|
82
86
|
targets[options.typecheckTargetName] = typecheckTarget(options.typecheckTargetName, projectRoot, namedInputs, siblingFiles, isUsingTsSolutionSetup, pmc);
|
|
83
|
-
(0,
|
|
87
|
+
(0, internal_2.addBuildAndWatchDepsTargets)(context.workspaceRoot, projectRoot, targets, options, pmc);
|
|
84
88
|
return { targets, metadata: {} };
|
|
85
89
|
}
|
|
86
90
|
function buildTarget(buildTargetName, projectRoot, buildDirectory, assetsBuildDirectory, namedInputs, remixCompiler, isUsingTsSolutionSetup) {
|
|
@@ -188,7 +192,7 @@ function typecheckTarget(typecheckTargetName, projectRoot, namedInputs, siblingF
|
|
|
188
192
|
async function getBuildPaths(configFilePath, projectRoot, workspaceRoot, remixCompiler) {
|
|
189
193
|
const configPath = (0, path_1.join)(workspaceRoot, configFilePath);
|
|
190
194
|
if (remixCompiler === RemixCompiler.IsClassic) {
|
|
191
|
-
let appConfig = await (0,
|
|
195
|
+
let appConfig = await (0, internal_1.loadConfigFile)(configPath);
|
|
192
196
|
return {
|
|
193
197
|
buildDirectory: 'build',
|
|
194
198
|
serverBuildPath: appConfig.serverBuildPath ?? 'build/index.js',
|
|
@@ -250,3 +254,29 @@ var RemixCompiler;
|
|
|
250
254
|
RemixCompiler[RemixCompiler["IsVte"] = 2] = "IsVte";
|
|
251
255
|
RemixCompiler[RemixCompiler["IsNotRemix"] = 3] = "IsNotRemix";
|
|
252
256
|
})(RemixCompiler || (RemixCompiler = {}));
|
|
257
|
+
async function filterRemixConfigs(configFilePaths, context) {
|
|
258
|
+
const preErrors = [];
|
|
259
|
+
const candidates = await Promise.all(configFilePaths.map(async (configFile) => {
|
|
260
|
+
try {
|
|
261
|
+
const projectRoot = (0, path_1.dirname)(configFile);
|
|
262
|
+
const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
|
|
263
|
+
if (!siblingFiles.includes('package.json') &&
|
|
264
|
+
!siblingFiles.includes('project.json')) {
|
|
265
|
+
return null;
|
|
266
|
+
}
|
|
267
|
+
const remixCompiler = determineIsRemixVite(configFile, context.workspaceRoot);
|
|
268
|
+
if (remixCompiler === RemixCompiler.IsNotRemix) {
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
271
|
+
return { configFile, projectRoot, siblingFiles, remixCompiler };
|
|
272
|
+
}
|
|
273
|
+
catch (e) {
|
|
274
|
+
preErrors.push([configFile, e]);
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
}));
|
|
278
|
+
return {
|
|
279
|
+
entries: candidates.filter((c) => c !== null),
|
|
280
|
+
preErrors,
|
|
281
|
+
};
|
|
282
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const REMIX_BUILD_EXECUTOR_DEPRECATION_MESSAGE = "The `@nx/remix:build` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/remix:convert-to-inferred` to migrate to the `@nx/remix/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.";
|
|
2
|
+
export declare const REMIX_SERVE_EXECUTOR_DEPRECATION_MESSAGE = "The `@nx/remix:serve` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/remix:convert-to-inferred` to migrate to the `@nx/remix/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.";
|
|
3
|
+
export declare function warnRemixBuildExecutorDeprecation(): void;
|
|
4
|
+
export declare function warnRemixServeExecutorDeprecation(): void;
|
|
5
|
+
//# sourceMappingURL=deprecation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deprecation.d.ts","sourceRoot":"","sources":["../../../../../packages/remix/src/utils/deprecation.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,wCAAwC,+PACyM,CAAC;AAE/P,eAAO,MAAM,wCAAwC,+PACyM,CAAC;AAE/P,wBAAgB,iCAAiC,IAAI,IAAI,CAExD;AAED,wBAAgB,iCAAiC,IAAI,IAAI,CAExD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.REMIX_SERVE_EXECUTOR_DEPRECATION_MESSAGE = exports.REMIX_BUILD_EXECUTOR_DEPRECATION_MESSAGE = void 0;
|
|
4
|
+
exports.warnRemixBuildExecutorDeprecation = warnRemixBuildExecutorDeprecation;
|
|
5
|
+
exports.warnRemixServeExecutorDeprecation = warnRemixServeExecutorDeprecation;
|
|
6
|
+
const devkit_1 = require("@nx/devkit");
|
|
7
|
+
// TODO(v24): Remove the @nx/remix:build and @nx/remix:serve executors. The
|
|
8
|
+
// inferred plugin (@nx/remix/plugin) and the convert-to-inferred generator
|
|
9
|
+
// stay supported.
|
|
10
|
+
exports.REMIX_BUILD_EXECUTOR_DEPRECATION_MESSAGE = 'The `@nx/remix:build` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/remix:convert-to-inferred` to migrate to the `@nx/remix/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.';
|
|
11
|
+
exports.REMIX_SERVE_EXECUTOR_DEPRECATION_MESSAGE = 'The `@nx/remix:serve` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/remix:convert-to-inferred` to migrate to the `@nx/remix/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.';
|
|
12
|
+
function warnRemixBuildExecutorDeprecation() {
|
|
13
|
+
devkit_1.logger.warn(exports.REMIX_BUILD_EXECUTOR_DEPRECATION_MESSAGE);
|
|
14
|
+
}
|
|
15
|
+
function warnRemixServeExecutorDeprecation() {
|
|
16
|
+
devkit_1.logger.warn(exports.REMIX_SERVE_EXECUTOR_DEPRECATION_MESSAGE);
|
|
17
|
+
}
|
|
@@ -5,11 +5,11 @@ exports.updateJestTestSetup = updateJestTestSetup;
|
|
|
5
5
|
exports.updateJestTestMatch = updateJestTestMatch;
|
|
6
6
|
exports.updateVitestTestIncludes = updateVitestTestIncludes;
|
|
7
7
|
const devkit_1 = require("@nx/devkit");
|
|
8
|
-
const
|
|
8
|
+
const internal_1 = require("@nx/js/internal");
|
|
9
9
|
let tsModule;
|
|
10
10
|
function updateVitestTestSetup(tree, pathToVitestConfig, pathToTestSetup) {
|
|
11
11
|
if (!tsModule) {
|
|
12
|
-
tsModule = (0,
|
|
12
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
13
13
|
}
|
|
14
14
|
const { ast, query } = require('@phenomnomnominal/tsquery');
|
|
15
15
|
const fileContents = tree.read(pathToVitestConfig, 'utf-8');
|
|
@@ -32,7 +32,7 @@ function updateVitestTestSetup(tree, pathToVitestConfig, pathToTestSetup) {
|
|
|
32
32
|
}
|
|
33
33
|
function updateJestTestSetup(tree, pathToJestConfig, pathToTestSetup) {
|
|
34
34
|
if (!tsModule) {
|
|
35
|
-
tsModule = (0,
|
|
35
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
36
36
|
}
|
|
37
37
|
const { ast, query } = require('@phenomnomnominal/tsquery');
|
|
38
38
|
const fileContents = tree.read(pathToJestConfig, 'utf-8');
|
|
@@ -55,7 +55,7 @@ function updateJestTestSetup(tree, pathToJestConfig, pathToTestSetup) {
|
|
|
55
55
|
}
|
|
56
56
|
function updateJestTestMatch(tree, pathToJestConfig, includesString) {
|
|
57
57
|
if (!tsModule) {
|
|
58
|
-
tsModule = (0,
|
|
58
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
59
59
|
}
|
|
60
60
|
const { ast, query } = require('@phenomnomnominal/tsquery');
|
|
61
61
|
const fileContents = tree.read(pathToJestConfig, 'utf-8');
|
|
@@ -69,7 +69,7 @@ function updateJestTestMatch(tree, pathToJestConfig, includesString) {
|
|
|
69
69
|
}
|
|
70
70
|
function updateVitestTestIncludes(tree, pathToVitestConfig, includesString) {
|
|
71
71
|
if (!tsModule) {
|
|
72
|
-
tsModule = (0,
|
|
72
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
73
73
|
}
|
|
74
74
|
const { ast, query } = require('@phenomnomnominal/tsquery');
|
|
75
75
|
const fileContents = tree.read(pathToVitestConfig, 'utf-8');
|