jsgui3-server 0.0.83 → 0.0.86

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.
@@ -9,6 +9,7 @@
9
9
 
10
10
 
11
11
  const {each} = require('lang-mini');
12
+ //const babel_node_tools = require('../babel_node_tools');
12
13
 
13
14
 
14
15
  // deep_iterate_babel_super_node
@@ -53,6 +54,10 @@ const deep_iterate_babel_object_method_node = (babel_node, depth, path, common,
53
54
  // deep_iterate_object_method_node
54
55
  const deep_iterate_this_expression_node = (babel_node, depth, path, common, callback) => {
55
56
 
57
+ // Maybe no further iteration to do???
58
+
59
+
60
+ //throw 'stop';
56
61
  }
57
62
 
58
63
  // const deep_iterate_array_pattern_node
@@ -273,7 +278,11 @@ const deep_iterate_babel_member_expression_node = (babel_node, depth, path, comm
273
278
 
274
279
 
275
280
  if (extra) {
276
- throw 'NYI'
281
+
282
+ //console.log('babel_node', babel_node);
283
+ //console.log('extra', extra);
284
+
285
+ //throw 'NYI'
277
286
  };
278
287
  deep_iterate_babel_node_$INTERNAL(object, depth + 1, path + sibling_number++ + '/', common, callback);
279
288
  deep_iterate_babel_node_$INTERNAL(property, depth + 1, path + sibling_number++ + '/', common, callback);
@@ -370,6 +379,18 @@ const deep_iterate_babel_block_statement_node = (babel_node, depth, path, common
370
379
  });
371
380
  }
372
381
 
