@kubb/core 2.0.0-canary.20231030T124950 → 2.0.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.
Files changed (100) hide show
  1. package/README.md +1 -1
  2. package/dist/chunk-4A7WG6IA.js +128 -0
  3. package/dist/chunk-4A7WG6IA.js.map +1 -0
  4. package/dist/chunk-54P4AWHI.js +71 -0
  5. package/dist/chunk-54P4AWHI.js.map +1 -0
  6. package/dist/chunk-5TK7TMV6.cjs +131 -0
  7. package/dist/chunk-5TK7TMV6.cjs.map +1 -0
  8. package/dist/chunk-7S67BJXQ.js +85 -0
  9. package/dist/chunk-7S67BJXQ.js.map +1 -0
  10. package/dist/chunk-E3ANGQ5N.cjs +2290 -0
  11. package/dist/chunk-E3ANGQ5N.cjs.map +1 -0
  12. package/dist/chunk-H47IKRXJ.cjs +129 -0
  13. package/dist/chunk-H47IKRXJ.cjs.map +1 -0
  14. package/dist/chunk-HIE46T3F.js +129 -0
  15. package/dist/chunk-HIE46T3F.js.map +1 -0
  16. package/dist/chunk-K2H7BYQB.js +155 -0
  17. package/dist/chunk-K2H7BYQB.js.map +1 -0
  18. package/dist/chunk-NAWI7UXW.js +67 -0
  19. package/dist/chunk-NAWI7UXW.js.map +1 -0
  20. package/dist/chunk-PLVKILIY.cjs +162 -0
  21. package/dist/chunk-PLVKILIY.cjs.map +1 -0
  22. package/dist/chunk-W2FP7ZWW.cjs +71 -0
  23. package/dist/chunk-W2FP7ZWW.cjs.map +1 -0
  24. package/dist/chunk-WZQO3EPM.cjs +91 -0
  25. package/dist/chunk-WZQO3EPM.cjs.map +1 -0
  26. package/dist/chunk-XDHI63G7.cjs +104 -0
  27. package/dist/chunk-XDHI63G7.cjs.map +1 -0
  28. package/dist/chunk-XPOF4D5N.js +18 -0
  29. package/dist/chunk-XPOF4D5N.js.map +1 -0
  30. package/dist/fs.cjs +31 -0
  31. package/dist/fs.cjs.map +1 -0
  32. package/dist/fs.d.cts +5 -0
  33. package/dist/fs.d.ts +5 -0
  34. package/dist/fs.js +11 -0
  35. package/dist/fs.js.map +1 -0
  36. package/dist/index.cjs +1866 -977
  37. package/dist/index.cjs.map +1 -1
  38. package/dist/index.d.cts +302 -319
  39. package/dist/index.d.ts +302 -319
  40. package/dist/index.js +1071 -846
  41. package/dist/index.js.map +1 -1
  42. package/dist/logger.cjs +26 -0
  43. package/dist/logger.cjs.map +1 -0
  44. package/dist/logger.d.cts +32 -0
  45. package/dist/logger.d.ts +32 -0
  46. package/dist/logger.js +8 -0
  47. package/dist/logger.js.map +1 -0
  48. package/dist/transformers.cjs +124 -0
  49. package/dist/transformers.cjs.map +1 -0
  50. package/dist/transformers.d.cts +55 -0
  51. package/dist/transformers.d.ts +55 -0
  52. package/dist/transformers.js +95 -0
  53. package/dist/transformers.js.map +1 -0
  54. package/dist/utils.cjs +23 -1163
  55. package/dist/utils.cjs.map +1 -1
  56. package/dist/utils.d.cts +2 -143
  57. package/dist/utils.d.ts +2 -143
  58. package/dist/utils.js +15 -1118
  59. package/dist/utils.js.map +1 -1
  60. package/dist/write-A6VgHkYA.d.cts +10 -0
  61. package/dist/write-A6VgHkYA.d.ts +10 -0
  62. package/package.json +40 -23
  63. package/src/BarrelManager.ts +113 -0
  64. package/src/FileManager.ts +581 -0
  65. package/src/Generator.ts +34 -0
  66. package/src/PackageManager.ts +178 -0
  67. package/src/PluginManager.ts +645 -0
  68. package/src/PromiseManager.ts +51 -0
  69. package/src/build.ts +221 -0
  70. package/src/config.ts +22 -0
  71. package/src/errors.ts +12 -0
  72. package/src/fs/clean.ts +5 -0
  73. package/src/fs/index.ts +3 -0
  74. package/src/fs/read.ts +68 -0
  75. package/src/fs/write.ts +79 -0
  76. package/src/index.ts +27 -0
  77. package/src/logger.ts +121 -0
  78. package/src/plugin.ts +80 -0
  79. package/src/transformers/casing.ts +9 -0
  80. package/src/transformers/combineCodes.ts +3 -0
  81. package/src/transformers/createJSDocBlockText.ts +9 -0
  82. package/src/transformers/escape.ts +31 -0
  83. package/src/transformers/indent.ts +3 -0
  84. package/src/transformers/index.ts +36 -0
  85. package/src/transformers/nameSorter.ts +9 -0
  86. package/src/transformers/searchAndReplace.ts +25 -0
  87. package/src/transformers/transformReservedWord.ts +97 -0
  88. package/src/transformers/trim.ts +7 -0
  89. package/src/types.ts +334 -0
  90. package/src/utils/EventEmitter.ts +24 -0
  91. package/src/utils/FunctionParams.ts +86 -0
  92. package/src/utils/TreeNode.ts +125 -0
  93. package/src/utils/URLPath.ts +133 -0
  94. package/src/utils/cache.ts +35 -0
  95. package/src/utils/executeStrategies.ts +83 -0
  96. package/src/utils/index.ts +8 -0
  97. package/src/utils/promise.ts +13 -0
  98. package/src/utils/renderTemplate.ts +31 -0
  99. package/src/utils/timeout.ts +7 -0
  100. package/src/utils/uniqueName.ts +20 -0
