@makano/rew 1.1.7 → 1.1.9

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