Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
node_modules/
*.swp
build/*
.lock-wscript
out/
Makefile.gyp
Expand All @@ -12,3 +11,4 @@ docs/
npm-debug.log
/.idea/
.env
dist/*
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- 4
- 6
env:
- CXX=g++-4.8
addons:
Expand Down
47 changes: 13 additions & 34 deletions bin/build
Original file line number Diff line number Diff line change
@@ -1,38 +1,17 @@
#! /usr/bin/env node
#! /usr/bin/env bash

var child_process = require('child_process');
var fs = require('fs');
# Build all TypeScript files (including tests) to out/
tsc

var buildDir = process.env.BUILD_DIR || 'build';
# Concat all xterm.js files into a single file and output as a UMD to dist/xterm.js
browserify out/xterm.js --standalone Terminal -p [ tsify ] --outfile dist/xterm.js

if (!fs.existsSync(buildDir)){
fs.mkdirSync(buildDir);
}
# Copy all CSS files from src/ to dist/
cd src
find . -name '*.css' | cpio -pdm ../dist
cd ..

// 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.');
# Copy addons from out/ to dist/
cd out/addons
find . -name '*.js' | cpio -pdm ../../dist/addons
cd ../..
1 change: 0 additions & 1 deletion demo/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ var terminals = {},
logs = {};

app.use('/build', express.static(__dirname + '/../build'));
app.use('/addons', express.static(__dirname + '/../addons'));

app.get('/', function(req, res){
res.sendFile(__dirname + '/index.html');
Expand Down
10 changes: 5 additions & 5 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
<head>
<title>xterm.js demo</title>
<link rel="stylesheet" href="../build/xterm.css" />
<link rel="stylesheet" href="../addons/fullscreen/fullscreen.css" />
<link rel="stylesheet" href="../build/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="../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>
<script src="/build/xterm.js" ></script>
<script src="/build/addons/attach/attach.js" ></script>
<script src="/build/addons/fit/fit.js" ></script>
<script src="/build/addons/fullscreen/fullscreen.js" ></script>
</head>
<body>
<h1>xterm.js: xterm, in the browser</h1>
Expand Down
14 changes: 6 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,24 @@
"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",
"jsdoc": "3.4.0",
"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"
},
"scripts": {
"start": "nodemon --watch src --watch addons --exec bash -c './bin/build && node demo/app'",
"test": "mocha --recursive --compilers js:babel-core/register",
"start": "nodemon --watch src --watch addons --watch demo --exec bash -c './bin/build && node demo/app'",
"test": "./bin/build && mocha --recursive ./out",
"build:docs": "jsdoc -c jsdoc.json",
"build": "./bin/build"
}
Expand Down
4 changes: 2 additions & 2 deletions addons/attach/attach.js → src/addons/attach/attach.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
/*
* CommonJS environment
*/
module.exports = attach(require('../../dist/xterm'));
module.exports = attach(require('../../xterm'));
} else if (typeof define == 'function') {
/*
* Require.js is available
*/
define(['../../dist/xterm'], attach);
define(['../../xterm'], attach);
} else {
/*
* Plain browser environment
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions addons/fit/fit.js → src/addons/fit/fit.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
/*
* CommonJS environment
*/
module.exports = fit(require('../../dist/xterm'));
module.exports = fit(require('../../xterm'));
} else if (typeof define == 'function') {
/*
* Require.js is available
*/
define(['../../dist/xterm'], fit);
define(['../../xterm'], fit);
} else {
/*
* Plain browser environment
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
/*
* CommonJS environment
*/
module.exports = fullscreen(require('../../dist/xterm'));
module.exports = fullscreen(require('../../xterm'));
} else if (typeof define == 'function') {
/*
* Require.js is available
*/
define(['../../dist/xterm'], fullscreen);
define(['../../xterm'], fullscreen);
} else {
/*
* Plain browser environment
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions addons/linkify/linkify.js → src/addons/linkify/linkify.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
/*
* CommonJS environment
*/
module.exports = linkify(require('../../dist/xterm'));
module.exports = linkify(require('../../xterm'));
} else if (typeof define == 'function') {
/*
* Require.js is available
*/
define(['../../dist/xterm'], linkify);
define(['../../xterm'], linkify);
} else {
/*
* Plain browser environment
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
/*
* CommonJS environment
*/
module.exports = attach(require('../../src/xterm'));
module.exports = attach(require('../../xterm'));
} else if (typeof define == 'function') {
/*
* Require.js is available
*/
define(['../../src/xterm'], attach);
define(['../../xterm'], attach);
} else {
/*
* Plain browser environment
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var assert = require('chai').assert;
var Terminal = require('../../dist/xterm');
var Terminal = require('../../xterm');
var linkify = require('../../addons/linkify/linkify');

describe('linkify addon', function () {
Expand Down
5 changes: 2 additions & 3 deletions test/addons/test.js → src/test/addons/test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
var assert = require('chai').assert;
var Terminal = require('../../src/xterm');
var distTerminal = require('../../dist/xterm');
var Terminal = require('../../xterm');

describe('xterm.js addons', function() {
it('should load addons with Terminal.loadAddon', function () {
Terminal.loadAddon('attach');
// Test that addon was loaded successfully
assert.equal(typeof distTerminal.prototype.attach, 'function');
assert.equal(typeof Terminal.prototype.attach, 'function');
});
});
4 changes: 2 additions & 2 deletions test/clipboard-test.js → src/test/clipboard-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var assert = require('chai').assert;
var Terminal = require('../src/xterm');
var Clipboard = require('../src/handlers/Clipboard');
var Terminal = require('../xterm');
var Clipboard = require('../handlers/Clipboard');


describe('evaluateCopiedTextProcessing', function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var assert = require('chai').assert;
var Terminal = require('../src/xterm');
var Terminal = require('../xterm');

describe('CompositionHelper', function () {
var terminal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var glob = require('glob');
var fs = require('fs');
var pty = require('pty.js');
var sleep = require('sleep');
var Terminal = require('../src/xterm');
var Terminal = require('../xterm');

var CONSOLE_LOG = console.log;

Expand Down Expand Up @@ -80,9 +80,10 @@ describe('xterm output comparison', function() {

// omit stack trace for escape sequence files
Error.stackTraceLimit = 0;
var files = glob.sync('test/escape_sequence_files/*.in');
var files = glob.sync('**/escape_sequence_files/*.in');
// only successful tests for now
var successful = [0, 2, 6, 12, 13, 18, 20, 22, 27, 28];
console.log(files);
for (var a in successful) {
var i = successful[a];
(function(filename){
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion test/test.js → src/test/test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var assert = require('chai').assert;
var expect = require('chai').expect;
var Terminal = require('../src/xterm');
var Terminal = require('../xterm');

describe('xterm.js', function() {
var xterm;
Expand Down
2 changes: 1 addition & 1 deletion test/viewport-test.js → src/test/viewport-test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var assert = require('chai').assert;
var Terminal = require('../src/xterm');
var Terminal = require('../xterm');

describe('Viewport', function () {
var terminal;
Expand Down
4 changes: 2 additions & 2 deletions src/xterm.js
Original file line number Diff line number Diff line change
Expand Up @@ -647,10 +647,10 @@ Terminal.prototype.open = function(parent) {
Terminal.loadAddon = function(addon, callback) {
if (typeof exports === 'object' && typeof module === 'object') {
// CommonJS
return require('../addons/' + addon);
return require('./addons/' + addon + '/' + addon);
} else if (typeof define == 'function') {
// RequireJS
return require(['../addons/' + addon + '/' + addon], callback);
return require(['./addons/' + addon + '/' + addon], callback);
} else {
console.error('Cannot load a module without a CommonJS or RequireJS environment.');
return false;
Expand Down
18 changes: 18 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"rootDir": "src",
"allowJs": true,
"outDir": "out"
},
"exclude": [
"addons",
"build",
"demo",
"dist",
"out",
"test",
"node_modules"
]
}
6 changes: 6 additions & 0 deletions typings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "xterm",
"globalDependencies": {
"node": "registry:env/node#6.0.0+20160918225031"
}
}