@kubb/fabric-core 0.13.3 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Fabric-D4udrNnL.d.ts → Fabric-CFkgoZwY.d.ts} +2 -2
- package/dist/{chunk-DVipidnM.cjs → chunk-MlS0t1Af.cjs} +27 -37
- package/dist/{chunk-BVHe6Par.js → chunk-O_arW02_.js} +6 -11
- package/dist/defaultParser-D0_-Uy2Z.cjs +19 -0
- package/dist/{defaultParser-BK-zOanQ.cjs.map → defaultParser-D0_-Uy2Z.cjs.map} +1 -1
- package/dist/{defaultParser-BD_N68Bo.js → defaultParser-iCpMSYCp.js} +4 -5
- package/dist/{defaultParser-BD_N68Bo.js.map → defaultParser-iCpMSYCp.js.map} +1 -1
- package/dist/{getRelativePath-C4Au07ON.js → getRelativePath-NAm_Y-vp.js} +3 -6
- package/dist/{getRelativePath-C4Au07ON.js.map → getRelativePath-NAm_Y-vp.js.map} +1 -1
- package/dist/{getRelativePath-DpbA6qm5.cjs → getRelativePath-WX4HB169.cjs} +18 -21
- package/dist/{getRelativePath-DpbA6qm5.cjs.map → getRelativePath-WX4HB169.cjs.map} +1 -1
- package/dist/index.cjs +75 -93
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +54 -55
- package/dist/index.js +71 -89
- package/dist/index.js.map +1 -1
- package/dist/{onProcessExit-BHrZkYzP.cjs → onProcessExit-C2AuepQI.cjs} +213 -227
- package/dist/onProcessExit-C2AuepQI.cjs.map +1 -0
- package/dist/{onProcessExit-CnZym153.js → onProcessExit-Cput7j2c.js} +124 -138
- package/dist/onProcessExit-Cput7j2c.js.map +1 -0
- package/dist/parsers/typescript.cjs +4 -5
- package/dist/parsers/typescript.cjs.map +1 -1
- package/dist/parsers/typescript.d.ts +2 -2
- package/dist/parsers/typescript.js +3 -4
- package/dist/parsers/typescript.js.map +1 -1
- package/dist/parsers.cjs +6 -7
- package/dist/parsers.cjs.map +1 -1
- package/dist/parsers.d.ts +2 -2
- package/dist/parsers.js +4 -5
- package/dist/parsers.js.map +1 -1
- package/dist/plugins.cjs +7 -13
- package/dist/plugins.cjs.map +1 -1
- package/dist/plugins.d.ts +5 -5
- package/dist/plugins.js +6 -12
- package/dist/plugins.js.map +1 -1
- package/dist/{RootContext-BEiEsH2Z.d.ts → types-BwR3_cUx.d.ts} +10 -5
- package/dist/types.cjs +13 -15
- package/dist/types.d.ts +4 -12
- package/dist/types.js +2 -3
- package/dist/{useNodeTree-CPJ6Y80N.d.ts → useNodeTree-Wc1WxA05.d.ts} +3 -3
- package/package.json +2 -2
- package/src/components/{App.ts → Fabric.ts} +8 -8
- package/src/composables/{useApp.ts → useFabric.ts} +4 -4
- package/src/contexts/{AppContext.ts → FabricContext.ts} +2 -2
- package/src/index.ts +4 -6
- package/src/plugins/fsxPlugin/fsxPlugin.ts +4 -4
- package/dist/defaultParser-BK-zOanQ.cjs +0 -21
- package/dist/onProcessExit-BHrZkYzP.cjs.map +0 -1
- package/dist/onProcessExit-CnZym153.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as __name, t as __exportAll } from "./chunk-
|
|
1
|
+
import { n as __name, t as __exportAll } from "./chunk-O_arW02_.js";
|
|
2
2
|
|
|
3
3
|
//#region src/KubbFile.d.ts
|
|
4
4
|
declare namespace KubbFile_d_exports {
|
|
@@ -516,4 +516,4 @@ interface Fabric<T extends FabricOptions = FabricOptions> extends Kubb.Fabric {
|
|
|
516
516
|
}
|
|
517
517
|
//#endregion
|
|
518
518
|
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-
|
|
519
|
+
//# sourceMappingURL=Fabric-CFkgoZwY.d.ts.map
|
|
@@ -11,28 +11,20 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
11
11
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
12
|
var __exportAll = (all, no_symbols) => {
|
|
13
13
|
let target = {};
|
|
14
|
-
for (var name in all) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
if (!no_symbols) {
|
|
21
|
-
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
22
|
-
}
|
|
14
|
+
for (var name in all) __defProp(target, name, {
|
|
15
|
+
get: all[name],
|
|
16
|
+
enumerable: true
|
|
17
|
+
});
|
|
18
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
23
19
|
return target;
|
|
24
20
|
};
|
|
25
21
|
var __copyProps = (to, from, except, desc) => {
|
|
26
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}
|
|
22
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
23
|
+
key = keys[i];
|
|
24
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
25
|
+
get: ((k) => from[k]).bind(null, key),
|
|
26
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
27
|
+
});
|
|
36
28
|
}
|
|
37
29
|
return to;
|
|
38
30
|
};
|
|
@@ -40,24 +32,22 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
40
32
|
value: mod,
|
|
41
33
|
enumerable: true
|
|
42
34
|
}) : target, mod));
|
|
43
|
-
|
|
44
35
|
//#endregion
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
36
|
+
Object.defineProperty(exports, "__exportAll", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function() {
|
|
39
|
+
return __exportAll;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "__name", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function() {
|
|
45
|
+
return __name;
|
|
46
|
+
}
|
|
51
47
|
});
|
|
52
|
-
Object.defineProperty(exports,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
48
|
+
Object.defineProperty(exports, "__toESM", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function() {
|
|
51
|
+
return __toESM;
|
|
52
|
+
}
|
|
57
53
|
});
|
|
58
|
-
Object.defineProperty(exports, '__toESM', {
|
|
59
|
-
enumerable: true,
|
|
60
|
-
get: function () {
|
|
61
|
-
return __toESM;
|
|
62
|
-
}
|
|
63
|
-
});
|
|
@@ -6,17 +6,12 @@ var __name = (target, value) => __defProp(target, "name", {
|
|
|
6
6
|
});
|
|
7
7
|
var __exportAll = (all, no_symbols) => {
|
|
8
8
|
let target = {};
|
|
9
|
-
for (var name in all) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
if (!no_symbols) {
|
|
16
|
-
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
17
|
-
}
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
13
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
18
14
|
return target;
|
|
19
15
|
};
|
|
20
|
-
|
|
21
16
|
//#endregion
|
|
22
|
-
export { __name as n, __exportAll as t };
|
|
17
|
+
export { __name as n, __exportAll as t };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require("./chunk-MlS0t1Af.cjs");
|
|
2
|
+
//#region src/parsers/defaultParser.ts
|
|
3
|
+
const defaultParser = require("./getRelativePath-WX4HB169.cjs").defineParser({
|
|
4
|
+
name: "default",
|
|
5
|
+
extNames: [".json"],
|
|
6
|
+
install() {},
|
|
7
|
+
async parse(file) {
|
|
8
|
+
return file.sources.map((item) => item.value).join("\n\n");
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
//#endregion
|
|
12
|
+
Object.defineProperty(exports, "defaultParser", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function() {
|
|
15
|
+
return defaultParser;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=defaultParser-D0_-Uy2Z.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultParser-
|
|
1
|
+
{"version":3,"file":"defaultParser-D0_-Uy2Z.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,0DAAgBA,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,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { n as defineParser } from "./getRelativePath-
|
|
3
|
-
|
|
1
|
+
import "./chunk-O_arW02_.js";
|
|
2
|
+
import { n as defineParser } from "./getRelativePath-NAm_Y-vp.js";
|
|
4
3
|
//#region src/parsers/defaultParser.ts
|
|
5
4
|
const defaultParser = defineParser({
|
|
6
5
|
name: "default",
|
|
@@ -10,7 +9,7 @@ const defaultParser = defineParser({
|
|
|
10
9
|
return file.sources.map((item) => item.value).join("\n\n");
|
|
11
10
|
}
|
|
12
11
|
});
|
|
13
|
-
|
|
14
12
|
//#endregion
|
|
15
13
|
export { defaultParser as t };
|
|
16
|
-
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=defaultParser-iCpMSYCp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultParser-
|
|
1
|
+
{"version":3,"file":"defaultParser-iCpMSYCp.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,11 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./chunk-O_arW02_.js";
|
|
2
2
|
import { normalize, relative } from "node:path";
|
|
3
|
-
|
|
4
3
|
//#region src/utils/trimExtName.ts
|
|
5
4
|
function trimExtName(text) {
|
|
6
5
|
return text.replace(/\.[^/.]+$/, "");
|
|
7
6
|
}
|
|
8
|
-
|
|
9
7
|
//#endregion
|
|
10
8
|
//#region src/parsers/defineParser.ts
|
|
11
9
|
/**
|
|
@@ -37,7 +35,6 @@ function defineParser(parser) {
|
|
|
37
35
|
...parser
|
|
38
36
|
};
|
|
39
37
|
}
|
|
40
|
-
|
|
41
38
|
//#endregion
|
|
42
39
|
//#region src/utils/getRelativePath.ts
|
|
43
40
|
function slash(path, platform = "linux") {
|
|
@@ -52,7 +49,7 @@ function getRelativePath(rootDir, filePath, platform = "linux") {
|
|
|
52
49
|
if (slashedPath.startsWith("../")) return slashedPath;
|
|
53
50
|
return `./${slashedPath}`;
|
|
54
51
|
}
|
|
55
|
-
|
|
56
52
|
//#endregion
|
|
57
53
|
export { defineParser as n, trimExtName as r, getRelativePath as t };
|
|
58
|
-
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=getRelativePath-NAm_Y-vp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRelativePath-
|
|
1
|
+
{"version":3,"file":"getRelativePath-NAm_Y-vp.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,11 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
require("./chunk-MlS0t1Af.cjs");
|
|
2
2
|
let node_path = require("node:path");
|
|
3
|
-
|
|
4
3
|
//#region src/utils/trimExtName.ts
|
|
5
4
|
function trimExtName(text) {
|
|
6
5
|
return text.replace(/\.[^/.]+$/, "");
|
|
7
6
|
}
|
|
8
|
-
|
|
9
7
|
//#endregion
|
|
10
8
|
//#region src/parsers/defineParser.ts
|
|
11
9
|
/**
|
|
@@ -37,7 +35,6 @@ function defineParser(parser) {
|
|
|
37
35
|
...parser
|
|
38
36
|
};
|
|
39
37
|
}
|
|
40
|
-
|
|
41
38
|
//#endregion
|
|
42
39
|
//#region src/utils/getRelativePath.ts
|
|
43
40
|
function slash(path, platform = "linux") {
|
|
@@ -52,24 +49,24 @@ function getRelativePath(rootDir, filePath, platform = "linux") {
|
|
|
52
49
|
if (slashedPath.startsWith("../")) return slashedPath;
|
|
53
50
|
return `./${slashedPath}`;
|
|
54
51
|
}
|
|
55
|
-
|
|
56
52
|
//#endregion
|
|
57
|
-
Object.defineProperty(exports,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
53
|
+
Object.defineProperty(exports, "defineParser", {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
get: function() {
|
|
56
|
+
return defineParser;
|
|
57
|
+
}
|
|
62
58
|
});
|
|
63
|
-
Object.defineProperty(exports,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
59
|
+
Object.defineProperty(exports, "getRelativePath", {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
get: function() {
|
|
62
|
+
return getRelativePath;
|
|
63
|
+
}
|
|
68
64
|
});
|
|
69
|
-
Object.defineProperty(exports,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
65
|
+
Object.defineProperty(exports, "trimExtName", {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function() {
|
|
68
|
+
return trimExtName;
|
|
69
|
+
}
|
|
74
70
|
});
|
|
75
|
-
|
|
71
|
+
|
|
72
|
+
//# sourceMappingURL=getRelativePath-WX4HB169.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRelativePath-
|
|
1
|
+
{"version":3,"file":"getRelativePath-WX4HB169.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,kBAAA,GAAA,UAAA,WAA2B,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,OAAA,GAAA,UAAA,UAJU,SAAS,SAAS,EAIR,SAAS;AAEjD,KAAI,YAAY,WAAW,MAAM,CAC/B,QAAO;AAGT,QAAO,KAAK"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,15 +1,33 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value:
|
|
2
|
-
|
|
3
|
-
const require_onProcessExit = require(
|
|
4
|
-
const require_getRelativePath = require(
|
|
5
|
-
const require_parsers_typescript = require(
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("./chunk-MlS0t1Af.cjs");
|
|
3
|
+
const require_onProcessExit = require("./onProcessExit-C2AuepQI.cjs");
|
|
4
|
+
const require_getRelativePath = require("./getRelativePath-WX4HB169.cjs");
|
|
5
|
+
const require_parsers_typescript = require("./parsers/typescript.cjs");
|
|
6
6
|
let remeda = require("remeda");
|
|
7
|
-
|
|
7
|
+
//#region src/components/Br.ts
|
|
8
|
+
/**
|
|
9
|
+
* Generates a line break in the output.
|
|
10
|
+
*
|
|
11
|
+
* Use this component to add newlines in generated code.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <>
|
|
16
|
+
* const x = 1
|
|
17
|
+
* <Br />
|
|
18
|
+
* const y = 2
|
|
19
|
+
* </>
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
const Br = require_onProcessExit.createComponent("br", () => {
|
|
23
|
+
return require_onProcessExit.createIntrinsic("br");
|
|
24
|
+
});
|
|
25
|
+
Br.displayName = "Br";
|
|
26
|
+
//#endregion
|
|
8
27
|
//#region src/composables/useContext.ts
|
|
9
28
|
function useContext(key, defaultValue) {
|
|
10
29
|
return require_onProcessExit.inject(key, defaultValue);
|
|
11
30
|
}
|
|
12
|
-
|
|
13
31
|
//#endregion
|
|
14
32
|
//#region src/composables/useNodeTree.ts
|
|
15
33
|
/**
|
|
@@ -31,72 +49,6 @@ function useContext(key, defaultValue) {
|
|
|
31
49
|
function useNodeTree() {
|
|
32
50
|
return useContext(require_onProcessExit.NodeTreeContext);
|
|
33
51
|
}
|
|
34
|
-
|
|
35
|
-
//#endregion
|
|
36
|
-
//#region src/contexts/AppContext.ts
|
|
37
|
-
/**
|
|
38
|
-
* Provides app-level metadata and lifecycle hooks (like `exit`) to
|
|
39
|
-
* components and composables within a Fabric runtime.
|
|
40
|
-
*/
|
|
41
|
-
const AppContext = require_onProcessExit.createContext({
|
|
42
|
-
exit: () => {},
|
|
43
|
-
meta: {}
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
//#endregion
|
|
47
|
-
//#region src/components/App.ts
|
|
48
|
-
/**
|
|
49
|
-
* Container component providing App context with metadata and lifecycle.
|
|
50
|
-
*
|
|
51
|
-
* Use this component to wrap your application and provide shared metadata
|
|
52
|
-
* that can be accessed by child components using the useApp composable.
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* ```tsx
|
|
56
|
-
* <App meta={{ version: '1.0.0', author: 'John Doe' }}>
|
|
57
|
-
* <File baseName="user.ts" path="./user.ts">
|
|
58
|
-
* <File.Source>export type User = {}</File.Source>
|
|
59
|
-
* </File>
|
|
60
|
-
* </App>
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
const App = require_onProcessExit.createComponent("App", ({ children, ...props }) => {
|
|
64
|
-
const { meta = {} } = props;
|
|
65
|
-
const { exit } = useContext(require_onProcessExit.RootContext);
|
|
66
|
-
const nodeTree = useNodeTree();
|
|
67
|
-
if (nodeTree) require_onProcessExit.provide(require_onProcessExit.NodeTreeContext, nodeTree.addChild({
|
|
68
|
-
type: "App",
|
|
69
|
-
props
|
|
70
|
-
}));
|
|
71
|
-
require_onProcessExit.provide(AppContext, {
|
|
72
|
-
exit,
|
|
73
|
-
meta
|
|
74
|
-
});
|
|
75
|
-
return children;
|
|
76
|
-
});
|
|
77
|
-
App.displayName = "App";
|
|
78
|
-
|
|
79
|
-
//#endregion
|
|
80
|
-
//#region src/components/Br.ts
|
|
81
|
-
/**
|
|
82
|
-
* Generates a line break in the output.
|
|
83
|
-
*
|
|
84
|
-
* Use this component to add newlines in generated code.
|
|
85
|
-
*
|
|
86
|
-
* @example
|
|
87
|
-
* ```tsx
|
|
88
|
-
* <>
|
|
89
|
-
* const x = 1
|
|
90
|
-
* <Br />
|
|
91
|
-
* const y = 2
|
|
92
|
-
* </>
|
|
93
|
-
* ```
|
|
94
|
-
*/
|
|
95
|
-
const Br = require_onProcessExit.createComponent("br", () => {
|
|
96
|
-
return require_onProcessExit.createIntrinsic("br");
|
|
97
|
-
});
|
|
98
|
-
Br.displayName = "Br";
|
|
99
|
-
|
|
100
52
|
//#endregion
|
|
101
53
|
//#region src/utils/createJSDoc.ts
|
|
102
54
|
/**
|
|
@@ -112,7 +64,6 @@ function createJSDoc({ comments }) {
|
|
|
112
64
|
" */"
|
|
113
65
|
].join("\n");
|
|
114
66
|
}
|
|
115
|
-
|
|
116
67
|
//#endregion
|
|
117
68
|
//#region src/components/Const.ts
|
|
118
69
|
/**
|
|
@@ -146,7 +97,6 @@ const Const = require_onProcessExit.createComponent("Const", ({ children, ...pro
|
|
|
146
97
|
return result;
|
|
147
98
|
});
|
|
148
99
|
Const.displayName = "Const";
|
|
149
|
-
|
|
150
100
|
//#endregion
|
|
151
101
|
//#region src/components/Dedent.ts
|
|
152
102
|
/**
|
|
@@ -170,7 +120,48 @@ const Dedent = require_onProcessExit.createComponent("dedent", () => {
|
|
|
170
120
|
return require_onProcessExit.createIntrinsic("dedent");
|
|
171
121
|
});
|
|
172
122
|
Dedent.displayName = "Dedent";
|
|
173
|
-
|
|
123
|
+
//#endregion
|
|
124
|
+
//#region src/contexts/FabricContext.ts
|
|
125
|
+
/**
|
|
126
|
+
* Provides app-level metadata and lifecycle hooks (like `exit`) to
|
|
127
|
+
* components and composables within a Fabric runtime.
|
|
128
|
+
*/
|
|
129
|
+
const FabricContext = require_onProcessExit.createContext({
|
|
130
|
+
exit: () => {},
|
|
131
|
+
meta: {}
|
|
132
|
+
});
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/components/Fabric.ts
|
|
135
|
+
/**
|
|
136
|
+
* Container component providing App context with metadata and lifecycle.
|
|
137
|
+
*
|
|
138
|
+
* Use this component to wrap your application and provide shared metadata
|
|
139
|
+
* that can be accessed by child components using the useApp composable.
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```tsx
|
|
143
|
+
* <Fabric meta={{ version: '1.0.0', author: 'John Doe' }}>
|
|
144
|
+
* <File baseName="user.ts" path="./user.ts">
|
|
145
|
+
* <File.Source>export type User = {}</File.Source>
|
|
146
|
+
* </File>
|
|
147
|
+
* </Fabric>
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
const Fabric = require_onProcessExit.createComponent("Fabric", ({ children, ...props }) => {
|
|
151
|
+
const { meta = {} } = props;
|
|
152
|
+
const { exit } = useContext(require_onProcessExit.RootContext);
|
|
153
|
+
const nodeTree = useNodeTree();
|
|
154
|
+
if (nodeTree) require_onProcessExit.provide(require_onProcessExit.NodeTreeContext, nodeTree.addChild({
|
|
155
|
+
type: "Fabric",
|
|
156
|
+
props
|
|
157
|
+
}));
|
|
158
|
+
require_onProcessExit.provide(FabricContext, {
|
|
159
|
+
exit,
|
|
160
|
+
meta
|
|
161
|
+
});
|
|
162
|
+
return children;
|
|
163
|
+
});
|
|
164
|
+
Fabric.displayName = "Fabric";
|
|
174
165
|
//#endregion
|
|
175
166
|
//#region src/contexts/FileContext.ts
|
|
176
167
|
/**
|
|
@@ -178,7 +169,6 @@ Dedent.displayName = "Dedent";
|
|
|
178
169
|
* components and composables within a Fabric runtime.
|
|
179
170
|
*/
|
|
180
171
|
const FileContext = require_onProcessExit.createContext(null);
|
|
181
|
-
|
|
182
172
|
//#endregion
|
|
183
173
|
//#region src/composables/useFile.ts
|
|
184
174
|
/**
|
|
@@ -201,7 +191,6 @@ const FileContext = require_onProcessExit.createContext(null);
|
|
|
201
191
|
function useFile() {
|
|
202
192
|
return useContext(FileContext);
|
|
203
193
|
}
|
|
204
|
-
|
|
205
194
|
//#endregion
|
|
206
195
|
//#region src/composables/useFileManager.ts
|
|
207
196
|
/**
|
|
@@ -226,7 +215,6 @@ function useFileManager() {
|
|
|
226
215
|
const { fileManager } = useContext(require_onProcessExit.RootContext);
|
|
227
216
|
return fileManager;
|
|
228
217
|
}
|
|
229
|
-
|
|
230
218
|
//#endregion
|
|
231
219
|
//#region src/components/File.ts
|
|
232
220
|
/**
|
|
@@ -362,7 +350,6 @@ const FileImport = require_onProcessExit.createComponent("FileImport", (props) =
|
|
|
362
350
|
File.Source = FileSource;
|
|
363
351
|
File.Import = FileImport;
|
|
364
352
|
File.Export = FileExport;
|
|
365
|
-
|
|
366
353
|
//#endregion
|
|
367
354
|
//#region src/components/Indent.ts
|
|
368
355
|
/**
|
|
@@ -386,7 +373,6 @@ const Indent = require_onProcessExit.createComponent("indent", () => {
|
|
|
386
373
|
return require_onProcessExit.createIntrinsic("indent");
|
|
387
374
|
});
|
|
388
375
|
Indent.displayName = "Indent";
|
|
389
|
-
|
|
390
376
|
//#endregion
|
|
391
377
|
//#region src/components/Function.ts
|
|
392
378
|
/**
|
|
@@ -491,7 +477,6 @@ const ArrowFunction = require_onProcessExit.createComponent("ArrowFunction", ({
|
|
|
491
477
|
});
|
|
492
478
|
ArrowFunction.displayName = "ArrowFunction";
|
|
493
479
|
Function.Arrow = ArrowFunction;
|
|
494
|
-
|
|
495
480
|
//#endregion
|
|
496
481
|
//#region src/components/Type.ts
|
|
497
482
|
/**
|
|
@@ -523,9 +508,8 @@ const Type = require_onProcessExit.createComponent("Type", ({ children, ...props
|
|
|
523
508
|
return result;
|
|
524
509
|
});
|
|
525
510
|
Type.displayName = "Type";
|
|
526
|
-
|
|
527
511
|
//#endregion
|
|
528
|
-
//#region src/composables/
|
|
512
|
+
//#region src/composables/useFabric.ts
|
|
529
513
|
/**
|
|
530
514
|
* Accesses the App context with metadata and exit function.
|
|
531
515
|
*
|
|
@@ -536,14 +520,13 @@ Type.displayName = "Type";
|
|
|
536
520
|
*
|
|
537
521
|
* @example
|
|
538
522
|
* ```ts
|
|
539
|
-
* const { meta, exit } =
|
|
523
|
+
* const { meta, exit } = useFabric<{ version: string }>()
|
|
540
524
|
* console.log(meta.version)
|
|
541
525
|
* ```
|
|
542
526
|
*/
|
|
543
|
-
function
|
|
544
|
-
return useContext(
|
|
527
|
+
function useFabric() {
|
|
528
|
+
return useContext(FabricContext);
|
|
545
529
|
}
|
|
546
|
-
|
|
547
530
|
//#endregion
|
|
548
531
|
//#region src/composables/useLifecycle.ts
|
|
549
532
|
/**
|
|
@@ -568,7 +551,6 @@ function useLifecycle() {
|
|
|
568
551
|
const { exit } = useContext(require_onProcessExit.RootContext);
|
|
569
552
|
return { exit };
|
|
570
553
|
}
|
|
571
|
-
|
|
572
554
|
//#endregion
|
|
573
555
|
//#region src/createFabric.ts
|
|
574
556
|
/**
|
|
@@ -666,13 +648,12 @@ function createFabric(config = { mode: "sequential" }) {
|
|
|
666
648
|
};
|
|
667
649
|
return fabric;
|
|
668
650
|
}
|
|
669
|
-
|
|
670
651
|
//#endregion
|
|
671
|
-
exports.App = App;
|
|
672
|
-
exports.AppContext = AppContext;
|
|
673
652
|
exports.Br = Br;
|
|
674
653
|
exports.Const = Const;
|
|
675
654
|
exports.Dedent = Dedent;
|
|
655
|
+
exports.Fabric = Fabric;
|
|
656
|
+
exports.FabricContext = FabricContext;
|
|
676
657
|
exports.File = File;
|
|
677
658
|
exports.FileContext = FileContext;
|
|
678
659
|
exports.FileManager = require_onProcessExit.FileManager;
|
|
@@ -697,10 +678,11 @@ exports.provide = require_onProcessExit.provide;
|
|
|
697
678
|
exports.renderIndent = require_onProcessExit.renderIndent;
|
|
698
679
|
exports.renderIntrinsic = require_onProcessExit.renderIntrinsic;
|
|
699
680
|
exports.unprovide = require_onProcessExit.unprovide;
|
|
700
|
-
exports.useApp = useApp;
|
|
701
681
|
exports.useContext = useContext;
|
|
682
|
+
exports.useFabric = useFabric;
|
|
702
683
|
exports.useFile = useFile;
|
|
703
684
|
exports.useFileManager = useFileManager;
|
|
704
685
|
exports.useLifecycle = useLifecycle;
|
|
705
686
|
exports.useNodeTree = useNodeTree;
|
|
687
|
+
|
|
706
688
|
//# sourceMappingURL=index.cjs.map
|