npmdata 0.10.3 → 0.12.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/README.md +133 -58
- package/dist/cli/actions/check.d.ts +6 -0
- package/dist/cli/actions/check.d.ts.map +1 -0
- package/dist/cli/actions/check.js +57 -0
- package/dist/cli/actions/check.js.map +1 -0
- package/dist/cli/actions/extract.d.ts +7 -0
- package/dist/cli/actions/extract.d.ts.map +1 -0
- package/dist/cli/actions/extract.js +84 -0
- package/dist/cli/actions/extract.js.map +1 -0
- package/dist/cli/actions/init.d.ts +6 -0
- package/dist/cli/actions/init.d.ts.map +1 -0
- package/dist/cli/actions/init.js +36 -0
- package/dist/cli/actions/init.js.map +1 -0
- package/dist/cli/actions/list.d.ts +7 -0
- package/dist/cli/actions/list.d.ts.map +1 -0
- package/dist/cli/actions/list.js +42 -0
- package/dist/cli/actions/list.js.map +1 -0
- package/dist/cli/actions/purge.d.ts +6 -0
- package/dist/cli/actions/purge.d.ts.map +1 -0
- package/dist/cli/actions/purge.js +47 -0
- package/dist/cli/actions/purge.js.map +1 -0
- package/dist/cli/argv.d.ts +35 -0
- package/dist/cli/argv.d.ts.map +1 -0
- package/dist/cli/argv.js +125 -0
- package/dist/cli/argv.js.map +1 -0
- package/dist/cli/cli.d.ts +9 -0
- package/dist/cli/cli.d.ts.map +1 -0
- package/dist/cli/cli.js +69 -0
- package/dist/cli/cli.js.map +1 -0
- package/dist/cli/runner.d.ts +9 -0
- package/dist/cli/runner.d.ts.map +1 -0
- package/dist/cli/runner.js +106 -0
- package/dist/cli/runner.js.map +1 -0
- package/dist/cli/usage.d.ts +6 -0
- package/dist/cli/usage.d.ts.map +1 -0
- package/dist/cli/usage.js +126 -0
- package/dist/cli/usage.js.map +1 -0
- package/dist/fileset/check.d.ts +15 -0
- package/dist/fileset/check.d.ts.map +1 -0
- package/dist/fileset/check.js +68 -0
- package/dist/fileset/check.js.map +1 -0
- package/dist/fileset/constants.d.ts +13 -0
- package/dist/fileset/constants.d.ts.map +1 -0
- package/dist/fileset/constants.js +22 -0
- package/dist/fileset/constants.js.map +1 -0
- package/dist/fileset/diff.d.ts +16 -0
- package/dist/fileset/diff.d.ts.map +1 -0
- package/dist/fileset/diff.js +116 -0
- package/dist/fileset/diff.js.map +1 -0
- package/dist/fileset/execute.d.ts +29 -0
- package/dist/fileset/execute.d.ts.map +1 -0
- package/dist/fileset/execute.js +136 -0
- package/dist/fileset/execute.js.map +1 -0
- package/dist/fileset/gitignore.d.ts +16 -0
- package/dist/fileset/gitignore.d.ts.map +1 -0
- package/dist/fileset/gitignore.js +82 -0
- package/dist/fileset/gitignore.js.map +1 -0
- package/dist/fileset/index.d.ts +5 -0
- package/dist/fileset/index.d.ts.map +1 -0
- package/dist/fileset/index.js +21 -0
- package/dist/fileset/index.js.map +1 -0
- package/dist/fileset/list.d.ts +6 -0
- package/dist/fileset/list.d.ts.map +1 -0
- package/dist/fileset/list.js +11 -0
- package/dist/fileset/list.js.map +1 -0
- package/dist/fileset/markers.d.ts +22 -0
- package/dist/fileset/markers.d.ts.map +1 -0
- package/dist/fileset/markers.js +68 -0
- package/dist/fileset/markers.js.map +1 -0
- package/dist/fileset/package-files.d.ts +14 -0
- package/dist/fileset/package-files.d.ts.map +1 -0
- package/dist/fileset/package-files.js +81 -0
- package/dist/fileset/package-files.js.map +1 -0
- package/dist/fileset/purge.d.ts +12 -0
- package/dist/fileset/purge.d.ts.map +1 -0
- package/dist/fileset/purge.js +95 -0
- package/dist/fileset/purge.js.map +1 -0
- package/dist/fileset/test-utils.d.ts +12 -0
- package/dist/fileset/test-utils.d.ts.map +1 -0
- package/dist/fileset/test-utils.js +65 -0
- package/dist/fileset/test-utils.js.map +1 -0
- package/dist/index.d.ts +10 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -17
- package/dist/index.js.map +1 -1
- package/dist/main.js +9 -16
- package/dist/main.js.map +1 -1
- package/dist/npmdata-0.0.1.tgz +0 -0
- package/dist/package/action-check.d.ts +20 -0
- package/dist/package/action-check.d.ts.map +1 -0
- package/dist/package/action-check.js +61 -0
- package/dist/package/action-check.js.map +1 -0
- package/dist/package/action-extract.d.ts +21 -0
- package/dist/package/action-extract.d.ts.map +1 -0
- package/dist/package/action-extract.js +186 -0
- package/dist/package/action-extract.js.map +1 -0
- package/dist/package/action-init.d.ts +13 -0
- package/dist/package/action-init.d.ts.map +1 -0
- package/dist/package/action-init.js +77 -0
- package/dist/package/action-init.js.map +1 -0
- package/dist/package/action-list.d.ts +14 -0
- package/dist/package/action-list.d.ts.map +1 -0
- package/dist/package/action-list.js +46 -0
- package/dist/package/action-list.js.map +1 -0
- package/dist/package/action-purge.d.ts +21 -0
- package/dist/package/action-purge.d.ts.map +1 -0
- package/dist/package/action-purge.js +60 -0
- package/dist/package/action-purge.js.map +1 -0
- package/dist/package/config-merge.d.ts +18 -0
- package/dist/package/config-merge.d.ts.map +1 -0
- package/dist/package/config-merge.js +48 -0
- package/dist/package/config-merge.js.map +1 -0
- package/dist/package/config.d.ts +13 -0
- package/dist/package/config.d.ts.map +1 -0
- package/dist/package/config.js +29 -0
- package/dist/package/config.js.map +1 -0
- package/dist/package/content-replacements.d.ts +21 -0
- package/dist/package/content-replacements.d.ts.map +1 -0
- package/dist/package/content-replacements.js +96 -0
- package/dist/package/content-replacements.js.map +1 -0
- package/dist/package/index.d.ts +10 -0
- package/dist/package/index.d.ts.map +1 -0
- package/dist/package/index.js +16 -0
- package/dist/package/index.js.map +1 -0
- package/dist/package/symlinks.d.ts +17 -0
- package/dist/package/symlinks.d.ts.map +1 -0
- package/dist/package/symlinks.js +125 -0
- package/dist/package/symlinks.js.map +1 -0
- package/dist/types.d.ts +184 -270
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -12
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +25 -55
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +82 -181
- package/dist/utils.js.map +1 -1
- package/package.json +5 -2
- package/dist/cli.d.ts +0 -6
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -514
- package/dist/cli.js.map +0 -1
- package/dist/consumer.d.ts +0 -74
- package/dist/consumer.d.ts.map +0 -1
- package/dist/consumer.js +0 -820
- package/dist/consumer.js.map +0 -1
- package/dist/publisher.d.ts +0 -38
- package/dist/publisher.d.ts.map +0 -1
- package/dist/publisher.js +0 -164
- package/dist/publisher.js.map +0 -1
- package/dist/runner.d.ts +0 -102
- package/dist/runner.d.ts.map +0 -1
- package/dist/runner.js +0 -748
- package/dist/runner.js.map +0 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,68 +1,187 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Excludes common package metadata files that are not meant to be extracted by consumers.
|
|
2
|
+
* Internal parsed representation of an npm package specifier.
|
|
4
3
|
*/
|
|
5
|
-
export
|
|
4
|
+
export type PackageConfig = {
|
|
5
|
+
/** npm package name (e.g. "my-pkg" or "@scope/my-pkg") */
|
|
6
|
+
name: string;
|
|
7
|
+
/** Semver range constraint. Absent means "latest". */
|
|
8
|
+
version?: string;
|
|
9
|
+
};
|
|
6
10
|
/**
|
|
7
|
-
*
|
|
8
|
-
* After files are extracted, matching files/dirs in the output directory are made
|
|
9
|
-
* available as symlinks inside the target directory.
|
|
11
|
+
* Controls which files are selected from a package and install behaviour.
|
|
10
12
|
*/
|
|
11
|
-
export type
|
|
13
|
+
export type SelectorConfig = {
|
|
12
14
|
/**
|
|
13
|
-
* Glob
|
|
14
|
-
*
|
|
15
|
-
* the target directory.
|
|
16
|
-
* Example: "**\/skills\/**" will find every entry under any "skills" directory.
|
|
15
|
+
* Glob patterns; files must match at least one.
|
|
16
|
+
* Default: DEFAULT_FILENAME_PATTERNS (excludes package.json, bin/**, README.md, node_modules/**)
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
files?: string[];
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
21
|
-
* directory in which the runner is invoked (i.e. the consumer's project root).
|
|
22
|
-
* Example: ".github/skills"
|
|
20
|
+
* Regex strings; files must match at least one. Binary files always skip regex check.
|
|
23
21
|
*/
|
|
24
|
-
|
|
22
|
+
contentRegexes?: string[];
|
|
23
|
+
/**
|
|
24
|
+
* Tags this entry for --presets CLI filtering. Not forwarded to dependency packages.
|
|
25
|
+
*/
|
|
26
|
+
presets?: string[];
|
|
27
|
+
/**
|
|
28
|
+
* Force fresh package install even if a satisfying version is installed.
|
|
29
|
+
*/
|
|
30
|
+
upgrade?: boolean;
|
|
25
31
|
};
|
|
26
32
|
/**
|
|
27
|
-
*
|
|
28
|
-
* After files are extracted, the specified files in the workspace are searched
|
|
29
|
-
* for regex matches and the matched portions are replaced with the target string.
|
|
33
|
+
* Controls where and how extracted files are written.
|
|
30
34
|
*/
|
|
31
|
-
export type
|
|
35
|
+
export type OutputConfig = {
|
|
32
36
|
/**
|
|
33
|
-
*
|
|
34
|
-
* whose content should be modified.
|
|
35
|
-
* Example: "docs/**\/*.md"
|
|
37
|
+
* Output directory relative to cwd. Concatenated across recursion levels.
|
|
36
38
|
*/
|
|
37
|
-
|
|
39
|
+
path: string;
|
|
38
40
|
/**
|
|
39
|
-
*
|
|
40
|
-
* matched file. All non-overlapping occurrences are replaced (global flag is
|
|
41
|
-
* applied automatically).
|
|
42
|
-
* Example: "<!-- version: .* -->"
|
|
41
|
+
* Overwrite existing unmanaged files. Overridden by --force and --keep-existing.
|
|
43
42
|
*/
|
|
44
|
-
|
|
43
|
+
force?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Skip files that already exist; create missing ones. Cannot combine with force.
|
|
46
|
+
*/
|
|
47
|
+
keepExisting?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Create/update .gitignore alongside each .npmdata marker.
|
|
50
|
+
*/
|
|
51
|
+
gitignore?: boolean;
|
|
45
52
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
53
|
+
* Write without .npmdata marker, no gitignore update, no read-only. Existing files skipped.
|
|
54
|
+
* Takes precedence over force.
|
|
48
55
|
*/
|
|
56
|
+
unmanaged?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Report what would change; no disk writes.
|
|
59
|
+
*/
|
|
60
|
+
dryRun?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Post-extract symlink operations. Appended across recursion levels.
|
|
63
|
+
*/
|
|
64
|
+
symlinks?: SymlinkConfig[];
|
|
65
|
+
/**
|
|
66
|
+
* Post-extract content replacements. Appended across recursion levels.
|
|
67
|
+
*/
|
|
68
|
+
contentReplacements?: ContentReplacementConfig[];
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Controls runtime output verbosity.
|
|
72
|
+
*/
|
|
73
|
+
export type ExecutionConfig = {
|
|
74
|
+
/** Suppress per-file output; print only final summary line. */
|
|
75
|
+
silent?: boolean;
|
|
76
|
+
/** Print detailed step information. */
|
|
77
|
+
verbose?: boolean;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Defines one post-extract symlink operation.
|
|
81
|
+
*/
|
|
82
|
+
export type SymlinkConfig = {
|
|
83
|
+
/** Glob relative to outputDir. Matching files/dirs get symlinked into `target`. */
|
|
84
|
+
source: string;
|
|
85
|
+
/** Directory where symlinks are created, relative to outputDir. Supports ../ paths. */
|
|
86
|
+
target: string;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Defines one post-extract content replacement operation.
|
|
90
|
+
*/
|
|
91
|
+
export type ContentReplacementConfig = {
|
|
92
|
+
/** Glob relative to cwd selecting workspace files to modify. */
|
|
93
|
+
files: string;
|
|
94
|
+
/** Regex string; all non-overlapping occurrences replaced (global flag applied). */
|
|
95
|
+
match: string;
|
|
96
|
+
/** Replacement string; may contain back-references ($1, $2). */
|
|
49
97
|
replace: string;
|
|
50
98
|
};
|
|
51
99
|
/**
|
|
52
|
-
*
|
|
100
|
+
* One entry in the npmdata.sets array. Represents a single extraction target.
|
|
53
101
|
*/
|
|
54
|
-
export type
|
|
102
|
+
export type NpmdataExtractEntry = {
|
|
103
|
+
/** Flat package spec string ("my-pkg@^1.2.3"). Parsed to PackageConfig internally. */
|
|
104
|
+
package: string;
|
|
105
|
+
/** Where/how to write files. */
|
|
106
|
+
output: OutputConfig;
|
|
107
|
+
/** Which files to select and install options. */
|
|
108
|
+
selector?: SelectorConfig;
|
|
55
109
|
/**
|
|
56
|
-
*
|
|
110
|
+
* Preset tags for --presets CLI filtering. An entry is included when at least
|
|
111
|
+
* one of its presets appears in the requested preset list.
|
|
112
|
+
* Not forwarded to dependency packages.
|
|
57
113
|
*/
|
|
58
|
-
|
|
114
|
+
presets?: string[];
|
|
115
|
+
/** Suppress per-file output. Root-level (not nested). */
|
|
116
|
+
silent?: boolean;
|
|
117
|
+
/** Print detailed step information. Root-level (not nested). */
|
|
118
|
+
verbose?: boolean;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Top-level structure stored under npmdata key in package.json or in any cosmiconfig source.
|
|
122
|
+
*/
|
|
123
|
+
export type NpmdataConfig = {
|
|
124
|
+
/** All extraction entries. */
|
|
125
|
+
sets: NpmdataExtractEntry[];
|
|
59
126
|
/**
|
|
60
|
-
*
|
|
127
|
+
* Shell command run after successful extract (not during --dry-run).
|
|
128
|
+
* Executed in process.cwd(). Full argv appended as arguments.
|
|
61
129
|
*/
|
|
62
|
-
|
|
130
|
+
postExtractScript?: string;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* A single file operation in the diff/execute pipeline.
|
|
134
|
+
*/
|
|
135
|
+
export type FileOperation = {
|
|
136
|
+
relPath: string;
|
|
137
|
+
sourcePath: string;
|
|
138
|
+
destPath: string;
|
|
139
|
+
hash: string;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* A file skipped during extraction with the reason.
|
|
143
|
+
*/
|
|
144
|
+
export type SkippedFile = {
|
|
145
|
+
relPath: string;
|
|
146
|
+
reason: 'conflict' | 'keep-existing' | 'unmanaged';
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* An unmanaged file in outputDir that blocks extraction.
|
|
150
|
+
*/
|
|
151
|
+
export type ConflictFile = {
|
|
152
|
+
relPath: string;
|
|
153
|
+
/** Set when file is managed by a different package. */
|
|
154
|
+
existingOwner?: string;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Internal read-only structure produced by fileset/diff.ts. Not persisted.
|
|
158
|
+
*/
|
|
159
|
+
export type ExtractionMap = {
|
|
160
|
+
/** Files present in package source but absent from outputDir. */
|
|
161
|
+
toAdd: FileOperation[];
|
|
162
|
+
/** Files whose hash differs between package source and outputDir. */
|
|
163
|
+
toModify: FileOperation[];
|
|
164
|
+
/** Relative paths of managed files no longer present in filtered package source. */
|
|
165
|
+
toDelete: string[];
|
|
166
|
+
/** Files skipped with reason. */
|
|
167
|
+
toSkip: SkippedFile[];
|
|
168
|
+
/** Unmanaged files in outputDir that block extraction. */
|
|
169
|
+
conflicts: ConflictFile[];
|
|
63
170
|
};
|
|
64
171
|
/**
|
|
65
|
-
*
|
|
172
|
+
* One row in a .npmdata CSV marker file.
|
|
173
|
+
* CSV format (preserved from v1): path,packageName,packageVersion — one row per file, no header.
|
|
174
|
+
*/
|
|
175
|
+
export type ManagedFileMetadata = {
|
|
176
|
+
/** Relative path from marker file directory. */
|
|
177
|
+
path: string;
|
|
178
|
+
/** Source npm package name. */
|
|
179
|
+
packageName: string;
|
|
180
|
+
/** Installed version at extraction time. */
|
|
181
|
+
packageVersion: string;
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Event emitted by extract/check/purge for UI progress reporting.
|
|
66
185
|
*/
|
|
67
186
|
export type ProgressEvent = {
|
|
68
187
|
type: 'package-start';
|
|
@@ -90,245 +209,40 @@ export type ProgressEvent = {
|
|
|
90
209
|
file: string;
|
|
91
210
|
};
|
|
92
211
|
/**
|
|
93
|
-
*
|
|
212
|
+
* Result of a check operation for a single fileset.
|
|
94
213
|
*/
|
|
95
|
-
export type
|
|
96
|
-
/**
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
* can be provided and they will all be extracted into outputDir.
|
|
100
|
-
*/
|
|
101
|
-
packages: string[];
|
|
102
|
-
/**
|
|
103
|
-
* Output directory where files will be extracted
|
|
104
|
-
*/
|
|
105
|
-
outputDir: string;
|
|
106
|
-
/**
|
|
107
|
-
* Package manager type (auto-detect if not specified)
|
|
108
|
-
*/
|
|
109
|
-
packageManager?: 'pnpm' | 'yarn' | 'npm';
|
|
110
|
-
/**
|
|
111
|
-
* Allow creating conflicting files (default: false, will error)
|
|
112
|
-
*/
|
|
113
|
-
force?: boolean;
|
|
114
|
-
/**
|
|
115
|
-
* When true, skip files that already exist in the output directory but create
|
|
116
|
-
* them when they are absent. Cannot be combined with force.
|
|
117
|
-
*/
|
|
118
|
-
keepExisting?: boolean;
|
|
119
|
-
/**
|
|
120
|
-
* Working directory from which to run package manager install commands (e.g. pnpm add).
|
|
121
|
-
* Defaults to process.cwd() if not specified.
|
|
122
|
-
*/
|
|
123
|
-
cwd?: string;
|
|
124
|
-
/**
|
|
125
|
-
* Automatically create/update a .gitignore file alongside each .npmdata marker file,
|
|
126
|
-
* adding the managed files and the .npmdata file itself to be ignored by git.
|
|
127
|
-
* Defaults to true. Set to false to disable.
|
|
128
|
-
*/
|
|
129
|
-
gitignore?: boolean;
|
|
130
|
-
/**
|
|
131
|
-
* When true, write files to disk without creating a .npmdata marker, without
|
|
132
|
-
* updating .gitignore, and without making files read-only. Files written with
|
|
133
|
-
* this flag are not tracked by npmdata and can be freely edited by the user.
|
|
134
|
-
* When a destination file already exists it is left untouched and reported as
|
|
135
|
-
* skipped. Takes precedence over force.
|
|
136
|
-
*/
|
|
137
|
-
unmanaged?: boolean;
|
|
138
|
-
/**
|
|
139
|
-
* When true, simulate extraction without writing anything to disk.
|
|
140
|
-
* The returned ConsumerResult reflects what would have changed.
|
|
141
|
-
*/
|
|
142
|
-
dryRun?: boolean;
|
|
143
|
-
/**
|
|
144
|
-
* When true, force a fresh install of each package even if a satisfying version
|
|
145
|
-
* is already installed. Useful to pick up the latest patch or minor release.
|
|
146
|
-
*/
|
|
147
|
-
upgrade?: boolean;
|
|
148
|
-
/**
|
|
149
|
-
* Optional callback called for each file event during extraction.
|
|
150
|
-
* Useful for progress reporting in scripts and build tools.
|
|
151
|
-
*/
|
|
152
|
-
onProgress?: (event: ProgressEvent) => void;
|
|
153
|
-
/**
|
|
154
|
-
* Content-replacement operations that were applied to files after extraction.
|
|
155
|
-
* When provided, check() will apply the same transformations to the package
|
|
156
|
-
* source content before comparing hashes, so files modified by replacements
|
|
157
|
-
* are not incorrectly reported as out of sync.
|
|
158
|
-
*/
|
|
159
|
-
contentReplacements?: ContentReplacementConfig[];
|
|
160
|
-
};
|
|
161
|
-
/**
|
|
162
|
-
* Metadata about managed files
|
|
163
|
-
*/
|
|
164
|
-
export type ManagedFileMetadata = {
|
|
165
|
-
/**
|
|
166
|
-
* Path to the managed file (relative to marker file directory)
|
|
167
|
-
*/
|
|
168
|
-
path: string;
|
|
169
|
-
/**
|
|
170
|
-
* Package name that created this file
|
|
171
|
-
*/
|
|
172
|
-
packageName: string;
|
|
173
|
-
/**
|
|
174
|
-
* Package version that created this file
|
|
175
|
-
*/
|
|
176
|
-
packageVersion: string;
|
|
177
|
-
/**
|
|
178
|
-
* Whether the file was written replacing an existing unmanaged file (via force flag)
|
|
179
|
-
*/
|
|
180
|
-
force?: boolean;
|
|
181
|
-
};
|
|
182
|
-
/**
|
|
183
|
-
* Result of a consumer operation
|
|
184
|
-
*/
|
|
185
|
-
export type ConsumerResult = {
|
|
186
|
-
added: string[];
|
|
214
|
+
export type CheckResult = {
|
|
215
|
+
/** Files in .npmdata marker but absent from output dir. */
|
|
216
|
+
missing: string[];
|
|
217
|
+
/** Files whose content hash differs from package source. */
|
|
187
218
|
modified: string[];
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
sourcePackages: Array<{
|
|
191
|
-
name: string;
|
|
192
|
-
version: string;
|
|
193
|
-
changes: {
|
|
194
|
-
added: string[];
|
|
195
|
-
modified: string[];
|
|
196
|
-
deleted: string[];
|
|
197
|
-
skipped: string[];
|
|
198
|
-
};
|
|
199
|
-
}>;
|
|
219
|
+
/** Files in filtered package source but never extracted. */
|
|
220
|
+
extra: string[];
|
|
200
221
|
};
|
|
201
222
|
/**
|
|
202
|
-
* Result of
|
|
223
|
+
* Result of purging one fileset.
|
|
203
224
|
*/
|
|
204
|
-
export type
|
|
205
|
-
/**
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
|
|
211
|
-
*/
|
|
212
|
-
differences: {
|
|
213
|
-
/**
|
|
214
|
-
* Files that are in the .npmdata marker but missing from the output directory
|
|
215
|
-
*/
|
|
216
|
-
missing: string[];
|
|
217
|
-
/**
|
|
218
|
-
* Files whose contents differ from the package source
|
|
219
|
-
*/
|
|
220
|
-
modified: string[];
|
|
221
|
-
/**
|
|
222
|
-
* Files that exist in the package but have not been extracted yet
|
|
223
|
-
*/
|
|
224
|
-
extra: string[];
|
|
225
|
-
};
|
|
226
|
-
/**
|
|
227
|
-
* Per-package breakdown of differences
|
|
228
|
-
*/
|
|
229
|
-
sourcePackages: Array<{
|
|
230
|
-
name: string;
|
|
231
|
-
version: string;
|
|
232
|
-
ok: boolean;
|
|
233
|
-
differences: {
|
|
234
|
-
missing: string[];
|
|
235
|
-
modified: string[];
|
|
236
|
-
extra: string[];
|
|
237
|
-
};
|
|
238
|
-
}>;
|
|
225
|
+
export type PurgeResult = {
|
|
226
|
+
/** Number of files deleted. */
|
|
227
|
+
deleted: number;
|
|
228
|
+
/** Number of symlinks removed. */
|
|
229
|
+
symlinksRemoved: number;
|
|
230
|
+
/** Number of empty dirs removed. */
|
|
231
|
+
dirsRemoved: number;
|
|
239
232
|
};
|
|
240
233
|
/**
|
|
241
|
-
*
|
|
242
|
-
* The runner iterates over these entries and calls extract() for each one.
|
|
234
|
+
* Result of executing an ExtractionMap.
|
|
243
235
|
*/
|
|
244
|
-
export type
|
|
245
|
-
/**
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Glob patterns to filter which files are extracted (e.g. ["data/**", "*.json"]).
|
|
257
|
-
* Defaults to all files when not set.
|
|
258
|
-
*/
|
|
259
|
-
files?: string[];
|
|
260
|
-
/**
|
|
261
|
-
* Allow overwriting existing unmanaged files (default: false).
|
|
262
|
-
*/
|
|
263
|
-
force?: boolean;
|
|
264
|
-
/**
|
|
265
|
-
* When true, skip files that already exist in the output directory but create
|
|
266
|
-
* them when they are absent. Cannot be combined with force (default: false).
|
|
267
|
-
*/
|
|
268
|
-
keepExisting?: boolean;
|
|
269
|
-
/**
|
|
270
|
-
* Create/update a .gitignore file alongside each .npmdata marker file (default: true).
|
|
271
|
-
*/
|
|
272
|
-
gitignore?: boolean;
|
|
273
|
-
/**
|
|
274
|
-
* Write files without creating a .npmdata marker, updating .gitignore, or making
|
|
275
|
-
* files read-only. Existing files are skipped rather than overwritten (default: false).
|
|
276
|
-
*/
|
|
277
|
-
unmanaged?: boolean;
|
|
278
|
-
/**
|
|
279
|
-
* Simulate extraction without writing anything to disk (default: false).
|
|
280
|
-
*/
|
|
281
|
-
dryRun?: boolean;
|
|
282
|
-
/**
|
|
283
|
-
* Force a fresh install of the package even when a satisfying version is already
|
|
284
|
-
* installed (default: false).
|
|
285
|
-
*/
|
|
286
|
-
upgrade?: boolean;
|
|
287
|
-
/**
|
|
288
|
-
* Suppress per-file output, printing only the final result line (default: false).
|
|
289
|
-
*/
|
|
290
|
-
silent?: boolean;
|
|
291
|
-
/**
|
|
292
|
-
* Print detailed progress information for each file and step processed (default: false).
|
|
293
|
-
*/
|
|
294
|
-
verbose?: boolean;
|
|
295
|
-
/**
|
|
296
|
-
* Regex patterns (as strings) to filter files by content. Only files whose content
|
|
297
|
-
* matches at least one pattern are extracted.
|
|
298
|
-
*/
|
|
299
|
-
contentRegexes?: string[];
|
|
300
|
-
/**
|
|
301
|
-
* Tags used to group and selectively run entries. When the data package is invoked with
|
|
302
|
-
* --tags, only entries whose tags list includes at least one of the requested tags are
|
|
303
|
-
* processed. Entries with no tags are always skipped when a tag filter is active.
|
|
304
|
-
*/
|
|
305
|
-
tags?: string[];
|
|
306
|
-
/**
|
|
307
|
-
* Post-extract symlink operations. After extraction, for each config the runner
|
|
308
|
-
* resolves all files/directories inside outputDir that match the source glob and
|
|
309
|
-
* creates a corresponding symlink inside the target directory. Stale symlinks
|
|
310
|
-
* (pointing into outputDir but no longer matched) are removed automatically.
|
|
311
|
-
*/
|
|
312
|
-
symlinks?: SymlinkConfig[];
|
|
313
|
-
/**
|
|
314
|
-
* Post-extract content-replacement operations. After extraction, for each config
|
|
315
|
-
* the runner finds workspace files matching the files glob and applies the regex
|
|
316
|
-
* replacement to their contents.
|
|
317
|
-
*/
|
|
318
|
-
contentReplacements?: ContentReplacementConfig[];
|
|
319
|
-
};
|
|
320
|
-
/**
|
|
321
|
-
* Package.json for a publishable project
|
|
322
|
-
*/
|
|
323
|
-
export type PublishablePackageJson = {
|
|
324
|
-
name: string;
|
|
325
|
-
version: string;
|
|
326
|
-
description?: string;
|
|
327
|
-
main?: string;
|
|
328
|
-
bin?: string;
|
|
329
|
-
files?: string[];
|
|
330
|
-
dependencies?: Record<string, string>;
|
|
331
|
-
npmdata?: NpmdataExtractEntry[];
|
|
332
|
-
[key: string]: unknown;
|
|
236
|
+
export type ExecuteResult = {
|
|
237
|
+
/** Paths of newly created files (for rollback purposes). */
|
|
238
|
+
newlyCreated: string[];
|
|
239
|
+
/** Number of files added. */
|
|
240
|
+
added: number;
|
|
241
|
+
/** Number of files modified. */
|
|
242
|
+
modified: number;
|
|
243
|
+
/** Number of files deleted. */
|
|
244
|
+
deleted: number;
|
|
245
|
+
/** Number of files skipped. */
|
|
246
|
+
skipped: number;
|
|
333
247
|
};
|
|
334
248
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAC;IAC3B;;OAEG;IACH,mBAAmB,CAAC,EAAE,wBAAwB,EAAE,CAAC;CAClD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,+DAA+D;IAC/D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,uCAAuC;IACvC,OAAO,CAA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I,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhE;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,2DAA2D;IAC3D,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,4DAA4D;IAC5D,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,eAAe,EAAE,MAAM,CAAC;IACxB,oCAAoC;IACpC,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,4DAA4D;IAC5D,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,gCAAgC;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
package/dist/types.js
CHANGED
|
@@ -1,15 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_FILENAME_PATTERNS = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Default filename patterns applied when no filenamePatterns are specified.
|
|
6
|
-
* Excludes common package metadata files that are not meant to be extracted by consumers.
|
|
7
|
-
*/
|
|
8
|
-
exports.DEFAULT_FILENAME_PATTERNS = [
|
|
9
|
-
'**',
|
|
10
|
-
'!package.json',
|
|
11
|
-
'!bin/**',
|
|
12
|
-
'!README.md',
|
|
13
|
-
'!node_modules/**',
|
|
14
|
-
];
|
|
15
3
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,78 +1,48 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NpmdataExtractEntry, PackageConfig } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Parse a package spec like "my-pkg@^1.2.3" or "@scope/pkg@2.x" into name and version.
|
|
4
|
-
* The version separator is the LAST "@" so that scoped packages ("@scope/name") are handled
|
|
4
|
+
* The version separator is the LAST "@" so that scoped packages ("@scope/name") are handled.
|
|
5
5
|
*/
|
|
6
|
-
export declare function parsePackageSpec(spec: string):
|
|
7
|
-
name: string;
|
|
8
|
-
version: string | undefined;
|
|
9
|
-
};
|
|
6
|
+
export declare function parsePackageSpec(spec: string): PackageConfig;
|
|
10
7
|
/**
|
|
11
|
-
*
|
|
12
|
-
* "relDir/", i.e. lives somewhere inside that directory.
|
|
8
|
+
* Compute the SHA-256 hash of a file.
|
|
13
9
|
*/
|
|
14
|
-
export declare function
|
|
15
|
-
/**
|
|
16
|
-
* Detect whether a file is binary by scanning it for null bytes.
|
|
17
|
-
* Reads up to the first 8 KB only to keep memory usage low.
|
|
18
|
-
*/
|
|
19
|
-
export declare function isBinaryFile(filePath: string): boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Get hash of file contents
|
|
22
|
-
*/
|
|
23
|
-
export declare function calculateFileHash(filePath: string): string;
|
|
10
|
+
export declare function hashFile(filePath: string): Promise<string>;
|
|
24
11
|
/**
|
|
25
12
|
* Compute the SHA-256 hash of an in-memory buffer or string.
|
|
26
|
-
* Used to hash content that has been transformed in memory before
|
|
27
|
-
*/
|
|
28
|
-
export declare function calculateBufferHash(content: Buffer | string): string;
|
|
29
|
-
/**
|
|
30
|
-
* Check if file contents match regex patterns.
|
|
31
|
-
* Binary files (detected via null-byte scan) are always excluded when patterns are set.
|
|
32
|
-
*/
|
|
33
|
-
export declare function matchesContentRegex(filePath: string, patterns?: RegExp[]): boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Recursively find all files in directory matching filters
|
|
13
|
+
* Used to hash content that has been transformed in memory before comparison.
|
|
36
14
|
*/
|
|
37
|
-
export declare function
|
|
38
|
-
export declare const matchesFilenamePattern: (filename: string, patterns?: string[]) => boolean;
|
|
15
|
+
export declare function hashBuffer(content: Buffer | string): string;
|
|
39
16
|
/**
|
|
40
|
-
*
|
|
17
|
+
* Synchronous file hash (SHA-256).
|
|
41
18
|
*/
|
|
42
|
-
export declare function
|
|
19
|
+
export declare function hashFileSync(filePath: string): string;
|
|
43
20
|
/**
|
|
44
|
-
*
|
|
45
|
-
|
|
46
|
-
export declare function removeFile(filePath: string): void;
|
|
47
|
-
/**
|
|
48
|
-
* Copy file preserving directory structure
|
|
49
|
-
*/
|
|
50
|
-
export declare function copyFile(src: string, dest: string): void;
|
|
51
|
-
/**
|
|
52
|
-
* Detect package manager type.
|
|
53
|
-
* Inspects the lock files in the given directory (defaults to process.cwd()).
|
|
21
|
+
* Detect whether a file is binary by scanning it for null bytes.
|
|
22
|
+
* Reads up to the first 8 KB only.
|
|
54
23
|
*/
|
|
55
|
-
export declare function
|
|
24
|
+
export declare function isBinaryFile(filePath: string): boolean;
|
|
56
25
|
/**
|
|
57
|
-
*
|
|
26
|
+
* Detect package manager by inspecting lock files in the given directory.
|
|
27
|
+
* Falls back to npm if no lock file is found.
|
|
58
28
|
*/
|
|
59
|
-
export declare function
|
|
29
|
+
export declare function detectPackageManager(cwd?: string): 'pnpm' | 'npm';
|
|
60
30
|
/**
|
|
61
|
-
*
|
|
31
|
+
* Install a package using the detected package manager.
|
|
32
|
+
* Returns the installed package path under node_modules.
|
|
62
33
|
*/
|
|
63
|
-
export declare function
|
|
34
|
+
export declare function installPackage(name: string, version: string | undefined, upgrade: boolean, cwd?: string): string;
|
|
64
35
|
/**
|
|
65
|
-
*
|
|
36
|
+
* Return the installed package path under cwd/node_modules, or null if not installed.
|
|
66
37
|
*/
|
|
67
|
-
export declare function
|
|
38
|
+
export declare function getInstalledPackagePath(name: string, cwd?: string): string | null;
|
|
68
39
|
/**
|
|
69
|
-
*
|
|
70
|
-
* Supports both the current pipe-delimited format and the legacy comma-delimited format
|
|
71
|
-
* (detected automatically for backward compatibility).
|
|
40
|
+
* Ensure a directory exists, creating it recursively if needed.
|
|
72
41
|
*/
|
|
73
|
-
export declare function
|
|
42
|
+
export declare function ensureDir(dir: string): void;
|
|
74
43
|
/**
|
|
75
|
-
*
|
|
44
|
+
* Filter entries by requested presets.
|
|
45
|
+
* When no presets are requested, all entries pass through.
|
|
76
46
|
*/
|
|
77
|
-
export declare function
|
|
47
|
+
export declare function filterEntriesByPresets(entries: NpmdataExtractEntry[], presets: string[]): NpmdataExtractEntry[];
|
|
78
48
|
//# sourceMappingURL=utils.d.ts.map
|