Skip to content

(WiP) Working .cjs, .mjs interop for tsc, tsserver #40068

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

Closed
wants to merge 1,345 commits into from

Conversation

frank-dspeed
Copy link

@frank-dspeed frank-dspeed commented Aug 15, 2020

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Aug 15, 2020
@typescript-bot
Copy link
Collaborator

Thanks for the PR! It looks like you've changed the TSServer protocol in some way. Please ensure that any changes here don't break consumers of the current TSServer API. For some extra review, we'll ping @sheetalkamat, @amcasey, @mjbvz, @minestarks for you. Feel free to loop in other consumers/maintainers if necessary

@ghost
Copy link

ghost commented Aug 15, 2020

CLA assistant check
All CLA requirements met.

@frank-dspeed
Copy link
Author

frank-dspeed commented Aug 15, 2020

Test it

PreBuild Version

npm i -g vscode-typescript@https://github.com/stealify/typescript
# Getting global path
npm root -g

Hit f1 on keyboard open user settings and set

"typescript.tsdk": "{your_global_npm_path}/vscode-typescript/lib"

restart is not needed.

Copy link
Contributor

@ExE-Boss ExE-Boss left a comment

Choose a reason for hiding this comment

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

This is largely incorrect, as auto‑import will still implicitly produce require(…) calls in *.mjs files and won’t treat ES Module syntax as invalid in *.cjs files.

And that is the major reason why https://gist.github.com/robertrossmann/0fb8b22341dcd83f37522ee654b0fb68 wasn’t merged.

Also, #39840 should be left open, as it adds compiler checks to ensure that the resulting *.mjs and *.cjs files are valid.

@frank-dspeed
Copy link
Author

frank-dspeed commented Aug 15, 2020

@ExE-Boss your total correct there is the label WiP that means Work in Progress but it is at last a working version this version handels every extension as JS so it decides if it is module or commonjs via the first import or require call you know all tha internals this will be a lot of work it is only to get something going. and let the community provide feedback i will put that also into the market place as extension and then we can all move on.

I am Mainly working on replacing typescript complet with rollup to do Project and Package Analyze at the same place

maybe you could add some tests feel free to create pull requests to this pr.

@frank-dspeed frank-dspeed marked this pull request as draft August 19, 2020 10:37
@matths
Copy link

matths commented Nov 2, 2020

i will put that also into the market place as extension and then we can all move on.

@frank-dspeed, is there an extension already available?

@frank-dspeed
Copy link
Author

frank-dspeed commented Nov 3, 2020

@matths nope there was not much interrest for that before you did post that message i am still working on automated builds but i will focus this week on the marketplace extension also and ping you here.

this is the current repo https://github.com/stealify/typescript/releases

it builds the current nightly and patches it and includes in the readme a easy way to set it up for one or more workspaces.

https://github.com/stealify/typescript

@sdykae
Copy link

sdykae commented Nov 14, 2020

Any notices?

typescript-bot and others added 19 commits April 30, 2021 06:06
…ft#43718)

Previously, getExternalModuleMember passed through its received value of
`dontResolveAlias` to every function that accepted it. That includes (1)
resolution of the module symbol and (2) resolution of the module
specifier. However, in TS, the module symbol is never an alias anyway, so
dontResolveAlias doesn't make a difference. In JS, the module symbol
*can* be an alias, and it should always be resolved. That's what this PR
does.

Fixes microsoft#43713
…nment (microsoft#43851)

* Handle localness in special cases by checking exported variable assignment
Fixes microsoft#42976

* Fix existing tests where arrow now behaves similar to function expression

* Update src/services/goToDefinition.ts
* Test where relative import isnt ideal in the declaration emit

* use project relative preference for declaration emit
Fixes microsoft#39117

* Fix incorrect path matching when calculating module specifier

* Use correct baseUrl for the module specifier
Previously, the name resolution for link tags in displaypart generation
mistakenly required a valueDeclaration. Now it uses the first
declaration if there is no valueDeclaration, so that types and
namespaces will also resolve.

This is another instance of using valueDeclaration as "the default
declaration", which doesn't apply to types.

Fixes microsoft#43868
… the file when using sources of project reference (microsoft#43914)

* Test where allowJs present in referenced project affects picking up right set of import files

* use options from referened project for including resolved imports in the file when using sources of project reference
Fixes microsoft#43909
…n determining never-ness (microsoft#43763)

* Allow filterType to consider union constraints of non-union types when determining never-ness

* Move impl to callback

* Baseline change in narrowing behavior into test, fix post-LKG build
…kage, invalidate for file paths in that package (microsoft#43974)

Co-authored-by: Daniel Rosenwasser <[email protected]>
…crosoft#43892)

* Fix package.json auto imports for pnpm without project references

* Make property optional

* Revert unnecessary unnittest change

* Set symlinked files when setting symlinked directories

* Update `typeDirectiveIsEqualTo`

* Consider symlinks found during type reference directive resolution into `discoverProbableSymlinks`

* Rename `originalFileName` to `originalPath`, make internal
DanielRosenwasser and others added 26 commits July 1, 2021 12:21
* Update LKG.

* Remove unnecessary assertions.
…PropertyTypes'. (microsoft#44854)

* Check for optionality in 'delete'.

* Accepted baselines.
* Add more tests.

* Accepted baselines.

* Switch to testing the symbol's flags.

* Accepted baselines.
…4816)

* Add some failing tests around transient symbols

* Working, but slower

* A class is much faster, apparently

* This is probably best?

* Back to multimap

* Go back to single symbol cache

* Revert now-unnecessary generics

* Rename and reorganize

* Fix weird compound condition

* Clean up
…t#44873)

* Consistently skip attributes with hyphenated names in JSX

* Add regression test

* Accept new baselines

* Fix tests

* Accept new baselines
…iguredProject (microsoft#44836)

* Apply disableReferencedProjectLoad to getOriginalLocationEnsuringConfiguredProject

* Reuse previously computed values and refine comments

* Add baselines for test matrix
)

* fix(35050): fix decorated block-scoped class emit

* Only use internal name when targeting ES5/3

Co-authored-by: Ron Buckton <[email protected]>
…zers (microsoft#44876)

* Add collision check for 'Reflect' when using super in static initializers

* PR feedback

* Accept baseline for new failing test
@typescript-bot
Copy link
Collaborator

It looks like you've sent a pull request to update our 'lib' files. These files aren't meant to be edited by hand, as they consist of last-known good states of the compiler and are generated from 'src'. Unless this is necessary, consider closing the pull request and sending a separate PR to update 'src'.

@typescript-bot typescript-bot added the lib update PR modifies files in the `lib` folder label Jul 11, 2021
@frank-dspeed
Copy link
Author

Fixed in #45884 (TypeScript 4.5)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Uncommitted Bug PR for untriaged, rejected, closed or missing bug lib update PR modifies files in the `lib` folder
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support type checking .cjs files Support ".mjs" input files