@kubb/core 5.12.1 → 5.12.3
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-D3jKB944.js → Hookable-DPTq2eNO.js} +20 -4
- package/dist/Hookable-DPTq2eNO.js.map +1 -0
- package/dist/index.cjs +19 -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-D3jKB944.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.3";
|
|
49
49
|
//#endregion
|
|
50
50
|
//#region ../../internals/utils/src/casing.ts
|
|
51
51
|
/**
|
|
@@ -1540,16 +1540,31 @@ async function resolvePublicFetchConfig(repo, signal) {
|
|
|
1540
1540
|
addresses
|
|
1541
1541
|
});
|
|
1542
1542
|
}
|
|
1543
|
+
/** Adds an `Authorization` header for `repo`'s origin as the `GIT_CONFIG_*` pair after those in `env`, keeping the token out of the arguments; throws on a line break. */
|
|
1544
|
+
function gitAuthEnv(env, { repo, authorization }) {
|
|
1545
|
+
if (/[\r\n]/.test(authorization) || !URL.canParse(repo)) throw gitError("The authorization for a git `input` must be one line, for an https repository.");
|
|
1546
|
+
const index = Math.max(0, Number.parseInt(env.GIT_CONFIG_COUNT ?? "", 10) || 0);
|
|
1547
|
+
return {
|
|
1548
|
+
GIT_CONFIG_COUNT: String(index + 1),
|
|
1549
|
+
[`GIT_CONFIG_KEY_${index}`]: `http.${new URL(repo).origin}/.extraheader`,
|
|
1550
|
+
[`GIT_CONFIG_VALUE_${index}`]: `Authorization: ${authorization}`
|
|
1551
|
+
};
|
|
1552
|
+
}
|
|
1543
1553
|
/**
|
|
1544
1554
|
* Fetches one commit of a git repository into a temporary directory with a shallow `git fetch`,
|
|
1545
1555
|
* so any host and the user's own git credentials work, and relative `$ref` files resolve.
|
|
1546
1556
|
* Resolves to the spec path on disk and a `dispose` that deletes the checkout.
|
|
1547
1557
|
*
|
|
1548
1558
|
* 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.
|
|
1559
|
+
* the addresses checked, and it does not follow a redirect. `authorization` adds that header to this
|
|
1560
|
+
* fetch only, through {@link gitAuthEnv}.
|
|
1550
1561
|
*/
|
|
1551
|
-
async function checkoutGitInput(input, signal, { publicOnly = false } = {}) {
|
|
1562
|
+
async function checkoutGitInput(input, signal, { publicOnly = false, authorization } = {}) {
|
|
1552
1563
|
const { repo, ref, path } = parseGitInput(input);
|
|
1564
|
+
const authEnv = authorization ? gitAuthEnv(node_process.default.env, {
|
|
1565
|
+
repo,
|
|
1566
|
+
authorization
|
|
1567
|
+
}) : {};
|
|
1553
1568
|
const fetchConfig = publicOnly ? await resolvePublicFetchConfig(repo, signal) : [];
|
|
1554
1569
|
const dir = await (0, node_fs_promises.mkdtemp)((0, node_path.join)((0, node_os.tmpdir)(), "kubb-git-"));
|
|
1555
1570
|
const dispose = () => (0, node_fs_promises.rm)(dir, {
|
|
@@ -1565,6 +1580,7 @@ async function checkoutGitInput(input, signal, { publicOnly = false } = {}) {
|
|
|
1565
1580
|
const label = `${redact(repo)}${ref ? ` at ${ref}` : ""}`;
|
|
1566
1581
|
const env = {
|
|
1567
1582
|
...node_process.default.env,
|
|
1583
|
+
...authEnv,
|
|
1568
1584
|
GIT_TERMINAL_PROMPT: "0"
|
|
1569
1585
|
};
|
|
1570
1586
|
const steps = [
|