@vltpkg/spec 1.0.0-rc.31 → 1.0.0-rc.33
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/dist/browser.d.ts +0 -2
- package/dist/browser.js +7 -7
- package/dist/types.d.ts +24 -2
- package/package.json +11 -4
package/dist/browser.d.ts
CHANGED
|
@@ -2,10 +2,8 @@ import type { Range } from '@vltpkg/semver';
|
|
|
2
2
|
import type { GitSelectorParsed, Scope, SpecLike, SpecOptions, SpecOptionsFilled, SpecType } from './types.ts';
|
|
3
3
|
export * from './types.ts';
|
|
4
4
|
export declare const kCustomInspect: unique symbol;
|
|
5
|
-
export declare const defaultRegistry = "https://registry.npmjs.org/";
|
|
6
5
|
export declare const defaultRegistryName = "npm";
|
|
7
6
|
export declare const defaultRegistries: {
|
|
8
|
-
npm: string;
|
|
9
7
|
gh: string;
|
|
10
8
|
};
|
|
11
9
|
export declare const defaultJsrRegistries: {
|
package/dist/browser.js
CHANGED
|
@@ -2,10 +2,8 @@ import { error, typeError } from '@vltpkg/error-cause';
|
|
|
2
2
|
import { parseRange } from '@vltpkg/semver';
|
|
3
3
|
export * from "./types.js";
|
|
4
4
|
export const kCustomInspect = Symbol.for('nodejs.util.inspect.custom');
|
|
5
|
-
export const defaultRegistry = 'https://registry.npmjs.org/';
|
|
6
5
|
export const defaultRegistryName = 'npm';
|
|
7
6
|
export const defaultRegistries = {
|
|
8
|
-
npm: defaultRegistry,
|
|
9
7
|
gh: 'https://npm.pkg.github.com/',
|
|
10
8
|
};
|
|
11
9
|
export const defaultJsrRegistries = { jsr: 'https://npm.jsr.io/' };
|
|
@@ -42,11 +40,13 @@ export const getOptions = (options) => ({
|
|
|
42
40
|
catalog: {},
|
|
43
41
|
catalogs: {},
|
|
44
42
|
...options,
|
|
43
|
+
// built-in aliases are user/service-overridable: user config wins
|
|
45
44
|
'jsr-registries': {
|
|
46
|
-
...(options?.['jsr-registries'] ?? {}),
|
|
47
45
|
...defaultJsrRegistries,
|
|
46
|
+
...(options?.['jsr-registries'] ?? {}),
|
|
48
47
|
},
|
|
49
|
-
registry: options?.registry
|
|
48
|
+
registry: options?.registry,
|
|
49
|
+
'default-registry-alias': options?.['default-registry-alias'] ?? defaultRegistryName,
|
|
50
50
|
'scoped-registries': options?.['scoped-registries'] ?? {},
|
|
51
51
|
'git-hosts': options?.['git-hosts'] ?
|
|
52
52
|
{
|
|
@@ -55,8 +55,8 @@ export const getOptions = (options) => ({
|
|
|
55
55
|
}
|
|
56
56
|
: defaultGitHosts,
|
|
57
57
|
registries: {
|
|
58
|
-
...(options?.registries ?? {}),
|
|
59
58
|
...defaultRegistries,
|
|
59
|
+
...(options?.registries ?? {}),
|
|
60
60
|
},
|
|
61
61
|
'git-host-archives': options?.['git-host-archives'] ?
|
|
62
62
|
{
|
|
@@ -501,9 +501,9 @@ export class Spec {
|
|
|
501
501
|
this.distTag = this.bareSpec;
|
|
502
502
|
}
|
|
503
503
|
this.registrySpec = this.bareSpec;
|
|
504
|
-
const { 'scoped-registries': scopeRegs, registry } = this.options;
|
|
504
|
+
const { 'scoped-registries': scopeRegs, registry, registries, 'default-registry-alias': defaultAlias, } = this.options;
|
|
505
505
|
const scopeReg = this.scope && scopeRegs[this.scope];
|
|
506
|
-
this.registry = scopeReg ?? registry;
|
|
506
|
+
this.registry = scopeReg ?? registry ?? registries[defaultAlias];
|
|
507
507
|
// no guessing the tarball for JSR registries
|
|
508
508
|
for (const r of Object.values(this.options['jsr-registries'])) {
|
|
509
509
|
if (this.registry === r)
|
package/dist/types.d.ts
CHANGED
|
@@ -4,8 +4,30 @@ export type SpecOptions = {
|
|
|
4
4
|
};
|
|
5
5
|
export type Scope = `@${string}`;
|
|
6
6
|
export type SpecOptionsFilled = {
|
|
7
|
-
/**
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* The registry where a spec should be resolved against.
|
|
9
|
+
*
|
|
10
|
+
* There is **no default**. If no registry is configured, registry-type
|
|
11
|
+
* specs parsed without one will have `spec.registry === undefined`, and
|
|
12
|
+
* anything that needs to build a registry URL will fail. Named registry
|
|
13
|
+
* aliases (`gh:`, `jsr:`) and `scoped-registries` are unaffected.
|
|
14
|
+
*
|
|
15
|
+
* For bare specs, this takes precedence over the
|
|
16
|
+
* `default-registry-alias` lookup but not over a matching
|
|
17
|
+
* `scoped-registries` entry.
|
|
18
|
+
*/
|
|
19
|
+
registry?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The name of the registry alias (a key in `registries`) that bare specs
|
|
22
|
+
* (e.g. `foo@latest`) and transitive deps without an explicit registry
|
|
23
|
+
* protocol resolve through, when no `registry` or `scoped-registries`
|
|
24
|
+
* entry applies.
|
|
25
|
+
*
|
|
26
|
+
* Defaults to `'npm'`. The `npm` alias itself has **no** built-in URL --
|
|
27
|
+
* it must be configured (e.g. via `vlt setup`), otherwise bare specs
|
|
28
|
+
* resolve with `spec.registry === undefined`.
|
|
29
|
+
*/
|
|
30
|
+
'default-registry-alias': string;
|
|
9
31
|
/** shorthand prefix names for known registries */
|
|
10
32
|
registries: Record<string, string>;
|
|
11
33
|
/** shorthand prefix names for known git hosts */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vltpkg/spec",
|
|
3
3
|
"description": "Package specifier library",
|
|
4
|
-
"version": "1.0.0-rc.
|
|
4
|
+
"version": "1.0.0-rc.33",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/vltpkg/vltpkg.git",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"url": "http://vlt.sh"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@vltpkg/error-cause": "1.0.0-rc.
|
|
17
|
-
"@vltpkg/semver": "1.0.0-rc.
|
|
16
|
+
"@vltpkg/error-cause": "1.0.0-rc.33",
|
|
17
|
+
"@vltpkg/semver": "1.0.0-rc.33"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@eslint/js": "^9.39.1",
|
|
@@ -66,5 +66,12 @@
|
|
|
66
66
|
},
|
|
67
67
|
"files": [
|
|
68
68
|
"dist"
|
|
69
|
-
]
|
|
69
|
+
],
|
|
70
|
+
"bugs": [
|
|
71
|
+
{
|
|
72
|
+
"type": "link",
|
|
73
|
+
"url": "https://github.com/vltpkg/vltpkg/issues"
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"homepage": "https://github.com/vltpkg/vltpkg/tree/main/src/spec#readme"
|
|
70
77
|
}
|