Skip to content

Commit

Permalink
Merge pull request #4851 from ajaxorg/commonjs
Browse files Browse the repository at this point in the history
move code to src folder and switch to commonjs
  • Loading branch information
nightwing authored Aug 4, 2022
2 parents c2c749b + 2398568 commit 416ae9e
Show file tree
Hide file tree
Showing 1,508 changed files with 42,208 additions and 61,993 deletions.
6 changes: 3 additions & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ lib/ace/mode/xml/*
lib/ace/mode/xquery/*
lib/ace/mode/xquery.js
lib/ace/mode/yaml/*
lib/ace/test/asyncjs/
lib/ace/lib/es5-shim.js
lib/ace/keyboard/vim*.js
**/test/asyncjs/*
**/es5-shim.js
**/vim*.js
experiments/
tool/
doc/
Expand Down
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"parserOptions": {
"ecmaVersion": 2015
},
"globals": {
define: true,
require: true,
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm i && npm i eslint istanbul typescript
- run: node_modules/.bin/istanbul cover lib/ace/test/all.js
- run: npm i
- run: npm run cover
- run: |
set -x;
git status;
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ jam/
.git-ref
npm-debug.log
deps/
dist
dist

lib/ace
49 changes: 46 additions & 3 deletions Makefile.dryice.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,56 @@ var ACE_HOME = __dirname;
var BUILD_DIR = ACE_HOME + "/build";
var CACHE = {};

function generateAmdModules() {
var root = ACE_HOME + "/";
function iterate(dir) {
var filenames = fs.readdirSync(root + dir);
filenames.forEach(function(name) {
var path = dir + name;
var stat = fs.statSync(root + path);
var newPath = path.replace("src", "lib/ace");
if (stat.isDirectory()) {
try {
fs.mkdirSync(root + newPath);
} catch(e) {}
iterate(path + "/");
} else if (/\.js/.test(name) && !/worker_client\.js$/.test(name)) {
transform(path, newPath);
}
});
}
function transform(path, newPath) {
var data = fs.readFileSync(root + path, "utf-8");
data = compileTypescript(data);
fs.writeFileSync(root + newPath, data, "utf-8");
}
function compileTypescript(code) {
var ts = require("typescript");
return ts.transpileModule(code, {
compilerOptions: {
newLine: "lf",
downlevelIteration: true,
suppressExcessPropertyErrors: true,
module: ts.ModuleKind.CommonJS,
removeComments: false,
sourceMap: false,
inlineSourceMap: false,
target: "ES5"
},
fileName: ""
}).outputText;
}

iterate("src/");
}

function main(args) {
if (args.indexOf("updateModes") !== -1) {
return updateModes();
}

generateAmdModules();

var type = "minimal";
args = args.map(function(x) {
if (x[0] == "-" && x[1] != "-")
Expand Down Expand Up @@ -594,9 +640,6 @@ function normalizeLineEndings(module) {
function includeLoader(module) {
var pattern = '"include loader_build";';
if (module.source && module.source.indexOf(pattern) != -1) {
console.log("===================================== =====================================");
console.log(module);
console.log("===================================== =====================================");
module.deps.push("ace/loader_build");
module.source = module.source.replace(pattern, 'require("./loader_build")(exports)');
}
Expand Down
2 changes: 1 addition & 1 deletion build
Submodule build updated 1999 files
4 changes: 2 additions & 2 deletions demo/code_lens.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<script src="kitchen-sink/require.js"></script>
<script>
// setup paths
require.config({paths: { "ace" : "../lib/ace"}});
require.config({paths: { "ace" : "../src"}});
// load ace and extensions
require(["ace/ace", "ace/ext/code_lens"], function(ace, codeLens) {
var editor = ace.edit("editor");
Expand Down Expand Up @@ -110,7 +110,7 @@
});

}
callback(p);
callback(null, p);
}
});

Expand Down
34 changes: 0 additions & 34 deletions demo/kitchen-sink/demo.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,3 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */


define(function(require, exports, module) {
"use strict";

require("ace/ext/rtl");
Expand Down Expand Up @@ -556,5 +524,3 @@ function moveFocus() {
else
env.editor.focus();
}

});
33 changes: 0 additions & 33 deletions demo/kitchen-sink/dev_util.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,3 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */

define(function(require, exports, module) {
var ace = require("ace/ace");
var dom = require("ace/lib/dom");
var event = require("ace/lib/event");
Expand Down Expand Up @@ -427,5 +396,3 @@ exports.log = function(str) {
};

exports.addGlobals();

});
34 changes: 0 additions & 34 deletions demo/kitchen-sink/doclist.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,3 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */

define(function(require, exports, module) {
"use strict";

var EditSession = require("ace/edit_session").EditSession;
Expand Down Expand Up @@ -218,6 +187,3 @@ module.exports.all = {
"Huge documents": module.exports.hugeDocs,
"own source": module.exports.ownSource
};

});

2 changes: 1 addition & 1 deletion demo/kitchen-sink/docs/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ function foo(items, nada) {
for (var i=0; i<items.length; i++) {
alert(items[i] + "juhu\n");
} // Real Tab.
}
}
34 changes: 0 additions & 34 deletions demo/kitchen-sink/file_drop.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,3 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */

define(function(require, exports, module) {

var config = require("ace/config");
var event = require("ace/lib/event");
var modelist = require("ace/ext/modelist");
Expand Down Expand Up @@ -69,5 +37,3 @@ config.defineOptions(Editor.prototype, "editor", {
value: true
}
});

});
33 changes: 0 additions & 33 deletions demo/kitchen-sink/inline_editor.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,3 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */


define(function(require, exports, module) {
"use strict";

var LineWidgets = require("ace/line_widgets").LineWidgets;
Expand Down Expand Up @@ -99,4 +67,3 @@ require("ace/commands/default_commands").commands.push({
inlineEditor.setTheme("ace/theme/solarized_light");
}
});
});
7 changes: 0 additions & 7 deletions demo/kitchen-sink/layout.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@

define(function(require, exports, module) {
"use strict";

var dom = require("ace/lib/dom");
Expand Down Expand Up @@ -125,8 +123,3 @@ exports.singleLineEditor = function(el) {

return editor;
};



});

Loading

0 comments on commit 416ae9e

Please sign in to comment.