@kubb/fabric-core 0.12.11 → 0.13.1

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 (61) hide show
  1. package/README.md +1 -1
  2. package/dist/{Fabric-CrRJykMN.d.ts → Fabric-CE-4sqCG.d.ts} +1 -4
  3. package/dist/{Fabric-DMmgrLto.d.cts → Fabric-efyCO1t7.d.ts} +2 -2
  4. package/dist/{RootContext-Cf7WJM7r.d.cts → RootContext-BgiMS39h.d.ts} +3 -3
  5. package/dist/{RootContext-CvaGJ-4g.d.ts → RootContext-CA-zkTEp.d.ts} +3 -4
  6. package/dist/{chunk-BVHe6Par.js → chunk-BYypO7fO.js} +1 -5
  7. package/dist/{chunk-DVipidnM.cjs → chunk-uaV2rQ02.cjs} +0 -10
  8. package/dist/{defaultParser-BK-zOanQ.cjs → defaultParser-BAgmtMo_.cjs} +2 -3
  9. package/dist/{defaultParser-BK-zOanQ.cjs.map → defaultParser-BAgmtMo_.cjs.map} +1 -1
  10. package/dist/{defaultParser-BD_N68Bo.js → defaultParser-C1atU7yU.js} +2 -3
  11. package/dist/{defaultParser-BD_N68Bo.js.map → defaultParser-C1atU7yU.js.map} +1 -1
  12. package/dist/{getRelativePath-C4Au07ON.js → getRelativePath-BcieQL5M.js} +1 -2
  13. package/dist/{getRelativePath-C4Au07ON.js.map → getRelativePath-BcieQL5M.js.map} +1 -1
  14. package/dist/{getRelativePath-DpbA6qm5.cjs → getRelativePath-DVG8dIzW.cjs} +2 -2
  15. package/dist/{getRelativePath-DpbA6qm5.cjs.map → getRelativePath-DVG8dIzW.cjs.map} +1 -1
  16. package/dist/index.cjs +62 -61
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.ts +11 -5
  19. package/dist/index.js +8 -9
  20. package/dist/index.js.map +1 -1
  21. package/dist/{Root-CKos-Ahf.cjs → onProcessExit-B7_bTfyR.cjs} +115 -213
  22. package/dist/onProcessExit-B7_bTfyR.cjs.map +1 -0
  23. package/dist/{Root-BQX3eHqb.js → onProcessExit-CF200hsz.js} +109 -190
  24. package/dist/onProcessExit-CF200hsz.js.map +1 -0
  25. package/dist/parsers/typescript.cjs +4 -4
  26. package/dist/parsers/typescript.cjs.map +1 -1
  27. package/dist/parsers/typescript.d.ts +1 -2
  28. package/dist/parsers/typescript.js +3 -4
  29. package/dist/parsers/typescript.js.map +1 -1
  30. package/dist/parsers.cjs +2 -3
  31. package/dist/parsers.cjs.map +1 -1
  32. package/dist/parsers.d.ts +1 -2
  33. package/dist/parsers.js +2 -3
  34. package/dist/parsers.js.map +1 -1
  35. package/dist/plugins.cjs +61 -305
  36. package/dist/plugins.cjs.map +1 -1
  37. package/dist/plugins.d.ts +9 -40
  38. package/dist/plugins.js +58 -298
  39. package/dist/plugins.js.map +1 -1
  40. package/dist/types.cjs +1 -1
  41. package/dist/types.d.ts +3 -4
  42. package/dist/types.js +1 -1
  43. package/dist/{useNodeTree-CgEKFUV-.d.cts → useNodeTree-BpHR6gQx.d.ts} +2 -2
  44. package/dist/{useNodeTree-CamNuFQP.d.ts → useNodeTree-DuQ5Df0t.d.ts} +2 -3
  45. package/package.json +8 -18
  46. package/src/FileManager.ts +6 -2
  47. package/src/createFile.ts +12 -9
  48. package/src/index.ts +3 -2
  49. package/src/plugins/fsPlugin.ts +8 -6
  50. package/src/plugins/fsxPlugin/Runtime.ts +4 -7
  51. package/src/plugins/index.ts +0 -1
  52. package/src/plugins/loggerPlugin.ts +15 -192
  53. package/src/utils/onProcessExit.ts +35 -0
  54. package/dist/Root-BQX3eHqb.js.map +0 -1
  55. package/dist/Root-CKos-Ahf.cjs.map +0 -1
  56. package/dist/index.d.cts +0 -595
  57. package/dist/parsers/typescript.d.cts +0 -45
  58. package/dist/parsers.d.cts +0 -37
  59. package/dist/plugins.d.cts +0 -149
  60. package/dist/types.d.cts +0 -11
  61. package/src/plugins/graphPlugin.ts +0 -136
