resolve-pkglock 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Axel Meinhardt
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # resolve-pkglock
2
+
3
+ Resolve your PNPM symlinks *without breaking builds* — use your `pnpm-lock.yaml` as the single source of truth for module resolution.
4
+
5
+ `resolve-pkglock` hooks into Node.js’ modern [module customization hooks](https://nodejs.org/api/module.html#moduleregisterhooksoptions) to resolve your workspace dependencies directly from the PNPM store instead of through symlinks. This is especially useful in environments where symlinks cause issues (e.g. Docker, certain CI/CD setups, or read-only deployments).
6
+
7
+ ***
8
+
9
+ ## Why
10
+
11
+ - **PNPM uses symlinks** in workspaces to deduplicate modules.
12
+ - Some deployment environments **don’t preserve them**.
13
+ - Luckily, everything needed for resolution is already in your **pnpm-lock.yaml**.
14
+
15
+ By using `resolve-pkglock`, you can resolve dependencies directly from the PNPM store based on your lockfile — no symlinks required.
16
+
17
+ ***
18
+
19
+ ## Requirements
20
+
21
+ - **Node.js v22.15.0** or newer (supports module hooks).
22
+ - A **correctly maintained `pnpm-lock.yaml`** in your workspace root.
23
+
24
+ ***
25
+
26
+ ## Usage
27
+
28
+ Load the module early in your entrypoint before other imports:
29
+
30
+ ```js
31
+ // eslint-disable-next-line antfu/no-import-dist, antfu/no-import-node-modules-by-path
32
+ import resolvePkgLock from './node_modules/.pnpm/resolve-pkglock.../node_modules/resolve-pkglock/dist/index.js';
33
+
34
+ // Initialize with the path to your workspace root (where pnpm-lock.yaml lives)
35
+ await resolvePkgLock(import.meta.dirname);
36
+
37
+ // Then import your local packages normally
38
+ import('your-local-package');
39
+ ```
40
+
41
+ > ⚠️ Make sure you’re referencing the *non-symlinked folder* in the PNPM store when importing `resolve-pkglock`.
42
+
43
+ ***
44
+
45
+ ## Optional: Disable Symlinks Completely
46
+
47
+ With `resolve-pkglock`, you can set this safely in your `pnpm-workspace.yaml`:
48
+
49
+ ```yaml
50
+ symlink: false
51
+ ```
52
+
53
+ This fully avoids the creation of symlinks while preserving the benefits of PNPM’s deterministic lockfile.
54
+
55
+ ***
56
+
57
+ ## License
58
+
59
+ MIT © [ameinhardt](https://github.com/ameinhardt)
@@ -0,0 +1,2 @@
1
+ declare function init(workspaceRoot: string): Promise<void>;
2
+ export default init;