merlionjs 0.2.2__tar.gz

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.
@@ -0,0 +1,65 @@
1
+ Metadata-Version: 2.4
2
+ Name: merlionjs
3
+ Version: 0.2.2
4
+ Summary: Next.js-style web framework in Zig — zero Node.js required
5
+ Author-email: Rach Pradhan <rach@pradhan.io>
6
+ License: MIT
7
+ Project-URL: Homepage, https://merlionjs.com
8
+ Project-URL: Documentation, https://merlionjs.com/docs
9
+ Project-URL: Repository, https://github.com/justrach/merjs
10
+ Project-URL: Issues, https://github.com/justrach/merjs/issues
11
+ Keywords: zig,web-framework,ssr,full-stack,edge,cloudflare-workers,wasm
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: MacOS
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Operating System :: Microsoft :: Windows
18
+ Classifier: Programming Language :: Zig
19
+ Classifier: Topic :: Internet :: WWW/HTTP
20
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
21
+ Requires-Python: >=3.8
22
+ Description-Content-Type: text/markdown
23
+
24
+ # merjs
25
+
26
+ Next.js-style web framework in Zig — zero Node.js required.
27
+
28
+ ## Installation
29
+
30
+ ```bash
31
+ pip install merjs
32
+ ```
33
+
34
+ ## Usage
35
+
36
+ ```bash
37
+ # Create new project
38
+ mer init my-app
39
+ cd my-app
40
+
41
+ # Start dev server
42
+ zig build serve
43
+
44
+ # Build for production
45
+ zig build prod
46
+ ```
47
+
48
+ ## Requirements
49
+
50
+ - Zig 0.15.1+
51
+ - Python 3.8+ (for this installer only)
52
+
53
+ ## Platform Support
54
+
55
+ - macOS (Intel & Apple Silicon)
56
+ - Linux (x64 & ARM64)
57
+ - Windows (x64)
58
+
59
+ ## Documentation
60
+
61
+ Visit [merlionjs.com](https://merlionjs.com) for full documentation.
62
+
63
+ ## License
64
+
65
+ MIT
@@ -0,0 +1,42 @@
1
+ # merjs
2
+
3
+ Next.js-style web framework in Zig — zero Node.js required.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install merjs
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```bash
14
+ # Create new project
15
+ mer init my-app
16
+ cd my-app
17
+
18
+ # Start dev server
19
+ zig build serve
20
+
21
+ # Build for production
22
+ zig build prod
23
+ ```
24
+
25
+ ## Requirements
26
+
27
+ - Zig 0.15.1+
28
+ - Python 3.8+ (for this installer only)
29
+
30
+ ## Platform Support
31
+
32
+ - macOS (Intel & Apple Silicon)
33
+ - Linux (x64 & ARM64)
34
+ - Windows (x64)
35
+
36
+ ## Documentation
37
+
38
+ Visit [merlionjs.com](https://merlionjs.com) for full documentation.
39
+
40
+ ## License
41
+
42
+ MIT
@@ -0,0 +1,42 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "merlionjs"
7
+ version = "0.2.2"
8
+ description = "Next.js-style web framework in Zig — zero Node.js required"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ authors = [
12
+ {name = "Rach Pradhan", email = "rach@pradhan.io"}
13
+ ]
14
+ keywords = ["zig", "web-framework", "ssr", "full-stack", "edge", "cloudflare-workers", "wasm"]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Intended Audience :: Developers",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Operating System :: MacOS",
20
+ "Operating System :: POSIX :: Linux",
21
+ "Operating System :: Microsoft :: Windows",
22
+ "Programming Language :: Zig",
23
+ "Topic :: Internet :: WWW/HTTP",
24
+ "Topic :: Software Development :: Libraries :: Application Frameworks",
25
+ ]
26
+ requires-python = ">=3.8"
27
+
28
+ [project.urls]
29
+ Homepage = "https://merlionjs.com"
30
+ Documentation = "https://merlionjs.com/docs"
31
+ Repository = "https://github.com/justrach/merjs"
32
+ Issues = "https://github.com/justrach/merjs/issues"
33
+
34
+ [project.scripts]
35
+ mer = "merjs.cli:main"
36
+ merjs = "merjs.cli:main"
37
+
38
+ [tool.setuptools.packages.find]
39
+ where = ["src"]
40
+
41
+ [tool.setuptools.package-data]
42
+ merjs = ["bin/*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,33 @@
1
+ """
2
+ Setup script for merjs - downloads binary during install
3
+ """
4
+
5
+ from setuptools import setup, find_packages
6
+ from setuptools.command.install import install
7
+ import subprocess
8
+ import sys
9
+
10
+
11
+ class InstallCommand(install):
12
+ """Custom install command that downloads the mer binary."""
13
+
14
+ def run(self):
15
+ # Run standard install first
16
+ install.run(self)
17
+
18
+ # Download the binary
19
+ try:
20
+ from merjs.install import main as install_binary
21
+ install_binary()
22
+ except Exception as e:
23
+ print(f"Warning: Failed to download mer binary: {e}", file=sys.stderr)
24
+ print("You can manually download it from https://github.com/justrach/merjs/releases", file=sys.stderr)
25
+
26
+
27
+ setup(
28
+ cmdclass={
29
+ 'install': InstallCommand,
30
+ },
31
+ packages=find_packages(where="src"),
32
+ package_dir={"": "src"},
33
+ )
@@ -0,0 +1,59 @@
1
+ """
2
+ merlionjs - Next.js-style web framework in Zig
3
+
4
+ This package provides the `mer` CLI tool. The actual binary is downloaded
5
+ during installation.
6
+ """
7
+
8
+ __version__ = "0.2.2"
9
+ __all__ = ["get_binary_path", "binary_exists"]
10
+
11
+ import os
12
+ import platform
13
+ from pathlib import Path
14
+
15
+
16
+ def get_binary_path() -> Path:
17
+ """Return the path to the mer binary."""
18
+ system = platform.system().lower()
19
+ machine = platform.machine().lower()
20
+
21
+ # Normalize platform names
22
+ if system == "darwin":
23
+ platform_name = "macos"
24
+ elif system == "linux":
25
+ platform_name = "linux"
26
+ elif system == "windows":
27
+ platform_name = "windows"
28
+ else:
29
+ raise RuntimeError(f"Unsupported platform: {system}")
30
+
31
+ # Normalize architecture names
32
+ if machine in ("x86_64", "amd64", "x64"):
33
+ arch = "x86_64"
34
+ elif machine in ("arm64", "aarch64"):
35
+ arch = "aarch64"
36
+ else:
37
+ raise RuntimeError(f"Unsupported architecture: {machine}")
38
+
39
+ bin_name = "mer.exe" if platform_name == "windows" else "mer"
40
+
41
+ # Look for binary in package directory
42
+ package_dir = Path(__file__).parent
43
+ bin_path = package_dir / "bin" / bin_name
44
+
45
+ if not bin_path.exists():
46
+ raise RuntimeError(
47
+ f"Binary not found at {bin_path}. "
48
+ "Try reinstalling: pip install --force-reinstall merlionjs"
49
+ )
50
+
51
+ return bin_path
52
+
53
+
54
+ def binary_exists() -> bool:
55
+ """Check if the mer binary is installed."""
56
+ try:
57
+ return get_binary_path().exists()
58
+ except RuntimeError:
59
+ return False
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ CLI wrapper for the mer binary
4
+ """
5
+
6
+ import sys
7
+ import subprocess
8
+ import os
9
+ from . import get_binary_path
10
+
11
+
12
+ def main():
13
+ """Run the mer binary with passed arguments."""
14
+ try:
15
+ bin_path = get_binary_path()
16
+ except RuntimeError as e:
17
+ print(f"merjs error: {e}", file=sys.stderr)
18
+ sys.exit(1)
19
+
20
+ # Pass through all arguments and environment
21
+ result = subprocess.run(
22
+ [str(bin_path)] + sys.argv[1:],
23
+ env=os.environ,
24
+ cwd=os.getcwd()
25
+ )
26
+ sys.exit(result.returncode)
27
+
28
+
29
+ if __name__ == "__main__":
30
+ main()
@@ -0,0 +1,134 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Post-install script to download the mer binary
4
+ """
5
+
6
+ import os
7
+ import platform
8
+ import urllib.request
9
+ import urllib.error
10
+ import hashlib
11
+ import sys
12
+ from pathlib import Path
13
+
14
+ REPO = os.environ.get("MER_INSTALL_REPO", "justrach/merjs")
15
+ VERSION = os.environ.get("MER_INSTALL_VERSION", "0.2.2")
16
+
17
+
18
+ def get_platform():
19
+ """Get normalized platform and architecture."""
20
+ system = platform.system().lower()
21
+ machine = platform.machine().lower()
22
+
23
+ platform_map = {
24
+ "darwin": "macos",
25
+ "linux": "linux",
26
+ "windows": "windows"
27
+ }
28
+
29
+ arch_map = {
30
+ "x86_64": "x86_64",
31
+ "amd64": "x86_64",
32
+ "x64": "x86_64",
33
+ "arm64": "aarch64",
34
+ "aarch64": "aarch64"
35
+ }
36
+
37
+ p = platform_map.get(system)
38
+ a = arch_map.get(machine)
39
+
40
+ if not p or not a:
41
+ raise RuntimeError(
42
+ f"Unsupported platform: {system} {machine}. "
43
+ "merjs supports macOS/Linux/Windows on x64/arm64."
44
+ )
45
+
46
+ return p, a
47
+
48
+
49
+ def download(url: str, dest: Path):
50
+ """Download file from URL to destination."""
51
+ print(f"merjs: downloading from {url}...")
52
+ try:
53
+ urllib.request.urlretrieve(url, dest)
54
+ except urllib.error.HTTPError as e:
55
+ raise RuntimeError(f"Download failed: HTTP {e.code}")
56
+ except Exception as e:
57
+ raise RuntimeError(f"Download failed: {e}")
58
+
59
+
60
+ def verify_checksum(bin_path: Path, checksums_url: str, asset_name: str):
61
+ """Verify SHA256 checksum of downloaded binary."""
62
+ try:
63
+ with urllib.request.urlopen(checksums_url) as response:
64
+ checksums = response.read().decode('utf-8')
65
+
66
+ expected_hash = None
67
+ for line in checksums.split('\n'):
68
+ if asset_name in line:
69
+ expected_hash = line.split()[0]
70
+ break
71
+
72
+ if not expected_hash:
73
+ print("merjs: checksum not found, skipping verification")
74
+ return
75
+
76
+ actual_hash = hashlib.sha256(bin_path.read_bytes()).hexdigest()
77
+
78
+ if expected_hash != actual_hash:
79
+ raise RuntimeError(
80
+ f"Checksum mismatch: expected {expected_hash}, got {actual_hash}"
81
+ )
82
+ print("merjs: checksum verified")
83
+ except Exception as e:
84
+ print(f"merjs: checksum verification skipped: {e}")
85
+
86
+
87
+ def main():
88
+ """Download and install the mer binary."""
89
+ platform_name, arch = get_platform()
90
+ asset_name = f"mer-{platform_name}-{arch}"
91
+ bin_name = "mer.exe" if platform_name == "windows" else "mer"
92
+
93
+ # Get package directory
94
+ package_dir = Path(__file__).parent
95
+ bin_dir = package_dir / "bin"
96
+ bin_path = bin_dir / bin_name
97
+
98
+ # Create bin directory
99
+ bin_dir.mkdir(parents=True, exist_ok=True)
100
+
101
+ # Check if already exists
102
+ if bin_path.exists():
103
+ print("merjs: binary already exists, skipping download")
104
+ return
105
+
106
+ # Build download URLs
107
+ base_url = f"https://github.com/{REPO}/releases"
108
+ if VERSION == "latest" or not VERSION[0].isdigit():
109
+ download_url = f"{base_url}/latest/download/{asset_name}"
110
+ checksums_url = f"{base_url}/latest/download/checksums.txt"
111
+ else:
112
+ download_url = f"{base_url}/download/v{VERSION}/{asset_name}"
113
+ checksums_url = f"{base_url}/download/v{VERSION}/checksums.txt"
114
+
115
+ try:
116
+ download(download_url, bin_path)
117
+ verify_checksum(bin_path, checksums_url, asset_name)
118
+
119
+ # Make executable on Unix
120
+ if platform_name != "windows":
121
+ bin_path.chmod(0o755)
122
+
123
+ print(f"merjs: installed to {bin_path}")
124
+ print("merjs: run `mer init my-app` to get started")
125
+ except Exception as e:
126
+ print(f"merjs: install failed: {e}", file=sys.stderr)
127
+ # Clean up partial download
128
+ if bin_path.exists():
129
+ bin_path.unlink()
130
+ sys.exit(1)
131
+
132
+
133
+ if __name__ == "__main__":
134
+ main()
@@ -0,0 +1,65 @@
1
+ Metadata-Version: 2.4
2
+ Name: merlionjs
3
+ Version: 0.2.2
4
+ Summary: Next.js-style web framework in Zig — zero Node.js required
5
+ Author-email: Rach Pradhan <rach@pradhan.io>
6
+ License: MIT
7
+ Project-URL: Homepage, https://merlionjs.com
8
+ Project-URL: Documentation, https://merlionjs.com/docs
9
+ Project-URL: Repository, https://github.com/justrach/merjs
10
+ Project-URL: Issues, https://github.com/justrach/merjs/issues
11
+ Keywords: zig,web-framework,ssr,full-stack,edge,cloudflare-workers,wasm
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: MacOS
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Operating System :: Microsoft :: Windows
18
+ Classifier: Programming Language :: Zig
19
+ Classifier: Topic :: Internet :: WWW/HTTP
20
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
21
+ Requires-Python: >=3.8
22
+ Description-Content-Type: text/markdown
23
+
24
+ # merjs
25
+
26
+ Next.js-style web framework in Zig — zero Node.js required.
27
+
28
+ ## Installation
29
+
30
+ ```bash
31
+ pip install merjs
32
+ ```
33
+
34
+ ## Usage
35
+
36
+ ```bash
37
+ # Create new project
38
+ mer init my-app
39
+ cd my-app
40
+
41
+ # Start dev server
42
+ zig build serve
43
+
44
+ # Build for production
45
+ zig build prod
46
+ ```
47
+
48
+ ## Requirements
49
+
50
+ - Zig 0.15.1+
51
+ - Python 3.8+ (for this installer only)
52
+
53
+ ## Platform Support
54
+
55
+ - macOS (Intel & Apple Silicon)
56
+ - Linux (x64 & ARM64)
57
+ - Windows (x64)
58
+
59
+ ## Documentation
60
+
61
+ Visit [merlionjs.com](https://merlionjs.com) for full documentation.
62
+
63
+ ## License
64
+
65
+ MIT
@@ -0,0 +1,11 @@
1
+ README.md
2
+ pyproject.toml
3
+ setup.py
4
+ src/merjs/__init__.py
5
+ src/merjs/cli.py
6
+ src/merjs/install.py
7
+ src/merlionjs.egg-info/PKG-INFO
8
+ src/merlionjs.egg-info/SOURCES.txt
9
+ src/merlionjs.egg-info/dependency_links.txt
10
+ src/merlionjs.egg-info/entry_points.txt
11
+ src/merlionjs.egg-info/top_level.txt
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ mer = merjs.cli:main
3
+ merjs = merjs.cli:main