code-playpad 0.8.0 → 0.10.0

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.
Files changed (36) hide show
  1. package/README.md +71 -4
  2. package/dist/COMPILER-LICENSE-AUDIT.md +104 -0
  3. package/dist/COMPILER-NOTICES.txt +16973 -0
  4. package/dist/THIRD-PARTY-NOTICES.txt +102 -0
  5. package/dist/cdn.js +2 -2
  6. package/dist/compiler-license-manifest.json +203 -0
  7. package/dist/config-CT3H6Oum.js +6 -0
  8. package/dist/cpp-CO2abWii.js +1 -0
  9. package/dist/cpp-Cs32J8JC.js +6 -0
  10. package/dist/dist-CNOK8CHE.js +6 -0
  11. package/dist/{element-BTbopmDc.js → element-CQGYVEF7.js} +4 -4
  12. package/dist/element.js +1 -1
  13. package/dist/index.d.ts +1 -1
  14. package/dist/index.js +1 -1
  15. package/dist/{java-CAuQOfuB.js → java-8qjVCjsN.js} +1 -1
  16. package/dist/{java-p3d2UdsW.js → java-DeBiVPXO.js} +1 -1
  17. package/dist/{javascript-BgIyjzbD.js → javascript-B1tVx7AD.js} +1 -1
  18. package/dist/{javascript-BUUMtBcS.js → javascript-DLPaJJzf.js} +1 -1
  19. package/dist/{pyodide-BCtQRDyT.js → pyodide-BOoYEfX1.js} +1 -1
  20. package/dist/{pyodide-DKoE92s5.js → pyodide-C8ImkXdD.js} +1 -1
  21. package/dist/react.js +1 -1
  22. package/dist/runtime/compiler-assets.d.ts +5 -0
  23. package/dist/runtime/compiler-cache.d.ts +9 -0
  24. package/dist/runtime/config.d.ts +13 -0
  25. package/dist/runtime/cpp/assets.d.ts +6 -0
  26. package/dist/runtime/cpp/project.d.ts +9 -0
  27. package/dist/runtime/cpp/worker.d.ts +1 -0
  28. package/dist/runtime/cpp-worker.generated.d.ts +1 -0
  29. package/dist/runtime/cpp.d.ts +3 -0
  30. package/dist/runtime/worker-runtime.d.ts +1 -0
  31. package/dist/standalone.js +9 -9
  32. package/dist/types.d.ts +13 -1
  33. package/dist/{worker-runtime-C2AhIV7u.js → worker-runtime-DfYet3xy.js} +2 -2
  34. package/dist/{worker-runtime-DJs9O_oY.js → worker-runtime-sUPz1J56.js} +2 -2
  35. package/package.json +17 -5
  36. package/dist/config-D9w0xYhX.js +0 -6
