jsgui3-server 0.0.75 → 0.0.79

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 (158) 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 +10 -36
  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 +13 -53
  130. package/resources/jsbuilder/Platforms.js +69 -15
  131. package/resources/jsbuilder/Project.js +109 -0
  132. package/resources/jsbuilder/Reference.js +1 -1
  133. package/resources/jsbuilder/Reference_Sequence.js +16 -7
  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 +303 -11
  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 -751
  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
  156. package/resources/jsbuilder/Declaration.js +0 -15
  157. package/resources/jsbuilder/Declaration_Sequence.js +0 -15
  158. package/resources/jsbuilder/JS_File.js +0 -77
@@ -0,0 +1,338 @@
1
+ const babel_node_tools = require('../babel/babel_node_tools');
2
+ const {each} = require('lang-mini');
3
+ const {deep_iterate_babel_node} = babel_node_tools;
4
+ const parser = require('@babel/parser');
5
+ const JS_AST_Node_Core = require('./JS_AST_Node_0-Core');
6
+ const { resolvePlugin } = require('@babel/core');
7
+
8
+ const {type_abbreviations, map_expression_categories, map_literal_categories, map_statement_categories, map_categories} = require('../babel/babel_consts');
9
+ /*
10
+
11
+ module.exports = {
12
+ type_abbreviations: type_abbreviations,
13
+ map_expression_categories: map_expression_categories,
14
+ map_literal_categories: map_literal_categories,
15
+ map_categories: map_categories
16
+ }
17
+
18
+ */
19
+
20
+ const get_category = (type) => {
21
+
22
+ const res = map_categories[type];
23
+ if (!res) {
24
+ console.log('type');
25
+ throw 'NYI';
26
+ }
27
+ return res;
28
+
29
+
30
+ // Literal
31
+
32
+ // Declaration
33
+
34
+ // Declarator
35
+
36
+ // Expression
37
+
38
+ // Statement
39
+
40
+ // Pattern
41
+
42
+ // Identifier - Seem not to fit a category, or be one of its own.
43
+ }
44
+ class JS_AST_Node_Babel extends JS_AST_Node_Core {
45
+ constructor(spec = {}) {
46
+ super(spec);
47
+ // sets the childnodes here.
48
+ // will also make available the relevant bable properties.
49
+ // .babel.type
50
+ let babel_ast; // only for the root node. A root node of JS_AST can have a babel as
51
+ let babel_node, babel_node_file, babel_node_program;
52
+ const babel = {
53
+ // Maybe a parse function here.
54
+ // and a .parsed property.
55
+ }
56
+ if (spec.babel_node) {
57
+ babel_node = babel.node = spec.babel_node;
58
+ // Then it needs to parse it within its own system.
59
+ //
60
+ //const {type} = babel_node;
61
+ //console.log('type', type);
62
+ // Don't do this automatically here.
63
+ //
64
+ // Iterate through the babel node, building a structure that mirrors it and links back to it.
65
+ }
66
+
67
+ const filter_deep_iterate_babel_node = (babel_node, fn_filter, callback) => deep_iterate_babel_node(babel_node, (bn, path, depth) => fn_filter(bn) ? callback(bn, path, depth) : undefined)
68
+ const inner_deep_iterate_babel_node = (babel_node, callback) => filter_deep_iterate_babel_node(babel_node, bn => bn !== babel_node, callback)
69
+
70
+ const get_parent_path = path => {
71
+ let res = path.split('/');
72
+ let res2 = res.slice(0, res.length - 2);
73
+ return res2.join('/') + '/';
74
+ }
75
+
76
+ /*
77
+ const get_babel_node_child_nodes = (babel_node) => {
78
+ const {type} = babel_node;
79
+ if (type === 'VariableDeclaration') {
80
+ return babel_node.declarations;
81
+ } else if (type === 'VariableDeclarator') {
82
+ return [babel_node.id, babel_node.init];
83
+ } else if (type === 'Identifier') {
84
+ return [];
85
+ } else if (type === 'NumericLiteral') {
86
+ return [];
87
+ } else if (type === 'ArrayExpression') {
88
+ return babel_node.elements;
89
+ } else {
90
+ console.log('type', type);
91
+ throw 'NYI';
92
+ }
93
+ }
94
+ */
95
+
96
+
97
+ const load_mirror_structure = () => {
98
+ if (this.root_node === this) {
99
+ const map_nodes_by_path = {};
100
+ const map_babel_nodes_by_path = {};
101
+ const map_js_ast_nodes_by_path = {
102
+ '/': this
103
+ };
104
+ deep_iterate_babel_node(babel_node, (inner_babel_node, path, depth, stop) => {
105
+ //console.log('node.name', node.id?.name);
106
+ //console.log('depth', depth);
107
+
108
+ if (babel_node === inner_babel_node) {
109
+ //throw 'stop';
110
+ } else {
111
+ //console.log('1) path', path);
112
+ //console.log('babel_node.type', babel_node.type);
113
+ const parent_path = get_parent_path(path);
114
+ //console.log('parent_path', parent_path);
115
+ map_babel_nodes_by_path[path] = inner_babel_node;
116
+ const parent_babel_node = map_babel_nodes_by_path[parent_path];
117
+ const parent_js_ast_node = map_js_ast_nodes_by_path[parent_path];
118
+ const new_node = parent_js_ast_node.create_append_child({
119
+ babel_node: inner_babel_node,
120
+ path: path
121
+ });
122
+ map_js_ast_nodes_by_path[path] = new_node;
123
+ }
124
+ })
125
+ } else {
126
+ throw 'stop';
127
+ }
128
+ }
129
+
130
+ Object.defineProperty(this, 'babel', {
131
+
132
+
133
+ get() {
134
+ //console.log('babel object requested');
135
+ return babel;
136
+ },
137
+ enumerable: true,
138
+ configurable: false
139
+ });
140
+
141
+ //if (spec.full_source) {
142
+ // full_source = spec.full_source;
143
+ //}
144
+
145
+
146
+
147
+ // Abbreviated_type....
148
+
149
+
150
+
151
+ //const
152
+
153
+ // May use something (new) from lang-mini or lang-tools to parse the tree easily.
154
+ // Signature_Tree object. Will be abstract in that it's not closely integrated with the AST tree functionality, could be reused elsewhere.
155
+
156
+
157
+
158
+
159
+ Object.defineProperty(babel, 'start', {
160
+ get() { return babel_node.start; },
161
+ //set(newValue) { bValue = newValue; },
162
+ enumerable: true,
163
+ configurable: false
164
+ });
165
+ Object.defineProperty(babel, 'end', {
166
+ get() { return babel_node.end; },
167
+ //set(newValue) { bValue = newValue; },
168
+ enumerable: true,
169
+ configurable: false
170
+ });
171
+ Object.defineProperty(babel, 'name', {
172
+ get() { return babel_node.name; },
173
+ //set(newValue) { bValue = newValue; },
174
+ enumerable: true,
175
+ configurable: true
176
+ });
177
+
178
+
179
+ // only for identifiers.
180
+
181
+
182
+
183
+ Object.defineProperty(babel, 'node', {
184
+ get() {
185
+ return babel_node;
186
+ },
187
+ //set(newValue) { bValue = newValue; },
188
+ enumerable: true,
189
+ configurable: false
190
+ });
191
+ Object.defineProperty(babel, 'type', {
192
+ get() {
193
+ //console.log('babel', babel);
194
+ //console.log('babel_node', babel_node);
195
+ //console.log('babel.node', babel.node);
196
+ return babel_node.type;
197
+ },
198
+ //set(newValue) { bValue = newValue; },
199
+ enumerable: true,
200
+ configurable: false
201
+ });
202
+
203
+ //let category;
204
+ Object.defineProperty(babel, 'category', {
205
+ get() {
206
+ //console.log('babel', babel);
207
+ //console.log('babel_node', babel_node);
208
+ //console.log('babel.node', babel.node);
209
+ //category = ;
210
+ return get_category(babel_node.type);
211
+ },
212
+ //set(newValue) { bValue = newValue; },
213
+ enumerable: true,
214
+ configurable: false
215
+ });
216
+
217
+
218
+ Object.defineProperty(babel, 'is_identifier', {
219
+ get() {
220
+ return babel.type === 'Identifier';
221
+ },
222
+ enumerable: true,
223
+ configurable: false
224
+ });
225
+
226
+ Object.defineProperty(babel, 'is_declaration', {
227
+ get() {
228
+ return babel.type === 'VariableDeclaration' || babel.type === 'ClassDeclaration';
229
+ },
230
+ enumerable: true,
231
+ configurable: false
232
+ });
233
+ Object.defineProperty(babel, 'is_expression', {
234
+ get() {
235
+ return !!map_expression_categories[babel.type];
236
+ },
237
+ enumerable: true,
238
+ configurable: false
239
+ });
240
+ Object.defineProperty(babel, 'is_statement', {
241
+ get() {
242
+ return !!map_statement_categories[babel.type];
243
+ },
244
+ enumerable: true,
245
+ configurable: false
246
+ });
247
+ Object.defineProperty(babel, 'is_literal', {
248
+ get() {
249
+ return !!map_literal_categories[babel.type];
250
+ },
251
+ enumerable: true,
252
+ configurable: false
253
+ });
254
+
255
+
256
+
257
+
258
+
259
+ Object.defineProperty(babel, 'ast', {
260
+ get() {
261
+
262
+ if (this.root === this) {
263
+
264
+ } else {
265
+ // will return undefined, for the moment
266
+ }
267
+ },
268
+ set(val) { bValue = newValue; },
269
+ enumerable: true,
270
+ configurable: false
271
+ });
272
+
273
+ if (this.root_node === this) {
274
+
275
+ //console.log('babel_node', babel_node);
276
+
277
+ if (!babel_node) {
278
+ const {source} = this;
279
+ //console.log('source', source);
280
+ const babel_ast = parser.parse(source, {
281
+ sourceType: 'module',
282
+ plugins: [
283
+ 'asyncGenerators',
284
+ 'bigInt',
285
+ 'classPrivateMethods',
286
+ 'classPrivateProperties',
287
+ 'classProperties',
288
+ 'doExpressions',
289
+ //'exportDefaultFrom',
290
+ 'nullishCoalescingOperator',
291
+ 'numericSeparator',
292
+ 'objectRestSpread',
293
+ 'optionalCatchBinding',
294
+ 'optionalChaining',
295
+ ]});
296
+
297
+ //console.log('babel_ast', babel_ast);
298
+
299
+ babel_node_file = babel_ast;
300
+ babel_node_program = babel_ast.program;
301
+
302
+ //console.log('babel_node_program', babel_node_program);
303
+
304
+ const {body} = babel_node_program;
305
+
306
+ if (body.length === 1) {
307
+ const node0 = body[0];
308
+
309
+ babel_node = node0;
310
+ } else {
311
+ throw 'NYI';
312
+ }
313
+ //throw 'stop';
314
+ }
315
+ //throw 'stop';
316
+ if (babel_node) {
317
+ //console.log('1) babel_node', babel_node);
318
+ const {type} = babel_node;
319
+ //if (true || type === 'File') {
320
+ load_mirror_structure({
321
+ root_node: this.root_node
322
+ });
323
+ //}
324
+ } else {
325
+
326
+
327
+ }
328
+
329
+ }
330
+
331
+ }
332
+ }
333
+ JS_AST_Node_Babel.from_babel_node = (spec) => {
334
+ return new JS_AST_Node_Babel(spec);
335
+ }
336
+
337
+
338
+ module.exports = JS_AST_Node_Babel;
@@ -0,0 +1,40 @@
1
+
2
+ // Coming up with a new version based on the plan.
3
+ // Want to hold the compressed version. Hold a reference to the new version which has has the compression run.
4
+
5
+ const JS_AST_Node_Planning = require('./JS_AST_Node_9-Planning');
6
+
7
+ class JS_AST_Node_Changing extends JS_AST_Node_Planning {
8
+ constructor(spec = {}) {
9
+ super(spec);
10
+
11
+ // sets the childnodes here.
12
+ // will also make available the relevant bable properties.
13
+
14
+ // Use the lower level tools to kind of understand the node.
15
+ // Provide property getters that will do this.
16
+
17
+ // Seeing what pattern / recognised object / pattern it is.
18
+
19
+ let compressed_version;
20
+
21
+ const get_compressed_version = () => {
22
+ // Compress the inner local variables.
23
+ //
24
+
25
+ // Will compare original and compressed source.
26
+ }
27
+
28
+ Object.defineProperty(this, 'compressed_version', {
29
+ get() {
30
+ if (!compressed_version) compressed_version = get_compressed_version();
31
+ return compressed_version;
32
+ },
33
+ //set(newValue) { bValue = newValue; },
34
+ enumerable: true,
35
+ configurable: false
36
+ });
37
+ }
38
+ }
39
+
40
+ module.exports = JS_AST_Node_Changing;
@@ -0,0 +1,97 @@
1
+
2
+
3
+ const JS_AST_Node_Basics_Babel = require('./JS_AST_Node_1-Babel');
4
+
5
+ const JS_AST_Relationship_Node_To_Group = require('./JS_AST_Relationship_Node_To_Group');
6
+
7
+ const JS_AST_Group_Shared = require('./JS_AST_Group_Shared');
8
+
9
+ class JS_AST_Node_Child extends JS_AST_Node_Basics_Babel {
10
+ constructor(spec = {}) {
11
+ super(spec);
12
+ const {each_child_node} = this;
13
+
14
+ const select_child_nodes = fn_select => {
15
+ const res = [];
16
+ filter_each_child_node(fn_select, cn => res.push(cn));
17
+ return res;
18
+ }
19
+
20
+ // Make it a Relationship_Group.
21
+ // Node_To_Group_Relationship
22
+
23
+ // JS_AST_Relationship_Node_To_Group
24
+
25
+ const child = new JS_AST_Relationship_Node_To_Group({
26
+ origin: this,
27
+ name: 'child'//,
28
+ //obtainer: () => this.child_nodes,
29
+ //iterator: callback => each(this.child_nodes, callback),
30
+ //each: callback => each(this.child_nodes, callback)//,
31
+ //select: fn_select => select_child_nodes(fn_select)
32
+ });
33
+
34
+ // Group properties....
35
+
36
+ /*
37
+ let child_shared_type;
38
+
39
+ // Could benefit from making some kind of group shared class
40
+ // so the shared type property definition would work on multiple different groups.
41
+ // as would a find function.
42
+
43
+
44
+
45
+
46
+ //child.shared = {
47
+
48
+ //}
49
+
50
+ Object.defineProperty(child.shared, 'type', {
51
+ get() {
52
+ if (child_shared_type === undefined) {
53
+ each_child_node((cn, idx, stop) => {
54
+ if (child_shared_type === undefined) {
55
+ child_shared_type = cn.type;
56
+ } else {
57
+ if (cn.type === child_shared_type) {
58
+ // all good
59
+ } else {
60
+ child_shared_type = false;
61
+ stop();
62
+ }
63
+ }
64
+
65
+ })
66
+ }
67
+ return child_shared_type;
68
+ //return child_nodes.length;
69
+ },
70
+ enumerable: true,
71
+ configurable: false
72
+ });
73
+ */
74
+
75
+
76
+ /*
77
+ const find_child_node = (finder, callback) => {
78
+ let res;
79
+ each_child_node((cn, idx, stop) => {
80
+ if (finder(cn)) {
81
+ res = cn;
82
+ stop();
83
+ }
84
+ });
85
+ return res;
86
+ }
87
+ */
88
+
89
+
90
+
91
+ let arr_child_types;
92
+ let arr_child_categories;
93
+ this.child = child;
94
+ }
95
+ }
96
+
97
+ module.exports = JS_AST_Node_Child
@@ -0,0 +1,38 @@
1
+
2
+
3
+ const JS_AST_Node_Basics_Child = require('./JS_AST_Node_2.1.1-Child');
4
+
5
+ const JS_AST_Relationship_Node_Within_Group_To_Node = require('./JS_AST_Relationship_Node_Within_Group_To_Node');
6
+
7
+ class JS_AST_Node_Parent extends JS_AST_Node_Basics_Child {
8
+ constructor(spec = {}) {
9
+ super(spec);
10
+ const {each_inner_node} = this;
11
+
12
+
13
+ // Make it a Relationship_Group.
14
+ // Node_To_Group_Relationship
15
+
16
+ // JS_AST_Relationship_Node_To_Group
17
+
18
+ // Do we have the index within parent?
19
+ // Could change the construction algo lower down so it's given - it's useful.
20
+
21
+
22
+ const parent = new JS_AST_Relationship_Node_Within_Group_To_Node({
23
+ origin: this,
24
+ name: 'parent',
25
+ node: this.parent_node
26
+ //obtainer: () => this.child_nodes,
27
+ //iterator: callback => each(this.child_nodes, callback),
28
+ //each: callback => each(this.child_nodes, callback)//,
29
+ //select: fn_select => select_child_nodes(fn_select)
30
+ });
31
+
32
+ // Group properties....
33
+
34
+ this.parent = parent;
35
+ }
36
+ }
37
+
38
+ module.exports = JS_AST_Node_Parent
@@ -0,0 +1,62 @@
1
+
2
+
3
+ const JS_AST_Node_Basics_Parent = require('./JS_AST_Node_2.1.2-Parent');
4
+
5
+ const JS_AST_Relationship_Node_To_Group = require('./JS_AST_Relationship_Node_To_Group');
6
+
7
+ class JS_AST_Node_Ancestor extends JS_AST_Node_Basics_Parent {
8
+ constructor(spec = {}) {
9
+ super(spec);
10
+ const {each_inner_node} = this;
11
+
12
+
13
+ // Make it a Relationship_Group.
14
+ // Node_To_Group_Relationship
15
+
16
+ // JS_AST_Relationship_Node_To_Group
17
+
18
+ // index (of ancestors)
19
+
20
+ const ancestor = new JS_AST_Relationship_Node_To_Group({
21
+ origin: this,
22
+ name: 'ancestor'//,
23
+ //obtainer: () => this.child_nodes,
24
+ //iterator: callback => each(this.child_nodes, callback),
25
+ //each: callback => each(this.child_nodes, callback)//,
26
+ //select: fn_select => select_child_nodes(fn_select)
27
+ });
28
+
29
+ // Group properties....
30
+
31
+
32
+ const parent = this.parent;
33
+ let gparent, ggparent;
34
+ if (parent.node) {
35
+ gparent = parent.node.parent;
36
+ if (gparent && gparent.node) {
37
+ ggparent = gparent.node.parent;
38
+ }
39
+
40
+ }
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+ Object.assign(this, {
50
+ ancestor: ancestor,
51
+ gparent: gparent,
52
+ ggparent: ggparent
53
+ });
54
+
55
+
56
+ this.ancestor = ancestor;
57
+ this.gparent = gparent;
58
+ this.ggparent = ggparent;
59
+ }
60
+ }
61
+
62
+ module.exports = JS_AST_Node_Ancestor
@@ -0,0 +1,44 @@
1
+
2
+
3
+ const JS_AST_Node_Ancestor = require('./JS_AST_Node_2.1.3-Ancestor');
4
+
5
+ const JS_AST_Relationship_Node_To_Group = require('./JS_AST_Relationship_Node_To_Group');
6
+
7
+ class JS_AST_Node_Inner extends JS_AST_Node_Ancestor {
8
+ constructor(spec = {}) {
9
+ super(spec);
10
+ const {each_inner_node} = this;
11
+
12
+
13
+ // Make it a Relationship_Group.
14
+ // Node_To_Group_Relationship
15
+
16
+ // JS_AST_Relationship_Node_To_Group
17
+
18
+ const inner = new JS_AST_Relationship_Node_To_Group({
19
+ origin: this,
20
+ name: 'inner'//,
21
+ //obtainer: () => this.child_nodes,
22
+ //iterator: callback => each(this.child_nodes, callback),
23
+ //each: callback => each(this.child_nodes, callback)//,
24
+ //select: fn_select => select_child_nodes(fn_select)
25
+ });
26
+
27
+ // Group properties....
28
+
29
+ // Make a shared property class?
30
+ // Group_Shared_Properties class
31
+
32
+
33
+ // Group_Shared_Property type possibly?
34
+
35
+ //inner.shared = {
36
+
37
+ //}
38
+
39
+
40
+ this.inner = inner;
41
+ }
42
+ }
43
+
44
+ module.exports = JS_AST_Node_Inner
@@ -0,0 +1,73 @@
1
+
2
+
3
+ const JS_AST_Node_Inner = require('./JS_AST_Node_2.2-Inner');
4
+
5
+ const JS_AST_Relationship_Node_To_Group = require('./JS_AST_Relationship_Node_To_Group');
6
+
7
+ class JS_AST_Node_All extends JS_AST_Node_Inner {
8
+ constructor(spec = {}) {
9
+ super(spec);
10
+ const {deep_iterate} = this;
11
+
12
+
13
+ // Make it a Relationship_Group.
14
+ // Node_To_Group_Relationship
15
+
16
+ // JS_AST_Relationship_Node_To_Group
17
+
18
+ const all = new JS_AST_Relationship_Node_To_Group({
19
+ origin: this,
20
+ name: 'all'//,
21
+ //obtainer: () => this.child_nodes,
22
+ //iterator: callback => each(this.child_nodes, callback),
23
+ //each: callback => each(this.child_nodes, callback)//,
24
+ //select: fn_select => select_child_nodes(fn_select)
25
+ });
26
+
27
+ // Group properties....
28
+
29
+ /*
30
+
31
+ let all_shared_type;
32
+
33
+ // Make a shared property class?
34
+ // Group_Shared_Properties class
35
+
36
+ // Just a group_shared class for the moment.
37
+
38
+
39
+
40
+
41
+ all.shared = {
42
+
43
+ }
44
+
45
+ Object.defineProperty(all.shared, 'type', {
46
+ get() {
47
+ if (all_shared_type === undefined) {
48
+ deep_iterate((cn, idx, stop) => {
49
+ if (all_shared_type === undefined) {
50
+ all_shared_type = cn.type;
51
+ } else {
52
+ if (cn.type === all_shared_type) {
53
+ // all good
54
+ } else {
55
+ all_shared_type = false;
56
+ stop();
57
+ }
58
+ }
59
+
60
+ })
61
+ }
62
+ return child_shared_type;
63
+ //return child_nodes.length;
64
+ },
65
+ enumerable: true,
66
+ configurable: false
67
+ });
68
+ */
69
+ this.all = all;
70
+ }
71
+ }
72
+
73
+ module.exports = JS_AST_Node_All