jsgui3-server 0.0.147 → 0.0.149
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/.github/workflows/control-scan-manifest-check.yml +31 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-071799b982906680f5fd699d.js +40 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-07352945ad5c92654fcb8b65.js +39 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-138a601fadb6191ea314c6fd.js +39 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-171f6c381c2cadf2e9fa7087.js +39 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-1d973388156b84a04373fac9.js +39 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-20e117bc8a10d2cd16234bbe.js +40 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-2b028a82b0e5efddba42425f.js +39 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-4518556cd5c7e059e82b22b8.js +40 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-5bac1aa0f213902f718ed74f.js +40 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-5f9996ac7822caf777d92f56.js +39 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-60a92c702e65fd9cf748e3ec.js +39 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-6164c1f8f738995c541895d2.js +44 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-6718a85eb9e5aa782dd47a05.js +45 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-69e280f14e37aee76a1d4675.js +39 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-7570d1b030d44b111ed59c4c.js +39 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-7798c9bbd55e510d5039f936.js +42 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-78cd511ea1ef18ecb03d1be5.js +40 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-7d482e0b95bcb5e3c543118b.js +43 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-80e9476d1127c55b40fdb36f.js +40 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-810ced55d5320a3088a05b13.js +40 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-8423565f1a40e329afc8c6cf.js +40 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-900bef783b8cee36506ec282.js +39 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-a1a37aff6416fdad74040ddf.js +39 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-ad48d5e8eda40f175b4df090.js +39 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-aec5a2d963015528c9099462.js +39 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-af9d34e0f1722fab9e28c269.js +39 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-b818e4015e2f1fe86280b5ab.js +41 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-bcb2541adc70b7aba61768c5.js +44 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-bfe89d2c78ed44f95ed7dd73.js +40 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-c06f04806a1e688e1187110c.js +40 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-c3f3adf904f585afc544b96a.js +39 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-d45acb873e1d8e32d5e60f2e.js +39 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-db06f132533706f4a0163b8c.js +39 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-f660f40d78b135fc8560a862.js +39 -0
- package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-f9dee4ec18a96e09bee06bae.js +39 -0
- package/README.md +85 -3
- package/admin-ui/client.js +213 -0
- package/admin-ui/server.js +104 -0
- package/client/controls/auto-observable.js +207 -0
- package/dev-status.svg +139 -0
- package/docs/api-reference.md +301 -43
- package/docs/books/admin-ui/01-introduction.md +32 -0
- package/docs/books/admin-ui/02-architecture.md +92 -0
- package/docs/books/admin-ui/03-controls.md +194 -0
- package/docs/books/admin-ui/04-implementation-plan.md +62 -0
- package/docs/books/admin-ui/README.md +26 -0
- package/docs/books/jsgui3-bundling-research-book/00-table-of-contents.md +35 -0
- package/docs/books/jsgui3-bundling-research-book/01-pipeline-and-runtime-semantics.md +34 -0
- package/docs/books/jsgui3-bundling-research-book/02-javascript-bundling-core.md +36 -0
- package/docs/books/jsgui3-bundling-research-book/03-style-extraction-and-css-compilation.md +35 -0
- package/docs/books/jsgui3-bundling-research-book/04-static-publishing-and-delivery.md +39 -0
- package/docs/books/jsgui3-bundling-research-book/05-current-limits-and-size-bloat-vectors.md +25 -0
- package/docs/books/jsgui3-bundling-research-book/06-unused-module-elimination-strategy.md +77 -0
- package/docs/books/jsgui3-bundling-research-book/07-jsgui3-html-control-and-mixin-pruning.md +63 -0
- package/docs/books/jsgui3-bundling-research-book/08-test-and-verification-methodology.md +43 -0
- package/docs/books/jsgui3-bundling-research-book/09-roadmap-and-rollout.md +42 -0
- package/docs/books/jsgui3-bundling-research-book/10-further-research-strategies-and-upgrades.md +211 -0
- package/docs/books/jsgui3-bundling-research-book/README.md +35 -0
- package/docs/bundling-system-deep-dive.md +9 -4
- package/docs/comprehensive-documentation.md +49 -18
- package/docs/configuration-reference.md +152 -27
- package/docs/core/README.md +19 -0
- package/docs/core/jsgui3-server-core-book/00-table-of-contents.md +21 -0
- package/docs/core/jsgui3-server-core-book/01-startup-readiness-state-machine.md +41 -0
- package/docs/core/jsgui3-server-core-book/02-resource-abstraction-and-lifecycle.md +92 -0
- package/docs/core/jsgui3-server-core-book/03-resource-pool-and-event-topology.md +47 -0
- package/docs/core/jsgui3-server-core-book/04-sse-publisher-semantics.md +41 -0
- package/docs/core/jsgui3-server-core-book/05-serve-factory-resource-wiring.md +46 -0
- package/docs/core/jsgui3-server-core-book/06-e2e-testing-methodology.md +48 -0
- package/docs/core/jsgui3-server-core-book/07-defect-detection-and-hardening-loop.md +47 -0
- package/docs/publishers-guide.md +59 -4
- package/docs/resources-guide.md +184 -35
- package/docs/simple-server-api-design.md +72 -17
- package/docs/system-architecture.md +18 -14
- package/examples/controls/15) window, observable SSE/server.js +6 -1
- package/examples/controls/19) window, auto observable ui/client.js +125 -0
- package/examples/controls/19) window, auto observable ui/server.js +73 -0
- package/examples/controls/20) window, task manager app/README.md +133 -0
- package/examples/controls/20) window, task manager app/client.js +797 -0
- package/examples/controls/20) window, task manager app/server.js +178 -0
- package/examples/controls/6) window, color_palette/client.js +165 -68
- package/examples/controls/9) window, date picker/client.js +362 -76
- package/examples/controls/9b) window, shared data.model mirrored date pickers/client.js +104 -83
- package/examples/jsgui3-html/06) theming/client.js +22 -1
- package/examples/jsgui3-html/10) binding-debugger/client.js +137 -1
- package/http/responders/static/Static_Route_HTTP_Responder.js +52 -34
- package/lab/experiments/capture-color-controls.js +196 -0
- package/lab/results/screenshots/color-controls/full_page.png +0 -0
- package/lab/results/screenshots/color-controls/section_1_color_grid_12x12.png +0 -0
- package/lab/results/screenshots/color-controls/section_2_color_grid_4x2.png +0 -0
- package/lab/results/screenshots/color-controls/section_3_color_palette.png +0 -0
- package/lab/results/screenshots/color-controls/section_4_palette_comparison.png +0 -0
- package/lab/results/screenshots/color-controls/section_5_raw_swatches.png +0 -0
- package/lab/results/screenshots/color-controls/section_6_optimized_crayola.png +0 -0
- package/lab/results/screenshots/color-controls/section_7_pastel_palette.png +0 -0
- package/lab/results/screenshots/color-controls/section_8_extended_144.png +0 -0
- package/lab/screenshot-utils.js +248 -0
- package/module.js +11 -4
- package/package.json +14 -4
- package/publishers/Publishers.js +4 -3
- package/publishers/helpers/assigners/static-compressed-response-buffers/Single_Control_Webpage_Server_Static_Compressed_Response_Buffers_Assigner.js +5 -5
- package/publishers/http-observable-publisher.js +8 -0
- package/publishers/http-sse-publisher.js +341 -0
- package/publishers/http-webpage-publisher.js +13 -3
- package/publishers/http-webpageorsite-publisher.js +18 -0
- package/resources/process-resource.js +950 -0
- package/resources/processors/bundlers/js/esbuild/Advanced_JS_Bundler_Using_ESBuild.js +164 -46
- package/resources/processors/bundlers/js/esbuild/Core_JS_Non_Minifying_Bundler_Using_ESBuild.js +18 -7
- package/resources/processors/bundlers/js/esbuild/JSGUI3_HTML_Control_Optimizer.js +829 -0
- package/resources/remote-process-resource.js +355 -0
- package/resources/server-resource-pool.js +354 -41
- package/serve-factory.js +441 -259
- package/server.js +161 -16
- package/tests/README.md +66 -4
- package/tests/admin-ui-render.test.js +24 -0
- package/tests/assigners.test.js +56 -40
- package/tests/bundling-default-control-elimination.puppeteer.test.js +260 -0
- package/tests/configuration-validation.test.js +21 -18
- package/tests/content-analysis.test.js +7 -6
- package/tests/control-optimizer-cache-behavior.test.js +52 -0
- package/tests/control-scan-manifest-regression.test.js +144 -0
- package/tests/end-to-end.test.js +15 -14
- package/tests/error-handling.test.js +222 -179
- package/tests/fixtures/bundling-default-button-client.js +37 -0
- package/tests/fixtures/bundling-default-window-client.js +34 -0
- package/tests/fixtures/control_scan_manifest_expectations.json +48 -0
- package/tests/fixtures/resource-monitor-client.js +319 -0
- package/tests/helpers/puppeteer-e2e-harness.js +317 -0
- package/tests/http-sse-publisher.test.js +136 -0
- package/tests/performance.test.js +69 -65
- package/tests/process-resource.test.js +138 -0
- package/tests/publishers.test.js +7 -7
- package/tests/remote-process-resource.test.js +160 -0
- package/tests/sass-controls.e2e.test.js +7 -1
- package/tests/serve-resources.test.js +270 -0
- package/tests/serve.test.js +120 -50
- package/tests/server-resource-pool.test.js +106 -0
- package/tests/small-controls-bundle-size.test.js +252 -0
- package/tests/test-runner.js +13 -1
- package/tests/window-examples.puppeteer.test.js +204 -1
- package/tests/window-resource-integration.puppeteer.test.js +585 -0
- package/tests/temp_invalid.js +0 -7
- package/tests/temp_invalid_utf8.js +0 -1
- package/tests/temp_malformed.js +0 -10
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# 9. Roadmap and Rollout
|
|
2
|
+
|
|
3
|
+
## Phase A: Baseline Instrumentation
|
|
4
|
+
|
|
5
|
+
- emit module graph manifest without pruning
|
|
6
|
+
- add CI artifact publishing for manifests
|
|
7
|
+
- add docs for reading retention reasons
|
|
8
|
+
|
|
9
|
+
Exit criteria:
|
|
10
|
+
- manifests generated for all target example fixtures
|
|
11
|
+
- no behavior changes
|
|
12
|
+
|
|
13
|
+
## Phase B: Safe Pruning Profile
|
|
14
|
+
|
|
15
|
+
- implement `safe` elimination profile
|
|
16
|
+
- prune only proven unreachable and side-effect-safe modules
|
|
17
|
+
- add fail-fast option for uncertain prune attempts
|
|
18
|
+
|
|
19
|
+
Exit criteria:
|
|
20
|
+
- full test suite green
|
|
21
|
+
- measurable JS size reductions on simple apps
|
|
22
|
+
- zero runtime regressions
|
|
23
|
+
|
|
24
|
+
## Phase C: jsgui3-html Symbol-Aware Pruning
|
|
25
|
+
|
|
26
|
+
- add control/mixin symbol graph pass
|
|
27
|
+
- integrate registry publication edge tracking
|
|
28
|
+
- support optional feature-group retention manifests
|
|
29
|
+
|
|
30
|
+
Exit criteria:
|
|
31
|
+
- significant size reductions for minimal-control apps
|
|
32
|
+
- controlled retention for dynamic access cases
|
|
33
|
+
|
|
34
|
+
## Phase D: Operational Hardening
|
|
35
|
+
|
|
36
|
+
- add deterministic chunk/hash strategy if route model evolves
|
|
37
|
+
- enforce size budgets in CI
|
|
38
|
+
- document migration path for package authors to declare side effects explicitly
|
|
39
|
+
|
|
40
|
+
## Non-Goal
|
|
41
|
+
|
|
42
|
+
Runtime hot-switching of elimination profiles is not required. Build-time consistency with predictable APIs is the target.
|
package/docs/books/jsgui3-bundling-research-book/10-further-research-strategies-and-upgrades.md
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
# 10. Further Research: Strategies and Upgrades
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
This chapter extends the initial roadmap with additional strategies validated against current official tooling documentation. The goal is to improve both:
|
|
6
|
+
|
|
7
|
+
- elimination quality (more dead code removed safely)
|
|
8
|
+
- operational confidence (clear reason codes and controlled risk)
|
|
9
|
+
|
|
10
|
+
## A. Strengthen Existing Esbuild-Centric Strategy
|
|
11
|
+
|
|
12
|
+
### A1. Turn Build Metadata into First-Class Artifact
|
|
13
|
+
|
|
14
|
+
Current proposal already introduces a manifest. Upgrade it to include:
|
|
15
|
+
|
|
16
|
+
- esbuild `metafile` `inputs` and `outputs` mapping
|
|
17
|
+
- importer chains for each retained module
|
|
18
|
+
- side-effect reason code (`annotation`, `package_side_effects`, `plugin_side_effects`, `unknown`)
|
|
19
|
+
- unresolved dynamic-import reason code where relevant
|
|
20
|
+
|
|
21
|
+
Why: esbuild exposes a structured metadata graph and textual analysis hooks suitable for deterministic retention explanations.
|
|
22
|
+
|
|
23
|
+
### A2. Add Plugin-Level Side-Effect Overrides (Safe Allowlist Only)
|
|
24
|
+
|
|
25
|
+
Esbuild plugin `onResolve` supports returning `sideEffects: false`. Use this only through a strict allowlist generated from audited modules, never broad regex defaults.
|
|
26
|
+
|
|
27
|
+
Why: this provides precision beyond package-level `sideEffects` fields and enables selective pruning of known-safe internal modules.
|
|
28
|
+
|
|
29
|
+
### A3. Improve Annotation Fault Tolerance
|
|
30
|
+
|
|
31
|
+
Support an explicit fallback mode for bad third-party annotations:
|
|
32
|
+
|
|
33
|
+
- default: respect annotations (`/* @__PURE__ */`, `package.json sideEffects`)
|
|
34
|
+
- safe fallback: set `ignoreAnnotations: true` for known-problem dependency subsets
|
|
35
|
+
|
|
36
|
+
Why: esbuild documents annotation misuse as a real breakage source; controlled fallback prevents production outages.
|
|
37
|
+
|
|
38
|
+
### A4. Prefer ESM Paths Where Safe
|
|
39
|
+
|
|
40
|
+
For packages that expose both CommonJS and ESM, prefer ESM paths where validated to improve tree shaking.
|
|
41
|
+
|
|
42
|
+
Why: esbuild explicitly notes tree shaking depends on ESM `import`/`export` and does not work on CommonJS modules the same way.
|
|
43
|
+
|
|
44
|
+
## B. Add Multi-Chunk Strategy (Not Just Single /js/js.js)
|
|
45
|
+
|
|
46
|
+
### B1. Optional ESM Split Build Profile
|
|
47
|
+
|
|
48
|
+
Add an optional bundler profile that emits ESM with splitting enabled (`format: 'esm'`, `splitting: true`) and chunk names with content hashes.
|
|
49
|
+
|
|
50
|
+
Use for:
|
|
51
|
+
|
|
52
|
+
- multi-page apps
|
|
53
|
+
- heavy optional controls loaded by `import()`
|
|
54
|
+
|
|
55
|
+
Do not force this profile for simple examples where a single file remains desirable.
|
|
56
|
+
|
|
57
|
+
### B2. Route and HTML Preparation Upgrade
|
|
58
|
+
|
|
59
|
+
Current static route assigner assumes one JS and one CSS file. Add a preparer mode that:
|
|
60
|
+
|
|
61
|
+
- maps every emitted JS/CSS asset to static routes
|
|
62
|
+
- injects `<script type="module">` plus chunk graph references where required
|
|
63
|
+
- supports content-hash file names for cache correctness
|
|
64
|
+
|
|
65
|
+
## C. Use Safety Ladder from Rollup Research as Policy Design Input
|
|
66
|
+
|
|
67
|
+
Even if the implementation remains esbuild-first, Rollup's treeshake policy surface is a useful design model:
|
|
68
|
+
|
|
69
|
+
- `safest`
|
|
70
|
+
- `recommended`
|
|
71
|
+
- `smallest`
|
|
72
|
+
|
|
73
|
+
Adopt equivalent policy semantics in `jsgui3-server` elimination config:
|
|
74
|
+
|
|
75
|
+
- `safe` (strict side-effect conservatism)
|
|
76
|
+
- `balanced` (some side-effect assumptions)
|
|
77
|
+
- `aggressive` (max pruning, stronger contracts)
|
|
78
|
+
|
|
79
|
+
Include explicit controls for assumptions analogous to:
|
|
80
|
+
|
|
81
|
+
- module side effects
|
|
82
|
+
- property-read side effects
|
|
83
|
+
- try/catch deoptimization behavior
|
|
84
|
+
- manually pure function sets
|
|
85
|
+
|
|
86
|
+
## D. Package Boundary Strategy for jsgui3-html
|
|
87
|
+
|
|
88
|
+
### D1. Subpath Exports for Feature Addressability
|
|
89
|
+
|
|
90
|
+
Restructure `jsgui3-html` package exports so controls and mixins have stable subpath entry points (for example, `./controls/date_picker.js`, `./mixins/draggable.js`, `./core/...`).
|
|
91
|
+
|
|
92
|
+
Why: Node package `exports` and subpath exports give explicit package contracts and allow bundlers to consume narrow entry points instead of broad index hubs.
|
|
93
|
+
|
|
94
|
+
### D2. Core vs Optional Feature Groups
|
|
95
|
+
|
|
96
|
+
Define package layers:
|
|
97
|
+
|
|
98
|
+
- `core` minimal runtime
|
|
99
|
+
- optional groups (`advanced-controls`, `diagnostics`, `themes`, etc.)
|
|
100
|
+
|
|
101
|
+
Then bind elimination policies to these boundaries for predictable pruning.
|
|
102
|
+
|
|
103
|
+
### D3. Internal Imports Field for Maintainability
|
|
104
|
+
|
|
105
|
+
Use package `imports` (private `#...` aliases) inside `jsgui3-html` to stabilize internal paths while allowing refactors that do not leak into public imports.
|
|
106
|
+
|
|
107
|
+
## E. Compression and Minification Escalation Path
|
|
108
|
+
|
|
109
|
+
### E1. Keep Esbuild as Default Minifier
|
|
110
|
+
|
|
111
|
+
Esbuild is very fast and adequate for most builds.
|
|
112
|
+
|
|
113
|
+
### E2. Optional High-Compression Pass
|
|
114
|
+
|
|
115
|
+
For release artifacts that need additional byte reduction, provide an optional second minification pass profile (e.g., Terser pure-function tuning). Keep this opt-in due to risk/perf tradeoffs.
|
|
116
|
+
|
|
117
|
+
### E3. Experimental Extreme Profile
|
|
118
|
+
|
|
119
|
+
Document (not default) an experimental path for Closure Compiler `ADVANCED_OPTIMIZATIONS` for controlled targets only, with strict compatibility guardrails.
|
|
120
|
+
|
|
121
|
+
## F. Coverage-Guided Optimization (Puppeteer + CDP)
|
|
122
|
+
|
|
123
|
+
### F1. Coverage Collection Pipeline
|
|
124
|
+
|
|
125
|
+
Use Puppeteer coverage APIs in E2E suites:
|
|
126
|
+
|
|
127
|
+
- `page.coverage.startJSCoverage(...)`
|
|
128
|
+
- `page.coverage.startCSSCoverage(...)`
|
|
129
|
+
- stop coverage and persist per-script ranges
|
|
130
|
+
|
|
131
|
+
Enable block-level coverage for high resolution.
|
|
132
|
+
|
|
133
|
+
### F2. Precise CDP Coverage for Deep Diagnostics
|
|
134
|
+
|
|
135
|
+
For targeted diagnostics, integrate CDP Profiler precise coverage APIs (`startPreciseCoverage`, `takePreciseCoverage`) in controlled runs.
|
|
136
|
+
|
|
137
|
+
### F3. Correct Interpretation Rule
|
|
138
|
+
|
|
139
|
+
Coverage is advisory, not authoritative:
|
|
140
|
+
|
|
141
|
+
- never auto-prune solely from observed runtime coverage
|
|
142
|
+
- use coverage to identify candidates for lazy loading or refactor, then validate with static safety rules
|
|
143
|
+
|
|
144
|
+
## G. Concrete Upgrades to Existing jsgui3-server Plan
|
|
145
|
+
|
|
146
|
+
### G1. New Config Surface (Proposed)
|
|
147
|
+
|
|
148
|
+
```js
|
|
149
|
+
bundler: {
|
|
150
|
+
elimination: {
|
|
151
|
+
enabled: true,
|
|
152
|
+
profile: 'safe', // safe | balanced | aggressive
|
|
153
|
+
emit_manifest: true,
|
|
154
|
+
include_importer_chains: true,
|
|
155
|
+
fail_on_uncertain_prune: true,
|
|
156
|
+
plugin_side_effect_overrides: {
|
|
157
|
+
allowlist: []
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
chunking: {
|
|
161
|
+
profile: 'single', // single | esm_split
|
|
162
|
+
chunk_names: 'chunks/[name]-[hash]'
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### G2. Manifest Enrichment (Proposed)
|
|
168
|
+
|
|
169
|
+
Add fields:
|
|
170
|
+
|
|
171
|
+
- `retained_reason_code`
|
|
172
|
+
- `side_effect_source`
|
|
173
|
+
- `importer_chain`
|
|
174
|
+
- `dynamic_access_risk`
|
|
175
|
+
- `runtime_coverage_seen` (optional diagnostic field)
|
|
176
|
+
|
|
177
|
+
### G3. Test Expansion
|
|
178
|
+
|
|
179
|
+
- policy conformance tests per profile (`safe`, `balanced`, `aggressive`)
|
|
180
|
+
- split profile routing/injection tests
|
|
181
|
+
- manifest stability snapshots
|
|
182
|
+
- Puppeteer coverage capture and diff reporting
|
|
183
|
+
|
|
184
|
+
## H. Prioritized Execution Order
|
|
185
|
+
|
|
186
|
+
1. Implement manifest enrichment on top of current esbuild flow.
|
|
187
|
+
2. Add safe plugin-side-effect allowlist mechanism.
|
|
188
|
+
3. Add ESM split profile behind feature flag.
|
|
189
|
+
4. Add package-boundary changes in `jsgui3-html` (`exports`/subpaths/core layering).
|
|
190
|
+
5. Add optional secondary minifier profile.
|
|
191
|
+
6. Integrate coverage-guided diagnostics into CI reports.
|
|
192
|
+
|
|
193
|
+
## Source Notes
|
|
194
|
+
|
|
195
|
+
External strategies in this chapter are based on current official docs for esbuild, Rollup, webpack, Node package exports/imports, Puppeteer coverage APIs, and Chrome DevTools Protocol coverage APIs.
|
|
196
|
+
|
|
197
|
+
Primary references:
|
|
198
|
+
|
|
199
|
+
- https://esbuild.github.io/api/
|
|
200
|
+
- https://esbuild.github.io/plugins/
|
|
201
|
+
- https://rollupjs.org/configuration-options/
|
|
202
|
+
- https://webpack.js.org/guides/tree-shaking/
|
|
203
|
+
- https://webpack.js.org/plugins/split-chunks-plugin/
|
|
204
|
+
- https://nodejs.org/api/packages.html
|
|
205
|
+
- https://babeljs.io/docs/babel-plugin-transform-modules-commonjs
|
|
206
|
+
- https://terser.org/docs/options/#compress-options
|
|
207
|
+
- https://developers.google.com/closure/compiler/docs/compilation_levels
|
|
208
|
+
- https://developers.google.com/closure/compiler/docs/api-tutorial3
|
|
209
|
+
- https://pptr.dev/api/puppeteer.coverage.startjscoverage
|
|
210
|
+
- https://pptr.dev/api/puppeteer.coverage.startcsscoverage
|
|
211
|
+
- https://chromedevtools.github.io/devtools-protocol/tot/Profiler/#method-startPreciseCoverage
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# JSGUI3 Bundling Research Book
|
|
2
|
+
|
|
3
|
+
This book documents how JS and CSS bundling currently works in `jsgui3-server`, then defines a practical path to remove unused modules, controls, mixins, and related code from final bundles without breaking runtime behavior.
|
|
4
|
+
|
|
5
|
+
## Scope
|
|
6
|
+
|
|
7
|
+
- Current runtime bundling semantics (implementation-first, file-path grounded)
|
|
8
|
+
- Existing optimization surface and current limits
|
|
9
|
+
- Dead-module elimination strategy for application code and `jsgui3-html`
|
|
10
|
+
- Control/mixin reachability and pruning model
|
|
11
|
+
- Verification strategy (unit, integration, e2e, and size-regression)
|
|
12
|
+
|
|
13
|
+
## Intended Readers
|
|
14
|
+
|
|
15
|
+
- Maintainers changing bundling internals
|
|
16
|
+
- Contributors adding controls or mixins to `jsgui3-html`
|
|
17
|
+
- Agents implementing bundle-size reduction work
|
|
18
|
+
|
|
19
|
+
## Reading Order
|
|
20
|
+
|
|
21
|
+
1. [00 Table of Contents](00-table-of-contents.md)
|
|
22
|
+
2. [01 Pipeline and Runtime Semantics](01-pipeline-and-runtime-semantics.md)
|
|
23
|
+
3. [02 JavaScript Bundling Core](02-javascript-bundling-core.md)
|
|
24
|
+
4. [03 Style Extraction and CSS Compilation](03-style-extraction-and-css-compilation.md)
|
|
25
|
+
5. [04 Static Publishing and Delivery](04-static-publishing-and-delivery.md)
|
|
26
|
+
6. [05 Current Limits and Size-Bloat Vectors](05-current-limits-and-size-bloat-vectors.md)
|
|
27
|
+
7. [06 Unused Module Elimination Strategy](06-unused-module-elimination-strategy.md)
|
|
28
|
+
8. [07 jsgui3-html Control and Mixin Pruning](07-jsgui3-html-control-and-mixin-pruning.md)
|
|
29
|
+
9. [08 Test and Verification Methodology](08-test-and-verification-methodology.md)
|
|
30
|
+
10. [09 Roadmap and Rollout](09-roadmap-and-rollout.md)
|
|
31
|
+
11. [10 Further Research: Strategies and Upgrades](10-further-research-strategies-and-upgrades.md)
|
|
32
|
+
|
|
33
|
+
## Status
|
|
34
|
+
|
|
35
|
+
This is a working research book. It is designed to be updated as the bundling system evolves.
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
# Bundling System Deep Dive
|
|
2
|
-
|
|
3
|
-
##
|
|
1
|
+
# Bundling System Deep Dive
|
|
2
|
+
|
|
3
|
+
## Research Track
|
|
4
|
+
|
|
5
|
+
For the active, chaptered research track on lightweight bundle strategy and unused-module elimination, use:
|
|
6
|
+
`docs/books/jsgui3-bundling-research-book/README.md`
|
|
7
|
+
|
|
8
|
+
## When to Read
|
|
4
9
|
|
|
5
10
|
This document provides detailed technical documentation of JSGUI3 Server's bundling system. Read this when:
|
|
6
11
|
- You need to understand how JavaScript and CSS bundling works internally
|
|
@@ -522,4 +527,4 @@ Key takeaways:
|
|
|
522
527
|
- **Debugging**: Use debug mode and logging for troubleshooting
|
|
523
528
|
- **Performance**: Fast for development, optimizable for production
|
|
524
529
|
|
|
525
|
-
For issues not covered here, check the [troubleshooting guide](docs/troubleshooting.md) or create an issue in the repository.
|
|
530
|
+
For issues not covered here, check the [troubleshooting guide](docs/troubleshooting.md) or create an issue in the repository.
|
|
@@ -15,7 +15,7 @@ This document provides detailed technical documentation for the JSGUI3 Server fr
|
|
|
15
15
|
- You're troubleshooting complex issues or performance problems
|
|
16
16
|
- You need to understand deployment, security, and production considerations
|
|
17
17
|
|
|
18
|
-
**Note:** Start with [README.md](../README.md) for project overview and basic usage. For server API design principles, see [docs/simple-server-api-design.md](docs/simple-server-api-design.md).
|
|
18
|
+
**Note:** Start with [README.md](../README.md) for project overview and basic usage. For server API design principles, see [docs/simple-server-api-design.md](docs/simple-server-api-design.md). For bundling internals and elimination strategy research, see [docs/books/jsgui3-bundling-research-book/README.md](docs/books/jsgui3-bundling-research-book/README.md).
|
|
19
19
|
|
|
20
20
|
# JSGUI3 Server - Comprehensive Documentation
|
|
21
21
|
|
|
@@ -118,8 +118,9 @@ This section is a short, task-oriented runway for AI agents that need to act qui
|
|
|
118
118
|
**Start here:**
|
|
119
119
|
1. Identify the target subsystem: examples, bundlers, publishers, or controls.
|
|
120
120
|
2. Jump to the focused guide: `docs/books/jsgui3-mvvm-fullstack/README.md`.
|
|
121
|
-
3.
|
|
122
|
-
4.
|
|
121
|
+
3. For bundle-size and pruning work, use: `docs/books/jsgui3-bundling-research-book/README.md`.
|
|
122
|
+
4. Make the smallest change that can pass a targeted test.
|
|
123
|
+
5. Run the narrow test file first, then widen if needed.
|
|
123
124
|
|
|
124
125
|
**Minimal commands:**
|
|
125
126
|
```bash
|
|
@@ -489,14 +490,16 @@ Main entry point for starting the server.
|
|
|
489
490
|
**Parameters:**
|
|
490
491
|
- `options` (object): Server configuration object
|
|
491
492
|
|
|
492
|
-
**Options:**
|
|
493
|
-
- `ctrl` or `Ctrl`: Main control class constructor
|
|
494
|
-
- `pages`: Object defining multiple pages with routes as keys
|
|
495
|
-
- `api`: Object defining API endpoints
|
|
496
|
-
- `
|
|
497
|
-
- `
|
|
498
|
-
- `
|
|
499
|
-
- `
|
|
493
|
+
**Options:**
|
|
494
|
+
- `ctrl` or `Ctrl`: Main control class constructor
|
|
495
|
+
- `pages`: Object defining multiple pages with routes as keys
|
|
496
|
+
- `api`: Object defining API endpoints
|
|
497
|
+
- `resources`: Object/array of managed resource definitions
|
|
498
|
+
- `events`: Enable/configure built-in SSE endpoint for resource lifecycle events
|
|
499
|
+
- `src_path_client_js`: Path to client-side JavaScript file
|
|
500
|
+
- `port`: Server port (default: 8080)
|
|
501
|
+
- `host`: Server host (default: all IPv4 interfaces)
|
|
502
|
+
- `debug`: Enable debug mode (default: false)
|
|
500
503
|
|
|
501
504
|
**Returns:** Promise that resolves to the server instance
|
|
502
505
|
|
|
@@ -527,17 +530,45 @@ const server = await Server.serve({
|
|
|
527
530
|
port: 3000
|
|
528
531
|
});
|
|
529
532
|
|
|
530
|
-
// With API endpoints
|
|
531
|
-
const server = await Server.serve({
|
|
532
|
-
ctrl: DashboardControl,
|
|
533
|
+
// With API endpoints
|
|
534
|
+
const server = await Server.serve({
|
|
535
|
+
ctrl: DashboardControl,
|
|
533
536
|
src_path_client_js: require.resolve('./client.js'),
|
|
534
537
|
api: {
|
|
535
538
|
'status': () => ({ uptime: process.uptime() }),
|
|
536
539
|
'users': async () => await getUsers()
|
|
537
|
-
},
|
|
538
|
-
port: 3000
|
|
539
|
-
});
|
|
540
|
-
|
|
540
|
+
},
|
|
541
|
+
port: 3000
|
|
542
|
+
});
|
|
543
|
+
|
|
544
|
+
// With managed resources and SSE lifecycle events
|
|
545
|
+
let server_with_resources;
|
|
546
|
+
server_with_resources = await Server.serve({
|
|
547
|
+
api: {
|
|
548
|
+
'resources/summary': () => server_with_resources.resource_pool.summary
|
|
549
|
+
},
|
|
550
|
+
resources: {
|
|
551
|
+
worker_direct: {
|
|
552
|
+
type: 'process',
|
|
553
|
+
command: process.execPath,
|
|
554
|
+
args: ['worker.js'],
|
|
555
|
+
autoRestart: true
|
|
556
|
+
},
|
|
557
|
+
worker_pm2: {
|
|
558
|
+
type: 'process',
|
|
559
|
+
processManager: { type: 'pm2' }, // pm2Path optional
|
|
560
|
+
command: process.execPath,
|
|
561
|
+
args: ['worker.js']
|
|
562
|
+
},
|
|
563
|
+
remote_worker: {
|
|
564
|
+
type: 'remote',
|
|
565
|
+
host: '127.0.0.1',
|
|
566
|
+
port: 3400
|
|
567
|
+
}
|
|
568
|
+
},
|
|
569
|
+
events: true // creates /events and forwards resource lifecycle events
|
|
570
|
+
});
|
|
571
|
+
```
|
|
541
572
|
|
|
542
573
|
### Publishers API
|
|
543
574
|
|
|
@@ -129,7 +129,7 @@ Configuration values are resolved in this order (later sources override earlier
|
|
|
129
129
|
});
|
|
130
130
|
```
|
|
131
131
|
|
|
132
|
-
### API Configuration
|
|
132
|
+
### API Configuration
|
|
133
133
|
|
|
134
134
|
#### `api`
|
|
135
135
|
- **Type:** `object`
|
|
@@ -154,9 +154,81 @@ Configuration values are resolved in this order (later sources override earlier
|
|
|
154
154
|
'echo': (data) => data
|
|
155
155
|
}
|
|
156
156
|
});
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
###
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Resource and Event Options
|
|
160
|
+
|
|
161
|
+
#### `resources`
|
|
162
|
+
- **Type:** `object | array`
|
|
163
|
+
- **Description:** Resource definitions to register in the server resource pool and start after server startup.
|
|
164
|
+
- **Lifecycle:** Resources are started automatically after the HTTP server is listening and stopped automatically during `server.close()`.
|
|
165
|
+
- **Supported forms:**
|
|
166
|
+
- In-process resource instance
|
|
167
|
+
- In-process resource constructor/class config
|
|
168
|
+
- Process resource config (`type: 'process'` or inferred from `command`)
|
|
169
|
+
- Remote process resource config (`type: 'remote'` or inferred from `host`/`endpoints`)
|
|
170
|
+
- **Example:**
|
|
171
|
+
```javascript
|
|
172
|
+
Server.serve({
|
|
173
|
+
resources: {
|
|
174
|
+
// In-process resource instance
|
|
175
|
+
cache: new In_Process_Cache_Resource({ name: 'cache' }),
|
|
176
|
+
|
|
177
|
+
// Process_Resource in direct mode (default)
|
|
178
|
+
worker_direct: {
|
|
179
|
+
type: 'process',
|
|
180
|
+
command: process.execPath,
|
|
181
|
+
args: ['worker.js'],
|
|
182
|
+
autoRestart: true
|
|
183
|
+
},
|
|
184
|
+
|
|
185
|
+
// Process_Resource in PM2 mode (pm2Path optional)
|
|
186
|
+
worker_pm2: {
|
|
187
|
+
type: 'process',
|
|
188
|
+
processManager: { type: 'pm2' },
|
|
189
|
+
command: process.execPath,
|
|
190
|
+
args: ['worker.js']
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
// Remote_Process_Resource
|
|
194
|
+
remote_worker: {
|
|
195
|
+
type: 'remote',
|
|
196
|
+
host: '127.0.0.1',
|
|
197
|
+
port: 3400,
|
|
198
|
+
pollIntervalMs: 30000
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**Process resource notes:**
|
|
205
|
+
- `processManager` defaults to `direct`.
|
|
206
|
+
- PM2 works without explicitly setting `pm2Path`:
|
|
207
|
+
- `processManager.pm2Path` (if provided)
|
|
208
|
+
- `PM2_PATH` env var (if provided)
|
|
209
|
+
- local `node_modules/.bin/pm2` (if present)
|
|
210
|
+
- `pm2` from `PATH`
|
|
211
|
+
|
|
212
|
+
#### `events`
|
|
213
|
+
- **Type:** `boolean | object`
|
|
214
|
+
- **Description:** Enables a built-in SSE endpoint for resource lifecycle events.
|
|
215
|
+
- **Default:** `false`
|
|
216
|
+
- **When `true`:**
|
|
217
|
+
- Registers `HTTP_SSE_Publisher` at `/events`
|
|
218
|
+
- Forwards resource pool lifecycle events (`resource_state_change`, `crashed`, `unhealthy`, `unreachable`, `recovered`)
|
|
219
|
+
- **When object:** Supports publisher options such as `route`, `name`, `keepaliveIntervalMs`, `maxClients`.
|
|
220
|
+
- **Example:**
|
|
221
|
+
```javascript
|
|
222
|
+
Server.serve({
|
|
223
|
+
events: {
|
|
224
|
+
route: '/events',
|
|
225
|
+
keepaliveIntervalMs: 15000,
|
|
226
|
+
maxClients: 200
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Static File Serving
|
|
160
232
|
|
|
161
233
|
#### `static`
|
|
162
234
|
- **Type:** `object`
|
|
@@ -349,21 +421,70 @@ Server.serve({
|
|
|
349
421
|
});
|
|
350
422
|
```
|
|
351
423
|
|
|
352
|
-
### Resource Pools
|
|
353
|
-
|
|
354
|
-
```javascript
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
}
|
|
366
|
-
|
|
424
|
+
### Resource Pools
|
|
425
|
+
|
|
426
|
+
```javascript
|
|
427
|
+
let server;
|
|
428
|
+
server = await Server.serve({
|
|
429
|
+
resources: {
|
|
430
|
+
cache: new In_Process_Cache_Resource({
|
|
431
|
+
name: 'cache'
|
|
432
|
+
}),
|
|
433
|
+
worker_direct: {
|
|
434
|
+
type: 'process',
|
|
435
|
+
command: process.execPath,
|
|
436
|
+
args: ['worker.js']
|
|
437
|
+
},
|
|
438
|
+
remote_worker: {
|
|
439
|
+
type: 'remote',
|
|
440
|
+
host: '127.0.0.1',
|
|
441
|
+
port: 3400
|
|
442
|
+
}
|
|
443
|
+
},
|
|
444
|
+
events: true,
|
|
445
|
+
api: {
|
|
446
|
+
'resources/summary': () => server.resource_pool.summary,
|
|
447
|
+
'resources/restart': async ({ name }) => {
|
|
448
|
+
const resource = server.resource_pool.get_resource(name);
|
|
449
|
+
if (!resource || typeof resource.restart !== 'function') {
|
|
450
|
+
return { ok: false, error: 'Resource restart not supported' };
|
|
451
|
+
}
|
|
452
|
+
await resource.restart();
|
|
453
|
+
return { ok: true, status: resource.status };
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
For strongly typed in-process resources you can also provide constructor-based entries:
|
|
460
|
+
|
|
461
|
+
```javascript
|
|
462
|
+
Server.serve({
|
|
463
|
+
resources: {
|
|
464
|
+
in_process_metrics: {
|
|
465
|
+
type: 'resource',
|
|
466
|
+
class: In_Process_Metrics_Resource,
|
|
467
|
+
spec: {
|
|
468
|
+
sampleIntervalMs: 1000
|
|
469
|
+
}
|
|
470
|
+
},
|
|
471
|
+
in_process_events: {
|
|
472
|
+
constructor_fn: In_Process_Event_Bus_Resource,
|
|
473
|
+
spec: {
|
|
474
|
+
maxHistory: 500
|
|
475
|
+
}
|
|
476
|
+
},
|
|
477
|
+
in_process_cache: {
|
|
478
|
+
resource: new In_Process_Cache_Resource({
|
|
479
|
+
name: 'in_process_cache'
|
|
480
|
+
})
|
|
481
|
+
},
|
|
482
|
+
in_process_singleton: new In_Process_Registry_Resource({
|
|
483
|
+
name: 'in_process_singleton'
|
|
484
|
+
})
|
|
485
|
+
}
|
|
486
|
+
});
|
|
487
|
+
```
|
|
367
488
|
|
|
368
489
|
### Middleware
|
|
369
490
|
|
|
@@ -402,14 +523,18 @@ Server.serve({ port: 'not-a-number' });
|
|
|
402
523
|
- **Required:** None (auto-discovery provides defaults)
|
|
403
524
|
- **Optional:** All options have sensible defaults
|
|
404
525
|
|
|
405
|
-
### Validation Rules
|
|
406
|
-
|
|
407
|
-
- `port`: Must be number between 1-65535 or 0 (ephemeral)
|
|
408
|
-
- `host`: Must be valid IPv4 address or hostname
|
|
409
|
-
- `debug`: Converted to boolean using truthy() function
|
|
410
|
-
- `pages`: Each page must have `content` property
|
|
411
|
-
- `api`: Values must be functions
|
|
412
|
-
- `static`: Values must be strings (directory paths)
|
|
526
|
+
### Validation Rules
|
|
527
|
+
|
|
528
|
+
- `port`: Must be number between 1-65535 or 0 (ephemeral)
|
|
529
|
+
- `host`: Must be valid IPv4 address or hostname
|
|
530
|
+
- `debug`: Converted to boolean using truthy() function
|
|
531
|
+
- `pages`: Each page must have `content` property
|
|
532
|
+
- `api`: Values must be functions
|
|
533
|
+
- `static`: Values must be strings (directory paths)
|
|
534
|
+
- `resources`: Must be an object map or array of supported resource entries
|
|
535
|
+
- `resources.<name>.type`: Supported values include `process`, `remote`, `resource`, `in_process`, `in-process`
|
|
536
|
+
- `resources.<name>.processManager.type`: Supported values include `direct`, `pm2`
|
|
537
|
+
- `events`: Must be boolean or object
|
|
413
538
|
|
|
414
539
|
## Configuration Patterns
|
|
415
540
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Core Documentation
|
|
2
|
+
|
|
3
|
+
This directory contains dense, implementation-first documentation for the active reliability surface of `jsgui3-server`.
|
|
4
|
+
|
|
5
|
+
Current focus:
|
|
6
|
+
|
|
7
|
+
- server startup and readiness semantics
|
|
8
|
+
- unified resource model (in-process, direct process, remote process)
|
|
9
|
+
- resource pool lifecycle and event forwarding
|
|
10
|
+
- SSE event transport for resource telemetry
|
|
11
|
+
- end-to-end browser testing methodology for control + resource integration
|
|
12
|
+
|
|
13
|
+
Primary text:
|
|
14
|
+
|
|
15
|
+
- `docs/core/jsgui3-server-core-book/00-table-of-contents.md`
|
|
16
|
+
|
|
17
|
+
Related deep-dive:
|
|
18
|
+
|
|
19
|
+
- `docs/books/jsgui3-bundling-research-book/README.md`
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# jsgui3-server Core Book
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
This book specifies the currently critical execution path: `Server.serve(...)` startup, resource lifecycle control, resource event publication, and browser-level verification of those behaviors.
|
|
6
|
+
|
|
7
|
+
## Chapter Map
|
|
8
|
+
|
|
9
|
+
1. `01-startup-readiness-state-machine.md`
|
|
10
|
+
2. `02-resource-abstraction-and-lifecycle.md`
|
|
11
|
+
3. `03-resource-pool-and-event-topology.md`
|
|
12
|
+
4. `04-sse-publisher-semantics.md`
|
|
13
|
+
5. `05-serve-factory-resource-wiring.md`
|
|
14
|
+
6. `06-e2e-testing-methodology.md`
|
|
15
|
+
7. `07-defect-detection-and-hardening-loop.md`
|
|
16
|
+
|
|
17
|
+
## Reader Contract
|
|
18
|
+
|
|
19
|
+
- This text is dense by design.
|
|
20
|
+
- It assumes familiarity with Node.js HTTP servers, async control flow, and event-driven architecture.
|
|
21
|
+
- It prioritizes invariants, failure modes, and testability over introductory narrative.
|