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.
Files changed (145) hide show
  1. package/.github/workflows/control-scan-manifest-check.yml +31 -0
  2. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-071799b982906680f5fd699d.js +40 -0
  3. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-07352945ad5c92654fcb8b65.js +39 -0
  4. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-138a601fadb6191ea314c6fd.js +39 -0
  5. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-171f6c381c2cadf2e9fa7087.js +39 -0
  6. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-1d973388156b84a04373fac9.js +39 -0
  7. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-20e117bc8a10d2cd16234bbe.js +40 -0
  8. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-2b028a82b0e5efddba42425f.js +39 -0
  9. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-4518556cd5c7e059e82b22b8.js +40 -0
  10. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-5bac1aa0f213902f718ed74f.js +40 -0
  11. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-5f9996ac7822caf777d92f56.js +39 -0
  12. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-60a92c702e65fd9cf748e3ec.js +39 -0
  13. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-6164c1f8f738995c541895d2.js +44 -0
  14. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-6718a85eb9e5aa782dd47a05.js +45 -0
  15. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-69e280f14e37aee76a1d4675.js +39 -0
  16. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-7570d1b030d44b111ed59c4c.js +39 -0
  17. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-7798c9bbd55e510d5039f936.js +42 -0
  18. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-78cd511ea1ef18ecb03d1be5.js +40 -0
  19. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-7d482e0b95bcb5e3c543118b.js +43 -0
  20. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-80e9476d1127c55b40fdb36f.js +40 -0
  21. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-810ced55d5320a3088a05b13.js +40 -0
  22. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-8423565f1a40e329afc8c6cf.js +40 -0
  23. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-900bef783b8cee36506ec282.js +39 -0
  24. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-a1a37aff6416fdad74040ddf.js +39 -0
  25. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-ad48d5e8eda40f175b4df090.js +39 -0
  26. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-aec5a2d963015528c9099462.js +39 -0
  27. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-af9d34e0f1722fab9e28c269.js +39 -0
  28. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-b818e4015e2f1fe86280b5ab.js +41 -0
  29. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-bcb2541adc70b7aba61768c5.js +44 -0
  30. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-bfe89d2c78ed44f95ed7dd73.js +40 -0
  31. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-c06f04806a1e688e1187110c.js +40 -0
  32. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-c3f3adf904f585afc544b96a.js +39 -0
  33. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-d45acb873e1d8e32d5e60f2e.js +39 -0
  34. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-db06f132533706f4a0163b8c.js +39 -0
  35. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-f660f40d78b135fc8560a862.js +39 -0
  36. package/.jsgui3-server-cache/jsgui3-html-shims/jsgui3-html-controls-shim-f9dee4ec18a96e09bee06bae.js +39 -0
  37. package/README.md +85 -3
  38. package/admin-ui/client.js +213 -0
  39. package/admin-ui/server.js +104 -0
  40. package/client/controls/auto-observable.js +207 -0
  41. package/dev-status.svg +139 -0
  42. package/docs/api-reference.md +301 -43
  43. package/docs/books/admin-ui/01-introduction.md +32 -0
  44. package/docs/books/admin-ui/02-architecture.md +92 -0
  45. package/docs/books/admin-ui/03-controls.md +194 -0
  46. package/docs/books/admin-ui/04-implementation-plan.md +62 -0
  47. package/docs/books/admin-ui/README.md +26 -0
  48. package/docs/books/jsgui3-bundling-research-book/00-table-of-contents.md +35 -0
  49. package/docs/books/jsgui3-bundling-research-book/01-pipeline-and-runtime-semantics.md +34 -0
  50. package/docs/books/jsgui3-bundling-research-book/02-javascript-bundling-core.md +36 -0
  51. package/docs/books/jsgui3-bundling-research-book/03-style-extraction-and-css-compilation.md +35 -0
  52. package/docs/books/jsgui3-bundling-research-book/04-static-publishing-and-delivery.md +39 -0
  53. package/docs/books/jsgui3-bundling-research-book/05-current-limits-and-size-bloat-vectors.md +25 -0
  54. package/docs/books/jsgui3-bundling-research-book/06-unused-module-elimination-strategy.md +77 -0
  55. package/docs/books/jsgui3-bundling-research-book/07-jsgui3-html-control-and-mixin-pruning.md +63 -0
  56. package/docs/books/jsgui3-bundling-research-book/08-test-and-verification-methodology.md +43 -0
  57. package/docs/books/jsgui3-bundling-research-book/09-roadmap-and-rollout.md +42 -0
  58. package/docs/books/jsgui3-bundling-research-book/10-further-research-strategies-and-upgrades.md +211 -0
  59. package/docs/books/jsgui3-bundling-research-book/README.md +35 -0
  60. package/docs/bundling-system-deep-dive.md +9 -4
  61. package/docs/comprehensive-documentation.md +49 -18
  62. package/docs/configuration-reference.md +152 -27
  63. package/docs/core/README.md +19 -0
  64. package/docs/core/jsgui3-server-core-book/00-table-of-contents.md +21 -0
  65. package/docs/core/jsgui3-server-core-book/01-startup-readiness-state-machine.md +41 -0
  66. package/docs/core/jsgui3-server-core-book/02-resource-abstraction-and-lifecycle.md +92 -0
  67. package/docs/core/jsgui3-server-core-book/03-resource-pool-and-event-topology.md +47 -0
  68. package/docs/core/jsgui3-server-core-book/04-sse-publisher-semantics.md +41 -0
  69. package/docs/core/jsgui3-server-core-book/05-serve-factory-resource-wiring.md +46 -0
  70. package/docs/core/jsgui3-server-core-book/06-e2e-testing-methodology.md +48 -0
  71. package/docs/core/jsgui3-server-core-book/07-defect-detection-and-hardening-loop.md +47 -0
  72. package/docs/publishers-guide.md +59 -4
  73. package/docs/resources-guide.md +184 -35
  74. package/docs/simple-server-api-design.md +72 -17
  75. package/docs/system-architecture.md +18 -14
  76. package/examples/controls/15) window, observable SSE/server.js +6 -1
  77. package/examples/controls/19) window, auto observable ui/client.js +125 -0
  78. package/examples/controls/19) window, auto observable ui/server.js +73 -0
  79. package/examples/controls/20) window, task manager app/README.md +133 -0
  80. package/examples/controls/20) window, task manager app/client.js +797 -0
  81. package/examples/controls/20) window, task manager app/server.js +178 -0
  82. package/examples/controls/6) window, color_palette/client.js +165 -68
  83. package/examples/controls/9) window, date picker/client.js +362 -76
  84. package/examples/controls/9b) window, shared data.model mirrored date pickers/client.js +104 -83
  85. package/examples/jsgui3-html/06) theming/client.js +22 -1
  86. package/examples/jsgui3-html/10) binding-debugger/client.js +137 -1
  87. package/http/responders/static/Static_Route_HTTP_Responder.js +52 -34
  88. package/lab/experiments/capture-color-controls.js +196 -0
  89. package/lab/results/screenshots/color-controls/full_page.png +0 -0
  90. package/lab/results/screenshots/color-controls/section_1_color_grid_12x12.png +0 -0
  91. package/lab/results/screenshots/color-controls/section_2_color_grid_4x2.png +0 -0
  92. package/lab/results/screenshots/color-controls/section_3_color_palette.png +0 -0
  93. package/lab/results/screenshots/color-controls/section_4_palette_comparison.png +0 -0
  94. package/lab/results/screenshots/color-controls/section_5_raw_swatches.png +0 -0
  95. package/lab/results/screenshots/color-controls/section_6_optimized_crayola.png +0 -0
  96. package/lab/results/screenshots/color-controls/section_7_pastel_palette.png +0 -0
  97. package/lab/results/screenshots/color-controls/section_8_extended_144.png +0 -0
  98. package/lab/screenshot-utils.js +248 -0
  99. package/module.js +11 -4
  100. package/package.json +14 -4
  101. package/publishers/Publishers.js +4 -3
  102. package/publishers/helpers/assigners/static-compressed-response-buffers/Single_Control_Webpage_Server_Static_Compressed_Response_Buffers_Assigner.js +5 -5
  103. package/publishers/http-observable-publisher.js +8 -0
  104. package/publishers/http-sse-publisher.js +341 -0
  105. package/publishers/http-webpage-publisher.js +13 -3
  106. package/publishers/http-webpageorsite-publisher.js +18 -0
  107. package/resources/process-resource.js +950 -0
  108. package/resources/processors/bundlers/js/esbuild/Advanced_JS_Bundler_Using_ESBuild.js +164 -46
  109. package/resources/processors/bundlers/js/esbuild/Core_JS_Non_Minifying_Bundler_Using_ESBuild.js +18 -7
  110. package/resources/processors/bundlers/js/esbuild/JSGUI3_HTML_Control_Optimizer.js +829 -0
  111. package/resources/remote-process-resource.js +355 -0
  112. package/resources/server-resource-pool.js +354 -41
  113. package/serve-factory.js +441 -259
  114. package/server.js +161 -16
  115. package/tests/README.md +66 -4
  116. package/tests/admin-ui-render.test.js +24 -0
  117. package/tests/assigners.test.js +56 -40
  118. package/tests/bundling-default-control-elimination.puppeteer.test.js +260 -0
  119. package/tests/configuration-validation.test.js +21 -18
  120. package/tests/content-analysis.test.js +7 -6
  121. package/tests/control-optimizer-cache-behavior.test.js +52 -0
  122. package/tests/control-scan-manifest-regression.test.js +144 -0
  123. package/tests/end-to-end.test.js +15 -14
  124. package/tests/error-handling.test.js +222 -179
  125. package/tests/fixtures/bundling-default-button-client.js +37 -0
  126. package/tests/fixtures/bundling-default-window-client.js +34 -0
  127. package/tests/fixtures/control_scan_manifest_expectations.json +48 -0
  128. package/tests/fixtures/resource-monitor-client.js +319 -0
  129. package/tests/helpers/puppeteer-e2e-harness.js +317 -0
  130. package/tests/http-sse-publisher.test.js +136 -0
  131. package/tests/performance.test.js +69 -65
  132. package/tests/process-resource.test.js +138 -0
  133. package/tests/publishers.test.js +7 -7
  134. package/tests/remote-process-resource.test.js +160 -0
  135. package/tests/sass-controls.e2e.test.js +7 -1
  136. package/tests/serve-resources.test.js +270 -0
  137. package/tests/serve.test.js +120 -50
  138. package/tests/server-resource-pool.test.js +106 -0
  139. package/tests/small-controls-bundle-size.test.js +252 -0
  140. package/tests/test-runner.js +13 -1
  141. package/tests/window-examples.puppeteer.test.js +204 -1
  142. package/tests/window-resource-integration.puppeteer.test.js +585 -0
  143. package/tests/temp_invalid.js +0 -7
  144. package/tests/temp_invalid_utf8.js +0 -1
  145. package/tests/temp_malformed.js +0 -10