package/README.md CHANGED
@@ -9,7 +9,7 @@ entirely in the reader's browser. No backend, no iframe, no sign-up.
9
9
  **[Live demo →](https://code-playpad.swengr.com)**
10
10
 
11
11
  ```html
12
- <script type="module" src="https://cdn.jsdelivr.net/npm/code-playpad@0.8.0/dist/standalone.js"></script>
12
+ <script type="module" src="https://cdn.jsdelivr.net/npm/code-playpad@0.9.0/dist/standalone.js"></script>
13
13
 
14
14
  <code-playpad height="auto">
15
15
  print("hello from a static page")
@@ -159,6 +159,21 @@ under a second. The engine stops a runaway program after 200 million steps
159
159
  the evidence behind it and every known difference from the JDK, is in
160
160
  [JAVA-COMPATIBILITY.md](https://cdn.jsdelivr.net/npm/code-playpad/JAVA-COMPATIBILITY.md), which ships in the package.
161
161
 
162
+ ## Experimental C/C++
163
+
164
+ `language="c"` (C17) and `language="cpp"` (C++20) compile and run in a worker
165
+ with a real Clang compiler, prefilled stdin and Stop. They are experimental:
166
+
167
+ - **The compiler loads on the first C/C++ Run.** It is a separate package,
168
+ [`@code-playpad/cpp-toolchain`](https://www.npmjs.com/package/@code-playpad/cpp-toolchain),
169
+ fetched from jsDelivr and checked by SHA-256. Installing `code-playpad` does not
170
+ download it. To host it yourself, call `configureCpp({ indexURL })`.
171
+ - **Lightly tested on phones.** Desktop Chromium, WebKit and Firefox pass the
172
+ browser suite. One physical phone was checked by hand; memory on phones has
173
+ not been measured.
174
+
175
+ See [setup and limits](https://github.com/stancs/code-playpad/blob/main/docs/COMPILER-RUNTIMES.md).
176
+
162
177
  ## Download size
163
178
 
164
179
  What a page downloads once a reader presses Run, with the CDN build, as
@@ -173,7 +188,8 @@ actually sent.
173
188
  | TypeScript | **227.3 KB** (0.5.2: with the 46.9 KB transform) | nothing (before 0.5.2: Sucrase from esm.sh, 72 KB) | 179.9 KB |
174
189
  | Java | **288.1 KB** (0.8.0: engine 0.39) | nothing | 216.4 KB |
175
190
  | Java, with collections | **373.1 KB** (0.8.0) | nothing | 233.2 KB |
176
- | All four | 477.5 KB (0.8.0) | Pyodide | 273.9 KB |
191
+ | C or C++ (experimental) | **187.0 KB** | the compiler, about **29.9 MB**, from the host you configure | — |
192
+ | All five | 520.0 KB | Pyodide and the C/C++ compiler | 273.9 KB |
177
193
 
178
194
  - **Every row includes a 144.5 KB shared base:** the editor (CodeMirror) and
179
195
  the widget, the same as in 0.3.0.
@@ -188,11 +204,23 @@ actually sent.
188
204
  that uses them: `java.time` 16.8 KB, `java.math` 6.7 KB,
189
205
  `Pattern`/`Matcher` 2.7 KB and `BitSet` 2.3 KB. The rows above leave
190
206
  them out.
207
+ - C/C++: 42.5 KB (the 7.9 KB runtime plus 34.6 KB of C/C++ syntax
208
+ highlighting). See the C/C++ note below.
191
209
  - The Java figures for 0.8.0 are the 0.4.0 measurements plus what the
192
210
  engine's two chunks changed by in the build's gzip sizes (engines 0.28
193
211
  to 0.39 added the collection staples, library subclasses, the tutorial
194
212
  APIs, regex, java.time, javac's error recovery and messages, packages
195
213
  and more; 0.32 moved the rarely used classes out of the library).
214
+ - **C and C++ (experimental)** were measured on 2026-10-29 as
215
+ the difference between pages with and without C/C++. Measured that day,
216
+ whole pages come out 4–8 KB larger than this table, with or without the
217
+ C/C++ code, so the C/C++ and All five rows add the measured 42.5 KB to this
218
+ table's figures. The compiler is the large part: Clang 15.2 MB, the linker 8.8 MB,
219
+ and headers and libraries 5.9 MB, gzipped as a host would typically send
220
+ them. It downloads on the first Run, from the address given to
221
+ `configureCpp` (by default, jsDelivr), and is cached after that. C and C++ share it, so a page
222
+ with both downloads it once. 0.3.0 had no C/C++, so its All five figure is
223
+ its four-language page.
196
224
  - **Java grew** from 0.3.0 because the subset did, from basic Java to most of
197
225
  what practice programs use (see the version history). The owner treats
198
226
  download size as secondary to coverage. The package's size checks still
@@ -217,7 +245,7 @@ actually sent.
217
245
  ### From a CDN — nothing to install
218
246
 
219
247
  ```html
220
- <script type="module" src="https://cdn.jsdelivr.net/npm/code-playpad@0.8.0/dist/standalone.js"></script>
248
+ <script type="module" src="https://cdn.jsdelivr.net/npm/code-playpad@0.9.0/dist/standalone.js"></script>
221
249
  ```
222
250
 
223
251
  This is the `standalone` build: CodeMirror is bundled in, so a static blog post
@@ -848,6 +876,39 @@ warms every other page on the site.
848
876
 
849
877
  ## Version history
850
878
 
879
+ ### 0.10.0
880
+
881
+ C and C++ now work with no setup. Nothing else changed.
882
+
883
+ - **The compiler has its own package,** `@code-playpad/cpp-toolchain`, loaded from
884
+ jsDelivr on the first C/C++ Run and checked by SHA-256. Installing `code-playpad`
885
+ doesn't download it.
886
+ - **`configureCpp({ indexURL })` is now optional,** and only needed to host the
887
+ compiler yourself.
888
+ - **The demo site** has a C/C++ page.
889
+
890
+ ### 0.9.0
891
+
892
+ Adds experimental C and C++. Nothing else changed: Python, JavaScript,
893
+ TypeScript and Java behave as in 0.8.0, and existing pages grow by about
894
+ 0.5 KB.
895
+
896
+ - **`language="c"` and `language="cpp"`** (C17 and C++20) compile with Clang 20
897
+ and link with LLD, compiled to WebAssembly, in a worker. Multiple files,
898
+ prefilled stdin, Stop, a wall-clock limit and streamed output all work.
899
+ Programs get stdin, stdout and stderr only; exceptions and threads are not
900
+ supported, and live interactive stdin is not implemented.
901
+ - **`configureCpp({ indexURL })` is required.** The compiler (about 29.9 MB
902
+ gzipped) is not in this package and has no hosted copy yet, so you build and
903
+ host it yourself. Its files are checked by SHA-256 and cached after the first
904
+ Run. Without the setting, Run explains what is missing and downloads nothing.
905
+ - **Tested on desktop only:** Chromium, WebKit and Firefox. Physical iPhone and
906
+ Android runs have not been done.
907
+ - **`RunOptions`** gains `onProgress` and `timeoutMs`, and `Result` gains
908
+ `memory`.
909
+ - **New optional peer dependency:** `@codemirror/lang-cpp`, for highlighting
910
+ with a bundler.
911
+
851
912
  ### 0.8.0
852
913
 
853
914
  Java engine 0.34.1 → 0.39.0, each change checked against JDK 25. Nothing
@@ -883,7 +944,7 @@ class of that folder's package, as on the JDK.
883
944
  first loads, as the JDK's launcher does, so its errors appear at that
884
945
  point in the run.
885
946
 
886
- Markup and API written against 0.1.3 still work on 0.8.0, with one exception, in
947
+ Markup and API written against 0.1.3 still work on 0.9.0, with one exception, in
887
948
  0.5.1: an `entry` that names none of a widget's files is now an error.
888
949
 
889
950
  ### 0.7.0
@@ -1183,6 +1244,12 @@ their own MIT licences, reproduced in full in `dist/THIRD-PARTY-NOTICES.txt`.
1183
1244
  Pyodide (MPL-2.0) is fetched from a CDN at runtime and is not redistributed by
1184
1245
  this package.
1185
1246
 
1247
+ Experimental C/C++ downloads separate compiler assets with additional
1248
+ third-party terms; those assets are not MIT-only. Their notices ship in
1249
+ `dist/COMPILER-NOTICES.txt`. The pinned C/C++ rebuild passes its scoped license
1250
+ inventory gate; see the [compiler license audit](docs/COMPILER-LICENSE-AUDIT.md)
1251
+ and [rebuild and remaining gates](docs/CPP-REBUILD.md).
1252
+
1186
1253
  The Java engine is original code under the same MIT licence. Java is a trademark
1187
1254
  of Oracle and/or its affiliates; code-playpad is not affiliated with, endorsed
1188
1255
  by, or certified by Oracle, and its Java support is a documented subset, not a
@@ -0,0 +1,104 @@
1
+ # Compiler license audit — 2026-10-27
2
+
3
+ **Disposition: the project's own code remains MIT. The license inventory gate
4
+ passes for the pinned rebuilt C/C++ artifact set and its notice companions.**
5
+ The owner approved releasing this C/C++ set on 2026-10-30. The old browsercc
6
+ binary set is superseded, not retroactively cleared. See [CPP-REBUILD.md](CPP-REBUILD.md)
7
+ for exact scope, build evidence and remaining non-license release gates.
8
+
9
+
10
+ ## What is cleared and what was added
11
+
12
+ The bundled integration uses `@bjorn3/browser_wasi_shim` 0.4.2 under its MIT option
13
+ and adapts the MIT Weblings worker protocol/sysroot format at
14
+ `d0cd7a9f3af7d8249b3948ac0e19d2afc0d01633`. Their full notices already reside in
15
+ `dist/THIRD-PARTY-NOTICES.txt`; the distribution check now verifies both the names
16
+ and complete text. The CodeMirror C++ grammar retains its MIT notice too.
17
+ The project's LICENSE is unchanged. No compiler binaries are committed or packed.
18
+
19
+ Added a separate `third-party/compiler/manifest.json` and source notice corpus.
20
+ Each snapshot records its immutable source URL and SHA-256. The build emits
21
+ `dist/COMPILER-NOTICES.txt`, this audit, and `compiler-license-manifest.json` so
22
+ npm consumers receive the findings and available external notices. The local
23
+ asset-preparation script also copies these companions beside each toolchain.
24
+ The rebuilt C/C++ additions resolve its scoped inventory gaps.
25
+
26
+ `npm run check:compiler-licenses` verifies notice hashes. Adding `-- --release`
27
+ fails unless the owner has set `releaseApproved`. Use `-- --release --toolchain=cpp`
28
+ for the rebuilt C/C++ license gate, which passes. This is an explicit
29
+ compiler release gate, not a claim that a normal build is approved for release.
30
+
31
+ ## Historical browsercc C/C++ findings (superseded by the pinned rebuild)
32
+
33
+ The reviewed npm archive is browsercc 0.1.1, source
34
+ `86168bacf0fe7c662e3e65a2e3006ceb159cd0dc`; exact asset hashes are recorded in
35
+ `src/runtime/cpp/assets.ts` and the audit manifest. The wrapper's MIT LICENSE
36
+ has no explicit copyright-holder line; it is preserved verbatim. Package metadata
37
+ names Daniel Bertalan as author; no invented copyright line was added.
38
+
39
+ The recipe builds Clang/LLD from LLVM 20.1.2 (`58df0ef89dd64126512e4ee27b4ac3fd8ddf6247`).
40
+ It obtains libc++, libc++abi and compiler builtins from WASI SDK 25's LLVM revision
41
+ `ab4b5a2db582958af1ee308a790cfdb42bd24720`, and wasi-libc revision
42
+ `574b88da481569b65a237cb80daf9a2d5aeaf82d`. These are distinct LLVM inputs.
43
+ Their primary license texts are retained, including LLVM exceptions and legacy
44
+ NCSA terms. wasi-libc's umbrella references Apache/LLVM, Apache, MIT, cloudlibc
45
+ BSD-2-Clause, musl MIT, musl-fts BSD-3-Clause and allocator notices; these referenced
46
+ texts and allocator attribution headers are included.
47
+
48
+ The recipe explicitly removes sysroot `share/` and VERSION (share/ was later
49
+ confirmed to contain symbol/configuration data, not a standalone license bundle),
50
+ and the distributed
51
+ sysroot contains no standalone license/copyright files. It also selects Emscripten
52
+ `latest`, with no immutable SDK revision or complete linked-host-library list.
53
+ The compiler Wasm files contain no producer/custom metadata that resolves that
54
+ version. Root LLVM notices explicitly defer to component/file-level third-party
55
+ terms; copying only the root license is not a complete compiler notice bundle.
56
+
57
+ **Historical C/C++ blockers (resolved by replacement):** obtain upstream provenance plus a complete notice/SBOM bundle,
58
+ or rebuild from pinned LLVM, Emscripten and WASI inputs while preserving notices.
59
+ Account for Emscripten glue, linked libc/libc++/allocator code, and LLVM's included
60
+ third-party code. Compare any replacement hashes and rerun browser/size tests.
61
+ The current CDN pointer does not make the missing attribution irrelevant.
62
+
63
+ ## Rust (removed 2026-10-29)
64
+
65
+ An experimental Rust runtime was removed before release. Its compiler came
66
+ from a fork whose custom backend commits carry no license of their own, so no
67
+ license review could clear it. The owner chose not to seek one; any future Rust
68
+ runtime would replace those commits with project-authored code. Its audit, notice
69
+ corpus and evidence remain in git history on branch `codex/c-cpp-runtime`.
70
+
71
+ ## Distribution and generated user programs
72
+
73
+ Retain upstream copyright/license texts and applicable NOTICE files; identify
74
+ modified upstream files where required by their licenses. Our separately authored
75
+ integration remains MIT. Upstream recipe modifications (sysroot rearrangement,
76
+ added bits/stdc++.h and stripped sections) are not our original authorship and need provenance in any replacement distribution.
77
+
78
+ Compiling a user's program does not by itself relicense its original source.
79
+ Linked libc/libc++ and other runtime code have their own terms. LLVM's
80
+ exception is relevant to embedded object code, not a blanket exemption for
81
+ redistributing the compiler, unrelated libraries or all generated programs.
82
+ Don't tell downstream users that every output is automatically MIT or obligation-free.
83
+
84
+ ## Release checklist / owner actions
85
+
86
+ 1. Keep C/C++ scoped to the rebuilt, verified hashes and notice companions.
87
+ 2. Publish complete, immutable compiler distributions with companion notices;
88
+ test the actual CDN compression, CORS and notice URLs. Current transfers are
89
+ measured with a local gzip mirror, not verified production hosting.
90
+ 3. Complete physical iPhone Safari and Android Chrome memory/lifecycle/cache
91
+ testing. Desktop Chromium, WebKit and Firefox pass 22 checks each.
92
+ 4. Run the packed React/bundler/CSP checks, and decide interactive-input scope.
93
+ See compiler-validation.md for the detailed non-license gates.
94
+
95
+ Sources: immutable URLs for every retained text are in the manifest; the build
96
+ recipe is [browsercc](https://github.com/BertalanD/browsercc/blob/86168bacf0fe7c662e3e65a2e3006ceb159cd0dc/build.sh),
97
+ superseded by the pinned rebuild in `toolchains/cpp/`.
98
+
99
+ Validation: notice hashes, 77 tests, typecheck, build and distribution checks pass.
100
+ The npm dry-run (2026-10-29, after Rust's removal) contains all three audit
101
+ companions (932,733 bytes compressed, 77 files). Local asset preparation copies
102
+ them beside the toolchain. The combined release check fails until the owner
103
+ approves release; the rebuilt C/C++ check passes; successful packaging is not
104
+ release clearance.