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

Support browsers from before 2020 #4579

Merged
merged 10 commits into from Dec 15, 2021
Merged

Support browsers from before 2020 #4579

merged 10 commits into from Dec 15, 2021

Conversation

L3P3
Copy link
Contributor

@L3P3 L3P3 commented Dec 5, 2021

As reported in #2825, #2826 and #3051, almost everything works in older browsers. This setting here prevented me from updating and I think it is an obvious enhancement to not artificially restrict to browsers from 2020+. There should not be any noticable downsides of this change since es6 and es2020 are pretty similar with only minor differences.

As reported in #2825, #2826 and #3051, almost everything works in older browsers. This setting here prevented me from updating and I think it is an obvious enhancement to not restrict to browsers from 2020+. There should not be any measurable downsides of this change since es6 and es2020 are pretty similar with only minor differences.
@L3P3 L3P3 requested a review from a team as a code owner December 5, 2021 09:39
@jsjoeio jsjoeio self-assigned this Dec 6, 2021
@jsjoeio jsjoeio added the chore Related to maintenance or clean up label Dec 6, 2021
@jsjoeio
Copy link
Contributor

jsjoeio commented Dec 6, 2021

@code-asher I can't think of any downsides to this, can you? 🤔

@jawnsy
Copy link
Contributor

jawnsy commented Dec 6, 2021

I guess upstream vscode uses es2020 as the target, so one risk is that divergence means that the result may not be as well-tested. I don't know enough to have an accurate assessment of the risk though.

@jsjoeio
Copy link
Contributor

jsjoeio commented Dec 6, 2021

I guess upstream vscode uses es2020 as the target, so one risk is that divergence means that the result may not be as well-tested. I don't know enough to have an accurate assessment of the risk though.

Great point! I'm guessing we decided to use es2020 after they upgraded. Looks like they dropped support for legacy edge and IE when they made that upgrade.

@code-asher
Copy link
Member

code-asher commented Dec 7, 2021 via email

@jsjoeio
Copy link
Contributor

jsjoeio commented Dec 7, 2021

We can change our target but code-server will still not work since VS
Code has their own target.

Ah right! This would have to be in VS Code itself (or in our fork). But if we change in our fork, that would diverge from upstream and could cause other issues.

I am not sure we even have any of our own
client-side JavaScript anymore in 4.0.0.

Wow, you're right. I didn't even realize that.

@L3P3
Copy link
Contributor Author

L3P3 commented Dec 8, 2021

Between es6 and es2020, there are no interoperability risks. In this case, they only differ in syntactic sugar like ?? and ?. operators. Not even polyfills required to ensure compatiblity between two modules.
Isn't this tsconfig also respected in submodules? I think it should be at least tested if that works. Or are you sure that there will still be es2020 code after this proposed change?

@L3P3
Copy link
Contributor Author

L3P3 commented Dec 8, 2021

I am not sure we even have any of our own client-side JavaScript anymore in 4.0.0.

What about the forked repository? Isn't that deemed "our own"?

But if we change in our fork, that would diverge from upstream and could cause other issues.

Yeah, we diverge in one global setting but TypeScript guarantees that older targets are still working properly and being compatible to newer code... I think code-server has a selling point in being more compatible than upstream. Microsoft does not care about a few individuals that diverge from mainstream for some reason. We have the chance to continue to not go that route with probably very low effort.

@code-asher
Copy link
Member

code-asher commented Dec 8, 2021 via email

@L3P3
Copy link
Contributor Author

L3P3 commented Dec 8, 2021

So maybe we also need to add lib.

Yes, sure. Those are polyfills so that beside syntax change, also new methods work in older browsers. 😉

@jsjoeio
Copy link
Contributor

jsjoeio commented Dec 8, 2021

But if we patch it there instead and everything works that seems like a
win to me.

Good point! I agree. @code-asher should we ask @L3P3 to submit a PR to our fork here?

We could also leave this change here as well in case we ever add
client-side JavaScript again.

Agreed. As long as the build passes, I think we're okay to merge.

Copy link
Contributor

@jsjoeio jsjoeio left a comment

Choose a reason for hiding this comment

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

Even though we don't have any client-side JS in code-server at the moment, we're okay merging this in, in case we do want to support older browser in the future.

Thanks @L3P3 for adding this 👍

@jsjoeio
Copy link
Contributor

jsjoeio commented Dec 8, 2021

Docs preview

P.S. you can ignore this. It's a known issue that I need to fix.

@L3P3
Copy link
Contributor Author

L3P3 commented Dec 8, 2021

Sounds great. Done.

Lets hope it compiles successfully. 🙈

@L3P3
Copy link
Contributor Author

L3P3 commented Dec 8, 2021

BTW if anyone wonders why they targeted es2020 in the first place: They use electron which is pretty much latest chrome. Web development and electron development has some differences. 😉

@jsjoeio
Copy link
Contributor

jsjoeio commented Dec 8, 2021

FAIL test/unit/node/routes/login.test.ts
   Test suite failed to run

    test/unit/node/routes/login.test.ts:81:9 - error TS2322: Type 'URLSearchParams' is not assignable to type 'BodyInit | undefined'.
      Type 'URLSearchParams' is missing the following properties from type 'URLSearchParams': entries, keys, values, [Symbol.iterator]

    81         body: params,
               ~~~~

Hmm... looks like one of the tests are failing. You might need to look into fixing login.test.ts

@jsjoeio
Copy link
Contributor

jsjoeio commented Dec 8, 2021

I still see the same error in the test here. We'll push this for the next release.

@jsjoeio jsjoeio added this to the 4.0.1 milestone Dec 8, 2021
@L3P3
Copy link
Contributor Author

L3P3 commented Dec 9, 2021

Sorry, I thought that dom includes dom.iterable but it appears to not be the case. Just another try and hopefully no error. 🙈

@codecov
Copy link

codecov bot commented Dec 9, 2021

Codecov Report

Merging #4579 (7a441d1) into main (1b796d1) will decrease coverage by 0.03%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4579      +/-   ##
==========================================
- Coverage   66.14%   66.10%   -0.04%     
==========================================
  Files          30       30              
  Lines        1654     1658       +4     
  Branches      331      337       +6     
==========================================
+ Hits         1094     1096       +2     
- Misses        475      477       +2     
  Partials       85       85              
Impacted Files Coverage Δ
src/node/routes/pathProxy.ts 67.85% <0.00%> (-1.38%) ⬇️
src/node/cli.ts 83.52% <0.00%> (-0.26%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1b796d1...7a441d1. Read the comment docs.

@jsjoeio
Copy link
Contributor

jsjoeio commented Dec 9, 2021

@code-asher tested this yesterday and I think it should be okay to merge after 4.0.0 is out!

@jsjoeio jsjoeio modified the milestones: 4.0.1, 4.0.0 Dec 13, 2021
@jsjoeio jsjoeio merged commit 259363b into coder:main Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Related to maintenance or clean up
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants