@makano/rew 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. package/bin/rew +9 -0
  2. package/bin/ui +0 -0
  3. package/bin/webkit_app +0 -0
  4. package/lib/coffeescript/browser.js +151 -0
  5. package/lib/coffeescript/cake.js +135 -0
  6. package/lib/coffeescript/coffeescript.js +409 -0
  7. package/lib/coffeescript/command.js +750 -0
  8. package/lib/coffeescript/grammar.js +2496 -0
  9. package/lib/coffeescript/helpers.js +477 -0
  10. package/lib/coffeescript/index.js +217 -0
  11. package/lib/coffeescript/lexer.js +1943 -0
  12. package/lib/coffeescript/nodes.js +9204 -0
  13. package/lib/coffeescript/optparse.js +230 -0
  14. package/lib/coffeescript/parser.js +1344 -0
  15. package/lib/coffeescript/register.js +100 -0
  16. package/lib/coffeescript/repl.js +305 -0
  17. package/lib/coffeescript/rewriter.js +1138 -0
  18. package/lib/coffeescript/scope.js +187 -0
  19. package/lib/coffeescript/sourcemap.js +229 -0
  20. package/lib/rew/cli/cli.js +117 -0
  21. package/lib/rew/cli/log.js +40 -0
  22. package/lib/rew/cli/run.js +20 -0
  23. package/lib/rew/cli/utils.js +122 -0
  24. package/lib/rew/const/default.js +35 -0
  25. package/lib/rew/const/files.js +15 -0
  26. package/lib/rew/css/theme.css +3 -0
  27. package/lib/rew/functions/core.js +85 -0
  28. package/lib/rew/functions/emitter.js +57 -0
  29. package/lib/rew/functions/export.js +9 -0
  30. package/lib/rew/functions/future.js +22 -0
  31. package/lib/rew/functions/id.js +13 -0
  32. package/lib/rew/functions/import.js +57 -0
  33. package/lib/rew/functions/map.js +17 -0
  34. package/lib/rew/functions/match.js +34 -0
  35. package/lib/rew/functions/sleep.js +5 -0
  36. package/lib/rew/functions/types.js +96 -0
  37. package/lib/rew/html/ui.html +223 -0
  38. package/lib/rew/main.js +17 -0
  39. package/lib/rew/models/enum.js +14 -0
  40. package/lib/rew/models/struct.js +41 -0
  41. package/lib/rew/modules/compiler.js +17 -0
  42. package/lib/rew/modules/context.js +50 -0
  43. package/lib/rew/modules/fs.js +19 -0
  44. package/lib/rew/modules/runtime.js +24 -0
  45. package/lib/rew/modules/utils.js +0 -0
  46. package/lib/rew/modules/yaml.js +36 -0
  47. package/lib/rew/pkgs/conf.js +92 -0
  48. package/lib/rew/pkgs/data.js +8 -0
  49. package/lib/rew/pkgs/date.js +98 -0
  50. package/lib/rew/pkgs/modules/data/bintree.js +66 -0
  51. package/lib/rew/pkgs/modules/data/doublylinked.js +100 -0
  52. package/lib/rew/pkgs/modules/data/linkedList.js +88 -0
  53. package/lib/rew/pkgs/modules/data/queue.js +28 -0
  54. package/lib/rew/pkgs/modules/data/stack.js +27 -0
  55. package/lib/rew/pkgs/modules/ui/classes.js +171 -0
  56. package/lib/rew/pkgs/pkgs.js +13 -0
  57. package/lib/rew/pkgs/ui.js +108 -0
  58. package/package.json +41 -0
