@kubb/fabric-core 0.2.13 → 0.2.15

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 (50) hide show
  1. package/README.md +5 -1
  2. package/dist/{Fabric-CxMkO4Rt.d.ts → Fabric-0mXLgmur.d.cts} +22 -21
  3. package/dist/{Fabric-BfnUdEpq.d.cts → Fabric-C-AqOkTA.d.ts} +22 -21
  4. package/dist/{defineFabric-DApM1nNr.d.cts → defineFabric-D_m6CB1s.d.ts} +3 -3
  5. package/dist/{defineFabric-Nf6eMaz7.d.ts → defineFabric-Dkt2l0wC.d.cts} +3 -3
  6. package/dist/{defineProperty-CspRhtP3.cjs → defineProperty-B05cRoSl.cjs} +26 -26
  7. package/dist/{defineProperty-CspRhtP3.cjs.map → defineProperty-B05cRoSl.cjs.map} +1 -1
  8. package/dist/{defineProperty-BtekiGIK.js → defineProperty-BZknW4oy.js} +27 -27
  9. package/dist/{defineProperty-BtekiGIK.js.map → defineProperty-BZknW4oy.js.map} +1 -1
  10. package/dist/index.cjs +50 -39
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.cts +2 -2
  13. package/dist/index.d.ts +2 -2
  14. package/dist/index.js +50 -39
  15. package/dist/index.js.map +1 -1
  16. package/dist/parsers/typescript.d.cts +2 -2
  17. package/dist/parsers/typescript.d.ts +2 -2
  18. package/dist/parsers.cjs.map +1 -1
  19. package/dist/parsers.d.cts +2 -2
  20. package/dist/parsers.d.ts +2 -2
  21. package/dist/parsers.js.map +1 -1
  22. package/dist/plugins.cjs +96 -96
  23. package/dist/plugins.cjs.map +1 -1
  24. package/dist/plugins.d.cts +35 -35
  25. package/dist/plugins.d.ts +35 -35
  26. package/dist/plugins.js +94 -94
  27. package/dist/plugins.js.map +1 -1
  28. package/dist/types.d.cts +3 -3
  29. package/dist/types.d.ts +3 -3
  30. package/dist/{typescriptParser-Dz9T1BQ1.d.cts → typescriptParser-B4-y6QxR.d.cts} +2 -2
  31. package/dist/{typescriptParser-DypTa1AN.d.ts → typescriptParser-By3ckLtc.d.ts} +2 -2
  32. package/dist/typescriptParser-CNHO6H2_.cjs.map +1 -1
  33. package/dist/typescriptParser-CWT7zCJy.js.map +1 -1
  34. package/package.json +1 -1
  35. package/src/Fabric.ts +12 -11
  36. package/src/FileManager.ts +4 -4
  37. package/src/FileProcessor.ts +3 -4
  38. package/src/createFile.ts +3 -3
  39. package/src/defineFabric.ts +18 -10
  40. package/src/index.ts +3 -3
  41. package/src/parsers/tsxParser.ts +1 -1
  42. package/src/parsers/types.ts +1 -1
  43. package/src/parsers/typescriptParser.ts +1 -1
  44. package/src/plugins/barrelPlugin.ts +13 -13
  45. package/src/plugins/fsPlugin.ts +8 -8
  46. package/src/plugins/graphPlugin.ts +8 -9
  47. package/src/plugins/index.ts +2 -3
  48. package/src/plugins/progressPlugin.ts +6 -6
  49. package/src/plugins/types.ts +1 -1
  50. package/src/types.ts +2 -2
package/dist/plugins.cjs CHANGED
@@ -1,78 +1,21 @@
1
1
  const require_trimExtName = require('./trimExtName-Bb4zGVF1.cjs');
2
- const require_defineProperty = require('./defineProperty-CspRhtP3.cjs');
2
+ const require_defineProperty = require('./defineProperty-B05cRoSl.cjs');
3
3
  const require_getRelativePath = require('./getRelativePath-C6lvNCs7.cjs');
4
4
  let node_path = require("node:path");
5
5
  node_path = require_trimExtName.__toESM(node_path);
6
6
  let fs_extra = require("fs-extra");
7
7
  fs_extra = require_trimExtName.__toESM(fs_extra);
8
- let cli_progress = require("cli-progress");
9
- cli_progress = require_trimExtName.__toESM(cli_progress);
10
- let node_process = require("node:process");
11
- node_process = require_trimExtName.__toESM(node_process);
12
8
  let node_http = require("node:http");
13
9
  node_http = require_trimExtName.__toESM(node_http);
14
10
  let serve_handler = require("serve-handler");
15
11
  serve_handler = require_trimExtName.__toESM(serve_handler);
16
12
  let node_child_process = require("node:child_process");
17
13
  node_child_process = require_trimExtName.__toESM(node_child_process);
14
+ let node_process = require("node:process");
15
+ node_process = require_trimExtName.__toESM(node_process);
16
+ let cli_progress = require("cli-progress");
17
+ cli_progress = require_trimExtName.__toESM(cli_progress);
18
18
 
19
- //#region src/plugins/createPlugin.ts
20
- function createPlugin(plugin) {
21
- return {
22
- type: "plugin",
23
- ...plugin
24
- };
25
- }
26
-
27
- //#endregion
28
- //#region src/plugins/fsPlugin.ts
29
- async function write(path$2, data, options = {}) {
30
- if (typeof Bun !== "undefined") {
31
- if (!data || (data === null || data === void 0 ? void 0 : data.trim()) === "") return;
32
- await Bun.write((0, node_path.resolve)(path$2), data.trim());
33
- if (options === null || options === void 0 ? void 0 : options.sanity) {
34
- const savedData = await Bun.file((0, node_path.resolve)(path$2)).text();
35
- 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$2}\n\nData[${data.length}]:\n${data}\n\nSaved[${savedData.length}]:\n${savedData}\n`);
36
- return savedData;
37
- }
38
- return data;
39
- }
40
- if (!data || (data === null || data === void 0 ? void 0 : data.trim()) === "") return;
41
- try {
42
- const oldContent = await fs_extra.default.readFile((0, node_path.resolve)(path$2), { encoding: "utf-8" });
43
- if ((oldContent === null || oldContent === void 0 ? void 0 : oldContent.toString()) === (data === null || data === void 0 ? void 0 : data.toString())) return;
44
- } catch (_err) {}
45
- await fs_extra.default.outputFile((0, node_path.resolve)(path$2), data.trim(), { encoding: "utf-8" });
46
- if (options === null || options === void 0 ? void 0 : options.sanity) {
47
- const savedData = await fs_extra.default.readFile((0, node_path.resolve)(path$2), { encoding: "utf-8" });
48
- 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$2}\n\nData[${data.length}]:\n${data}\n\nSaved[${savedData.length}]:\n${savedData}\n`);
49
- return savedData;
50
- }
51
- return data;
52
- }
53
- const fsPlugin = createPlugin({
54
- name: "fs",
55
- install(app, options = {}) {
56
- if (options.clean) fs_extra.default.removeSync(options.clean.path);
57
- app.context.events.on("process:progress", async ({ file, source }) => {
58
- if (options.onBeforeWrite) await options.onBeforeWrite(file.path, source);
59
- await write(file.path, source, { sanity: false });
60
- });
61
- },
62
- inject(app, { dryRun } = {}) {
63
- return { async write(options = { extension: { ".ts": ".ts" } }) {
64
- var _app$context$config;
65
- await app.context.fileManager.write({
66
- mode: (_app$context$config = app.context.config) === null || _app$context$config === void 0 || (_app$context$config = _app$context$config.options) === null || _app$context$config === void 0 ? void 0 : _app$context$config.mode,
67
- extension: options.extension,
68
- dryRun,
69
- parsers: app.context.installedParsers
70
- });
71
- } };
72
- }
73
- });
74
-
75
- //#endregion
76
19
  //#region \0@oxc-project+runtime@0.95.0/helpers/classPrivateFieldSet2.js
77
20
  function _classPrivateFieldSet2(s, a, r) {
78
21
  return s.set(require_defineProperty._assertClassBrand(s, a), r), r;
@@ -173,6 +116,15 @@ var TreeNode = class TreeNode {
173
116
  }
174
117
  };
175
118
 
119
+ //#endregion
120
+ //#region src/plugins/createPlugin.ts
121
+ function createPlugin(plugin) {
122
+ return {
123
+ type: "plugin",
124
+ ...plugin
125
+ };
126
+ }
127
+
176
128
  //#endregion
177
129
  //#region src/plugins/barrelPlugin.ts
178
130
  function getBarrelFiles({ files, root, mode }) {
@@ -236,29 +188,29 @@ function getBarrelFiles({ files, root, mode }) {
236
188
  }
237
189
  const barrelPlugin = createPlugin({
238
190
  name: "barrel",
239
- install(app, options) {
191
+ install(ctx, options) {
240
192
  if (!options) throw new Error("Barrel plugin requires options.root and options.mode");
241
193
  if (!options.mode) return;
242
- app.context.events.on("write:start", async ({ files }) => {
194
+ ctx.on("write:start", async ({ files }) => {
243
195
  const root = options.root;
244
196
  const barrelFiles = getBarrelFiles({
245
197
  files,
246
198
  root,
247
199
  mode: options.mode
248
200
  });
249
- await app.context.fileManager.add(...barrelFiles);
201
+ await ctx.fileManager.add(...barrelFiles);
250
202
  });
251
203
  },
252
- inject(app, options) {
204
+ inject(ctx, options) {
253
205
  if (!options) throw new Error("Barrel plugin requires options.root and options.mode");
254
206
  return { async writeEntry({ root, mode }) {
255
- var _app$context$config;
207
+ var _ctx$config;
256
208
  if (!mode || mode === "propagate") return;
257
209
  const rootPath = node_path.default.resolve(root, "index.ts");
258
210
  const entryFile = require_defineProperty.createFile({
259
211
  path: rootPath,
260
212
  baseName: "index.ts",
261
- exports: app.files.filter((file) => {
213
+ exports: ctx.files.filter((file) => {
262
214
  return file.sources.some((source) => source.isIndexable);
263
215
  }).flatMap((file) => {
264
216
  var _file$sources;
@@ -274,39 +226,61 @@ const barrelPlugin = createPlugin({
274
226
  }).filter(Boolean),
275
227
  sources: []
276
228
  });
277
- await app.context.fileManager.add(entryFile);
278
- await app.context.fileManager.write({
279
- mode: (_app$context$config = app.context.config) === null || _app$context$config === void 0 || (_app$context$config = _app$context$config.options) === null || _app$context$config === void 0 ? void 0 : _app$context$config.mode,
229
+ await ctx.addFile(entryFile);
230
+ await ctx.fileManager.write({
231
+ mode: (_ctx$config = ctx.config) === null || _ctx$config === void 0 || (_ctx$config = _ctx$config.options) === null || _ctx$config === void 0 ? void 0 : _ctx$config.mode,
280
232
  dryRun: options.dryRun,
281
- parsers: app.context.installedParsers
233
+ parsers: ctx.installedParsers
282
234
  });
283
235
  } };
284
236
  }
285
237
  });
286
238
 
287
239
  //#endregion
288
- //#region src/plugins/progressPlugin.ts
289
- const progressPlugin = createPlugin({
290
- name: "progress",
291
- install(app) {
292
- const progressBar = new cli_progress.SingleBar({
293
- format: "{bar} {percentage}% | {value}/{total} | {message}",
294
- barCompleteChar: "█",
295
- barIncompleteChar: "░",
296
- hideCursor: true,
297
- clearOnComplete: true
298
- }, cli_progress.Presets.shades_grey);
299
- app.context.events.on("process:start", async ({ files }) => {
300
- progressBar.start(files.length, 0, { message: "Starting..." });
301
- });
302
- app.context.events.on("process:progress", async ({ file }) => {
303
- const message = `Writing ${(0, node_path.relative)(node_process.default.cwd(), file.path)}`;
304
- progressBar.increment(1, { message });
305
- });
306
- app.context.events.on("process:end", async ({ files }) => {
307
- progressBar.update(files.length, { message: "Done ✅" });
308
- progressBar.stop();
240
+ //#region src/plugins/fsPlugin.ts
241
+ async function write(path$2, data, options = {}) {
242
+ if (typeof Bun !== "undefined") {
243
+ if (!data || (data === null || data === void 0 ? void 0 : data.trim()) === "") return;
244
+ await Bun.write((0, node_path.resolve)(path$2), data.trim());
245
+ if (options === null || options === void 0 ? void 0 : options.sanity) {
246
+ const savedData = await Bun.file((0, node_path.resolve)(path$2)).text();
247
+ 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$2}\n\nData[${data.length}]:\n${data}\n\nSaved[${savedData.length}]:\n${savedData}\n`);
248
+ return savedData;
249
+ }
250
+ return data;
251
+ }
252
+ if (!data || (data === null || data === void 0 ? void 0 : data.trim()) === "") return;
253
+ try {
254
+ const oldContent = await fs_extra.default.readFile((0, node_path.resolve)(path$2), { encoding: "utf-8" });
255
+ if ((oldContent === null || oldContent === void 0 ? void 0 : oldContent.toString()) === (data === null || data === void 0 ? void 0 : data.toString())) return;
256
+ } catch (_err) {}
257
+ await fs_extra.default.outputFile((0, node_path.resolve)(path$2), data.trim(), { encoding: "utf-8" });
258
+ if (options === null || options === void 0 ? void 0 : options.sanity) {
259
+ const savedData = await fs_extra.default.readFile((0, node_path.resolve)(path$2), { encoding: "utf-8" });
260
+ 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$2}\n\nData[${data.length}]:\n${data}\n\nSaved[${savedData.length}]:\n${savedData}\n`);
261
+ return savedData;
262
+ }
263
+ return data;
264
+ }
265
+ const fsPlugin = createPlugin({
266
+ name: "fs",
267
+ install(ctx, options = {}) {
268
+ if (options.clean) fs_extra.default.removeSync(options.clean.path);
269
+ ctx.on("process:progress", async ({ file, source }) => {
270
+ if (options.onBeforeWrite) await options.onBeforeWrite(file.path, source);
271
+ await write(file.path, source, { sanity: false });
309
272
  });
273
+ },
274
+ inject(ctx, { dryRun } = {}) {
275
+ return { async write(options = { extension: { ".ts": ".ts" } }) {
276
+ var _ctx$config;
277
+ await ctx.fileManager.write({
278
+ mode: (_ctx$config = ctx.config) === null || _ctx$config === void 0 || (_ctx$config = _ctx$config.options) === null || _ctx$config === void 0 ? void 0 : _ctx$config.mode,
279
+ extension: options.extension,
280
+ dryRun,
281
+ parsers: ctx.installedParsers
282
+ });
283
+ } };
310
284
  }
311
285
  });
312
286
 
@@ -399,9 +373,9 @@ async function serve(root) {
399
373
  }
400
374
  const graphPlugin = createPlugin({
401
375
  name: "graph",
402
- install(app, options) {
376
+ install(ctx, options) {
403
377
  if (!options) throw new Error("Graph plugin requires options.root and options.mode");
404
- app.context.events.on("write:start", async ({ files }) => {
378
+ ctx.on("write:start", async ({ files }) => {
405
379
  const root = options.root;
406
380
  const graph = getGraph({
407
381
  files,
@@ -424,12 +398,38 @@ const graphPlugin = createPlugin({
424
398
  value: html
425
399
  }]
426
400
  });
427
- await app.context.fileManager.add(graphFile, graphHtmlFile);
401
+ await ctx.addFile(graphFile, graphHtmlFile);
428
402
  if (options.open) await serve(root);
429
403
  });
430
404
  }
431
405
  });
432
406
 
407
+ //#endregion
408
+ //#region src/plugins/progressPlugin.ts
409
+ const progressPlugin = createPlugin({
410
+ name: "progress",
411
+ install(ctx) {
412
+ const progressBar = new cli_progress.SingleBar({
413
+ format: "{bar} {percentage}% | {value}/{total} | {message}",
414
+ barCompleteChar: "█",
415
+ barIncompleteChar: "░",
416
+ hideCursor: true,
417
+ clearOnComplete: true
418
+ }, cli_progress.Presets.shades_grey);
419
+ ctx.on("process:start", async ({ files }) => {
420
+ progressBar.start(files.length, 0, { message: "Starting..." });
421
+ });
422
+ ctx.on("process:progress", async ({ file }) => {
423
+ const message = `Writing ${(0, node_path.relative)(node_process.default.cwd(), file.path)}`;
424
+ progressBar.increment(1, { message });
425
+ });
426
+ ctx.on("process:end", async ({ files }) => {
427
+ progressBar.update(files.length, { message: "Done ✅" });
428
+ progressBar.stop();
429
+ });
430
+ }
431
+ });
432
+
433
433
  //#endregion
434
434
  exports.barrelPlugin = barrelPlugin;
435
435
  exports.createPlugin = createPlugin;
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.cjs","names":["path","fs","stack: Array<TreeNode<TData>>","result: Array<TreeNode<TData>>","nodes: Array<{ id: string; label: string }>","edges: Array<{ from: string; to: string }>","next: TreeNode<BarrelData> | undefined","path","createFile","getRelativePath","SingleBar","Presets","process","path","http","createFile","path"],"sources":["../src/plugins/createPlugin.ts","../src/plugins/fsPlugin.ts","../src/utils/TreeNode.ts","../src/plugins/barrelPlugin.ts","../src/plugins/progressPlugin.ts","../src/utils/open.ts","../src/plugins/graphPlugin.ts"],"sourcesContent":["import type { Plugin, UserPlugin } from './types.ts'\n\nexport function createPlugin<Options = unknown, TAppExtension extends Record<string, any> = {}>(\n plugin: UserPlugin<Options, TAppExtension>,\n): Plugin<Options, TAppExtension> {\n return {\n type: 'plugin',\n ...plugin,\n }\n}\n","import { createPlugin } from './createPlugin.ts'\nimport fs from 'fs-extra'\nimport { resolve } from 'node:path'\nimport type * as KubbFile from '../KubbFile.ts'\n\ntype WriteOptions = {\n extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>\n}\n\ntype Options = {\n dryRun?: boolean\n /**\n * Optional callback that is invoked whenever a file is written by the plugin.\n * Useful for tests to observe write operations without spying on internal functions.\n */\n onBeforeWrite?: (path: string, data: string | undefined) => void | Promise<void>\n clean?: {\n path: string\n }\n}\n\ntype ExtendOptions = {\n write(options?: WriteOptions): Promise<void>\n}\n\nexport async function write(path: string, data: string | undefined, options: { sanity?: boolean } = {}): Promise<string | undefined> {\n if (typeof Bun !== 'undefined') {\n if (!data || data?.trim() === '') {\n return undefined\n }\n\n await Bun.write(resolve(path), data.trim())\n\n if (options?.sanity) {\n const file = Bun.file(resolve(path))\n const savedData = await file.text()\n\n if (savedData?.toString() !== data?.toString()) {\n throw new Error(`Sanity check failed for ${path}\\n\\nData[${data.length}]:\\n${data}\\n\\nSaved[${savedData.length}]:\\n${savedData}\\n`)\n }\n\n return savedData\n }\n\n return data\n }\n\n if (!data || data?.trim() === '') {\n return undefined\n }\n\n try {\n const oldContent = await fs.readFile(resolve(path), {\n encoding: 'utf-8',\n })\n if (oldContent?.toString() === data?.toString()) {\n return\n }\n } catch (_err) {\n /* empty */\n }\n\n await fs.outputFile(resolve(path), data.trim(), { encoding: 'utf-8' })\n\n if (options?.sanity) {\n const savedData = await fs.readFile(resolve(path), {\n encoding: 'utf-8',\n })\n\n if (savedData?.toString() !== data?.toString()) {\n throw new Error(`Sanity check failed for ${path}\\n\\nData[${data.length}]:\\n${data}\\n\\nSaved[${savedData.length}]:\\n${savedData}\\n`)\n }\n\n return savedData\n }\n\n return data\n}\n\n// biome-ignore lint/suspicious/noTsIgnore: production ready\n// @ts-ignore\ndeclare module '@kubb/fabric-core' {\n interface Fabric {\n write(options?: WriteOptions): Promise<void>\n }\n}\n\ndeclare global {\n namespace Kubb {\n interface Fabric {\n write(options?: WriteOptions): Promise<void>\n }\n }\n}\n\nexport const fsPlugin = createPlugin<Options, ExtendOptions>({\n name: 'fs',\n install(app, options = {}) {\n if (options.clean) {\n fs.removeSync(options.clean.path)\n }\n\n app.context.events.on('process:progress', async ({ file, source }) => {\n if (options.onBeforeWrite) {\n await options.onBeforeWrite(file.path, source)\n }\n await write(file.path, source, { sanity: false })\n })\n },\n inject(app, { dryRun } = {}) {\n return {\n async write(\n options = {\n extension: { '.ts': '.ts' },\n },\n ) {\n await app.context.fileManager.write({\n mode: app.context.config?.options?.mode,\n extension: options.extension,\n dryRun,\n parsers: app.context.installedParsers,\n })\n },\n }\n },\n})\n","import type * as KubbFile from '../KubbFile.ts'\n\ntype BarrelData = {\n file?: KubbFile.File\n path: string\n name: string\n}\n\nexport type Graph = {\n nodes: Array<{ id: string; label: string }>\n edges: Array<{ from: string; to: string }>\n}\n\nexport class TreeNode<TData = unknown> {\n data: TData\n parent?: TreeNode<TData>\n children: Array<TreeNode<TData>> = []\n #cachedLeaves?: Array<TreeNode<TData>>\n\n constructor(data: TData, parent?: TreeNode<TData>) {\n this.data = data\n this.parent = parent\n }\n\n addChild(data: TData): TreeNode<TData> {\n const child = new TreeNode(data, this)\n this.children.push(child)\n this.#cachedLeaves = undefined // invalidate cached leaves\n return child\n }\n\n get leaves(): Array<TreeNode<TData>> {\n if (this.#cachedLeaves) return this.#cachedLeaves\n if (this.children.length === 0) return [this]\n\n const stack: Array<TreeNode<TData>> = [...this.children]\n const result: Array<TreeNode<TData>> = []\n\n for (const node of stack) {\n if (node.children.length) {\n for (const child of node.children) stack.push(child)\n } else {\n result.push(node)\n }\n }\n\n this.#cachedLeaves = result\n return result\n }\n\n forEach(callback: (node: TreeNode<TData>) => void): this {\n const stack: Array<TreeNode<TData>> = [this]\n\n for (const node of stack) {\n callback(node)\n if (node.children.length) {\n for (const child of node.children) stack.push(child)\n }\n }\n return this\n }\n\n findDeep(predicate: (node: TreeNode<TData>) => boolean): TreeNode<TData> | undefined {\n for (const leaf of this.leaves) {\n if (predicate(leaf)) return leaf\n }\n return undefined\n }\n\n static toGraph(root: TreeNode<BarrelData>): Graph {\n const nodes: Array<{ id: string; label: string }> = []\n const edges: Array<{ from: string; to: string }> = []\n\n root.forEach((node) => {\n nodes.push({\n id: node.data.path,\n label: node.data.name,\n })\n\n for (const child of node.children) {\n edges.push({\n from: node.data.path,\n to: child.data.path,\n })\n }\n })\n\n return { nodes, edges }\n }\n\n static fromFiles(files: Array<KubbFile.File>, rootFolder = ''): TreeNode<BarrelData> | null {\n const normalizePath = (p: string): string => p.replace(/\\\\/g, '/')\n const normalizedRoot = normalizePath(rootFolder)\n const rootPrefix = normalizedRoot.endsWith('/') ? normalizedRoot : `${normalizedRoot}/`\n\n const filteredFiles = files.filter((file) => {\n const filePath = normalizePath(file.path)\n\n return !filePath.endsWith('.json') && (!rootFolder || filePath.startsWith(rootPrefix))\n })\n\n if (filteredFiles.length === 0) {\n return null\n }\n\n const treeNode = new TreeNode<BarrelData>({\n name: rootFolder || '',\n path: rootFolder || '',\n file: undefined,\n })\n\n for (const file of filteredFiles) {\n const relPath = normalizePath(file.path).slice(rootPrefix.length)\n const parts = relPath.split('/')\n\n let current = treeNode\n let currentPath = rootFolder\n\n for (const [index, part] of parts.entries()) {\n const isLast = index === parts.length - 1\n currentPath += (currentPath.endsWith('/') ? '' : '/') + part\n\n let next: TreeNode<BarrelData> | undefined\n for (const child of current.children) {\n if ((child.data as BarrelData).name === part) {\n next = child\n break\n }\n }\n\n if (!next) {\n next = current.addChild({\n name: part,\n path: currentPath,\n file: isLast ? file : undefined,\n })\n }\n\n current = next\n }\n }\n\n return treeNode\n }\n}\n","/** biome-ignore-all lint/suspicious/useIterableCallbackReturn: not needed */\n\nimport { createPlugin } from './createPlugin.ts'\nimport type * as KubbFile from '../KubbFile.ts'\nimport { TreeNode } from '../utils/TreeNode.ts'\nimport path from 'node:path'\nimport { getRelativePath } from '../utils/getRelativePath.ts'\nimport { createFile } from '../createFile.ts'\n\ntype Mode = 'all' | 'named' | 'propagate' | false\n\ntype Options = {\n root: string\n mode: Mode\n dryRun?: boolean\n}\n\ntype WriteEntryOptions = {\n root: string\n mode: Mode\n}\n\ntype ExtendOptions = {\n writeEntry(options: WriteEntryOptions): Promise<void>\n}\n\n// biome-ignore lint/suspicious/noTsIgnore: production ready\n// @ts-ignore\ndeclare module '@kubb/fabric-core' {\n interface Fabric {\n writeEntry(options: WriteEntryOptions): Promise<void>\n }\n}\n\ndeclare global {\n namespace Kubb {\n interface Fabric {\n writeEntry(options: WriteEntryOptions): Promise<void>\n }\n }\n}\n\ntype GetBarrelFilesOptions = {\n files: KubbFile.File[]\n root: string\n mode: Mode\n}\n\nexport function getBarrelFiles({ files, root, mode }: GetBarrelFilesOptions): Array<KubbFile.File> {\n // Do not generate when propagating or disabled\n if (mode === 'propagate' || mode === false) {\n return []\n }\n\n const cachedFiles = new Map<KubbFile.Path, KubbFile.File>()\n const dedupe = new Map<KubbFile.Path, Set<string>>()\n\n const treeNode = TreeNode.fromFiles(files, root)\n\n if (!treeNode) {\n return []\n }\n\n treeNode.forEach((node) => {\n // Only create a barrel for directory-like nodes that have a parent with a path\n if (!node?.children || !node.parent?.data.path) {\n return\n }\n\n const parentPath = node.parent.data.path as KubbFile.Path\n const barrelPath = path.join(parentPath, 'index.ts') as KubbFile.Path\n\n let barrelFile = cachedFiles.get(barrelPath)\n if (!barrelFile) {\n barrelFile = createFile({\n path: barrelPath,\n baseName: 'index.ts',\n exports: [],\n sources: [],\n })\n cachedFiles.set(barrelPath, barrelFile)\n dedupe.set(barrelPath, new Set<string>())\n }\n\n const seen = dedupe.get(barrelPath)!\n\n // Collect all leaves under the current directory node\n node.leaves.forEach((leaf) => {\n const file = leaf.data.file\n if (!file) {\n return\n }\n\n const sources = file.sources || []\n sources.forEach((source) => {\n if (!file.path || !source.isIndexable || !source.name) {\n return\n }\n\n const key = `${source.name}|${source.isTypeOnly ? '1' : '0'}`\n if (seen.has(key)) {\n return\n }\n seen.add(key)\n\n // Always compute relative path from the parent directory to the file path\n barrelFile!.exports!.push({\n name: [source.name],\n path: getRelativePath(parentPath, file.path),\n isTypeOnly: source.isTypeOnly,\n })\n\n barrelFile!.sources.push({\n name: source.name,\n isTypeOnly: source.isTypeOnly,\n value: '', // TODO use parser to generate import\n isExportable: mode === 'all' || mode === 'named',\n isIndexable: mode === 'all' || mode === 'named',\n })\n })\n })\n })\n\n const result = [...cachedFiles.values()]\n\n if (mode === 'all') {\n return result.map((file) => ({\n ...file,\n exports: file.exports?.map((e) => ({ ...e, name: undefined })),\n }))\n }\n\n return result\n}\n\nexport const barrelPlugin = createPlugin<Options, ExtendOptions>({\n name: 'barrel',\n install(app, options) {\n if (!options) {\n throw new Error('Barrel plugin requires options.root and options.mode')\n }\n\n if (!options.mode) {\n return undefined\n }\n\n app.context.events.on('write:start', async ({ files }) => {\n const root = options.root\n const barrelFiles = getBarrelFiles({ files, root, mode: options.mode })\n\n await app.context.fileManager.add(...barrelFiles)\n })\n },\n inject(app, options) {\n if (!options) {\n throw new Error('Barrel plugin requires options.root and options.mode')\n }\n\n return {\n async writeEntry({ root, mode }) {\n if (!mode || mode === 'propagate') {\n return undefined\n }\n\n const rootPath = path.resolve(root, 'index.ts')\n\n const barrelFiles = app.files.filter((file) => {\n return file.sources.some((source) => source.isIndexable)\n })\n\n const entryFile = createFile({\n path: rootPath,\n baseName: 'index.ts',\n exports: barrelFiles\n .flatMap((file) => {\n const containsOnlyTypes = file.sources.every((source) => source.isTypeOnly)\n\n return file.sources\n ?.map((source) => {\n if (!file.path || !source.isIndexable) {\n return undefined\n }\n\n return {\n name: mode === 'all' ? undefined : [source.name],\n path: getRelativePath(rootPath, file.path),\n isTypeOnly: mode === 'all' ? containsOnlyTypes : source.isTypeOnly,\n } as KubbFile.Export\n })\n .filter(Boolean)\n })\n .filter(Boolean),\n sources: [],\n })\n\n await app.context.fileManager.add(entryFile)\n\n await app.context.fileManager.write({\n mode: app.context.config?.options?.mode,\n dryRun: options.dryRun,\n parsers: app.context.installedParsers,\n })\n },\n }\n },\n})\n","import { Presets, SingleBar } from 'cli-progress'\nimport { createPlugin } from './createPlugin.ts'\nimport { relative } from 'node:path'\nimport process from 'node:process'\n\nexport const progressPlugin = createPlugin({\n name: 'progress',\n install(app) {\n const progressBar = new SingleBar(\n {\n format: '{bar} {percentage}% | {value}/{total} | {message}',\n barCompleteChar: '█',\n barIncompleteChar: '░',\n hideCursor: true,\n clearOnComplete: true,\n },\n Presets.shades_grey,\n )\n\n app.context.events.on('process:start', async ({ files }) => {\n progressBar.start(files.length, 0, { message: 'Starting...' })\n })\n\n app.context.events.on('process:progress', async ({ file }) => {\n const message = `Writing ${relative(process.cwd(), file.path)}`\n progressBar.increment(1, { message })\n })\n\n app.context.events.on('process:end', async ({ files }) => {\n progressBar.update(files.length, { message: 'Done ✅' })\n progressBar.stop()\n })\n },\n})\n","import { spawn } from 'node:child_process'\n\nconst spawnBin = (bin: string, args: string[]): Promise<boolean> => {\n return new Promise((resolve) => {\n const process = spawn(bin, args, {\n detached: true,\n shell: false,\n windowsHide: true,\n })\n\n process.on('close', (code) => {\n resolve(!code)\n })\n })\n}\n\ntype Options = {\n app?: string\n}\n\nexport async function open(path: string, options?: Options): Promise<boolean> {\n const app = options?.app\n\n if (process.platform === 'win32') {\n return spawnBin('cmd.exe', ['/c', 'start', app || '', path.replace(/[&^]/g, '^$&')])\n }\n\n if (process.platform === 'linux') {\n return spawnBin(app || 'xdg-open', [path])\n }\n if (process.platform === 'darwin') {\n return spawnBin('open', app ? ['-a', app, path] : [path])\n }\n\n throw new Error(`Unsupported platform, could not open \"${path}\"`)\n}\n","import { createPlugin } from './createPlugin.ts'\nimport type * as KubbFile from '../KubbFile.ts'\nimport { type Graph, TreeNode } from '../utils/TreeNode.ts'\nimport path from 'node:path'\nimport http from 'node:http'\nimport type { AddressInfo } from 'node:net'\nimport handler from 'serve-handler'\nimport { open } from '../utils/open.ts'\n\nimport { createFile } from '../createFile.ts'\n\ntype Options = {\n root: string\n /**\n * @default false\n */\n open?: boolean\n}\n\ntype GetGraphOptions = {\n files: KubbFile.File[]\n root: string\n}\n\nexport function getGraph({ files, root }: GetGraphOptions): Graph | undefined {\n const treeNode = TreeNode.fromFiles(files, root)\n\n if (!treeNode) {\n return undefined\n }\n\n return TreeNode.toGraph(treeNode)\n}\nconst html = `\n <!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <title>File Graph</title>\n <script type=\"module\">\n import { Network } from 'https://cdn.jsdelivr.net/npm/vis-network/standalone/esm/vis-network.min.js'\n\n async function main() {\n const res = await fetch('./graph.json')\n const { nodes, edges } = await res.json()\n const container = document.getElementById('graph')\n\n const network = new Network(\n container,\n { nodes, edges },\n {\n layout: { hierarchical: { direction: 'UD', sortMethod: 'directed' } },\n nodes: { shape: 'box', font: { face: 'monospace' } },\n edges: { arrows: 'to' },\n physics: false,\n },\n )\n }\n\n main()\n </script>\n <style>\n html, body, #graph { height: 100%; margin: 0; }\n </style>\n </head>\n <body>\n <div id=\"graph\"></div>\n </body>\n</html>\n`\n\nasync function serve(root: string) {\n const server = http.createServer((req, res) => {\n return handler(req, res, {\n public: root,\n cleanUrls: true,\n })\n })\n\n server.listen(0, async () => {\n const { port } = server.address() as AddressInfo\n console.log(`Running on http://localhost:${port}/graph.html`)\n\n await open(`http://localhost:${port}/graph.html`)\n })\n}\n\nexport const graphPlugin = createPlugin<Options>({\n name: 'graph',\n install(app, options) {\n if (!options) {\n throw new Error('Graph plugin requires options.root and options.mode')\n }\n\n app.context.events.on('write:start', async ({ files }) => {\n const root = options.root\n\n const graph = getGraph({ files, root })\n\n if (!graph) {\n return undefined\n }\n\n const graphFile = createFile({\n baseName: 'graph.json',\n path: path.join(root, 'graph.json'),\n sources: [\n {\n name: 'graph',\n value: JSON.stringify(graph, null, 2),\n },\n ],\n })\n\n const graphHtmlFile = createFile({\n baseName: 'graph.html',\n path: path.join(root, 'graph.html'),\n sources: [\n {\n name: 'graph',\n value: html,\n },\n ],\n })\n\n await app.context.fileManager.add(graphFile, graphHtmlFile)\n\n if (options.open) {\n await serve(root)\n }\n })\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAEA,SAAgB,aACd,QACgC;AAChC,QAAO;EACL,MAAM;EACN,GAAG;EACJ;;;;;ACiBH,eAAsB,MAAM,QAAc,MAA0B,UAAgC,EAAE,EAA+B;AACnI,KAAI,OAAO,QAAQ,aAAa;AAC9B,MAAI,CAAC,qDAAQ,KAAM,MAAM,MAAK,GAC5B;AAGF,QAAM,IAAI,6BAAcA,OAAK,EAAE,KAAK,MAAM,CAAC;AAE3C,wDAAI,QAAS,QAAQ;GAEnB,MAAM,YAAY,MADL,IAAI,4BAAaA,OAAK,CAAC,CACP,MAAM;AAEnC,8DAAI,UAAW,UAAU,mDAAK,KAAM,UAAU,EAC5C,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IACF,CAAC;AAEF,SAAM,IAAI,QAAQ,YAAY,IAAI,WAAW,cAAc;AAE3D,OAAI,QAAQ,KACV,OAAM,MAAM,KAAK;IAEnB;;CAEL,CAAC"}
1
+ {"version":3,"file":"plugins.cjs","names":["stack: Array<TreeNode<TData>>","result: Array<TreeNode<TData>>","nodes: Array<{ id: string; label: string }>","edges: Array<{ from: string; to: string }>","next: TreeNode<BarrelData> | undefined","path","createFile","getRelativePath","path","fs","path","http","createFile","path","SingleBar","Presets","process"],"sources":["../src/utils/TreeNode.ts","../src/plugins/createPlugin.ts","../src/plugins/barrelPlugin.ts","../src/plugins/fsPlugin.ts","../src/utils/open.ts","../src/plugins/graphPlugin.ts","../src/plugins/progressPlugin.ts"],"sourcesContent":["import type * as KubbFile from '../KubbFile.ts'\n\ntype BarrelData = {\n file?: KubbFile.File\n path: string\n name: string\n}\n\nexport type Graph = {\n nodes: Array<{ id: string; label: string }>\n edges: Array<{ from: string; to: string }>\n}\n\nexport class TreeNode<TData = unknown> {\n data: TData\n parent?: TreeNode<TData>\n children: Array<TreeNode<TData>> = []\n #cachedLeaves?: Array<TreeNode<TData>>\n\n constructor(data: TData, parent?: TreeNode<TData>) {\n this.data = data\n this.parent = parent\n }\n\n addChild(data: TData): TreeNode<TData> {\n const child = new TreeNode(data, this)\n this.children.push(child)\n this.#cachedLeaves = undefined // invalidate cached leaves\n return child\n }\n\n get leaves(): Array<TreeNode<TData>> {\n if (this.#cachedLeaves) return this.#cachedLeaves\n if (this.children.length === 0) return [this]\n\n const stack: Array<TreeNode<TData>> = [...this.children]\n const result: Array<TreeNode<TData>> = []\n\n for (const node of stack) {\n if (node.children.length) {\n for (const child of node.children) stack.push(child)\n } else {\n result.push(node)\n }\n }\n\n this.#cachedLeaves = result\n return result\n }\n\n forEach(callback: (node: TreeNode<TData>) => void): this {\n const stack: Array<TreeNode<TData>> = [this]\n\n for (const node of stack) {\n callback(node)\n if (node.children.length) {\n for (const child of node.children) stack.push(child)\n }\n }\n return this\n }\n\n findDeep(predicate: (node: TreeNode<TData>) => boolean): TreeNode<TData> | undefined {\n for (const leaf of this.leaves) {\n if (predicate(leaf)) return leaf\n }\n return undefined\n }\n\n static toGraph(root: TreeNode<BarrelData>): Graph {\n const nodes: Array<{ id: string; label: string }> = []\n const edges: Array<{ from: string; to: string }> = []\n\n root.forEach((node) => {\n nodes.push({\n id: node.data.path,\n label: node.data.name,\n })\n\n for (const child of node.children) {\n edges.push({\n from: node.data.path,\n to: child.data.path,\n })\n }\n })\n\n return { nodes, edges }\n }\n\n static fromFiles(files: Array<KubbFile.File>, rootFolder = ''): TreeNode<BarrelData> | null {\n const normalizePath = (p: string): string => p.replace(/\\\\/g, '/')\n const normalizedRoot = normalizePath(rootFolder)\n const rootPrefix = normalizedRoot.endsWith('/') ? normalizedRoot : `${normalizedRoot}/`\n\n const filteredFiles = files.filter((file) => {\n const filePath = normalizePath(file.path)\n\n return !filePath.endsWith('.json') && (!rootFolder || filePath.startsWith(rootPrefix))\n })\n\n if (filteredFiles.length === 0) {\n return null\n }\n\n const treeNode = new TreeNode<BarrelData>({\n name: rootFolder || '',\n path: rootFolder || '',\n file: undefined,\n })\n\n for (const file of filteredFiles) {\n const relPath = normalizePath(file.path).slice(rootPrefix.length)\n const parts = relPath.split('/')\n\n let current = treeNode\n let currentPath = rootFolder\n\n for (const [index, part] of parts.entries()) {\n const isLast = index === parts.length - 1\n currentPath += (currentPath.endsWith('/') ? '' : '/') + part\n\n let next: TreeNode<BarrelData> | undefined\n for (const child of current.children) {\n if ((child.data as BarrelData).name === part) {\n next = child\n break\n }\n }\n\n if (!next) {\n next = current.addChild({\n name: part,\n path: currentPath,\n file: isLast ? file : undefined,\n })\n }\n\n current = next\n }\n }\n\n return treeNode\n }\n}\n","import type { Plugin, UserPlugin } from './types.ts'\n\nexport function createPlugin<Options = unknown, TAppExtension extends Record<string, any> = {}>(\n plugin: UserPlugin<Options, TAppExtension>,\n): Plugin<Options, TAppExtension> {\n return {\n type: 'plugin',\n ...plugin,\n }\n}\n","/** biome-ignore-all lint/suspicious/useIterableCallbackReturn: not needed */\n\nimport path from 'node:path'\nimport { createFile } from '../createFile.ts'\nimport type * as KubbFile from '../KubbFile.ts'\nimport { getRelativePath } from '../utils/getRelativePath.ts'\nimport { TreeNode } from '../utils/TreeNode.ts'\nimport { createPlugin } from './createPlugin.ts'\n\ntype Mode = 'all' | 'named' | 'propagate' | false\n\ntype Options = {\n root: string\n mode: Mode\n dryRun?: boolean\n}\n\ntype WriteEntryOptions = {\n root: string\n mode: Mode\n}\n\ntype ExtendOptions = {\n writeEntry(options: WriteEntryOptions): Promise<void>\n}\n\n// biome-ignore lint/suspicious/noTsIgnore: production ready\n// @ts-ignore\ndeclare module '@kubb/fabric-core' {\n interface Fabric {\n writeEntry(options: WriteEntryOptions): Promise<void>\n }\n}\n\ndeclare global {\n namespace Kubb {\n interface Fabric {\n writeEntry(options: WriteEntryOptions): Promise<void>\n }\n }\n}\n\ntype GetBarrelFilesOptions = {\n files: KubbFile.File[]\n root: string\n mode: Mode\n}\n\nexport function getBarrelFiles({ files, root, mode }: GetBarrelFilesOptions): Array<KubbFile.File> {\n // Do not generate when propagating or disabled\n if (mode === 'propagate' || mode === false) {\n return []\n }\n\n const cachedFiles = new Map<KubbFile.Path, KubbFile.File>()\n const dedupe = new Map<KubbFile.Path, Set<string>>()\n\n const treeNode = TreeNode.fromFiles(files, root)\n\n if (!treeNode) {\n return []\n }\n\n treeNode.forEach((node) => {\n // Only create a barrel for directory-like nodes that have a parent with a path\n if (!node?.children || !node.parent?.data.path) {\n return\n }\n\n const parentPath = node.parent.data.path as KubbFile.Path\n const barrelPath = path.join(parentPath, 'index.ts') as KubbFile.Path\n\n let barrelFile = cachedFiles.get(barrelPath)\n if (!barrelFile) {\n barrelFile = createFile({\n path: barrelPath,\n baseName: 'index.ts',\n exports: [],\n sources: [],\n })\n cachedFiles.set(barrelPath, barrelFile)\n dedupe.set(barrelPath, new Set<string>())\n }\n\n const seen = dedupe.get(barrelPath)!\n\n // Collect all leaves under the current directory node\n node.leaves.forEach((leaf) => {\n const file = leaf.data.file\n if (!file) {\n return\n }\n\n const sources = file.sources || []\n sources.forEach((source) => {\n if (!file.path || !source.isIndexable || !source.name) {\n return\n }\n\n const key = `${source.name}|${source.isTypeOnly ? '1' : '0'}`\n if (seen.has(key)) {\n return\n }\n seen.add(key)\n\n // Always compute relative path from the parent directory to the file path\n barrelFile!.exports!.push({\n name: [source.name],\n path: getRelativePath(parentPath, file.path),\n isTypeOnly: source.isTypeOnly,\n })\n\n barrelFile!.sources.push({\n name: source.name,\n isTypeOnly: source.isTypeOnly,\n value: '', // TODO use parser to generate import\n isExportable: mode === 'all' || mode === 'named',\n isIndexable: mode === 'all' || mode === 'named',\n })\n })\n })\n })\n\n const result = [...cachedFiles.values()]\n\n if (mode === 'all') {\n return result.map((file) => ({\n ...file,\n exports: file.exports?.map((e) => ({ ...e, name: undefined })),\n }))\n }\n\n return result\n}\n\nexport const barrelPlugin = createPlugin<Options, ExtendOptions>({\n name: 'barrel',\n install(ctx, options) {\n if (!options) {\n throw new Error('Barrel plugin requires options.root and options.mode')\n }\n\n if (!options.mode) {\n return undefined\n }\n\n ctx.on('write:start', async ({ files }) => {\n const root = options.root\n const barrelFiles = getBarrelFiles({ files, root, mode: options.mode })\n\n await ctx.fileManager.add(...barrelFiles)\n })\n },\n inject(ctx, options) {\n if (!options) {\n throw new Error('Barrel plugin requires options.root and options.mode')\n }\n\n return {\n async writeEntry({ root, mode }) {\n if (!mode || mode === 'propagate') {\n return undefined\n }\n\n const rootPath = path.resolve(root, 'index.ts')\n\n const barrelFiles = ctx.files.filter((file) => {\n return file.sources.some((source) => source.isIndexable)\n })\n\n const entryFile = createFile({\n path: rootPath,\n baseName: 'index.ts',\n exports: barrelFiles\n .flatMap((file) => {\n const containsOnlyTypes = file.sources.every((source) => source.isTypeOnly)\n\n return file.sources\n ?.map((source) => {\n if (!file.path || !source.isIndexable) {\n return undefined\n }\n\n return {\n name: mode === 'all' ? undefined : [source.name],\n path: getRelativePath(rootPath, file.path),\n isTypeOnly: mode === 'all' ? containsOnlyTypes : source.isTypeOnly,\n } as KubbFile.Export\n })\n .filter(Boolean)\n })\n .filter(Boolean),\n sources: [],\n })\n\n await ctx.addFile(entryFile)\n\n await ctx.fileManager.write({\n mode: ctx.config?.options?.mode,\n dryRun: options.dryRun,\n parsers: ctx.installedParsers,\n })\n },\n }\n },\n})\n","import { resolve } from 'node:path'\nimport fs from 'fs-extra'\nimport type * as KubbFile from '../KubbFile.ts'\nimport { createPlugin } from './createPlugin.ts'\n\ntype WriteOptions = {\n extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>\n}\n\ntype Options = {\n dryRun?: boolean\n /**\n * Optional callback that is invoked whenever a file is written by the plugin.\n * Useful for tests to observe write operations without spying on internal functions.\n */\n onBeforeWrite?: (path: string, data: string | undefined) => void | Promise<void>\n clean?: {\n path: string\n }\n}\n\ntype ExtendOptions = {\n write(options?: WriteOptions): Promise<void>\n}\n\nexport async function write(path: string, data: string | undefined, options: { sanity?: boolean } = {}): Promise<string | undefined> {\n if (typeof Bun !== 'undefined') {\n if (!data || data?.trim() === '') {\n return undefined\n }\n\n await Bun.write(resolve(path), data.trim())\n\n if (options?.sanity) {\n const file = Bun.file(resolve(path))\n const savedData = await file.text()\n\n if (savedData?.toString() !== data?.toString()) {\n throw new Error(`Sanity check failed for ${path}\\n\\nData[${data.length}]:\\n${data}\\n\\nSaved[${savedData.length}]:\\n${savedData}\\n`)\n }\n\n return savedData\n }\n\n return data\n }\n\n if (!data || data?.trim() === '') {\n return undefined\n }\n\n try {\n const oldContent = await fs.readFile(resolve(path), {\n encoding: 'utf-8',\n })\n if (oldContent?.toString() === data?.toString()) {\n return\n }\n } catch (_err) {\n /* empty */\n }\n\n await fs.outputFile(resolve(path), data.trim(), { encoding: 'utf-8' })\n\n if (options?.sanity) {\n const savedData = await fs.readFile(resolve(path), {\n encoding: 'utf-8',\n })\n\n if (savedData?.toString() !== data?.toString()) {\n throw new Error(`Sanity check failed for ${path}\\n\\nData[${data.length}]:\\n${data}\\n\\nSaved[${savedData.length}]:\\n${savedData}\\n`)\n }\n\n return savedData\n }\n\n return data\n}\n\n// biome-ignore lint/suspicious/noTsIgnore: production ready\n// @ts-ignore\ndeclare module '@kubb/fabric-core' {\n interface Fabric {\n write(options?: WriteOptions): Promise<void>\n }\n}\n\ndeclare global {\n namespace Kubb {\n interface Fabric {\n write(options?: WriteOptions): Promise<void>\n }\n }\n}\n\nexport const fsPlugin = createPlugin<Options, ExtendOptions>({\n name: 'fs',\n install(ctx, options = {}) {\n if (options.clean) {\n fs.removeSync(options.clean.path)\n }\n\n ctx.on('process:progress', async ({ file, source }) => {\n if (options.onBeforeWrite) {\n await options.onBeforeWrite(file.path, source)\n }\n await write(file.path, source, { sanity: false })\n })\n },\n inject(ctx, { dryRun } = {}) {\n return {\n async write(\n options = {\n extension: { '.ts': '.ts' },\n },\n ) {\n await ctx.fileManager.write({\n mode: ctx.config?.options?.mode,\n extension: options.extension,\n dryRun,\n parsers: ctx.installedParsers,\n })\n },\n }\n },\n})\n","import { spawn } from 'node:child_process'\n\nconst spawnBin = (bin: string, args: string[]): Promise<boolean> => {\n return new Promise((resolve) => {\n const process = spawn(bin, args, {\n detached: true,\n shell: false,\n windowsHide: true,\n })\n\n process.on('close', (code) => {\n resolve(!code)\n })\n })\n}\n\ntype Options = {\n app?: string\n}\n\nexport async function open(path: string, options?: Options): Promise<boolean> {\n const app = options?.app\n\n if (process.platform === 'win32') {\n return spawnBin('cmd.exe', ['/c', 'start', app || '', path.replace(/[&^]/g, '^$&')])\n }\n\n if (process.platform === 'linux') {\n return spawnBin(app || 'xdg-open', [path])\n }\n if (process.platform === 'darwin') {\n return spawnBin('open', app ? ['-a', app, path] : [path])\n }\n\n throw new Error(`Unsupported platform, could not open \"${path}\"`)\n}\n","import http from 'node:http'\nimport type { AddressInfo } from 'node:net'\nimport path from 'node:path'\nimport handler from 'serve-handler'\nimport { createFile } from '../createFile.ts'\nimport type * as KubbFile from '../KubbFile.ts'\nimport { open } from '../utils/open.ts'\nimport { type Graph, TreeNode } from '../utils/TreeNode.ts'\nimport { createPlugin } from './createPlugin.ts'\n\ntype Options = {\n root: string\n /**\n * @default false\n */\n open?: boolean\n}\n\ntype GetGraphOptions = {\n files: KubbFile.File[]\n root: string\n}\n\nexport function getGraph({ files, root }: GetGraphOptions): Graph | undefined {\n const treeNode = TreeNode.fromFiles(files, root)\n\n if (!treeNode) {\n return undefined\n }\n\n return TreeNode.toGraph(treeNode)\n}\nconst html = `\n <!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <title>File Graph</title>\n <script type=\"module\">\n import { Network } from 'https://cdn.jsdelivr.net/npm/vis-network/standalone/esm/vis-network.min.js'\n\n async function main() {\n const res = await fetch('./graph.json')\n const { nodes, edges } = await res.json()\n const container = document.getElementById('graph')\n\n const network = new Network(\n container,\n { nodes, edges },\n {\n layout: { hierarchical: { direction: 'UD', sortMethod: 'directed' } },\n nodes: { shape: 'box', font: { face: 'monospace' } },\n edges: { arrows: 'to' },\n physics: false,\n },\n )\n }\n\n main()\n </script>\n <style>\n html, body, #graph { height: 100%; margin: 0; }\n </style>\n </head>\n <body>\n <div id=\"graph\"></div>\n </body>\n</html>\n`\n\nasync function serve(root: string) {\n const server = http.createServer((req, res) => {\n return handler(req, res, {\n public: root,\n cleanUrls: true,\n })\n })\n\n server.listen(0, async () => {\n const { port } = server.address() as AddressInfo\n console.log(`Running on http://localhost:${port}/graph.html`)\n\n await open(`http://localhost:${port}/graph.html`)\n })\n}\n\nexport const graphPlugin = createPlugin<Options>({\n name: 'graph',\n install(ctx, options) {\n if (!options) {\n throw new Error('Graph plugin requires options.root and options.mode')\n }\n\n ctx.on('write:start', async ({ files }) => {\n const root = options.root\n\n const graph = getGraph({ files, root })\n\n if (!graph) {\n return undefined\n }\n\n const graphFile = createFile({\n baseName: 'graph.json',\n path: path.join(root, 'graph.json'),\n sources: [\n {\n name: 'graph',\n value: JSON.stringify(graph, null, 2),\n },\n ],\n })\n\n const graphHtmlFile = createFile({\n baseName: 'graph.html',\n path: path.join(root, 'graph.html'),\n sources: [\n {\n name: 'graph',\n value: html,\n },\n ],\n })\n\n await ctx.addFile(graphFile, graphHtmlFile)\n\n if (options.open) {\n await serve(root)\n }\n })\n },\n})\n","import { relative } from 'node:path'\nimport process from 'node:process'\nimport { Presets, SingleBar } from 'cli-progress'\nimport { createPlugin } from './createPlugin.ts'\n\nexport const progressPlugin = createPlugin({\n name: 'progress',\n install(ctx) {\n const progressBar = new SingleBar(\n {\n format: '{bar} {percentage}% | {value}/{total} | {message}',\n barCompleteChar: '█',\n barIncompleteChar: '░',\n hideCursor: true,\n clearOnComplete: true,\n },\n Presets.shades_grey,\n )\n\n ctx.on('process:start', async ({ files }) => {\n progressBar.start(files.length, 0, { message: 'Starting...' })\n })\n\n ctx.on('process:progress', async ({ file }) => {\n const message = `Writing ${relative(process.cwd(), file.path)}`\n progressBar.increment(1, { message })\n })\n\n ctx.on('process:end', async ({ files }) => {\n progressBar.update(files.length, { message: 'Done ✅' })\n progressBar.stop()\n })\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,IAAa,WAAb,MAAa,SAA0B;CAMrC,YAAY,MAAa,QAA0B;+CALnD;+CACA;+CACA,YAAmC,EAAE;;AAInC,OAAK,OAAO;AACZ,OAAK,SAAS;;CAGhB,SAAS,MAA8B;EACrC,MAAM,QAAQ,IAAI,SAAS,MAAM,KAAK;AACtC,OAAK,SAAS,KAAK,MAAM;AACzB,8CAAqB,OAAS;AAC9B,SAAO;;CAGT,IAAI,SAAiC;AACnC,mEAAI,KAAkB,CAAE,qEAAO,KAAkB;AACjD,MAAI,KAAK,SAAS,WAAW,EAAG,QAAO,CAAC,KAAK;EAE7C,MAAMA,QAAgC,CAAC,GAAG,KAAK,SAAS;EACxD,MAAMC,SAAiC,EAAE;AAEzC,OAAK,MAAM,Q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name, o as Plugin, s as UserPlugin } from "./Fabric-0mXLgmur.cjs";
2
2
 
3
- //#region src/plugins/createPlugin.d.ts
4
- declare function createPlugin<Options$3 = unknown, TAppExtension extends Record<string, any> = {}>(plugin: UserPlugin<Options$3, TAppExtension>): Plugin<Options$3, TAppExtension>;
5
- //#endregion
6
- //#region src/plugins/fsPlugin.d.ts
7
- type WriteOptions = {
8
- extension?: Record<Extname, Extname | ''>;
9
- };
3
+ //#region src/plugins/barrelPlugin.d.ts
4
+ type Mode = 'all' | 'named' | 'propagate' | false;
10
5
  type Options$2 = {
6
+ root: string;
7
+ mode: Mode;
11
8
  dryRun?: boolean;
12
- /**
13
- * Optional callback that is invoked whenever a file is written by the plugin.
14
- * Useful for tests to observe write operations without spying on internal functions.
15
- */
16
- onBeforeWrite?: (path: string, data: string | undefined) => void | Promise<void>;
17
- clean?: {
18
- path: string;
19
- };
9
+ };
10
+ type WriteEntryOptions = {
11
+ root: string;
12
+ mode: Mode;
20
13
  };
21
14
  type ExtendOptions$1 = {
22
- write(options?: WriteOptions): Promise<void>;
15
+ writeEntry(options: WriteEntryOptions): Promise<void>;
23
16
  };
24
17
  declare module '@kubb/fabric-core' {
25
18
  interface Fabric {
26
- write(options?: WriteOptions): Promise<void>;
19
+ writeEntry(options: WriteEntryOptions): Promise<void>;
27
20
  }
28
21
  }
29
22
  declare global {
30
23
  namespace Kubb {
31
24
  interface Fabric {
32
- write(options?: WriteOptions): Promise<void>;
25
+ writeEntry(options: WriteEntryOptions): Promise<void>;
33
26
  }
34
27
  }
35
28
  }
36
- declare const fsPlugin: Plugin<Options$2, ExtendOptions$1>;
29
+ declare const barrelPlugin: Plugin<Options$2, ExtendOptions$1>;
37
30
  //#endregion
38
- //#region src/plugins/barrelPlugin.d.ts
39
- type Mode = 'all' | 'named' | 'propagate' | false;
31
+ //#region src/plugins/createPlugin.d.ts
32
+ declare function createPlugin<Options$3 = unknown, TAppExtension extends Record<string, any> = {}>(plugin: UserPlugin<Options$3, TAppExtension>): Plugin<Options$3, TAppExtension>;
33
+ //#endregion
34
+ //#region src/plugins/fsPlugin.d.ts
35
+ type WriteOptions = {
36
+ extension?: Record<Extname, Extname | ''>;
37
+ };
40
38
  type Options$1 = {
41
- root: string;
42
- mode: Mode;
43
39
  dryRun?: boolean;
44
- };
45
- type WriteEntryOptions = {
46
- root: string;
47
- mode: Mode;
40
+ /**
41
+ * Optional callback that is invoked whenever a file is written by the plugin.
42
+ * Useful for tests to observe write operations without spying on internal functions.
43
+ */
44
+ onBeforeWrite?: (path: string, data: string | undefined) => void | Promise<void>;
45
+ clean?: {
46
+ path: string;
47
+ };
48
48
  };
49
49
  type ExtendOptions = {
50
- writeEntry(options: WriteEntryOptions): Promise<void>;
50
+ write(options?: WriteOptions): Promise<void>;
51
51
  };
52
52
  declare module '@kubb/fabric-core' {
53
53
  interface Fabric {
54
- writeEntry(options: WriteEntryOptions): Promise<void>;
54
+ write(options?: WriteOptions): Promise<void>;
55
55
  }
56
56
  }
57
57
  declare global {
58
58
  namespace Kubb {
59
59
  interface Fabric {
60
- writeEntry(options: WriteEntryOptions): Promise<void>;
60
+ write(options?: WriteOptions): Promise<void>;
61
61
  }
62
62
  }
63
63
  }
64
- declare const barrelPlugin: Plugin<Options$1, ExtendOptions>;
65
- //#endregion
66
- //#region src/plugins/progressPlugin.d.ts
67
- declare const progressPlugin: Plugin<[], {}>;
64
+ declare const fsPlugin: Plugin<Options$1, ExtendOptions>;
68
65
  //#endregion
69
66
  //#region src/plugins/graphPlugin.d.ts
70
67
  type Options = {
@@ -76,5 +73,8 @@ type Options = {
76
73
  };
77
74
  declare const graphPlugin: Plugin<Options, {}>;
78
75
  //#endregion
76
+ //#region src/plugins/progressPlugin.d.ts
77
+ declare const progressPlugin: Plugin<[], {}>;
78
+ //#endregion
79
79
  export { barrelPlugin, createPlugin, fsPlugin, graphPlugin, progressPlugin };
80
80
  //# sourceMappingURL=plugins.d.cts.map
package/dist/plugins.d.ts CHANGED
@@ -1,70 +1,67 @@
1
- import { d as UserPlugin, f as Extname, u as Plugin } from "./Fabric-CxMkO4Rt.js";
1
+ import { f as Extname, o as Plugin, s as UserPlugin } from "./Fabric-C-AqOkTA.js";
2
2
 
3
- //#region src/plugins/createPlugin.d.ts
4
- declare function createPlugin<Options$3 = unknown, TAppExtension extends Record<string, any> = {}>(plugin: UserPlugin<Options$3, TAppExtension>): Plugin<Options$3, TAppExtension>;
5
- //#endregion
6
- //#region src/plugins/fsPlugin.d.ts
7
- type WriteOptions = {
8
- extension?: Record<Extname, Extname | ''>;
9
- };
3
+ //#region src/plugins/barrelPlugin.d.ts
4
+ type Mode = 'all' | 'named' | 'propagate' | false;
10
5
  type Options$2 = {
6
+ root: string;
7
+ mode: Mode;
11
8
  dryRun?: boolean;
12
- /**
13
- * Optional callback that is invoked whenever a file is written by the plugin.
14
- * Useful for tests to observe write operations without spying on internal functions.
15
- */
16
- onBeforeWrite?: (path: string, data: string | undefined) => void | Promise<void>;
17
- clean?: {
18
- path: string;
19
- };
9
+ };
10
+ type WriteEntryOptions = {
11
+ root: string;
12
+ mode: Mode;
20
13
  };
21
14
  type ExtendOptions$1 = {
22
- write(options?: WriteOptions): Promise<void>;
15
+ writeEntry(options: WriteEntryOptions): Promise<void>;
23
16
  };
24
17
  declare module '@kubb/fabric-core' {
25
18
  interface Fabric {
26
- write(options?: WriteOptions): Promise<void>;
19
+ writeEntry(options: WriteEntryOptions): Promise<void>;
27
20
  }
28
21
  }
29
22
  declare global {
30
23
  namespace Kubb {
31
24
  interface Fabric {
32
- write(options?: WriteOptions): Promise<void>;
25
+ writeEntry(options: WriteEntryOptions): Promise<void>;
33
26
  }
34
27
  }
35
28
  }
36
- declare const fsPlugin: Plugin<Options$2, ExtendOptions$1>;
29
+ declare const barrelPlugin: Plugin<Options$2, ExtendOptions$1>;
37
30
  //#endregion
38
- //#region src/plugins/barrelPlugin.d.ts
39
- type Mode = 'all' | 'named' | 'propagate' | false;
31
+ //#region src/plugins/createPlugin.d.ts
32
+ declare function createPlugin<Options$3 = unknown, TAppExtension extends Record<string, any> = {}>(plugin: UserPlugin<Options$3, TAppExtension>): Plugin<Options$3, TAppExtension>;
33
+ //#endregion
34
+ //#region src/plugins/fsPlugin.d.ts
35
+ type WriteOptions = {
36
+ extension?: Record<Extname, Extname | ''>;
37
+ };
40
38
  type Options$1 = {
41
- root: string;
42
- mode: Mode;
43
39
  dryRun?: boolean;
44
- };
45
- type WriteEntryOptions = {
46
- root: string;
47
- mode: Mode;
40
+ /**
41
+ * Optional callback that is invoked whenever a file is written by the plugin.
42
+ * Useful for tests to observe write operations without spying on internal functions.
43
+ */
44
+ onBeforeWrite?: (path: string, data: string | undefined) => void | Promise<void>;
45
+ clean?: {
46
+ path: string;
47
+ };
48
48
  };
49
49
  type ExtendOptions = {
50
- writeEntry(options: WriteEntryOptions): Promise<void>;
50
+ write(options?: WriteOptions): Promise<void>;
51
51
  };
52
52
  declare module '@kubb/fabric-core' {
53
53
  interface Fabric {
54
- writeEntry(options: WriteEntryOptions): Promise<void>;
54
+ write(options?: WriteOptions): Promise<void>;
55
55
  }
56
56
  }
57
57
  declare global {
58
58
  namespace Kubb {
59
59
  interface Fabric {
60
- writeEntry(options: WriteEntryOptions): Promise<void>;
60
+ write(options?: WriteOptions): Promise<void>;
61
61
  }
62
62
  }
63
63
  }
64
- declare const barrelPlugin: Plugin<Options$1, ExtendOptions>;
65
- //#endregion
66
- //#region src/plugins/progressPlugin.d.ts
67
- declare const progressPlugin: Plugin<[], {}>;
64
+ declare const fsPlugin: Plugin<Options$1, ExtendOptions>;
68
65
  //#endregion
69
66
  //#region src/plugins/graphPlugin.d.ts
70
67
  type Options = {
@@ -76,5 +73,8 @@ type Options = {
76
73
  };
77
74
  declare const graphPlugin: Plugin<Options, {}>;
78
75
  //#endregion
76
+ //#region src/plugins/progressPlugin.d.ts
77
+ declare const progressPlugin: Plugin<[], {}>;
78
+ //#endregion
79
79
  export { barrelPlugin, createPlugin, fsPlugin, graphPlugin, progressPlugin };
80
80
  //# sourceMappingURL=plugins.d.ts.map