package/dist/plugins.cjs CHANGED
@@ -1,22 +1,14 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_chunk = require('./chunk-DVipidnM.cjs');
3
- const require_Root = require('./Root-CKos-Ahf.cjs');
4
- const require_getRelativePath = require('./getRelativePath-DpbA6qm5.cjs');
2
+ const require_chunk = require('./chunk-uaV2rQ02.cjs');
3
+ const require_onProcessExit = require('./onProcessExit-B7_bTfyR.cjs');
4
+ const require_getRelativePath = require('./getRelativePath-DVG8dIzW.cjs');
5
5
  let node_path = require("node:path");
6
6
  node_path = require_chunk.__toESM(node_path);
7
- let fs_extra = require("fs-extra");
8
- fs_extra = require_chunk.__toESM(fs_extra);
9
- let signal_exit = require("signal-exit");
10
- let node_http = require("node:http");
11
- node_http = require_chunk.__toESM(node_http);
12
- let serve_handler = require("serve-handler");
13
- serve_handler = require_chunk.__toESM(serve_handler);
14
- let node_child_process = require("node:child_process");
7
+ let node_fs = require("node:fs");
8
+ let node_fs_promises = require("node:fs/promises");
9
+ let node_util = require("node:util");
15
10
  let _clack_prompts = require("@clack/prompts");
16
11
  _clack_prompts = require_chunk.__toESM(_clack_prompts);
17
- let picocolors = require("picocolors");
18
- picocolors = require_chunk.__toESM(picocolors);
19
- let ws = require("ws");
20
12
 
21
13
  //#region src/plugins/definePlugin.ts
22
14
  /**
@@ -62,16 +54,15 @@ function getBarrelFiles({ files, root, mode }) {
62
54
  }
63
55
  const cachedFiles = /* @__PURE__ */ new Map();
64
56
  const dedupe = /* @__PURE__ */ new Map();
65
- const treeNode = require_Root.TreeNode.fromFiles(files, root);
57
+ const treeNode = require_onProcessExit.TreeNode.fromFiles(files, root);
66
58
  if (!treeNode) return [];
