@vertz/runtime 0.0.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.
Files changed (3) hide show
  1. package/index.js +32 -0
  2. package/package.json +41 -0
  3. package/postinstall.cjs +13 -0
package/index.js ADDED
@@ -0,0 +1,32 @@
1
+ // index.ts
2
+ import { existsSync } from "node:fs";
3
+ import { createRequire } from "node:module";
4
+ import { dirname, join } from "node:path";
5
+ var require2 = createRequire(import.meta.url);
6
+ function getBinaryPath() {
7
+ const pkg = `@vertz/runtime-${process.platform}-${process.arch}`;
8
+ let pkgDir;
9
+ try {
10
+ pkgDir = dirname(require2.resolve(`${pkg}/package.json`));
11
+ } catch {
12
+ throw new Error(`No Vertz runtime binary available for ${process.platform}-${process.arch}.
13
+ ` + `Expected package: ${pkg}
14
+
15
+ ` + `If your platform is supported, try: npm install @vertz/runtime
16
+ ` + `If your platform is not supported, build from source: cd native && cargo build --release
17
+
18
+ ` + `Supported platforms: darwin-arm64, darwin-x64, linux-x64, linux-arm64
19
+ ` + `See: https://vertz.dev/docs/runtime`);
20
+ }
21
+ const binaryPath = join(pkgDir, "vtz");
22
+ if (!existsSync(binaryPath)) {
23
+ throw new Error(`Vertz runtime package ${pkg} is installed but the binary is missing at ${binaryPath}.
24
+ ` + `The package may be corrupted or incompletely installed.
25
+
26
+ ` + `Try: npm rebuild ${pkg}`);
27
+ }
28
+ return binaryPath;
29
+ }
30
+ export {
31
+ getBinaryPath
32
+ };
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@vertz/runtime",
3
+ "version": "0.0.2",
4
+ "description": "Vertz runtime binary (platform selector)",
5
+ "files": [
6
+ "index.js",
7
+ "index.d.ts",
8
+ "postinstall.cjs"
9
+ ],
10
+ "type": "module",
11
+ "main": "index.js",
12
+ "types": "index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "import": "./index.js",
16
+ "types": "./index.d.ts"
17
+ },
18
+ "./package.json": "./package.json"
19
+ },
20
+ "scripts": {
21
+ "build": "bun build index.ts --outdir . --target node",
22
+ "postinstall": "node postinstall.cjs"
23
+ },
24
+ "devDependencies": {
25
+ "@types/node": "^22.15.32"
26
+ },
27
+ "optionalDependencies": {
28
+ "@vertz/runtime-darwin-arm64": "0.0.2",
29
+ "@vertz/runtime-darwin-x64": "0.0.2",
30
+ "@vertz/runtime-linux-arm64": "0.0.2",
31
+ "@vertz/runtime-linux-x64": "0.0.2"
32
+ },
33
+ "bin": {
34
+ "vtz": "./vtz",
35
+ "vertz": "./vtz"
36
+ },
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "https://github.com/vertz-dev/vtz"
40
+ }
41
+ }
@@ -0,0 +1,13 @@
1
+ try {
2
+ // Dynamic import not available in CJS postinstall context — use require on the compiled .js
3
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
4
+ const { getBinaryPath } = require('./index.js');
5
+ getBinaryPath();
6
+ } catch {
7
+ const pkg = `@vertz/runtime-${process.platform}-${process.arch}`;
8
+ console.warn(
9
+ `\x1b[33m[vertz]\x1b[0m Runtime binary not found for ${process.platform}-${process.arch}. ` +
10
+ `\`vertz dev\` will fall back to Bun.\n` +
11
+ `Try: npm install ${pkg}`,
12
+ );
13
+ }