@kubb/core 5.12.2 → 5.12.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/{Hookable-DuUzYJNA.js → Hookable-CIEVq8yT.js} +24 -4
- package/dist/Hookable-CIEVq8yT.js.map +1 -0
- package/dist/index.cjs +23 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +1 -1
- package/dist/mocks.js +1 -1
- package/package.json +2 -2
- package/dist/Hookable-DuUzYJNA.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -45,7 +45,7 @@ unstorage_drivers_fs = __toESM(unstorage_drivers_fs, 1);
|
|
|
45
45
|
let node_url = require("node:url");
|
|
46
46
|
let node_module = require("node:module");
|
|
47
47
|
//#region package.json
|
|
48
|
-
var version = "5.12.
|
|
48
|
+
var version = "5.12.4";
|
|
49
49
|
//#endregion
|
|
50
50
|
//#region ../../internals/utils/src/casing.ts
|
|
51
51
|
/**
|
|
@@ -1541,15 +1541,34 @@ async function resolvePublicFetchConfig(repo, signal) {
|
|
|
1541
1541
|
});
|
|
1542
1542
|
}
|
|
1543
1543
|
/**
|
|
1544
|
+
* The `GIT_CONFIG_*` pair that sends an `Authorization` header to `repo`'s origin, numbered after
|
|
1545
|
+
* the pairs already in `env`, so the token stays out of the process arguments. Throws
|
|
1546
|
+
* `KUBB_GIT_INPUT_FAILED` for a value with a line break, which would add another header.
|
|
1547
|
+
*/
|
|
1548
|
+
function gitAuthEnv(env, { repo, authorization }) {
|
|
1549
|
+
if (/[\r\n]/.test(authorization) || !URL.canParse(repo)) throw gitError("The authorization for a git `input` must be one line, for an https repository.");
|
|
1550
|
+
const index = Math.max(0, Number.parseInt(env.GIT_CONFIG_COUNT ?? "", 10) || 0);
|
|
1551
|
+
return {
|
|
1552
|
+
GIT_CONFIG_COUNT: String(index + 1),
|
|
1553
|
+
[`GIT_CONFIG_KEY_${index}`]: `http.${new URL(repo).origin}/.extraheader`,
|
|
1554
|
+
[`GIT_CONFIG_VALUE_${index}`]: `Authorization: ${authorization}`
|
|
1555
|
+
};
|
|
1556
|
+
}
|
|
1557
|
+
/**
|
|
1544
1558
|
* Fetches one commit of a git repository into a temporary directory with a shallow `git fetch`,
|
|
1545
1559
|
* so any host and the user's own git credentials work, and relative `$ref` files resolve.
|
|
1546
1560
|
* Resolves to the spec path on disk and a `dispose` that deletes the checkout.
|
|
1547
1561
|
*
|
|
1548
1562
|
* With `publicOnly`, the repository must be an https URL on public addresses, the fetch connects to
|
|
1549
|
-
* the addresses checked, and it does not follow a redirect.
|
|
1563
|
+
* the addresses checked, and it does not follow a redirect. `authorization` adds that header to this
|
|
1564
|
+
* fetch only, through {@link gitAuthEnv}.
|
|
1550
1565
|
*/
|
|
1551
|
-
async function checkoutGitInput(input, signal, { publicOnly = false } = {}) {
|
|
1566
|
+
async function checkoutGitInput(input, signal, { publicOnly = false, authorization } = {}) {
|
|
1552
1567
|
const { repo, ref, path } = parseGitInput(input);
|
|
1568
|
+
const authEnv = authorization ? gitAuthEnv(node_process.default.env, {
|
|
1569
|
+
repo,
|
|
1570
|
+
authorization
|
|
1571
|
+
}) : {};
|
|
1553
1572
|
const fetchConfig = publicOnly ? await resolvePublicFetchConfig(repo, signal) : [];
|
|
1554
1573
|
const dir = await (0, node_fs_promises.mkdtemp)((0, node_path.join)((0, node_os.tmpdir)(), "kubb-git-"));
|
|
1555
1574
|
const dispose = () => (0, node_fs_promises.rm)(dir, {
|
|
@@ -1565,6 +1584,7 @@ async function checkoutGitInput(input, signal, { publicOnly = false } = {}) {
|
|
|
1565
1584
|
const label = `${redact(repo)}${ref ? ` at ${ref}` : ""}`;
|
|
1566
1585
|
const env = {
|
|
1567
1586
|
...node_process.default.env,
|
|
1587
|
+
...authEnv,
|
|
1568
1588
|
GIT_TERMINAL_PROMPT: "0"
|
|
1569
1589
|
};
|
|
1570
1590
|
const steps = [
|