@kubb/studio 0.0.0-canary-20260903193839

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveConfig-B9oGiNMi.js","names":[],"sources":["../../../internals/utils/src/casing.ts","../src/resolveConfig.ts"],"sourcesContent":["type Options = {\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n return text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/(\\d)([a-z])/g, '$1 $2')\n .split(/[\\s\\-_./\\\\:]+/)\n .filter(Boolean)\n .map((word, i) => {\n if (word.length > 1 && word === word.toUpperCase()) return word\n const head = i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()\n return head + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n/**\n * Converts `text` to camelCase.\n *\n * @example Word boundaries\n * `camelCase('hello-world') // 'helloWorld'`\n *\n * @example With a prefix\n * `camelCase('tag', { prefix: 'create' }) // 'createTag'`\n */\nexport function camelCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n *\n * @example Word boundaries\n * `pascalCase('hello-world') // 'HelloWorld'`\n *\n * @example With a suffix\n * `pascalCase('tag', { suffix: 'schema' }) // 'TagSchema'`\n */\nexport function pascalCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n","import { existsSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport { pathToFileURL } from 'node:url'\nimport type { Adapter, Plugin } from '@kubb/core'\nimport { camelCase } from '@internals/utils'\nimport { mergeDeep } from 'remeda'\nimport type { JSONKubbConfig } from './protocol/index.ts'\n\n/**\n * Turns the JSON config Studio sends back into live Kubb objects.\n *\n * A plugin or adapter instance carries closures (`parse`, `getImports`, ...) that cannot survive\n * JSON, so both sides pass options over the wire and the factory is re-invoked here with the merged\n * result. Only `@kubb/plugin-*` packages are resolved this way, so the reinstantiated factory is\n * always one Kubb ships, never an arbitrary module the payload names.\n */\n\ntype PluginFactory = (options: unknown) => Plugin\n\n/**\n * Imports a package, falling back to how the user's project would resolve it.\n *\n * `import()` resolves from this file, so a linked or globally installed Studio (`pnpm link`,\n * `npm i -g`) only sees its own `node_modules` and misses the plugins installed next to the user's\n * config. The retry resolves from `process.cwd()` instead.\n */\nasync function importFromProject(packageName: string): Promise<Record<string, unknown>> {\n try {\n return await import(packageName)\n } catch {\n const require = createRequire(pathToFileURL(`${process.cwd()}/`))\n // `require.resolve` picks the package's `require` condition, so prefer the ESM build sitting\n // next to it. Loading the CJS copy would pull in a second `@kubb/core` instance.\n const resolved = require.resolve(packageName)\n const esm = resolved.replace(/\\.cjs$/, '.js')\n\n return await import(pathToFileURL(esm !== resolved && existsSync(esm) ? esm : resolved).href)\n }\n}\n\n/**\n * Strips the `@kubb/` scope from a plugin package name, matching the `name` convention Kubb\n * plugin factories use internally.\n *\n * @example\n * ```ts\n * toPluginName('@kubb/plugin-ts') // 'plugin-ts'\n * ```\n */\nfunction toPluginName(packageName: string): string {\n return packageName.split('/').pop() ?? packageName\n}\n\n/**\n * Derives the conventional named export for a `@kubb/*` plugin package from its package name.\n *\n * @example\n * ```ts\n * toExportName('@kubb/plugin-react-query') // 'pluginReactQuery'\n * toExportName('@kubb/plugin-ts') // 'pluginTs'\n * ```\n */\nexport function toExportName(packageName: string): string {\n return camelCase(toPluginName(packageName))\n}\n\n/**\n * A `@kubb/plugin-*` package specifier. Nothing else may reach `import()`: only Kubb's own\n * plugins are supported, so a payload naming anything else, a third-party package or a path, is\n * refused before it can execute.\n */\nconst KUBB_PLUGIN_SPECIFIER = /^@kubb\\/plugin-[\\w.-]+$/\n\n/**\n * Whether `name` is a `@kubb/plugin-*` specifier. Exported so `configFile.ts` can refuse the same\n * shape before printing a Studio-supplied plugin name into the config file's source text.\n */\nexport function isKubbPluginSpecifier(name: string): boolean {\n return KUBB_PLUGIN_SPECIFIER.test(name)\n}\n\n/**\n * Dynamically imports a `@kubb/plugin-*` package and returns its factory function.\n *\n * Packages must be pre-installed in the Docker image at build time via the `KUBB_PACKAGES`\n * build ARG, no runtime installation is possible in the distroless container.\n *\n * Resolution order: the camelCase named export the package name implies (e.g. `pluginTs`), then\n * the default export.\n *\n * @throws if the package cannot be imported or exports no callable factory.\n */\nasync function loadPluginFactory(packageName: string): Promise<PluginFactory> {\n if (!isKubbPluginSpecifier(packageName)) {\n throw new Error(`Plugin \"${packageName}\" is not a @kubb/plugin-* package. Kubb Studio only supports Kubb's own plugins.`)\n }\n\n let mod: Record<string, unknown>\n try {\n mod = await importFromProject(packageName)\n } catch (cause) {\n throw new Error(`Plugin \"${packageName}\" could not be loaded. Make sure it is installed: \\`npm install ${packageName}\\``, { cause })\n }\n\n const exportName = toExportName(packageName)\n\n if (typeof mod[exportName] === 'function') return mod[exportName] as PluginFactory\n\n if (typeof mod['default'] === 'function') return mod['default'] as PluginFactory\n\n throw new Error(`Plugin \"${packageName}\" does not export a callable factory. Tried the named export \"${exportName}\" and \"default\".`)\n}\n\n/**\n * Resolves each plugin entry by dynamically importing the `@kubb/plugin-*` package and\n * calling its factory with the provided options.\n *\n * Packages must be pre-installed in the Docker image at build time, use the `KUBB_PACKAGES`\n * build ARG to control which ones are available at runtime.\n *\n * @example\n * ```ts\n * { name: '@kubb/plugin-react-query', options: { output: { path: './hooks' } } }\n * { name: '@kubb/plugin-ts', options: { output: { path: './types' } } }\n * ```\n */\nexport async function resolvePlugins(plugins: NonNullable<JSONKubbConfig['plugins']>): Promise<Array<Plugin>> {\n return Promise.all(\n plugins.map(async ({ name, options }) => {\n const factory = await loadPluginFactory(name)\n return factory(options ?? {}) as Plugin\n }),\n )\n}\n\n/**\n * Merges studio plugin options with disk config plugins.\n * Studio takes priority: options from studio win over disk, and a plugin Studio explicitly\n * disabled is dropped even when the disk config still lists it. Disk plugins without a studio\n * counterpart are kept as-is. Studio plugins not present on disk are appended.\n *\n * For plugins present in both configs, the plugin is re-instantiated with merged options\n * so that all internal closures correctly reference the merged values.\n */\nexport async function mergePlugins(\n diskPlugins: Array<Plugin> | undefined,\n studioPlugins: JSONKubbConfig['plugins'] | undefined,\n): Promise<Array<Plugin> | undefined> {\n // Matched on the package's base name rather than by instantiating first. Every Kubb plugin\n // factory returns exactly that (`@kubb/plugin-ts` → `plugin-ts`), enforced by the `satisfies` on\n // each factory's name.\n const disabledNames = new Set((studioPlugins ?? []).filter((entry) => entry.disabled).map((entry) => toPluginName(entry.name)))\n const activeDiskPlugins = disabledNames.size ? diskPlugins?.filter((plugin) => !disabledNames.has(plugin.name)) : diskPlugins\n const activeStudioPlugins = studioPlugins?.filter((entry) => !entry.disabled)\n\n if (!activeDiskPlugins && !activeStudioPlugins?.length) return undefined\n if (!activeStudioPlugins?.length) return activeDiskPlugins\n\n if (!activeDiskPlugins) return resolvePlugins(activeStudioPlugins)\n\n const studioEntryByName = new Map(activeStudioPlugins.map((entry) => [toPluginName(entry.name), entry] as const))\n const diskNames = new Set(activeDiskPlugins.map((plugin) => plugin.name))\n\n // Each plugin is instantiated once, with its final options. Resolving the whole payload first\n // just to read the names would build every overlapping plugin twice and discard the first.\n const merged = await Promise.all(\n activeDiskPlugins.map(async (diskPlugin) => {\n const studioEntry = studioEntryByName.get(diskPlugin.name)\n if (!studioEntry) return diskPlugin\n\n // Disk as base, studio overrides, then re-instantiate so the plugin's closures reference the\n // merged values. A plugin that never sets `options` (e.g. `@kubb/plugin-barrel`) leaves\n // `diskPlugin.options` undefined, which `mergeDeep` can't accept.\n const options = mergeDeep((diskPlugin.options as Record<string, unknown>) ?? {}, (studioEntry.options as Record<string, unknown>) ?? {})\n const [resolved] = await resolvePlugins([{ name: studioEntry.name, options }])\n\n return resolved ?? diskPlugin\n }),\n )\n\n const studioOnly = activeStudioPlugins.filter((entry) => !diskNames.has(toPluginName(entry.name)))\n\n return [...merged, ...(await resolvePlugins(studioOnly))]\n}\n\n/**\n * Merges Studio-provided adapter option overrides into the disk config's adapter.\n *\n * Adapter instances carry live functions (`parse`, `getImports`, ...) that can't survive\n * JSON serialization over the WebSocket, so `studioOptions` is treated as an options patch\n * rather than a replacement adapter. Re-invokes the same `@kubb/adapter-<name>` factory the\n * disk config used, with the merged options, so the resulting instance has fresh closures\n * over the merged values instead of a plain object missing `parse`.\n */\nexport async function mergeAdapter(diskAdapter: Adapter | undefined, studioOptions: object | undefined): Promise<Adapter | undefined> {\n if (!studioOptions || !diskAdapter) {\n return diskAdapter\n }\n\n const packageName = `@kubb/adapter-${diskAdapter.name}`\n const mod = await importFromProject(packageName)\n const factory = mod[toExportName(packageName)]\n\n if (typeof factory !== 'function') {\n return diskAdapter\n }\n\n const mergedOptions = mergeDeep((diskAdapter.options as Record<string, unknown>) ?? {}, studioOptions as Record<string, unknown>)\n\n return factory(mergedOptions) as Adapter\n}\n"],"mappings":";;;;;;;;;;;;;AAkBA,SAAS,gBAAgB,MAAc,QAAyB;CAC9D,OAAO,KACJ,KAAK,CAAC,CACN,QAAQ,qBAAqB,OAAO,CAAC,CACrC,QAAQ,yBAAyB,OAAO,CAAC,CACzC,QAAQ,gBAAgB,OAAO,CAAC,CAChC,MAAM,eAAe,CAAC,CACtB,OAAO,OAAO,CAAC,CACf,KAAK,MAAM,MAAM;EAChB,IAAI,KAAK,SAAS,KAAK,SAAS,KAAK,YAAY,GAAG,OAAO;EAE3D,QADa,MAAM,KAAK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AAuC,CAAC,CAAC;EACvI,MAAM,CAAC,YAAY,MAAM,eAAe,CAAC;GAAE,MAAM,YAAY;GAAM;EAAQ,CAAC,CAAC;EAE7E,OAAO,YAAY;CACrB,CAAC,CACH;CAEA,MAAM,aAAa,oBAAoB,QAAQ,UAAU,CAAC,UAAU,IAAI,aAAa,MAAM,IAAI,CAAC,CAAC;CAEjG,OAAO,CAAC,GAAG,QAAQ,GAAI,MAAM,eAAe,UAAU,CAAE;AAC1D;;;;;;;;;;AAWA,eAAsB,aAAa,aAAkC,eAAiE;CACpI,IAAI,CAAC,iBAAiB,CAAC,aACrB,OAAO;CAGT,MAAM,cAAc,iBAAiB,YAAY;CAEjD,MAAM,WAAU,MADE,kBAAkB,WAAW,EAAA,CAC3B,aAAa,WAAW;CAE5C,IAAI,OAAO,YAAY,YACrB,OAAO;CAKT,OAAO,QAFe,UAAW,YAAY,WAAuC,CAAC,GAAG,aAE7D,CAAC;AAC9B"}
@@ -0,0 +1,202 @@
1
+ require("./rolldown-runtime-qbf5tadS.cjs");
2
+ let node_fs = require("node:fs");
3
+ let node_module = require("node:module");
4
+ let node_url = require("node:url");
5
+ let remeda = require("remeda");
6
+ //#region ../../internals/utils/src/casing.ts
7
+ /**
8
+ * Shared implementation for camelCase and PascalCase conversion.
9
+ * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)
10
+ * and capitalizes each word according to `pascal`.
11
+ *
12
+ * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.
13
+ */
14
+ function toCamelOrPascal(text, pascal) {
15
+ return text.trim().replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/(\d)([a-z])/g, "$1 $2").split(/[\s\-_./\\:]+/).filter(Boolean).map((word, i) => {
16
+ if (word.length > 1 && word === word.toUpperCase()) return word;
17
+ return (i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()) + word.slice(1);
18
+ }).join("").replace(/[^a-zA-Z0-9]/g, "");
19
+ }
20
+ /**
21
+ * Converts `text` to camelCase.
22
+ *
23
+ * @example Word boundaries
24
+ * `camelCase('hello-world') // 'helloWorld'`
25
+ *
26
+ * @example With a prefix
27
+ * `camelCase('tag', { prefix: 'create' }) // 'createTag'`
28
+ */
29
+ function camelCase(text, { prefix = "", suffix = "" } = {}) {
30
+ return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false);
31
+ }
32
+ //#endregion
33
+ //#region src/resolveConfig.ts
34
+ /**
35
+ * Imports a package, falling back to how the user's project would resolve it.
36
+ *
37
+ * `import()` resolves from this file, so a linked or globally installed Studio (`pnpm link`,
38
+ * `npm i -g`) only sees its own `node_modules` and misses the plugins installed next to the user's
39
+ * config. The retry resolves from `process.cwd()` instead.
40
+ */
41
+ async function importFromProject(packageName) {
42
+ try {
43
+ return await import(packageName);
44
+ } catch {
45
+ const resolved = (0, node_module.createRequire)((0, node_url.pathToFileURL)(`${process.cwd()}/`)).resolve(packageName);
46
+ const esm = resolved.replace(/\.cjs$/, ".js");
47
+ return await import((0, node_url.pathToFileURL)(esm !== resolved && (0, node_fs.existsSync)(esm) ? esm : resolved).href);
48
+ }
49
+ }
50
+ /**
51
+ * Strips the `@kubb/` scope from a plugin package name, matching the `name` convention Kubb
52
+ * plugin factories use internally.
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * toPluginName('@kubb/plugin-ts') // 'plugin-ts'
57
+ * ```
58
+ */
59
+ function toPluginName(packageName) {
60
+ return packageName.split("/").pop() ?? packageName;
61
+ }
62
+ /**
63
+ * Derives the conventional named export for a `@kubb/*` plugin package from its package name.
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * toExportName('@kubb/plugin-react-query') // 'pluginReactQuery'
68
+ * toExportName('@kubb/plugin-ts') // 'pluginTs'
69
+ * ```
70
+ */
71
+ function toExportName(packageName) {
72
+ return camelCase(toPluginName(packageName));
73
+ }
74
+ /**
75
+ * A `@kubb/plugin-*` package specifier. Nothing else may reach `import()`: only Kubb's own
76
+ * plugins are supported, so a payload naming anything else, a third-party package or a path, is
77
+ * refused before it can execute.
78
+ */
79
+ const KUBB_PLUGIN_SPECIFIER = /^@kubb\/plugin-[\w.-]+$/;
80
+ /**
81
+ * Whether `name` is a `@kubb/plugin-*` specifier. Exported so `configFile.ts` can refuse the same
82
+ * shape before printing a Studio-supplied plugin name into the config file's source text.
83
+ */
84
+ function isKubbPluginSpecifier(name) {
85
+ return KUBB_PLUGIN_SPECIFIER.test(name);
86
+ }
87
+ /**
88
+ * Dynamically imports a `@kubb/plugin-*` package and returns its factory function.
89
+ *
90
+ * Packages must be pre-installed in the Docker image at build time via the `KUBB_PACKAGES`
91
+ * build ARG, no runtime installation is possible in the distroless container.
92
+ *
93
+ * Resolution order: the camelCase named export the package name implies (e.g. `pluginTs`), then
94
+ * the default export.
95
+ *
96
+ * @throws if the package cannot be imported or exports no callable factory.
97
+ */
98
+ async function loadPluginFactory(packageName) {
99
+ if (!isKubbPluginSpecifier(packageName)) throw new Error(`Plugin "${packageName}" is not a @kubb/plugin-* package. Kubb Studio only supports Kubb's own plugins.`);
100
+ let mod;
101
+ try {
102
+ mod = await importFromProject(packageName);
103
+ } catch (cause) {
104
+ throw new Error(`Plugin "${packageName}" could not be loaded. Make sure it is installed: \`npm install ${packageName}\``, { cause });
105
+ }
106
+ const exportName = toExportName(packageName);
107
+ if (typeof mod[exportName] === "function") return mod[exportName];
108
+ if (typeof mod["default"] === "function") return mod["default"];
109
+ throw new Error(`Plugin "${packageName}" does not export a callable factory. Tried the named export "${exportName}" and "default".`);
110
+ }
111
+ /**
112
+ * Resolves each plugin entry by dynamically importing the `@kubb/plugin-*` package and
113
+ * calling its factory with the provided options.
114
+ *
115
+ * Packages must be pre-installed in the Docker image at build time, use the `KUBB_PACKAGES`
116
+ * build ARG to control which ones are available at runtime.
117
+ *
118
+ * @example
119
+ * ```ts
120
+ * { name: '@kubb/plugin-react-query', options: { output: { path: './hooks' } } }
121
+ * { name: '@kubb/plugin-ts', options: { output: { path: './types' } } }
122
+ * ```
123
+ */
124
+ async function resolvePlugins(plugins) {
125
+ return Promise.all(plugins.map(async ({ name, options }) => {
126
+ return (await loadPluginFactory(name))(options ?? {});
127
+ }));
128
+ }
129
+ /**
130
+ * Merges studio plugin options with disk config plugins.
131
+ * Studio takes priority: options from studio win over disk, and a plugin Studio explicitly
132
+ * disabled is dropped even when the disk config still lists it. Disk plugins without a studio
133
+ * counterpart are kept as-is. Studio plugins not present on disk are appended.
134
+ *
135
+ * For plugins present in both configs, the plugin is re-instantiated with merged options
136
+ * so that all internal closures correctly reference the merged values.
137
+ */
138
+ async function mergePlugins(diskPlugins, studioPlugins) {
139
+ const disabledNames = new Set((studioPlugins ?? []).filter((entry) => entry.disabled).map((entry) => toPluginName(entry.name)));
140
+ const activeDiskPlugins = disabledNames.size ? diskPlugins?.filter((plugin) => !disabledNames.has(plugin.name)) : diskPlugins;
141
+ const activeStudioPlugins = studioPlugins?.filter((entry) => !entry.disabled);
142
+ if (!activeDiskPlugins && !activeStudioPlugins?.length) return void 0;
143
+ if (!activeStudioPlugins?.length) return activeDiskPlugins;
144
+ if (!activeDiskPlugins) return resolvePlugins(activeStudioPlugins);
145
+ const studioEntryByName = new Map(activeStudioPlugins.map((entry) => [toPluginName(entry.name), entry]));
146
+ const diskNames = new Set(activeDiskPlugins.map((plugin) => plugin.name));
147
+ const merged = await Promise.all(activeDiskPlugins.map(async (diskPlugin) => {
148
+ const studioEntry = studioEntryByName.get(diskPlugin.name);
149
+ if (!studioEntry) return diskPlugin;
150
+ const options = (0, remeda.mergeDeep)(diskPlugin.options ?? {}, studioEntry.options ?? {});
151
+ const [resolved] = await resolvePlugins([{
152
+ name: studioEntry.name,
153
+ options
154
+ }]);
155
+ return resolved ?? diskPlugin;
156
+ }));
157
+ const studioOnly = activeStudioPlugins.filter((entry) => !diskNames.has(toPluginName(entry.name)));
158
+ return [...merged, ...await resolvePlugins(studioOnly)];
159
+ }
160
+ /**
161
+ * Merges Studio-provided adapter option overrides into the disk config's adapter.
162
+ *
163
+ * Adapter instances carry live functions (`parse`, `getImports`, ...) that can't survive
164
+ * JSON serialization over the WebSocket, so `studioOptions` is treated as an options patch
165
+ * rather than a replacement adapter. Re-invokes the same `@kubb/adapter-<name>` factory the
166
+ * disk config used, with the merged options, so the resulting instance has fresh closures
167
+ * over the merged values instead of a plain object missing `parse`.
168
+ */
169
+ async function mergeAdapter(diskAdapter, studioOptions) {
170
+ if (!studioOptions || !diskAdapter) return diskAdapter;
171
+ const packageName = `@kubb/adapter-${diskAdapter.name}`;
172
+ const factory = (await importFromProject(packageName))[toExportName(packageName)];
173
+ if (typeof factory !== "function") return diskAdapter;
174
+ return factory((0, remeda.mergeDeep)(diskAdapter.options ?? {}, studioOptions));
175
+ }
176
+ //#endregion
177
+ Object.defineProperty(exports, "isKubbPluginSpecifier", {
178
+ enumerable: true,
179
+ get: function() {
180
+ return isKubbPluginSpecifier;
181
+ }
182
+ });
183
+ Object.defineProperty(exports, "mergeAdapter", {
184
+ enumerable: true,
185
+ get: function() {
186
+ return mergeAdapter;
187
+ }
188
+ });
189
+ Object.defineProperty(exports, "mergePlugins", {
190
+ enumerable: true,
191
+ get: function() {
192
+ return mergePlugins;
193
+ }
194
+ });
195
+ Object.defineProperty(exports, "toExportName", {
196
+ enumerable: true,
197
+ get: function() {
198
+ return toExportName;
199
+ }
200
+ });
201
+
202
+ //# sourceMappingURL=resolveConfig-Ci-BVhN_.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveConfig-Ci-BVhN_.cjs","names":["createRequire","pathToFileURL","existsSync","mergeDeep"],"sources":["../../../internals/utils/src/casing.ts","../src/resolveConfig.ts"],"sourcesContent":["type Options = {\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n return text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/(\\d)([a-z])/g, '$1 $2')\n .split(/[\\s\\-_./\\\\:]+/)\n .filter(Boolean)\n .map((word, i) => {\n if (word.length > 1 && word === word.toUpperCase()) return word\n const head = i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()\n return head + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n/**\n * Converts `text` to camelCase.\n *\n * @example Word boundaries\n * `camelCase('hello-world') // 'helloWorld'`\n *\n * @example With a prefix\n * `camelCase('tag', { prefix: 'create' }) // 'createTag'`\n */\nexport function camelCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n *\n * @example Word boundaries\n * `pascalCase('hello-world') // 'HelloWorld'`\n *\n * @example With a suffix\n * `pascalCase('tag', { suffix: 'schema' }) // 'TagSchema'`\n */\nexport function pascalCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n","import { existsSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport { pathToFileURL } from 'node:url'\nimport type { Adapter, Plugin } from '@kubb/core'\nimport { camelCase } from '@internals/utils'\nimport { mergeDeep } from 'remeda'\nimport type { JSONKubbConfig } from './protocol/index.ts'\n\n/**\n * Turns the JSON config Studio sends back into live Kubb objects.\n *\n * A plugin or adapter instance carries closures (`parse`, `getImports`, ...) that cannot survive\n * JSON, so both sides pass options over the wire and the factory is re-invoked here with the merged\n * result. Only `@kubb/plugin-*` packages are resolved this way, so the reinstantiated factory is\n * always one Kubb ships, never an arbitrary module the payload names.\n */\n\ntype PluginFactory = (options: unknown) => Plugin\n\n/**\n * Imports a package, falling back to how the user's project would resolve it.\n *\n * `import()` resolves from this file, so a linked or globally installed Studio (`pnpm link`,\n * `npm i -g`) only sees its own `node_modules` and misses the plugins installed next to the user's\n * config. The retry resolves from `process.cwd()` instead.\n */\nasync function importFromProject(packageName: string): Promise<Record<string, unknown>> {\n try {\n return await import(packageName)\n } catch {\n const require = createRequire(pathToFileURL(`${process.cwd()}/`))\n // `require.resolve` picks the package's `require` condition, so prefer the ESM build sitting\n // next to it. Loading the CJS copy would pull in a second `@kubb/core` instance.\n const resolved = require.resolve(packageName)\n const esm = resolved.replace(/\\.cjs$/, '.js')\n\n return await import(pathToFileURL(esm !== resolved && existsSync(esm) ? esm : resolved).href)\n }\n}\n\n/**\n * Strips the `@kubb/` scope from a plugin package name, matching the `name` convention Kubb\n * plugin factories use internally.\n *\n * @example\n * ```ts\n * toPluginName('@kubb/plugin-ts') // 'plugin-ts'\n * ```\n */\nfunction toPluginName(packageName: string): string {\n return packageName.split('/').pop() ?? packageName\n}\n\n/**\n * Derives the conventional named export for a `@kubb/*` plugin package from its package name.\n *\n * @example\n * ```ts\n * toExportName('@kubb/plugin-react-query') // 'pluginReactQuery'\n * toExportName('@kubb/plugin-ts') // 'pluginTs'\n * ```\n */\nexport function toExportName(packageName: string): string {\n return camelCase(toPluginName(packageName))\n}\n\n/**\n * A `@kubb/plugin-*` package specifier. Nothing else may reach `import()`: only Kubb's own\n * plugins are supported, so a payload naming anything else, a third-party package or a path, is\n * refused before it can execute.\n */\nconst KUBB_PLUGIN_SPECIFIER = /^@kubb\\/plugin-[\\w.-]+$/\n\n/**\n * Whether `name` is a `@kubb/plugin-*` specifier. Exported so `configFile.ts` can refuse the same\n * shape before printing a Studio-supplied plugin name into the config file's source text.\n */\nexport function isKubbPluginSpecifier(name: string): boolean {\n return KUBB_PLUGIN_SPECIFIER.test(name)\n}\n\n/**\n * Dynamically imports a `@kubb/plugin-*` package and returns its factory function.\n *\n * Packages must be pre-installed in the Docker image at build time via the `KUBB_PACKAGES`\n * build ARG, no runtime installation is possible in the distroless container.\n *\n * Resolution order: the camelCase named export the package name implies (e.g. `pluginTs`), then\n * the default export.\n *\n * @throws if the package cannot be imported or exports no callable factory.\n */\nasync function loadPluginFactory(packageName: string): Promise<PluginFactory> {\n if (!isKubbPluginSpecifier(packageName)) {\n throw new Error(`Plugin \"${packageName}\" is not a @kubb/plugin-* package. Kubb Studio only supports Kubb's own plugins.`)\n }\n\n let mod: Record<string, unknown>\n try {\n mod = await importFromProject(packageName)\n } catch (cause) {\n throw new Error(`Plugin \"${packageName}\" could not be loaded. Make sure it is installed: \\`npm install ${packageName}\\``, { cause })\n }\n\n const exportName = toExportName(packageName)\n\n if (typeof mod[exportName] === 'function') return mod[exportName] as PluginFactory\n\n if (typeof mod['default'] === 'function') return mod['default'] as PluginFactory\n\n throw new Error(`Plugin \"${packageName}\" does not export a callable factory. Tried the named export \"${exportName}\" and \"default\".`)\n}\n\n/**\n * Resolves each plugin entry by dynamically importing the `@kubb/plugin-*` package and\n * calling its factory with the provided options.\n *\n * Packages must be pre-installed in the Docker image at build time, use the `KUBB_PACKAGES`\n * build ARG to control which ones are available at runtime.\n *\n * @example\n * ```ts\n * { name: '@kubb/plugin-react-query', options: { output: { path: './hooks' } } }\n * { name: '@kubb/plugin-ts', options: { output: { path: './types' } } }\n * ```\n */\nexport async function resolvePlugins(plugins: NonNullable<JSONKubbConfig['plugins']>): Promise<Array<Plugin>> {\n return Promise.all(\n plugins.map(async ({ name, options }) => {\n const factory = await loadPluginFactory(name)\n return factory(options ?? {}) as Plugin\n }),\n )\n}\n\n/**\n * Merges studio plugin options with disk config plugins.\n * Studio takes priority: options from studio win over disk, and a plugin Studio explicitly\n * disabled is dropped even when the disk config still lists it. Disk plugins without a studio\n * counterpart are kept as-is. Studio plugins not present on disk are appended.\n *\n * For plugins present in both configs, the plugin is re-instantiated with merged options\n * so that all internal closures correctly reference the merged values.\n */\nexport async function mergePlugins(\n diskPlugins: Array<Plugin> | undefined,\n studioPlugins: JSONKubbConfig['plugins'] | undefined,\n): Promise<Array<Plugin> | undefined> {\n // Matched on the package's base name rather than by instantiating first. Every Kubb plugin\n // factory returns exactly that (`@kubb/plugin-ts` → `plugin-ts`), enforced by the `satisfies` on\n // each factory's name.\n const disabledNames = new Set((studioPlugins ?? []).filter((entry) => entry.disabled).map((entry) => toPluginName(entry.name)))\n const activeDiskPlugins = disabledNames.size ? diskPlugins?.filter((plugin) => !disabledNames.has(plugin.name)) : diskPlugins\n const activeStudioPlugins = studioPlugins?.filter((entry) => !entry.disabled)\n\n if (!activeDiskPlugins && !activeStudioPlugins?.length) return undefined\n if (!activeStudioPlugins?.length) return activeDiskPlugins\n\n if (!activeDiskPlugins) return resolvePlugins(activeStudioPlugins)\n\n const studioEntryByName = new Map(activeStudioPlugins.map((entry) => [toPluginName(entry.name), entry] as const))\n const diskNames = new Set(activeDiskPlugins.map((plugin) => plugin.name))\n\n // Each plugin is instantiated once, with its final options. Resolving the whole payload first\n // just to read the names would build every overlapping plugin twice and discard the first.\n const merged = await Promise.all(\n activeDiskPlugins.map(async (diskPlugin) => {\n const studioEntry = studioEntryByName.get(diskPlugin.name)\n if (!studioEntry) return diskPlugin\n\n // Disk as base, studio overrides, then re-instantiate so the plugin's closures reference the\n // merged values. A plugin that never sets `options` (e.g. `@kubb/plugin-barrel`) leaves\n // `diskPlugin.options` undefined, which `mergeDeep` can't accept.\n const options = mergeDeep((diskPlugin.options as Record<string, unknown>) ?? {}, (studioEntry.options as Record<string, unknown>) ?? {})\n const [resolved] = await resolvePlugins([{ name: studioEntry.name, options }])\n\n return resolved ?? diskPlugin\n }),\n )\n\n const studioOnly = activeStudioPlugins.filter((entry) => !diskNames.has(toPluginName(entry.name)))\n\n return [...merged, ...(await resolvePlugins(studioOnly))]\n}\n\n/**\n * Merges Studio-provided adapter option overrides into the disk config's adapter.\n *\n * Adapter instances carry live functions (`parse`, `getImports`, ...) that can't survive\n * JSON serialization over the WebSocket, so `studioOptions` is treated as an options patch\n * rather than a replacement adapter. Re-invokes the same `@kubb/adapter-<name>` factory the\n * disk config used, with the merged options, so the resulting instance has fresh closures\n * over the merged values instead of a plain object missing `parse`.\n */\nexport async function mergeAdapter(diskAdapter: Adapter | undefined, studioOptions: object | undefined): Promise<Adapter | undefined> {\n if (!studioOptions || !diskAdapter) {\n return diskAdapter\n }\n\n const packageName = `@kubb/adapter-${diskAdapter.name}`\n const mod = await importFromProject(packageName)\n const factory = mod[toExportName(packageName)]\n\n if (typeof factory !== 'function') {\n return diskAdapter\n }\n\n const mergedOptions = mergeDeep((diskAdapter.options as Record<string, unknown>) ?? {}, studioOptions as Record<string, unknown>)\n\n return factory(mergedOptions) as Adapter\n}\n"],"mappings":";;;;;;;;;;;;;AAkBA,SAAS,gBAAgB,MAAc,QAAyB;CAC9D,OAAO,KACJ,KAAK,CAAC,CACN,QAAQ,qBAAqB,OAAO,CAAC,CACrC,QAAQ,yBAAyB,OAAO,CAAC,CACzC,QAAQ,gBAAgB,OAAO,CAAC,CAChC,MAAM,eAAe,CAAC,CACtB,OAAO,OAAO,CAAC,CACf,KAAK,MAAM,MAAM;EAChB,IAAI,KAAK,SAAS,KAAK,SAAS,KAAK,YAAY,GAAG,OAAO;EAE3D,QADa,MAAM,KAAK,CAAC,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,KAC9E,KAAK,MAAM,CAAC;CAC5B,CAAC,CAAC,CACD,KAAK,EAAE,CAAC,CACR,QAAQ,iBAAiB,EAAE;AAChC;;;;;;;;;;AAWA,SAAgB,UAAU,MAAc,EAAE,SAAS,IAAI,SAAS,OAAgB,CAAC,GAAW;CAC1F,OAAO,gBAAgB,GAAG,OAAO,GAAG,KAAK,GAAG,UAAU,KAAK;AAC7D;;;;;;;;;;ACpBA,eAAe,kBAAkB,aAAuD;CACtF,IAA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U,CAAE;AAC1D;;;;;;;;;;AAWA,eAAsB,aAAa,aAAkC,eAAiE;CACpI,IAAI,CAAC,iBAAiB,CAAC,aACrB,OAAO;CAGT,MAAM,cAAc,iBAAiB,YAAY;CAEjD,MAAM,WAAU,MADE,kBAAkB,WAAW,EAAA,CAC3B,aAAa,WAAW;CAE5C,IAAI,OAAO,YAAY,YACrB,OAAO;CAKT,OAAO,SAAA,GAFeA,OAAAA,UAAAA,CAAW,YAAY,WAAuC,CAAC,GAAG,aAE7D,CAAC;AAC9B"}
@@ -0,0 +1,9 @@
1
+ import "node:module";
2
+ //#region \0rolldown/runtime.js
3
+ var __defProp = Object.defineProperty;
4
+ var __name = (target, value) => __defProp(target, "name", {
5
+ value,
6
+ configurable: true
7
+ });
8
+ //#endregion
9
+ export { __name as t };
@@ -0,0 +1,38 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __name = (target, value) => __defProp(target, "name", {
5
+ value,
6
+ configurable: true
7
+ });
8
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
+ var __getOwnPropNames = Object.getOwnPropertyNames;
10
+ var __getProtoOf = Object.getPrototypeOf;
11
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
12
+ var __copyProps = (to, from, except, desc) => {
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
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+ //#endregion
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
+ });
package/package.json ADDED
@@ -0,0 +1,86 @@
1
+ {
2
+ "name": "@kubb/studio",
3
+ "version": "0.0.0-canary-20260903193839",
4
+ "description": "Kubb Studio client runtime. Connects a Kubb project to Kubb Studio over WebSocket and streams code generation events, shared by the `kubb studio` CLI command and the Docker agent.",
5
+ "keywords": [
6
+ "agent",
7
+ "codegen",
8
+ "kubb",
9
+ "openapi",
10
+ "studio",
11
+ "typescript",
12
+ "websocket"
13
+ ],
14
+ "homepage": "https://kubb.dev",
15
+ "license": "MIT",
16
+ "author": "stijnvanhulle",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/kubb-labs/kubb.git",
20
+ "directory": "packages/studio"
21
+ },
22
+ "funding": [
23
+ {
24
+ "type": "github",
25
+ "url": "https://github.com/sponsors/stijnvanhulle"
26
+ },
27
+ {
28
+ "type": "opencollective",
29
+ "url": "https://opencollective.com/kubb"
30
+ }
31
+ ],
32
+ "files": [
33
+ "dist",
34
+ "!/**/**.test.**",
35
+ "!/**/__tests__/**",
36
+ "!/**/__snapshots__/**"
37
+ ],
38
+ "type": "module",
39
+ "sideEffects": false,
40
+ "main": "./dist/index.cjs",
41
+ "module": "./dist/index.js",
42
+ "types": "./dist/index.d.ts",
43
+ "exports": {
44
+ ".": {
45
+ "types": "./dist/index.d.ts",
46
+ "import": "./dist/index.js",
47
+ "require": "./dist/index.cjs"
48
+ },
49
+ "./protocol": {
50
+ "types": "./dist/protocol.d.ts",
51
+ "import": "./dist/protocol.js",
52
+ "require": "./dist/protocol.cjs"
53
+ },
54
+ "./package.json": "./package.json"
55
+ },
56
+ "publishConfig": {
57
+ "access": "public",
58
+ "registry": "https://registry.npmjs.org/"
59
+ },
60
+ "dependencies": {
61
+ "magicast": "^0.5.4",
62
+ "ofetch": "^1.5.1",
63
+ "remeda": "^2.45.0",
64
+ "tinyexec": "^1.3.0",
65
+ "unstorage": "^1.17.5",
66
+ "ws": "^8.21.3",
67
+ "@kubb/core": "0.0.0-canary-20260903193839"
68
+ },
69
+ "devDependencies": {
70
+ "@types/ws": "^8.18.1",
71
+ "@kubb/adapter-oas": "0.0.0-canary-20260903193839",
72
+ "@internals/utils": "0.0.0-canary-20260903193839"
73
+ },
74
+ "engines": {
75
+ "node": ">=22"
76
+ },
77
+ "scripts": {
78
+ "build": "tsdown",
79
+ "clean": "node -e \"require('node:fs').rmSync('./dist', {recursive:true,force:true})\"",
80
+ "lint": "oxlint .",
81
+ "lint:fix": "oxlint --fix .",
82
+ "start": "tsdown --watch",
83
+ "test": "vitest --passWithNoTests",
84
+ "typecheck": "tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false"
85
+ }
86
+ }