@kubb/core 0.42.0 → 0.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -12
- package/dist/index.global.js +4 -10
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +4 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -189,7 +189,7 @@ declare const read: (path: string) => Promise<string>;
|
|
|
189
189
|
type Import = {
|
|
190
190
|
name: string | string[];
|
|
191
191
|
path: string;
|
|
192
|
-
|
|
192
|
+
isTypeOnly?: boolean;
|
|
193
193
|
};
|
|
194
194
|
type File = {
|
|
195
195
|
/**
|
|
@@ -230,20 +230,10 @@ declare class FileManager {
|
|
|
230
230
|
private getCache;
|
|
231
231
|
private getCacheByPath;
|
|
232
232
|
private getCountByStatus;
|
|
233
|
-
|
|
233
|
+
getSource(file: File): string;
|
|
234
234
|
get files(): File[];
|
|
235
235
|
add(file: File): Promise<File>;
|
|
236
236
|
addOrAppend(file: File): Promise<File>;
|
|
237
|
-
build(file: File): {
|
|
238
|
-
source: string;
|
|
239
|
-
fileName: string;
|
|
240
|
-
path: string;
|
|
241
|
-
imports?: {
|
|
242
|
-
name: string | string[];
|
|
243
|
-
path: string;
|
|
244
|
-
type?: boolean | undefined;
|
|
245
|
-
}[] | undefined;
|
|
246
|
-
};
|
|
247
237
|
combine(files: Array<File | null>): File[];
|
|
248
238
|
setStatus(id: UUID, status: Status): void;
|
|
249
239
|
get(id: UUID): File | undefined;
|
package/dist/index.global.js
CHANGED
|
@@ -17221,10 +17221,10 @@ var kubb = (function (exports) {
|
|
|
17221
17221
|
const importSource = imports.reduce((prev, curr) => {
|
|
17222
17222
|
if (Array.isArray(curr.name)) {
|
|
17223
17223
|
return `${prev}
|
|
17224
|
-
import ${curr.
|
|
17224
|
+
import ${curr.isTypeOnly ? "type " : ""}{ ${curr.name.join(",")} } from "${curr.path}";`;
|
|
17225
17225
|
}
|
|
17226
17226
|
return `${prev}
|
|
17227
|
-
import ${curr.
|
|
17227
|
+
import ${curr.isTypeOnly ? "type " : ""}${curr.name} from "${curr.path}";`;
|
|
17228
17228
|
}, "");
|
|
17229
17229
|
if (importSource) {
|
|
17230
17230
|
return `${importSource}
|
|
@@ -17263,12 +17263,6 @@ ${file.source}`,
|
|
|
17263
17263
|
}
|
|
17264
17264
|
return this.add(file);
|
|
17265
17265
|
}
|
|
17266
|
-
build(file) {
|
|
17267
|
-
return {
|
|
17268
|
-
...file,
|
|
17269
|
-
source: this.getSource(file)
|
|
17270
|
-
};
|
|
17271
|
-
}
|
|
17272
17266
|
combine(files) {
|
|
17273
17267
|
return files.filter(Boolean).reduce((acc, curr) => {
|
|
17274
17268
|
const prevIndex = acc.findIndex((item) => item.path === curr.path);
|
|
@@ -17612,12 +17606,12 @@ ${curr.source}`,
|
|
|
17612
17606
|
fileManager.events.onSuccess(async () => {
|
|
17613
17607
|
await pluginManager.hookParallel("buildEnd");
|
|
17614
17608
|
setTimeout(() => {
|
|
17615
|
-
done({ files: fileManager.files.map((file) => fileManager.
|
|
17609
|
+
done({ files: fileManager.files.map((file) => ({ ...file, source: fileManager.getSource(file) })) });
|
|
17616
17610
|
}, 1e3);
|
|
17617
17611
|
});
|
|
17618
17612
|
fileManager.events.onAdd(async (id, file) => {
|
|
17619
17613
|
const { path } = file;
|
|
17620
|
-
let
|
|
17614
|
+
let code = fileManager.getSource(file);
|
|
17621
17615
|
const loadedResult = await pluginManager.hookFirst("load", [path]);
|
|
17622
17616
|
if (loadedResult) {
|
|
17623
17617
|
code = loadedResult;
|