@nx/rspack 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/migrations.json +52 -8
- package/package.json +27 -13
- package/src/executors/dev-server/dev-server.impl.d.ts.map +1 -1
- package/src/executors/dev-server/dev-server.impl.js +6 -4
- package/src/executors/dev-server/schema.json +1 -0
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +4 -4
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +4 -4
- package/src/executors/module-federation-static-server/module-federation-static-server.impl.js +4 -4
- package/src/executors/rspack/lib/normalize-options.js +2 -2
- package/src/executors/rspack/rspack.impl.d.ts.map +1 -1
- package/src/executors/rspack/rspack.impl.js +6 -4
- package/src/executors/rspack/schema.json +1 -0
- package/src/executors/ssr-dev-server/ssr-dev-server.impl.d.ts.map +1 -1
- package/src/executors/ssr-dev-server/ssr-dev-server.impl.js +2 -2
- package/src/generators/configuration/configuration.d.ts.map +1 -1
- package/src/generators/configuration/configuration.js +13 -10
- package/src/generators/convert-config-to-rspack-plugin/convert-config-to-rspack-plugin.d.ts.map +1 -1
- package/src/generators/convert-config-to-rspack-plugin/convert-config-to-rspack-plugin.js +5 -7
- package/src/generators/convert-to-inferred/convert-to-inferred.d.ts.map +1 -1
- package/src/generators/convert-to-inferred/convert-to-inferred.js +13 -6
- package/src/generators/convert-to-inferred/utils/build-post-target-transformer.js +8 -8
- package/src/generators/convert-to-inferred/utils/serve-post-target-transformer.d.ts.map +1 -1
- package/src/generators/convert-to-inferred/utils/serve-post-target-transformer.js +4 -4
- package/src/generators/convert-to-inferred/utils/types.d.ts +1 -1
- package/src/generators/convert-to-inferred/utils/types.d.ts.map +1 -1
- package/src/generators/convert-webpack/convert-webpack.d.ts.map +1 -1
- package/src/generators/convert-webpack/convert-webpack.js +8 -1
- package/src/generators/init/init.d.ts.map +1 -1
- package/src/generators/init/init.js +14 -7
- package/src/generators/init/schema.json +1 -1
- package/src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package.d.ts.map +1 -1
- package/src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package.js +2 -2
- package/src/migrations/update-20-3-0/ensure-nx-module-federation-package.d.ts.map +1 -1
- package/src/migrations/update-20-3-0/ensure-nx-module-federation-package.js +2 -2
- package/src/migrations/update-22-0-0/remove-deprecated-options.d.ts.map +1 -1
- package/src/migrations/update-22-0-0/remove-deprecated-options.js +3 -3
- package/src/migrations/update-23-0-0/add-svgr-to-rspack-config.d.ts +3 -0
- package/src/migrations/update-23-0-0/add-svgr-to-rspack-config.d.ts.map +1 -0
- package/src/migrations/update-23-0-0/add-svgr-to-rspack-config.js +413 -0
- package/src/migrations/update-23-0-0/add-svgr-to-rspack-config.md +84 -0
- package/src/plugins/nx-react-rspack-plugin/nx-react-rspack-plugin.d.ts +1 -7
- package/src/plugins/nx-react-rspack-plugin/nx-react-rspack-plugin.d.ts.map +1 -1
- package/src/plugins/plugin.d.ts.map +1 -1
- package/src/plugins/plugin.js +17 -27
- package/src/plugins/utils/apply-base-config.js +2 -2
- package/src/plugins/utils/apply-react-config.d.ts +1 -4
- package/src/plugins/utils/apply-react-config.d.ts.map +1 -1
- package/src/plugins/utils/apply-react-config.js +1 -32
- package/src/plugins/utils/apply-web-config.d.ts.map +1 -1
- package/src/plugins/utils/apply-web-config.js +4 -14
- package/src/plugins/utils/models.d.ts +1 -10
- package/src/plugins/utils/models.d.ts.map +1 -1
- package/src/plugins/utils/plugins/normalize-options.js +2 -2
- package/src/plugins/utils/plugins/nx-tsconfig-paths-rspack-plugin.js +3 -3
- package/src/utils/assert-supported-rspack-version.d.ts +3 -0
- package/src/utils/assert-supported-rspack-version.d.ts.map +1 -0
- package/src/utils/assert-supported-rspack-version.js +8 -0
- package/src/utils/config.js +2 -2
- package/src/utils/deprecation.d.ts +6 -0
- package/src/utils/deprecation.d.ts.map +1 -0
- package/src/utils/deprecation.js +21 -0
- package/src/utils/e2e-web-server-info-utils.d.ts +1 -1
- package/src/utils/e2e-web-server-info-utils.d.ts.map +1 -1
- package/src/utils/e2e-web-server-info-utils.js +6 -5
- package/src/utils/generator-utils.d.ts.map +1 -1
- package/src/utils/generator-utils.js +3 -4
- package/src/utils/resolve-user-defined-rspack-config.js +2 -2
- package/src/utils/version-utils.d.ts +27 -0
- package/src/utils/version-utils.d.ts.map +1 -0
- package/src/utils/version-utils.js +53 -0
- package/src/utils/versions.d.ts +18 -3
- package/src/utils/versions.d.ts.map +1 -1
- package/src/utils/versions.js +21 -4
- package/src/utils/with-react.d.ts +1 -7
- package/src/utils/with-react.d.ts.map +1 -1
- package/src/utils/with-react.js +1 -1
- package/src/utils/with-web.d.ts +1 -1
- package/src/utils/with-web.d.ts.map +1 -1
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
#### Replace the `svgr` Option with the `withSvgr` Composable in Rspack Configs
|
|
2
|
+
|
|
3
|
+
Updates rspack configs that use React to use a new `withSvgr` composable function instead of passing an `svgr` option to `withReact` or `NxReactRspackPlugin`. The option was removed; SVG handling is now consolidated into the images asset rule by default. The migration inlines a `withSvgr` helper into each affected config so existing SVGR-as-React-component behavior is preserved.
|
|
4
|
+
|
|
5
|
+
#### Sample Code Changes
|
|
6
|
+
|
|
7
|
+
Replace the `svgr` option on `withReact` with a `withSvgr(...)` call composed alongside it.
|
|
8
|
+
|
|
9
|
+
##### Before
|
|
10
|
+
|
|
11
|
+
```js title="apps/myapp/rspack.config.js" {5}
|
|
12
|
+
const { composePlugins, withNx, withReact } = require('@nx/rspack');
|
|
13
|
+
|
|
14
|
+
module.exports = composePlugins(
|
|
15
|
+
withNx(),
|
|
16
|
+
withReact({ svgr: { svgo: false, titleProp: true, ref: true } })
|
|
17
|
+
);
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
##### After
|
|
21
|
+
|
|
22
|
+
```js title="apps/myapp/rspack.config.js"
|
|
23
|
+
const { composePlugins, withNx, withReact } = require('@nx/rspack');
|
|
24
|
+
|
|
25
|
+
// SVGR support function (migrated from svgr option in withReact/NxReactRspackPlugin)
|
|
26
|
+
function withSvgr(svgrOptions = {}) {
|
|
27
|
+
const defaultOptions = { svgo: false, titleProp: true, ref: true };
|
|
28
|
+
const options = { ...defaultOptions, ...svgrOptions };
|
|
29
|
+
return function configure(config) {
|
|
30
|
+
const svgLoaderIdx = config.module.rules.findIndex(
|
|
31
|
+
(rule) =>
|
|
32
|
+
typeof rule === 'object' &&
|
|
33
|
+
typeof rule.test !== 'undefined' &&
|
|
34
|
+
rule.test.toString().includes('svg')
|
|
35
|
+
);
|
|
36
|
+
if (svgLoaderIdx !== -1) {
|
|
37
|
+
config.module.rules.splice(svgLoaderIdx, 1);
|
|
38
|
+
}
|
|
39
|
+
config.module.rules.push(
|
|
40
|
+
{ test: /\.svg$/i, type: 'asset', resourceQuery: /url/ },
|
|
41
|
+
{
|
|
42
|
+
test: /\.svg$/i,
|
|
43
|
+
issuer: /\.[jt]sx?$/,
|
|
44
|
+
resourceQuery: { not: [/url/] },
|
|
45
|
+
use: [{ loader: '@svgr/webpack', options }],
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
return config;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
module.exports = composePlugins(
|
|
53
|
+
withNx(),
|
|
54
|
+
withReact(),
|
|
55
|
+
withSvgr({ svgo: false, titleProp: true, ref: true })
|
|
56
|
+
);
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
For the `NxReactRspackPlugin` style, the `svgr` option is removed from the plugin call and the entire `module.exports` is wrapped with a `withSvgr(...)` call that registers the loader rules directly on the compiler.
|
|
60
|
+
|
|
61
|
+
##### Before
|
|
62
|
+
|
|
63
|
+
```js title="apps/myapp/rspack.config.js" {5}
|
|
64
|
+
const { NxReactRspackPlugin } = require('@nx/rspack');
|
|
65
|
+
|
|
66
|
+
module.exports = {
|
|
67
|
+
plugins: [new NxReactRspackPlugin({ svgr: true, main: './src/main.tsx' })],
|
|
68
|
+
};
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
##### After
|
|
72
|
+
|
|
73
|
+
```js title="apps/myapp/rspack.config.js"
|
|
74
|
+
const { NxReactRspackPlugin } = require('@nx/rspack');
|
|
75
|
+
|
|
76
|
+
// SVGR support function (migrated from svgr option in withReact/NxReactRspackPlugin)
|
|
77
|
+
function withSvgr(svgrOptions = {}) {
|
|
78
|
+
/* same helper as above, compiler.options.module.rules variant */
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
module.exports = withSvgr()({
|
|
82
|
+
plugins: [new NxReactRspackPlugin({ main: './src/main.tsx' })],
|
|
83
|
+
});
|
|
84
|
+
```
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import type { Compiler } from '@rspack/core';
|
|
2
2
|
export declare class NxReactRspackPlugin {
|
|
3
3
|
private options;
|
|
4
|
-
constructor(options?:
|
|
5
|
-
/**
|
|
6
|
-
* @deprecated SVGR support is deprecated and will be removed in Nx 23.
|
|
7
|
-
* TODO(v23): Remove SVGR support
|
|
8
|
-
*/
|
|
9
|
-
svgr?: boolean;
|
|
10
|
-
});
|
|
4
|
+
constructor(options?: Record<string, any>);
|
|
11
5
|
apply(compiler: Compiler): void;
|
|
12
6
|
}
|
|
13
7
|
//# sourceMappingURL=nx-react-rspack-plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-react-rspack-plugin.d.ts","sourceRoot":"","sources":["../../../../../../packages/rspack/src/plugins/nx-react-rspack-plugin/nx-react-rspack-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7C,qBAAa,mBAAmB;
|
|
1
|
+
{"version":3,"file":"nx-react-rspack-plugin.d.ts","sourceRoot":"","sources":["../../../../../../packages/rspack/src/plugins/nx-react-rspack-plugin/nx-react-rspack-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7C,qBAAa,mBAAmB;IAClB,OAAO,CAAC,OAAO;gBAAP,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM;IAErD,KAAK,CAAC,QAAQ,EAAE,QAAQ;CAGzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/rspack/src/plugins/plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/rspack/src/plugins/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAGlB,aAAa,EAKd,MAAM,YAAY,CAAC;AAapB,MAAM,WAAW,mBAAmB;IAClC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAID,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAIF,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,mBAAmB,CAiC5D,CAAC"}
|
package/src/plugins/plugin.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createNodesV2 = exports.createDependencies = void 0;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const get_named_inputs_1 = require("@nx/devkit/src/utils/get-named-inputs");
|
|
6
6
|
const js_1 = require("@nx/js");
|
|
7
|
-
const
|
|
7
|
+
const internal_2 = require("@nx/js/internal");
|
|
8
8
|
const fs_1 = require("fs");
|
|
9
9
|
const file_hasher_1 = require("nx/src/hasher/file-hasher");
|
|
10
10
|
const cache_directory_1 = require("nx/src/utils/cache-directory");
|
|
@@ -12,20 +12,6 @@ const package_manager_1 = require("nx/src/utils/package-manager");
|
|
|
12
12
|
const path_1 = require("path");
|
|
13
13
|
const read_rspack_options_1 = require("../utils/read-rspack-options");
|
|
14
14
|
const resolve_user_defined_rspack_config_1 = require("../utils/resolve-user-defined-rspack-config");
|
|
15
|
-
const util_1 = require("@nx/js/src/plugins/typescript/util");
|
|
16
|
-
function readTargetsCache(cachePath) {
|
|
17
|
-
try {
|
|
18
|
-
return process.env.NX_CACHE_PROJECT_GRAPH !== 'false'
|
|
19
|
-
? (0, devkit_1.readJsonFile)(cachePath)
|
|
20
|
-
: {};
|
|
21
|
-
}
|
|
22
|
-
catch {
|
|
23
|
-
return {};
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
function writeTargetsToCache(cachePath, results) {
|
|
27
|
-
(0, devkit_1.writeJsonFile)(cachePath, results);
|
|
28
|
-
}
|
|
29
15
|
const createDependencies = () => {
|
|
30
16
|
return [];
|
|
31
17
|
};
|
|
@@ -36,18 +22,20 @@ exports.createNodesV2 = [
|
|
|
36
22
|
async (configFilePaths, options, context) => {
|
|
37
23
|
const optionsHash = (0, file_hasher_1.hashObject)(options);
|
|
38
24
|
const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `rspack-${optionsHash}.hash`);
|
|
39
|
-
const targetsCache =
|
|
40
|
-
const isTsSolutionSetup = (0,
|
|
41
|
-
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, package_manager_1.getPackageManagerCommand)(packageManager);
|
|
29
|
+
const lockFileName = (0, js_1.getLockFileName)(packageManager);
|
|
42
30
|
try {
|
|
43
|
-
return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => createNodesInternal(configFile, options, context, targetsCache, isTsSolutionSetup, pmc), configFilePaths, options, context);
|
|
31
|
+
return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => createNodesInternal(configFile, options, context, targetsCache, isTsSolutionSetup, pmc, lockFileName), configFilePaths, options, context);
|
|
44
32
|
}
|
|
45
33
|
finally {
|
|
46
|
-
|
|
34
|
+
targetsCache.writeToDisk();
|
|
47
35
|
}
|
|
48
36
|
},
|
|
49
37
|
];
|
|
50
|
-
async function createNodesInternal(configFilePath, options, context, targetsCache, isTsSolutionSetup, pmc) {
|
|
38
|
+
async function createNodesInternal(configFilePath, options, context, targetsCache, isTsSolutionSetup, pmc, lockFileName) {
|
|
51
39
|
const projectRoot = (0, path_1.dirname)(configFilePath);
|
|
52
40
|
// Do not create a project if package.json and project.json isn't there.
|
|
53
41
|
const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
|
|
@@ -60,7 +48,7 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
|
|
|
60
48
|
packageJson = (0, devkit_1.readJsonFile)((0, path_1.join)(context.workspaceRoot, projectRoot, 'package.json'));
|
|
61
49
|
}
|
|
62
50
|
const normalizedOptions = normalizeOptions(options);
|
|
63
|
-
const lockFileHash = (0, file_hasher_1.hashFile)((0, path_1.join)(context.workspaceRoot,
|
|
51
|
+
const lockFileHash = (0, file_hasher_1.hashFile)((0, path_1.join)(context.workspaceRoot, lockFileName)) ?? '';
|
|
64
52
|
const nodeHash = (0, file_hasher_1.hashArray)([
|
|
65
53
|
(0, file_hasher_1.hashFile)((0, path_1.join)(context.workspaceRoot, configFilePath)),
|
|
66
54
|
lockFileHash,
|
|
@@ -70,8 +58,10 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
|
|
|
70
58
|
// We do not want to alter how the hash is calculated, so appending the config file path to the hash
|
|
71
59
|
// to prevent vite/vitest files overwriting the target cache created by the other
|
|
72
60
|
const hash = `${nodeHash}_${configFilePath}`;
|
|
73
|
-
targetsCache
|
|
74
|
-
|
|
61
|
+
if (!targetsCache.has(hash)) {
|
|
62
|
+
targetsCache.set(hash, await createRspackTargets(configFilePath, projectRoot, normalizedOptions, context, isTsSolutionSetup, pmc));
|
|
63
|
+
}
|
|
64
|
+
const { targets, metadata } = targetsCache.get(hash);
|
|
75
65
|
return {
|
|
76
66
|
projects: {
|
|
77
67
|
[projectRoot]: {
|
|
@@ -83,7 +73,7 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
|
|
|
83
73
|
};
|
|
84
74
|
}
|
|
85
75
|
async function createRspackTargets(configFilePath, projectRoot, options, context, isTsSolutionSetup, pmc) {
|
|
86
|
-
const namedInputs = (0,
|
|
76
|
+
const namedInputs = (0, internal_1.getNamedInputs)(projectRoot, context);
|
|
87
77
|
const rspackConfig = await (0, resolve_user_defined_rspack_config_1.resolveUserDefinedRspackConfig)((0, path_1.join)(context.workspaceRoot, configFilePath), (0, js_1.getRootTsConfigPath)(), true);
|
|
88
78
|
const rspackOptions = await (0, read_rspack_options_1.readRspackOptions)(rspackConfig);
|
|
89
79
|
const outputs = [];
|
|
@@ -175,7 +165,7 @@ async function createRspackTargets(configFilePath, projectRoot, options, context
|
|
|
175
165
|
'@nx/js:typescript-sync',
|
|
176
166
|
];
|
|
177
167
|
}
|
|
178
|
-
(0,
|
|
168
|
+
(0, internal_2.addBuildAndWatchDepsTargets)(context.workspaceRoot, projectRoot, targets, options, pmc);
|
|
179
169
|
return { targets, metadata: {} };
|
|
180
170
|
}
|
|
181
171
|
function normalizeOptions(options) {
|
|
@@ -12,7 +12,7 @@ const hash_format_1 = require("./hash-format");
|
|
|
12
12
|
const nx_tsconfig_paths_rspack_plugin_1 = require("./plugins/nx-tsconfig-paths-rspack-plugin");
|
|
13
13
|
const get_terser_ecma_version_1 = require("./get-terser-ecma-version");
|
|
14
14
|
const nodeExternals = require("webpack-node-externals");
|
|
15
|
-
const
|
|
15
|
+
const internal_1 = require("@nx/js/internal");
|
|
16
16
|
const get_non_buildable_libs_1 = require("./get-non-buildable-libs");
|
|
17
17
|
const IGNORED_RSPACK_WARNINGS = [
|
|
18
18
|
/The comment file/i,
|
|
@@ -201,7 +201,7 @@ function applyNxIndependentConfig(options, config) {
|
|
|
201
201
|
function applyNxDependentConfig(options, config, { useNormalizedEntry } = {}) {
|
|
202
202
|
const tsConfig = options.tsConfig ?? (0, js_1.getRootTsConfigPath)();
|
|
203
203
|
const plugins = [];
|
|
204
|
-
const isUsingTsSolution = (0,
|
|
204
|
+
const isUsingTsSolution = (0, internal_1.isUsingTsSolutionSetup)();
|
|
205
205
|
const executorContext = {
|
|
206
206
|
projectName: options.projectName,
|
|
207
207
|
targetName: options.targetName,
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import { Configuration, RspackOptionsNormalized } from '@rspack/core';
|
|
2
|
-
|
|
3
|
-
export declare function applyReactConfig(options: {
|
|
4
|
-
svgr?: boolean | SvgrOptions;
|
|
5
|
-
}, config?: Partial<RspackOptionsNormalized | Configuration>): void;
|
|
2
|
+
export declare function applyReactConfig(options?: Record<string, any>, config?: Partial<RspackOptionsNormalized | Configuration>): void;
|
|
6
3
|
//# sourceMappingURL=apply-react-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-react-config.d.ts","sourceRoot":"","sources":["../../../../../../packages/rspack/src/plugins/utils/apply-react-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEtE,
|
|
1
|
+
{"version":3,"file":"apply-react-config.d.ts","sourceRoot":"","sources":["../../../../../../packages/rspack/src/plugins/utils/apply-react-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEtE,wBAAgB,gBAAgB,CAC9B,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EACjC,MAAM,GAAE,OAAO,CAAC,uBAAuB,GAAG,aAAa,CAAM,GAC5D,IAAI,CAUN"}
|
|
@@ -1,47 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.applyReactConfig = applyReactConfig;
|
|
4
|
-
|
|
5
|
-
// TODO(v23): Remove SVGR support
|
|
6
|
-
function applyReactConfig(options, config = {}) {
|
|
4
|
+
function applyReactConfig(options = {}, config = {}) {
|
|
7
5
|
if (global.NX_GRAPH_CREATION)
|
|
8
6
|
return;
|
|
9
7
|
addHotReload(config);
|
|
10
|
-
if (options.svgr !== false || typeof options.svgr === 'object') {
|
|
11
|
-
// Log deprecation warning when SVGR is used
|
|
12
|
-
if (options.svgr === true || typeof options.svgr === 'object') {
|
|
13
|
-
devkit_1.logger.warn('SVGR support is deprecated and will be removed in Nx 23. Please consider using alternative SVG handling methods.');
|
|
14
|
-
}
|
|
15
|
-
removeSvgLoaderIfPresent(config);
|
|
16
|
-
const defaultSvgrOptions = {
|
|
17
|
-
svgo: false,
|
|
18
|
-
titleProp: true,
|
|
19
|
-
ref: true,
|
|
20
|
-
};
|
|
21
|
-
const svgrOptions = typeof options.svgr === 'object' ? options.svgr : defaultSvgrOptions;
|
|
22
|
-
config.module.rules.push({
|
|
23
|
-
test: /\.svg$/i,
|
|
24
|
-
type: 'asset',
|
|
25
|
-
resourceQuery: /url/, // *.svg?url
|
|
26
|
-
}, {
|
|
27
|
-
test: /\.svg$/i,
|
|
28
|
-
issuer: /\.[jt]sx?$/,
|
|
29
|
-
resourceQuery: { not: [/url/] }, // exclude react component if not *.svg?url
|
|
30
|
-
use: [{ loader: '@svgr/webpack', options: svgrOptions }],
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
8
|
// enable rspack node api
|
|
34
9
|
config.node = {
|
|
35
10
|
__dirname: true,
|
|
36
11
|
__filename: true,
|
|
37
12
|
};
|
|
38
13
|
}
|
|
39
|
-
function removeSvgLoaderIfPresent(config) {
|
|
40
|
-
const svgLoaderIdx = config.module.rules.findIndex((rule) => typeof rule === 'object' && rule.test?.toString().includes('svg'));
|
|
41
|
-
if (svgLoaderIdx === -1)
|
|
42
|
-
return;
|
|
43
|
-
config.module.rules.splice(svgLoaderIdx, 1);
|
|
44
|
-
}
|
|
45
14
|
function addHotReload(config) {
|
|
46
15
|
const ReactRefreshPlugin = require('@rspack/plugin-react-refresh');
|
|
47
16
|
const isDev = process.env.NODE_ENV === 'development' || config.mode === 'development';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-web-config.d.ts","sourceRoot":"","sources":["../../../../../../packages/rspack/src/plugins/utils/apply-web-config.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAQlB,uBAAuB,EACxB,MAAM,cAAc,CAAC;AAUtB,OAAO,EAAE,kCAAkC,EAAE,MAAM,UAAU,CAAC;AAG9D,wBAAgB,cAAc,CAC5B,OAAO,EAAE,kCAAkC,EAC3C,MAAM,GAAE,OAAO,CAAC,uBAAuB,GAAG,aAAa,CAAM,EAC7D,EACE,kBAAkB,GACnB,GAAE;IAID,kBAAkB,CAAC,EAAE,OAAO,CAAC;CACzB,GACL,IAAI,
|
|
1
|
+
{"version":3,"file":"apply-web-config.d.ts","sourceRoot":"","sources":["../../../../../../packages/rspack/src/plugins/utils/apply-web-config.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAQlB,uBAAuB,EACxB,MAAM,cAAc,CAAC;AAUtB,OAAO,EAAE,kCAAkC,EAAE,MAAM,UAAU,CAAC;AAG9D,wBAAgB,cAAc,CAC5B,OAAO,EAAE,kCAAkC,EAC3C,MAAM,GAAE,OAAO,CAAC,uBAAuB,GAAG,aAAa,CAAM,EAC7D,EACE,kBAAkB,GACnB,GAAE;IAID,kBAAkB,CAAC,EAAE,OAAO,CAAC;CACzB,GACL,IAAI,CA2WN"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.applyWebConfig = applyWebConfig;
|
|
4
|
-
const
|
|
4
|
+
const internal_1 = require("@nx/js/internal");
|
|
5
5
|
const core_1 = require("@rspack/core");
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
const write_index_html_plugin_1 = require("../write-index-html-plugin");
|
|
@@ -18,7 +18,7 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
|
|
|
18
18
|
options.generateIndexHtml ??= true;
|
|
19
19
|
options.index = options.index
|
|
20
20
|
? (0, path_1.join)(options.root, options.index)
|
|
21
|
-
: (0, path_1.join)(options.root, (0,
|
|
21
|
+
: (0, path_1.join)(options.root, (0, internal_1.getProjectSourceRoot)(options.projectGraph.nodes[options.projectName].data), 'index.html');
|
|
22
22
|
options.styles ??= [];
|
|
23
23
|
options.scripts ??= [];
|
|
24
24
|
const isProd = process.env.NODE_ENV === 'production' || options.mode === 'production';
|
|
@@ -306,19 +306,9 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
|
|
|
306
306
|
...(config.module ?? {}),
|
|
307
307
|
rules: [
|
|
308
308
|
...(config.module.rules ?? []),
|
|
309
|
-
// Images: Inline small images, and emit a separate file otherwise.
|
|
309
|
+
// Images: Inline small images, and emit a separate file otherwise (including SVGs).
|
|
310
310
|
{
|
|
311
|
-
test: /\.(avif|bmp|gif|ico|jpe?g|png|webp)$/,
|
|
312
|
-
type: 'asset',
|
|
313
|
-
parser: {
|
|
314
|
-
dataUrlCondition: {
|
|
315
|
-
maxSize: 10_000, // 10 kB
|
|
316
|
-
},
|
|
317
|
-
},
|
|
318
|
-
},
|
|
319
|
-
// SVG: same as image but we need to separate it so it can be swapped for SVGR in the React plugin.
|
|
320
|
-
{
|
|
321
|
-
test: /\.svg$/,
|
|
311
|
+
test: /\.(avif|bmp|gif|ico|jpe?g|png|svg|webp)$/,
|
|
322
312
|
type: 'asset',
|
|
323
313
|
parser: {
|
|
324
314
|
dataUrlCondition: {
|
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
import type { DevTool, Mode } from '@rspack/core';
|
|
2
2
|
import type { ProjectGraph } from '@nx/devkit';
|
|
3
|
-
import type { AssetGlob } from '@nx/js/
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated SVGR support is deprecated and will be removed in Nx 23.
|
|
6
|
-
* TODO(v23): Remove SVGR support
|
|
7
|
-
*/
|
|
8
|
-
export interface SvgrOptions {
|
|
9
|
-
svgo?: boolean;
|
|
10
|
-
titleProp?: boolean;
|
|
11
|
-
ref?: boolean;
|
|
12
|
-
}
|
|
3
|
+
import type { AssetGlob } from '@nx/js/internal';
|
|
13
4
|
export interface AssetGlobPattern {
|
|
14
5
|
glob: string;
|
|
15
6
|
input: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../../../../packages/rspack/src/plugins/utils/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../../../../packages/rspack/src/plugins/utils/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAA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AAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,kCACf,SAAQ,wBAAwB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,mBAAmB,EAAE,OAAO,CAAC;CAC9B"}
|
|
@@ -4,7 +4,7 @@ exports.normalizeOptions = normalizeOptions;
|
|
|
4
4
|
exports.normalizeAssets = normalizeAssets;
|
|
5
5
|
exports.normalizeFileReplacements = normalizeFileReplacements;
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const
|
|
7
|
+
const internal_1 = require("@nx/js/internal");
|
|
8
8
|
const fs_1 = require("fs");
|
|
9
9
|
const path_1 = require("path");
|
|
10
10
|
function normalizeOptions(options) {
|
|
@@ -49,7 +49,7 @@ function normalizeOptions(options) {
|
|
|
49
49
|
// executor options take precedence (especially for overriding with CLI args)
|
|
50
50
|
originalTargetOptions);
|
|
51
51
|
}
|
|
52
|
-
const sourceRoot = (0,
|
|
52
|
+
const sourceRoot = (0, internal_1.getProjectSourceRoot)(projectNode.data);
|
|
53
53
|
if (!combinedPluginAndMaybeExecutorOptions.main) {
|
|
54
54
|
throw new Error(`Missing "main" option for the entry file. Set this option in your Nx rspack plugin.`);
|
|
55
55
|
}
|
|
@@ -4,7 +4,7 @@ exports.NxTsconfigPathsRspackPlugin = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const path = tslib_1.__importStar(require("path"));
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const
|
|
7
|
+
const internal_1 = require("@nx/js/internal");
|
|
8
8
|
const rspack_nx_build_coordination_plugin_1 = require("./rspack-nx-build-coordination-plugin");
|
|
9
9
|
const fs_1 = require("fs");
|
|
10
10
|
class NxTsconfigPathsRspackPlugin {
|
|
@@ -43,8 +43,8 @@ class NxTsconfigPathsRspackPlugin {
|
|
|
43
43
|
handleBuildLibsFromSource(config, options) {
|
|
44
44
|
if (!options.buildLibsFromSource && options.targetName) {
|
|
45
45
|
const remappedTarget = options.targetName === 'serve' ? 'build' : options.targetName;
|
|
46
|
-
const { target, dependencies } = (0,
|
|
47
|
-
options.tsConfig = (0,
|
|
46
|
+
const { target, dependencies } = (0, internal_1.calculateProjectBuildableDependencies)(undefined, options.projectGraph, options.root, options.projectName, remappedTarget, options.configurationName);
|
|
47
|
+
options.tsConfig = (0, internal_1.createTmpTsConfig)(options.tsConfig, options.root, target.data.root, dependencies);
|
|
48
48
|
this.tmpTsConfigPath = options.tsConfig;
|
|
49
49
|
if (options.targetName === 'serve') {
|
|
50
50
|
const buildableDependencies = dependencies
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assert-supported-rspack-version.d.ts","sourceRoot":"","sources":["../../../../../packages/rspack/src/utils/assert-supported-rspack-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAIvC,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAM7D"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assertSupportedRspackVersion = assertSupportedRspackVersion;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
5
|
+
const versions_1 = require("./versions");
|
|
6
|
+
function assertSupportedRspackVersion(tree) {
|
|
7
|
+
(0, internal_1.assertSupportedPackageVersion)(tree, '@rspack/core', versions_1.minSupportedRspackVersion);
|
|
8
|
+
}
|
package/src/utils/config.js
CHANGED
|
@@ -5,7 +5,7 @@ exports.isNxRspackComposablePlugin = isNxRspackComposablePlugin;
|
|
|
5
5
|
exports.composePlugins = composePlugins;
|
|
6
6
|
exports.composePluginsSync = composePluginsSync;
|
|
7
7
|
const devkit_1 = require("@nx/devkit");
|
|
8
|
-
const
|
|
8
|
+
const internal_1 = require("@nx/js/internal");
|
|
9
9
|
const configuration_1 = require("nx/src/config/configuration");
|
|
10
10
|
exports.nxRspackComposablePlugin = 'nxRspackComposablePlugin';
|
|
11
11
|
function isNxRspackComposablePlugin(a) {
|
|
@@ -50,7 +50,7 @@ function ensureNxRspackExecutionContext(ctx) {
|
|
|
50
50
|
ctx.options ??= {
|
|
51
51
|
root: devkit_1.workspaceRoot,
|
|
52
52
|
projectRoot: projectNode.data.root,
|
|
53
|
-
sourceRoot: (0,
|
|
53
|
+
sourceRoot: (0, internal_1.getProjectSourceRoot)(projectNode.data),
|
|
54
54
|
// These aren't actually needed since NxRspackPlugin and withNx both support them being undefined.
|
|
55
55
|
assets: undefined,
|
|
56
56
|
outputFileName: undefined,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const RSPACK_EXECUTOR_DEPRECATION_MESSAGE = "The `@nx/rspack:rspack` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/rspack:convert-to-inferred` to migrate to the `@nx/rspack/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.";
|
|
2
|
+
export declare const RSPACK_DEV_SERVER_EXECUTOR_DEPRECATION_MESSAGE = "The `@nx/rspack:dev-server` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/rspack:convert-to-inferred` to migrate to the `@nx/rspack/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.";
|
|
3
|
+
export declare function warnRspackExecutorDeprecation(): void;
|
|
4
|
+
export declare function warnRspackDevServerExecutorDeprecation(): void;
|
|
5
|
+
export declare function warnRspackExecutorGenerating(): void;
|
|
6
|
+
//# sourceMappingURL=deprecation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deprecation.d.ts","sourceRoot":"","sources":["../../../../../packages/rspack/src/utils/deprecation.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,mCAAmC,mQACkN,CAAC;AAEnQ,eAAO,MAAM,8CAA8C,uQAC2M,CAAC;AAEvQ,wBAAgB,6BAA6B,IAAI,IAAI,CAEpD;AAED,wBAAgB,sCAAsC,IAAI,IAAI,CAE7D;AAED,wBAAgB,4BAA4B,IAAI,IAAI,CAInD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RSPACK_DEV_SERVER_EXECUTOR_DEPRECATION_MESSAGE = exports.RSPACK_EXECUTOR_DEPRECATION_MESSAGE = void 0;
|
|
4
|
+
exports.warnRspackExecutorDeprecation = warnRspackExecutorDeprecation;
|
|
5
|
+
exports.warnRspackDevServerExecutorDeprecation = warnRspackDevServerExecutorDeprecation;
|
|
6
|
+
exports.warnRspackExecutorGenerating = warnRspackExecutorGenerating;
|
|
7
|
+
const devkit_1 = require("@nx/devkit");
|
|
8
|
+
// TODO(v24): Remove the @nx/rspack:rspack and @nx/rspack:dev-server
|
|
9
|
+
// executors. The inferred plugin (@nx/rspack/plugin) and the
|
|
10
|
+
// convert-to-inferred generator stay supported.
|
|
11
|
+
exports.RSPACK_EXECUTOR_DEPRECATION_MESSAGE = 'The `@nx/rspack:rspack` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/rspack:convert-to-inferred` to migrate to the `@nx/rspack/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.';
|
|
12
|
+
exports.RSPACK_DEV_SERVER_EXECUTOR_DEPRECATION_MESSAGE = 'The `@nx/rspack:dev-server` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/rspack:convert-to-inferred` to migrate to the `@nx/rspack/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.';
|
|
13
|
+
function warnRspackExecutorDeprecation() {
|
|
14
|
+
devkit_1.logger.warn(exports.RSPACK_EXECUTOR_DEPRECATION_MESSAGE);
|
|
15
|
+
}
|
|
16
|
+
function warnRspackDevServerExecutorDeprecation() {
|
|
17
|
+
devkit_1.logger.warn(exports.RSPACK_DEV_SERVER_EXECUTOR_DEPRECATION_MESSAGE);
|
|
18
|
+
}
|
|
19
|
+
function warnRspackExecutorGenerating() {
|
|
20
|
+
devkit_1.logger.warn('Generating targets that use the deprecated `@nx/rspack:rspack` and `@nx/rspack:dev-server` executors. These executors will be removed in Nx v24. Run `nx g @nx/rspack:convert-to-inferred` next to migrate these targets to the `@nx/rspack/plugin` inferred plugin and prevent future generators from emitting executor targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.');
|
|
21
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type Tree } from '@nx/devkit';
|
|
2
|
-
export declare function getRspackE2EWebServerInfo(tree: Tree, projectName: string, configFilePath: string, isPluginBeingAdded: boolean, e2ePortOverride?: number): Promise<import("@nx/devkit/
|
|
2
|
+
export declare function getRspackE2EWebServerInfo(tree: Tree, projectName: string, configFilePath: string, isPluginBeingAdded: boolean, e2ePortOverride?: number): Promise<import("@nx/devkit/internal").E2EWebServerDetails>;
|
|
3
3
|
//# sourceMappingURL=e2e-web-server-info-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"e2e-web-server-info-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/rspack/src/utils/e2e-web-server-info-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAc,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"e2e-web-server-info-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/rspack/src/utils/e2e-web-server-info-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAc,MAAM,YAAY,CAAC;AAMnD,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,EACtB,kBAAkB,EAAE,OAAO,EAC3B,eAAe,CAAC,EAAE,MAAM,8DA6BzB"}
|
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getRspackE2EWebServerInfo = getRspackE2EWebServerInfo;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
6
|
async function getRspackE2EWebServerInfo(tree, projectName, configFilePath, isPluginBeingAdded, e2ePortOverride) {
|
|
7
7
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
8
8
|
let e2ePort = e2ePortOverride ?? 4200;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const servePort = (0, internal_1.readTargetDefaultsForTarget)('serve', nxJson.targetDefaults)
|
|
10
|
+
?.options?.port;
|
|
11
|
+
if (servePort) {
|
|
12
|
+
e2ePort = servePort;
|
|
12
13
|
}
|
|
13
|
-
return (0,
|
|
14
|
+
return (0, internal_1.getE2EWebServerInfo)(tree, projectName, {
|
|
14
15
|
plugin: '@nx/rspack/plugin',
|
|
15
16
|
serveTargetName: 'serveTargetName',
|
|
16
17
|
serveStaticTargetName: 'previewTargetName',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/rspack/src/utils/generator-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,mBAAmB,EACnB,IAAI,EAEL,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"generator-utils.d.ts","sourceRoot":"","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B,CACjC,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,qBAAqB,CAAC,EAAE,MAAM,QAa/B;AAID,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,mBAAmB,EAC5B,WAAW,EAAE,MAAM,QA8DpB;AAED,wBAAgB,mCAAmC,CACjD,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM,GAClB,MAAM,CAQR;AAED,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,MAAM,UAchB;AAED,wBAAsB,oCAAoC,CACxD,+BAA+B,EAAE,WAAW,EAC5C,sBAAsB,EAAE,sBAAsB,EAC9C,oBAAoB,EAAE,oBAAoB,EAC1C,SAAS,EAAE,SAAS,iBAuBrB;AAqCD,wBAAsB,sBAAsB,CAAC,WAAW,EAAE,MAAM,iBA4B/D;AAED,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,mBAAmB,EAC5B,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE;IACP,CAAC,UAAU,EAAE,MAAM,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;CAChD,GACA;IAAE,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC;IAAC,SAAS,CAAC,EAAE,SAAS,CAAA;CAAE,CAmEnD;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,mBAAmB,UASrE;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,mBAAmB,UAYzE"}
|
|
@@ -14,8 +14,7 @@ exports.determineFrameworkAndTarget = determineFrameworkAndTarget;
|
|
|
14
14
|
exports.determineMain = determineMain;
|
|
15
15
|
exports.determineTsConfig = determineTsConfig;
|
|
16
16
|
const devkit_1 = require("@nx/devkit");
|
|
17
|
-
const
|
|
18
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
17
|
+
const internal_1 = require("@nx/js/internal");
|
|
19
18
|
const has_plugin_1 = require("./has-plugin");
|
|
20
19
|
function findExistingTargetsInProject(targets, userProvidedTargets) {
|
|
21
20
|
const output = {
|
|
@@ -130,7 +129,7 @@ function addOrChangeBuildTarget(tree, options, target) {
|
|
|
130
129
|
if (tree.exists((0, devkit_1.joinPathFragments)(project.root, 'src/assets'))) {
|
|
131
130
|
assets.push((0, devkit_1.joinPathFragments)(project.root, 'src/assets'));
|
|
132
131
|
}
|
|
133
|
-
const isTsSolutionSetup = (0,
|
|
132
|
+
const isTsSolutionSetup = (0, internal_1.isUsingTsSolutionSetup)(tree);
|
|
134
133
|
const buildOptions = {
|
|
135
134
|
target: options.target ?? 'web',
|
|
136
135
|
outputPath: isTsSolutionSetup
|
|
@@ -486,7 +485,7 @@ async function handleUnknownExecutors(projectName) {
|
|
|
486
485
|
}
|
|
487
486
|
}
|
|
488
487
|
function determineFrameworkAndTarget(tree, options, projectRoot, targets) {
|
|
489
|
-
(0,
|
|
488
|
+
(0, internal_1.ensureTypescript)();
|
|
490
489
|
const { ast, query } = require('@phenomnomnominal/tsquery');
|
|
491
490
|
// First try to infer if the target is node
|
|
492
491
|
if (options.target !== 'node') {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveUserDefinedRspackConfig = resolveUserDefinedRspackConfig;
|
|
4
|
-
const
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
5
5
|
async function resolveUserDefinedRspackConfig(path, tsConfig,
|
|
6
6
|
/** Skip require cache and return latest content */
|
|
7
7
|
reload = false) {
|
|
8
|
-
return await (0,
|
|
8
|
+
return await (0, internal_1.loadConfigFile)(path);
|
|
9
9
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type Tree } from '@nx/devkit';
|
|
2
|
+
import { type SupportedRspackMajorVersion } from './versions';
|
|
3
|
+
/**
|
|
4
|
+
* Returns the declared @rspack/core major version from the workspace's
|
|
5
|
+
* package.json when it matches a supported major, or `undefined` otherwise
|
|
6
|
+
* (fresh install, dist tag, unknown major). Below-floor enforcement is
|
|
7
|
+
* handled at generator entry points via `assertSupportedRspackVersion`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getInstalledRspackMajorVersion(tree: Tree): SupportedRspackMajorVersion | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Returns the installed @rspack/core major version resolved at runtime from
|
|
12
|
+
* node_modules. For use in executors and runtime code where no Tree is
|
|
13
|
+
* available. Returns `null` when @rspack/core can't be resolved or the
|
|
14
|
+
* installed major isn't supported.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getInstalledRspackVersionRuntime(): SupportedRspackMajorVersion | null;
|
|
17
|
+
/**
|
|
18
|
+
* Returns the version-map entry for the installed major, falling back to the
|
|
19
|
+
* latest supported map when no installed version is detected (fresh install)
|
|
20
|
+
* or the detected major is outside the supported window.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getRspackVersionsForInstalledMajor(tree: Tree): {
|
|
23
|
+
rspackCoreVersion: string;
|
|
24
|
+
rspackDevServerVersion: string;
|
|
25
|
+
rspackPluginReactRefreshVersion: string;
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=version-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/rspack/src/utils/version-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAMvC,OAAO,EAGL,KAAK,2BAA2B,EACjC,MAAM,YAAY,CAAC;AAIpB;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,IAAI,GACT,2BAA2B,GAAG,SAAS,CASzC;AAED;;;;;GAKG;AACH,wBAAgB,gCAAgC,IAAI,2BAA2B,GAAG,IAAI,CASrF;AAED;;;;GAIG;AACH,wBAAgB,kCAAkC,CAAC,IAAI,EAAE,IAAI;;;;EAM5D"}
|