382
+ const deep_iterate_babel_function_declaration_node = (babel_node, depth, path, common, callback) => {
383
+ const {extra, id, generator, async, params, body} = babel_node;
384
+
385
+ let sibling_number = 0;
386
+
387
+ deep_iterate_babel_node_$INTERNAL(id, depth + 1, path + sibling_number++ + '/', common, callback);
388
+ each(params, param => deep_iterate_babel_node_$INTERNAL(param, depth + 1, path + sibling_number++ + '/', common, callback));
389
+ deep_iterate_babel_node_$INTERNAL(body, depth + 1, path + sibling_number++ + '/', common, callback);
390
+
391
+
392
+ }
393
+
373
394
  const deep_iterate_babel_arrow_function_expression_node = (babel_node, depth, path, common, callback) => {
374
395
  //console.log('deep_iterate_babel_arrow_function_expression_node', babel_node);
375
396
 
@@ -435,6 +456,204 @@ const deep_iterate_babel_binary_expression_node = (babel_node, depth, path, comm
435
456
  //throw 'stop';
436
457
  }
437
458
 
459
+ const deep_iterate_babel_template_literal_node = (babel_node, depth, path, common, callback) => {
460
+ // expressions and quasis
461
+
462
+ const {generator, async, params, body, quasis, expressions} = babel_node;
463
+
464
+ const q0 = babel_node.quasis[0];
465
+ //console.log('babel_node', babel_node);
466
+ //throw 'NYI';
467
+ //console.log('q0', q0);
468
+ // has both raw and cooked values.
469
+
470
+ // template element.
471
+
472
+ //const {} = babel_node;
473
+ let sibling_number = 0;
474
+ // Assume the params are nodes.
475
+
476
+
477
+ if (expressions.length > 0) {
478
+ throw 'NYI';
479
+ }
480
+
481
+ if (quasis.length > 0) {
482
+ each(quasis, x => deep_iterate_babel_node_$INTERNAL(x, depth + 1, path + sibling_number++ + '/', common, callback));
483
+ //console.log('params', params);
484
+ //throw 'NYI';
485
+ //each(quasis, quasi => {
486
+ // deep_iterate_babel_node_$INTERNAL(quasi, depth + 1, path + sibling_number++ + '/', common, callback);
487
+ //})
488
+ }
489
+
490
+
491
+
492
+ }
493
+
494
+ // deep_iterate_babel_template_element_node
495
+
496
+ const deep_iterate_babel_template_element_node = (babel_node, depth, path, common, callback) => {
497
+ // value.raw is basically it.
498
+
499
+ const {value} = babel_node;
500
+ const {raw, cooked} = value;
501
+
502
+ };
503
+
504
+ // deep_iterate_babel_try_statement_node
505
+
506
+ const deep_iterate_babel_try_statement_node = (babel_node, depth, path, common, callback) => {
507
+ // value.raw is basically it.
508
+
509
+ const {block, handler} = babel_node;
510
+ let sibling_number = 0;
511
+
512
+ deep_iterate_babel_node_$INTERNAL(block, depth + 1, path + sibling_number++ + '/', common, callback);
513
+ deep_iterate_babel_node_$INTERNAL(handler, depth + 1, path + sibling_number++ + '/', common, callback);
514
+
515
+ };
516
+
517
+ //deep_iterate_babel_catch_clause_node
518
+
519
+ const deep_iterate_babel_catch_clause_node = (babel_node, depth, path, common, callback) => {
520
+ // value.raw is basically it.
521
+
522
+ const {param, body} = babel_node;
523
+ let sibling_number = 0;
524
+
525
+ deep_iterate_babel_node_$INTERNAL(param, depth + 1, path + sibling_number++ + '/', common, callback);
526
+ deep_iterate_babel_node_$INTERNAL(body, depth + 1, path + sibling_number++ + '/', common, callback);
527
+
528
+ };
529
+
530
+ // deep_iterate_babel_switch_statement_node 1 discriminant, n cases
531
+
532
+ const deep_iterate_babel_switch_statement_node = (babel_node, depth, path, common, callback) => {
533
+ // value.raw is basically it.
534
+
535
+ const {discriminant, cases} = babel_node;
536
+ let sibling_number = 0;
537
+
538
+ deep_iterate_babel_node_$INTERNAL(discriminant, depth + 1, path + sibling_number++ + '/', common, callback);
539
+
540
+ each(cases, x => deep_iterate_babel_node_$INTERNAL(x, depth + 1, path + sibling_number++ + '/', common, callback));
541
+ //deep_iterate_babel_node_$INTERNAL(body, depth + 1, path + sibling_number++ + '/', common, callback);
542
+
543
+ };
544
+
545
+ // deep_iterate_babel_switch_case_node
546
+
547
+
548
+ const deep_iterate_babel_switch_case_node = (babel_node, depth, path, common, callback) => {
549
+ // value.raw is basically it.
550
+
551
+ //console.log('babel_node', babel_node);
552
+ //throw 'NYI';
553
+
554
+ const {consequent, test} = babel_node;
555
+ let sibling_number = 0;
556
+
557
+
558
+ if (consequent.length > 0) {
559
+ //throw 'NYI';
560
+ each(consequent, x => deep_iterate_babel_node_$INTERNAL(x, depth + 1, path + sibling_number++ + '/', common, callback));
561
+ }
562
+
563
+ deep_iterate_babel_node_$INTERNAL(test, depth + 1, path + sibling_number++ + '/', common, callback);
564
+
565
+
566
+ //deep_iterate_babel_node_$INTERNAL(body, depth + 1, path + sibling_number++ + '/', common, callback);
567
+
568
+ };
569
+
570
+ // deep_iterate_babel_regexp_literal_node
571
+
572
+
573
+ const deep_iterate_babel_regexp_literal_node = (babel_node, depth, path, common, callback) => {
574
+
575
+
576
+
577
+ };
578
+
579
+ // deep_iterate_babel_break_statement_node
580
+
581
+ const deep_iterate_babel_break_statement_node = (babel_node, depth, path, common, callback) => {
582
+
583
+
584
+
585
+ };
586
+
587
+ // deep_iterate_babel_for_in_statement_node
588
+
589
+
590
+ const deep_iterate_babel_for_in_statement_node = (babel_node, depth, path, common, callback) => {
591
+ // value.raw is basically it.
592
+
593
+ const {left, right, body} = babel_node;
594
+ let sibling_number = 0;
595
+
596
+ deep_iterate_babel_node_$INTERNAL(left, depth + 1, path + sibling_number++ + '/', common, callback);
597
+ deep_iterate_babel_node_$INTERNAL(right, depth + 1, path + sibling_number++ + '/', common, callback);
598
+ deep_iterate_babel_node_$INTERNAL(body, depth + 1, path + sibling_number++ + '/', common, callback);
599
+
600
+ };
601
+
602
+ // deep_iterate_babel_sequence_expression_node
603
+
604
+
605
+ const deep_iterate_babel_sequence_expression_node = (babel_node, depth, path, common, callback) => {
606
+ // value.raw is basically it.
607
+
608
+ const {expressions} = babel_node;
609
+ let sibling_number = 0;
610
+
611
+ //deep_iterate_babel_node_$INTERNAL(discriminant, depth + 1, path + sibling_number++ + '/', common, callback);
612
+
613
+ each(expressions, x => deep_iterate_babel_node_$INTERNAL(x, depth + 1, path + sibling_number++ + '/', common, callback));
614
+ //deep_iterate_babel_node_$INTERNAL(body, depth + 1, path + sibling_number++ + '/', common, callback);
615
+
616
+ };
617
+
618
+ // deep_iterate_babel_class_expression_node
619
+ const deep_iterate_babel_class_expression_node = (babel_node, depth, path, common, callback) => {
620
+ // value.raw is basically it.
621
+
622
+ const {id, superClass, node} = babel_node;
623
+ let sibling_number = 0;
624
+
625
+ if (id) deep_iterate_babel_node_$INTERNAL(id, depth + 1, path + sibling_number++ + '/', common, callback);
626
+ deep_iterate_babel_node_$INTERNAL(superClass, depth + 1, path + sibling_number++ + '/', common, callback);
627
+ deep_iterate_babel_node_$INTERNAL(node, depth + 1, path + sibling_number++ + '/', common, callback);
628
+
629
+ };
630
+
631
+ // deep_iterate_babel_rest_element_node
632
+ const deep_iterate_babel_rest_element_node = (babel_node, depth, path, common, callback) => {
633
+ // value.raw is basically it.
634
+
635
+ const {argument} = babel_node;
636
+ let sibling_number = 0;
637
+
638
+ if (argument) deep_iterate_babel_node_$INTERNAL(argument, depth + 1, path + sibling_number++ + '/', common, callback);
639
+
640
+
641
+ };
642
+
643
+ // deep_iterate_babel_await_expression_node
644
+
645
+ const deep_iterate_babel_await_expression_node = (babel_node, depth, path, common, callback) => {
646
+ // value.raw is basically it.
647
+
648
+ const {argument} = babel_node;
649
+ let sibling_number = 0;
650
+
651
+ if (argument) deep_iterate_babel_node_$INTERNAL(argument, depth + 1, path + sibling_number++ + '/', common, callback);
652
+
653
+
654
+ };
655
+
656
+
438
657
  const deep_iterate_babel_node_$INTERNAL = (babel_node, depth, path, common, callback) => {
439
658
 
440
659
  if (babel_node) {
@@ -532,7 +751,44 @@ const deep_iterate_babel_node_$INTERNAL = (babel_node, depth, path, common, call
532
751
  return deep_iterate_babel_conditional_expression_node(babel_node, depth, path, common, callback);
533
752
  } else if (type === 'Super') {
534
753
  return deep_iterate_babel_super_node(babel_node, depth, path, common, callback);
754
+ } else if (type === 'FunctionDeclaration') {
755
+ return deep_iterate_babel_function_declaration_node(babel_node, depth, path, common, callback);
756
+ } else if (type === 'TemplateLiteral') {
757
+ return deep_iterate_babel_template_literal_node(babel_node, depth, path, common, callback);
758
+ } else if (type === 'TemplateElement') {
759
+ return deep_iterate_babel_template_element_node(babel_node, depth, path, common, callback);
760
+ } else if (type === 'TryStatement') {
761
+ return deep_iterate_babel_try_statement_node(babel_node, depth, path, common, callback);
762
+ } else if (type === 'CatchClause') {
763
+ return deep_iterate_babel_catch_clause_node(babel_node, depth, path, common, callback);
764
+ } else if (type === 'SwitchStatement') {
765
+ return deep_iterate_babel_switch_statement_node(babel_node, depth, path, common, callback);
766
+ } else if (type === 'SwitchCase') {
767
+ return deep_iterate_babel_switch_case_node(babel_node, depth, path, common, callback);
768
+ } else if (type === 'RegExpLiteral') {
769
+ return deep_iterate_babel_regexp_literal_node(babel_node, depth, path, common, callback);
770
+ } else if (type === 'BreakStatement') {
771
+ return deep_iterate_babel_break_statement_node(babel_node, depth, path, common, callback);
772
+ } else if (type === 'ForInStatement') {
773
+ return deep_iterate_babel_for_in_statement_node(babel_node, depth, path, common, callback);
774
+ } else if (type === 'SequenceExpression') {
775
+ return deep_iterate_babel_sequence_expression_node(babel_node, depth, path, common, callback);
776
+ } else if (type === 'ClassExpression') {
777
+ return deep_iterate_babel_class_expression_node(babel_node, depth, path, common, callback);
778
+ } else if (type === 'RestElement') {
779
+ return deep_iterate_babel_rest_element_node(babel_node, depth, path, common, callback);
780
+ } else if (type === 'AwaitExpression') {
781
+ return deep_iterate_babel_await_expression_node(babel_node, depth, path, common, callback);
535
782
  } else {
783
+
784
+ // FunctionDeclaration TemplateLiteral TemplateElement TryStatement CatchClause
785
+ // SwitchStatement SwitchCase RegExpLiteral BreakStatement ForInStatement
786
+ // SequenceExpression
787
+ // ClassExpression
788
+ // RestElement (what is this?) A: ...
789
+
790
+ // Need to make this handle a template literal too.
791
+
536
792
  console.log('');
537
793
  console.log('type', type);
538
794
  console.log('');
@@ -9,7 +9,7 @@
9
9
 
10
10
  // Load a JS file into an OO structure
11
11
 
12
- const JS_File = require('..//JS_File/JS_File');
12
+ const JS_File = require('../JS_File/JS_File');
13
13
  //const JS_File_Comprehension = require('../JS_File_Comprehension');
14
14
  const path = require('path');
15
15
  const fs = require('fs');
@@ -33,7 +33,7 @@
33
33
 
34
34
 
35
35
 
36
- const JS_File = require('..//JS_File/JS_File');
36
+ const JS_File = require('../JS_File/JS_File');
37
37
  //const JS_File_Comprehension = require('../JS_File_Comprehension');
38
38
  const path = require('path');
39
39
  const fs = require('fs');
@@ -48,7 +48,7 @@ const test_js_file = () => {
48
48
  // stream the file in.
49
49
  const lm_path = '../../../../../tools/lang-mini/lang-mini.js'
50
50
  const lt_path = '../../../../../tools/lang-tools/lang.js'
51
- const fnl_path = '../../../../../tools/fnl/fnl.js'
51
+ const fnl_path = require.resolve('fnl');
52
52
  const filecomp_path = '../JS_File_Comprehension.js';
53
53
  const jsfile_path = '../JS_File/JS_File.js';
54
54
  const jsbuilder_path = '../JS_Builder.js';
package/roadmap.md CHANGED
@@ -1,3 +1,7 @@
1
+ To fix:
2
+ CSS bundled from the JS.
3
+
4
+
1
5
  Make it work as a stand-alone application.
2
6
  Start it, get it serving a directory easily.
3
7
  Start it, access it through admin pages.
@@ -38,6 +42,24 @@ A file manager interface would be cool.
38
42
  Maybe would need to use file system resource
39
43
  Could work on remote file system too.
40
44
 
45
+ Or make clear this is the core of the server?
46
+ jsgui3-server-core perhaps?
47
+
48
+ A Default server? Could also include file management.
49
+
50
+
51
+ jsgui3-website could be helpful
52
+ a .deploy function
53
+ possibly the website could be hosted over multiple different servers, deployment could work for that.
54
+ The website would not only be within the server.
55
+
56
+ Could have a deployment wizard.
57
+
58
+
59
+
60
+
61
+
62
+
41
63
 
42
64
 
43
65
 
package/server.js CHANGED
@@ -236,24 +236,49 @@ class JSGUI_Server extends Evented_Class {
236
236
 
237
237
 
238
238
  const ws_publisher = new HTTP_Website_Publisher(opts_ws_publisher);
239
+
240
+ // but need to wait until that website publisher is ready.
241
+
242
+
243
+
244
+
239
245
  // ws publisher could have website admin (web) tools.
240
246
  // website admin web interface.
241
247
 
248
+ ws_publisher.on('ready', () => {
249
+ console.log('ws publisher is ready');
242
250
 
251
+ // server not started yet though?
252
+
253
+ const ws_resource = new Website_Resource({
254
+ 'name': 'Website Resource',
255
+ 'website': ws_app
256
+ });
257
+ resource_pool.add(ws_resource);
258
+ //server_router.set_route('/*', ws_app, ws_publisher.handle_http);
259
+ //server_router.set_route('/*', ws_publisher.handle_http);
260
+
261
+ // Should render the Ctrl homepage at some point.
262
+
263
+ server_router.set_route('/*', ws_publisher, ws_publisher.handle_http);
264
+ //throw 'stop';
265
+
266
+ this.raise('ready');
243
267
 
244
268
 
245
- const ws_resource = new Website_Resource({
246
- 'name': 'Website Resource',
247
- 'website': ws_app
248
269
  });
249
- resource_pool.add(ws_resource);
250
- //server_router.set_route('/*', ws_app, ws_publisher.handle_http);
251
- //server_router.set_route('/*', ws_publisher.handle_http);
252
- server_router.set_route('/*', ws_publisher, ws_publisher.handle_http);
270
+
271
+
272
+
273
+
274
+
253
275
  //console.log('route has been set');
254
276
  // ws_publisher.start();
255
277
  }
256
278
  current();
279
+
280
+
281
+
257
282
  }
258
283
 
259
284
  // a 'router' property that returns the server router.
@@ -274,6 +299,8 @@ class JSGUI_Server extends Evented_Class {
274
299
  // http_port, https_port
275
300
 
276
301
 
302
+ // will change to observable API.
303
+
277
304
  'start'(port, callback, fnProcessRequest) {
278
305
 
279
306
  if (tof(port) !== 'number') {
@@ -433,6 +460,16 @@ JSGUI_Server.Page_Context = Server_Page_Context;
433
460
  JSGUI_Server.Server_Page_Context = Server_Page_Context;
434
461
  JSGUI_Server.Website_Resource = Website_Resource;
435
462
 
463
+ // Maybe jsgui3-website should be its own module.
464
+ // Would (completely?) abstract away from the server.
465
+
466
+ // And maybe jsgui3-webpage
467
+ // Could be integrated within jsgui3-server.
468
+
469
+
470
+
471
+
472
+
436
473
  module.exports = JSGUI_Server;
437
474
 
438
475
  if (require.main === module) {
@@ -3,6 +3,32 @@ const {tof, HTML_Document} = jsgui;
3
3
 
4
4
  const oext = require('obext');
5
5
 
6
+ // Should maybe become its own module.
7
+
8
+ // jsgui3-website and jsgui3-webpage
9
+ // jsgui3-application
10
+ // jsgui3-ui-app
11
+ // jsgui3-app may be enough
12
+ // could build / deploy it to phonegap / other native app wrapper.
13
+ // And could deploy a jsgui3-app as a website...?
14
+ // Deploy same app to other platforms?
15
+ // possibly jsgui3-bundler could bundle a website for different uses and formats.
16
+ // could have some kind of non-node server operating on client-side apps.
17
+
18
+ // jsgui3-coming-soon could itself be a website.
19
+ // or a webpage?
20
+
21
+ // website with a single page.
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
6
32
  const Webpage = require('./webpage');
7
33
  // Website is a Publisher?
8
34