@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.
- package/README.md +1 -1
- package/dist/{Fabric-CrRJykMN.d.ts → Fabric-CE-4sqCG.d.ts} +1 -4
- package/dist/{Fabric-DMmgrLto.d.cts → Fabric-efyCO1t7.d.ts} +2 -2
- package/dist/{RootContext-Cf7WJM7r.d.cts → RootContext-BgiMS39h.d.ts} +3 -3
- package/dist/{RootContext-CvaGJ-4g.d.ts → RootContext-CA-zkTEp.d.ts} +3 -4
- package/dist/{chunk-BVHe6Par.js → chunk-BYypO7fO.js} +1 -5
- package/dist/{chunk-DVipidnM.cjs → chunk-uaV2rQ02.cjs} +0 -10
- package/dist/{defaultParser-BK-zOanQ.cjs → defaultParser-BAgmtMo_.cjs} +2 -3
- package/dist/{defaultParser-BK-zOanQ.cjs.map → defaultParser-BAgmtMo_.cjs.map} +1 -1
- package/dist/{defaultParser-BD_N68Bo.js → defaultParser-C1atU7yU.js} +2 -3
- package/dist/{defaultParser-BD_N68Bo.js.map → defaultParser-C1atU7yU.js.map} +1 -1
- package/dist/{getRelativePath-C4Au07ON.js → getRelativePath-BcieQL5M.js} +1 -2
- package/dist/{getRelativePath-C4Au07ON.js.map → getRelativePath-BcieQL5M.js.map} +1 -1
- package/dist/{getRelativePath-DpbA6qm5.cjs → getRelativePath-DVG8dIzW.cjs} +2 -2
- package/dist/{getRelativePath-DpbA6qm5.cjs.map → getRelativePath-DVG8dIzW.cjs.map} +1 -1
- package/dist/index.cjs +62 -61
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +11 -5
- package/dist/index.js +8 -9
- package/dist/index.js.map +1 -1
- package/dist/{Root-CKos-Ahf.cjs → onProcessExit-B7_bTfyR.cjs} +115 -213
- package/dist/onProcessExit-B7_bTfyR.cjs.map +1 -0
- package/dist/{Root-BQX3eHqb.js → onProcessExit-CF200hsz.js} +109 -190
- package/dist/onProcessExit-CF200hsz.js.map +1 -0
- package/dist/parsers/typescript.cjs +4 -4
- package/dist/parsers/typescript.cjs.map +1 -1
- package/dist/parsers/typescript.d.ts +1 -2
- package/dist/parsers/typescript.js +3 -4
- package/dist/parsers/typescript.js.map +1 -1
- package/dist/parsers.cjs +2 -3
- package/dist/parsers.cjs.map +1 -1
- package/dist/parsers.d.ts +1 -2
- package/dist/parsers.js +2 -3
- package/dist/parsers.js.map +1 -1
- package/dist/plugins.cjs +61 -305
- package/dist/plugins.cjs.map +1 -1
- package/dist/plugins.d.ts +9 -40
- package/dist/plugins.js +58 -298
- package/dist/plugins.js.map +1 -1
- package/dist/types.cjs +1 -1
- package/dist/types.d.ts +3 -4
- package/dist/types.js +1 -1
- package/dist/{useNodeTree-CgEKFUV-.d.cts → useNodeTree-BpHR6gQx.d.ts} +2 -2
- package/dist/{useNodeTree-CamNuFQP.d.ts → useNodeTree-DuQ5Df0t.d.ts} +2 -3
- package/package.json +8 -18
- package/src/FileManager.ts +6 -2
- package/src/createFile.ts +12 -9
- package/src/index.ts +3 -2
- package/src/plugins/fsPlugin.ts +8 -6
- package/src/plugins/fsxPlugin/Runtime.ts +4 -7
- package/src/plugins/index.ts +0 -1
- package/src/plugins/loggerPlugin.ts +15 -192
- package/src/utils/onProcessExit.ts +35 -0
- package/dist/Root-BQX3eHqb.js.map +0 -1
- package/dist/Root-CKos-Ahf.cjs.map +0 -1
- package/dist/index.d.cts +0 -595
- package/dist/parsers/typescript.d.cts +0 -45
- package/dist/parsers.d.cts +0 -37
- package/dist/plugins.d.cts +0 -149
- package/dist/types.d.cts +0 -11
- package/src/plugins/graphPlugin.ts +0 -136
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
## Features
|
|
24
24
|
- Language-agnostic toolkit for generating code and files using JSX and TypeScript.
|
|
25
25
|
- Works with Node.js 20+ and Bun.
|
|
26
|
-
- Plugin ecosystem with fsPlugin, barrelPlugin, loggerPlugin,
|
|
26
|
+
- Plugin ecosystem with fsPlugin, barrelPlugin, loggerPlugin, and reactPlugin.
|
|
27
27
|
- Parser system for TypeScript, TSX, and custom file formats.
|
|
28
28
|
- Event-driven architecture for file generation lifecycle.
|
|
29
29
|
- Built-in debugging utilities and progress tracking.
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { n as __name, t as __exportAll } from "./chunk-BVHe6Par.js";
|
|
2
|
-
|
|
3
|
-
//#region src/KubbFile.d.ts
|
|
4
1
|
declare namespace KubbFile_d_exports {
|
|
5
2
|
export { BaseName, Export, Extname, File, Import, Mode, Path, ResolvedFile, Source };
|
|
6
3
|
}
|
|
@@ -516,4 +513,4 @@ interface Fabric<T extends FabricOptions = FabricOptions> extends Kubb.Fabric {
|
|
|
516
513
|
}
|
|
517
514
|
//#endregion
|
|
518
515
|
export { Path as A, UserParser as C, File as D, Extname as E, Source as M, Import as O, Parser as S, Export as T, inject as _, FabricElement as a, FileManager as b, FabricOptions as c, renderIndent as d, renderIntrinsic as f, createContext as g, Context as h, FabricContext as i, ResolvedFile as j, KubbFile_d_exports as k, Plugin as l, RenderContextProps as m, FabricComponent as n, FabricMode as o, RenderContext as p, FabricConfig as r, FabricNode as s, Fabric as t, UserPlugin as u, provide as v, BaseName as w, FileProcessor as x, unprovide as y };
|
|
519
|
-
//# sourceMappingURL=Fabric-
|
|
516
|
+
//# sourceMappingURL=Fabric-CE-4sqCG.d.ts.map
|
|
@@ -512,5 +512,5 @@ interface Fabric<T extends FabricOptions = FabricOptions> extends Kubb.Fabric {
|
|
|
512
512
|
upsertFile(...files: File[]): Promise<void>;
|
|
513
513
|
}
|
|
514
514
|
//#endregion
|
|
515
|
-
export { Path as A, UserParser as C, File as D, Extname as E, Source as M,
|
|
516
|
-
//# sourceMappingURL=Fabric-
|
|
515
|
+
export { Path as A, UserParser as C, File as D, Extname as E, Source as M, Import as O, Parser as S, Export as T, inject as _, FabricElement as a, FileManager as b, FabricOptions as c, renderIndent as d, renderIntrinsic as f, createContext as g, Context as h, FabricContext as i, ResolvedFile as j, KubbFile_d_exports as k, Plugin as l, RenderContextProps as m, FabricComponent as n, FabricMode as o, RenderContext as p, FabricConfig as r, FabricNode as s, Fabric as t, UserPlugin as u, provide as v, BaseName as w, FileProcessor as x, unprovide as y };
|
|
516
|
+
//# sourceMappingURL=Fabric-efyCO1t7.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as TreeNode, t as ComponentNode } from "./useNodeTree-
|
|
1
|
+
import { b as FileManager, h as Context } from "./Fabric-CE-4sqCG.js";
|
|
2
|
+
import { r as TreeNode, t as ComponentNode } from "./useNodeTree-BpHR6gQx.js";
|
|
3
3
|
|
|
4
4
|
//#region src/contexts/RootContext.d.ts
|
|
5
5
|
type RootContextProps = {
|
|
@@ -23,4 +23,4 @@ type RootContextProps = {
|
|
|
23
23
|
declare const RootContext: Context<RootContextProps>;
|
|
24
24
|
//#endregion
|
|
25
25
|
export { RootContextProps as n, RootContext as t };
|
|
26
|
-
//# sourceMappingURL=RootContext-
|
|
26
|
+
//# sourceMappingURL=RootContext-BgiMS39h.d.ts.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { r as TreeNode, t as ComponentNode } from "./useNodeTree-CamNuFQP.js";
|
|
1
|
+
import { b as FileManager, h as Context } from "./Fabric-efyCO1t7.js";
|
|
2
|
+
import { r as TreeNode, t as ComponentNode } from "./useNodeTree-DuQ5Df0t.js";
|
|
4
3
|
|
|
5
4
|
//#region src/contexts/RootContext.d.ts
|
|
6
5
|
type RootContextProps = {
|
|
@@ -24,4 +23,4 @@ type RootContextProps = {
|
|
|
24
23
|
declare const RootContext: Context<RootContextProps>;
|
|
25
24
|
//#endregion
|
|
26
25
|
export { RootContextProps as n, RootContext as t };
|
|
27
|
-
//# sourceMappingURL=RootContext-
|
|
26
|
+
//# sourceMappingURL=RootContext-CA-zkTEp.d.ts.map
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
//#region \0rolldown/runtime.js
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __name = (target, value) => __defProp(target, "name", {
|
|
4
|
-
value,
|
|
5
|
-
configurable: true
|
|
6
|
-
});
|
|
7
3
|
var __exportAll = (all, no_symbols) => {
|
|
8
4
|
let target = {};
|
|
9
5
|
for (var name in all) {
|
|
@@ -19,4 +15,4 @@ var __exportAll = (all, no_symbols) => {
|
|
|
19
15
|
};
|
|
20
16
|
|
|
21
17
|
//#endregion
|
|
22
|
-
export {
|
|
18
|
+
export { __exportAll as t };
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
//#region \0rolldown/runtime.js
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", {
|
|
5
|
-
value,
|
|
6
|
-
configurable: true
|
|
7
|
-
});
|
|
8
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
@@ -49,12 +45,6 @@ Object.defineProperty(exports, '__exportAll', {
|
|
|
49
45
|
return __exportAll;
|
|
50
46
|
}
|
|
51
47
|
});
|
|
52
|
-
Object.defineProperty(exports, '__name', {
|
|
53
|
-
enumerable: true,
|
|
54
|
-
get: function () {
|
|
55
|
-
return __name;
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
48
|
Object.defineProperty(exports, '__toESM', {
|
|
59
49
|
enumerable: true,
|
|
60
50
|
get: function () {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_getRelativePath = require('./getRelativePath-DpbA6qm5.cjs');
|
|
1
|
+
const require_getRelativePath = require('./getRelativePath-DVG8dIzW.cjs');
|
|
3
2
|
|
|
4
3
|
//#region src/parsers/defaultParser.ts
|
|
5
4
|
const defaultParser = require_getRelativePath.defineParser({
|
|
@@ -18,4 +17,4 @@ Object.defineProperty(exports, 'defaultParser', {
|
|
|
18
17
|
return defaultParser;
|
|
19
18
|
}
|
|
20
19
|
});
|
|
21
|
-
//# sourceMappingURL=defaultParser-
|
|
20
|
+
//# sourceMappingURL=defaultParser-BAgmtMo_.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultParser-
|
|
1
|
+
{"version":3,"file":"defaultParser-BAgmtMo_.cjs","names":["defineParser"],"sources":["../src/parsers/defaultParser.ts"],"sourcesContent":["import { defineParser } from './defineParser.ts'\n\nexport const defaultParser = defineParser({\n name: 'default',\n extNames: ['.json'],\n install() {},\n async parse(file) {\n return file.sources.map((item) => item.value).join('\\n\\n')\n },\n})\n"],"mappings":";;;AAEA,MAAa,gBAAgBA,qCAAa;CACxC,MAAM;CACN,UAAU,CAAC,QAAQ;CACnB,UAAU;CACV,MAAM,MAAM,MAAM;AAChB,SAAO,KAAK,QAAQ,KAAK,SAAS,KAAK,MAAM,CAAC,KAAK,OAAO;;CAE7D,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import { n as defineParser } from "./getRelativePath-C4Au07ON.js";
|
|
1
|
+
import { n as defineParser } from "./getRelativePath-BcieQL5M.js";
|
|
3
2
|
|
|
4
3
|
//#region src/parsers/defaultParser.ts
|
|
5
4
|
const defaultParser = defineParser({
|
|
@@ -13,4 +12,4 @@ const defaultParser = defineParser({
|
|
|
13
12
|
|
|
14
13
|
//#endregion
|
|
15
14
|
export { defaultParser as t };
|
|
16
|
-
//# sourceMappingURL=defaultParser-
|
|
15
|
+
//# sourceMappingURL=defaultParser-C1atU7yU.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultParser-
|
|
1
|
+
{"version":3,"file":"defaultParser-C1atU7yU.js","names":[],"sources":["../src/parsers/defaultParser.ts"],"sourcesContent":["import { defineParser } from './defineParser.ts'\n\nexport const defaultParser = defineParser({\n name: 'default',\n extNames: ['.json'],\n install() {},\n async parse(file) {\n return file.sources.map((item) => item.value).join('\\n\\n')\n },\n})\n"],"mappings":";;;AAEA,MAAa,gBAAgB,aAAa;CACxC,MAAM;CACN,UAAU,CAAC,QAAQ;CACnB,UAAU;CACV,MAAM,MAAM,MAAM;AAChB,SAAO,KAAK,QAAQ,KAAK,SAAS,KAAK,MAAM,CAAC,KAAK,OAAO;;CAE7D,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { n as __name } from "./chunk-BVHe6Par.js";
|
|
2
1
|
import { normalize, relative } from "node:path";
|
|
3
2
|
|
|
4
3
|
//#region src/utils/trimExtName.ts
|
|
@@ -55,4 +54,4 @@ function getRelativePath(rootDir, filePath, platform = "linux") {
|
|
|
55
54
|
|
|
56
55
|
//#endregion
|
|
57
56
|
export { defineParser as n, trimExtName as r, getRelativePath as t };
|
|
58
|
-
//# sourceMappingURL=getRelativePath-
|
|
57
|
+
//# sourceMappingURL=getRelativePath-BcieQL5M.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRelativePath-
|
|
1
|
+
{"version":3,"file":"getRelativePath-BcieQL5M.js","names":[],"sources":["../src/utils/trimExtName.ts","../src/parsers/defineParser.ts","../src/utils/getRelativePath.ts"],"sourcesContent":["export function trimExtName(text: string): string {\n return text.replace(/\\.[^/.]+$/, '')\n}\n","import type { Parser, UserParser } from './types.ts'\n\n/**\n * Defines a Fabric parser with type safety.\n *\n * Use this function to create parsers that transform files based on\n * their extension.\n *\n * @param parser - The parser configuration object\n * @returns A typed parser ready to use with Fabric\n *\n * @example\n * ```ts\n * import { defineParser } from '@kubb/fabric-core'\n *\n * export const jsonParser = defineParser({\n * name: 'json-parser',\n * extensions: ['.json'],\n * async parse(source, meta) {\n * const data = JSON.parse(source)\n * return data\n * }\n * })\n * ```\n */\nexport function defineParser<TOptions = unknown, TMeta extends object = any>(parser: UserParser<TOptions, TMeta>): Parser<TOptions, TMeta> {\n return {\n type: 'parser',\n ...parser,\n }\n}\n","import { normalize, relative } from 'node:path'\n\nfunction slash(path: string, platform: 'windows' | 'mac' | 'linux' = 'linux') {\n const isWindowsPath = /^\\\\\\\\\\?\\\\/.test(path)\n const normalizedPath = normalize(path)\n\n if (['linux', 'mac'].includes(platform) && !isWindowsPath) {\n // linux and mac\n return normalizedPath.replaceAll(/\\\\/g, '/').replace('../', '')\n }\n\n // windows\n return normalizedPath.replaceAll(/\\\\/g, '/').replace('../', '')\n}\n\nexport function getRelativePath(rootDir?: string | null, filePath?: string | null, platform: 'windows' | 'mac' | 'linux' = 'linux'): string {\n if (!rootDir || !filePath) {\n throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ''} ${filePath || ''}`)\n }\n\n const relativePath = relative(rootDir, filePath)\n\n // On Windows, paths are separated with a \"\\\"\n // However, web browsers use \"/\" no matter the platform\n const slashedPath = slash(relativePath, platform)\n\n if (slashedPath.startsWith('../')) {\n return slashedPath\n }\n\n return `./${slashedPath}`\n}\n"],"mappings":";;;AAAA,SAAgB,YAAY,MAAsB;AAChD,QAAO,KAAK,QAAQ,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACwBtC,SAAgB,aAA6D,QAA8D;AACzI,QAAO;EACL,MAAM;EACN,GAAG;EACJ;;;;;AC3BH,SAAS,MAAM,MAAc,WAAwC,SAAS;CAC5E,MAAM,gBAAgB,YAAY,KAAK,KAAK;CAC5C,MAAM,iBAAiB,UAAU,KAAK;AAEtC,KAAI,CAAC,SAAS,MAAM,CAAC,SAAS,SAAS,IAAI,CAAC,cAE1C,QAAO,eAAe,WAAW,OAAO,IAAI,CAAC,QAAQ,OAAO,GAAG;AAIjE,QAAO,eAAe,WAAW,OAAO,IAAI,CAAC,QAAQ,OAAO,GAAG;;AAGjE,SAAgB,gBAAgB,SAAyB,UAA0B,WAAwC,SAAiB;AAC1I,KAAI,CAAC,WAAW,CAAC,SACf,OAAM,IAAI,MAAM,uEAAuE,WAAW,GAAG,GAAG,YAAY,KAAK;CAO3H,MAAM,cAAc,MAJC,SAAS,SAAS,SAAS,EAIR,SAAS;AAEjD,KAAI,YAAY,WAAW,MAAM,CAC/B,QAAO;AAGT,QAAO,KAAK"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_chunk = require('./chunk-
|
|
1
|
+
const require_chunk = require('./chunk-uaV2rQ02.cjs');
|
|
2
2
|
let node_path = require("node:path");
|
|
3
3
|
|
|
4
4
|
//#region src/utils/trimExtName.ts
|
|
@@ -72,4 +72,4 @@ Object.defineProperty(exports, 'trimExtName', {
|
|
|
72
72
|
return trimExtName;
|
|
73
73
|
}
|
|
74
74
|
});
|
|
75
|
-
//# sourceMappingURL=getRelativePath-
|
|
75
|
+
//# sourceMappingURL=getRelativePath-DVG8dIzW.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRelativePath-
|
|
1
|
+
{"version":3,"file":"getRelativePath-DVG8dIzW.cjs","names":[],"sources":["../src/utils/trimExtName.ts","../src/parsers/defineParser.ts","../src/utils/getRelativePath.ts"],"sourcesContent":["export function trimExtName(text: string): string {\n return text.replace(/\\.[^/.]+$/, '')\n}\n","import type { Parser, UserParser } from './types.ts'\n\n/**\n * Defines a Fabric parser with type safety.\n *\n * Use this function to create parsers that transform files based on\n * their extension.\n *\n * @param parser - The parser configuration object\n * @returns A typed parser ready to use with Fabric\n *\n * @example\n * ```ts\n * import { defineParser } from '@kubb/fabric-core'\n *\n * export const jsonParser = defineParser({\n * name: 'json-parser',\n * extensions: ['.json'],\n * async parse(source, meta) {\n * const data = JSON.parse(source)\n * return data\n * }\n * })\n * ```\n */\nexport function defineParser<TOptions = unknown, TMeta extends object = any>(parser: UserParser<TOptions, TMeta>): Parser<TOptions, TMeta> {\n return {\n type: 'parser',\n ...parser,\n }\n}\n","import { normalize, relative } from 'node:path'\n\nfunction slash(path: string, platform: 'windows' | 'mac' | 'linux' = 'linux') {\n const isWindowsPath = /^\\\\\\\\\\?\\\\/.test(path)\n const normalizedPath = normalize(path)\n\n if (['linux', 'mac'].includes(platform) && !isWindowsPath) {\n // linux and mac\n return normalizedPath.replaceAll(/\\\\/g, '/').replace('../', '')\n }\n\n // windows\n return normalizedPath.replaceAll(/\\\\/g, '/').replace('../', '')\n}\n\nexport function getRelativePath(rootDir?: string | null, filePath?: string | null, platform: 'windows' | 'mac' | 'linux' = 'linux'): string {\n if (!rootDir || !filePath) {\n throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ''} ${filePath || ''}`)\n }\n\n const relativePath = relative(rootDir, filePath)\n\n // On Windows, paths are separated with a \"\\\"\n // However, web browsers use \"/\" no matter the platform\n const slashedPath = slash(relativePath, platform)\n\n if (slashedPath.startsWith('../')) {\n return slashedPath\n }\n\n return `./${slashedPath}`\n}\n"],"mappings":";;;;AAAA,SAAgB,YAAY,MAAsB;AAChD,QAAO,KAAK,QAAQ,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACwBtC,SAAgB,aAA6D,QAA8D;AACzI,QAAO;EACL,MAAM;EACN,GAAG;EACJ;;;;;AC3BH,SAAS,MAAM,MAAc,WAAwC,SAAS;CAC5E,MAAM,gBAAgB,YAAY,KAAK,KAAK;CAC5C,MAAM,0CAA2B,KAAK;AAEtC,KAAI,CAAC,SAAS,MAAM,CAAC,SAAS,SAAS,IAAI,CAAC,cAE1C,QAAO,eAAe,WAAW,OAAO,IAAI,CAAC,QAAQ,OAAO,GAAG;AAIjE,QAAO,eAAe,WAAW,OAAO,IAAI,CAAC,QAAQ,OAAO,GAAG;;AAGjE,SAAgB,gBAAgB,SAAyB,UAA0B,WAAwC,SAAiB;AAC1I,KAAI,CAAC,WAAW,CAAC,SACf,OAAM,IAAI,MAAM,uEAAuE,WAAW,GAAG,GAAG,YAAY,KAAK;CAO3H,MAAM,cAAc,8BAJU,SAAS,SAAS,EAIR,SAAS;AAEjD,KAAI,YAAY,WAAW,MAAM,CAC/B,QAAO;AAGT,QAAO,KAAK"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_chunk = require('./chunk-
|
|
3
|
-
const
|
|
4
|
-
const require_getRelativePath = require('./getRelativePath-
|
|
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
|
const require_parsers_typescript = require('./parsers/typescript.cjs');
|
|
6
6
|
let remeda = require("remeda");
|
|
7
7
|
|
|
8
8
|
//#region src/composables/useContext.ts
|
|
9
9
|
function useContext(key, defaultValue) {
|
|
10
|
-
return
|
|
10
|
+
return require_onProcessExit.inject(key, defaultValue);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
//#endregion
|
|
@@ -29,7 +29,7 @@ function useContext(key, defaultValue) {
|
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
31
|
function useNodeTree() {
|
|
32
|
-
return useContext(
|
|
32
|
+
return useContext(require_onProcessExit.NodeTreeContext);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
//#endregion
|
|
@@ -38,7 +38,7 @@ function useNodeTree() {
|
|
|
38
38
|
* Provides app-level metadata and lifecycle hooks (like `exit`) to
|
|
39
39
|
* components and composables within a Fabric runtime.
|
|
40
40
|
*/
|
|
41
|
-
const AppContext =
|
|
41
|
+
const AppContext = require_onProcessExit.createContext({
|
|
42
42
|
exit: () => {},
|
|
43
43
|
meta: {}
|
|
44
44
|
});
|
|
@@ -60,15 +60,15 @@ const AppContext = require_Root.createContext({
|
|
|
60
60
|
* </App>
|
|
61
61
|
* ```
|
|
62
62
|
*/
|
|
63
|
-
const App =
|
|
63
|
+
const App = require_onProcessExit.createComponent("App", ({ children, ...props }) => {
|
|
64
64
|
const { meta = {} } = props;
|
|
65
|
-
const { exit } = useContext(
|
|
65
|
+
const { exit } = useContext(require_onProcessExit.RootContext);
|
|
66
66
|
const nodeTree = useNodeTree();
|
|
67
|
-
if (nodeTree)
|
|
67
|
+
if (nodeTree) require_onProcessExit.provide(require_onProcessExit.NodeTreeContext, nodeTree.addChild({
|
|
68
68
|
type: "App",
|
|
69
69
|
props
|
|
70
70
|
}));
|
|
71
|
-
|
|
71
|
+
require_onProcessExit.provide(AppContext, {
|
|
72
72
|
exit,
|
|
73
73
|
meta
|
|
74
74
|
});
|
|
@@ -92,8 +92,8 @@ App.displayName = "App";
|
|
|
92
92
|
* </>
|
|
93
93
|
* ```
|
|
94
94
|
*/
|
|
95
|
-
const Br =
|
|
96
|
-
return
|
|
95
|
+
const Br = require_onProcessExit.createComponent("br", () => {
|
|
96
|
+
return require_onProcessExit.createIntrinsic("br");
|
|
97
97
|
});
|
|
98
98
|
Br.displayName = "Br";
|
|
99
99
|
|
|
@@ -104,7 +104,7 @@ Br.displayName = "Br";
|
|
|
104
104
|
*/
|
|
105
105
|
function createJSDoc({ comments }) {
|
|
106
106
|
if (!comments || comments.length === 0) return "";
|
|
107
|
-
const lines = comments.flatMap((c) => String(c
|
|
107
|
+
const lines = comments.flatMap((c) => String(c ?? "").split(/\r?\n/)).map((l) => l.replace(/\*\//g, "*\\/").replace(/\r/g, "")).filter((l) => l.trim().length > 0);
|
|
108
108
|
if (lines.length === 0) return "";
|
|
109
109
|
return [
|
|
110
110
|
"/**",
|
|
@@ -125,16 +125,16 @@ function createJSDoc({ comments }) {
|
|
|
125
125
|
* </Const>
|
|
126
126
|
* ```
|
|
127
127
|
*/
|
|
128
|
-
const Const =
|
|
128
|
+
const Const = require_onProcessExit.createComponent("Const", ({ children, ...props }) => {
|
|
129
129
|
const { name, export: canExport, type, JSDoc, asConst } = props;
|
|
130
130
|
const nodeTree = useNodeTree();
|
|
131
|
-
if (nodeTree)
|
|
131
|
+
if (nodeTree) require_onProcessExit.provide(require_onProcessExit.NodeTreeContext, nodeTree.addChild({
|
|
132
132
|
type: "Const",
|
|
133
133
|
props
|
|
134
134
|
}));
|
|
135
|
-
const value =
|
|
135
|
+
const value = require_onProcessExit.renderIntrinsic(children);
|
|
136
136
|
let result = "";
|
|
137
|
-
if (JSDoc
|
|
137
|
+
if (JSDoc?.comments) {
|
|
138
138
|
result += createJSDoc({ comments: JSDoc.comments });
|
|
139
139
|
result += "\n";
|
|
140
140
|
}
|
|
@@ -166,8 +166,8 @@ Const.displayName = "Const";
|
|
|
166
166
|
* </>
|
|
167
167
|
* ```
|
|
168
168
|
*/
|
|
169
|
-
const Dedent =
|
|
170
|
-
return
|
|
169
|
+
const Dedent = require_onProcessExit.createComponent("dedent", () => {
|
|
170
|
+
return require_onProcessExit.createIntrinsic("dedent");
|
|
171
171
|
});
|
|
172
172
|
Dedent.displayName = "Dedent";
|
|
173
173
|
|
|
@@ -177,7 +177,7 @@ Dedent.displayName = "Dedent";
|
|
|
177
177
|
* Provides app-level metadata and lifecycle hooks (like `exit`) to
|
|
178
178
|
* components and composables within a Fabric runtime.
|
|
179
179
|
*/
|
|
180
|
-
const FileContext =
|
|
180
|
+
const FileContext = require_onProcessExit.createContext(null);
|
|
181
181
|
|
|
182
182
|
//#endregion
|
|
183
183
|
//#region src/composables/useFile.ts
|
|
@@ -223,7 +223,7 @@ function useFile() {
|
|
|
223
223
|
* ```
|
|
224
224
|
*/
|
|
225
225
|
function useFileManager() {
|
|
226
|
-
const { fileManager } = useContext(
|
|
226
|
+
const { fileManager } = useContext(require_onProcessExit.RootContext);
|
|
227
227
|
return fileManager;
|
|
228
228
|
}
|
|
229
229
|
|
|
@@ -243,11 +243,11 @@ function useFileManager() {
|
|
|
243
243
|
* </File>
|
|
244
244
|
* ```
|
|
245
245
|
*/
|
|
246
|
-
const File =
|
|
246
|
+
const File = require_onProcessExit.createComponent("File", ({ children, ...props }) => {
|
|
247
247
|
const { baseName, path, meta = {}, footer, banner } = props;
|
|
248
248
|
const fileManager = useFileManager();
|
|
249
249
|
const nodeTree = useNodeTree();
|
|
250
|
-
if (nodeTree)
|
|
250
|
+
if (nodeTree) require_onProcessExit.provide(require_onProcessExit.NodeTreeContext, nodeTree.addChild({
|
|
251
251
|
type: "File",
|
|
252
252
|
props
|
|
253
253
|
}));
|
|
@@ -262,7 +262,7 @@ const File = require_Root.createComponent("File", ({ children, ...props }) => {
|
|
|
262
262
|
exports: []
|
|
263
263
|
};
|
|
264
264
|
const [resolvedFile] = fileManager.add(file);
|
|
265
|
-
|
|
265
|
+
require_onProcessExit.provide(FileContext, resolvedFile);
|
|
266
266
|
return children;
|
|
267
267
|
});
|
|
268
268
|
/**
|
|
@@ -277,15 +277,15 @@ const File = require_Root.createComponent("File", ({ children, ...props }) => {
|
|
|
277
277
|
* </File.Source>
|
|
278
278
|
* ```
|
|
279
279
|
*/
|
|
280
|
-
const FileSource =
|
|
280
|
+
const FileSource = require_onProcessExit.createComponent("FileSource", ({ children, ...props }) => {
|
|
281
281
|
const { name, isExportable, isIndexable, isTypeOnly } = props;
|
|
282
282
|
const nodeTree = useNodeTree();
|
|
283
283
|
const file = useFile();
|
|
284
|
-
if (nodeTree)
|
|
284
|
+
if (nodeTree) require_onProcessExit.provide(require_onProcessExit.NodeTreeContext, nodeTree.addChild({
|
|
285
285
|
type: "FileSource",
|
|
286
286
|
props
|
|
287
287
|
}));
|
|
288
|
-
const value =
|
|
288
|
+
const value = require_onProcessExit.renderIntrinsic(children);
|
|
289
289
|
if (file) file.sources.push({
|
|
290
290
|
name,
|
|
291
291
|
isExportable,
|
|
@@ -305,11 +305,11 @@ const FileSource = require_Root.createComponent("FileSource", ({ children, ...pr
|
|
|
305
305
|
* <File.Export name="User" path="./types/user" isTypeOnly />
|
|
306
306
|
* ```
|
|
307
307
|
*/
|
|
308
|
-
const FileExport =
|
|
308
|
+
const FileExport = require_onProcessExit.createComponent("FileExport", (props) => {
|
|
309
309
|
const { name, path, isTypeOnly, asAlias } = props;
|
|
310
310
|
const nodeTree = useNodeTree();
|
|
311
311
|
const file = useFile();
|
|
312
|
-
if (nodeTree)
|
|
312
|
+
if (nodeTree) require_onProcessExit.provide(require_onProcessExit.NodeTreeContext, nodeTree.addChild({
|
|
313
313
|
type: "FileExport",
|
|
314
314
|
props
|
|
315
315
|
}));
|
|
@@ -336,11 +336,11 @@ const FileExport = require_Root.createComponent("FileExport", (props) => {
|
|
|
336
336
|
* <File.Import name="User" path="./types/user" isTypeOnly />
|
|
337
337
|
* ```
|
|
338
338
|
*/
|
|
339
|
-
const FileImport =
|
|
339
|
+
const FileImport = require_onProcessExit.createComponent("FileImport", (props) => {
|
|
340
340
|
const { name, path, root, isNameSpace, isTypeOnly } = props;
|
|
341
341
|
const nodeTree = useNodeTree();
|
|
342
342
|
const file = useFile();
|
|
343
|
-
if (nodeTree)
|
|
343
|
+
if (nodeTree) require_onProcessExit.provide(require_onProcessExit.NodeTreeContext, nodeTree.addChild({
|
|
344
344
|
type: "FileImport",
|
|
345
345
|
props
|
|
346
346
|
}));
|
|
@@ -382,8 +382,8 @@ File.Export = FileExport;
|
|
|
382
382
|
* </>
|
|
383
383
|
* ```
|
|
384
384
|
*/
|
|
385
|
-
const Indent =
|
|
386
|
-
return
|
|
385
|
+
const Indent = require_onProcessExit.createComponent("indent", () => {
|
|
386
|
+
return require_onProcessExit.createIntrinsic("indent");
|
|
387
387
|
});
|
|
388
388
|
Indent.displayName = "Indent";
|
|
389
389
|
|
|
@@ -405,15 +405,15 @@ Indent.displayName = "Indent";
|
|
|
405
405
|
* </Function>
|
|
406
406
|
* ```
|
|
407
407
|
*/
|
|
408
|
-
const Function =
|
|
408
|
+
const Function = require_onProcessExit.createComponent("Function", ({ children, ...props }) => {
|
|
409
409
|
const { name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc } = props;
|
|
410
410
|
const nodeTree = useNodeTree();
|
|
411
|
-
if (nodeTree)
|
|
411
|
+
if (nodeTree) require_onProcessExit.provide(require_onProcessExit.NodeTreeContext, nodeTree.addChild({
|
|
412
412
|
type: "Function",
|
|
413
413
|
props
|
|
414
414
|
}));
|
|
415
415
|
const parts = [];
|
|
416
|
-
if (JSDoc
|
|
416
|
+
if (JSDoc?.comments) {
|
|
417
417
|
parts.push(createJSDoc({ comments: JSDoc.comments }));
|
|
418
418
|
parts.push("\n");
|
|
419
419
|
}
|
|
@@ -449,15 +449,15 @@ Function.displayName = "Function";
|
|
|
449
449
|
* the same options as `Function`. Use `singleLine` to produce a one-line
|
|
450
450
|
* arrow expression.
|
|
451
451
|
*/
|
|
452
|
-
const ArrowFunction =
|
|
452
|
+
const ArrowFunction = require_onProcessExit.createComponent("ArrowFunction", ({ children, ...props }) => {
|
|
453
453
|
const { name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc, singleLine } = props;
|
|
454
454
|
const nodeTree = useNodeTree();
|
|
455
|
-
if (nodeTree)
|
|
455
|
+
if (nodeTree) require_onProcessExit.provide(require_onProcessExit.NodeTreeContext, nodeTree.addChild({
|
|
456
456
|
type: "ArrowFunction",
|
|
457
457
|
props
|
|
458
458
|
}));
|
|
459
459
|
const parts = [];
|
|
460
|
-
if (JSDoc
|
|
460
|
+
if (JSDoc?.comments) {
|
|
461
461
|
parts.push(createJSDoc({ comments: JSDoc.comments }));
|
|
462
462
|
parts.push("\n");
|
|
463
463
|
}
|
|
@@ -504,17 +504,17 @@ Function.Arrow = ArrowFunction;
|
|
|
504
504
|
* </Type>
|
|
505
505
|
* ```
|
|
506
506
|
*/
|
|
507
|
-
const Type =
|
|
507
|
+
const Type = require_onProcessExit.createComponent("Type", ({ children, ...props }) => {
|
|
508
508
|
const { name, export: canExport, JSDoc } = props;
|
|
509
509
|
const nodeTree = useNodeTree();
|
|
510
|
-
if (nodeTree)
|
|
510
|
+
if (nodeTree) require_onProcessExit.provide(require_onProcessExit.NodeTreeContext, nodeTree.addChild({
|
|
511
511
|
type: "Type",
|
|
512
512
|
props
|
|
513
513
|
}));
|
|
514
514
|
if (name.charAt(0).toUpperCase() !== name.charAt(0)) throw new Error("Name should start with a capital letter (see TypeScript types)");
|
|
515
|
-
const value =
|
|
515
|
+
const value = require_onProcessExit.renderIntrinsic(children);
|
|
516
516
|
let result = "";
|
|
517
|
-
if (JSDoc
|
|
517
|
+
if (JSDoc?.comments) {
|
|
518
518
|
result += createJSDoc({ comments: JSDoc.comments });
|
|
519
519
|
result += "\n";
|
|
520
520
|
}
|
|
@@ -565,7 +565,7 @@ function useApp() {
|
|
|
565
565
|
* ```
|
|
566
566
|
*/
|
|
567
567
|
function useLifecycle() {
|
|
568
|
-
const { exit } = useContext(
|
|
568
|
+
const { exit } = useContext(require_onProcessExit.RootContext);
|
|
569
569
|
return { exit };
|
|
570
570
|
}
|
|
571
571
|
|
|
@@ -602,11 +602,11 @@ function useLifecycle() {
|
|
|
602
602
|
* ```
|
|
603
603
|
*/
|
|
604
604
|
function createFabric(config = { mode: "sequential" }) {
|
|
605
|
-
const events = new
|
|
605
|
+
const events = new require_onProcessExit.AsyncEventEmitter();
|
|
606
606
|
const installedPlugins = /* @__PURE__ */ new Set();
|
|
607
607
|
const installedParsers = /* @__PURE__ */ new Map();
|
|
608
608
|
const installedParserNames = /* @__PURE__ */ new Set();
|
|
609
|
-
const fileManager = new
|
|
609
|
+
const fileManager = new require_onProcessExit.FileManager({ events });
|
|
610
610
|
const context = {
|
|
611
611
|
get files() {
|
|
612
612
|
return fileManager.files;
|
|
@@ -672,27 +672,28 @@ exports.Const = Const;
|
|
|
672
672
|
exports.Dedent = Dedent;
|
|
673
673
|
exports.File = File;
|
|
674
674
|
exports.FileContext = FileContext;
|
|
675
|
-
exports.FileManager =
|
|
676
|
-
exports.FileProcessor =
|
|
675
|
+
exports.FileManager = require_onProcessExit.FileManager;
|
|
676
|
+
exports.FileProcessor = require_onProcessExit.FileProcessor;
|
|
677
677
|
exports.Function = Function;
|
|
678
678
|
exports.Indent = Indent;
|
|
679
|
-
exports.NodeTreeContext =
|
|
680
|
-
exports.RenderContext =
|
|
681
|
-
exports.Root =
|
|
682
|
-
exports.RootContext =
|
|
683
|
-
exports.TreeNode =
|
|
679
|
+
exports.NodeTreeContext = require_onProcessExit.NodeTreeContext;
|
|
680
|
+
exports.RenderContext = require_onProcessExit.RenderContext;
|
|
681
|
+
exports.Root = require_onProcessExit.Root;
|
|
682
|
+
exports.RootContext = require_onProcessExit.RootContext;
|
|
683
|
+
exports.TreeNode = require_onProcessExit.TreeNode;
|
|
684
684
|
exports.Type = Type;
|
|
685
|
-
exports.createComponent =
|
|
686
|
-
exports.createContext =
|
|
685
|
+
exports.createComponent = require_onProcessExit.createComponent;
|
|
686
|
+
exports.createContext = require_onProcessExit.createContext;
|
|
687
687
|
exports.createFabric = createFabric;
|
|
688
|
-
exports.createFile =
|
|
688
|
+
exports.createFile = require_onProcessExit.createFile;
|
|
689
689
|
exports.createJSDoc = createJSDoc;
|
|
690
690
|
exports.getRelativePath = require_getRelativePath.getRelativePath;
|
|
691
|
-
exports.inject =
|
|
692
|
-
exports.
|
|
693
|
-
exports.
|
|
694
|
-
exports.
|
|
695
|
-
exports.
|
|
691
|
+
exports.inject = require_onProcessExit.inject;
|
|
692
|
+
exports.onProcessExit = require_onProcessExit.onProcessExit;
|
|
693
|
+
exports.provide = require_onProcessExit.provide;
|
|
694
|
+
exports.renderIndent = require_onProcessExit.renderIndent;
|
|
695
|
+
exports.renderIntrinsic = require_onProcessExit.renderIntrinsic;
|
|
696
|
+
exports.unprovide = require_onProcessExit.unprovide;
|
|
696
697
|
exports.useApp = useApp;
|
|
697
698
|
exports.useContext = useContext;
|
|
698
699
|
exports.useFile = useFile;
|