@kubb/core 4.32.0 → 4.32.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/dist/{chunk-DKWOrOAv.js → chunk--u3MIqq1.js} +1 -2
- package/dist/{chunk-CNbaEX1y.cjs → chunk-ByKO4r7w.cjs} +17 -23
- package/dist/{write-CwpeNfTd.cjs → fs-D4eqq6bR.cjs} +33 -38
- package/dist/fs-D4eqq6bR.cjs.map +1 -0
- package/dist/{write-pEo2oQGI.js → fs-TVBCPkE-.js} +4 -9
- package/dist/fs-TVBCPkE-.js.map +1 -0
- package/dist/fs.cjs +8 -9
- package/dist/fs.d.ts +1 -1
- package/dist/fs.js +2 -3
- package/dist/hooks.cjs +3 -6
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.ts +2 -2
- package/dist/hooks.js +2 -5
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +15 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +5 -14
- package/dist/index.js.map +1 -1
- package/dist/{packageManager-B7KCmp2R.d.ts → packageManager-_7I0WFQU.d.ts} +3 -3
- package/dist/{packageManager-BGUS6_Pq.cjs → packageManager-jzjuEj2U.cjs} +79 -93
- package/dist/{packageManager-BGUS6_Pq.cjs.map → packageManager-jzjuEj2U.cjs.map} +1 -1
- package/dist/{packageManager-B6NiaZeW.js → packageManager-wMCQlgd6.js} +5 -19
- package/dist/{packageManager-B6NiaZeW.js.map → packageManager-wMCQlgd6.js.map} +1 -1
- package/dist/{toRegExp-DdJ1Kgbf.js → transformers-BwSpAhvT.js} +26 -15
- package/dist/transformers-BwSpAhvT.js.map +1 -0
- package/dist/{toRegExp-DGgAWZ_m.cjs → transformers-BweFhqh-.cjs} +121 -104
- package/dist/transformers-BweFhqh-.cjs.map +1 -0
- package/dist/transformers.cjs +24 -46
- package/dist/transformers.d.ts +1 -1
- package/dist/transformers.js +1 -26
- package/dist/{types-CiePC9Y3.d.ts → types-f_no0d7G.d.ts} +2 -2
- package/dist/utils.cjs +6 -20
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.ts +3 -3
- package/dist/utils.js +4 -18
- package/dist/utils.js.map +1 -1
- package/package.json +5 -1
- package/dist/toRegExp-DGgAWZ_m.cjs.map +0 -1
- package/dist/toRegExp-DdJ1Kgbf.js.map +0 -1
- package/dist/transformers.cjs.map +0 -1
- package/dist/transformers.js.map +0 -1
- package/dist/write-CwpeNfTd.cjs.map +0 -1
- package/dist/write-pEo2oQGI.js.map +0 -1
|
@@ -10,16 +10,12 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
10
10
|
var __getProtoOf = Object.getPrototypeOf;
|
|
11
11
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
12
|
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
14
|
+
key = keys[i];
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: ((k) => from[k]).bind(null, key),
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
23
19
|
}
|
|
24
20
|
return to;
|
|
25
21
|
};
|
|
@@ -27,18 +23,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
23
|
value: mod,
|
|
28
24
|
enumerable: true
|
|
29
25
|
}) : target, mod));
|
|
30
|
-
|
|
31
26
|
//#endregion
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
Object.defineProperty(exports, "__name", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function() {
|
|
30
|
+
return __name;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(exports, "__toESM", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function() {
|
|
36
|
+
return __toESM;
|
|
37
|
+
}
|
|
38
38
|
});
|
|
39
|
-
Object.defineProperty(exports, '__toESM', {
|
|
40
|
-
enumerable: true,
|
|
41
|
-
get: function () {
|
|
42
|
-
return __toESM;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
const require_chunk = require(
|
|
1
|
+
const require_chunk = require("./chunk-ByKO4r7w.cjs");
|
|
2
2
|
let node_path = require("node:path");
|
|
3
3
|
let node_fs_promises = require("node:fs/promises");
|
|
4
4
|
let node_fs = require("node:fs");
|
|
5
5
|
node_fs = require_chunk.__toESM(node_fs);
|
|
6
|
-
|
|
7
6
|
//#region src/fs/clean.ts
|
|
8
7
|
async function clean(path) {
|
|
9
8
|
return (0, node_fs_promises.rm)(path, {
|
|
@@ -11,14 +10,12 @@ async function clean(path) {
|
|
|
11
10
|
force: true
|
|
12
11
|
});
|
|
13
12
|
}
|
|
14
|
-
|
|
15
13
|
//#endregion
|
|
16
14
|
//#region src/fs/exists.ts
|
|
17
15
|
async function exists(path) {
|
|
18
16
|
if (typeof Bun !== "undefined") return Bun.file(path).exists();
|
|
19
17
|
return (0, node_fs_promises.access)(path).then(() => true, () => false);
|
|
20
18
|
}
|
|
21
|
-
|
|
22
19
|
//#endregion
|
|
23
20
|
//#region src/fs/read.ts
|
|
24
21
|
async function read(path) {
|
|
@@ -28,7 +25,6 @@ async function read(path) {
|
|
|
28
25
|
function readSync(path) {
|
|
29
26
|
return (0, node_fs.readFileSync)(path, { encoding: "utf8" });
|
|
30
27
|
}
|
|
31
|
-
|
|
32
28
|
//#endregion
|
|
33
29
|
//#region src/fs/utils.ts
|
|
34
30
|
function slash(path, platform = "linux") {
|
|
@@ -43,7 +39,6 @@ function getRelativePath(rootDir, filePath, platform = "linux") {
|
|
|
43
39
|
if (slashedPath.startsWith("../")) return slashedPath;
|
|
44
40
|
return `./${slashedPath}`;
|
|
45
41
|
}
|
|
46
|
-
|
|
47
42
|
//#endregion
|
|
48
43
|
//#region src/fs/write.ts
|
|
49
44
|
async function write(path, data, options = {}) {
|
|
@@ -67,42 +62,42 @@ async function write(path, data, options = {}) {
|
|
|
67
62
|
}
|
|
68
63
|
return data.trim();
|
|
69
64
|
}
|
|
70
|
-
|
|
71
65
|
//#endregion
|
|
72
|
-
Object.defineProperty(exports,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
66
|
+
Object.defineProperty(exports, "clean", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function() {
|
|
69
|
+
return clean;
|
|
70
|
+
}
|
|
77
71
|
});
|
|
78
|
-
Object.defineProperty(exports,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
72
|
+
Object.defineProperty(exports, "exists", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function() {
|
|
75
|
+
return exists;
|
|
76
|
+
}
|
|
83
77
|
});
|
|
84
|
-
Object.defineProperty(exports,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
78
|
+
Object.defineProperty(exports, "getRelativePath", {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function() {
|
|
81
|
+
return getRelativePath;
|
|
82
|
+
}
|
|
89
83
|
});
|
|
90
|
-
Object.defineProperty(exports,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
84
|
+
Object.defineProperty(exports, "read", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function() {
|
|
87
|
+
return read;
|
|
88
|
+
}
|
|
95
89
|
});
|
|
96
|
-
Object.defineProperty(exports,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
90
|
+
Object.defineProperty(exports, "readSync", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function() {
|
|
93
|
+
return readSync;
|
|
94
|
+
}
|
|
101
95
|
});
|
|
102
|
-
Object.defineProperty(exports,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
96
|
+
Object.defineProperty(exports, "write", {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function() {
|
|
99
|
+
return write;
|
|
100
|
+
}
|
|
107
101
|
});
|
|
108
|
-
|
|
102
|
+
|
|
103
|
+
//# sourceMappingURL=fs-D4eqq6bR.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs-D4eqq6bR.cjs","names":[],"sources":["../src/fs/clean.ts","../src/fs/exists.ts","../src/fs/read.ts","../src/fs/utils.ts","../src/fs/write.ts"],"sourcesContent":["import { rm } from 'node:fs/promises'\n\nexport async function clean(path: string): Promise<void> {\n return rm(path, { recursive: true, force: true })\n}\n","import fs from 'node:fs'\nimport { access } from 'node:fs/promises'\n\nexport async function exists(path: string): Promise<boolean> {\n if (typeof Bun !== 'undefined') {\n return Bun.file(path).exists()\n }\n return access(path).then(\n () => true,\n () => false,\n )\n}\n\nexport function existsSync(path: string): boolean {\n return fs.existsSync(path)\n}\n","import { readFileSync } from 'node:fs'\nimport { readFile } from 'node:fs/promises'\n\nexport async function read(path: string): Promise<string> {\n if (typeof Bun !== 'undefined') {\n return Bun.file(path).text()\n }\n return readFile(path, { encoding: 'utf8' })\n}\n\nexport function readSync(path: string): string {\n return readFileSync(path, { encoding: 'utf8' })\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","import { mkdir, readFile, writeFile } from 'node:fs/promises'\nimport { dirname, resolve } from 'node:path'\n\ntype Options = { sanity?: boolean }\n\nexport async function write(path: string, data: string, options: Options = {}): Promise<string | undefined> {\n if (data.trim() === '') {\n return undefined\n }\n\n const resolved = resolve(path)\n\n if (typeof Bun !== 'undefined') {\n const file = Bun.file(resolved)\n const oldContent = (await file.exists()) ? await file.text() : null\n if (oldContent === data.trim()) {\n return undefined\n }\n await Bun.write(resolved, data.trim())\n return data.trim()\n }\n\n try {\n const oldContent = await readFile(resolved, { encoding: 'utf-8' })\n if (oldContent?.toString() === data.trim()) {\n return undefined\n }\n } catch (_err) {\n /* file doesn't exist yet */\n }\n\n await mkdir(dirname(resolved), { recursive: true })\n await writeFile(resolved, data.trim(), { encoding: 'utf-8' })\n\n if (options.sanity) {\n const savedData = await readFile(resolved, { encoding: 'utf-8' })\n\n if (savedData?.toString() !== data.trim()) {\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.trim()\n}\n"],"mappings":";;;;;;AAEA,eAAsB,MAAM,MAA6B;AACvD,SAAA,GAAA,iBAAA,IAAU,MAAM;EAAE,WAAW;EAAM,OAAO;EAAM,CAAC;;;;ACAnD,eAAsB,OAAO,MAAgC;AAC3D,KAAI,OAAO,QAAQ,YACjB,QAAO,IAAI,KAAK,KAAK,CAAC,QAAQ;AAEhC,SAAA,GAAA,iBAAA,QAAc,KAAK,CAAC,WACZ,YACA,MACP;;;;ACPH,eAAsB,KAAK,MAA+B;AACxD,KAAI,OAAO,QAAQ,YACjB,QAAO,IAAI,KAAK,KAAK,CAAC,MAAM;AAE9B,SAAA,GAAA,iBAAA,UAAgB,MAAM,EAAE,UAAU,QAAQ,CAAC;;AAG7C,SAAgB,SAAS,MAAsB;AAC7C,SAAA,GAAA,QAAA,cAAoB,MAAM,EAAE,UAAU,QAAQ,CAAC;;;;ACTjD,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;;;;ACzBd,eAAsB,MAAM,MAAc,MAAc,UAAmB,EAAE,EAA+B;AAC1G,KAAI,KAAK,MAAM,KAAK,GAClB;CAGF,MAAM,YAAA,GAAA,UAAA,SAAmB,KAAK;AAE9B,KAAI,OAAO,QAAQ,aAAa;EAC9B,MAAM,OAAO,IAAI,KAAK,SAAS;AAE/B,OADoB,MAAM,KAAK,QAAQ,GAAI,MAAM,KAAK,MAAM,GAAG,UAC5C,KAAK,MAAM,CAC5B;AAEF,QAAM,IAAI,MAAM,UAAU,KAAK,MAAM,CAAC;AACtC,SAAO,KAAK,MAAM;;AAGpB,KAAI;AAEF,OADmB,OAAA,GAAA,iBAAA,UAAe,UAAU,EAAE,UAAU,SAAS,CAAC,GAClD,UAAU,KAAK,KAAK,MAAM,CACxC;UAEK,MAAM;AAIf,QAAA,GAAA,iBAAA,QAAA,GAAA,UAAA,SAAoB,SAAS,EAAE,EAAE,WAAW,MAAM,CAAC;AACnD,QAAA,GAAA,iBAAA,WAAgB,UAAU,KAAK,MAAM,EAAE,EAAE,UAAU,SAAS,CAAC;AAE7D,KAAI,QAAQ,QAAQ;EAClB,MAAM,YAAY,OAAA,GAAA,iBAAA,UAAe,UAAU,EAAE,UAAU,SAAS,CAAC;AAEjE,MAAI,WAAW,UAAU,KAAK,KAAK,MAAM,CACvC,OAAM,IAAI,MAAM,2BAA2B,KAAK,WAAW,KAAK,OAAO,MAAM,KAAK,YAAY,UAAU,OAAO,MAAM,UAAU,IAAI;AAGrI,SAAO;;AAGT,QAAO,KAAK,MAAM"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./chunk--u3MIqq1.js";
|
|
2
2
|
import { dirname, normalize, relative, resolve } from "node:path";
|
|
3
3
|
import { access, mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
4
|
-
import
|
|
5
|
-
|
|
4
|
+
import { readFileSync } from "node:fs";
|
|
6
5
|
//#region src/fs/clean.ts
|
|
7
6
|
async function clean(path) {
|
|
8
7
|
return rm(path, {
|
|
@@ -10,14 +9,12 @@ async function clean(path) {
|
|
|
10
9
|
force: true
|
|
11
10
|
});
|
|
12
11
|
}
|
|
13
|
-
|
|
14
12
|
//#endregion
|
|
15
13
|
//#region src/fs/exists.ts
|
|
16
14
|
async function exists(path) {
|
|
17
15
|
if (typeof Bun !== "undefined") return Bun.file(path).exists();
|
|
18
16
|
return access(path).then(() => true, () => false);
|
|
19
17
|
}
|
|
20
|
-
|
|
21
18
|
//#endregion
|
|
22
19
|
//#region src/fs/read.ts
|
|
23
20
|
async function read(path) {
|
|
@@ -27,7 +24,6 @@ async function read(path) {
|
|
|
27
24
|
function readSync(path) {
|
|
28
25
|
return readFileSync(path, { encoding: "utf8" });
|
|
29
26
|
}
|
|
30
|
-
|
|
31
27
|
//#endregion
|
|
32
28
|
//#region src/fs/utils.ts
|
|
33
29
|
function slash(path, platform = "linux") {
|
|
@@ -42,7 +38,6 @@ function getRelativePath(rootDir, filePath, platform = "linux") {
|
|
|
42
38
|
if (slashedPath.startsWith("../")) return slashedPath;
|
|
43
39
|
return `./${slashedPath}`;
|
|
44
40
|
}
|
|
45
|
-
|
|
46
41
|
//#endregion
|
|
47
42
|
//#region src/fs/write.ts
|
|
48
43
|
async function write(path, data, options = {}) {
|
|
@@ -66,7 +61,7 @@ async function write(path, data, options = {}) {
|
|
|
66
61
|
}
|
|
67
62
|
return data.trim();
|
|
68
63
|
}
|
|
69
|
-
|
|
70
64
|
//#endregion
|
|
71
65
|
export { exists as a, readSync as i, getRelativePath as n, clean as o, read as r, write as t };
|
|
72
|
-
|
|
66
|
+
|
|
67
|
+
//# sourceMappingURL=fs-TVBCPkE-.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs-TVBCPkE-.js","names":[],"sources":["../src/fs/clean.ts","../src/fs/exists.ts","../src/fs/read.ts","../src/fs/utils.ts","../src/fs/write.ts"],"sourcesContent":["import { rm } from 'node:fs/promises'\n\nexport async function clean(path: string): Promise<void> {\n return rm(path, { recursive: true, force: true })\n}\n","import fs from 'node:fs'\nimport { access } from 'node:fs/promises'\n\nexport async function exists(path: string): Promise<boolean> {\n if (typeof Bun !== 'undefined') {\n return Bun.file(path).exists()\n }\n return access(path).then(\n () => true,\n () => false,\n )\n}\n\nexport function existsSync(path: string): boolean {\n return fs.existsSync(path)\n}\n","import { readFileSync } from 'node:fs'\nimport { readFile } from 'node:fs/promises'\n\nexport async function read(path: string): Promise<string> {\n if (typeof Bun !== 'undefined') {\n return Bun.file(path).text()\n }\n return readFile(path, { encoding: 'utf8' })\n}\n\nexport function readSync(path: string): string {\n return readFileSync(path, { encoding: 'utf8' })\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","import { mkdir, readFile, writeFile } from 'node:fs/promises'\nimport { dirname, resolve } from 'node:path'\n\ntype Options = { sanity?: boolean }\n\nexport async function write(path: string, data: string, options: Options = {}): Promise<string | undefined> {\n if (data.trim() === '') {\n return undefined\n }\n\n const resolved = resolve(path)\n\n if (typeof Bun !== 'undefined') {\n const file = Bun.file(resolved)\n const oldContent = (await file.exists()) ? await file.text() : null\n if (oldContent === data.trim()) {\n return undefined\n }\n await Bun.write(resolved, data.trim())\n return data.trim()\n }\n\n try {\n const oldContent = await readFile(resolved, { encoding: 'utf-8' })\n if (oldContent?.toString() === data.trim()) {\n return undefined\n }\n } catch (_err) {\n /* file doesn't exist yet */\n }\n\n await mkdir(dirname(resolved), { recursive: true })\n await writeFile(resolved, data.trim(), { encoding: 'utf-8' })\n\n if (options.sanity) {\n const savedData = await readFile(resolved, { encoding: 'utf-8' })\n\n if (savedData?.toString() !== data.trim()) {\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.trim()\n}\n"],"mappings":";;;;;AAEA,eAAsB,MAAM,MAA6B;AACvD,QAAO,GAAG,MAAM;EAAE,WAAW;EAAM,OAAO;EAAM,CAAC;;;;ACAnD,eAAsB,OAAO,MAAgC;AAC3D,KAAI,OAAO,QAAQ,YACjB,QAAO,IAAI,KAAK,KAAK,CAAC,QAAQ;AAEhC,QAAO,OAAO,KAAK,CAAC,WACZ,YACA,MACP;;;;ACPH,eAAsB,KAAK,MAA+B;AACxD,KAAI,OAAO,QAAQ,YACjB,QAAO,IAAI,KAAK,KAAK,CAAC,MAAM;AAE9B,QAAO,SAAS,MAAM,EAAE,UAAU,QAAQ,CAAC;;AAG7C,SAAgB,SAAS,MAAsB;AAC7C,QAAO,aAAa,MAAM,EAAE,UAAU,QAAQ,CAAC;;;;ACTjD,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;;;;ACzBd,eAAsB,MAAM,MAAc,MAAc,UAAmB,EAAE,EAA+B;AAC1G,KAAI,KAAK,MAAM,KAAK,GAClB;CAGF,MAAM,WAAW,QAAQ,KAAK;AAE9B,KAAI,OAAO,QAAQ,aAAa;EAC9B,MAAM,OAAO,IAAI,KAAK,SAAS;AAE/B,OADoB,MAAM,KAAK,QAAQ,GAAI,MAAM,KAAK,MAAM,GAAG,UAC5C,KAAK,MAAM,CAC5B;AAEF,QAAM,IAAI,MAAM,UAAU,KAAK,MAAM,CAAC;AACtC,SAAO,KAAK,MAAM;;AAGpB,KAAI;AAEF,OADmB,MAAM,SAAS,UAAU,EAAE,UAAU,SAAS,CAAC,GAClD,UAAU,KAAK,KAAK,MAAM,CACxC;UAEK,MAAM;AAIf,OAAM,MAAM,QAAQ,SAAS,EAAE,EAAE,WAAW,MAAM,CAAC;AACnD,OAAM,UAAU,UAAU,KAAK,MAAM,EAAE,EAAE,UAAU,SAAS,CAAC;AAE7D,KAAI,QAAQ,QAAQ;EAClB,MAAM,YAAY,MAAM,SAAS,UAAU,EAAE,UAAU,SAAS,CAAC;AAEjE,MAAI,WAAW,UAAU,KAAK,KAAK,MAAM,CACvC,OAAM,IAAI,MAAM,2BAA2B,KAAK,WAAW,KAAK,OAAO,MAAM,KAAK,YAAY,UAAU,OAAO,MAAM,UAAU,IAAI;AAGrI,SAAO;;AAGT,QAAO,KAAK,MAAM"}
|
package/dist/fs.cjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value:
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.
|
|
9
|
-
exports.write = require_write.write;
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_fs = require("./fs-D4eqq6bR.cjs");
|
|
3
|
+
exports.clean = require_fs.clean;
|
|
4
|
+
exports.exists = require_fs.exists;
|
|
5
|
+
exports.getRelativePath = require_fs.getRelativePath;
|
|
6
|
+
exports.read = require_fs.read;
|
|
7
|
+
exports.readSync = require_fs.readSync;
|
|
8
|
+
exports.write = require_fs.write;
|
package/dist/fs.d.ts
CHANGED
package/dist/fs.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { a as exists, i as readSync, n as getRelativePath, o as clean, r as read, t as write } from "./
|
|
2
|
-
|
|
3
|
-
export { clean, exists, getRelativePath, read, readSync, write };
|
|
1
|
+
import { a as exists, i as readSync, n as getRelativePath, o as clean, r as read, t as write } from "./fs-TVBCPkE-.js";
|
|
2
|
+
export { clean, exists, getRelativePath, read, readSync, write };
|
package/dist/hooks.cjs
CHANGED
|
@@ -1,29 +1,26 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value:
|
|
2
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("./chunk-ByKO4r7w.cjs");
|
|
3
3
|
let _kubb_react_fabric = require("@kubb/react-fabric");
|
|
4
|
-
|
|
5
4
|
//#region src/hooks/useMode.ts
|
|
6
5
|
function useMode() {
|
|
7
6
|
const { meta } = (0, _kubb_react_fabric.useApp)();
|
|
8
7
|
return meta.mode;
|
|
9
8
|
}
|
|
10
|
-
|
|
11
9
|
//#endregion
|
|
12
10
|
//#region src/hooks/usePlugin.ts
|
|
13
11
|
function usePlugin() {
|
|
14
12
|
const { meta } = (0, _kubb_react_fabric.useApp)();
|
|
15
13
|
return meta.plugin;
|
|
16
14
|
}
|
|
17
|
-
|
|
18
15
|
//#endregion
|
|
19
16
|
//#region src/hooks/usePluginManager.ts
|
|
20
17
|
function usePluginManager() {
|
|
21
18
|
const { meta } = (0, _kubb_react_fabric.useApp)();
|
|
22
19
|
return meta.pluginManager;
|
|
23
20
|
}
|
|
24
|
-
|
|
25
21
|
//#endregion
|
|
26
22
|
exports.useMode = useMode;
|
|
27
23
|
exports.usePlugin = usePlugin;
|
|
28
24
|
exports.usePluginManager = usePluginManager;
|
|
25
|
+
|
|
29
26
|
//# sourceMappingURL=hooks.cjs.map
|
package/dist/hooks.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.cjs","names":[],"sources":["../src/hooks/useMode.ts","../src/hooks/usePlugin.ts","../src/hooks/usePluginManager.ts"],"sourcesContent":["import type { KubbFile } from '@kubb/fabric-core/types'\nimport { useApp } from '@kubb/react-fabric'\n\nexport function useMode(): KubbFile.Mode {\n const { meta } = useApp<{ mode: KubbFile.Mode }>()\n\n return meta.mode\n}\n","import { useApp } from '@kubb/react-fabric'\nimport type { Plugin, PluginFactoryOptions } from '../types.ts'\n\nexport function usePlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions>(): Plugin<TOptions> {\n const { meta } = useApp<{ plugin: Plugin<TOptions> }>()\n\n return meta.plugin\n}\n","import { useApp } from '@kubb/react-fabric'\nimport type { PluginManager } from '../PluginManager.ts'\n\nexport function usePluginManager(): PluginManager {\n const { meta } = useApp<{ pluginManager: PluginManager }>()\n\n return meta.pluginManager\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.cjs","names":[],"sources":["../src/hooks/useMode.ts","../src/hooks/usePlugin.ts","../src/hooks/usePluginManager.ts"],"sourcesContent":["import type { KubbFile } from '@kubb/fabric-core/types'\nimport { useApp } from '@kubb/react-fabric'\n\nexport function useMode(): KubbFile.Mode {\n const { meta } = useApp<{ mode: KubbFile.Mode }>()\n\n return meta.mode\n}\n","import { useApp } from '@kubb/react-fabric'\nimport type { Plugin, PluginFactoryOptions } from '../types.ts'\n\nexport function usePlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions>(): Plugin<TOptions> {\n const { meta } = useApp<{ plugin: Plugin<TOptions> }>()\n\n return meta.plugin\n}\n","import { useApp } from '@kubb/react-fabric'\nimport type { PluginManager } from '../PluginManager.ts'\n\nexport function usePluginManager(): PluginManager {\n const { meta } = useApp<{ pluginManager: PluginManager }>()\n\n return meta.pluginManager\n}\n"],"mappings":";;;;AAGA,SAAgB,UAAyB;CACvC,MAAM,EAAE,UAAA,GAAA,mBAAA,SAA0C;AAElD,QAAO,KAAK;;;;ACHd,SAAgB,YAA4F;CAC1G,MAAM,EAAE,UAAA,GAAA,mBAAA,SAA+C;AAEvD,QAAO,KAAK;;;;ACHd,SAAgB,mBAAkC;CAChD,MAAM,EAAE,UAAA,GAAA,mBAAA,SAAmD;AAE3D,QAAO,KAAK"}
|
package/dist/hooks.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as __name } from "./chunk
|
|
2
|
-
import { O as PluginManager, f as Plugin, m as PluginFactoryOptions } from "./types-
|
|
1
|
+
import { t as __name } from "./chunk--u3MIqq1.js";
|
|
2
|
+
import { O as PluginManager, f as Plugin, m as PluginFactoryOptions } from "./types-f_no0d7G.js";
|
|
3
3
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
4
4
|
|
|
5
5
|
//#region src/hooks/useMode.d.ts
|
package/dist/hooks.js
CHANGED
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./chunk--u3MIqq1.js";
|
|
2
2
|
import { useApp } from "@kubb/react-fabric";
|
|
3
|
-
|
|
4
3
|
//#region src/hooks/useMode.ts
|
|
5
4
|
function useMode() {
|
|
6
5
|
const { meta } = useApp();
|
|
7
6
|
return meta.mode;
|
|
8
7
|
}
|
|
9
|
-
|
|
10
8
|
//#endregion
|
|
11
9
|
//#region src/hooks/usePlugin.ts
|
|
12
10
|
function usePlugin() {
|
|
13
11
|
const { meta } = useApp();
|
|
14
12
|
return meta.plugin;
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
//#endregion
|
|
18
15
|
//#region src/hooks/usePluginManager.ts
|
|
19
16
|
function usePluginManager() {
|
|
20
17
|
const { meta } = useApp();
|
|
21
18
|
return meta.pluginManager;
|
|
22
19
|
}
|
|
23
|
-
|
|
24
20
|
//#endregion
|
|
25
21
|
export { useMode, usePlugin, usePluginManager };
|
|
22
|
+
|
|
26
23
|
//# sourceMappingURL=hooks.js.map
|
package/dist/hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","names":[],"sources":["../src/hooks/useMode.ts","../src/hooks/usePlugin.ts","../src/hooks/usePluginManager.ts"],"sourcesContent":["import type { KubbFile } from '@kubb/fabric-core/types'\nimport { useApp } from '@kubb/react-fabric'\n\nexport function useMode(): KubbFile.Mode {\n const { meta } = useApp<{ mode: KubbFile.Mode }>()\n\n return meta.mode\n}\n","import { useApp } from '@kubb/react-fabric'\nimport type { Plugin, PluginFactoryOptions } from '../types.ts'\n\nexport function usePlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions>(): Plugin<TOptions> {\n const { meta } = useApp<{ plugin: Plugin<TOptions> }>()\n\n return meta.plugin\n}\n","import { useApp } from '@kubb/react-fabric'\nimport type { PluginManager } from '../PluginManager.ts'\n\nexport function usePluginManager(): PluginManager {\n const { meta } = useApp<{ pluginManager: PluginManager }>()\n\n return meta.pluginManager\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.js","names":[],"sources":["../src/hooks/useMode.ts","../src/hooks/usePlugin.ts","../src/hooks/usePluginManager.ts"],"sourcesContent":["import type { KubbFile } from '@kubb/fabric-core/types'\nimport { useApp } from '@kubb/react-fabric'\n\nexport function useMode(): KubbFile.Mode {\n const { meta } = useApp<{ mode: KubbFile.Mode }>()\n\n return meta.mode\n}\n","import { useApp } from '@kubb/react-fabric'\nimport type { Plugin, PluginFactoryOptions } from '../types.ts'\n\nexport function usePlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions>(): Plugin<TOptions> {\n const { meta } = useApp<{ plugin: Plugin<TOptions> }>()\n\n return meta.plugin\n}\n","import { useApp } from '@kubb/react-fabric'\nimport type { PluginManager } from '../PluginManager.ts'\n\nexport function usePluginManager(): PluginManager {\n const { meta } = useApp<{ pluginManager: PluginManager }>()\n\n return meta.pluginManager\n}\n"],"mappings":";;;AAGA,SAAgB,UAAyB;CACvC,MAAM,EAAE,SAAS,QAAiC;AAElD,QAAO,KAAK;;;;ACHd,SAAgB,YAA4F;CAC1G,MAAM,EAAE,SAAS,QAAsC;AAEvD,QAAO,KAAK;;;;ACHd,SAAgB,mBAAkC;CAChD,MAAM,EAAE,SAAS,QAA0C;AAE3D,QAAO,KAAK"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
const require_chunk = require("./chunk-ByKO4r7w.cjs");
|
|
6
|
+
const require_packageManager = require("./packageManager-jzjuEj2U.cjs");
|
|
7
|
+
const require_fs = require("./fs-D4eqq6bR.cjs");
|
|
5
8
|
let node_path = require("node:path");
|
|
6
9
|
let _kubb_react_fabric = require("@kubb/react-fabric");
|
|
7
10
|
let _kubb_react_fabric_parsers = require("@kubb/react-fabric/parsers");
|
|
@@ -15,7 +18,6 @@ let node_url = require("node:url");
|
|
|
15
18
|
let empathic_package = require("empathic/package");
|
|
16
19
|
empathic_package = require_chunk.__toESM(empathic_package);
|
|
17
20
|
let semver = require("semver");
|
|
18
|
-
|
|
19
21
|
//#region src/BaseGenerator.ts
|
|
20
22
|
/**
|
|
21
23
|
* Abstract class that contains the building blocks for plugins to create their own Generator
|
|
@@ -42,7 +44,6 @@ var BaseGenerator = class {
|
|
|
42
44
|
};
|
|
43
45
|
}
|
|
44
46
|
};
|
|
45
|
-
|
|
46
47
|
//#endregion
|
|
47
48
|
//#region src/config.ts
|
|
48
49
|
/**
|
|
@@ -68,11 +69,9 @@ function defineConfig(config) {
|
|
|
68
69
|
function isInputPath(config) {
|
|
69
70
|
return typeof config?.input === "object" && config.input !== null && "path" in config.input;
|
|
70
71
|
}
|
|
71
|
-
|
|
72
72
|
//#endregion
|
|
73
73
|
//#region package.json
|
|
74
|
-
var version = "4.32.
|
|
75
|
-
|
|
74
|
+
var version = "4.32.1";
|
|
76
75
|
//#endregion
|
|
77
76
|
//#region src/utils/diagnostics.ts
|
|
78
77
|
/**
|
|
@@ -87,7 +86,6 @@ function getDiagnosticInfo() {
|
|
|
87
86
|
cwd: process.cwd()
|
|
88
87
|
};
|
|
89
88
|
}
|
|
90
|
-
|
|
91
89
|
//#endregion
|
|
92
90
|
//#region src/build.ts
|
|
93
91
|
async function setup(options) {
|
|
@@ -113,7 +111,7 @@ async function setup(options) {
|
|
|
113
111
|
});
|
|
114
112
|
try {
|
|
115
113
|
if (isInputPath(userConfig) && !new require_packageManager.URLPath(userConfig.input.path).isURL) {
|
|
116
|
-
await
|
|
114
|
+
await require_fs.exists(userConfig.input.path);
|
|
117
115
|
await events.emit("debug", {
|
|
118
116
|
date: /* @__PURE__ */ new Date(),
|
|
119
117
|
logs: [`✓ Input file validated: ${userConfig.input.path}`]
|
|
@@ -142,7 +140,7 @@ async function setup(options) {
|
|
|
142
140
|
date: /* @__PURE__ */ new Date(),
|
|
143
141
|
logs: ["Cleaning output directories", ` • Output: ${definedConfig.output.path}`]
|
|
144
142
|
});
|
|
145
|
-
await
|
|
143
|
+
await require_fs.clean(definedConfig.output.path);
|
|
146
144
|
}
|
|
147
145
|
const fabric = (0, _kubb_react_fabric.createFabric)();
|
|
148
146
|
fabric.use(_kubb_react_fabric_plugins.fsPlugin);
|
|
@@ -162,7 +160,7 @@ async function setup(options) {
|
|
|
162
160
|
source
|
|
163
161
|
});
|
|
164
162
|
if (source) {
|
|
165
|
-
if (definedConfig.output.write) await
|
|
163
|
+
if (definedConfig.output.write) await require_fs.write(file.path, source, { sanity: false });
|
|
166
164
|
sources.set(file.path, source);
|
|
167
165
|
}
|
|
168
166
|
});
|
|
@@ -293,7 +291,7 @@ async function safeBuild(options, overrides) {
|
|
|
293
291
|
if (!pluginOptions || pluginOptions?.output?.barrelType === false) return;
|
|
294
292
|
return {
|
|
295
293
|
name: config.output.barrelType === "all" ? void 0 : [source.name],
|
|
296
|
-
path:
|
|
294
|
+
path: require_fs.getRelativePath(rootPath, file.path),
|
|
297
295
|
isTypeOnly: config.output.barrelType === "all" ? containsOnlyTypes : source.isTypeOnly
|
|
298
296
|
};
|
|
299
297
|
}).filter(Boolean);
|
|
@@ -330,13 +328,11 @@ async function safeBuild(options, overrides) {
|
|
|
330
328
|
};
|
|
331
329
|
}
|
|
332
330
|
}
|
|
333
|
-
|
|
334
331
|
//#endregion
|
|
335
332
|
//#region src/defineLogger.ts
|
|
336
333
|
function defineLogger(logger) {
|
|
337
334
|
return { ...logger };
|
|
338
335
|
}
|
|
339
|
-
|
|
340
336
|
//#endregion
|
|
341
337
|
//#region src/definePlugin.ts
|
|
342
338
|
/**
|
|
@@ -345,7 +341,6 @@ function defineLogger(logger) {
|
|
|
345
341
|
function definePlugin(build) {
|
|
346
342
|
return (options) => build(options ?? {});
|
|
347
343
|
}
|
|
348
|
-
|
|
349
344
|
//#endregion
|
|
350
345
|
//#region src/PackageManager.ts
|
|
351
346
|
var PackageManager = class PackageManager {
|
|
@@ -386,13 +381,13 @@ var PackageManager = class PackageManager {
|
|
|
386
381
|
async getPackageJSON() {
|
|
387
382
|
const pkgPath = empathic_package.up({ cwd: this.#cwd });
|
|
388
383
|
if (!pkgPath) return;
|
|
389
|
-
const json = await
|
|
384
|
+
const json = await require_fs.read(pkgPath);
|
|
390
385
|
return JSON.parse(json);
|
|
391
386
|
}
|
|
392
387
|
getPackageJSONSync() {
|
|
393
388
|
const pkgPath = empathic_package.up({ cwd: this.#cwd });
|
|
394
389
|
if (!pkgPath) return;
|
|
395
|
-
const json =
|
|
390
|
+
const json = require_fs.readSync(pkgPath);
|
|
396
391
|
return JSON.parse(json);
|
|
397
392
|
}
|
|
398
393
|
static setVersion(dependency, version) {
|
|
@@ -436,7 +431,6 @@ var PackageManager = class PackageManager {
|
|
|
436
431
|
return (0, semver.satisfies)(semVer, version);
|
|
437
432
|
}
|
|
438
433
|
};
|
|
439
|
-
|
|
440
434
|
//#endregion
|
|
441
435
|
//#region src/types.ts
|
|
442
436
|
const LogLevel = {
|
|
@@ -447,7 +441,6 @@ const LogLevel = {
|
|
|
447
441
|
verbose: 4,
|
|
448
442
|
debug: 5
|
|
449
443
|
};
|
|
450
|
-
|
|
451
444
|
//#endregion
|
|
452
445
|
exports.BaseGenerator = BaseGenerator;
|
|
453
446
|
exports.LogLevel = LogLevel;
|
|
@@ -465,4 +458,5 @@ exports.getMode = require_packageManager.getMode;
|
|
|
465
458
|
exports.isInputPath = isInputPath;
|
|
466
459
|
exports.safeBuild = safeBuild;
|
|
467
460
|
exports.setup = setup;
|
|
461
|
+
|
|
468
462
|
//# sourceMappingURL=index.cjs.map
|