@reventlessdev/reventless-ppx 1.0.0-alpha.114 → 1.0.0-alpha.116
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 +29 -3
- package/package.json +3 -3
package/bin
CHANGED
|
@@ -15,7 +15,23 @@
|
|
|
15
15
|
#
|
|
16
16
|
# Windows is served via WSL2 (which presents as Linux-x86_64); there is no native
|
|
17
17
|
# Windows binary.
|
|
18
|
-
|
|
18
|
+
# The real directory, not the path a link gave: under pnpm this package is a link into the
|
|
19
|
+
# store, where the per-platform binary beside it is the very version it depends on. Through the
|
|
20
|
+
# link, the binary beside it is whichever one was hoisted, possibly another version's.
|
|
21
|
+
DIR="$(cd "$(dirname "$0")" && pwd -P)"
|
|
22
|
+
|
|
23
|
+
# A package.json's version, read without node.
|
|
24
|
+
version_of() {
|
|
25
|
+
sed -n 's/^[[:space:]]*"version":[[:space:]]*"\([^"]*\)".*/\1/p' "$1" 2>/dev/null | head -n 1
|
|
26
|
+
}
|
|
27
|
+
OWN="$(version_of "$DIR/package.json")"
|
|
28
|
+
|
|
29
|
+
# Whether a candidate binary is this package's version: its package.json says the same, or it is
|
|
30
|
+
# a local build, which has none. A binary of another version writes another sidecar.
|
|
31
|
+
matches_own() {
|
|
32
|
+
pkg="$(dirname "$1")/package.json"
|
|
33
|
+
[ ! -f "$pkg" ] || [ -z "$OWN" ] || [ "$(version_of "$pkg")" = "$OWN" ]
|
|
34
|
+
}
|
|
19
35
|
|
|
20
36
|
case "$(uname -s)-$(uname -m)" in
|
|
21
37
|
Linux-x86_64) PKG="linux-x64"; LOCAL="ppx-linux.exe" ;;
|
|
@@ -33,7 +49,7 @@ for CAND in \
|
|
|
33
49
|
# `-f` (exists), not `-x`: npm/pnpm normalize file modes to 0644 when installing
|
|
34
50
|
# from a published tarball (only package.json `bin` targets are guaranteed +x),
|
|
35
51
|
# 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
|
|
52
|
+
if [ -f "$CAND" ] && matches_own "$CAND"; then chmod u+x "$CAND" 2>/dev/null; exec "$CAND" "$@"; fi
|
|
37
53
|
done
|
|
38
54
|
|
|
39
55
|
# (1c) Walk up ancestor directories looking for a node_modules with the matching
|
|
@@ -43,7 +59,17 @@ ANCESTOR="$DIR"
|
|
|
43
59
|
while [ "$ANCESTOR" != "/" ] && [ -n "$ANCESTOR" ]; do
|
|
44
60
|
ANCESTOR="$(dirname "$ANCESTOR")"
|
|
45
61
|
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
|
|
62
|
+
if [ -f "$CAND" ] && matches_own "$CAND"; then chmod u+x "$CAND" 2>/dev/null; exec "$CAND" "$@"; fi
|
|
63
|
+
done
|
|
64
|
+
|
|
65
|
+
# (3) No binary of this version anywhere: one of another version, said so, rather than none.
|
|
66
|
+
for CAND in \
|
|
67
|
+
"$DIR/../reventless-ppx-$PKG/ppx.exe" \
|
|
68
|
+
"$DIR/node_modules/@reventlessdev/reventless-ppx-$PKG/ppx.exe"; do
|
|
69
|
+
if [ -f "$CAND" ]; then
|
|
70
|
+
echo "reventless-ppx: no binary of $OWN for $PKG; running $(version_of "$(dirname "$CAND")/package.json") instead." >&2
|
|
71
|
+
chmod u+x "$CAND" 2>/dev/null; exec "$CAND" "$@"
|
|
72
|
+
fi
|
|
47
73
|
done
|
|
48
74
|
|
|
49
75
|
echo "reventless-ppx: no binary found for $(uname -s)-$(uname -m)." >&2
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reventlessdev/reventless-ppx",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.116",
|
|
4
4
|
"description": "ReScript PPX to eliminate boilerplate from Reventless application code",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"files": [
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"test": "./test/run.sh"
|
|
19
19
|
},
|
|
20
20
|
"optionalDependencies": {
|
|
21
|
-
"@reventlessdev/reventless-ppx-darwin-arm64": "1.0.0-alpha.
|
|
22
|
-
"@reventlessdev/reventless-ppx-linux-x64": "1.0.0-alpha.
|
|
21
|
+
"@reventlessdev/reventless-ppx-darwin-arm64": "1.0.0-alpha.116",
|
|
22
|
+
"@reventlessdev/reventless-ppx-linux-x64": "1.0.0-alpha.116"
|
|
23
23
|
},
|
|
24
24
|
"publishConfig": {
|
|
25
25
|
"registry": "https://registry.npmjs.org"
|