67
59
  treeNode.forEach((node) => {
68
- var _node$parent;
69
- if (!(node === null || node === void 0 ? void 0 : node.children) || !((_node$parent = node.parent) === null || _node$parent === void 0 ? void 0 : _node$parent.data.path)) return;
60
+ if (!node?.children || !node.parent?.data.path) return;
70
61
  const parentPath = node.parent.data.path;
71
62
  const barrelPath = node_path.default.join(parentPath, "index.ts");
72
63
  let barrelFile = cachedFiles.get(barrelPath);
73
64
  if (!barrelFile) {
74
- barrelFile = require_Root.createFile({
65
+ barrelFile = require_onProcessExit.createFile({
75
66
  path: barrelPath,
76
67
  baseName: "index.ts",
77
68
  imports: [],
@@ -107,16 +98,13 @@ function getBarrelFiles({ files, root, mode }) {
107
98
  }
108
99
  });
109
100
  const result = [...cachedFiles.values()];
110
- if (mode === "all") return result.map((file) => {
111
- var _file$exports;
112
- return {
113
- ...file,
114
- exports: (_file$exports = file.exports) === null || _file$exports === void 0 ? void 0 : _file$exports.map((e) => ({
115
- ...e,
116
- name: void 0
117
- }))
118
- };
119
- });
101
+ if (mode === "all") return result.map((file) => ({
102
+ ...file,
103
+ exports: file.exports?.map((e) => ({
104
+ ...e,
105
+ name: void 0
106
+ }))
107
+ }));
120
108
  return result;
121
109
  }
122
110
  const barrelPlugin = definePlugin({
@@ -148,8 +136,7 @@ const barrelPlugin = definePlugin({
148
136
  for (const file of barrelFiles) fileTypeCache.set(file, file.sources.every((source) => source.isTypeOnly));
149
137
  const exports = [];
150
138
  for (const file of barrelFiles) {
151
- var _fileTypeCache$get;
152
- const containsOnlyTypes = (_fileTypeCache$get = fileTypeCache.get(file)) !== null && _fileTypeCache$get !== void 0 ? _fileTypeCache$get : false;
139
+ const containsOnlyTypes = fileTypeCache.get(file) ?? false;
153
140
  for (const source of file.sources) {
154
141
  if (!file.path || !source.isIndexable) continue;
155
142
  exports.push({
@@ -159,7 +146,7 @@ const barrelPlugin = definePlugin({
159
146
  });
160
147
  }
161
148
  }
162
- const entryFile = require_Root.createFile({
149
+ const entryFile = require_onProcessExit.createFile({
163
150
  path: rootPath,
164
151
  baseName: "index.ts",
165
152
  imports: [],
@@ -180,24 +167,24 @@ const barrelPlugin = definePlugin({
180
167
  //#region src/plugins/fsPlugin.ts
181
168
  async function write(path, data, options = {}) {
182
169
  if (typeof Bun !== "undefined") {
183
- if (!data || (data === null || data === void 0 ? void 0 : data.trim()) === "") return;
170
+ if (!data || data?.trim() === "") return;
184
171
  await Bun.write((0, node_path.resolve)(path), data.trim());
185
- if (options === null || options === void 0 ? void 0 : options.sanity) {
172
+ if (options?.sanity) {
186
173
  const savedData = await Bun.file((0, node_path.resolve)(path)).text();
187
- if ((savedData === null || savedData === void 0 ? void 0 : savedData.toString()) !== (data === null || data === void 0 ? void 0 : data.toString())) throw new Error(`Sanity check failed for ${path}\n\nData[${data.length}]:\n${data}\n\nSaved[${savedData.length}]:\n${savedData}\n`);
174
+ if (savedData?.toString() !== data?.toString()) throw new Error(`Sanity check failed for ${path}\n\nData[${data.length}]:\n${data}\n\nSaved[${savedData.length}]:\n${savedData}\n`);
188
175
  return savedData;
189
176
  }
190
177
  return data;
191
178
  }
192
- if (!data || (data === null || data === void 0 ? void 0 : data.trim()) === "") return;
179
+ if (!data || data?.trim() === "") return;
193
180
  try {
194
- const oldContent = await fs_extra.default.readFile((0, node_path.resolve)(path), { encoding: "utf-8" });
195
- if ((oldContent === null || oldContent === void 0 ? void 0 : oldContent.toString()) === (data === null || data === void 0 ? void 0 : data.toString())) return;
181
+ if ((await (0, node_fs_promises.readFile)((0, node_path.resolve)(path), { encoding: "utf-8" }))?.toString() === data?.toString()) return;
196
182
  } catch (_err) {}
197
- await fs_extra.default.outputFile((0, node_path.resolve)(path), data.trim(), { encoding: "utf-8" });
198
- if (options === null || options === void 0 ? void 0 : options.sanity) {
199
- const savedData = await fs_extra.default.readFile((0, node_path.resolve)(path), { encoding: "utf-8" });
200
- if ((savedData === null || savedData === void 0 ? void 0 : savedData.toString()) !== (data === null || data === void 0 ? void 0 : data.toString())) throw new Error(`Sanity check failed for ${path}\n\nData[${data.length}]:\n${data}\n\nSaved[${savedData.length}]:\n${savedData}\n`);
183
+ await (0, node_fs_promises.mkdir)((0, node_path.dirname)((0, node_path.resolve)(path)), { recursive: true });
184
+ await (0, node_fs_promises.writeFile)((0, node_path.resolve)(path), data.trim(), { encoding: "utf-8" });
185
+ if (options?.sanity) {
186
+ const savedData = await (0, node_fs_promises.readFile)((0, node_path.resolve)(path), { encoding: "utf-8" });
187
+ if (savedData?.toString() !== data?.toString()) throw new Error(`Sanity check failed for ${path}\n\nData[${data.length}]:\n${data}\n\nSaved[${savedData.length}]:\n${savedData}\n`);
201
188
  return savedData;
202
189
  }
203
190
  return data;
@@ -205,7 +192,10 @@ async function write(path, data, options = {}) {
205
192
  const fsPlugin = definePlugin({
206
193
  name: "fs",
207
194
  install(ctx, options = {}) {
208
- if (options.clean) fs_extra.default.removeSync(options.clean.path);
195
+ if (options.clean) (0, node_fs.rmSync)(options.clean.path, {
196
+ recursive: true,
197
+ force: true
198
+ });
209
199
  ctx.on("file:processing:update", async ({ file, source }) => {
210
200
  if (options.onBeforeWrite) await options.onBeforeWrite(file.path, source);
211
201
  await write(file.path, source, { sanity: false });
@@ -226,24 +216,22 @@ const fsPlugin = definePlugin({
226
216
 
227
217
  //#endregion
228
218
  //#region src/plugins/fsxPlugin/Runtime.ts
229
- var _options = /* @__PURE__ */ new WeakMap();
230
- var _renderPromise = /* @__PURE__ */ new WeakMap();
231
219
  var Runtime = class {
220
+ #options;
221
+ exitPromise;
232
222
  constructor(options) {
233
- require_Root._classPrivateFieldInitSpec(this, _options, void 0);
234
- require_Root._defineProperty(this, "exitPromise", void 0);
235
- require_Root._classPrivateFieldInitSpec(this, _renderPromise, Promise.resolve());
236
- require_Root._defineProperty(this, "resolveExitPromise", () => {});
237
- require_Root._defineProperty(this, "rejectExitPromise", () => {});
238
- require_Root._defineProperty(this, "unsubscribeExit", () => {});
239
- require_Root._classPrivateFieldSet2(_options, this, options);
240
- this.unsubscribeExit = (0, signal_exit.onExit)((code) => {
223
+ this.#options = options;
224
+ this.unsubscribeExit = require_onProcessExit.onProcessExit((code) => {
241
225
  this.unmount(code);
242
- }, { alwaysLast: false }).bind(this);
226
+ });
243
227
  }
244
228
  get fileManager() {
245
- return require_Root._classPrivateFieldGet2(_options, this).fileManager;
229
+ return this.#options.fileManager;
246
230
  }
231
+ #renderPromise = Promise.resolve();
232
+ resolveExitPromise = () => {};
233
+ rejectExitPromise = () => {};
234
+ unsubscribeExit = () => {};
247
235
  onError(error) {
248
236
  throw error;
249
237
  }
@@ -253,7 +241,7 @@ var Runtime = class {
253
241
  }, 0);
254
242
  }
255
243
  async render(node) {
256
- const treeNode = require_Root._classPrivateFieldGet2(_options, this).treeNode || new require_Root.TreeNode({
244
+ const treeNode = this.#options.treeNode || new require_onProcessExit.TreeNode({
257
245
  type: "Root",
258
246
  props: {}
259
247
  });
@@ -264,22 +252,20 @@ var Runtime = class {
264
252
  onError: this.onError.bind(this)
265
253
  };
266
254
  try {
267
- var _element;
268
255
  treeNode.data.props = props;
269
- const element = require_Root.Root({
256
+ const element = require_onProcessExit.Root({
270
257
  ...props,
271
258
  children: node
272
259
  });
273
- await require_Root._classPrivateFieldGet2(_renderPromise, this);
274
- return ((_element = element()) === null || _element === void 0 ? void 0 : _element.toString()) || "";
260
+ await this.#renderPromise;
261
+ return element()?.toString() || "";
275
262
  } catch (e) {
276
263
  props.onError(e);
277
264
  return "";
278
265
  }
279
266
  }
280
267
  unmount(error) {
281
- var _classPrivateFieldGet2$1;
282
- if ((_classPrivateFieldGet2$1 = require_Root._classPrivateFieldGet2(_options, this)) === null || _classPrivateFieldGet2$1 === void 0 ? void 0 : _classPrivateFieldGet2$1.debug) console.log("Unmount", error);
268
+ if (this.#options?.debug) console.log("Unmount", error);
283
269
  this.unsubscribeExit();
284
270
  if (error instanceof Error) {
285
271
  this.rejectExitPromise(error);
@@ -318,146 +304,8 @@ const fsxPlugin = definePlugin({
318
304
  }
319
305
  });
320
306
 
321
- //#endregion
322
- //#region src/utils/open.ts
323
- const spawnBin = (bin, args) => {
324
- return new Promise((resolve) => {
325
- (0, node_child_process.spawn)(bin, args, {
326
- detached: true,
327
- shell: false,
328
- windowsHide: true
329
- }).on("close", (code) => {
330
- resolve(!code);
331
- });
332
- });
333
- };
334
- async function open(path, options) {
335
- const app = options === null || options === void 0 ? void 0 : options.app;
336
- if (process.platform === "win32") return spawnBin("cmd.exe", [
337
- "/c",
338
- "start",
339
- app || "",
340
- path.replace(/[&^]/g, "^$&")
341
- ]);
342
- if (process.platform === "linux") return spawnBin(app || "xdg-open", [path]);
343
- if (process.platform === "darwin") return spawnBin("open", app ? [
344
- "-a",
345
- app,
346
- path
347
- ] : [path]);
348
- throw new Error(`Unsupported platform, could not open "${path}"`);
349
- }
350
-
351
- //#endregion
352
- //#region src/plugins/graphPlugin.ts
353
- function getGraph({ files, root }) {
354
- const treeNode = require_Root.TreeNode.fromFiles(files, root);
355
- if (!treeNode) return;
356
- return require_Root.TreeNode.toGraph(treeNode);
357
- }
358
- const html = `
359
- <!DOCTYPE html>
360
- <html lang="en">
361
- <head>
362
- <meta charset="UTF-8" />
363
- <title>File Graph</title>
364
- <script type="module">
365
- import { Network } from 'https://cdn.jsdelivr.net/npm/vis-network/standalone/esm/vis-network.min.js'
366
-
367
- async function main() {
368
- const res = await fetch('./graph.json')
369
- const { nodes, edges } = await res.json()
370
- const container = document.getElementById('graph')
371
-
372
- const network = new Network(
373
- container,
374
- { nodes, edges },
375
- {
376
- layout: { hierarchical: { direction: 'UD', sortMethod: 'directed' } },
377
- nodes: { shape: 'box', font: { face: 'monospace' } },
378
- edges: { arrows: 'to' },
379
- physics: false,
380
- },
381
- )
382
- }
383
-
384
- main()
385
- <\/script>
386
- <style>
387
- html, body, #graph { height: 100%; margin: 0; }
388
- </style>
389
- </head>
390
- <body>
391
- <div id="graph"></div>
392
- </body>
393
- </html>
394
- `;
395
- async function serve(root) {
396
- const server = node_http.default.createServer((req, res) => {
397
- return (0, serve_handler.default)(req, res, {
398
- public: root,
399
- cleanUrls: true
400
- });
401
- });
402
- server.listen(0, async () => {
403
- const { port } = server.address();
404
- console.log(`Running on http://localhost:${port}/graph.html`);
405
- await open(`http://localhost:${port}/graph.html`);
406
- });
407
- }
408
- const graphPlugin = definePlugin({
409
- name: "graph",
410
- install(ctx, options) {
411
- if (!options) throw new Error("Graph plugin requires options.root and options.mode");
412
- ctx.on("files:writing:start", async (files) => {
413
- const root = options.root;
414
- const graph = getGraph({
415
- files,
416
- root
417
- });
418
- if (!graph) return;
419
- const graphFile = require_Root.createFile({
420
- baseName: "graph.json",
421
- path: node_path.default.join(root, "graph.json"),
422
- sources: [{
423
- name: "graph",
424
- value: JSON.stringify(graph, null, 2)
425
- }],
426
- imports: [],
427
- exports: []
428
- });
429
- const graphHtmlFile = require_Root.createFile({
430
- baseName: "graph.html",
431
- path: node_path.default.join(root, "graph.html"),
432
- sources: [{
433
- name: "graph",
434
- value: html
435
- }],
436
- imports: [],
437
- exports: []
438
- });
439
- await ctx.addFile(graphFile, graphHtmlFile);
440
- if (options.open) await serve(root);
441
- });
442
- }
443
- });
444
-
445
307
  //#endregion
446
308
  //#region src/plugins/loggerPlugin.ts
447
- function normalizeAddress(address) {
448
- return {
449
- host: address.address === "::" ? "127.0.0.1" : address.address,
450
- port: address.port
451
- };
452
- }
453
- function serializeFile(file) {
454
- return {
455
- path: file.path,
456
- baseName: file.baseName,
457
- name: "name" in file ? file.name : void 0,
458
- extname: "extname" in file ? file.extname : void 0
459
- };
460
- }
461
309
  function pluralize(word, count) {
462
310
  return `${count} ${word}${count === 1 ? "" : "s"}`;
463
311
  }
@@ -465,7 +313,7 @@ const DEFAULT_PROGRESS_BAR_SIZE = 30;
465
313
  const loggerPlugin = definePlugin({
466
314
  name: "logger",
467
315
  install(ctx, options = {}) {
468
- const { websocket = true, progress = true } = options;
316
+ const { progress = true } = options;
469
317
  const state = {
470
318
  spinner: _clack_prompts.spinner(),
471
319
  isSpinning: false,
@@ -474,70 +322,24 @@ const loggerPlugin = definePlugin({
474
322
  function formatPath(path) {
475
323
  return (0, node_path.relative)(process.cwd(), path);
476
324
  }
477
- let server;
478
- let wss;
479
- const broadcast = (event, payload) => {
480
- if (!wss) return;
481
- const message = JSON.stringify({
482
- event,
483
- payload
484
- });
485
- for (const client of wss.clients) if (client.readyState === ws.WebSocket.OPEN) client.send(message);
486
- };
487
- if (websocket) {
488
- const { host = "127.0.0.1", port = 0 } = typeof websocket === "boolean" ? {} : websocket;
489
- server = node_http.default.createServer();
490
- wss = new ws.WebSocketServer({ server });
491
- server.listen(port, host, () => {
492
- const addressInfo = server === null || server === void 0 ? void 0 : server.address();
493
- if (addressInfo && typeof addressInfo === "object") {
494
- const { host: resolvedHost, port: resolvedPort } = normalizeAddress(addressInfo);
495
- const url = `ws://${resolvedHost}:${resolvedPort}`;
496
- _clack_prompts.log.info(`${picocolors.default.blue("ℹ")} Logger websocket listening on ${url}`);
497
- broadcast("websocket:ready", { url });
498
- }
499
- });
500
- wss.on("connection", (socket) => {
501
- _clack_prompts.log.info(`${picocolors.default.blue("ℹ")} Logger websocket client connected`);
502
- socket.send(JSON.stringify({
503
- event: "welcome",
504
- payload: {
505
- message: "Connected to Fabric log stream",
506
- timestamp: Date.now()
507
- }
508
- }));
509
- });
510
- wss.on("error", (error) => {
511
- _clack_prompts.log.error(`${picocolors.default.red("✗")} Logger websocket error: ${error.message}`);
512
- });
513
- }
514
325
  ctx.on("lifecycle:start", async () => {
515
- _clack_prompts.intro(`${picocolors.default.blue("Fabric")} ${picocolors.default.dim("Starting run")}`);
516
- broadcast("lifecycle:start", { timestamp: Date.now() });
326
+ _clack_prompts.intro(`${(0, node_util.styleText)("blue", "Fabric")} ${(0, node_util.styleText)("dim", "Starting run")}`);
517
327
  });
518
328
  ctx.on("lifecycle:render", async () => {
519
- _clack_prompts.log.info(`${picocolors.default.blue("ℹ")} Rendering application graph`);
520
- broadcast("lifecycle:render", { timestamp: Date.now() });
329
+ _clack_prompts.log.info(`${(0, node_util.styleText)("blue", "ℹ")} Rendering application graph`);
521
330
  });
522
331
  ctx.on("files:added", async (files) => {
523
332
  if (!files.length) return;
524
- _clack_prompts.log.info(`${picocolors.default.blue("ℹ")} Queued ${pluralize("file", files.length)}`);
525
- broadcast("files:added", { files: files.map(serializeFile) });
333
+ _clack_prompts.log.info(`${(0, node_util.styleText)("blue", "ℹ")} Queued ${pluralize("file", files.length)}`);
526
334
  });
527
335
  ctx.on("file:resolve:path", async (file) => {
528
- _clack_prompts.log.step(`Resolving path for ${picocolors.default.dim(formatPath(file.path))}`);
529
- broadcast("file:resolve:path", { file: serializeFile(file) });
336
+ _clack_prompts.log.step(`Resolving path for ${(0, node_util.styleText)("dim", formatPath(file.path))}`);
530
337
  });
531
338
  ctx.on("file:resolve:name", async (file) => {
532
- _clack_prompts.log.step(`Resolving name for ${picocolors.default.dim(formatPath(file.path))}`);
533
- broadcast("file:resolve:name", { file: serializeFile(file) });
339
+ _clack_prompts.log.step(`Resolving name for ${(0, node_util.styleText)("dim", formatPath(file.path))}`);
534
340
  });
535
341
  ctx.on("files:processing:start", async (files) => {
536
- _clack_prompts.log.step(`Processing ${picocolors.default.green(pluralize("file", files.length))}`);
537
- broadcast("files:processing:start", {
538
- total: files.length,
539
- timestamp: Date.now()
540
- });
342
+ _clack_prompts.log.step(`Processing ${(0, node_util.styleText)("green", pluralize("file", files.length))}`);
541
343
  if (progress) {
542
344
  state.progressBar = _clack_prompts.progress({
543
345
  style: "block",
@@ -548,76 +350,31 @@ const loggerPlugin = definePlugin({
548
350
  }
549
351
  });
550
352
  ctx.on("file:processing:start", async (file, index, total) => {
551
- if (!state.progressBar) _clack_prompts.log.step(`Processing ${picocolors.default.dim(`[${index + 1}/${total}]`)} ${formatPath(file.path)}`);
552
- broadcast("file:processing:start", {
553
- index,
554
- total,
555
- file: serializeFile(file)
556
- });
353
+ if (!state.progressBar) _clack_prompts.log.step(`Processing ${(0, node_util.styleText)("dim", `[${index + 1}/${total}]`)} ${formatPath(file.path)}`);
557
354
  });
558
355
  ctx.on("file:processing:update", async ({ processed, total, percentage, file }) => {
559
- broadcast("file:processing:update", {
560
- processed,
561
- total,
562
- percentage,
563
- file: serializeFile(file)
564
- });
565
356
  if (state.progressBar) state.progressBar.advance(void 0, `Writing ${formatPath(file.path)}`);
566
357
  else {
567
358
  const formattedPercentage = Number.isFinite(percentage) ? percentage.toFixed(1) : "0.0";
568
- _clack_prompts.log.step(`Progress ${picocolors.default.green(`${formattedPercentage}%`)} ${picocolors.default.dim(`(${processed}/${total})`)} → ${formatPath(file.path)}`);
359
+ _clack_prompts.log.step(`Progress ${(0, node_util.styleText)("green", `${formattedPercentage}%`)} ${(0, node_util.styleText)("dim", `(${processed}/${total})`)} → ${formatPath(file.path)}`);
569
360
  }
570
361
  });
571
362
  ctx.on("file:processing:end", async (file, index, total) => {
572
- if (state.progressBar) state.progressBar.message(`${picocolors.default.green("✓")} Finished ${picocolors.default.dim(`[${index + 1}/${total}]`)} ${formatPath(file.path)}`);
573
- else _clack_prompts.log.success(`${picocolors.default.green("✓")} Finished ${picocolors.default.dim(`[${index + 1}/${total}]`)} ${formatPath(file.path)}`);
574
- broadcast("file:processing:end", {
575
- index,
576
- total,
577
- file: serializeFile(file)
578
- });
579
- });
580
- ctx.on("files:writing:start", async (files) => {
581
- broadcast("files:writing:start", { files: files.map(serializeFile) });
582
- });
583
- ctx.on("files:writing:end", async (files) => {
584
- broadcast("files:writing:end", { files: files.map(serializeFile) });
363
+ if (state.progressBar) state.progressBar.message(`${(0, node_util.styleText)("green", "✓")} Finished ${(0, node_util.styleText)("dim", `[${index + 1}/${total}]`)} ${formatPath(file.path)}`);
364
+ else _clack_prompts.log.success(`${(0, node_util.styleText)("green", "✓")} Finished ${(0, node_util.styleText)("dim", `[${index + 1}/${total}]`)} ${formatPath(file.path)}`);
585
365
  });
586
366
  ctx.on("files:processing:end", async (files) => {
587
367
  if (state.progressBar) {
588
- state.progressBar.stop(`${picocolors.default.green("✓")} Processed ${pluralize("file", files.length)}`);
368
+ state.progressBar.stop(`${(0, node_util.styleText)("green", "✓")} Processed ${pluralize("file", files.length)}`);
589
369
  state.progressBar = void 0;
590
- } else _clack_prompts.log.success(`${picocolors.default.green("✓")} Processed ${pluralize("file", files.length)}`);
591
- broadcast("files:processing:end", {
592
- total: files.length,
593
- timestamp: Date.now()
594
- });
370
+ } else _clack_prompts.log.success(`${(0, node_util.styleText)("green", "✓")} Processed ${pluralize("file", files.length)}`);
595
371
  });
596
372
  ctx.on("lifecycle:end", async () => {
597
373
  if (state.progressBar) {
598
374
  state.progressBar.stop();
599
375
  state.progressBar = void 0;
600
376
  }
601
- _clack_prompts.outro(`${picocolors.default.blue("Fabric")} ${picocolors.default.dim("completed")}`);
602
- broadcast("lifecycle:end", { timestamp: Date.now() });
603
- const closures = [];
604
- if (wss) {
605
- const wsServer = wss;
606
- closures.push(new Promise((resolve) => {
607
- for (const client of wsServer.clients) client.close();
608
- wsServer.close(() => resolve());
609
- }));
610
- }
611
- if (server) {
612
- const httpServer = server;
613
- closures.push(new Promise((resolve) => {
614
- httpServer.close(() => resolve());
615
- }));
616
- }
617
- if (closures.length) {
618
- await Promise.allSettled(closures);
619
- _clack_prompts.log.info(`${picocolors.default.blue("ℹ")} Logger websocket closed`);
620
- }
377
+ _clack_prompts.outro(`${(0, node_util.styleText)("blue", "Fabric")} ${(0, node_util.styleText)("dim", "completed")}`);
621
378
  });
622
379
  }
623
380
  });
@@ -627,6 +384,5 @@ exports.barrelPlugin = barrelPlugin;
627
384
  exports.definePlugin = definePlugin;
628
385
  exports.fsPlugin = fsPlugin;
629
386
  exports.fsxPlugin = fsxPlugin;
630
- exports.graphPlugin = graphPlugin;
631
387
  exports.loggerPlugin = loggerPlugin;
632
388
  //# sourceMappingURL=plugins.cjs.map