@letary/chisel 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/README.md +15 -0
- package/index.js +22 -0
- package/package.json +21 -0
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# @letary/chisel
|
|
2
|
+
|
|
3
|
+
The platform-binary resolver for [chisel](https://github.com/letary/chisel) — a method-granular
|
|
4
|
+
bundler with math fusion (Rust/SWC).
|
|
5
|
+
|
|
6
|
+
Installing this package pulls the binary for your OS/arch via an optional
|
|
7
|
+
`@letary/chisel-<platform>` dependency (the same per-platform mechanism esbuild uses), so there's no
|
|
8
|
+
postinstall download.
|
|
9
|
+
|
|
10
|
+
```js
|
|
11
|
+
const { binaryPath } = require("@letary/chisel")
|
|
12
|
+
const bin = binaryPath() // absolute path to the chisel binary, or null if this platform isn't supported
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The binary speaks JSON over stdio — see the main repo for the input/output contract.
|
package/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Resolves the chisel binary for the current platform. The binary ships in one of the optional
|
|
2
|
+
// `@<scope>/chisel-<platform>` packages (esbuild-style: each has `os`/`cpu` filters, so npm installs
|
|
3
|
+
// only the matching one). Returns the absolute path, or null if no package matches this platform.
|
|
4
|
+
const { join, dirname } = require("node:path")
|
|
5
|
+
const { existsSync } = require("node:fs")
|
|
6
|
+
|
|
7
|
+
const SCOPE = "@letary" // keep in sync with scripts/npm-publish.mjs
|
|
8
|
+
|
|
9
|
+
/** Absolute path to the chisel binary for this platform, or null if unsupported / not installed. */
|
|
10
|
+
function binaryPath() {
|
|
11
|
+
const key = `${process.platform}-${process.arch}` // e.g. "darwin-arm64", "linux-x64", "win32-x64"
|
|
12
|
+
const bin = process.platform === "win32" ? "chisel.exe" : "chisel"
|
|
13
|
+
try {
|
|
14
|
+
const pkgDir = dirname(require.resolve(`${SCOPE}/chisel-${key}/package.json`))
|
|
15
|
+
const p = join(pkgDir, bin)
|
|
16
|
+
return existsSync(p) ? p : null
|
|
17
|
+
} catch {
|
|
18
|
+
return null
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
module.exports = { binaryPath }
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@letary/chisel",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Method-granular bundler with math fusion (Rust/SWC) — resolves the platform binary.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/letary/chisel.git"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"main": "index.js",
|
|
11
|
+
"files": [
|
|
12
|
+
"index.js"
|
|
13
|
+
],
|
|
14
|
+
"optionalDependencies": {
|
|
15
|
+
"@letary/chisel-darwin-arm64": "0.1.2",
|
|
16
|
+
"@letary/chisel-darwin-x64": "0.1.2",
|
|
17
|
+
"@letary/chisel-linux-x64": "0.1.2",
|
|
18
|
+
"@letary/chisel-linux-arm64": "0.1.2",
|
|
19
|
+
"@letary/chisel-win32-x64": "0.1.2"
|
|
20
|
+
}
|
|
21
|
+
}
|