jsgui3-server 0.0.74 → 0.0.78

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 (155) hide show
  1. package/examples/client-side-popup-menu-button.html +93 -93
  2. package/examples/controls/_html-server-color-palette.js +114 -114
  3. package/examples/controls/html-server-combo-box.js +104 -104
  4. package/examples/controls/html-server-list.js +98 -98
  5. package/examples/controls/html-server-popup-menu-button.js +114 -114
  6. package/examples/controls/html-server-start-stop-toggle-button.js +146 -146
  7. package/examples/controls/scs-arrow-button.js +36 -36
  8. package/examples/controls/scs-date-picker.js +157 -157
  9. package/examples/controls/scs-file-browser.js +82 -82
  10. package/examples/controls/scs-item.js +159 -159
  11. package/examples/controls/scs-month-arrow-selector.js +126 -126
  12. package/examples/controls/scs-month-view.js +95 -95
  13. package/examples/controls/scs-start-stop-toggle-button.js +40 -40
  14. package/examples/controls/scs-tree.js +49 -49
  15. package/examples/controls/scs-year-arrow-selector.js +127 -127
  16. package/examples/demos/date-picker.js +119 -119
  17. package/examples/demos/explain-encapsulation.js +9 -9
  18. package/examples/demos/resizing.js +35 -35
  19. package/examples/demos/server_time.js +6 -6
  20. package/examples/demos/square_box.js +324 -324
  21. package/examples/html-rendering.js +20 -20
  22. package/examples/html-server.js +102 -100
  23. package/fs2.js +1836 -1836
  24. package/module.js +21 -21
  25. package/old/single-control-server.js +418 -418
  26. package/package.json +44 -42
  27. package/publishing/function-publisher.js +202 -202
  28. package/publishing/notes.md +5 -5
  29. package/publishing/observable-publisher.js +118 -118
  30. package/publishing/resource-publisher.js +306 -306
  31. package/resources/data-resource.js +104 -104
  32. package/resources/fs-resource.js +148 -148
  33. package/resources/jsbuilder/Abstract_Single_Declaration.js +105 -0
  34. package/resources/jsbuilder/Abstract_Single_Declaration_Sequence.js +43 -0
  35. package/resources/jsbuilder/JS_AST/JS_AST_Abstract_Node.js +62 -0
  36. package/resources/jsbuilder/JS_AST/JS_AST_Abstract_Node_Group.js +42 -0
  37. package/resources/jsbuilder/JS_AST/JS_AST_Group_Shared.js +62 -0
  38. package/resources/jsbuilder/JS_AST/JS_AST_Node.js +94 -0
  39. package/resources/jsbuilder/JS_AST/JS_AST_Node_0-Core.js +228 -0
  40. package/resources/jsbuilder/JS_AST/JS_AST_Node_1-Babel.js +338 -0
  41. package/resources/jsbuilder/JS_AST/JS_AST_Node_10-Changing.js +40 -0
  42. package/resources/jsbuilder/JS_AST/JS_AST_Node_2.1.1-Child.js +97 -0
  43. package/resources/jsbuilder/JS_AST/JS_AST_Node_2.1.2-Parent.js +38 -0
  44. package/resources/jsbuilder/JS_AST/JS_AST_Node_2.1.3-Ancestor.js +62 -0
  45. package/resources/jsbuilder/JS_AST/JS_AST_Node_2.2-Inner.js +44 -0
  46. package/resources/jsbuilder/JS_AST/JS_AST_Node_2.3-All.js +73 -0
  47. package/resources/jsbuilder/JS_AST/JS_AST_Node_2.4-Sibling.js +93 -0
  48. package/resources/jsbuilder/JS_AST/JS_AST_Node_2.5-Available_In_Scope.js +29 -0
  49. package/resources/jsbuilder/JS_AST/JS_AST_Node_2.9-Signature.js +116 -0
  50. package/resources/jsbuilder/JS_AST/JS_AST_Node_3-Basics.js +160 -0
  51. package/resources/jsbuilder/JS_AST/JS_AST_Node_3.0.0-Basics_First.js +179 -0
  52. package/resources/jsbuilder/JS_AST/JS_AST_Node_3.0.1-Basics_Second.js +88 -0
  53. package/resources/jsbuilder/JS_AST/JS_AST_Node_3.0.99-Basics_Last.js +92 -0
  54. package/resources/jsbuilder/JS_AST/JS_AST_Node_3.1-Basics_Each.js +137 -0
  55. package/resources/jsbuilder/JS_AST/JS_AST_Node_3.1.5-Basics_Count.js +74 -0
  56. package/resources/jsbuilder/JS_AST/JS_AST_Node_3.2-Basics_Filter.js +40 -0
  57. package/resources/jsbuilder/JS_AST/JS_AST_Node_3.3-Basics_Collect.js +86 -0
  58. package/resources/jsbuilder/JS_AST/JS_AST_Node_3.4-Basics_Select.js +43 -0
  59. package/resources/jsbuilder/JS_AST/JS_AST_Node_3.5-Basics_Find.js +41 -0
  60. package/resources/jsbuilder/JS_AST/JS_AST_Node_3.6-Basics_Callmap.js +55 -0
  61. package/resources/jsbuilder/JS_AST/JS_AST_Node_4.0-Index_Indexes.js +46 -0
  62. package/resources/jsbuilder/JS_AST/JS_AST_Node_4.1-Index.js +344 -0
  63. package/resources/jsbuilder/JS_AST/JS_AST_Node_5.0-Category.js +39 -0
  64. package/resources/jsbuilder/JS_AST/JS_AST_Node_5.1-Category_Identifier.js +31 -0
  65. package/resources/jsbuilder/JS_AST/JS_AST_Node_5.2-Category_Literal.js +29 -0
  66. package/resources/jsbuilder/JS_AST/JS_AST_Node_5.3-Category_Expression.js +27 -0
  67. package/resources/jsbuilder/JS_AST/JS_AST_Node_5.4-Category_Pattern.js +9 -0
  68. package/resources/jsbuilder/JS_AST/JS_AST_Node_5.5-Category_Declaration.js +44 -0
  69. package/resources/jsbuilder/JS_AST/JS_AST_Node_5.6-Category_Statement.js +22 -0
  70. package/resources/jsbuilder/JS_AST/JS_AST_Node_6.0-Type.js +87 -0
  71. package/resources/jsbuilder/JS_AST/JS_AST_Node_6.1-Type_Class_Declaration.js +9 -0
  72. package/resources/jsbuilder/JS_AST/JS_AST_Node_6.2-Type_Variable_Declaration.js +28 -0
  73. package/resources/jsbuilder/JS_AST/JS_AST_Node_6.3-Type_Variable_Declarator.js +29 -0
  74. package/resources/jsbuilder/JS_AST/JS_AST_Node_7-Query.js +737 -0
  75. package/resources/jsbuilder/JS_AST/JS_AST_Node_8-Features.js +65 -0
  76. package/resources/jsbuilder/JS_AST/JS_AST_Node_9-Planning.js +32 -0
  77. package/resources/jsbuilder/JS_AST/JS_AST_Node_Arrangement.js +15 -0
  78. package/resources/jsbuilder/JS_AST/JS_AST_Node_Feature/JS_AST_Node_Declared_Object.js +306 -0
  79. package/resources/jsbuilder/JS_AST/JS_AST_Node_Feature/JS_AST_Node_Feature.js +78 -0
  80. package/resources/jsbuilder/JS_AST/JS_AST_Node_Feature/JS_AST_Node_Feature_Declaration.js +249 -0
  81. package/resources/jsbuilder/JS_AST/JS_AST_Node_Feature/JS_AST_Node_Feature_Declarator.js +139 -0
  82. package/resources/jsbuilder/JS_AST/JS_AST_Node_Feature/JS_AST_Root_Node_Feature/JS_AST_Root_Node_Feature.js +10 -0
  83. package/resources/jsbuilder/JS_AST/JS_AST_Node_Feature/JS_AST_Root_Node_Feature/JS_AST_Root_Node_Feature_Exported.js +101 -0
  84. package/resources/jsbuilder/JS_AST/JS_AST_Node_Feature/JS_AST_Root_Node_Feature/JS_AST_Root_Node_Feature_Exports.js +61 -0
  85. package/resources/jsbuilder/JS_AST/JS_AST_Node_Feature/JS_AST_Root_Node_Feature/JS_AST_Root_Node_Interpreted.js +180 -0
  86. package/resources/jsbuilder/JS_AST/JS_AST_Node_Feature/JS_AST_Root_Node_Feature/_JSGUI_Root_Node_Interpreted.js +43 -0
  87. package/resources/jsbuilder/JS_AST/JS_AST_Node_Feature/JS_AST_Root_Node_Feature/special_case_objectassign_to_object.js +12 -0
  88. package/resources/jsbuilder/JS_AST/JS_AST_Node_Group.js +35 -0
  89. package/resources/jsbuilder/JS_AST/JS_AST_Operation.js +11 -0
  90. package/resources/jsbuilder/JS_AST/JS_AST_Operation_On_Relationship.js +32 -0
  91. package/resources/jsbuilder/JS_AST/JS_AST_Ordered_Relationship_Node_To_Group.js +38 -0
  92. package/resources/jsbuilder/JS_AST/JS_AST_Ordinal.js +40 -0
  93. package/resources/jsbuilder/JS_AST/JS_AST_Ordinal_Relationship.js +25 -0
  94. package/resources/jsbuilder/JS_AST/JS_AST_Relationship_Node_To_Group.js +201 -0
  95. package/resources/jsbuilder/JS_AST/JS_AST_Relationship_Node_Within_Group_To_Node.js +44 -0
  96. package/resources/jsbuilder/JS_AST/_JS_AST_Node_3.8-Query_Features.js +77 -0
  97. package/resources/jsbuilder/JS_AST/query/all.js +0 -0
  98. package/resources/jsbuilder/JS_AST/query/enable_array_as_queryable.js +228 -0
  99. package/resources/jsbuilder/JS_AST/query/find_object_keys.js +405 -0
  100. package/resources/jsbuilder/JS_AST/query/node_queries.js +9 -0
  101. package/resources/jsbuilder/JS_AST/query/root_queries.js +0 -0
  102. package/resources/jsbuilder/JS_AST/query/root_query_identidy.js +12 -0
  103. package/resources/jsbuilder/JS_AST_Node_Extended/JSGUI_Singular_Declaration.js +86 -0
  104. package/resources/jsbuilder/JS_AST_Node_Extended/JS_AST_Node_Declaration.js +124 -0
  105. package/resources/jsbuilder/JS_AST_Node_Extended/JS_AST_Node_Extended.js +88 -0
  106. package/resources/jsbuilder/JS_AST_Node_Extended/JS_AST_Node_Extended_0-Core.js +11 -0
  107. package/resources/jsbuilder/JS_Builder.js +11 -0
  108. package/resources/jsbuilder/JS_File/Feature/JS_File_Declared_Object.js +32 -0
  109. package/resources/jsbuilder/JS_File/Feature/JS_File_Exported_Object_Info.js +26 -0
  110. package/resources/jsbuilder/JS_File/Feature/JS_File_Exports.js +79 -0
  111. package/resources/jsbuilder/JS_File/Feature/JS_File_Feature.js +18 -0
  112. package/resources/jsbuilder/JS_File/Feature/JS_File_Imported_Object_Info.js +26 -0
  113. package/resources/jsbuilder/JS_File/Feature/JS_File_Imports.js +9 -0
  114. package/resources/jsbuilder/JS_File/JS_File.js +12 -0
  115. package/resources/jsbuilder/JS_File/JS_File_0-Core.js +202 -0
  116. package/resources/jsbuilder/JS_File/JS_File_1-Early_Parse.js +175 -0
  117. package/resources/jsbuilder/JS_File/JS_File_2-Babel.js +81 -0
  118. package/resources/jsbuilder/JS_File/JS_File_3-JS_AST_Node.js +86 -0
  119. package/resources/jsbuilder/JS_File/JS_File_4-Query.js +414 -0
  120. package/resources/jsbuilder/JS_File/JS_File_4.1-Query_Features.js +415 -0
  121. package/resources/jsbuilder/JS_File/JS_File_5-Planning.js +59 -0
  122. package/resources/jsbuilder/JS_File/JS_File_6-Changing.js +24 -0
  123. package/resources/jsbuilder/JS_File/JS_File_Export_Reference.js +12 -0
  124. package/resources/jsbuilder/JS_File/JS_File_Import_Reference.js +24 -0
  125. package/resources/jsbuilder/JS_File/JS_File_Import_References.js +32 -0
  126. package/resources/jsbuilder/JS_File/JS_File_Processor.js +16 -0
  127. package/resources/jsbuilder/JS_File/JS_Files.js +16 -0
  128. package/resources/jsbuilder/Module.js +14 -0
  129. package/resources/jsbuilder/Platform.js +14 -0
  130. package/resources/jsbuilder/Platforms.js +70 -0
  131. package/resources/jsbuilder/Project.js +109 -0
  132. package/resources/jsbuilder/Reference.js +1 -0
  133. package/resources/jsbuilder/Reference_Sequence.js +16 -0
  134. package/resources/jsbuilder/Scope.js +30 -0
  135. package/resources/jsbuilder/Variable_Name_Provider.js +43 -0
  136. package/resources/jsbuilder/_JS_File.js +226 -0
  137. package/resources/jsbuilder/ast_query.js +21 -0
  138. package/resources/jsbuilder/babel/babel_consts.js +150 -0
  139. package/resources/jsbuilder/babel/babel_node_tools.js +542 -0
  140. package/resources/jsbuilder/babel/deep_iterate/deep_iterate_babel.js +604 -0
  141. package/resources/jsbuilder/build.js +16 -0
  142. package/resources/jsbuilder/platform_notes.md +66 -0
  143. package/resources/jsbuilder/test/test_ast_node.js +451 -0
  144. package/resources/jsbuilder/test/test_js_file.js +304 -0
  145. package/resources/jsbuilder/test/test_project.js +157 -0
  146. package/resources/local-server-info-resource.js +78 -78
  147. package/resources/process-js.js +537 -537
  148. package/resources/server-resource-pool.js +84 -84
  149. package/resources/website-css-resource.js +411 -411
  150. package/resources/website-javascript-resource.js +761 -731
  151. package/resources/website-resource.js +390 -390
  152. package/resources/website-static-html-resource.js +196 -196
  153. package/server.js +170 -170
  154. package/single-control-server.js +398 -398
  155. package/single-page-app.js +129 -129
@@ -0,0 +1,344 @@
1
+ //const babel_node_tools = require('../babel/babel_node_tools');
2
+ // Index before query would help.
3
+
4
+ // Will index the occurrances of various nodes / things.
5
+ // Could get more into tree pattern checking too, declaratively saying what to look for and looking for multiple things at once with signature comparisons in a map.
6
+
7
+ // Indexing at every level looks like it would be useful.
8
+ // so in order to get the info about how the names relate to nodes we consult indexes.
9
+
10
+ const { each } = require('lang-mini');
11
+ const JS_AST_Node_Basics_Callmap = require('./JS_AST_Node_3.6-Basics_Callmap');
12
+ const JS_AST_Node_Indexes = require('./JS_AST_Node_4.0-Index_Indexes');
13
+
14
+ class JS_AST_Node_Index extends JS_AST_Node_Basics_Callmap {
15
+ constructor(spec = {}) {
16
+ super(spec);
17
+ const {deep_iterate, inner, child} = this;
18
+
19
+ // normal object can not work with its's 'constructor' property.
20
+ const _map_identifiers_by_name = new Map();
21
+ let is_indexed = false;
22
+ const indexes = new JS_AST_Node_Indexes();
23
+ const handle_found = (index_name, key, value) => {
24
+ return indexes.set(index_name, key, value);
25
+ }
26
+
27
+ const setup_node_index = (index_name, fn_selector, fn_key) => {
28
+
29
+ if (indexes.has_index(index_name)) {
30
+ throw 'NYI - index already exists'
31
+ } else {
32
+ deep_iterate(node => {
33
+ if (fn_selector(node)) {
34
+ const key = fn_key(node);
35
+ handle_found(index_name, key, node);
36
+ }
37
+ })
38
+ }
39
+ //return indexes.get_index(index_name);
40
+
41
+ }
42
+
43
+ const get_indexed_nodes_by_key = (index_name, key) => {
44
+ return indexes.get(index_name, key);
45
+ }
46
+
47
+ // calling multiple indexing functions on a single iteration?
48
+
49
+ // .find.all.identifiers(node => node.name = name)
50
+ // .find.identifiers.by.name(name) could substitute for the index.
51
+
52
+ // .idx_lookup_
53
+
54
+ // .nodes_by_name
55
+
56
+ const old = () => {
57
+ const do_default_indexing = () => {
58
+ // Will find function names too :) The functions being called
59
+ // could we make a shallower version that is more efficient?
60
+ // ie, it gets the map from below, and adds any relevant items at the current level.
61
+
62
+ // Making use of child nodes' own indexes would be the optimization here.
63
+ // Building it out of the indexes of the child nodes, if they have indexes.
64
+
65
+ deep_iterate(node => {
66
+ // Are the child nodes all of the same type?
67
+ // .child_node_shared_type property
68
+
69
+ if (node.is_identifier) {
70
+ const name = node.name;
71
+ //console.log('name', name);
72
+
73
+ //_map_identifiers_by_name[name] = _map_identifiers_by_name[name] || [];
74
+ //if (!_map_identifiers_by_name.has(name)) _map_identifiers_by_name.set(name, [])
75
+ handle_found('identifiers_by_name', name, node);
76
+
77
+ //_map_identifiers_by_name.get(name).push(node);
78
+ //console.log('map_identifiers_by_name[name]', _map_identifiers_by_name[name]);
79
+ //_map_identifiers_by_name[name].push(node);
80
+ }
81
+ if (node.is_declaration) {
82
+ //console.log('have declaration node in index loop');
83
+ //console.log('node.child_nodes.length', node.child_nodes.length);
84
+ //console.log('node.signature', node.signature);
85
+ //console.log('node', node);
86
+ //console.log('node.child', node.child);
87
+ //console.log('node.child.count', node.child.count);
88
+ // node.child.collected.names???
89
+
90
+ if (node.child.shared.type === 'VariableDeclarator') {
91
+ if (node.source.length < 800) {
92
+ //console.log('node.source', node.source);
93
+ }
94
+ node.each.child(dec => {
95
+ //console.log('dec.babel.node', dec.babel.node);
96
+ //const id = dec.child.find(node => node.is_identifier);
97
+ // find.identifier();
98
+ const id = dec.find(node => node.is_identifier);
99
+ if (id) {
100
+ //console.log('id', id);
101
+ //console.log('id.name', id.name);
102
+ //_map_names_to_declarations[id.name] = node;
103
+
104
+ //_map_names_to_declarations.set(id.name, node)
105
+ handle_found('names_to_declarations', id.name, node);
106
+ } else {
107
+ //console.log('node', node);
108
+ //console.log('dec.child.count', dec.child.count);
109
+
110
+ // dec.child.types?
111
+ // dec.child.collect.types
112
+ //console.log('dec.child.collect.type', dec.child.collect.type);
113
+ // object pattern and member expression.
114
+ // {a, b, c} = lib;
115
+ if (dec.child.count === 2) {
116
+ const child_types = dec.child.all.type;
117
+ // dec.child.collect.category
118
+ const child_categories = dec.child.all.category;
119
+ //console.log('child_categories', child_categories);
120
+ // maybe any expression is allowed.
121
+ // seems that way
122
+ if (child_types[0] === 'ObjectPattern' && child_categories[1] === 'Expression') {
123
+ const objpat = dec.child_nodes[0];
124
+ //console.log('objpat', objpat);
125
+ //console.log('objpat.child.shared.type', objpat.child.shared.type);
126
+ if (objpat.child.shared.type === 'ObjectProperty') {
127
+ objpat.each.child(objprop => {
128
+ //console.log('objprop', objprop);
129
+ //console.log('objprop.source', objprop.source);
130
+ //console.log('objprop.child.count', objprop.child.count);
131
+ if (objprop.child.count === 2) {
132
+ //console.log('objprop.child.first', objprop.child.first);
133
+ //console.log('objprop.child.last', objprop.child.last);
134
+ //console.log('objprop.child.last.source', objprop.child.last.source);
135
+ //console.log('objprop.child.first.source', objprop.child.first.source);
136
+ if (objprop.child.first.source == objprop.child.last.source) {
137
+ const name = objprop.child.first.name;
138
+ //console.log('name', name);
139
+ //_map_names_to_declarations[name] = node;
140
+ //_map_names_to_declarations.set(name, node);
141
+ handle_found('names_to_declarations', name, node);
142
+ } else {
143
+ throw 'stop';
144
+ }
145
+ } else {
146
+ throw 'stop';
147
+ }
148
+ })
149
+ } else {
150
+ throw 'stop';
151
+ }
152
+ } else {
153
+ // can be [ 'ObjectPattern', 'ThisExpression' ]
154
+ throw 'stop';
155
+ }
156
+ } else {
157
+ throw 'stop';
158
+ }
159
+ }
160
+ // dec.id?
161
+ // gets the identifier?
162
+ // dec.child.identifier?
163
+ })
164
+ }
165
+ // then are all the child nodes of type 'VariableDeclarator'
166
+ // .deep (self then inner)
167
+ // .inner (recursively child nodes)
168
+ // .child
169
+ //node.child.declarators
170
+ }
171
+
172
+
173
+ if (node.is_expression) {
174
+ if (node.type === 'CallExpression') {
175
+ //console.log('node.source', node.source);
176
+ //console.log('node', node);
177
+ //console.log('node.babel.node', node.babel.node);
178
+
179
+ const callee = node.first.child.node;
180
+ if (callee.is_identifier) {
181
+ const fncall_name = callee.name;
182
+ //console.log('fncall_name', fncall_name);
183
+ //_map_fn_call_names.set(fncall_name, node);
184
+ handle_found('fn_call_names', fncall_name, node);
185
+ } else {
186
+
187
+ if (callee.type === 'MemberExpression') {
188
+ //console.log('callee.child.count', callee.child.count);
189
+ let fncall_path = '';
190
+ let first = true;
191
+
192
+ // .child.node.count ???
193
+ // .child.declaration.count
194
+
195
+ // .count.child?
196
+ // // don't properly have .child any longer.
197
+ // this would be under callee.count.child.node
198
+
199
+ if (callee.child_nodes.length > 1) {
200
+ //.each.child.identifier
201
+
202
+ callee.each.child(id => {
203
+ if (id.is_identifier) {
204
+ if (!first) {
205
+ fncall_path += '.';
206
+ } else {
207
+ first = false;
208
+ }
209
+ fncall_path += id.name;
210
+ } else {
211
+ //console.log('node.source', node.source);
212
+
213
+ // Calling a function that is a property of an object.
214
+ // Not so interested right now.
215
+
216
+ // Not looking for this now
217
+
218
+ //throw 'stop';
219
+ }
220
+ })
221
+ handle_found('fn_call_names', fncall_name, node);
222
+ //_map_fn_call_names.set(fncall_path, node);
223
+ } else {
224
+ throw 'stop';
225
+ }
226
+
227
+ }
228
+ //
229
+ //throw 'stop';
230
+ }
231
+ //throw 'stop';
232
+ }
233
+ }
234
+ //console.log('child.count', child.count);
235
+ //if (child.count > 0) {
236
+ // child.each(cn => {
237
+ // })Class constructor {}specClass constructor {}spec
238
+ //}
239
+ })
240
+ is_indexed = true;
241
+ }
242
+ const ensure_index = () => {
243
+ // maybe call it standard indexing here.
244
+
245
+ if (!is_indexed) {
246
+ do_default_indexing();
247
+ }
248
+ }
249
+ // this.map
250
+ // identifiers.name
251
+
252
+ Object.defineProperty(this, 'is_indexed', {
253
+ get() {
254
+ return is_indexed;
255
+ },
256
+ //set(newValue) { bValue = newValue; },
257
+ enumerable: true,
258
+ configurable: false
259
+ });
260
+
261
+
262
+ }
263
+
264
+
265
+ /*
266
+ Object.defineProperty(this, 'maps', {
267
+ get() {
268
+ return maps;
269
+ },
270
+ //set(newValue) { bValue = newValue; },
271
+ enumerable: true,
272
+ configurable: false
273
+ });
274
+ */
275
+
276
+ /*
277
+ Object.defineProperty(this, 'map_identifiers_by_name', {
278
+ get() {
279
+ ensure_index();
280
+ return _map_identifiers_by_name;
281
+
282
+ },
283
+ //set(newValue) { bValue = newValue; },
284
+ enumerable: true,
285
+ configurable: false
286
+ });
287
+ */
288
+
289
+ // _map_names_to_declarations
290
+
291
+ // declaration.identifier.name
292
+
293
+ // Not so sure about the map object here.
294
+
295
+ // Makes sense as a verb, a means to access it.
296
+
297
+ /*
298
+
299
+ const map = {
300
+ declaration: {
301
+ identifier: {
302
+
303
+ }
304
+ },
305
+ identifier: {
306
+
307
+ }
308
+ }
309
+ Object.defineProperty(map.declaration.identifier, 'name', {
310
+ get() {
311
+ ensure_index();
312
+ return _map_names_to_declarations;
313
+ },
314
+ //set(newValue) { bValue = newValue; },
315
+ enumerable: true,
316
+ configurable: false
317
+ });
318
+ Object.defineProperty(map.identifier, 'name', {
319
+ get() {
320
+ ensure_index();
321
+ return _map_identifiers_by_name;
322
+ },
323
+ //set(newValue) { bValue = newValue; },
324
+ enumerable: true,
325
+ configurable: false
326
+ });
327
+ Object.defineProperty(this, 'map', {
328
+ get() {
329
+ //ensure_index();
330
+ return map;
331
+ },
332
+ //set(newValue) { bValue = newValue; },
333
+ enumerable: true,
334
+ configurable: false
335
+ });
336
+ */
337
+
338
+ this.setup_node_index = setup_node_index;
339
+ this.get_indexed_nodes_by_key = get_indexed_nodes_by_key;
340
+ // setup_node_index = (index_name, fn_selector, fn_key) => {
341
+
342
+ }
343
+ }
344
+ module.exports = JS_AST_Node_Index;
@@ -0,0 +1,39 @@
1
+ const JS_AST_Node_Index = require('./JS_AST_Node_4.1-Index');
2
+
3
+ const {type_abbreviations, map_expression_categories, map_literal_categories, map_statement_categories, map_categories} = require('../babel/babel_consts');
4
+
5
+
6
+
7
+
8
+ class JS_AST_Node_Category extends JS_AST_Node_Index {
9
+ constructor(spec = {}) {
10
+ super(spec);
11
+
12
+ Object.defineProperty(this, 'category', {
13
+ get() {
14
+ //console.log('babel', babel);
15
+ //console.log('babel_node', babel_node);
16
+ //console.log('babel.node', babel.node);
17
+ return this.babel.category;
18
+ },
19
+ //set(newValue) { bValue = newValue; },
20
+ enumerable: true,
21
+ configurable: false
22
+ });
23
+ Object.defineProperty(this, 'cat', {
24
+ get() {
25
+ throw 'NYI'
26
+ //console.log('babel', babel);
27
+ //console.log('babel_node', babel_node);
28
+ //console.log('babel.node', babel.node);
29
+ return babel.abbreviated_category;
30
+ },
31
+ //set(newValue) { bValue = newValue; },
32
+ enumerable: true,
33
+ configurable: false
34
+ });
35
+
36
+ }
37
+ }
38
+
39
+ module.exports = JS_AST_Node_Category;
@@ -0,0 +1,31 @@
1
+ const JS_AST_Node_Category = require('./JS_AST_Node_5.0-Category');
2
+
3
+ class JS_AST_Node_Category_Identifier extends JS_AST_Node_Category {
4
+ constructor(spec = {}) {
5
+ super(spec);
6
+
7
+ Object.defineProperty(this, 'is_identifier', {
8
+ get() {
9
+ return this.babel.is_identifier;
10
+ },
11
+ enumerable: true,
12
+ configurable: false
13
+ });
14
+
15
+
16
+
17
+ if (this.is_identifier) {
18
+ Object.defineProperty(this, 'name', {
19
+ get() { return this.babel.name; },
20
+ //set(newValue) { bValue = newValue; },
21
+ enumerable: true,
22
+ configurable: false
23
+ });
24
+ }
25
+ // Overwrite the name property later on?
26
+
27
+
28
+ }
29
+ }
30
+
31
+ module.exports = JS_AST_Node_Category_Identifier;
@@ -0,0 +1,29 @@
1
+ const JS_AST_Node_Category_Identifier = require('./JS_AST_Node_5.1-Category_Identifier');
2
+
3
+ class JS_AST_Node_Category_Literal extends JS_AST_Node_Category_Identifier {
4
+ constructor(spec = {}) {
5
+ super(spec);
6
+
7
+ Object.defineProperty(this, 'is_literal', {
8
+ get() {
9
+ return this.babel.is_literal;
10
+ },
11
+ enumerable: true,
12
+ configurable: false
13
+ });
14
+
15
+ if (this.is_literal) {
16
+ Object.defineProperty(this, 'value', {
17
+ get() {
18
+ return this.babel.node.value;
19
+ },
20
+ enumerable: true,
21
+ configurable: false
22
+ });
23
+ }
24
+
25
+
26
+ }
27
+ }
28
+
29
+ module.exports = JS_AST_Node_Category_Literal;
@@ -0,0 +1,27 @@
1
+ const JS_AST_Node_Category_Literal = require('./JS_AST_Node_5.2-Category_Literal');
2
+
3
+ class JS_AST_Node_Category_Expression extends JS_AST_Node_Category_Literal {
4
+ constructor(spec = {}) {
5
+ super(spec);
6
+
7
+ Object.defineProperty(this, 'is_expression', {
8
+ get() {
9
+ return this.babel.is_expression;
10
+ },
11
+ enumerable: true,
12
+ configurable: false
13
+ });
14
+
15
+ // See if we can evaluate expressions?
16
+ // Probably not worth it right now....
17
+
18
+ // // .can_evaluate property
19
+ // so with some expression patterns we will be able to do so. maybe just a few.
20
+ //
21
+
22
+
23
+
24
+ }
25
+ }
26
+
27
+ module.exports = JS_AST_Node_Category_Expression;
@@ -0,0 +1,9 @@
1
+ const JS_AST_Node_Category_Expression = require('./JS_AST_Node_5.3-Category_Expression');
2
+
3
+ class JS_AST_Node_Category_Pattern extends JS_AST_Node_Category_Expression {
4
+ constructor(spec = {}) {
5
+ super(spec);
6
+ }
7
+ }
8
+
9
+ module.exports = JS_AST_Node_Category_Pattern;
@@ -0,0 +1,44 @@
1
+ const JS_AST_Node_Category_Pattern = require('./JS_AST_Node_5.4-Category_Pattern');
2
+ const JS_AST_Node_Feature_Declaration = require('./JS_AST_Node_Feature/JS_AST_Node_Feature_Declaration');
3
+
4
+ class JS_AST_Node_Category_Declaration extends JS_AST_Node_Category_Pattern {
5
+ constructor(spec = {}) {
6
+ super(spec);
7
+
8
+ Object.defineProperty(this, 'is_declaration', {
9
+ get() {
10
+ return this.babel.is_declaration;
11
+ },
12
+ enumerable: true,
13
+ configurable: false
14
+ });
15
+
16
+ if (this.is_declaration) {
17
+
18
+ // include the declaration feature here?
19
+ //
20
+
21
+ const declaration = new JS_AST_Node_Feature_Declaration({ // some of the code is out of the way - maybe it will get complex / longwinded?
22
+ node: this
23
+ });
24
+
25
+ // But outside of / on a lower level to the feature, more commands and queries to enable better access to declarations would help.
26
+
27
+
28
+
29
+ // declaration.declared.keys
30
+ // Set up retrieval of info on what is declared.
31
+
32
+ // .declared property?
33
+ // .declared.keys
34
+
35
+ // .declared makes for good syntax to access the data.
36
+ // make use of inner class declaration and variable declaration and declarator nodes.
37
+ // more detailed code on them will enable the declaration category to work well.
38
+
39
+ this.declaration = declaration;
40
+ }
41
+ }
42
+ }
43
+
44
+ module.exports = JS_AST_Node_Category_Declaration;
@@ -0,0 +1,22 @@
1
+ const JS_AST_Node_Category_Declaration = require('./JS_AST_Node_5.5-Category_Declaration');
2
+
3
+ class JS_AST_Node_Category_Statement extends JS_AST_Node_Category_Declaration {
4
+ constructor(spec = {}) {
5
+ super(spec);
6
+
7
+ Object.defineProperty(this, 'is_statement', {
8
+ get() {
9
+ return this.babel.is_statement;
10
+ },
11
+ enumerable: true,
12
+ configurable: false
13
+ });
14
+
15
+
16
+
17
+
18
+
19
+ }
20
+ }
21
+
22
+ module.exports = JS_AST_Node_Category_Statement;
@@ -0,0 +1,87 @@
1
+ const JS_AST_Node_Category_Statement = require('./JS_AST_Node_5.6-Category_Statement');
2
+
3
+ const {type_abbreviations, map_expression_categories, map_literal_categories, map_statement_categories, map_categories} = require('../babel/babel_consts');
4
+ class JS_AST_Node_Type extends JS_AST_Node_Category_Statement {
5
+ constructor(spec = {}) {
6
+ super(spec);
7
+
8
+ Object.defineProperty(this, 'type', {
9
+ get() { return this.babel.node.type; },
10
+ //set(newValue) { bValue = newValue; },
11
+ enumerable: true,
12
+ configurable: false
13
+ });
14
+
15
+ Object.defineProperty(this, 'abbreviated_type', {
16
+ get() {
17
+ const abb = type_abbreviations[this.babel.node.type];
18
+ if (abb) {
19
+ return abb;
20
+ } else {
21
+ console.log('this.babel.node.type', this.babel.node.type);
22
+ throw 'stop';
23
+ }
24
+
25
+ },
26
+ //set(newValue) { bValue = newValue; },
27
+ enumerable: true,
28
+ configurable: false
29
+ });
30
+ Object.defineProperty(this, 't', {
31
+ get() {
32
+ return this.abbreviated_type;
33
+
34
+ },
35
+ //set(newValue) { bValue = newValue; },
36
+ enumerable: true,
37
+ configurable: false
38
+ });
39
+ }
40
+ }
41
+
42
+ module.exports = JS_AST_Node_Type;
43
+
44
+
45
+
46
+ // Declaration and declarator seem like among the most important types to focus on for the moment.
47
+ // A very important objective is to find out about what is declared within a piece of code.
48
+ // Will get these queries, and possibly a small layer on top, getting the relevant info about the files that get used to build the jsgui client application.
49
+
50
+ // There will be a variety of files and structures to test. As far as reasonable, there will be general purpose interpretation functions being used, want to get it working in
51
+ // some less standard file arrangements, such as exporting the result of a function call. So long as that code is out of the way (OK within this large structure), and only used in the
52
+ // cases where it is relevant, then it's good to have it in there. Will later get the build system correctly interpreting details from a variety of files, specifically react files will
53
+ // be one of the first to be incorporated into the jsgui build system.
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+ // Then have declaration types
62
+ // Class declaration
63
+ // Variable declaration (which includes const)
64
+
65
+ // Declarator types
66
+
67
+ // Functionality to enable to effective querying of specific types of nodes, to get data out of them in an easy way.
68
+ // Declaration keys
69
+ // Declaration map_key_to_js_ast_node
70
+ // will match up the object and array deconstruction.
71
+
72
+ // Continue trying the system with various pieces of syntax, and get out the required data in a simple way.
73
+ // Get it expressed in a nice query (can use filter and select functions) and have specific functions that will be used / needed to interpret imports, exports, and some of the things that
74
+ // come in between.
75
+
76
+ // More work on scope analysis / iteration / rules?
77
+
78
+ // visible_to? so is a node somewhere in the document visible to another node?
79
+ // leave scope itself for the moment from the core, but see if we can get good iteration through it with a simple function, and / or simple rules.
80
+
81
+
82
+
83
+
84
+
85
+
86
+
87
+
@@ -0,0 +1,9 @@
1
+ const JS_AST_Node_Type = require('./JS_AST_Node_6.0-Type');
2
+
3
+ class JS_AST_Node_Type_Class_Declaration extends JS_AST_Node_Type {
4
+ constructor(spec = {}) {
5
+ super(spec);
6
+ }
7
+ }
8
+
9
+ module.exports = JS_AST_Node_Type_Class_Declaration;
@@ -0,0 +1,28 @@
1
+ const JS_AST_Node_Type_Class_Declaration = require('./JS_AST_Node_6.1-Type_Class_Declaration');
2
+
3
+ const JS_AST_Node_Feature = require('./JS_AST_Node_Feature/JS_AST_Node_Feature');
4
+
5
+ class JS_AST_Node_Type_Variable_Declaration extends JS_AST_Node_Type_Class_Declaration {
6
+ constructor(spec = {}) {
7
+ super(spec);
8
+
9
+ // Possibly 'Declaration' is a feature.
10
+ // Makes sense really.
11
+
12
+
13
+ // Code that is specific for variable rather than class declarations would be best here.
14
+
15
+
16
+
17
+
18
+
19
+ if (this.type === 'VariableDeclaration') {
20
+ // .declaration.names
21
+ // .declaration.keys
22
+ // .declaration.map
23
+
24
+ }
25
+ }
26
+ }
27
+
28
+ module.exports = JS_AST_Node_Type_Variable_Declaration;