update dryice build script
This commit is contained in:
parent
58dc601000
commit
850c13a22c
6 changed files with 128 additions and 121 deletions
|
|
@ -36,7 +36,6 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
//require("long-stack-traces");
|
||||
var copy = require('dryice').copy;
|
||||
|
||||
var aceHome = __dirname;
|
||||
|
|
@ -49,22 +48,32 @@ var project = copy.createCommonJsProject([
|
|||
aceHome + '/demo'
|
||||
]);
|
||||
|
||||
copy({
|
||||
source: "build_support/editor.html",
|
||||
dest: 'build/editor.html'
|
||||
});
|
||||
|
||||
var ace = copy.createDataObject();
|
||||
copy({
|
||||
source: [
|
||||
copy.source.commonjs({
|
||||
project: project,
|
||||
require: [
|
||||
'pilot/plugin_manager',
|
||||
'pilot/environment',
|
||||
'pilot/index',
|
||||
'startup',
|
||||
"pilot/fixoldbrowsers",
|
||||
"pilot/index",
|
||||
"pilot/plugin_manager",
|
||||
"pilot/environment",
|
||||
"ace/editor",
|
||||
"ace/edit_session",
|
||||
"ace/undomanager",
|
||||
"ace/theme/textmate",
|
||||
"ace/mode/text",
|
||||
"ace/mode/matching_brace_outdent",
|
||||
"ace/virtual_renderer"
|
||||
]
|
||||
}),
|
||||
'build_support/mini_require.js',
|
||||
'build_support/boot.js'
|
||||
})
|
||||
],
|
||||
filter: [ copy.filter.debug, copy.filter.moduleDefines ],
|
||||
filter: [ copy.filter.moduleDefines ],
|
||||
dest: ace
|
||||
});
|
||||
copy({
|
||||
|
|
@ -85,11 +94,19 @@ copy({
|
|||
filter: [ copy.filter.base64 ],
|
||||
dest: ace
|
||||
});
|
||||
copy({
|
||||
source: [
|
||||
'build_support/mini_require.js',
|
||||
'build_support/boot.js'
|
||||
],
|
||||
dest: ace
|
||||
});
|
||||
|
||||
|
||||
// Create the compressed and uncompressed output files
|
||||
copy({
|
||||
source: ace,
|
||||
filter: copy.filter.uglifyjs,
|
||||
// filter: copy.filter.uglifyjs,
|
||||
dest: 'build/ace.js'
|
||||
});
|
||||
copy({
|
||||
|
|
@ -110,7 +127,7 @@ copy({
|
|||
require: [ 'cockpit/index' ]
|
||||
}),
|
||||
],
|
||||
filter: [ copy.filter.debug, copy.filter.moduleDefines ],
|
||||
filter: [ copy.filter.moduleDefines ],
|
||||
dest: cockpit
|
||||
});
|
||||
copy({
|
||||
|
|
@ -143,108 +160,87 @@ copy({
|
|||
dest: 'build/cockpit-uncompressed.js'
|
||||
});
|
||||
|
||||
console.log('# conventional ---------');
|
||||
|
||||
// Pilot sources
|
||||
var pilotData = copy.createDataObject();
|
||||
copy({
|
||||
source: {
|
||||
root: aceHome + '/support/pilot/lib',
|
||||
include: /.*\.js$/,
|
||||
exclude: /tests?\//
|
||||
},
|
||||
filter: [ copy.filter.debug, copy.filter.moduleDefines ],
|
||||
dest: pilotData
|
||||
// create modes
|
||||
project.assmeAllFilesLoaded();
|
||||
|
||||
["css", "html", "javascript", "php", "python", "xml"].forEach(function(mode) {
|
||||
copy({
|
||||
source: [
|
||||
copy.source.commonjs({
|
||||
project: project,
|
||||
require: [ 'ace/mode/' + mode ]
|
||||
}),
|
||||
],
|
||||
filter: [ copy.filter.moduleDefines, copy.filter.uglifyjs ],
|
||||
dest: "build/mode/" + mode + ".js"
|
||||
});
|
||||
});
|
||||
|
||||
// Cockpit sources
|
||||
var cockpitData = copy.createDataObject();
|
||||
copy({
|
||||
source: {
|
||||
root: aceHome + '/support/cockpit/lib',
|
||||
include: /.*\.js$/,
|
||||
exclude: /tests?\//
|
||||
},
|
||||
filter: [ copy.filter.moduleDefines ],
|
||||
dest: cockpitData
|
||||
});
|
||||
copy({
|
||||
source: {
|
||||
root: aceHome + '/support/cockpit/lib',
|
||||
include: /.*\.css$|.*\.html$/,
|
||||
exclude: /tests?\//
|
||||
},
|
||||
filter: [ copy.filter.addDefines ],
|
||||
dest: cockpitData
|
||||
});
|
||||
copy({
|
||||
source: {
|
||||
root: aceHome + '/support/cockpit/lib',
|
||||
include: /.*\.png$|.*\.gif$/,
|
||||
exclude: /tests?\//
|
||||
},
|
||||
filter: [ copy.filter.base64 ],
|
||||
dest: cockpitData
|
||||
});
|
||||
// create worker
|
||||
console.log('# worker ---------');
|
||||
|
||||
// Ace sources
|
||||
var aceData = copy.createDataObject();
|
||||
var jsWorker = copy.createDataObject();
|
||||
var workerProject = copy.createCommonJsProject([
|
||||
aceHome + '/support/pilot/lib',
|
||||
aceHome + '/lib'
|
||||
]);
|
||||
copy({
|
||||
source: [
|
||||
// Exclude all themes/modes so we can just include textmate/js
|
||||
{
|
||||
root: aceHome + '/lib',
|
||||
include: /.*\.js$/,
|
||||
exclude: /tests?\/|theme\/|mode\/|ace\/worker\/worker\.js/
|
||||
},
|
||||
{ base: aceHome + '/lib/', path: 'ace/theme/textmate.js' },
|
||||
{ base: aceHome + '/lib/', path: 'ace/mode/text.js' },
|
||||
{ base: aceHome + '/lib/', path: 'ace/mode/javascript.js' },
|
||||
{ base: aceHome + '/lib/', path: 'ace/mode/javascript_worker.js' },
|
||||
{ base: aceHome + '/lib/', path: 'ace/mode/text_highlight_rules.js' },
|
||||
{ base: aceHome + '/lib/', path: 'ace/mode/javascript_highlight_rules.js' },
|
||||
{ base: aceHome + '/lib/', path: 'ace/mode/doc_comment_highlight_rules.js' },
|
||||
{ base: aceHome + '/lib/', path: 'ace/mode/matching_brace_outdent.js' },
|
||||
{ base: aceHome + '/lib/', path: 'ace/mode/javascript_highlight_rules.js' }
|
||||
copy.source.commonjs({
|
||||
project: workerProject,
|
||||
require: [
|
||||
'pilot/fixoldbrowsers',
|
||||
'pilot/event_emitter',
|
||||
'pilot/oop',
|
||||
'ace/mode/javascript_worker'
|
||||
]
|
||||
}),
|
||||
],
|
||||
filter: [ copy.filter.moduleDefines ],
|
||||
dest: aceData
|
||||
filter: [ copy.filter.moduleDefines, /*copy.filter.uglifyjs*/ ],
|
||||
dest: jsWorker
|
||||
});
|
||||
copy({
|
||||
source: {
|
||||
source: [
|
||||
aceHome + "/lib/ace/worker/worker.js",
|
||||
jsWorker
|
||||
],
|
||||
dest: "build/worker/javascript.js"
|
||||
});
|
||||
|
||||
// create themes
|
||||
var eclipseTheme = copy.createDataObject();
|
||||
copy({
|
||||
source: [{
|
||||
root: aceHome + '/lib',
|
||||
include: /tm\.css|editor\.css/,
|
||||
exclude: /tests?\//
|
||||
},
|
||||
filter: [ copy.filter.addDefines ],
|
||||
dest: aceData
|
||||
include: "ace/theme/eclipse.js"
|
||||
}],
|
||||
filter: [ copy.filter.moduleDefines, copy.filter.uglifyjs ],
|
||||
dest: eclipseTheme
|
||||
});
|
||||
copy({
|
||||
source: [{
|
||||
root: aceHome + '/lib',
|
||||
include: "ace/theme/eclipse.css"
|
||||
}],
|
||||
filter: [ copy.filter.addDefines, copy.filter.uglifyjs ],
|
||||
dest: eclipseTheme
|
||||
});
|
||||
copy({
|
||||
source: eclipseTheme,
|
||||
dest: 'build/theme/eclipse.js'
|
||||
});
|
||||
|
||||
// Piece together the parts that we want
|
||||
var data = copy.createDataObject();
|
||||
copy({
|
||||
source: [
|
||||
'build_support/mini_require.js',
|
||||
pilotData,
|
||||
// cockpitData,
|
||||
aceData,
|
||||
'build_support/boot.js'
|
||||
],
|
||||
dest: data
|
||||
});
|
||||
|
||||
// Create the compressed and uncompressed output files
|
||||
copy({
|
||||
source: data,
|
||||
filter: copy.filter.uglifyjs,
|
||||
dest: 'build/old-ace.js'
|
||||
});
|
||||
//copy({
|
||||
// source: data,
|
||||
// dest: 'build/ace-uncompressed.js'
|
||||
//});
|
||||
|
||||
copy({
|
||||
source: data,
|
||||
dest: 'build/old-ace-uncompressed.js'
|
||||
[
|
||||
"clouds", "clouds_midnight", "cobalt", "dawn", "idle_fingers", "kr_theme",
|
||||
"mono_industrial", "monokai", "pastel_on_dark", "twilight"
|
||||
].forEach(function(theme) {
|
||||
copy({
|
||||
source: [{
|
||||
root: aceHome + '/lib',
|
||||
include: "ace/theme/" + theme + ".js"
|
||||
}],
|
||||
filter: [ copy.filter.moduleDefines, copy.filter.uglifyjs ],
|
||||
dest: "build/theme/" + theme + ".js"
|
||||
});
|
||||
});
|
||||
|
|
@ -35,21 +35,37 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
var deps = [ "pilot/plugin_manager", "pilot/environment" ];
|
||||
var deps = [
|
||||
"pilot/fixoldbrowsers",
|
||||
"pilot/index",
|
||||
"pilot/plugin_manager",
|
||||
"pilot/environment",
|
||||
"ace/editor",
|
||||
"ace/edit_session",
|
||||
"ace/virtual_renderer",
|
||||
"ace/undomanager",
|
||||
"ace/theme/textmate"
|
||||
];
|
||||
|
||||
require(deps, function() {
|
||||
var catalog = require("pilot/plugin_manager").catalog;
|
||||
catalog.registerPlugins([ "pilot/index" ]);
|
||||
|
||||
var Dom = require("pilot/dom");
|
||||
var Event = require("pilot/event");
|
||||
|
||||
var ace = {
|
||||
var Editor = require("ace/editor").Editor;
|
||||
var EditSession = require("ace/edit_session").EditSession;
|
||||
var UndoManager = require("ace/undomanager").UndoManager;
|
||||
var Renderer = require("ace/virtual_renderer").VirtualRenderer;
|
||||
|
||||
window.ace = {
|
||||
edit: function(el) {
|
||||
if (typeof(el) == "string") {
|
||||
el = document.getElementById(el);
|
||||
}
|
||||
|
||||
var doc = new EditSession(Dom.getInnerText(el));
|
||||
doc.setMode(new JavaScriptMode());
|
||||
doc.setUndoManager(new UndoManager());
|
||||
el.innerHTML = '';
|
||||
|
||||
|
|
@ -69,4 +85,4 @@ require(deps, function() {
|
|||
return editor;
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -19,10 +19,14 @@
|
|||
|
||||
<script src="ace.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="theme/twilight.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="mode/javascript.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
var editor = ace.edit("editor");
|
||||
editor.setTheme("ace/theme/twilight");
|
||||
|
||||
var JavaScriptMode = require("ace/mode/javascript").Mode;
|
||||
editor.getSession().setMode(new JavaScriptMode());
|
||||
}, false);
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -76,19 +76,10 @@ function require(module, callback) {
|
|||
|
||||
return payload;
|
||||
};
|
||||
|
||||
window.define = function(module, payload) {
|
||||
if (typeof module !== 'string') {
|
||||
console.error('dropping module because define wasn\'t munged.');
|
||||
console.trace();
|
||||
return;
|
||||
}
|
||||
|
||||
// console.log('defining module: ' + module + ' as a ' + typeof payload);
|
||||
require.modules[module] = payload;
|
||||
}
|
||||
}
|
||||
|
||||
require.packaged = true;
|
||||
|
||||
/**
|
||||
* Internal function to lookup moduleNames and resolve them by calling the
|
||||
* definition function if needed.
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ oop.inherits(Mode, TextMode);
|
|||
|
||||
this.createWorker = function(session) {
|
||||
var doc = session.getDocument();
|
||||
var worker = new WorkerClient("../..", ["ace", "pilot"], "ace/mode/javascript_worker", "JavaScriptWorker");
|
||||
var worker = new WorkerClient("../..", ["ace", "pilot"], "worker/javascript.js", "ace/mode/javascript_worker", "JavaScriptWorker");
|
||||
worker.call("setValue", [doc.getValue()]);
|
||||
|
||||
doc.on("change", function(e) {
|
||||
|
|
|
|||
|
|
@ -11,12 +11,12 @@ define(function(require, exports, module) {
|
|||
var oop = require("pilot/oop");
|
||||
var EventEmitter = require("pilot/event_emitter").EventEmitter;
|
||||
|
||||
var WorkerClient = function(baseUrl, topLevelNamespaces, module, classname) {
|
||||
var WorkerClient = function(baseUrl, topLevelNamespaces, packagedJs, module, classname) {
|
||||
|
||||
this.callbacks = [];
|
||||
|
||||
if (require.packaged) {
|
||||
var worker = this.$worker = new Worker("worker.js");
|
||||
var worker = this.$worker = new Worker(packagedJs);
|
||||
}
|
||||
else {
|
||||
var workerUrl = require.nameToUrl("ace/worker/worker", null, "_");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue