@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.
- 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 +312 -239
- package/lib/rew/cli/log.js +27 -27
- package/lib/rew/cli/run.js +8 -8
- package/lib/rew/cli/utils.js +368 -199
- package/lib/rew/const/config_path.js +2 -2
- package/lib/rew/const/default.js +38 -53
- package/lib/rew/const/files.js +11 -14
- package/lib/rew/const/opt.js +6 -6
- package/lib/rew/css/theme.css +1 -1
- package/lib/rew/functions/core.js +55 -55
- package/lib/rew/functions/curl.js +23 -0
- package/lib/rew/functions/emitter.js +52 -55
- package/lib/rew/functions/exec.js +25 -25
- package/lib/rew/functions/export.js +17 -17
- package/lib/rew/functions/fs.js +57 -59
- package/lib/rew/functions/future.js +29 -21
- package/lib/rew/functions/id.js +8 -9
- package/lib/rew/functions/import.js +106 -122
- package/lib/rew/functions/map.js +10 -10
- package/lib/rew/functions/match.js +35 -42
- package/lib/rew/functions/path.js +8 -8
- package/lib/rew/functions/require.js +32 -36
- package/lib/rew/functions/sleep.js +2 -2
- package/lib/rew/functions/stdout.js +18 -18
- package/lib/rew/functions/types.js +82 -106
- package/lib/rew/html/ui.html +12 -12
- package/lib/rew/html/ui.js +196 -201
- package/lib/rew/main.js +14 -14
- package/lib/rew/misc/bin.js +37 -0
- package/lib/rew/misc/findAppInfo.js +13 -13
- package/lib/rew/misc/findAppPath.js +15 -15
- package/lib/rew/misc/req.js +7 -0
- package/lib/rew/misc/seededid.js +8 -8
- package/lib/rew/models/enum.js +12 -12
- package/lib/rew/models/struct.js +30 -32
- package/lib/rew/modules/compiler.js +237 -209
- 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 -92
- package/lib/rew/pkgs/data.js +10 -10
- package/lib/rew/pkgs/date.js +27 -27
- package/lib/rew/pkgs/env.js +5 -5
- package/lib/rew/pkgs/modules/data/bintree.js +51 -51
- package/lib/rew/pkgs/modules/data/doublylinked.js +84 -84
- package/lib/rew/pkgs/modules/data/linkedList.js +72 -72
- package/lib/rew/pkgs/modules/data/queue.js +18 -18
- package/lib/rew/pkgs/modules/data/stack.js +18 -18
- package/lib/rew/pkgs/modules/threads/worker.js +36 -36
- package/lib/rew/pkgs/modules/ui/classes.js +181 -184
- package/lib/rew/pkgs/pkgs.js +9 -9
- package/lib/rew/pkgs/rune.js +373 -410
- package/lib/rew/pkgs/threads.js +62 -66
- package/lib/rew/pkgs/ui.js +148 -160
- package/lib/rew/qrew/compile.js +12 -0
- package/package.json +4 -3
@@ -1,151 +1,156 @@
|
|
1
1
|
// Generated by CoffeeScript 2.7.0
|
2
|
-
(function() {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
2
|
+
(function () {
|
3
|
+
// This **Browser** compatibility layer extends core CoffeeScript functions
|
4
|
+
// to make things work smoothly when compiling code directly in the browser.
|
5
|
+
// We add support for loading remote Coffee scripts via **XHR**, and
|
6
|
+
// `text/coffeescript` script tags, source maps via data-URLs, and so on.
|
7
|
+
var CoffeeScript,
|
8
|
+
compile,
|
9
|
+
indexOf = [].indexOf;
|
9
10
|
|
10
|
-
|
11
|
+
CoffeeScript = require('./coffeescript');
|
11
12
|
|
12
|
-
|
13
|
+
({ compile } = CoffeeScript);
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
15
|
+
// Use `window.eval` to evaluate code, rather than just `eval`, to run the
|
16
|
+
// script in a clean global scope rather than inheriting the scope of the
|
17
|
+
// CoffeeScript compiler. (So that `cake test:browser` also works in Node,
|
18
|
+
// use either `window.eval` or `global.eval` as appropriate).
|
19
|
+
CoffeeScript.eval = function (code, options = {}) {
|
20
|
+
var globalRoot;
|
21
|
+
if (options.bare == null) {
|
22
|
+
options.bare = true;
|
23
|
+
}
|
24
|
+
globalRoot = typeof window !== 'undefined' && window !== null ? window : global;
|
25
|
+
return globalRoot['eval'](compile(code, options));
|
26
|
+
};
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
// Running code does not provide access to this scope.
|
29
|
+
CoffeeScript.run = function (code, options = {}) {
|
30
|
+
options.bare = true;
|
31
|
+
options.shiftLine = true;
|
32
|
+
return Function(compile(code, options))();
|
33
|
+
};
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
35
|
+
// Export this more limited `CoffeeScript` than what is exported by
|
36
|
+
// `index.coffee`, which is intended for a Node environment.
|
37
|
+
module.exports = CoffeeScript;
|
37
38
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
// If we’re not in a browser environment, we’re finished with the public API.
|
40
|
+
if (typeof window === 'undefined' || window === null) {
|
41
|
+
return;
|
42
|
+
}
|
42
43
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
44
|
+
// Include source maps where possible. If we’ve got a base64 encoder, a
|
45
|
+
// JSON serializer, and tools for escaping unicode characters, we’re good to go.
|
46
|
+
// Ported from https://developer.mozilla.org/en-US/docs/DOM/window.btoa
|
47
|
+
if (typeof btoa !== 'undefined' && btoa !== null && typeof JSON !== 'undefined' && JSON !== null) {
|
48
|
+
compile = function (code, options = {}) {
|
49
|
+
options.inlineMap = true;
|
50
|
+
return CoffeeScript.compile(code, options);
|
51
|
+
};
|
52
|
+
}
|
52
53
|
|
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
|
-
|
54
|
+
// Load a remote script from the current domain via XHR.
|
55
|
+
CoffeeScript.load = function (url, callback, options = {}, hold = false) {
|
56
|
+
var xhr;
|
57
|
+
options.sourceFiles = [url];
|
58
|
+
xhr = window.ActiveXObject ? new window.ActiveXObject('Microsoft.XMLHTTP') : new window.XMLHttpRequest();
|
59
|
+
xhr.open('GET', url, true);
|
60
|
+
if ('overrideMimeType' in xhr) {
|
61
|
+
xhr.overrideMimeType('text/plain');
|
62
|
+
}
|
63
|
+
xhr.onreadystatechange = function () {
|
64
|
+
var param, ref;
|
65
|
+
if (xhr.readyState === 4) {
|
66
|
+
if ((ref = xhr.status) === 0 || ref === 200) {
|
67
|
+
param = [xhr.responseText, options];
|
68
|
+
if (!hold) {
|
69
|
+
CoffeeScript.run(...param);
|
70
|
+
}
|
71
|
+
} else {
|
72
|
+
throw new Error(`Could not load ${url}`);
|
73
|
+
}
|
74
|
+
if (callback) {
|
75
|
+
return callback(param);
|
76
|
+
}
|
77
|
+
}
|
78
|
+
};
|
79
|
+
return xhr.send(null);
|
80
|
+
};
|
80
81
|
|
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
|
-
// be importable without side effects.
|
143
|
-
if (this === window) {
|
144
|
-
if (window.addEventListener) {
|
145
|
-
window.addEventListener('DOMContentLoaded', CoffeeScript.runScripts, false);
|
146
|
-
} else {
|
147
|
-
window.attachEvent('onload', CoffeeScript.runScripts);
|
148
|
-
}
|
149
|
-
}
|
82
|
+
// Activate CoffeeScript in the browser by having it compile and evaluate
|
83
|
+
// all script tags with a content-type of `text/coffeescript`.
|
84
|
+
// This happens on page load.
|
85
|
+
CoffeeScript.runScripts = function () {
|
86
|
+
var coffees, coffeetypes, execute, i, index, j, len, s, script, scripts;
|
87
|
+
scripts = window.document.getElementsByTagName('script');
|
88
|
+
coffeetypes = ['text/coffeescript', 'text/literate-coffeescript'];
|
89
|
+
coffees = (function () {
|
90
|
+
var j, len, ref, results;
|
91
|
+
results = [];
|
92
|
+
for (j = 0, len = scripts.length; j < len; j++) {
|
93
|
+
s = scripts[j];
|
94
|
+
if (((ref = s.type), indexOf.call(coffeetypes, ref) >= 0)) {
|
95
|
+
results.push(s);
|
96
|
+
}
|
97
|
+
}
|
98
|
+
return results;
|
99
|
+
})();
|
100
|
+
index = 0;
|
101
|
+
execute = function () {
|
102
|
+
var param;
|
103
|
+
param = coffees[index];
|
104
|
+
if (param instanceof Array) {
|
105
|
+
CoffeeScript.run(...param);
|
106
|
+
index++;
|
107
|
+
return execute();
|
108
|
+
}
|
109
|
+
};
|
110
|
+
for (i = j = 0, len = coffees.length; j < len; i = ++j) {
|
111
|
+
script = coffees[i];
|
112
|
+
(function (script, i) {
|
113
|
+
var options, source;
|
114
|
+
options = {
|
115
|
+
literate: script.type === coffeetypes[1],
|
116
|
+
};
|
117
|
+
source = script.src || script.getAttribute('data-src');
|
118
|
+
if (source) {
|
119
|
+
options.filename = source;
|
120
|
+
return CoffeeScript.load(
|
121
|
+
source,
|
122
|
+
function (param) {
|
123
|
+
coffees[i] = param;
|
124
|
+
return execute();
|
125
|
+
},
|
126
|
+
options,
|
127
|
+
true,
|
128
|
+
);
|
129
|
+
} else {
|
130
|
+
// `options.filename` defines the filename the source map appears as
|
131
|
+
// in Developer Tools. If a script tag has an `id`, use that as the
|
132
|
+
// filename; otherwise use `coffeescript`, or `coffeescript1` etc.,
|
133
|
+
// leaving the first one unnumbered for the common case that there’s
|
134
|
+
// only one CoffeeScript script block to parse.
|
135
|
+
options.filename = script.id && script.id !== '' ? script.id : `coffeescript${i !== 0 ? i : ''}`;
|
136
|
+
options.sourceFiles = ['embedded'];
|
137
|
+
return (coffees[i] = [script.innerHTML, options]);
|
138
|
+
}
|
139
|
+
})(script, i);
|
140
|
+
}
|
141
|
+
return execute();
|
142
|
+
};
|
150
143
|
|
144
|
+
// Listen for window load, both in decent browsers and in IE.
|
145
|
+
// Only attach this event handler on startup for the
|
146
|
+
// non-ES module version of the browser compiler, to preserve
|
147
|
+
// backward compatibility while letting the ES module version
|
148
|
+
// be importable without side effects.
|
149
|
+
if (this === window) {
|
150
|
+
if (window.addEventListener) {
|
151
|
+
window.addEventListener('DOMContentLoaded', CoffeeScript.runScripts, false);
|
152
|
+
} else {
|
153
|
+
window.attachEvent('onload', CoffeeScript.runScripts);
|
154
|
+
}
|
155
|
+
}
|
151
156
|
}).call(this);
|
package/lib/coffeescript/cake.js
CHANGED
@@ -1,135 +1,134 @@
|
|
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
|
-
|
2
|
+
(function () {
|
3
|
+
// `cake` is a simplified version of [Make](http://www.gnu.org/software/make/)
|
4
|
+
// ([Rake](http://rake.rubyforge.org/), [Jake](https://github.com/280north/jake))
|
5
|
+
// for CoffeeScript. You define tasks with names and descriptions in a Cakefile,
|
6
|
+
// and can call them from the command line, or invoke them from other tasks.
|
7
|
+
|
8
|
+
// Running `cake` with no arguments will print out a list of all the tasks in the
|
9
|
+
// current directory's Cakefile.
|
10
|
+
|
11
|
+
// External dependencies.
|
12
|
+
var CoffeeScript, cakefileDirectory, fatalError, fs, helpers, missingTask, oparse, options, optparse, path, printTasks, switches, tasks;
|
13
|
+
|
14
|
+
fs = require('fs');
|
15
|
+
|
16
|
+
path = require('path');
|
17
|
+
|
18
|
+
helpers = require('./helpers');
|
19
|
+
|
20
|
+
optparse = require('./optparse');
|
21
|
+
|
22
|
+
CoffeeScript = require('./');
|
23
|
+
|
24
|
+
// Register .coffee extension
|
25
|
+
CoffeeScript.register();
|
26
|
+
|
27
|
+
// Keep track of the list of defined tasks, the accepted options, and so on.
|
28
|
+
tasks = {};
|
29
|
+
|
30
|
+
options = {};
|
31
|
+
|
32
|
+
switches = [];
|
33
|
+
|
34
|
+
oparse = null;
|
35
|
+
|
36
|
+
// Mixin the top-level Cake functions for Cakefiles to use directly.
|
37
|
+
helpers.extend(global, {
|
38
|
+
// Define a Cake task with a short name, an optional sentence description,
|
39
|
+
// and the function to run as the action itself.
|
40
|
+
task: function (name, description, action) {
|
41
|
+
if (!action) {
|
42
|
+
[action, description] = [description, action];
|
43
|
+
}
|
44
|
+
return (tasks[name] = { name, description, action });
|
45
|
+
},
|
46
|
+
// Define an option that the Cakefile accepts. The parsed options hash,
|
47
|
+
// containing all of the command-line options passed, will be made available
|
48
|
+
// as the first argument to the action.
|
49
|
+
option: function (letter, flag, description) {
|
50
|
+
return switches.push([letter, flag, description]);
|
51
|
+
},
|
52
|
+
// Invoke another task in the current Cakefile.
|
53
|
+
invoke: function (name) {
|
54
|
+
if (!tasks[name]) {
|
55
|
+
missingTask(name);
|
56
|
+
}
|
57
|
+
return tasks[name].action(options);
|
58
|
+
},
|
59
|
+
});
|
60
|
+
|
61
|
+
// Run `cake`. Executes all of the tasks you pass, in order. Note that Node's
|
62
|
+
// asynchrony may cause tasks to execute in a different order than you'd expect.
|
63
|
+
// If no tasks are passed, print the help screen. Keep a reference to the
|
64
|
+
// original directory name, when running Cake tasks from subdirectories.
|
65
|
+
exports.run = function () {
|
66
|
+
var arg, args, e, i, len, ref, results;
|
67
|
+
global.__originalDirname = fs.realpathSync('.');
|
68
|
+
process.chdir(cakefileDirectory(__originalDirname));
|
69
|
+
args = process.argv.slice(2);
|
70
|
+
CoffeeScript.run(fs.readFileSync('Cakefile').toString(), {
|
71
|
+
filename: 'Cakefile',
|
72
|
+
});
|
73
|
+
oparse = new optparse.OptionParser(switches);
|
74
|
+
if (!args.length) {
|
75
|
+
return printTasks();
|
76
|
+
}
|
77
|
+
try {
|
78
|
+
options = oparse.parse(args);
|
79
|
+
} catch (error) {
|
80
|
+
e = error;
|
81
|
+
return fatalError(`${e}`);
|
82
|
+
}
|
83
|
+
ref = options.arguments;
|
84
|
+
results = [];
|
85
|
+
for (i = 0, len = ref.length; i < len; i++) {
|
86
|
+
arg = ref[i];
|
87
|
+
results.push(invoke(arg));
|
88
|
+
}
|
89
|
+
return results;
|
90
|
+
};
|
91
|
+
|
92
|
+
// Display the list of Cake tasks in a format similar to `rake -T`
|
93
|
+
printTasks = function () {
|
94
|
+
var cakefilePath, desc, name, relative, spaces, task;
|
95
|
+
relative = path.relative || path.resolve;
|
96
|
+
cakefilePath = path.join(relative(__originalDirname, process.cwd()), 'Cakefile');
|
97
|
+
console.log(`${cakefilePath} defines the following tasks:\n`);
|
98
|
+
for (name in tasks) {
|
99
|
+
task = tasks[name];
|
100
|
+
spaces = 20 - name.length;
|
101
|
+
spaces = spaces > 0 ? Array(spaces + 1).join(' ') : '';
|
102
|
+
desc = task.description ? `# ${task.description}` : '';
|
103
|
+
console.log(`cake ${name}${spaces} ${desc}`);
|
104
|
+
}
|
105
|
+
if (switches.length) {
|
106
|
+
return console.log(oparse.help());
|
107
|
+
}
|
108
|
+
};
|
109
|
+
|
110
|
+
// Print an error and exit when attempting to use an invalid task/option.
|
111
|
+
fatalError = function (message) {
|
112
|
+
console.error(message + '\n');
|
113
|
+
console.log('To see a list of all tasks/options, run "cake"');
|
114
|
+
return process.exit(1);
|
115
|
+
};
|
116
|
+
|
117
|
+
missingTask = function (task) {
|
118
|
+
return fatalError(`No such task: ${task}`);
|
119
|
+
};
|
120
|
+
|
121
|
+
// When `cake` is invoked, search in the current and all parent directories
|
122
|
+
// to find the relevant Cakefile.
|
123
|
+
cakefileDirectory = function (dir) {
|
124
|
+
var parent;
|
125
|
+
if (fs.existsSync(path.join(dir, 'Cakefile'))) {
|
126
|
+
return dir;
|
127
|
+
}
|
128
|
+
parent = path.normalize(path.join(dir, '..'));
|
129
|
+
if (parent !== dir) {
|
130
|
+
return cakefileDirectory(parent);
|
131
|
+
}
|
132
|
+
throw new Error(`Cakefile not found in ${process.cwd()}`);
|
133
|
+
};
|
135
134
|
}).call(this);
|