@makano/rew 1.1.73 → 1.2.0
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.
- package/lib/coffeescript/browser.js +144 -139
- package/lib/coffeescript/cake.js +132 -133
- package/lib/coffeescript/coffeescript.js +437 -381
- package/lib/coffeescript/command.js +806 -724
- package/lib/coffeescript/grammar.js +1908 -2474
- package/lib/coffeescript/helpers.js +509 -473
- package/lib/coffeescript/index.js +228 -215
- package/lib/coffeescript/lexer.js +2282 -1909
- package/lib/coffeescript/nodes.js +9782 -9202
- package/lib/coffeescript/optparse.js +255 -227
- package/lib/coffeescript/parser.js +20305 -1265
- package/lib/coffeescript/register.js +107 -87
- package/lib/coffeescript/repl.js +307 -284
- package/lib/coffeescript/rewriter.js +1389 -1079
- package/lib/coffeescript/scope.js +176 -172
- package/lib/coffeescript/sourcemap.js +242 -227
- package/lib/rew/cli/cli.js +288 -186
- package/lib/rew/cli/log.js +31 -32
- package/lib/rew/cli/run.js +10 -12
- package/lib/rew/cli/utils.js +344 -176
- package/lib/rew/const/config_path.js +4 -0
- package/lib/rew/const/default.js +38 -35
- package/lib/rew/const/files.js +9 -9
- package/lib/rew/const/opt.js +8 -8
- package/lib/rew/css/theme.css +2 -2
- package/lib/rew/functions/core.js +55 -57
- package/lib/rew/functions/curl.js +23 -0
- package/lib/rew/functions/emitter.js +52 -55
- package/lib/rew/functions/exec.js +25 -21
- package/lib/rew/functions/export.js +18 -20
- package/lib/rew/functions/fs.js +55 -54
- package/lib/rew/functions/future.js +29 -21
- package/lib/rew/functions/id.js +8 -9
- package/lib/rew/functions/import.js +107 -93
- package/lib/rew/functions/map.js +13 -16
- package/lib/rew/functions/match.js +35 -26
- package/lib/rew/functions/path.js +8 -8
- package/lib/rew/functions/require.js +32 -33
- package/lib/rew/functions/sleep.js +2 -2
- package/lib/rew/functions/stdout.js +20 -20
- package/lib/rew/functions/types.js +96 -95
- package/lib/rew/html/ui.html +12 -13
- package/lib/rew/html/ui.js +205 -168
- package/lib/rew/main.js +14 -14
- package/lib/rew/misc/bin.js +37 -0
- package/lib/rew/misc/findAppInfo.js +16 -0
- package/lib/rew/misc/findAppPath.js +21 -0
- package/lib/rew/misc/req.js +7 -0
- package/lib/rew/misc/seededid.js +13 -0
- package/lib/rew/models/enum.js +12 -12
- package/lib/rew/models/struct.js +30 -32
- package/lib/rew/modules/compiler.js +237 -177
- package/lib/rew/modules/context.js +35 -22
- package/lib/rew/modules/fs.js +10 -10
- package/lib/rew/modules/runtime.js +17 -21
- package/lib/rew/modules/yaml.js +27 -30
- package/lib/rew/pkgs/conf.js +82 -75
- package/lib/rew/pkgs/data.js +12 -7
- package/lib/rew/pkgs/date.js +27 -28
- package/lib/rew/pkgs/env.js +6 -8
- package/lib/rew/pkgs/modules/data/bintree.js +52 -52
- package/lib/rew/pkgs/modules/data/doublylinked.js +85 -85
- package/lib/rew/pkgs/modules/data/linkedList.js +73 -73
- package/lib/rew/pkgs/modules/data/queue.js +19 -20
- package/lib/rew/pkgs/modules/data/stack.js +19 -19
- package/lib/rew/pkgs/modules/threads/worker.js +36 -26
- package/lib/rew/pkgs/modules/ui/classes.js +182 -178
- package/lib/rew/pkgs/pkgs.js +9 -10
- package/lib/rew/pkgs/rune.js +400 -0
- package/lib/rew/pkgs/threads.js +57 -53
- package/lib/rew/pkgs/ui.js +148 -136
- package/lib/rew/qrew/compile.js +12 -0
- package/package.json +11 -4
@@ -1,187 +1,191 @@
|
|
1
1
|
// Generated by CoffeeScript 2.7.0
|
2
|
-
(function() {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
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
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
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
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
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
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
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
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
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
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
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
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
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
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
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
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
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
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
+
// Does this scope have any declared variables?
|
153
|
+
hasDeclarations() {
|
154
|
+
return !!this.declaredVariables().length;
|
155
|
+
}
|
152
156
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
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);
|