Files
vscode/src/vs/code
c9dda3b36a feat: restore asar for node_modules (#324084)
* feat: restore node_modules bundled into asar

* fix: store node_modules at top level inside asar archive

* Revert "fix: store node_modules at top level inside asar archive"

This reverts commit 4747aa5e375cc1fe49b8eb510dd1acec1fd6a581.

* fix: pack node_modules into asar

* fix: read copilot/ripgrep natives from node_modules.asar.unpacked

* fix: load node-context modules and native binaries from ASAR

- bootstrap-esm: resolve bare specifiers via package self-reference so
  Node applies the package's real `exports`/`main` and ESM conditions.
  The previous CommonJS `require.resolve()` picked the `require`
  condition and loaded the CJS entry of dual CJS/ESM packages (e.g.
  playwright-core), which did not expose their named ESM exports.

- amdX: in `_nodeJSLoadScript`, read module files with the ASAR-aware
  `require('fs')` instead of `import('fs')`, which the resolution hook
  maps to the ASAR-unaware `original-fs` and therefore cannot read
  files inside the archive (e.g. @vscode/iconv-lite-umd).

- agentHost commandAutoApprover: load the tree-sitter `.wasm` files
  from node_modules.asar.unpacked in built apps (node_modules in dev).

- agentHost copilotAgent: resolve the @github/copilot-<platform> CLI
  and the @microsoft/mxc-sdk sandbox binaries from
  node_modules.asar.unpacked in built apps, and unpack
  @microsoft/mxc-sdk/bin so those executables can be spawned.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: resolve ASAR modules relative to the archive root

Two follow-up fixes for ASAR support:

- bootstrap-esm: resolve packages inside node_modules.asar with relative
  specifiers (require.resolve("./<pkg>/package.json") and "./<spec>")
  instead of bare specifiers. The archive directory is named
  node_modules.asar, so a bare-specifier resolution walks for a
  node_modules directory that does not exist and fails. This broke every
  native module imported from main.js in the packaged app
  (@vscode/spdlog, @vscode/sqlite3, native-keymap, @vscode/deviceid,
  @vscode/policy-watcher), preventing startup.

- create-universal-app: pass `singleArchFiles` so the universal merger
  allows files that are unique to a single arch inside the merged
  node_modules.asar (the @github/copilot-<arch> platform package and the
  arch-specific copilot/ripgrep binaries). These paths are ASAR-internal
  (top level, no node_modules prefix); without the allowlist the merge
  aborts with "Detected unique file ... not covered by allowList rule".

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: resolve sandbox runtime and Windows CJS lookups with ASAR

* fix: resolve ESM modules from the importer's own node_modules

* fix: unpack node-pty package.json

* fix: resolve node-pty binaries from unpacked asar in Copilot shim

* fix: resolve Copilot native binaries from node_modules.asar.unpacked

* fix: universal build for mxc

* fix: load tree-sitter wasm from node_modules on web

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-07 07:39:48 +00:00
..