@ac-kit/fixture-util 0.1.0 → 0.1.1

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/CHANGELOG.md ADDED
@@ -0,0 +1,22 @@
1
+ # @ac-kit/fixture-util
2
+
3
+ ## 0.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 0b4fe43: `setupGitSparseFixtureEntry` runs `git` in `@ac-kit/cmd-git`'s
8
+ `gitIsolatedEnvironment`, with an empty temporary home: run from a git hook,
9
+ it no longer reinitialises, adds a remote to and checks out into the hook's
10
+ repository, and the machine's system, global and user git configuration
11
+ (`url.*.insteadOf`, `core.hooksPath`, `init.templateDir`, credential helpers,
12
+ `http.proxy`) no longer applies. Every `GIT_*` variable is ignored; proxy
13
+ variables outside git (`https_proxy`…) still apply, and a credential prompt
14
+ fails instead of waiting.
15
+ - Updated dependencies [0b4fe43]
16
+ - Updated dependencies [0b4fe43]
17
+ - Updated dependencies [0b4fe43]
18
+ - Updated dependencies [0b4fe43]
19
+ - Updated dependencies [0b4fe43]
20
+ - @ac-kit/cmd-git@0.2.0
21
+ - @ac-kit/node@0.12.0
22
+ - @ac-kit/crypto-hash@0.1.12
package/README.md CHANGED
@@ -28,5 +28,5 @@ own manifest data and domain-specific loaders.
28
28
  Node only.
29
29
 
30
30
  See the