@@ -0,0 +1,194 @@
1
+ # Chapter 3: Controls
2
+
3
+ ## Control Placement Strategy
4
+
5
+ | Control | Location | Rationale |
6
+ |---------|----------|-----------|
7
+ | `Property_Viewer` | jsgui3-html | General-purpose read-only property display |
8
+ | `Property_Editor` | jsgui3-html | Already exists - editing properties |
9
+ | `Object_KVP_Viewer` | jsgui3-html | Already exists - key-value pairs |
10
+ | `Object_KVP_Editor` | jsgui3-html | Already exists - editable KVP |
11
+ | `Resource_Viewer` | jsgui3-html | General-purpose for any resource with name/type/status |
12
+ | `Tree_View` | jsgui3-html | General-purpose hierarchical display |
13
+ | `Admin_Page` | jsgui3-server | Server-specific admin shell |
14
+ | `Resource_List` | jsgui3-server | Server-specific resource listing |
15
+ | `Observables_List` | jsgui3-server | Server-specific observable listing |
16
+ | `Observable_Monitor` | jsgui3-server | Server-specific real-time monitoring |
17
+ | `Resource_Detail_Page` | jsgui3-server | Server-specific resource detail view |
18
+
19
+ ---
20
+
21
+ ## General-Purpose Controls (jsgui3-html)
22
+
23
+ ### Existing Controls to Leverage
24
+
25
+ 1. **`Property_Editor`** - Edits properties with type-specific inputs
26
+ 2. **`Object_KVP_Viewer`** - Displays object as key-value pairs
27
+ 3. **`Object_KVP_Editor`** - Editable key-value pairs
28
+
29
+ ### New Controls Needed in jsgui3-html
30
+
31
+ #### Property_Viewer
32
+
33
+ Read-only display of an object's properties in a clean table format.
34
+
35
+ ```javascript
36
+ const viewer = new controls.Property_Viewer({
37
+ context,
38
+ data: { name: 'MyResource', type: 'observable', status: 'active' },
39
+ schema: {
40
+ name: { label: 'Name', type: 'string' },
41
+ type: { label: 'Type', type: 'badge' },
42
+ status: { label: 'Status', type: 'status-indicator' }
43
+ }
44
+ });
45
+ ```
46
+
47
+ #### Resource_Viewer
48
+
49
+ Displays a resource with icon, name, type badge, and expandable details.
50
+
51
+ ```javascript
52
+ const rv = new controls.Resource_Viewer({
53
+ context,
54
+ resource: {
55
+ name: '/api/tick-stream',
56
+ type: 'observable',
57
+ schema: { type: 'int' },
58
+ status: 'active',
59
+ connections: 3
60
+ }
61
+ });
62
+ ```
63
+
64
+ #### Tree_View
65
+
66
+ Hierarchical tree with expand/collapse, icons, and selection.
67
+
68
+ ```javascript
69
+ const tree = new controls.Tree_View({
70
+ context,
71
+ data: [
72
+ { label: 'Publishers', icon: '📡', children: [...] },
73
+ { label: 'Routes', icon: '🛤️', children: [...] }
74
+ ],
75
+ onSelect: (node) => console.log('Selected:', node)
76
+ });
77
+ ```
78
+
79
+ ---
80
+
81
+ ## Server-Specific Controls (jsgui3-server/admin-ui)
82
+
83
+ ### 1. Admin_Page
84
+
85
+ The main container control that serves as the Admin UI shell.
86
+
87
+ ```javascript
88
+ class Admin_Page extends Active_HTML_Document {
89
+ // Renders sidebar + main panel + header
90
+ }
91
+ ```
92
+
93
+ **Layout:**
94
+ - Left sidebar: `Resource_List` + `Observables_List`
95
+ - Main panel: `Resource_Detail_Page` or selected content
96
+ - Header: Server name, uptime, connection count
97
+
98
+ ### 2. Resource_List
99
+
100
+ Displays all registered server resources using `Tree_View`.
101
+
102
+ **Data Source:** `GET /api/admin/resources`
103
+
104
+ **Structure:**
105
+ ```
106
+ ├── Routes
107
+ │ ├── / (webpage)
108
+ │ ├── /admin (admin-ui)
109
+ │ └── /api/* (function)
110
+ ├── Publishers
111
+ │ ├── HTTP_Website_Publisher
112
+ │ └── HTTP_Observable_Publisher
113
+ └── Resources
114
+ ├── Server Router
115
+ └── Resource Pool
116
+ ```
117
+
118
+ ### 3. Observables_List
119
+
120
+ Lists all published observables with status indicators.
121
+
122
+ **Data Source:** `GET /api/admin/observables`
123
+
124
+ **Item Display:**
125
+ - Route path
126
+ - Schema type badge
127
+ - Status indicator (active/paused/stopped)
128
+ - Connection count
129
+
130
+ ### 4. Observable_Monitor
131
+
132
+ Real-time display for a single observable using `Auto_Observable_UI`.
133
+
134
+ **Features:**
135
+ - Play/Pause controls
136
+ - History buffer (last N values)
137
+ - Schema display
138
+ - Export to JSON
139
+
140
+ ### 5. Resource_Detail_Page
141
+
142
+ Detail view for a selected resource.
143
+
144
+ **Sections:**
145
+ - **Header**: Name, type badge
146
+ - **Properties**: Using `Property_Viewer`
147
+ - **Actions**: Pause, resume, stop (for observables)
148
+ - **Live View**: For observables, embedded monitor
149
+
150
+ ### 6. Config_Panel
151
+
152
+ Form-based configuration editor using `Property_Editor`.
153
+
154
+ **Features:**
155
+ - Read-only by default (safety)
156
+ - Unlock with confirmation for editing
157
+ - Validation before save
158
+
159
+ ### 7. Metrics_Dashboard
160
+
161
+ Displays server health metrics.
162
+
163
+ **Metrics:**
164
+ - Active connections
165
+ - Requests/second
166
+ - Memory usage
167
+ - Observable subscription count
168
+
169
+ ---
170
+
171
+ ## Styling Approach
172
+
173
+ All controls use CSS-in-JS via the static `.css` property:
174
+
175
+ ```javascript
176
+ Admin_Page.css = `
177
+ .admin-page {
178
+ display: grid;
179
+ grid-template-columns: 280px 1fr;
180
+ height: 100vh;
181
+ background: #1a1a2e;
182
+ }
183
+ .admin-sidebar { ... }
184
+ .admin-main { ... }
185
+ `;
186
+ ```
187
+
188
+ ## Extension Points
189
+
190
+ Custom admin panels can be registered:
191
+
192
+ ```javascript
193
+ server.admin.registerPanel('MyPanel', MyPanelControl);
194
+ ```
@@ -0,0 +1,62 @@
1
+ # Chapter 4: Implementation Plan
2
+
3
+ ## Phase 1: Foundation
4
+
5
+ ### jsgui3-html (General-Purpose)
6
+ - [ ] Implement `Property_Viewer` control
7
+ - [ ] Implement `Resource_Viewer` control
8
+ - [ ] Implement `Tree_View` control
9
+
10
+ ### jsgui3-server (Admin-Specific)
11
+ - [x] Create `admin-ui/client.js` with `Admin_Page`
12
+ - [x] Create `admin-ui/server.js` with API routes
13
+ - [x] Register `/admin` route in main server
14
+
15
+ ## Phase 2: Resource Browser
16
+
17
+ - [ ] Implement `Resource_List` using `Tree_View`
18
+ - [x] Add API: `GET /api/admin/resources`
19
+ - [ ] Implement `Resource_Detail_Page`
20
+ - [ ] Wire up selection → detail view
21
+
22
+ ## Phase 3: Observable Visibility
23
+
24
+ - [ ] Implement `Observables_List` control
25
+ - [x] Add API: `GET /api/admin/observables`
26
+ - [ ] Implement `Observable_Monitor` with `Auto_Observable_UI`
27
+ - [ ] Add play/pause/history features
28
+
29
+ ## Phase 4: Metrics & Config
30
+
31
+ - [ ] Implement `Metrics_Dashboard`
32
+ - [ ] Add API: `GET /api/admin/metrics` (SSE)
33
+ - [ ] Implement `Config_Panel` using `Property_Editor`
34
+
35
+ ## Phase 5: Polish
36
+
37
+ - [ ] Responsive design
38
+ - [ ] Keyboard navigation
39
+ - [ ] Export/import config
40
+ - [ ] Documentation and examples
41
+
42
+ ## File Checklist
43
+
44
+ | File | Location | Status |
45
+ |------|----------|--------|
46
+ | `Property_Viewer.js` | jsgui3-html | Planned |
47
+ | `Resource_Viewer.js` | jsgui3-html | Planned |
48
+ | `Tree_View.js` | jsgui3-html | Planned |
49
+ | `admin-ui/client.js` | jsgui3-server | ✅ Done |
50
+ | `admin-ui/server.js` | jsgui3-server | ✅ Done |
51
+ | `admin-ui/controls/Resource_List.js` | jsgui3-server | Planned |
52
+ | `admin-ui/controls/Observables_List.js` | jsgui3-server | Planned |
53
+ | `admin-ui/controls/Observable_Monitor.js` | jsgui3-server | Planned |
54
+ | `admin-ui/controls/Resource_Detail_Page.js` | jsgui3-server | Planned |
55
+
56
+ ## Success Criteria
57
+
58
+ 1. Navigate to `/admin` and see the Admin UI
59
+ 2. Browse all server resources in tree view
60
+ 3. Select a resource to see its properties
61
+ 4. View live observable streams with auto-generated UIs
62
+ 5. See basic metrics (connections, uptime)
@@ -0,0 +1,26 @@
1
+ # Admin UI Book
2
+
3
+ This folder contains documentation for the `jsgui3-server` Admin UI system.
4
+
5
+ ## Chapters
6
+
7
+ 1. [Introduction](./01-introduction.md) - Vision and goals
8
+ 2. [Architecture](./02-architecture.md) - High-level design
9
+ 3. [Controls](./03-controls.md) - UI components
10
+ 4. [Implementation Plan](./04-implementation-plan.md) - Phases and tasks
11
+
12
+ ## Purpose
13
+
14
+ The Admin UI provides a web-based interface to administer and monitor `jsgui3-server` instances. Key features include:
15
+
16
+ - **Resource Viewer**: Browse server-side resources (publishers, routes, etc.)
17
+ - **Observable Monitor**: Real-time visibility into observable server processes
18
+ - **Configuration Editor**: Modify server settings
19
+ - **Performance Dashboard**: View metrics and health
20
+
21
+ ## Design Principles
22
+
23
+ 1. **Dogfooding**: Built entirely with jsgui3 controls
24
+ 2. **Real-time**: Uses `Remote_Observable` for live updates
25
+ 3. **Extensible**: Plugin architecture for custom panels
26
+ 4. **Polished UX**: Modern dark theme, smooth transitions
@@ -0,0 +1,35 @@
1
+ # 0. Table of Contents
2
+
3
+ ## Part I: What the Bundler Does Today
4
+
5
+ 1. [Pipeline and Runtime Semantics](01-pipeline-and-runtime-semantics.md)
6
+ 2. [JavaScript Bundling Core](02-javascript-bundling-core.md)
7
+ 3. [Style Extraction and CSS Compilation](03-style-extraction-and-css-compilation.md)
8
+ 4. [Static Publishing and Delivery](04-static-publishing-and-delivery.md)
9
+
10
+ ## Part II: Why Bundles Are Still Larger Than Needed
11
+
12
+ 5. [Current Limits and Size-Bloat Vectors](05-current-limits-and-size-bloat-vectors.md)
13
+
14
+ ## Part III: How to Get to Lightweight Bundles
15
+
16
+ 6. [Unused Module Elimination Strategy](06-unused-module-elimination-strategy.md)
17
+ 7. [jsgui3-html Control and Mixin Pruning](07-jsgui3-html-control-and-mixin-pruning.md)
18
+ 8. [Test and Verification Methodology](08-test-and-verification-methodology.md)
19
+ 9. [Roadmap and Rollout](09-roadmap-and-rollout.md)
20
+ 10. [Further Research: Strategies and Upgrades](10-further-research-strategies-and-upgrades.md)
21
+
22
+ ## Primary Code Surfaces Referenced
23
+
24
+ - `publishers/http-webpageorsite-publisher.js`
25
+ - `publishers/http-webpage-publisher.js`
26
+ - `publishers/helpers/preparers/static/bundle/Static_Routes_Responses_Webpage_Bundle_Preparer.js`
27
+ - `publishers/helpers/assigners/static-routes/Single_Control_Webpage_Server_Static_Routes_Assigner.js`
28
+ - `publishers/helpers/assigners/static-uncompressed-response-buffers/Single_Control_Webpage_Server_Static_Uncompressed_Response_Buffers_Assigner.js`
29
+ - `publishers/helpers/assigners/static-compressed-response-buffers/Single_Control_Webpage_Server_Static_Compressed_Response_Buffers_Assigner.js`
30
+ - `publishers/helpers/assigners/static-headers/Single_Control_Webpage_Server_Static_Headers_Assigner.js`
31
+ - `resources/processors/bundlers/js/esbuild/Advanced_JS_Bundler_Using_ESBuild.js`
32
+ - `resources/processors/bundlers/js/esbuild/Core_JS_Non_Minifying_Bundler_Using_ESBuild.js`
33
+ - `resources/processors/bundlers/js/esbuild/Core_JS_Single_File_Minifying_Bundler_Using_ESBuild.js`
34
+ - `resources/processors/extractors/js/css_and_js/AST_Node/CSS_And_JS_From_JS_String_Using_AST_Node_Extractor.js`
35
+ - `resources/processors/bundlers/style-bundler.js`
@@ -0,0 +1,34 @@
1
+ # 1. Pipeline and Runtime Semantics
2
+
3
+ ## System Entry Point
4
+
5
+ For webpage/site publishing, the active bundling entry path is:
6
+
7
+ 1. `HTTP_Webpage_Publisher.get_ready()`
8
+ 2. `HTTP_Webpageorsite_Publisher.get_ready()`
9
+ 3. `JS_Bundler.bundle(src_path_client_js)`
10
+ 4. static route/response preparation
11
+
12
+ The concrete orchestrator is `publishers/http-webpageorsite-publisher.js`, which constructs `JS_Bundler` and awaits `js_bundler.bundle(...)`.
13
+
14
+ ## Bundle Payload Contract
15
+
16
+ The bundle object is `Bundle` (a `Collection`) from `resources/processors/bundlers/bundle.js`. Effective convention is:
17
+
18
+ - bundle array with one `Bundle` instance
19
+ - `Bundle._arr` containing items such as:
20
+ - `{ type: 'JavaScript', extension: 'js', text: '...' }`
21
+ - `{ type: 'CSS', extension: 'css', text: '...' }`
22
+ - `{ type: 'HTML', extension: 'html', text: '...' }` (added by webpage publisher)
23
+
24
+ This contract is implicit and shared by publishers/assigners.
25
+
26
+ ## Readiness and Failure Semantics
27
+
28
+ `HTTP_Webpage_Publisher` starts an async readiness flow in constructor and emits `'ready'` on success. On error, it emits `'error'` and then still emits `'ready'` with `{}` so upstream startup can continue.
29
+
30
+ `HTTP_Webpageorsite_Publisher.get_ready()` also has defensive fallback for missing `src_path_client_js`, returning placeholder JS/CSS text items.
31
+
32
+ ## Consequence
33
+
34
+ The current design prioritizes startup continuity over hard failure. This is operationally useful, but for strict production correctness a separate "fail-fast bundling" mode should exist.
@@ -0,0 +1,36 @@
1
+ # 2. JavaScript Bundling Core
2
+
3
+ ## Active JS Bundler Chain
4
+
5
+ `resources/processors/bundlers/js-bundler.js` exports `./js/JS_Bundler`, which exports `./esbuild/Advanced_JS_Bundler_Using_ESBuild`.
6
+
7
+ That advanced bundler composes two core stages:
8
+
9
+ 1. `Core_JS_Non_Minifying_Bundler_Using_ESBuild`
10
+ 2. `Core_JS_Single_File_Minifying_Bundler_Using_ESBuild` (production branch)
11
+
12
+ ## Stage A: Non-Minifying Bundle
13
+
14
+ `Core_JS_Non_Minifying_Bundler_Using_ESBuild` executes `esbuild.build` with:
15
+
16
+ - `bundle: true`
17
+ - `treeShaking: true`
18
+ - `write: false`
19
+ - optional sourcemap, controlled by `sourcemaps.enabled`, `debug`, and `includeInProduction`
20
+
21
+ It returns a one-item `Bundle` containing JavaScript text.
22
+
23
+ ## Stage B: Style-Assignment Removal
24
+
25
+ `Advanced_JS_Bundler_Using_ESBuild` parses the Stage A JS, extracts style assignments, and produces CSS-free JS text for a second JS pass.
26
+
27
+ ## Stage C: Debug/Production Split
28
+
29
+ - Debug path: re-bundle CSS-free JS without minification.
30
+ - Production path: re-bundle CSS-free JS, then run minifier bundler.
31
+
32
+ Minifier behavior is configurable by `bundler.minify` with levels `conservative | normal | aggressive` and option overrides.
33
+
34
+ ## Existing Optimization Character
35
+
36
+ The current model is "bundle then sanitize" rather than "module graph first with explicit retained-module manifest." It relies heavily on esbuild tree shaking plus post-bundle style extraction.
@@ -0,0 +1,35 @@
1
+ # 3. Style Extraction and CSS Compilation
2
+
3
+ ## Extraction Target
4
+
5
+ `CSS_And_JS_From_JS_String_Using_AST_Node_Extractor` scans bundled JS AST and finds assignment expressions where:
6
+
7
+ - left side is a member expression ending in `css`, `scss`, or `sass`
8
+ - right side is a template literal
9
+
10
+ Matched style source is collected, and assignment source spans are removed from JS output.
11
+
12
+ ## Output Shape
13
+
14
+ Extractor returns:
15
+
16
+ - `css` (concatenated)
17
+ - `scss` (concatenated)
18
+ - `sass` (concatenated)
19
+ - `style_segments` (ordered typed segments)
20
+ - `js` (style-assignment-free JS)
21
+
22
+ ## Compilation Phase
23
+
24
+ `resources/processors/bundlers/style-bundler.js` compiles style payloads via `SASS_Compiler` when SCSS/SASS is present (or when CSS is configured to compile through sass). It supports:
25
+
26
+ - mixed segment compilation
27
+ - load paths
28
+ - output style
29
+ - optional inline sourcemaps
30
+
31
+ The compiled CSS is appended as a `CSS` bundle item.
32
+
33
+ ## Current Limits
34
+
35
+ Extraction currently depends on a specific syntactic shape (`AssignmentExpression` + template literal). Non-matching style declaration patterns can evade extraction and remain in JS, which both bloats JS and risks duplicate style semantics.
@@ -0,0 +1,39 @@
1
+ # 4. Static Publishing and Delivery
2
+
3
+ ## Preparation Chain
4
+
5
+ `Static_Routes_Responses_Webpage_Bundle_Preparer.prepare(...)` runs:
6
+
7
+ 1. route assignment
8
+ 2. identity buffer assignment
9
+ 3. compressed buffer assignment
10
+ 4. response header assignment
11
+
12
+ ## Route Model
13
+
14
+ `Single_Control_Webpage_Server_Static_Routes_Assigner` maps by type:
15
+
16
+ - JavaScript -> `/js/js.js`
17
+ - CSS -> `/css/css.css`
18
+ - HTML -> `/`
19
+
20
+ This is deterministic but static; no fingerprinted asset paths yet.
21
+
22
+ ## Encoding Model
23
+
24
+ `Single_Control_Webpage_Server_Static_Uncompressed_Response_Buffers_Assigner` writes `response_buffers.identity`.
25
+
26
+ `Single_Control_Webpage_Server_Static_Compressed_Response_Buffers_Assigner` optionally adds:
27
+
28
+ - `response_buffers.gzip`
29
+ - `response_buffers.br`
30
+
31
+ Configurable controls include `enabled`, `algorithms`, `gzip.level`, `brotli.quality`, and `threshold`.
32
+
33
+ ## Header Model
34
+
35
+ `Single_Control_Webpage_Server_Static_Headers_Assigner` writes headers per encoding variant under `item.response_headers[encoding]`, including `Content-Length`, `Content-Type`, and `Content-Encoding` where applicable.
36
+
37
+ ## Practical Implication
38
+
39
+ The delivery layer is currently path-stable and content-encoding-aware but not cache-fingerprint-aware. Lightweight bundles can still be produced, but CDN/browser cache efficiency is constrained by fixed asset names.
@@ -0,0 +1,25 @@
1
+ # 5. Current Limits and Size-Bloat Vectors
2
+
3
+ ## Bloat Vector 1: Entry-Point Over-Inclusion
4
+
5
+ If the client entry imports a broad namespace (or re-export hub), esbuild includes reachable modules conservatively. Tree shaking helps, but side-effect ambiguity limits elimination.
6
+
7
+ ## Bloat Vector 2: Side Effects and Dynamic Access
8
+
9
+ Patterns like dynamic member access, side-effectful module initialization, or broad registry mutation make safe elimination harder. Bundlers retain uncertain modules by design.
10
+
11
+ ## Bloat Vector 3: Post-Bundle Style Extraction Cost
12
+
13
+ Current strategy performs non-minifying bundle first, then AST style extraction, then JS rebundle/minify. This gives clean CSS separation but incurs additional processing and can retain JS content not representable as removable style assignments.
14
+
15
+ ## Bloat Vector 4: Fixed Aggregate Assets
16
+
17
+ Everything converges to a single `/js/js.js` and `/css/css.css` asset pair. This simplifies runtime, but does not naturally support granular shared-chunk caching.
18
+
19
+ ## Bloat Vector 5: Startup-Continuity Fallbacks
20
+
21
+ Bundling fallback behavior favors server startup continuity. If fallback text assets are accepted too loosely in operational workflows, latent size/perf regressions may go unnoticed.
22
+
23
+ ## Core Observation
24
+
25
+ The system is robust and functionally coherent, but it lacks a first-class "reachability report + elimination policy" layer that explains exactly what was retained and why.
@@ -0,0 +1,77 @@
1
+ # 6. Unused Module Elimination Strategy
2
+
3
+ ## Design Goal
4
+
5
+ Add deterministic dead-module elimination while preserving runtime correctness and keeping current high-level APIs stable.
6
+
7
+ ## Phase 1: Observability First
8
+
9
+ Introduce a bundle analysis artifact per build:
10
+
11
+ - `module_graph_manifest.json`
12
+ - fields: module path, retained/pruned flag, retention reason, side-effect classification, importer chain
13
+
14
+ Use esbuild `metafile` as baseline graph input. Do not prune yet in this phase.
15
+
16
+ ## Phase 2: Policy-Based Pruning
17
+
18
+ Add pruning policies:
19
+
20
+ - `safe`: prune only modules proven side-effect free and unreachable from entry exports
21
+ - `balanced`: allow package-level side-effect allowlists
22
+ - `aggressive`: opt-in broader pruning with explicit risk declaration
23
+
24
+ Each pruned module must carry an auditable reason code.
25
+
26
+ ## Phase 3: Runtime Safety Guardrails
27
+
28
+ Add optional runtime checks in debug mode:
29
+
30
+ - missing symbol trap hooks for known registries
31
+ - warning when dynamic lookup requests pruned modules
32
+
33
+ ## Proposed Configuration Surface
34
+
35
+ ```js
36
+ bundler: {
37
+ elimination: {
38
+ enabled: true,
39
+ profile: 'safe',
40
+ emit_manifest: true,
41
+ fail_on_uncertain_prune: true
42
+ }
43
+ }
44
+ ```
45
+
46
+ ## Contract
47
+
48
+ The contract must be: "No silent pruning." Every elimination decision is traceable in emitted metadata.
49
+
50
+ ## Current Implementation (Initial)
51
+
52
+ `jsgui3-server` now includes an initial `jsgui3-html` control scan-and-package path in the advanced esbuild bundler.
53
+
54
+ Enable it with:
55
+
56
+ ```js
57
+ bundler: {
58
+ elimination: {
59
+ enabled: true,
60
+ jsgui3_html_controls: {
61
+ enabled: true
62
+ }
63
+ }
64
+ }
65
+ ```
66
+
67
+ Behavior:
68
+
69
+ - scans reachable source files from the entry file
70
+ - detects static `jsgui3-html` control usage patterns
71
+ - builds a lightweight shim exporting only selected controls
72
+ - aliases `require('jsgui3-html')` to that shim during bundling
73
+ - attaches scan metadata at `bundle.bundle_analysis.jsgui3_html_control_scan`
74
+
75
+ Safety:
76
+
77
+ - if dynamic control indexing is detected (`controls[some_var]`), optimization is disabled by default
@@ -0,0 +1,63 @@
1
+ # 7. jsgui3-html Control and Mixin Pruning
2
+
3
+ ## Objective
4
+
5
+ Allow `jsgui3-html` to grow in feature breadth while keeping simple app bundles lightweight by pruning unused controls, mixins, and helper modules.
6
+
7
+ ## Constraint Surface
8
+
9
+ `jsgui3-html` usage often includes:
10
+
11
+ - direct imports (`const {Window} = require('jsgui3-html').controls`)
12
+ - registry-style access (`jsgui.controls.some_control`)
13
+ - inheritance chains and mixin composition
14
+
15
+ Pruning must account for all three.
16
+
17
+ ## Reachability Model
18
+
19
+ Build a typed symbol graph with nodes:
20
+
21
+ - controls
22
+ - mixins
23
+ - utility helpers
24
+ - transitive runtime support modules
25
+
26
+ Edges:
27
+
28
+ - static import/require edges
29
+ - inheritance edges
30
+ - mixin application edges
31
+ - registry publication edges
32
+
33
+ A module is retained if any retained symbol depends on it.
34
+
35
+ ## Beyond Controls and Mixins
36
+
37
+ The same graph can prune additional payload classes:
38
+
39
+ - optional theme packs
40
+ - optional icon packs
41
+ - optional debug instrumentation
42
+ - optional adapter layers (for features not used by the app)
43
+ - feature-local helper modules that are only referenced by pruned controls
44
+
45
+ ## Packaging Recommendation
46
+
47
+ Within `jsgui3-html`, define explicit boundaries:
48
+
49
+ - `core` (always lightweight baseline)
50
+ - optional feature groups (advanced controls, diagnostics, heavy widgets)
51
+
52
+ Then allow bundler elimination to prune unused optional groups based on symbol reachability.
53
+
54
+ ## Dynamic-Access Safety
55
+
56
+ When dynamic registry access is detected and symbol resolution is uncertain:
57
+
58
+ - `safe` profile retains uncertain candidates
59
+ - manifest records reason as `dynamic_access_uncertain`
60
+
61
+ ## Result
62
+
63
+ This produces consistent APIs while allowing bundle contents to shrink significantly for narrow use cases.
@@ -0,0 +1,43 @@
1
+ # 8. Test and Verification Methodology
2
+
3
+ ## Verification Principle
4
+
5
+ Bundle-size optimization is valid only if behavioral equivalence is maintained for supported usage profiles.
6
+
7
+ ## Test Layers
8
+
9
+ 1. Unit tests for elimination graph logic
10
+ 2. Integration tests for bundler output and route serving
11
+ 3. E2E browser tests for real interaction flows (Puppeteer)
12
+ 4. Size-regression tests with per-fixture budgets
13
+
14
+ ## Bundle Correctness Tests
15
+
16
+ For each fixture app:
17
+
18
+ - generate baseline bundle (elimination disabled)
19
+ - generate optimized bundle (elimination enabled)
20
+ - compare runtime outcomes and key DOM/event traces
21
+ - compare bundle size deltas against expected thresholds
22
+
23
+ ## Puppeteer Scenarios
24
+
25
+ For control-heavy examples:
26
+
27
+ - open page and wait for control activation markers
28
+ - perform high-specificity interactions (drag, resize, date pick, color pick, keyboard paths)
29
+ - assert expected UI state and emitted network/API behavior
30
+
31
+ For resource-integrated flows:
32
+
33
+ - verify client-visible state updates driven by server resources
34
+ - verify SSE/event paths where applicable
35
+ - confirm no missing-symbol/runtime errors caused by pruning
36
+
37
+ ## Gating Policy
38
+
39
+ A prune policy cannot be promoted from experimental to default unless:
40
+
41
+ - all functional suites pass
42
+ - bundle manifest diff is stable and explainable
43
+ - size regression thresholds are met across representative fixtures.