Commit 6428515
Add the format-trimming panel and per-format build exclusion
New panel (panels/formats.js + editor/trim.js): pick the formats you
need; applying moves decoder sources between runtime/ and trimmed/
(move, not copy, .meta travels so UUIDs survive), regenerates
codecs.ts/index.ts, records the choice in editor/build/trim.json, and
rewrites native/cc_plugin.json platforms so trimmed formats drop out
of native builds too.
Build hooks and main.js read trim.json to skip staging/copying the
~89KB animated-webp.wasm when WebP is trimmed. main.js also aligns
disk state with the saved profile on load and warns when the
extension is installed globally (shared runtime/ across projects).
WebP ships off by default, and the committed tree matches: sources
parked in trimmed/, codecs.ts without the webp entry, trim.json
webp:false, cc_plugin.json platforms:[]. Reason: its off-native
backend needs an engine that exports cc.wasm (cocos/cocos4#306) and
no stable release has that yet, so defaulting it on would ship ~113KB
nothing can load.
Cocos 3.8 treats every mounted script as a bundle entry with no
tree-shaking of unreferenced scripts, so physically moving the files
is the only way trimming actually shrinks packages; README documents
the mechanism, the WebP engine requirement, and the payload table.
Co-Authored-By: Claude Code <noreply@anthropic.com>1 parent 8483138 commit 6428515
18 files changed
Lines changed: 861 additions & 90 deletions
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| |||
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
51 | 69 | | |
52 | 70 | | |
53 | 71 | | |
| |||
70 | 88 | | |
71 | 89 | | |
72 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
73 | 101 | | |
74 | 102 | | |
75 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
0 commit comments