unplugin-kubb 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/astro.d.cts +1 -1
- package/dist/astro.d.ts +1 -1
- package/dist/esbuild.d.cts +1 -1
- package/dist/esbuild.d.ts +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/nuxt.cjs.map +1 -1
- package/dist/nuxt.d.cts +1 -1
- package/dist/nuxt.d.ts +1 -1
- package/dist/nuxt.js.map +1 -1
- package/dist/rollup.d.cts +1 -1
- package/dist/rollup.d.ts +1 -1
- package/dist/rspack.d.cts +1 -1
- package/dist/rspack.d.ts +1 -1
- package/dist/src-Dn-CzqNK.js.map +1 -1
- package/dist/src-INEri0Ub.cjs.map +1 -1
- package/dist/{types-BbLZctbn.d.ts → types-Bt9ZCbPy.d.ts} +12 -126
- package/dist/{types-F_pPB4iq.d.cts → types-DpTGv8q2.d.cts} +12 -126
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/vite.d.cts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/webpack-D2VoiCsm.cjs.map +1 -1
- package/dist/webpack-gtaz7qKH.js.map +1 -1
- package/dist/webpack.d.cts +1 -1
- package/dist/webpack.d.ts +1 -1
- package/package.json +3 -6
- package/src/index.ts +2 -4
- package/src/nuxt.ts +1 -2
- package/src/webpack.ts +2 -4
package/dist/astro.d.cts
CHANGED
package/dist/astro.d.ts
CHANGED
package/dist/esbuild.d.cts
CHANGED
package/dist/esbuild.d.ts
CHANGED
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/nuxt.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nuxt.cjs","names":["vite","webpack"],"sources":["../src/nuxt.ts"],"sourcesContent":["import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from '@nuxt/kit'\nimport '@nuxt/schema'\n\nimport
|
|
1
|
+
{"version":3,"file":"nuxt.cjs","names":["vite","webpack"],"sources":["../src/nuxt.ts"],"sourcesContent":["import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from '@nuxt/kit'\nimport '@nuxt/schema'\n\nimport type { Options } from './types.ts'\nimport vite from './vite.ts'\nimport webpack from './webpack.ts'\n\nexport interface ModuleOptions extends Options {}\n\nexport default defineNuxtModule<ModuleOptions>({\n meta: {\n name: 'nuxt-unplugin-starter',\n configKey: 'unpluginStarter',\n },\n defaults: undefined,\n setup(options, _nuxt) {\n addVitePlugin(() => vite(options))\n addWebpackPlugin(() => webpack(options))\n\n // ...\n },\n})\n"],"mappings":";;;;;;;;AASA,oDAA+C;CAC7C,MAAM;EACJ,MAAM;EACN,WAAW;EACZ;CACD,UAAU;CACV,MAAM,SAAS,OAAO;AACpB,sCAAoBA,0BAAK,QAAQ,CAAC;AAClC,yCAAuBC,gCAAQ,QAAQ,CAAC;;CAI3C,CAAC"}
|
package/dist/nuxt.d.cts
CHANGED
package/dist/nuxt.d.ts
CHANGED
package/dist/nuxt.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nuxt.js","names":["vite","webpack"],"sources":["../src/nuxt.ts"],"sourcesContent":["import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from '@nuxt/kit'\nimport '@nuxt/schema'\n\nimport
|
|
1
|
+
{"version":3,"file":"nuxt.js","names":["vite","webpack"],"sources":["../src/nuxt.ts"],"sourcesContent":["import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from '@nuxt/kit'\nimport '@nuxt/schema'\n\nimport type { Options } from './types.ts'\nimport vite from './vite.ts'\nimport webpack from './webpack.ts'\n\nexport interface ModuleOptions extends Options {}\n\nexport default defineNuxtModule<ModuleOptions>({\n meta: {\n name: 'nuxt-unplugin-starter',\n configKey: 'unpluginStarter',\n },\n defaults: undefined,\n setup(options, _nuxt) {\n addVitePlugin(() => vite(options))\n addWebpackPlugin(() => webpack(options))\n\n // ...\n },\n})\n"],"mappings":";;;;;;;AASA,mBAAe,iBAAgC;CAC7C,MAAM;EACJ,MAAM;EACN,WAAW;EACZ;CACD,UAAU;CACV,MAAM,SAAS,OAAO;AACpB,sBAAoBA,aAAK,QAAQ,CAAC;AAClC,yBAAuBC,gBAAQ,QAAQ,CAAC;;CAI3C,CAAC"}
|
package/dist/rollup.d.cts
CHANGED
package/dist/rollup.d.ts
CHANGED
package/dist/rspack.d.cts
CHANGED
package/dist/rspack.d.ts
CHANGED
package/dist/src-Dn-CzqNK.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"src-Dn-CzqNK.js","names":["unpluginFactory: UnpluginFactory<Options | undefined>"],"sources":["../src/index.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"src-Dn-CzqNK.js","names":["unpluginFactory: UnpluginFactory<Options | undefined>"],"sources":["../src/index.ts"],"sourcesContent":["import type { Config } from '@kubb/core'\nimport { safeBuild } from '@kubb/core'\nimport { createLogger } from '@kubb/core/logger'\nimport type { UnpluginFactory } from 'unplugin'\nimport { createUnplugin } from 'unplugin'\nimport type { Options } from './types.ts'\n\nexport const unpluginFactory: UnpluginFactory<Options | undefined> = (options) => {\n const name = 'unplugin-kubb' as const\n const logger = createLogger({\n name,\n })\n\n return {\n name,\n enforce: 'pre',\n vite: {\n configResolved(config) {\n logger.on('start', (message: string) => {\n config.logger.info(`${name}: ${message}`)\n })\n\n logger.on('success', (message: string) => {\n config.logger.info(`${name}: ${message}`)\n })\n\n logger.on('warning', (message: string) => {\n config.logger.info(`${name}: ${message}`)\n })\n\n logger.on('error', (message: string) => {\n config.logger.info(`${name}: ${message}`)\n })\n },\n },\n\n async buildStart() {\n if (!options?.config) {\n throw new Error('Config is not set')\n }\n\n const { root: _root, ...userConfig } = options.config as Config\n\n logger.emit('start', 'Building')\n\n const { error } = await safeBuild({\n config: {\n root: process.cwd(),\n ...userConfig,\n output: {\n write: true,\n ...userConfig.output,\n },\n },\n logger,\n })\n\n if (error) {\n throw error\n }\n },\n }\n}\n\nexport const unplugin = /* #__PURE__ */ createUnplugin(unpluginFactory)\n\nexport default unplugin\n"],"mappings":";;;;;AAOA,MAAaA,mBAAyD,YAAY;CAChF,MAAM,OAAO;CACb,MAAM,SAAS,aAAa,EAC1B,MACD,CAAC;AAEF,QAAO;EACL;EACA,SAAS;EACT,MAAM,EACJ,eAAe,QAAQ;AACrB,UAAO,GAAG,UAAU,YAAoB;AACtC,WAAO,OAAO,KAAK,GAAG,KAAK,IAAI,UAAU;KACzC;AAEF,UAAO,GAAG,YAAY,YAAoB;AACxC,WAAO,OAAO,KAAK,GAAG,KAAK,IAAI,UAAU;KACzC;AAEF,UAAO,GAAG,YAAY,YAAoB;AACxC,WAAO,OAAO,KAAK,GAAG,KAAK,IAAI,UAAU;KACzC;AAEF,UAAO,GAAG,UAAU,YAAoB;AACtC,WAAO,OAAO,KAAK,GAAG,KAAK,IAAI,UAAU;KACzC;KAEL;EAED,MAAM,aAAa;AACjB,OAAI,CAAC,SAAS,OACZ,OAAM,IAAI,MAAM,oBAAoB;GAGtC,MAAM,EAAE,MAAM,MAAO,GAAG,eAAe,QAAQ;AAE/C,UAAO,KAAK,SAAS,WAAW;GAEhC,MAAM,EAAE,UAAU,MAAM,UAAU;IAChC,QAAQ;KACN,MAAM,QAAQ,KAAK;KACnB,GAAG;KACH,QAAQ;MACN,OAAO;MACP,GAAG,WAAW;MACf;KACF;IACD;IACD,CAAC;AAEF,OAAI,MACF,OAAM;;EAGX;;AAGH,MAAa,WAA2B,+BAAe,gBAAgB;AAEvE,kBAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"src-INEri0Ub.cjs","names":["unpluginFactory: UnpluginFactory<Options | undefined>","unplugin"],"sources":["../src/index.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"src-INEri0Ub.cjs","names":["unpluginFactory: UnpluginFactory<Options | undefined>","unplugin"],"sources":["../src/index.ts"],"sourcesContent":["import type { Config } from '@kubb/core'\nimport { safeBuild } from '@kubb/core'\nimport { createLogger } from '@kubb/core/logger'\nimport type { UnpluginFactory } from 'unplugin'\nimport { createUnplugin } from 'unplugin'\nimport type { Options } from './types.ts'\n\nexport const unpluginFactory: UnpluginFactory<Options | undefined> = (options) => {\n const name = 'unplugin-kubb' as const\n const logger = createLogger({\n name,\n })\n\n return {\n name,\n enforce: 'pre',\n vite: {\n configResolved(config) {\n logger.on('start', (message: string) => {\n config.logger.info(`${name}: ${message}`)\n })\n\n logger.on('success', (message: string) => {\n config.logger.info(`${name}: ${message}`)\n })\n\n logger.on('warning', (message: string) => {\n config.logger.info(`${name}: ${message}`)\n })\n\n logger.on('error', (message: string) => {\n config.logger.info(`${name}: ${message}`)\n })\n },\n },\n\n async buildStart() {\n if (!options?.config) {\n throw new Error('Config is not set')\n }\n\n const { root: _root, ...userConfig } = options.config as Config\n\n logger.emit('start', 'Building')\n\n const { error } = await safeBuild({\n config: {\n root: process.cwd(),\n ...userConfig,\n output: {\n write: true,\n ...userConfig.output,\n },\n },\n logger,\n })\n\n if (error) {\n throw error\n }\n },\n }\n}\n\nexport const unplugin = /* #__PURE__ */ createUnplugin(unpluginFactory)\n\nexport default unplugin\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAaA,mBAAyD,YAAY;CAChF,MAAM,OAAO;CACb,MAAM,8CAAsB,EAC1B,MACD,CAAC;AAEF,QAAO;EACL;EACA,SAAS;EACT,MAAM,EACJ,eAAe,QAAQ;AACrB,UAAO,GAAG,UAAU,YAAoB;AACtC,WAAO,OAAO,KAAK,GAAG,KAAK,IAAI,UAAU;KACzC;AAEF,UAAO,GAAG,YAAY,YAAoB;AACxC,WAAO,OAAO,KAAK,GAAG,KAAK,IAAI,UAAU;KACzC;AAEF,UAAO,GAAG,YAAY,YAAoB;AACxC,WAAO,OAAO,KAAK,GAAG,KAAK,IAAI,UAAU;KACzC;AAEF,UAAO,GAAG,UAAU,YAAoB;AACtC,WAAO,OAAO,KAAK,GAAG,KAAK,IAAI,UAAU;KACzC;KAEL;EAED,MAAM,aAAa;AACjB,OAAI,CAAC,SAAS,OACZ,OAAM,IAAI,MAAM,oBAAoB;GAGtC,MAAM,EAAE,MAAM,MAAO,GAAG,eAAe,QAAQ;AAE/C,UAAO,KAAK,SAAS,WAAW;GAEhC,MAAM,EAAE,UAAU,iCAAgB;IAChC,QAAQ;KACN,MAAM,QAAQ,KAAK;KACnB,GAAG;KACH,QAAQ;MACN,OAAO;MACP,GAAG,WAAW;MACf;KACF;IACD;IACD,CAAC;AAEF,OAAI,MACF,OAAM;;EAGX;;AAGH,MAAaC,aAA2B,6CAAe,gBAAgB;AAEvE,kBAAeA"}
|
|
@@ -1,121 +1,7 @@
|
|
|
1
|
+
import { KubbFile } from "@kubb/fabric-core/types";
|
|
1
2
|
import { Fabric, FileManager } from "@kubb/react-fabric";
|
|
2
3
|
import { ConsolaInstance, LogLevel } from "consola";
|
|
3
4
|
|
|
4
|
-
//#region ../core/src/fs/types.d.ts
|
|
5
|
-
type BasePath<T extends string = string> = `${T}/`;
|
|
6
|
-
type Import = {
|
|
7
|
-
/**
|
|
8
|
-
* Import name to be used
|
|
9
|
-
* @example ["useState"]
|
|
10
|
-
* @example "React"
|
|
11
|
-
*/
|
|
12
|
-
name: string | Array<string | {
|
|
13
|
-
propertyName: string;
|
|
14
|
-
name?: string;
|
|
15
|
-
}>;
|
|
16
|
-
/**
|
|
17
|
-
* Path for the import
|
|
18
|
-
* @example '@kubb/core'
|
|
19
|
-
*/
|
|
20
|
-
path: string;
|
|
21
|
-
/**
|
|
22
|
-
* Add `type` prefix to the import, this will result in: `import type { Type } from './path'`.
|
|
23
|
-
*/
|
|
24
|
-
isTypeOnly?: boolean;
|
|
25
|
-
isNameSpace?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* When root is set it will get the path with relative getRelativePath(root, path).
|
|
28
|
-
*/
|
|
29
|
-
root?: string;
|
|
30
|
-
};
|
|
31
|
-
type Source = {
|
|
32
|
-
name?: string;
|
|
33
|
-
value?: string;
|
|
34
|
-
isTypeOnly?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Has const or type 'export'
|
|
37
|
-
* @default false
|
|
38
|
-
*/
|
|
39
|
-
isExportable?: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* When set, barrel generation will add this
|
|
42
|
-
* @default false
|
|
43
|
-
*/
|
|
44
|
-
isIndexable?: boolean;
|
|
45
|
-
};
|
|
46
|
-
type Export = {
|
|
47
|
-
/**
|
|
48
|
-
* Export name to be used.
|
|
49
|
-
* @example ["useState"]
|
|
50
|
-
* @example "React"
|
|
51
|
-
*/
|
|
52
|
-
name?: string | Array<string>;
|
|
53
|
-
/**
|
|
54
|
-
* Path for the import.
|
|
55
|
-
* @example '@kubb/core'
|
|
56
|
-
*/
|
|
57
|
-
path: string;
|
|
58
|
-
/**
|
|
59
|
-
* Add `type` prefix to the export, this will result in: `export type { Type } from './path'`.
|
|
60
|
-
*/
|
|
61
|
-
isTypeOnly?: boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Make it possible to override the name, this will result in: `export * as aliasName from './path'`.
|
|
64
|
-
*/
|
|
65
|
-
asAlias?: boolean;
|
|
66
|
-
};
|
|
67
|
-
type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
|
|
68
|
-
type Mode = 'single' | 'split';
|
|
69
|
-
/**
|
|
70
|
-
* Name to be used to dynamicly create the baseName(based on input.path)
|
|
71
|
-
* Based on UNIX basename
|
|
72
|
-
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
73
|
-
*/
|
|
74
|
-
type BaseName = `${string}.${string}`;
|
|
75
|
-
/**
|
|
76
|
-
* Path will be full qualified path to a specified file
|
|
77
|
-
*/
|
|
78
|
-
type Path = string;
|
|
79
|
-
type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
|
|
80
|
-
type OptionalPath = Path | undefined | null;
|
|
81
|
-
type File<TMeta extends object = object> = {
|
|
82
|
-
/**
|
|
83
|
-
* Name to be used to create the path
|
|
84
|
-
* Based on UNIX basename, `${name}.extname`
|
|
85
|
-
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
86
|
-
*/
|
|
87
|
-
baseName: BaseName;
|
|
88
|
-
/**
|
|
89
|
-
* Path will be full qualified path to a specified file
|
|
90
|
-
*/
|
|
91
|
-
path: AdvancedPath<BaseName> | Path;
|
|
92
|
-
sources: Array<Source>;
|
|
93
|
-
imports?: Array<Import>;
|
|
94
|
-
exports?: Array<Export>;
|
|
95
|
-
/**
|
|
96
|
-
* Use extra meta, this is getting used to generate the barrel/index files.
|
|
97
|
-
*/
|
|
98
|
-
meta?: TMeta;
|
|
99
|
-
banner?: string;
|
|
100
|
-
footer?: string;
|
|
101
|
-
};
|
|
102
|
-
type ResolvedImport = Import;
|
|
103
|
-
type ResolvedExport = Export;
|
|
104
|
-
type ResolvedFile<TMeta extends object = object> = File<TMeta> & {
|
|
105
|
-
/**
|
|
106
|
-
* @default object-hash
|
|
107
|
-
*/
|
|
108
|
-
id: string;
|
|
109
|
-
/**
|
|
110
|
-
* Contains the first part of the baseName, generated based on baseName
|
|
111
|
-
* @link https://nodejs.org/api/path.html#pathformatpathobject
|
|
112
|
-
*/
|
|
113
|
-
name: string;
|
|
114
|
-
extname: Extname;
|
|
115
|
-
imports: Array<ResolvedImport>;
|
|
116
|
-
exports: Array<ResolvedExport>;
|
|
117
|
-
};
|
|
118
|
-
//#endregion
|
|
119
5
|
//#region ../core/src/utils/EventEmitter.d.ts
|
|
120
6
|
declare class EventEmitter<TEvents extends Record<string, any>> {
|
|
121
7
|
#private;
|
|
@@ -259,7 +145,7 @@ type Config<TInput = Input> = {
|
|
|
259
145
|
* Override the extension to the generated imports and exports, by default each plugin will add an extension
|
|
260
146
|
* @default { '.ts': '.ts'}
|
|
261
147
|
*/
|
|
262
|
-
extension?: Record<Extname, Extname | ''>;
|
|
148
|
+
extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
|
|
263
149
|
/**
|
|
264
150
|
* Specify how `index.ts` files should be created. You can also disable the generation of barrel files here. While each plugin has its own `barrelType` option, this setting controls the creation of the root barrel file, such as` src/gen/index.ts`.
|
|
265
151
|
* @default 'named'
|
|
@@ -390,7 +276,7 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
|
|
|
390
276
|
* @type hookFirst
|
|
391
277
|
* @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
|
|
392
278
|
*/
|
|
393
|
-
resolvePath?: (this: PluginContext<TOptions>, baseName: BaseName, mode?: Mode, options?: TOptions['resolvePathOptions']) => OptionalPath;
|
|
279
|
+
resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.OptionalPath;
|
|
394
280
|
/**
|
|
395
281
|
* Resolve to a name based on a string.
|
|
396
282
|
* Useful when converting to PascalCase or camelCase.
|
|
@@ -408,8 +294,8 @@ type PluginLifecycleHooks = keyof PluginLifecycle;
|
|
|
408
294
|
type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
|
|
409
295
|
type ResolvePathParams<TOptions = object> = {
|
|
410
296
|
pluginKey?: Plugin['key'];
|
|
411
|
-
baseName: BaseName;
|
|
412
|
-
mode?: Mode;
|
|
297
|
+
baseName: KubbFile.BaseName;
|
|
298
|
+
mode?: KubbFile.Mode;
|
|
413
299
|
/**
|
|
414
300
|
* Options to be passed to 'resolvePath' 3th parameter
|
|
415
301
|
*/
|
|
@@ -434,8 +320,8 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
|
|
|
434
320
|
*/
|
|
435
321
|
fileManager: FileManager;
|
|
436
322
|
pluginManager: PluginManager;
|
|
437
|
-
addFile: (...file: Array<File>) => Promise<Array<ResolvedFile>>;
|
|
438
|
-
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => OptionalPath;
|
|
323
|
+
addFile: (...file: Array<KubbFile.File>) => Promise<Array<KubbFile.ResolvedFile>>;
|
|
324
|
+
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => KubbFile.OptionalPath;
|
|
439
325
|
resolveName: (params: ResolveNameParams) => string;
|
|
440
326
|
logger: Logger;
|
|
441
327
|
/**
|
|
@@ -479,8 +365,8 @@ type Events = {
|
|
|
479
365
|
};
|
|
480
366
|
type GetFileProps<TOptions = object> = {
|
|
481
367
|
name: string;
|
|
482
|
-
mode?: Mode;
|
|
483
|
-
extname: Extname;
|
|
368
|
+
mode?: KubbFile.Mode;
|
|
369
|
+
extname: KubbFile.Extname;
|
|
484
370
|
pluginKey: Plugin['key'];
|
|
485
371
|
options?: TOptions;
|
|
486
372
|
};
|
|
@@ -499,10 +385,10 @@ declare class PluginManager {
|
|
|
499
385
|
extname,
|
|
500
386
|
pluginKey,
|
|
501
387
|
options
|
|
502
|
-
}: GetFileProps<TOptions>): File<{
|
|
388
|
+
}: GetFileProps<TOptions>): KubbFile.File<{
|
|
503
389
|
pluginKey: Plugin['key'];
|
|
504
390
|
}>;
|
|
505
|
-
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => OptionalPath;
|
|
391
|
+
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.OptionalPath;
|
|
506
392
|
resolveName: (params: ResolveNameParams) => string;
|
|
507
393
|
/**
|
|
508
394
|
* Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
|
|
@@ -603,4 +489,4 @@ type Options = {
|
|
|
603
489
|
};
|
|
604
490
|
//#endregion
|
|
605
491
|
export { Options as t };
|
|
606
|
-
//# sourceMappingURL=types-
|
|
492
|
+
//# sourceMappingURL=types-Bt9ZCbPy.d.ts.map
|
|
@@ -1,121 +1,7 @@
|
|
|
1
|
+
import { KubbFile } from "@kubb/fabric-core/types";
|
|
1
2
|
import { Fabric, FileManager } from "@kubb/react-fabric";
|
|
2
3
|
import { ConsolaInstance, LogLevel } from "consola";
|
|
3
4
|
|
|
4
|
-
//#region ../core/src/fs/types.d.ts
|
|
5
|
-
type BasePath<T extends string = string> = `${T}/`;
|
|
6
|
-
type Import = {
|
|
7
|
-
/**
|
|
8
|
-
* Import name to be used
|
|
9
|
-
* @example ["useState"]
|
|
10
|
-
* @example "React"
|
|
11
|
-
*/
|
|
12
|
-
name: string | Array<string | {
|
|
13
|
-
propertyName: string;
|
|
14
|
-
name?: string;
|
|
15
|
-
}>;
|
|
16
|
-
/**
|
|
17
|
-
* Path for the import
|
|
18
|
-
* @example '@kubb/core'
|
|
19
|
-
*/
|
|
20
|
-
path: string;
|
|
21
|
-
/**
|
|
22
|
-
* Add `type` prefix to the import, this will result in: `import type { Type } from './path'`.
|
|
23
|
-
*/
|
|
24
|
-
isTypeOnly?: boolean;
|
|
25
|
-
isNameSpace?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* When root is set it will get the path with relative getRelativePath(root, path).
|
|
28
|
-
*/
|
|
29
|
-
root?: string;
|
|
30
|
-
};
|
|
31
|
-
type Source = {
|
|
32
|
-
name?: string;
|
|
33
|
-
value?: string;
|
|
34
|
-
isTypeOnly?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Has const or type 'export'
|
|
37
|
-
* @default false
|
|
38
|
-
*/
|
|
39
|
-
isExportable?: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* When set, barrel generation will add this
|
|
42
|
-
* @default false
|
|
43
|
-
*/
|
|
44
|
-
isIndexable?: boolean;
|
|
45
|
-
};
|
|
46
|
-
type Export = {
|
|
47
|
-
/**
|
|
48
|
-
* Export name to be used.
|
|
49
|
-
* @example ["useState"]
|
|
50
|
-
* @example "React"
|
|
51
|
-
*/
|
|
52
|
-
name?: string | Array<string>;
|
|
53
|
-
/**
|
|
54
|
-
* Path for the import.
|
|
55
|
-
* @example '@kubb/core'
|
|
56
|
-
*/
|
|
57
|
-
path: string;
|
|
58
|
-
/**
|
|
59
|
-
* Add `type` prefix to the export, this will result in: `export type { Type } from './path'`.
|
|
60
|
-
*/
|
|
61
|
-
isTypeOnly?: boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Make it possible to override the name, this will result in: `export * as aliasName from './path'`.
|
|
64
|
-
*/
|
|
65
|
-
asAlias?: boolean;
|
|
66
|
-
};
|
|
67
|
-
type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
|
|
68
|
-
type Mode = 'single' | 'split';
|
|
69
|
-
/**
|
|
70
|
-
* Name to be used to dynamicly create the baseName(based on input.path)
|
|
71
|
-
* Based on UNIX basename
|
|
72
|
-
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
73
|
-
*/
|
|
74
|
-
type BaseName = `${string}.${string}`;
|
|
75
|
-
/**
|
|
76
|
-
* Path will be full qualified path to a specified file
|
|
77
|
-
*/
|
|
78
|
-
type Path = string;
|
|
79
|
-
type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
|
|
80
|
-
type OptionalPath = Path | undefined | null;
|
|
81
|
-
type File<TMeta extends object = object> = {
|
|
82
|
-
/**
|
|
83
|
-
* Name to be used to create the path
|
|
84
|
-
* Based on UNIX basename, `${name}.extname`
|
|
85
|
-
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
86
|
-
*/
|
|
87
|
-
baseName: BaseName;
|
|
88
|
-
/**
|
|
89
|
-
* Path will be full qualified path to a specified file
|
|
90
|
-
*/
|
|
91
|
-
path: AdvancedPath<BaseName> | Path;
|
|
92
|
-
sources: Array<Source>;
|
|
93
|
-
imports?: Array<Import>;
|
|
94
|
-
exports?: Array<Export>;
|
|
95
|
-
/**
|
|
96
|
-
* Use extra meta, this is getting used to generate the barrel/index files.
|
|
97
|
-
*/
|
|
98
|
-
meta?: TMeta;
|
|
99
|
-
banner?: string;
|
|
100
|
-
footer?: string;
|
|
101
|
-
};
|
|
102
|
-
type ResolvedImport = Import;
|
|
103
|
-
type ResolvedExport = Export;
|
|
104
|
-
type ResolvedFile<TMeta extends object = object> = File<TMeta> & {
|
|
105
|
-
/**
|
|
106
|
-
* @default object-hash
|
|
107
|
-
*/
|
|
108
|
-
id: string;
|
|
109
|
-
/**
|
|
110
|
-
* Contains the first part of the baseName, generated based on baseName
|
|
111
|
-
* @link https://nodejs.org/api/path.html#pathformatpathobject
|
|
112
|
-
*/
|
|
113
|
-
name: string;
|
|
114
|
-
extname: Extname;
|
|
115
|
-
imports: Array<ResolvedImport>;
|
|
116
|
-
exports: Array<ResolvedExport>;
|
|
117
|
-
};
|
|
118
|
-
//#endregion
|
|
119
5
|
//#region ../core/src/utils/EventEmitter.d.ts
|
|
120
6
|
declare class EventEmitter<TEvents extends Record<string, any>> {
|
|
121
7
|
#private;
|
|
@@ -259,7 +145,7 @@ type Config<TInput = Input> = {
|
|
|
259
145
|
* Override the extension to the generated imports and exports, by default each plugin will add an extension
|
|
260
146
|
* @default { '.ts': '.ts'}
|
|
261
147
|
*/
|
|
262
|
-
extension?: Record<Extname, Extname | ''>;
|
|
148
|
+
extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
|
|
263
149
|
/**
|
|
264
150
|
* Specify how `index.ts` files should be created. You can also disable the generation of barrel files here. While each plugin has its own `barrelType` option, this setting controls the creation of the root barrel file, such as` src/gen/index.ts`.
|
|
265
151
|
* @default 'named'
|
|
@@ -390,7 +276,7 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
|
|
|
390
276
|
* @type hookFirst
|
|
391
277
|
* @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
|
|
392
278
|
*/
|
|
393
|
-
resolvePath?: (this: PluginContext<TOptions>, baseName: BaseName, mode?: Mode, options?: TOptions['resolvePathOptions']) => OptionalPath;
|
|
279
|
+
resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.OptionalPath;
|
|
394
280
|
/**
|
|
395
281
|
* Resolve to a name based on a string.
|
|
396
282
|
* Useful when converting to PascalCase or camelCase.
|
|
@@ -408,8 +294,8 @@ type PluginLifecycleHooks = keyof PluginLifecycle;
|
|
|
408
294
|
type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
|
|
409
295
|
type ResolvePathParams<TOptions = object> = {
|
|
410
296
|
pluginKey?: Plugin['key'];
|
|
411
|
-
baseName: BaseName;
|
|
412
|
-
mode?: Mode;
|
|
297
|
+
baseName: KubbFile.BaseName;
|
|
298
|
+
mode?: KubbFile.Mode;
|
|
413
299
|
/**
|
|
414
300
|
* Options to be passed to 'resolvePath' 3th parameter
|
|
415
301
|
*/
|
|
@@ -434,8 +320,8 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
|
|
|
434
320
|
*/
|
|
435
321
|
fileManager: FileManager;
|
|
436
322
|
pluginManager: PluginManager;
|
|
437
|
-
addFile: (...file: Array<File>) => Promise<Array<ResolvedFile>>;
|
|
438
|
-
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => OptionalPath;
|
|
323
|
+
addFile: (...file: Array<KubbFile.File>) => Promise<Array<KubbFile.ResolvedFile>>;
|
|
324
|
+
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => KubbFile.OptionalPath;
|
|
439
325
|
resolveName: (params: ResolveNameParams) => string;
|
|
440
326
|
logger: Logger;
|
|
441
327
|
/**
|
|
@@ -479,8 +365,8 @@ type Events = {
|
|
|
479
365
|
};
|
|
480
366
|
type GetFileProps<TOptions = object> = {
|
|
481
367
|
name: string;
|
|
482
|
-
mode?: Mode;
|
|
483
|
-
extname: Extname;
|
|
368
|
+
mode?: KubbFile.Mode;
|
|
369
|
+
extname: KubbFile.Extname;
|
|
484
370
|
pluginKey: Plugin['key'];
|
|
485
371
|
options?: TOptions;
|
|
486
372
|
};
|
|
@@ -499,10 +385,10 @@ declare class PluginManager {
|
|
|
499
385
|
extname,
|
|
500
386
|
pluginKey,
|
|
501
387
|
options
|
|
502
|
-
}: GetFileProps<TOptions>): File<{
|
|
388
|
+
}: GetFileProps<TOptions>): KubbFile.File<{
|
|
503
389
|
pluginKey: Plugin['key'];
|
|
504
390
|
}>;
|
|
505
|
-
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => OptionalPath;
|
|
391
|
+
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.OptionalPath;
|
|
506
392
|
resolveName: (params: ResolveNameParams) => string;
|
|
507
393
|
/**
|
|
508
394
|
* Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
|
|
@@ -603,4 +489,4 @@ type Options = {
|
|
|
603
489
|
};
|
|
604
490
|
//#endregion
|
|
605
491
|
export { Options as t };
|
|
606
|
-
//# sourceMappingURL=types-
|
|
492
|
+
//# sourceMappingURL=types-DpTGv8q2.d.cts.map
|
package/dist/types.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Options } from "./types-
|
|
1
|
+
import { t as Options } from "./types-DpTGv8q2.cjs";
|
|
2
2
|
export { Options };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Options } from "./types-
|
|
1
|
+
import { t as Options } from "./types-Bt9ZCbPy.js";
|
|
2
2
|
export { Options };
|
package/dist/vite.d.cts
CHANGED
package/dist/vite.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack-D2VoiCsm.cjs","names":["unpluginFactory"],"sources":["../src/webpack.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"webpack-D2VoiCsm.cjs","names":["unpluginFactory"],"sources":["../src/webpack.ts"],"sourcesContent":["import type { UnpluginFactoryOutput } from 'unplugin'\nimport { createWebpackPlugin } from 'unplugin'\nimport type { WebpackPluginInstance } from 'webpack'\nimport { unpluginFactory } from './index.ts'\nimport type { Options } from './types.ts'\n\n// resolves issue for: The inferred type of 'default' cannot be named without a reference to 'node_modules/webpack'. This is likely not portable. A type annotation is necessary.\nexport default createWebpackPlugin(unpluginFactory) as unknown as UnpluginFactoryOutput<Options, WebpackPluginInstance>\n"],"mappings":";;;;;AAOA,wDAAmCA,4BAAgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack-gtaz7qKH.js","names":[],"sources":["../src/webpack.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"webpack-gtaz7qKH.js","names":[],"sources":["../src/webpack.ts"],"sourcesContent":["import type { UnpluginFactoryOutput } from 'unplugin'\nimport { createWebpackPlugin } from 'unplugin'\nimport type { WebpackPluginInstance } from 'webpack'\nimport { unpluginFactory } from './index.ts'\nimport type { Options } from './types.ts'\n\n// resolves issue for: The inferred type of 'default' cannot be named without a reference to 'node_modules/webpack'. This is likely not portable. A type annotation is necessary.\nexport default createWebpackPlugin(unpluginFactory) as unknown as UnpluginFactoryOutput<Options, WebpackPluginInstance>\n"],"mappings":";;;;AAOA,sBAAe,oBAAoB,gBAAgB"}
|
package/dist/webpack.d.cts
CHANGED
package/dist/webpack.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unplugin-kubb",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Unplugin for Kubb",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"unplugin",
|
|
@@ -87,14 +87,11 @@
|
|
|
87
87
|
"devDependencies": {
|
|
88
88
|
"@nuxt/kit": "^3.20.0",
|
|
89
89
|
"@nuxt/schema": "^3.20.0",
|
|
90
|
-
"
|
|
91
|
-
"rimraf": "^6.0.1",
|
|
90
|
+
"rimraf": "^6.1.0",
|
|
92
91
|
"rollup": "^4.52.5",
|
|
93
|
-
"tsdown": "^0.15.11",
|
|
94
|
-
"typescript": "^5.9.3",
|
|
95
92
|
"vite": "^6.4.1",
|
|
96
93
|
"webpack": "^5.102.1",
|
|
97
|
-
"@kubb/core": "4.
|
|
94
|
+
"@kubb/core": "4.5.0"
|
|
98
95
|
},
|
|
99
96
|
"peerDependencies": {
|
|
100
97
|
"@kubb/core": "^4.0.0",
|
package/src/index.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
+
import type { Config } from '@kubb/core'
|
|
1
2
|
import { safeBuild } from '@kubb/core'
|
|
2
3
|
import { createLogger } from '@kubb/core/logger'
|
|
3
|
-
|
|
4
|
-
import { createUnplugin } from 'unplugin'
|
|
5
|
-
|
|
6
|
-
import type { Config } from '@kubb/core'
|
|
7
4
|
import type { UnpluginFactory } from 'unplugin'
|
|
5
|
+
import { createUnplugin } from 'unplugin'
|
|
8
6
|
import type { Options } from './types.ts'
|
|
9
7
|
|
|
10
8
|
export const unpluginFactory: UnpluginFactory<Options | undefined> = (options) => {
|
package/src/nuxt.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from '@nuxt/kit'
|
|
2
2
|
import '@nuxt/schema'
|
|
3
3
|
|
|
4
|
+
import type { Options } from './types.ts'
|
|
4
5
|
import vite from './vite.ts'
|
|
5
6
|
import webpack from './webpack.ts'
|
|
6
7
|
|
|
7
|
-
import type { Options } from './types.ts'
|
|
8
|
-
|
|
9
8
|
export interface ModuleOptions extends Options {}
|
|
10
9
|
|
|
11
10
|
export default defineNuxtModule<ModuleOptions>({
|
package/src/webpack.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { createWebpackPlugin } from 'unplugin'
|
|
2
|
-
|
|
3
|
-
import { unpluginFactory } from './index.ts'
|
|
4
|
-
|
|
5
1
|
import type { UnpluginFactoryOutput } from 'unplugin'
|
|
2
|
+
import { createWebpackPlugin } from 'unplugin'
|
|
6
3
|
import type { WebpackPluginInstance } from 'webpack'
|
|
4
|
+
import { unpluginFactory } from './index.ts'
|
|
7
5
|
import type { Options } from './types.ts'
|
|
8
6
|
|
|
9
7
|
// resolves issue for: The inferred type of 'default' cannot be named without a reference to 'node_modules/webpack'. This is likely not portable. A type annotation is necessary.
|