@kubb/core 5.8.3 → 5.9.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/{KubbDriver-BX8mbluL.js → KubbDriver-B13hgYVE.js} +2 -2
- package/dist/{KubbDriver-BX8mbluL.js.map → KubbDriver-B13hgYVE.js.map} +1 -1
- package/dist/{KubbDriver-iAEw2oH5.cjs → KubbDriver-xvzVajlp.cjs} +2 -2
- package/dist/{KubbDriver-iAEw2oH5.cjs.map → KubbDriver-xvzVajlp.cjs.map} +1 -1
- package/dist/index.cjs +13 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +20 -8
- package/dist/index.js +13 -3
- package/dist/index.js.map +1 -1
- package/dist/mocks.cjs +1 -1
- package/dist/mocks.js +1 -1
- package/package.json +2 -2
- package/schemas/kubb-extension.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_KubbDriver = require("./KubbDriver-
|
|
2
|
+
const require_KubbDriver = require("./KubbDriver-xvzVajlp.cjs");
|
|
3
3
|
let verkit = require("verkit");
|
|
4
4
|
let node_util = require("node:util");
|
|
5
5
|
let node_process = require("node:process");
|
|
@@ -1362,6 +1362,9 @@ const OPTION_TYPES = /* @__PURE__ */ new Set([
|
|
|
1362
1362
|
const PACKAGE_NAME = /^(?:@[a-z0-9~][a-z0-9._~-]*\/)?[a-z0-9~][a-z0-9._~-]*$/;
|
|
1363
1363
|
const IDENTIFIER = /^[A-Za-z_$][\w$]*$/;
|
|
1364
1364
|
const REGISTRY_ID = /^[a-z0-9]+(?:-[a-z0-9]+)*\/[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
1365
|
+
const GITHUB_OWNER = /^[A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9])){0,38}$/;
|
|
1366
|
+
const GITHUB_REPO = /^(?!\.\.?$)[A-Za-z0-9._-]{1,100}$/;
|
|
1367
|
+
const COMMIT = /^[0-9a-f]{40}$/;
|
|
1365
1368
|
/** Option path segments that would reach an object's prototype when Studio writes the value by path. */
|
|
1366
1369
|
const UNSAFE_KEYS = /* @__PURE__ */ new Set([
|
|
1367
1370
|
"__proto__",
|
|
@@ -1371,6 +1374,7 @@ const UNSAFE_KEYS = /* @__PURE__ */ new Set([
|
|
|
1371
1374
|
const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1372
1375
|
const isOptionalString = (value) => value === void 0 || typeof value === "string";
|
|
1373
1376
|
const isFilledString = (value) => typeof value === "string" && value !== "";
|
|
1377
|
+
const matches = (pattern, value) => typeof value === "string" && pattern.test(value);
|
|
1374
1378
|
/** Serializes with sorted object keys, so equal JSON values give equal strings whatever their key order. */
|
|
1375
1379
|
const canonicalJSON = (value) => JSON.stringify(value, (_key, item) => isObject(item) ? Object.fromEntries(Object.keys(item).sort().map((key) => [key, item[key]])) : item);
|
|
1376
1380
|
/**
|
|
@@ -1414,14 +1418,20 @@ function isExtensionManifest(value) {
|
|
|
1414
1418
|
const { kind, name, export: exportName, displayName, description, maintainers, dependencies, compatibility, options } = value;
|
|
1415
1419
|
return EXTENSION_KINDS.has(kind) && isPackageName(name) && typeof exportName === "string" && IDENTIFIER.test(exportName) && typeof displayName === "string" && typeof description === "string" && (maintainers === void 0 || Array.isArray(maintainers) && maintainers.every(isMaintainer)) && (dependencies === void 0 || Array.isArray(dependencies) && dependencies.every(isPackageName)) && (compatibility === void 0 || isObject(compatibility) && Object.entries(compatibility).every(([key, range]) => (key === "kubb" || key === "node") && typeof range === "string")) && (options === void 0 || Array.isArray(options) && options.every(isOption)) && manifestProblems(value).length === 0;
|
|
1416
1420
|
}
|
|
1421
|
+
/** Checks that no artifact field can reach a package manager as a flag or path, and that a GitHub tag names the version. */
|
|
1422
|
+
function isRegistryArtifact(value) {
|
|
1423
|
+
if (!isObject(value) || !isPackageName(value.package) || typeof value.version !== "string" || !(0, verkit.isValid)(value.version)) return false;
|
|
1424
|
+
if (value.kind === "npm") return true;
|
|
1425
|
+
return value.kind === "github" && matches(GITHUB_OWNER, value.owner) && matches(GITHUB_REPO, value.repo) && (value.tag === value.version || value.tag === `v${value.version}`) && matches(COMMIT, value.commit);
|
|
1426
|
+
}
|
|
1417
1427
|
/**
|
|
1418
1428
|
* Checks one entry of a registry's `index.json` or `<owner>/<slug>.json`: a full `<owner>/<slug>` id,
|
|
1419
|
-
* an npm artifact pinned to a valid version, and a valid manifest of the entry's kind.
|
|
1429
|
+
* an npm or GitHub artifact pinned to a valid version, and a valid manifest of the entry's kind.
|
|
1420
1430
|
*/
|
|
1421
1431
|
function isRegistryEntry(value) {
|
|
1422
1432
|
if (!isObject(value)) return false;
|
|
1423
1433
|
const { id, kind, type, artifact, manifest } = value;
|
|
1424
|
-
return typeof id === "string" && REGISTRY_ID.test(id) && EXTENSION_KINDS.has(kind) && (type === "official" || type === "community") &&
|
|
1434
|
+
return typeof id === "string" && REGISTRY_ID.test(id) && EXTENSION_KINDS.has(kind) && (type === "official" || type === "community") && isRegistryArtifact(artifact) && isExtensionManifest(manifest) && manifest.kind === kind;
|
|
1425
1435
|
}
|
|
1426
1436
|
//#endregion
|
|
1427
1437
|
//#region src/installedPackages.ts
|