@opentf/web-compiler 0.18.0 → 0.19.0
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/bin/darwin-arm64/otfwc.br +0 -0
- package/bin/darwin-x64/otfwc.br +0 -0
- package/bin/linux-x64/otfwc.br +0 -0
- package/bin/win32-x64/otfwc.exe.br +0 -0
- package/extract.js +20 -2
- package/package.json +4 -1
|
Binary file
|
package/bin/darwin-x64/otfwc.br
CHANGED
|
Binary file
|
package/bin/linux-x64/otfwc.br
CHANGED
|
Binary file
|
|
Binary file
|
package/extract.js
CHANGED
|
@@ -10,9 +10,27 @@
|
|
|
10
10
|
import { chmod, exists, file, write } from "runtime:fs";
|
|
11
11
|
import { dirname, fromFileURL, join } from "runtime:path";
|
|
12
12
|
import { arch, env, platform } from "runtime:process";
|
|
13
|
+
import { resolve } from "runtime:build";
|
|
13
14
|
|
|
14
15
|
const here = dirname(fromFileURL(import.meta.url));
|
|
15
16
|
|
|
17
|
+
// A build can inline this resolver into a prerender entry. Resolve the installed
|
|
18
|
+
// package by name so its binary stays anchored to the package, not that bundle.
|
|
19
|
+
function packageDirectory() {
|
|
20
|
+
try {
|
|
21
|
+
return dirname(fromFileURL(import.meta.resolve("@opentf/web-compiler")));
|
|
22
|
+
} catch {}
|
|
23
|
+
// With pnpm the compiler may only be visible to the tool that depends on it.
|
|
24
|
+
// Resolve from that installed module, rather than from the generated bundle.
|
|
25
|
+
for (const tool of ["@opentf/esdev-plugin-web", "@opentf/web-cli/ssg"]) {
|
|
26
|
+
try {
|
|
27
|
+
const importer = resolve(tool, import.meta.url);
|
|
28
|
+
return dirname(fromFileURL(resolve("@opentf/web-compiler", importer)));
|
|
29
|
+
} catch {}
|
|
30
|
+
}
|
|
31
|
+
return here;
|
|
32
|
+
}
|
|
33
|
+
|
|
16
34
|
// The shipped `bin/` subdirectories are named the way node reports a host, which is
|
|
17
35
|
// not how the runtime does; map onto them rather than renaming what we publish.
|
|
18
36
|
const OS_NAMES = { linux: "linux", macos: "darwin", windows: "win32" };
|
|
@@ -26,7 +44,7 @@ function hostKey(platformName = platform, architecture = arch) {
|
|
|
26
44
|
return os && cpu ? `${os}-${cpu}` : `${platformName}-${architecture}`;
|
|
27
45
|
}
|
|
28
46
|
|
|
29
|
-
function hostBinPath({ binaryDir =
|
|
47
|
+
function hostBinPath({ binaryDir = packageDirectory(), os = platform, cpuArch = arch } = {}) {
|
|
30
48
|
const key = hostKey(os, cpuArch);
|
|
31
49
|
if (!SUPPORTED.has(key)) return null;
|
|
32
50
|
return join(binaryDir, "bin", key, os === "windows" ? "otfwc.exe" : "otfwc");
|
|
@@ -58,7 +76,7 @@ export async function extractIfPackaged() {
|
|
|
58
76
|
}
|
|
59
77
|
|
|
60
78
|
/** Absolute path to the otfwc executable, or throw with a clear message. */
|
|
61
|
-
export async function otfwcPath({ binaryDir =
|
|
79
|
+
export async function otfwcPath({ binaryDir = packageDirectory(), environment = env, os = platform, cpuArch = arch } = {}) {
|
|
62
80
|
if (environment.OTFWC_BIN) {
|
|
63
81
|
if (await exists(environment.OTFWC_BIN)) return environment.OTFWC_BIN;
|
|
64
82
|
throw new Error(`otfwc: OTFWC_BIN is set but ${environment.OTFWC_BIN} does not exist`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentf/web-compiler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "OTF Web native toolchain (otfwc) — component compilation and documentation indexing in one platform binary.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
"extract.js",
|
|
13
13
|
"bin"
|
|
14
14
|
],
|
|
15
|
+
"engines": {
|
|
16
|
+
"esdev": ">=0.15.0"
|
|
17
|
+
},
|
|
15
18
|
"keywords": [
|
|
16
19
|
"opentf",
|
|
17
20
|
"compiler",
|