|
1 | | -README.md Language: [中文](https://github.com/zyrong/vscode-node-modules/blob/master/README.md) | [English](https://github.com/zyrong/vscode-node-modules/blob/master/README.en.md) |
| 1 | +Language: [English](./README.md) | [中文](./README_CN.md) |
2 | 2 | <br/><br/> |
3 | 3 |
|
4 | 4 | # node-modules |
5 | | -<!--   --> |
| 5 | + |
| 6 | +Forked from [zyrong/vscode-node-modules](https://github.com/zyrong/vscode-node-modules) with enhanced support for multi-level node_modules directory structure. |
6 | 7 |
|
7 | 8 | <br/> |
8 | 9 |
|
9 | 10 | ## Features |
10 | 11 |
|
11 | | -- 在`package.json`文件中 将鼠标悬停在`packageName`上会出现相关提示 |
12 | | -如果此packageName对应的package在已经安装的情况下,点击悬浮框中的包名,会跳转到包的安装目录下 |
13 | | - |
| 12 | +### Package.json Hover Tip |
| 13 | + |
| 14 | +Hover the mouse over `packageName` in the `package.json` file and a related prompt will appear. If the package corresponding to this packageName is already installed, click the package name in the floating box, and it will jump to the installation directory of the package. |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | +### Import/Require Hover Tip |
| 19 | + |
| 20 | +When importing `package` using `import` or `require` in `.ts`, `.js`, `.jsx`, `.tsx`, `.vue` files, move the mouse over the `PackageName`, you will get relevant tips. |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | +### Go to Definition |
| 25 | + |
| 26 | +In package.json file, `press Ctrl` and `click packageName` to jump to node_modules corresponding package directory. |
| 27 | + |
| 28 | + |
14 | 29 |
|
15 | | -- 在`.ts` `.js` `.jsx` `.tsx` `.vue`文件中使用`import`或`require`导入`package`时,鼠标移动到`PackageName`上,将会得到相关提示。 |
16 | | - |
| 30 | +### Search Package |
| 31 | + |
| 32 | +Right-click the node_modules folder and click Search Package in the pop-up menu to search the node_modules packages. |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | +### Search node_modules |
| 37 | + |
| 38 | +In the pop-up menu, click Search node_modules to search the node_modules path. |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | +### Copy Real Path of Symlink |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | +<br/> |
17 | 47 |
|
18 | | -- 在package.json文件中 `按住ctrl`+`点击packageName`将跳转到node_modules对应package目录下. |
19 | | - |
| 48 | +## Multi-level node_modules Support |
20 | 49 |
|
21 | | -- 对 node_modules文件夹 点击右键,在弹出的菜单,点击搜索 Package,可以对node_modules的package进行搜索。 |
22 | | - |
| 50 | +This fork version enhances support for multi-level node_modules directory structure, suitable for the following scenarios: |
23 | 51 |
|
24 | | -- 在弹出的菜单中,点击搜索 node_modules,可以对node_modules进行路径搜索。 |
25 | | - |
| 52 | +### 1. Nested node_modules Lookup |
| 53 | + |
| 54 | +When the project has nested node_modules structure (e.g., `node_modules/package-a/node_modules/package-b`), the extension automatically traverses upward to find dependency packages until the target package is found or the workspace root is reached. |
| 55 | + |
| 56 | +### 2. package-lock.json Support |
| 57 | + |
| 58 | +Support in `package-lock.json` and `npm-shrinkwrap.json`: |
| 59 | +- Parse nested package paths under `packages` field |
| 60 | +- Parse hierarchical dependency relationships under `dependencies` field |
| 61 | +- Automatically recognize `.package-lock.json` files |
| 62 | + |
| 63 | +### 3. pnpm Directory Structure Support |
| 64 | + |
| 65 | +Search Package feature supports pnpm's special directory structure: |
| 66 | +- Packages under `node_modules/.pnpm/node_modules/` |
| 67 | + |
| 68 | +### 4. Monorepo Workspace Support |
| 69 | + |
| 70 | +In monorepo projects, supports correctly resolving dependencies from sub-package directories, following Node.js module resolution rules to search upward. |
| 71 | + |
| 72 | +<br/> |
| 73 | + |
| 74 | +## Keyboard Shortcuts |
| 75 | + |
| 76 | +| Feature | Windows | macOS | |
| 77 | +|---------|---------|-------| |
| 78 | +| Search Package | `Ctrl+K P` | `Cmd+K P` | |
| 79 | +| Search node_modules | `Ctrl+K N` | `Cmd+K N` | |
| 80 | + |
| 81 | +<br/> |
| 82 | + |
| 83 | +## Configuration |
| 84 | + |
| 85 | +| Setting | Default | Description | |
| 86 | +|---------|---------|-------------| |
| 87 | +| `node_modules.general.debug` | `false` | Enable debug logging | |
| 88 | +| `node_modules.hovers.pkgName.bundleSize` | `true` | Show bundle size in hover tips | |
| 89 | +| `node_modules.resolve.preserveSymlinks` | `false` | Whether to preserve symlinks (not resolve to real paths) | |
| 90 | + |
| 91 | +<br/> |
26 | 92 |
|
27 | | -- 复制符号链接对应的实际路径 |
28 | | - |
| 93 | +## Acknowledgments |
29 | 94 |
|
30 | | -> 快捷键: |
31 | | -> 搜索 Package: windows(ctrl+k p)、mac(cmd+k p) |
32 | | -> 搜索 node_modules: windows(ctrl+k n)、mac(cmd+k n) |
| 95 | +This project is forked from [zyrong/vscode-node-modules](https://github.com/zyrong/vscode-node-modules). Thanks to the original author for the excellent work. |
0 commit comments