Skip to content

Commit 75b7a61

Browse files
authored
Merge pull request #3240 from jaseci-labs/3209-bug-fix-stripping-3rd-party-library-imports
3209 bug fix stripping 3rd party library imports
2 parents 9b57db7 + c678bb8 commit 75b7a61

30 files changed

+5787
-73
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Release jac-client to PYPI
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
release-client:
7+
name: Release
8+
runs-on: ubuntu-latest
9+
defaults:
10+
run:
11+
working-directory: jac-client
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
- name: Set up Python
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: '3.12'
20+
- name: Install Poetry
21+
run: |
22+
pip install poetry
23+
- name: Build and publish package
24+
run: |
25+
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
26+
poetry build
27+
poetry publish
28+
# - run: pip install githubrelease
29+
# - run: python scripts/gh_release.py
30+
# env:
31+
# GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

.github/workflows/test-jaseci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ jobs:
5858
DATABASE_HOST: mongodb://localhost/?retryWrites=true&w=majority
5959
REDIS_HOST: redis://localhost
6060
TASK_CONSUMER_CRON_SECOND: "*"
61+
- name: Run Jac-Client tests
62+
run: |
63+
pip install -e jac-client
64+
pytest -x jac-client
6165
- name: Run littleX tests
6266
run: |
6367
pip install numpy

docs/docs/communityhub/release_notes/jac-client.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22

33
This document provides a summary of new features, improvements, and bug fixes in each version of **Jac-Client**. For details on changes that might require updates to your existing code, please refer to the [Breaking Changes](../breaking_changes.md) page.
44

5-
## jaclang 0.9.0 / jac-cloud 0.2.11 / byllm 0.4.6 / jac-client 0.1.0 (Unreleased)
5+
## jaclang 0.9.0 / jac-client 0.1.0 (Unreleased)
66

77
- **Client Bundler Plugin Support**: Extended the existing `pluggy`-based plugin architecture to support custom client bundling implementations. Two static methods were added to `JacMachineInterface` to enable client bundler plugins:
88
- `get_client_bundle_builder()`: Returns the client bundle builder instance, allowing plugins to provide custom bundler implementations
99
- `build_client_bundle()`: Builds client bundles for modules, can be overridden by plugins to use custom bundling strategies
1010

1111
- **ViteBundlerPlugin (jac-client)**: Official Vite-based bundler plugin providing production-ready JavaScript bundling with HMR, tree shaking, code splitting, TypeScript support, and asset optimization. Implements the `build_client_bundle()` hook to replace default bundling with Vite's optimized build system. Install `jac-client` library from the source and use it for automatic Vite-powered client bundle generation.
1212

13+
- **Import System Fix**: Fixed relative imports in client bundles, added support for third-party npm modules, and implemented validation for pure JavaScript file imports.
14+
15+
- **PYPI Package Release**: First stable release (v0.1.0) now available on PyPI. Install via `pip install jac-client` to get started with Vite-powered client bundling for your Jac projects.
16+
1317
## jaclang 0.8.10 / jac-cloud 0.2.10 / byllm 0.4.5 (Latest Release)
1418

1519
## jaclang 0.8.9 / jac-cloud 0.2.9 / byllm 0.4.4

jac-client/README.md

Lines changed: 91 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,111 @@
1-
Jac Client
2-
==========
1+
# Jac Client
32

4-
Lightweight plugin that adds Vite-powered client bundling to Jac programs. It provides a `ClientBundleBuilder` implementation discovered by the Jac runtime via entry-points, so you can generate optimized browser bundles from Jac client code automatically.
3+
Build full-stack web applications with Jac - one language for frontend and backend.
54

6-
Requirements
7-
------------
8-
- Python: 3.12+
9-
- Python deps: `jaclang==0.8.10` (installed transitively)
10-
- Node.js tooling available on PATH:
11-
- `node`/`npm` (or `pnpm`/`yarn` if `npx` can execute Vite)
12-
- `npx` and Vite present in your frontend project (`devDependencies`)
5+
Jac Client enables you to write React-like components, manage state, and build interactive UIs all in Jac. No need for separate frontend frameworks, HTTP clients, or complex build configurations.
6+
7+
---
8+
9+
## ✨ Features
10+
11+
- **Single Language**: Write frontend and backend in Jac
12+
- **No HTTP Client**: Use `__jacSpawn()` instead of fetch/axios
13+
- **Reactive State**: Built-in state management with `createState()`
14+
- **Component-Based**: Build reusable UI components with JSX
15+
- **Graph Database**: Built-in graph data model eliminates need for SQL/NoSQL
16+
- **Type Safety**: Type checking across frontend and backend
17+
- **Vite-Powered**: Optimized production bundles with Vite
18+
19+
---
20+
21+
## 🚀 Quick Start
1322

14-
Install
15-
-------
16-
Using pip:
23+
### Installation
1724

1825
```bash
1926
pip install jac-client
2027
```
2128

22-
Using Poetry inside a project:
29+
### Create a New App
2330

2431
```bash
25-
poetry add jac-client
32+
jac create_jac_app my-app
33+
cd my-app
34+
jac serve app.jac
2635
```
2736

37+
Visit `http://localhost:8000` to see your app!
38+
39+
---
40+
41+
## 📚 Documentation
42+
43+
For detailed guides and tutorials, see the **[docs folder](jac_client/docs/)**:
44+
45+
- **[Getting Started Guide](jac_client/docs/README.md)** - Complete beginner's guide
46+
- **[Routing](jac_client/docs/routing.md)** - Multi-page applications with `initRouter()`
47+
- **[Lifecycle Hooks](jac_client/docs/lifecycle-hooks.md)** - Using `onMount()` for initialization
48+
- **[Advanced State](jac_client/docs/advanced-state.md)** - Managing complex state
49+
- **[Imports](jac_client/docs/imports.md)** - Importing libraries, Jac files, and JavaScript modules
50+
51+
---
52+
53+
## 💡 Example
54+
55+
```jac
56+
cl {
57+
let [count, setCount] = createState({"value": 0});
58+
59+
def Counter() -> any {
60+
s = count();
61+
return <div>
62+
<h1>Count: {s.value}</h1>
63+
<button onClick={lambda -> None {
64+
setCount({"value": s.value + 1});
65+
}}>
66+
Increment
67+
</button>
68+
</div>;
69+
}
70+
71+
def jac_app() -> any {
72+
return Counter();
73+
}
74+
}
2875
```
29-
your_app/
30-
package.json # contains vite in devDependencies
31-
node_modules/
32-
static/
33-
client/
34-
js/ # Vite output will be written here
35-
your_program.jac # your Jac source
36-
```
3776

38-
How it works
39-
------------
40-
At runtime, Jac discovers the `JacClient` plugin and calls its builder:
77+
---
78+
79+
## 🔧 Requirements
80+
81+
- Python: 3.12+
82+
- Node.js: For npm and Vite
83+
- Jac Language: `jaclang` (installed automatically)
84+
85+
---
86+
87+
## 🛠️ How It Works
88+
89+
Jac Client is a plugin that:
90+
1. Compiles your `.jac` client code to JavaScript
91+
2. Bundles dependencies with Vite for optimal performance
92+
3. Provides a runtime for reactive state and components
93+
4. Integrates seamlessly with Jac's backend graph operations
94+
95+
---
96+
97+
## 📖 Learn More
4198

42-
- `jac_client.plugin.client.JacClient.get_client_bundle_builder()` returns `ViteClientBundleBuilder` configured with paths resolved from `JacMachine.base_path_dir`.
43-
- The builder compiles `.jac` client code to JS, stitches any client imports, injects an init script that registers exports with the Jac runtime, then runs Vite to produce an optimized IIFE bundle named `client.[hash].js`.
99+
- **Full Documentation**: See [docs/](jac_client/docs/) for comprehensive guides
100+
- **Examples**: Check `jac_client/examples/` for working examples
101+
- **Issues**: Report bugs on [GitHub Issues](https://github.com/Jaseci-Labs/jaseci/issues)
44102

45-
Troubleshooting
46-
---------------
47-
- npx/vite not found: ensure Node.js is installed and that `package.json` has Vite in `devDependencies` (so `npx vite` works in your app root).
48-
- Build completes but no bundle found: the builder expects Vite to emit `client.[hash].js`; check custom Vite configs or permissions in the output directory.
49-
- Output directory missing: the plugin will create the directory if needed, but verify the process has write permissions to `<base_path_dir>/static/client/js`.
103+
---
50104

51-
Contributing
52-
------------
53-
- See `jac-client/TODO.md` for improvements and `jac-client/ROADMAP.md` for direction.
54-
- PRs to enhance cross-platform path handling, dev HMR, and caching are welcome.
105+
## 📄 License
55106

56-
License
57-
-------
58-
MIT (see repository root `LICENSE`).
107+
MIT License - see [LICENSE](../LICENSE) file.
59108

109+
---
60110

111+
**Happy coding with Jac!** 🎉

jac-client/TODO.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,6 @@
5555
- ✅ Completed
5656
- ⏸️ On Hold
5757

58+
59+
60+
utility library code

0 commit comments

Comments
 (0)