Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deno bundle fails when invalid URIs/imports are found in comments #4858

Closed
alexjamesmalcolm opened this issue Apr 23, 2020 · 4 comments
Closed
Labels
bug Something isn't working correctly

Comments

@alexjamesmalcolm
Copy link

Version:

deno 0.41.0
v8 8.2.308
typescript 3.8.3

How to reproduce:
deno bundle https://unpkg.com/@vaadin/[email protected]/dist/vaadin-router.js output.js
The following error is produced:

error: Uncaught URIError: relative import path "my-view.js" not prefixed with / or ./ or ../ Imported from "https://unpkg.com/@vaadin/[email protected]/dist/vaadin-router.js"
► $deno$/ops/dispatch_json.ts:43:11
    at unwrapResponse ($deno$/ops/dispatch_json.ts:43:11)
    at Object.sendSync ($deno$/ops/dispatch_json.ts:72:10)
    at Object.resolveModules ($deno$/ops/compiler.ts:11:10)
    at resolveModules ($deno$/compiler/imports.ts:63:22)
    at processImports ($deno$/compiler/imports.ts:147:27)
    at Object.processImports ($deno$/compiler/imports.ts:156:13)
    at async compile (file:///Users/runner/runners/2.169.0/work/deno/deno/cli/js/compiler.ts:131:31)
    at async tsCompilerOnMessage (file:///Users/runner/runners/2.169.0/work/deno/deno/cli/js/compiler.ts:338:22)
    at async workerMessageRecvCallback ($deno$/runtime_worker.ts:62:9)

deno bundle appears to get caught up on this part of https://unpkg.com/@vaadin/[email protected]/dist/vaadin-router.js:

// Actions like `() => import('my-view.js')` are not expected to
// end the resolution, despite the result is not empty. Checking
// the result with a whitelist of values that end the resolution.

When this chunk of comments is removed from a local version of the file and deno bundle is attempted again it works without issue.

Desired behavior:
Deno bundle should ignore comments while looking for imports.

Also, thank you for creating such an incredible tool!

@alexjamesmalcolm alexjamesmalcolm changed the title Deno bundle is parsing comments for valid imports/uris Deno bundle is parsing comments for valid imports/URIs Apr 23, 2020
@alexjamesmalcolm alexjamesmalcolm changed the title Deno bundle is parsing comments for valid imports/URIs Deno bundle fails when invalid URIs/imports are found in comments Apr 23, 2020
@ry ry added the bug Something isn't working correctly label Apr 23, 2020
@ry
Copy link
Member

ry commented Apr 23, 2020

Thanks for the report - this is definitely a bug. We have a couple regular expressions that pass over the code - we need to change these to use the actual AST.

@bartlomieju
Copy link
Member

Duplicate of #4464

@bartlomieju bartlomieju marked this as a duplicate of #4464 Apr 23, 2020
@kitsonk
Copy link
Contributor

kitsonk commented Apr 23, 2020

Correct, duplicate #4464 which is a duplicate of #3089, it has nothing to do with the code in the comments, it has to do with using the string literal markings. It is really microsoft/TypeScript#30878. Can we close this and #4464 both in favour of #3089? I have chased the TypeScript defect, but will likely take a look at it myself since it is largely being ignored.

@bartlomieju
Copy link
Member

Closing in favor of #3089

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly
Projects
None yet
Development

No branches or pull requests

4 participants