@kubb/core 1.11.0-canary.20231011T142449 → 1.11.0-canary.20231011T170015

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 CHANGED
@@ -1,21 +1,20 @@
1
- import { createRequire } from 'module';
1
+ import mod, { createRequire } from 'module';
2
2
  import pc3 from 'picocolors';
3
3
  export { default as pc } from 'picocolors';
4
- import crypto from 'node:crypto';
5
- import pathParser2 from 'node:path';
4
+ import crypto from 'crypto';
5
+ import pathParser2 from 'path';
6
6
  import fs, { remove } from 'fs-extra';
7
7
  import { switcher } from 'js-runtime';
8
8
  import { camelCase, camelCaseTransformMerge } from 'change-case';
9
9
  import { orderBy } from 'natural-orderby';
10
- import { performance } from 'node:perf_hooks';
10
+ import { performance } from 'perf_hooks';
11
11
  import dirTree from 'directory-tree';
12
- import mod from 'node:module';
13
- import os from 'node:os';
14
- import { pathToFileURL } from 'node:url';
12
+ import os from 'os';
13
+ import { pathToFileURL } from 'url';
15
14
  import seedrandom from 'seedrandom';
16
15
  import { createImportDeclaration, print, createExportDeclaration } from '@kubb/ts-codegen';
17
16
  import isEqual from 'lodash.isequal';
18
- import { EventEmitter as EventEmitter$1 } from 'node:events';
17
+ import { EventEmitter as EventEmitter$1 } from 'events';
19
18
 
20
19
  createRequire(import.meta.url);
21
20
 
@@ -379,7 +378,11 @@ function renderTemplate(template, data = void 0) {
379
378
  }
380
379
  const matches = template.match(/{{(.*?)}}/g);
381
380
  return matches?.reduce((prev, curr) => {
382
- const value = data[curr.split(/{{|}}/).filter(Boolean)[0].trim()];
381
+ const index = curr.split(/{{|}}/).filter(Boolean)[0]?.trim();
382
+ if (index === void 0) {
383
+ return prev;
384
+ }
385
+ const value = data[index];
383
386
  if (value === void 0) {
384
387
  return prev;
385
388
  }
@@ -783,14 +786,16 @@ function combineFiles(files) {
783
786
  const prevIndex = acc.findIndex((item) => item.path === curr.path);
784
787
  if (prevIndex !== -1) {
785
788
  const prev = acc[prevIndex];
786
- acc[prevIndex] = {
787
- ...curr,
788
- source: prev.source && curr.source ? `${prev.source}
789
+ if (prev) {
790
+ acc[prevIndex] = {
791
+ ...curr,
792
+ source: prev.source && curr.source ? `${prev.source}
789
793
  ${curr.source}` : "",
790
- imports: [...prev.imports || [], ...curr.imports || []],
791
- exports: [...prev.exports || [], ...curr.exports || []],
792
- env: { ...prev.env || {}, ...curr.env || {} }
793
- };
794
+ imports: [...prev.imports || [], ...curr.imports || []],
795
+ exports: [...prev.exports || [], ...curr.exports || []],
796
+ env: { ...prev.env || {}, ...curr.env || {} }
797
+ };
798
+ }
794
799
  } else {
795
800
  acc.push(curr);
796
801
  }