@makano/rew 1.1.81 → 1.2.0

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