jsgui3-server 0.0.145 → 0.0.147

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 (49) hide show
  1. package/README.md +16 -0
  2. package/docs/agent-development-guide.md +92 -9
  3. package/docs/books/jsgui3-mvvm-fullstack/00-overview.md +17 -0
  4. package/docs/books/jsgui3-mvvm-fullstack/01-stack-map.md +25 -0
  5. package/docs/books/jsgui3-mvvm-fullstack/02-control-lifecycle.md +32 -0
  6. package/docs/books/jsgui3-mvvm-fullstack/03-mvvm-basics.md +57 -0
  7. package/docs/books/jsgui3-mvvm-fullstack/04-bindings-and-validation.md +51 -0
  8. package/docs/books/jsgui3-mvvm-fullstack/05-full-stack-example.md +50 -0
  9. package/docs/books/jsgui3-mvvm-fullstack/06-testing.md +23 -0
  10. package/docs/books/jsgui3-mvvm-fullstack/07-troubleshooting.md +20 -0
  11. package/docs/books/jsgui3-mvvm-fullstack/08-agent-playbooks.md +30 -0
  12. package/docs/books/jsgui3-mvvm-fullstack/README.md +30 -0
  13. package/docs/comprehensive-documentation.md +145 -34
  14. package/docs/diagrams/jsgui3-progress-update.svg +181 -0
  15. package/docs/jsgui3-sass-patterns-book/01-vision-and-goals.md +31 -0
  16. package/docs/jsgui3-sass-patterns-book/02-stack-map.md +40 -0
  17. package/docs/jsgui3-sass-patterns-book/03-control-local-sass.md +60 -0
  18. package/docs/jsgui3-sass-patterns-book/04-extension-and-variants.md +76 -0
  19. package/docs/jsgui3-sass-patterns-book/05-theming-and-tokens.md +54 -0
  20. package/docs/jsgui3-sass-patterns-book/06-workspace-overrides.md +45 -0
  21. package/docs/jsgui3-sass-patterns-book/07-resource-and-bundling.md +46 -0
  22. package/docs/jsgui3-sass-patterns-book/08-examples.md +62 -0
  23. package/docs/jsgui3-sass-patterns-book/09-testing-and-adoption.md +27 -0
  24. package/docs/jsgui3-sass-patterns-book/README.md +23 -0
  25. package/docs/troubleshooting.md +44 -4
  26. package/examples/controls/14) window, canvas/client.js +1 -1
  27. package/examples/controls/14b) window, canvas (improved renderer)/client.js +1 -1
  28. package/examples/controls/14d) window, canvas globe/client.js +1 -1
  29. package/examples/controls/14e) window, canvas multithreaded/client.js +1 -1
  30. package/examples/controls/14f) window, canvas polyglobe/client.js +1 -1
  31. package/examples/controls/16) window, form container/client.js +254 -0
  32. package/examples/controls/16) window, form container/server.js +20 -0
  33. package/examples/controls/17) window, mvvm binding/client.js +530 -0
  34. package/examples/controls/17) window, mvvm binding/server.js +20 -0
  35. package/examples/controls/18) window, observable bindRemote/README.md +28 -0
  36. package/examples/controls/18) window, observable bindRemote/check.js +144 -0
  37. package/examples/controls/18) window, observable bindRemote/client.js +387 -0
  38. package/examples/controls/18) window, observable bindRemote/server.js +107 -0
  39. package/package.json +4 -4
  40. package/publishers/http-webpage-publisher.js +39 -16
  41. package/publishers/http-webpageorsite-publisher.js +48 -35
  42. package/resources/processors/bundlers/js/esbuild/Core_JS_Non_Minifying_Bundler_Using_ESBuild.js +87 -100
  43. package/resources/processors/bundlers/js/esbuild/Core_JS_Single_File_Minifying_Bundler_Using_ESBuild.js +89 -60
  44. package/server.js +199 -185
  45. package/tests/README.md +45 -9
  46. package/tests/bundlers.test.js +53 -47
  47. package/tests/examples-controls.e2e.test.js +3 -1
  48. package/tests/sass-controls.e2e.test.js +123 -9
  49. package/tests/server-publish-observable.test.js +99 -0
@@ -55,12 +55,58 @@ class Core_JS_Single_File_Minifying_Bundler_Using_ESBuild extends Bundler_Using_
55
55
  return options;
56
56
  }
57
57
 
