@makano/rew 1.2.55 → 1.2.57
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/civet/main.js +17239 -0
- package/lib/rew/cli/cli.js +3 -2
- package/lib/rew/cli/utils.js +18 -10
- package/lib/rew/const/ext.js +5 -0
- package/lib/rew/const/opt.js +4 -2
- package/lib/rew/const/usage.js +12 -0
- package/lib/rew/functions/fs.js +6 -1
- package/lib/rew/functions/import.js +4 -4
- package/lib/rew/functions/require.js +1 -1
- package/lib/rew/main.js +1 -13
- package/lib/rew/modules/compiler.js +72 -25
- package/lib/rew/modules/context.js +12 -0
- package/lib/rew/modules/runtime.js +1 -0
- package/lib/rew/pkgs/serve.js +8 -5
- package/lib/rew/pkgs/web.js +5 -4
- package/package.json +1 -1
- package/runtime.d.ts +15 -10
- package/jsconfig.json +0 -13
- package/lib/coffeescript/browser.js +0 -156
- package/lib/coffeescript/cake.js +0 -134
- package/lib/coffeescript/coffeescript.js +0 -465
- package/lib/coffeescript/command.js +0 -832
- package/lib/coffeescript/grammar.js +0 -1930
- package/lib/coffeescript/helpers.js +0 -513
- package/lib/coffeescript/index.js +0 -230
- package/lib/coffeescript/lexer.js +0 -2316
- package/lib/coffeescript/nodes.js +0 -9784
- package/lib/coffeescript/optparse.js +0 -258
- package/lib/coffeescript/parser.js +0 -20384
- package/lib/coffeescript/register.js +0 -120
- package/lib/coffeescript/repl.js +0 -328
- package/lib/coffeescript/rewriter.js +0 -1448
- package/lib/coffeescript/scope.js +0 -191
- package/lib/coffeescript/sourcemap.js +0 -244
@@ -1,156 +0,0 @@
|
|
1
|
-
// Generated by CoffeeScript 2.7.0
|
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;
|
10
|
-
|
11
|
-
CoffeeScript = require('./coffeescript');
|
12
|
-
|
13
|
-
({ compile } = CoffeeScript);
|
14
|
-
|
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
|
-
};
|
27
|
-
|
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
|
-
};
|
34
|
-
|
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;
|
38
|
-
|
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
|
-
}
|
43
|
-
|
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
|
-
}
|
53
|
-
|
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
|
-
};
|
81
|
-
|
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
|
-
};
|
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
|
-
}
|
156
|
-
}).call(this);
|
package/lib/coffeescript/cake.js
DELETED
@@ -1,134 +0,0 @@
|
|
1
|
-
// Generated by CoffeeScript 2.7.0
|
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
|
-
};
|
134
|
-
}).call(this);
|