@kubb/core 3.5.13 → 3.6.1

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.
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkFNJSMBV2_cjs = require('./chunk-FNJSMBV2.cjs');
4
- var chunkAPA7HHVW_cjs = require('./chunk-APA7HHVW.cjs');
3
+ var chunk5BDEVSCJ_cjs = require('./chunk-5BDEVSCJ.cjs');
4
+ var chunkXLEU7VVY_cjs = require('./chunk-XLEU7VVY.cjs');
5
5
  var path = require('path');
6
6
  var fs = require('@kubb/fs');
7
7
  var hash = require('object-hash');
@@ -13,9 +13,9 @@ var path__default = /*#__PURE__*/_interopDefault(path);
13
13
  var hash__default = /*#__PURE__*/_interopDefault(hash);
14
14
 
15
15
  // ../../node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.js
16
- var require_eventemitter3 = chunkAPA7HHVW_cjs.__commonJS({
16
+ var require_eventemitter3 = chunkXLEU7VVY_cjs.__commonJS({
17
17
  "../../node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.js"(exports, module) {
18
- chunkAPA7HHVW_cjs.init_cjs_shims();
18
+ chunkXLEU7VVY_cjs.init_cjs_shims();
19
19
  var has = Object.prototype.hasOwnProperty;
20
20
  var prefix = "~";
21
21
  function Events() {
@@ -78,7 +78,7 @@ var require_eventemitter3 = chunkAPA7HHVW_cjs.__commonJS({
78
78
  if (!this._events[evt]) return false;
79
79
  var listeners = this._events[evt], len = arguments.length, args, i;
80
80
  if (listeners.fn) {
81
- if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
81
+ if (listeners.once) this.removeListener(event, listeners.fn, void 0, true);
82
82
  switch (len) {
83
83
  case 1:
84
84
  return listeners.fn.call(listeners.context), true;
@@ -100,7 +100,7 @@ var require_eventemitter3 = chunkAPA7HHVW_cjs.__commonJS({
100
100
  } else {
101
101
  var length = listeners.length, j;
102
102
  for (i = 0; i < length; i++) {
103
- if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
103
+ if (listeners[i].once) this.removeListener(event, listeners[i].fn, void 0, true);
104
104
  switch (len) {
105
105
  case 1:
106
106
  listeners[i].fn.call(listeners[i].context);
@@ -175,10 +175,10 @@ var require_eventemitter3 = chunkAPA7HHVW_cjs.__commonJS({
175
175
  });
176
176
 
177
177
  // src/utils/index.ts
178
- chunkAPA7HHVW_cjs.init_cjs_shims();
178
+ chunkXLEU7VVY_cjs.init_cjs_shims();
179
179
 
180
180
  // src/utils/FunctionParams.ts
181
- chunkAPA7HHVW_cjs.init_cjs_shims();
181
+ chunkXLEU7VVY_cjs.init_cjs_shims();
182
182
  var FunctionParams = class _FunctionParams {
183
183
  #items = [];
184
184
  constructor() {
@@ -199,18 +199,18 @@ var FunctionParams = class _FunctionParams {
199
199
  return this;
200
200
  }
201
201
  static #orderItems(items) {
202
- return chunkFNJSMBV2_cjs.orderBy(
202
+ return chunk5BDEVSCJ_cjs.orderBy(
203
203
  items.filter(Boolean),
204
204
  [
205
205
  (v) => {
206
206
  if (Array.isArray(v)) {
207
- return undefined;
207
+ return void 0;
208
208
  }
209
209
  return !v.default;
210
210
  },
211
211
  (v) => {
212
212
  if (Array.isArray(v)) {
213
- return undefined;
213
+ return void 0;
214
214
  }
215
215
  return v.required ?? true;
216
216
  }
@@ -227,7 +227,7 @@ var FunctionParams = class _FunctionParams {
227
227
  acc.push(`${type}${rest.default ? ` = ${rest.default}` : ""}`);
228
228
  return acc;
229
229
  }
230
- const parameterName = name.startsWith("{") ? name : chunkFNJSMBV2_cjs.camelCase(name);
230
+ const parameterName = name.startsWith("{") ? name : chunk5BDEVSCJ_cjs.camelCase(name);
231
231
  if (type) {
232
232
  if (required) {
233
233
  acc.push(`${parameterName}: ${type}${rest.default ? ` = ${rest.default}` : ""}`);
@@ -245,14 +245,14 @@ var FunctionParams = class _FunctionParams {
245
245
  const enabled = items.every((item) => item.enabled) ? items.at(0)?.enabled : true;
246
246
  const required = items.every((item) => item.required) ?? true;
247
247
  items.forEach((item) => {
248
- name = _FunctionParams.#addParams(name, { ...item, type: undefined });
248
+ name = _FunctionParams.#addParams(name, { ...item, type: void 0 });
249
249
  if (items.some((item2) => item2.type)) {
250
250
  type = _FunctionParams.#addParams(type, item);
251
251
  }
252
252
  });
253
253
  return {
254
254
  name: `{ ${name.join(", ")} }`,
255
- type: type.length ? `{ ${type.join("; ")} }` : undefined,
255
+ type: type.length ? `{ ${type.join("; ")} }` : void 0,
256
256
  enabled,
257
257
  required
258
258
  };
@@ -282,7 +282,7 @@ var FunctionParams = class _FunctionParams {
282
282
  };
283
283
 
284
284
  // src/utils/promise.ts
285
- chunkAPA7HHVW_cjs.init_cjs_shims();
285
+ chunkXLEU7VVY_cjs.init_cjs_shims();
286
286
  function isPromise(result) {
287
287
  return !!result && typeof result?.then === "function";
288
288
  }
@@ -294,19 +294,19 @@ function isPromiseRejectedResult(result) {
294
294
  }
295
295
 
296
296
  // src/utils/renderTemplate.ts
297
- chunkAPA7HHVW_cjs.init_cjs_shims();
298
- function renderTemplate(template, data = undefined) {
297
+ chunkXLEU7VVY_cjs.init_cjs_shims();
298
+ function renderTemplate(template, data = void 0) {
299
299
  if (!data || !Object.keys(data).length) {
300
300
  return template.replace(/{{(.*?)}}/g, "");
301
301
  }
302
302
  const matches = template.match(/{{(.*?)}}/g);
303
303
  return matches?.reduce((prev, curr) => {
304
304
  const index = curr.split(/{{|}}/).filter(Boolean)[0]?.trim();
305
- if (index === undefined) {
305
+ if (index === void 0) {
306
306
  return prev;
307
307
  }
308
308
  const value = data[index];
309
- if (value === undefined) {
309
+ if (value === void 0) {
310
310
  return prev;
311
311
  }
312
312
  return prev.replace(curr, () => {
@@ -319,7 +319,7 @@ function renderTemplate(template, data = undefined) {
319
319
  }
320
320
 
321
321
  // src/utils/timeout.ts
322
- chunkAPA7HHVW_cjs.init_cjs_shims();
322
+ chunkXLEU7VVY_cjs.init_cjs_shims();
323
323
  async function timeout(ms) {
324
324
  return new Promise((resolve) => {
325
325
  setTimeout(() => {
@@ -329,7 +329,7 @@ async function timeout(ms) {
329
329
  }
330
330
 
331
331
  // src/utils/uniqueName.ts
332
- chunkAPA7HHVW_cjs.init_cjs_shims();
332
+ chunkXLEU7VVY_cjs.init_cjs_shims();
333
333
  function getUniqueName(originalName, data) {
334
334
  let used = data[originalName] || 0;
335
335
  if (used) {
@@ -350,7 +350,7 @@ function setUniqueName(originalName, data) {
350
350
  }
351
351
 
352
352
  // src/utils/URLPath.ts
353
- chunkAPA7HHVW_cjs.init_cjs_shims();
353
+ chunkXLEU7VVY_cjs.init_cjs_shims();
354
354
  var URLPath = class {
355
355
  path;
356
356
  #options;
@@ -421,9 +421,9 @@ var URLPath = class {
421
421
  if (found) {
422
422
  newPath = found.reduce((prev, path2) => {
423
423
  const pathWithoutBrackets = path2.replaceAll("{", "").replaceAll("}", "");
424
- let param = chunkFNJSMBV2_cjs.isValidVarName(pathWithoutBrackets) ? pathWithoutBrackets : chunkFNJSMBV2_cjs.camelCase(pathWithoutBrackets);
424
+ let param = chunk5BDEVSCJ_cjs.isValidVarName(pathWithoutBrackets) ? pathWithoutBrackets : chunk5BDEVSCJ_cjs.camelCase(pathWithoutBrackets);
425
425
  if (this.#options.casing === "camelcase") {
426
- param = chunkFNJSMBV2_cjs.camelCase(param);
426
+ param = chunk5BDEVSCJ_cjs.camelCase(param);
427
427
  }
428
428
  return prev.replace(path2, `\${${replacer ? replacer(param) : param}}`);
429
429
  }, this.path);
@@ -434,14 +434,14 @@ var URLPath = class {
434
434
  const regex = /{(\w|-)*}/g;
435
435
  const found = this.path.match(regex);
436
436
  if (!found) {
437
- return undefined;
437
+ return void 0;
438
438
  }
439
439
  const params = {};
440
440
  found.forEach((item) => {
441
441
  item = item.replaceAll("{", "").replaceAll("}", "");
442
- let param = chunkFNJSMBV2_cjs.isValidVarName(item) ? item : chunkFNJSMBV2_cjs.camelCase(item);
442
+ let param = chunk5BDEVSCJ_cjs.isValidVarName(item) ? item : chunk5BDEVSCJ_cjs.camelCase(item);
443
443
  if (this.#options.casing === "camelcase") {
444
- param = chunkFNJSMBV2_cjs.camelCase(param);
444
+ param = chunk5BDEVSCJ_cjs.camelCase(param);
445
445
  }
446
446
  const key = replacer ? replacer(param) : param;
447
447
  params[key] = key;
@@ -458,21 +458,21 @@ var URLPath = class {
458
458
  };
459
459
 
460
460
  // src/utils/parser.ts
461
- chunkAPA7HHVW_cjs.init_cjs_shims();
461
+ chunkXLEU7VVY_cjs.init_cjs_shims();
462
462
 
463
463
  // src/FileManager.ts
464
- chunkAPA7HHVW_cjs.init_cjs_shims();
464
+ chunkXLEU7VVY_cjs.init_cjs_shims();
465
465
 
466
466
  // src/BarrelManager.ts
467
- chunkAPA7HHVW_cjs.init_cjs_shims();
467
+ chunkXLEU7VVY_cjs.init_cjs_shims();
468
468
 
469
469
  // src/utils/TreeNode.ts
470
- chunkAPA7HHVW_cjs.init_cjs_shims();
470
+ chunkXLEU7VVY_cjs.init_cjs_shims();
471
471
  var TreeNode = class _TreeNode {
472
472
  data;
473
473
  parent;
474
474
  children = [];
475
- #cachedLeaves = undefined;
475
+ #cachedLeaves = void 0;
476
476
  constructor(data, parent) {
477
477
  this.data = data;
478
478
  this.parent = parent;
@@ -634,7 +634,7 @@ var BarrelManager = class {
634
634
  logger?.emit("debug", { date: /* @__PURE__ */ new Date(), logs: [`Start barrel generation for pluginKey ${meta?.pluginKey?.join(".")} and root '${root}'`] });
635
635
  TreeNode.build(generatedFiles, root)?.forEach((treeNode) => {
636
636
  if (!treeNode || !treeNode.children || !treeNode.parent?.data.path) {
637
- return undefined;
637
+ return void 0;
638
638
  }
639
639
  const barrelFile = {
640
640
  path: path.join(treeNode.parent?.data.path, "index.ts"),
@@ -646,23 +646,23 @@ var BarrelManager = class {
646
646
  const leaves = treeNode.leaves;
647
647
  leaves.forEach((item) => {
648
648
  if (!item.data.name) {
649
- return undefined;
649
+ return void 0;
650
650
  }
651
651
  const sources = item.data.file?.sources || [];
652
652
  if (!sources.some((source) => source.isIndexable)) {
653
653
  logger?.emit(
654
654
  "warning",
655
655
  `No isIndexable source found(source should have a name and isIndexable):
656
- File: ${JSON.stringify(item.data.file, undefined, 2)}`
656
+ File: ${JSON.stringify(item.data.file, void 0, 2)}`
657
657
  );
658
658
  }
659
659
  sources.forEach((source) => {
660
660
  if (!item.data.file?.path || !source.isIndexable || !source.name) {
661
- return undefined;
661
+ return void 0;
662
662
  }
663
663
  const alreadyContainInPreviousBarrelFile = previousBarrelFile?.sources.some((item2) => item2.name === source.name);
664
664
  if (alreadyContainInPreviousBarrelFile) {
665
- return undefined;
665
+ return void 0;
666
666
  }
667
667
  if (!barrelFile.exports) {
668
668
  barrelFile.exports = [];
@@ -715,14 +715,14 @@ File: ${JSON.stringify(item.data.file, undefined, 2)}`
715
715
  };
716
716
 
717
717
  // ../../node_modules/.pnpm/p-queue@8.1.0/node_modules/p-queue/dist/index.js
718
- chunkAPA7HHVW_cjs.init_cjs_shims();
718
+ chunkXLEU7VVY_cjs.init_cjs_shims();
719
719
 
720
720
  // ../../node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.mjs
721
- chunkAPA7HHVW_cjs.init_cjs_shims();
722
- var import_index = chunkAPA7HHVW_cjs.__toESM(require_eventemitter3(), 1);
721
+ chunkXLEU7VVY_cjs.init_cjs_shims();
722
+ var import_index = chunkXLEU7VVY_cjs.__toESM(require_eventemitter3(), 1);
723
723
 
724
724
  // ../../node_modules/.pnpm/p-timeout@6.1.3/node_modules/p-timeout/index.js
725
- chunkAPA7HHVW_cjs.init_cjs_shims();
725
+ chunkXLEU7VVY_cjs.init_cjs_shims();
726
726
  var TimeoutError = class extends Error {
727
727
  constructor(message) {
728
728
  super(message);
@@ -736,9 +736,9 @@ var AbortError = class extends Error {
736
736
  this.message = message;
737
737
  }
738
738
  };
739
- var getDOMException = (errorMessage) => globalThis.DOMException === undefined ? new AbortError(errorMessage) : new DOMException(errorMessage);
739
+ var getDOMException = (errorMessage) => globalThis.DOMException === void 0 ? new AbortError(errorMessage) : new DOMException(errorMessage);
740
740
  var getAbortedReason = (signal) => {
741
- const reason = signal.reason === undefined ? getDOMException("This operation was aborted.") : signal.reason;
741
+ const reason = signal.reason === void 0 ? getDOMException("This operation was aborted.") : signal.reason;
742
742
  return reason instanceof Error ? reason : getDOMException(reason);
743
743
  };
744
744
  function pTimeout(promise, options) {
@@ -771,7 +771,7 @@ function pTimeout(promise, options) {
771
771
  return;
772
772
  }
773
773
  const timeoutError = new TimeoutError();
774
- timer = customTimers.setTimeout.call(undefined, () => {
774
+ timer = customTimers.setTimeout.call(void 0, () => {
775
775
  if (fallback) {
776
776
  try {
777
777
  resolve(fallback());
@@ -804,17 +804,17 @@ function pTimeout(promise, options) {
804
804
  cancelablePromise.clear();
805
805
  });
806
806
  cancelablePromise.clear = () => {
807
- customTimers.clearTimeout.call(undefined, timer);
808
- timer = undefined;
807
+ customTimers.clearTimeout.call(void 0, timer);
808
+ timer = void 0;
809
809
  };
810
810
  return cancelablePromise;
811
811
  }
812
812
 
813
813
  // ../../node_modules/.pnpm/p-queue@8.1.0/node_modules/p-queue/dist/priority-queue.js
814
- chunkAPA7HHVW_cjs.init_cjs_shims();
814
+ chunkXLEU7VVY_cjs.init_cjs_shims();
815
815
 
816
816
  // ../../node_modules/.pnpm/p-queue@8.1.0/node_modules/p-queue/dist/lower-bound.js
817
- chunkAPA7HHVW_cjs.init_cjs_shims();
817
+ chunkXLEU7VVY_cjs.init_cjs_shims();
818
818
  function lowerBound(array, value, comparator) {
819
819
  let first = 0;
820
820
  let count = array.length;
@@ -911,7 +911,7 @@ var PQueue = class extends import_index.default {
911
911
  if (!(typeof options.intervalCap === "number" && options.intervalCap >= 1)) {
912
912
  throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${options.intervalCap?.toString() ?? ""}\` (${typeof options.intervalCap})`);
913
913
  }
914
- if (options.interval === undefined || !(Number.isFinite(options.interval) && options.interval >= 0)) {
914
+ if (options.interval === void 0 || !(Number.isFinite(options.interval) && options.interval >= 0)) {
915
915
  throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${options.interval?.toString() ?? ""}\` (${typeof options.interval})`);
916
916
  }
917
917
  this.#carryoverConcurrencyCount = options.carryoverConcurrencyCount;
@@ -939,16 +939,16 @@ var PQueue = class extends import_index.default {
939
939
  #onResumeInterval() {
940
940
  this.#onInterval();
941
941
  this.#initializeIntervalIfNeeded();
942
- this.#timeoutId = undefined;
942
+ this.#timeoutId = void 0;
943
943
  }
944
944
  get #isIntervalPaused() {
945
945
  const now = Date.now();
946
- if (this.#intervalId === undefined) {
946
+ if (this.#intervalId === void 0) {
947
947
  const delay = this.#intervalEnd - now;
948
948
  if (delay < 0) {
949
949
  this.#intervalCount = this.#carryoverConcurrencyCount ? this.#pending : 0;
950
950
  } else {
951
- if (this.#timeoutId === undefined) {
951
+ if (this.#timeoutId === void 0) {
952
952
  this.#timeoutId = setTimeout(() => {
953
953
  this.#onResumeInterval();
954
954
  }, delay);
@@ -963,7 +963,7 @@ var PQueue = class extends import_index.default {
963
963
  if (this.#intervalId) {
964
964
  clearInterval(this.#intervalId);
965
965
  }
966
- this.#intervalId = undefined;
966
+ this.#intervalId = void 0;
967
967
  this.emit("empty");
968
968
  if (this.#pending === 0) {
969
969
  this.emit("idle");
@@ -988,7 +988,7 @@ var PQueue = class extends import_index.default {
988
988
  return false;
989
989
  }
990
990
  #initializeIntervalIfNeeded() {
991
- if (this.#isIntervalIgnored || this.#intervalId !== undefined) {
991
+ if (this.#isIntervalIgnored || this.#intervalId !== void 0) {
992
992
  return;
993
993
  }
994
994
  this.#intervalId = setInterval(() => {
@@ -999,7 +999,7 @@ var PQueue = class extends import_index.default {
999
999
  #onInterval() {
1000
1000
  if (this.#intervalCount === 0 && this.#pending === 0 && this.#intervalId) {
1001
1001
  clearInterval(this.#intervalId);
1002
- this.#intervalId = undefined;
1002
+ this.#intervalId = void 0;
1003
1003
  }
1004
1004
  this.#intervalCount = this.#carryoverConcurrencyCount ? this.#pending : 0;
1005
1005
  this.#processQueue();
@@ -1216,7 +1216,7 @@ var FileManager = class {
1216
1216
  return [...this.#filesByPath.values()];
1217
1217
  }
1218
1218
  get orderedFiles() {
1219
- return chunkFNJSMBV2_cjs.orderBy(
1219
+ return chunk5BDEVSCJ_cjs.orderBy(
1220
1220
  [...this.#filesByPath.values()],
1221
1221
  [
1222
1222
  (v) => v?.meta && "pluginKey" in v.meta && !v.meta.pluginKey,
@@ -1293,7 +1293,7 @@ var FileManager = class {
1293
1293
  exports: file.exports?.map((exportItem) => {
1294
1294
  return {
1295
1295
  ...exportItem,
1296
- name: undefined
1296
+ name: void 0
1297
1297
  };
1298
1298
  })
1299
1299
  };
@@ -1357,12 +1357,12 @@ function combineSources(sources) {
1357
1357
  );
1358
1358
  }
1359
1359
  function combineExports(exports) {
1360
- return chunkFNJSMBV2_cjs.orderBy(exports, [
1360
+ return chunk5BDEVSCJ_cjs.orderBy(exports, [
1361
1361
  (v) => !!Array.isArray(v.name),
1362
1362
  (v) => !v.isTypeOnly,
1363
1363
  (v) => v.path,
1364
1364
  (v) => !!v.name,
1365
- (v) => Array.isArray(v.name) ? chunkFNJSMBV2_cjs.orderBy(v.name) : v.name
1365
+ (v) => Array.isArray(v.name) ? chunk5BDEVSCJ_cjs.orderBy(v.name) : v.name
1366
1366
  ]).reduce(
1367
1367
  (prev, curr) => {
1368
1368
  const name = curr.name;
@@ -1396,12 +1396,12 @@ function combineExports(exports) {
1396
1396
  );
1397
1397
  }
1398
1398
  function combineImports(imports, exports, source) {
1399
- return chunkFNJSMBV2_cjs.orderBy(imports, [
1399
+ return chunk5BDEVSCJ_cjs.orderBy(imports, [
1400
1400
  (v) => !!Array.isArray(v.name),
1401
1401
  (v) => !v.isTypeOnly,
1402
1402
  (v) => v.path,
1403
1403
  (v) => !!v.name,
1404
- (v) => Array.isArray(v.name) ? chunkFNJSMBV2_cjs.orderBy(v.name) : v.name
1404
+ (v) => Array.isArray(v.name) ? chunk5BDEVSCJ_cjs.orderBy(v.name) : v.name
1405
1405
  ]).reduce(
1406
1406
  (prev, curr) => {
1407
1407
  let name = Array.isArray(curr.name) ? [...new Set(curr.name)] : curr.name;
@@ -1452,7 +1452,7 @@ function combineImports(imports, exports, source) {
1452
1452
  }
1453
1453
  var queue = new PQueue({ concurrency: 100 });
1454
1454
  async function processFiles({ dryRun, root, extension, logger, files }) {
1455
- const orderedFiles = chunkFNJSMBV2_cjs.orderBy(files, [
1455
+ const orderedFiles = chunk5BDEVSCJ_cjs.orderBy(files, [
1456
1456
  (v) => v?.meta && "pluginKey" in v.meta && !v.meta.pluginKey,
1457
1457
  (v) => v.path.length,
1458
1458
  (v) => fs.trimExtName(v.path).endsWith("index")
@@ -1468,7 +1468,7 @@ async function processFiles({ dryRun, root, extension, logger, files }) {
1468
1468
  const promises = orderedFiles.map(async (file) => {
1469
1469
  await queue.add(async () => {
1470
1470
  const message = file ? `Writing ${path.relative(root, file.path)}` : "";
1471
- const extname2 = extension?.[file.extname] || undefined;
1471
+ const extname2 = extension?.[file.extname] || void 0;
1472
1472
  const source = await getSource(file, { logger, extname: extname2 });
1473
1473
  await fs.write(file.path, source, { sanity: false });
1474
1474
  logger?.emit("progressed", { id: "files", message });
@@ -1603,5 +1603,5 @@ exports.processFiles = processFiles;
1603
1603
  exports.renderTemplate = renderTemplate;
1604
1604
  exports.setUniqueName = setUniqueName;
1605
1605
  exports.timeout = timeout;
1606
- //# sourceMappingURL=chunk-KRCCD6NL.cjs.map
1607
- //# sourceMappingURL=chunk-KRCCD6NL.cjs.map
1606
+ //# sourceMappingURL=chunk-J5UMT7G6.cjs.map
1607
+ //# sourceMappingURL=chunk-J5UMT7G6.cjs.map