58
- get_default_minify_config() {
59
- return {
60
- enabled: true,
61
- level: 'normal'
62
- };
63
- }
58
+ get_default_minify_config() {
59
+ return {
60
+ enabled: true,
61
+ level: 'normal'
62
+ };
63
+ }
64
+
65
+ apply_minify_options(o_build) {
66
+ const enabled = this.minify_config.enabled !== false;
67
+ if (!enabled) {
68
+ o_build.minify = false;
69
+ return;
70
+ }
71
+
72
+ const level = this.minify_config.level || 'normal';
73
+ const level_overrides = {
74
+ conservative: {
75
+ minifyIdentifiers: false,
76
+ minifyWhitespace: false,
77
+ minifySyntax: false
78
+ },
79
+ aggressive: {
80
+ drop: ['console', 'debugger']
81
+ }
82
+ };
83
+
84
+ o_build.minify = true;
85
+ if (level_overrides[level]) {
86
+ Object.assign(o_build, level_overrides[level]);
87
+ }
88
+
89
+ const minify_options = this.get_minify_options();
90
+ if (minify_options && typeof minify_options === 'object') {
91
+ if (minify_options.mangle === false) {
92
+ o_build.minifyIdentifiers = false;
93
+ }
94
+ if (minify_options.compress === false) {
95
+ o_build.minifySyntax = false;
96
+ o_build.minifyWhitespace = false;
97
+ } else if (minify_options.compress && typeof minify_options.compress === 'object') {
98
+ if (minify_options.compress.sequences === false) {
99
+ o_build.minifySyntax = false;
100
+ }
101
+ const drop = [];
102
+ if (minify_options.compress.drop_console) drop.push('console');
103
+ if (minify_options.compress.drop_debugger) drop.push('debugger');
104
+ if (drop.length) {
105
+ o_build.drop = Array.from(new Set([...(o_build.drop || []), ...drop]));
106
+ }
107
+ }
108
+ }
109
+ }
64
110
 
65
111
 
66
112
 
@@ -75,40 +121,23 @@ class Core_JS_Single_File_Minifying_Bundler_Using_ESBuild extends Bundler_Using_
75
121
  if (typeof str_js !== 'string') {
76
122
  throw new Error('bundle() expects a string parameter');
77
123
  }
78
- const res_obs = obs(async(next, complete, error) => {
79
-
80
-
81
-
82
- //console.log('Core_JS_Bundler_Using_ESBuild bundle js_file_path:', js_file_path);
83
-
84
- // Looks like we need better linking build options....
85
-
86
- let result = await esbuild.build({
87
- stdin: {
88
- contents: str_js,
89
-
90
- // These are all optional:
91
- //resolveDir: './src',
92
- //sourcefile: 'imaginary-file.js',
93
- //loader: 'ts',
94
- },
95
- bundle: true,
96
-
97
- // Possibly no minification here....
98
- // Want to use non-minified or only partially minified version to separate the JS and the CSS.
99
-
100
- treeShaking: true,
101
- minify: true,
102
- //format: 'iife',
103
-
104
- //sourcemap: 'external',
105
- write: false,
106
- // Remove outdir since we're keeping in memory
107
- })
108
- //console.log('result.outputFiles:\n\n');
109
- for (let out of result.outputFiles) {
110
- //console.log('out.path, out.contents, out.hash, out.text', out.path, out.contents, out.hash, out.text)
111
- }
124
+ const res_obs = obs(async(next, complete, error) => {
125
+ try {
126
+ const o_build = {
127
+ stdin: {
128
+ contents: str_js
129
+ },
130
+ bundle: true,
131
+ treeShaking: true,
132
+ write: false
133
+ };
134
+
135
+ this.apply_minify_options(o_build);
136
+
137
+ const result = await esbuild.build(o_build);
138
+ for (let out of result.outputFiles) {
139
+ //console.log('out.path, out.contents, out.hash, out.text', out.path, out.contents, out.hash, out.text)
140
+ }
112
141
 
113
142
  //console.log('result.outputFiles.length', result.outputFiles.length);
114
143
 
@@ -116,9 +145,9 @@ class Core_JS_Single_File_Minifying_Bundler_Using_ESBuild extends Bundler_Using_
116
145
  //throw 'stop';
117
146
 
118
147
 
119
- if (result.outputFiles.length === 1) {
120
-
121
- const output_file = result.outputFiles[0];
148
+ if (result.outputFiles.length === 1) {
149
+
150
+ const output_file = result.outputFiles[0];
122
151
 
123
152
  //console.log('output_file', output_file);
124
153
 
@@ -155,10 +184,10 @@ class Core_JS_Single_File_Minifying_Bundler_Using_ESBuild extends Bundler_Using_
155
184
  text: output_file.text
156
185
  }
157
186
 
158
- res_bundle.push(o_bundle_item);
159
-
160
- next(res_bundle);
161
- complete();
187
+ res_bundle.push(o_bundle_item);
188
+
189
+ next(res_bundle);
190
+ complete(res_bundle);
162
191
 
163
192
 
164
193
 
@@ -192,18 +221,18 @@ class Core_JS_Single_File_Minifying_Bundler_Using_ESBuild extends Bundler_Using_
192
221
  //console.trace();
193
222
  //throw 'NYI';
194
223
 
195
- } else {
196
-
197
-
198
- console.trace();
199
- throw 'NYI';
200
-
201
- }
202
-
203
-
204
- // The core bundler....
205
- // Maybe later even use a Static_Response_Preparer???
206
- // And have the relevant Publisher use it?
224
+ } else {
225
+ console.trace();
226
+ throw 'NYI';
227
+ }
228
+ } catch (err) {
229
+ if (typeof error === 'function') error(err);
230
+ }
231
+
232
+
233
+ // The core bundler....
234
+ // Maybe later even use a Static_Response_Preparer???
235
+ // And have the relevant Publisher use it?
207
236
 
208
237
 
209
238
 
@@ -221,4 +250,4 @@ class Core_JS_Single_File_Minifying_Bundler_Using_ESBuild extends Bundler_Using_
221
250
 
222
251
  }
223
252
 
224
- module.exports = Core_JS_Single_File_Minifying_Bundler_Using_ESBuild;
253
+ module.exports = Core_JS_Single_File_Minifying_Bundler_Using_ESBuild;