rsbuild-plugin-workspace-dev 0.0.0-chore-modify-hook-2025-12-16-20251216020145 → 0.0.0-chore-modify-hook-2025-12-16-20251216024637

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.
@@ -1,5 +1,5 @@
1
1
  export declare const PACKAGE_JSON = "package.json";
2
- export declare const DEBUG_LOG_TITLE = "[Rsbuild Workspace Dev Plugin]: ";
2
+ export declare const PLUGIN_LOG_TITLE = "[Rsbuild Workspace Dev Plugin]: ";
3
3
  export declare const RSLIB_READY_MESSAGE = "build complete, watching for changes";
4
4
  export declare const MODERN_MODULE_READY_MESSAGE = "Watching for file changes";
5
5
  export declare const TSUP_READY_MESSAGE = "Watching for changes in";
package/dist/index.cjs CHANGED
@@ -39,7 +39,7 @@ __webpack_require__.d(__webpack_exports__, {
39
39
  const external_chalk_namespaceObject = require("chalk");
40
40
  var external_chalk_default = /*#__PURE__*/ __webpack_require__.n(external_chalk_namespaceObject);
41
41
  const PACKAGE_JSON = 'package.json';
42
- const DEBUG_LOG_TITLE = '[Rsbuild Workspace Dev Plugin]: ';
42
+ const PLUGIN_LOG_TITLE = '[Rsbuild Workspace Dev Plugin]: ';
43
43
  const RSLIB_READY_MESSAGE = 'build complete, watching for changes';
44
44
  const MODERN_MODULE_READY_MESSAGE = 'Watching for file changes';
45
45
  const TSUP_READY_MESSAGE = 'Watching for changes in';
@@ -107,10 +107,10 @@ class Logger {
107
107
  this.name = name;
108
108
  this.stdout = '';
109
109
  this.stderr = '';
110
- this.logTitle = DEBUG_LOG_TITLE;
110
+ this.logTitle = PLUGIN_LOG_TITLE;
111
111
  }
112
112
  }
113
- const debugLog = (msg, prefix = DEBUG_LOG_TITLE)=>{
113
+ const debugLog = (msg, prefix = PLUGIN_LOG_TITLE)=>{
114
114
  if (isDebug) console.log(prefix + msg);
115
115
  };
116
116
  const get_packages_namespaceObject = require("@manypkg/get-packages");
@@ -147,6 +147,7 @@ class WorkspaceDevRunner {
147
147
  packageJson,
148
148
  path: dir
149
149
  };
150
+ if (this.options.projects?.[name]?.skip === 'prune') return void console.log(`${PLUGIN_LOG_TITLE} Prune project ${name} and its dependencies because it is marked as skip: prune`);
150
151
  this.graph.setNode(name, node);
151
152
  this.visited[name] = false;
152
153
  this.visiting[name] = false;
@@ -159,7 +160,7 @@ class WorkspaceDevRunner {
159
160
  };
160
161
  for (const depName of Object.keys(deps)){
161
162
  const isInternalDep = this.packages.some((p)=>p.packageJson.name === depName);
162
- if (isInternalDep) {
163
+ if (isInternalDep && this.options.projects?.[depName]?.skip !== 'prune') {
163
164
  this.graph.setEdge(packageName, depName);
164
165
  this.checkGraph();
165
166
  const depPackage = packages.find((pkg)=>pkg.packageJson.name === depName);
@@ -172,7 +173,11 @@ class WorkspaceDevRunner {
172
173
  checkGraph() {
173
174
  const cycles = external_graphlib_default().alg.findCycles(this.graph);
174
175
  const nonSelfCycles = cycles.filter((c)=>1 !== c.length);
175
- if (nonSelfCycles.length) console.log(external_chalk_default().red(`${DEBUG_LOG_TITLE} Cycle dependency graph found: ${cycles.join(', ')}, you should config projects in plugin options to skip them, or fix the cycle dependency. Otherwise, a loop of dev will occur.`));
176
+ const nonSkipCycles = nonSelfCycles.filter((group)=>{
177
+ const isSkip = group.some((node)=>this.options.projects?.[node]?.skip);
178
+ return !isSkip;
179
+ });
180
+ if (nonSkipCycles.length) throw new Error(`${PLUGIN_LOG_TITLE} Cycle dependency graph found: ${nonSkipCycles}, you should config projects in plugin options to skip someone, or fix the cycle dependency. Otherwise, a loop of dev will occur.`);
176
181
  }
177
182
  async start() {
178
183
  const promises = [];
@@ -184,7 +189,8 @@ class WorkspaceDevRunner {
184
189
  const canStart = dependencies.every((dep)=>{
185
190
  const selfStart = node === dep;
186
191
  const isVisiting = this.visiting[dep];
187
- const isVisited = selfStart || this.visited[dep];
192
+ const skipDep = this.options.projects?.[dep]?.skip;
193
+ const isVisited = selfStart || this.visited[dep] || skipDep;
188
194
  return isVisited && !isVisiting;
189
195
  });
190
196
  if (canStart && !this.visited[node] && !this.visiting[node]) {
@@ -206,7 +212,7 @@ class WorkspaceDevRunner {
206
212
  this.visited[node] = true;
207
213
  this.visiting[node] = false;
208
214
  debugLog(`Skip visit node: ${node}`);
209
- logger.emitLogOnce('stdout', `skip visit node: ${name}`);
215
+ logger.emitLogOnce('stdout', `Skip visit node: ${name}`);
210
216
  return this.start().then(()=>resolve());
211
217
  }
212
218
  this.visiting[node] = true;
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { spawn } from "child_process";
6
6
  import graphlib, { Graph } from "graphlib";
7
7
  import path_0 from "path";
8
8
  const PACKAGE_JSON = 'package.json';
9
- const DEBUG_LOG_TITLE = '[Rsbuild Workspace Dev Plugin]: ';
9
+ const PLUGIN_LOG_TITLE = '[Rsbuild Workspace Dev Plugin]: ';
10
10
  const RSLIB_READY_MESSAGE = 'build complete, watching for changes';
11
11
  const MODERN_MODULE_READY_MESSAGE = 'Watching for file changes';
12
12
  const TSUP_READY_MESSAGE = 'Watching for changes in';
@@ -70,10 +70,10 @@ class Logger {
70
70
  this.name = name;
71
71
  this.stdout = '';
72
72
  this.stderr = '';
73
- this.logTitle = DEBUG_LOG_TITLE;
73
+ this.logTitle = PLUGIN_LOG_TITLE;
74
74
  }
75
75
  }
76
- const debugLog = (msg, prefix = DEBUG_LOG_TITLE)=>{
76
+ const debugLog = (msg, prefix = PLUGIN_LOG_TITLE)=>{
77
77
  if (isDebug) console.log(prefix + msg);
78
78
  };
79
79
  function workspace_dev_define_property(obj, key, value) {
@@ -104,6 +104,7 @@ class WorkspaceDevRunner {
104
104
  packageJson,
105
105
  path: dir
106
106
  };
107
+ if (this.options.projects?.[name]?.skip === 'prune') return void console.log(`${PLUGIN_LOG_TITLE} Prune project ${name} and its dependencies because it is marked as skip: prune`);
107
108
  this.graph.setNode(name, node);
108
109
  this.visited[name] = false;
109
110
  this.visiting[name] = false;
@@ -116,7 +117,7 @@ class WorkspaceDevRunner {
116
117
  };
117
118
  for (const depName of Object.keys(deps)){
118
119
  const isInternalDep = this.packages.some((p)=>p.packageJson.name === depName);
119
- if (isInternalDep) {
120
+ if (isInternalDep && this.options.projects?.[depName]?.skip !== 'prune') {
120
121
  this.graph.setEdge(packageName, depName);
121
122
  this.checkGraph();
122
123
  const depPackage = packages.find((pkg)=>pkg.packageJson.name === depName);
@@ -129,7 +130,11 @@ class WorkspaceDevRunner {
129
130
  checkGraph() {
130
131
  const cycles = graphlib.alg.findCycles(this.graph);
131
132
  const nonSelfCycles = cycles.filter((c)=>1 !== c.length);
132
- if (nonSelfCycles.length) console.log(chalk.red(`${DEBUG_LOG_TITLE} Cycle dependency graph found: ${cycles.join(', ')}, you should config projects in plugin options to skip them, or fix the cycle dependency. Otherwise, a loop of dev will occur.`));
133
+ const nonSkipCycles = nonSelfCycles.filter((group)=>{
134
+ const isSkip = group.some((node)=>this.options.projects?.[node]?.skip);
135
+ return !isSkip;
136
+ });
137
+ if (nonSkipCycles.length) throw new Error(`${PLUGIN_LOG_TITLE} Cycle dependency graph found: ${nonSkipCycles}, you should config projects in plugin options to skip someone, or fix the cycle dependency. Otherwise, a loop of dev will occur.`);
133
138
  }
134
139
  async start() {
135
140
  const promises = [];
@@ -141,7 +146,8 @@ class WorkspaceDevRunner {
141
146
  const canStart = dependencies.every((dep)=>{
142
147
  const selfStart = node === dep;
143
148
  const isVisiting = this.visiting[dep];
144
- const isVisited = selfStart || this.visited[dep];
149
+ const skipDep = this.options.projects?.[dep]?.skip;
150
+ const isVisited = selfStart || this.visited[dep] || skipDep;
145
151
  return isVisited && !isVisiting;
146
152
  });
147
153
  if (canStart && !this.visited[node] && !this.visiting[node]) {
@@ -163,7 +169,7 @@ class WorkspaceDevRunner {
163
169
  this.visited[node] = true;
164
170
  this.visiting[node] = false;
165
171
  debugLog(`Skip visit node: ${node}`);
166
- logger.emitLogOnce('stdout', `skip visit node: ${name}`);
172
+ logger.emitLogOnce('stdout', `Skip visit node: ${name}`);
167
173
  return this.start().then(()=>resolve());
168
174
  }
169
175
  this.visiting[node] = true;
@@ -5,7 +5,7 @@ export interface WorkspaceDevRunnerOptions {
5
5
  projects?: Record<string, {
6
6
  match?: (stdout: string) => boolean;
7
7
  command?: string;
8
- skip?: boolean;
8
+ skip?: boolean | 'prune';
9
9
  }>;
10
10
  startCurrent?: boolean;
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rsbuild-plugin-workspace-dev",
3
- "version": "0.0.0-chore-modify-hook-2025-12-16-20251216020145",
3
+ "version": "0.0.0-chore-modify-hook-2025-12-16-20251216024637",
4
4
  "description": "An Rsbuild plugin to provides workspace recursive dev functionality for Monorepo topologies.",
5
5
  "repository": "https://github.com/rspack-contrib/rsbuild-plugin-workspace-dev",
6
6
  "license": "MIT",