-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
151 lines (127 loc) · 4.27 KB
/
types.ts
File metadata and controls
151 lines (127 loc) · 4.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/**
* @fileoverview Public type surface for `packages/*` modules — the
* `PackageJson` shape (npm-extended with a `socket` field) plus option
* bags consumed across `edit` / `manifest` / `normalize` / `operations`
* / `provenance` / `licenses`. Pure types, no runtime side effects.
*/
import type { CategoryString } from '../eco/types'
// Type for package.json exports field.
type PackageExports = {
[path: string]: unknown
}
// Re-export the EditablePackageJson instance type for convenient access
export type EditablePackageJson = import('./edit').EditablePackageJsonInstance
/**
* Extended PackageJson type based on NPMCliPackageJson.Content with Socket-specific additions.
* @extends NPMCliPackageJson.Content (from @npmcli/package-json)
* @property socket - Optional Socket.dev specific configuration
*/
export type PackageJson = {
// Core npm fields
[key: string]: unknown
name?: string | undefined
version?: string | undefined
description?: string | undefined
main?: string | undefined
module?: string | undefined
types?: string | undefined
typings?: string | undefined
bin?: string | Record<string, string> | undefined
// Author and contributors
author?: string | { name?: string; email?: string; url?: string } | undefined
contributors?:
| Array<string | { name?: string; email?: string; url?: string }>
| undefined
maintainers?:
| Array<string | { name?: string; email?: string; url?: string }>
| undefined
// Repository and URLs
repository?:
| string
| { type?: string; url?: string; directory?: string }
| undefined
homepage?: string | undefined
bugs?: string | { url?: string; email?: string } | undefined
// License
license?: string | undefined
licenses?: Array<{ type?: string; url?: string }> | undefined
// Scripts
scripts?: Record<string, string> | undefined
// Dependencies
dependencies?: Record<string, string> | undefined
devDependencies?: Record<string, string> | undefined
peerDependencies?: Record<string, string> | undefined
optionalDependencies?: Record<string, string> | undefined
bundledDependencies?: string[] | undefined
bundleDependencies?: string[] | undefined
// Package managers specific
overrides?: Record<string, string> | undefined
resolutions?: Record<string, string> | undefined
pnpm?: Record<string, unknown> | undefined
// Module system
exports?: PackageExports | string | string[] | undefined
imports?: Record<string, unknown> | undefined
type?: 'module' | 'commonjs' | undefined
// Publishing
private?: boolean | undefined
publishConfig?: Record<string, unknown> | undefined
files?: string[] | undefined
// Engines and OS
engines?: Record<string, string> | undefined
os?: string[] | undefined
cpu?: string[] | undefined
// Package manager
packageManager?: string | undefined
// Workspaces
workspaces?: string[] | { packages?: string[] } | undefined
// Socket.dev specific
socket?:
| {
categories?: CategoryString | CategoryString[]
interop?: string | string[]
[key: string]: unknown
}
| undefined
}
export type SaveOptions = {
ignoreWhitespace?: boolean | undefined
sort?: boolean | undefined
}
export type EditablePackageJsonOptions = {
normalize?: boolean | undefined
path?: string | undefined
preserve?: string[] | readonly string[] | undefined
create?: boolean | undefined
data?: PackageJson | undefined
}
export type ExtractOptions = {
dest?: string | undefined
tmpPrefix?: string | undefined
signal?: AbortSignal | undefined
packumentCache?: Map<string, unknown> | undefined
preferOffline?: boolean | undefined
}
export type NormalizeOptions = {
preserve?: string[] | readonly string[] | undefined
}
export type ReadPackageJsonOptions = NormalizeOptions & {
editable?: boolean | undefined
normalize?: boolean | undefined
throws?: boolean | undefined
}
export type ProvenanceOptions = {
signal?: AbortSignal | undefined
timeout?: number | undefined
}
export type LicenseNode = {
license: string
exception?: string | undefined
inFile?: string | undefined
plus?: boolean | undefined
}
export type PacoteOptions = {
signal?: AbortSignal | undefined
packumentCache?: Map<string, unknown> | undefined
preferOffline?: boolean | undefined
fullMetadata?: boolean | undefined
}