KEMBAR78
feat: reenable asar support by deepak1556 · Pull Request #272552 · microsoft/vscode · GitHub
Skip to content

Conversation

@deepak1556
Copy link
Collaborator

@deepak1556 deepak1556 commented Oct 21, 2025

Fixes #228064

Testing one approach that adjusts the parentURL in the module resolution logic to resolve the package url https://github.com/nodejs/node/blob/340e61990b9bf871d8a5e9b9337eaa337d3e9ddc/lib/internal/modules/package_json_reader.js#L294

  1. Adjusts the asar layout to include node_modules to fit the above lookup logic
From:

node_modules.asar
 / packageA
 
To:

node_modules.asar
 / node_modules/packageA
  1. Updated condition in importAMDNodeModule since AMD loading in web workers trip on the condition platform.isWeb

  2. utilityprocess 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.

@deepak1556 deepak1556 added this to the October 2025 milestone Oct 21, 2025
@deepak1556 deepak1556 self-assigned this Oct 21, 2025
@Copilot Copilot AI review requested due to automatic review settings October 22, 2025 18:06
Copy link
Contributor

Copilot AI left a 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_modules folder (e.g., node_modules.asar/node_modules/packageA instead of node_modules.asar/packageA)
  • Removed the canASAR flag and simplified ASAR usage conditions throughout the codebase
  • Implemented ESM module resolution hooks in bootstrap-esm.ts to 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

@deepak1556 deepak1556 force-pushed the robo/enable_asar branch 2 times, most recently from 998621d to 801be2e Compare October 22, 2025 22:24
@deepak1556 deepak1556 marked this pull request as ready for review October 22, 2025 22:59
@vs-code-engineering
Copy link

vs-code-engineering bot commented Oct 22, 2025

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@bpasero

Matched files:

  • src/bootstrap-esm.ts
  • src/bootstrap-node.ts

@TylerLeonhardt

Matched files:

  • src/vs/workbench/services/languageDetection/browser/languageDetectionWorkerServiceImpl.ts

@deepak1556 deepak1556 enabled auto-merge (squash) October 22, 2025 23:03
@deepak1556 deepak1556 marked this pull request as draft October 22, 2025 23:19
auto-merge was automatically disabled October 22, 2025 23:19

Pull request was converted to draft

@deepak1556 deepak1556 marked this pull request as ready for review October 23, 2025 04:58
@deepak1556 deepak1556 enabled auto-merge (squash) October 23, 2025 04:58
@deepak1556 deepak1556 merged commit ff89137 into main Oct 23, 2025
54 checks passed
@deepak1556 deepak1556 deleted the robo/enable_asar branch October 23, 2025 05:37
joaomoreno added a commit that referenced this pull request Oct 23, 2025
joaomoreno added a commit that referenced this pull request Oct 23, 2025
Revert "feat: reenable asar support (#272552)"

This reverts commit ff89137.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ESM: restore support for ASAR

2 participants