@kubb/core 0.56.2 → 0.56.4
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.cjs +50 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +14 -14
- package/dist/index.global.js +45 -34
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +49 -38
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.global.js
CHANGED
|
@@ -15055,10 +15055,10 @@ var kubb = (function (exports) {
|
|
|
15055
15055
|
var m = p;
|
|
15056
15056
|
if (c) {
|
|
15057
15057
|
var isDir = c === "DIR" || Array.isArray(c);
|
|
15058
|
-
var
|
|
15059
|
-
if (isDir && !
|
|
15058
|
+
var slash2 = p.slice(-1) === "/";
|
|
15059
|
+
if (isDir && !slash2)
|
|
15060
15060
|
m += "/";
|
|
15061
|
-
else if (!isDir &&
|
|
15061
|
+
else if (!isDir && slash2)
|
|
15062
15062
|
m = m.slice(0, -1);
|
|
15063
15063
|
if (m !== p) {
|
|
15064
15064
|
var mabs = makeAbs(self2, m);
|
|
@@ -28287,7 +28287,7 @@ ${n}`;
|
|
|
28287
28287
|
|
|
28288
28288
|
// src/utils/isURL.ts
|
|
28289
28289
|
init_define_process();
|
|
28290
|
-
|
|
28290
|
+
function isURL(data) {
|
|
28291
28291
|
try {
|
|
28292
28292
|
const url = new URL(data);
|
|
28293
28293
|
if (url?.href) {
|
|
@@ -28297,7 +28297,7 @@ ${n}`;
|
|
|
28297
28297
|
return false;
|
|
28298
28298
|
}
|
|
28299
28299
|
return false;
|
|
28300
|
-
}
|
|
28300
|
+
}
|
|
28301
28301
|
|
|
28302
28302
|
// src/managers/pluginManager/PluginManager.ts
|
|
28303
28303
|
init_define_process();
|
|
@@ -28308,21 +28308,21 @@ ${n}`;
|
|
|
28308
28308
|
|
|
28309
28309
|
// src/utils/isPromise.ts
|
|
28310
28310
|
init_define_process();
|
|
28311
|
-
|
|
28311
|
+
function isPromise(result) {
|
|
28312
28312
|
return typeof result?.then === "function";
|
|
28313
|
-
}
|
|
28313
|
+
}
|
|
28314
28314
|
|
|
28315
28315
|
// src/utils/write.ts
|
|
28316
28316
|
init_define_process();
|
|
28317
28317
|
var import_fs = __toESM(require_lib(), 1);
|
|
28318
28318
|
var import_path = __toESM(require_path_browserify(), 1);
|
|
28319
28319
|
var import_rimraf = __toESM(require_rimraf(), 1);
|
|
28320
|
-
|
|
28320
|
+
async function safeWriteFileToPath(path, data) {
|
|
28321
28321
|
const passedPath = import_path.default.dirname(import_path.default.resolve(path));
|
|
28322
28322
|
await import_fs.promises.mkdir(passedPath, { recursive: true });
|
|
28323
28323
|
return import_fs.promises.writeFile(import_path.default.resolve(path), data, { encoding: "utf-8" });
|
|
28324
|
-
}
|
|
28325
|
-
|
|
28324
|
+
}
|
|
28325
|
+
async function write(data, path) {
|
|
28326
28326
|
try {
|
|
28327
28327
|
await import_fs.promises.stat(path);
|
|
28328
28328
|
const oldContent = await import_fs.promises.readFile(path, { encoding: "utf-8" });
|
|
@@ -28333,8 +28333,8 @@ ${n}`;
|
|
|
28333
28333
|
return safeWriteFileToPath(path, data);
|
|
28334
28334
|
}
|
|
28335
28335
|
return safeWriteFileToPath(path, data);
|
|
28336
|
-
}
|
|
28337
|
-
|
|
28336
|
+
}
|
|
28337
|
+
async function clean(path) {
|
|
28338
28338
|
return new Promise((resolve, reject) => {
|
|
28339
28339
|
(0, import_rimraf.default)(path, (err) => {
|
|
28340
28340
|
if (err) {
|
|
@@ -28344,7 +28344,7 @@ ${n}`;
|
|
|
28344
28344
|
}
|
|
28345
28345
|
});
|
|
28346
28346
|
});
|
|
28347
|
-
}
|
|
28347
|
+
}
|
|
28348
28348
|
|
|
28349
28349
|
// src/utils/cache.ts
|
|
28350
28350
|
init_define_process();
|
|
@@ -28377,27 +28377,38 @@ ${n}`;
|
|
|
28377
28377
|
init_define_process();
|
|
28378
28378
|
var import_path2 = __toESM(require_path_browserify(), 1);
|
|
28379
28379
|
var import_fs2 = __toESM(require_lib(), 1);
|
|
28380
|
-
|
|
28381
|
-
|
|
28380
|
+
function slash(path) {
|
|
28381
|
+
const isExtendedLengthPath = /^\\\\\?\\/.test(path);
|
|
28382
|
+
if (isExtendedLengthPath) {
|
|
28383
|
+
return path;
|
|
28384
|
+
}
|
|
28385
|
+
return path.replace(/\\/g, "/");
|
|
28386
|
+
}
|
|
28387
|
+
function getRelativePath(rootDir, filePath) {
|
|
28388
|
+
if (!rootDir || !filePath) {
|
|
28382
28389
|
throw new Error("Root and file should be filled in when retrieving the relativePath");
|
|
28383
28390
|
}
|
|
28384
|
-
const
|
|
28385
|
-
|
|
28386
|
-
|
|
28387
|
-
|
|
28391
|
+
const relativePath = import_path2.default.relative(rootDir, filePath);
|
|
28392
|
+
const path = slash(relativePath).replace("../", "").trimEnd();
|
|
28393
|
+
if (path.startsWith("../")) {
|
|
28394
|
+
return path.replace(import_path2.default.basename(path), import_path2.default.basename(path, import_path2.default.extname(filePath)));
|
|
28395
|
+
}
|
|
28396
|
+
return `./${path.replace(import_path2.default.basename(path), import_path2.default.basename(path, import_path2.default.extname(filePath)))}`;
|
|
28397
|
+
}
|
|
28398
|
+
function getPathMode(path) {
|
|
28388
28399
|
if (!path) {
|
|
28389
28400
|
return "directory";
|
|
28390
28401
|
}
|
|
28391
28402
|
return import_path2.default.extname(path) ? "file" : "directory";
|
|
28392
|
-
}
|
|
28393
|
-
|
|
28403
|
+
}
|
|
28404
|
+
async function read(path) {
|
|
28394
28405
|
try {
|
|
28395
28406
|
return import_fs2.promises.readFile(path, { encoding: "utf8" });
|
|
28396
28407
|
} catch (err) {
|
|
28397
28408
|
console.error(err);
|
|
28398
28409
|
throw err;
|
|
28399
28410
|
}
|
|
28400
|
-
}
|
|
28411
|
+
}
|
|
28401
28412
|
|
|
28402
28413
|
// src/utils/format.ts
|
|
28403
28414
|
init_define_process();
|
|
@@ -28412,13 +28423,13 @@ ${n}`;
|
|
|
28412
28423
|
endOfLine: "auto"
|
|
28413
28424
|
// plugins: [parserTypescript],
|
|
28414
28425
|
};
|
|
28415
|
-
|
|
28426
|
+
function format(source) {
|
|
28416
28427
|
return (0, import_prettier.format)(source, formatOptions);
|
|
28417
|
-
}
|
|
28428
|
+
}
|
|
28418
28429
|
|
|
28419
28430
|
// src/utils/objectToParameters.ts
|
|
28420
28431
|
init_define_process();
|
|
28421
|
-
|
|
28432
|
+
function objectToParameters(data, options = {}) {
|
|
28422
28433
|
return data.reduce((acc, [key, value]) => {
|
|
28423
28434
|
if (options.typed) {
|
|
28424
28435
|
acc.push(`${key}: ${value}["${key}"], `);
|
|
@@ -28427,11 +28438,11 @@ ${n}`;
|
|
|
28427
28438
|
}
|
|
28428
28439
|
return acc;
|
|
28429
28440
|
}, []).join("");
|
|
28430
|
-
}
|
|
28441
|
+
}
|
|
28431
28442
|
|
|
28432
28443
|
// src/utils/nameSorter.ts
|
|
28433
28444
|
init_define_process();
|
|
28434
|
-
|
|
28445
|
+
function nameSorter(a, b) {
|
|
28435
28446
|
if (a.name < b.name) {
|
|
28436
28447
|
return -1;
|
|
28437
28448
|
}
|
|
@@ -28439,11 +28450,11 @@ ${n}`;
|
|
|
28439
28450
|
return 1;
|
|
28440
28451
|
}
|
|
28441
28452
|
return 0;
|
|
28442
|
-
}
|
|
28453
|
+
}
|
|
28443
28454
|
|
|
28444
28455
|
// src/utils/jsdoc.ts
|
|
28445
28456
|
init_define_process();
|
|
28446
|
-
|
|
28457
|
+
function createJSDocBlockText({ comments }) {
|
|
28447
28458
|
const filteredComments = comments.filter(Boolean);
|
|
28448
28459
|
if (!filteredComments.length) {
|
|
28449
28460
|
return void 0;
|
|
@@ -28454,7 +28465,7 @@ ${n}`;
|
|
|
28454
28465
|
}, "/**");
|
|
28455
28466
|
return `${text}
|
|
28456
28467
|
*/`;
|
|
28457
|
-
}
|
|
28468
|
+
}
|
|
28458
28469
|
|
|
28459
28470
|
// src/plugin.ts
|
|
28460
28471
|
function createPlugin(factory) {
|
|
@@ -28576,7 +28587,7 @@ ${n}`;
|
|
|
28576
28587
|
getSuccessKey: () => `success`,
|
|
28577
28588
|
getRemoveKey: (id) => `${id}remove`
|
|
28578
28589
|
};
|
|
28579
|
-
|
|
28590
|
+
function getFileManagerEvents(emitter) {
|
|
28580
28591
|
return {
|
|
28581
28592
|
/**
|
|
28582
28593
|
* Emiter
|
|
@@ -28620,7 +28631,7 @@ ${n}`;
|
|
|
28620
28631
|
return () => emitter.removeListener(keys.getRemoveKey(id), callback);
|
|
28621
28632
|
}
|
|
28622
28633
|
};
|
|
28623
|
-
}
|
|
28634
|
+
}
|
|
28624
28635
|
|
|
28625
28636
|
// src/managers/fileManager/FileManager.ts
|
|
28626
28637
|
var FileManager = class {
|
|
@@ -29031,7 +29042,7 @@ ${curr.source}`,
|
|
|
29031
29042
|
init_define_process();
|
|
29032
29043
|
var ValidationPluginError = class extends Error {
|
|
29033
29044
|
};
|
|
29034
|
-
|
|
29045
|
+
function validatePlugins(plugins, dependedPluginNames) {
|
|
29035
29046
|
let pluginNames = [];
|
|
29036
29047
|
if (typeof dependedPluginNames === "string") {
|
|
29037
29048
|
pluginNames = [dependedPluginNames];
|
|
@@ -29045,7 +29056,7 @@ ${curr.source}`,
|
|
|
29045
29056
|
}
|
|
29046
29057
|
});
|
|
29047
29058
|
return true;
|
|
29048
|
-
}
|
|
29059
|
+
}
|
|
29049
29060
|
|
|
29050
29061
|
// src/build.ts
|
|
29051
29062
|
async function transformReducer(_previousCode, result, _plugin) {
|