package/bin/rew ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ const path = require('path');
3
+ const fs = require('fs');
4
+ const rew_mod = path.resolve(process.cwd(), 'node_modules/rew');
5
+ if(fs.existsSync(rew_mod)){
6
+ require(rew_mod(path.join(rew_mod, 'lib/rew/cli.js')));
7
+ } else {
8
+ require('../lib/rew/cli/cli.js');
9
+ }
package/bin/ui ADDED
Binary file
package/bin/webkit_app ADDED
Binary file
@@ -0,0 +1,151 @@
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, compile,
8
+ indexOf = [].indexOf;
9
+
10
+ CoffeeScript = require('./coffeescript');
11
+
12
+ ({compile} = CoffeeScript);
13
+
14
+ // Use `window.eval` to evaluate code, rather than just `eval`, to run the
15
+ // script in a clean global scope rather than inheriting the scope of the
16
+ // CoffeeScript compiler. (So that `cake test:browser` also works in Node,
17
+ // use either `window.eval` or `global.eval` as appropriate).
18
+ CoffeeScript.eval = function(code, options = {}) {
19
+ var globalRoot;
20
+ if (options.bare == null) {
21
+ options.bare = true;
22
+ }
23
+ globalRoot = typeof window !== "undefined" && window !== null ? window : global;
24
+ return globalRoot['eval'](compile(code, options));
25
+ };
26
+
27
+ // Running code does not provide access to this scope.
28
+ CoffeeScript.run = function(code, options = {}) {
29
+ options.bare = true;
30
+ options.shiftLine = true;
31
+ return Function(compile(code, options))();
32
+ };
33
+
34
+ // Export this more limited `CoffeeScript` than what is exported by
35
+ // `index.coffee`, which is intended for a Node environment.
36
+ module.exports = CoffeeScript;
37
+
38
+ // If we’re not in a browser environment, we’re finished with the public API.
39
+ if (typeof window === "undefined" || window === null) {
40
+ return;
41
+ }
42
+
43
+ // Include source maps where possible. If we’ve got a base64 encoder, a
44
+ // JSON serializer, and tools for escaping unicode characters, we’re good to go.
45
+ // Ported from https://developer.mozilla.org/en-US/docs/DOM/window.btoa
46
+ if ((typeof btoa !== "undefined" && btoa !== null) && (typeof JSON !== "undefined" && JSON !== null)) {
47
+ compile = function(code, options = {}) {
48
+ options.inlineMap = true;
49
+ return CoffeeScript.compile(code, options);
50
+ };
51
+ }
52
+
53
+ // Load a remote script from the current domain via XHR.
54
+ CoffeeScript.load = function(url, callback, options = {}, hold = false) {
55
+ var xhr;
56
+ options.sourceFiles = [url];
57
+ xhr = window.ActiveXObject ? new window.ActiveXObject('Microsoft.XMLHTTP') : new window.XMLHttpRequest();
58
+ xhr.open('GET', url, true);
59
+ if ('overrideMimeType' in xhr) {
60
+ xhr.overrideMimeType('text/plain');
61
+ }
62
+ xhr.onreadystatechange = function() {
63
+ var param, ref;
64
+ if (xhr.readyState === 4) {
65
+ if ((ref = xhr.status) === 0 || ref === 200) {
66
+ param = [xhr.responseText, options];
67
+ if (!hold) {
68
+ CoffeeScript.run(...param);
69
+ }
70
+ } else {
71
+ throw new Error(`Could not load ${url}`);
72
+ }
73
+ if (callback) {
74
+ return callback(param);
75
+ }
76
+ }
77
+ };
78
+ return xhr.send(null);
79
+ };
80
+
81
+ // Activate CoffeeScript in the browser by having it compile and evaluate
82
+ // all script tags with a content-type of `text/coffeescript`.
83
+ // This happens on page load.
84
+ CoffeeScript.runScripts = function() {
85
+ var coffees, coffeetypes, execute, i, index, j, len, s, script, scripts;
86
+ scripts = window.document.getElementsByTagName('script');
87
+ coffeetypes = ['text/coffeescript', 'text/literate-coffeescript'];
88
+ coffees = (function() {
89
+ var j, len, ref, results;
90
+ results = [];
91
+ for (j = 0, len = scripts.length; j < len; j++) {
92
+ s = scripts[j];
93
+ if (ref = s.type, indexOf.call(coffeetypes, ref) >= 0) {
94
+ results.push(s);
95
+ }
96
+ }
97
+ return results;
98
+ })();
99
+ index = 0;
100
+ execute = function() {
101
+ var param;
102
+ param = coffees[index];
103
+ if (param instanceof Array) {
104
+ CoffeeScript.run(...param);
105
+ index++;
106
+ return execute();
107
+ }
108
+ };
109
+ for (i = j = 0, len = coffees.length; j < len; i = ++j) {
110
+ script = coffees[i];
111
+ (function(script, i) {
112
+ var options, source;
113
+ options = {
114
+ literate: script.type === coffeetypes[1]
115
+ };
116
+ source = script.src || script.getAttribute('data-src');
117
+ if (source) {
118
+ options.filename = source;
119
+ return CoffeeScript.load(source, function(param) {
120
+ coffees[i] = param;
121
+ return execute();
122
+ }, options, true);
123
+ } else {
124
+ // `options.filename` defines the filename the source map appears as
125
+ // in Developer Tools. If a script tag has an `id`, use that as the
126
+ // filename; otherwise use `coffeescript`, or `coffeescript1` etc.,
127
+ // leaving the first one unnumbered for the common case that there’s
128
+ // only one CoffeeScript script block to parse.
129
+ options.filename = script.id && script.id !== '' ? script.id : `coffeescript${i !== 0 ? i : ''}`;
130
+ options.sourceFiles = ['embedded'];
131
+ return coffees[i] = [script.innerHTML, options];
132
+ }
133
+ })(script, i);
134
+ }
135
+ return execute();
136
+ };
137
+
138
+ // Listen for window load, both in decent browsers and in IE.
139
+ // Only attach this event handler on startup for the
140
+ // non-ES module version of the browser compiler, to preserve
141
+ // backward compatibility while letting the ES module version
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
+ }
150
+
151
+ }).call(this);
@@ -0,0 +1,135 @@
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
+
135
+ }).call(this);