@pnpm/resolving.local-resolver 1101.1.19 → 1101.2.0
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/CHANGELOG.md +22 -0
- package/lib/index.d.ts +2 -2
- package/lib/index.js +2 -2
- package/lib/parseBareSpecifier.d.ts +14 -0
- package/lib/parseBareSpecifier.js +30 -0
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @pnpm/local-resolver
|
|
2
2
|
|
|
3
|
+
## 1101.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- `catalogMode` and `--save-catalog` no longer move a local path, tarball, or `workspace:<path>` specifier into a catalog. Such a specifier is resolved against the project that declares it, so one catalog entry cannot mean the same directory for every project that references it [#14437](https://github.com/pnpm/pnpm/issues/14437).
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies:
|
|
12
|
+
- @pnpm/error@1100.1.4
|
|
13
|
+
- @pnpm/workspace.project-manifest-reader@1100.0.27
|
|
14
|
+
|
|
15
|
+
## 1101.1.20
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies:
|
|
20
|
+
- @pnpm/crypto.hash@1100.0.3
|
|
21
|
+
- @pnpm/resolving.resolver-base@1101.2.0
|
|
22
|
+
- @pnpm/types@1102.1.0
|
|
23
|
+
- @pnpm/workspace.project-manifest-reader@1100.0.26
|
|
24
|
+
|
|
3
25
|
## 1101.1.19
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DirectoryResolution, LatestInfo, LatestQuery, Resolution, ResolveResult, TarballResolution } from '@pnpm/resolving.resolver-base';
|
|
2
2
|
import type { DependencyManifest, PkgResolutionId } from '@pnpm/types';
|
|
3
|
-
import { type WantedLocalDependency } from './parseBareSpecifier.js';
|
|
4
|
-
export { type WantedLocalDependency };
|
|
3
|
+
import { isLocalFilesystemSpecifier, type WantedLocalDependency } from './parseBareSpecifier.js';
|
|
4
|
+
export { isLocalFilesystemSpecifier, type WantedLocalDependency };
|
|
5
5
|
export interface LocalResolveResult extends ResolveResult {
|
|
6
6
|
manifest?: DependencyManifest;
|
|
7
7
|
normalizedBareSpecifier?: string;
|
package/lib/index.js
CHANGED
|
@@ -4,8 +4,8 @@ import { getTarballIntegrity } from '@pnpm/crypto.hash';
|
|
|
4
4
|
import { PnpmError } from '@pnpm/error';
|
|
5
5
|
import { logger } from '@pnpm/logger';
|
|
6
6
|
import { readProjectManifestOnly } from '@pnpm/workspace.project-manifest-reader';
|
|
7
|
-
import { parseLocalPath, parseLocalScheme } from './parseBareSpecifier.js';
|
|
8
|
-
export {};
|
|
7
|
+
import { isLocalFilesystemSpecifier, parseLocalPath, parseLocalScheme } from './parseBareSpecifier.js';
|
|
8
|
+
export { isLocalFilesystemSpecifier };
|
|
9
9
|
/**
|
|
10
10
|
* Resolves a dependency declared with an explicit local scheme:
|
|
11
11
|
* `link:`, `workspace:`, `file:`, or (rejected) `path:`.
|
|
@@ -10,6 +10,20 @@ export interface WantedLocalDependency {
|
|
|
10
10
|
bareSpecifier: string;
|
|
11
11
|
injected?: boolean;
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Whether a bare specifier's shape can only mean a local file or directory:
|
|
15
|
+
* the `link:` / `file:` protocols, a path-prefixed spec (`./`, `../`, `~/`,
|
|
16
|
+
* absolute POSIX paths, and Windows drive paths — including drive-relative
|
|
17
|
+
* ones like `C:dir`), or a bare tarball file name.
|
|
18
|
+
*
|
|
19
|
+
* Narrower than what {@link parseLocalPath} claims, which also takes any spec
|
|
20
|
+
* containing a path separator. That shape is statically indistinguishable from
|
|
21
|
+
* a hosted-git shorthand (`user/repo`) or a named-registry alias
|
|
22
|
+
* (`gh:@scope/pkg`), and the resolver chain only gets away with claiming it by
|
|
23
|
+
* running the local resolver last. Callers that dispatch on specifier shape
|
|
24
|
+
* without that ordering ask this instead.
|
|
25
|
+
*/
|
|
26
|
+
export declare function isLocalFilesystemSpecifier(bareSpecifier: string): boolean;
|
|
13
27
|
export declare function parseLocalScheme(wd: WantedLocalDependency, projectDir: string, lockfileDir: string, opts: {
|
|
14
28
|
preserveAbsolutePaths: boolean;
|
|
15
29
|
}): LocalPackageSpec | null;
|
|
@@ -17,6 +17,36 @@ class PathIsUnsupportedProtocolError extends PnpmError {
|
|
|
17
17
|
this.protocol = protocol;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Whether a bare specifier's shape can only mean a local file or directory:
|
|
22
|
+
* the `link:` / `file:` protocols, a path-prefixed spec (`./`, `../`, `~/`,
|
|
23
|
+
* absolute POSIX paths, and Windows drive paths — including drive-relative
|
|
24
|
+
* ones like `C:dir`), or a bare tarball file name.
|
|
25
|
+
*
|
|
26
|
+
* Narrower than what {@link parseLocalPath} claims, which also takes any spec
|
|
27
|
+
* containing a path separator. That shape is statically indistinguishable from
|
|
28
|
+
* a hosted-git shorthand (`user/repo`) or a named-registry alias
|
|
29
|
+
* (`gh:@scope/pkg`), and the resolver chain only gets away with claiming it by
|
|
30
|
+
* running the local resolver last. Callers that dispatch on specifier shape
|
|
31
|
+
* without that ordering ask this instead.
|
|
32
|
+
*/
|
|
33
|
+
export function isLocalFilesystemSpecifier(bareSpecifier) {
|
|
34
|
+
if (bareSpecifier.startsWith('link:') || bareSpecifier.startsWith('file:'))
|
|
35
|
+
return true;
|
|
36
|
+
if (isFilespec.test(bareSpecifier))
|
|
37
|
+
return true;
|
|
38
|
+
// Any other protocol — a `git+ssh:` / `https:` URL, an `npm:` alias, a
|
|
39
|
+
// named-registry prefix — belongs to its own resolver, tarball-shaped path
|
|
40
|
+
// or not.
|
|
41
|
+
if (bareSpecifier.includes(':'))
|
|
42
|
+
return false;
|
|
43
|
+
// A `#` here marks a hosted-git shorthand's committish
|
|
44
|
+
// (`user/repo#release.tgz`), not a local tarball: the protocol and
|
|
45
|
+
// path-prefixed forms already returned above.
|
|
46
|
+
if (bareSpecifier.includes('#'))
|
|
47
|
+
return false;
|
|
48
|
+
return isFilename.test(bareSpecifier);
|
|
49
|
+
}
|
|
20
50
|
export function parseLocalScheme(wd, projectDir, lockfileDir, opts) {
|
|
21
51
|
if (wd.bareSpecifier.startsWith('link:') || wd.bareSpecifier.startsWith('workspace:')) {
|
|
22
52
|
return fromLocal(wd, projectDir, lockfileDir, 'directory', opts);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/resolving.local-resolver",
|
|
3
|
-
"version": "1101.
|
|
3
|
+
"version": "1101.2.0",
|
|
4
4
|
"description": "Resolver for local packages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"!*.map"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@pnpm/crypto.hash": "1100.0.
|
|
33
|
-
"@pnpm/error": "1100.1.
|
|
34
|
-
"@pnpm/resolving.resolver-base": "1101.
|
|
35
|
-
"@pnpm/types": "1102.
|
|
36
|
-
"@pnpm/workspace.project-manifest-reader": "1100.0.
|
|
32
|
+
"@pnpm/crypto.hash": "1100.0.3",
|
|
33
|
+
"@pnpm/error": "1100.1.4",
|
|
34
|
+
"@pnpm/resolving.resolver-base": "1101.2.0",
|
|
35
|
+
"@pnpm/types": "1102.1.0",
|
|
36
|
+
"@pnpm/workspace.project-manifest-reader": "1100.0.27",
|
|
37
37
|
"normalize-path": "^3.0.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@jest/globals": "30.4.1",
|
|
44
44
|
"@pnpm/logger": "1100.0.0",
|
|
45
|
-
"@pnpm/resolving.local-resolver": "1101.
|
|
45
|
+
"@pnpm/resolving.local-resolver": "1101.2.0",
|
|
46
46
|
"@types/normalize-path": "^3.0.2"
|
|
47
47
|
},
|
|
48
48
|
"engines": {
|