@kubb/core 3.10.11 → 3.10.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-43SGNV6Q.cjs → chunk-4Y54TK73.cjs} +296 -313
- package/dist/chunk-4Y54TK73.cjs.map +1 -0
- package/dist/{chunk-GB7SMQO5.cjs → chunk-DFVR26S3.cjs} +13 -13
- package/dist/{chunk-GB7SMQO5.cjs.map → chunk-DFVR26S3.cjs.map} +1 -1
- package/dist/{chunk-XMAFJGOG.cjs → chunk-DYN65P3T.cjs} +8 -8
- package/dist/{chunk-XMAFJGOG.cjs.map → chunk-DYN65P3T.cjs.map} +1 -1
- package/dist/{chunk-7TZ5IOVL.js → chunk-F5IHVBMD.js} +9 -9
- package/dist/{chunk-7TZ5IOVL.js.map → chunk-F5IHVBMD.js.map} +1 -1
- package/dist/{chunk-5ENRRZRW.cjs → chunk-H7GP5BQJ.cjs} +4 -4
- package/dist/chunk-H7GP5BQJ.cjs.map +1 -0
- package/dist/{chunk-RMUG7S5Y.js → chunk-PNGIYL5L.js} +8 -23
- package/dist/chunk-PNGIYL5L.js.map +1 -0
- package/dist/{chunk-533OTQHD.js → chunk-RM6742YK.js} +3 -3
- package/dist/{chunk-533OTQHD.js.map → chunk-RM6742YK.js.map} +1 -1
- package/dist/{chunk-56PMPT4L.cjs → chunk-ZZEKLURQ.cjs} +17 -17
- package/dist/{chunk-56PMPT4L.cjs.map → chunk-ZZEKLURQ.cjs.map} +1 -1
- package/dist/fs.cjs +9 -9
- package/dist/fs.js +1 -1
- package/dist/index.cjs +42 -42
- package/dist/index.js +8 -8
- package/dist/logger.cjs +7 -7
- package/dist/logger.js +2 -2
- package/dist/mocks.cjs +10 -10
- package/dist/mocks.js +3 -3
- package/dist/{prompt-UVNS6X7J.js → prompt-ELTHGQK6.js} +6 -5
- package/dist/prompt-ELTHGQK6.js.map +1 -0
- package/dist/{prompt-BPFJQVHQ.cjs → prompt-HR6NQYCR.cjs} +4 -4
- package/dist/{prompt-BPFJQVHQ.cjs.map → prompt-HR6NQYCR.cjs.map} +1 -1
- package/dist/transformers.cjs +22 -22
- package/dist/utils.cjs +19 -19
- package/dist/utils.js +2 -2
- package/package.json +7 -7
- package/src/FileManager.ts +6 -31
- package/dist/chunk-43SGNV6Q.cjs.map +0 -1
- package/dist/chunk-5ENRRZRW.cjs.map +0 -1
- package/dist/chunk-RMUG7S5Y.js.map +0 -1
- package/dist/prompt-UVNS6X7J.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkH7GP5BQJ_cjs = require('./chunk-H7GP5BQJ.cjs');
|
|
4
4
|
var fs3 = require('fs-extra');
|
|
5
5
|
var path = require('path');
|
|
6
6
|
var jsRuntime = require('js-runtime');
|
|
@@ -10,16 +10,16 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
10
10
|
var fs3__default = /*#__PURE__*/_interopDefault(fs3);
|
|
11
11
|
|
|
12
12
|
// src/fs/index.ts
|
|
13
|
-
|
|
13
|
+
chunkH7GP5BQJ_cjs.init_cjs_shims();
|
|
14
14
|
|
|
15
15
|
// src/fs/clean.ts
|
|
16
|
-
|
|
16
|
+
chunkH7GP5BQJ_cjs.init_cjs_shims();
|
|
17
17
|
async function clean(path) {
|
|
18
18
|
return fs3__default.default.remove(path);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
// src/fs/read.ts
|
|
22
|
-
|
|
22
|
+
chunkH7GP5BQJ_cjs.init_cjs_shims();
|
|
23
23
|
function slash(path$1, platform = "linux") {
|
|
24
24
|
const isWindowsPath = /^\\\\\?\\/.test(path$1);
|
|
25
25
|
const normalizedPath = path.normalize(path$1);
|
|
@@ -70,7 +70,7 @@ function readSync(path) {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
// src/fs/write.ts
|
|
73
|
-
|
|
73
|
+
chunkH7GP5BQJ_cjs.init_cjs_shims();
|
|
74
74
|
var writer = jsRuntime.switcher(
|
|
75
75
|
{
|
|
76
76
|
node: async (path$1, data, { sanity }) => {
|
|
@@ -137,7 +137,7 @@ async function write(path, data, options = {}) {
|
|
|
137
137
|
|
|
138
138
|
// src/fs/types.ts
|
|
139
139
|
var types_exports = {};
|
|
140
|
-
|
|
140
|
+
chunkH7GP5BQJ_cjs.init_cjs_shims();
|
|
141
141
|
|
|
142
142
|
// src/fs/index.ts
|
|
143
143
|
function trimExtName(text) {
|
|
@@ -151,5 +151,5 @@ exports.readSync = readSync;
|
|
|
151
151
|
exports.trimExtName = trimExtName;
|
|
152
152
|
exports.types_exports = types_exports;
|
|
153
153
|
exports.write = write;
|
|
154
|
-
//# sourceMappingURL=chunk-
|
|
155
|
-
//# sourceMappingURL=chunk-
|
|
154
|
+
//# sourceMappingURL=chunk-DYN65P3T.cjs.map
|
|
155
|
+
//# sourceMappingURL=chunk-DYN65P3T.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/fs/index.ts","../src/fs/clean.ts","../src/fs/read.ts","../src/fs/write.ts","../src/fs/types.ts"],"names":["init_cjs_shims","fs","path","normalize","relative","switcher","resolve"],"mappings":";;;;;;;;;;;;AAAAA,gCAAA,EAAA;;;ACAAA,gCAAA,EAAA;AAEA,eAAsB,MAAM,IAA6B,EAAA;AACvD,EAAO,OAAAC,oBAAA,CAAG,OAAO,IAAI,CAAA;AACvB;;;ACJAD,gCAAA,EAAA;AAKA,SAAS,KAAA,CAAME,MAAc,EAAA,QAAA,GAAwC,OAAS,EAAA;AAC5E,EAAM,MAAA,aAAA,GAAgB,WAAY,CAAA,IAAA,CAAKA,MAAI,CAAA;AAC3C,EAAM,MAAA,cAAA,GAAiBC,eAAUD,MAAI,CAAA;AAErC,EAAI,IAAA,CAAC,SAAS,KAAK,CAAA,CAAE,SAAS,QAAQ,CAAA,IAAK,CAAC,aAAe,EAAA;AAEzD,IAAA,OAAO,eA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,CAAK,OAAQ,CAAA,WAAA,EAAa,EAAE,CAAA;AACrC","file":"chunk-XMAFJGOG.cjs","sourcesContent":["export { clean } from './clean.ts'\nexport { getRelativePath, read, readSync } from './read.ts'\nexport { write } from './write.ts'\n\nexport function trimExtName(text: string): string {\n return text.replace(/\\.[^/.]+$/, '')\n}\n\nexport * as KubbFile from './types.ts'\n","import fs from 'fs-extra'\n\nexport async function clean(path: string): Promise<void> {\n return fs.remove(path)\n}\n","import { normalize, relative } from 'node:path'\n\nimport fs from 'fs-extra'\nimport { switcher } from 'js-runtime'\n\nfunction slash(path: string, platform: 'windows' | 'mac' | 'linux' = 'linux') {\n const isWindowsPath = /^\\\\\\\\\\?\\\\/.test(path)\n const normalizedPath = normalize(path)\n\n if (['linux', 'mac'].includes(platform) && !isWindowsPath) {\n // linux and mac\n return normalizedPath.replaceAll(/\\\\/g, '/').replace('../', '')\n }\n\n // windows\n return normalizedPath.replaceAll(/\\\\/g, '/').replace('../', '')\n}\n\nexport function getRelativePath(rootDir?: string | null, filePath?: string | null, platform: 'windows' | 'mac' | 'linux' = 'linux'): string {\n if (!rootDir || !filePath) {\n throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ''} ${filePath || ''}`)\n }\n\n const relativePath = relative(rootDir, filePath)\n\n // On Windows, paths are separated with a \"\\\"\n // However, web browsers use \"/\" no matter the platform\n const slashedPath = slash(relativePath, platform)\n\n if (slashedPath.startsWith('../')) {\n return slashedPath\n }\n\n return `./${slashedPath}`\n}\n\nconst reader = switcher(\n {\n node: async (path: string) => {\n return fs.readFile(path, { encoding: 'utf8' })\n },\n bun: async (path: string) => {\n const file = Bun.file(path)\n\n return file.text()\n },\n },\n 'node',\n)\n\nconst syncReader = switcher(\n {\n node: (path: string) => {\n return fs.readFileSync(path, { encoding: 'utf8' })\n },\n bun: () => {\n throw new Error('Bun cannot read sync')\n },\n },\n 'node',\n)\n\nexport async function read(path: string): Promise<string> {\n return reader(path)\n}\n\nexport function readSync(path: string): string {\n return syncReader(path)\n}\n","import { resolve } from 'node:path'\n\nimport fs from 'fs-extra'\nimport { switcher } from 'js-runtime'\n\ntype Options = { sanity?: boolean }\n\nconst writer = switcher(\n {\n node: async (path: string, data: string, { sanity }: Options) => {\n try {\n const oldContent = await fs.readFile(resolve(path), {\n encoding: 'utf-8',\n })\n if (oldContent?.toString() === data?.toString()) {\n return\n }\n } catch (_err) {\n /* empty */\n }\n\n await fs.outputFile(resolve(path), data, { encoding: 'utf-8' })\n\n if (sanity) {\n const savedData = await fs.readFile(resolve(path), {\n encoding: 'utf-8',\n })\n\n if (savedData?.toString() !== data?.toString()) {\n throw new Error(`Sanity check failed for ${path}\\n\\nData[${data.length}]:\\n${data}\\n\\nSaved[${savedData.length}]:\\n${savedData}\\n`)\n }\n\n return savedData\n }\n\n return data\n },\n bun: async (path: string, data: string, { sanity }: Options) => {\n try {\n await Bun.write(resolve(path), data)\n\n if (sanity) {\n const file = Bun.file(resolve(path))\n const savedData = await file.text()\n\n if (savedData?.toString() !== data?.toString()) {\n throw new Error(`Sanity check failed for ${path}\\n\\nData[${path.length}]:\\n${path}\\n\\nSaved[${savedData.length}]:\\n${savedData}\\n`)\n }\n\n return savedData\n }\n\n return data\n } catch (e) {\n console.error(e)\n }\n },\n },\n 'node',\n)\n\nexport async function write(path: string, data: string, options: Options = {}): Promise<string | undefined> {\n if (data.trim() === '') {\n return undefined\n }\n return writer(path, data.trim(), options)\n}\n","type BasePath<T extends string = string> = `${T}/`\n\nexport type Import = {\n /**\n * Import name to be used\n * @example [\"useState\"]\n * @example \"React\"\n */\n name:\n | string\n | Array<\n | string\n | {\n propertyName: string\n name?: string\n }\n >\n /**\n * Path for the import\n * @example '@kubb/core'\n */\n path: string\n /**\n * Add `type` prefix to the import, this will result in: `import type { Type } from './path'`.\n */\n isTypeOnly?: boolean\n\n isNameSpace?: boolean\n /**\n * When root is set it will get the path with relative getRelativePath(root, path).\n */\n root?: string\n}\n\nexport type Source = {\n name?: string\n value?: string\n isTypeOnly?: boolean\n /**\n * Has const or type 'export'\n * @default false\n */\n isExportable?: boolean\n /**\n * When set, barrel generation will add this\n * @default false\n */\n isIndexable?: boolean\n}\n\nexport type Export = {\n /**\n * Export name to be used.\n * @example [\"useState\"]\n * @example \"React\"\n */\n name?: string | Array<string>\n /**\n * Path for the import.\n * @example '@kubb/core'\n */\n path: string\n /**\n * Add `type` prefix to the export, this will result in: `export type { Type } from './path'`.\n */\n isTypeOnly?: boolean\n /**\n * Make it possible to override the name, this will result in: `export * as aliasName from './path'`.\n */\n asAlias?: boolean\n}\n\nexport type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`\n\nexport type Mode = 'single' | 'split'\n\n/**\n * Name to be used to dynamicly create the baseName(based on input.path)\n * Based on UNIX basename\n * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix\n */\nexport type BaseName = `${string}.${string}`\n\n/**\n * Path will be full qualified path to a specified file\n */\nexport type Path = string\n\nexport type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`\n\nexport type OptionalPath = Path | undefined | null\n\nexport type File<TMeta extends object = object> = {\n /**\n * Name to be used to create the path\n * Based on UNIX basename, `${name}.extname`\n * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix\n */\n baseName: BaseName\n /**\n * Path will be full qualified path to a specified file\n */\n path: AdvancedPath<BaseName> | Path\n sources: Array<Source>\n imports?: Array<Import>\n exports?: Array<Export>\n /**\n * This will call fileManager.add instead of fileManager.addOrAppend, adding the source when the files already exists\n * This will also ignore the combinefiles utils\n * @default `false`\n */\n override?: boolean\n /**\n * Use extra meta, this is getting used to generate the barrel/index files.\n */\n meta?: TMeta\n banner?: string\n footer?: string\n}\n\nexport type ResolvedImport = Import\n\nexport type ResolvedExport = Export\n\nexport type ResolvedFile<TMeta extends object = object> = File<TMeta> & {\n /**\n * @default object-hash\n */\n id: string\n /**\n * Contains the first part of the baseName, generated based on baseName\n * @link https://nodejs.org/api/path.html#pathformatpathobject\n */\n name: string\n extname: Extname\n imports: Array<ResolvedImport>\n exports: Array<ResolvedExport>\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/fs/index.ts","../src/fs/clean.ts","../src/fs/read.ts","../src/fs/write.ts","../src/fs/types.ts"],"names":["init_cjs_shims","fs","path","normalize","relative","switcher","resolve"],"mappings":";;;;;;;;;;;;AAAAA,gCAAA,EAAA;;;ACAAA,gCAAA,EAAA;AAEA,eAAsB,MAAM,IAA6B,EAAA;AACvD,EAAO,OAAAC,oBAAA,CAAG,OAAO,IAAI,CAAA;AACvB;;;ACJAD,gCAAA,EAAA;AAKA,SAAS,KAAA,CAAME,MAAc,EAAA,QAAA,GAAwC,OAAS,EAAA;AAC5E,EAAM,MAAA,aAAA,GAAgB,WAAY,CAAA,IAAA,CAAKA,MAAI,CAAA;AAC3C,EAAM,MAAA,cAAA,GAAiBC,eAAUD,MAAI,CAAA;AAErC,EAAI,IAAA,CAAC,SAAS,KAAK,CAAA,CAAE,SAAS,QAAQ,CAAA,IAAK,CAAC,aAAe,EAAA;AAEzD,IAAA,OAAO,eAAe,UAAW,CAAA,KAAA,EAAO,GAAG,CAAE,CAAA,OAAA,CAAQ,OAAO,EAAE,CAAA;AAAA;AAIhE,EAAA,OAAO,eAAe,UAAW,CAAA,KAAA,EAAO,GAAG,CAAE,CAAA,OAAA,CAAQ,OAAO,EAAE,CAAA;AAChE;AAEO,SAAS,eAAgB,CAAA,OAAA,EAAyB,QAA0B,EAAA,QAAA,GAAwC,OAAiB,EAAA;AAC1I,EAAI,IAAA,CAAC,OAAW,IAAA,CAAC,QAAU,EAAA;AACzB,IAAM,MAAA,IAAI,MAAM,CAAuE,oEAAA,EAAA,OAAA,IAAW,EAAE,CAAI,CAAA,EAAA,QAAA,IAAY,EAAE,CAAE,CAAA,CAAA;AAAA;AAG1H,EAAM,MAAA,YAAA,GAAeE,aAAS,CAAA,OAAA,EAAS,QAAQ,CAAA;AAI/C,EAAM,MAAA,WAAA,GAAc,KAAM,CAAA,YAAA,EAA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I;;AAAA,KAAA,EAAYA,OAAK,MAAM,CAAA;AAAA,EAAOA,MAAI;;AAAA,MAAA,EAAa,UAAU,MAAM,CAAA;AAAA,EAAO,SAAS;AAAA,CAAI,CAAA;AAAA;AAGpI,UAAO,OAAA,SAAA;AAAA;AAGT,QAAO,OAAA,IAAA;AAAA,eACA,CAAG,EAAA;AACV,QAAA,OAAA,CAAQ,MAAM,CAAC,CAAA;AAAA;AACjB;AACF,GACF;AAAA,EACA;AACF,CAAA;AAEA,eAAsB,KAAM,CAAA,IAAA,EAAc,IAAc,EAAA,OAAA,GAAmB,EAAiC,EAAA;AAC1G,EAAI,IAAA,IAAA,CAAK,IAAK,EAAA,KAAM,EAAI,EAAA;AACtB,IAAO,OAAA,MAAA;AAAA;AAET,EAAA,OAAO,MAAO,CAAA,IAAA,EAAM,IAAK,CAAA,IAAA,IAAQ,OAAO,CAAA;AAC1C;;;AClEA,IAAA,aAAA,GAAA;AAAAF,gCAAA,EAAA;;;AJIO,SAAS,YAAY,IAAsB,EAAA;AAChD,EAAO,OAAA,IAAA,CAAK,OAAQ,CAAA,WAAA,EAAa,EAAE,CAAA;AACrC","file":"chunk-DYN65P3T.cjs","sourcesContent":["export { clean } from './clean.ts'\nexport { getRelativePath, read, readSync } from './read.ts'\nexport { write } from './write.ts'\n\nexport function trimExtName(text: string): string {\n return text.replace(/\\.[^/.]+$/, '')\n}\n\nexport * as KubbFile from './types.ts'\n","import fs from 'fs-extra'\n\nexport async function clean(path: string): Promise<void> {\n return fs.remove(path)\n}\n","import { normalize, relative } from 'node:path'\n\nimport fs from 'fs-extra'\nimport { switcher } from 'js-runtime'\n\nfunction slash(path: string, platform: 'windows' | 'mac' | 'linux' = 'linux') {\n const isWindowsPath = /^\\\\\\\\\\?\\\\/.test(path)\n const normalizedPath = normalize(path)\n\n if (['linux', 'mac'].includes(platform) && !isWindowsPath) {\n // linux and mac\n return normalizedPath.replaceAll(/\\\\/g, '/').replace('../', '')\n }\n\n // windows\n return normalizedPath.replaceAll(/\\\\/g, '/').replace('../', '')\n}\n\nexport function getRelativePath(rootDir?: string | null, filePath?: string | null, platform: 'windows' | 'mac' | 'linux' = 'linux'): string {\n if (!rootDir || !filePath) {\n throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ''} ${filePath || ''}`)\n }\n\n const relativePath = relative(rootDir, filePath)\n\n // On Windows, paths are separated with a \"\\\"\n // However, web browsers use \"/\" no matter the platform\n const slashedPath = slash(relativePath, platform)\n\n if (slashedPath.startsWith('../')) {\n return slashedPath\n }\n\n return `./${slashedPath}`\n}\n\nconst reader = switcher(\n {\n node: async (path: string) => {\n return fs.readFile(path, { encoding: 'utf8' })\n },\n bun: async (path: string) => {\n const file = Bun.file(path)\n\n return file.text()\n },\n },\n 'node',\n)\n\nconst syncReader = switcher(\n {\n node: (path: string) => {\n return fs.readFileSync(path, { encoding: 'utf8' })\n },\n bun: () => {\n throw new Error('Bun cannot read sync')\n },\n },\n 'node',\n)\n\nexport async function read(path: string): Promise<string> {\n return reader(path)\n}\n\nexport function readSync(path: string): string {\n return syncReader(path)\n}\n","import { resolve } from 'node:path'\n\nimport fs from 'fs-extra'\nimport { switcher } from 'js-runtime'\n\ntype Options = { sanity?: boolean }\n\nconst writer = switcher(\n {\n node: async (path: string, data: string, { sanity }: Options) => {\n try {\n const oldContent = await fs.readFile(resolve(path), {\n encoding: 'utf-8',\n })\n if (oldContent?.toString() === data?.toString()) {\n return\n }\n } catch (_err) {\n /* empty */\n }\n\n await fs.outputFile(resolve(path), data, { encoding: 'utf-8' })\n\n if (sanity) {\n const savedData = await fs.readFile(resolve(path), {\n encoding: 'utf-8',\n })\n\n if (savedData?.toString() !== data?.toString()) {\n throw new Error(`Sanity check failed for ${path}\\n\\nData[${data.length}]:\\n${data}\\n\\nSaved[${savedData.length}]:\\n${savedData}\\n`)\n }\n\n return savedData\n }\n\n return data\n },\n bun: async (path: string, data: string, { sanity }: Options) => {\n try {\n await Bun.write(resolve(path), data)\n\n if (sanity) {\n const file = Bun.file(resolve(path))\n const savedData = await file.text()\n\n if (savedData?.toString() !== data?.toString()) {\n throw new Error(`Sanity check failed for ${path}\\n\\nData[${path.length}]:\\n${path}\\n\\nSaved[${savedData.length}]:\\n${savedData}\\n`)\n }\n\n return savedData\n }\n\n return data\n } catch (e) {\n console.error(e)\n }\n },\n },\n 'node',\n)\n\nexport async function write(path: string, data: string, options: Options = {}): Promise<string | undefined> {\n if (data.trim() === '') {\n return undefined\n }\n return writer(path, data.trim(), options)\n}\n","type BasePath<T extends string = string> = `${T}/`\n\nexport type Import = {\n /**\n * Import name to be used\n * @example [\"useState\"]\n * @example \"React\"\n */\n name:\n | string\n | Array<\n | string\n | {\n propertyName: string\n name?: string\n }\n >\n /**\n * Path for the import\n * @example '@kubb/core'\n */\n path: string\n /**\n * Add `type` prefix to the import, this will result in: `import type { Type } from './path'`.\n */\n isTypeOnly?: boolean\n\n isNameSpace?: boolean\n /**\n * When root is set it will get the path with relative getRelativePath(root, path).\n */\n root?: string\n}\n\nexport type Source = {\n name?: string\n value?: string\n isTypeOnly?: boolean\n /**\n * Has const or type 'export'\n * @default false\n */\n isExportable?: boolean\n /**\n * When set, barrel generation will add this\n * @default false\n */\n isIndexable?: boolean\n}\n\nexport type Export = {\n /**\n * Export name to be used.\n * @example [\"useState\"]\n * @example \"React\"\n */\n name?: string | Array<string>\n /**\n * Path for the import.\n * @example '@kubb/core'\n */\n path: string\n /**\n * Add `type` prefix to the export, this will result in: `export type { Type } from './path'`.\n */\n isTypeOnly?: boolean\n /**\n * Make it possible to override the name, this will result in: `export * as aliasName from './path'`.\n */\n asAlias?: boolean\n}\n\nexport type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`\n\nexport type Mode = 'single' | 'split'\n\n/**\n * Name to be used to dynamicly create the baseName(based on input.path)\n * Based on UNIX basename\n * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix\n */\nexport type BaseName = `${string}.${string}`\n\n/**\n * Path will be full qualified path to a specified file\n */\nexport type Path = string\n\nexport type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`\n\nexport type OptionalPath = Path | undefined | null\n\nexport type File<TMeta extends object = object> = {\n /**\n * Name to be used to create the path\n * Based on UNIX basename, `${name}.extname`\n * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix\n */\n baseName: BaseName\n /**\n * Path will be full qualified path to a specified file\n */\n path: AdvancedPath<BaseName> | Path\n sources: Array<Source>\n imports?: Array<Import>\n exports?: Array<Export>\n /**\n * This will call fileManager.add instead of fileManager.addOrAppend, adding the source when the files already exists\n * This will also ignore the combinefiles utils\n * @default `false`\n */\n override?: boolean\n /**\n * Use extra meta, this is getting used to generate the barrel/index files.\n */\n meta?: TMeta\n banner?: string\n footer?: string\n}\n\nexport type ResolvedImport = Import\n\nexport type ResolvedExport = Export\n\nexport type ResolvedFile<TMeta extends object = object> = File<TMeta> & {\n /**\n * @default object-hash\n */\n id: string\n /**\n * Contains the first part of the baseName, generated based on baseName\n * @link https://nodejs.org/api/path.html#pathformatpathobject\n */\n name: string\n extname: Extname\n imports: Array<ResolvedImport>\n exports: Array<ResolvedExport>\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { write } from './chunk-
|
|
1
|
+
import { write } from './chunk-RM6742YK.js';
|
|
2
2
|
import seedrandom from 'seedrandom';
|
|
3
|
-
import * as tty from '
|
|
4
|
-
import { EventEmitter as EventEmitter$1 } from '
|
|
5
|
-
import { sep, resolve } from '
|
|
6
|
-
import { formatWithOptions } from '
|
|
7
|
-
import g$1 from '
|
|
3
|
+
import * as tty from 'tty';
|
|
4
|
+
import { EventEmitter as EventEmitter$1 } from 'events';
|
|
5
|
+
import { sep, resolve } from 'path';
|
|
6
|
+
import { formatWithOptions } from 'util';
|
|
7
|
+
import g$1 from 'process';
|
|
8
8
|
|
|
9
9
|
var {
|
|
10
10
|
env = {},
|
|
@@ -1083,7 +1083,7 @@ function createConsola2(options = {}) {
|
|
|
1083
1083
|
defaults: { level },
|
|
1084
1084
|
stdout: process.stdout,
|
|
1085
1085
|
stderr: process.stderr,
|
|
1086
|
-
prompt: (...args) => import('./prompt-
|
|
1086
|
+
prompt: (...args) => import('./prompt-ELTHGQK6.js').then((m) => m.prompt(...args)),
|
|
1087
1087
|
reporters: options.reporters || [
|
|
1088
1088
|
options.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()
|
|
1089
1089
|
],
|
|
@@ -1195,5 +1195,5 @@ function randomCliColour(text) {
|
|
|
1195
1195
|
}
|
|
1196
1196
|
|
|
1197
1197
|
export { EventEmitter, LogMapper, createLogger, randomCliColour, randomColour };
|
|
1198
|
-
//# sourceMappingURL=chunk-
|
|
1199
|
-
//# sourceMappingURL=chunk-
|
|
1198
|
+
//# sourceMappingURL=chunk-F5IHVBMD.js.map
|
|
1199
|
+
//# sourceMappingURL=chunk-F5IHVBMD.js.map
|