fix(language-service): remove tsickle dependency
Removes the tsickle dependency added when tsickle was added to the transform compiler. Added a test to ensure stray dependencies are not added and no errors are introduced during module flattening.
This commit is contained in:
@ -9,6 +9,11 @@ source scripts/env.sh
|
||||
HOST="node tools/typescript_host.js"
|
||||
VALIDATE="node tools/typescript_validator.js"
|
||||
|
||||
# Ensure the languages service can load correctly in node before typescript loads it.
|
||||
# This verifies its dependencies and emits any exceptions, both of which are only
|
||||
# emitted to the typescript logs (not the validated output).
|
||||
node tools/load_test.js
|
||||
|
||||
for TYPESCRIPT in ${TYPESCRIPTS[@]}
|
||||
do
|
||||
SERVER="node typescripts/$TYPESCRIPT/node_modules/typescript/lib/tsserver.js"
|
||||
|
35
integration/language_service_plugin/tools/load_test.ts
Normal file
35
integration/language_service_plugin/tools/load_test.ts
Normal file
@ -0,0 +1,35 @@
|
||||
const ts = require('typescript');
|
||||
const Module = require('module');
|
||||
|
||||
const existingRequire = Module.prototype.require;
|
||||
|
||||
const recordedRequires: string[] = [];
|
||||
|
||||
function recordingRequire(path: string) {
|
||||
recordedRequires.push(path);
|
||||
return existingRequire.call(this, path);
|
||||
}
|
||||
|
||||
Module.prototype.require = recordingRequire;
|
||||
|
||||
try {
|
||||
const lsf = require('@angular/language-service');
|
||||
const ls = lsf({typescript: ts});
|
||||
|
||||
// Assert that the only module that should have been required are '@angular/langauge-service', 'fs', and 'path'
|
||||
|
||||
const allowedLoads = new Set(["@angular/language-service", "fs", "path"]);
|
||||
|
||||
const invalidModules = recordedRequires.filter(m => !allowedLoads.has(m));
|
||||
|
||||
if (invalidModules.length > 0) {
|
||||
console.error(`FAILED: Loading the language service required: ${invalidModules.join(', ')}`);
|
||||
process.exit(1);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(`FAILED: Loading the language service caused the following exception: ${e.stack || e}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log('SUCCESS: Loading passed')
|
||||
process.exit(0);
|
@ -13,6 +13,7 @@
|
||||
},
|
||||
"files": [
|
||||
"typescript_host.ts",
|
||||
"typescript_validator.ts"
|
||||
"typescript_validator.ts",
|
||||
"load_test.ts"
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user