+++ /dev/null
-{
- "presets": ["es2015"]
-}
/*
* CommonJS environment
*/
- module.exports = attach(require('../../src/xterm'));
+ module.exports = attach(require('../../build/xterm'));
} else if (typeof define == 'function') {
/*
* Require.js is available
*/
- define(['../../src/xterm'], attach);
+ define(['../../build/xterm'], attach);
} else {
/*
* Plain browser environment
/*
* CommonJS environment
*/
- module.exports = fit(require('../../src/xterm'));
+ module.exports = fit(require('../../build/xterm'));
} else if (typeof define == 'function') {
/*
* Require.js is available
*/
- define(['../../src/xterm'], fit);
+ define(['../../build/xterm'], fit);
} else {
/*
* Plain browser environment
/*
* CommonJS environment
*/
- module.exports = fullscreen(require('../../src/xterm'));
+ module.exports = fullscreen(require('../../build/xterm'));
} else if (typeof define == 'function') {
/*
* Require.js is available
*/
- define(['../../src/xterm'], fullscreen);
+ define(['../../build/xterm'], fullscreen);
} else {
/*
* Plain browser environment
/*
* CommonJS environment
*/
- module.exports = linkify(require('../../src/xterm'));
+ module.exports = linkify(require('../../build/xterm'));
} else if (typeof define == 'function') {
/*
* Require.js is available
*/
- define(['../../src/xterm'], linkify);
+ define(['../../build/xterm'], linkify);
} else {
/*
* Plain browser environment
-#! /usr/bin/env node
+#! /usr/bin/env sh
-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.');
+mkdir -p build
+browserify src/xterm.js --standalone Terminal -p [ tsify ] --outfile build/xterm.js
+cp src/xterm.css build/xterm.css
"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",
+ "@types/node": "^6.0.41",
"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",
"mocha": "2.5.3",
"nodemon": "1.10.2",
"pty.js": "0.3.1",
- "sleep": "^3.0.1"
+ "sleep": "^3.0.1",
+ "tsify": "^1.0.7",
+ "typescript": "^2.0.3",
+ "typings": "^1.4.0"
},
"scripts": {
"start": "nodemon --watch src --watch addons --exec bash -c './bin/build && node demo/app'",
- "test": "mocha --recursive --compilers js:babel-core/register",
+ "test": "./bin/build && mocha --recursive",
"build:docs": "jsdoc -c jsdoc.json",
"build": "./bin/build"
}
Terminal.loadAddon = function(addon, callback) {
if (typeof exports === 'object' && typeof module === 'object') {
// CommonJS
- return require(__dirname + '/../addons/' + addon);
+ return require('../addons/' + addon);
} else if (typeof define == 'function') {
// RequireJS
return require(['../addons/' + addon + '/' + addon], callback);
var assert = require('chai').assert;
-var Terminal = require('../../src/xterm');
+var Terminal = require('../../build/xterm');
var linkify = require('../../addons/linkify/linkify');
describe('linkify addon', function () {
var assert = require('chai').assert;
-var Terminal = require('../../src/xterm');
+var Terminal = require('../../build/xterm');
describe('xterm.js addons', function() {
it('should load addons with Terminal.loadAddon', function () {
var assert = require('chai').assert;
-var Terminal = require('../src/xterm');
+var Terminal = require('../build/xterm');
describe('CompositionHelper', function () {
var terminal;
--- /dev/null
+var glob = require('glob');
+var fs = require('fs');
+var pty = require('pty.js');
+var sleep = require('sleep');
+var Terminal = require('../build/xterm');
+
+var CONSOLE_LOG = console.log;
+
+// expect files need terminal at 80x25!
+var COLS = 80;
+var ROWS = 25;
+
+/** some helpers for pty interaction */
+// we need a pty in between to get the termios decorations
+// for the basic test cases a raw pty device is enough
+var primitive_pty = pty.native.open(COLS, ROWS);
+
+// fake sychronous pty write - read
+// we just pipe the data from slave to master as a child program would do
+// pty.js opens pipe fds with O_NONBLOCK
+// just wait 10ms instead of setting fds to blocking mode
+function pty_write_read(s) {
+ fs.writeSync(primitive_pty.slave, s);
+ sleep.usleep(10000);
+ var b = Buffer(64000);
+ var bytes = fs.readSync(primitive_pty.master, b, 0, 64000);
+ return b.toString('utf8', 0, bytes);
+}
+
+// make sure raw pty is at x=0 and has no pending data
+function pty_reset() {
+ pty_write_read('\r\n');
+}
+
+/* debug helpers */
+// generate colorful noisy output to compare xterm and emulator cell states
+function formatError(in_, out_, expected) {
+ function addLineNumber(start, color) {
+ var counter = start || 0;
+ return function(s) {
+ counter += 1;
+ return '\x1b[33m' + (' ' + counter).slice(-2) + color + s;
+ }
+ }
+ var line80 = '12345678901234567890123456789012345678901234567890123456789012345678901234567890';
+ var s = '';
+ s += '\n\x1b[34m' + JSON.stringify(in_);
+ s += '\n\x1b[33m ' + line80 + '\n';
+ s += out_.split('\n').map(addLineNumber(0, '\x1b[31m')).join('\n');
+ s += '\n\x1b[33m ' + line80 + '\n';
+ s += expected.split('\n').map(addLineNumber(0, '\x1b[32m')).join('\n');
+ return s;
+}
+
+// simple debug output of terminal cells
+function terminalToString(term) {
+ var result = '';
+ var line_s = '';
+ for (var line=0; line<term.rows; ++line) {
+ line_s = '';
+ for (var cell=0; cell<term.cols; ++cell) {
+ line_s += term.lines[line][cell][1];
+ }
+ // rtrim empty cells as xterm does
+ line_s = line_s.replace(/\s+$/, '');
+ result += line_s;
+ result += '\n';
+ }
+ return result;
+}
+
+/** tests */
+describe('xterm output comparison', function() {
+ var xterm;
+
+ beforeEach(function () {
+ xterm = new Terminal(COLS, ROWS);
+ xterm.refresh = function() {};
+ });
+
+ // omit stack trace for escape sequence files
+ Error.stackTraceLimit = 0;
+ var files = glob.sync('test/escape_sequence_files/*.in');
+ // only successful tests for now
+ var successful = [0, 2, 6, 12, 13, 18, 20, 22, 27, 28];
+ for (var a in successful) {
+ var i = successful[a];
+ (function(filename){
+ it(filename.split('/').slice(-1)[0], function () {
+ pty_reset();
+ var in_file = fs.readFileSync(filename, 'utf8');
+ var from_pty = pty_write_read(in_file);
+ // uncomment this to get log from terminal
+ console.log = function(){};
+ xterm.write(from_pty);
+ var from_emulator = terminalToString(xterm);
+ console.log = CONSOLE_LOG;
+ var expected = fs.readFileSync(filename.split('.')[0] + '.text', 'utf8');
+ if (from_emulator != expected) {
+ // uncomment to get noisy output
+ //throw new Error(formatError(in_file, from_emulator, expected));
+ throw new Error('mismatch');
+ }
+ });
+ })(files[i]);
+ }
+});
+
+++ /dev/null
-var glob = require('glob');
-var fs = require('fs');
-var pty = require('pty.js');
-var sleep = require('sleep');
-var Terminal = require('../src/xterm');
-
-var CONSOLE_LOG = console.log;
-
-// expect files need terminal at 80x25!
-var COLS = 80;
-var ROWS = 25;
-
-/** some helpers for pty interaction */
-// we need a pty in between to get the termios decorations
-// for the basic test cases a raw pty device is enough
-var primitive_pty = pty.native.open(COLS, ROWS);
-
-// fake sychronous pty write - read
-// we just pipe the data from slave to master as a child program would do
-// pty.js opens pipe fds with O_NONBLOCK
-// just wait 10ms instead of setting fds to blocking mode
-function pty_write_read(s) {
- fs.writeSync(primitive_pty.slave, s);
- sleep.usleep(10000);
- var b = Buffer(64000);
- var bytes = fs.readSync(primitive_pty.master, b, 0, 64000);
- return b.toString('utf8', 0, bytes);
-}
-
-// make sure raw pty is at x=0 and has no pending data
-function pty_reset() {
- pty_write_read('\r\n');
-}
-
-/* debug helpers */
-// generate colorful noisy output to compare xterm and emulator cell states
-function formatError(in_, out_, expected) {
- function addLineNumber(start, color) {
- var counter = start || 0;
- return function(s) {
- counter += 1;
- return '\x1b[33m' + (' ' + counter).slice(-2) + color + s;
- }
- }
- var line80 = '12345678901234567890123456789012345678901234567890123456789012345678901234567890';
- var s = '';
- s += '\n\x1b[34m' + JSON.stringify(in_);
- s += '\n\x1b[33m ' + line80 + '\n';
- s += out_.split('\n').map(addLineNumber(0, '\x1b[31m')).join('\n');
- s += '\n\x1b[33m ' + line80 + '\n';
- s += expected.split('\n').map(addLineNumber(0, '\x1b[32m')).join('\n');
- return s;
-}
-
-// simple debug output of terminal cells
-function terminalToString(term) {
- var result = '';
- var line_s = '';
- for (var line=0; line<term.rows; ++line) {
- line_s = '';
- for (var cell=0; cell<term.cols; ++cell) {
- line_s += term.lines[line][cell][1];
- }
- // rtrim empty cells as xterm does
- line_s = line_s.replace(/\s+$/, '');
- result += line_s;
- result += '\n';
- }
- return result;
-}
-
-/** tests */
-describe('xterm output comparison', function() {
- var xterm;
-
- beforeEach(function () {
- xterm = new Terminal(COLS, ROWS);
- xterm.refresh = function() {};
- });
-
- // omit stack trace for escape sequence files
- Error.stackTraceLimit = 0;
- var files = glob.sync('test/escape_sequence_files/*.in');
- // only successful tests for now
- var successful = [0, 2, 6, 12, 13, 18, 20, 22, 27, 28];
- for (var a in successful) {
- var i = successful[a];
- (function(filename){
- it(filename.split('/').slice(-1)[0], function () {
- pty_reset();
- var in_file = fs.readFileSync(filename, 'utf8');
- var from_pty = pty_write_read(in_file);
- // uncomment this to get log from terminal
- console.log = function(){};
- xterm.write(from_pty);
- var from_emulator = terminalToString(xterm);
- console.log = CONSOLE_LOG;
- var expected = fs.readFileSync(filename.split('.')[0] + '.text', 'utf8');
- if (from_emulator != expected) {
- // uncomment to get noisy output
- //throw new Error(formatError(in_file, from_emulator, expected));
- throw new Error('mismatch');
- }
- });
- })(files[i]);
- }
-});
-
var assert = require('chai').assert;
var expect = require('chai').expect;
-var Terminal = require('../src/xterm');
+var Terminal = require('../build/xterm');
describe('xterm.js', function() {
var xterm;
var assert = require('chai').assert;
-var Terminal = require('../src/xterm');
+var Terminal = require('../build/xterm');
describe('Viewport', function () {
var terminal;
--- /dev/null
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es5",
+ "rootDir": "src",
+ "allowJs": true
+ },
+ "exclude": [
+ "addons",
+ "build",
+ "demo",
+ "out",
+ "test",
+ "node_modules"
+ ]
+}
--- /dev/null
+{
+ "name": "xterm",
+ "globalDependencies": {
+ "node": "registry:env/node#6.0.0+20160918225031"
+ }
+}