@flowscripter/flowscripter-io-cli 3.0.6 → 3.0.7
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/bun.lock +2 -2
- package/package.json +2 -2
- package/src/commands/hash.ts +2 -1
- package/tests/commands/hash-lazy-load.test.ts +23 -0
package/bun.lock
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"@flowscripter/dynamic-cli-framework": "^11.0.0",
|
|
9
9
|
"@flowscripter/dynamic-cli-framework-api": "^5.0.2",
|
|
10
10
|
"@flowscripter/dynamic-plugin-framework": "^2.2.25",
|
|
11
|
-
"@flowscripter/flowscripter-io-cli-hash-native": "^
|
|
11
|
+
"@flowscripter/flowscripter-io-cli-hash-native": "^2.0.0",
|
|
12
12
|
"@flowscripter/pluggable-io-framework": "^2.1.2",
|
|
13
13
|
"@flowscripter/pluggable-io-framework-api": "^3.1.3",
|
|
14
14
|
"zod": "^4.6.7",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
|
|
33
33
|
"@flowscripter/dynamic-plugin-framework": ["@flowscripter/dynamic-plugin-framework@2.2.25", "", { "dependencies": { "semver": "^7.8.5" }, "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-12bvEep1XsbTS2kFwhd5veLUFU6pQxgKqOT4x8K8j/aS/uBzGMoeLgiHh+9kp8BpfJmwnPLQrFPj7/ffdPxZPw=="],
|
|
34
34
|
|
|
35
|
-
"@flowscripter/flowscripter-io-cli-hash-native": ["@flowscripter/flowscripter-io-cli-hash-native@
|
|
35
|
+
"@flowscripter/flowscripter-io-cli-hash-native": ["@flowscripter/flowscripter-io-cli-hash-native@2.0.0", "", { "peerDependencies": { "typescript": "^7.0.2" } }, "sha512-4Ntzvqr+iK5N2k/zhPlCBO+/hVZQCaolSKir+ey3Fl23cLXFt3QbVyMuwLLNtdXWG54Crfso4ogn/D7yMvTusA=="],
|
|
36
36
|
|
|
37
37
|
"@flowscripter/io-plugin-filesystem": ["@flowscripter/io-plugin-filesystem@2.0.3", "", { "dependencies": { "@flowscripter/pluggable-io-framework-api": "^3.1.2", "zod": "^4.6.6" }, "peerDependencies": { "@flowscripter/dynamic-plugin-framework": "*", "typescript": "^7.0.2" } }, "sha512-RYYXfy3t7Nt0w3b+BmxIn1CdsyMh6z/3BoCTFLqkhMSe+3tcQs+jLnZp1f456FQKR3hq5dS4MxAalaepfdy4fg=="],
|
|
38
38
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowscripter/flowscripter-io-cli",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.7",
|
|
4
4
|
"description": "CLI for https://github.com/flowscripter/pluggable-io-framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bun",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@flowscripter/dynamic-cli-framework": "^11.0.0",
|
|
25
25
|
"@flowscripter/dynamic-cli-framework-api": "^5.0.2",
|
|
26
26
|
"@flowscripter/dynamic-plugin-framework": "^2.2.25",
|
|
27
|
-
"@flowscripter/flowscripter-io-cli-hash-native": "^
|
|
27
|
+
"@flowscripter/flowscripter-io-cli-hash-native": "^2.0.0",
|
|
28
28
|
"@flowscripter/pluggable-io-framework": "^2.1.2",
|
|
29
29
|
"@flowscripter/pluggable-io-framework-api": "^3.1.3",
|
|
30
30
|
"zod": "^4.6.7"
|
package/src/commands/hash.ts
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "@flowscripter/dynamic-cli-framework";
|
|
12
12
|
import type { ProviderRegistry } from "@flowscripter/pluggable-io-framework";
|
|
13
13
|
import { type Item, PayloadKind } from "@flowscripter/pluggable-io-framework-api";
|
|
14
|
-
import { Sha256Hasher } from "@flowscripter/flowscripter-io-cli-hash-native";
|
|
14
|
+
import { initNativeLib, Sha256Hasher } from "@flowscripter/flowscripter-io-cli-hash-native";
|
|
15
15
|
import { createByteScale } from "../util/byteScale.ts";
|
|
16
16
|
import { createLocationOption } from "../util/location/createLocationOption.ts";
|
|
17
17
|
import { toStructuredLocation } from "../util/location/toStructuredLocation.ts";
|
|
@@ -112,6 +112,7 @@ async function hashWithNativeSha256(
|
|
|
112
112
|
reader: ReadableStreamDefaultReader<Item>,
|
|
113
113
|
onChunk: (chunkLength: number) => void,
|
|
114
114
|
): Promise<string> {
|
|
115
|
+
await initNativeLib();
|
|
115
116
|
const hasher = new Sha256Hasher();
|
|
116
117
|
for (;;) {
|
|
117
118
|
const { done, value } = await reader.read();
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { expect, test } from "bun:test";
|
|
2
|
+
import { existsSync, mkdtempSync, rmSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
|
|
6
|
+
test("importing the hash command does not resolve or download the native library", async () => {
|
|
7
|
+
const home = mkdtempSync(join(tmpdir(), "hash-lazy-load-"));
|
|
8
|
+
try {
|
|
9
|
+
const hashModule = join(import.meta.dir, "../../src/commands/hash.ts");
|
|
10
|
+
const proc = Bun.spawn(
|
|
11
|
+
[process.execPath, "--eval", "await import(process.argv[1])", hashModule],
|
|
12
|
+
{
|
|
13
|
+
env: { ...process.env, HOME: home, USERPROFILE: home },
|
|
14
|
+
stdout: "pipe",
|
|
15
|
+
stderr: "pipe",
|
|
16
|
+
},
|
|
17
|
+
);
|
|
18
|
+
expect(await proc.exited).toBe(0);
|
|
19
|
+
expect(existsSync(join(home, ".flowscripter"))).toBe(false);
|
|
20
|
+
} finally {
|
|
21
|
+
rmSync(home, { recursive: true, force: true });
|
|
22
|
+
}
|
|
23
|
+
});
|