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

Fix behavior for extensionless files with .mime file #1779

Merged
merged 2 commits into from
Feb 15, 2019

Conversation

kevinkassimo
Copy link
Contributor

@kevinkassimo kevinkassimo commented Feb 15, 2019

Closes #1776

There are 2 separate issues addressed here that both contribute to the issue:

  1. In rollup config file we failed to include ts.Extension, resulting in ts.Extension become undefined in the bundle.

  2. In js/compiler.ts we did not specify that we allow files of non-TS extensions => This would result in the following lines to fail:
    https://github.com/Microsoft/TypeScript/blob/ed8c81a5638c7d745cb8541137ad6990da045467/src/compiler/program.ts#L2151-L2161

function getSourceFileFromReferenceWorker(...) {
  // ...
  const sourceFileNoExtension = options.allowNonTsExtensions && getSourceFile(fileName);
  if (sourceFileNoExtension) return sourceFileNoExtension;
  // ...

  const sourceFileWithAddedExtension = forEach(supportedExtensions, extension => getSourceFile(fileName   extension)); // Trying with all possibly supported extensions
  // ...
}

Without allowNonTsExtensions set to true in options, the compiler would try out all possible file names with extensions but never check the original extensionless one. This causes the behavior in debug log as mentioned in #1776 (comment)

/cc @kitsonk

@kevinkassimo
Copy link
Contributor Author

kevinkassimo commented Feb 15, 2019

@ry AppVeyor is reporting something like ninja explain: rust_crates/libwebpki_roots.rlib is dirty. Could you check what is the problem?

The error went away after the new commit. Don't know why

Copy link
Contributor

@kitsonk kitsonk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but a couple minor nits

js/compiler.ts Outdated Show resolved Hide resolved
rollup.config.js Outdated Show resolved Hide resolved
Copy link
Contributor

@kitsonk kitsonk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ry ry merged commit fe0ceae into denoland:master Feb 15, 2019
@kevinkassimo kevinkassimo deleted the compiler/no_ext_with_mime branch December 27, 2019 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants