npmdata 0.11.0 → 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.
Files changed (153) hide show
  1. package/README.md +47 -42
  2. package/dist/cli/actions/check.d.ts +6 -0
  3. package/dist/cli/actions/check.d.ts.map +1 -0
  4. package/dist/cli/actions/check.js +57 -0
  5. package/dist/cli/actions/check.js.map +1 -0
  6. package/dist/cli/actions/extract.d.ts +7 -0
  7. package/dist/cli/actions/extract.d.ts.map +1 -0
  8. package/dist/cli/actions/extract.js +84 -0
  9. package/dist/cli/actions/extract.js.map +1 -0
  10. package/dist/cli/actions/init.d.ts +6 -0
  11. package/dist/cli/actions/init.d.ts.map +1 -0
  12. package/dist/cli/actions/init.js +36 -0
  13. package/dist/cli/actions/init.js.map +1 -0
  14. package/dist/cli/actions/list.d.ts +7 -0
  15. package/dist/cli/actions/list.d.ts.map +1 -0
  16. package/dist/cli/actions/list.js +42 -0
  17. package/dist/cli/actions/list.js.map +1 -0
  18. package/dist/cli/actions/purge.d.ts +6 -0
  19. package/dist/cli/actions/purge.d.ts.map +1 -0
  20. package/dist/cli/actions/purge.js +47 -0
  21. package/dist/cli/actions/purge.js.map +1 -0
  22. package/dist/cli/argv.d.ts +35 -0
  23. package/dist/cli/argv.d.ts.map +1 -0
  24. package/dist/cli/argv.js +125 -0
  25. package/dist/cli/argv.js.map +1 -0
  26. package/dist/cli/cli.d.ts +9 -0
  27. package/dist/cli/cli.d.ts.map +1 -0
  28. package/dist/cli/cli.js +69 -0
  29. package/dist/cli/cli.js.map +1 -0
  30. package/dist/cli/runner.d.ts +9 -0
  31. package/dist/cli/runner.d.ts.map +1 -0
  32. package/dist/cli/runner.js +106 -0
  33. package/dist/cli/runner.js.map +1 -0
  34. package/dist/cli/usage.d.ts +6 -0
  35. package/dist/cli/usage.d.ts.map +1 -0
  36. package/dist/cli/usage.js +126 -0
  37. package/dist/cli/usage.js.map +1 -0
  38. package/dist/fileset/check.d.ts +15 -0
  39. package/dist/fileset/check.d.ts.map +1 -0
  40. package/dist/fileset/check.js +68 -0
  41. package/dist/fileset/check.js.map +1 -0
  42. package/dist/fileset/constants.d.ts +13 -0
  43. package/dist/fileset/constants.d.ts.map +1 -0
  44. package/dist/fileset/constants.js +22 -0
  45. package/dist/fileset/constants.js.map +1 -0
  46. package/dist/fileset/diff.d.ts +16 -0
  47. package/dist/fileset/diff.d.ts.map +1 -0
  48. package/dist/fileset/diff.js +116 -0
  49. package/dist/fileset/diff.js.map +1 -0
  50. package/dist/fileset/execute.d.ts +29 -0
  51. package/dist/fileset/execute.d.ts.map +1 -0
  52. package/dist/fileset/execute.js +136 -0
  53. package/dist/fileset/execute.js.map +1 -0
  54. package/dist/fileset/gitignore.d.ts +16 -0
  55. package/dist/fileset/gitignore.d.ts.map +1 -0
  56. package/dist/fileset/gitignore.js +82 -0
  57. package/dist/fileset/gitignore.js.map +1 -0
  58. package/dist/fileset/index.d.ts +5 -0
  59. package/dist/fileset/index.d.ts.map +1 -0
  60. package/dist/fileset/index.js +21 -0
  61. package/dist/fileset/index.js.map +1 -0
  62. package/dist/fileset/list.d.ts +6 -0
  63. package/dist/fileset/list.d.ts.map +1 -0
  64. package/dist/fileset/list.js +11 -0
  65. package/dist/fileset/list.js.map +1 -0
  66. package/dist/fileset/markers.d.ts +22 -0
  67. package/dist/fileset/markers.d.ts.map +1 -0
  68. package/dist/fileset/markers.js +68 -0
  69. package/dist/fileset/markers.js.map +1 -0
  70. package/dist/fileset/package-files.d.ts +14 -0
  71. package/dist/fileset/package-files.d.ts.map +1 -0
  72. package/dist/fileset/package-files.js +81 -0
  73. package/dist/fileset/package-files.js.map +1 -0
  74. package/dist/fileset/purge.d.ts +12 -0
  75. package/dist/fileset/purge.d.ts.map +1 -0
  76. package/dist/fileset/purge.js +95 -0
  77. package/dist/fileset/purge.js.map +1 -0
  78. package/dist/fileset/test-utils.d.ts +12 -0
  79. package/dist/fileset/test-utils.d.ts.map +1 -0
  80. package/dist/fileset/test-utils.js +65 -0
  81. package/dist/fileset/test-utils.js.map +1 -0
  82. package/dist/index.d.ts +10 -8
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +11 -19
  85. package/dist/index.js.map +1 -1
  86. package/dist/main.js +9 -17
  87. package/dist/main.js.map +1 -1
  88. package/dist/npmdata-0.0.1.tgz +0 -0
  89. package/dist/package/action-check.d.ts +20 -0
  90. package/dist/package/action-check.d.ts.map +1 -0
  91. package/dist/package/action-check.js +61 -0
  92. package/dist/package/action-check.js.map +1 -0
  93. package/dist/package/action-extract.d.ts +21 -0
  94. package/dist/package/action-extract.d.ts.map +1 -0
  95. package/dist/package/action-extract.js +186 -0
  96. package/dist/package/action-extract.js.map +1 -0
  97. package/dist/package/action-init.d.ts +13 -0
  98. package/dist/package/action-init.d.ts.map +1 -0
  99. package/dist/package/action-init.js +77 -0
  100. package/dist/package/action-init.js.map +1 -0
  101. package/dist/package/action-list.d.ts +14 -0
  102. package/dist/package/action-list.d.ts.map +1 -0
  103. package/dist/package/action-list.js +46 -0
  104. package/dist/package/action-list.js.map +1 -0
  105. package/dist/package/action-purge.d.ts +21 -0
  106. package/dist/package/action-purge.d.ts.map +1 -0
  107. package/dist/package/action-purge.js +60 -0
  108. package/dist/package/action-purge.js.map +1 -0
  109. package/dist/package/config-merge.d.ts +18 -0
  110. package/dist/package/config-merge.d.ts.map +1 -0
  111. package/dist/package/config-merge.js +48 -0
  112. package/dist/package/config-merge.js.map +1 -0
  113. package/dist/package/config.d.ts +13 -0
  114. package/dist/package/config.d.ts.map +1 -0
  115. package/dist/package/config.js +29 -0
  116. package/dist/package/config.js.map +1 -0
  117. package/dist/package/content-replacements.d.ts +21 -0
  118. package/dist/package/content-replacements.d.ts.map +1 -0
  119. package/dist/package/content-replacements.js +96 -0
  120. package/dist/package/content-replacements.js.map +1 -0
  121. package/dist/package/index.d.ts +10 -0
  122. package/dist/package/index.d.ts.map +1 -0
  123. package/dist/package/index.js +16 -0
  124. package/dist/package/index.js.map +1 -0
  125. package/dist/package/symlinks.d.ts +17 -0
  126. package/dist/package/symlinks.d.ts.map +1 -0
  127. package/dist/package/symlinks.js +125 -0
  128. package/dist/package/symlinks.js.map +1 -0
  129. package/dist/types.d.ts +181 -277
  130. package/dist/types.d.ts.map +1 -1
  131. package/dist/types.js +0 -12
  132. package/dist/types.js.map +1 -1
  133. package/dist/utils.d.ts +25 -55
  134. package/dist/utils.d.ts.map +1 -1
  135. package/dist/utils.js +82 -181
  136. package/dist/utils.js.map +1 -1
  137. package/package.json +4 -2
  138. package/dist/cli.d.ts +0 -6
  139. package/dist/cli.d.ts.map +0 -1
  140. package/dist/cli.js +0 -570
  141. package/dist/cli.js.map +0 -1
  142. package/dist/consumer.d.ts +0 -74
  143. package/dist/consumer.d.ts.map +0 -1
  144. package/dist/consumer.js +0 -820
  145. package/dist/consumer.js.map +0 -1
  146. package/dist/publisher.d.ts +0 -38
  147. package/dist/publisher.d.ts.map +0 -1
  148. package/dist/publisher.js +0 -164
  149. package/dist/publisher.js.map +0 -1
  150. package/dist/runner.d.ts +0 -117
  151. package/dist/runner.d.ts.map +0 -1
  152. package/dist/runner.js +0 -812
  153. package/dist/runner.js.map +0 -1
package/dist/types.d.ts CHANGED
@@ -1,344 +1,248 @@
1
1
  /**
2
- * Default filename patterns applied when no filenamePatterns are specified.
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 declare const DEFAULT_FILENAME_PATTERNS: string[];
6
- /**
7
- * Configuration for a post-extract symlink operation.
8
- * After files are extracted, matching files/dirs in the output directory are made
9
- * available as symlinks inside the target directory.
10
- */
11
- export type SymlinkConfig = {
12
- /**
13
- * Glob pattern relative to the extraction outputDir. Every file or directory
14
- * whose relative path matches this pattern will be represented by a symlink in
15
- * the target directory.
16
- * Example: "**\/skills\/**" will find every entry under any "skills" directory.
17
- */
18
- source: string;
19
- /**
20
- * Directory where the symlinks will be created, relative to the working
21
- * directory in which the runner is invoked (i.e. the consumer's project root).
22
- * Example: ".github/skills"
23
- */
24
- target: string;
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;
25
9
  };
26
10
  /**
27
- * Configuration for a post-extract content-replacement operation.
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.
11
+ * Controls which files are selected from a package and install behaviour.
30
12
  */
31
- export type ContentReplacementConfig = {
32
- /**
33
- * Glob pattern (relative to the working directory) selecting workspace files
34
- * whose content should be modified.
35
- * Example: "docs/**\/*.md"
36
- */
37
- files: string;
13
+ export type SelectorConfig = {
38
14
  /**
39
- * Regular-expression string used to locate the text to replace inside each
40
- * matched file. All non-overlapping occurrences are replaced (global flag is
41
- * applied automatically).
42
- * Example: "<!-- version: .* -->"
15
+ * Glob patterns; files must match at least one.
16
+ * Default: DEFAULT_FILENAME_PATTERNS (excludes package.json, bin/**, README.md, node_modules/**)
43
17
  */
44
- match: string;
18
+ files?: string[];
45
19
  /**
46
- * Replacement string (may contain regex back-references such as "$1").
47
- * Example: "<!-- version: 1.2.3 -->"
20
+ * Regex strings; files must match at least one. Binary files always skip regex check.
48
21
  */
49
- replace: string;
50
- };
51
- /**
52
- * Configuration for filtering which files to include/exclude
53
- */
54
- export type FileFilterConfig = {
22
+ contentRegexes?: string[];
55
23
  /**
56
- * Glob patterns to match filenames (e.g., "*.md", "src/**\/*.ts")
24
+ * Tags this entry for --presets CLI filtering. Not forwarded to dependency packages.
57
25
  */
58
- filenamePatterns?: string[];
26
+ presets?: string[];
59
27
  /**
60
- * Regex patterns to match file contents (files must contain at least one match)
28
+ * Force fresh package install even if a satisfying version is installed.
61
29
  */
62
- contentRegexes?: RegExp[];
63
- };
64
- /**
65
- * Event emitted by extract() as files are processed.
66
- */
67
- export type ProgressEvent = {
68
- type: 'package-start';
69
- packageName: string;
70
- packageVersion: string;
71
- } | {
72
- type: 'package-end';
73
- packageName: string;
74
- packageVersion: string;
75
- } | {
76
- type: 'file-added';
77
- packageName: string;
78
- file: string;
79
- } | {
80
- type: 'file-modified';
81
- packageName: string;
82
- file: string;
83
- } | {
84
- type: 'file-deleted';
85
- packageName: string;
86
- file: string;
87
- } | {
88
- type: 'file-skipped';
89
- packageName: string;
90
- file: string;
30
+ upgrade?: boolean;
91
31
  };
92
32
  /**
93
- * Configuration for the consumer
33
+ * Controls where and how extracted files are written.
94
34
  */
95
- export type ConsumerConfig = FileFilterConfig & {
96
- /**
97
- * Package specs to install from registry. Each entry is either a bare package name
98
- * ("my-pkg") or a name with a semver constraint ("my-pkg@^1.2.3"). Multiple packages
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;
35
+ export type OutputConfig = {
106
36
  /**
107
- * Package manager type (auto-detect if not specified)
37
+ * Output directory relative to cwd. Concatenated across recursion levels.
108
38
  */
109
- packageManager?: 'pnpm' | 'yarn' | 'npm';
39
+ path: string;
110
40
  /**
111
- * Allow creating conflicting files (default: false, will error)
41
+ * Overwrite existing unmanaged files. Overridden by --force and --keep-existing.
112
42
  */
113
43
  force?: boolean;
114
44
  /**
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.
45
+ * Skip files that already exist; create missing ones. Cannot combine with force.
117
46
  */
118
47
  keepExisting?: boolean;
119
48
  /**
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.
49
+ * Create/update .gitignore alongside each .npmdata marker.
128
50
  */
129
51
  gitignore?: boolean;
130
52
  /**
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.
53
+ * Write without .npmdata marker, no gitignore update, no read-only. Existing files skipped.
54
+ * Takes precedence over force.
136
55
  */
137
56
  unmanaged?: boolean;
138
57
  /**
139
- * When true, simulate extraction without writing anything to disk.
140
- * The returned ConsumerResult reflects what would have changed.
58
+ * Report what would change; no disk writes.
141
59
  */
142
60
  dryRun?: boolean;
143
61
  /**
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.
62
+ * Post-extract symlink operations. Appended across recursion levels.
151
63
  */
152
- onProgress?: (event: ProgressEvent) => void;
64
+ symlinks?: SymlinkConfig[];
153
65
  /**
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.
66
+ * Post-extract content replacements. Appended across recursion levels.
158
67
  */
159
68
  contentReplacements?: ContentReplacementConfig[];
160
69
  };
161
70
  /**
162
- * Metadata about managed files
71
+ * Controls runtime output verbosity.
163
72
  */
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;
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;
181
78
  };
