@nx/rsbuild 23.0.0-pr.35465.2bc2643 → 23.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/{config-utils.d.ts → dist/config-utils.d.ts} +0 -1
  2. package/{generators.d.ts → dist/generators.d.ts} +0 -1
  3. package/dist/index.d.ts +1 -0
  4. package/{index.js → dist/index.js} +2 -1
  5. package/{src → dist/src}/generators/configuration/configuration.d.ts +0 -1
  6. package/{src → dist/src}/generators/configuration/configuration.js +5 -2
  7. package/{src → dist/src}/generators/configuration/lib/index.d.ts +0 -1
  8. package/{src → dist/src}/generators/configuration/lib/normalize-options.d.ts +0 -1
  9. package/{src → dist/src}/generators/init/init.d.ts +0 -1
  10. package/{src → dist/src}/generators/init/init.js +8 -4
  11. package/{src → dist/src}/generators/init/schema.json +1 -1
  12. package/dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes.d.ts +9 -0
  13. package/dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes.js +223 -0
  14. package/dist/src/plugins/plugin.d.ts +15 -0
  15. package/{src → dist/src}/plugins/plugin.js +74 -35
  16. package/{src → dist/src}/utils/add-build-plugin.d.ts +0 -1
  17. package/dist/src/utils/assert-supported-rsbuild-version.d.ts +2 -0
  18. package/dist/src/utils/assert-supported-rsbuild-version.js +8 -0
  19. package/{src → dist/src}/utils/ast-utils.d.ts +0 -1
  20. package/dist/src/utils/e2e-web-server-info-utils.d.ts +2 -0
  21. package/{src → dist/src}/utils/e2e-web-server-info-utils.js +6 -5
  22. package/{src → dist/src}/utils/has-rsbuild-plugin.d.ts +0 -1
  23. package/{src → dist/src}/utils/indent-by.d.ts +0 -1
  24. package/dist/src/utils/version-utils.d.ts +27 -0
  25. package/dist/src/utils/version-utils.js +53 -0
  26. package/dist/src/utils/versions.d.ts +21 -0
  27. package/dist/src/utils/versions.js +27 -0
  28. package/generators.json +4 -4
  29. package/migrations.json +10 -1
  30. package/package.json +64 -20
  31. package/config-utils.d.ts.map +0 -1
  32. package/generators.d.ts.map +0 -1
  33. package/index.d.ts +0 -2
  34. package/index.d.ts.map +0 -1
  35. package/src/generators/configuration/configuration.d.ts.map +0 -1
  36. package/src/generators/configuration/lib/index.d.ts.map +0 -1
  37. package/src/generators/configuration/lib/normalize-options.d.ts.map +0 -1
  38. package/src/generators/init/init.d.ts.map +0 -1
  39. package/src/plugins/plugin.d.ts +0 -12
  40. package/src/plugins/plugin.d.ts.map +0 -1
  41. package/src/utils/add-build-plugin.d.ts.map +0 -1
  42. package/src/utils/ast-utils.d.ts.map +0 -1
  43. package/src/utils/e2e-web-server-info-utils.d.ts +0 -3
  44. package/src/utils/e2e-web-server-info-utils.d.ts.map +0 -1
  45. package/src/utils/has-rsbuild-plugin.d.ts.map +0 -1
  46. package/src/utils/indent-by.d.ts.map +0 -1
  47. package/src/utils/versions.d.ts +0 -17
  48. package/src/utils/versions.d.ts.map +0 -1
  49. package/src/utils/versions.js +0 -19
  50. /package/{LICENSE → dist/LICENSE} +0 -0
  51. /package/{config-utils.js → dist/config-utils.js} +0 -0
  52. /package/{generators.js → dist/generators.js} +0 -0
  53. /package/{src → dist/src}/generators/configuration/files/rsbuild.config.ts__tpl__ +0 -0
  54. /package/{src → dist/src}/generators/configuration/lib/index.js +0 -0
  55. /package/{src → dist/src}/generators/configuration/lib/normalize-options.js +0 -0
  56. /package/{src → dist/src}/generators/configuration/schema.d.ts +0 -0
  57. /package/{src → dist/src}/generators/configuration/schema.json +0 -0
  58. /package/{src → dist/src}/generators/init/schema.d.ts +0 -0
  59. /package/{src → dist/src}/utils/add-build-plugin.js +0 -0
  60. /package/{src → dist/src}/utils/ast-utils.js +0 -0
  61. /package/{src → dist/src}/utils/has-rsbuild-plugin.js +0 -0
  62. /package/{src → dist/src}/utils/indent-by.js +0 -0
@@ -3,4 +3,3 @@ export { addCopyAssets, addHtmlTemplatePath, addExperimentalSwcPlugin, addSource
3
3
  export * as versions from './src/utils/versions';
4
4
  export { getRsbuildE2EWebServerInfo } from './src/utils/e2e-web-server-info-utils';
5
5
  export { hasRsbuildPlugin } from './src/utils/has-rsbuild-plugin';
6
- //# sourceMappingURL=config-utils.d.ts.map
@@ -1,3 +1,2 @@
1
1
  export { configurationGenerator } from './src/generators/configuration/configuration';
2
2
  export { initGenerator } from './src/generators/init/init';
3
- //# sourceMappingURL=generators.d.ts.map
@@ -0,0 +1 @@
1
+ export { createNodes, createNodesV2, RsbuildPluginOptions, } from './src/plugins/plugin';
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createNodesV2 = void 0;
3
+ exports.createNodesV2 = exports.createNodes = void 0;
4
4
  var plugin_1 = require("./src/plugins/plugin");
5
+ Object.defineProperty(exports, "createNodes", { enumerable: true, get: function () { return plugin_1.createNodes; } });
5
6
  Object.defineProperty(exports, "createNodesV2", { enumerable: true, get: function () { return plugin_1.createNodesV2; } });
@@ -2,4 +2,3 @@ import { GeneratorCallback, type Tree } from '@nx/devkit';
2
2
  import { type Schema } from './schema';
3
3
  export declare function configurationGenerator(tree: Tree, schema: Schema): Promise<GeneratorCallback>;
4
4
  export default configurationGenerator;
5
- //# sourceMappingURL=configuration.d.ts.map
@@ -5,9 +5,11 @@ const devkit_1 = require("@nx/devkit");
5
5
  const lib_1 = require("./lib");
6
6
  const js_1 = require("@nx/js");
7
7
  const init_1 = require("../init/init");
8
- const versions_1 = require("../../utils/versions");
8
+ const version_utils_1 = require("../../utils/version-utils");
9
+ const assert_supported_rsbuild_version_1 = require("../../utils/assert-supported-rsbuild-version");
9
10
  const path_1 = require("path");
10
11
  async function configurationGenerator(tree, schema) {
12
+ (0, assert_supported_rsbuild_version_1.assertSupportedRsbuildVersion)(tree);
11
13
  const projectGraph = await (0, devkit_1.createProjectGraphAsync)();
12
14
  const projects = (0, devkit_1.readProjectsConfigurationFromProjectGraph)(projectGraph);
13
15
  let project = projects.projects[schema.project];
@@ -39,7 +41,8 @@ async function configurationGenerator(tree, schema) {
39
41
  delete projectJson.targets['dev'];
40
42
  }
41
43
  }
42
- tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@rsbuild/core': versions_1.rsbuildVersion }));
44
+ const rsbuildVersions = (0, version_utils_1.getRsbuildVersionsForInstalledMajor)(tree);
45
+ tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@rsbuild/core': rsbuildVersions.rsbuildVersion }, undefined, true));
43
46
  (0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, 'files'), options.projectRoot, {
44
47
  ...options,
45
48
  tpl: '',
@@ -1,2 +1 @@
1
1
  export * from './normalize-options';
2
- //# sourceMappingURL=index.d.ts.map
@@ -8,4 +8,3 @@ export interface NormalizedOptions extends Schema {
8
8
  projectRoot: string;
9
9
  }
10
10
  export declare function normalizeOptions(tree: Tree, schema: Schema, project: ProjectConfiguration): Promise<NormalizedOptions>;
11
- //# sourceMappingURL=normalize-options.d.ts.map
@@ -4,4 +4,3 @@ export declare function updateDependencies(tree: Tree, schema: InitGeneratorSche
4
4
  export declare function initGenerator(tree: Tree, schema: InitGeneratorSchema): Promise<GeneratorCallback>;
5
5
  export declare function initGeneratorInternal(tree: Tree, schema: InitGeneratorSchema): Promise<GeneratorCallback>;
6
6
  export default initGenerator;
7
- //# sourceMappingURL=init.d.ts.map
@@ -3,26 +3,30 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateDependencies = updateDependencies;
4
4
  exports.initGenerator = initGenerator;
5
5
  exports.initGeneratorInternal = initGeneratorInternal;
6
+ const internal_1 = require("@nx/devkit/internal");
6
7
  const devkit_1 = require("@nx/devkit");
7
- const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
8
8
  const plugin_1 = require("../../plugins/plugin");
9
9
  const versions_1 = require("../../utils/versions");
10
+ const version_utils_1 = require("../../utils/version-utils");
11
+ const assert_supported_rsbuild_version_1 = require("../../utils/assert-supported-rsbuild-version");
10
12
  function updateDependencies(tree, schema) {
13
+ const rsbuildVersions = (0, version_utils_1.getRsbuildVersionsForInstalledMajor)(tree);
11
14
  return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
12
15
  '@nx/rsbuild': versions_1.nxVersion,
13
- '@rsbuild/core': versions_1.rsbuildVersion,
14
- }, undefined, schema.keepExistingVersions);
16
+ '@rsbuild/core': rsbuildVersions.rsbuildVersion,
17
+ }, undefined, schema.keepExistingVersions ?? true);
15
18
  }
16
19
  function initGenerator(tree, schema) {
17
20
  return initGeneratorInternal(tree, { addPlugin: false, ...schema });
18
21
  }
19
22
  async function initGeneratorInternal(tree, schema) {
23
+ (0, assert_supported_rsbuild_version_1.assertSupportedRsbuildVersion)(tree);
20
24
  const nxJson = (0, devkit_1.readNxJson)(tree);
21
25
  const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
22
26
  nxJson.useInferencePlugins !== false;
23
27
  schema.addPlugin ??= addPluginDefault;
24
28
  if (schema.addPlugin) {
25
- await (0, add_plugin_1.addPlugin)(tree, await (0, devkit_1.createProjectGraphAsync)(), '@nx/rsbuild', plugin_1.createNodesV2, {
29
+ await (0, internal_1.addPlugin)(tree, await (0, devkit_1.createProjectGraphAsync)(), '@nx/rsbuild', plugin_1.createNodes, {
26
30
  buildTargetName: ['build', 'rsbuild:build', 'rsbuild-build'],
27
31
  devTargetName: ['dev', 'rsbuild:dev', 'rsbuild-dev'],
28
32
  previewTargetName: ['preview', 'rsbuild:preview', 'rsbuild-preview'],
@@ -13,7 +13,7 @@
13
13
  "type": "boolean",
14
14
  "x-priority": "internal",
15
15
  "description": "Keep existing dependencies versions",
16
- "default": false
16
+ "default": true
17
17
  },
18
18
  "updatePackageScripts": {
19
19
  "type": "boolean",
@@ -0,0 +1,9 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ export default function migrateCreateNodesV2ToCreateNodes(tree: Tree): Promise<void>;
3
+ /**
4
+ * Rewrites named imports and re-exports of `createNodesV2` to `createNodes`
5
+ * when they come from one of the given module specifiers. Only the named
6
+ * bindings are touched — the module specifier, the `import`/`export` keyword,
7
+ * any `type` modifier, and any default import are left untouched.
8
+ */
9
+ export declare function rewriteCreateNodesV2Imports(source: string, specifiers: ReadonlySet<string>): string;
@@ -0,0 +1,223 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = migrateCreateNodesV2ToCreateNodes;
4
+ exports.rewriteCreateNodesV2Imports = rewriteCreateNodesV2Imports;
5
+ const devkit_1 = require("@nx/devkit");
6
+ const TS_EXTENSIONS = ['.ts', '.tsx', '.cts', '.mts'];
7
+ const DEPRECATED_NAME = 'createNodesV2';
8
+ const CANONICAL_NAME = 'createNodes';
9
+ // Module specifiers from which `@nx/rsbuild` publicly exposes `createNodesV2`.
10
+ // A named import or re-export of `createNodesV2` from one of these is rewritten
11
+ // to the canonical `createNodes` export.
12
+ const TARGET_SPECIFIERS = new Set(['@nx/rsbuild']);
13
+ let ts;
14
+ async function migrateCreateNodesV2ToCreateNodes(tree) {
15
+ let touchedCount = 0;
16
+ (0, devkit_1.visitNotIgnoredFiles)(tree, '.', (filePath) => {
17
+ if (!TS_EXTENSIONS.some((ext) => filePath.endsWith(ext))) {
18
+ return;
19
+ }
20
+ const original = tree.read(filePath, 'utf-8');
21
+ if (!original || !original.includes(DEPRECATED_NAME)) {
22
+ return;
23
+ }
24
+ const updated = rewriteCreateNodesV2Imports(original, TARGET_SPECIFIERS);
25
+ if (updated !== original) {
26
+ tree.write(filePath, updated);
27
+ touchedCount += 1;
28
+ }
29
+ });
30
+ if (touchedCount > 0) {
31
+ devkit_1.logger.info(`Renamed \`${DEPRECATED_NAME}\` imports to \`${CANONICAL_NAME}\` in ${touchedCount} file(s).`);
32
+ }
33
+ await (0, devkit_1.formatFiles)(tree);
34
+ }
35
+ /**
36
+ * Rewrites named imports and re-exports of `createNodesV2` to `createNodes`
37
+ * when they come from one of the given module specifiers. Only the named
38
+ * bindings are touched — the module specifier, the `import`/`export` keyword,
39
+ * any `type` modifier, and any default import are left untouched.
40
+ */
41
+ function rewriteCreateNodesV2Imports(source, specifiers) {
42
+ ts ??= (0, devkit_1.ensurePackage)('typescript', '*');
43
+ const sourceFile = ts.createSourceFile('tmp.ts', source, ts.ScriptTarget.Latest,
44
+ /* setParentNodes */ true, ts.ScriptKind.TSX);
45
+ const changes = [];
46
+ let renameLocalUsages = false;
47
+ for (const stmt of sourceFile.statements) {
48
+ if (ts.isImportDeclaration(stmt)) {
49
+ renameLocalUsages =
50
+ collectImportRewrite(sourceFile, stmt, specifiers, changes) ||
51
+ renameLocalUsages;
52
+ }
53
+ else if (ts.isExportDeclaration(stmt)) {
54
+ collectExportRewrite(sourceFile, stmt, specifiers, changes);
55
+ }
56
+ }
57
+ // Renaming a local `createNodesV2` import binding to `createNodes` (a lone
58
+ // `{ createNodesV2 }`, or one deduped against an existing `createNodes`)
59
+ // changes the name in scope, so value references to `createNodesV2` in the
60
+ // file body must be renamed too — otherwise they dangle. Aliased imports and
61
+ // re-exports keep their local name, so they never trigger this.
62
+ if (renameLocalUsages) {
63
+ collectValueUsageRewrites(sourceFile, changes);
64
+ }
65
+ return changes.length > 0 ? (0, devkit_1.applyChangesToString)(source, changes) : source;
66
+ }
67
+ function isTargetSpecifier(node, specifiers) {
68
+ return ts.isStringLiteral(node) && specifiers.has(node.text);
69
+ }
70
+ function collectImportRewrite(sourceFile, stmt, specifiers, changes) {
71
+ if (!isTargetSpecifier(stmt.moduleSpecifier, specifiers)) {
72
+ return false;
73
+ }
74
+ const namedBindings = stmt.importClause?.namedBindings;
75
+ // Only `import { ... }` carries renameable named bindings. `import x`,
76
+ // `import * as ns`, and side-effect imports reference the module wholesale
77
+ // and keep working through the `createNodesV2` runtime alias, so we leave
78
+ // them be. A mixed `import def, { createNodesV2 }` still has its named
79
+ // bindings rewritten below — the default binding is untouched.
80
+ if (!namedBindings || !ts.isNamedImports(namedBindings)) {
81
+ return false;
82
+ }
83
+ // The local `createNodesV2` binding only disappears when it is imported
84
+ // without an alias — a lone `{ createNodesV2 }` or one deduped against an
85
+ // existing `createNodes`. `{ createNodesV2 as x }` keeps the local `x`, so
86
+ // its in-file usages are unaffected and must not be rewritten.
87
+ const localBindingRenamed = namedBindings.elements.some((el) => el.name.text === DEPRECATED_NAME &&
88
+ (el.propertyName ?? el.name).text === DEPRECATED_NAME);
89
+ rewriteNamedBindings(sourceFile, namedBindings, changes);
90
+ return localBindingRenamed;
91
+ }
92
+ function collectExportRewrite(sourceFile, stmt, specifiers, changes) {
93
+ if (!stmt.moduleSpecifier ||
94
+ !isTargetSpecifier(stmt.moduleSpecifier, specifiers)) {
95
+ return;
96
+ }
97
+ // `export { ... } from '...'` can be rewritten; `export * from '...'` has no
98
+ // named bindings to rename.
99
+ if (!stmt.exportClause || !ts.isNamedExports(stmt.exportClause)) {
100
+ return;
101
+ }
102
+ rewriteNamedBindings(sourceFile, stmt.exportClause, changes);
103
+ }
104
+ /**
105
+ * Re-renders the `{ ... }` of a named import/export, renaming any
106
+ * `createNodesV2` specifier to `createNodes`. If renaming would collide with a
107
+ * `createNodes` that is already present (e.g. `{ createNodes, createNodesV2 }`),
108
+ * the duplicate is dropped. Returns without recording a change when the binding
109
+ * list contains no `createNodesV2`.
110
+ */
111
+ function rewriteNamedBindings(sourceFile, namedBindings, changes) {
112
+ const elements = namedBindings.elements;
113
+ const hasDeprecated = elements.some((el) => (el.propertyName ?? el.name).text === DEPRECATED_NAME);
114
+ if (!hasDeprecated) {
115
+ return;
116
+ }
117
+ const seen = new Set();
118
+ const rendered = [];
119
+ for (const el of elements) {
120
+ const text = renderSpecifier(el);
121
+ if (!seen.has(text)) {
122
+ seen.add(text);
123
+ rendered.push(text);
124
+ }
125
+ }
126
+ const start = namedBindings.getStart(sourceFile);
127
+ changes.push({
128
+ type: devkit_1.ChangeType.Delete,
129
+ start,
130
+ length: namedBindings.getEnd() - start,
131
+ }, {
132
+ type: devkit_1.ChangeType.Insert,
133
+ index: start,
134
+ text: `{ ${rendered.join(', ')} }`,
135
+ });
136
+ }
137
+ function renderSpecifier(el) {
138
+ const typePrefix = el.isTypeOnly ? 'type ' : '';
139
+ const rename = (name) => name === DEPRECATED_NAME ? CANONICAL_NAME : name;
140
+ // `{ name }` — no alias, so the local binding follows the rename.
141
+ if (!el.propertyName) {
142
+ return `${typePrefix}${rename(el.name.text)}`;
143
+ }
144
+ // `{ propertyName as name }` — only the imported (left) side is renamed; the
145
+ // local alias is preserved. A now-redundant alias such as
146
+ // `createNodesV2 as createNodes` collapses to `createNodes`.
147
+ const canonicalImported = rename(el.propertyName.text);
148
+ const localName = el.name.text;
149
+ return canonicalImported === localName
150
+ ? `${typePrefix}${localName}`
151
+ : `${typePrefix}${canonicalImported} as ${localName}`;
152
+ }
153
+ /**
154
+ * Renames value references of `createNodesV2` to `createNodes` in the file
155
+ * body. Only called once a local `createNodesV2` import binding has actually
156
+ * been renamed, so these references would otherwise dangle. Occurrences that
157
+ * are not references to that binding are skipped: the import/export
158
+ * declarations themselves, property accesses (`x.createNodesV2`), qualified
159
+ * type names, object-literal keys, and declaration names that shadow the
160
+ * import. A shorthand property (`{ createNodesV2 }`) is expanded to
161
+ * `{ createNodesV2: createNodes }` so the property key is preserved. Strings
162
+ * and comments are never `Identifier` nodes, so they are left alone.
163
+ */
164
+ function collectValueUsageRewrites(sourceFile, changes) {
165
+ const visit = (node) => {
166
+ if (ts.isIdentifier(node) &&
167
+ node.text === DEPRECATED_NAME &&
168
+ isRenamableValueUsage(node)) {
169
+ const start = node.getStart(sourceFile);
170
+ changes.push({
171
+ type: devkit_1.ChangeType.Delete,
172
+ start,
173
+ length: node.getEnd() - start,
174
+ }, {
175
+ type: devkit_1.ChangeType.Insert,
176
+ index: start,
177
+ text: ts.isShorthandPropertyAssignment(node.parent)
178
+ ? `${DEPRECATED_NAME}: ${CANONICAL_NAME}`
179
+ : CANONICAL_NAME,
180
+ });
181
+ }
182
+ node.forEachChild(visit);
183
+ };
184
+ sourceFile.forEachChild(visit);
185
+ }
186
+ /**
187
+ * Whether a `createNodesV2` identifier is a value reference to the renamed
188
+ * import binding, as opposed to a position that must be left untouched.
189
+ */
190
+ function isRenamableValueUsage(node) {
191
+ const parent = node.parent;
192
+ if (!parent) {
193
+ return false;
194
+ }
195
+ // Import/export bindings — already handled by the declaration rewrite.
196
+ if (ts.isImportSpecifier(parent) ||
197
+ ts.isExportSpecifier(parent) ||
198
+ ts.isImportClause(parent) ||
199
+ ts.isNamespaceImport(parent)) {
200
+ return false;
201
+ }
202
+ // `x.createNodesV2` / `X.createNodesV2` — a member name, not the binding.
203
+ if (ts.isPropertyAccessExpression(parent) && parent.name === node) {
204
+ return false;
205
+ }
206
+ if (ts.isQualifiedName(parent) && parent.right === node) {
207
+ return false;
208
+ }
209
+ // `{ createNodesV2: ... }` — an object-literal key, not the binding.
210
+ if (ts.isPropertyAssignment(parent) && parent.name === node) {
211
+ return false;
212
+ }
213
+ // A declaration whose name shadows the import (variable, param, etc.).
214
+ if ((ts.isVariableDeclaration(parent) ||
215
+ ts.isParameter(parent) ||
216
+ ts.isBindingElement(parent) ||
217
+ ts.isFunctionDeclaration(parent) ||
218
+ ts.isClassDeclaration(parent)) &&
219
+ parent.name === node) {
220
+ return false;
221
+ }
222
+ return true;
223
+ }
@@ -0,0 +1,15 @@
1
+ import { CreateNodes } from '@nx/devkit';
2
+ export interface RsbuildPluginOptions {
3
+ buildTargetName?: string;
4
+ devTargetName?: string;
5
+ previewTargetName?: string;
6
+ inspectTargetName?: string;
7
+ typecheckTargetName?: string;
8
+ buildDepsTargetName?: string;
9
+ watchDepsTargetName?: string;
10
+ }
11
+ export declare const createNodes: CreateNodes<RsbuildPluginOptions>;
12
+ /**
13
+ * @deprecated Use {@link createNodes} instead. This will be removed in Nx 24.
14
+ */
15
+ export declare const createNodesV2: CreateNodes<RsbuildPluginOptions>;
@@ -1,54 +1,65 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createNodesV2 = void 0;
3
+ exports.createNodesV2 = exports.createNodes = 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 file_hasher_1 = require("nx/src/hasher/file-hasher");
7
7
  const cache_directory_1 = require("nx/src/utils/cache-directory");
8
- const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
9
- const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
8
+ const internal_2 = require("@nx/js/internal");
10
9
  const js_1 = require("@nx/js");
11
10
  const fs_1 = require("fs");
12
11
  const path_1 = require("path");
13
12
  const minimatch_1 = require("minimatch");
14
- const core_1 = require("@rsbuild/core");
15
- const util_1 = require("@nx/js/src/plugins/typescript/util");
16
- function readTargetsCache(cachePath) {
17
- return (0, fs_1.existsSync)(cachePath) ? (0, devkit_1.readJsonFile)(cachePath) : {};
18
- }
19
- function writeTargetsCache(cachePath, results) {
20
- (0, devkit_1.writeJsonFile)(cachePath, results);
21
- }
22
13
  const rsbuildConfigGlob = '**/rsbuild.config.{js,ts,mjs,mts,cjs,cts}';
23
- exports.createNodesV2 = [
14
+ exports.createNodes = [
24
15
  rsbuildConfigGlob,
25
16
  async (configFilePaths, options, context) => {
26
17
  const optionsHash = (0, file_hasher_1.hashObject)(options);
27
18
  const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `rsbuild-${optionsHash}.hash`);
28
- const targetsCache = readTargetsCache(cachePath);
29
- const isUsingTsSolutionSetup = (0, ts_solution_setup_1.isUsingTsSolutionSetup)();
30
- const pmc = (0, devkit_1.getPackageManagerCommand)((0, devkit_1.detectPackageManager)(context.workspaceRoot));
19
+ const targetsCache = new internal_1.PluginCache(cachePath);
20
+ const isUsingTsSolutionSetup = (0, internal_2.isUsingTsSolutionSetup)();
21
+ const packageManager = (0, devkit_1.detectPackageManager)(context.workspaceRoot);
22
+ const pmc = (0, devkit_1.getPackageManagerCommand)(packageManager);
23
+ const lockFileName = (0, js_1.getLockFileName)(packageManager);
24
+ const normalizedOptions = normalizeOptions(options);
31
25
  try {
32
- return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => createNodesInternal(configFile, options, context, targetsCache, isUsingTsSolutionSetup, pmc), configFilePaths, options, context);
26
+ const { entries, preErrors } = await filterRsbuildConfigs(configFilePaths, context);
27
+ const projectHashes = await (0, internal_1.calculateHashesForCreateNodes)(entries.map((e) => e.projectRoot), { ...normalizedOptions, isUsingTsSolutionSetup }, context, entries.map(() => [lockFileName]));
28
+ let results = [];
29
+ let nodeErrors = [];
30
+ try {
31
+ results = await (0, devkit_1.createNodesFromFiles)((configFile, _, ctx, idx) => createNodesInternal(configFile, normalizedOptions, ctx, targetsCache, isUsingTsSolutionSetup, pmc, entries[idx].tsConfigFiles, projectHashes[idx]), entries.map((e) => e.configFile), options, context);
32
+ }
33
+ catch (e) {
34
+ if (e instanceof devkit_1.AggregateCreateNodesError) {
35
+ results = e.partialResults ?? [];
36
+ nodeErrors = e.errors;
37
+ }
38
+ else {
39
+ throw e;
40
+ }
41
+ }
42
+ const allErrors = [...preErrors, ...nodeErrors];
43
+ if (allErrors.length > 0) {
44
+ throw new devkit_1.AggregateCreateNodesError(allErrors, results);
45
+ }
46
+ return results;
33
47
  }
34
48
  finally {
35
- writeTargetsCache(cachePath, targetsCache);
49
+ targetsCache.writeToDisk();
36
50
  }
37
51
  },
38
52
  ];
39
- async function createNodesInternal(configFilePath, options, context, targetsCache, isUsingTsSolutionSetup, pmc) {
53
+ /**
54
+ * @deprecated Use {@link createNodes} instead. This will be removed in Nx 24.
55
+ */
56
+ exports.createNodesV2 = exports.createNodes;
57
+ async function createNodesInternal(configFilePath, normalizedOptions, context, targetsCache, isUsingTsSolutionSetup, pmc, tsConfigFiles, hash) {
40
58
  const projectRoot = (0, path_1.dirname)(configFilePath);
41
- // Do not create a project if package.json and project.json isn't there.
42
- const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
43
- if (!siblingFiles.includes('package.json') &&
44
- !siblingFiles.includes('project.json')) {
45
- return {};
59
+ if (!targetsCache.has(hash)) {
60
+ targetsCache.set(hash, await createRsbuildTargets(configFilePath, projectRoot, normalizedOptions, tsConfigFiles, isUsingTsSolutionSetup, context, pmc));
46
61
  }
47
- const tsConfigFiles = siblingFiles.filter((p) => (0, minimatch_1.minimatch)(p, 'tsconfig*{.json,.*.json}')) ?? [];
48
- const normalizedOptions = normalizeOptions(options);
49
- const hash = await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, { ...normalizedOptions, isUsingTsSolutionSetup }, context, [(0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot))]);
50
- targetsCache[hash] ??= await createRsbuildTargets(configFilePath, projectRoot, normalizedOptions, tsConfigFiles, isUsingTsSolutionSetup, context, pmc);
51
- const { targets, metadata } = targetsCache[hash];
62
+ const { targets, metadata } = targetsCache.get(hash);
52
63
  return {
53
64
  projects: {
54
65
  [projectRoot]: {
@@ -61,13 +72,17 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
61
72
  }
62
73
  async function createRsbuildTargets(configFilePath, projectRoot, options, tsConfigFiles, isUsingTsSolutionSetup, context, pmc) {
63
74
  const absoluteConfigFilePath = (0, devkit_1.joinPathFragments)(context.workspaceRoot, configFilePath);
64
- const rsbuildConfig = await (0, core_1.loadConfig)({
75
+ // Required lazily: `@rsbuild/core` is an optional peer dependency, so it
76
+ // may be absent when the plugin is loaded in a workspace that doesn't use
77
+ // Rsbuild yet (e.g. before a generator installs it).
78
+ const { loadConfig } = require('@rsbuild/core');
79
+ const rsbuildConfig = await loadConfig({
65
80
  path: absoluteConfigFilePath,
66
81
  });
67
82
  if (!rsbuildConfig.filePath) {
68
83
  return { targets: {}, metadata: {} };
69
84
  }
70
- const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
85
+ const namedInputs = (0, internal_1.getNamedInputs)(projectRoot, context);
71
86
  const { buildOutputs } = getOutputs(rsbuildConfig.content, projectRoot, context.workspaceRoot);
72
87
  const targets = {};
73
88
  targets[options.buildTargetName] = {
@@ -156,13 +171,14 @@ async function createRsbuildTargets(configFilePath, projectRoot, options, tsConf
156
171
  ];
157
172
  }
158
173
  }
159
- (0, util_1.addBuildAndWatchDepsTargets)(context.workspaceRoot, projectRoot, targets, options, pmc);
174
+ (0, internal_2.addBuildAndWatchDepsTargets)(context.workspaceRoot, projectRoot, targets, options, pmc);
160
175
  return { targets, metadata: {} };
161
176
  }
162
177
  function getOutputs(rsbuildConfig, projectRoot, workspaceRoot) {
163
- const buildOutputPath = normalizeOutputPath(rsbuildConfig?.output?.distPath?.root
164
- ? (0, path_1.dirname)(rsbuildConfig?.output.distPath.root)
165
- : undefined, projectRoot, workspaceRoot, 'dist');
178
+ // `output.distPath.root` is the directory Rsbuild emits the build into, so
179
+ // it is the build output as-is. (Don't take its `dirname` - that points at
180
+ // the parent directory, which can capture sibling projects' outputs.)
181
+ const buildOutputPath = normalizeOutputPath(rsbuildConfig?.output?.distPath?.root, projectRoot, workspaceRoot, 'dist');
166
182
  return {
167
183
  buildOutputs: [buildOutputPath],
168
184
  };
@@ -190,6 +206,29 @@ function normalizeOutputPath(outputPath, projectRoot, workspaceRoot, path) {
190
206
  }
191
207
  }
192
208
  }
209
+ async function filterRsbuildConfigs(configFiles, context) {
210
+ const preErrors = [];
211
+ const candidates = await Promise.all(configFiles.map(async (configFile) => {
212
+ try {
213
+ const projectRoot = (0, path_1.dirname)(configFile);
214
+ const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
215
+ if (!siblingFiles.includes('package.json') &&
216
+ !siblingFiles.includes('project.json')) {
217
+ return null;
218
+ }
219
+ const tsConfigFiles = siblingFiles.filter((p) => (0, minimatch_1.minimatch)(p, 'tsconfig*{.json,.*.json}')) ?? [];
220
+ return { configFile, projectRoot, tsConfigFiles };
221
+ }
222
+ catch (e) {
223
+ preErrors.push([configFile, e]);
224
+ return null;
225
+ }
226
+ }));
227
+ return {
228
+ entries: candidates.filter((c) => c !== null),
229
+ preErrors,
230
+ };
231
+ }
193
232
  function normalizeOptions(options) {
194
233
  options ??= {};
195
234
  options.buildTargetName ??= 'build';
@@ -8,4 +8,3 @@ import { type Tree } from '@nx/devkit';
8
8
  * @param options - Optional but should be defined as a string such as `property: {foo: 'bar'}`
9
9
  */
10
10
  export declare function addBuildPlugin(tree: Tree, pathToConfigFile: string, importPath: string, pluginName: string, options?: string): void;
11
- //# sourceMappingURL=add-build-plugin.d.ts.map
@@ -0,0 +1,2 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ export declare function assertSupportedRsbuildVersion(tree: Tree): void;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertSupportedRsbuildVersion = assertSupportedRsbuildVersion;
4
+ const internal_1 = require("@nx/devkit/internal");
5
+ const versions_1 = require("./versions");
6
+ function assertSupportedRsbuildVersion(tree) {
7
+ (0, internal_1.assertSupportedPackageVersion)(tree, '@rsbuild/core', versions_1.minSupportedRsbuildVersion);
8
+ }
@@ -3,4 +3,3 @@ export declare function addHtmlTemplatePath(tree: Tree, configFilePath: string,
3
3
  export declare function addCopyAssets(tree: Tree, configFilePath: string, from: string): void;
4
4
  export declare function addExperimentalSwcPlugin(tree: Tree, configFilePath: string, pluginName: string): void;
5
5
  export declare function addSourceDefine(tree: Tree, configFilePath: string, key: string, value: string): void;
6
- //# sourceMappingURL=ast-utils.d.ts.map
@@ -0,0 +1,2 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ export declare function getRsbuildE2EWebServerInfo(tree: Tree, projectName: string, configFilePath: string, isPluginBeingAdded: boolean, e2ePortOverride?: number): Promise<import("@nx/devkit/internal").E2EWebServerDetails>;
@@ -2,15 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getRsbuildE2EWebServerInfo = getRsbuildE2EWebServerInfo;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const e2e_web_server_info_utils_1 = require("@nx/devkit/src/generators/e2e-web-server-info-utils");
5
+ const internal_1 = require("@nx/devkit/internal");
6
6
  async function getRsbuildE2EWebServerInfo(tree, projectName, configFilePath, isPluginBeingAdded, e2ePortOverride) {
7
7
  const nxJson = (0, devkit_1.readNxJson)(tree);
8
8
  let e2ePort = e2ePortOverride ?? 4200;
9
- if (nxJson.targetDefaults?.['dev'] &&
10
- nxJson.targetDefaults?.['dev'].options?.port) {
11
- e2ePort = nxJson.targetDefaults?.['dev'].options?.port;
9
+ const devPort = (0, internal_1.readTargetDefaultsForTarget)('dev', nxJson.targetDefaults)
10
+ ?.options?.port;
11
+ if (devPort) {
12
+ e2ePort = devPort;
12
13
  }
13
- return (0, e2e_web_server_info_utils_1.getE2EWebServerInfo)(tree, projectName, {
14
+ return (0, internal_1.getE2EWebServerInfo)(tree, projectName, {
14
15
  plugin: '@nx/rsbuild',
15
16
  serveTargetName: 'devTargetName',
16
17
  serveStaticTargetName: 'previewTargetName',
@@ -1,3 +1,2 @@
1
1
  import { type Tree } from '@nx/devkit';
2
2
  export declare function hasRsbuildPlugin(tree: Tree, projectPath?: string): boolean;
3
- //# sourceMappingURL=has-rsbuild-plugin.d.ts.map
@@ -1,2 +1 @@
1
1
  export declare function indentBy(tabNumber: number): (str: string) => string;
2
- //# sourceMappingURL=indent-by.d.ts.map
@@ -0,0 +1,27 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ import { type SupportedRsbuildMajorVersion } from './versions';
3
+ /**
4
+ * Returns the declared @rsbuild/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 `assertSupportedRsbuildVersion`.
8
+ */
9
+ export declare function getInstalledRsbuildMajorVersion(tree: Tree): SupportedRsbuildMajorVersion | undefined;
10
+ /**
11
+ * Returns the installed @rsbuild/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 @rsbuild/core can't be resolved or the
14
+ * installed major isn't supported.
15
+ */
16
+ export declare function getInstalledRsbuildVersionRuntime(): SupportedRsbuildMajorVersion | 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 getRsbuildVersionsForInstalledMajor(tree: Tree): {
23
+ rsbuildVersion: string;
24
+ rsbuildPluginReactVersion: string;
25
+ rsbuildPluginVueVersion: string;
26
+ rsbuildPluginSassVersion: string;
27
+ };
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getInstalledRsbuildMajorVersion = getInstalledRsbuildMajorVersion;
4
+ exports.getInstalledRsbuildVersionRuntime = getInstalledRsbuildVersionRuntime;
5
+ exports.getRsbuildVersionsForInstalledMajor = getRsbuildVersionsForInstalledMajor;
6
+ const internal_1 = require("@nx/devkit/internal");
7
+ const semver_1 = require("semver");
8
+ const versions_1 = require("./versions");
9
+ const RSBUILD_CORE_PACKAGE = '@rsbuild/core';
10
+ /**
11
+ * Returns the declared @rsbuild/core major version from the workspace's
12
+ * package.json when it matches a supported major, or `undefined` otherwise
13
+ * (fresh install, dist tag, unknown major). Below-floor enforcement is
14
+ * handled at generator entry points via `assertSupportedRsbuildVersion`.
15
+ */
16
+ function getInstalledRsbuildMajorVersion(tree) {
17
+ const declared = (0, internal_1.getDeclaredPackageVersion)(tree, RSBUILD_CORE_PACKAGE);
18
+ if (!declared) {
19
+ return undefined;
20
+ }
21
+ const installedMajor = (0, semver_1.major)(declared);
22
+ return installedMajor in versions_1.backwardCompatibleRsbuildVersions
23
+ ? installedMajor
24
+ : undefined;
25
+ }
26
+ /**
27
+ * Returns the installed @rsbuild/core major version resolved at runtime from
28
+ * node_modules. For use in executors and runtime code where no Tree is
29
+ * available. Returns `null` when @rsbuild/core can't be resolved or the
30
+ * installed major isn't supported.
31
+ */
32
+ function getInstalledRsbuildVersionRuntime() {
33
+ const version = (0, internal_1.getInstalledPackageVersion)(RSBUILD_CORE_PACKAGE);
34
+ if (!version) {
35
+ return null;
36
+ }
37
+ const installedMajor = (0, semver_1.major)(version);
38
+ return installedMajor in versions_1.backwardCompatibleRsbuildVersions
39
+ ? installedMajor
40
+ : null;
41
+ }
42
+ /**
43
+ * Returns the version-map entry for the installed major, falling back to the
44
+ * latest supported map when no installed version is detected (fresh install)
45
+ * or the detected major is outside the supported window.
46
+ */
47
+ function getRsbuildVersionsForInstalledMajor(tree) {
48
+ const installed = getInstalledRsbuildMajorVersion(tree);
49
+ if (installed === undefined) {
50
+ return versions_1.latestRsbuildVersions;
51
+ }
52
+ return versions_1.backwardCompatibleRsbuildVersions[installed];
53
+ }
@@ -0,0 +1,21 @@
1
+ export declare const nxVersion: any;
2
+ export declare const minSupportedRsbuildVersion = "1.0.0";
3
+ export declare const supportedRsbuildMajorVersions: readonly [1];
4
+ export type SupportedRsbuildMajorVersion = (typeof supportedRsbuildMajorVersions)[number];
5
+ type RsbuildVersionMap = {
6
+ rsbuildVersion: string;
7
+ rsbuildPluginReactVersion: string;
8
+ rsbuildPluginVueVersion: string;
9
+ rsbuildPluginSassVersion: string;
10
+ };
11
+ export declare const latestRsbuildVersions: RsbuildVersionMap;
12
+ export declare const backwardCompatibleRsbuildVersions: Record<SupportedRsbuildMajorVersion, RsbuildVersionMap>;
13
+ /**
14
+ * Kept for backward compatibility with code paths that don't yet branch on
15
+ * the detected installed major. Points at the latest supported major.
16
+ */
17
+ export declare const rsbuildVersion: string;
18
+ export declare const rsbuildPluginReactVersion: string;
19
+ export declare const rsbuildPluginVueVersion: string;
20
+ export declare const rsbuildPluginSassVersion: string;
21
+ export {};
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.rsbuildPluginSassVersion = exports.rsbuildPluginVueVersion = exports.rsbuildPluginReactVersion = exports.rsbuildVersion = exports.backwardCompatibleRsbuildVersions = exports.latestRsbuildVersions = exports.supportedRsbuildMajorVersions = exports.minSupportedRsbuildVersion = exports.nxVersion = void 0;
4
+ const path_1 = require("path");
5
+ exports.nxVersion = require((0, path_1.join)('@nx/rsbuild', 'package.json')).version;
6
+ exports.minSupportedRsbuildVersion = '1.0.0';
7
+ // Supported `@rsbuild/core` majors. Currently v1 only — v2 ships as pure
8
+ // ESM, which @nx/rsbuild (CommonJS) cannot consume without a deeper
9
+ // refactor; tracked separately.
10
+ exports.supportedRsbuildMajorVersions = [1];
11
+ exports.latestRsbuildVersions = {
12
+ rsbuildVersion: '1.1.10',
13
+ rsbuildPluginReactVersion: '1.1.0',
14
+ rsbuildPluginVueVersion: '1.0.5',
15
+ rsbuildPluginSassVersion: '1.1.2',
16
+ };
17
+ exports.backwardCompatibleRsbuildVersions = {
18
+ 1: exports.latestRsbuildVersions,
19
+ };
20
+ /**
21
+ * Kept for backward compatibility with code paths that don't yet branch on
22
+ * the detected installed major. Points at the latest supported major.
23
+ */
24
+ exports.rsbuildVersion = exports.latestRsbuildVersions.rsbuildVersion;
25
+ exports.rsbuildPluginReactVersion = exports.latestRsbuildVersions.rsbuildPluginReactVersion;
26
+ exports.rsbuildPluginVueVersion = exports.latestRsbuildVersions.rsbuildPluginVueVersion;
27
+ exports.rsbuildPluginSassVersion = exports.latestRsbuildVersions.rsbuildPluginSassVersion;
package/generators.json CHANGED
@@ -3,15 +3,15 @@
3
3
  "version": "0.1",
4
4
  "generators": {
5
5
  "init": {
6
- "factory": "./src/generators/init/init#initGeneratorInternal",
7
- "schema": "./src/generators/init/schema.json",
6
+ "factory": "./dist/src/generators/init/init#initGeneratorInternal",
7
+ "schema": "./dist/src/generators/init/schema.json",
8
8
  "description": "Initialize the `@nx/rsbuild` plugin.",
9
9
  "aliases": ["ng-add"],
10
10
  "hidden": true
11
11
  },
12
12
  "configuration": {
13
- "factory": "./src/generators/configuration/configuration",
14
- "schema": "./src/generators/configuration/schema.json",
13
+ "factory": "./dist/src/generators/configuration/configuration",
14
+ "schema": "./dist/src/generators/configuration/schema.json",
15
15
  "description": "Add an Rsbuild configuration for the provided project."
16
16
  }
17
17
  }
package/migrations.json CHANGED
@@ -1 +1,10 @@
1
- {}
1
+ {
2
+ "generators": {
3
+ "update-23-0-0-migrate-create-nodes-v2-import": {
4
+ "version": "23.0.0-beta.24",
5
+ "description": "Rename imports of `createNodesV2` from `@nx/rsbuild` to the canonical `createNodes` export.",
6
+ "implementation": "./dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes",
7
+ "documentation": "./dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes.md"
8
+ }
9
+ }
10
+ }
package/package.json CHANGED
@@ -1,8 +1,15 @@
1
1
  {
2
2
  "name": "@nx/rsbuild",
3
3
  "description": "The Nx Plugin for Rsbuild contains an Nx plugin, executors and utilities that support building applications using Rsbuild.",
4
- "version": "23.0.0-pr.35465.2bc2643",
4
+ "version": "23.0.0-rc.0",
5
5
  "type": "commonjs",
6
+ "files": [
7
+ "dist",
8
+ "!dist/tsconfig.tsbuildinfo",
9
+ "migrations.json",
10
+ "executors.json",
11
+ "generators.json"
12
+ ],
6
13
  "publishConfig": {
7
14
  "access": "public"
8
15
  },
@@ -25,43 +32,80 @@
25
32
  "author": "Colum Ferry",
26
33
  "license": "MIT",
27
34
  "homepage": "https://nx.dev",
28
- "main": "index.js",
35
+ "main": "./dist/index.js",
36
+ "types": "./dist/index.d.ts",
37
+ "typesVersions": {
38
+ "*": {
39
+ "generators": [
40
+ "dist/generators.d.ts"
41
+ ],
42
+ "config-utils": [
43
+ "dist/config-utils.d.ts"
44
+ ],
45
+ "src/*": [
46
+ "dist/src/*.d.ts"
47
+ ],
48
+ "src/*.js": [
49
+ "dist/src/*.d.ts"
50
+ ]
51
+ }
52
+ },
29
53
  "generators": "./generators.json",
30
54
  "executors": "./executors.json",
31
55
  "dependencies": {
32
56
  "tslib": "^2.3.0",
33
- "@nx/devkit": "23.0.0-pr.35465.2bc2643",
34
- "@nx/js": "23.0.0-pr.35465.2bc2643",
35
- "@rsbuild/core": "1.1.8",
36
- "minimatch": "10.2.4",
37
- "@phenomnomnominal/tsquery": "~6.1.4"
57
+ "minimatch": "10.2.5",
58
+ "semver": "^7.6.3",
59
+ "@phenomnomnominal/tsquery": "~6.2.0",
60
+ "@nx/devkit": "23.0.0-rc.0",
61
+ "@nx/js": "23.0.0-rc.0"
38
62
  },
39
63
  "devDependencies": {
40
- "nx": "23.0.0-pr.35465.2bc2643"
64
+ "nx": "23.0.0-rc.0"
65
+ },
66
+ "peerDependencies": {
67
+ "@rsbuild/core": "^1.0.0"
68
+ },
69
+ "peerDependenciesMeta": {
70
+ "@rsbuild/core": {
71
+ "optional": true
72
+ }
41
73
  },
42
- "peerDependencies": {},
43
74
  "nx-migrations": {
44
- "migrations": "./migrations.json"
75
+ "migrations": "./migrations.json",
76
+ "supportsOptionalMigrations": true
45
77
  },
46
78
  "exports": {
47
79
  ".": {
48
- "types": "./index.d.ts",
49
- "default": "./index.js"
80
+ "@nx/nx-source": "./index.ts",
81
+ "types": "./dist/index.d.ts",
82
+ "default": "./dist/index.js"
50
83
  },
51
- "./executors/*/schema.json": "./src/executors/*/schema.json",
52
- "./executors/*/schema": "./src/executors/*/schema.d.ts",
53
- "./generators/*/schema.json": "./src/generators/*/schema.json",
54
- "./generators/*/schema": "./src/generators/*/schema.d.ts",
55
84
  "./package.json": {
56
85
  "default": "./package.json"
57
86
  },
87
+ "./migrations.json": "./migrations.json",
88
+ "./generators.json": "./generators.json",
89
+ "./executors.json": "./executors.json",
58
90
  "./generators": {
59
- "types": "./generators.d.ts",
60
- "default": "./generators.js"
91
+ "@nx/nx-source": "./generators.ts",
92
+ "types": "./dist/generators.d.ts",
93
+ "default": "./dist/generators.js"
61
94
  },
62
95
  "./config-utils": {
63
- "types": "./config-utils.d.ts",
64
- "default": "./config-utils.js"
96
+ "@nx/nx-source": "./config-utils.ts",
97
+ "types": "./dist/config-utils.d.ts",
98
+ "default": "./dist/config-utils.js"
99
+ },
100
+ "./src/*": {
101
+ "@nx/nx-source": "./src/*.ts",
102
+ "types": "./dist/src/*.d.ts",
103
+ "default": "./dist/src/*.js"
104
+ },
105
+ "./src/*.js": {
106
+ "@nx/nx-source": "./src/*.ts",
107
+ "types": "./dist/src/*.d.ts",
108
+ "default": "./dist/src/*.js"
65
109
  }
66
110
  }
67
111
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-utils.d.ts","sourceRoot":"","sources":["../../../packages/rsbuild/config-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,wBAAwB,EACxB,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"generators.d.ts","sourceRoot":"","sources":["../../../packages/rsbuild/generators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC"}
package/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export { createNodesV2, RsbuildPluginOptions } from './src/plugins/plugin';
2
- //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/rsbuild/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../../../../packages/rsbuild/src/generators/configuration/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAIjB,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,UAAU,CAAC;AAOvC,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAiDtE;AAED,eAAe,sBAAsB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../packages/rsbuild/src/generators/configuration/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalize-options.d.ts","sourceRoot":"","sources":["../../../../../../../packages/rsbuild/src/generators/configuration/lib/normalize-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,IAAI,EACT,KAAK,oBAAoB,EAC1B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AAGxC,MAAM,WAAW,iBAAkB,SAAQ,MAAM;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,YAAY,CAAC;IACtC,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,oBAAoB,8BAiC9B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../packages/rsbuild/src/generators/init/init.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,IAAI,EACT,KAAK,iBAAiB,EAMvB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAI/C,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,mBAAmB,qBAWzE;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,mBAAmB,8BAEpE;AAED,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,mBAAmB,8BAkD5B;AAED,eAAe,aAAa,CAAC"}
@@ -1,12 +0,0 @@
1
- import { CreateNodesV2 } from '@nx/devkit';
2
- export interface RsbuildPluginOptions {
3
- buildTargetName?: string;
4
- devTargetName?: string;
5
- previewTargetName?: string;
6
- inspectTargetName?: string;
7
- typecheckTargetName?: string;
8
- buildDepsTargetName?: string;
9
- watchDepsTargetName?: string;
10
- }
11
- export declare const createNodesV2: CreateNodesV2<RsbuildPluginOptions>;
12
- //# sourceMappingURL=plugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/rsbuild/src/plugins/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,aAAa,EAMd,MAAM,YAAY,CAAC;AAapB,MAAM,WAAW,oBAAoB;IACnC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAiBD,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,oBAAoB,CAgC7D,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"add-build-plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/rsbuild/src/utils/add-build-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AASvC;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,IAAI,EACV,gBAAgB,EAAE,MAAM,EACxB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,MAAM,QA6CjB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ast-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/rsbuild/src/utils/ast-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAOvC,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,MAAM,EACtB,YAAY,EAAE,MAAM,QA6CrB;AAED,wBAAgB,aAAa,CAC3B,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,MAAM,QAgDb;AAED,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,QAuGnB;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,MAAM,EACtB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,QAmDd"}
@@ -1,3 +0,0 @@
1
- import { type Tree } from '@nx/devkit';
2
- export declare function getRsbuildE2EWebServerInfo(tree: Tree, projectName: string, configFilePath: string, isPluginBeingAdded: boolean, e2ePortOverride?: number): Promise<import("@nx/devkit/src/generators/e2e-web-server-info-utils").E2EWebServerDetails>;
3
- //# sourceMappingURL=e2e-web-server-info-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"e2e-web-server-info-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/rsbuild/src/utils/e2e-web-server-info-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAc,MAAM,YAAY,CAAC;AAGnD,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,EACtB,kBAAkB,EAAE,OAAO,EAC3B,eAAe,CAAC,EAAE,MAAM,8FA8BzB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"has-rsbuild-plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/rsbuild/src/utils/has-rsbuild-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAc,MAAM,YAAY,CAAC;AAGnD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,EAAE,MAAM,WA6BhE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"indent-by.d.ts","sourceRoot":"","sources":["../../../../../packages/rsbuild/src/utils/indent-by.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,IAChC,KAAK,MAAM,YAOpB"}
@@ -1,17 +0,0 @@
1
- export declare const nxVersion: any;
2
- export declare const rsbuildVersion = "1.1.10";
3
- export declare const rsbuildPluginReactVersion = "1.1.0";
4
- export declare const rsbuildPluginVueVersion = "1.0.5";
5
- export declare const rsbuildPluginSassVersion = "1.1.2";
6
- export declare const rsbuildPluginLessVersion = "1.1.0";
7
- export declare const rsbuildPluginStyledComponentsVersion = "1.1.0";
8
- /**
9
- * These versions need to line up with the version of the swc_core crate Rspack uses for the version of Rsbuild above
10
- * Checking the `cargo.toml` at https://github.com/web-infra-dev/rspack/blob/main/Cargo.toml for the correct Rspack version
11
- * is the best way to ensure that these versions are correct.
12
- *
13
- * The release notes for the packages below are very helpful in understanding what version of swc_core crate they require.
14
- */
15
- export declare const rsbuildSwcPluginEmotionVersion = "^7.0.3";
16
- export declare const rsbuildSwcPluginStyledJsxVersion = "^5.0.2";
17
- //# sourceMappingURL=versions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../../../../packages/rsbuild/src/utils/versions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,KAAwC,CAAC;AAC/D,eAAO,MAAM,cAAc,WAAW,CAAC;AACvC,eAAO,MAAM,yBAAyB,UAAU,CAAC;AACjD,eAAO,MAAM,uBAAuB,UAAU,CAAC;AAC/C,eAAO,MAAM,wBAAwB,UAAU,CAAC;AAChD,eAAO,MAAM,wBAAwB,UAAU,CAAC;AAChD,eAAO,MAAM,oCAAoC,UAAU,CAAC;AAE5D;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B,WAAW,CAAC;AACvD,eAAO,MAAM,gCAAgC,WAAW,CAAC"}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.rsbuildSwcPluginStyledJsxVersion = exports.rsbuildSwcPluginEmotionVersion = exports.rsbuildPluginStyledComponentsVersion = exports.rsbuildPluginLessVersion = exports.rsbuildPluginSassVersion = exports.rsbuildPluginVueVersion = exports.rsbuildPluginReactVersion = exports.rsbuildVersion = exports.nxVersion = void 0;
4
- exports.nxVersion = require('../../package.json').version;
5
- exports.rsbuildVersion = '1.1.10';
6
- exports.rsbuildPluginReactVersion = '1.1.0';
7
- exports.rsbuildPluginVueVersion = '1.0.5';
8
- exports.rsbuildPluginSassVersion = '1.1.2';
9
- exports.rsbuildPluginLessVersion = '1.1.0';
10
- exports.rsbuildPluginStyledComponentsVersion = '1.1.0';
11
- /**
12
- * These versions need to line up with the version of the swc_core crate Rspack uses for the version of Rsbuild above
13
- * Checking the `cargo.toml` at https://github.com/web-infra-dev/rspack/blob/main/Cargo.toml for the correct Rspack version
14
- * is the best way to ensure that these versions are correct.
15
- *
16
- * The release notes for the packages below are very helpful in understanding what version of swc_core crate they require.
17
- */
18
- exports.rsbuildSwcPluginEmotionVersion = '^7.0.3';
19
- exports.rsbuildSwcPluginStyledJsxVersion = '^5.0.2';
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes