@kubb/core 3.0.0-alpha.7 → 3.0.0-alpha.9
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-BHZAXMKP.js → chunk-27CPVXAT.js} +28 -15
- package/dist/chunk-27CPVXAT.js.map +1 -0
- package/dist/{chunk-4SIOKKDJ.cjs → chunk-5IGANEGE.cjs} +35 -22
- package/dist/chunk-5IGANEGE.cjs.map +1 -0
- package/dist/index.cjs +12 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/mocks.cjs +5 -2
- 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 -1
- package/dist/mocks.js.map +1 -1
- package/dist/utils.cjs +2 -2
- package/dist/utils.js +1 -1
- package/package.json +7 -7
- package/src/BarrelManager.ts +81 -69
- package/src/{Generator.ts → BaseGenerator.ts} +1 -1
- package/src/FileManager.ts +2 -1
- package/src/__snapshots__/barrel.json +13 -8
- package/src/build.ts +3 -4
- package/src/index.ts +1 -1
- package/dist/chunk-4SIOKKDJ.cjs.map +0 -1
- package/dist/chunk-BHZAXMKP.js.map +0 -1
|
@@ -270,7 +270,7 @@ var URLPath = class {
|
|
|
270
270
|
|
|
271
271
|
// src/utils/parser.ts
|
|
272
272
|
import { extname as extname2 } from "node:path";
|
|
273
|
-
import { getRelativePath as
|
|
273
|
+
import { getRelativePath as getRelativePath2 } from "@kubb/fs";
|
|
274
274
|
import hash from "object-hash";
|
|
275
275
|
|
|
276
276
|
// src/FileManager.ts
|
|
@@ -465,7 +465,8 @@ var BarrelManager = class {
|
|
|
465
465
|
}
|
|
466
466
|
getFiles(generatedFiles, root) {
|
|
467
467
|
const { logger } = this.#options;
|
|
468
|
-
const files =
|
|
468
|
+
const files = /* @__PURE__ */ new Map();
|
|
469
|
+
TreeNode.build(generatedFiles, root)?.forEach((treeNode) => {
|
|
469
470
|
if (!treeNode || !treeNode.children || !treeNode.parent?.data.path) {
|
|
470
471
|
return void 0;
|
|
471
472
|
}
|
|
@@ -476,15 +477,15 @@ var BarrelManager = class {
|
|
|
476
477
|
return void 0;
|
|
477
478
|
}
|
|
478
479
|
const sources = item.data.file?.sources || [];
|
|
479
|
-
if (!sources.some((source) => source.
|
|
480
|
+
if (!sources.some((source) => source.isIndexable)) {
|
|
480
481
|
logger?.emit(
|
|
481
482
|
"warning",
|
|
482
|
-
`No
|
|
483
|
+
`No isIndexable source found(source should have a name and isIndexable):
|
|
483
484
|
File: ${JSON.stringify(item.data.file, void 0, 2)}`
|
|
484
485
|
);
|
|
485
486
|
}
|
|
486
487
|
return sources.map((source) => {
|
|
487
|
-
if (!item.data.file?.path || !source.
|
|
488
|
+
if (!item.data.file?.path || !source.isIndexable) {
|
|
488
489
|
return void 0;
|
|
489
490
|
}
|
|
490
491
|
const isSubExport = !!treeNode.parent?.data.path?.split?.("/")?.length;
|
|
@@ -502,12 +503,11 @@ File: ${JSON.stringify(item.data.file, void 0, 2)}`
|
|
|
502
503
|
};
|
|
503
504
|
});
|
|
504
505
|
}).flat().filter(Boolean);
|
|
505
|
-
const combinedExports = combineExports(exports);
|
|
506
506
|
const barrelFile = {
|
|
507
507
|
path: barrelPath,
|
|
508
508
|
baseName: "index.ts",
|
|
509
|
-
exports
|
|
510
|
-
sources:
|
|
509
|
+
exports,
|
|
510
|
+
sources: exports.flatMap((item) => {
|
|
511
511
|
if (Array.isArray(item.name)) {
|
|
512
512
|
return item.name.map((name) => {
|
|
513
513
|
return {
|
|
@@ -515,7 +515,8 @@ File: ${JSON.stringify(item.data.file, void 0, 2)}`
|
|
|
515
515
|
isTypeOnly: item.isTypeOnly,
|
|
516
516
|
//TODO use parser to generate import
|
|
517
517
|
value: "",
|
|
518
|
-
isExportable: false
|
|
518
|
+
isExportable: false,
|
|
519
|
+
isIndexable: false
|
|
519
520
|
};
|
|
520
521
|
});
|
|
521
522
|
}
|
|
@@ -525,14 +526,25 @@ File: ${JSON.stringify(item.data.file, void 0, 2)}`
|
|
|
525
526
|
isTypeOnly: item.isTypeOnly,
|
|
526
527
|
//TODO use parser to generate import
|
|
527
528
|
value: "",
|
|
528
|
-
isExportable: false
|
|
529
|
+
isExportable: false,
|
|
530
|
+
isIndexable: false
|
|
529
531
|
}
|
|
530
532
|
];
|
|
531
533
|
})
|
|
532
534
|
};
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
535
|
+
const previousBarrelFile = files.get(barrelFile.path);
|
|
536
|
+
if (previousBarrelFile) {
|
|
537
|
+
files.set(barrelFile.path, {
|
|
538
|
+
...previousBarrelFile,
|
|
539
|
+
...barrelFile,
|
|
540
|
+
exports: combineExports([...previousBarrelFile.exports || [], ...barrelFile.exports || []]),
|
|
541
|
+
sources: combineSources([...previousBarrelFile.sources || [], ...barrelFile.sources || []])
|
|
542
|
+
});
|
|
543
|
+
} else {
|
|
544
|
+
files.set(barrelFile.path, barrelFile);
|
|
545
|
+
}
|
|
546
|
+
});
|
|
547
|
+
return [...files.values()];
|
|
536
548
|
}
|
|
537
549
|
};
|
|
538
550
|
|
|
@@ -685,6 +697,7 @@ function combineSources(sources) {
|
|
|
685
697
|
prevByName.value = curr.value;
|
|
686
698
|
prevByName.isExportable = curr.isExportable;
|
|
687
699
|
prevByName.isTypeOnly = curr.isTypeOnly;
|
|
700
|
+
prevByName.isIndexable = curr.isIndexable;
|
|
688
701
|
return prev;
|
|
689
702
|
}
|
|
690
703
|
return [...prev, curr];
|
|
@@ -861,7 +874,7 @@ var typeScriptParser = createFileParser({
|
|
|
861
874
|
async print(file) {
|
|
862
875
|
const module = await import("@kubb/parser-ts");
|
|
863
876
|
const importNodes = file.imports.map((item) => {
|
|
864
|
-
const path = item.root ?
|
|
877
|
+
const path = item.root ? getRelativePath2(item.root, item.path) : item.path;
|
|
865
878
|
return module.factory.createImportDeclaration({
|
|
866
879
|
name: item.name,
|
|
867
880
|
path,
|
|
@@ -929,4 +942,4 @@ export {
|
|
|
929
942
|
getSource,
|
|
930
943
|
processFiles
|
|
931
944
|
};
|
|
932
|
-
//# sourceMappingURL=chunk-
|
|
945
|
+
//# sourceMappingURL=chunk-27CPVXAT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/FunctionParams.ts","../src/utils/promise.ts","../src/utils/renderTemplate.ts","../src/utils/timeout.ts","../src/utils/uniqueName.ts","../src/utils/URLPath.ts","../src/utils/parser.ts","../src/FileManager.ts","../src/BarrelManager.ts","../src/utils/TreeNode.ts"],"sourcesContent":["import { orderBy } from 'natural-orderby'\n\nimport { camelCase } from '../transformers/casing.ts'\n\ntype FunctionParamsASTWithoutType = {\n name?: string\n type?: string\n /**\n * @default true\n */\n required?: boolean\n /**\n * @default true\n */\n enabled?: boolean\n default?: string\n}\n\ntype FunctionParamsASTWithType = {\n name?: never\n type: string\n /**\n * @default true\n */\n required?: boolean\n /**\n * @default true\n */\n enabled?: boolean\n default?: string\n}\n/**\n * @deprecated\n */\nexport type FunctionParamsAST = FunctionParamsASTWithoutType | FunctionParamsASTWithType\n\n/**\n * @deprecated\n */\nexport class FunctionParams {\n #items: Array<FunctionParamsAST | FunctionParamsAST[]> = []\n constructor() {\n return this\n }\n\n get items(): FunctionParamsAST[] {\n return this.#items.flat()\n }\n\n add(item: FunctionParamsAST | Array<FunctionParamsAST | FunctionParamsAST[] | undefined> | undefined): FunctionParams {\n if (!item) {\n return this\n }\n\n if (Array.isArray(item)) {\n item.filter(Boolean).forEach((it) => this.#items.push(it))\n return this\n }\n this.#items.push(item)\n\n return this\n }\n static #orderItems(items: Array<FunctionParamsAST | FunctionParamsAST[]>) {\n return orderBy(\n items.filter(Boolean),\n [\n (v) => {\n if (Array.isArray(v)) {\n return undefined\n }\n return !v.default\n },\n (v) => {\n if (Array.isArray(v)) {\n return undefined\n }\n return v.required ?? true\n },\n ],\n ['desc', 'desc'],\n )\n }\n\n static #addParams(acc: string[], item: FunctionParamsAST) {\n const { enabled = true, name, type, required = true, ...rest } = item\n\n if (!enabled) {\n return acc\n }\n\n if (!name) {\n // when name is not se we will use TypeScript generics\n acc.push(`${type}${rest.default ? ` = ${rest.default}` : ''}`)\n\n return acc\n }\n // TODO check whey we still need the camelcase here\n const parameterName = name.startsWith('{') ? name : camelCase(name)\n\n if (type) {\n if (required) {\n acc.push(`${parameterName}: ${type}${rest.default ? ` = ${rest.default}` : ''}`)\n } else {\n acc.push(`${parameterName}?: ${type}`)\n }\n } else {\n acc.push(`${parameterName}`)\n }\n\n return acc\n }\n\n static toObject(items: FunctionParamsAST[]): FunctionParamsAST {\n let type: string[] = []\n let name: string[] = []\n\n const enabled = items.every((item) => item.enabled) ? items.at(0)?.enabled : true\n const required = items.every((item) => item.required) ?? true\n\n items.forEach((item) => {\n name = FunctionParams.#addParams(name, { ...item, type: undefined })\n if (items.some((item) => item.type)) {\n type = FunctionParams.#addParams(type, item)\n }\n })\n\n return {\n name: `{ ${name.join(', ')} }`,\n type: type.length ? `{ ${type.join('; ')} }` : undefined,\n enabled,\n required,\n }\n }\n\n static toString(items: (FunctionParamsAST | FunctionParamsAST[])[]): string {\n const sortedData = FunctionParams.#orderItems(items)\n\n return sortedData\n .reduce((acc, item) => {\n if (Array.isArray(item)) {\n if (item.length <= 0) {\n return acc\n }\n const subItems = FunctionParams.#orderItems(item) as FunctionParamsAST[]\n const objectItem = FunctionParams.toObject(subItems)\n\n return FunctionParams.#addParams(acc, objectItem)\n }\n\n return FunctionParams.#addParams(acc, item)\n }, [] as string[])\n .join(', ')\n }\n\n toObject(): FunctionParamsAST {\n const items = FunctionParams.#orderItems(this.#items).flat()\n\n return FunctionParams.toObject(items)\n }\n\n toString(): string {\n const items = FunctionParams.#orderItems(this.#items)\n\n return FunctionParams.toString(items)\n }\n}\n","import type { PossiblePromise } from '@kubb/types'\n\nexport function isPromise<T>(result: PossiblePromise<T>): result is Promise<T> {\n return !!result && typeof (result as Promise<unknown>)?.then === 'function'\n}\n\nexport function isPromiseFulfilledResult<T = unknown>(result: PromiseSettledResult<unknown>): result is PromiseFulfilledResult<T> {\n return result.status === 'fulfilled'\n}\n\nexport function isPromiseRejectedResult<T>(result: PromiseSettledResult<unknown>): result is Omit<PromiseRejectedResult, 'reason'> & { reason: T } {\n return result.status === 'rejected'\n}\n","export function renderTemplate<TData extends Record<string, unknown> = Record<string, unknown>>(template: string, data: TData | undefined = undefined): string {\n if (!data || !Object.keys(data).length) {\n return template.replace(/{{(.*?)}}/g, '')\n }\n\n const matches = template.match(/{{(.*?)}}/g)\n\n return (\n matches?.reduce((prev, curr) => {\n const index = curr.split(/{{|}}/).filter(Boolean)[0]?.trim()\n if (index === undefined) {\n return prev\n }\n const value = data[index]\n\n if (value === undefined) {\n return prev\n }\n\n return prev\n .replace(curr, () => {\n if (typeof value === 'boolean') {\n return `${value.toString()}` || 'false'\n }\n\n return (value as string) || ''\n })\n .trim()\n }, template) || ''\n )\n}\n","export async function timeout(ms: number): Promise<unknown> {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(true)\n }, ms)\n })\n}\n","export function getUniqueName(originalName: string, data: Record<string, number>): string {\n let used = data[originalName] || 0\n if (used) {\n data[originalName] = ++used\n originalName += used\n }\n data[originalName] = 1\n return originalName\n}\n\nexport function setUniqueName(originalName: string, data: Record<string, number>): string {\n let used = data[originalName] || 0\n if (used) {\n data[originalName] = ++used\n\n return originalName\n }\n data[originalName] = 1\n return originalName\n}\n","import { camelCase } from '../transformers/casing.ts'\n\nexport type URLObject = {\n url: string\n params?: Record<string, string>\n}\n\ntype ObjectOptions = {\n type?: 'path' | 'template'\n replacer?: (pathParam: string) => string\n stringify?: boolean\n}\n\nexport class URLPath {\n path: string\n\n constructor(path: string) {\n this.path = path\n\n return this\n }\n\n /**\n * Convert Swagger path to URLPath(syntax of Express)\n * @example /pet/{petId} => /pet/:petId\n */\n get URL(): string {\n return this.toURLPath()\n }\n get isURL(): boolean {\n try {\n const url = new URL(this.path)\n if (url?.href) {\n return true\n }\n } catch (error) {\n return false\n }\n return false\n }\n\n /**\n * Convert Swagger path to template literals/ template strings(camelcase)\n * @example /pet/{petId} => `/pet/${petId}`\n * @example /account/monetary-accountID => `/account/${monetaryAccountId}`\n * @example /account/userID => `/account/${userId}`\n */\n get template(): string {\n return this.toTemplateString()\n }\n get object(): URLObject | string {\n return this.toObject()\n }\n get params(): Record<string, string> | undefined {\n return this.getParams()\n }\n\n toObject({ type = 'path', replacer, stringify }: ObjectOptions = {}): URLObject | string {\n const object = {\n url: type === 'path' ? this.toURLPath() : this.toTemplateString(replacer),\n params: this.getParams(),\n }\n\n if (stringify) {\n if (type === 'template') {\n return JSON.stringify(object).replaceAll(\"'\", '').replaceAll(`\"`, '')\n }\n\n if (object.params) {\n return `{ url: '${object.url}', params: ${JSON.stringify(object.params).replaceAll(\"'\", '').replaceAll(`\"`, '')} }`\n }\n\n return `{ url: '${object.url}' }`\n }\n\n return object\n }\n\n /**\n * Convert Swagger path to template literals/ template strings(camelcase)\n * @example /pet/{petId} => `/pet/${petId}`\n * @example /account/monetary-accountID => `/account/${monetaryAccountId}`\n * @example /account/userID => `/account/${userId}`\n */\n toTemplateString(replacer?: (pathParam: string) => string): string {\n const regex = /{(\\w|-)*}/g\n const found = this.path.match(regex)\n let newPath = this.path.replaceAll('{', '${')\n\n if (found) {\n newPath = found.reduce((prev, curr) => {\n const pathParam = replacer ? replacer(camelCase(curr)) : camelCase(curr)\n const replacement = `\\${${pathParam}}`\n\n return prev.replace(curr, replacement)\n }, this.path)\n }\n\n return `\\`${newPath}\\``\n }\n\n getParams(replacer?: (pathParam: string) => string): Record<string, string> | undefined {\n const regex = /{(\\w|-)*}/g\n const found = this.path.match(regex)\n\n if (!found) {\n return undefined\n }\n\n const params: Record<string, string> = {}\n found.forEach((item) => {\n item = item.replaceAll('{', '').replaceAll('}', '')\n\n const pathParam = replacer ? replacer(camelCase(item)) : camelCase(item)\n\n params[pathParam] = pathParam\n }, this.path)\n\n return params\n }\n\n /**\n * Convert Swagger path to URLPath(syntax of Express)\n * @example /pet/{petId} => /pet/:petId\n */\n toURLPath(): string {\n return this.path.replaceAll('{', ':').replaceAll('}', '')\n }\n}\n","import { extname } from 'node:path'\nimport type * as KubbFile from '@kubb/fs/types'\n\nimport { getRelativePath } from '@kubb/fs'\nimport hash from 'object-hash'\nimport { combineExports, combineImports, combineSources } from '../FileManager.ts'\nimport type { Logger } from '../logger.ts'\n\n/**\n * Helper to create a file with name and id set\n */\nexport function createFile<TMeta extends object = object>(file: KubbFile.File<TMeta>): KubbFile.ResolvedFile<TMeta> {\n const extName = extname(file.baseName) as KubbFile.Extname\n\n if (!extName) {\n throw new Error(`No extName found for ${file.baseName}`)\n }\n\n const source = file.sources.map((item) => item.value).join('\\n\\n')\n const exports = file.exports ? combineExports(file.exports) : []\n const imports = file.imports && source ? combineImports(file.imports, exports, source) : []\n const sources = file.sources ? combineSources(file.sources) : []\n\n return {\n ...file,\n id: hash({ path: file.path }),\n name: trimExtName(file.baseName),\n extName,\n imports: imports.map((item) => createFileImport(item)),\n exports: exports.map((item) => createFileExport(item)),\n sources: sources.map((item) => createFileSource(item)),\n }\n}\n\n/**\n * Helper to create a fileImport with extName set\n */\nexport function createFileSource(source: KubbFile.Source): KubbFile.Source {\n return source\n}\n\n/**\n * Helper to create a fileImport with extName set\n */\nexport function createFileImport(imp: KubbFile.Import): KubbFile.ResolvedImport {\n const extName = extname(imp.path) as KubbFile.Extname\n\n return {\n ...imp,\n extName: imp.extName ? imp.extName : extName,\n }\n}\n\n/**\n * Helper to create a fileExport with extName set\n */\nexport function createFileExport(exp: KubbFile.Export): KubbFile.ResolvedExport {\n const extName = extname(exp.path) as KubbFile.Extname\n\n return {\n ...exp,\n extName: exp.extName ? exp.extName : extName,\n }\n}\n\nexport type ParserModule<TMeta extends object = object> = {\n /**\n * By default @kubb/react is used\n */\n render: (item: any) => any\n /**\n * Convert a file to string\n */\n print: (file: KubbFile.ResolvedFile<TMeta>, options: PrintOptions) => Promise<string>\n}\n\nexport function createFileParser<TMeta extends object = object>(parser: ParserModule<TMeta>): ParserModule<TMeta> {\n return parser\n}\n\ntype PrintOptions = {\n logger?: Logger\n}\n\nconst typeScriptParser = createFileParser({\n render() {\n return undefined\n },\n async print(file) {\n const module = await import('@kubb/parser-ts')\n\n const importNodes = file.imports\n .map((item) => {\n const path = item.root ? getRelativePath(item.root, item.path) : item.path\n\n return module.factory.createImportDeclaration({\n name: item.name,\n path,\n isTypeOnly: item.isTypeOnly,\n })\n })\n .filter(Boolean)\n\n const exportNodes = file.exports\n .map((item) => {\n return module.factory.createExportDeclaration({\n name: item.name,\n path: item.path,\n isTypeOnly: item.isTypeOnly,\n asAlias: item.asAlias,\n })\n })\n .filter(Boolean)\n\n const source = [module.print([...importNodes, ...exportNodes]), file.sources.map((item) => item.value).join('\\n\\n')].join('\\n')\n\n // do some basic linting with the ts compiler\n return module.print([], { source, noEmitHelpers: false })\n },\n})\n\nconst defaultParser = createFileParser({\n render() {\n return undefined\n },\n async print(file, { logger }) {\n return file.sources.map((item) => item.value).join('\\n\\n')\n },\n})\n\nconst parsers: Record<KubbFile.Extname, ParserModule<any>> = {\n '.ts': typeScriptParser,\n '.js': typeScriptParser,\n '.jsx': typeScriptParser,\n '.tsx': typeScriptParser,\n '.json': defaultParser,\n}\n\nexport async function getFileParser<TMeta extends object = object>(extName: KubbFile.Extname | undefined): Promise<ParserModule<TMeta>> {\n if (!extName) {\n return defaultParser\n }\n\n const parser = parsers[extName]\n\n if (!parser) {\n console.warn(`[parser] No parser found for ${extName}, default parser will be used`)\n }\n\n return parser || defaultParser\n}\n\nexport function trimExtName(text: string): string {\n const extName = text.split('.').pop()\n\n return text.replace(`.${extName}`, '')\n}\n","import { extname, join, relative } from 'node:path'\n\nimport { orderBy } from 'natural-orderby'\nimport { isDeepEqual } from 'remeda'\n\nimport { read, write } from '@kubb/fs'\nimport { BarrelManager } from './BarrelManager.ts'\n\nimport type * as KubbFile from '@kubb/fs/types'\n\nimport { trimExtName } from '@kubb/fs'\nimport type { ResolvedFile } from '@kubb/fs/types'\nimport type { GreaterThan } from '@kubb/types'\nimport PQueue from 'p-queue'\nimport type { Logger } from './logger.ts'\nimport type { Config, Plugin } from './types.ts'\nimport { createFile, getFileParser } from './utils'\nimport { type DirectoryTree, TreeNode, buildDirectoryTree } from './utils/TreeNode.ts'\n\nexport type FileMetaBase = {\n pluginKey?: Plugin['key']\n}\n\ntype AddResult<T extends Array<KubbFile.File>> = Promise<Awaited<GreaterThan<T['length'], 1> extends true ? Promise<ResolvedFile[]> : Promise<ResolvedFile>>>\n\ntype AddIndexesProps = {\n /**\n * Root based on root and output.path specified in the config\n */\n root: string\n files: KubbFile.File[]\n /**\n * Output for plugin\n */\n output: {\n path: string\n extName?: KubbFile.Extname\n exportAs?: string\n exportType?: 'barrel' | 'barrelNamed' | false\n }\n group?: {\n output: string\n exportAs: string\n }\n logger?: Logger\n\n meta?: FileMetaBase\n}\n\nexport class FileManager {\n #filesByPath: Map<KubbFile.Path, KubbFile.ResolvedFile> = new Map()\n #files: Set<KubbFile.ResolvedFile> = new Set()\n constructor() {\n return this\n }\n\n get files(): Array<KubbFile.ResolvedFile> {\n return Array.from(this.#files)\n }\n\n get orderedFiles(): Array<KubbFile.ResolvedFile> {\n return orderBy(Array.from(this.#files), [\n (v) => v?.meta && 'pluginKey' in v.meta && !v.meta.pluginKey,\n (v) => v.path.length,\n (v) => trimExtName(v.path).endsWith('index'),\n (v) => trimExtName(v.baseName),\n (v) => v.path.split('.').pop(),\n ])\n }\n\n get groupedFiles(): DirectoryTree | null {\n return buildDirectoryTree(Array.from(this.#files))\n }\n\n get treeNode(): TreeNode | null {\n return TreeNode.build(Array.from(this.#files))\n }\n\n async add<T extends Array<KubbFile.File> = Array<KubbFile.File>>(...files: T): AddResult<T> {\n const promises = files.map((file) => {\n if (file.override) {\n return this.#add(file)\n }\n\n return this.#addOrAppend(file)\n })\n\n const resolvedFiles = await Promise.all(promises)\n\n if (files.length > 1) {\n return resolvedFiles as unknown as AddResult<T>\n }\n\n return resolvedFiles[0] as unknown as AddResult<T>\n }\n\n async #add(file: KubbFile.File): Promise<ResolvedFile> {\n const resolvedFile = createFile(file)\n\n this.#filesByPath.set(resolvedFile.path, resolvedFile)\n this.#files.add(resolvedFile)\n\n return resolvedFile\n }\n\n clear() {\n this.#filesByPath.clear()\n this.#files.clear()\n }\n\n async #addOrAppend(file: KubbFile.File): Promise<ResolvedFile> {\n const previousFile = this.#filesByPath.get(file.path)\n\n if (previousFile) {\n this.#filesByPath.delete(previousFile.path)\n this.#files.delete(previousFile)\n\n return this.#add(mergeFile(previousFile, file))\n }\n return this.#add(file)\n }\n\n getCacheById(id: string): KubbFile.File | undefined {\n let cache: KubbFile.File | undefined\n\n this.#files.forEach((file) => {\n if (file.id === id) {\n cache = file\n }\n })\n return cache\n }\n\n getByPath(path: KubbFile.Path): KubbFile.ResolvedFile | undefined {\n return this.#filesByPath.get(path)\n }\n\n deleteByPath(path: KubbFile.Path): void {\n const cacheItem = this.getByPath(path)\n if (!cacheItem) {\n return\n }\n\n this.#filesByPath.delete(path)\n this.#files.delete(cacheItem)\n }\n\n async getBarrelFiles({ files, meta, root, output, logger }: AddIndexesProps): Promise<KubbFile.File[]> {\n const { exportType = 'barrelNamed' } = output\n const barrelManager = new BarrelManager({ logger })\n\n if (exportType === false) {\n return []\n }\n\n const pathToBuildFrom = join(root, output.path)\n\n if (trimExtName(pathToBuildFrom).endsWith('index')) {\n logger?.emit('warning', 'Output has the same fileName as the barrelFiles, please disable barrel generation')\n\n return []\n }\n\n const barrelFiles = barrelManager.getFiles(files, pathToBuildFrom)\n\n if (exportType === 'barrel') {\n return barrelFiles.map((file) => {\n return {\n ...file,\n exports: file.exports?.map((exportItem) => {\n return {\n ...exportItem,\n name: undefined,\n }\n }),\n }\n })\n }\n\n return barrelFiles.map((indexFile) => {\n return {\n ...indexFile,\n meta,\n }\n })\n }\n\n async write(...params: Parameters<typeof write>): ReturnType<typeof write> {\n return write(...params)\n }\n\n async read(...params: Parameters<typeof read>): ReturnType<typeof read> {\n return read(...params)\n }\n\n // statics\n static getMode(path: string | undefined | null): KubbFile.Mode {\n if (!path) {\n return 'split'\n }\n return extname(path) ? 'single' : 'split'\n }\n}\n\ntype GetSourceOptions = {\n logger?: Logger\n}\n\nexport async function getSource<TMeta extends FileMetaBase = FileMetaBase>(file: ResolvedFile<TMeta>, { logger }: GetSourceOptions = {}): Promise<string> {\n const parser = await getFileParser(file.extName)\n\n return parser.print(file, { logger })\n}\n\nexport function mergeFile<TMeta extends FileMetaBase = FileMetaBase>(a: KubbFile.File<TMeta>, b: KubbFile.File<TMeta>): KubbFile.File<TMeta> {\n return {\n ...a,\n sources: [...(a.sources || []), ...(b.sources || [])],\n imports: [...(a.imports || []), ...(b.imports || [])],\n exports: [...(a.exports || []), ...(b.exports || [])],\n }\n}\n\nexport function combineSources(sources: Array<KubbFile.Source>): Array<KubbFile.Source> {\n return sources.reduce(\n (prev, curr) => {\n const prevByName = prev.findLast((imp) => imp.name === curr.name)\n const prevByPathAndIsExportable = prev.findLast((imp) => imp.name === curr.name && imp.isExportable)\n\n if (prevByPathAndIsExportable) {\n // we already have an export that has the same name but uses `isExportable` (export type ...)\n return [...prev, curr]\n }\n\n if (prevByName) {\n prevByName.value = curr.value\n prevByName.isExportable = curr.isExportable\n prevByName.isTypeOnly = curr.isTypeOnly\n prevByName.isIndexable = curr.isIndexable\n\n return prev\n }\n\n return [...prev, curr]\n },\n [] as Array<KubbFile.Source>,\n )\n}\n\nexport function combineExports(exports: Array<KubbFile.Export>): Array<KubbFile.Export> {\n const combinedExports = exports.reduce(\n (prev, curr) => {\n const name = curr.name\n const prevByPath = prev.findLast((imp) => imp.path === curr.path)\n const prevByPathAndIsTypeOnly = prev.findLast((imp) => imp.path === curr.path && isDeepEqual(imp.name, name) && imp.isTypeOnly)\n\n if (prevByPathAndIsTypeOnly) {\n // we already have an export that has the same path but uses `isTypeOnly` (export type ...)\n return prev\n }\n\n const uniquePrev = prev.findLast(\n (imp) => imp.path === curr.path && isDeepEqual(imp.name, name) && imp.isTypeOnly === curr.isTypeOnly && imp.asAlias === curr.asAlias,\n )\n\n // we already have an item that was unique enough or name field is empty or prev asAlias is set but current has no changes\n if (uniquePrev || (Array.isArray(name) && !name.length) || (prevByPath?.asAlias && !curr.asAlias)) {\n return prev\n }\n\n if (!prevByPath) {\n return [\n ...prev,\n {\n ...curr,\n name: Array.isArray(name) ? [...new Set(name)] : name,\n },\n ]\n }\n\n // merge all names when prev and current both have the same isTypeOnly set\n if (prevByPath && Array.isArray(prevByPath.name) && Array.isArray(curr.name) && prevByPath.isTypeOnly === curr.isTypeOnly) {\n prevByPath.name = [...new Set([...prevByPath.name, ...curr.name])]\n\n return prev\n }\n\n return [...prev, curr]\n },\n [] as Array<KubbFile.Export>,\n )\n\n return orderBy(combinedExports, [\n (v) => !!Array.isArray(v.name),\n (v) => !v.isTypeOnly,\n (v) => v.path,\n (v) => !!v.name,\n (v) => (Array.isArray(v.name) ? orderBy(v.name) : v.name),\n ])\n}\n\nexport function combineImports(imports: Array<KubbFile.Import>, exports: Array<KubbFile.Export>, source?: string): Array<KubbFile.Import> {\n const combinedImports = imports.reduce(\n (prev, curr) => {\n let name = Array.isArray(curr.name) ? [...new Set(curr.name)] : curr.name\n\n const hasImportInSource = (importName: string) => {\n if (!source) {\n return true\n }\n\n const checker = (name?: string) => name && !!source.includes(name)\n\n return checker(importName) || exports.some(({ name }) => (Array.isArray(name) ? name.some(checker) : checker(name)))\n }\n\n if (curr.path === curr.root) {\n // root and path are the same file, remove the \"./\" import\n return prev\n }\n\n // merge all names and check if the importName is being used in the generated source and if not filter those imports out\n if (Array.isArray(name)) {\n name = name.filter((item) => (typeof item === 'string' ? hasImportInSource(item) : hasImportInSource(item.propertyName)))\n }\n\n const prevByPath = prev.findLast((imp) => imp.path === curr.path && imp.isTypeOnly === curr.isTypeOnly)\n const uniquePrev = prev.findLast((imp) => imp.path === curr.path && isDeepEqual(imp.name, name) && imp.isTypeOnly === curr.isTypeOnly)\n const prevByPathNameAndIsTypeOnly = prev.findLast((imp) => imp.path === curr.path && isDeepEqual(imp.name, name) && imp.isTypeOnly)\n\n if (prevByPathNameAndIsTypeOnly) {\n // we already have an export that has the same path but uses `isTypeOnly` (import type ...)\n return prev\n }\n\n // already unique enough or name is empty\n if (uniquePrev || (Array.isArray(name) && !name.length)) {\n return prev\n }\n\n // new item, append name\n if (!prevByPath) {\n return [\n ...prev,\n {\n ...curr,\n name,\n },\n ]\n }\n\n // merge all names when prev and current both have the same isTypeOnly set\n if (prevByPath && Array.isArray(prevByPath.name) && Array.isArray(name) && prevByPath.isTypeOnly === curr.isTypeOnly) {\n prevByPath.name = [...new Set([...prevByPath.name, ...name])]\n\n return prev\n }\n\n // no import was found in the source, ignore import\n if (!Array.isArray(name) && name && !hasImportInSource(name)) {\n return prev\n }\n\n return [...prev, curr]\n },\n [] as Array<KubbFile.Import>,\n )\n\n return orderBy(combinedImports, [\n (v) => !!Array.isArray(v.name),\n (v) => !v.isTypeOnly,\n (v) => v.path,\n (v) => !!v.name,\n (v) => (Array.isArray(v.name) ? orderBy(v.name) : v.name),\n ])\n}\ntype WriteFilesProps = {\n config: Config\n files: Array<KubbFile.ResolvedFile>\n logger: Logger\n dryRun?: boolean\n}\n/**\n * Global queue\n */\nconst queue = new PQueue({ concurrency: 100 })\n\nexport async function processFiles({ dryRun, config, logger, files }: WriteFilesProps) {\n const orderedFiles = orderBy(files, [\n (v) => v?.meta && 'pluginKey' in v.meta && !v.meta.pluginKey,\n (v) => v.path.length,\n (v) => trimExtName(v.path).endsWith('index'),\n ])\n\n logger.emit('debug', {\n logs: [JSON.stringify({ files: orderedFiles }, null, 2)],\n fileName: 'kubb-files.json',\n override: true,\n })\n\n if (!dryRun) {\n const size = orderedFiles.length\n\n logger.emit('progress_start', { id: 'files', size })\n const promises = orderedFiles.map(async (file) => {\n await queue.add(async () => {\n const source = await getSource(file, { logger })\n\n await write(file.path, source, { sanity: false })\n\n logger.emit('progress', { id: 'files', data: file ? relative(config.root, file.path) : '' })\n })\n })\n\n await Promise.all(promises)\n\n logger.emit('progress_stop', { id: 'files' })\n }\n\n return files\n}\n","import { join } from 'node:path'\n\nimport { TreeNode } from './utils/TreeNode.ts'\n\nimport { getRelativePath } from '@kubb/fs'\nimport type * as KubbFile from '@kubb/fs/types'\nimport { combineExports, combineSources } from './FileManager.ts'\nimport type { Logger } from './logger.ts'\n\nexport type BarrelManagerOptions = {\n logger?: Logger\n}\n\nexport class BarrelManager {\n #options: BarrelManagerOptions\n\n constructor(options: BarrelManagerOptions = {}) {\n this.#options = options\n\n return this\n }\n\n getFiles(generatedFiles: KubbFile.File[], root?: string): Array<KubbFile.File> {\n const { logger } = this.#options\n\n const files = new Map<KubbFile.Path, KubbFile.File>()\n\n TreeNode.build(generatedFiles, root)?.forEach((treeNode) => {\n if (!treeNode || !treeNode.children || !treeNode.parent?.data.path) {\n return undefined\n }\n\n const barrelPath: KubbFile.Path = join(treeNode.parent?.data.path, 'index.ts')\n\n const leaves = treeNode.leaves\n\n // biome-ignore lint/complexity/useFlatMap: we have a custom map in TreeNode\n const exports = leaves\n .map((item) => {\n if (!item.data.name) {\n return undefined\n }\n\n const sources = item.data.file?.sources || []\n\n if (!sources.some((source) => source.isIndexable)) {\n logger?.emit(\n 'warning',\n `No isIndexable source found(source should have a name and isIndexable):\\nFile: ${JSON.stringify(item.data.file, undefined, 2)}`,\n )\n }\n\n return sources.map((source) => {\n if (!item.data.file?.path || !source.isIndexable) {\n return undefined\n }\n\n // true when we have a subdirectory that also contains barrel files\n const isSubExport = !!treeNode.parent?.data.path?.split?.('/')?.length\n\n if (isSubExport) {\n return {\n name: [source.name],\n path: getRelativePath(treeNode.parent?.data.path, item.data.path),\n isTypeOnly: source.isTypeOnly,\n } as KubbFile.Export\n }\n\n return {\n name: [source.name],\n path: `./${item.data.file.baseName}`,\n isTypeOnly: source.isTypeOnly,\n } as KubbFile.Export\n })\n })\n .flat()\n .filter(Boolean)\n\n const barrelFile: KubbFile.File = {\n path: barrelPath,\n baseName: 'index.ts',\n exports: exports,\n sources: exports.flatMap((item) => {\n if (Array.isArray(item.name)) {\n return item.name.map((name) => {\n return {\n name: name,\n isTypeOnly: item.isTypeOnly,\n //TODO use parser to generate import\n value: '',\n isExportable: false,\n isIndexable: false,\n } as KubbFile.Source\n })\n }\n return [\n {\n name: item.name,\n isTypeOnly: item.isTypeOnly,\n //TODO use parser to generate import\n value: '',\n isExportable: false,\n isIndexable: false,\n } as KubbFile.Source,\n ]\n }),\n }\n\n const previousBarrelFile = files.get(barrelFile.path)\n\n if (previousBarrelFile) {\n files.set(barrelFile.path, {\n ...previousBarrelFile,\n ...barrelFile,\n exports: combineExports([...(previousBarrelFile.exports || []), ...(barrelFile.exports || [])]),\n sources: combineSources([...(previousBarrelFile.sources || []), ...(barrelFile.sources || [])]),\n })\n } else {\n files.set(barrelFile.path, barrelFile)\n }\n })\n\n return [...files.values()]\n }\n}\n","import type * as KubbFile from '@kubb/fs/types'\nimport { FileManager } from '../FileManager.ts'\n\ntype BarrelData = {\n file?: KubbFile.File\n /**\n * @deprecated use file instead\n */\n type: KubbFile.Mode\n path: string\n name: string\n}\n\nexport class TreeNode {\n public data: BarrelData\n\n public parent?: TreeNode\n\n public children: Array<TreeNode> = []\n\n constructor(data: BarrelData, parent?: TreeNode) {\n this.data = data\n this.parent = parent\n return this\n }\n\n addChild(data: BarrelData): TreeNode {\n const child = new TreeNode(data, this)\n if (!this.children) {\n this.children = []\n }\n this.children.push(child)\n return child\n }\n\n find(data?: BarrelData): TreeNode | null {\n if (!data) {\n return null\n }\n\n if (data === this.data) {\n return this\n }\n\n if (this.children?.length) {\n for (let i = 0, { length } = this.children, target: TreeNode | null = null; i < length; i++) {\n target = this.children[i]!.find(data)\n if (target) {\n return target\n }\n }\n }\n\n return null\n }\n\n get leaves(): Array<TreeNode> {\n if (!this.children || this.children.length === 0) {\n // this is a leaf\n return [this]\n }\n\n // if not a leaf, return all children's leaves recursively\n const leaves: TreeNode[] = []\n if (this.children) {\n for (let i = 0, { length } = this.children; i < length; i++) {\n leaves.push.apply(leaves, this.children[i]!.leaves)\n }\n }\n return leaves\n }\n\n get root(): TreeNode {\n if (!this.parent) {\n return this\n }\n return this.parent.root\n }\n\n forEach(callback: (treeNode: TreeNode) => void): this {\n if (typeof callback !== 'function') {\n throw new TypeError('forEach() callback must be a function')\n }\n\n // run this node through function\n callback(this)\n\n // do the same for all children\n if (this.children) {\n for (let i = 0, { length } = this.children; i < length; i++) {\n this.children[i]?.forEach(callback)\n }\n }\n\n return this\n }\n\n filter(callback: (treeNode: TreeNode) => boolean): Array<TreeNode> {\n let data: Array<TreeNode> = []\n if (typeof callback !== 'function') {\n throw new TypeError('forEach() callback must be a function')\n }\n\n // run this node through function\n if (callback(this)) {\n data.push(this)\n }\n\n // do the same for all children\n if (this.children) {\n for (let i = 0, { length } = this.children; i < length; i++) {\n const childData = this.children[i]?.filter(callback).filter(Boolean) || []\n data = [...new Set([...data, ...childData])]\n }\n }\n\n return data\n }\n\n map<T>(callback: (treeNode: TreeNode) => T): Array<T> {\n let data: Array<T> = []\n if (typeof callback !== 'function') {\n throw new TypeError('forEach() callback must be a function')\n }\n\n // run this node through function\n data.push(callback(this))\n\n // do the same for all children\n if (this.children) {\n for (let i = 0, { length } = this.children; i < length; i++) {\n const childData = this.children[i]?.map(callback).filter(Boolean) || []\n data = [...new Set([...data, ...childData])]\n }\n }\n\n return data\n }\n\n public static build(files: KubbFile.File[], root?: string): TreeNode | null {\n try {\n const filteredTree = buildDirectoryTree(files, root)\n\n if (!filteredTree) {\n return null\n }\n\n const treeNode = new TreeNode({\n name: filteredTree.name,\n path: filteredTree.path,\n file: filteredTree.file,\n type: FileManager.getMode(filteredTree.path),\n })\n\n const recurse = (node: typeof treeNode, item: DirectoryTree) => {\n const subNode = node.addChild({\n name: item.name,\n path: item.path,\n file: item.file,\n type: FileManager.getMode(item.path),\n })\n\n if (item.children?.length) {\n item.children?.forEach((child) => {\n recurse(subNode, child)\n })\n }\n }\n\n filteredTree.children?.forEach((child) => recurse(treeNode, child))\n\n return treeNode\n } catch (e) {\n throw new Error('Something went wrong with creating barrel files with the TreeNode class', { cause: e })\n }\n }\n}\n\nexport type DirectoryTree = {\n name: string\n path: string\n file?: KubbFile.File\n children: Array<DirectoryTree>\n}\n\nexport function buildDirectoryTree(files: Array<KubbFile.File>, rootFolder = ''): DirectoryTree | null {\n const rootPrefix = rootFolder.endsWith('/') ? rootFolder : `${rootFolder}/`\n const filteredFiles = files.filter((file) => (rootFolder ? file.path.startsWith(rootPrefix) && !file.path.endsWith('.json') : !file.path.endsWith('.json')))\n\n if (filteredFiles.length === 0) {\n return null // No files match the root folder\n }\n\n const root: DirectoryTree = {\n name: rootFolder || '',\n path: rootFolder || '',\n children: [],\n }\n\n filteredFiles.forEach((file) => {\n const path = file.path.slice(rootFolder.length)\n const parts = path.split('/')\n let currentLevel: DirectoryTree[] = root.children\n let currentPath = rootFolder\n\n parts.forEach((part, index) => {\n if (index !== 0) {\n currentPath += `/${part}`\n } else {\n currentPath += `${part}`\n }\n\n let existingNode = currentLevel.find((node) => node.name === part)\n\n if (!existingNode) {\n if (index === parts.length - 1) {\n // If it's the last part, it's a file\n existingNode = {\n name: part,\n file,\n path: currentPath,\n } as DirectoryTree\n } else {\n // Otherwise, it's a folder\n existingNode = {\n name: part,\n path: currentPath,\n children: [],\n } as DirectoryTree\n }\n currentLevel.push(existingNode)\n }\n\n // Move to the next level if it's a folder\n if (!existingNode.file) {\n currentLevel = existingNode.children\n }\n })\n })\n\n return root\n}\n"],"mappings":";;;;;;AAuCO,IAAM,iBAAN,MAAM,gBAAe;AAAA,EAC1B,SAAyD,CAAC;AAAA,EAC1D,cAAc;AACZ,WAAO;AAAA,EACT;AAAA,EAEA,IAAI,QAA6B;AAC/B,WAAO,KAAK,OAAO,KAAK;AAAA,EAC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AAwB;AAAA,QAC5C,MAAM,KAAK;AAAA,QACX,MAAM,KAAK;AAAA,QACX,YAAY,KAAK;AAAA,QACjB,SAAS,KAAK;AAAA,MAChB,CAAC;AAAA,IACH,CAAC,EACA,OAAO,OAAO;AAEjB,UAAM,SAAS,CAAC,OAAO,MAAM,CAAC,GAAG,aAAa,GAAG,WAAW,CAAC,GAAG,KAAK,QAAQ,IAAI,CAAC,SAAS,KAAK,KAAK,EAAE,KAAK,MAAM,CAAC,EAAE,KAAK,IAAI;AAG9H,WAAO,OAAO,MAAM,CAAC,GAAG,EAAE,QAAQ,eAAe,MAAM,CAAC;AAAA,EAC1D;AACF,CAAC;AAED,IAAM,gBAAgB,iBAAiB;AAAA,EACrC,SAAS;AACP,WAAO;AAAA,EACT;AAAA,EACA,MAAM,MAAM,MAAM,EAAE,OAAO,GAAG;AAC5B,WAAO,KAAK,QAAQ,IAAI,CAAC,SAAS,KAAK,KAAK,EAAE,KAAK,MAAM;AAAA,EAC3D;AACF,CAAC;AAED,IAAM,UAAuD;AAAA,EAC3D,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AACX;AAEA,eAAsB,cAA6C,SAAqE;AACtI,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,EACT;AAEA,QAAM,SAAS,QAAQ,OAAO;AAE9B,MAAI,CAAC,QAAQ;AACX,YAAQ,KAAK,gCAAgC,OAAO,+BAA+B;AAAA,EACrF;AAEA,SAAO,UAAU;AACnB;AAEO,SAASD,aAAY,MAAsB;AAChD,QAAM,UAAU,KAAK,MAAM,GAAG,EAAE,IAAI;AAEpC,SAAO,KAAK,QAAQ,IAAI,OAAO,IAAI,EAAE;AACvC;","names":["item","extname","getRelativePath","join","join","name","extname","trimExtName","getRelativePath"]}
|
|
@@ -646,7 +646,8 @@ var BarrelManager = class {
|
|
|
646
646
|
}
|
|
647
647
|
getFiles(generatedFiles, root) {
|
|
648
648
|
const { logger } = this.#options;
|
|
649
|
-
const files =
|
|
649
|
+
const files = /* @__PURE__ */ new Map();
|
|
650
|
+
_optionalChain([TreeNode, 'access', _41 => _41.build, 'call', _42 => _42(generatedFiles, root), 'optionalAccess', _43 => _43.forEach, 'call', _44 => _44((treeNode) => {
|
|
650
651
|
if (!treeNode || !treeNode.children || !_optionalChain([treeNode, 'access', _45 => _45.parent, 'optionalAccess', _46 => _46.data, 'access', _47 => _47.path])) {
|
|
651
652
|
return void 0;
|
|
652
653
|
}
|
|
@@ -657,15 +658,15 @@ var BarrelManager = class {
|
|
|
657
658
|
return void 0;
|
|
658
659
|
}
|
|
659
660
|
const sources = _optionalChain([item, 'access', _51 => _51.data, 'access', _52 => _52.file, 'optionalAccess', _53 => _53.sources]) || [];
|
|
660
|
-
if (!sources.some((source) => source.
|
|
661
|
+
if (!sources.some((source) => source.isIndexable)) {
|
|
661
662
|
_optionalChain([logger, 'optionalAccess', _54 => _54.emit, 'call', _55 => _55(
|
|
662
663
|
"warning",
|
|
663
|
-
`No
|
|
664
|
+
`No isIndexable source found(source should have a name and isIndexable):
|
|
664
665
|
File: ${JSON.stringify(item.data.file, void 0, 2)}`
|
|
665
666
|
)]);
|
|
666
667
|
}
|
|
667
668
|
return sources.map((source) => {
|
|
668
|
-
if (!_optionalChain([item, 'access', _56 => _56.data, 'access', _57 => _57.file, 'optionalAccess', _58 => _58.path]) || !source.
|
|
669
|
+
if (!_optionalChain([item, 'access', _56 => _56.data, 'access', _57 => _57.file, 'optionalAccess', _58 => _58.path]) || !source.isIndexable) {
|
|
669
670
|
return void 0;
|
|
670
671
|
}
|
|
671
672
|
const isSubExport = !!_optionalChain([treeNode, 'access', _59 => _59.parent, 'optionalAccess', _60 => _60.data, 'access', _61 => _61.path, 'optionalAccess', _62 => _62.split, 'optionalCall', _63 => _63("/"), 'optionalAccess', _64 => _64.length]);
|
|
@@ -683,12 +684,11 @@ File: ${JSON.stringify(item.data.file, void 0, 2)}`
|
|
|
683
684
|
};
|
|
684
685
|
});
|
|
685
686
|
}).flat().filter(Boolean);
|
|
686
|
-
const combinedExports = combineExports(exports);
|
|
687
687
|
const barrelFile = {
|
|
688
688
|
path: barrelPath,
|
|
689
689
|
baseName: "index.ts",
|
|
690
|
-
exports
|
|
691
|
-
sources:
|
|
690
|
+
exports,
|
|
691
|
+
sources: exports.flatMap((item) => {
|
|
692
692
|
if (Array.isArray(item.name)) {
|
|
693
693
|
return item.name.map((name) => {
|
|
694
694
|
return {
|
|
@@ -696,7 +696,8 @@ File: ${JSON.stringify(item.data.file, void 0, 2)}`
|
|
|
696
696
|
isTypeOnly: item.isTypeOnly,
|
|
697
697
|
//TODO use parser to generate import
|
|
698
698
|
value: "",
|
|
699
|
-
isExportable: false
|
|
699
|
+
isExportable: false,
|
|
700
|
+
isIndexable: false
|
|
700
701
|
};
|
|
701
702
|
});
|
|
702
703
|
}
|
|
@@ -706,14 +707,25 @@ File: ${JSON.stringify(item.data.file, void 0, 2)}`
|
|
|
706
707
|
isTypeOnly: item.isTypeOnly,
|
|
707
708
|
//TODO use parser to generate import
|
|
708
709
|
value: "",
|
|
709
|
-
isExportable: false
|
|
710
|
+
isExportable: false,
|
|
711
|
+
isIndexable: false
|
|
710
712
|
}
|
|
711
713
|
];
|
|
712
714
|
})
|
|
713
715
|
};
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
716
|
+
const previousBarrelFile = files.get(barrelFile.path);
|
|
717
|
+
if (previousBarrelFile) {
|
|
718
|
+
files.set(barrelFile.path, {
|
|
719
|
+
...previousBarrelFile,
|
|
720
|
+
...barrelFile,
|
|
721
|
+
exports: combineExports([...previousBarrelFile.exports || [], ...barrelFile.exports || []]),
|
|
722
|
+
sources: combineSources([...previousBarrelFile.sources || [], ...barrelFile.sources || []])
|
|
723
|
+
});
|
|
724
|
+
} else {
|
|
725
|
+
files.set(barrelFile.path, barrelFile);
|
|
726
|
+
}
|
|
727
|
+
})]);
|
|
728
|
+
return [...files.values()];
|
|
717
729
|
}
|
|
718
730
|
};
|
|
719
731
|
|
|
@@ -854,7 +866,7 @@ var PriorityQueue = class {
|
|
|
854
866
|
}
|
|
855
867
|
dequeue() {
|
|
856
868
|
const item = this.#queue.shift();
|
|
857
|
-
return _optionalChain([item, 'optionalAccess',
|
|
869
|
+
return _optionalChain([item, 'optionalAccess', _68 => _68.run]);
|
|
858
870
|
}
|
|
859
871
|
filter(options) {
|
|
860
872
|
return this.#queue.filter((element) => element.priority === options.priority).map((element) => element.run);
|
|
@@ -900,10 +912,10 @@ var PQueue = class extends import_index.default {
|
|
|
900
912
|
...options
|
|
901
913
|
};
|
|
902
914
|
if (!(typeof options.intervalCap === "number" && options.intervalCap >= 1)) {
|
|
903
|
-
throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${_nullishCoalesce(_optionalChain([options, 'access',
|
|
915
|
+
throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${_nullishCoalesce(_optionalChain([options, 'access', _69 => _69.intervalCap, 'optionalAccess', _70 => _70.toString, 'call', _71 => _71()]), () => ( ""))}\` (${typeof options.intervalCap})`);
|
|
904
916
|
}
|
|
905
917
|
if (options.interval === void 0 || !(Number.isFinite(options.interval) && options.interval >= 0)) {
|
|
906
|
-
throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${_nullishCoalesce(_optionalChain([options, 'access',
|
|
918
|
+
throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${_nullishCoalesce(_optionalChain([options, 'access', _72 => _72.interval, 'optionalAccess', _73 => _73.toString, 'call', _74 => _74()]), () => ( ""))}\` (${typeof options.interval})`);
|
|
907
919
|
}
|
|
908
920
|
this.#carryoverConcurrencyCount = options.carryoverConcurrencyCount;
|
|
909
921
|
this.#isIntervalIgnored = options.intervalCap === Number.POSITIVE_INFINITY || options.interval === 0;
|
|
@@ -1030,7 +1042,7 @@ var PQueue = class extends import_index.default {
|
|
|
1030
1042
|
this.#pending++;
|
|
1031
1043
|
this.#intervalCount++;
|
|
1032
1044
|
try {
|
|
1033
|
-
_optionalChain([options, 'access',
|
|
1045
|
+
_optionalChain([options, 'access', _75 => _75.signal, 'optionalAccess', _76 => _76.throwIfAborted, 'call', _77 => _77()]);
|
|
1034
1046
|
let operation = function_({ signal: options.signal });
|
|
1035
1047
|
if (options.timeout) {
|
|
1036
1048
|
operation = pTimeout(Promise.resolve(operation), { milliseconds: options.timeout });
|
|
@@ -1169,7 +1181,7 @@ var FileManager = class {
|
|
|
1169
1181
|
}
|
|
1170
1182
|
get orderedFiles() {
|
|
1171
1183
|
return _chunkA6PCLWEYcjs.orderBy.call(void 0, Array.from(this.#files), [
|
|
1172
|
-
(v) => _optionalChain([v, 'optionalAccess',
|
|
1184
|
+
(v) => _optionalChain([v, 'optionalAccess', _78 => _78.meta]) && "pluginKey" in v.meta && !v.meta.pluginKey,
|
|
1173
1185
|
(v) => v.path.length,
|
|
1174
1186
|
(v) => _fs.trimExtName.call(void 0, v.path).endsWith("index"),
|
|
1175
1187
|
(v) => _fs.trimExtName.call(void 0, v.baseName),
|
|
@@ -1242,7 +1254,7 @@ var FileManager = class {
|
|
|
1242
1254
|
}
|
|
1243
1255
|
const pathToBuildFrom = _path.join.call(void 0, root, output.path);
|
|
1244
1256
|
if (_fs.trimExtName.call(void 0, pathToBuildFrom).endsWith("index")) {
|
|
1245
|
-
_optionalChain([logger, 'optionalAccess',
|
|
1257
|
+
_optionalChain([logger, 'optionalAccess', _79 => _79.emit, 'call', _80 => _80("warning", "Output has the same fileName as the barrelFiles, please disable barrel generation")]);
|
|
1246
1258
|
return [];
|
|
1247
1259
|
}
|
|
1248
1260
|
const barrelFiles = barrelManager.getFiles(files, pathToBuildFrom);
|
|
@@ -1250,7 +1262,7 @@ var FileManager = class {
|
|
|
1250
1262
|
return barrelFiles.map((file) => {
|
|
1251
1263
|
return {
|
|
1252
1264
|
...file,
|
|
1253
|
-
exports: _optionalChain([file, 'access',
|
|
1265
|
+
exports: _optionalChain([file, 'access', _81 => _81.exports, 'optionalAccess', _82 => _82.map, 'call', _83 => _83((exportItem) => {
|
|
1254
1266
|
return {
|
|
1255
1267
|
...exportItem,
|
|
1256
1268
|
name: void 0
|
|
@@ -1304,6 +1316,7 @@ function combineSources(sources) {
|
|
|
1304
1316
|
prevByName.value = curr.value;
|
|
1305
1317
|
prevByName.isExportable = curr.isExportable;
|
|
1306
1318
|
prevByName.isTypeOnly = curr.isTypeOnly;
|
|
1319
|
+
prevByName.isIndexable = curr.isIndexable;
|
|
1307
1320
|
return prev;
|
|
1308
1321
|
}
|
|
1309
1322
|
return [...prev, curr];
|
|
@@ -1323,7 +1336,7 @@ function combineExports(exports) {
|
|
|
1323
1336
|
const uniquePrev = prev.findLast(
|
|
1324
1337
|
(imp) => imp.path === curr.path && _remeda.isDeepEqual.call(void 0, imp.name, name) && imp.isTypeOnly === curr.isTypeOnly && imp.asAlias === curr.asAlias
|
|
1325
1338
|
);
|
|
1326
|
-
if (uniquePrev || Array.isArray(name) && !name.length || _optionalChain([prevByPath, 'optionalAccess',
|
|
1339
|
+
if (uniquePrev || Array.isArray(name) && !name.length || _optionalChain([prevByPath, 'optionalAccess', _84 => _84.asAlias]) && !curr.asAlias) {
|
|
1327
1340
|
return prev;
|
|
1328
1341
|
}
|
|
1329
1342
|
if (!prevByPath) {
|
|
@@ -1408,7 +1421,7 @@ function combineImports(imports, exports, source) {
|
|
|
1408
1421
|
var queue = new PQueue({ concurrency: 100 });
|
|
1409
1422
|
async function processFiles({ dryRun, config, logger, files }) {
|
|
1410
1423
|
const orderedFiles = _chunkA6PCLWEYcjs.orderBy.call(void 0, files, [
|
|
1411
|
-
(v) => _optionalChain([v, 'optionalAccess',
|
|
1424
|
+
(v) => _optionalChain([v, 'optionalAccess', _85 => _85.meta]) && "pluginKey" in v.meta && !v.meta.pluginKey,
|
|
1412
1425
|
(v) => v.path.length,
|
|
1413
1426
|
(v) => _fs.trimExtName.call(void 0, v.path).endsWith("index")
|
|
1414
1427
|
]);
|
|
@@ -1548,4 +1561,4 @@ function trimExtName2(text) {
|
|
|
1548
1561
|
|
|
1549
1562
|
|
|
1550
1563
|
exports.FunctionParams = FunctionParams; exports.isPromise = isPromise; exports.isPromiseFulfilledResult = isPromiseFulfilledResult; exports.isPromiseRejectedResult = isPromiseRejectedResult; exports.renderTemplate = renderTemplate; exports.timeout = timeout; exports.getUniqueName = getUniqueName; exports.setUniqueName = setUniqueName; exports.URLPath = URLPath; exports.createFile = createFile; exports.createFileImport = createFileImport; exports.createFileExport = createFileExport; exports.createFileParser = createFileParser; exports.getFileParser = getFileParser; exports.FileManager = FileManager; exports.getSource = getSource; exports.processFiles = processFiles;
|
|
1551
|
-
//# sourceMappingURL=chunk-
|
|
1564
|
+
//# sourceMappingURL=chunk-5IGANEGE.cjs.map
|