@webjsdev/cli 0.10.15 → 0.10.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webjsdev/cli",
3
- "version": "0.10.15",
3
+ "version": "0.10.16",
4
4
  "type": "module",
5
5
  "description": "webjs CLI - dev, start, create, db",
6
6
  "bin": {
@@ -96,7 +96,7 @@ self-review loop.
96
96
  ## Framework rules
97
97
 
98
98
  - No build step: ES modules served directly.
99
- - **Erasable TypeScript only.** Node 24+ strips types via
99
+ - **Erasable TypeScript only.** The runtime (Node 24+ or Bun) strips types via
100
100
  `module.stripTypeScriptTypes` (whitespace replacement, byte-exact position
101
101
  preservation, no sourcemap). The scaffold's `tsconfig.json` sets
102
102
  `erasableSyntaxOnly: true`, so the TS compiler rejects `enum`, `namespace`
@@ -102,7 +102,7 @@ self-review loop.
102
102
  ## Framework rules
103
103
 
104
104
  - No build step: source files are served as ES modules
105
- - **Erasable TypeScript only.** Node 24+ strips types via `module.stripTypeScriptTypes` (whitespace replacement, byte-exact position preservation, no sourcemap). The scaffold's tsconfig.json sets `erasableSyntaxOnly: true`, so the TS compiler rejects `enum`, `namespace` with values, constructor parameter properties, legacy decorators with `emitDecoratorMetadata`, and `import = require`. Use erasable equivalents: `const X = { ... } as const` plus a derived union type instead of `enum`; explicit fields plus constructor body assignments instead of parameter properties. If `erasableSyntaxOnly` is disabled and non-erasable syntax is used, the dev server fails at strip time and returns a 500 pointing at the `no-non-erasable-typescript` lint rule. webjs is buildless end-to-end and has no bundler fallback.
105
+ - **Erasable TypeScript only.** The runtime strips types via `module.stripTypeScriptTypes` (Node's built-in, or `amaro` on Bun) (whitespace replacement, byte-exact position preservation, no sourcemap). The scaffold's tsconfig.json sets `erasableSyntaxOnly: true`, so the TS compiler rejects `enum`, `namespace` with values, constructor parameter properties, legacy decorators with `emitDecoratorMetadata`, and `import = require`. Use erasable equivalents: `const X = { ... } as const` plus a derived union type instead of `enum`; explicit fields plus constructor body assignments instead of parameter properties. If `erasableSyntaxOnly` is disabled and non-erasable syntax is used, the dev server fails at strip time and returns a 500 pointing at the `no-non-erasable-typescript` lint rule. webjs is buildless end-to-end and has no bundler fallback.
106
106
  - **Tailwind-first styling.** Tailwind utilities are the strong default for pages AND light-DOM components (the default DOM mode): layout, spacing, color (via `@theme` tokens), typography, borders, radius, shadows, interaction states. Light DOM does not scope, so utilities apply directly. The lit reflex to scope CSS (`static styles = css`) or write an inline `<style>` with semantic class names (`.hero`, `.card`) in a light-DOM component is wrong: the scoped block needs `static shadow = true`, and inline class names leak globally. When a utility bundle repeats, extract a `lib/utils/ui.ts` helper returning an `html` fragment, not a CSS class. Reserve raw CSS for the allowlist (design tokens / `@theme`, `@property` + `@keyframes`, `::-webkit-scrollbar`, `prefers-reduced-motion`, complex `color-mix()` / gradients); when unavoidable in a light-DOM component, prefix every class selector with the component tag.
107
107
  - Shadow-DOM components opt in with `static shadow = true` and use `static styles = css` for scoped CSS, not inline styles. That is the right home for scoped CSS.
108
108
  - One function per server action file (*.server.ts)
@@ -98,7 +98,7 @@ each change must include.
98
98
 
99
99
  - No build step: source files are served as ES modules. Don't introduce
100
100
  build tools or bundlers in the critical path.
101
- - **Erasable TypeScript only.** Node 24+ strips types via `module.stripTypeScriptTypes` (whitespace replacement, byte-exact position preservation, no sourcemap). The scaffold's tsconfig.json sets `erasableSyntaxOnly: true`, so the TS compiler rejects `enum`, `namespace` with values, constructor parameter properties, legacy decorators with `emitDecoratorMetadata`, and `import = require`. Use erasable equivalents: `const X = { ... } as const` plus a derived union type instead of `enum`; explicit fields plus constructor body assignments instead of parameter properties. If `erasableSyntaxOnly` is disabled and non-erasable syntax is used, the dev server fails at strip time and returns a 500 pointing at the `no-non-erasable-typescript` lint rule. webjs is buildless end-to-end and has no bundler fallback.
101
+ - **Erasable TypeScript only.** The runtime strips types via `module.stripTypeScriptTypes` (Node's built-in, or `amaro` on Bun) (whitespace replacement, byte-exact position preservation, no sourcemap). The scaffold's tsconfig.json sets `erasableSyntaxOnly: true`, so the TS compiler rejects `enum`, `namespace` with values, constructor parameter properties, legacy decorators with `emitDecoratorMetadata`, and `import = require`. Use erasable equivalents: `const X = { ... } as const` plus a derived union type instead of `enum`; explicit fields plus constructor body assignments instead of parameter properties. If `erasableSyntaxOnly` is disabled and non-erasable syntax is used, the dev server fails at strip time and returns a 500 pointing at the `no-non-erasable-typescript` lint rule. webjs is buildless end-to-end and has no bundler fallback.
102
102
  - Tagged template: html`<div>${value}</div>` with css`...` for styles.
103
103
  - **Tailwind-first styling.** Tailwind utilities are the strong default for pages AND light-DOM components (the default DOM mode): layout, spacing, color (via `@theme` tokens), typography, borders, radius, shadows, interaction states. Light DOM does not scope, so utilities apply directly. The lit reflex to scope CSS (`static styles = css\`...\``) or write an inline `<style>` with semantic class names (`.hero`, `.card`) in a light-DOM component is wrong: the scoped block needs `static shadow = true`, and inline class names leak globally. When a utility bundle repeats, extract a `lib/utils/ui.ts` helper returning an `html` fragment, not a CSS class. Reserve raw CSS for the allowlist (design tokens / `@theme`, `@property` + `@keyframes`, `::-webkit-scrollbar`, `prefers-reduced-motion`, complex `color-mix()` / gradients); when unavoidable in a light-DOM component, prefix every class selector with the component tag. Shadow-DOM components (`static shadow = true`) legitimately author `static styles = css\`...\`` for scoped CSS; don't use inline `style="..."` there.
104
104
  - Components: extend WebComponent, declare `static properties` (and `static styles` for shadow-DOM components), call `Class.register('tag-name')` at the bottom of the file. The tag name is the argument to `.register()`, not a static field.
@@ -393,6 +393,23 @@ In Docker / Railway, prefer `npm start` (or `node node_modules/.bin/npm
393
393
  start`) as the CMD over `node ... webjs.js start ...`. The npm form
394
394
  fires `prestart`; the direct binary form skips it.
395
395
 
396
+ ### Running on Bun instead of Node
397
+
398
+ webjs runs on **Node 24+ or Bun**. The same `package.json` scripts work on
399
+ either; to run under Bun, force it with `--bun` so the server executes on Bun
400
+ rather than the `webjs` bin's Node shebang:
401
+
402
+ ```sh
403
+ bun install
404
+ bun --bun run dev # or: bun --bun run start
405
+ ```
406
+
407
+ On Node the `.ts` type-stripping is the built-in `module.stripTypeScriptTypes`;
408
+ on Bun (which has no built-in) it comes from `amaro` automatically, so the same
409
+ source serves identically. SSR action-result seeding (an internal hydration
410
+ optimization) is off on Bun (it needs `module.registerHooks`), which only means
411
+ an async-render component re-fetches once on hydration, no behavior change.
412
+
396
413
  **Containerized deploy ships with the scaffold.** `Dockerfile`,
397
414
  `compose.yaml`, and `.dockerignore` are scaffolded at the app root. The
398
415
  Dockerfile pins `node:24-alpine` (the same Node major CI uses), installs
@@ -1126,10 +1143,11 @@ composition, so a nested shell ends up dropped by the HTML parser.
1126
1143
  browser-only). Never fetch initial data in `connectedCallback` /
1127
1144
  `firstUpdated`. Fetch in the page function (server) and pass it as
1128
1145
  a prop. See *Component pattern* above.
1129
- 8. **Erasable TypeScript only.** Node 24+ strips types via
1130
- `module.stripTypeScriptTypes` (whitespace replacement, byte-exact
1131
- line and column position preservation, no sourcemap shipped to the
1132
- browser). Your `tsconfig.json` sets `erasableSyntaxOnly: true`, so
1146
+ 8. **Erasable TypeScript only.** The runtime strips types at the runtime
1147
+ layer (Node 24+'s built-in `module.stripTypeScriptTypes`, or `amaro`
1148
+ on Bun, which is byte-identical), with whitespace replacement so
1149
+ line and column positions are byte-exact and no sourcemap ships to
1150
+ the browser. Your `tsconfig.json` sets `erasableSyntaxOnly: true`, so
1133
1151
  the TS compiler rejects: `enum`, `namespace` with values,
1134
1152
  constructor parameter properties, legacy decorators with
1135
1153
  `emitDecoratorMetadata`, and `import = require`. Use the erasable
@@ -1054,7 +1054,7 @@ export async function createPost(input: {
1054
1054
 
1055
1055
  <!-- OVERRIDE -->
1056
1056
  - TypeScript with explicit `.ts` extensions in imports
1057
- - **Erasable TypeScript only.** The framework strips types via Node 24+'s built-in `module.stripTypeScriptTypes` (whitespace replacement, byte-exact line + column preservation, no sourcemap shipped). Your `tsconfig.json` sets `erasableSyntaxOnly: true`, so the compiler rejects: `enum`, `namespace` with values, constructor parameter properties, legacy decorators with `emitDecoratorMetadata`, and `import = require`. Write the erasable equivalents:
1057
+ - **Erasable TypeScript only.** The runtime strips types at the runtime layer (Node 24+'s built-in `module.stripTypeScriptTypes`, or `amaro` on Bun, byte-identical) with whitespace replacement, so line + column positions are byte-exact and no sourcemap ships. Your `tsconfig.json` sets `erasableSyntaxOnly: true`, so the compiler rejects: `enum`, `namespace` with values, constructor parameter properties, legacy decorators with `emitDecoratorMetadata`, and `import = require`. Write the erasable equivalents:
1058
1058
  ```ts
1059
1059
  // Not allowed
1060
1060
  enum Color { Red, Green, Blue }
@@ -3,11 +3,14 @@
3
3
  # Works with a plain `docker build` / `docker compose up`, and is the same
4
4
  # artifact the webdeploy hosting tool (ubicloud + uncloud) builds and ships.
5
5
  #
6
- # webjs serves .ts directly via Node's built-in type-stripping, so there is
7
- # NO JavaScript build step. **Node 24+ is REQUIRED**: on older Node the runtime
8
- # falls back to esbuild, whose class-declaration transform breaks webjs's SSR
9
- # walker for multi-class component files. Do not lower this base image
10
- # below 24 (the same version the CI workflow and the framework pin).
6
+ # webjs serves .ts directly by stripping types at the runtime layer, so there is
7
+ # NO JavaScript build step (webjs is buildless end to end; there is no bundler or
8
+ # esbuild fallback). This image runs the app on **Node 24+**, where the strip is
9
+ # the built-in `module.stripTypeScriptTypes`. webjs ALSO runs on **Bun** (where
10
+ # the strip comes from `amaro` automatically), so you can swap this base for an
11
+ # `oven/bun` image and start the app with `bun --bun run start`. Do not lower the
12
+ # Node base below 24 (the floor the CI workflow and the framework pin enforce),
13
+ # since the built-in stripper and recursive fs.watch need it.
11
14
  #
12
15
  # Security headers are set by the framework, not the proxy. webjs emits
13
16
  # X-Content-Type-Options, X-Frame-Options, Referrer-Policy, and