182
79
  /**
183
- * Result of a consumer operation
80
+ * Defines one post-extract symlink operation.
184
81
  */
185
- export type ConsumerResult = {
186
- added: string[];
187
- modified: string[];
188
- deleted: string[];
189
- skipped: string[];
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
- }>;
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;
200
87
  };
201
88
  /**
202
- * Result of a check operation
89
+ * Defines one post-extract content replacement operation.
203
90
  */
204
- export type CheckResult = {
205
- /**
206
- * Whether all files are in sync
207
- */
208
- ok: boolean;
209
- /**
210
- * Aggregated files that differ from source (across all packages)
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
- }>;
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). */
97
+ replace: string;
239
98
  };
240
99
  /**
241
- * A single extraction entry defined in the publishable package.json "npmdata" array.
242
- * The runner iterates over these entries and calls extract() for each one.
100
+ * One entry in the npmdata.sets array. Represents a single extraction target.
243
101
  */
244
102
  export type NpmdataExtractEntry = {
245
- /**
246
- * Package spec to install and extract from. Either a bare name ("my-pkg") or a
247
- * name with a semver constraint ("my-pkg@^1.2.3").
248
- */
103
+ /** Flat package spec string ("my-pkg@^1.2.3"). Parsed to PackageConfig internally. */
249
104
  package: string;
105
+ /** Where/how to write files. */
106
+ output: OutputConfig;
107
+ /** Which files to select and install options. */
108
+ selector?: SelectorConfig;
250
109
  /**
251
- * Output directory where files will be extracted, relative to where the consumer
252
- * runs the command (e.g. "./data" or "src/generated").
253
- */
254
- outputDir: string;
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).
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.
289
113
  */
114
+ presets?: string[];
115
+ /** Suppress per-file output. Root-level (not nested). */
290
116
  silent?: boolean;
291
- /**
292
- * Print detailed progress information for each file and step processed (default: false).
293
- */
117
+ /** Print detailed step information. Root-level (not nested). */
294
118
  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
119
  };
320
120
  /**
321
- * Top-level config structure stored under the "npmdata" key in package.json
322
- * or in a .npmdatarc file.
121
+ * Top-level structure stored under npmdata key in package.json or in any cosmiconfig source.
323
122
  */
324
123
  export type NpmdataConfig = {
124
+ /** All extraction entries. */
125
+ sets: NpmdataExtractEntry[];
325
126
  /**
326
- * The list of extraction entries to process.
127
+ * Shell command run after successful extract (not during --dry-run).
128
+ * Executed in process.cwd(). Full argv appended as arguments.
327
129
  */
328
- sets: NpmdataExtractEntry[];
130
+ postExtractScript?: string;
329
131
  };
330
132
  /**
331
- * Package.json for a publishable project
133
+ * A single file operation in the diff/execute pipeline.
332
134
  */
333
- export type PublishablePackageJson = {
334
- name: string;
335
- version: string;
336
- description?: string;
337
- main?: string;
338
- bin?: string;
339
- files?: string[];
340
- dependencies?: Record<string, string>;
341
- npmdata?: NpmdataConfig;
342
- [key: string]: unknown;
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[];
170
+ };
171
+ /**
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.
185
+ */
186
+ export type ProgressEvent = {
187
+ type: 'package-start';
188
+ packageName: string;
189
+ packageVersion: string;
190
+ } | {
191
+ type: 'package-end';
192
+ packageName: string;
193
+ packageVersion: string;
194
+ } | {
195
+ type: 'file-added';
196
+ packageName: string;
197
+ file: string;
198
+ } | {
199
+ type: 'file-modified';
200
+ packageName: string;
201
+ file: string;
202
+ } | {
203
+ type: 'file-deleted';
204
+ packageName: string;
205
+ file: string;
206
+ } | {
207
+ type: 'file-skipped';
208
+ packageName: string;
209
+ file: string;
210
+ };
211
+ /**
212
+ * Result of a check operation for a single fileset.
213
+ */
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. */
218
+ modified: string[];
219
+ /** Files in filtered package source but never extracted. */
220
+ extra: string[];
221
+ };
222
+ /**
223
+ * Result of purging one fileset.
224
+ */
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;
232
+ };
233
+ /**
234
+ * Result of executing an ExtractionMap.
235
+ */
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;
343
247
  };
344
248
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,yBAAyB,UAMrC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE5B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,GACtE;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,GACpE;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACzD;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,WAAW,EAAE,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E,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":";;;AAAA;;;GAGG;AACU,QAAA,yBAAyB,GAAG;IACvC,IAAI;IACJ,eAAe;IACf,SAAS;IACT,YAAY;IACZ,kBAAkB;CACnB,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}