mirror of
https://github.com/denoland/deno.git
synced 2024-12-27 09:39:08 -05:00
fix(cli): fix paths in internal stack traces (#5093)
This commit updates "deno_typescript" crate to properly map bundle entrypoint file to internal specifier. All import specifiers were remapped from "file:///a/b/c.ts" to "$deno$/a/b/c.ts", but that was not the case for entrypoint file "main.ts" and "compiler.ts". Because of that internal stack traces were inconsistent; showing "file:///some/random/path/on/ci/machine.ts" URL in frames that originate from "main.ts" or "compiler.ts" and "$deno$/file.ts" for all other imports.
This commit is contained in:
parent
5875bb9c0d
commit
9cd7d59840
9 changed files with 53 additions and 42 deletions
|
@ -4,6 +4,6 @@ error: Uncaught TypeError: Cannot resolve extension for "[WILDCARD]config.json"
|
|||
at new SourceFile ($deno$/compiler/sourcefile.ts:[WILDCARD])
|
||||
at processImports ($deno$/compiler/imports.ts:[WILDCARD])
|
||||
at async Object.processImports ($deno$/compiler/imports.ts:[WILDCARD])
|
||||
at async compile ([WILDCARD]compiler.ts:[WILDCARD])
|
||||
at async tsCompilerOnMessage ([WILDCARD]compiler.ts:[WILDCARD])
|
||||
at async compile ($deno$/compiler.ts:[WILDCARD])
|
||||
at async tsCompilerOnMessage ($deno$/compiler.ts:[WILDCARD])
|
||||
at async workerMessageRecvCallback ($deno$/runtime_worker.ts:[WILDCARD])
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
[WILDCARD]error: Uncaught NotFound: Cannot resolve module "[WILDCARD]/bad-module.ts" from "[WILDCARD]/error_004_missing_module.ts"
|
||||
at unwrapResponse ([WILDCARD]dispatch_json.ts:[WILDCARD])
|
||||
at Object.sendAsync ([WILDCARD]dispatch_json.ts:[WILDCARD])
|
||||
at async processImports ([WILDCARD]compiler/imports.ts:[WILDCARD])
|
||||
at async Object.processImports ([WILDCARD]compiler/imports.ts:[WILDCARD])
|
||||
at async compile ([WILDCARD]compiler.ts:[WILDCARD])
|
||||
at async tsCompilerOnMessage ([WILDCARD]compiler.ts:[WILDCARD])
|
||||
at async processImports ($deno$/compiler/imports.ts:[WILDCARD])
|
||||
at async Object.processImports ($deno$/compiler/imports.ts:[WILDCARD])
|
||||
at async compile ($deno$/compiler.ts:[WILDCARD])
|
||||
at async tsCompilerOnMessage ($deno$/compiler.ts:[WILDCARD])
|
||||
at async workerMessageRecvCallback ([WILDCARD]runtime_worker.ts:[WILDCARD])
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
[WILDCARD]error: Uncaught NotFound: Cannot resolve module "[WILDCARD]/bad-module.ts" from "[WILDCARD]/error_005_missing_dynamic_import.ts"
|
||||
at unwrapResponse ([WILDCARD]dispatch_json.ts:[WILDCARD])
|
||||
at Object.sendAsync ([WILDCARD]dispatch_json.ts:[WILDCARD])
|
||||
at async processImports ([WILDCARD]compiler/imports.ts:[WILDCARD])
|
||||
at async Object.processImports ([WILDCARD]compiler/imports.ts:[WILDCARD])
|
||||
at async compile ([WILDCARD]compiler.ts:[WILDCARD])
|
||||
at async tsCompilerOnMessage ([WILDCARD]compiler.ts:[WILDCARD])
|
||||
at async processImports ($deno$/compiler/imports.ts:[WILDCARD])
|
||||
at async Object.processImports ($deno$/compiler/imports.ts:[WILDCARD])
|
||||
at async compile ($deno$/compiler.ts:[WILDCARD])
|
||||
at async tsCompilerOnMessage ($deno$/compiler.ts:[WILDCARD])
|
||||
at async workerMessageRecvCallback ([WILDCARD]runtime_worker.ts:[WILDCARD])
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
[WILDCARD]error: Uncaught NotFound: Cannot resolve module "[WILDCARD]/non-existent" from "[WILDCARD]/error_006_import_ext_failure.ts"
|
||||
at unwrapResponse ([WILDCARD]dispatch_json.ts:[WILDCARD])
|
||||
at Object.sendAsync ([WILDCARD]dispatch_json.ts:[WILDCARD])
|
||||
at async processImports ([WILDCARD]compiler/imports.ts:[WILDCARD])
|
||||
at async Object.processImports ([WILDCARD]compiler/imports.ts:[WILDCARD])
|
||||
at async compile ([WILDCARD]compiler.ts:[WILDCARD])
|
||||
at async tsCompilerOnMessage ([WILDCARD]compiler.ts:[WILDCARD])
|
||||
at async processImports ($deno$/compiler/imports.ts:[WILDCARD])
|
||||
at async Object.processImports ($deno$/compiler/imports.ts:[WILDCARD])
|
||||
at async compile ($deno$/compiler.ts:[WILDCARD])
|
||||
at async tsCompilerOnMessage ($deno$/compiler.ts:[WILDCARD])
|
||||
at async workerMessageRecvCallback ([WILDCARD]runtime_worker.ts:[WILDCARD])
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
[WILDCARD]error: Uncaught URIError: relative import path "bad-module.ts" not prefixed with / or ./ or ../ Imported from "[WILDCARD]/error_011_bad_module_specifier.ts"
|
||||
at unwrapResponse ([WILDCARD]ops/dispatch_json.ts:[WILDCARD])
|
||||
at Object.sendSync ([WILDCARD]ops/dispatch_json.ts:[WILDCARD])
|
||||
at resolveModules ([WILDCARD]compiler/imports.ts:[WILDCARD])
|
||||
at processImports ([WILDCARD]compiler/imports.ts:[WILDCARD])
|
||||
at Object.processImports ([WILDCARD]compiler/imports.ts:[WILDCARD])
|
||||
at async compile ([WILDCARD]compiler.ts:[WILDCARD])
|
||||
at async tsCompilerOnMessage ([WILDCARD]compiler.ts:[WILDCARD])
|
||||
at unwrapResponse ($deno$/ops/dispatch_json.ts:[WILDCARD])
|
||||
at Object.sendSync ($deno$/ops/dispatch_json.ts:[WILDCARD])
|
||||
at resolveModules ($deno$/compiler/imports.ts:[WILDCARD])
|
||||
at processImports ($deno$/compiler/imports.ts:[WILDCARD])
|
||||
at Object.processImports ($deno$/compiler/imports.ts:[WILDCARD])
|
||||
at async compile ($deno$/compiler.ts:[WILDCARD])
|
||||
at async tsCompilerOnMessage ($deno$/compiler.ts:[WILDCARD])
|
||||
at async workerMessageRecvCallback ([WILDCARD]runtime_worker.ts:[WILDCARD])
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
[WILDCARD]error: Uncaught URIError: relative import path "bad-module.ts" not prefixed with / or ./ or ../ Imported from "[WILDCARD]/error_012_bad_dynamic_import_specifier.ts"
|
||||
at unwrapResponse ([WILDCARD]ops/dispatch_json.ts:[WILDCARD])
|
||||
at Object.sendSync ([WILDCARD]ops/dispatch_json.ts:[WILDCARD])
|
||||
at resolveModules ([WILDCARD]compiler/imports.ts:[WILDCARD])
|
||||
at processImports ([WILDCARD]compiler/imports.ts:[WILDCARD])
|
||||
at Object.processImports ([WILDCARD]compiler/imports.ts:[WILDCARD])
|
||||
at async compile ([WILDCARD]compiler.ts:[WILDCARD])
|
||||
at async tsCompilerOnMessage ([WILDCARD]compiler.ts:[WILDCARD])
|
||||
at unwrapResponse ($deno$/ops/dispatch_json.ts:[WILDCARD])
|
||||
at Object.sendSync ($deno$/ops/dispatch_json.ts:[WILDCARD])
|
||||
at resolveModules ($deno$/compiler/imports.ts:[WILDCARD])
|
||||
at processImports ($deno$/compiler/imports.ts:[WILDCARD])
|
||||
at Object.processImports ($deno$/compiler/imports.ts:[WILDCARD])
|
||||
at async compile ($deno$/compiler.ts:[WILDCARD])
|
||||
at async tsCompilerOnMessage ($deno$/compiler.ts:[WILDCARD])
|
||||
at async workerMessageRecvCallback ([WILDCARD]runtime_worker.ts:[WILDCARD])
|
||||
|
|
|
@ -4,6 +4,6 @@ error: Uncaught PermissionDenied: Remote module are not allowed to statically im
|
|||
at Object.sendAsync ($deno$/ops/dispatch_json.ts:[WILDCARD])
|
||||
at async processImports ($deno$/compiler/imports.ts:[WILDCARD])
|
||||
at async Object.processImports ($deno$/compiler/imports.ts:[WILDCARD])
|
||||
at async compile ([WILDCARD]compiler.ts:[WILDCARD])
|
||||
at async tsCompilerOnMessage ([WILDCARD]compiler.ts:[WILDCARD])
|
||||
at async compile ($deno$/compiler.ts:[WILDCARD])
|
||||
at async tsCompilerOnMessage ($deno$/compiler.ts:[WILDCARD])
|
||||
at async workerMessageRecvCallback ($deno$/runtime_worker.ts:[WILDCARD])
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
[WILDCARD]error: Uncaught URIError: relative import path "baz" not prefixed with / or ./ or ../ Imported from "[WILDCARD]/type_definitions/bar.d.ts"
|
||||
at unwrapResponse ([WILDCARD]ops/dispatch_json.ts:[WILDCARD])
|
||||
at Object.sendSync ([WILDCARD]ops/dispatch_json.ts:[WILDCARD])
|
||||
at Object.resolveModules ([WILDCARD]ops/compiler.ts:[WILDCARD])
|
||||
at resolveModules ([WILDCARD]compiler/imports.ts:[WILDCARD])
|
||||
at processImports ([WILDCARD]compiler/imports.ts:[WILDCARD])
|
||||
at processImports ([WILDCARD]compiler/imports.ts:[WILDCARD])
|
||||
at async Object.processImports ([WILDCARD]compiler/imports.ts:[WILDCARD])
|
||||
at async compile ([WILDCARD]compiler.ts:[WILDCARD])
|
||||
at async tsCompilerOnMessage ([WILDCARD]compiler.ts:[WILDCARD])
|
||||
at unwrapResponse ($deno$/ops/dispatch_json.ts:[WILDCARD])
|
||||
at Object.sendSync ($deno$/ops/dispatch_json.ts:[WILDCARD])
|
||||
at Object.resolveModules ($deno$/ops/compiler.ts:[WILDCARD])
|
||||
at resolveModules ($deno$/compiler/imports.ts:[WILDCARD])
|
||||
at processImports ($deno$/compiler/imports.ts:[WILDCARD])
|
||||
at processImports ($deno$/compiler/imports.ts:[WILDCARD])
|
||||
at async Object.processImports ($deno$/compiler/imports.ts:[WILDCARD])
|
||||
at async compile ($deno$/compiler.ts:[WILDCARD])
|
||||
at async tsCompilerOnMessage ($deno$/compiler.ts:[WILDCARD])
|
||||
at async workerMessageRecvCallback ([WILDCARD]runtime_worker.ts:[WILDCARD])
|
||||
|
|
|
@ -19,14 +19,25 @@ function main(configText, rootNames) {
|
|||
|
||||
const host = new Host();
|
||||
|
||||
assert(rootNames.length > 0);
|
||||
|
||||
assert(rootNames.length === 1);
|
||||
// If root file is external file, ie. URL with "file://"
|
||||
// then create an internal name - in case of bundling
|
||||
// cli runtime this is always true.
|
||||
const rootFile = rootNames[0];
|
||||
const result = externalSpecifierRegEx.exec(rootFile);
|
||||
let rootSpecifier = rootFile;
|
||||
if (result) {
|
||||
const [, specifier] = result;
|
||||
const internalSpecifier = `$deno$${specifier}`;
|
||||
moduleMap.set(internalSpecifier, rootFile);
|
||||
rootSpecifier = internalSpecifier;
|
||||
}
|
||||
const { options, diagnostics } = configure(configText);
|
||||
handleDiagnostics(host, diagnostics);
|
||||
|
||||
println(`>>> TS config: ${JSON.stringify(options)}`);
|
||||
|
||||
const program = ts.createProgram(rootNames, options, host);
|
||||
const program = ts.createProgram([rootSpecifier], options, host);
|
||||
|
||||
handleDiagnostics(
|
||||
host,
|
||||
|
|
Loading…
Reference in a new issue