@esposter/shared-node 4.1.2 → 4.3.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/README.md CHANGED
@@ -1,19 +1,35 @@
1
1
  # @esposter/shared-node
2
2
 
3
3
  [![Apache-2.0 licensed][badge-license]][url-license]
4
+ [![NPM version][badge-npm-version]][url-npm]
5
+ [![NPM downloads][badge-npm-downloads]][url-npm]
6
+ [![NPM Unpacked Size (with version)][badge-npm-unpacked-size]][url-npm]
4
7
 
5
8
  Node-only shared tooling for Esposter — the machine-wide download cache, hidden-window child processes and benchmark reporting reused across packages. Server/build environment only; never import in browser code.
6
9
 
7
10
  ## Table of Contents
8
11
 
12
+ - 🚀 [Getting Started](#getting-started)
9
13
  - 📖 [Documentation](#documentation)
10
14
  - ⚖️ [License](#license)
11
15
 
12
16
  ---
13
17
 
18
+ ## <a name="getting-started">🚀 Getting Started</a>
19
+
20
+ ```bash
21
+ pnpm i @esposter/shared-node
22
+ ```
23
+
24
+ ```ts
25
+ import { spawnSync } from "@esposter/shared-node/child-process";
26
+
27
+ spawnSync("pnpm", ["install"], { stdio: "inherit" });
28
+ ```
29
+
14
30
  ## <a name="documentation">📖 Documentation</a>
15
31
 
16
- We highly recommend you take a look at the [documentation](https://esposter.com/docs/api/modules/_esposter_shared-node.html) to level up.
32
+ We highly recommend you take a look at the [documentation](https://github.com/Esposter/Esposter/tree/main/openspec/specs) to level up.
17
33
 
18
34
  ### What's Included
19
35
 
@@ -71,3 +87,7 @@ This project is licensed under the [Apache-2.0 license](https://github.com/Espos
71
87
 
72
88
  [badge-license]: https://img.shields.io/github/license/Esposter/Esposter.svg?color=blue
73
89
  [url-license]: https://github.com/Esposter/Esposter/blob/main/LICENSE
90
+ [badge-npm-version]: https://img.shields.io/npm/v/@esposter/shared-node/latest?color=brightgreen
91
+ [url-npm]: https://www.npmjs.com/package/@esposter/shared-node/v/latest
92
+ [badge-npm-unpacked-size]: https://img.shields.io/npm/unpacked-size/@esposter/shared-node/latest?label=npm
93
+ [badge-npm-downloads]: https://img.shields.io/npm/dm/@esposter/shared-node.svg
package/dist/cache.js CHANGED
@@ -9,7 +9,9 @@ const CACHE_ROOT = join(homedir(), SITE_NAME, "cache");
9
9
  const CONTENT_CACHE_DIRECTORY = join(CACHE_ROOT, "content");
10
10
  //#endregion
11
11
  //#region src/services/cache/readContentAddressedObject.ts
12
+ const SHA_256_HEX_REGEX = /^[0-9a-f]{64}$/u;
12
13
  const readContentAddressedObject = async (hash, download, directory = CONTENT_CACHE_DIRECTORY) => {
14
+ if (!SHA_256_HEX_REGEX.test(hash)) throw new InvalidOperationError(Operation.Read, hash, "is not a SHA-256 hex digest");
13
15
  const path = join(directory, hash);
14
16
  if (existsSync(path)) return readFile(path);
15
17
  const bytes = Buffer.from(await download());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esposter/shared-node",
3
- "version": "4.1.2",
3
+ "version": "4.3.1",
4
4
  "description": "Node-only shared tooling: the machine-wide download cache, hidden-window child processes, and benchmark reporting reused across packages.",
5
5
  "keywords": [
6
6
  "benchmark",
@@ -44,28 +44,26 @@
44
44
  },
45
45
  "scripts": {
46
46
  "build": "tsdown",
47
- "format": "oxfmt",
48
- "format:check": "oxfmt --check",
49
47
  "lint": "eslint .",
50
48
  "lint:fix": "eslint --fix .",
51
49
  "test": "vitest",
52
50
  "typecheck": "tsc"
53
51
  },
54
52
  "dependencies": {
55
- "@esposter/shared": "4.1.2"
53
+ "@esposter/shared": "4.3.1"
56
54
  },
57
55
  "devDependencies": {
58
- "@esposter/configuration": "4.1.2",
56
+ "@esposter/configuration": "4.3.1",
59
57
  "@types/node": "^26.6.5",
60
58
  "tsdown": "^0.23.1"
61
59
  },
62
60
  "peerDependencies": {
63
- "vitest": "^5.0.4"
61
+ "vitest": "^5.0.5"
64
62
  },
65
63
  "peerDependenciesMeta": {
66
64
  "vitest": {
67
65
  "optional": true
68
66
  }
69
67
  },
70
- "gitHead": "144e3f98570b015e3181bfbc6cb70d346ce826b5"
68
+ "gitHead": "777a39636b789c13af33ed13370246ccf6dbaf31"
71
69
  }