Adopt project references

Recent versions of TypeScript has improved the performance of project
references so they are now viable to switch over to.
This commit is contained in:
Daniel Imms
2019-03-30 14:05:24 -07:00
parent 1451bcb6ae
commit 0b78011fa3
11 changed files with 77 additions and 53 deletions
+2 -2
View File
@@ -2,8 +2,8 @@
<html> <html>
<head> <head>
<title>xterm.js demo</title> <title>xterm.js demo</title>
<link rel="stylesheet" href="/build/xterm.css" /> <link rel="stylesheet" href="/src/xterm.css" />
<link rel="stylesheet" href="/build/addons/fullscreen/fullscreen.css" /> <link rel="stylesheet" href="/src/addons/fullscreen/fullscreen.css" />
<link rel="stylesheet" href="style.css" /> <link rel="stylesheet" href="style.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-promise/4.1.1/es6-promise.auto.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/es6-promise/4.1.1/es6-promise.auto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fetch/1.0.0/fetch.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/fetch/1.0.0/fetch.min.js"></script>
+1
View File
@@ -11,6 +11,7 @@ function startServer() {
logs = {}; logs = {};
app.use('/build', express.static(__dirname + '/../build')); app.use('/build', express.static(__dirname + '/../build'));
app.use('/src', express.static(__dirname + '/../src'));
app.get('/', function(req, res){ app.get('/', function(req, res){
res.sendFile(__dirname + '/index.html'); res.sendFile(__dirname + '/index.html');
+5 -5
View File
@@ -16,9 +16,9 @@ const ts = require('gulp-typescript');
const util = require('gulp-util'); const util = require('gulp-util');
const buildDir = process.env.BUILD_DIR || 'build'; const buildDir = process.env.BUILD_DIR || 'build';
const tsProject = ts.createProject('tsconfig.json'); const tsProject = ts.createProject('src/tsconfig.json');
let srcDir = tsProject.config.compilerOptions.rootDir; let srcDir = './src';
let outDir = tsProject.config.compilerOptions.outDir; let outDir = './lib';
const addons = fs.readdirSync(`${__dirname}/src/addons`); const addons = fs.readdirSync(`${__dirname}/src/addons`);
@@ -61,7 +61,7 @@ gulp.task('browserify', function() {
}; };
let bundleStream = browserify(browserifyOptions) let bundleStream = browserify(browserifyOptions)
.bundle() .bundle()
.pipe(source('xterm.js')) .pipe(source(`xterm.js`))
.pipe(buffer()) .pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true, sourceRoot: '..'})) .pipe(sourcemaps.init({loadMaps: true, sourceRoot: '..'}))
.pipe(sourcemaps.write('./')) .pipe(sourcemaps.write('./'))
@@ -136,6 +136,6 @@ gulp.task('sorcery-addons', ['browserify-addons'], function () {
}) })
}); });
gulp.task('build', ['sorcery', 'sorcery-addons']); gulp.task('build', ['css', 'sorcery', 'sorcery-addons']);
gulp.task('test', ['mocha']); gulp.task('test', ['mocha']);
gulp.task('default', ['build']); gulp.task('default', ['build']);
+3 -7
View File
@@ -38,7 +38,7 @@
"ts-loader": "^4.5.0", "ts-loader": "^4.5.0",
"tslint": "^5.9.1", "tslint": "^5.9.1",
"tslint-consistent-codestyle": "^1.13.0", "tslint-consistent-codestyle": "^1.13.0",
"typescript": "3.1", "typescript": "3.4",
"vinyl-buffer": "^1.0.0", "vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0", "vinyl-source-stream": "^1.1.0",
"webpack": "^4.17.1", "webpack": "^4.17.1",
@@ -50,20 +50,16 @@
"start-debug": "node --inspect-brk demo/start", "start-debug": "node --inspect-brk demo/start",
"start-zmodem": "node demo/zmodem/app", "start-zmodem": "node demo/zmodem/app",
"lint": "tslint 'src/**/*.ts' './demo/**/*.ts'", "lint": "tslint 'src/**/*.ts' './demo/**/*.ts'",
"pretest": "npm run layering",
"test": "npm run mocha", "test": "npm run mocha",
"posttest": "npm run lint", "posttest": "npm run lint",
"test-debug": "node --inspect-brk node_modules/.bin/gulp test", "test-debug": "node --inspect-brk node_modules/.bin/gulp test",
"test-suite": "gulp mocha-suite --test", "test-suite": "gulp mocha-suite --test",
"test-coverage": "nyc -x gulpfile.js -x '**/*test*' npm run mocha", "test-coverage": "nyc -x gulpfile.js -x '**/*test*' npm run mocha",
"mocha": "gulp test", "mocha": "gulp test",
"tsc": "tsc", "prebuild": "tsc -b ./src/tsconfig.all.json",
"prebuild": "concurrently --kill-others-on-fail --names \"lib,attach,fit,fullscreen,search,terminado,webLinks,winptyCompat,zmodem,css\" \"tsc\" \"tsc -p ./src/addons/attach\" \"tsc -p ./src/addons/fit\" \"tsc -p ./src/addons/fullscreen\" \"tsc -p ./src/addons/search\" \"tsc -p ./src/addons/terminado\" \"tsc -p ./src/addons/webLinks\" \"tsc -p ./src/addons/winptyCompat\" \"tsc -p ./src/addons/zmodem\" \"gulp css\"",
"build": "gulp build", "build": "gulp build",
"prepublish": "npm run build", "prepublish": "npm run build",
"coveralls": "nyc report --reporter=text-lcov | coveralls", "coveralls": "nyc report --reporter=text-lcov | coveralls",
"watch": "concurrently --kill-others-on-fail --names \"lib,css\" \"tsc -w\" \"gulp watch-css\"", "watch": "tsc -b -w ./src/tsconfig.all.json"
"watch-addons": "concurrently --kill-others-on-fail --names \"attach,fit,fullscreen,search,terminado,webLinks,winptyCompat,zmodem\" \"tsc -w -p ./src/addons/attach\" \"tsc -w -p ./src/addons/fit\" \"tsc -w -p ./src/addons/fullscreen\" \"tsc -w -p ./src/addons/search\" \"tsc -w -p ./src/addons/terminado\" \"tsc -w -p ./src/addons/webLinks\" \"tsc -w -p ./src/addons/winptyCompat\" \"tsc -w -p ./src/addons/zmodem\"",
"layering": "concurrently --kill-others-on-fail --names \"common,core\" \"tsc -p ./src/common\" \"tsc -p ./src/core\""
} }
} }
+2 -12
View File
@@ -1,17 +1,7 @@
{ {
"extends": "../tsconfig-library-base",
"compilerOptions": { "compilerOptions": {
"target": "es5", "outDir": "../../lib"
"lib": [
"es5"
],
"rootDir": ".",
"noEmit": true,
"strict": true,
"pretty": true,
"types": [
"../../node_modules/@types/mocha",
"../../"
]
}, },
"include": [ "include": [
"./**/*" "./**/*"
+6 -14
View File
@@ -1,20 +1,12 @@
{ {
"extends": "../tsconfig-library-base",
"compilerOptions": { "compilerOptions": {
"target": "es5", "outDir": "../../lib"
"lib": [
"es5"
],
"rootDir": ".",
"noEmit": true,
"strict": true,
"pretty": true,
"types": [
"../../node_modules/@types/mocha",
"../../"
]
}, },
"include": [ "include": [
"./**/*", "./**/*"
"../common/**/*" ],
"references": [
{ "path": "../common" }
] ]
} }
+15
View File
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"target": "es5",
"lib": [ "es5" ],
"rootDir": ".",
"sourceMap": true,
"removeComments": true,
"pretty": true,
"incremental": true,
"skipLibCheck": true
}
}
+11
View File
@@ -0,0 +1,11 @@
{
"extends": "./tsconfig-base.json",
"compilerOptions": {
"types": [
"../../node_modules/@types/mocha",
"../../"
],
"composite": true,
"strict": true
}
}
+16
View File
@@ -0,0 +1,16 @@
{
"files": [],
"include": [],
"references": [
{ "path": "." },
{ "path": "./addons/attach" },
{ "path": "./addons/fit" },
{ "path": "./addons/fullscreen" },
{ "path": "./addons/search" },
{ "path": "./addons/terminado" },
{ "path": "./addons/webLinks" },
{ "path": "./addons/winptyCompat" },
{ "path": "./addons/zmodem" }
]
}
+12 -9
View File
@@ -1,7 +1,7 @@
{ {
"extends": "./tsconfig-base",
"compilerOptions": { "compilerOptions": {
"module": "commonjs", "module": "commonjs",
"target": "es5",
"lib": [ "lib": [
"dom", "dom",
"es5", "es5",
@@ -9,19 +9,22 @@
"scripthost", "scripthost",
"es2015.promise" "es2015.promise"
], ],
"rootDir": "src", "rootDir": ".",
"outDir": "lib", "outDir": "../lib",
"sourceMap": true,
"removeComments": true,
"preserveWatchOutput": true,
"noUnusedLocals": true, "noUnusedLocals": true,
"noImplicitAny": true "noImplicitAny": true
}, },
"include": [ "include": [
"src/**/*", "./**/*",
"typings/xterm.d.ts" "../typings/xterm.d.ts"
], ],
"exclude": [ "exclude": [
"src/addons/**/*" "./addons/**/*"
],
"references": [
{ "path": "./common" },
{ "path": "./core" }
] ]
} }
+4 -4
View File
@@ -6633,10 +6633,10 @@ typedarray@^0.0.6, typedarray@~0.0.5:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
typescript@3.1: typescript@3.4:
version "3.1.6" version "3.4.1"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.1.6.tgz#b6543a83cfc8c2befb3f4c8fba6896f5b0c9be68" resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.4.1.tgz#b6691be11a881ffa9a05765a205cb7383f3b63c6"
integrity sha512-tDMYfVtvpb96msS1lDX9MEdHrW4yOuZ4Kdc4Him9oU796XldPYF/t2+uKoX0BBa0hXXwDlqYQbXY5Rzjzc5hBA== integrity sha512-3NSMb2VzDQm8oBTLH6Nj55VVtUEpe/rgkIzMir0qVoLyjDZlnMBva0U6vDiV3IH+sl/Yu6oP5QwsAQtHPmDd2Q==
uglify-es@^3.3.4: uglify-es@^3.3.4:
version "3.3.9" version "3.3.9"