@ac-kit/fixture-util 0.1.0 → 0.1.2
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 +52 -0
- package/README.md +1 -1
- package/dist/fetch.d.ts +5 -2
- package/dist/fetch.d.ts.map +1 -1
- package/dist/fetch.js +4 -1
- package/dist/fetch.js.map +1 -1
- package/dist/git-sparse.d.ts +9 -0
- package/dist/git-sparse.d.ts.map +1 -1
- package/dist/git-sparse.js +21 -2
- package/dist/git-sparse.js.map +1 -1
- package/package.json +13 -11
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# @ac-kit/fixture-util
|
|
2
|
+
|
|
3
|
+
## 0.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5c203e7: Encoded bytes, digests and tags are typed `Uint8Array<ArrayBuffer>`, so they
|
|
8
|
+
are `BufferSource`s and go straight to `crypto.subtle` or any other Web API
|
|
9
|
+
without a cast:
|
|
10
|
+
|
|
11
|
+
- `@ac-kit/crypto-hash`: `sha224`, `sha3_224`, `sha3_256`, `sha3_384`,
|
|
12
|
+
`sha3_512`, `shake128`, `shake256` and every sink's `digest`, like the other
|
|
13
|
+
digests already were. Every digest is a fresh array spanning the whole of its
|
|
14
|
+
own plain buffer.
|
|
15
|
+
- `@ac-kit/crypto-mac`: `hmacMd5` and `hmacSha224`, like the other wrappers.
|
|
16
|
+
A tag truncated with `tagLengthBytes` is a view of the full digest's buffer,
|
|
17
|
+
not a copy.
|
|
18
|
+
- `@ac-kit/fixture-util`: `fetchArtifact`.
|
|
19
|
+
- `@ac-kit/format-asn1`: `berEncode`, `cerEncode` and `derEncode`, always a
|
|
20
|
+
fresh array over the whole of a plain buffer. `berEncode` now copies a
|
|
21
|
+
top-level ANY value instead of returning the caller's array, as `cerEncode`
|
|
22
|
+
and `derEncode` already did.
|
|
23
|
+
- `@ac-kit/format-cbor`: `encodeCbor`.
|
|
24
|
+
- `@ac-kit/format-netstring`: `encodeNetstring`.
|
|
25
|
+
- Updated dependencies [5c203e7]
|
|
26
|
+
- Updated dependencies [5c203e7]
|
|
27
|
+
- Updated dependencies [5c203e7]
|
|
28
|
+
- Updated dependencies [5c203e7]
|
|
29
|
+
- @ac-kit/crypto-hash@0.2.0
|
|
30
|
+
- @ac-kit/node@0.13.0
|
|
31
|
+
- @ac-kit/cmd-git@0.2.1
|
|
32
|
+
|
|
33
|
+
## 0.1.1
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- 0b4fe43: `setupGitSparseFixtureEntry` runs `git` in `@ac-kit/cmd-git`'s
|
|
38
|
+
`gitIsolatedEnvironment`, with an empty temporary home: run from a git hook,
|
|
39
|
+
it no longer reinitialises, adds a remote to and checks out into the hook's
|
|
40
|
+
repository, and the machine's system, global and user git configuration
|
|
41
|
+
(`url.*.insteadOf`, `core.hooksPath`, `init.templateDir`, credential helpers,
|
|
42
|
+
`http.proxy`) no longer applies. Every `GIT_*` variable is ignored; proxy
|
|
43
|
+
variables outside git (`https_proxy`…) still apply, and a credential prompt
|
|
44
|
+
fails instead of waiting.
|
|
45
|
+
- Updated dependencies [0b4fe43]
|
|
46
|
+
- Updated dependencies [0b4fe43]
|
|
47
|
+
- Updated dependencies [0b4fe43]
|
|
48
|
+
- Updated dependencies [0b4fe43]
|
|
49
|
+
- Updated dependencies [0b4fe43]
|
|
50
|
+
- @ac-kit/cmd-git@0.2.0
|
|
51
|
+
- @ac-kit/node@0.12.0
|
|
52
|
+
- @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.
|
|
31
|
+
[generated API docs](https://anthochamp.pages.grenadine.io/node-essentials/api/fixture-util/)
|
|
32
32
|
for the full reference.
|
package/dist/fetch.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Downloads `url` and returns its raw bytes, a fresh array over the whole of a
|
|
3
|
+
* plain (never shared) `ArrayBuffer`, so it is a `BufferSource`.
|
|
4
|
+
*/
|
|
5
|
+
export declare function fetchArtifact(url: string): Promise<Uint8Array<ArrayBuffer>>;
|
|
3
6
|
/** Extracts every entry of a zip archive under `destination`. */
|
|
4
7
|
export declare function extractZip(data: Uint8Array, destination: string): Promise<void>;
|
|
5
8
|
//# sourceMappingURL=fetch.d.ts.map
|
package/dist/fetch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAKA
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,wBAAsB,aAAa,CAClC,GAAG,EAAE,MAAM,GACT,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAQlC;AAED,iEAAiE;AACjE,wBAAsB,UAAU,CAC/B,IAAI,EAAE,UAAU,EAChB,WAAW,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAaf"}
|
package/dist/fetch.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
2
2
|
import { dirname, join } from "node:path";
|
|
3
3
|
import { unzipSync } from "fflate";
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Downloads `url` and returns its raw bytes, a fresh array over the whole of a
|
|
6
|
+
* plain (never shared) `ArrayBuffer`, so it is a `BufferSource`.
|
|
7
|
+
*/
|
|
5
8
|
export async function fetchArtifact(url) {
|
|
6
9
|
const response = await fetch(url);
|
|
7
10
|
if (!response.ok) {
|
package/dist/fetch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC
|
|
1
|
+
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAClC,GAAW;IAEX,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;IAElC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,OAAO,GAAG,OAAO,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;IAC5E,CAAC;IAED,OAAO,IAAI,UAAU,CAAC,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;AACrD,CAAC;AAED,iEAAiE;AACjE,MAAM,CAAC,KAAK,UAAU,UAAU,CAC/B,IAAgB,EAChB,WAAmB;IAEnB,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAEhC,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACvD,2EAA2E;QAC3E,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACvD,SAAS;QACV,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QAC5C,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAClD,MAAM,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,CAAC;AACF,CAAC"}
|
package/dist/git-sparse.d.ts
CHANGED
|
@@ -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.
|
package/dist/git-sparse.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-sparse.d.ts","sourceRoot":"","sources":["../src/git-sparse.ts"],"names":[],"mappings":"
|
|
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"}
|
package/dist/git-sparse.js
CHANGED
|
@@ -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
|
|
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, {
|
package/dist/git-sparse.js.map
CHANGED
|
@@ -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,oBAAo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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.
|
|
3
|
+
"version": "0.1.2",
|
|
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.
|
|
11
|
+
"homepage": "https://anthochamp.pages.grenadine.io/node-essentials/api/fixture-util/",
|
|
12
12
|
"bugs": {
|
|
13
|
-
"url": "https://
|
|
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://
|
|
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
|
|
42
|
-
"@ac-kit/crypto-hash": "^0.
|
|
41
|
+
"@ac-kit/cmd-git": "^0.2.1",
|
|
42
|
+
"@ac-kit/crypto-hash": "^0.2.0",
|
|
43
|
+
"@ac-kit/node": "^0.13.0",
|
|
43
44
|
"fflate": "0.8.3"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
47
|
+
"@ac-kit/integration-test-util": "0.6.1",
|
|
46
48
|
"@ac-kit/tsconfig": "0.1.0",
|
|
47
49
|
"@ac-kit/typedoc-config": "0.1.0",
|
|
48
|
-
"@ac-kit/vitest-config": "0.
|
|
49
|
-
"@types/node": "26.
|
|
50
|
+
"@ac-kit/vitest-config": "0.3.0",
|
|
51
|
+
"@types/node": "26.6.11",
|
|
50
52
|
"@typescript/native": "typescript@7.0.2",
|
|
51
|
-
"rimraf": "6.1.
|
|
53
|
+
"rimraf": "6.1.4",
|
|
52
54
|
"typedoc": "0.28.20",
|
|
53
55
|
"typescript": "@typescript/typescript6@6.0.2",
|
|
54
|
-
"vite": "8.
|
|
55
|
-
"vitest": "5.
|
|
56
|
+
"vite": "8.4.0",
|
|
57
|
+
"vitest": "5.1.2"
|
|
56
58
|
},
|
|
57
59
|
"engines": {
|
|
58
60
|
"node": ">=24"
|