-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
didn't respect x-typescript-types
response header
#4184
Comments
Weird, curl -I -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36' https://cdn.pika.dev/fp-ts
|
@KSXGitHub I believe Pika requires a Deno user agent. @axetroy I believe it is related to the JS dependency analysis, related to #4197 |
@kitsonk What is deno user agent? How do I find it? |
@KSXGitHub it is set here: Lines 32 to 35 in eafd40f
But you are right, even with that, the header is missing:
I thought I had fixed it last week @axetroy in #4120 and I think I did, but whatever is in the cache doesn't seem to be coming from Pika anymore. Paging @FredKSchott |
Hey, y'all! https://cdn.pika.dev/fp-ts@^2.4.3 is the semver lookup URL, which then immediately loads/wraps the
Has the behavior changed to only fetch types that are resolved off of the user's top-level import and ignore the rest? We can change to support this, but would want to make sure that this is intentional behavior first. |
Hmmm... ah, ok... I don't think the change in behaviour was intentional. We should support it, that flow (but we currently don't test it). Ok, investigating. |
Ok, did some thinking about this, and not totally sure what the right answer is. We had reports of issues with Deno being slow when loading large JavaScript dependencies, and challenges with mis-identifying imports. So we made a change where So what is currently happening in this situation is, a module imports So it used to work with So given all this, there are two potential fixes, and I am not sure which is best:
|
@kitsonk there is #4140 that I was supposed to carry on; and my eyes are still set on the thing we discussed in #4068. Would keeping |
@bartlomieju I don't think you are going to get and AST out of swc that TS can use any time soon, and in this case TS needs to fully parse the JavaScript source in order to figure out what the exports and import type shape is to solve this gap. The first step is to do the dependency analysis in swc and eliminate the preprocess in the compiler, but that wouldn't solve this problem. |
@kitsonk if you all need it, we can export the types from the lookup URL as well. I'll need a few days to implement, though. |
@FredKSchott I don't know if it is easier, or more "future proof" but all that needs to be done is serving up of the semver wrapper module as a TypeScript and passing it in the |
okay, the CDN now returns types on lookup URLs as well as resource URLs! I'm seeing expected behavior again using Pika CDN with v0.35.0. @kitsonk can we add tests for this sort of setup to keep things working in future releases? How do you feel about remote integration tests that test against our CDN directly? |
I'm fine with that, though I would want @ry's opinion. The only thought is that we might want a set of "3rd party integration" tests that won't break the build and are only advisory in the build, versus breaking the build. I can certainly model what we are talking about here in the integration tests though to catch any regressions. There were whole classes of stuff I broke with trying to get us to handle JavaScript better in the compiler and I apologise. |
np! If modeling locally is possible, then that sounds just as good to me |
Refs denoland#4184 Refs denoland#4040 In denoland#4040 we changed the way JavaScript dependencies are analysed in the TypeScript compiler. When we encounter a JavaScript file that doesn't have any types, and `checkJs` is disabled, we stop the analysis. This caused situations where when there was a typed file, loading an untyped file, loading a typed file, we stop the analysis. We didn't specifically check this "chaining" behaviour in our tests, and there were situations in the while where this behaviour was a regression, so this introduces test to ensure the behaviour as designed is preserved.
So, this issue is effectively an external bug, which has been fixed. We intentionally changed the behaviour of Deno in #4040, which highlighted that we had coupled to some unintentional behaviour, which Pika.dev/cdn fixed. #4386 adds some tests to make the intentional behaviour of how So my recommendation is to close this issue as external fixed. |
@kitsonk Thanks for your great work. We can keep this issue until the next version been released. I will verify if it is fixed and then close the issue |
@axetroy there was nothing to fix in Deno. 0.35 should be working again against Pika.dev/cdn. See Fred's comment here: #4184 (comment) |
Refs denoland#4184 Refs denoland#4040 In denoland#4040 we changed the way JavaScript dependencies are analysed in the TypeScript compiler. When we encounter a JavaScript file that doesn't have any types, and `checkJs` is disabled, we stop the analysis. This caused situations where when there was a typed file, loading an untyped file, loading a typed file, we stop the analysis. We didn't specifically check this "chaining" behaviour in our tests, and there were situations in the while where this behaviour was a regression, so this introduces test to ensure the behaviour as designed is preserved.
Thanks @kitsonk! |
Refs denoland#4184 Refs denoland#4040 In denoland#4040 we changed the way JavaScript dependencies are analysed in the TypeScript compiler. When we encounter a JavaScript file that doesn't have any types, and `checkJs` is disabled, we stop the analysis. This caused situations where when there was a typed file, loading an untyped file, loading a typed file, we stop the analysis. We didn't specifically check this "chaining" behaviour in our tests, and there were situations in the while where this behaviour was a regression, so this introduces test to ensure the behaviour as designed is preserved.
The submodule of
https://cdn.pika.dev/fp-ts
contains header information, but the declaration file is not downloadedSource Code
$ deno -V deno 0.35.0 $ deno run mod.ts # or deno fetch mod.ts
The text was updated successfully, but these errors were encountered: