- rolling most of runtime dependencies into a static build

This commit is contained in:
Eugene Zolenko 2017-09-25 18:22:38 -06:00
parent 2fe9435af8
commit 591ef5d4c7
7 changed files with 38661 additions and 164 deletions

2
dist/host.d.ts vendored
View File

@ -15,7 +15,7 @@ export declare class LanguageServiceHost implements tsTypes.LanguageServiceHost
getDefaultLibFileName(opts: tsTypes.CompilerOptions): string;
useCaseSensitiveFileNames(): boolean;
readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[];
readFile(path: string, encoding?: string): string;
readFile(path: string, encoding?: string): string | undefined;
fileExists(path: string): boolean;
getTypeRootsVersion(): number;
directoryExists(directoryName: string): boolean;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -26,32 +26,29 @@
"lint": "tslint -c ./tslint.json src/*.ts"
},
"dependencies": {
"colors": "^1.1.2",
"fs-extra": "^3.0.1",
"graphlib": "^2.1.1",
"lodash": "^4.17.4",
"object-hash": "^1.1.8",
"rollup-pluginutils": "^2.0.1",
"typescript": "^2.3.4",
"tslib": "^1.7.1",
"resolve": "^1.3.3"
},
"peerDependencies": {
"typescript": "^2.0",
"tslib": "^1.7.1",
"resolve": "^1.3.3"
},
"devDependencies": {
"typescript": "^2.5.2",
"object-hash": "^1.1.8",
"rollup-pluginutils": "^2.0.1",
"colors": "^1.1.2",
"graphlib": "^2.1.1",
"lodash": "^4.17.4",
"@types/colors": "^1.1.3",
"@types/fs-extra": "^3.0.3",
"@types/graphlib": "^2.1.4",
"@types/lodash": "^4.14.67",
"@types/node": "^8.0.1",
"@types/object-hash": "^0.5.28",
"@types/lodash": "^4.14.76",
"@types/node": "^8.0.31",
"@types/object-hash": "^0.5.29",
"@types/resolve": "^0.0.4",
"rimraf": "^2.6.1",
"rollup": "^0.48.2",
"rimraf": "^2.6.2",
"rollup": "^0.50.0",
"rollup-plugin-typescript2": "github:ezolenko/rollup-plugin-typescript2#master",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup-plugin-commonjs": "^8.2.1",
"rollup-watch": "^4.3.1",
"tslint": "^5.7.0"
},

View File

@ -1,31 +1,45 @@
import ts from 'rollup-plugin-typescript2';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
const pkg = require('./package.json');
export default {
entry: 'src/index.ts',
input: 'src/index.ts',
external: [
'path',
'fs',
'fs-extra',
'object-assign',
'rollup-pluginutils',
'typescript',
'lodash',
'graphlib',
'object-hash',
'colors/safe',
'resolve'
"fs",
"fs-extra",
"resolve",
"crypto",
"path",
"constants",
"stream",
"util",
"assert",
"os",
],
plugins: [
ts({ verbosity: 3 }),
resolve({ jsnext: true, preferBuiltins: true }),
commonjs(
{
include: "node_modules/**",
namedExports:
{
"graphlib": [ "alg", "Graph" ],
"colors/safe": [ "green", "white", "red", "yellow", "blue" ],
"lodash": [ "get", "each", "isEqual", "some", "filter", "endsWith", "map", "has", "isFunction", "concat", "find", "defaults" ],
// "fs-extra": [ "renameSync", "removeSync", "ensureFileSync", "writeJsonSync", "readJsonSync", "existsSync", "readdirSync", "emptyDirSync" ],
},
}
),
ts({ verbosity: 3, abortOnError: false }),
],
banner: '/* eslint-disable */',
targets: [
output: [
{
format: 'cjs',
file: pkg.main

View File

@ -39,7 +39,7 @@ export class LanguageServiceHost implements tsTypes.LanguageServiceHost
if (existsSync(fileName))
{
this.snapshots[fileName] = tsModule.ScriptSnapshot.fromString(tsModule.sys.readFile(fileName));
this.snapshots[fileName] = tsModule.ScriptSnapshot.fromString(tsModule.sys.readFile(fileName)!);
this.versions[fileName] = (this.versions[fileName] || 0) + 1;
return this.snapshots[fileName];
}
@ -84,7 +84,7 @@ export class LanguageServiceHost implements tsTypes.LanguageServiceHost
return tsModule.sys.readDirectory(path, extensions, exclude, include);
}
public readFile(path: string, encoding?: string): string
public readFile(path: string, encoding?: string): string | undefined
{
return tsModule.sys.readFile(path, encoding);
}

View File

@ -15,7 +15,7 @@ export function parseTsConfig(tsconfig: string, context: IContext, pluginOptions
throw new Error(`couldn't find '${tsconfig}' in ${process.cwd()}`);
const text = tsModule.sys.readFile(fileName);
const result = tsModule.parseConfigFileTextToJson(fileName, text);
const result = tsModule.parseConfigFileTextToJson(fileName, text!);
if (result.error)
{