@reventlessdev/reventless-ppx 1.0.0-alpha.46
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 +52 -0
- package/package.json +30 -0
package/bin
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# Resolve and exec the reventless-ppx native binary for the current platform.
|
|
3
|
+
#
|
|
4
|
+
# Resolution order:
|
|
5
|
+
# 1. The matching per-platform package @reventlessdev/reventless-ppx-<platform>
|
|
6
|
+
# (declared as an optionalDependency; npm/pnpm install only the one whose
|
|
7
|
+
# os/cpu match). Three layouts covered:
|
|
8
|
+
# a. sibling in node_modules (npm flat / pnpm hoisted, same package dir)
|
|
9
|
+
# b. nested under this package's own node_modules (pnpm strict / per-pkg)
|
|
10
|
+
# c. hoisted to an ancestor node_modules (pnpm hoisted in a workspace —
|
|
11
|
+
# the per-platform pkg lands at the *workspace root* node_modules,
|
|
12
|
+
# not at the consumer's or this package's level)
|
|
13
|
+
# 2. A locally-built or committed fallback binary in this directory — covers PPX
|
|
14
|
+
# development (`pnpm build:ppx`) and the pre-publish transition window.
|
|
15
|
+
#
|
|
16
|
+
# Windows is served via WSL2 (which presents as Linux-x86_64); there is no native
|
|
17
|
+
# Windows binary.
|
|
18
|
+
DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
19
|
+
|
|
20
|
+
case "$(uname -s)-$(uname -m)" in
|
|
21
|
+
Linux-x86_64) PKG="linux-x64"; LOCAL="ppx-linux.exe" ;;
|
|
22
|
+
Linux-aarch64) PKG="linux-arm64"; LOCAL="ppx-linux-arm.exe" ;;
|
|
23
|
+
Darwin-x86_64) PKG="darwin-x64"; LOCAL="ppx-osx-x64.exe" ;;
|
|
24
|
+
Darwin-arm64) PKG="darwin-arm64"; LOCAL="ppx-osx.exe" ;;
|
|
25
|
+
*) echo "reventless-ppx: unsupported platform $(uname -s)-$(uname -m)" >&2; exit 1 ;;
|
|
26
|
+
esac
|
|
27
|
+
|
|
28
|
+
# (1a) sibling in node_modules; (1b) nested under this package; (2) local fallback.
|
|
29
|
+
for CAND in \
|
|
30
|
+
"$DIR/../reventless-ppx-$PKG/ppx.exe" \
|
|
31
|
+
"$DIR/node_modules/@reventlessdev/reventless-ppx-$PKG/ppx.exe" \
|
|
32
|
+
"$DIR/$LOCAL"; do
|
|
33
|
+
# `-f` (exists), not `-x`: npm/pnpm normalize file modes to 0644 when installing
|
|
34
|
+
# from a published tarball (only package.json `bin` targets are guaranteed +x),
|
|
35
|
+
# so the native binary often arrives non-executable. Restore +x, then exec.
|
|
36
|
+
if [ -f "$CAND" ]; then chmod u+x "$CAND" 2>/dev/null; exec "$CAND" "$@"; fi
|
|
37
|
+
done
|
|
38
|
+
|
|
39
|
+
# (1c) Walk up ancestor directories looking for a node_modules with the matching
|
|
40
|
+
# per-platform package — covers pnpm's hoisted workspace layout, where the
|
|
41
|
+
# optionalDep lands at the workspace root rather than at this package's level.
|
|
42
|
+
ANCESTOR="$DIR"
|
|
43
|
+
while [ "$ANCESTOR" != "/" ] && [ -n "$ANCESTOR" ]; do
|
|
44
|
+
ANCESTOR="$(dirname "$ANCESTOR")"
|
|
45
|
+
CAND="$ANCESTOR/node_modules/@reventlessdev/reventless-ppx-$PKG/ppx.exe"
|
|
46
|
+
if [ -f "$CAND" ]; then chmod u+x "$CAND" 2>/dev/null; exec "$CAND" "$@"; fi
|
|
47
|
+
done
|
|
48
|
+
|
|
49
|
+
echo "reventless-ppx: no binary found for $(uname -s)-$(uname -m)." >&2
|
|
50
|
+
echo " Expected package @reventlessdev/reventless-ppx-$PKG, or a local build at $DIR/$LOCAL." >&2
|
|
51
|
+
echo " For PPX development: (cd \"$DIR/src\" && opam exec -- dune build) && cp \"$DIR/src/_build/default/bin/bin.exe\" \"$DIR/$LOCAL\"" >&2
|
|
52
|
+
exit 1
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@reventlessdev/reventless-ppx",
|
|
3
|
+
"version": "1.0.0-alpha.46",
|
|
4
|
+
"description": "ReScript PPX to eliminate boilerplate from Reventless application code",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"files": [
|
|
7
|
+
"bin"
|
|
8
|
+
],
|
|
9
|
+
"bin": {
|
|
10
|
+
"reventless-ppx": "bin"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build:ppx": "cd src && opam exec -- dune build",
|
|
14
|
+
"clean:ppx": "cd src && opam exec -- dune clean",
|
|
15
|
+
"publish:platform": "node ../../scripts/publish-ppx-local.mjs",
|
|
16
|
+
"test": "./test/run.sh"
|
|
17
|
+
},
|
|
18
|
+
"optionalDependencies": {
|
|
19
|
+
"@reventlessdev/reventless-ppx-darwin-arm64": "^1.0.0-alpha.45",
|
|
20
|
+
"@reventlessdev/reventless-ppx-linux-x64": "^1.0.0-alpha.45"
|
|
21
|
+
},
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"registry": "https://registry.npmjs.org"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/ReventlessDev/reventless-core.git",
|
|
28
|
+
"directory": "packages/reventless-ppx"
|
|
29
|
+
}
|
|
30
|
+
}
|