@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,229 +1,244 @@
|
|
1
1
|
// Generated by CoffeeScript 2.7.0
|
2
|
-
(function() {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
2
|
+
(function () {
|
3
|
+
// Source maps allow JavaScript runtimes to match running JavaScript back to
|
4
|
+
// the original source code that corresponds to it. This can be minified
|
5
|
+
// JavaScript, but in our case, we're concerned with mapping pretty-printed
|
6
|
+
// JavaScript back to CoffeeScript.
|
7
|
+
|
8
|
+
// In order to produce maps, we must keep track of positions (line number, column number)
|
9
|
+
// that originated every node in the syntax tree, and be able to generate a
|
10
|
+
// [map file](https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit)
|
11
|
+
// — which is a compact, VLQ-encoded representation of the JSON serialization
|
12
|
+
// of this information — to write out alongside the generated JavaScript.
|
13
|
+
|
14
|
+
// LineMap
|
15
|
+
// -------
|
16
|
+
|
17
|
+
// A **LineMap** object keeps track of information about original line and column
|
18
|
+
// positions for a single line of output JavaScript code.
|
19
|
+
// **SourceMaps** are implemented in terms of **LineMaps**.
|
20
|
+
var LineMap, SourceMap;
|
21
|
+
|
22
|
+
LineMap = class LineMap {
|
23
|
+
constructor(line1) {
|
24
|
+
this.line = line1;
|
25
|
+
this.columns = [];
|
26
|
+
}
|
27
|
+
|
28
|
+
add(column, [sourceLine, sourceColumn], options = {}) {
|
29
|
+
if (this.columns[column] && options.noReplace) {
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
return (this.columns[column] = {
|
33
|
+
line: this.line,
|
34
|
+
column,
|
35
|
+
sourceLine,
|
36
|
+
sourceColumn,
|
37
|
+
});
|
38
|
+
}
|
39
|
+
|
40
|
+
sourceLocation(column) {
|
41
|
+
var mapping;
|
42
|
+
while (!((mapping = this.columns[column]) || column <= 0)) {
|
43
|
+
column--;
|
44
|
+
}
|
45
|
+
return mapping && [mapping.sourceLine, mapping.sourceColumn];
|
46
|
+
}
|
47
|
+
};
|
48
|
+
|
49
|
+
SourceMap = function () {
|
50
|
+
var BASE64_CHARS, VLQ_CONTINUATION_BIT, VLQ_SHIFT, VLQ_VALUE_MASK;
|
51
|
+
|
52
|
+
// SourceMap
|
53
|
+
// ---------
|
54
|
+
|
55
|
+
// Maps locations in a single generated JavaScript file back to locations in
|
56
|
+
// the original CoffeeScript source file.
|
57
|
+
|
58
|
+
// This is intentionally agnostic towards how a source map might be represented on
|
59
|
+
// disk. Once the compiler is ready to produce a "v3"-style source map, we can walk
|
60
|
+
// through the arrays of line and column buffer to produce it.
|
61
|
+
class SourceMap {
|
62
|
+
constructor() {
|
63
|
+
this.lines = [];
|
64
|
+
}
|
65
|
+
|
66
|
+
// Adds a mapping to this SourceMap. `sourceLocation` and `generatedLocation`
|
67
|
+
// are both `[line, column]` arrays. If `options.noReplace` is true, then if there
|
68
|
+
// is already a mapping for the specified `line` and `column`, this will have no
|
69
|
+
// effect.
|
70
|
+
add(sourceLocation, generatedLocation, options = {}) {
|
71
|
+
var base, column, line, lineMap;
|
72
|
+
[line, column] = generatedLocation;
|
73
|
+
lineMap = (base = this.lines)[line] || (base[line] = new LineMap(line));
|
74
|
+
return lineMap.add(column, sourceLocation, options);
|
75
|
+
}
|
76
|
+
|
77
|
+
// Look up the original position of a given `line` and `column` in the generated
|
78
|
+
// code.
|
79
|
+
sourceLocation([line, column]) {
|
80
|
+
var lineMap;
|
81
|
+
while (!((lineMap = this.lines[line]) || line <= 0)) {
|
82
|
+
line--;
|
83
|
+
}
|
84
|
+
return lineMap && lineMap.sourceLocation(column);
|
85
|
+
}
|
86
|
+
|
87
|
+
static registerCompiled(filename, source, sourcemap) {
|
88
|
+
if (sourcemap != null) {
|
89
|
+
return (SourceMap.sourceMaps[filename] = sourcemap);
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
static getSourceMap(filename) {
|
94
|
+
return SourceMap.sourceMaps[filename];
|
95
|
+
}
|
96
|
+
|
97
|
+
// V3 SourceMap Generation
|
98
|
+
// -----------------------
|
99
|
+
|
100
|
+
// Builds up a V3 source map, returning the generated JSON as a string.
|
101
|
+
// `options.sourceRoot` may be used to specify the sourceRoot written to the source
|
102
|
+
// map. Also, `options.sourceFiles` and `options.generatedFile` may be passed to
|
103
|
+
// set "sources" and "file", respectively.
|
104
|
+
generate(options = {}, code = null) {
|
105
|
+
var buffer,
|
106
|
+
i,
|
107
|
+
j,
|
108
|
+
lastColumn,
|
109
|
+
lastSourceColumn,
|
110
|
+
lastSourceLine,
|
111
|
+
len,
|
112
|
+
len1,
|
113
|
+
lineMap,
|
114
|
+
lineNumber,
|
115
|
+
mapping,
|
116
|
+
needComma,
|
117
|
+
ref,
|
118
|
+
ref1,
|
119
|
+
sources,
|
120
|
+
v3,
|
121
|
+
writingline;
|
122
|
+
writingline = 0;
|
123
|
+
lastColumn = 0;
|
124
|
+
lastSourceLine = 0;
|
125
|
+
lastSourceColumn = 0;
|
126
|
+
needComma = false;
|
127
|
+
buffer = '';
|
128
|
+
ref = this.lines;
|
129
|
+
for (lineNumber = i = 0, len = ref.length; i < len; lineNumber = ++i) {
|
130
|
+
lineMap = ref[lineNumber];
|
131
|
+
if (lineMap) {
|
132
|
+
ref1 = lineMap.columns;
|
133
|
+
for (j = 0, len1 = ref1.length; j < len1; j++) {
|
134
|
+
mapping = ref1[j];
|
135
|
+
if (!mapping) {
|
136
|
+
continue;
|
137
|
+
}
|
138
|
+
while (writingline < mapping.line) {
|
139
|
+
lastColumn = 0;
|
140
|
+
needComma = false;
|
141
|
+
buffer += ';';
|
142
|
+
writingline++;
|
143
|
+
}
|
144
|
+
// Write a comma if we've already written a segment on this line.
|
145
|
+
if (needComma) {
|
146
|
+
buffer += ',';
|
147
|
+
needComma = false;
|
148
|
+
}
|
149
|
+
// Write the next segment. Segments can be 1, 4, or 5 values. If just one, then it
|
150
|
+
// is a generated column which doesn't match anything in the source code.
|
151
|
+
|
152
|
+
// The starting column in the generated source, relative to any previous recorded
|
153
|
+
// column for the current line:
|
154
|
+
buffer += this.encodeVlq(mapping.column - lastColumn);
|
155
|
+
lastColumn = mapping.column;
|
156
|
+
// The index into the list of sources:
|
157
|
+
buffer += this.encodeVlq(0);
|
158
|
+
// The starting line in the original source, relative to the previous source line.
|
159
|
+
buffer += this.encodeVlq(mapping.sourceLine - lastSourceLine);
|
160
|
+
lastSourceLine = mapping.sourceLine;
|
161
|
+
// The starting column in the original source, relative to the previous column.
|
162
|
+
buffer += this.encodeVlq(mapping.sourceColumn - lastSourceColumn);
|
163
|
+
lastSourceColumn = mapping.sourceColumn;
|
164
|
+
needComma = true;
|
165
|
+
}
|
166
|
+
}
|
167
|
+
}
|
168
|
+
// Produce the canonical JSON object format for a "v3" source map.
|
169
|
+
sources = options.sourceFiles ? options.sourceFiles : options.filename ? [options.filename] : ['<anonymous>'];
|
170
|
+
v3 = {
|
171
|
+
version: 3,
|
172
|
+
file: options.generatedFile || '',
|
173
|
+
sourceRoot: options.sourceRoot || '',
|
174
|
+
sources: sources,
|
175
|
+
names: [],
|
176
|
+
mappings: buffer,
|
177
|
+
};
|
178
|
+
if (options.sourceMap || options.inlineMap) {
|
179
|
+
v3.sourcesContent = [code];
|
180
|
+
}
|
181
|
+
return v3;
|
182
|
+
}
|
183
|
+
|
184
|
+
encodeVlq(value) {
|
185
|
+
var answer, nextChunk, signBit, valueToEncode;
|
186
|
+
answer = '';
|
187
|
+
// Least significant bit represents the sign.
|
188
|
+
signBit = value < 0 ? 1 : 0;
|
189
|
+
// The next bits are the actual value.
|
190
|
+
valueToEncode = (Math.abs(value) << 1) + signBit;
|
191
|
+
// Make sure we encode at least one character, even if valueToEncode is 0.
|
192
|
+
while (valueToEncode || !answer) {
|
193
|
+
nextChunk = valueToEncode & VLQ_VALUE_MASK;
|
194
|
+
valueToEncode = valueToEncode >> VLQ_SHIFT;
|
195
|
+
if (valueToEncode) {
|
196
|
+
nextChunk |= VLQ_CONTINUATION_BIT;
|
197
|
+
}
|
198
|
+
answer += this.encodeBase64(nextChunk);
|
199
|
+
}
|
200
|
+
return answer;
|
201
|
+
}
|
202
|
+
|
203
|
+
encodeBase64(value) {
|
204
|
+
return (
|
205
|
+
BASE64_CHARS[value] ||
|
206
|
+
(function () {
|
207
|
+
throw new Error(`Cannot Base64 encode value: ${value}`);
|
208
|
+
})()
|
209
|
+
);
|
210
|
+
}
|
211
|
+
}
|
212
|
+
|
213
|
+
// Caching
|
214
|
+
// -------
|
215
|
+
|
216
|
+
// A static source maps cache `filename`: `map`. These are used for transforming
|
217
|
+
// stack traces and are currently set in `CoffeeScript.compile` for all files
|
218
|
+
// compiled with the source maps option.
|
219
|
+
SourceMap.sourceMaps = Object.create(null);
|
220
|
+
|
221
|
+
// Base64 VLQ Encoding
|
222
|
+
// -------------------
|
223
|
+
|
224
|
+
// Note that SourceMap VLQ encoding is "backwards". MIDI-style VLQ encoding puts
|
225
|
+
// the most-significant-bit (MSB) from the original value into the MSB of the VLQ
|
226
|
+
// encoded value (see [Wikipedia](https://en.wikipedia.org/wiki/File:Uintvar_coding.svg)).
|
227
|
+
// SourceMap VLQ does things the other way around, with the least significat four
|
228
|
+
// bits of the original value encoded into the first byte of the VLQ encoded value.
|
229
|
+
VLQ_SHIFT = 5;
|
230
|
+
|
231
|
+
VLQ_CONTINUATION_BIT = 1 << VLQ_SHIFT; // 0010 0000
|
232
|
+
|
233
|
+
VLQ_VALUE_MASK = VLQ_CONTINUATION_BIT - 1; // 0001 1111
|
234
|
+
|
235
|
+
// Regular Base64 Encoding
|
236
|
+
// -----------------------
|
237
|
+
BASE64_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
238
|
+
|
239
|
+
return SourceMap;
|
240
|
+
}.call(this);
|
241
|
+
|
242
|
+
// Our API for source maps is just the `SourceMap` class.
|
243
|
+
module.exports = SourceMap;
|
229
244
|
}).call(this);
|