@kubb/cli 5.15.0 → 5.15.2
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/{Telemetry-B3edcFoB.js → Telemetry-BLRICCFj.js} +2 -2
- package/dist/{Telemetry-B3edcFoB.js.map → Telemetry-BLRICCFj.js.map} +1 -1
- package/dist/{Telemetry-COWGqYmh.cjs → Telemetry-CSjCG8WO.cjs} +2 -2
- package/dist/{Telemetry-COWGqYmh.cjs.map → Telemetry-CSjCG8WO.cjs.map} +1 -1
- package/dist/{background-_dKcGjM7.js → background-BeEZZNGc.js} +2 -2
- package/dist/{background-_dKcGjM7.js.map → background-BeEZZNGc.js.map} +1 -1
- package/dist/{background-B24lIehn.cjs → background-BiyfuZFp.cjs} +2 -2
- package/dist/{background-B24lIehn.cjs.map → background-BiyfuZFp.cjs.map} +1 -1
- package/dist/{background-D-7OGjvg.js → background-QEuTfHev.js} +1 -1
- package/dist/{configFile-CoEpHdXG.cjs → configFile-CVfWdtKh.cjs} +4 -40
- package/dist/configFile-CVfWdtKh.cjs.map +1 -0
- package/dist/{configFile-C0DIXNMD.js → configFile-IHj8fRIw.js} +3 -39
- package/dist/configFile-IHj8fRIw.js.map +1 -0
- package/dist/{spinner-BZaln7O8.js → fs-Cf1FSRh9.js} +20 -41
- package/dist/fs-Cf1FSRh9.js.map +1 -0
- package/dist/index.cjs +14 -14
- package/dist/index.js +14 -14
- package/dist/{installWithSpinner-DpnpxHq5.js → installWithSpinner-BAlTSQlE.js} +3 -3
- package/dist/{installWithSpinner-DpnpxHq5.js.map → installWithSpinner-BAlTSQlE.js.map} +1 -1
- package/dist/{installWithSpinner-ONGfIVUJ.cjs → installWithSpinner-X9J7yxiR.cjs} +3 -3
- package/dist/{installWithSpinner-ONGfIVUJ.cjs.map → installWithSpinner-X9J7yxiR.cjs.map} +1 -1
- package/dist/intro-DRl-pwVs.js +72 -0
- package/dist/intro-DRl-pwVs.js.map +1 -0
- package/dist/intro-DuyzJ3Rb.cjs +102 -0
- package/dist/intro-DuyzJ3Rb.cjs.map +1 -0
- package/dist/{intro-9PB8sE8z.js → log-B-1vLxF1.js} +2 -66
- package/dist/log-B-1vLxF1.js.map +1 -0
- package/dist/{intro-YPaf1Imr.cjs → log-wv1OxLiq.cjs} +1 -95
- package/dist/log-wv1OxLiq.cjs.map +1 -0
- package/dist/{mascot-JSA0j3Q_.cjs → mascot-CC-D4ON2.cjs} +2 -2
- package/dist/{mascot-JSA0j3Q_.cjs.map → mascot-CC-D4ON2.cjs.map} +1 -1
- package/dist/{mascot--q1xjKw1.js → mascot-CmUUHLlx.js} +2 -2
- package/dist/{mascot--q1xjKw1.js.map → mascot-CmUUHLlx.js.map} +1 -1
- package/dist/{mcp-CYPOFKnP.cjs → mcp-Don4UqAB.cjs} +2 -2
- package/dist/{mcp-CYPOFKnP.cjs.map → mcp-Don4UqAB.cjs.map} +1 -1
- package/dist/{mcp-CxeZR5vb.js → mcp-Spp8N-xs.js} +2 -2
- package/dist/{mcp-CxeZR5vb.js.map → mcp-Spp8N-xs.js.map} +1 -1
- package/dist/package-Bf2T71nz.js +5 -0
- package/dist/package-Bf2T71nz.js.map +1 -0
- package/dist/{package-aX0q9SZr.cjs → package-CI_luotn.cjs} +2 -2
- package/dist/package-CI_luotn.cjs.map +1 -0
- package/dist/{registry-B3eYk4LN.js → registry-Cy48PGdh.js} +3 -2
- package/dist/registry-Cy48PGdh.js.map +1 -0
- package/dist/{registry-YE1pFWL-.cjs → registry-Q77p5TZp.cjs} +3 -2
- package/dist/registry-Q77p5TZp.cjs.map +1 -0
- package/dist/{reporters-BM430HdQ.js → reporters-D6w4huLl.js} +222 -11
- package/dist/reporters-D6w4huLl.js.map +1 -0
- package/dist/{reporters-2cgjvXwR.cjs → reporters-Dby6Kgdj.cjs} +255 -10
- package/dist/reporters-Dby6Kgdj.cjs.map +1 -0
- package/dist/reporters-GdWr95qd.js +1 -0
- package/dist/{run-C0KI-NE3.js → run-BEwA7UDN.js} +4 -4
- package/dist/{run-C0KI-NE3.js.map → run-BEwA7UDN.js.map} +1 -1
- package/dist/{run-RN_31Q4u.js → run-BGUSyeuP.js} +44 -38
- package/dist/run-BGUSyeuP.js.map +1 -0
- package/dist/{run-DFXhBS64.js → run-BY4KZsE3.js} +2 -2
- package/dist/{run-DFXhBS64.js.map → run-BY4KZsE3.js.map} +1 -1
- package/dist/{run-CbX6tpqB.js → run-B_XCebc9.js} +10 -10
- package/dist/{run-CbX6tpqB.js.map → run-B_XCebc9.js.map} +1 -1
- package/dist/{run-B4zvF9WY.cjs → run-CFw6-hm1.cjs} +48 -42
- package/dist/run-CFw6-hm1.cjs.map +1 -0
- package/dist/{run-DCqmf5W1.cjs → run-CGdXlXy-.cjs} +4 -4
- package/dist/{run-DCqmf5W1.cjs.map → run-CGdXlXy-.cjs.map} +1 -1
- package/dist/{run-CCLPt4hr.js → run-CYynQJRk.js} +1 -1
- package/dist/{run-CrM4jsix.cjs → run-CfumUZCl.cjs} +7 -6
- package/dist/{run-CrM4jsix.cjs.map → run-CfumUZCl.cjs.map} +1 -1
- package/dist/{run-D-nn9-Wq.js → run-Cgy4_JPy.js} +14 -18
- package/dist/run-Cgy4_JPy.js.map +1 -0
- package/dist/{run-1H9TGT8v.js → run-Ch7Uuu-u.js} +4 -3
- package/dist/{run-1H9TGT8v.js.map → run-Ch7Uuu-u.js.map} +1 -1
- package/dist/{run-BYP_t9dR.cjs → run-DCggecSY.cjs} +19 -24
- package/dist/run-DCggecSY.cjs.map +1 -0
- package/dist/{run-Bb19PlwV.cjs → run-DFIaAIjC.cjs} +13 -12
- package/dist/{run-Bb19PlwV.cjs.map → run-DFIaAIjC.cjs.map} +1 -1
- package/dist/{run-BrM7-NSV.js → run-DHfFHNfG.js} +13 -17
- package/dist/run-DHfFHNfG.js.map +1 -0
- package/dist/{run-CvFakE3B.cjs → run-DT4hTOR2.cjs} +16 -21
- package/dist/run-DT4hTOR2.cjs.map +1 -0
- package/dist/{run-DgGZOC_x.cjs → run-DfCka9wW.cjs} +47 -61
- package/dist/run-DfCka9wW.cjs.map +1 -0
- package/dist/{run-KqdudiWQ.js → run-DiCSiwh8.js} +10 -9
- package/dist/{run-KqdudiWQ.js.map → run-DiCSiwh8.js.map} +1 -1
- package/dist/{run-BoO7H8RA.cjs → run-FGwhN0Pi.cjs} +20 -20
- package/dist/{run-BoO7H8RA.cjs.map → run-FGwhN0Pi.cjs.map} +1 -1
- package/dist/{run-D5Z6nfzK.cjs → run-KePEAia2.cjs} +2 -2
- package/dist/{run-D5Z6nfzK.cjs.map → run-KePEAia2.cjs.map} +1 -1
- package/dist/{run-CCsdLz3X.js → run-OHr93Akz.js} +40 -53
- package/dist/run-OHr93Akz.js.map +1 -0
- package/dist/shared-DcDHRtZx.js +58 -0
- package/dist/shared-DcDHRtZx.js.map +1 -0
- package/dist/shared-KKRMm1xX.cjs +87 -0
- package/dist/shared-KKRMm1xX.cjs.map +1 -0
- package/dist/{snapshot-D7Ytw8S0.cjs → snapshot-ByWxzJIh.cjs} +7 -7
- package/dist/{snapshot-D7Ytw8S0.cjs.map → snapshot-ByWxzJIh.cjs.map} +1 -1
- package/dist/{snapshot-n7dJGCWv.js → snapshot-UAiT_UQa.js} +6 -6
- package/dist/{snapshot-n7dJGCWv.js.map → snapshot-UAiT_UQa.js.map} +1 -1
- package/dist/spinner-DxsAllRI.js +48 -0
- package/dist/spinner-DxsAllRI.js.map +1 -0
- package/dist/{spinner-CfB0sIPy.cjs → spinner-RfMb7fd6.cjs} +50 -21
- package/dist/spinner-RfMb7fd6.cjs.map +1 -0
- package/dist/{status-DxSkp1cH.js → status-CEZ3m06O.js} +3 -3
- package/dist/{status-DxSkp1cH.js.map → status-CEZ3m06O.js.map} +1 -1
- package/dist/{status-Bc0_4T41.cjs → status-iE6UADco.cjs} +3 -3
- package/dist/{status-Bc0_4T41.cjs.map → status-iE6UADco.cjs.map} +1 -1
- package/dist/{studio-BpYwgFb0.cjs → studio-BL3zpp5R.cjs} +12 -12
- package/dist/{studio-BpYwgFb0.cjs.map → studio-BL3zpp5R.cjs.map} +1 -1
- package/dist/{studio-mw6HaPkr.js → studio-D9WQb5vH.js} +12 -12
- package/dist/{studio-mw6HaPkr.js.map → studio-D9WQb5vH.js.map} +1 -1
- package/dist/studioWorker.js +2 -2
- package/dist/{summary-Clvl5Hxs.cjs → summary-B2Apv5KO.cjs} +17 -2
- package/dist/summary-B2Apv5KO.cjs.map +1 -0
- package/dist/{summary-CbmQKA8l.js → summary-BQWHL_Ca.js} +12 -3
- package/dist/summary-BQWHL_Ca.js.map +1 -0
- package/dist/{text-Ep3AulAS.cjs → text-DMiX2dcG.cjs} +10 -1
- package/dist/text-DMiX2dcG.cjs.map +1 -0
- package/dist/{text-BmiI4s6N.js → text-EoYn04SX.js} +5 -2
- package/dist/text-EoYn04SX.js.map +1 -0
- package/dist/{utils-CbJ6hS_t.js → utils-CeMUE4P0.js} +90 -70
- package/dist/utils-CeMUE4P0.js.map +1 -0
- package/dist/{utils-CO89mxRU.cjs → utils-uSJAZuvP.cjs} +101 -69
- package/dist/utils-uSJAZuvP.cjs.map +1 -0
- package/dist/{validate-CMSeDpGT.cjs → validate-B9Ctya2v.cjs} +3 -3
- package/dist/{validate-CMSeDpGT.cjs.map → validate-B9Ctya2v.cjs.map} +1 -1
- package/dist/{validate-8ZcWXfMt.js → validate-BGvFsCDL.js} +3 -3
- package/dist/{validate-8ZcWXfMt.js.map → validate-BGvFsCDL.js.map} +1 -1
- package/package.json +8 -7
- package/dist/configFile-C0DIXNMD.js.map +0 -1
- package/dist/configFile-CoEpHdXG.cjs.map +0 -1
- package/dist/intro-9PB8sE8z.js.map +0 -1
- package/dist/intro-YPaf1Imr.cjs.map +0 -1
- package/dist/package-D3Yss9Bb.js +0 -5
- package/dist/package-D3Yss9Bb.js.map +0 -1
- package/dist/package-aX0q9SZr.cjs.map +0 -1
- package/dist/registry-B3eYk4LN.js.map +0 -1
- package/dist/registry-YE1pFWL-.cjs.map +0 -1
- package/dist/reporters-2cgjvXwR.cjs.map +0 -1
- package/dist/reporters-BM430HdQ.js.map +0 -1
- package/dist/run-B4zvF9WY.cjs.map +0 -1
- package/dist/run-BYP_t9dR.cjs.map +0 -1
- package/dist/run-BrM7-NSV.js.map +0 -1
- package/dist/run-CCsdLz3X.js.map +0 -1
- package/dist/run-CvFakE3B.cjs.map +0 -1
- package/dist/run-D-nn9-Wq.js.map +0 -1
- package/dist/run-DgGZOC_x.cjs.map +0 -1
- package/dist/run-RN_31Q4u.js.map +0 -1
- package/dist/shared-C0EtrdUm.cjs +0 -123
- package/dist/shared-C0EtrdUm.cjs.map +0 -1
- package/dist/shared-Ct9stKpp.js +0 -94
- package/dist/shared-Ct9stKpp.js.map +0 -1
- package/dist/spinner-BZaln7O8.js.map +0 -1
- package/dist/spinner-CfB0sIPy.cjs.map +0 -1
- package/dist/summary-CbmQKA8l.js.map +0 -1
- package/dist/summary-Clvl5Hxs.cjs.map +0 -1
- package/dist/text-BmiI4s6N.js.map +0 -1
- package/dist/text-Ep3AulAS.cjs.map +0 -1
- package/dist/utils-BdibacYq.js +0 -244
- package/dist/utils-BdibacYq.js.map +0 -1
- package/dist/utils-CO89mxRU.cjs.map +0 -1
- package/dist/utils-CbJ6hS_t.js.map +0 -1
- package/dist/utils-CcARPB45.cjs +0 -286
- package/dist/utils-CcARPB45.cjs.map +0 -1
package/dist/shared-C0EtrdUm.cjs
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
require("@gunshi/plugin-dryrun");
|
|
2
|
-
// src/commands/shared.ts
|
|
3
|
-
const configArg = { config: {
|
|
4
|
-
type: "string",
|
|
5
|
-
description: "Path to the Kubb config",
|
|
6
|
-
short: "c"
|
|
7
|
-
} };
|
|
8
|
-
const yesArg = { yes: {
|
|
9
|
-
type: "boolean",
|
|
10
|
-
description: "Skip the confirmation",
|
|
11
|
-
short: "y",
|
|
12
|
-
default: false
|
|
13
|
-
} };
|
|
14
|
-
const logLevelArg = { logLevel: {
|
|
15
|
-
type: "enum",
|
|
16
|
-
choices: [
|
|
17
|
-
"silent",
|
|
18
|
-
"info",
|
|
19
|
-
"verbose"
|
|
20
|
-
],
|
|
21
|
-
description: "Info, silent or verbose",
|
|
22
|
-
short: "l",
|
|
23
|
-
default: "info",
|
|
24
|
-
toKebab: true
|
|
25
|
-
} };
|
|
26
|
-
const studioConnectionArgs = {
|
|
27
|
-
url: {
|
|
28
|
-
type: "string",
|
|
29
|
-
description: "Base URL of the Kubb Studio instance"
|
|
30
|
-
},
|
|
31
|
-
token: {
|
|
32
|
-
type: "string",
|
|
33
|
-
description: "Organization CI API key for `snapshot`. Defaults to KUBB_TOKEN"
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
const studioPermissionArgs = {
|
|
37
|
-
allowRead: {
|
|
38
|
-
type: "boolean",
|
|
39
|
-
description: "Read the source of files a generation produced. Asked for once per project when omitted",
|
|
40
|
-
default: false,
|
|
41
|
-
toKebab: true
|
|
42
|
-
},
|
|
43
|
-
allowReadAst: {
|
|
44
|
-
type: "boolean",
|
|
45
|
-
description: "Read the parsed spec (the Kubb AST). Asked for once per project when omitted",
|
|
46
|
-
default: false,
|
|
47
|
-
toKebab: true
|
|
48
|
-
},
|
|
49
|
-
allowWrite: {
|
|
50
|
-
type: "boolean",
|
|
51
|
-
description: "Write generated files to disk. Asked for once per project when omitted",
|
|
52
|
-
default: false,
|
|
53
|
-
toKebab: true
|
|
54
|
-
},
|
|
55
|
-
allowConfigEdit: {
|
|
56
|
-
type: "boolean",
|
|
57
|
-
description: "Let Studio change plugin options in kubb.config.ts. Asked for once per project when omitted",
|
|
58
|
-
default: false,
|
|
59
|
-
toKebab: true
|
|
60
|
-
},
|
|
61
|
-
allowInstall: {
|
|
62
|
-
type: "boolean",
|
|
63
|
-
description: "Let Studio install extensions from the registry with kubb add; needs --allow-config-edit too. Asked for once per project when omitted",
|
|
64
|
-
default: false,
|
|
65
|
-
toKebab: true
|
|
66
|
-
},
|
|
67
|
-
allowUpdate: {
|
|
68
|
-
type: "boolean",
|
|
69
|
-
description: "Let Studio update installed extensions with kubb update. Asked for once per project when omitted",
|
|
70
|
-
default: false,
|
|
71
|
-
toKebab: true
|
|
72
|
-
},
|
|
73
|
-
allowRemove: {
|
|
74
|
-
type: "boolean",
|
|
75
|
-
description: "Let Studio remove extensions with kubb remove, which edits kubb.config.ts and uninstalls packages; needs --allow-config-edit too. Asked for once per project when omitted",
|
|
76
|
-
default: false,
|
|
77
|
-
toKebab: true
|
|
78
|
-
},
|
|
79
|
-
allowSaveInput: {
|
|
80
|
-
type: "boolean",
|
|
81
|
-
description: "Let Studio save the spec it sends as the input in kubb.config.ts; needs --allow-config-edit too. Asked for once per project when omitted",
|
|
82
|
-
default: false,
|
|
83
|
-
toKebab: true
|
|
84
|
-
},
|
|
85
|
-
allowExec: {
|
|
86
|
-
type: "boolean",
|
|
87
|
-
description: "Run the formatter, the linter, and output.postGenerate after a generation",
|
|
88
|
-
default: false,
|
|
89
|
-
toKebab: true
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
Object.defineProperty(exports, "configArg", {
|
|
93
|
-
enumerable: true,
|
|
94
|
-
get: function() {
|
|
95
|
-
return configArg;
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
Object.defineProperty(exports, "logLevelArg", {
|
|
99
|
-
enumerable: true,
|
|
100
|
-
get: function() {
|
|
101
|
-
return logLevelArg;
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
Object.defineProperty(exports, "studioConnectionArgs", {
|
|
105
|
-
enumerable: true,
|
|
106
|
-
get: function() {
|
|
107
|
-
return studioConnectionArgs;
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
Object.defineProperty(exports, "studioPermissionArgs", {
|
|
111
|
-
enumerable: true,
|
|
112
|
-
get: function() {
|
|
113
|
-
return studioPermissionArgs;
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
Object.defineProperty(exports, "yesArg", {
|
|
117
|
-
enumerable: true,
|
|
118
|
-
get: function() {
|
|
119
|
-
return yesArg;
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
//# sourceMappingURL=shared-C0EtrdUm.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shared-C0EtrdUm.cjs","names":[],"sources":["../src/commands/shared.ts"],"sourcesContent":["import { pluginId as dryRunId } from '@gunshi/plugin-dryrun'\nimport type { DryRunExtension } from '@gunshi/plugin-dryrun'\n\nexport { dryRunId }\n\n/** Extension shape gunshi's command context carries with `@gunshi/plugin-dryrun`; the `extensions` type parameter of `defineWithTypes`. */\nexport type DryRunExtensions = {\n [dryRunId]: DryRunExtension\n}\n\nexport const configArg = {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n} as const\n\nexport const yesArg = {\n yes: {\n type: 'boolean',\n description: 'Skip the confirmation',\n short: 'y',\n default: false,\n },\n} as const\n\nexport const logLevelArg = {\n logLevel: {\n type: 'enum',\n choices: ['silent', 'info', 'verbose'] as const,\n description: 'Info, silent or verbose',\n short: 'l',\n default: 'info',\n toKebab: true,\n },\n} as const\n\nexport const studioConnectionArgs = {\n url: {\n type: 'string',\n description: 'Base URL of the Kubb Studio instance',\n },\n token: {\n type: 'string',\n description: 'Organization CI API key for `snapshot`. Defaults to KUBB_TOKEN',\n },\n} as const\n\nexport const studioPermissionArgs = {\n allowRead: {\n type: 'boolean',\n description: 'Read the source of files a generation produced. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowReadAst: {\n type: 'boolean',\n description: 'Read the parsed spec (the Kubb AST). Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowWrite: {\n type: 'boolean',\n description: 'Write generated files to disk. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowConfigEdit: {\n type: 'boolean',\n description: 'Let Studio change plugin options in kubb.config.ts. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowInstall: {\n type: 'boolean',\n description: 'Let Studio install extensions from the registry with kubb add; needs --allow-config-edit too. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowUpdate: {\n type: 'boolean',\n description: 'Let Studio update installed extensions with kubb update. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowRemove: {\n type: 'boolean',\n description:\n 'Let Studio remove extensions with kubb remove, which edits kubb.config.ts and uninstalls packages; needs --allow-config-edit too. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowSaveInput: {\n type: 'boolean',\n description: 'Let Studio save the spec it sends as the input in kubb.config.ts; needs --allow-config-edit too. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowExec: {\n type: 'boolean',\n description: 'Run the formatter, the linter, and output.postGenerate after a generation',\n default: false,\n toKebab: true,\n },\n} as const\n"],"mappings":";;AAUA,MAAa,YAAY,EACvB,QAAQ;CACN,MAAM;CACN,aAAa;CACb,OAAO;AACT,EACF;AAEA,MAAa,SAAS,EACpB,KAAK;CACH,MAAM;CACN,aAAa;CACb,OAAO;CACP,SAAS;AACX,EACF;AAEA,MAAa,cAAc,EACzB,UAAU;CACR,MAAM;CACN,SAAS;EAAC;EAAU;EAAQ;CAAS;CACrC,aAAa;CACb,OAAO;CACP,SAAS;CACT,SAAS;AACX,EACF;AAEA,MAAa,uBAAuB;CAClC,KAAK;EACH,MAAM;EACN,aAAa;CACf;CACA,OAAO;EACL,MAAM;EACN,aAAa;CACf;AACF;AAEA,MAAa,uBAAuB;CAClC,WAAW;EACT,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,cAAc;EACZ,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,YAAY;EACV,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,iBAAiB;EACf,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,cAAc;EACZ,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,aAAa;EACX,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,aAAa;EACX,MAAM;EACN,aACE;EACF,SAAS;EACT,SAAS;CACX;CACA,gBAAgB;EACd,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,WAAW;EACT,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;AACF"}
|
package/dist/shared-Ct9stKpp.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { pluginId as dryRunId } from "@gunshi/plugin-dryrun";
|
|
2
|
-
// src/commands/shared.ts
|
|
3
|
-
const configArg = { config: {
|
|
4
|
-
type: "string",
|
|
5
|
-
description: "Path to the Kubb config",
|
|
6
|
-
short: "c"
|
|
7
|
-
} };
|
|
8
|
-
const yesArg = { yes: {
|
|
9
|
-
type: "boolean",
|
|
10
|
-
description: "Skip the confirmation",
|
|
11
|
-
short: "y",
|
|
12
|
-
default: false
|
|
13
|
-
} };
|
|
14
|
-
const logLevelArg = { logLevel: {
|
|
15
|
-
type: "enum",
|
|
16
|
-
choices: [
|
|
17
|
-
"silent",
|
|
18
|
-
"info",
|
|
19
|
-
"verbose"
|
|
20
|
-
],
|
|
21
|
-
description: "Info, silent or verbose",
|
|
22
|
-
short: "l",
|
|
23
|
-
default: "info",
|
|
24
|
-
toKebab: true
|
|
25
|
-
} };
|
|
26
|
-
const studioConnectionArgs = {
|
|
27
|
-
url: {
|
|
28
|
-
type: "string",
|
|
29
|
-
description: "Base URL of the Kubb Studio instance"
|
|
30
|
-
},
|
|
31
|
-
token: {
|
|
32
|
-
type: "string",
|
|
33
|
-
description: "Organization CI API key for `snapshot`. Defaults to KUBB_TOKEN"
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
const studioPermissionArgs = {
|
|
37
|
-
allowRead: {
|
|
38
|
-
type: "boolean",
|
|
39
|
-
description: "Read the source of files a generation produced. Asked for once per project when omitted",
|
|
40
|
-
default: false,
|
|
41
|
-
toKebab: true
|
|
42
|
-
},
|
|
43
|
-
allowReadAst: {
|
|
44
|
-
type: "boolean",
|
|
45
|
-
description: "Read the parsed spec (the Kubb AST). Asked for once per project when omitted",
|
|
46
|
-
default: false,
|
|
47
|
-
toKebab: true
|
|
48
|
-
},
|
|
49
|
-
allowWrite: {
|
|
50
|
-
type: "boolean",
|
|
51
|
-
description: "Write generated files to disk. Asked for once per project when omitted",
|
|
52
|
-
default: false,
|
|
53
|
-
toKebab: true
|
|
54
|
-
},
|
|
55
|
-
allowConfigEdit: {
|
|
56
|
-
type: "boolean",
|
|
57
|
-
description: "Let Studio change plugin options in kubb.config.ts. Asked for once per project when omitted",
|
|
58
|
-
default: false,
|
|
59
|
-
toKebab: true
|
|
60
|
-
},
|
|
61
|
-
allowInstall: {
|
|
62
|
-
type: "boolean",
|
|
63
|
-
description: "Let Studio install extensions from the registry with kubb add; needs --allow-config-edit too. Asked for once per project when omitted",
|
|
64
|
-
default: false,
|
|
65
|
-
toKebab: true
|
|
66
|
-
},
|
|
67
|
-
allowUpdate: {
|
|
68
|
-
type: "boolean",
|
|
69
|
-
description: "Let Studio update installed extensions with kubb update. Asked for once per project when omitted",
|
|
70
|
-
default: false,
|
|
71
|
-
toKebab: true
|
|
72
|
-
},
|
|
73
|
-
allowRemove: {
|
|
74
|
-
type: "boolean",
|
|
75
|
-
description: "Let Studio remove extensions with kubb remove, which edits kubb.config.ts and uninstalls packages; needs --allow-config-edit too. Asked for once per project when omitted",
|
|
76
|
-
default: false,
|
|
77
|
-
toKebab: true
|
|
78
|
-
},
|
|
79
|
-
allowSaveInput: {
|
|
80
|
-
type: "boolean",
|
|
81
|
-
description: "Let Studio save the spec it sends as the input in kubb.config.ts; needs --allow-config-edit too. Asked for once per project when omitted",
|
|
82
|
-
default: false,
|
|
83
|
-
toKebab: true
|
|
84
|
-
},
|
|
85
|
-
allowExec: {
|
|
86
|
-
type: "boolean",
|
|
87
|
-
description: "Run the formatter, the linter, and output.postGenerate after a generation",
|
|
88
|
-
default: false,
|
|
89
|
-
toKebab: true
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
export { studioPermissionArgs as a, studioConnectionArgs as i, dryRunId as n, yesArg as o, logLevelArg as r, configArg as t };
|
|
93
|
-
|
|
94
|
-
//# sourceMappingURL=shared-Ct9stKpp.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shared-Ct9stKpp.js","names":[],"sources":["../src/commands/shared.ts"],"sourcesContent":["import { pluginId as dryRunId } from '@gunshi/plugin-dryrun'\nimport type { DryRunExtension } from '@gunshi/plugin-dryrun'\n\nexport { dryRunId }\n\n/** Extension shape gunshi's command context carries with `@gunshi/plugin-dryrun`; the `extensions` type parameter of `defineWithTypes`. */\nexport type DryRunExtensions = {\n [dryRunId]: DryRunExtension\n}\n\nexport const configArg = {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n} as const\n\nexport const yesArg = {\n yes: {\n type: 'boolean',\n description: 'Skip the confirmation',\n short: 'y',\n default: false,\n },\n} as const\n\nexport const logLevelArg = {\n logLevel: {\n type: 'enum',\n choices: ['silent', 'info', 'verbose'] as const,\n description: 'Info, silent or verbose',\n short: 'l',\n default: 'info',\n toKebab: true,\n },\n} as const\n\nexport const studioConnectionArgs = {\n url: {\n type: 'string',\n description: 'Base URL of the Kubb Studio instance',\n },\n token: {\n type: 'string',\n description: 'Organization CI API key for `snapshot`. Defaults to KUBB_TOKEN',\n },\n} as const\n\nexport const studioPermissionArgs = {\n allowRead: {\n type: 'boolean',\n description: 'Read the source of files a generation produced. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowReadAst: {\n type: 'boolean',\n description: 'Read the parsed spec (the Kubb AST). Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowWrite: {\n type: 'boolean',\n description: 'Write generated files to disk. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowConfigEdit: {\n type: 'boolean',\n description: 'Let Studio change plugin options in kubb.config.ts. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowInstall: {\n type: 'boolean',\n description: 'Let Studio install extensions from the registry with kubb add; needs --allow-config-edit too. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowUpdate: {\n type: 'boolean',\n description: 'Let Studio update installed extensions with kubb update. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowRemove: {\n type: 'boolean',\n description:\n 'Let Studio remove extensions with kubb remove, which edits kubb.config.ts and uninstalls packages; needs --allow-config-edit too. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowSaveInput: {\n type: 'boolean',\n description: 'Let Studio save the spec it sends as the input in kubb.config.ts; needs --allow-config-edit too. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowExec: {\n type: 'boolean',\n description: 'Run the formatter, the linter, and output.postGenerate after a generation',\n default: false,\n toKebab: true,\n },\n} as const\n"],"mappings":";;AAUA,MAAa,YAAY,EACvB,QAAQ;CACN,MAAM;CACN,aAAa;CACb,OAAO;AACT,EACF;AAEA,MAAa,SAAS,EACpB,KAAK;CACH,MAAM;CACN,aAAa;CACb,OAAO;CACP,SAAS;AACX,EACF;AAEA,MAAa,cAAc,EACzB,UAAU;CACR,MAAM;CACN,SAAS;EAAC;EAAU;EAAQ;CAAS;CACrC,aAAa;CACb,OAAO;CACP,SAAS;CACT,SAAS;AACX,EACF;AAEA,MAAa,uBAAuB;CAClC,KAAK;EACH,MAAM;EACN,aAAa;CACf;CACA,OAAO;EACL,MAAM;EACN,aAAa;CACf;AACF;AAEA,MAAa,uBAAuB;CAClC,WAAW;EACT,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,cAAc;EACZ,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,YAAY;EACV,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,iBAAiB;EACf,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,cAAc;EACZ,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,aAAa;EACX,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,aAAa;EACX,MAAM;EACN,aACE;EACF,SAAS;EACT,SAAS;CACX;CACA,gBAAgB;EACd,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,WAAW;EACT,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"spinner-BZaln7O8.js","names":[],"sources":["../../../internals/utils/src/fs.ts","../src/ui/spinner.ts"],"sourcesContent":["import { access, glob as globNode, mkdir, readFile, writeFile } from 'node:fs/promises'\n\nimport { dirname, isAbsolute, join, relative, resolve } from 'node:path'\nimport { runtime } from './runtime.ts'\n\nexport { existsSync } from 'node:fs'\nexport { mkdir, mkdtemp, rm } from 'node:fs/promises'\n\n/**\n * Resolves to `true` when the file or directory at `path` exists.\n * Uses `Bun.file().exists()` when running under Bun, `fs.access` otherwise.\n *\n * @example\n * ```ts\n * if (await exists('./kubb.config.ts')) {\n * const content = await read('./kubb.config.ts')\n * }\n * ```\n */\nexport async function exists(path: string): Promise<boolean> {\n if (runtime.isBun) {\n return Bun.file(path).exists()\n }\n return access(path).then(\n () => true,\n () => false,\n )\n}\n\n/**\n * Reads the file at `path` as a UTF-8 string.\n * Uses `Bun.file().text()` when running under Bun, `fs.readFile` otherwise.\n *\n * @example\n * ```ts\n * const source = await read('./src/Pet.ts')\n * ```\n */\nexport async function read(path: string): Promise<string> {\n if (runtime.isBun) {\n return Bun.file(path).text()\n }\n return readFile(path, { encoding: 'utf8' })\n}\n\ntype WriteOptions = {\n /**\n * Previously read content, or `null` when the file does not exist.\n * Omitting this value reads the file before writing.\n */\n stored?: string | null\n /**\n * When `true`, re-reads the file immediately after writing and throws if the\n * content does not match — useful for catching write failures on unreliable file systems.\n */\n sanity?: boolean\n}\n\n/**\n * Whether `stored` already holds `source`, comparing on the trimmed text rather than the exact\n * bytes. Surrounding whitespace is what a formatter adds and what editors strip, and neither is a\n * reason to rewrite the file.\n *\n * Both sides are trimmed, so a storage that keeps bytes verbatim settles on the same answer as one\n * that normalizes what it stores. Trimming only `stored` would leave a source with leading\n * whitespace rewritten on every build, since the stored copy keeps the whitespace the comparison\n * has already dropped.\n */\nexport function matchesStored({ stored, source }: { stored: string; source: string }): boolean {\n return stored.trim() === source.trim()\n}\n\n/**\n * Writes `data` to `path`, trimming surrounding whitespace and ending the file with a single newline\n * the way prettier, biome, and oxfmt all do.\n * Skips the write when the trimmed content is empty, or when the file already holds that content.\n * Creates any missing parent directories automatically.\n * When `sanity` is `true`, re-reads the file after writing and throws if the content does not match.\n *\n * @example\n * ```ts\n * await write('./src/Pet.ts', source) // writes and returns the trimmed content plus a newline\n * await write('./src/Pet.ts', source) // null — file unchanged\n * await write('./src/Pet.ts', ' ') // null — empty content skipped\n * ```\n */\nexport async function write(path: string, data: string, options: WriteOptions = {}): Promise<string | null> {\n const trimmed = data.trim()\n if (trimmed === '') return null\n\n const content = `${trimmed}\\n`\n const resolved = resolve(path)\n let stored = options.stored\n\n if (stored === undefined) {\n if (runtime.isBun) {\n const file = Bun.file(resolved)\n stored = (await file.exists()) ? await file.text() : null\n } else {\n try {\n stored = await readFile(resolved, { encoding: 'utf-8' })\n } catch {\n /* file doesn't exist yet */\n stored = null\n }\n }\n }\n if (matchesStored({ stored: stored ?? '', source: trimmed })) return null\n\n await writeRaw(resolved, content)\n\n if (options.sanity) {\n const savedData = await read(resolved)\n if (savedData !== content) {\n throw new Error(`Sanity check failed for ${path}\\n\\nData[${data.length}]:\\n${data}\\n\\nSaved[${savedData.length}]:\\n${savedData}\\n`)\n }\n return savedData\n }\n\n return content\n}\n\n/**\n * Writes UTF-8 content verbatim, including empty files and surrounding whitespace.\n * Uses Bun.write under Bun and creates missing parent directories under either runtime.\n *\n * @example\n * await writeRaw('./cache/output.ts', ' // keep these bytes\\n\\n')\n */\nexport async function writeRaw(path: string, content: string): Promise<void> {\n const resolved = resolve(path)\n if (runtime.isBun) {\n await Bun.write(resolved, content)\n return\n }\n try {\n await writeFile(resolved, content, { encoding: 'utf-8' })\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error\n await mkdir(dirname(resolved), { recursive: true })\n await writeFile(resolved, content, { encoding: 'utf-8' })\n }\n}\n\n/**\n * Lists non-hidden regular files below `directory` as relative POSIX paths, excluding directories and symlinks.\n * Uses Bun.Glob under Bun because its Node glob compatibility API lacks directory-entry support.\n *\n * @example\n * for await (const path of listFiles('./src')) console.log(path)\n */\nexport async function* listFiles(directory: string): AsyncGenerator<string> {\n const cwd = resolve(directory)\n if (runtime.isBun) {\n yield* new Bun.Glob('**/*').scan({ cwd, dot: false, onlyFiles: true, followSymlinks: false })\n return\n }\n for await (const entry of globNode('**/*', { cwd, withFileTypes: true })) {\n if (entry.isFile()) yield toPosixPath(relative(cwd, join(entry.parentPath, entry.name)))\n }\n}\n\n/**\n * Converts a filesystem path to use POSIX (`/`) separators.\n *\n * Most of the codebase compares and composes paths as strings (prefix matching, joining for\n * import specifiers, splitting on `/`). On POSIX `path.resolve` already returns `/`-separated\n * paths, but on Windows it returns `\\`-separated paths, which breaks every such comparison.\n *\n * Routing every path that crosses a module boundary through `toPosixPath` keeps the rest of the\n * code platform-agnostic. The conversion runs unconditionally so Windows-specific behavior is\n * exercisable from POSIX CI.\n *\n * @example\n * toPosixPath('C:\\\\repo\\\\src\\\\pet.ts') // 'C:/repo/src/pet.ts'\n */\nexport function toPosixPath(filePath: string): string {\n return filePath.replaceAll('\\\\', '/')\n}\n\n/**\n * Strips the file extension from a path or file name.\n * Only removes the last `.ext` segment when the dot is not part of a directory name.\n *\n * @example\n * trimExtName('petStore.ts') // 'petStore'\n * trimExtName('/src/models/pet.ts') // '/src/models/pet'\n * trimExtName('/project.v2/gen/pet.ts') // '/project.v2/gen/pet'\n * trimExtName('noExtension') // 'noExtension'\n */\nexport function trimExtName(text: string): string {\n const dotIndex = text.lastIndexOf('.')\n if (dotIndex > 0 && !text.includes('/', dotIndex)) {\n return text.slice(0, dotIndex)\n }\n return text\n}\n\n/**\n * Resolves to `true` when `path` is `parent` itself or nested inside it. Both sides are resolved\n * to absolute paths first, so relative and `..`-containing inputs compare correctly.\n *\n * Guards a destructive or an out-of-tree operation: before wiping an output directory, check that\n * it does not contain the project root, and before loading a path a caller supplied, check that it\n * did not escape the directory it is allowed to read from.\n *\n * @example\n * isPathInside('./src/gen', '.') // true — nested inside the root\n * isPathInside('.', '.') // true — the same directory counts as inside\n * isPathInside('.', './src/gen') // false — the root is not inside its own output\n * isPathInside('../other', '.') // false — escapes the root\n */\nexport function isPathInside(path: string, parent: string): boolean {\n const resolvedPath = resolve(path)\n const resolvedParent = resolve(parent)\n if (resolvedPath === resolvedParent) {\n return true\n }\n\n const rel = relative(resolvedParent, resolvedPath)\n\n return rel !== '' && !rel.startsWith('..') && !isAbsolute(rel)\n}\n","import type { WriterSpinner } from '../loggers/types.ts'\nimport { writer } from './log.ts'\n\n/**\n * A progress spinner, or a writer that prints each message it is given when the terminal cannot\n * animate one. Callers drive both the same way, including the failure state.\n */\nexport function createSpinner(): WriterSpinner {\n return writer().spinner()\n}\n\n/** How long a wait may run before a spinner shows, so a fast answer draws nothing. */\nconst SPINNER_DELAY_MS = 150\n\n/**\n * Awaits `promise`, showing a spinner with `message` only when it takes longer than 150 ms.\n */\nexport async function withSpinner<T>({ promise, message }: { promise: Promise<T>; message: string }): Promise<T> {\n let spinner: WriterSpinner | undefined\n const timer = setTimeout(() => {\n spinner = createSpinner()\n spinner.start(message)\n }, SPINNER_DELAY_MS)\n try {\n return await promise\n } finally {\n clearTimeout(timer)\n spinner?.clear()\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAmBA,eAAsB,OAAO,MAAgC;CAC3D,IAAI,QAAQ,OACV,OAAO,IAAI,KAAK,IAAI,CAAC,CAAC,OAAO;CAE/B,OAA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,IAAI,MAAM,UAAU,OAAO;EACjC;CACF;CACA,IAAI;EACF,MAAM,UAAU,UAAU,SAAS,EAAE,UAAU,QAAQ,CAAC;CAC1D,SAAS,OAAO;EACd,IAAK,MAAgC,SAAS,UAAU,MAAM;EAC9D,MAAM,MAAM,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAK,CAAC;EAClD,MAAM,UAAU,UAAU,SAAS,EAAE,UAAU,QAAQ,CAAC;CAC1D;AACF;;;;;;;;;;;;;;;AAsEA,SAAgB,aAAa,MAAc,QAAyB;CAClE,MAAM,eAAe,QAAQ,IAAI;CACjC,MAAM,iBAAiB,QAAQ,MAAM;CACrC,IAAI,iBAAiB,gBACnB,OAAO;CAGT,MAAM,MAAM,SAAS,gBAAgB,YAAY;CAEjD,OAAO,QAAQ,MAAM,CAAC,IAAI,WAAW,IAAI,KAAK,CAAC,WAAW,GAAG;AAC/D;;;;;;ACvNA,SAAgB,gBAA+B;CAC7C,OAAO,OAAO,CAAC,CAAC,QAAQ;AAC1B;;AAGA,MAAM,mBAAmB;;;;AAKzB,eAAsB,YAAe,EAAE,SAAS,WAAiE;CAC/G,IAAI;CACJ,MAAM,QAAQ,iBAAiB;EAC7B,UAAU,cAAc;EACxB,QAAQ,MAAM,OAAO;CACvB,GAAG,gBAAgB;CACnB,IAAI;EACF,OAAO,MAAM;CACf,UAAU;EACR,aAAa,KAAK;EAClB,SAAS,MAAM;CACjB;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"spinner-CfB0sIPy.cjs","names":["runtime","access","readFile","resolve","writeFile","mkdir","dirname","relative","isAbsolute","writer"],"sources":["../../../internals/utils/src/fs.ts","../src/ui/spinner.ts"],"sourcesContent":["import { access, glob as globNode, mkdir, readFile, writeFile } from 'node:fs/promises'\n\nimport { dirname, isAbsolute, join, relative, resolve } from 'node:path'\nimport { runtime } from './runtime.ts'\n\nexport { existsSync } from 'node:fs'\nexport { mkdir, mkdtemp, rm } from 'node:fs/promises'\n\n/**\n * Resolves to `true` when the file or directory at `path` exists.\n * Uses `Bun.file().exists()` when running under Bun, `fs.access` otherwise.\n *\n * @example\n * ```ts\n * if (await exists('./kubb.config.ts')) {\n * const content = await read('./kubb.config.ts')\n * }\n * ```\n */\nexport async function exists(path: string): Promise<boolean> {\n if (runtime.isBun) {\n return Bun.file(path).exists()\n }\n return access(path).then(\n () => true,\n () => false,\n )\n}\n\n/**\n * Reads the file at `path` as a UTF-8 string.\n * Uses `Bun.file().text()` when running under Bun, `fs.readFile` otherwise.\n *\n * @example\n * ```ts\n * const source = await read('./src/Pet.ts')\n * ```\n */\nexport async function read(path: string): Promise<string> {\n if (runtime.isBun) {\n return Bun.file(path).text()\n }\n return readFile(path, { encoding: 'utf8' })\n}\n\ntype WriteOptions = {\n /**\n * Previously read content, or `null` when the file does not exist.\n * Omitting this value reads the file before writing.\n */\n stored?: string | null\n /**\n * When `true`, re-reads the file immediately after writing and throws if the\n * content does not match — useful for catching write failures on unreliable file systems.\n */\n sanity?: boolean\n}\n\n/**\n * Whether `stored` already holds `source`, comparing on the trimmed text rather than the exact\n * bytes. Surrounding whitespace is what a formatter adds and what editors strip, and neither is a\n * reason to rewrite the file.\n *\n * Both sides are trimmed, so a storage that keeps bytes verbatim settles on the same answer as one\n * that normalizes what it stores. Trimming only `stored` would leave a source with leading\n * whitespace rewritten on every build, since the stored copy keeps the whitespace the comparison\n * has already dropped.\n */\nexport function matchesStored({ stored, source }: { stored: string; source: string }): boolean {\n return stored.trim() === source.trim()\n}\n\n/**\n * Writes `data` to `path`, trimming surrounding whitespace and ending the file with a single newline\n * the way prettier, biome, and oxfmt all do.\n * Skips the write when the trimmed content is empty, or when the file already holds that content.\n * Creates any missing parent directories automatically.\n * When `sanity` is `true`, re-reads the file after writing and throws if the content does not match.\n *\n * @example\n * ```ts\n * await write('./src/Pet.ts', source) // writes and returns the trimmed content plus a newline\n * await write('./src/Pet.ts', source) // null — file unchanged\n * await write('./src/Pet.ts', ' ') // null — empty content skipped\n * ```\n */\nexport async function write(path: string, data: string, options: WriteOptions = {}): Promise<string | null> {\n const trimmed = data.trim()\n if (trimmed === '') return null\n\n const content = `${trimmed}\\n`\n const resolved = resolve(path)\n let stored = options.stored\n\n if (stored === undefined) {\n if (runtime.isBun) {\n const file = Bun.file(resolved)\n stored = (await file.exists()) ? await file.text() : null\n } else {\n try {\n stored = await readFile(resolved, { encoding: 'utf-8' })\n } catch {\n /* file doesn't exist yet */\n stored = null\n }\n }\n }\n if (matchesStored({ stored: stored ?? '', source: trimmed })) return null\n\n await writeRaw(resolved, content)\n\n if (options.sanity) {\n const savedData = await read(resolved)\n if (savedData !== content) {\n throw new Error(`Sanity check failed for ${path}\\n\\nData[${data.length}]:\\n${data}\\n\\nSaved[${savedData.length}]:\\n${savedData}\\n`)\n }\n return savedData\n }\n\n return content\n}\n\n/**\n * Writes UTF-8 content verbatim, including empty files and surrounding whitespace.\n * Uses Bun.write under Bun and creates missing parent directories under either runtime.\n *\n * @example\n * await writeRaw('./cache/output.ts', ' // keep these bytes\\n\\n')\n */\nexport async function writeRaw(path: string, content: string): Promise<void> {\n const resolved = resolve(path)\n if (runtime.isBun) {\n await Bun.write(resolved, content)\n return\n }\n try {\n await writeFile(resolved, content, { encoding: 'utf-8' })\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error\n await mkdir(dirname(resolved), { recursive: true })\n await writeFile(resolved, content, { encoding: 'utf-8' })\n }\n}\n\n/**\n * Lists non-hidden regular files below `directory` as relative POSIX paths, excluding directories and symlinks.\n * Uses Bun.Glob under Bun because its Node glob compatibility API lacks directory-entry support.\n *\n * @example\n * for await (const path of listFiles('./src')) console.log(path)\n */\nexport async function* listFiles(directory: string): AsyncGenerator<string> {\n const cwd = resolve(directory)\n if (runtime.isBun) {\n yield* new Bun.Glob('**/*').scan({ cwd, dot: false, onlyFiles: true, followSymlinks: false })\n return\n }\n for await (const entry of globNode('**/*', { cwd, withFileTypes: true })) {\n if (entry.isFile()) yield toPosixPath(relative(cwd, join(entry.parentPath, entry.name)))\n }\n}\n\n/**\n * Converts a filesystem path to use POSIX (`/`) separators.\n *\n * Most of the codebase compares and composes paths as strings (prefix matching, joining for\n * import specifiers, splitting on `/`). On POSIX `path.resolve` already returns `/`-separated\n * paths, but on Windows it returns `\\`-separated paths, which breaks every such comparison.\n *\n * Routing every path that crosses a module boundary through `toPosixPath` keeps the rest of the\n * code platform-agnostic. The conversion runs unconditionally so Windows-specific behavior is\n * exercisable from POSIX CI.\n *\n * @example\n * toPosixPath('C:\\\\repo\\\\src\\\\pet.ts') // 'C:/repo/src/pet.ts'\n */\nexport function toPosixPath(filePath: string): string {\n return filePath.replaceAll('\\\\', '/')\n}\n\n/**\n * Strips the file extension from a path or file name.\n * Only removes the last `.ext` segment when the dot is not part of a directory name.\n *\n * @example\n * trimExtName('petStore.ts') // 'petStore'\n * trimExtName('/src/models/pet.ts') // '/src/models/pet'\n * trimExtName('/project.v2/gen/pet.ts') // '/project.v2/gen/pet'\n * trimExtName('noExtension') // 'noExtension'\n */\nexport function trimExtName(text: string): string {\n const dotIndex = text.lastIndexOf('.')\n if (dotIndex > 0 && !text.includes('/', dotIndex)) {\n return text.slice(0, dotIndex)\n }\n return text\n}\n\n/**\n * Resolves to `true` when `path` is `parent` itself or nested inside it. Both sides are resolved\n * to absolute paths first, so relative and `..`-containing inputs compare correctly.\n *\n * Guards a destructive or an out-of-tree operation: before wiping an output directory, check that\n * it does not contain the project root, and before loading a path a caller supplied, check that it\n * did not escape the directory it is allowed to read from.\n *\n * @example\n * isPathInside('./src/gen', '.') // true — nested inside the root\n * isPathInside('.', '.') // true — the same directory counts as inside\n * isPathInside('.', './src/gen') // false — the root is not inside its own output\n * isPathInside('../other', '.') // false — escapes the root\n */\nexport function isPathInside(path: string, parent: string): boolean {\n const resolvedPath = resolve(path)\n const resolvedParent = resolve(parent)\n if (resolvedPath === resolvedParent) {\n return true\n }\n\n const rel = relative(resolvedParent, resolvedPath)\n\n return rel !== '' && !rel.startsWith('..') && !isAbsolute(rel)\n}\n","import type { WriterSpinner } from '../loggers/types.ts'\nimport { writer } from './log.ts'\n\n/**\n * A progress spinner, or a writer that prints each message it is given when the terminal cannot\n * animate one. Callers drive both the same way, including the failure state.\n */\nexport function createSpinner(): WriterSpinner {\n return writer().spinner()\n}\n\n/** How long a wait may run before a spinner shows, so a fast answer draws nothing. */\nconst SPINNER_DELAY_MS = 150\n\n/**\n * Awaits `promise`, showing a spinner with `message` only when it takes longer than 150 ms.\n */\nexport async function withSpinner<T>({ promise, message }: { promise: Promise<T>; message: string }): Promise<T> {\n let spinner: WriterSpinner | undefined\n const timer = setTimeout(() => {\n spinner = createSpinner()\n spinner.start(message)\n }, SPINNER_DELAY_MS)\n try {\n return await promise\n } finally {\n clearTimeout(timer)\n spinner?.clear()\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,eAAsB,OAAO,MAAgC;CAC3D,IAAIA,aAAAA,QAAQ,OACV,OAAO,IAAI,KAAK,IAAI,CAAC,CAAC,OAAO;CAE/B,QAAA,GAAOC,iBAAAA,OAAAA,CAAO,IAAI,CAAC,CAAC,WACZ,YACA,KACR;AACF;;;;;;;;;;AAWA,eAAsB,KAAK,MAA+B;CACxD,IAAID,aAAAA,QAAQ,OACV,OAAO,IAAI,KAAK,IAAI,CAAC,CAAC,KAAK;CAE7B,QAAA,GAAOE,iBAAAA,SAAAA,CAAS,MAAM,EAAE,UAAU,OAAO,CAAC;AAC5C;;;;;;;;;;;AAyBA,SAAgB,cAAc,EAAE,QAAQ,UAAuD;CAC7F,OAAO,OAAO,KAAK,MAAM,OAAO,KAAK;AACvC;;;;;;;;;;;;;;;AAgBA,eAAsB,MAAM,MAAc,MAAc,UAAwB,CAAC,GAA2B;CAC1G,MAAM,UAAU,KAAK,KAAK;CAC1B,IAAI,YAAY,IAAI,OAAO;CAE3B,MAAM,UAAU,GAAG,QAAQ;CAC3B,MAAM,YAAA,GAAWC,UAAAA,QAAAA,C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,MAAM,gBAAA,GAAeD,UAAAA,QAAAA,CAAQ,IAAI;CACjC,MAAM,kBAAA,GAAiBA,UAAAA,QAAAA,CAAQ,MAAM;CACrC,IAAI,iBAAiB,gBACnB,OAAO;CAGT,MAAM,OAAA,GAAMI,UAAAA,SAAAA,CAAS,gBAAgB,YAAY;CAEjD,OAAO,QAAQ,MAAM,CAAC,IAAI,WAAW,IAAI,KAAK,EAAA,GAACC,UAAAA,WAAAA,CAAW,GAAG;AAC/D;;;;;;ACvNA,SAAgB,gBAA+B;CAC7C,OAAOC,cAAAA,OAAO,CAAC,CAAC,QAAQ;AAC1B;;AAGA,MAAM,mBAAmB;;;;AAKzB,eAAsB,YAAe,EAAE,SAAS,WAAiE;CAC/G,IAAI;CACJ,MAAM,QAAQ,iBAAiB;EAC7B,UAAU,cAAc;EACxB,QAAQ,MAAM,OAAO;CACvB,GAAG,gBAAgB;CACnB,IAAI;EACF,OAAO,MAAM;CACf,UAAU;EACR,aAAa,KAAK;EAClB,SAAS,MAAM;CACjB;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"summary-CbmQKA8l.js","names":[],"sources":["../src/ui/summary.ts"],"sourcesContent":["import { styleText } from 'node:util'\nimport { formatMs, getElapsedMs } from '@internals/utils'\nimport { logOutro } from './intro.ts'\n\n/**\n * Finishes a command with its outcome and duration before the labeled details.\n * A command with prompts closes its existing block; validation writes a standalone summary.\n */\nexport function logCommandSummary({\n title,\n status,\n hrStart,\n lines,\n block = false,\n}: {\n title: string\n status: 'success' | 'failed' | 'warning' | 'planned' | 'canceled'\n hrStart: [number, number]\n lines: ReadonlyArray<string>\n block?: boolean\n}): void {\n const colors = { success: 'green', failed: 'red', warning: 'yellow', planned: 'cyan', canceled: 'dim' } as const\n const symbols = { success: '✓', failed: '✗', warning: '!', planned: '◇', canceled: '○' } as const\n const summary = [`${styleText(colors[status], `${symbols[status]} ${title}`)} ${styleText('dim', formatMs(getElapsedMs(hrStart)))}`, '', ...lines].join('\\n')\n if (block) {\n logOutro(summary)\n return\n }\n if (status === 'failed') {\n console.error(summary)\n return\n }\n console.log(summary)\n}\n"],"mappings":";;;;;;;;;AAQA,SAAgB,kBAAkB,EAChC,OACA,QACA,SACA,OACA,QAAQ,SAOD;CAGP,MAAM,UAAU;EAAC,GAAG,UAAU;GAFb,SAAS;GAAS,QAAQ;GAAO,SAAS;GAAU,SAAS;GAAQ,UAAU;EAE7D,EAAE,SAAS,GAAG;GAD/B,SAAS;GAAK,QAAQ;GAAK,SAAS;GAAK,SAAS;GAAK,UAAU;EAC5B,EAAE,QAAQ,GAAG,OAAO,EAAE,IAAI,UAAU,OAAO,SAAS,aAAa,OAAO,CAAC,CAAC;EAAK;EAAI,GAAG;CAAK,CAAC,CAAC,KAAK,IAAI;CAC7J,IAAI,OAAO;EACT,SAAS,OAAO;EAChB;CACF;CACA,IAAI,WAAW,UAAU;EACvB,QAAQ,MAAM,OAAO;EACrB;CACF;CACA,QAAQ,IAAI,OAAO;AACrB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"summary-Clvl5Hxs.cjs","names":["styleText","formatMs","getElapsedMs"],"sources":["../src/ui/summary.ts"],"sourcesContent":["import { styleText } from 'node:util'\nimport { formatMs, getElapsedMs } from '@internals/utils'\nimport { logOutro } from './intro.ts'\n\n/**\n * Finishes a command with its outcome and duration before the labeled details.\n * A command with prompts closes its existing block; validation writes a standalone summary.\n */\nexport function logCommandSummary({\n title,\n status,\n hrStart,\n lines,\n block = false,\n}: {\n title: string\n status: 'success' | 'failed' | 'warning' | 'planned' | 'canceled'\n hrStart: [number, number]\n lines: ReadonlyArray<string>\n block?: boolean\n}): void {\n const colors = { success: 'green', failed: 'red', warning: 'yellow', planned: 'cyan', canceled: 'dim' } as const\n const symbols = { success: '✓', failed: '✗', warning: '!', planned: '◇', canceled: '○' } as const\n const summary = [`${styleText(colors[status], `${symbols[status]} ${title}`)} ${styleText('dim', formatMs(getElapsedMs(hrStart)))}`, '', ...lines].join('\\n')\n if (block) {\n logOutro(summary)\n return\n }\n if (status === 'failed') {\n console.error(summary)\n return\n }\n console.log(summary)\n}\n"],"mappings":";;;;;;;;;AAQA,SAAgB,kBAAkB,EAChC,OACA,QACA,SACA,OACA,QAAQ,SAOD;CAGP,MAAM,UAAU;EAAC,IAAA,GAAGA,UAAAA,UAAAA,CAAU;GAFb,SAAS;GAAS,QAAQ;GAAO,SAAS;GAAU,SAAS;GAAQ,UAAU;EAE7D,EAAE,SAAS,GAAG;GAD/B,SAAS;GAAK,QAAQ;GAAK,SAAS;GAAK,SAAS;GAAK,UAAU;EAC5B,EAAE,QAAQ,GAAG,OAAO,EAAE,KAAA,GAAIA,UAAAA,UAAAA,CAAU,OAAOC,aAAAA,SAASC,aAAAA,aAAa,OAAO,CAAC,CAAC;EAAK;EAAI,GAAG;CAAK,CAAC,CAAC,KAAK,IAAI;CAC7J,IAAI,OAAO;EACT,cAAA,SAAS,OAAO;EAChB;CACF;CACA,IAAI,WAAW,UAAU;EACvB,QAAQ,MAAM,OAAO;EACrB;CACF;CACA,QAAQ,IAAI,OAAO;AACrB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text-BmiI4s6N.js","names":[],"sources":["../src/ui/text.ts"],"sourcesContent":["/** Counts a noun, so a message never reads `1 files`. */\nexport function pluralize(count: number, noun: string): string {\n return `${count} ${count === 1 ? noun : `${noun}s`}`\n}\n\n/** The flag that grants a permission, such as `--allow-read-ast`. */\nexport function toPermissionFlag(key: string): string {\n return `--${key.replace(/[A-Z]/g, (char) => `-${char.toLowerCase()}`)}`\n}\n"],"mappings":";;;AACA,SAAgB,UAAU,OAAe,MAAsB;CAC7D,OAAO,GAAG,MAAM,GAAG,UAAU,IAAI,OAAO,GAAG,KAAK;AAClD;;AAGA,SAAgB,iBAAiB,KAAqB;CACpD,OAAO,KAAK,IAAI,QAAQ,WAAW,SAAS,IAAI,KAAK,YAAY,GAAG;AACtE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text-Ep3AulAS.cjs","names":[],"sources":["../src/ui/text.ts"],"sourcesContent":["/** Counts a noun, so a message never reads `1 files`. */\nexport function pluralize(count: number, noun: string): string {\n return `${count} ${count === 1 ? noun : `${noun}s`}`\n}\n\n/** The flag that grants a permission, such as `--allow-read-ast`. */\nexport function toPermissionFlag(key: string): string {\n return `--${key.replace(/[A-Z]/g, (char) => `-${char.toLowerCase()}`)}`\n}\n"],"mappings":";;;AACA,SAAgB,UAAU,OAAe,MAAsB;CAC7D,OAAO,GAAG,MAAM,GAAG,UAAU,IAAI,OAAO,GAAG,KAAK;AAClD;;AAGA,SAAgB,iBAAiB,KAAqB;CACpD,OAAO,KAAK,IAAI,QAAQ,WAAW,SAAS,IAAI,KAAK,YAAY,GAAG;AACtE"}
|
package/dist/utils-BdibacYq.js
DELETED
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
import "./rolldown-runtime-xo6NMXYd.js";
|
|
2
|
-
import { a as matchesStored, o as read } from "./spinner-BZaln7O8.js";
|
|
3
|
-
import { styleText } from "node:util";
|
|
4
|
-
import process from "node:process";
|
|
5
|
-
import { readdir } from "node:fs/promises";
|
|
6
|
-
import { join, relative } from "node:path";
|
|
7
|
-
// ../../internals/utils/src/promise.ts
|
|
8
|
-
/**
|
|
9
|
-
* Runs `run` over every item with at most `limit` in flight. Workers share one iterator, so each
|
|
10
|
-
* takes the next item the moment it frees up instead of waiting for a batch to drain.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```ts
|
|
14
|
-
* await inParallel({ items: files, limit: 50, run: (file) => storage.writeItem(file.path, file.source) })
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
async function inParallel({ items, limit, run }) {
|
|
18
|
-
const queue = items.entries();
|
|
19
|
-
const worker = async () => {
|
|
20
|
-
for (const [index, item] of queue) await run(item, index);
|
|
21
|
-
};
|
|
22
|
-
await Promise.all(Array.from({ length: Math.min(limit, items.length) }, () => worker()));
|
|
23
|
-
}
|
|
24
|
-
// src/runners/generate/utils.ts
|
|
25
|
-
/** Glob pattern for paths the file watcher ignores. */
|
|
26
|
-
const WATCHER_IGNORED_PATHS = "**/{.git,node_modules}/**";
|
|
27
|
-
/**
|
|
28
|
-
* Quiet window in milliseconds that collapses a burst of watcher events (an editor save emits several) into one rebuild.
|
|
29
|
-
* It outlasts chokidar's 100 ms atomic-save window, which holds back the event of a write-then-rename save.
|
|
30
|
-
*/
|
|
31
|
-
const WATCHER_DEBOUNCE_MS = 250;
|
|
32
|
-
/** `14:02:11 petStore.yaml changed`, the line a watcher prints when its input changes. */
|
|
33
|
-
function formatChange({ target, removed = false, now = /* @__PURE__ */ new Date() }) {
|
|
34
|
-
return `${styleText("dim", now.toTimeString().slice(0, 8))} ${styleText("bold", target)} ${removed ? "removed" : "changed"}`;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Starts a file watcher on the given paths and calls `cb` on any change.
|
|
38
|
-
* Ignores `.git` and `node_modules` directories. Event bursts (an editor save emits several)
|
|
39
|
-
* are debounced into one call. `cb` must never reject: its result is not awaited, so the caller
|
|
40
|
-
* serializes and reports its own builds. Resolves to a function that stops watching.
|
|
41
|
-
*/
|
|
42
|
-
async function startWatcher(path, cb, log = {
|
|
43
|
-
info: console.log,
|
|
44
|
-
error: console.log
|
|
45
|
-
}) {
|
|
46
|
-
const { watch } = await import("chokidar");
|
|
47
|
-
const watcher = watch(path, {
|
|
48
|
-
ignorePermissionErrors: true,
|
|
49
|
-
ignored: WATCHER_IGNORED_PATHS,
|
|
50
|
-
ignoreInitial: true
|
|
51
|
-
});
|
|
52
|
-
for (const signal of ["SIGINT", "SIGTERM"]) process.once(signal, () => void watcher.close());
|
|
53
|
-
let debounceTimer = null;
|
|
54
|
-
watcher.on("all", (type, file) => {
|
|
55
|
-
log.info(formatChange({
|
|
56
|
-
target: relative(process.cwd(), file),
|
|
57
|
-
removed: type === "unlink"
|
|
58
|
-
}));
|
|
59
|
-
if (debounceTimer) clearTimeout(debounceTimer);
|
|
60
|
-
debounceTimer = setTimeout(() => {
|
|
61
|
-
debounceTimer = null;
|
|
62
|
-
cb(path);
|
|
63
|
-
}, WATCHER_DEBOUNCE_MS);
|
|
64
|
-
});
|
|
65
|
-
return async () => {
|
|
66
|
-
if (debounceTimer) clearTimeout(debounceTimer);
|
|
67
|
-
await watcher.close();
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
function createSnapshot() {
|
|
71
|
-
return {
|
|
72
|
-
schemas: /* @__PURE__ */ new Set(),
|
|
73
|
-
operations: /* @__PURE__ */ new Set()
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Collects a {@link BuildSnapshot} from the hooks while a build runs. `take` hands back the finished
|
|
78
|
-
* build's snapshot and starts the next one.
|
|
79
|
-
*/
|
|
80
|
-
function trackBuild(hooks) {
|
|
81
|
-
let current = createSnapshot();
|
|
82
|
-
hooks.hook("kubb:generate:schema", (node) => {
|
|
83
|
-
if (node.name) current.schemas.add(node.name);
|
|
84
|
-
});
|
|
85
|
-
hooks.hook("kubb:generate:operation", (node) => {
|
|
86
|
-
current.operations.add(node.operationId);
|
|
87
|
-
});
|
|
88
|
-
return { take() {
|
|
89
|
-
const snapshot = current;
|
|
90
|
-
current = createSnapshot();
|
|
91
|
-
return snapshot;
|
|
92
|
-
} };
|
|
93
|
-
}
|
|
94
|
-
function diffNames(previous, next) {
|
|
95
|
-
return {
|
|
96
|
-
added: [...next].filter((name) => !previous.has(name)).length,
|
|
97
|
-
removed: [...previous].filter((name) => !next.has(name)).length
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Compares two {@link BuildSnapshot}s by name.
|
|
102
|
-
*/
|
|
103
|
-
function diffBuilds(previous, next) {
|
|
104
|
-
return {
|
|
105
|
-
schemas: diffNames(previous.schemas, next.schemas),
|
|
106
|
-
operations: diffNames(previous.operations, next.operations)
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Compares file contents or fingerprints by path.
|
|
111
|
-
*/
|
|
112
|
-
function diffFiles(previous, next) {
|
|
113
|
-
const files = [];
|
|
114
|
-
let unchanged = 0;
|
|
115
|
-
for (const [path, fingerprint] of next) {
|
|
116
|
-
const before = previous.get(path);
|
|
117
|
-
if (before === fingerprint) unchanged++;
|
|
118
|
-
else files.push({
|
|
119
|
-
status: before === void 0 ? "A" : "M",
|
|
120
|
-
path
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
for (const path of previous.keys()) if (!next.has(path)) files.push({
|
|
124
|
-
status: "D",
|
|
125
|
-
path
|
|
126
|
-
});
|
|
127
|
-
return {
|
|
128
|
-
files,
|
|
129
|
-
unchanged
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
function countLineChanges(before, after) {
|
|
133
|
-
const remaining = /* @__PURE__ */ new Map();
|
|
134
|
-
for (const line of before ? before.split("\n") : []) remaining.set(line, (remaining.get(line) ?? 0) + 1);
|
|
135
|
-
let added = 0;
|
|
136
|
-
for (const line of after ? after.split("\n") : []) {
|
|
137
|
-
const count = remaining.get(line) ?? 0;
|
|
138
|
-
if (count > 0) remaining.set(line, count - 1);
|
|
139
|
-
else added++;
|
|
140
|
-
}
|
|
141
|
-
const removed = [...remaining.values()].reduce((sum, count) => sum + count, 0);
|
|
142
|
-
return {
|
|
143
|
-
added,
|
|
144
|
-
removed
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Reads the output before generation, so cleaning the directory cannot erase the diff baseline.
|
|
149
|
-
* A missing directory or an unreadable file is skipped.
|
|
150
|
-
*/
|
|
151
|
-
async function readOutputFiles(outputPath) {
|
|
152
|
-
const entries = await readdir(outputPath, {
|
|
153
|
-
recursive: true,
|
|
154
|
-
withFileTypes: true
|
|
155
|
-
}).catch(() => []);
|
|
156
|
-
const files = /* @__PURE__ */ new Map();
|
|
157
|
-
await inParallel({
|
|
158
|
-
items: entries.filter((entry) => entry.isFile()).map((entry) => join(entry.parentPath, entry.name)),
|
|
159
|
-
limit: 50,
|
|
160
|
-
run: async (filePath) => {
|
|
161
|
-
const source = await read(filePath).catch(() => null);
|
|
162
|
-
if (source !== null) files.set(filePath, source);
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
return files;
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Compares generated output with the files captured before generation. The manifest recognizes
|
|
169
|
-
* output rewritten by a formatter, and `clean` includes files the run would delete.
|
|
170
|
-
*/
|
|
171
|
-
async function diffOutput({ storage, paths, clean, manifest, previousFiles }) {
|
|
172
|
-
const generated = new Set(paths);
|
|
173
|
-
const changes = [];
|
|
174
|
-
let unchanged = 0;
|
|
175
|
-
await inParallel({
|
|
176
|
-
items: paths,
|
|
177
|
-
limit: 50,
|
|
178
|
-
run: async (filePath, index) => {
|
|
179
|
-
const next = await storage.readItem(filePath);
|
|
180
|
-
if (next === null) return;
|
|
181
|
-
const previous = previousFiles.get(filePath) ?? null;
|
|
182
|
-
if (previous !== null && (matchesStored({
|
|
183
|
-
stored: previous,
|
|
184
|
-
source: next
|
|
185
|
-
}) || manifest?.isUpToDate({
|
|
186
|
-
key: filePath,
|
|
187
|
-
source: next,
|
|
188
|
-
disk: previous
|
|
189
|
-
}))) {
|
|
190
|
-
unchanged++;
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
changes[index] = {
|
|
194
|
-
status: previous === null ? "A" : "M",
|
|
195
|
-
path: filePath,
|
|
196
|
-
...countLineChanges(previous?.trim() ?? "", previous === null ? next.trimEnd() : next.trim())
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
const files = changes.filter((file) => file !== void 0);
|
|
201
|
-
if (clean) {
|
|
202
|
-
for (const [filePath, source] of previousFiles) if (!generated.has(filePath)) files.push({
|
|
203
|
-
status: "D",
|
|
204
|
-
path: filePath,
|
|
205
|
-
...countLineChanges(source.trimEnd(), "")
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
return {
|
|
209
|
-
files,
|
|
210
|
-
unchanged
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Reads `r` (rebuild) and `q` (quit) from an interactive stdin in raw mode, and keeps ctrl+c
|
|
215
|
-
* working. Returns `undefined` when stdin is not a TTY. Otherwise returns `arm`, which turns raw
|
|
216
|
-
* mode back on: a spinner restores the terminal when it stops, so call it after each build. Raw mode
|
|
217
|
-
* is restored on exit.
|
|
218
|
-
*/
|
|
219
|
-
function listenForKeys({ rebuild, quit, input = process.stdin }) {
|
|
220
|
-
if (!input.isTTY) return void 0;
|
|
221
|
-
const arm = () => {
|
|
222
|
-
input.setRawMode(true);
|
|
223
|
-
input.resume();
|
|
224
|
-
};
|
|
225
|
-
input.setEncoding("utf8");
|
|
226
|
-
input.on("data", (data) => {
|
|
227
|
-
const key = data.trim();
|
|
228
|
-
if (key === "r") {
|
|
229
|
-
rebuild();
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
if (key === "q" || data === "") {
|
|
233
|
-
input.setRawMode(false);
|
|
234
|
-
input.pause();
|
|
235
|
-
quit(key === "q" ? 0 : 130);
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
process.once("exit", () => input.setRawMode(false));
|
|
239
|
-
arm();
|
|
240
|
-
return arm;
|
|
241
|
-
}
|
|
242
|
-
export { readOutputFiles as a, listenForKeys as i, diffFiles as n, startWatcher as o, diffOutput as r, trackBuild as s, diffBuilds as t };
|
|
243
|
-
|
|
244
|
-
//# sourceMappingURL=utils-BdibacYq.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils-BdibacYq.js","names":[],"sources":["../../../internals/utils/src/promise.ts","../src/runners/generate/utils.ts"],"sourcesContent":["/** A value that may already be resolved or still pending.\n *\n * @example\n * ```ts\n * function load(id: string): PossiblePromise<string> {\n * return cache.get(id) ?? fetchRemote(id)\n * }\n * ```\n */\nexport type PossiblePromise<T> = Promise<T> | T\n\ntype Store<TKey, TValue> = {\n has(key: TKey): boolean\n get(key: TKey): TValue | undefined\n set(key: TKey, value: TValue): unknown\n}\n\n/**\n * Wraps `factory` with a keyed cache backed by the provided store.\n *\n * Pass a `WeakMap` for object keys (results are GC-eligible when the key is\n * collected) or a `Map` for primitive keys. For multi-argument functions,\n * nest two `memoize` calls — the outer keyed by the first argument, the\n * inner (created once per outer miss) keyed by the second.\n *\n * Because the cache is owned by the caller, it can be shared, inspected, or\n * cleared independently of the memoized function.\n *\n * @example Single WeakMap key\n * ```ts\n * const cache = new WeakMap<SchemaNode, Set<string>>()\n * const getRefs = memoize(cache, (node) => collectRefs(node))\n * ```\n *\n * @example Single Map key (primitive)\n * ```ts\n * const cache = new Map<string, Resolver>()\n * const getResolver = memoize(cache, (name) => buildResolver(name))\n * ```\n *\n * @example Two-level (object + primitive)\n * ```ts\n * const outer = new WeakMap<Params[], Map<string, Params[]>>()\n * const fn = memoize(outer, (params) => memoize(new Map(), (key) => transform(params, key)))\n * fn(params)('camelcase')\n * ```\n */\nexport function memoize<TKey, TValue>(store: Store<TKey, TValue>, factory: (key: TKey) => TValue): (key: TKey) => TValue {\n return (key: TKey): TValue => {\n if (store.has(key)) return store.get(key)!\n const value = factory(key)\n store.set(key, value)\n return value\n }\n}\n\ntype ParallelOptions<TItem> = {\n /**\n * Items to work through, handed out in order.\n */\n items: ReadonlyArray<TItem>\n /**\n * How many items may be in flight at once.\n */\n limit: number\n /**\n * Runs once per item, with the item's position so a caller can report progress.\n */\n run(item: TItem, index: number): Promise<void>\n}\n\n/**\n * Runs `run` over every item with at most `limit` in flight. Workers share one iterator, so each\n * takes the next item the moment it frees up instead of waiting for a batch to drain.\n *\n * @example\n * ```ts\n * await inParallel({ items: files, limit: 50, run: (file) => storage.writeItem(file.path, file.source) })\n * ```\n */\nexport async function inParallel<TItem>({ items, limit, run }: ParallelOptions<TItem>): Promise<void> {\n const queue = items.entries()\n\n const worker = async (): Promise<void> => {\n for (const [index, item] of queue) await run(item, index)\n }\n\n await Promise.all(Array.from({ length: Math.min(limit, items.length) }, () => worker()))\n}\n","import { readdir } from 'node:fs/promises'\nimport { join, relative } from 'node:path'\nimport process from 'node:process'\nimport { styleText } from 'node:util'\nimport { inParallel, matchesStored, read } from '@internals/utils'\nimport type { Hookable, KubbHooks, OutputManifest, Storage } from '@kubb/core'\n\n/** Glob pattern for paths the file watcher ignores. */\nconst WATCHER_IGNORED_PATHS = '**/{.git,node_modules}/**' as const\n\n/**\n * Quiet window in milliseconds that collapses a burst of watcher events (an editor save emits several) into one rebuild.\n * It outlasts chokidar's 100 ms atomic-save window, which holds back the event of a write-then-rename save.\n */\nconst WATCHER_DEBOUNCE_MS = 250\n\n/** `14:02:11 petStore.yaml changed`, the line a watcher prints when its input changes. */\nexport function formatChange({ target, removed = false, now = new Date() }: { target: string; removed?: boolean; now?: Date }): string {\n return `${styleText('dim', now.toTimeString().slice(0, 8))} ${styleText('bold', target)} ${removed ? 'removed' : 'changed'}`\n}\n\ntype WatcherLog = {\n info: (message: string) => void\n error: (message: string) => void\n}\n\n/**\n * Starts a file watcher on the given paths and calls `cb` on any change.\n * Ignores `.git` and `node_modules` directories. Event bursts (an editor save emits several)\n * are debounced into one call. `cb` must never reject: its result is not awaited, so the caller\n * serializes and reports its own builds. Resolves to a function that stops watching.\n */\nexport async function startWatcher(\n path: Array<string>,\n cb: (path: Array<string>) => Promise<void>,\n log: WatcherLog = { info: console.log, error: console.log },\n): Promise<() => Promise<void>> {\n const { watch } = await import('chokidar')\n // `ignoreInitial` skips the `add` events chokidar fires for existing files at startup, which\n // would otherwise rebuild right after the initial run.\n const watcher = watch(path, { ignorePermissionErrors: true, ignored: WATCHER_IGNORED_PATHS, ignoreInitial: true })\n\n for (const signal of ['SIGINT', 'SIGTERM'] as const) {\n process.once(signal, () => void watcher.close())\n }\n\n let debounceTimer: ReturnType<typeof setTimeout> | null = null\n\n watcher.on('all', (type, file) => {\n log.info(formatChange({ target: relative(process.cwd(), file), removed: type === 'unlink' }))\n if (debounceTimer) clearTimeout(debounceTimer)\n debounceTimer = setTimeout(() => {\n debounceTimer = null\n void cb(path)\n }, WATCHER_DEBOUNCE_MS)\n })\n\n return async () => {\n if (debounceTimer) clearTimeout(debounceTimer)\n await watcher.close()\n }\n}\n\n/**\n * What one build produced: the schema and operation names the plugins generated.\n */\nexport type BuildSnapshot = {\n schemas: Set<string>\n operations: Set<string>\n}\n\nfunction createSnapshot(): BuildSnapshot {\n return { schemas: new Set(), operations: new Set() }\n}\n\n/**\n * Collects a {@link BuildSnapshot} from the hooks while a build runs. `take` hands back the finished\n * build's snapshot and starts the next one.\n */\nexport function trackBuild(hooks: Hookable<KubbHooks>): { take(): BuildSnapshot } {\n let current = createSnapshot()\n\n hooks.hook('kubb:generate:schema', (node) => {\n if (node.name) current.schemas.add(node.name)\n })\n hooks.hook('kubb:generate:operation', (node) => {\n current.operations.add(node.operationId)\n })\n\n return {\n take() {\n const snapshot = current\n current = createSnapshot()\n return snapshot\n },\n }\n}\n\ntype NameChange = { added: number; removed: number }\n\n/**\n * How a rebuild differs from the build before it: the spec's added and removed schemas and operations.\n */\nexport type BuildDiff = {\n schemas: NameChange\n operations: NameChange\n}\n\nfunction diffNames(previous: Set<string>, next: Set<string>): NameChange {\n return { added: [...next].filter((name) => !previous.has(name)).length, removed: [...previous].filter((name) => !next.has(name)).length }\n}\n\n/**\n * Compares two {@link BuildSnapshot}s by name.\n */\nexport function diffBuilds(previous: BuildSnapshot, next: BuildSnapshot): BuildDiff {\n return {\n schemas: diffNames(previous.schemas, next.schemas),\n operations: diffNames(previous.operations, next.operations),\n }\n}\n\n/**\n * Compares file contents or fingerprints by path.\n */\nexport function diffFiles(previous: ReadonlyMap<string, string>, next: ReadonlyMap<string, string>): { files: Array<FileChange>; unchanged: number } {\n const files: Array<FileChange> = []\n let unchanged = 0\n for (const [path, fingerprint] of next) {\n const before = previous.get(path)\n if (before === fingerprint) unchanged++\n else files.push({ status: before === undefined ? 'A' : 'M', path })\n }\n for (const path of previous.keys()) {\n if (!next.has(path)) files.push({ status: 'D', path })\n }\n\n return { files, unchanged }\n}\n\n/** A changed file with how many lines it gains and loses, counted as a multiset, which is cheap and close enough for a plan. */\nexport type FileChange = { status: 'A' | 'M' | 'D'; path: string; added?: number; removed?: number }\n\nfunction countLineChanges(before: string, after: string): { added: number; removed: number } {\n const remaining = new Map<string, number>()\n for (const line of before ? before.split('\\n') : []) remaining.set(line, (remaining.get(line) ?? 0) + 1)\n let added = 0\n for (const line of after ? after.split('\\n') : []) {\n const count = remaining.get(line) ?? 0\n if (count > 0) remaining.set(line, count - 1)\n else added++\n }\n const removed = [...remaining.values()].reduce((sum, count) => sum + count, 0)\n return { added, removed }\n}\n\n/**\n * Reads the output before generation, so cleaning the directory cannot erase the diff baseline.\n * A missing directory or an unreadable file is skipped.\n */\nexport async function readOutputFiles(outputPath: string): Promise<Map<string, string>> {\n const entries = await readdir(outputPath, { recursive: true, withFileTypes: true }).catch(() => [])\n const files = new Map<string, string>()\n await inParallel({\n items: entries.filter((entry) => entry.isFile()).map((entry) => join(entry.parentPath, entry.name)),\n limit: 50,\n run: async (filePath) => {\n const source = await read(filePath).catch(() => null)\n if (source !== null) files.set(filePath, source)\n },\n })\n return files\n}\n\n/**\n * Compares generated output with the files captured before generation. The manifest recognizes\n * output rewritten by a formatter, and `clean` includes files the run would delete.\n */\nexport async function diffOutput({\n storage,\n paths,\n clean,\n manifest,\n previousFiles,\n}: {\n storage: Storage\n paths: ReadonlyArray<string>\n clean: boolean\n manifest?: Pick<OutputManifest, 'isUpToDate'>\n /**\n * The output captured before a real run, including files removed by cleaning.\n */\n previousFiles: ReadonlyMap<string, string>\n}): Promise<{ files: Array<FileChange>; unchanged: number }> {\n const generated = new Set(paths)\n const changes: Array<FileChange | undefined> = []\n let unchanged = 0\n await inParallel({\n items: paths,\n limit: 50,\n run: async (filePath, index) => {\n const next = await storage.readItem(filePath)\n if (next === null) return\n const previous = previousFiles.get(filePath) ?? null\n if (previous !== null && (matchesStored({ stored: previous, source: next }) || manifest?.isUpToDate({ key: filePath, source: next, disk: previous }))) {\n unchanged++\n return\n }\n changes[index] = {\n status: previous === null ? 'A' : 'M',\n path: filePath,\n ...countLineChanges(previous?.trim() ?? '', previous === null ? next.trimEnd() : next.trim()),\n }\n },\n })\n const files = changes.filter((file) => file !== undefined)\n if (clean) {\n for (const [filePath, source] of previousFiles) {\n if (!generated.has(filePath)) files.push({ status: 'D', path: filePath, ...countLineChanges(source.trimEnd(), '') })\n }\n }\n\n return { files, unchanged }\n}\n\ntype KeyInput = Pick<NodeJS.ReadStream, 'isTTY' | 'setRawMode' | 'resume' | 'pause' | 'setEncoding' | 'on'>\n\ntype KeyOptions = {\n rebuild: () => void\n /**\n * Ends the process with this exit code: `0` for `q`, `130` for ctrl+c, which raw mode turns into a key.\n */\n quit: (code: number) => void\n input?: KeyInput\n}\n\n/**\n * Reads `r` (rebuild) and `q` (quit) from an interactive stdin in raw mode, and keeps ctrl+c\n * working. Returns `undefined` when stdin is not a TTY. Otherwise returns `arm`, which turns raw\n * mode back on: a spinner restores the terminal when it stops, so call it after each build. Raw mode\n * is restored on exit.\n */\nexport function listenForKeys({ rebuild, quit, input = process.stdin }: KeyOptions): (() => void) | undefined {\n if (!input.isTTY) return undefined\n\n const arm = () => {\n input.setRawMode(true)\n input.resume()\n }\n input.setEncoding('utf8')\n input.on('data', (data: string) => {\n const key = data.trim()\n if (key === 'r') {\n rebuild()\n return\n }\n if (key === 'q' || data === '\\u0003') {\n input.setRawMode(false)\n input.pause()\n quit(key === 'q' ? 0 : 130)\n }\n })\n process.once('exit', () => input.setRawMode(false))\n arm()\n\n return arm\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgFA,eAAsB,WAAkB,EAAE,OAAO,OAAO,OAA8C;CACpG,MAAM,QAAQ,MAAM,QAAQ;CAE5B,MAAM,SAAS,YAA2B;EACxC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diagnostics","write"],"sources":["../src/runners/init/utils.ts"],"sourcesContent":["import fs from 'node:fs'\nimport path from 'node:path'\nimport process from 'node:process'\nimport { read, write } from '@internals/utils'\nimport { Diagnostics, type ExtensionManifest, type RegistryEntry } from '@kubb/core'\nimport { x } from 'tinyexec'\n\nexport type PackageManagerName = 'npm' | 'pnpm' | 'yarn' | 'bun'\n\n/** Metadata describing a package manager's lock file and commands. */\nexport type PackageManagerInfo = {\n /** Identifier used in CLI commands, e.g. `pnpm`, `yarn`. */\n name: PackageManagerName\n /** Lock file names that identify this package manager in a project root. */\n lockFiles: ReadonlyArray<string>\n /** Subcommands passed to the package manager binary to create a `package.json`. */\n initCommand: ReadonlyArray<string>\n /** Subcommands passed to the package manager binary to install a dev dependency. */\n installCommand: ReadonlyArray<string>\n /** Subcommands passed to the package manager binary to uninstall a dependency. */\n removeCommand: ReadonlyArray<string>\n /** Subcommands passed to the package manager binary before a `package.json` script name. */\n runCommand: ReadonlyArray<string>\n}\n\n/** Metadata for each supported package manager, keyed by its short name. */\nexport const packageManagers: Record<PackageManagerName, PackageManagerInfo> = {\n pnpm: {\n name: 'pnpm',\n lockFiles: ['pnpm-lock.yaml'],\n initCommand: ['init'],\n installCommand: ['add', '-D'],\n removeCommand: ['remove'],\n runCommand: [],\n },\n yarn: {\n name: 'yarn',\n lockFiles: ['yarn.lock'],\n initCommand: ['init', '-y'],\n installCommand: ['add', '-D'],\n removeCommand: ['remove'],\n runCommand: [],\n },\n bun: {\n name: 'bun',\n lockFiles: ['bun.lock', 'bun.lockb'],\n initCommand: ['init', '-y'],\n installCommand: ['add', '-d'],\n removeCommand: ['remove'],\n runCommand: ['run'],\n },\n npm: {\n name: 'npm',\n lockFiles: ['package-lock.json'],\n initCommand: ['init', '-y'],\n installCommand: ['install', '--save-dev'],\n removeCommand: ['uninstall'],\n runCommand: ['run'],\n },\n}\n\n/** Minimal shape of `package.json` fields read during detection. */\ntype PackageJson = {\n /** The `packageManager` field from `package.json` (e.g. `\"pnpm@9.0.0\"`). */\n packageManager?: string\n scripts?: Record<string, string>\n}\n\n/** Detects the package manager for `cwd`: the `packageManager` field in `package.json`, then a lock file, then `npm`. */\nexport function detectPackageManager(cwd: string = process.cwd()): PackageManagerInfo {\n const packageJsonPath = path.join(cwd, 'package.json')\n if (fs.existsSync(packageJsonPath)) {\n try {\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8')) as PackageJson\n const pmField = packageJson.packageManager\n if (typeof pmField === 'string') {\n const name = pmField.split('@')[0]\n if (name && name in packageManagers) {\n return packageManagers[name as PackageManagerName]\n }\n }\n } catch {\n // Continue to lock file detection\n }\n }\n\n for (const pm of Object.values(packageManagers)) {\n if (pm.lockFiles.some((lockFile) => fs.existsSync(path.join(cwd, lockFile)))) {\n return pm\n }\n }\n\n return packageManagers.npm\n}\n\n/**\n * Initializes a new `package.json` at `cwd` using the detected package manager.\n */\nexport async function initPackageJson(cwd: string, packageManager: PackageManagerInfo): Promise<void> {\n await x(packageManager.name, [...packageManager.initCommand], {\n nodeOptions: { cwd, stdio: 'inherit' },\n throwOnError: true,\n })\n}\n\n/** How many trailing lines of a failed install's output the error keeps. */\nconst INSTALL_OUTPUT_LINES = 20\nconst INSTALL_TIMEOUT_MS = 5 * 60_000\n\n/**\n * Installs the given packages at `cwd` using the detected package manager. Each output line goes\n * to `onLine`, so the caller can show it while the install runs; a failed install also keeps the\n * end of the output in the error.\n */\nexport async function installPackages(\n packages: Array<string>,\n packageManager: PackageManagerInfo,\n cwd: string = process.cwd(),\n onLine?: (line: string) => void,\n command: ReadonlyArray<string> = packageManager.installCommand,\n): Promise<void> {\n const args = [...command, ...packages]\n // No stdin, so a package manager that wants input fails instead of waiting. The timeout ends a stalled install.\n const result = x(packageManager.name, args, {\n nodeOptions: { cwd, stdio: ['ignore', 'pipe', 'pipe'] },\n timeout: INSTALL_TIMEOUT_MS,\n throwOnError: false,\n })\n const lines: Array<string> = []\n for await (const line of result) {\n lines.push(line)\n onLine?.(line)\n }\n if (result.exitCode === 0) return\n if (result.exitCode === undefined) throw new Error(`\\`${packageManager.name} ${args.join(' ')}\\` timed out after ${INSTALL_TIMEOUT_MS / 60_000} minutes`)\n\n const output = lines.slice(-INSTALL_OUTPUT_LINES).join('\\n')\n throw new Error(`\\`${packageManager.name} ${args.join(' ')}\\` failed with exit code ${result.exitCode}${output ? `:\\n${output}` : ''}`)\n}\n\n/**\n * Uninstalls the given packages at `cwd` with the package manager's remove command, like {@link installPackages}.\n */\nexport function uninstallPackages(packages: Array<string>, packageManager: PackageManagerInfo, cwd: string = process.cwd()): Promise<void> {\n return installPackages(packages, packageManager, cwd, undefined, packageManager.removeCommand)\n}\n\n/**\n * What the selected plugins' `manifests` say is missing from the selection: a `dependencies`\n * entry, or a `client` plugin next to a `consumer`. Empty when nothing is missing.\n * `optionalDependencies` are skipped, since `kubb init` writes the default options.\n */\nexport function missingPluginDependencies(manifests: Array<ExtensionManifest>): Array<string> {\n const selected = manifests.map((manifest) => manifest.name)\n const hasClient = manifests.some((manifest) => manifest.role === 'client')\n return manifests.flatMap((manifest) => [\n ...(manifest.dependencies ?? []).filter((name) => !selected.includes(name)).map((name) => `${manifest.name} needs ${name}.`),\n ...(manifest.role === 'consumer' && !hasClient ? [`${manifest.name} needs a client plugin, such as plugin-axios or plugin-fetch.`] : []),\n ])\n}\n\nasync function readPackageJson(cwd: string): Promise<PackageJson> {\n try {\n return JSON.parse(await read(path.join(cwd, 'package.json'))) as PackageJson\n } catch {\n return {}\n }\n}\n\nconst SPEC_FILE = /^(openapi|swagger)[\\w.-]*\\.(ya?ml|json)$/i\nconst SKIPPED_DIRS = new Set(['node_modules', 'dist', 'build', 'coverage'])\n\n/**\n * Finds OpenAPI spec files up to `depth` folders below `cwd`, shallowest first, as `./`-relative\n * paths. Walks one level at a time and stops after `limit` files, so a large repo stays fast.\n */\nexport async function findSpecFiles(cwd: string, { depth = 3, limit = 20 }: { depth?: number; limit?: number } = {}): Promise<Array<string>> {\n const found: Array<string> = []\n let level: Array<string> = ['']\n for (let current = 0; current <= depth && level.length && found.length < limit; current++) {\n const listings = await Promise.all(\n level.map(async (dir) => ({ dir, entries: await fs.promises.readdir(path.join(cwd, dir), { withFileTypes: true }).catch(() => []) })),\n )\n level = []\n for (const { dir, entries } of listings) {\n for (const entry of entries.toSorted((a, b) => a.name.localeCompare(b.name))) {\n if (entry.isFile() && SPEC_FILE.test(entry.name)) found.push(`./${path.posix.join(dir, entry.name)}`)\n if (entry.isDirectory() && !entry.name.startsWith('.') && !SKIPPED_DIRS.has(entry.name)) level.push(path.posix.join(dir, entry.name))\n }\n }\n }\n return found.slice(0, limit)\n}\n\n/** The spec version and operation count, when the file states them. */\nexport type SpecInfo = { version?: string; operations?: number }\n\nconst SPEC_HEAD_BYTES = 256 * 1024\nconst METHOD = '(?:get|put|post|delete|options|head|patch|trace)'\n\n/**\n * Reads the OpenAPI or Swagger version and counts the operations from the first 256 KB of the\n * file, so a large spec is never parsed. The count is left out when the file is longer.\n */\nexport async function readSpecInfo(file: string): Promise<SpecInfo> {\n const handle = await fs.promises.open(file)\n try {\n const buffer = Buffer.alloc(SPEC_HEAD_BYTES)\n const { bytesRead } = await handle.read(buffer, 0, SPEC_HEAD_BYTES, 0)\n const head = buffer.toString('utf-8', 0, bytesRead)\n const complete = bytesRead < SPEC_HEAD_BYTES\n const version = head.match(/^\\s*[\"']?(?:openapi|swagger)[\"']?\\s*:\\s*[\"']?(\\d[\\d.]*)/m)?.[1]\n // shortcut: counts method keys at any depth, so a schema property named `get` counts too; use the adapter when that matters.\n const methods = new RegExp(`^\\\\s*[\"']?${METHOD}[\"']?\\\\s*:\\\\s*(?:\\\\{|$)`, 'gm')\n return { version, operations: complete ? (head.match(methods)?.length ?? 0) : undefined }\n } finally {\n await handle.close()\n }\n}\n\n/** Finds a plugin by registry id, slug, or short name, so `ts`, `plugin-ts`, and `kubb-labs/plugin-ts` all match. */\nexport function findPlugin({ plugins, id }: { plugins: Array<RegistryEntry>; id: string }): RegistryEntry | undefined {\n const ids = id.includes('/') ? [id] : [`kubb-labs/${id}`, `kubb-labs/plugin-${id}`]\n return plugins.find((entry) => ids.includes(entry.id))\n}\n\n/**\n * Turns the comma-separated `--plugins` value into registry entries.\n *\n * @throws when an id is not in `plugins`.\n */\nexport function parsePluginsFlag({ plugins, value }: { plugins: Array<RegistryEntry>; value: string }): Array<RegistryEntry> {\n const ids = value\n .split(',')\n .map((id) => id.trim())\n .filter(Boolean)\n const unknown = ids.filter((id) => !findPlugin({ plugins, id }))\n if (unknown.length)\n throw new Diagnostics.Error({\n code: Diagnostics.code.pluginNotFound,\n severity: 'error',\n message: `Not in the Kubb registry: ${unknown.join(', ')}. Browse the plugins at https://kubb.dev/extensions.`,\n help: 'Use plugin ids from https://kubb.dev/extensions, such as plugin-ts or ts.',\n })\n return ids.map((id) => findPlugin({ plugins, id })!)\n}\n\n/** Adds `\"generate\": \"kubb generate\"` to the `package.json` scripts at `cwd`. Returns `false`, and changes nothing, when a `generate` script exists. */\nexport async function addGenerateScript(cwd: string): Promise<boolean> {\n const file = path.join(cwd, 'package.json')\n const source = await read(file)\n const packageJson = JSON.parse(source) as PackageJson\n if (packageJson.scripts?.generate !== undefined) return false\n const indent = source.match(/^[ \\t]+/m)?.[0] ?? ' '\n const updated = { ...packageJson, scripts: { ...packageJson.scripts, generate: 'kubb generate' } }\n await write(file, JSON.stringify(updated, null, indent))\n return true\n}\n\n/** Reads the `generate` script from the `package.json` at `cwd`. */\nexport async function generateScript(cwd: string): Promise<string | undefined> {\n return (await readPackageJson(cwd)).scripts?.generate\n}\n"],"mappings":";;;;;;;;;;;;AA0BA,MAAa,kBAAkE;CAC7E,MAAM;EACJ,MAAM;EACN,WAAW,CAAC,gBAAgB;EAC5B,aAAa,CAAC,MAAM;EACpB,gBAAgB,CAAC,OAAO,IAAI;EAC5B,eAAe,CAAC,QAAQ;EACxB,YAAY,CAAC;CACf;CACA,MAAM;EACJ,MAAM;EACN,WAAW,CAAC,WAAW;EACvB,aA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