devmap 0.2.3__py3-none-any.whl → 0.2.5__py3-none-any.whl
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.
- devmap/__init__.py +43 -17
- devmap/_devmap.mjs +2006 -0
- {devmap-0.2.3.dist-info → devmap-0.2.5.dist-info}/METADATA +2 -2
- devmap-0.2.5.dist-info/RECORD +7 -0
- devmap-0.2.3.dist-info/RECORD +0 -6
- {devmap-0.2.3.dist-info → devmap-0.2.5.dist-info}/WHEEL +0 -0
- {devmap-0.2.3.dist-info → devmap-0.2.5.dist-info}/entry_points.txt +0 -0
- {devmap-0.2.3.dist-info → devmap-0.2.5.dist-info}/top_level.txt +0 -0
devmap/__init__.py
CHANGED
|
@@ -1,27 +1,53 @@
|
|
|
1
|
-
"""devmap —
|
|
1
|
+
"""devmap — standalone CLI shipped via PyPI.
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
This package embeds the compiled devmap app (a self-contained JavaScript bundle,
|
|
4
|
+
``_devmap.mjs``) and launches it with Node.js (or Bun) when you run ``devmap``.
|
|
5
|
+
So ``pip install devmap && devmap`` works on its own — no separate npm/bun
|
|
6
|
+
install required, as long as a JavaScript runtime is on PATH.
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Run ``devmap`` after installing either of the above. This shim just prints that
|
|
10
|
-
guidance so a stray ``pip install devmap`` does not leave the user empty-handed.
|
|
8
|
+
If you already manage devmap via ``npm i -g devmap`` / ``bun i -g devmap``,
|
|
9
|
+
that install takes precedence on PATH and is equally valid.
|
|
11
10
|
"""
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
import os
|
|
13
|
+
import shutil
|
|
14
|
+
import subprocess
|
|
15
|
+
import sys
|
|
16
|
+
|
|
17
|
+
__version__ = "0.2.5"
|
|
18
|
+
|
|
19
|
+
_BUNDLE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "_devmap.mjs")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _find_runtime() -> "str | None":
|
|
23
|
+
for name in ("node", "node.exe", "bun", "bun.exe"):
|
|
24
|
+
path = shutil.which(name)
|
|
25
|
+
if path:
|
|
26
|
+
return path
|
|
27
|
+
return None
|
|
14
28
|
|
|
15
29
|
|
|
16
30
|
def main() -> None:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
31
|
+
runtime = _find_runtime()
|
|
32
|
+
if runtime is None:
|
|
33
|
+
sys.stderr.write(
|
|
34
|
+
"devmap requires Node.js (or Bun) to run.\n"
|
|
35
|
+
"Install Node.js from https://nodejs.org (or Bun from https://bun.sh)\n"
|
|
36
|
+
"and make sure it is on your PATH, then re-run `devmap`.\n"
|
|
37
|
+
)
|
|
38
|
+
sys.exit(1)
|
|
39
|
+
if not os.path.exists(_BUNDLE):
|
|
40
|
+
sys.stderr.write(
|
|
41
|
+
f"devmap: bundled app not found at {_BUNDLE}.\n"
|
|
42
|
+
"Reinstall with `pip install --force-reinstall --no-cache-dir devmap`.\n"
|
|
43
|
+
)
|
|
44
|
+
sys.exit(1)
|
|
45
|
+
try:
|
|
46
|
+
proc = subprocess.run([runtime, _BUNDLE, *sys.argv[1:]])
|
|
47
|
+
except Exception as exc: # pragma: no cover - defensive
|
|
48
|
+
sys.stderr.write(f"devmap: failed to launch runtime `{runtime}`: {exc}\n")
|
|
49
|
+
sys.exit(1)
|
|
50
|
+
sys.exit(proc.returncode)
|
|
25
51
|
|
|
26
52
|
|
|
27
53
|
if __name__ == "__main__":
|