Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

Conflicts:
	package.json
  • Loading branch information...
commit a831eef3e8019b6a68e53c4746245cdf8a75a385 2 parents 43e543f + eeeaf7d
@nightwing nightwing authored
View
16 demo/kitchen-sink/package.json
@@ -0,0 +1,16 @@
+{
+ "main": "./demo.js",
+ "mappings": {
+ "ace": "../.."
+ },
+ "config": {
+ "github.com/sourcemint/bundler-js/0/-meta/config/0": {
+ "adapter": "github.com/sourcemint/sdk-requirejs/0",
+ "resources": [
+ "./icons/*",
+ "./logo.png",
+ "./styles.css"
+ ]
+ }
+ }
+}
View
9 lib/ace/worker/worker_client.js
@@ -50,7 +50,14 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, mod, classname) {
this.$worker = new Worker(config.get("workerPath") + "/" + packagedJs);
}
else {
- var workerUrl = this.$normalizePath(require.nameToUrl("ace/worker/worker", null, "_"));
+ var workerUrl;
+ if (typeof require.supports !== "undefined" && require.supports.indexOf("ucjs2-pinf-0") >= 0) {
+ // We are running in the sourcemint loader.
+ workerUrl = require.nameToUrl("ace/worker/worker_sourcemint");
+ } else {
+ // We are running in RequireJS.
+ workerUrl = this.$normalizePath(require.nameToUrl("ace/worker/worker", null, "_"));
+ }
this.$worker = new Worker(workerUrl);
var tlns = {};
View
73 lib/ace/worker/worker_sourcemint.js
@@ -0,0 +1,73 @@
+
+define(function(require, exports, module) {
+
+ "no use strict";
+
+ exports.main = function()
+ {
+ var console = {
+ log: function(msg) {
+ postMessage({type: "log", data: msg});
+ }
+ };
+
+ // NOTE: This sets the global `window` object used by workers.
+ // TODO: Pass into worker what it needs and don't set global here.
+ window = {
+ console: console
+ };
+
+ function initSender() {
+
+ var EventEmitter = require("ace/lib/event_emitter").EventEmitter;
+ var oop = require("ace/lib/oop");
+
+ var Sender = function() {};
+
+ (function() {
+
+ oop.implement(this, EventEmitter);
+
+ this.callback = function(data, callbackId) {
+ postMessage({
+ type: "call",
+ id: callbackId,
+ data: data
+ });
+ };
+
+ this.emit = function(name, data) {
+ postMessage({
+ type: "event",
+ name: name,
+ data: data
+ });
+ };
+
+ }).call(Sender.prototype);
+
+ return new Sender();
+ }
+
+ var main;
+ var sender;
+
+ onmessage = function(e) {
+ var msg = e.data;
+ if (msg.command) {
+ main[msg.command].apply(main, msg.args);
+ }
+ else if (msg.init) {
+ require("ace/lib/fixoldbrowsers");
+ sender = initSender();
+ require.async(msg.module, function(WORKER) {
+ var clazz = WORKER[msg.classname];
+ main = new clazz(sender);
+ });
+ }
+ else if (msg.event && sender) {
+ sender._emit(msg.event, msg.data);
+ }
+ };
+ }
+});
View
26 package.json
@@ -24,6 +24,9 @@
"engines": {
"node": "~0.6.0"
},
+ "mappings": {
+ "ace": "."
+ },
"licenses": [{
"type": "MPL",
"url": "http://www.mozilla.org/MPL/"
@@ -39,5 +42,28 @@
},
"scripts": {
"test": "node lib/ace/test/all.js"
+ },
+ "config": {
+ "github.com/sourcemint/bundler-js/0/-meta/config/0": {
+ "adapter": "github.com/sourcemint/sdk-requirejs/0",
+ "modules": {
+ "/lib/ace/virtual_renderer.js": {
+ "dynamicLinks": [
+ "/lib/ace/theme/*.js"
+ ]
+ },
+ "/lib/ace/worker/worker_client.js": {
+ "dynamicLinks": [
+ "/lib/ace/worker/worker_sourcemint.js"
+ ]
+ },
+ "/lib/ace/worker/worker_sourcemint.js": {
+ "bundleLoader": true,
+ "dynamicLinks": [
+ "/lib/ace/mode/*_worker.js"
+ ]
+ }
+ }
+ }
}
}
View
2  sourcemint/.gitignore
@@ -0,0 +1,2 @@
+/dist/
+/node_modules/
View
63 sourcemint/README.md
@@ -0,0 +1,63 @@
+Develop & Distribute ACE using the Sourcemint Loader
+====================================================
+
+The [Sourcemint JavaScript Loader](https://github.com/sourcemint/loader-js) is an optimized
+module loader that boots sets of *statically linked* modules from *bundles*. An application may
+load additional bundles by using *dynamic links*.
+
+*Bundles* are generated from the AMD formatted source files on the fly during development (using a server helper)
+and in-batch for production builds. To generate bundles the Sourcemint [RequireJS SDK](https://github.com/sourcemint/sdk-requirejs)
+and [Platform NodeJS](https://github.com/sourcemint/platform-nodejs) projects are used.
+
+
+Development
+===========
+
+**Requirements:**
+
+ * [NodeJS](http://nodejs.org/)
+
+**Install:**
+
+ git clone git://github.com/ajaxorg/ace.git
+ cd ace
+ # TMP: Switch to sourcemint branch
+ git checkout sourcemint
+ cd sourcemint
+ npm install
+
+**Start development server:**
+
+ node dev
+
+**NOTE:** Modified source files are automatically reloaded on browser refresh so there is no
+need to restart the server during development.
+
+
+Production
+==========
+
+To generate production bundles, use the same setup as for *Development*, then run:
+
+ // NOT YET IMPLEMENTED
+ node build ../demo/kitchen-sink ./dist
+
+Where `../demo/kitchen-sink` is the path to your ACE bootstrap package which embeds ACE in the page
+or provides an interface for the rest of your application to interact with ACE.
+
+Everything needed for ACE (and your bootstrap package) to run will be written to the `./dist` directory which can be
+used in a production application by serving these static files via a web server. To load the bootstrap file use:
+
+ <!-- Load the Sourcemint JavaScript Loader -->
+ <script type="text/javascript" src="./dist/loader.min.js"></script>
+ <!-- Load ACE bootstrap file -->
+ <script type="text/javascript">
+ require.sandbox("./dist/kitchen-sink.js", function(sandbox) {
+ sandbox.main();
+ });
+ </script>
+
+See `../demo/kitchen-sink` for an example of how to write an ACE bootstrap package.
+
+See [Embedding Ace](https://github.com/ajaxorg/ace) and [Embedding API](https://github.com/ajaxorg/ace/wiki/Embedding---API)
+for more information on how to embed and interact with ACE.
View
47 sourcemint/dev.js
@@ -0,0 +1,47 @@
+
+var PATH = require("path"),
+ FS = require("fs"),
+ CONNECT = require("connect"),
+ BUNDLER = require("sourcemint-platform-nodejs/lib/bundler");
+
+
+exports.main = function(options) {
+
+ var server = CONNECT();
+
+ server.use(CONNECT.router(function(app) {
+
+ app.get(/^\/loader.js/, CONNECT.static(PATH.dirname(require.resolve("sourcemint-loader-js/loader.js"))));
+
+ app.get(/^(?:\/demo\/kitchen-sink)(?:\.js)?(\/.*)?$/, BUNDLER.hoist(PATH.dirname(__dirname) + "/demo/kitchen-sink", {
+ distributionBasePath: __dirname + "/dist",
+ packageIdHashSeed: "__ACE__",
+ bundleLoader: false,
+ logger: {
+ log: function() {
+ console.log.apply(null, arguments);
+ }
+ }
+ }));
+
+ app.get(/^\//, function(req, res)
+ {
+ CONNECT.static(__dirname)(req, res, function()
+ {
+ res.writeHead(404);
+ res.end("Not found!");
+ });
+ });
+ }));
+
+ server.listen(options.port, "127.0.0.1");
+
+ console.log("ACE development server running at http://127.0.0.1:" + options.port + "/");
+}
+
+if (require.main === module) {
+ // TODO: Make configurable via command-line flag.
+ exports.main({
+ port: 8888
+ });
+}
View
16 sourcemint/index.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+
+<html lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <title>Ace Development Server</title>
+</head>
+<body>
+
+ <h1>Demos</h1>
+
+ <p><a href="kitchen-sink.html">Kitchen Sink</a></p>
+
+</body>
+</html>
View
209 sourcemint/kitchen-sink.html
@@ -0,0 +1,209 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+
+<html lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <title>Ace Kitchen Sink</title>
+ <meta name="author" content="Fabian Jakobs">
+ <link rel="stylesheet" href="demo/kitchen-sink/styles.css" type="text/css" media="screen" charset="utf-8">
+ <!--
+
+ Ace
+ version %version%
+ commit %commit%
+
+ -->
+</head>
+<body>
+ <img id="logo" src="demo/kitchen-sink/logo.png">
+ <table id="controls">
+ <tr>
+ <td>
+ <label for="doc">Document</label>
+ </td><td>
+ <select id="doc" size="1">
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td >
+ <label for="mode">Mode</label>
+ </td><td>
+ <select id="mode" size="1">
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <label for="split">Split</label>
+ </td><td>
+ <select id="split" size="1">
+ <option value="none">None</option>
+ <option value="below">Below</option>
+ <option value="beside">Beside</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td >
+ <label for="theme">Theme</label>
+ </td><td>
+ <select id="theme" size="1">
+ <option value="ace/theme/chrome">Chrome</option>
+ <option value="ace/theme/clouds">Clouds</option>
+ <option value="ace/theme/clouds_midnight">Clouds Midnight</option>
+ <option value="ace/theme/cobalt">Cobalt</option>
+ <option value="ace/theme/crimson_editor">Crimson Editor</option>
+ <option value="ace/theme/dawn">Dawn</option>
+ <option value="ace/theme/dreamweaver">Dreamweaver</option>
+ <option value="ace/theme/eclipse">Eclipse</option>
+ <option value="ace/theme/idle_fingers">idleFingers</option>
+ <option value="ace/theme/kr_theme">krTheme</option>
+ <option value="ace/theme/merbivore">Merbivore</option>
+ <option value="ace/theme/merbivore_soft">Merbivore Soft</option>
+ <option value="ace/theme/mono_industrial">Mono Industrial</option>
+ <option value="ace/theme/monokai">Monokai</option>
+ <option value="ace/theme/pastel_on_dark">Pastel on dark</option>
+ <option value="ace/theme/solarized_dark">Solarized Dark</option>
+ <option value="ace/theme/solarized_light">Solarized Light</option>
+ <option value="ace/theme/textmate" selected="selected">TextMate</option>
+ <option value="ace/theme/twilight">Twilight</option>
+ <option value="ace/theme/tomorrow">Tomorrow</option>
+ <option value="ace/theme/tomorrow_night">Tomorrow Night</option>
+ <option value="ace/theme/tomorrow_night_blue">Tomorrow Night Blue</option>
+ <option value="ace/theme/tomorrow_night_bright">Tomorrow Night Bright</option>
+ <option value="ace/theme/tomorrow_night_eighties">Tomorrow Night 80s</option>
+ <option value="ace/theme/vibrant_ink">Vibrant Ink</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <label for="fontsize">Font Size</label>
+ </td><td>
+ <select id="fontsize" size="1">
+ <option value="10px">10px</option>
+ <option value="11px">11px</option>
+ <option value="12px" selected="selected">12px</option>
+ <option value="14px">14px</option>
+ <option value="16px">16px</option>
+ <option value="20px">20px</option>
+ <option value="24px">24px</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <label for="folding">Code Folding</label>
+ </td><td>
+ <select id="folding" size="1">
+ <option value="manual">manual</option>
+ <option value="markbegin" selected="selected">mark begin</option>
+ <option value="markbeginend">mark begin and end</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <label for="select_style">Full Line Selection</label>
+ </td><td>
+ <input type="checkbox" name="select_style" id="select_style" checked>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <label for="highlight_active">Highlight Active Line</label>
+ </td><td>
+ <input type="checkbox" name="highlight_active" id="highlight_active" checked>
+ </td>
+ </tr>
+ <tr>
+ <td >
+ <label for="show_hidden">Show Invisibles</label>
+ </td><td>
+ <input type="checkbox" name="show_hidden" id="show_hidden" checked>
+ </td>
+ </tr>
+ <tr>
+ <td >
+ <label for="show_hscroll">Persistent HScroll</label>
+ </td><td>
+ <input type="checkbox" name="show_hscroll" id="show_hscroll">
+ </td>
+ </tr>
+ <tr>
+ <td >
+ <label for="keybinding">Key Binding</label>
+ </td><td>
+ <select id="keybinding" size="1">
+ <option value="ace">Ace</option>
+ <option value="vim">Vim</option>
+ <option value="emacs">Emacs</option>
+ <option value="custom">Custom</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td >
+ <label for="soft_wrap">Soft Wrap</label>
+ </td><td>
+ <select id="soft_wrap" size="1">
+ <option value="off">Off</option>
+ <option value="40">40 Chars</option>
+ <option value="80">80 Chars</option>
+ <option value="free">Free</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td >
+ <label for="show_gutter">Show Gutter</label>
+ </td><td>
+ <input type="checkbox" id="show_gutter" checked>
+ </td>
+ </tr>
+ <tr>
+ <td >
+ <label for="show_print_margin">Show Print Margin</label>
+ </td><td>
+ <input type="checkbox" id="show_print_margin" checked>
+ </td>
+ </tr>
+ <tr>
+ <td >
+ <label for="soft_tab">Use Soft Tab</label>
+ </td><td>
+ <input type="checkbox" id="soft_tab" checked>
+ </td>
+ </tr>
+ <tr>
+ <td >
+ <label for="highlight_selected_word">Highlight selected word</label>
+ </td>
+ <td>
+ <input type="checkbox" id="highlight_selected_word" checked>
+ </td>
+ </tr>
+ <tr>
+ <td >
+ <label for="enable_behaviours">Enable Behaviours</label>
+ </td>
+ <td>
+ <input type="checkbox" id="enable_behaviours">
+ </td>
+ </tr>
+ </table>
+
+ <div id="editor">
+ </div>
+
+ <script src="loader.js" type="text/javascript"></script>
+ <script type="text/javascript">
+ require.sandbox("demo/kitchen-sink.js", function(sandbox) {
+ sandbox.main();
+ });
+ </script>
+
+</body>
+</html>
View
12 sourcemint/package.json
@@ -0,0 +1,12 @@
+{
+ "name": "ajaxorg-ace-sourcemint",
+ "version": "0.1.0",
+ "engines": {
+ "node": "0.x"
+ },
+ "dependencies": {
+ "connect": "1.x",
+ "sourcemint-platform-nodejs": "0.x",
+ "sourcemint-loader-js": "0.x"
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.