Skip to content
This repository
Browse code

Merge remote-tracking branch 'upstream/sourcemint' into 00

Conflicts:
	package.json
  • Loading branch information...
commit a831eef3e8019b6a68e53c4746245cdf8a75a385 2 parents 43e543f + eeeaf7d
Harutyun Amirjanyan nightwing authored
16 demo/kitchen-sink/package.json
... ... @@ -0,0 +1,16 @@
  1 +{
  2 + "main": "./demo.js",
  3 + "mappings": {
  4 + "ace": "../.."
  5 + },
  6 + "config": {
  7 + "github.com/sourcemint/bundler-js/0/-meta/config/0": {
  8 + "adapter": "github.com/sourcemint/sdk-requirejs/0",
  9 + "resources": [
  10 + "./icons/*",
  11 + "./logo.png",
  12 + "./styles.css"
  13 + ]
  14 + }
  15 + }
  16 +}
9 lib/ace/worker/worker_client.js
@@ -50,7 +50,14 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, mod, classname) {
50 50 this.$worker = new Worker(config.get("workerPath") + "/" + packagedJs);
51 51 }
52 52 else {
53   - var workerUrl = this.$normalizePath(require.nameToUrl("ace/worker/worker", null, "_"));
  53 + var workerUrl;
  54 + if (typeof require.supports !== "undefined" && require.supports.indexOf("ucjs2-pinf-0") >= 0) {
  55 + // We are running in the sourcemint loader.
  56 + workerUrl = require.nameToUrl("ace/worker/worker_sourcemint");
  57 + } else {
  58 + // We are running in RequireJS.
  59 + workerUrl = this.$normalizePath(require.nameToUrl("ace/worker/worker", null, "_"));
  60 + }
54 61 this.$worker = new Worker(workerUrl);
55 62
56 63 var tlns = {};
73 lib/ace/worker/worker_sourcemint.js
... ... @@ -0,0 +1,73 @@
  1 +
  2 +define(function(require, exports, module) {
  3 +
  4 + "no use strict";
  5 +
  6 + exports.main = function()
  7 + {
  8 + var console = {
  9 + log: function(msg) {
  10 + postMessage({type: "log", data: msg});
  11 + }
  12 + };
  13 +
  14 + // NOTE: This sets the global `window` object used by workers.
  15 + // TODO: Pass into worker what it needs and don't set global here.
  16 + window = {
  17 + console: console
  18 + };
  19 +
  20 + function initSender() {
  21 +
  22 + var EventEmitter = require("ace/lib/event_emitter").EventEmitter;
  23 + var oop = require("ace/lib/oop");
  24 +
  25 + var Sender = function() {};
  26 +
  27 + (function() {
  28 +
  29 + oop.implement(this, EventEmitter);
  30 +
  31 + this.callback = function(data, callbackId) {
  32 + postMessage({
  33 + type: "call",
  34 + id: callbackId,
  35 + data: data
  36 + });
  37 + };
  38 +
  39 + this.emit = function(name, data) {
  40 + postMessage({
  41 + type: "event",
  42 + name: name,
  43 + data: data
  44 + });
  45 + };
  46 +
  47 + }).call(Sender.prototype);
  48 +
  49 + return new Sender();
  50 + }
  51 +
  52 + var main;
  53 + var sender;
  54 +
  55 + onmessage = function(e) {
  56 + var msg = e.data;
  57 + if (msg.command) {
  58 + main[msg.command].apply(main, msg.args);
  59 + }
  60 + else if (msg.init) {
  61 + require("ace/lib/fixoldbrowsers");
  62 + sender = initSender();
  63 + require.async(msg.module, function(WORKER) {
  64 + var clazz = WORKER[msg.classname];
  65 + main = new clazz(sender);
  66 + });
  67 + }
  68 + else if (msg.event && sender) {
  69 + sender._emit(msg.event, msg.data);
  70 + }
  71 + };
  72 + }
  73 +});
26 package.json
@@ -24,6 +24,9 @@
24 24 "engines": {
25 25 "node": "~0.6.0"
26 26 },
  27 + "mappings": {
  28 + "ace": "."
  29 + },
27 30 "licenses": [{
28 31 "type": "MPL",
29 32 "url": "http://www.mozilla.org/MPL/"
@@ -39,5 +42,28 @@
39 42 },
40 43 "scripts": {
41 44 "test": "node lib/ace/test/all.js"
  45 + },
  46 + "config": {
  47 + "github.com/sourcemint/bundler-js/0/-meta/config/0": {
  48 + "adapter": "github.com/sourcemint/sdk-requirejs/0",
  49 + "modules": {
  50 + "/lib/ace/virtual_renderer.js": {
  51 + "dynamicLinks": [
  52 + "/lib/ace/theme/*.js"
  53 + ]
  54 + },
  55 + "/lib/ace/worker/worker_client.js": {
  56 + "dynamicLinks": [
  57 + "/lib/ace/worker/worker_sourcemint.js"
  58 + ]
  59 + },
  60 + "/lib/ace/worker/worker_sourcemint.js": {
  61 + "bundleLoader": true,
  62 + "dynamicLinks": [
  63 + "/lib/ace/mode/*_worker.js"
  64 + ]
  65 + }
  66 + }
  67 + }
42 68 }
43 69 }
2  sourcemint/.gitignore
... ... @@ -0,0 +1,2 @@
  1 +/dist/
  2 +/node_modules/
63 sourcemint/README.md
Source Rendered
... ... @@ -0,0 +1,63 @@
  1 +Develop & Distribute ACE using the Sourcemint Loader
  2 +====================================================
  3 +
  4 +The [Sourcemint JavaScript Loader](https://github.com/sourcemint/loader-js) is an optimized
  5 +module loader that boots sets of *statically linked* modules from *bundles*. An application may
  6 +load additional bundles by using *dynamic links*.
  7 +
  8 +*Bundles* are generated from the AMD formatted source files on the fly during development (using a server helper)
  9 +and in-batch for production builds. To generate bundles the Sourcemint [RequireJS SDK](https://github.com/sourcemint/sdk-requirejs)
  10 +and [Platform NodeJS](https://github.com/sourcemint/platform-nodejs) projects are used.
  11 +
  12 +
  13 +Development
  14 +===========
  15 +
  16 +**Requirements:**
  17 +
  18 + * [NodeJS](http://nodejs.org/)
  19 +
  20 +**Install:**
  21 +
  22 + git clone git://github.com/ajaxorg/ace.git
  23 + cd ace
  24 + # TMP: Switch to sourcemint branch
  25 + git checkout sourcemint
  26 + cd sourcemint
  27 + npm install
  28 +
  29 +**Start development server:**
  30 +
  31 + node dev
  32 +
  33 +**NOTE:** Modified source files are automatically reloaded on browser refresh so there is no
  34 +need to restart the server during development.
  35 +
  36 +
  37 +Production
  38 +==========
  39 +
  40 +To generate production bundles, use the same setup as for *Development*, then run:
  41 +
  42 + // NOT YET IMPLEMENTED
  43 + node build ../demo/kitchen-sink ./dist
  44 +
  45 +Where `../demo/kitchen-sink` is the path to your ACE bootstrap package which embeds ACE in the page
  46 +or provides an interface for the rest of your application to interact with ACE.
  47 +
  48 +Everything needed for ACE (and your bootstrap package) to run will be written to the `./dist` directory which can be
  49 +used in a production application by serving these static files via a web server. To load the bootstrap file use:
  50 +
  51 + <!-- Load the Sourcemint JavaScript Loader -->
  52 + <script type="text/javascript" src="./dist/loader.min.js"></script>
  53 + <!-- Load ACE bootstrap file -->
  54 + <script type="text/javascript">
  55 + require.sandbox("./dist/kitchen-sink.js", function(sandbox) {
  56 + sandbox.main();
  57 + });
  58 + </script>
  59 +
  60 +See `../demo/kitchen-sink` for an example of how to write an ACE bootstrap package.
  61 +
  62 +See [Embedding Ace](https://github.com/ajaxorg/ace) and [Embedding API](https://github.com/ajaxorg/ace/wiki/Embedding---API)
  63 +for more information on how to embed and interact with ACE.
47 sourcemint/dev.js
... ... @@ -0,0 +1,47 @@
  1 +
  2 +var PATH = require("path"),
  3 + FS = require("fs"),
  4 + CONNECT = require("connect"),
  5 + BUNDLER = require("sourcemint-platform-nodejs/lib/bundler");
  6 +
  7 +
  8 +exports.main = function(options) {
  9 +
  10 + var server = CONNECT();
  11 +
  12 + server.use(CONNECT.router(function(app) {
  13 +
  14 + app.get(/^\/loader.js/, CONNECT.static(PATH.dirname(require.resolve("sourcemint-loader-js/loader.js"))));
  15 +
  16 + app.get(/^(?:\/demo\/kitchen-sink)(?:\.js)?(\/.*)?$/, BUNDLER.hoist(PATH.dirname(__dirname) + "/demo/kitchen-sink", {
  17 + distributionBasePath: __dirname + "/dist",
  18 + packageIdHashSeed: "__ACE__",
  19 + bundleLoader: false,
  20 + logger: {
  21 + log: function() {
  22 + console.log.apply(null, arguments);
  23 + }
  24 + }
  25 + }));
  26 +
  27 + app.get(/^\//, function(req, res)
  28 + {
  29 + CONNECT.static(__dirname)(req, res, function()
  30 + {
  31 + res.writeHead(404);
  32 + res.end("Not found!");
  33 + });
  34 + });
  35 + }));
  36 +
  37 + server.listen(options.port, "127.0.0.1");
  38 +
  39 + console.log("ACE development server running at http://127.0.0.1:" + options.port + "/");
  40 +}
  41 +
  42 +if (require.main === module) {
  43 + // TODO: Make configurable via command-line flag.
  44 + exports.main({
  45 + port: 8888
  46 + });
  47 +}
16 sourcemint/index.html
... ... @@ -0,0 +1,16 @@
  1 +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
  2 + "http://www.w3.org/TR/html4/strict.dtd">
  3 +
  4 +<html lang="en">
  5 +<head>
  6 + <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  7 + <title>Ace Development Server</title>
  8 +</head>
  9 +<body>
  10 +
  11 + <h1>Demos</h1>
  12 +
  13 + <p><a href="kitchen-sink.html">Kitchen Sink</a></p>
  14 +
  15 +</body>
  16 +</html>
209 sourcemint/kitchen-sink.html
... ... @@ -0,0 +1,209 @@
  1 +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
  2 + "http://www.w3.org/TR/html4/strict.dtd">
  3 +
  4 +<html lang="en">
  5 +<head>
  6 + <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  7 + <title>Ace Kitchen Sink</title>
  8 + <meta name="author" content="Fabian Jakobs">
  9 + <link rel="stylesheet" href="demo/kitchen-sink/styles.css" type="text/css" media="screen" charset="utf-8">
  10 + <!--
  11 +
  12 + Ace
  13 + version %version%
  14 + commit %commit%
  15 +
  16 + -->
  17 +</head>
  18 +<body>
  19 + <img id="logo" src="demo/kitchen-sink/logo.png">
  20 + <table id="controls">
  21 + <tr>
  22 + <td>
  23 + <label for="doc">Document</label>
  24 + </td><td>
  25 + <select id="doc" size="1">
  26 + </select>
  27 + </td>
  28 + </tr>
  29 + <tr>
  30 + <td >
  31 + <label for="mode">Mode</label>
  32 + </td><td>
  33 + <select id="mode" size="1">
  34 + </select>
  35 + </td>
  36 + </tr>
  37 + <tr>
  38 + <td>
  39 + <label for="split">Split</label>
  40 + </td><td>
  41 + <select id="split" size="1">
  42 + <option value="none">None</option>
  43 + <option value="below">Below</option>
  44 + <option value="beside">Beside</option>
  45 + </select>
  46 + </td>
  47 + </tr>
  48 + <tr>
  49 + <td >
  50 + <label for="theme">Theme</label>
  51 + </td><td>
  52 + <select id="theme" size="1">
  53 + <option value="ace/theme/chrome">Chrome</option>
  54 + <option value="ace/theme/clouds">Clouds</option>
  55 + <option value="ace/theme/clouds_midnight">Clouds Midnight</option>
  56 + <option value="ace/theme/cobalt">Cobalt</option>
  57 + <option value="ace/theme/crimson_editor">Crimson Editor</option>
  58 + <option value="ace/theme/dawn">Dawn</option>
  59 + <option value="ace/theme/dreamweaver">Dreamweaver</option>
  60 + <option value="ace/theme/eclipse">Eclipse</option>
  61 + <option value="ace/theme/idle_fingers">idleFingers</option>
  62 + <option value="ace/theme/kr_theme">krTheme</option>
  63 + <option value="ace/theme/merbivore">Merbivore</option>
  64 + <option value="ace/theme/merbivore_soft">Merbivore Soft</option>
  65 + <option value="ace/theme/mono_industrial">Mono Industrial</option>
  66 + <option value="ace/theme/monokai">Monokai</option>
  67 + <option value="ace/theme/pastel_on_dark">Pastel on dark</option>
  68 + <option value="ace/theme/solarized_dark">Solarized Dark</option>
  69 + <option value="ace/theme/solarized_light">Solarized Light</option>
  70 + <option value="ace/theme/textmate" selected="selected">TextMate</option>
  71 + <option value="ace/theme/twilight">Twilight</option>
  72 + <option value="ace/theme/tomorrow">Tomorrow</option>
  73 + <option value="ace/theme/tomorrow_night">Tomorrow Night</option>
  74 + <option value="ace/theme/tomorrow_night_blue">Tomorrow Night Blue</option>
  75 + <option value="ace/theme/tomorrow_night_bright">Tomorrow Night Bright</option>
  76 + <option value="ace/theme/tomorrow_night_eighties">Tomorrow Night 80s</option>
  77 + <option value="ace/theme/vibrant_ink">Vibrant Ink</option>
  78 + </select>
  79 + </td>
  80 + </tr>
  81 + <tr>
  82 + <td>
  83 + <label for="fontsize">Font Size</label>
  84 + </td><td>
  85 + <select id="fontsize" size="1">
  86 + <option value="10px">10px</option>
  87 + <option value="11px">11px</option>
  88 + <option value="12px" selected="selected">12px</option>
  89 + <option value="14px">14px</option>
  90 + <option value="16px">16px</option>
  91 + <option value="20px">20px</option>
  92 + <option value="24px">24px</option>
  93 + </select>
  94 + </td>
  95 + </tr>
  96 + <tr>
  97 + <td>
  98 + <label for="folding">Code Folding</label>
  99 + </td><td>
  100 + <select id="folding" size="1">
  101 + <option value="manual">manual</option>
  102 + <option value="markbegin" selected="selected">mark begin</option>
  103 + <option value="markbeginend">mark begin and end</option>
  104 + </select>
  105 + </td>
  106 + </tr>
  107 + <tr>
  108 + <td>
  109 + <label for="select_style">Full Line Selection</label>
  110 + </td><td>
  111 + <input type="checkbox" name="select_style" id="select_style" checked>
  112 + </td>
  113 + </tr>
  114 + <tr>
  115 + <td>
  116 + <label for="highlight_active">Highlight Active Line</label>
  117 + </td><td>
  118 + <input type="checkbox" name="highlight_active" id="highlight_active" checked>
  119 + </td>
  120 + </tr>
  121 + <tr>
  122 + <td >
  123 + <label for="show_hidden">Show Invisibles</label>
  124 + </td><td>
  125 + <input type="checkbox" name="show_hidden" id="show_hidden" checked>
  126 + </td>
  127 + </tr>
  128 + <tr>
  129 + <td >
  130 + <label for="show_hscroll">Persistent HScroll</label>
  131 + </td><td>
  132 + <input type="checkbox" name="show_hscroll" id="show_hscroll">
  133 + </td>
  134 + </tr>
  135 + <tr>
  136 + <td >
  137 + <label for="keybinding">Key Binding</label>
  138 + </td><td>
  139 + <select id="keybinding" size="1">
  140 + <option value="ace">Ace</option>
  141 + <option value="vim">Vim</option>
  142 + <option value="emacs">Emacs</option>
  143 + <option value="custom">Custom</option>
  144 + </select>
  145 + </td>
  146 + </tr>
  147 + <tr>
  148 + <td >
  149 + <label for="soft_wrap">Soft Wrap</label>
  150 + </td><td>
  151 + <select id="soft_wrap" size="1">
  152 + <option value="off">Off</option>
  153 + <option value="40">40 Chars</option>
  154 + <option value="80">80 Chars</option>
  155 + <option value="free">Free</option>
  156 + </select>
  157 + </td>
  158 + </tr>
  159 + <tr>
  160 + <td >
  161 + <label for="show_gutter">Show Gutter</label>
  162 + </td><td>
  163 + <input type="checkbox" id="show_gutter" checked>
  164 + </td>
  165 + </tr>
  166 + <tr>
  167 + <td >
  168 + <label for="show_print_margin">Show Print Margin</label>
  169 + </td><td>
  170 + <input type="checkbox" id="show_print_margin" checked>
  171 + </td>
  172 + </tr>
  173 + <tr>
  174 + <td >
  175 + <label for="soft_tab">Use Soft Tab</label>
  176 + </td><td>
  177 + <input type="checkbox" id="soft_tab" checked>
  178 + </td>
  179 + </tr>
  180 + <tr>
  181 + <td >
  182 + <label for="highlight_selected_word">Highlight selected word</label>
  183 + </td>
  184 + <td>
  185 + <input type="checkbox" id="highlight_selected_word" checked>
  186 + </td>
  187 + </tr>
  188 + <tr>
  189 + <td >
  190 + <label for="enable_behaviours">Enable Behaviours</label>
  191 + </td>
  192 + <td>
  193 + <input type="checkbox" id="enable_behaviours">
  194 + </td>
  195 + </tr>
  196 + </table>
  197 +
  198 + <div id="editor">
  199 + </div>
  200 +
  201 + <script src="loader.js" type="text/javascript"></script>
  202 + <script type="text/javascript">
  203 + require.sandbox("demo/kitchen-sink.js", function(sandbox) {
  204 + sandbox.main();
  205 + });
  206 + </script>
  207 +
  208 +</body>
  209 +</html>
12 sourcemint/package.json
... ... @@ -0,0 +1,12 @@
  1 +{
  2 + "name": "ajaxorg-ace-sourcemint",
  3 + "version": "0.1.0",
  4 + "engines": {
  5 + "node": "0.x"
  6 + },
  7 + "dependencies": {
  8 + "connect": "1.x",
  9 + "sourcemint-platform-nodejs": "0.x",
  10 + "sourcemint-loader-js": "0.x"
  11 + }
  12 +}

0 comments on commit a831eef

Please sign in to comment.
Something went wrong with that request. Please try again.