@makano/rew 1.1.81 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. package/lib/coffeescript/browser.js +144 -139
  2. package/lib/coffeescript/cake.js +132 -133
  3. package/lib/coffeescript/coffeescript.js +437 -381
  4. package/lib/coffeescript/command.js +806 -724
  5. package/lib/coffeescript/grammar.js +1908 -2474
  6. package/lib/coffeescript/helpers.js +509 -473
  7. package/lib/coffeescript/index.js +228 -215
  8. package/lib/coffeescript/lexer.js +2282 -1909
  9. package/lib/coffeescript/nodes.js +9782 -9202
  10. package/lib/coffeescript/optparse.js +255 -227
  11. package/lib/coffeescript/parser.js +20305 -1265
  12. package/lib/coffeescript/register.js +107 -87
  13. package/lib/coffeescript/repl.js +307 -284
  14. package/lib/coffeescript/rewriter.js +1389 -1079
  15. package/lib/coffeescript/scope.js +176 -172
  16. package/lib/coffeescript/sourcemap.js +242 -227
  17. package/lib/rew/cli/cli.js +312 -239
  18. package/lib/rew/cli/log.js +27 -27
  19. package/lib/rew/cli/run.js +8 -8
  20. package/lib/rew/cli/utils.js +368 -199
  21. package/lib/rew/const/config_path.js +2 -2
  22. package/lib/rew/const/default.js +38 -53
  23. package/lib/rew/const/files.js +11 -14
  24. package/lib/rew/const/opt.js +6 -6
  25. package/lib/rew/css/theme.css +1 -1
  26. package/lib/rew/functions/core.js +55 -55
  27. package/lib/rew/functions/curl.js +23 -0
  28. package/lib/rew/functions/emitter.js +52 -55
  29. package/lib/rew/functions/exec.js +25 -25
  30. package/lib/rew/functions/export.js +17 -17
  31. package/lib/rew/functions/fs.js +57 -59
  32. package/lib/rew/functions/future.js +29 -21
  33. package/lib/rew/functions/id.js +8 -9
  34. package/lib/rew/functions/import.js +106 -122
  35. package/lib/rew/functions/map.js +10 -10
  36. package/lib/rew/functions/match.js +35 -42
  37. package/lib/rew/functions/path.js +8 -8
  38. package/lib/rew/functions/require.js +32 -36
  39. package/lib/rew/functions/sleep.js +2 -2
  40. package/lib/rew/functions/stdout.js +18 -18
  41. package/lib/rew/functions/types.js +82 -106
  42. package/lib/rew/html/ui.html +12 -12
  43. package/lib/rew/html/ui.js +196 -201
  44. package/lib/rew/main.js +14 -14
  45. package/lib/rew/misc/bin.js +37 -0
  46. package/lib/rew/misc/findAppInfo.js +13 -13
  47. package/lib/rew/misc/findAppPath.js +15 -15
  48. package/lib/rew/misc/req.js +7 -0
  49. package/lib/rew/misc/seededid.js +8 -8
  50. package/lib/rew/models/enum.js +12 -12
  51. package/lib/rew/models/struct.js +30 -32
  52. package/lib/rew/modules/compiler.js +237 -209
  53. package/lib/rew/modules/fs.js +10 -10
  54. package/lib/rew/modules/runtime.js +17 -21
  55. package/lib/rew/modules/yaml.js +27 -30
  56. package/lib/rew/pkgs/conf.js +82 -92
  57. package/lib/rew/pkgs/data.js +10 -10
  58. package/lib/rew/pkgs/date.js +27 -27
  59. package/lib/rew/pkgs/env.js +5 -5
  60. package/lib/rew/pkgs/modules/data/bintree.js +51 -51
  61. package/lib/rew/pkgs/modules/data/doublylinked.js +84 -84
  62. package/lib/rew/pkgs/modules/data/linkedList.js +72 -72
  63. package/lib/rew/pkgs/modules/data/queue.js +18 -18
  64. package/lib/rew/pkgs/modules/data/stack.js +18 -18
  65. package/lib/rew/pkgs/modules/threads/worker.js +36 -36
  66. package/lib/rew/pkgs/modules/ui/classes.js +181 -184
  67. package/lib/rew/pkgs/pkgs.js +9 -9
  68. package/lib/rew/pkgs/rune.js +373 -410
  69. package/lib/rew/pkgs/threads.js +62 -66
  70. package/lib/rew/pkgs/ui.js +148 -160
  71. package/lib/rew/qrew/compile.js +12 -0
  72. package/package.json +4 -3
