@makano/rew 1.2.56 → 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 +7 -4
- 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,230 +0,0 @@
|
|
1
|
-
// Generated by CoffeeScript 2.7.0
|
2
|
-
(function () {
|
3
|
-
// Node.js Implementation
|
4
|
-
var CoffeeScript,
|
5
|
-
ext,
|
6
|
-
fs,
|
7
|
-
helpers,
|
8
|
-
i,
|
9
|
-
len,
|
10
|
-
path,
|
11
|
-
ref,
|
12
|
-
universalCompile,
|
13
|
-
vm,
|
14
|
-
hasProp = {}.hasOwnProperty;
|
15
|
-
|
16
|
-
CoffeeScript = require('./coffeescript');
|
17
|
-
|
18
|
-
fs = require('fs');
|
19
|
-
|
20
|
-
vm = require('vm');
|
21
|
-
|
22
|
-
path = require('path');
|
23
|
-
|
24
|
-
helpers = CoffeeScript.helpers;
|
25
|
-
|
26
|
-
CoffeeScript.transpile = function (js, options) {
|
27
|
-
var babel;
|
28
|
-
try {
|
29
|
-
babel = require('@babel/core');
|
30
|
-
} catch (error) {
|
31
|
-
try {
|
32
|
-
babel = require('babel-core');
|
33
|
-
} catch (error) {
|
34
|
-
// This error is only for Node, as CLI users will see a different error
|
35
|
-
// earlier if they don’t have Babel installed.
|
36
|
-
throw new Error("To use the transpile option, you must have the '@babel/core' module installed");
|
37
|
-
}
|
38
|
-
}
|
39
|
-
return babel.transform(js, options);
|
40
|
-
};
|
41
|
-
|
42
|
-
// The `compile` method shared by the CLI, Node and browser APIs.
|
43
|
-
universalCompile = CoffeeScript.compile;
|
44
|
-
|
45
|
-
// The `compile` method particular to the Node API.
|
46
|
-
CoffeeScript.compile = function (code, options) {
|
47
|
-
// Pass a reference to Babel into the compiler, so that the transpile option
|
48
|
-
// is available in the Node API. We need to do this so that tools like Webpack
|
49
|
-
// can `require('coffeescript')` and build correctly, without trying to
|
50
|
-
// require Babel.
|
51
|
-
if (options != null ? options.transpile : void 0) {
|
52
|
-
options.transpile.transpile = CoffeeScript.transpile;
|
53
|
-
}
|
54
|
-
return universalCompile.call(CoffeeScript, code, options);
|
55
|
-
};
|
56
|
-
|
57
|
-
// Compile and execute a string of CoffeeScript (on the server), correctly
|
58
|
-
// setting `__filename`, `__dirname`, and relative `require()`.
|
59
|
-
CoffeeScript.run = function (code, options = {}) {
|
60
|
-
var answer, dir, mainModule, ref;
|
61
|
-
mainModule = require.main;
|
62
|
-
// Set the filename.
|
63
|
-
mainModule.filename = process.argv[1] = options.filename ? fs.realpathSync(options.filename) : helpers.anonymousFileName();
|
64
|
-
// Clear the module cache.
|
65
|
-
mainModule.moduleCache && (mainModule.moduleCache = {});
|
66
|
-
// Assign paths for node_modules loading
|
67
|
-
dir = options.filename != null ? path.dirname(fs.realpathSync(options.filename)) : fs.realpathSync('.');
|
68
|
-
mainModule.paths = require('module')._nodeModulePaths(dir);
|
69
|
-
// Save the options for compiling child imports.
|
70
|
-
mainModule.options = options;
|
71
|
-
options.filename = mainModule.filename;
|
72
|
-
options.inlineMap = true;
|
73
|
-
// Compile.
|
74
|
-
answer = CoffeeScript.compile(code, options);
|
75
|
-
code = (ref = answer.js) != null ? ref : answer;
|
76
|
-
return mainModule._compile(code, mainModule.filename);
|
77
|
-
};
|
78
|
-
|
79
|
-
// Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).
|
80
|
-
// The CoffeeScript REPL uses this to run the input.
|
81
|
-
CoffeeScript.eval = function (code, options = {}) {
|
82
|
-
var Module, _module, _require, createContext, i, isContext, js, k, len, o, r, ref, ref1, ref2, ref3, sandbox, v;
|
83
|
-
if (!(code = code.trim())) {
|
84
|
-
return;
|
85
|
-
}
|
86
|
-
createContext = (ref = vm.Script.createContext) != null ? ref : vm.createContext;
|
87
|
-
isContext =
|
88
|
-
(ref1 = vm.isContext) != null
|
89
|
-
? ref1
|
90
|
-
: function (ctx) {
|
91
|
-
return options.sandbox instanceof createContext().constructor;
|
92
|
-
};
|
93
|
-
if (createContext) {
|
94
|
-
if (options.sandbox != null) {
|
95
|
-
if (isContext(options.sandbox)) {
|
96
|
-
sandbox = options.sandbox;
|
97
|
-
} else {
|
98
|
-
sandbox = createContext();
|
99
|
-
ref2 = options.sandbox;
|
100
|
-
for (k in ref2) {
|
101
|
-
if (!hasProp.call(ref2, k)) continue;
|
102
|
-
v = ref2[k];
|
103
|
-
sandbox[k] = v;
|
104
|
-
}
|
105
|
-
}
|
106
|
-
sandbox.global = sandbox.root = sandbox.GLOBAL = sandbox;
|
107
|
-
} else {
|
108
|
-
sandbox = global;
|
109
|
-
}
|
110
|
-
sandbox.__filename = options.filename || 'eval';
|
111
|
-
sandbox.__dirname = path.dirname(sandbox.__filename);
|
112
|
-
// define module/require only if they chose not to specify their own
|
113
|
-
if (!(sandbox !== global || sandbox.module || sandbox.require)) {
|
114
|
-
Module = require('module');
|
115
|
-
sandbox.module = _module = new Module(options.modulename || 'eval');
|
116
|
-
sandbox.require = _require = function (path) {
|
117
|
-
return Module._load(path, _module, true);
|
118
|
-
};
|
119
|
-
_module.filename = sandbox.__filename;
|
120
|
-
ref3 = Object.getOwnPropertyNames(require);
|
121
|
-
for (i = 0, len = ref3.length; i < len; i++) {
|
122
|
-
r = ref3[i];
|
123
|
-
if (r !== 'paths' && r !== 'arguments' && r !== 'caller') {
|
124
|
-
_require[r] = require[r];
|
125
|
-
}
|
126
|
-
}
|
127
|
-
// use the same hack node currently uses for their own REPL
|
128
|
-
_require.paths = _module.paths = Module._nodeModulePaths(process.cwd());
|
129
|
-
_require.resolve = function (request) {
|
130
|
-
return Module._resolveFilename(request, _module);
|
131
|
-
};
|
132
|
-
}
|
133
|
-
}
|
134
|
-
o = {};
|
135
|
-
for (k in options) {
|
136
|
-
if (!hasProp.call(options, k)) continue;
|
137
|
-
v = options[k];
|
138
|
-
o[k] = v;
|
139
|
-
}
|
140
|
-
o.bare = true; // ensure return value
|
141
|
-
js = CoffeeScript.compile(code, o);
|
142
|
-
if (sandbox === global) {
|
143
|
-
return vm.runInThisContext(js);
|
144
|
-
} else {
|
145
|
-
return vm.runInContext(js, sandbox);
|
146
|
-
}
|
147
|
-
};
|
148
|
-
|
149
|
-
CoffeeScript.register = function () {
|
150
|
-
return require('./register');
|
151
|
-
};
|
152
|
-
|
153
|
-
// Throw error with deprecation warning when depending upon implicit `require.extensions` registration
|
154
|
-
if (require.extensions) {
|
155
|
-
ref = CoffeeScript.FILE_EXTENSIONS;
|
156
|
-
for (i = 0, len = ref.length; i < len; i++) {
|
157
|
-
ext = ref[i];
|
158
|
-
(function (ext) {
|
159
|
-
var base;
|
160
|
-
return (base = require.extensions)[ext] != null
|
161
|
-
? base[ext]
|
162
|
-
: (base[ext] = function () {
|
163
|
-
throw new Error(`Use CoffeeScript.register() or require the coffeescript/register module to require ${ext} files.`);
|
164
|
-
});
|
165
|
-
})(ext);
|
166
|
-
}
|
167
|
-
}
|
168
|
-
|
169
|
-
CoffeeScript._compileRawFileContent = function (raw, filename, options = {}) {
|
170
|
-
var answer, err, stripped;
|
171
|
-
// Strip the Unicode byte order mark, if this file begins with one.
|
172
|
-
stripped = raw.charCodeAt(0) === 0xfeff ? raw.substring(1) : raw;
|
173
|
-
options = Object.assign({}, options, {
|
174
|
-
filename: filename,
|
175
|
-
literate: helpers.isLiterate(filename),
|
176
|
-
sourceFiles: [filename],
|
177
|
-
});
|
178
|
-
try {
|
179
|
-
answer = CoffeeScript.compile(stripped, options);
|
180
|
-
} catch (error) {
|
181
|
-
err = error;
|
182
|
-
// As the filename and code of a dynamically loaded file will be different
|
183
|
-
// from the original file compiled with CoffeeScript.run, add that
|
184
|
-
// information to error so it can be pretty-printed later.
|
185
|
-
throw helpers.updateSyntaxError(err, stripped, filename);
|
186
|
-
}
|
187
|
-
return answer;
|
188
|
-
};
|
189
|
-
|
190
|
-
CoffeeScript._compileFile = function (filename, options = {}) {
|
191
|
-
var raw;
|
192
|
-
raw = fs.readFileSync(filename, 'utf8');
|
193
|
-
return CoffeeScript._compileRawFileContent(raw, filename, options);
|
194
|
-
};
|
195
|
-
|
196
|
-
module.exports = CoffeeScript;
|
197
|
-
|
198
|
-
// Explicitly define all named exports so that Node’s automatic detection of
|
199
|
-
// named exports from CommonJS packages finds all of them. This enables consuming
|
200
|
-
// packages to write code like `import { compile } from 'coffeescript'`.
|
201
|
-
// Don’t simplify this into a loop or similar; the `module.exports.name` part is
|
202
|
-
// essential for Node’s algorithm to successfully detect the name.
|
203
|
-
module.exports.VERSION = CoffeeScript.VERSION;
|
204
|
-
|
205
|
-
module.exports.FILE_EXTENSIONS = CoffeeScript.FILE_EXTENSIONS;
|
206
|
-
|
207
|
-
module.exports.helpers = CoffeeScript.helpers;
|
208
|
-
|
209
|
-
module.exports.registerCompiled = CoffeeScript.registerCompiled;
|
210
|
-
|
211
|
-
module.exports.compile = CoffeeScript.compile;
|
212
|
-
|
213
|
-
module.exports.tokens = CoffeeScript.tokens;
|
214
|
-
|
215
|
-
module.exports.nodes = CoffeeScript.nodes;
|
216
|
-
|
217
|
-
module.exports.register = CoffeeScript.register;
|
218
|
-
|
219
|
-
module.exports.eval = CoffeeScript.eval;
|
220
|
-
|
221
|
-
module.exports.run = CoffeeScript.run;
|
222
|
-
|
223
|
-
module.exports.transpile = CoffeeScript.transpile;
|
224
|
-
|
225
|
-
module.exports.patchStackTrace = CoffeeScript.patchStackTrace;
|
226
|
-
|
227
|
-
module.exports._compileRawFileContent = CoffeeScript._compileRawFileContent;
|
228
|
-
|
229
|
-
module.exports._compileFile = CoffeeScript._compileFile;
|
230
|
-
}).call(this);
|