-
Notifications
You must be signed in to change notification settings - Fork 639
Typings Intaller initial work #844
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
Merged
Merged
Changes from 13 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
ca7e12a
Typings Installer initial work
sheetalkamat 0c801d5
Merge branch 'main' into typingsInstaller
sheetalkamat 8c7cb35
copilot feedback
sheetalkamat c5173c2
Merge branch 'main' into typingsInstaller
sheetalkamat 2b31568
Lock file 3 format
sheetalkamat 072664c
Merge branch 'main' into typingsInstaller
sheetalkamat 47676b8
Merge branch 'main' into typingsInstaller
sheetalkamat df78724
Add back hasAddedorRemovedFiles so ti can run
sheetalkamat 8fc083f
Fix tests
sheetalkamat 8f8df3c
Merge branch 'main' into typingsInstaller
sheetalkamat d94dc6a
Make hasAddedorRemovedFiles atomic bool to ensure its set correctly a…
sheetalkamat 930ab94
Remove unnecessary update
sheetalkamat 07d2886
Merge branch 'main' into typingsInstaller
sheetalkamat 96bd7df
Merge branch 'main' into typingsInstaller
sheetalkamat 7398600
Feedback part 1
sheetalkamat b465be9
Dont use regexp
sheetalkamat 7b7f4b4
Fix rune usage
sheetalkamat 588ea69
Set typings files with project lock to avoid race
sheetalkamat c0a57c2
Merge branch 'main' into typingsInstaller
sheetalkamat d38083e
Feedback part 2
sheetalkamat 14008e9
Converted todos to !!!
sheetalkamat 4572f06
Merge branch 'main' into typingsInstaller
sheetalkamat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
package core | ||
|
||
import ( | ||
"maps" | ||
"sync" | ||
) | ||
|
||
var UnprefixedNodeCoreModules = map[string]bool{ | ||
"assert": true, | ||
"assert/strict": true, | ||
"async_hooks": true, | ||
"buffer": true, | ||
"child_process": true, | ||
"cluster": true, | ||
"console": true, | ||
"constants": true, | ||
"crypto": true, | ||
"dgram": true, | ||
"diagnostics_channel": true, | ||
"dns": true, | ||
"dns/promises": true, | ||
"domain": true, | ||
"events": true, | ||
"fs": true, | ||
"fs/promises": true, | ||
"http": true, | ||
"http2": true, | ||
"https": true, | ||
"inspector": true, | ||
"inspector/promises": true, | ||
"module": true, | ||
"net": true, | ||
"os": true, | ||
"path": true, | ||
"path/posix": true, | ||
"path/win32": true, | ||
"perf_hooks": true, | ||
"process": true, | ||
"punycode": true, | ||
"querystring": true, | ||
"readline": true, | ||
"readline/promises": true, | ||
"repl": true, | ||
"stream": true, | ||
"stream/consumers": true, | ||
"stream/promises": true, | ||
"stream/web": true, | ||
"string_decoder": true, | ||
"sys": true, | ||
"test/mock_loader": true, | ||
"timers": true, | ||
"timers/promises": true, | ||
"tls": true, | ||
"trace_events": true, | ||
"tty": true, | ||
"url": true, | ||
"util": true, | ||
"util/types": true, | ||
"v8": true, | ||
"vm": true, | ||
"wasi": true, | ||
"worker_threads": true, | ||
"zlib": true, | ||
} | ||
|
||
var ExclusivelyPrefixedNodeCoreModules = map[string]bool{ | ||
"node:sea": true, | ||
"node:sqlite": true, | ||
"node:test": true, | ||
"node:test/reporters": true, | ||
} | ||
|
||
var ( | ||
nodeCoreModules = map[string]bool{} | ||
nodeCoreModulesOnce sync.Once | ||
) | ||
|
||
func ensureNodeCoreModules() { | ||
nodeCoreModulesOnce.Do(func() { | ||
for unprefixed := range UnprefixedNodeCoreModules { | ||
nodeCoreModules[unprefixed] = true | ||
nodeCoreModules["node:"+unprefixed] = true | ||
} | ||
maps.Copy(nodeCoreModules, ExclusivelyPrefixedNodeCoreModules) | ||
}) | ||
} | ||
|
||
func NonRelativeModuleNameForTypingCache(moduleName string) string { | ||
ensureNodeCoreModules() | ||
if nodeCoreModules[moduleName] { | ||
sheetalkamat marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return "node" | ||
} | ||
return moduleName | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.