--- /dev/null
+{
+ "presets": ["es2015"]
+}
/*
* Plain browser environment
*/
- attach(this.Xterm);
+ attach(window.Terminal);
}
})(function (Xterm) {
'use strict';
/*
* Plain browser environment
*/
- fit(this.Xterm);
+ fit(window.Terminal);
}
})(function (Xterm) {
/**
/*
* Plain browser environment
*/
- fullscreen(this.Xterm);
+ fullscreen(window.Terminal);
}
})(function (Xterm) {
var exports = {};
/*
* Plain browser environment
*/
- linkify(this.Xterm);
+ linkify(window.Terminal);
}
})(function (Xterm) {
'use strict';
--- /dev/null
+#! /usr/bin/env node
+
+var child_process = require('child_process');
+var fs = require('fs');
+
+var buildDir = process.env.BUILD_DIR || 'build';
+
+if (!fs.existsSync(buildDir)){
+ fs.mkdirSync(buildDir);
+}
+
+// Add `node_modules/.bin` to PATH
+process.env.PATH = process.cwd() + '/node_modules/.bin:' + process.env.PATH;
+
+console.log('Building xterm.js into ' + buildDir);
+
+// Build ES2015 modules into ES5 form, then concatenate them,
+// then remove unused require calls and save in output file with source map.
+console.log(' - Building ' + buildDir + '/xterm.js...');
+
+var jsBuildCmd = 'browserify src/xterm.js -s Terminal -t [ babelify --presets [ es2015 ] ] --debug | ';
+jsBuildCmd += 'derequire | exorcist ' + buildDir + '/xterm.js.map > ' + buildDir + '/xterm.js';
+
+var jsBuildProcess = child_process.execSync(jsBuildCmd);
+
+if (jsBuildProcess.status) {
+ console.log(jsBuildProcess.error);
+}
+
+console.log(' OK.');
+
+// Copy CSS into $BUILD_DIR
+console.log(' - Building ' + buildDir + '/xterm.css...');
+
+fs.createReadStream('src/xterm.css').pipe(
+ fs.createWriteStream(buildDir + '/xterm.css')
+);
+console.log(' OK.');
| sed 's/[",]//g' \
| tr -d '[[:space:]]')
-# Update version in package.json and bower.json
-sed -i "s/\"version\": \"$CURRENT_PACKAGE_JSON_VERSION\"/\"version\": \"$NEW_VERSION\"/g" package.json
-sed -i "s/\"version\": \"$CURRENT_BOWER_JSON_VERSION\"/\"version\": \"$NEW_VERSION\"/g" bower.json
+# Build xterm.js into `dist`
+export BUILD_DIR=dist
+sh bin/build
# Update AUTHORS file
sh bin/generate-authors
+# Update version in package.json and bower.json
+sed -i "s/\"version\": \"$CURRENT_PACKAGE_JSON_VERSION\"/\"version\": \"$NEW_VERSION\"/g" package.json
+sed -i "s/\"version\": \"$CURRENT_BOWER_JSON_VERSION\"/\"version\": \"$NEW_VERSION\"/g" bower.json
+
git commit -S -s -a -m "Bump version to $NEW_VERSION"
git tag $NEW_VERSION
var terminals = {},
logs = {};
-app.use('/src', express.static(__dirname + '/../src'));
+app.use('/build', express.static(__dirname + '/../build'));
app.use('/addons', express.static(__dirname + '/../addons'));
app.get('/', function(req, res){
<html>
<head>
<title>xterm.js demo</title>
- <link rel="stylesheet" href="../src/xterm.css" />
+ <link rel="stylesheet" href="../build/xterm.css" />
<link rel="stylesheet" href="../addons/fullscreen/fullscreen.css" />
<link rel="stylesheet" href="style.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/fetch/1.0.0/fetch.min.js"></script>
- <script src="../src/xterm.js" ></script>
+ <script src="../build/xterm.js" ></script>
<script src="../addons/attach/attach.js" ></script>
<script src="../addons/fit/fit.js" ></script>
<script src="../addons/fullscreen/fullscreen.js" ></script>
"repository": "https://github.com/sourcelair/xterm.js",
"license": "MIT",
"devDependencies": {
+ "babel-core": "6.14.0",
+ "babel-preset-es2015": "6.14.0",
+ "babelify": "^7.3.0",
+ "browserify": "^13.1.0",
"chai": "3.5.0",
+ "derequire": "^2.0.3",
"docdash": "0.4.0",
+ "exorcist": "^0.4.0",
"express": "4.13.4",
"express-ws": "2.0.0-rc.1",
"glob": "^7.0.5",
"jsdoc": "3.4.0",
"mocha": "2.5.3",
+ "nodemon": "1.10.2",
"pty.js": "0.3.1",
"sleep": "^3.0.1"
},
"scripts": {
- "start": "node demo/app",
- "test": "mocha --recursive",
- "build:docs": "node_modules/.bin/jsdoc -c jsdoc.json"
+ "start": "nodemon --watch src --watch addons --exec bash -c './bin/build && node demo/app'",
+ "test": "mocha --recursive --compilers js:babel-core/register",
+ "build:docs": "jsdoc -c jsdoc.json",
+ "build": "./bin/build"
}
}
--- /dev/null
+/**
+ * EventEmitter
+ */
+
+function EventEmitter() {
+ this._events = this._events || {};
+}
+
+EventEmitter.prototype.addListener = function(type, listener) {
+ this._events[type] = this._events[type] || [];
+ this._events[type].push(listener);
+};
+
+EventEmitter.prototype.on = EventEmitter.prototype.addListener;
+
+EventEmitter.prototype.removeListener = function(type, listener) {
+ if (!this._events[type]) return;
+
+ var obj = this._events[type]
+ , i = obj.length;
+
+ while (i--) {
+ if (obj[i] === listener || obj[i].listener === listener) {
+ obj.splice(i, 1);
+ return;
+ }
+ }
+};
+
+EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
+
+EventEmitter.prototype.removeAllListeners = function(type) {
+ if (this._events[type]) delete this._events[type];
+};
+
+EventEmitter.prototype.once = function(type, listener) {
+ var self = this;
+ function on() {
+ var args = Array.prototype.slice.call(arguments);
+ this.removeListener(type, on);
+ return listener.apply(this, args);
+ }
+ on.listener = listener;
+ return this.on(type, on);
+};
+
+EventEmitter.prototype.emit = function(type) {
+ if (!this._events[type]) return;
+
+ var args = Array.prototype.slice.call(arguments, 1)
+ , obj = this._events[type]
+ , l = obj.length
+ , i = 0;
+
+ for (; i < l; i++) {
+ obj[i].apply(this, args);
+ }
+};
+
+EventEmitter.prototype.listeners = function(type) {
+ return this._events[type] = this._events[type] || [];
+};
+
+export { EventEmitter };
* other features.
*/
-(function (xterm) {
- if (typeof exports === 'object' && typeof module === 'object') {
- /*
- * CommonJS environment
- */
- module.exports = xterm.call(this);
- } else if (typeof define == 'function') {
- /*
- * Require.js is available
- */
- define([], xterm.bind(window));
- } else {
- /*
- * Plain browser environment
- */
- this.Xterm = xterm.call(this);
- this.Terminal = this.Xterm; /* Backwards compatibility with term.js */
- }
-})(function() {
+import { EventEmitter } from './EventEmitter.js';
+
/**
* Terminal Emulation References:
* http://vt100.net/
* http://linux.die.net/man/7/urxvt
*/
- 'use strict';
-
- /**
- * Shared
- */
-
- var window = this, document = this.document;
-
- /**
- * EventEmitter
- */
-
- function EventEmitter() {
- this._events = this._events || {};
- }
-
- EventEmitter.prototype.addListener = function(type, listener) {
- this._events[type] = this._events[type] || [];
- this._events[type].push(listener);
- };
-
- EventEmitter.prototype.on = EventEmitter.prototype.addListener;
-
- EventEmitter.prototype.removeListener = function(type, listener) {
- if (!this._events[type]) return;
-
- var obj = this._events[type]
- , i = obj.length;
-
- while (i--) {
- if (obj[i] === listener || obj[i].listener === listener) {
- obj.splice(i, 1);
- return;
- }
- }
- };
-
- EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
-
- EventEmitter.prototype.removeAllListeners = function(type) {
- if (this._events[type]) delete this._events[type];
- };
-
- EventEmitter.prototype.once = function(type, listener) {
- var self = this;
- function on() {
- var args = Array.prototype.slice.call(arguments);
- this.removeListener(type, on);
- return listener.apply(this, args);
- }
- on.listener = listener;
- return this.on(type, on);
- };
-
- EventEmitter.prototype.emit = function(type) {
- if (!this._events[type]) return;
-
- var args = Array.prototype.slice.call(arguments, 1)
- , obj = this._events[type]
- , l = obj.length
- , i = 0;
-
- for (; i < l; i++) {
- obj[i].apply(this, args);
- }
- };
-
- EventEmitter.prototype.listeners = function(type) {
- return this._events[type] = this._events[type] || [];
- };
-
+ // Let it work inside Node.js for automated testing purposes.
+ var document = (typeof window != 'undefined') ? window.document : null;
/**
* Encapsulates the logic for handling compositionstart, compositionupdate and compositionend
return w1 !== w2;
}
- var String = this.String;
- var setTimeout = this.setTimeout;
- var setInterval = this.setInterval;
-
function indexOf(obj, el) {
var i = obj.length;
while (i--) {
Terminal.off = off;
Terminal.cancel = cancel;
-
- return Terminal;
-});
+module.exports = Terminal;
remove: function () {},
},
getBoundingClientRect: function () {
- return { width: 0 }
+ return { width: 0 };
},
style: {
left: 0,
return b.toString('utf8', 0, bytes);
}
-// make sure raw pty is at x=0 and has no pending data
+// make sure raw pty is at x=0 and has no pending data
function pty_reset() {
pty_write_read('\r\n');
}
var viewportElement;
var charMeasureElement;
var viewport;
+ var scrollAreaElement;
var CHARACTER_HEIGHT = 10;