@@ -1,187 +1,191 @@
1
1
  // Generated by CoffeeScript 2.7.0
2
- (function() {
3
- // The **Scope** class regulates lexical scoping within CoffeeScript. As you
4
- // generate code, you create a tree of scopes in the same shape as the nested
5
- // function bodies. Each scope knows about the variables declared within it,
6
- // and has a reference to its parent enclosing scope. In this way, we know which
7
- // variables are new and need to be declared with `var`, and which are shared
8
- // with external scopes.
9
- var Scope,
10
- indexOf = [].indexOf;
2
+ (function () {
3
+ // The **Scope** class regulates lexical scoping within CoffeeScript. As you
4
+ // generate code, you create a tree of scopes in the same shape as the nested
5
+ // function bodies. Each scope knows about the variables declared within it,
6
+ // and has a reference to its parent enclosing scope. In this way, we know which
7
+ // variables are new and need to be declared with `var`, and which are shared
8
+ // with external scopes.
9
+ var Scope,
10
+ indexOf = [].indexOf;
11
11
 
12
- exports.Scope = Scope = class Scope {
13
- // Initialize a scope with its parent, for lookups up the chain,
14
- // as well as a reference to the **Block** node it belongs to, which is
15
- // where it should declare its variables, a reference to the function that
16
- // it belongs to, and a list of variables referenced in the source code
17
- // and therefore should be avoided when generating variables. Also track comments
18
- // that should be output as part of variable declarations.
19
- constructor(parent, expressions, method, referencedVars) {
20
- var ref, ref1;
21
- this.parent = parent;
22
- this.expressions = expressions;
23
- this.method = method;
24
- this.referencedVars = referencedVars;
25
- this.variables = [
26
- {
27
- name: 'arguments',
28
- type: 'arguments'
29
- }
30
- ];
31
- this.comments = {};
32
- this.positions = {};
33
- if (!this.parent) {
34
- this.utilities = {};
35
- }
36
- // The `@root` is the top-level **Scope** object for a given file.
37
- this.root = (ref = (ref1 = this.parent) != null ? ref1.root : void 0) != null ? ref : this;
38
- }
12
+ exports.Scope = Scope = class Scope {
13
+ // Initialize a scope with its parent, for lookups up the chain,
14
+ // as well as a reference to the **Block** node it belongs to, which is
15
+ // where it should declare its variables, a reference to the function that
16
+ // it belongs to, and a list of variables referenced in the source code
17
+ // and therefore should be avoided when generating variables. Also track comments
18
+ // that should be output as part of variable declarations.
19
+ constructor(parent, expressions, method, referencedVars) {
20
+ var ref, ref1;
21
+ this.parent = parent;
22
+ this.expressions = expressions;
23
+ this.method = method;
24
+ this.referencedVars = referencedVars;
25
+ this.variables = [
26
+ {
27
+ name: 'arguments',
28
+ type: 'arguments',
29
+ },
30
+ ];
31
+ this.comments = {};
32
+ this.positions = {};
33
+ if (!this.parent) {
34
+ this.utilities = {};
35
+ }
36
+ // The `@root` is the top-level **Scope** object for a given file.
37
+ this.root = (ref = (ref1 = this.parent) != null ? ref1.root : void 0) != null ? ref : this;
38
+ }
39
39
 
40
- // Adds a new variable or overrides an existing one.
41
- add(name, type, immediate) {
42
- if (this.shared && !immediate) {
43
- return this.parent.add(name, type, immediate);
44
- }
45
- if (Object.prototype.hasOwnProperty.call(this.positions, name)) {
46
- return this.variables[this.positions[name]].type = type;
47
- } else {
48
- return this.positions[name] = this.variables.push({name, type}) - 1;
49
- }
50
- }
40
+ // Adds a new variable or overrides an existing one.
41
+ add(name, type, immediate) {
42
+ if (this.shared && !immediate) {
43
+ return this.parent.add(name, type, immediate);
44
+ }
45
+ if (Object.prototype.hasOwnProperty.call(this.positions, name)) {
46
+ return (this.variables[this.positions[name]].type = type);
47
+ } else {
48
+ return (this.positions[name] = this.variables.push({ name, type }) - 1);
49
+ }
50
+ }
51
51
 
52
- // When `super` is called, we need to find the name of the current method we're
53
- // in, so that we know how to invoke the same method of the parent class. This
54
- // can get complicated if super is being called from an inner function.
55
- // `namedMethod` will walk up the scope tree until it either finds the first
56
- // function object that has a name filled in, or bottoms out.
57
- namedMethod() {
58
- var ref;
59
- if (((ref = this.method) != null ? ref.name : void 0) || !this.parent) {
60
- return this.method;
61
- }
62
- return this.parent.namedMethod();
63
- }
52
+ // When `super` is called, we need to find the name of the current method we're
53
+ // in, so that we know how to invoke the same method of the parent class. This
54
+ // can get complicated if super is being called from an inner function.
55
+ // `namedMethod` will walk up the scope tree until it either finds the first
56
+ // function object that has a name filled in, or bottoms out.
57
+ namedMethod() {
58
+ var ref;
59
+ if (((ref = this.method) != null ? ref.name : void 0) || !this.parent) {
60
+ return this.method;
61
+ }
62
+ return this.parent.namedMethod();
63
+ }
64
64
 
65
- // Look up a variable name in lexical scope, and declare it if it does not
66
- // already exist.
67
- find(name, type = 'var') {
68
- if (this.check(name)) {
69
- return true;
70
- }
71
- this.add(name, type);
72
- return false;
73
- }
65
+ // Look up a variable name in lexical scope, and declare it if it does not
66
+ // already exist.
67
+ find(name, type = 'var') {
68
+ if (this.check(name)) {
69
+ return true;
70
+ }
71
+ this.add(name, type);
72
+ return false;
73
+ }
74
74
 
75
- // Reserve a variable name as originating from a function parameter for this
76
- // scope. No `var` required for internal references.
77
- parameter(name) {
78
- if (this.shared && this.parent.check(name, true)) {
79
- return;
80
- }
81
- return this.add(name, 'param');
82
- }
75
+ // Reserve a variable name as originating from a function parameter for this
76
+ // scope. No `var` required for internal references.
77
+ parameter(name) {
78
+ if (this.shared && this.parent.check(name, true)) {
79
+ return;
80
+ }
81
+ return this.add(name, 'param');
82
+ }
83
83
 
84
- // Just check to see if a variable has already been declared, without reserving,
85
- // walks up to the root scope.
86
- check(name) {
87
- var ref;
88
- return !!(this.type(name) || ((ref = this.parent) != null ? ref.check(name) : void 0));
89
- }
84
+ // Just check to see if a variable has already been declared, without reserving,
85
+ // walks up to the root scope.
86
+ check(name) {
87
+ var ref;
88
+ return !!(this.type(name) || ((ref = this.parent) != null ? ref.check(name) : void 0));
89
+ }
90
90
 
91
- // Generate a temporary variable name at the given index.
92
- temporary(name, index, single = false) {
93
- var diff, endCode, letter, newCode, num, startCode;
94
- if (single) {
95
- startCode = name.charCodeAt(0);
96
- endCode = 'z'.charCodeAt(0);
97
- diff = endCode - startCode;
98
- newCode = startCode + index % (diff + 1);
99
- letter = String.fromCharCode(newCode);
100
- num = Math.floor(index / (diff + 1));
101
- return `${letter}${num || ''}`;
102
- } else {
103
- return `${name}${index || ''}`;
104
- }
105
- }
91
+ // Generate a temporary variable name at the given index.
92
+ temporary(name, index, single = false) {
93
+ var diff, endCode, letter, newCode, num, startCode;
94
+ if (single) {
95
+ startCode = name.charCodeAt(0);
96
+ endCode = 'z'.charCodeAt(0);
97
+ diff = endCode - startCode;
98
+ newCode = startCode + (index % (diff + 1));
99
+ letter = String.fromCharCode(newCode);
100
+ num = Math.floor(index / (diff + 1));
101
+ return `${letter}${num || ''}`;
102
+ } else {
103
+ return `${name}${index || ''}`;
104
+ }
105
+ }
106
106
 
107
- // Gets the type of a variable.
108
- type(name) {
109
- var i, len, ref, v;
110
- ref = this.variables;
111
- for (i = 0, len = ref.length; i < len; i++) {
112
- v = ref[i];
113
- if (v.name === name) {
114
- return v.type;
115
- }
116
- }
117
- return null;
118
- }
107
+ // Gets the type of a variable.
108
+ type(name) {
109
+ var i, len, ref, v;
110
+ ref = this.variables;
111
+ for (i = 0, len = ref.length; i < len; i++) {
112
+ v = ref[i];
113
+ if (v.name === name) {
114
+ return v.type;
115
+ }
116
+ }
117
+ return null;
118
+ }
119
119
 
120
- // If we need to store an intermediate result, find an available name for a
121
- // compiler-generated variable. `_var`, `_var2`, and so on...
122
- freeVariable(name, options = {}) {
123
- var index, ref, temp;
124
- index = 0;
125
- while (true) {
126
- temp = this.temporary(name, index, options.single);
127
- if (!(this.check(temp) || indexOf.call(this.root.referencedVars, temp) >= 0)) {
128
- break;
129
- }
130
- index++;
131
- }
132
- if ((ref = options.reserve) != null ? ref : true) {
133
- this.add(temp, 'var', true);
134
- }
135
- return temp;
136
- }
120
+ // If we need to store an intermediate result, find an available name for a
121
+ // compiler-generated variable. `_var`, `_var2`, and so on...
122
+ freeVariable(name, options = {}) {
123
+ var index, ref, temp;
124
+ index = 0;
125
+ while (true) {
126
+ temp = this.temporary(name, index, options.single);
127
+ if (!(this.check(temp) || indexOf.call(this.root.referencedVars, temp) >= 0)) {
128
+ break;
129
+ }
130
+ index++;
131
+ }
132
+ if ((ref = options.reserve) != null ? ref : true) {
133
+ this.add(temp, 'var', true);
134
+ }
135
+ return temp;
136
+ }
137
137
 
138
- // Ensure that an assignment is made at the top of this scope
139
- // (or at the top-level scope, if requested).
140
- assign(name, value) {
141
- this.add(name, {
142
- value,
143
- assigned: true
144
- }, true);
145
- return this.hasAssignments = true;
146
- }
138
+ // Ensure that an assignment is made at the top of this scope
139
+ // (or at the top-level scope, if requested).
140
+ assign(name, value) {
141
+ this.add(
142
+ name,
143
+ {
144
+ value,
145
+ assigned: true,
146
+ },
147
+ true,
148
+ );
149
+ return (this.hasAssignments = true);
150
+ }
147
151
 
148
- // Does this scope have any declared variables?
149
- hasDeclarations() {
150
- return !!this.declaredVariables().length;
151
- }
152
+ // Does this scope have any declared variables?
153
+ hasDeclarations() {
154
+ return !!this.declaredVariables().length;
155
+ }
152
156
 
153
- // Return the list of variables first declared in this scope.
154
- declaredVariables() {
155
- var v;
156
- return ((function() {
157
- var i, len, ref, results;
158
- ref = this.variables;
159
- results = [];
160
- for (i = 0, len = ref.length; i < len; i++) {
161
- v = ref[i];
162
- if (v.type === 'var') {
163
- results.push(v.name);
164
- }
165
- }
166
- return results;
167
- }).call(this)).sort();
168
- }
169
-
170
- // Return the list of assignments that are supposed to be made at the top
171
- // of this scope.
172
- assignedVariables() {
173
- var i, len, ref, results, v;
174
- ref = this.variables;
175
- results = [];
176
- for (i = 0, len = ref.length; i < len; i++) {
177
- v = ref[i];
178
- if (v.type.assigned) {
179
- results.push(`${v.name} = ${v.type.value}`);
180
- }
181
- }
182
- return results;
183
- }
184
-
185
- };
157
+ // Return the list of variables first declared in this scope.
158
+ declaredVariables() {
159
+ var v;
160
+ return function () {
161
+ var i, len, ref, results;
162
+ ref = this.variables;
163
+ results = [];
164
+ for (i = 0, len = ref.length; i < len; i++) {
165
+ v = ref[i];
166
+ if (v.type === 'var') {
167
+ results.push(v.name);
168
+ }
169
+ }
170
+ return results;
171
+ }
172
+ .call(this)
173
+ .sort();
174
+ }
186
175
 
176
+ // Return the list of assignments that are supposed to be made at the top
177
+ // of this scope.
178
+ assignedVariables() {
179
+ var i, len, ref, results, v;
180
+ ref = this.variables;
181
+ results = [];
182
+ for (i = 0, len = ref.length; i < len; i++) {
183
+ v = ref[i];
184
+ if (v.type.assigned) {
185
+ results.push(`${v.name} = ${v.type.value}`);
186
+ }
187
+ }
188
+ return results;
189
+ }
190
+ };
187
191
  }).call(this);