@kubb/core 1.4.0 → 1.4.2

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.js DELETED
@@ -1,1519 +0,0 @@
1
- import { createRequire } from 'module';
2
- import crypto from 'node:crypto';
3
- import fs from 'fs-extra';
4
- import pathParser2 from 'node:path';
5
- import { camelCase, camelCaseTransformMerge } from 'change-case';
6
- import { performance } from 'node:perf_hooks';
7
- import { rimraf } from 'rimraf';
8
- import dirTree from 'directory-tree';
9
- import mod from 'node:module';
10
- import { pathToFileURL } from 'node:url';
11
- import pc3 from 'picocolors';
12
- export { default as pc } from 'picocolors';
13
- import seedrandom from 'seedrandom';
14
- import { createImportDeclaration, print, createExportDeclaration } from '@kubb/ts-codegen';
15
- import { EventEmitter as EventEmitter$1 } from 'node:events';
16
-
17
- createRequire(import.meta.url);
18
-
19
- // src/utils/isPromise.ts
20
- function isPromise(result) {
21
- return typeof result?.then === "function";
22
- }
23
- function isPromiseFulfilledResult(result) {
24
- return result.status === "fulfilled";
25
- }
26
- function isPromiseRejectedResult(result) {
27
- return result.status === "rejected";
28
- }
29
- async function safeWriteFileToPath(path, data) {
30
- const passedPath = pathParser2.dirname(pathParser2.resolve(path));
31
- await fs.mkdir(passedPath, { recursive: true });
32
- return fs.writeFile(pathParser2.resolve(path), data, { encoding: "utf-8" });
33
- }
34
- async function write(data, path) {
35
- try {
36
- await fs.stat(path);
37
- const oldContent = await fs.readFile(path, { encoding: "utf-8" });
38
- if (oldContent?.toString() === data) {
39
- return;
40
- }
41
- } catch (_err) {
42
- return safeWriteFileToPath(path, data);
43
- }
44
- return safeWriteFileToPath(path, data);
45
- }
46
-
47
- // src/utils/cache.ts
48
- function createPluginCache(Store = /* @__PURE__ */ Object.create(null)) {
49
- return {
50
- set(id, value) {
51
- Store[id] = [0, value];
52
- },
53
- get(id) {
54
- const item = Store[id];
55
- if (!item) {
56
- return null;
57
- }
58
- item[0] = 0;
59
- return item[1];
60
- },
61
- has(id) {
62
- const item = Store[id];
63
- if (!item) {
64
- return false;
65
- }
66
- item[0] = 0;
67
- return true;
68
- },
69
- delete(id) {
70
- return delete Store[id];
71
- }
72
- };
73
- }
74
- function slash(path, platform = "linux") {
75
- const isWindowsPath = /^\\\\\?\\/.test(path);
76
- if (["linux", "mac"].includes(platform) && !isWindowsPath) {
77
- return path.replaceAll(/\\/g, "/").replace("../", "").trimEnd();
78
- }
79
- return path.replaceAll(/\\/g, "/").replace("../", "").trimEnd();
80
- }
81
- function getRelativePath(rootDir, filePath, platform = "linux") {
82
- if (!rootDir || !filePath) {
83
- throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ""} ${filePath || ""}`);
84
- }
85
- const relativePath = pathParser2.relative(rootDir, filePath);
86
- const path = slash(relativePath, platform);
87
- if (path.startsWith("../")) {
88
- return path.replace(pathParser2.basename(path), pathParser2.basename(path, pathParser2.extname(filePath)));
89
- }
90
- return `./${path.replace(pathParser2.basename(path), pathParser2.basename(path, pathParser2.extname(filePath)))}`;
91
- }
92
- function getPathMode(path) {
93
- if (!path) {
94
- return "directory";
95
- }
96
- return pathParser2.extname(path) ? "file" : "directory";
97
- }
98
- async function read(path) {
99
- return fs.readFile(path, { encoding: "utf8" });
100
- }
101
- function objectToParameters(data, options = {}) {
102
- const { typed } = options;
103
- return data.reduce((acc, [key, value]) => {
104
- const parameterName = camelCase(key, { delimiter: "", transform: camelCaseTransformMerge });
105
- if (typed) {
106
- acc.push(`${parameterName}: ${value}["${key}"]`);
107
- } else {
108
- acc.push(`${parameterName}`);
109
- }
110
- return acc;
111
- }, []).join(", ");
112
- }
113
-
114
- // src/utils/nameSorter.ts
115
- function nameSorter(a, b) {
116
- if (a.name < b.name) {
117
- return -1;
118
- }
119
- if (a.name > b.name) {
120
- return 1;
121
- }
122
- return 0;
123
- }
124
-
125
- // src/utils/jsdoc.ts
126
- function createJSDocBlockText({ comments }) {
127
- const filteredComments = comments.filter(Boolean);
128
- if (!filteredComments.length) {
129
- return "";
130
- }
131
- const text = filteredComments.reduce((acc, comment) => {
132
- return `${acc}
133
- * ${comment}`;
134
- }, "/**");
135
- return `${text}
136
- */`;
137
- }
138
-
139
- // src/utils/getUniqueName.ts
140
- function getUniqueName(originalName, data) {
141
- let used = data[originalName] || 0;
142
- if (used) {
143
- data[originalName] = ++used;
144
- originalName += used;
145
- }
146
- data[originalName] = 1;
147
- return originalName;
148
- }
149
-
150
- // src/utils/timeout.ts
151
- async function timeout(ms) {
152
- return new Promise((resolve) => {
153
- setTimeout(() => {
154
- resolve(true);
155
- }, ms);
156
- });
157
- }
158
- var Queue = class {
159
- queue = [];
160
- workerCount = 0;
161
- maxParallel;
162
- debug = false;
163
- constructor(maxParallel, debug = false) {
164
- this.maxParallel = maxParallel;
165
- this.debug = debug;
166
- }
167
- run(job, options = { controller: new AbortController(), name: crypto.randomUUID(), description: "" }) {
168
- return new Promise((resolve, reject) => {
169
- const item = { reject, resolve, job, name: options.name, description: options.description || options.name };
170
- options.controller?.signal.addEventListener("abort", () => {
171
- this.queue = this.queue.filter((queueItem) => queueItem.name === item.name);
172
- reject("Aborted");
173
- });
174
- this.queue.push(item);
175
- this.work();
176
- });
177
- }
178
- runSync(job, options = { controller: new AbortController(), name: crypto.randomUUID(), description: "" }) {
179
- new Promise((resolve, reject) => {
180
- const item = { reject, resolve, job, name: options.name, description: options.description || options.name };
181
- options.controller?.signal.addEventListener("abort", () => {
182
- this.queue = this.queue.filter((queueItem) => queueItem.name === item.name);
183
- });
184
- this.queue.push(item);
185
- this.work();
186
- });
187
- }
188
- get hasJobs() {
189
- return this.workerCount > 0 || this.queue.length > 0;
190
- }
191
- work() {
192
- if (this.workerCount >= this.maxParallel) {
193
- return;
194
- }
195
- this.workerCount++;
196
- let entry;
197
- while (entry = this.queue.shift()) {
198
- const { reject, resolve, job, name, description } = entry;
199
- if (this.debug) {
200
- performance.mark(name + "_start");
201
- }
202
- job().then((result) => {
203
- resolve(result);
204
- if (this.debug) {
205
- performance.mark(name + "_stop");
206
- performance.measure(description, name + "_start", name + "_stop");
207
- }
208
- }).catch((err) => reject(err));
209
- }
210
- this.workerCount--;
211
- }
212
- };
213
-
214
- // src/utils/getEncodedText.ts
215
- function getEncodedText(text) {
216
- return text ? text.replaceAll("`", "\\`") : "";
217
- }
218
-
219
- // src/utils/renderTemplate.ts
220
- function renderTemplate(template, data = void 0) {
221
- if (!data) {
222
- return template.replace(/{{(.*?)}}/g, "");
223
- }
224
- return template.replace(/{{(.*?)}}/g, (match) => {
225
- const value = data[match.split(/{{|}}/).filter(Boolean)[0].trim()];
226
- return value || "";
227
- });
228
- }
229
- async function clean(path) {
230
- return rimraf(path);
231
- }
232
- var TreeNode = class _TreeNode {
233
- data;
234
- parent;
235
- children = [];
236
- constructor(data, parent) {
237
- this.data = data;
238
- this.parent = parent;
239
- return this;
240
- }
241
- addChild(data) {
242
- const child = new _TreeNode(data, this);
243
- if (!this.children) {
244
- this.children = [];
245
- }
246
- this.children.push(child);
247
- return child;
248
- }
249
- find(data) {
250
- if (!data) {
251
- return null;
252
- }
253
- if (data === this.data) {
254
- return this;
255
- }
256
- if (this.children?.length) {
257
- for (let i = 0, { length } = this.children, target = null; i < length; i++) {
258
- target = this.children[i].find(data);
259
- if (target) {
260
- return target;
261
- }
262
- }
263
- }
264
- return null;
265
- }
266
- get leaves() {
267
- if (!this.children || this.children.length === 0) {
268
- return [this];
269
- }
270
- const leaves = [];
271
- if (this.children) {
272
- for (let i = 0, { length } = this.children; i < length; i++) {
273
- leaves.push.apply(leaves, this.children[i].leaves);
274
- }
275
- }
276
- return leaves;
277
- }
278
- get root() {
279
- if (!this.parent) {
280
- return this;
281
- }
282
- return this.parent.root;
283
- }
284
- forEach(callback) {
285
- if (typeof callback !== "function") {
286
- throw new TypeError("forEach() callback must be a function");
287
- }
288
- callback(this);
289
- if (this.children) {
290
- for (let i = 0, { length } = this.children; i < length; i++) {
291
- this.children[i].forEach(callback);
292
- }
293
- }
294
- return this;
295
- }
296
- static build(path, options = {}) {
297
- try {
298
- const exclude = Array.isArray(options.exclude) ? options.exclude : [options.exclude].filter(Boolean);
299
- const filteredTree = dirTree(path, { extensions: options.extensions, exclude: [/node_modules/, ...exclude] });
300
- if (!filteredTree) {
301
- return null;
302
- }
303
- const treeNode = new _TreeNode({ name: filteredTree.name, path: filteredTree.path, type: filteredTree.type || getPathMode(filteredTree.path) });
304
- const recurse = (node, item) => {
305
- const subNode = node.addChild({ name: item.name, path: item.path, type: item.type || getPathMode(item.path) });
306
- if (item.children?.length) {
307
- item.children?.forEach((child) => {
308
- recurse(subNode, child);
309
- });
310
- }
311
- };
312
- filteredTree.children?.forEach((child) => recurse(treeNode, child));
313
- return treeNode;
314
- } catch (e) {
315
- throw new Error("Something went wrong with creating index files with the TreehNode class", { cause: e });
316
- }
317
- }
318
- };
319
-
320
- // src/utils/transformReservedWord.ts
321
- var reservedWords = [
322
- "abstract",
323
- "arguments",
324
- "boolean",
325
- "break",
326
- "byte",
327
- "case",
328
- "catch",
329
- "char",
330
- "class",
331
- "const",
332
- "continue",
333
- "debugger",
334
- "default",
335
- "delete",
336
- "do",
337
- "double",
338
- "else",
339
- "enum",
340
- "eval",
341
- "export",
342
- "extends",
343
- "false",
344
- "final",
345
- "finally",
346
- "float",
347
- "for",
348
- "function",
349
- "goto",
350
- "if",
351
- "implements",
352
- "import",
353
- "in",
354
- "instanceof",
355
- "int",
356
- "interface",
357
- "let",
358
- "long",
359
- "native",
360
- "new",
361
- "null",
362
- "package",
363
- "private",
364
- "protected",
365
- "public",
366
- "return",
367
- "short",
368
- "static",
369
- "super",
370
- "switch",
371
- "synchronized",
372
- "this",
373
- "throw",
374
- "throws",
375
- "transient",
376
- "true",
377
- "try",
378
- "typeof",
379
- "var",
380
- "void",
381
- "volatile",
382
- "while",
383
- "with",
384
- "yield",
385
- "Array",
386
- "Date",
387
- "eval",
388
- "function",
389
- "hasOwnProperty",
390
- "Infinity",
391
- "isFinite",
392
- "isNaN",
393
- "isPrototypeOf",
394
- "length",
395
- "Math",
396
- "name",
397
- "NaN",
398
- "Number",
399
- "Object",
400
- "prototype",
401
- "String",
402
- "toString",
403
- "undefined",
404
- "valueOf"
405
- ];
406
- function transformReservedWord(word) {
407
- if (word && reservedWords.includes(word) || word?.match(/^\d/)) {
408
- return `_${word}`;
409
- }
410
- return word;
411
- }
412
-
413
- // src/utils/getStackTrace.ts
414
- function getStackTrace(belowFn) {
415
- const oldLimit = Error.stackTraceLimit;
416
- Error.stackTraceLimit = Infinity;
417
- const dummyObject = {};
418
- const v8Handler = Error.prepareStackTrace;
419
- Error.prepareStackTrace = function prepareStackTrace(dummyObject2, v8StackTrace2) {
420
- return v8StackTrace2;
421
- };
422
- Error.captureStackTrace(dummyObject, belowFn || getStackTrace);
423
- const v8StackTrace = dummyObject.stack;
424
- Error.prepareStackTrace = v8Handler;
425
- Error.stackTraceLimit = oldLimit;
426
- return v8StackTrace;
427
- }
428
-
429
- // src/utils/uniqueId.ts
430
- var uniqueId = ((counter) => (str = "") => `${str}${++counter}`)(0);
431
- var SLASHES = /* @__PURE__ */ new Set(["/", "\\"]);
432
- function normalizeDirectory(directory) {
433
- if (!SLASHES.has(directory[directory.length - 1])) {
434
- return `${directory}/`;
435
- }
436
- return directory;
437
- }
438
- function getLocation(path, cwd) {
439
- let location = path;
440
- if (cwd) {
441
- const require2 = mod.createRequire(normalizeDirectory(cwd));
442
- location = require2.resolve(path);
443
- }
444
- return location;
445
- }
446
- async function importModule(path, cwd) {
447
- try {
448
- const location = getLocation(path, cwd);
449
- const module = await import(pathToFileURL(location).href);
450
- return module?.default ?? module;
451
- } catch (e) {
452
- console.log(e);
453
- return void 0;
454
- }
455
- }
456
-
457
- // src/utils/throttle.ts
458
- var throttle = (fn, delay) => {
459
- let wait = false;
460
- let timeout2;
461
- let cancelled = false;
462
- return [
463
- (...args) => {
464
- if (cancelled) {
465
- return void 0;
466
- }
467
- if (wait) {
468
- return void 0;
469
- }
470
- const val = fn(...args);
471
- wait = true;
472
- timeout2 = setTimeout(() => {
473
- wait = false;
474
- }, delay);
475
- return val;
476
- },
477
- () => {
478
- cancelled = true;
479
- clearTimeout(timeout2);
480
- }
481
- ];
482
- };
483
-
484
- // src/utils/SummaryError.ts
485
- var SummaryError = class extends Error {
486
- summary;
487
- constructor(message, options) {
488
- super(message, { cause: options.cause });
489
- this.name = "SummaryError";
490
- this.summary = options.summary || [];
491
- }
492
- };
493
-
494
- // src/utils/Warning.ts
495
- var Warning = class extends Error {
496
- constructor(message, options) {
497
- super(message, { cause: options?.cause });
498
- this.name = "Warning";
499
- }
500
- };
501
- function createLogger(spinner) {
502
- const log = (message) => {
503
- if (message && spinner) {
504
- spinner.text = message;
505
- }
506
- };
507
- const error = (message) => {
508
- if (message) {
509
- throw new Error(message || "Something went wrong");
510
- }
511
- };
512
- const warn = (message) => {
513
- if (message && spinner) {
514
- spinner.warn(pc3.yellow(message));
515
- }
516
- };
517
- const info = (message) => {
518
- if (message && spinner) {
519
- spinner.info(message);
520
- }
521
- };
522
- const logger = {
523
- log,
524
- error,
525
- warn,
526
- info,
527
- spinner
528
- };
529
- return logger;
530
- }
531
- function canLogHierarchy(input, compareTo) {
532
- if (input === "stacktrace") {
533
- return canLogHierarchy("info", compareTo);
534
- }
535
- return input === compareTo;
536
- }
537
- var defaultColours = ["black", "blue", "darkBlue", "cyan", "gray", "green", "darkGreen", "magenta", "red", "darkRed", "yellow", "darkYellow"];
538
- function randomColour(text, colours = defaultColours) {
539
- if (!text) {
540
- return "white";
541
- }
542
- const random = seedrandom(text);
543
- const colour = colours.at(Math.floor(random() * colours.length)) || "white";
544
- return colour;
545
- }
546
- function randomPicoColour(text, colors = defaultColours) {
547
- const colours = pc3.createColors(true);
548
- if (!text) {
549
- return colours.white(text);
550
- }
551
- const colour = randomColour(text, colors);
552
- const isDark = colour.includes("dark");
553
- const key = colour.replace("dark", "").toLowerCase();
554
- const formatter = colours[key];
555
- if (isDark) {
556
- return pc3.bold(formatter(text));
557
- }
558
- if (typeof formatter !== "function") {
559
- throw new Error("Formatter for picoColor is not of type function/Formatter");
560
- }
561
- return formatter(text);
562
- }
563
- var URLPath = class _URLPath {
564
- path;
565
- constructor(path) {
566
- this.path = path;
567
- }
568
- /**
569
- * Convert Swagger path to URLPath(syntax of Express)
570
- * @example /pet/{petId} => /pet/:petId
571
- */
572
- get URL() {
573
- return this.toURLPath();
574
- }
575
- get isUrl() {
576
- return _URLPath.isURL(this.path);
577
- }
578
- /**
579
- * Convert Swagger path to template literals/ template strings(camelcase)
580
- * @example /pet/{petId} => `/pet/${petId}`
581
- * @example /account/monetary-accountID => `/account/${monetaryAccountId}`
582
- * @example /account/userID => `/account/${userId}`
583
- */
584
- get template() {
585
- return this.toTemplateString();
586
- }
587
- /**
588
- * Convert Swagger path to template literals/ template strings(camelcase)
589
- * @example /pet/{petId} => `/pet/${petId}`
590
- * @example /account/monetary-accountID => `/account/${monetaryAccountId}`
591
- * @example /account/userID => `/account/${userId}`
592
- */
593
- toTemplateString() {
594
- return _URLPath.toTemplateString(this.path);
595
- }
596
- /**
597
- * Convert Swagger path to template literals/ template strings(camelcase)
598
- * @example /pet/{petId} => `/pet/${petId}`
599
- * @example /account/monetary-accountID => `/account/${monetaryAccountId}`
600
- * @example /account/userID => `/account/${userId}`
601
- */
602
- static toTemplateString(path) {
603
- const regex = /{(\w|-)*}/g;
604
- const found = path.match(regex);
605
- let newPath = path.replaceAll("{", "${");
606
- if (found) {
607
- newPath = found.reduce((prev, curr) => {
608
- const replacement = `\${${camelCase(curr, { delimiter: "", transform: camelCaseTransformMerge })}}`;
609
- return prev.replace(curr, replacement);
610
- }, path);
611
- }
612
- return `\`${newPath}\``;
613
- }
614
- /**
615
- * Convert Swagger path to URLPath(syntax of Express)
616
- * @example /pet/{petId} => /pet/:petId
617
- */
618
- toURLPath() {
619
- return _URLPath.toURLPath(this.path);
620
- }
621
- static toURLPath(path) {
622
- return path.replaceAll("{", ":").replaceAll("}", "");
623
- }
624
- static isURL(path) {
625
- try {
626
- const url = new URL(path);
627
- if (url?.href) {
628
- return true;
629
- }
630
- } catch (error) {
631
- return false;
632
- }
633
- return false;
634
- }
635
- };
636
- function getIndexes(root, options = {}) {
637
- const tree = TreeNode.build(root, { extensions: /\.ts/, ...options });
638
- if (!tree) {
639
- return null;
640
- }
641
- const fileReducer = (files2, currentTree) => {
642
- if (!currentTree.children) {
643
- return [];
644
- }
645
- if (currentTree.children?.length > 1) {
646
- const path = pathParser2.resolve(currentTree.data.path, "index.ts");
647
- const exports = currentTree.children.map((file) => {
648
- if (!file) {
649
- return void 0;
650
- }
651
- const importPath = file.data.type === "directory" ? `./${file.data.name}` : `./${file.data.name.replace(/\.[^.]*$/, "")}`;
652
- if (importPath.includes("index") && path.includes("index")) {
653
- return void 0;
654
- }
655
- return { path: importPath };
656
- }).filter(Boolean);
657
- files2.push({
658
- path,
659
- fileName: "index.ts",
660
- source: "",
661
- exports
662
- });
663
- } else {
664
- currentTree.children?.forEach((child) => {
665
- const path = pathParser2.resolve(currentTree.data.path, "index.ts");
666
- const importPath = child.data.type === "directory" ? `./${child.data.name}` : `./${child.data.name.replace(/\.[^.]*$/, "")}`;
667
- files2.push({
668
- path,
669
- fileName: "index.ts",
670
- source: "",
671
- exports: [{ path: importPath }]
672
- });
673
- });
674
- }
675
- currentTree.children.forEach((childItem) => {
676
- fileReducer(files2, childItem);
677
- });
678
- return files2;
679
- };
680
- const files = fileReducer([], tree);
681
- return files;
682
- }
683
- function combineFiles(files) {
684
- return files.filter(Boolean).reduce((acc, curr) => {
685
- const prevIndex = acc.findIndex((item) => item.path === curr.path);
686
- if (prevIndex !== -1) {
687
- const prev = acc[prevIndex];
688
- acc[prevIndex] = {
689
- ...curr,
690
- source: prev.source && curr.source ? `${prev.source}
691
- ${curr.source}` : "",
692
- imports: [...prev.imports || [], ...curr.imports || []],
693
- exports: [...prev.exports || [], ...curr.exports || []],
694
- env: { ...prev.env || {}, ...curr.env || {} }
695
- };
696
- } else {
697
- acc.push(curr);
698
- }
699
- return acc;
700
- }, []);
701
- }
702
- var extensions = [".js", ".ts"];
703
- function getFileSource(file) {
704
- let { source } = file;
705
- if (!extensions.some((extension) => file.fileName.endsWith(extension))) {
706
- return file.source;
707
- }
708
- const imports = [];
709
- const exports = [];
710
- file.imports?.forEach((curr) => {
711
- const existingImport = imports.find((imp) => imp.path === curr.path);
712
- if (!existingImport) {
713
- imports.push({
714
- ...curr,
715
- name: Array.isArray(curr.name) ? [...new Set(curr.name)] : curr.name
716
- });
717
- }
718
- if (existingImport && !Array.isArray(existingImport.name) && existingImport.name !== curr.name) {
719
- imports.push(curr);
720
- }
721
- if (existingImport && Array.isArray(existingImport.name)) {
722
- if (Array.isArray(curr.name)) {
723
- existingImport.name = [.../* @__PURE__ */ new Set([...existingImport.name, ...curr.name])];
724
- }
725
- }
726
- });
727
- file.exports?.forEach((curr) => {
728
- const exists = exports.find((imp) => imp.path === curr.path);
729
- if (!exists) {
730
- exports.push({
731
- ...curr,
732
- name: Array.isArray(curr.name) ? [...new Set(curr.name)] : curr.name
733
- });
734
- }
735
- if (exists && !Array.isArray(exists.name) && exists.name !== curr.name && exists.asAlias === curr.asAlias) {
736
- exports.push(curr);
737
- }
738
- if (exists && Array.isArray(exists.name)) {
739
- if (Array.isArray(curr.name)) {
740
- exists.name = [.../* @__PURE__ */ new Set([...exists.name, ...curr.name])];
741
- }
742
- }
743
- });
744
- const importNodes = imports.reduce((prev, curr) => {
745
- return [...prev, createImportDeclaration({ name: curr.name, path: curr.path, isTypeOnly: curr.isTypeOnly })];
746
- }, []);
747
- const importSource = print(importNodes);
748
- const exportNodes = exports.reduce((prev, curr) => {
749
- return [...prev, createExportDeclaration({ name: curr.name, path: curr.path, isTypeOnly: curr.isTypeOnly, asAlias: curr.asAlias })];
750
- }, []);
751
- const exportSource = print(exportNodes);
752
- source = getEnvSource(source, file.env);
753
- if (importSource) {
754
- source = `${importSource}
755
- ${source}`;
756
- }
757
- if (exportSource) {
758
- source = `${exportSource}
759
- ${source}`;
760
- }
761
- return source;
762
- }
763
- function searchAndReplace(options) {
764
- const { text, replaceBy, prefix = "", key } = options;
765
- const searchValues = options.searchValues?.(prefix, key) || [
766
- `${prefix}["${key}"]`,
767
- `${prefix}['${key}']`,
768
- `${prefix}[\`${key}\`]`,
769
- `${prefix}"${key}"`,
770
- `${prefix}'${key}'`,
771
- `${prefix}\`${key}\``,
772
- new RegExp(`${prefix}${key}`, "g")
773
- ];
774
- return searchValues.reduce((prev, searchValue) => {
775
- return prev.toString().replaceAll(searchValue, replaceBy);
776
- }, text);
777
- }
778
- function getEnvSource(source, env) {
779
- if (!env) {
780
- return source;
781
- }
782
- const keys = Object.keys(env);
783
- if (!keys.length) {
784
- return source;
785
- }
786
- return keys.reduce((prev, key) => {
787
- const environmentValue = env[key];
788
- const replaceBy = environmentValue ? `'${environmentValue.replaceAll('"', "")?.replaceAll("'", "")}'` : "undefined";
789
- if (key.toUpperCase() !== key) {
790
- throw new TypeError(`Environment should be in upperCase for ${key}`);
791
- }
792
- if (typeof replaceBy === "string") {
793
- prev = searchAndReplace({ text: prev.replaceAll(`process.env.${key}`, replaceBy), replaceBy, prefix: "process.env", key });
794
- prev = searchAndReplace({ text: prev.replaceAll(new RegExp(`(declare const).*
795
- `, "ig"), ""), replaceBy, key });
796
- }
797
- return prev;
798
- }, source);
799
- }
800
-
801
- // src/managers/fileManager/FileManager.ts
802
- var FileManager = class {
803
- cache = /* @__PURE__ */ new Map();
804
- task;
805
- queue;
806
- constructor(options) {
807
- if (options) {
808
- this.task = options.task;
809
- this.queue = options.queue;
810
- }
811
- }
812
- get extensions() {
813
- return extensions;
814
- }
815
- get files() {
816
- const files = [];
817
- this.cache.forEach((item) => {
818
- files.push(...item.flat(1));
819
- });
820
- return files;
821
- }
822
- get isExecuting() {
823
- return this.queue?.hasJobs ?? false;
824
- }
825
- async add(file) {
826
- const controller = new AbortController();
827
- const resolvedFile = { id: crypto.randomUUID(), ...file };
828
- this.cache.set(resolvedFile.path, [{ cancel: () => controller.abort(), ...resolvedFile }]);
829
- if (this.queue) {
830
- try {
831
- await this.queue.run(
832
- async () => {
833
- return this.task?.(resolvedFile);
834
- },
835
- { controller }
836
- );
837
- } catch {
838
- return resolvedFile;
839
- }
840
- }
841
- return resolvedFile;
842
- }
843
- addOrAppend(file) {
844
- const previousCaches = this.cache.get(file.path);
845
- const previousCache = previousCaches ? previousCaches.at(previousCaches.length - 1) : void 0;
846
- if (previousCache) {
847
- const sourceAlreadyExists = file.source && previousCache.source.includes(file.source);
848
- if (sourceAlreadyExists) {
849
- return Promise.resolve(previousCache);
850
- }
851
- previousCache.cancel?.();
852
- this.cache.delete(previousCache.path);
853
- return this.add({
854
- ...file,
855
- source: previousCache.source && file.source ? `${previousCache.source}
856
- ${file.source}` : "",
857
- imports: [...previousCache.imports || [], ...file.imports || []],
858
- exports: [...previousCache.exports || [], ...file.exports || []],
859
- env: { ...previousCache.env || {}, ...file.env || {} }
860
- });
861
- }
862
- return this.add(file);
863
- }
864
- append(path, file) {
865
- const previousFiles = this.cache.get(path) || [];
866
- this.cache.set(path, [...previousFiles, file]);
867
- }
868
- getCacheByUUID(UUID) {
869
- let cache;
870
- this.cache.forEach((files) => {
871
- cache = files.find((item) => item.id === UUID);
872
- });
873
- return cache;
874
- }
875
- get(path) {
876
- return this.cache.get(path);
877
- }
878
- remove(path) {
879
- const cacheItem = this.get(path);
880
- if (!cacheItem) {
881
- return;
882
- }
883
- this.cache.delete(path);
884
- }
885
- async write(...params) {
886
- if (this.queue) {
887
- return this.queue.run(async () => {
888
- return write(...params);
889
- });
890
- }
891
- return write(...params);
892
- }
893
- async read(...params) {
894
- if (this.queue) {
895
- return this.queue.run(async () => {
896
- return read(...params);
897
- });
898
- }
899
- return read(...params);
900
- }
901
- };
902
- function createPlugin(factory) {
903
- return (options) => {
904
- const plugin = factory(options);
905
- if (Array.isArray(plugin)) {
906
- throw new Error("Not implemented");
907
- }
908
- if (!plugin.transform) {
909
- plugin.transform = function transform(code) {
910
- return code;
911
- };
912
- }
913
- return plugin;
914
- };
915
- }
916
- var pluginName = "core";
917
- var definePlugin = createPlugin((options) => {
918
- const { fileManager, resolvePath, resolveName, logger } = options;
919
- return {
920
- name: pluginName,
921
- options,
922
- api() {
923
- return {
924
- get config() {
925
- return options.config;
926
- },
927
- logger,
928
- fileManager,
929
- async addFile(...files) {
930
- const trace = getStackTrace();
931
- const plugins = options.config.plugins?.filter((plugin) => trace[1].getFileName()?.includes(plugin.name)).sort((a, b) => {
932
- if (a.name.length < b.name.length) {
933
- return 1;
934
- }
935
- if (a.name.length > b.name.length) {
936
- return -1;
937
- }
938
- return 0;
939
- });
940
- const pluginName2 = plugins?.[0]?.name;
941
- return Promise.all(
942
- files.map((file) => {
943
- const fileWithMeta = {
944
- ...file,
945
- meta: {
946
- ...file.meta || {},
947
- pluginName: pluginName2
948
- }
949
- };
950
- if (file.override) {
951
- return fileManager.add(fileWithMeta);
952
- }
953
- return fileManager.addOrAppend(fileWithMeta);
954
- })
955
- );
956
- },
957
- resolvePath,
958
- resolveName: (params) => {
959
- const name = resolveName(params);
960
- return transformReservedWord(name);
961
- },
962
- cache: createPluginCache()
963
- };
964
- },
965
- resolvePath(fileName) {
966
- const root = pathParser2.resolve(this.config.root, this.config.output.path);
967
- return pathParser2.resolve(root, fileName);
968
- },
969
- resolveName(name) {
970
- return name;
971
- }
972
- };
973
- });
974
-
975
- // src/managers/pluginManager/ParallelPluginError.ts
976
- var ParallelPluginError = class extends Error {
977
- errors = [];
978
- pluginManager;
979
- constructor(message, options) {
980
- super(message, { cause: options.cause });
981
- this.name = "ParallelPluginError";
982
- this.errors = options.errors;
983
- this.pluginManager = options.pluginManager;
984
- }
985
- findError(searchError) {
986
- if (!searchError) {
987
- return void 0;
988
- }
989
- return this.errors.find((error) => {
990
- if (error.cause) {
991
- if (error.cause.name == searchError.name) {
992
- return true;
993
- }
994
- return !!this.findError(error.cause);
995
- }
996
- return error.name === searchError.name;
997
- })?.cause;
998
- }
999
- };
1000
-
1001
- // src/managers/pluginManager/PluginError.ts
1002
- var PluginError = class extends Error {
1003
- pluginManager;
1004
- cause;
1005
- constructor(message, options) {
1006
- super(message, { cause: options.cause });
1007
- this.name = "PluginError";
1008
- this.cause = options.cause;
1009
- this.pluginManager = options.pluginManager;
1010
- }
1011
- };
1012
- var EventEmitter = class {
1013
- emitter = new EventEmitter$1();
1014
- emit(eventName, ...eventArg) {
1015
- this.emitter.emit(eventName, ...eventArg);
1016
- }
1017
- on(eventName, handler) {
1018
- this.emitter.on(eventName, handler);
1019
- }
1020
- off(eventName, handler) {
1021
- this.emitter.off(eventName, handler);
1022
- }
1023
- };
1024
-
1025
- // src/managers/pluginManager/pluginParser.ts
1026
- function pluginParser(plugin, context) {
1027
- if (plugin.api && typeof plugin.api === "function") {
1028
- const api = plugin.api.call(context);
1029
- return {
1030
- ...plugin,
1031
- api
1032
- };
1033
- }
1034
- return null;
1035
- }
1036
-
1037
- // src/managers/pluginManager/PluginManager.ts
1038
- var hookNames = {
1039
- validate: 1,
1040
- buildStart: 1,
1041
- resolvePath: 1,
1042
- resolveName: 1,
1043
- load: 1,
1044
- transform: 1,
1045
- writeFile: 1,
1046
- buildEnd: 1
1047
- };
1048
- var hooks = Object.keys(hookNames);
1049
- var PluginManager = class {
1050
- plugins;
1051
- fileManager;
1052
- core;
1053
- queue;
1054
- executed = [];
1055
- logger;
1056
- eventEmitter = new EventEmitter();
1057
- constructor(config, options) {
1058
- this.logger = options.logger;
1059
- this.queue = new Queue(50, options.debug);
1060
- this.fileManager = new FileManager({ task: options.task, queue: this.queue });
1061
- const core = definePlugin({
1062
- config,
1063
- logger: this.logger,
1064
- fileManager: this.fileManager,
1065
- resolvePath: this.resolvePath,
1066
- resolveName: this.resolveName
1067
- });
1068
- this.core = pluginParser(core, core.api.call(null));
1069
- this.plugins = [this.core, ...config.plugins || []].reduce((prev, plugin) => {
1070
- const convertedApi = pluginParser(plugin, this.core?.api);
1071
- if (convertedApi) {
1072
- return [...prev, convertedApi];
1073
- }
1074
- return [...prev, plugin];
1075
- }, []);
1076
- }
1077
- resolvePath = (params) => {
1078
- if (params.pluginName) {
1079
- return this.hookForPluginSync({
1080
- pluginName: params.pluginName,
1081
- hookName: "resolvePath",
1082
- parameters: [params.fileName, params.directory, params.options]
1083
- });
1084
- }
1085
- return this.hookFirstSync({
1086
- hookName: "resolvePath",
1087
- parameters: [params.fileName, params.directory, params.options]
1088
- }).result;
1089
- };
1090
- resolveName = (params) => {
1091
- if (params.pluginName) {
1092
- return this.hookForPluginSync({
1093
- pluginName: params.pluginName,
1094
- hookName: "resolveName",
1095
- parameters: [params.name]
1096
- }) || params.name;
1097
- }
1098
- return this.hookFirstSync({
1099
- hookName: "resolveName",
1100
- parameters: [params.name]
1101
- }).result;
1102
- };
1103
- on(eventName, handler) {
1104
- this.eventEmitter.on(eventName, handler);
1105
- }
1106
- /**
1107
- *
1108
- * Run only hook for a specific plugin name
1109
- */
1110
- hookForPlugin({
1111
- pluginName: pluginName2,
1112
- hookName,
1113
- parameters
1114
- }) {
1115
- const plugin = this.getPlugin(hookName, pluginName2);
1116
- return this.execute({
1117
- strategy: "hookFirst",
1118
- hookName,
1119
- parameters,
1120
- plugin
1121
- });
1122
- }
1123
- hookForPluginSync({
1124
- pluginName: pluginName2,
1125
- hookName,
1126
- parameters
1127
- }) {
1128
- const plugin = this.getPlugin(hookName, pluginName2);
1129
- return this.executeSync({
1130
- strategy: "hookFirst",
1131
- hookName,
1132
- parameters,
1133
- plugin
1134
- });
1135
- }
1136
- /**
1137
- *
1138
- * Chains, first non-null result stops and returns
1139
- */
1140
- hookFirst({
1141
- hookName,
1142
- parameters,
1143
- skipped
1144
- }) {
1145
- let promise = Promise.resolve(null);
1146
- for (const plugin of this.getSortedPlugins(hookName)) {
1147
- if (skipped && skipped.has(plugin)) {
1148
- continue;
1149
- }
1150
- promise = promise.then(async (parseResult) => {
1151
- if (parseResult?.result != null) {
1152
- return parseResult;
1153
- }
1154
- const value = await this.execute({
1155
- strategy: "hookFirst",
1156
- hookName,
1157
- parameters,
1158
- plugin
1159
- });
1160
- return Promise.resolve({
1161
- plugin,
1162
- result: value
1163
- });
1164
- });
1165
- }
1166
- return promise;
1167
- }
1168
- /**
1169
- *
1170
- * Chains, first non-null result stops and returns
1171
- */
1172
- hookFirstSync({
1173
- hookName,
1174
- parameters,
1175
- skipped
1176
- }) {
1177
- let parseResult = null;
1178
- for (const plugin of this.getSortedPlugins(hookName)) {
1179
- if (skipped && skipped.has(plugin)) {
1180
- continue;
1181
- }
1182
- parseResult = {
1183
- result: this.executeSync({
1184
- strategy: "hookFirst",
1185
- hookName,
1186
- parameters,
1187
- plugin
1188
- }),
1189
- plugin
1190
- };
1191
- if (parseResult?.result != null) {
1192
- break;
1193
- }
1194
- }
1195
- return parseResult;
1196
- }
1197
- /**
1198
- *
1199
- * Parallel, runs all plugins
1200
- */
1201
- async hookParallel({
1202
- hookName,
1203
- parameters
1204
- }) {
1205
- const parallelPromises = [];
1206
- for (const plugin of this.getSortedPlugins(hookName)) {
1207
- const promise = this.execute({ strategy: "hookParallel", hookName, parameters, plugin });
1208
- if (promise) {
1209
- parallelPromises.push(promise);
1210
- }
1211
- }
1212
- const results = await Promise.allSettled(parallelPromises);
1213
- const errors = results.map((result) => {
1214
- if (isPromiseRejectedResult(result) && result.reason instanceof PluginError) {
1215
- return result.reason;
1216
- }
1217
- return void 0;
1218
- }).filter(Boolean);
1219
- if (errors.length) {
1220
- throw new ParallelPluginError("Error", { errors, pluginManager: this });
1221
- }
1222
- return results.filter((result) => result.status === "fulfilled").map((result) => result.value);
1223
- }
1224
- /**
1225
- *
1226
- * Chains, reduces returned value, handling the reduced value as the first hook argument
1227
- */
1228
- hookReduceArg0({
1229
- hookName,
1230
- parameters,
1231
- reduce
1232
- }) {
1233
- const [argument0, ...rest] = parameters;
1234
- let promise = Promise.resolve(argument0);
1235
- for (const plugin of this.getSortedPlugins(hookName)) {
1236
- promise = promise.then((arg0) => {
1237
- const value = this.execute({
1238
- strategy: "hookReduceArg0",
1239
- hookName,
1240
- parameters: [arg0, ...rest],
1241
- plugin
1242
- });
1243
- return value;
1244
- }).then((result) => reduce.call(this.core.api, argument0, result, plugin));
1245
- }
1246
- return promise;
1247
- }
1248
- /**
1249
- * Chains plugins
1250
- */
1251
- hookSeq({ hookName, parameters }) {
1252
- let promise = Promise.resolve();
1253
- for (const plugin of this.getSortedPlugins(hookName)) {
1254
- promise = promise.then(
1255
- () => this.execute({
1256
- strategy: "hookSeq",
1257
- hookName,
1258
- parameters,
1259
- plugin
1260
- })
1261
- );
1262
- }
1263
- return promise.then(noReturn);
1264
- }
1265
- getSortedPlugins(_hookName) {
1266
- const plugins = [...this.plugins].filter((plugin) => plugin.name !== "core");
1267
- return plugins;
1268
- }
1269
- getPlugin(hookName, pluginName2) {
1270
- const plugins = [...this.plugins];
1271
- const pluginByPluginName = plugins.find((item) => item.name === pluginName2 && item[hookName]);
1272
- if (!pluginByPluginName) {
1273
- return this.core;
1274
- }
1275
- return pluginByPluginName;
1276
- }
1277
- addExecutedToCallStack(executer) {
1278
- if (executer) {
1279
- this.eventEmitter.emit("execute", executer);
1280
- this.executed.push(executer);
1281
- }
1282
- }
1283
- /**
1284
- * Run an async plugin hook and return the result.
1285
- * @param hookName Name of the plugin hook. Must be either in `PluginHooks` or `OutputPluginValueHooks`.
1286
- * @param args Arguments passed to the plugin hook.
1287
- * @param plugin The actual pluginObject to run.
1288
- */
1289
- // Implementation signature
1290
- execute({
1291
- strategy,
1292
- hookName,
1293
- parameters,
1294
- plugin
1295
- }) {
1296
- const hook = plugin[hookName];
1297
- let output;
1298
- if (!hook) {
1299
- return null;
1300
- }
1301
- this.eventEmitter.emit("execute", { strategy, hookName, parameters, plugin });
1302
- const task = Promise.resolve().then(() => {
1303
- if (typeof hook === "function") {
1304
- const possiblePromiseResult = hook.apply(this.core.api, parameters);
1305
- if (isPromise(possiblePromiseResult)) {
1306
- return Promise.resolve(possiblePromiseResult);
1307
- }
1308
- return possiblePromiseResult;
1309
- }
1310
- return hook;
1311
- }).then((result) => {
1312
- output = result;
1313
- return result;
1314
- }).catch((e) => {
1315
- this.catcher(e, plugin, hookName);
1316
- return null;
1317
- }).finally(() => {
1318
- this.addExecutedToCallStack({
1319
- parameters,
1320
- output,
1321
- strategy,
1322
- hookName,
1323
- plugin
1324
- });
1325
- });
1326
- return this.queue.run(() => task);
1327
- }
1328
- /**
1329
- * Run a sync plugin hook and return the result.
1330
- * @param hookName Name of the plugin hook. Must be in `PluginHooks`.
1331
- * @param args Arguments passed to the plugin hook.
1332
- * @param plugin The acutal plugin
1333
- * @param replaceContext When passed, the plugin context can be overridden.
1334
- */
1335
- executeSync({
1336
- strategy,
1337
- hookName,
1338
- parameters,
1339
- plugin
1340
- }) {
1341
- const hook = plugin[hookName];
1342
- let output;
1343
- if (!hook) {
1344
- return null;
1345
- }
1346
- this.eventEmitter.emit("execute", { strategy, hookName, parameters, plugin });
1347
- try {
1348
- if (typeof hook === "function") {
1349
- const fn = hook.apply(this.core.api, parameters);
1350
- output = fn;
1351
- return fn;
1352
- }
1353
- output = hook;
1354
- return hook;
1355
- } catch (e) {
1356
- this.catcher(e, plugin, hookName);
1357
- return null;
1358
- } finally {
1359
- this.addExecutedToCallStack({
1360
- parameters,
1361
- output,
1362
- strategy,
1363
- hookName,
1364
- plugin
1365
- });
1366
- }
1367
- }
1368
- catcher(e, plugin, hookName) {
1369
- const text = `${e.message} (plugin: ${plugin.name}, hook: ${hookName})
1370
- `;
1371
- const pluginError = new PluginError(text, { cause: e, pluginManager: this });
1372
- this.eventEmitter.emit("error", pluginError);
1373
- throw pluginError;
1374
- }
1375
- };
1376
- function noReturn() {
1377
- }
1378
-
1379
- // src/managers/pluginManager/validate.ts
1380
- var ValidationPluginError = class extends Error {
1381
- };
1382
- function validatePlugins(plugins, dependedPluginNames) {
1383
- let pluginNames = [];
1384
- if (typeof dependedPluginNames === "string") {
1385
- pluginNames = [dependedPluginNames];
1386
- } else {
1387
- pluginNames = dependedPluginNames;
1388
- }
1389
- pluginNames.forEach((pluginName2) => {
1390
- const exists = plugins.some((plugin) => plugin.name === pluginName2);
1391
- if (!exists) {
1392
- throw new ValidationPluginError(`This plugin depends on the ${pluginName2} plugin.`);
1393
- }
1394
- });
1395
- return true;
1396
- }
1397
-
1398
- // src/types.ts
1399
- var LogLevel = {
1400
- silent: "silent",
1401
- info: "info",
1402
- stacktrace: "stacktrace"
1403
- };
1404
-
1405
- // src/build.ts
1406
- async function transformReducer(_previousCode, result, _plugin) {
1407
- return result;
1408
- }
1409
- async function build(options) {
1410
- const { config, debug, logger = createLogger() } = options;
1411
- try {
1412
- if (!URLPath.isURL(config.input.path)) {
1413
- await read(config.input.path);
1414
- }
1415
- } catch (e) {
1416
- throw new Error(
1417
- "Cannot read file/URL defined in `input.path` or set with `kubb generate PATH` in the CLI of your Kubb config " + pc3.dim(config.input.path),
1418
- {
1419
- cause: e
1420
- }
1421
- );
1422
- }
1423
- if (config.output.clean) {
1424
- await clean(config.output.path);
1425
- }
1426
- const queueTask = async (file) => {
1427
- const { path } = file;
1428
- let code = getFileSource(file);
1429
- const { result: loadedResult } = await pluginManager.hookFirst({
1430
- hookName: "load",
1431
- parameters: [path]
1432
- });
1433
- if (loadedResult && isPromise(loadedResult)) {
1434
- code = await loadedResult;
1435
- }
1436
- if (loadedResult && !isPromise(loadedResult)) {
1437
- code = loadedResult;
1438
- }
1439
- if (code) {
1440
- const transformedCode = await pluginManager.hookReduceArg0({
1441
- hookName: "transform",
1442
- parameters: [code, path],
1443
- reduce: transformReducer
1444
- });
1445
- if (config.output.write || config.output.write === void 0) {
1446
- await pluginManager.hookParallel({
1447
- hookName: "writeFile",
1448
- parameters: [transformedCode, path]
1449
- });
1450
- }
1451
- }
1452
- };
1453
- const pluginManager = new PluginManager(config, { debug, logger, task: queueTask });
1454
- const { plugins, fileManager } = pluginManager;
1455
- pluginManager.on("execute", (executer) => {
1456
- const { hookName, plugin, output, parameters } = executer;
1457
- const messsage = `${randomPicoColour(plugin.name)} Executing ${hookName}`;
1458
- if (config.logLevel === LogLevel.info && logger?.spinner && parameters) {
1459
- if (debug) {
1460
- logger.info(messsage);
1461
- } else {
1462
- logger.spinner.suffixText = messsage;
1463
- }
1464
- }
1465
- if (config.logLevel === LogLevel.stacktrace && logger?.spinner && parameters) {
1466
- logger.info(messsage);
1467
- const logs = [
1468
- parameters && `${pc3.bgWhite(`Parameters`)} ${randomPicoColour(plugin.name)} ${hookName}`,
1469
- JSON.stringify(parameters, void 0, 2),
1470
- output && `${pc3.bgWhite("Output")} ${randomPicoColour(plugin.name)} ${hookName}`,
1471
- output
1472
- ].filter(Boolean);
1473
- console.log(logs.join("\n"));
1474
- }
1475
- });
1476
- await pluginManager.hookParallel({
1477
- hookName: "validate",
1478
- parameters: [plugins]
1479
- });
1480
- await pluginManager.hookParallel({
1481
- hookName: "buildStart",
1482
- parameters: [config]
1483
- });
1484
- await pluginManager.hookParallel({ hookName: "buildEnd" });
1485
- return { files: fileManager.files.map((file) => ({ ...file, source: getFileSource(file) })), pluginManager };
1486
- }
1487
-
1488
- // src/config.ts
1489
- function defineConfig(options) {
1490
- return options;
1491
- }
1492
-
1493
- // src/generators/Generator.ts
1494
- var Generator = class {
1495
- _options = {};
1496
- constructor(options = {}) {
1497
- if (options) {
1498
- this._options = {
1499
- ...this._options,
1500
- ...options
1501
- };
1502
- }
1503
- return this;
1504
- }
1505
- get options() {
1506
- return this._options;
1507
- }
1508
- };
1509
-
1510
- // src/generators/SchemaGenerator.ts
1511
- var SchemaGenerator = class extends Generator {
1512
- };
1513
-
1514
- // src/index.ts
1515
- var src_default = build;
1516
-
1517
- export { FileManager, Generator, LogLevel, ParallelPluginError, PluginError, PluginManager, Queue, SchemaGenerator, SummaryError, TreeNode, URLPath, ValidationPluginError, Warning, build, canLogHierarchy, clean, combineFiles, createJSDocBlockText, createLogger, createPlugin, createPluginCache, src_default as default, defaultColours, defineConfig, extensions, getEncodedText, getFileSource, getIndexes, getLocation, getPathMode, getRelativePath, getStackTrace, getUniqueName, hooks, importModule, isPromise, isPromiseFulfilledResult, isPromiseRejectedResult, pluginName as name, nameSorter, normalizeDirectory, objectToParameters, pluginName, randomColour, randomPicoColour, read, renderTemplate, throttle, timeout, transformReservedWord, uniqueId, validatePlugins, write };
1518
- //# sourceMappingURL=out.js.map
1519
- //# sourceMappingURL=index.js.map