@vltpkg/types 1.6.4 → 1.8.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/dist/index.d.ts +4 -3
- package/dist/index.js +5 -4
- package/dist/type-target.d.ts +2 -0
- package/dist/type-target.js +16 -0
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { DepID } from '@vltpkg/dep-id';
|
|
2
2
|
import type { Spec, SpecLikeBase, SpecOptions } from '@vltpkg/spec';
|
|
3
|
+
export { getTypeTarget } from './type-target.ts';
|
|
3
4
|
/**
|
|
4
5
|
* Utility type that overrides specific properties of type T with new types
|
|
5
6
|
* from R. Constrains override values to exclude undefined, ensuring that
|
|
@@ -608,6 +609,8 @@ export type GraphLike = {
|
|
|
608
609
|
removeNode(node: NodeLike, replacement?: NodeLike, keepEdges?: boolean): void;
|
|
609
610
|
};
|
|
610
611
|
export type NodeLike = {
|
|
612
|
+
/** package this node provides type definitions for. */
|
|
613
|
+
typeTarget?: string;
|
|
611
614
|
id: DepID;
|
|
612
615
|
confused: boolean;
|
|
613
616
|
edgesIn: Set<EdgeLike>;
|
|
@@ -637,7 +640,6 @@ export type NodeLike = {
|
|
|
637
640
|
optional: boolean;
|
|
638
641
|
modifier?: string | undefined;
|
|
639
642
|
peerSetHash?: string | undefined;
|
|
640
|
-
registry?: string;
|
|
641
643
|
platform?: {
|
|
642
644
|
engines?: Record<string, string>;
|
|
643
645
|
os?: string[] | string;
|
|
@@ -649,7 +651,7 @@ export type NodeLike = {
|
|
|
649
651
|
buildAllowed?: boolean;
|
|
650
652
|
buildBlocked?: boolean;
|
|
651
653
|
options: SpecOptions;
|
|
652
|
-
toJSON: () => Pick<NodeLike, 'id' | 'name' | 'version' | 'location' | 'importer' | 'manifest' | 'projectRoot' | 'integrity' | 'resolved' | 'dev' | 'optional' | 'confused' | 'platform' | 'buildState' | 'buildAllowed' | 'buildBlocked'> & {
|
|
654
|
+
toJSON: () => Pick<NodeLike, 'id' | 'name' | 'version' | 'location' | 'importer' | 'manifest' | 'projectRoot' | 'integrity' | 'resolved' | 'dev' | 'optional' | 'confused' | 'platform' | 'buildState' | 'buildAllowed' | 'buildBlocked' | 'typeTarget'> & {
|
|
653
655
|
rawManifest?: NodeLike['manifest'];
|
|
654
656
|
};
|
|
655
657
|
toString(): string;
|
|
@@ -661,4 +663,3 @@ export type NodeLike = {
|
|
|
661
663
|
* Parse a scoped package name into its scope and name components.
|
|
662
664
|
*/
|
|
663
665
|
export declare const parseScope: (scoped: string) => [string | undefined, string];
|
|
664
|
-
export {};
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { Version } from '@vltpkg/semver';
|
|
|
3
3
|
import { assertPathSafeName } from '@vltpkg/spec/browser';
|
|
4
4
|
import { posix } from 'node:path';
|
|
5
5
|
import { debuglog } from 'node:util';
|
|
6
|
+
export { getTypeTarget } from "./type-target.js";
|
|
6
7
|
const debug = debuglog('vlt');
|
|
7
8
|
/**
|
|
8
9
|
* Normalize a single funding entry to a consistent format.
|
|
@@ -301,7 +302,7 @@ export const isNormalizedBugs = (o) => {
|
|
|
301
302
|
export const normalizeKeywords = (keywords) => {
|
|
302
303
|
if (!keywords)
|
|
303
304
|
return;
|
|
304
|
-
let keywordArray
|
|
305
|
+
let keywordArray;
|
|
305
306
|
if (typeof keywords === 'string') {
|
|
306
307
|
// Handle comma-separated string values
|
|
307
308
|
keywordArray = keywords
|
|
@@ -356,7 +357,7 @@ export const normalizeEngines = (engines) => {
|
|
|
356
357
|
export const normalizeOs = (os) => {
|
|
357
358
|
if (!os)
|
|
358
359
|
return;
|
|
359
|
-
let osArray
|
|
360
|
+
let osArray;
|
|
360
361
|
if (typeof os === 'string') {
|
|
361
362
|
// Handle single OS string
|
|
362
363
|
osArray = [os.trim()].filter(item => item.length > 0);
|
|
@@ -384,7 +385,7 @@ export const normalizeOs = (os) => {
|
|
|
384
385
|
export const normalizeCpu = (cpu) => {
|
|
385
386
|
if (!cpu)
|
|
386
387
|
return;
|
|
387
|
-
let cpuArray
|
|
388
|
+
let cpuArray;
|
|
388
389
|
if (typeof cpu === 'string') {
|
|
389
390
|
// Handle single CPU string
|
|
390
391
|
cpuArray = [cpu.trim()].filter(item => item.length > 0);
|
|
@@ -412,7 +413,7 @@ export const normalizeCpu = (cpu) => {
|
|
|
412
413
|
export const normalizeLibc = (libc) => {
|
|
413
414
|
if (!libc)
|
|
414
415
|
return;
|
|
415
|
-
let libcArray
|
|
416
|
+
let libcArray;
|
|
416
417
|
if (typeof libc === 'string') {
|
|
417
418
|
// Handle single libc string
|
|
418
419
|
libcArray = [libc.trim()].filter(item => item.length > 0);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** maps @types/foo to foo and @types/scope__name to @scope/name. */
|
|
2
|
+
export const getTypeTarget = (name) => {
|
|
3
|
+
if (!name?.startsWith('@types/'))
|
|
4
|
+
return;
|
|
5
|
+
const target = name.slice(7);
|
|
6
|
+
if (!target || target.includes('/'))
|
|
7
|
+
return;
|
|
8
|
+
const separator = target.indexOf('__');
|
|
9
|
+
if (separator === -1)
|
|
10
|
+
return target;
|
|
11
|
+
const scope = target.slice(0, separator);
|
|
12
|
+
const unscoped = target.slice(separator + 2);
|
|
13
|
+
if (!scope || !unscoped)
|
|
14
|
+
return;
|
|
15
|
+
return `@${scope}/${unscoped}`;
|
|
16
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vltpkg/types",
|
|
3
3
|
"description": "definitions for some of vlt's core types",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.8.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/vltpkg/vltpkg.git",
|
|
@@ -13,20 +13,20 @@
|
|
|
13
13
|
"url": "http://vlt.sh"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@vltpkg/dep-id": "1.
|
|
17
|
-
"@vltpkg/error-cause": "1.
|
|
18
|
-
"@vltpkg/semver": "1.
|
|
19
|
-
"@vltpkg/spec": "1.
|
|
16
|
+
"@vltpkg/dep-id": "1.8.0",
|
|
17
|
+
"@vltpkg/error-cause": "1.8.0",
|
|
18
|
+
"@vltpkg/semver": "1.8.0",
|
|
19
|
+
"@vltpkg/spec": "1.8.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@eslint/js": "^
|
|
22
|
+
"@eslint/js": "^10.0.1",
|
|
23
23
|
"@types/node": "^22.19.2",
|
|
24
|
-
"eslint": "^
|
|
24
|
+
"eslint": "^10.14.0",
|
|
25
25
|
"prettier": "^3.7.4",
|
|
26
26
|
"tap": "^21.8.0",
|
|
27
27
|
"typedoc": "~0.27.9",
|
|
28
28
|
"typescript": "5.7.3",
|
|
29
|
-
"typescript-eslint": "^8.
|
|
29
|
+
"typescript-eslint": "^8.56.0"
|
|
30
30
|
},
|
|
31
31
|
"license": "BSD-2-Clause-Patent",
|
|
32
32
|
"engines": {
|