31
- [generated API docs](https://anthochamp.github.io/node-essentials/api/fixture-util/)
31
+ [generated API docs](https://anthochamp.pages.grenadine.io/node-essentials/api/fixture-util/)
32
32
  for the full reference.
@@ -16,6 +16,15 @@ export interface GitSparseFixtureEntry extends FixtureEntryBase {
16
16
  * The checked-out `.git` metadata is only needed to produce the worktree above,
17
17
  * not to consume the fixture, so it is removed once the checkout is verified.
18
18
  *
19
+ * `git` works on the repository it creates in `destination` and on nothing else
20
+ * of the machine: it runs in `@ac-kit/cmd-git`'s `gitIsolatedEnvironment`, with
21
+ * an empty temporary home removed afterwards. The variables a git hook exports
22
+ * (`GIT_DIR`, `GIT_CONFIG_KEY_<n>`…) and every other `GIT_*` variable are
23
+ * dropped, the system, global and user configuration (`url.*.insteadOf`,
24
+ * `core.hooksPath`, `init.templateDir`, credential helpers, `http.proxy`) is
25
+ * ignored, and repository discovery stops at `destination`. Proxy variables
26
+ * outside git (`https_proxy`…) still apply; a credential prompt fails.
27
+ *
19
28
  * @throws {Error} When the checked-out `HEAD` does not match
20
29
  * {@link GitSparseFixtureEntry.commit} — defense in depth on top of git's own
21
30
  * content-addressed verification of the fetched objects.
@@ -1 +1 @@
1
- {"version":3,"file":"git-sparse.d.ts","sourceRoot":"","sources":["../src/git-sparse.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,wEAAwE;AACxE,MAAM,WAAW,qBAAsB,SAAQ,gBAAgB;IAC9D,sBAAsB;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,qEAAqE;IACrE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,wEAAwE;IACxE,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACxC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,0BAA0B,CAC/C,KAAK,EAAE,qBAAqB,EAC5B,WAAW,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAuBf"}
1
+ {"version":3,"file":"git-sparse.d.ts","sourceRoot":"","sources":["../src/git-sparse.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,wEAAwE;AACxE,MAAM,WAAW,qBAAsB,SAAQ,gBAAgB;IAC9D,sBAAsB;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,qEAAqE;IACrE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,wEAAwE;IACxE,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACxC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,0BAA0B,CAC/C,KAAK,EAAE,qBAAqB,EAC5B,WAAW,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAWf"}
@@ -1,6 +1,7 @@
1
1
  import { rm } from "node:fs/promises";
2
2
  import { join } from "node:path";
3
- import { gitCheckout, gitFetch, gitInit, gitRemoteAdd, gitRevParse, gitSparseCheckoutInit, gitSparseCheckoutSet, } from "@ac-kit/cmd-git";
3
+ import { gitCheckout, gitFetch, gitInit, gitIsolatedEnvironment, gitRemoteAdd, gitRevParse, gitSparseCheckoutInit, gitSparseCheckoutSet, } from "@ac-kit/cmd-git";
4
+ import { createTempDir } from "@ac-kit/node";
4
5
  /**
5
6
  * Fetches one git-hosted corpus by cloning nothing but the pinned commit's
6
7
  * object graph (`--filter=blob:none`) and checking out only the sparse paths
@@ -9,12 +10,30 @@ import { gitCheckout, gitFetch, gitInit, gitRemoteAdd, gitRevParse, gitSparseChe
9
10
  * The checked-out `.git` metadata is only needed to produce the worktree above,
10
11
  * not to consume the fixture, so it is removed once the checkout is verified.
11
12
  *
13
+ * `git` works on the repository it creates in `destination` and on nothing else
14
+ * of the machine: it runs in `@ac-kit/cmd-git`'s `gitIsolatedEnvironment`, with
15
+ * an empty temporary home removed afterwards. The variables a git hook exports
16
+ * (`GIT_DIR`, `GIT_CONFIG_KEY_<n>`…) and every other `GIT_*` variable are
17
+ * dropped, the system, global and user configuration (`url.*.insteadOf`,
18
+ * `core.hooksPath`, `init.templateDir`, credential helpers, `http.proxy`) is
19
+ * ignored, and repository discovery stops at `destination`. Proxy variables
20
+ * outside git (`https_proxy`…) still apply; a credential prompt fails.
21
+ *
12
22
  * @throws {Error} When the checked-out `HEAD` does not match
13
23
  * {@link GitSparseFixtureEntry.commit} — defense in depth on top of git's own
14
24
  * content-addressed verification of the fetched objects.
15
25
  */
16
26
  export async function setupGitSparseFixtureEntry(entry, destination) {
17
- const execOptions = { cwd: destination };
27
+ const home = await createTempDir("git-sparse-fixture-home");
28
+ try {
29
+ await checkOut_(entry, destination, gitIsolatedEnvironment(destination, { home }));
30
+ }
31
+ finally {
32
+ await rm(home, { recursive: true, force: true });
33
+ }
34
+ }
35
+ async function checkOut_(entry, destination, env) {
36
+ const execOptions = { cwd: destination, env };
18
37
  await gitInit({ execOptions });
19
38
  await gitRemoteAdd("origin", entry.url, { execOptions });
20
39
  await gitFetch("origin", entry.commit, {
@@ -1 +1 @@
1
- {"version":3,"file":"git-sparse.js","sourceRoot":"","sources":["../src/git-sparse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EACN,WAAW,EACX,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,WAAW,EACX,qBAAqB,EACrB,oBAAoB,GACpB,MAAM,iBAAiB,CAAC;AAgBzB;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC/C,KAA4B,EAC5B,WAAmB;IAEnB,MAAM,WAAW,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC;IAEzC,MAAM,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;IAC/B,MAAM,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;IACzD,MAAM,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,EAAE;QACtC,MAAM,EAAE,WAAW;QACnB,KAAK,EAAE,CAAC;QACR,WAAW;KACX,CAAC,CAAC;IACH,MAAM,qBAAqB,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;IACzD,MAAM,oBAAoB,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;IAC/D,MAAM,WAAW,CAAC,KAAK,CAAC,MAAM,EAA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AAC;AACF,CAAC;AAED,KAAK,UAAU,SAAS,CACvB,KAA4B,EAC5B,WAAmB,EACnB,GAA2B;IAE3B,MAAM,WAAW,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC;IAE9C,MAAM,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;IAC/B,MAAM,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;IACzD,MAAM,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,EAAE;QACtC,MAAM,EAAE,WAAW;QACnB,KAAK,EAAE,CAAC;QACR,WAAW;KACX,CAAC,CAAC;IACH,MAAM,qBAAqB,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;IACzD,MAAM,oBAAoB,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;IAC/D,MAAM,WAAW,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;IAEjD,MAAM,gBAAgB,GAAG,MAAM,WAAW,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;IAEpE,IAAI,gBAAgB,KAAK,KAAK,CAAC,MAAM,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CACd,YAAY,KAAK,CAAC,EAAE,kBAAkB,gBAAgB,4BAA4B,KAAK,CAAC,MAAM,EAAE,CAChG,CAAC;IACH,CAAC;IAED,MAAM,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AACvE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ac-kit/fixture-util",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Infrastructure for packages that fetch a pinned, checksummed test-vector corpus: fetch-and-verify, zip extraction, a manifest-driven setup runner and fixture-directory resolution.",
5
5
  "keywords": [
6
6
  "checksum",
@@ -8,15 +8,15 @@
8
8
  "test-vectors",
9
9
  "testing"
10
10
  ],
11
- "homepage": "https://anthochamp.github.io/node-essentials/api/fixture-util/",
11
+ "homepage": "https://anthochamp.pages.grenadine.io/node-essentials/api/fixture-util/",
12
12
  "bugs": {
13
- "url": "https://github.com/anthochamp/node-essentials/issues"
13
+ "url": "https://git.grenadine.io/anthochamp/node-essentials/issues"
14
14
  },
15
15
  "license": "BSD-3-Clause",
16
16
  "author": "Anthony Champagne <dev@anthonychampagne.fr>",
17
17
  "repository": {
18
18
  "type": "git",
19
- "url": "git+https://github.com/anthochamp/node-essentials.git",
19
+ "url": "git+https://git.grenadine.io/anthochamp/node-essentials.git",
20
20
  "directory": "packages/fixture-util"
21
21
  },
22
22
  "files": [
@@ -38,21 +38,23 @@
38
38
  "prepack": "yarn build"
39
39
  },
40
40
  "dependencies": {
41
- "@ac-kit/cmd-git": "^0.1.0",
42
- "@ac-kit/crypto-hash": "^0.1.0",
41
+ "@ac-kit/cmd-git": "^0.2.0",
42
+ "@ac-kit/crypto-hash": "^0.1.12",
43
+ "@ac-kit/node": "^0.12.0",
43
44
  "fflate": "0.8.3"
44
45
  },
45
46
  "devDependencies": {
47
+ "@ac-kit/integration-test-util": "0.6.0",
46
48
  "@ac-kit/tsconfig": "0.1.0",
47
49
  "@ac-kit/typedoc-config": "0.1.0",
48
- "@ac-kit/vitest-config": "0.1.0",
49
- "@types/node": "26.5.1",
50
+ "@ac-kit/vitest-config": "0.2.0",
51
+ "@types/node": "26.6.11",
50
52
  "@typescript/native": "typescript@7.0.2",
51
- "rimraf": "6.1.3",
53
+ "rimraf": "6.1.4",
52
54
  "typedoc": "0.28.20",
53
55
  "typescript": "@typescript/typescript6@6.0.2",
54
- "vite": "8.3.0",
55
- "vitest": "5.0.0"
56
+ "vite": "8.4.0",
57
+ "vitest": "5.1.2"
56
58
  },
57
59
  "engines": {
58
60
  "node": ">=24"