@orval/core 7.13.2 → 7.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +34 -37
- package/dist/index.js +109 -145
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1532,6 +1532,40 @@ declare const dynamicImport: <T>(toImport: T | string, from?: string, takeDefaul
|
|
|
1532
1532
|
//#region src/utils/extension.d.ts
|
|
1533
1533
|
declare const getExtension: (path: string) => "yaml" | "json";
|
|
1534
1534
|
//#endregion
|
|
1535
|
+
//#region src/utils/file.d.ts
|
|
1536
|
+
declare const getFileInfo: (target?: string, {
|
|
1537
|
+
backupFilename,
|
|
1538
|
+
extension
|
|
1539
|
+
}?: {
|
|
1540
|
+
backupFilename?: string;
|
|
1541
|
+
extension?: string;
|
|
1542
|
+
}) => {
|
|
1543
|
+
path: string;
|
|
1544
|
+
pathWithoutExtension: string;
|
|
1545
|
+
extension: string;
|
|
1546
|
+
isDirectory: boolean;
|
|
1547
|
+
dirname: string;
|
|
1548
|
+
filename: string;
|
|
1549
|
+
};
|
|
1550
|
+
declare function loadFile(filePath?: string, options?: {
|
|
1551
|
+
root?: string;
|
|
1552
|
+
defaultFileName?: string;
|
|
1553
|
+
alias?: Record<string, string>;
|
|
1554
|
+
tsconfig?: Tsconfig;
|
|
1555
|
+
}): Promise<{
|
|
1556
|
+
path: string;
|
|
1557
|
+
file?: string;
|
|
1558
|
+
error?: unknown;
|
|
1559
|
+
cached?: boolean;
|
|
1560
|
+
}>;
|
|
1561
|
+
declare function removeFilesAndEmptyFolders(patterns: string[], dir: string): Promise<void>;
|
|
1562
|
+
//#endregion
|
|
1563
|
+
//#region src/utils/file-extensions.d.ts
|
|
1564
|
+
declare const getMockFileExtensionByTypeName: (mock: GlobalMockOptions | ClientMockBuilder) => string;
|
|
1565
|
+
//#endregion
|
|
1566
|
+
//#region src/utils/is-body-verb.d.ts
|
|
1567
|
+
declare const getIsBodyVerb: (verb: Verbs) => boolean;
|
|
1568
|
+
//#endregion
|
|
1535
1569
|
//#region src/utils/logger.d.ts
|
|
1536
1570
|
declare const log: (message?: any, ...optionalParams: any[]) => void;
|
|
1537
1571
|
declare const startMessage: ({
|
|
@@ -1575,43 +1609,6 @@ interface LoggerOptions {
|
|
|
1575
1609
|
}
|
|
1576
1610
|
declare function createLogger(level?: LogLevel, options?: LoggerOptions): Logger;
|
|
1577
1611
|
//#endregion
|
|
1578
|
-
//#region src/utils/file.d.ts
|
|
1579
|
-
declare const getFileInfo: (target?: string, {
|
|
1580
|
-
backupFilename,
|
|
1581
|
-
extension
|
|
1582
|
-
}?: {
|
|
1583
|
-
backupFilename?: string;
|
|
1584
|
-
extension?: string;
|
|
1585
|
-
}) => {
|
|
1586
|
-
path: string;
|
|
1587
|
-
pathWithoutExtension: string;
|
|
1588
|
-
extension: string;
|
|
1589
|
-
isDirectory: boolean;
|
|
1590
|
-
dirname: string;
|
|
1591
|
-
filename: string;
|
|
1592
|
-
};
|
|
1593
|
-
declare function loadFile<File = any>(filePath?: string, options?: {
|
|
1594
|
-
root?: string;
|
|
1595
|
-
defaultFileName?: string;
|
|
1596
|
-
logLevel?: LogLevel;
|
|
1597
|
-
isDefault?: boolean;
|
|
1598
|
-
alias?: Record<string, string>;
|
|
1599
|
-
tsconfig?: Tsconfig;
|
|
1600
|
-
load?: boolean;
|
|
1601
|
-
}): Promise<{
|
|
1602
|
-
path: string;
|
|
1603
|
-
file?: File;
|
|
1604
|
-
error?: any;
|
|
1605
|
-
cached?: boolean;
|
|
1606
|
-
}>;
|
|
1607
|
-
declare function removeFilesAndEmptyFolders(patterns: string[], dir: string): Promise<void>;
|
|
1608
|
-
//#endregion
|
|
1609
|
-
//#region src/utils/file-extensions.d.ts
|
|
1610
|
-
declare const getMockFileExtensionByTypeName: (mock: GlobalMockOptions | ClientMockBuilder) => string;
|
|
1611
|
-
//#endregion
|
|
1612
|
-
//#region src/utils/is-body-verb.d.ts
|
|
1613
|
-
declare const getIsBodyVerb: (verb: Verbs) => boolean;
|
|
1614
|
-
//#endregion
|
|
1615
1612
|
//#region src/utils/merge-deep.d.ts
|
|
1616
1613
|
declare function mergeDeep<T extends Record<string, any>, U extends Record<string, any>>(source: T, target: U): T & U;
|
|
1617
1614
|
//#endregion
|
package/dist/index.js
CHANGED
|
@@ -47,12 +47,12 @@ let micromatch = require("micromatch");
|
|
|
47
47
|
micromatch = __toESM(micromatch);
|
|
48
48
|
let debug = require("debug");
|
|
49
49
|
debug = __toESM(debug);
|
|
50
|
-
let node_readline = require("node:readline");
|
|
51
|
-
node_readline = __toESM(node_readline);
|
|
52
50
|
let compare_versions = require("compare-versions");
|
|
53
51
|
compare_versions = __toESM(compare_versions);
|
|
54
52
|
let node_url = require("node:url");
|
|
55
53
|
node_url = __toESM(node_url);
|
|
54
|
+
let node_readline = require("node:readline");
|
|
55
|
+
node_readline = __toESM(node_readline);
|
|
56
56
|
let swagger2openapi = require("swagger2openapi");
|
|
57
57
|
swagger2openapi = __toESM(swagger2openapi);
|
|
58
58
|
let __ibm_cloud_openapi_ruleset = require("@ibm-cloud/openapi-ruleset");
|
|
@@ -192,100 +192,6 @@ function createDebugger(ns, options = {}) {
|
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
//#endregion
|
|
196
|
-
//#region src/utils/logger.ts
|
|
197
|
-
const log = console.log;
|
|
198
|
-
const startMessage = ({ name, version, description }) => `🍻 ${chalk.default.cyan.bold(name)} ${chalk.default.green(`v${version}`)}${description ? ` - ${description}` : ""}`;
|
|
199
|
-
const logError = (err, tag) => {
|
|
200
|
-
log(chalk.default.red([
|
|
201
|
-
"🛑",
|
|
202
|
-
tag ? `${tag} -` : void 0,
|
|
203
|
-
err instanceof Error ? err.stack : err
|
|
204
|
-
].filter(Boolean).join(" ")));
|
|
205
|
-
};
|
|
206
|
-
const mismatchArgsMessage = (mismatchArgs) => {
|
|
207
|
-
log(chalk.default.yellow(`${mismatchArgs.join(", ")} ${mismatchArgs.length === 1 ? "is" : "are"} not defined in your configuration!`));
|
|
208
|
-
};
|
|
209
|
-
const createSuccessMessage = (backend) => {
|
|
210
|
-
log(`🎉 ${backend ? `${chalk.default.green(backend)} - ` : ""}Your OpenAPI spec has been converted into ready to use orval!`);
|
|
211
|
-
};
|
|
212
|
-
const ibmOpenapiValidatorWarnings = (warnings) => {
|
|
213
|
-
log(chalk.default.yellow("(!) Warnings"));
|
|
214
|
-
for (const i of warnings) log(chalk.default.yellow(`Message : ${i.message}\nPath : ${i.path.join(", ")}`));
|
|
215
|
-
};
|
|
216
|
-
const ibmOpenapiValidatorErrors = (errors) => {
|
|
217
|
-
log(chalk.default.red("(!) Errors"));
|
|
218
|
-
for (const i of errors) log(chalk.default.red(`Message : ${i.message}\nPath : ${i.path.join(", ")}`));
|
|
219
|
-
};
|
|
220
|
-
const LogLevels = {
|
|
221
|
-
silent: 0,
|
|
222
|
-
error: 1,
|
|
223
|
-
warn: 2,
|
|
224
|
-
info: 3
|
|
225
|
-
};
|
|
226
|
-
let lastType;
|
|
227
|
-
let lastMsg;
|
|
228
|
-
let sameCount = 0;
|
|
229
|
-
function clearScreen() {
|
|
230
|
-
const repeatCount = process.stdout.rows - 2;
|
|
231
|
-
const blank = repeatCount > 0 ? "\n".repeat(repeatCount) : "";
|
|
232
|
-
console.log(blank);
|
|
233
|
-
node_readline.default.cursorTo(process.stdout, 0, 0);
|
|
234
|
-
node_readline.default.clearScreenDown(process.stdout);
|
|
235
|
-
}
|
|
236
|
-
function createLogger(level = "info", options = {}) {
|
|
237
|
-
const { prefix = "[vite]", allowClearScreen = true } = options;
|
|
238
|
-
const thresh = LogLevels[level];
|
|
239
|
-
const clear = allowClearScreen && process.stdout.isTTY && !process.env.CI ? clearScreen : () => {};
|
|
240
|
-
function output(type, msg, options$1 = {}) {
|
|
241
|
-
if (thresh >= LogLevels[type]) {
|
|
242
|
-
const method = type === "info" ? "log" : type;
|
|
243
|
-
const format = () => {
|
|
244
|
-
if (options$1.timestamp) {
|
|
245
|
-
const tag = type === "info" ? chalk.default.cyan.bold(prefix) : type === "warn" ? chalk.default.yellow.bold(prefix) : chalk.default.red.bold(prefix);
|
|
246
|
-
return `${chalk.default.dim((/* @__PURE__ */ new Date()).toLocaleTimeString())} ${tag} ${msg}`;
|
|
247
|
-
} else return msg;
|
|
248
|
-
};
|
|
249
|
-
if (type === lastType && msg === lastMsg) {
|
|
250
|
-
sameCount++;
|
|
251
|
-
clear();
|
|
252
|
-
console[method](format(), chalk.default.yellow(`(x${sameCount + 1})`));
|
|
253
|
-
} else {
|
|
254
|
-
sameCount = 0;
|
|
255
|
-
lastMsg = msg;
|
|
256
|
-
lastType = type;
|
|
257
|
-
if (options$1.clear) clear();
|
|
258
|
-
console[method](format());
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
const warnedMessages = /* @__PURE__ */ new Set();
|
|
263
|
-
const logger = {
|
|
264
|
-
hasWarned: false,
|
|
265
|
-
info(msg, opts) {
|
|
266
|
-
output("info", msg, opts);
|
|
267
|
-
},
|
|
268
|
-
warn(msg, opts) {
|
|
269
|
-
logger.hasWarned = true;
|
|
270
|
-
output("warn", msg, opts);
|
|
271
|
-
},
|
|
272
|
-
warnOnce(msg, opts) {
|
|
273
|
-
if (warnedMessages.has(msg)) return;
|
|
274
|
-
logger.hasWarned = true;
|
|
275
|
-
output("warn", msg, opts);
|
|
276
|
-
warnedMessages.add(msg);
|
|
277
|
-
},
|
|
278
|
-
error(msg, opts) {
|
|
279
|
-
logger.hasWarned = true;
|
|
280
|
-
output("error", msg, opts);
|
|
281
|
-
},
|
|
282
|
-
clearScreen(type) {
|
|
283
|
-
if (thresh >= LogLevels[type]) clear();
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
return logger;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
195
|
//#endregion
|
|
290
196
|
//#region src/utils/file.ts
|
|
291
197
|
const getFileInfo = (target = "", { backupFilename = "filename", extension = ".ts" } = {}) => {
|
|
@@ -306,15 +212,12 @@ const getFileInfo = (target = "", { backupFilename = "filename", extension = ".t
|
|
|
306
212
|
const debug$1 = createDebugger("orval:file-load");
|
|
307
213
|
const cache = /* @__PURE__ */ new Map();
|
|
308
214
|
async function loadFile(filePath, options) {
|
|
309
|
-
const { root = process.cwd(),
|
|
215
|
+
const { root = process.cwd(), defaultFileName, alias, tsconfig } = options ?? {};
|
|
310
216
|
const start = Date.now();
|
|
311
217
|
let resolvedPath;
|
|
312
|
-
let isTS = false;
|
|
313
218
|
let isMjs = false;
|
|
314
|
-
if (filePath)
|
|
315
|
-
|
|
316
|
-
isTS = filePath.endsWith(".ts");
|
|
317
|
-
} else if (defaultFileName) {
|
|
219
|
+
if (filePath) resolvedPath = node_path.default.resolve(filePath);
|
|
220
|
+
else if (defaultFileName) {
|
|
318
221
|
const jsFile = node_path.default.resolve(root, `${defaultFileName}.js`);
|
|
319
222
|
if (node_fs.default.existsSync(jsFile)) resolvedPath = jsFile;
|
|
320
223
|
if (!resolvedPath) {
|
|
@@ -330,10 +233,7 @@ async function loadFile(filePath, options) {
|
|
|
330
233
|
}
|
|
331
234
|
if (!resolvedPath) {
|
|
332
235
|
const tsFile = node_path.default.resolve(root, `${defaultFileName}.ts`);
|
|
333
|
-
if (node_fs.default.existsSync(tsFile))
|
|
334
|
-
resolvedPath = tsFile;
|
|
335
|
-
isTS = true;
|
|
336
|
-
}
|
|
236
|
+
if (node_fs.default.existsSync(tsFile)) resolvedPath = tsFile;
|
|
337
237
|
}
|
|
338
238
|
}
|
|
339
239
|
if (!resolvedPath) if (filePath) throw new Error(chalk.default.red(`File not found => ${filePath}`));
|
|
@@ -347,24 +247,8 @@ async function loadFile(filePath, options) {
|
|
|
347
247
|
cached: true
|
|
348
248
|
};
|
|
349
249
|
try {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
delete require.cache[require.resolve(resolvedPath)];
|
|
353
|
-
file = require(resolvedPath);
|
|
354
|
-
debug$1(`cjs loaded in ${Date.now() - start}ms`);
|
|
355
|
-
} catch (error) {
|
|
356
|
-
if (!new RegExp([
|
|
357
|
-
`Cannot use import statement`,
|
|
358
|
-
`Must use import to load ES Module`,
|
|
359
|
-
`Unexpected token`,
|
|
360
|
-
`Unexpected identifier`
|
|
361
|
-
].join("|")).test(error.message)) throw error;
|
|
362
|
-
}
|
|
363
|
-
if (!file) {
|
|
364
|
-
const { code } = await bundleFile(resolvedPath, isMjs, root || node_path.default.dirname(normalizeResolvedPath), alias, tsconfig?.compilerOptions);
|
|
365
|
-
file = load ? await loadFromBundledFile(resolvedPath, code, isDefault) : code;
|
|
366
|
-
debug$1(`bundled file loaded in ${Date.now() - start}ms`);
|
|
367
|
-
}
|
|
250
|
+
const { code: file } = await bundleFile(resolvedPath, isMjs, root || node_path.default.dirname(normalizeResolvedPath), alias, tsconfig?.compilerOptions);
|
|
251
|
+
debug$1(`bundled file loaded in ${Date.now() - start}ms`);
|
|
368
252
|
cache.set(resolvedPath, { file });
|
|
369
253
|
return {
|
|
370
254
|
path: normalizeResolvedPath,
|
|
@@ -459,19 +343,6 @@ async function bundleFile(fileName, mjs = false, workspace, alias, compilerOptio
|
|
|
459
343
|
dependencies: result.metafile ? Object.keys(result.metafile.inputs) : []
|
|
460
344
|
};
|
|
461
345
|
}
|
|
462
|
-
async function loadFromBundledFile(fileName, bundledCode, isDefault) {
|
|
463
|
-
const extension = node_path.default.extname(fileName);
|
|
464
|
-
const defaultLoader = require.extensions[extension];
|
|
465
|
-
require.extensions[extension] = (module$1, filename) => {
|
|
466
|
-
if (filename === fileName) module$1._compile(bundledCode, filename);
|
|
467
|
-
else defaultLoader(module$1, filename);
|
|
468
|
-
};
|
|
469
|
-
delete require.cache[require.resolve(fileName)];
|
|
470
|
-
const raw = require(fileName);
|
|
471
|
-
const file = isDefault && raw.__esModule ? raw.default : raw;
|
|
472
|
-
require.extensions[extension] = defaultLoader;
|
|
473
|
-
return file;
|
|
474
|
-
}
|
|
475
346
|
async function removeFilesAndEmptyFolders(patterns, dir) {
|
|
476
347
|
const files = await (0, globby.default)(patterns, {
|
|
477
348
|
cwd: dir,
|
|
@@ -533,10 +404,7 @@ const relativeSafe = (from, to) => {
|
|
|
533
404
|
return normalizeSafe(`.${separator}${normalizedRelativePath}`);
|
|
534
405
|
};
|
|
535
406
|
const getSpecName = (specKey, target) => {
|
|
536
|
-
if (isUrl(specKey))
|
|
537
|
-
const url = new URL(target);
|
|
538
|
-
return specKey.replace(url.origin, "").replace(getFileInfo(url.pathname).dirname, "").replace(`.${getExtension(specKey)}`, "");
|
|
539
|
-
}
|
|
407
|
+
if (isUrl(specKey)) return specKey;
|
|
540
408
|
return "/" + path$1.normalize(path$1.relative(getFileInfo(target).dirname, specKey)).split("../").join("").replace(`.${getExtension(specKey)}`, "");
|
|
541
409
|
};
|
|
542
410
|
const getSchemaFileName = (path$3) => {
|
|
@@ -733,6 +601,7 @@ const conventionName = (name, convention) => {
|
|
|
733
601
|
//#region src/utils/compare-version.ts
|
|
734
602
|
const compareVersions = (firstVersion, secondVersions, operator = ">=") => {
|
|
735
603
|
if (firstVersion === "latest" || firstVersion === "*") return true;
|
|
604
|
+
if (firstVersion.startsWith("catalog:")) return true;
|
|
736
605
|
return (0, compare_versions.compare)(firstVersion.replace(/(\s(.*))/, ""), secondVersions, operator);
|
|
737
606
|
};
|
|
738
607
|
|
|
@@ -847,6 +716,100 @@ const getMockFileExtensionByTypeName = (mock) => {
|
|
|
847
716
|
//#region src/utils/is-body-verb.ts
|
|
848
717
|
const getIsBodyVerb = (verb) => VERBS_WITH_BODY.includes(verb);
|
|
849
718
|
|
|
719
|
+
//#endregion
|
|
720
|
+
//#region src/utils/logger.ts
|
|
721
|
+
const log = console.log;
|
|
722
|
+
const startMessage = ({ name, version, description }) => `🍻 ${chalk.default.cyan.bold(name)} ${chalk.default.green(`v${version}`)}${description ? ` - ${description}` : ""}`;
|
|
723
|
+
const logError = (err, tag) => {
|
|
724
|
+
log(chalk.default.red([
|
|
725
|
+
"🛑",
|
|
726
|
+
tag ? `${tag} -` : void 0,
|
|
727
|
+
err instanceof Error ? err.stack : err
|
|
728
|
+
].filter(Boolean).join(" ")));
|
|
729
|
+
};
|
|
730
|
+
const mismatchArgsMessage = (mismatchArgs) => {
|
|
731
|
+
log(chalk.default.yellow(`${mismatchArgs.join(", ")} ${mismatchArgs.length === 1 ? "is" : "are"} not defined in your configuration!`));
|
|
732
|
+
};
|
|
733
|
+
const createSuccessMessage = (backend) => {
|
|
734
|
+
log(`🎉 ${backend ? `${chalk.default.green(backend)} - ` : ""}Your OpenAPI spec has been converted into ready to use orval!`);
|
|
735
|
+
};
|
|
736
|
+
const ibmOpenapiValidatorWarnings = (warnings) => {
|
|
737
|
+
log(chalk.default.yellow("(!) Warnings"));
|
|
738
|
+
for (const i of warnings) log(chalk.default.yellow(`Message : ${i.message}\nPath : ${i.path.join(", ")}`));
|
|
739
|
+
};
|
|
740
|
+
const ibmOpenapiValidatorErrors = (errors) => {
|
|
741
|
+
log(chalk.default.red("(!) Errors"));
|
|
742
|
+
for (const i of errors) log(chalk.default.red(`Message : ${i.message}\nPath : ${i.path.join(", ")}`));
|
|
743
|
+
};
|
|
744
|
+
const LogLevels = {
|
|
745
|
+
silent: 0,
|
|
746
|
+
error: 1,
|
|
747
|
+
warn: 2,
|
|
748
|
+
info: 3
|
|
749
|
+
};
|
|
750
|
+
let lastType;
|
|
751
|
+
let lastMsg;
|
|
752
|
+
let sameCount = 0;
|
|
753
|
+
function clearScreen() {
|
|
754
|
+
const repeatCount = process.stdout.rows - 2;
|
|
755
|
+
const blank = repeatCount > 0 ? "\n".repeat(repeatCount) : "";
|
|
756
|
+
console.log(blank);
|
|
757
|
+
node_readline.default.cursorTo(process.stdout, 0, 0);
|
|
758
|
+
node_readline.default.clearScreenDown(process.stdout);
|
|
759
|
+
}
|
|
760
|
+
function createLogger(level = "info", options = {}) {
|
|
761
|
+
const { prefix = "[vite]", allowClearScreen = true } = options;
|
|
762
|
+
const thresh = LogLevels[level];
|
|
763
|
+
const clear = allowClearScreen && process.stdout.isTTY && !process.env.CI ? clearScreen : () => {};
|
|
764
|
+
function output(type, msg, options$1 = {}) {
|
|
765
|
+
if (thresh >= LogLevels[type]) {
|
|
766
|
+
const method = type === "info" ? "log" : type;
|
|
767
|
+
const format = () => {
|
|
768
|
+
if (options$1.timestamp) {
|
|
769
|
+
const tag = type === "info" ? chalk.default.cyan.bold(prefix) : type === "warn" ? chalk.default.yellow.bold(prefix) : chalk.default.red.bold(prefix);
|
|
770
|
+
return `${chalk.default.dim((/* @__PURE__ */ new Date()).toLocaleTimeString())} ${tag} ${msg}`;
|
|
771
|
+
} else return msg;
|
|
772
|
+
};
|
|
773
|
+
if (type === lastType && msg === lastMsg) {
|
|
774
|
+
sameCount++;
|
|
775
|
+
clear();
|
|
776
|
+
console[method](format(), chalk.default.yellow(`(x${sameCount + 1})`));
|
|
777
|
+
} else {
|
|
778
|
+
sameCount = 0;
|
|
779
|
+
lastMsg = msg;
|
|
780
|
+
lastType = type;
|
|
781
|
+
if (options$1.clear) clear();
|
|
782
|
+
console[method](format());
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
const warnedMessages = /* @__PURE__ */ new Set();
|
|
787
|
+
const logger = {
|
|
788
|
+
hasWarned: false,
|
|
789
|
+
info(msg, opts) {
|
|
790
|
+
output("info", msg, opts);
|
|
791
|
+
},
|
|
792
|
+
warn(msg, opts) {
|
|
793
|
+
logger.hasWarned = true;
|
|
794
|
+
output("warn", msg, opts);
|
|
795
|
+
},
|
|
796
|
+
warnOnce(msg, opts) {
|
|
797
|
+
if (warnedMessages.has(msg)) return;
|
|
798
|
+
logger.hasWarned = true;
|
|
799
|
+
output("warn", msg, opts);
|
|
800
|
+
warnedMessages.add(msg);
|
|
801
|
+
},
|
|
802
|
+
error(msg, opts) {
|
|
803
|
+
logger.hasWarned = true;
|
|
804
|
+
output("error", msg, opts);
|
|
805
|
+
},
|
|
806
|
+
clearScreen(type) {
|
|
807
|
+
if (thresh >= LogLevels[type]) clear();
|
|
808
|
+
}
|
|
809
|
+
};
|
|
810
|
+
return logger;
|
|
811
|
+
}
|
|
812
|
+
|
|
850
813
|
//#endregion
|
|
851
814
|
//#region src/utils/merge-deep.ts
|
|
852
815
|
const isObject$1 = (obj) => obj && typeof obj === "object";
|
|
@@ -1127,7 +1090,10 @@ const getRefInfo = ($ref, context) => {
|
|
|
1127
1090
|
originalName,
|
|
1128
1091
|
refPaths
|
|
1129
1092
|
};
|
|
1130
|
-
|
|
1093
|
+
let path$3;
|
|
1094
|
+
if (isUrl($ref)) path$3 = $ref;
|
|
1095
|
+
else if (isUrl(context.specKey)) path$3 = resolveUrl(context.specKey, pathname);
|
|
1096
|
+
else path$3 = resolve(getFileInfo(context.specKey).dirname, pathname);
|
|
1131
1097
|
return {
|
|
1132
1098
|
name: sanitize(pascal(originalName) + suffix, {
|
|
1133
1099
|
es5keyword: true,
|
|
@@ -2713,11 +2679,9 @@ const generateMutator = async ({ output, mutator, name, workspace, tsconfig }) =
|
|
|
2713
2679
|
const errorTypeName = mutator.default ? `${pascal(name)}ErrorType` : "ErrorType";
|
|
2714
2680
|
const bodyTypeName = mutator.default ? `${pascal(name)}${BODY_TYPE_NAME}` : BODY_TYPE_NAME;
|
|
2715
2681
|
const { file, cached } = await loadFile(importPath, {
|
|
2716
|
-
isDefault: false,
|
|
2717
2682
|
root: workspace,
|
|
2718
2683
|
alias: mutator.alias,
|
|
2719
|
-
tsconfig
|
|
2720
|
-
load: false
|
|
2684
|
+
tsconfig
|
|
2721
2685
|
});
|
|
2722
2686
|
if (file) {
|
|
2723
2687
|
const mutatorInfoName = isDefault ? "default" : mutator.name;
|