@@ -0,0 +1,155 @@
1
+ import { createRequire } from 'module';
2
+ import { writeLog } from './chunk-7S67BJXQ.js';
3
+ import { init_esm_shims } from './chunk-54P4AWHI.js';
4
+ import seedrandom from 'seedrandom';
5
+ import { isatty } from 'tty';
6
+
7
+ createRequire(import.meta.url);
8
+
9
+ // src/logger.ts
10
+ init_esm_shims();
11
+
12
+ // ../../node_modules/.pnpm/tinyrainbow@1.1.1/node_modules/tinyrainbow/dist/node.js
13
+ init_esm_shims();
14
+
15
+ // ../../node_modules/.pnpm/tinyrainbow@1.1.1/node_modules/tinyrainbow/dist/chunk-5WCZOS7T.js
16
+ init_esm_shims();
17
+ var b = {
18
+ reset: [0, 0],
19
+ bold: [1, 22, "\x1B[22m\x1B[1m"],
20
+ dim: [2, 22, "\x1B[22m\x1B[2m"],
21
+ italic: [3, 23],
22
+ underline: [4, 24],
23
+ inverse: [7, 27],
24
+ hidden: [8, 28],
25
+ strikethrough: [9, 29],
26
+ black: [30, 39],
27
+ red: [31, 39],
28
+ green: [32, 39],
29
+ yellow: [33, 39],
30
+ blue: [34, 39],
31
+ magenta: [35, 39],
32
+ cyan: [36, 39],
33
+ white: [37, 39],
34
+ gray: [90, 39],
35
+ bgBlack: [40, 49],
36
+ bgRed: [41, 49],
37
+ bgGreen: [42, 49],
38
+ bgYellow: [43, 49],
39
+ bgBlue: [44, 49],
40
+ bgMagenta: [45, 49],
41
+ bgCyan: [46, 49],
42
+ bgWhite: [47, 49]
43
+ };
44
+ var C = Object.entries(b);
45
+ function d(r2) {
46
+ return String(r2);
47
+ }
48
+ d.open = "";
49
+ d.close = "";
50
+ function p(r2 = false) {
51
+ let n = typeof process != "undefined" ? process : void 0, t = (n == null ? void 0 : n.env) || {}, a = (n == null ? void 0 : n.argv) || [];
52
+ return !("NO_COLOR" in t || a.includes("--no-color")) && !("GITHUB_ACTIONS" in t) && ("FORCE_COLOR" in t || a.includes("--color") || (n == null ? void 0 : n.platform) === "win32" || r2 && t.TERM !== "dumb" || "CI" in t) || typeof window != "undefined" && !!window.chrome;
53
+ }
54
+ function w(r2 = false) {
55
+ let n = p(r2), t = (e, o, c, i) => {
56
+ let u = e.substring(0, i) + c, s = e.substring(i + o.length), l = s.indexOf(o);
57
+ return ~l ? u + t(s, o, c, l) : u + s;
58
+ }, a = (e, o, c = e) => {
59
+ let i = (u) => {
60
+ let s = String(u), l = s.indexOf(o, e.length);
61
+ return ~l ? e + t(s, o, c, l) + o : e + s + o;
62
+ };
63
+ return i.open = e, i.close = o, i;
64
+ }, g = {
65
+ isColorSupported: n
66
+ }, f = (e) => `\x1B[${e}m`;
67
+ for (let [e, o] of C)
68
+ g[e] = n ? a(
69
+ f(o[0]),
70
+ f(o[1]),
71
+ o[2]
72
+ ) : d;
73
+ return g;
74
+ }
75
+ var p2 = w(isatty(1));
76
+
77
+ // src/logger.ts
78
+ var LogLevel = {
79
+ silent: "silent",
80
+ info: "info",
81
+ debug: "debug"
82
+ };
83
+ function createLogger({ logLevel, name, spinner }) {
84
+ const logs = [];
85
+ const log = (message) => {
86
+ if (message && spinner) {
87
+ spinner.text = message;
88
+ logs.push(message);
89
+ }
90
+ };
91
+ const error = (message) => {
92
+ if (message) {
93
+ throw new Error(message || "Something went wrong");
94
+ }
95
+ };
96
+ const warn = (message) => {
97
+ if (message && spinner) {
98
+ spinner.warn(p2.yellow(message));
99
+ logs.push(message);
100
+ }
101
+ };
102
+ const info = (message) => {
103
+ if (message && spinner && logLevel !== LogLevel.silent) {
104
+ spinner.info(message);
105
+ logs.push(message);
106
+ }
107
+ };
108
+ const debug = async (message) => {
109
+ if (message) {
110
+ await writeLog(message);
111
+ }
112
+ };
113
+ const logger = {
114
+ name,
115
+ logLevel,
116
+ log,
117
+ error,
118
+ warn,
119
+ info,
120
+ debug,
121
+ spinner,
122
+ logs
123
+ };
124
+ return logger;
125
+ }
126
+ var defaultColours = ["black", "blue", "darkBlue", "cyan", "gray", "green", "darkGreen", "magenta", "red", "darkRed", "yellow", "darkYellow"];
127
+ function randomColour(text, colours = defaultColours) {
128
+ if (!text) {
129
+ return "white";
130
+ }
131
+ const random = seedrandom(text);
132
+ const colour = colours.at(Math.floor(random() * colours.length)) || "white";
133
+ return colour;
134
+ }
135
+ function randomCliColour(text, colors = defaultColours) {
136
+ const colours = w(true);
137
+ if (!text) {
138
+ return colours.white(text);
139
+ }
140
+ const colour = randomColour(text, colors);
141
+ const isDark = colour.includes("dark");
142
+ const key = colour.replace("dark", "").toLowerCase();
143
+ const formatter = colours[key];
144
+ if (isDark) {
145
+ return p2.bold(formatter(text));
146
+ }
147
+ if (typeof formatter !== "function") {
148
+ throw new Error("Formatter for picoColor is not of type function/Formatter");
149
+ }
150
+ return formatter(text);
151
+ }
152
+
153
+ export { LogLevel, createLogger, p2 as p, randomCliColour, randomColour };
154
+ //# sourceMappingURL=out.js.map
155
+ //# sourceMappingURL=chunk-K2H7BYQB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/logger.ts","../../../node_modules/.pnpm/tinyrainbow@1.1.1/node_modules/tinyrainbow/dist/node.js","../../../node_modules/.pnpm/tinyrainbow@1.1.1/node_modules/tinyrainbow/dist/chunk-5WCZOS7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O,IAAI,QAAQ,MAAM,CAAC,KAAK;AAEpE,SAAO;AACT;AAEO,SAAS,gBAAgB,MAAe,SAAS,gBAAwB;AAC9E,QAAM,UAAU,EAAa,IAAI;AAEjC,MAAI,CAAC,MAAM;AACT,WAAO,QAAQ,MAAM,IAAI;AAAA,EAC3B;AAEA,QAAM,SAAS,aAAa,MAAM,MAAM;AACxC,QAAM,SAAS,OAAO,SAAS,MAAM;AACrC,QAAM,MAAM,OAAO,QAAQ,QAAQ,EAAE,EAAE,YAAY;AACnD,QAAM,YAAuB,QAAQ,GAAG;AAExC,MAAI,QAAQ;AACV,WAAOA,GAAE,KAAK,UAAU,IAAI,CAAC;AAAA,EAC/B;AAEA,MAAI,OAAO,cAAc,YAAY;AACnC,UAAM,IAAI,MAAM,2DAA2D;AAAA,EAC7E;AACA,SAAO,UAAU,IAAI;AACvB","sourcesContent":["import seedrandom from 'seedrandom'\nimport c, { createColors } from 'tinyrainbow'\n\nimport { writeLog } from './fs/write.ts'\n\nimport type { Ora } from 'ora'\nimport type { Formatter } from 'tinyrainbow'\n\nexport const LogLevel = {\n silent: 'silent',\n info: 'info',\n debug: 'debug',\n} as const\n\nexport type LogLevel = keyof typeof LogLevel\n\nexport type Logger = {\n /**\n * Optional config name to show in CLI output\n */\n name?: string\n logLevel: LogLevel\n log: (message: string | null) => void\n error: (message: string | null) => void\n info: (message: string | null) => void\n warn: (message: string | null) => void\n debug: (message: string | null) => Promise<void>\n spinner?: Ora\n logs: string[]\n}\n\ntype Props = {\n name?: string\n logLevel: LogLevel\n spinner?: Ora\n}\n\nexport function createLogger({ logLevel, name, spinner }: Props): Logger {\n const logs: string[] = []\n const log: Logger['log'] = (message) => {\n if (message && spinner) {\n spinner.text = message\n logs.push(message)\n }\n }\n\n const error: Logger['error'] = (message) => {\n if (message) {\n throw new Error(message || 'Something went wrong')\n }\n }\n\n const warn: Logger['warn'] = (message) => {\n if (message && spinner) {\n spinner.warn(c.yellow(message))\n logs.push(message)\n }\n }\n\n const info: Logger['warn'] = (message) => {\n if (message && spinner && logLevel !== LogLevel.silent) {\n spinner.info(message)\n logs.push(message)\n }\n }\n\n const debug: Logger['debug'] = async (message) => {\n if (message) {\n await writeLog(message)\n }\n }\n\n const logger: Logger = {\n name,\n logLevel,\n log,\n error,\n warn,\n info,\n debug,\n spinner,\n logs,\n }\n\n return logger\n}\n\nconst defaultColours = ['black', 'blue', 'darkBlue', 'cyan', 'gray', 'green', 'darkGreen', 'magenta', 'red', 'darkRed', 'yellow', 'darkYellow'] as const\n\nexport function randomColour(text?: string, colours = defaultColours): string {\n if (!text) {\n return 'white'\n }\n\n const random = seedrandom(text)\n const colour = colours.at(Math.floor(random() * colours.length)) || 'white'\n\n return colour\n}\n\nexport function randomCliColour(text?: string, colors = defaultColours): string {\n const colours = createColors(true)\n\n if (!text) {\n return colours.white(text)\n }\n\n const colour = randomColour(text, colors)\n const isDark = colour.includes('dark')\n const key = colour.replace('dark', '').toLowerCase() as keyof typeof colours\n const formatter: Formatter = colours[key] as Formatter\n\n if (isDark) {\n return c.bold(formatter(text))\n }\n\n if (typeof formatter !== 'function') {\n throw new Error('Formatter for picoColor is not of type function/Formatter')\n }\n return formatter(text)\n}\n","import {\n a as t,\n b as e,\n c as o\n} from \"./chunk-5WCZOS7T.js\";\n\n// src/node.ts\nimport { isatty as r } from \"tty\";\nvar p = o(r(1));\nexport {\n o as createColors,\n p as default,\n t as getDefaultColors,\n e as isSupported\n};\n","// src/index.ts\nvar b = {\n reset: [0, 0],\n bold: [1, 22, \"\\x1B[22m\\x1B[1m\"],\n dim: [2, 22, \"\\x1B[22m\\x1B[2m\"],\n italic: [3, 23],\n underline: [4, 24],\n inverse: [7, 27],\n hidden: [8, 28],\n strikethrough: [9, 29],\n black: [30, 39],\n red: [31, 39],\n green: [32, 39],\n yellow: [33, 39],\n blue: [34, 39],\n magenta: [35, 39],\n cyan: [36, 39],\n white: [37, 39],\n gray: [90, 39],\n bgBlack: [40, 49],\n bgRed: [41, 49],\n bgGreen: [42, 49],\n bgYellow: [43, 49],\n bgBlue: [44, 49],\n bgMagenta: [45, 49],\n bgCyan: [46, 49],\n bgWhite: [47, 49]\n}, C = Object.entries(b);\nfunction d(r) {\n return String(r);\n}\nd.open = \"\";\nd.close = \"\";\nvar m = /* @__PURE__ */ C.reduce(\n (r, [n]) => (r[n] = d, r),\n { isColorSupported: !1 }\n);\nfunction x() {\n return { ...m };\n}\nfunction p(r = !1) {\n let n = typeof process != \"undefined\" ? process : void 0, t = (n == null ? void 0 : n.env) || {}, a = (n == null ? void 0 : n.argv) || [];\n return !(\"NO_COLOR\" in t || a.includes(\"--no-color\")) && !(\"GITHUB_ACTIONS\" in t) && (\"FORCE_COLOR\" in t || a.includes(\"--color\") || (n == null ? void 0 : n.platform) === \"win32\" || r && t.TERM !== \"dumb\" || \"CI\" in t) || typeof window != \"undefined\" && !!window.chrome;\n}\nfunction w(r = !1) {\n let n = p(r), t = (e, o, c, i) => {\n let u = e.substring(0, i) + c, s = e.substring(i + o.length), l = s.indexOf(o);\n return ~l ? u + t(s, o, c, l) : u + s;\n }, a = (e, o, c = e) => {\n let i = (u) => {\n let s = String(u), l = s.indexOf(o, e.length);\n return ~l ? e + t(s, o, c, l) + o : e + s + o;\n };\n return i.open = e, i.close = o, i;\n }, g = {\n isColorSupported: n\n }, f = (e) => `\\x1B[${e}m`;\n for (let [e, o] of C)\n g[e] = n ? a(\n f(o[0]),\n f(o[1]),\n o[2]\n ) : d;\n return g;\n}\n\nexport {\n x as a,\n p as b,\n w as c\n};\n"]}
@@ -0,0 +1,67 @@
1
+ import { createRequire } from 'module';
2
+ import { init_esm_shims } from './chunk-54P4AWHI.js';
3
+ import fs2 from 'fs-extra';
4
+ import { relative, basename, extname } from 'path';
5
+ import { switcher } from 'js-runtime';
6
+
7
+ createRequire(import.meta.url);
8
+
9
+ // src/fs/clean.ts
10
+ init_esm_shims();
11
+ async function clean(path) {
12
+ return fs2.remove(path);
13
+ }
14
+
15
+ // src/fs/read.ts
16
+ init_esm_shims();
17
+ function slash(path, platform = "linux") {
18
+ const isWindowsPath = /^\\\\\?\\/.test(path);
19
+ if (["linux", "mac"].includes(platform) && !isWindowsPath) {
20
+ return path.replaceAll(/\\/g, "/").replace("../", "").trimEnd();
21
+ }
22
+ return path.replaceAll(/\\/g, "/").replace("../", "").trimEnd();
23
+ }
24
+ function getRelativePath(rootDir, filePath, platform = "linux") {
25
+ if (!rootDir || !filePath) {
26
+ throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ""} ${filePath || ""}`);
27
+ }
28
+ const relativePath = relative(rootDir, filePath);
29
+ const slashedPath = slash(relativePath, platform);
30
+ if (slashedPath.startsWith("../")) {
31
+ return slashedPath.replace(basename(slashedPath), basename(slashedPath, extname(filePath)));
32
+ }
33
+ return `./${slashedPath.replace(basename(slashedPath), basename(slashedPath, extname(filePath)))}`;
34
+ }
35
+ var reader = switcher(
36
+ {
37
+ node: async (path) => {
38
+ return fs2.readFile(path, { encoding: "utf8" });
39
+ },
40
+ bun: async (path) => {
41
+ const file = Bun.file(path);
42
+ return file.text();
43
+ }
44
+ },
45
+ "node"
46
+ );
47
+ var syncReader = switcher(
48
+ {
49
+ node: (path) => {
50
+ return fs2.readFileSync(path, { encoding: "utf8" });
51
+ },
52
+ bun: () => {
53
+ throw new Error("Bun cannot read sync");
54
+ }
55
+ },
56
+ "node"
57
+ );
58
+ async function read(path) {
59
+ return reader(path);
60
+ }
61
+ function readSync(path) {
62
+ return syncReader(path);
63
+ }
64
+
65
+ export { clean, getRelativePath, read, readSync };
66
+ //# sourceMappingURL=out.js.map
67
+ //# sourceMappingURL=chunk-NAWI7UXW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/fs/clean.ts","../src/fs/read.ts"],"names":["fs"],"mappings":";;;;;;;;;AAAA;AAAA,OAAO,QAAQ;AAEf,eAAsB,MAAM,MAA6B;AACvD,SAAO,GAAG,OAAO,IAAI;AACvB;;;ACJA;AAAA,SAAS,UAAU,SA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AAAA,IACA,KAAK,MAAM;AACT,YAAM,IAAI,MAAM,sBAAsB;AAAA,IACxC;AAAA,EACF;AAAA,EACA;AACF;AAEA,eAAsB,KAAK,MAA+B;AACxD,SAAO,OAAO,IAAI;AACpB;AAEO,SAAS,SAAS,MAAsB;AAC7C,SAAO,WAAW,IAAI;AACxB","sourcesContent":["import fs from 'fs-extra'\n\nexport async function clean(path: string): Promise<void> {\n return fs.remove(path)\n}\n","import { basename, extname, relative } from 'node:path'\n\nimport fs from 'fs-extra'\nimport { switcher } from 'js-runtime'\n\nfunction slash(path: string, platform: 'windows' | 'mac' | 'linux' = 'linux') {\n const isWindowsPath = /^\\\\\\\\\\?\\\\/.test(path)\n\n if (['linux', 'mac'].includes(platform) && !isWindowsPath) {\n // linux and mac\n return path.replaceAll(/\\\\/g, '/').replace('../', '').trimEnd()\n }\n\n // windows\n return path.replaceAll(/\\\\/g, '/').replace('../', '').trimEnd()\n}\n\nexport function getRelativePath(rootDir?: string | null, filePath?: string | null, platform: 'windows' | 'mac' | 'linux' = 'linux'): string {\n if (!rootDir || !filePath) {\n throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ''} ${filePath || ''}`)\n }\n\n const relativePath = relative(rootDir, filePath)\n\n // On Windows, paths are separated with a \"\\\"\n // However, web browsers use \"/\" no matter the platform\n const slashedPath = slash(relativePath, platform)\n\n if (slashedPath.startsWith('../')) {\n return slashedPath.replace(basename(slashedPath), basename(slashedPath, extname(filePath)))\n }\n\n return `./${slashedPath.replace(basename(slashedPath), basename(slashedPath, extname(filePath)))}`\n}\n\nconst reader = switcher(\n {\n node: async (path: string) => {\n return fs.readFile(path, { encoding: 'utf8' })\n },\n bun: async (path: string) => {\n const file = Bun.file(path)\n\n return file.text()\n },\n },\n 'node',\n)\n\nconst syncReader = switcher(\n {\n node: (path: string) => {\n return fs.readFileSync(path, { encoding: 'utf8' })\n },\n bun: () => {\n throw new Error('Bun cannot read sync')\n },\n },\n 'node',\n)\n\nexport async function read(path: string): Promise<string> {\n return reader(path)\n}\n\nexport function readSync(path: string): string {\n return syncReader(path)\n}\n"]}
@@ -0,0 +1,162 @@
1
+ 'use strict';
2
+
3
+ var chunkE3ANGQ5N_cjs = require('./chunk-E3ANGQ5N.cjs');
4
+ var chunkWZQO3EPM_cjs = require('./chunk-WZQO3EPM.cjs');
5
+ var seedrandom = require('seedrandom');
6
+ var tty = require('tty');
7
+
8
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
+
10
+ var seedrandom__default = /*#__PURE__*/_interopDefault(seedrandom);
11
+
12
+ // src/logger.ts
13
+ chunkWZQO3EPM_cjs.init_cjs_shims();
14
+
15
+ // ../../node_modules/.pnpm/tinyrainbow@1.1.1/node_modules/tinyrainbow/dist/node.js
16
+ chunkWZQO3EPM_cjs.init_cjs_shims();
17
+
18
+ // ../../node_modules/.pnpm/tinyrainbow@1.1.1/node_modules/tinyrainbow/dist/chunk-5WCZOS7T.js
19
+ chunkWZQO3EPM_cjs.init_cjs_shims();
20
+ var b = {
21
+ reset: [0, 0],
22
+ bold: [1, 22, "\x1B[22m\x1B[1m"],
23
+ dim: [2, 22, "\x1B[22m\x1B[2m"],
24
+ italic: [3, 23],
25
+ underline: [4, 24],
26
+ inverse: [7, 27],
27
+ hidden: [8, 28],
28
+ strikethrough: [9, 29],
29
+ black: [30, 39],
30
+ red: [31, 39],
31
+ green: [32, 39],
32
+ yellow: [33, 39],
33
+ blue: [34, 39],
34
+ magenta: [35, 39],
35
+ cyan: [36, 39],
36
+ white: [37, 39],
37
+ gray: [90, 39],
38
+ bgBlack: [40, 49],
39
+ bgRed: [41, 49],
40
+ bgGreen: [42, 49],
41
+ bgYellow: [43, 49],
42
+ bgBlue: [44, 49],
43
+ bgMagenta: [45, 49],
44
+ bgCyan: [46, 49],
45
+ bgWhite: [47, 49]
46
+ };
47
+ var C = Object.entries(b);
48
+ function d(r2) {
49
+ return String(r2);
50
+ }
51
+ d.open = "";
52
+ d.close = "";
53
+ function p(r2 = false) {
54
+ let n = typeof process != "undefined" ? process : void 0, t = (n == null ? void 0 : n.env) || {}, a = (n == null ? void 0 : n.argv) || [];
55
+ return !("NO_COLOR" in t || a.includes("--no-color")) && !("GITHUB_ACTIONS" in t) && ("FORCE_COLOR" in t || a.includes("--color") || (n == null ? void 0 : n.platform) === "win32" || r2 && t.TERM !== "dumb" || "CI" in t) || typeof window != "undefined" && !!window.chrome;
56
+ }
57
+ function w(r2 = false) {
58
+ let n = p(r2), t = (e, o, c, i) => {
59
+ let u = e.substring(0, i) + c, s = e.substring(i + o.length), l = s.indexOf(o);
60
+ return ~l ? u + t(s, o, c, l) : u + s;
61
+ }, a = (e, o, c = e) => {
62
+ let i = (u) => {
63
+ let s = String(u), l = s.indexOf(o, e.length);
64
+ return ~l ? e + t(s, o, c, l) + o : e + s + o;
65
+ };
66
+ return i.open = e, i.close = o, i;
67
+ }, g = {
68
+ isColorSupported: n
69
+ }, f = (e) => `\x1B[${e}m`;
70
+ for (let [e, o] of C)
71
+ g[e] = n ? a(
72
+ f(o[0]),
73
+ f(o[1]),
74
+ o[2]
75
+ ) : d;
76
+ return g;
77
+ }
78
+ var p2 = w(tty.isatty(1));
79
+
80
+ // src/logger.ts
81
+ var LogLevel = {
82
+ silent: "silent",
83
+ info: "info",
84
+ debug: "debug"
85
+ };
86
+ function createLogger({ logLevel, name, spinner }) {
87
+ const logs = [];
88
+ const log = (message) => {
89
+ if (message && spinner) {
90
+ spinner.text = message;
91
+ logs.push(message);
92
+ }
93
+ };
94
+ const error = (message) => {
95
+ if (message) {
96
+ throw new Error(message || "Something went wrong");
97
+ }
98
+ };
99
+ const warn = (message) => {
100
+ if (message && spinner) {
101
+ spinner.warn(p2.yellow(message));
102
+ logs.push(message);
103
+ }
104
+ };
105
+ const info = (message) => {
106
+ if (message && spinner && logLevel !== LogLevel.silent) {
107
+ spinner.info(message);
108
+ logs.push(message);
109
+ }
110
+ };
111
+ const debug = async (message) => {
112
+ if (message) {
113
+ await chunkE3ANGQ5N_cjs.writeLog(message);
114
+ }
115
+ };
116
+ const logger = {
117
+ name,
118
+ logLevel,
119
+ log,
120
+ error,
121
+ warn,
122
+ info,
123
+ debug,
124
+ spinner,
125
+ logs
126
+ };
127
+ return logger;
128
+ }
129
+ var defaultColours = ["black", "blue", "darkBlue", "cyan", "gray", "green", "darkGreen", "magenta", "red", "darkRed", "yellow", "darkYellow"];
130
+ function randomColour(text, colours = defaultColours) {
131
+ if (!text) {
132
+ return "white";
133
+ }
134
+ const random = seedrandom__default.default(text);
135
+ const colour = colours.at(Math.floor(random() * colours.length)) || "white";
136
+ return colour;
137
+ }
138
+ function randomCliColour(text, colors = defaultColours) {
139
+ const colours = w(true);
140
+ if (!text) {
141
+ return colours.white(text);
142
+ }
143
+ const colour = randomColour(text, colors);
144
+ const isDark = colour.includes("dark");
145
+ const key = colour.replace("dark", "").toLowerCase();
146
+ const formatter = colours[key];
147
+ if (isDark) {
148
+ return p2.bold(formatter(text));
149
+ }
150
+ if (typeof formatter !== "function") {
151
+ throw new Error("Formatter for picoColor is not of type function/Formatter");
152
+ }
153
+ return formatter(text);
154
+ }
155
+
156
+ exports.LogLevel = LogLevel;
157
+ exports.createLogger = createLogger;
158
+ exports.p = p2;
159
+ exports.randomCliColour = randomCliColour;
160
+ exports.randomColour = randomColour;
161
+ //# sourceMappingURL=out.js.map
162
+ //# sourceMappingURL=chunk-PLVKILIY.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/logger.ts","../../../node_modules/.pnpm/tinyrainbow@1.1.1/node_modules/tinyrainbow/dist/node.js","../../../node_modules/.pnpm/tinyrainbow@1.1.1/node_modules/tinyrainbow/dist/chunk-5WCZOS7T.js"],"names":["r","p"],"mappings":";;;;;;;;AAAA;AAAA,OAAO,gBAAgB;;;ACAvB;;;ACAA;AACA,IAAI,IAAI;AAAA,EACN,OAAO,CAAC,GAAG,CAAC;AAAA,EACZ,MAAM,CAAC,GAAG,IAAI,iBAAiB;AAAA,EAC/B,KA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AEA,QAAM,SAAS,aAAa,MAAM,MAAM;AACxC,QAAM,SAAS,OAAO,SAAS,MAAM;AACrC,QAAM,MAAM,OAAO,QAAQ,QAAQ,EAAE,EAAE,YAAY;AACnD,QAAM,YAAuB,QAAQ,GAAG;AAExC,MAAI,QAAQ;AACV,WAAOA,GAAE,KAAK,UAAU,IAAI,CAAC;AAAA,EAC/B;AAEA,MAAI,OAAO,cAAc,YAAY;AACnC,UAAM,IAAI,MAAM,2DAA2D;AAAA,EAC7E;AACA,SAAO,UAAU,IAAI;AACvB","sourcesContent":["import seedrandom from 'seedrandom'\nimport c, { createColors } from 'tinyrainbow'\n\nimport { writeLog } from './fs/write.ts'\n\nimport type { Ora } from 'ora'\nimport type { Formatter } from 'tinyrainbow'\n\nexport const LogLevel = {\n silent: 'silent',\n info: 'info',\n debug: 'debug',\n} as const\n\nexport type LogLevel = keyof typeof LogLevel\n\nexport type Logger = {\n /**\n * Optional config name to show in CLI output\n */\n name?: string\n logLevel: LogLevel\n log: (message: string | null) => void\n error: (message: string | null) => void\n info: (message: string | null) => void\n warn: (message: string | null) => void\n debug: (message: string | null) => Promise<void>\n spinner?: Ora\n logs: string[]\n}\n\ntype Props = {\n name?: string\n logLevel: LogLevel\n spinner?: Ora\n}\n\nexport function createLogger({ logLevel, name, spinner }: Props): Logger {\n const logs: string[] = []\n const log: Logger['log'] = (message) => {\n if (message && spinner) {\n spinner.text = message\n logs.push(message)\n }\n }\n\n const error: Logger['error'] = (message) => {\n if (message) {\n throw new Error(message || 'Something went wrong')\n }\n }\n\n const warn: Logger['warn'] = (message) => {\n if (message && spinner) {\n spinner.warn(c.yellow(message))\n logs.push(message)\n }\n }\n\n const info: Logger['warn'] = (message) => {\n if (message && spinner && logLevel !== LogLevel.silent) {\n spinner.info(message)\n logs.push(message)\n }\n }\n\n const debug: Logger['debug'] = async (message) => {\n if (message) {\n await writeLog(message)\n }\n }\n\n const logger: Logger = {\n name,\n logLevel,\n log,\n error,\n warn,\n info,\n debug,\n spinner,\n logs,\n }\n\n return logger\n}\n\nconst defaultColours = ['black', 'blue', 'darkBlue', 'cyan', 'gray', 'green', 'darkGreen', 'magenta', 'red', 'darkRed', 'yellow', 'darkYellow'] as const\n\nexport function randomColour(text?: string, colours = defaultColours): string {\n if (!text) {\n return 'white'\n }\n\n const random = seedrandom(text)\n const colour = colours.at(Math.floor(random() * colours.length)) || 'white'\n\n return colour\n}\n\nexport function randomCliColour(text?: string, colors = defaultColours): string {\n const colours = createColors(true)\n\n if (!text) {\n return colours.white(text)\n }\n\n const colour = randomColour(text, colors)\n const isDark = colour.includes('dark')\n const key = colour.replace('dark', '').toLowerCase() as keyof typeof colours\n const formatter: Formatter = colours[key] as Formatter\n\n if (isDark) {\n return c.bold(formatter(text))\n }\n\n if (typeof formatter !== 'function') {\n throw new Error('Formatter for picoColor is not of type function/Formatter')\n }\n return formatter(text)\n}\n","import {\n a as t,\n b as e,\n c as o\n} from \"./chunk-5WCZOS7T.js\";\n\n// src/node.ts\nimport { isatty as r } from \"tty\";\nvar p = o(r(1));\nexport {\n o as createColors,\n p as default,\n t as getDefaultColors,\n e as isSupported\n};\n","// src/index.ts\nvar b = {\n reset: [0, 0],\n bold: [1, 22, \"\\x1B[22m\\x1B[1m\"],\n dim: [2, 22, \"\\x1B[22m\\x1B[2m\"],\n italic: [3, 23],\n underline: [4, 24],\n inverse: [7, 27],\n hidden: [8, 28],\n strikethrough: [9, 29],\n black: [30, 39],\n red: [31, 39],\n green: [32, 39],\n yellow: [33, 39],\n blue: [34, 39],\n magenta: [35, 39],\n cyan: [36, 39],\n white: [37, 39],\n gray: [90, 39],\n bgBlack: [40, 49],\n bgRed: [41, 49],\n bgGreen: [42, 49],\n bgYellow: [43, 49],\n bgBlue: [44, 49],\n bgMagenta: [45, 49],\n bgCyan: [46, 49],\n bgWhite: [47, 49]\n}, C = Object.entries(b);\nfunction d(r) {\n return String(r);\n}\nd.open = \"\";\nd.close = \"\";\nvar m = /* @__PURE__ */ C.reduce(\n (r, [n]) => (r[n] = d, r),\n { isColorSupported: !1 }\n);\nfunction x() {\n return { ...m };\n}\nfunction p(r = !1) {\n let n = typeof process != \"undefined\" ? process : void 0, t = (n == null ? void 0 : n.env) || {}, a = (n == null ? void 0 : n.argv) || [];\n return !(\"NO_COLOR\" in t || a.includes(\"--no-color\")) && !(\"GITHUB_ACTIONS\" in t) && (\"FORCE_COLOR\" in t || a.includes(\"--color\") || (n == null ? void 0 : n.platform) === \"win32\" || r && t.TERM !== \"dumb\" || \"CI\" in t) || typeof window != \"undefined\" && !!window.chrome;\n}\nfunction w(r = !1) {\n let n = p(r), t = (e, o, c, i) => {\n let u = e.substring(0, i) + c, s = e.substring(i + o.length), l = s.indexOf(o);\n return ~l ? u + t(s, o, c, l) : u + s;\n }, a = (e, o, c = e) => {\n let i = (u) => {\n let s = String(u), l = s.indexOf(o, e.length);\n return ~l ? e + t(s, o, c, l) + o : e + s + o;\n };\n return i.open = e, i.close = o, i;\n }, g = {\n isColorSupported: n\n }, f = (e) => `\\x1B[${e}m`;\n for (let [e, o] of C)\n g[e] = n ? a(\n f(o[0]),\n f(o[1]),\n o[2]\n ) : d;\n return g;\n}\n\nexport {\n x as a,\n p as b,\n w as c\n};\n"]}
@@ -0,0 +1,71 @@
1
+ 'use strict';
2
+
3
+ var chunkE3ANGQ5N_cjs = require('./chunk-E3ANGQ5N.cjs');
4
+ var chunkWZQO3EPM_cjs = require('./chunk-WZQO3EPM.cjs');
5
+ var path = require('path');
6
+ var jsRuntime = require('js-runtime');
7
+
8
+ // src/fs/clean.ts
9
+ chunkWZQO3EPM_cjs.init_cjs_shims();
10
+ var import_fs_extra = chunkWZQO3EPM_cjs.__toESM(chunkE3ANGQ5N_cjs.require_lib(), 1);
11
+ async function clean(path) {
12
+ return import_fs_extra.default.remove(path);
13
+ }
14
+
15
+ // src/fs/read.ts
16
+ chunkWZQO3EPM_cjs.init_cjs_shims();
17
+ var import_fs_extra2 = chunkWZQO3EPM_cjs.__toESM(chunkE3ANGQ5N_cjs.require_lib(), 1);
18
+ function slash(path, platform = "linux") {
19
+ const isWindowsPath = /^\\\\\?\\/.test(path);
20
+ if (["linux", "mac"].includes(platform) && !isWindowsPath) {
21
+ return path.replaceAll(/\\/g, "/").replace("../", "").trimEnd();
22
+ }
23
+ return path.replaceAll(/\\/g, "/").replace("../", "").trimEnd();
24
+ }
25
+ function getRelativePath(rootDir, filePath, platform = "linux") {
26
+ if (!rootDir || !filePath) {
27
+ throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ""} ${filePath || ""}`);
28
+ }
29
+ const relativePath = path.relative(rootDir, filePath);
30
+ const slashedPath = slash(relativePath, platform);
31
+ if (slashedPath.startsWith("../")) {
32
+ return slashedPath.replace(path.basename(slashedPath), path.basename(slashedPath, path.extname(filePath)));
33
+ }
34
+ return `./${slashedPath.replace(path.basename(slashedPath), path.basename(slashedPath, path.extname(filePath)))}`;
35
+ }
36
+ var reader = jsRuntime.switcher(
37
+ {
38
+ node: async (path) => {
39
+ return import_fs_extra2.default.readFile(path, { encoding: "utf8" });
40
+ },
41
+ bun: async (path) => {
42
+ const file = Bun.file(path);
43
+ return file.text();
44
+ }
45
+ },
46
+ "node"
47
+ );
48
+ var syncReader = jsRuntime.switcher(
49
+ {
50
+ node: (path) => {
51
+ return import_fs_extra2.default.readFileSync(path, { encoding: "utf8" });
52
+ },
53
+ bun: () => {
54
+ throw new Error("Bun cannot read sync");
55
+ }
56
+ },
57
+ "node"
58
+ );
59
+ async function read(path) {
60
+ return reader(path);
61
+ }
62
+ function readSync(path) {
63
+ return syncReader(path);
64
+ }
65
+
66
+ exports.clean = clean;
67
+ exports.getRelativePath = getRelativePath;
68
+ exports.read = read;
69
+ exports.readSync = readSync;
70
+ //# sourceMappingURL=out.js.map
71
+ //# sourceMappingURL=chunk-W2FP7ZWW.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/fs/clean.ts","../src/fs/read.ts"],"names":["fs","import_fs_extra"],"mappings":";;;;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;AACF;AAEA,IAAM,aAAa;AAAA,EACjB;AAAA,IACE,MAAM,CAAC,SAAiB;AACtB,aAAO,iBAAAA,QAAG,aAAa,MAAM,EAAE,UAAU,OAAO,CAAC;AAAA,IACnD;AAAA,IACA,KAAK,MAAM;AACT,YAAM,IAAI,MAAM,sBAAsB;AAAA,IACxC;AAAA,EACF;AAAA,EACA;AACF;AAEA,eAAsB,KAAK,MAA+B;AACxD,SAAO,OAAO,IAAI;AACpB;AAEO,SAAS,SAAS,MAAsB;AAC7C,SAAO,WAAW,IAAI;AACxB","sourcesContent":["import fs from 'fs-extra'\n\nexport async function clean(path: string): Promise<void> {\n return fs.remove(path)\n}\n","import { basename, extname, relative } from 'node:path'\n\nimport fs from 'fs-extra'\nimport { switcher } from 'js-runtime'\n\nfunction slash(path: string, platform: 'windows' | 'mac' | 'linux' = 'linux') {\n const isWindowsPath = /^\\\\\\\\\\?\\\\/.test(path)\n\n if (['linux', 'mac'].includes(platform) && !isWindowsPath) {\n // linux and mac\n return path.replaceAll(/\\\\/g, '/').replace('../', '').trimEnd()\n }\n\n // windows\n return path.replaceAll(/\\\\/g, '/').replace('../', '').trimEnd()\n}\n\nexport function getRelativePath(rootDir?: string | null, filePath?: string | null, platform: 'windows' | 'mac' | 'linux' = 'linux'): string {\n if (!rootDir || !filePath) {\n throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ''} ${filePath || ''}`)\n }\n\n const relativePath = relative(rootDir, filePath)\n\n // On Windows, paths are separated with a \"\\\"\n // However, web browsers use \"/\" no matter the platform\n const slashedPath = slash(relativePath, platform)\n\n if (slashedPath.startsWith('../')) {\n return slashedPath.replace(basename(slashedPath), basename(slashedPath, extname(filePath)))\n }\n\n return `./${slashedPath.replace(basename(slashedPath), basename(slashedPath, extname(filePath)))}`\n}\n\nconst reader = switcher(\n {\n node: async (path: string) => {\n return fs.readFile(path, { encoding: 'utf8' })\n },\n bun: async (path: string) => {\n const file = Bun.file(path)\n\n return file.text()\n },\n },\n 'node',\n)\n\nconst syncReader = switcher(\n {\n node: (path: string) => {\n return fs.readFileSync(path, { encoding: 'utf8' })\n },\n bun: () => {\n throw new Error('Bun cannot read sync')\n },\n },\n 'node',\n)\n\nexport async function read(path: string): Promise<string> {\n return reader(path)\n}\n\nexport function readSync(path: string): string {\n return syncReader(path)\n}\n"]}
@@ -0,0 +1,91 @@
1
+ 'use strict';
2
+
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
11
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
12
+ }) : x)(function(x) {
13
+ if (typeof require !== "undefined")
14
+ return require.apply(this, arguments);
15
+ throw Error('Dynamic require of "' + x + '" is not supported');
16
+ });
17
+ var __esm = (fn, res) => function __init() {
18
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
19
+ };
20
+ var __commonJS = (cb, mod) => function __require2() {
21
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
22
+ };
23
+ var __copyProps = (to, from, except, desc) => {
24
+ if (from && typeof from === "object" || typeof from === "function") {
25
+ for (let key of __getOwnPropNames(from))
26
+ if (!__hasOwnProp.call(to, key) && key !== except)
27
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
28
+ }
29
+ return to;
30
+ };
31
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
32
+ // If the importer is in node compatibility mode or this is not an ESM
33
+ // file that has been converted to a CommonJS file using a Babel-
34
+ // compatible transform (i.e. "__esModule" has not been set), then set
35
+ // "default" to the CommonJS "module.exports" for node compatibility.
36
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
37
+ mod
38
+ ));
39
+ var __publicField = (obj, key, value) => {
40
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
41
+ return value;
42
+ };
43
+ var __accessCheck = (obj, member, msg) => {
44
+ if (!member.has(obj))
45
+ throw TypeError("Cannot " + msg);
46
+ };
47
+ var __privateGet = (obj, member, getter) => {
48
+ __accessCheck(obj, member, "read from private field");
49
+ return getter ? getter.call(obj) : member.get(obj);
50
+ };
51
+ var __privateAdd = (obj, member, value) => {
52
+ if (member.has(obj))
53
+ throw TypeError("Cannot add the same private member more than once");
54
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
55
+ };
56
+ var __privateSet = (obj, member, value, setter) => {
57
+ __accessCheck(obj, member, "write to private field");
58
+ setter ? setter.call(obj, value) : member.set(obj, value);
59
+ return value;
60
+ };
61
+ var __privateWrapper = (obj, member, setter, getter) => ({
62
+ set _(value) {
63
+ __privateSet(obj, member, value, setter);
64
+ },
65
+ get _() {
66
+ return __privateGet(obj, member, getter);
67
+ }
68
+ });
69
+ var __privateMethod = (obj, member, method) => {
70
+ __accessCheck(obj, member, "access private method");
71
+ return method;
72
+ };
73
+
74
+ // ../../node_modules/.pnpm/tsup@8.0.1_@microsoft+api-extractor@7.38.5_ts-node@10.9.2_typescript@5.3.3/node_modules/tsup/assets/cjs_shims.js
75
+ var init_cjs_shims = __esm({
76
+ "../../node_modules/.pnpm/tsup@8.0.1_@microsoft+api-extractor@7.38.5_ts-node@10.9.2_typescript@5.3.3/node_modules/tsup/assets/cjs_shims.js"() {
77
+ }
78
+ });
79
+
80
+ exports.__commonJS = __commonJS;
81
+ exports.__privateAdd = __privateAdd;
82
+ exports.__privateGet = __privateGet;
83
+ exports.__privateMethod = __privateMethod;
84
+ exports.__privateSet = __privateSet;
85
+ exports.__privateWrapper = __privateWrapper;
86
+ exports.__publicField = __publicField;
87
+ exports.__require = __require;
88
+ exports.__toESM = __toESM;
89
+ exports.init_cjs_shims = init_cjs_shims;
90
+ //# sourceMappingURL=out.js.map
91
+ //# sourceMappingURL=chunk-WZQO3EPM.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.0.1_@microsoft+api-extractor@7.38.5_ts-node@10.9.2_typescript@5.3.3/node_modules/tsup/assets/cjs_shims.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () =>\n typeof document === 'undefined'\n ? new URL('file:' + __filename).href\n : (document.currentScript && document.currentScript.src) ||\n new URL('main.js', document.baseURI).href\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n"]}