Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions docs/command/global-module-shims.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ Package managers (`npm`, `npx`, `yarn`, `pnpm`, `corepack`, and bun when `shim_b

1. You install a global package (for example `npm install -g typescript`).
2. The install (or a later proxy-triggered **reshim**) scans `*.cmd` basenames under the active Node version directory.
3. For pnpm-related tools, `reshim` also scans `PNPM_HOME\bin` when set, and always ensures a `pnpm` shim exists.
3. For pnpm-related tools, `reshim` also scans `PNPM_HOME\bin` when set, and always ensures a `pnpm` shim exists. For Yarn Classic `yarn global` tools, `reshim` also scans `%LOCALAPPDATA%\Yarn\bin`. Yarn 2+ does not use `yarn global`.
4. For each discovered name, `{DataRoot}/.shim/{name}.exe` is created as a hardlink/copy of `{DataRoot}/proxy.exe`.
5. Running `my-global-tool` hits the proxy. The proxy:
- Parses `--nvm-use` / `--nvm-which` / `--nvm-shim-version` (same flags as the node shim)
- Resolves the active Node.js version
- Verifies trust (self, `node.exe`, delegated target)
- Locates `my-global-tool.cmd` / `.exe` / `.bat` under that install and spawns it
- Locates `my-global-tool.cmd` / `.exe` / `.bat` under that install, or under `%LOCALAPPDATA%\Yarn\bin` for Yarn Classic globals, and spawns it

Built-in prewarm list includes `node`, `npm`, `npx`, `yarn`, and `pnpm`. Other globals appear after install + reshim.

Expand All @@ -31,6 +31,9 @@ npm install -g typescript
tsc --version
tsc --nvm-which --version
tsc --nvm-use=22 --version

yarn global add @vue/cli
vue --version
```

:::tip
Expand Down
2 changes: 1 addition & 1 deletion docs/command/package-manager-shims.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pnpm --nvm-shim-version

When `auto_install` is enabled, missing auto-detected Node versions prompt/install the same way as `node` for these managers.

After global-affecting operations (for example `npm install -g`, yarn global/dlx/plugins, corepack enable/use), the proxy may trigger **reshim** so new [global CLI shims](/command/global-module-shims) are created.
After global-affecting operations (for example `npm install -g`, yarn global/dlx/plugins, corepack enable/use), the proxy may trigger **reshim** so new [global CLI shims](/command/global-module-shims) are created. Yarn Classic writes those CLIs to `%LOCALAPPDATA%\Yarn\bin`. `reshim` and the proxy read that directory. Yarn 2+ does not use `yarn global`.

## Bun malware wrap

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ slug: /command/global-module-shims

1. Устанавливаете глобальный пакет (например `npm install -g typescript`).
2. Установка (или позже proxy-triggered **reshim**) сканирует basenames `*.cmd` в каталоге активной версии Node.
3. Для инструментов pnpm `reshim` также сканирует `PNPM_HOME\bin`, если задан, и всегда обеспечивает shim `pnpm`.
3. Для инструментов pnpm `reshim` также сканирует `PNPM_HOME\bin`, если задан, и всегда обеспечивает shim `pnpm`. Для инструментов Yarn Classic `yarn global` `reshim` также сканирует `%LOCALAPPDATA%\Yarn\bin`. Yarn 2+ не использует `yarn global`.
4. Для каждого найденного имени создаётся `{DataRoot}/.shim/{name}.exe` как hardlink/копия `{DataRoot}/proxy.exe`.
5. Запуск `my-global-tool` попадает в proxy. Proxy:
- Разбирает `--nvm-use` / `--nvm-which` / `--nvm-shim-version` (те же флаги, что у node shim)
- Разрешает активную версию Node.js
- Проверяет доверие (self, `node.exe`, делегированная цель)
- Находит `my-global-tool.cmd` / `.exe` / `.bat` в этой установке и запускает
- Находит `my-global-tool.cmd` / `.exe` / `.bat` в этой установке или в `%LOCALAPPDATA%\Yarn\bin` для глобальных CLI Yarn Classic и запускает

Встроенный prewarm-список: `node`, `npm`, `npx`, `yarn`, `pnpm`. Остальные globals появляются после install + reshim.

Expand All @@ -31,6 +31,9 @@ npm install -g typescript
tsc --version
tsc --nvm-which --version
tsc --nvm-use=22 --version

yarn global add @vue/cli
vue --version
```

:::tip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pnpm --nvm-shim-version

При включённом `auto_install` отсутствующие auto-detected версии Node предлагаются/устанавливаются так же, как для `node`.

После операций, затрагивающих globals (например `npm install -g`, yarn global/dlx/plugins, corepack enable/use), proxy может вызвать **reshim**, чтобы появились новые [shim глобальных CLI](/command/global-module-shims).
После операций, затрагивающих globals (например `npm install -g`, yarn global/dlx/plugins, corepack enable/use), proxy может вызвать **reshim**, чтобы появились новые [shim глобальных CLI](/command/global-module-shims). Yarn Classic пишет эти CLI в `%LOCALAPPDATA%\Yarn\bin`. `reshim` и proxy читают этот каталог. Yarn 2+ не использует `yarn global`.

## Обёртка bun \{#bun-malware-wrap}

Expand Down
Loading