@jseeio/jsee 0.8.0 → 0.8.2
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/CHANGELOG.md +6 -0
- package/README.md +31 -11
- package/dist/jsee.core.js +1 -1
- package/dist/jsee.full.js +1 -1
- package/dist/jsee.runtime.js +1 -1
- package/package.json +10 -7
- package/src/browser-bundle-node.js +9 -0
- package/src/cli.js +134 -17
- package/src/main.js +12 -0
- package/templates/common-outputs.js +30 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.8.1
|
|
4
|
+
### Fixes:
|
|
5
|
+
- Fix `jsee init` JavaScript templates so generated minimal and chat apps accept the default object payload in both browser and server-side execution modes.
|
|
6
|
+
- Build UMD bundles with `globalThis`, and route CommonJS `require()` for browser-bundle subpaths through a clear Node stub instead of failing with browser-global errors.
|
|
7
|
+
- Harden the exported CLI generator for `node -e` / programmatic contexts where `require.main` is not defined.
|
|
8
|
+
|
|
3
9
|
## 0.8.0
|
|
4
10
|
### Features:
|
|
5
11
|
- Full bundle: new build target `jsee.full.js` that includes Observable Plot, Three.js, and Leaflet for rich output types out of the box. The CLI and Python server auto-select `jsee.full.js` vs `jsee.core.js` based on schema output types. Build with `npm run build-full`
|
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ Smallest browser example:
|
|
|
34
34
|
<script src="https://cdn.jsdelivr.net/npm/@jseeio/jsee@latest/dist/jsee.core.js"></script>
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
Pin a version for production, for example `@jseeio/jsee@0.8.
|
|
37
|
+
Pin a version for production, for example `@jseeio/jsee@0.8.1`.
|
|
38
38
|
|
|
39
39
|
**npm CLI/dev server:**
|
|
40
40
|
|
|
@@ -117,7 +117,7 @@ Generate a standalone HTML file:
|
|
|
117
117
|
|
|
118
118
|
```bash
|
|
119
119
|
npx @jseeio/jsee schema.json -o app.html
|
|
120
|
-
npx @jseeio/jsee schema.json -o app.html --
|
|
120
|
+
npx @jseeio/jsee schema.json -o app.html --bundle # inline runtime + imports for offline use
|
|
121
121
|
```
|
|
122
122
|
|
|
123
123
|
## When JSEE Fits
|
|
@@ -152,8 +152,8 @@ JSEE turns a JSON schema into a working web app. Instead of writing HTML, event
|
|
|
152
152
|
|
|
153
153
|
1. **Schema** is loaded from a URL, DOM element, function, or JS object
|
|
154
154
|
2. **Validation** checks schema structure and logs warnings for issues
|
|
155
|
-
3. **Imports** are resolved — JS scripts are loaded in sequence, CSS files are injected as `<link>` tags. In the browser, relative paths resolve against the page URL. In `--
|
|
156
|
-
4. **Models** initialize — code is loaded from `url`, `code`, or a hidden DOM cache (`data-src` elements used by `--
|
|
155
|
+
3. **Imports** are resolved — JS scripts are loaded in sequence, CSS files are injected as `<link>` tags. In the browser, relative paths resolve against the page URL. In `--bundle` mode, the CLI checks the local filesystem first
|
|
156
|
+
4. **Models** initialize — code is loaded from `url`, `code`, or a hidden DOM cache (`data-src` elements used by `--bundle` output and `download()`)
|
|
157
157
|
5. **GUI** is created — a Vue 3 app with reactive inputs, output cards, run/stop buttons and progress bar
|
|
158
158
|
6. **URL params** are applied — query string values (`?name=value`) set matching inputs, including `alias` matches. File URL params auto-load on init
|
|
159
159
|
|
|
@@ -167,7 +167,7 @@ JSEE turns a JSON schema into a working web app. Instead of writing HTML, event
|
|
|
167
167
|
|
|
168
168
|
### Offline & bundling
|
|
169
169
|
|
|
170
|
-
- **`jsee --
|
|
170
|
+
- **`jsee --bundle`** bundles everything into a single HTML file: the JSEE runtime, model/view/render code, and all imports are stored in hidden `<script data-src="...">` elements. The result works with no network
|
|
171
171
|
- **`jsee.download(title)`** does the same at runtime — exports the current app as a self-contained HTML file
|
|
172
172
|
|
|
173
173
|
## Schema blocks
|
|
@@ -182,7 +182,7 @@ Extra blocks can be provided for further customization:
|
|
|
182
182
|
|
|
183
183
|
- `render` / `view` — visualization part (optional). Defines custom rendering code
|
|
184
184
|
- `design` — overall appearance (optional). Defines how the app looks overwriting defaults
|
|
185
|
-
- `imports` — a list of scripts and stylesheets to load before the model is initialized. CSS files (`.css` extension) are injected as `<link rel="stylesheet">` in `<head>`, JS files are loaded as scripts. In the browser, relative paths (e.g. `dist/core.js`, `./lib.js`) resolve against the page URL. With `--
|
|
185
|
+
- `imports` — a list of scripts and stylesheets to load before the model is initialized. CSS files (`.css` extension) are injected as `<link rel="stylesheet">` in `<head>`, JS files are loaded as scripts. In the browser, relative paths (e.g. `dist/core.js`, `./lib.js`) resolve against the page URL. With `--bundle`, the CLI resolves imports by checking the local filesystem first — if a file exists on disk it is bundled; otherwise it is fetched from CDN
|
|
186
186
|
|
|
187
187
|
```json
|
|
188
188
|
"imports": [
|
|
@@ -369,7 +369,24 @@ Use `columns` on inputs/outputs for dashboard-style layouts:
|
|
|
369
369
|
- `outputs` — Outputs definition. Outputs also support `alias` (string) for matching model result keys by alternative names. Per-output `columns` (number, 1-12) sets grid column span, same as inputs
|
|
370
370
|
- `name`* — Name of the output
|
|
371
371
|
- `type`* — Type. Possible types:
|
|
372
|
-
- `file` —
|
|
372
|
+
- `file` — Download-only file output. With a static schema filename, return the file body under the output name:
|
|
373
|
+
```json
|
|
374
|
+
{ "name": "report", "type": "file", "filename": "report.csv" }
|
|
375
|
+
```
|
|
376
|
+
```javascript
|
|
377
|
+
return { report: "col1,col2\n1,2\n" }
|
|
378
|
+
```
|
|
379
|
+
For dynamic filenames, formats, or MIME types, return a descriptor object matching the output name:
|
|
380
|
+
```javascript
|
|
381
|
+
return {
|
|
382
|
+
file: {
|
|
383
|
+
filename: "dataset.csv",
|
|
384
|
+
content: csvText,
|
|
385
|
+
mime: "text/csv"
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
```
|
|
389
|
+
Descriptor fields: `filename` or `name`; `content`, `value`, `data`, or `url`; optional `mime` or `contentType`.
|
|
373
390
|
- `object` — JavaScript Object
|
|
374
391
|
- `html` or `svg` — SVG element
|
|
375
392
|
- `code` — Code block
|
|
@@ -515,7 +532,7 @@ Start a dev server or generate a static HTML file from a schema.
|
|
|
515
532
|
```bash
|
|
516
533
|
jsee schema.json # dev server on port 3000
|
|
517
534
|
jsee schema.json -o app.html # generate static HTML
|
|
518
|
-
jsee schema.json -o app.html
|
|
535
|
+
jsee schema.json -o app.html --bundle # self-contained HTML with bundled runtime
|
|
519
536
|
```
|
|
520
537
|
|
|
521
538
|
### Options
|
|
@@ -527,7 +544,8 @@ jsee schema.json -o app.html -f # self-contained HTML with bundled runtime
|
|
|
527
544
|
| `-d, --description <file>` | Markdown file to include as app description |
|
|
528
545
|
| `-p, --port <number>` | Dev server port (default: `3000`) |
|
|
529
546
|
| `-v, --version <version>` | JSEE runtime version (`latest`, `dev`, or semver) |
|
|
530
|
-
| `-
|
|
547
|
+
| `-b, --bundle` | Bundle runtime + all deps into a single offline HTML |
|
|
548
|
+
| `-f, --fetch` | Backward-compatible alias for `--bundle` |
|
|
531
549
|
| `-e, --execute` | Run models server-side (auto-enabled when serving local .js models) |
|
|
532
550
|
| `--client` | Force client-side execution (disable auto server-side) |
|
|
533
551
|
| `-c, --cdn <url\|bool>` | Rewrite model URLs for CDN deployment |
|
|
@@ -535,14 +553,16 @@ jsee schema.json -o app.html -f # self-contained HTML with bundled runtime
|
|
|
535
553
|
| `--verbose` | Enable verbose logging |
|
|
536
554
|
| `--help, -h` | Show usage info |
|
|
537
555
|
|
|
538
|
-
#### `--
|
|
556
|
+
#### `--bundle`
|
|
539
557
|
|
|
540
558
|
Bundles everything into a single offline HTML: the JSEE runtime, model/view/render code, and all imports are stored in hidden `<script data-src="...">` elements. Local files are detected by checking the filesystem (so bare paths like `dist/core.js` work alongside `./relative.js`); anything not found locally is fetched from CDN.
|
|
541
559
|
|
|
560
|
+
Model dependencies and schema `imports` are separate mechanisms: local model files that use `require()` or static `import`/`export` are bundled with optional `esbuild` during `--bundle`, so npm dependencies can become part of the generated HTML; schema `imports` remain explicit browser assets loaded before the model, such as CDN globals, local helper scripts, CSS files, Plot/Three/Leaflet, or other side-effect libraries.
|
|
561
|
+
|
|
542
562
|
#### `--runtime`
|
|
543
563
|
|
|
544
564
|
Select the runtime source for generated HTML:
|
|
545
|
-
- `auto` (default): `inline` when `--
|
|
565
|
+
- `auto` (default): `inline` when `--bundle`, otherwise `cdn` for file output and `local` for dev server
|
|
546
566
|
- `local`: `http://localhost:<port>/dist/...`
|
|
547
567
|
- `cdn`: jsdelivr CDN URL
|
|
548
568
|
- `inline`: embed runtime code directly in HTML
|