@kubb/core 3.10.10 → 3.10.12
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-J2EWMA56.cjs → chunk-67N7TJNL.cjs} +18 -18
- package/dist/{chunk-J2EWMA56.cjs.map → chunk-67N7TJNL.cjs.map} +1 -1
- package/dist/{chunk-5ENRRZRW.cjs → chunk-CXD7TVLT.cjs} +4 -4
- package/dist/{chunk-5ENRRZRW.cjs.map → chunk-CXD7TVLT.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-XMAFJGOG.cjs → chunk-FFYEJDCV.cjs} +8 -8
- package/dist/{chunk-XMAFJGOG.cjs.map → chunk-FFYEJDCV.cjs.map} +1 -1
- package/dist/{chunk-O5ASNFB7.js → chunk-GBYHPDPK.js} +3 -3
- package/dist/{chunk-O5ASNFB7.js.map → chunk-GBYHPDPK.js.map} +1 -1
- package/dist/{chunk-CMNPGTBE.cjs → chunk-PQLA6PG5.cjs} +49 -49
- package/dist/{chunk-CMNPGTBE.cjs.map → chunk-PQLA6PG5.cjs.map} +1 -1
- 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-GB7SMQO5.cjs → chunk-SUT27VY3.cjs} +13 -13
- package/dist/{chunk-GB7SMQO5.cjs.map → chunk-SUT27VY3.cjs.map} +1 -1
- package/dist/{chunk-IMO6IX7W.js → chunk-YYPJL6UD.js} +7 -7
- package/dist/{chunk-IMO6IX7W.js.map → chunk-YYPJL6UD.js.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 +9 -9
- package/dist/logger.cjs +7 -7
- package/dist/logger.js +2 -2
- package/dist/mocks.cjs +11 -11
- package/dist/mocks.cjs.map +1 -1
- package/dist/mocks.d.cts +1 -1
- package/dist/mocks.d.ts +1 -1
- package/dist/mocks.js +4 -4
- package/dist/mocks.js.map +1 -1
- package/dist/{prompt-UVNS6X7J.js → prompt-ELTHGQK6.js} +6 -5
- package/dist/prompt-ELTHGQK6.js.map +1 -0
- package/dist/{prompt-BPFJQVHQ.cjs → prompt-QMWQEXIN.cjs} +4 -4
- package/dist/{prompt-BPFJQVHQ.cjs.map → prompt-QMWQEXIN.cjs.map} +1 -1
- package/dist/transformers.cjs +22 -22
- package/dist/transformers.js +1 -1
- package/dist/utils.cjs +19 -19
- package/dist/utils.js +3 -3
- package/package.json +7 -7
- package/src/mocks/index.ts +73 -0
- package/src/transformers/transformReservedWord.ts +1 -1
- package/src/utils/URLPath.ts +1 -1
- package/src/utils/parser.ts +1 -1
- package/dist/prompt-UVNS6X7J.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import fs3 from 'fs-extra';
|
|
2
|
-
import { resolve, relative, normalize } from '
|
|
2
|
+
import { resolve, relative, normalize } from 'path';
|
|
3
3
|
import { switcher } from 'js-runtime';
|
|
4
4
|
|
|
5
5
|
// src/fs/clean.ts
|
|
@@ -127,5 +127,5 @@ function trimExtName(text) {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
export { clean, getRelativePath, read, readSync, trimExtName, types_exports, write };
|
|
130
|
-
//# sourceMappingURL=chunk-
|
|
131
|
-
//# sourceMappingURL=chunk-
|
|
130
|
+
//# sourceMappingURL=chunk-RM6742YK.js.map
|
|
131
|
+
//# sourceMappingURL=chunk-RM6742YK.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/fs/clean.ts","../src/fs/read.ts","../src/fs/write.ts","../src/fs/types.ts","../src/fs/index.ts"],"names":["fs","switcher"],"mappings":";;;;;AAEA,eAAsB,MAAM,IAA6B,EAAA;AACvD,EAAO,OAAAA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AI,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;;;ACIO,SAAS,YAAY,IAAsB,EAAA;AAChD,EAAO,OAAA,IAAA,CAAK,OAAQ,CAAA,WAAA,EAAa,EAAE,CAAA;AACrC","file":"chunk-533OTQHD.js","sourcesContent":["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","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"]}
|
|
1
|
+
{"version":3,"sources":["../src/fs/clean.ts","../src/fs/read.ts","../src/fs/write.ts","../src/fs/types.ts","../src/fs/index.ts"],"names":["fs","switcher"],"mappings":";;;;;AAEA,eAAsB,MAAM,IAA6B,EAAA;AACvD,EAAO,OAAAA,GAAA,CAAG,OAAO,IAAI,CAAA;AACvB;ACCA,SAAS,KAAA,CAAM,IAAc,EAAA,QAAA,GAAwC,OAAS,EAAA;AAC5E,EAAM,MAAA,aAAA,GAAgB,WAAY,CAAA,IAAA,CAAK,IAAI,CAAA;AAC3C,EAAM,MAAA,cAAA,GAAiB,UAAU,IAAI,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,C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A,EAAM,UAAY,EAAA;AAC9C,YAAM,MAAA,IAAI,KAAM,CAAA,CAAA,wBAAA,EAA2B,IAAI;;AAAA,KAAA,EAAY,KAAK,MAAM,CAAA;AAAA,EAAO,IAAI;;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;;;ACIO,SAAS,YAAY,IAAsB,EAAA;AAChD,EAAO,OAAA,IAAA,CAAK,OAAQ,CAAA,WAAA,EAAa,EAAE,CAAA;AACrC","file":"chunk-RM6742YK.js","sourcesContent":["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","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"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkFFYEJDCV_cjs = require('./chunk-FFYEJDCV.cjs');
|
|
4
|
+
var chunkCXD7TVLT_cjs = require('./chunk-CXD7TVLT.cjs');
|
|
5
5
|
var seedrandom = require('seedrandom');
|
|
6
6
|
var tty = require('tty');
|
|
7
7
|
var events = require('events');
|
|
@@ -34,13 +34,13 @@ var tty__namespace = /*#__PURE__*/_interopNamespace(tty);
|
|
|
34
34
|
var g$1__default = /*#__PURE__*/_interopDefault(g$1);
|
|
35
35
|
|
|
36
36
|
// src/logger.ts
|
|
37
|
-
|
|
37
|
+
chunkCXD7TVLT_cjs.init_cjs_shims();
|
|
38
38
|
|
|
39
39
|
// ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/utils.mjs
|
|
40
|
-
|
|
40
|
+
chunkCXD7TVLT_cjs.init_cjs_shims();
|
|
41
41
|
|
|
42
42
|
// ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs
|
|
43
|
-
|
|
43
|
+
chunkCXD7TVLT_cjs.init_cjs_shims();
|
|
44
44
|
var {
|
|
45
45
|
env = {},
|
|
46
46
|
argv = [],
|
|
@@ -276,7 +276,7 @@ function box(text, _opts = {}) {
|
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
// src/utils/EventEmitter.ts
|
|
279
|
-
|
|
279
|
+
chunkCXD7TVLT_cjs.init_cjs_shims();
|
|
280
280
|
var EventEmitter = class {
|
|
281
281
|
constructor() {
|
|
282
282
|
this.#emitter.setMaxListeners(100);
|
|
@@ -297,10 +297,10 @@ var EventEmitter = class {
|
|
|
297
297
|
};
|
|
298
298
|
|
|
299
299
|
// ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/index.mjs
|
|
300
|
-
|
|
300
|
+
chunkCXD7TVLT_cjs.init_cjs_shims();
|
|
301
301
|
|
|
302
302
|
// ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/core.mjs
|
|
303
|
-
|
|
303
|
+
chunkCXD7TVLT_cjs.init_cjs_shims();
|
|
304
304
|
var LogLevels = {
|
|
305
305
|
fatal: 0,
|
|
306
306
|
error: 0,
|
|
@@ -800,7 +800,7 @@ function createConsola(options = {}) {
|
|
|
800
800
|
}
|
|
801
801
|
|
|
802
802
|
// ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs
|
|
803
|
-
|
|
803
|
+
chunkCXD7TVLT_cjs.init_cjs_shims();
|
|
804
804
|
function parseStack(stack, message) {
|
|
805
805
|
const cwd = process.cwd() + path.sep;
|
|
806
806
|
const lines = stack.split("\n").splice(message.split("\n").length).map((l2) => l2.trim().replace("file://", "").replace(cwd, ""));
|
|
@@ -1128,7 +1128,7 @@ function createConsola2(options = {}) {
|
|
|
1128
1128
|
defaults: { level },
|
|
1129
1129
|
stdout: process.stdout,
|
|
1130
1130
|
stderr: process.stderr,
|
|
1131
|
-
prompt: (...args) => import('./prompt-
|
|
1131
|
+
prompt: (...args) => import('./prompt-QMWQEXIN.cjs').then((m) => m.prompt(...args)),
|
|
1132
1132
|
reporters: options.reporters || [
|
|
1133
1133
|
options.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()
|
|
1134
1134
|
],
|
|
@@ -1214,7 +1214,7 @@ function createLogger({ logLevel = 3, name, consola: _consola } = {}) {
|
|
|
1214
1214
|
});
|
|
1215
1215
|
await Promise.all(
|
|
1216
1216
|
Object.entries(files).map(async ([fileName, logs]) => {
|
|
1217
|
-
return
|
|
1217
|
+
return chunkFFYEJDCV_cjs.write(fileName, logs.join("\n"));
|
|
1218
1218
|
})
|
|
1219
1219
|
);
|
|
1220
1220
|
return Object.keys(files);
|
|
@@ -1244,5 +1244,5 @@ exports.LogMapper = LogMapper;
|
|
|
1244
1244
|
exports.createLogger = createLogger;
|
|
1245
1245
|
exports.randomCliColour = randomCliColour;
|
|
1246
1246
|
exports.randomColour = randomColour;
|
|
1247
|
-
//# sourceMappingURL=chunk-
|
|
1248
|
-
//# sourceMappingURL=chunk-
|
|
1247
|
+
//# sourceMappingURL=chunk-SUT27VY3.cjs.map
|
|
1248
|
+
//# sourceMappingURL=chunk-SUT27VY3.cjs.map
|