-
Notifications
You must be signed in to change notification settings - Fork 35.7k
feat: reenable asar support #272552
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
feat: reenable asar support #272552
Conversation
d872cba to
c0f6324
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR re-enables ASAR (Electron Archive) support for VS Code's ESM (ECMAScript Modules) implementation. The main goal is to fix module resolution issues by adjusting the ASAR layout and improving module loading logic.
Key changes:
- Restructured ASAR layout to include a nested
node_modulesfolder (e.g.,node_modules.asar/node_modules/packageAinstead ofnode_modules.asar/packageA) - Removed the
canASARflag and simplified ASAR usage conditions throughout the codebase - Implemented ESM module resolution hooks in
bootstrap-esm.tsto properly handle ASAR paths
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/vs/amdX.ts | Removed canASAR constant and updated ASAR usage logic to check for Electron environment directly |
| src/vs/base/common/platform.ts | Added hasElectronUserAgent flag to detect Electron environment |
| src/vs/base/common/network.ts | Updated ASAR paths to include nested node_modules folder |
| src/bootstrap-node.ts | Added enableASARSupport() function to hook into Node's module resolution |
| src/bootstrap-esm.ts | Implemented ESM loader hooks for ASAR path resolution |
| src/vs/workbench/services/treeSitter/browser/treeSitterLibraryService.ts | Removed canASAR import and simplified module location logic |
| src/vs/workbench/services/textMate/browser/textMateTokenizationFeatureImpl.ts | Removed canASAR import and simplified WASM loading logic |
| src/vs/workbench/services/textMate/browser/backgroundTokenization/threadedBackgroundTokenizerFactory.ts | Removed canASAR import and simplified ASAR usage check |
| src/vs/workbench/services/languageDetection/browser/languageDetectionWorkerServiceImpl.ts | Removed canASAR import and simplified ASAR usage check |
| build/linux/dependencies-generator.ts | Removed canAsar variable and hardcoded path to unpacked modules |
| build/linux/dependencies-generator.js | Removed canAsar variable and hardcoded path to unpacked modules |
| build/gulpfile.vscode.js | Updated ASAR creation to use process.cwd() and modified vsda exclusion comment |
998621d to
801be2e
Compare
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @bpaseroMatched files:
@TylerLeonhardtMatched files:
|
251cd5e to
cfabf85
Compare
This reverts commit ff89137.
Fixes #228064
Testing one approach that adjusts the
parentURLin the module resolution logic to resolve the package url https://github.com/nodejs/node/blob/340e61990b9bf871d8a5e9b9337eaa337d3e9ddc/lib/internal/modules/package_json_reader.js#L294node_modulesto fit the above lookup logicUpdated condition in
importAMDNodeModulesince AMD loading in web workers trip on the condition platform.isWebutilityprocess entrypoints don't preserve drive letter casing due to
FileAccess.asFileUri('bootstrap-fork.js').fsPath, the path checks in resolution are normalized to accommodate this behavior.