tjs-lang 0.8.3 → 0.8.5

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/CLAUDE.md CHANGED
@@ -147,8 +147,30 @@ import { AgentVM } from 'tjs-lang/vm' // VM only (smaller bundle)
147
147
  import { batteryAtoms } from 'tjs-lang/batteries' // LM Studio batteries
148
148
  import { dot, norm_sq } from 'tjs-lang/linalg' // SIMD linear-algebra kernels
149
149
  // Editor integrations: 'tjs-lang/editors/monaco', '/codemirror', '/ace'
150
+
151
+ // Self-contained BROWSER bundles — drop-in via import() from any CDN, no
152
+ // import-map/config (acorn + tosijs-schema inlined):
153
+ const { tjs } = await import(
154
+ 'https://cdn.jsdelivr.net/npm/tjs-lang/dist/tjs-browser.js'
155
+ )
156
+ // TS→TJS in the browser: lazy-loads the TypeScript compiler from a CDN on first call:
157
+ const { fromTS } = await import(
158
+ 'https://cdn.jsdelivr.net/npm/tjs-lang/dist/tjs-browser-from-ts.js'
159
+ )
160
+ // → exports: 'tjs-lang/browser' (TJS/AJS) and 'tjs-lang/browser/from-ts' (TS).
150
161
  ```
151
162
 
163
+ **Browser bundles + CDN reality** (build targets `tjs-browser` / `tjs-browser-from-ts`
164
+ in `scripts/build.ts`; `src/lang/browser.ts`, `browser-from-ts.ts`, `ts-cdn-shim.ts`):
165
+ the TJS/AJS bundle is fully self-contained → loads from **any** CDN (jsDelivr,
166
+ unpkg, esm.sh). The TS path lazy-loads the `typescript` compiler from a CDN on
167
+ demand (Proxy shim aliased over `from-ts`'s `typescript` import; no source change).
168
+ **Verified in a real browser: esm.sh is the ONLY CDN that reliably serves
169
+ `typescript`** (~700ms) — jsDelivr `+esm` / esm.run time out on its ~10MB CJS,
170
+ skypack is dead. So `DEFAULT_TYPESCRIPT_URL = https://esm.sh/typescript@5`,
171
+ overridable via `fromTS(src, { typescriptUrl })` or by preloading
172
+ `globalThis.__TJS_TS__`. Self-containment guarded by `src/lang/browser-bundle.test.ts`.
173
+
152
174
  ### Transpiler Chain (TS → TJS → JS)
153
175
 
154
176
  TJS supports transpiling TypeScript to JavaScript with runtime type validation. The pipeline has two distinct, independently testable steps:
@@ -314,7 +336,7 @@ Full syntax documentation is in [`CLAUDE-TJS-SYNTAX.md`](CLAUDE-TJS-SYNTAX.md).
314
336
  - **Bang access**: `x!.foo` — returns MonadicError if `x` is null/undefined, otherwise bare `x.foo`. Chains propagate: `x!.foo!.bar`.
315
337
  - **Type/Generic/FunctionPredicate**: Three declaration forms for runtime type predicates
316
338
  - **`const!`**: Compile-time immutability, zero runtime cost
317
- - **Equality**: `==`/`!=` = structural equality by default in native TJS (via `Is`/`IsNot`), `===`/`!==` = identity
339
+ - **Equality**: `==`/`!=` in native TJS (via `Eq`/`NotEq` under `TjsEquals`) are **footgun-free `===`** — they unwrap boxed primitives (`new Boolean(false) == false`) and treat `null`/`undefined` as equal, but do **NOT** coerce types (`'5' != 5`, `'' != false`) and are **NOT structural** (distinct objects/arrays are distinct: `{a:1} != {a:1}` — a real distinction, and structural `==` would be a silent O(n) hit). For deep structural comparison use the `Is`/`IsNot` function (or a type's `.Equals` hook). `===`/`!==` = strict identity.
318
340
  - **Polymorphic functions**: Multiple same-name declarations merge into arity/type dispatcher
319
341
  - **`extend` blocks**: Local class extensions without prototype pollution
320
342
  - **WASM blocks**: Inline WebAssembly compiled at transpile time, with SIMD intrinsics and `wasmBuffer()` zero-copy arrays