tjs-lang 0.8.4 → 0.8.6
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 +22 -0
- package/dist/index.js +66 -66
- package/dist/index.js.map +3 -3
- package/dist/src/lang/browser-from-ts.d.ts +38 -0
- package/dist/src/lang/browser.d.ts +13 -0
- package/dist/src/lang/ts-cdn-shim.d.ts +2 -0
- package/dist/tjs-browser-from-ts.js +58 -0
- package/dist/tjs-browser-from-ts.js.map +7 -0
- package/dist/tjs-browser.js +370 -0
- package/dist/tjs-browser.js.map +7 -0
- package/dist/tjs-from-ts.js +18 -18
- package/dist/tjs-from-ts.js.map +3 -3
- package/dist/tjs-lang.js +1 -1
- package/dist/tjs-lang.js.map +2 -2
- package/llms.txt +2 -0
- package/package.json +15 -1
- package/src/lang/browser-bundle.test.ts +69 -0
- package/src/lang/browser-from-ts.ts +81 -0
- package/src/lang/browser.ts +13 -0
- package/src/lang/emitters/from-ts.ts +48 -17
- package/src/lang/from-ts.test.ts +48 -0
- package/src/lang/ts-cdn-shim.ts +35 -0
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:
|