mirror of
https://github.com/denoland/deno.git
synced 2025-01-03 04:48:52 -05:00
fix(tsc): config resolution using relative paths (#7392)
This commit is contained in:
parent
79b2510617
commit
c14436a424
2 changed files with 22 additions and 7 deletions
|
@ -75,6 +75,24 @@ Deno.test({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Deno.test({
|
||||||
|
name: "Deno.compile() - pass outDir in compiler options",
|
||||||
|
async fn() {
|
||||||
|
const [diagnostics, actual] = await Deno.compile(
|
||||||
|
"src/foo.ts",
|
||||||
|
{
|
||||||
|
"src/foo.ts": "console.log('Hello world')",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
outDir: "./lib",
|
||||||
|
},
|
||||||
|
);
|
||||||
|
assert(diagnostics == null);
|
||||||
|
assert(actual);
|
||||||
|
assertEquals(Object.keys(actual), ["lib/foo.js.map", "lib/foo.js"]);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
Deno.test({
|
Deno.test({
|
||||||
name: "Deno.compile() - properly handles .d.ts files",
|
name: "Deno.compile() - properly handles .d.ts files",
|
||||||
async fn() {
|
async fn() {
|
||||||
|
|
|
@ -299,6 +299,7 @@ delete Object.prototype.__proto__;
|
||||||
// it makes sense to use the same scheme here.
|
// it makes sense to use the same scheme here.
|
||||||
const ASSETS = "asset://";
|
const ASSETS = "asset://";
|
||||||
const OUT_DIR = "deno://";
|
const OUT_DIR = "deno://";
|
||||||
|
const CACHE = "cache:///";
|
||||||
// This constant is passed to compiler settings when
|
// This constant is passed to compiler settings when
|
||||||
// doing incremental compiles. Contents of this
|
// doing incremental compiles. Contents of this
|
||||||
// file are passed back to Rust and saved to $DENO_DIR.
|
// file are passed back to Rust and saved to $DENO_DIR.
|
||||||
|
@ -382,13 +383,10 @@ delete Object.prototype.__proto__;
|
||||||
const RESOLVED_SPECIFIER_CACHE = new Map();
|
const RESOLVED_SPECIFIER_CACHE = new Map();
|
||||||
|
|
||||||
function parseCompilerOptions(compilerOptions) {
|
function parseCompilerOptions(compilerOptions) {
|
||||||
// TODO(bartlomieju): using `/` and `/tsconfig.json` because
|
|
||||||
// otherwise TSC complains that some paths are relative
|
|
||||||
// and some are absolute
|
|
||||||
const { options, errors } = ts.convertCompilerOptionsFromJson(
|
const { options, errors } = ts.convertCompilerOptionsFromJson(
|
||||||
compilerOptions,
|
compilerOptions,
|
||||||
"/",
|
"",
|
||||||
"/tsconfig.json",
|
"tsconfig.json",
|
||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
options,
|
options,
|
||||||
|
@ -491,7 +489,7 @@ delete Object.prototype.__proto__;
|
||||||
}
|
}
|
||||||
|
|
||||||
getCurrentDirectory() {
|
getCurrentDirectory() {
|
||||||
return "";
|
return CACHE;
|
||||||
}
|
}
|
||||||
|
|
||||||
getDefaultLibFileName(_options) {
|
getDefaultLibFileName(_options) {
|
||||||
|
@ -1333,7 +1331,6 @@ delete Object.prototype.__proto__;
|
||||||
target,
|
target,
|
||||||
createRuntimeCompileWriteFile(state),
|
createRuntimeCompileWriteFile(state),
|
||||||
);
|
);
|
||||||
|
|
||||||
const program = ts.createProgram({
|
const program = ts.createProgram({
|
||||||
rootNames,
|
rootNames,
|
||||||
options: host.getCompilationSettings(),
|
options: host.getCompilationSettings(),
|
||||||
|
|
Loading…
Reference in a new issue