@makano/rew 1.2.56 → 1.2.58

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,191 +0,0 @@
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;
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
- }
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
- }
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
- }
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
- }
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
- }
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
- }
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
- }
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
- }
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
- }
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(
142
- name,
143
- {
144
- value,
145
- assigned: true,
146
- },
147
- true,
148
- );
149
- return (this.hasAssignments = true);
150
- }
151
-
152
- // Does this scope have any declared variables?
153
- hasDeclarations() {
154
- return !!this.declaredVariables().length;
155
- }
156
-
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
- }
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
- };
191
- }).call(this);
@@ -1,244 +0,0 @@
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
- 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;
244
- }).call(this);