filedist 0.21.2

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 (154) hide show
  1. package/README.md +631 -0
  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 +36 -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 +60 -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 +30 -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 +30 -0
  17. package/dist/cli/actions/list.js.map +1 -0
  18. package/dist/cli/actions/presets.d.ts +7 -0
  19. package/dist/cli/actions/presets.d.ts.map +1 -0
  20. package/dist/cli/actions/presets.js +34 -0
  21. package/dist/cli/actions/presets.js.map +1 -0
  22. package/dist/cli/actions/purge.d.ts +6 -0
  23. package/dist/cli/actions/purge.d.ts.map +1 -0
  24. package/dist/cli/actions/purge.js +39 -0
  25. package/dist/cli/actions/purge.js.map +1 -0
  26. package/dist/cli/argv.d.ts +52 -0
  27. package/dist/cli/argv.d.ts.map +1 -0
  28. package/dist/cli/argv.js +172 -0
  29. package/dist/cli/argv.js.map +1 -0
  30. package/dist/cli/bin.d.ts +3 -0
  31. package/dist/cli/bin.d.ts.map +1 -0
  32. package/dist/cli/bin.js +10 -0
  33. package/dist/cli/bin.js.map +1 -0
  34. package/dist/cli/binpkg.d.ts +13 -0
  35. package/dist/cli/binpkg.d.ts.map +1 -0
  36. package/dist/cli/binpkg.js +38 -0
  37. package/dist/cli/binpkg.js.map +1 -0
  38. package/dist/cli/cli.d.ts +11 -0
  39. package/dist/cli/cli.d.ts.map +1 -0
  40. package/dist/cli/cli.js +118 -0
  41. package/dist/cli/cli.js.map +1 -0
  42. package/dist/cli/progress.d.ts +6 -0
  43. package/dist/cli/progress.d.ts.map +1 -0
  44. package/dist/cli/progress.js +12 -0
  45. package/dist/cli/progress.js.map +1 -0
  46. package/dist/cli/usage.d.ts +6 -0
  47. package/dist/cli/usage.d.ts.map +1 -0
  48. package/dist/cli/usage.js +151 -0
  49. package/dist/cli/usage.js.map +1 -0
  50. package/dist/fileset/check.d.ts +15 -0
  51. package/dist/fileset/check.d.ts.map +1 -0
  52. package/dist/fileset/check.js +70 -0
  53. package/dist/fileset/check.js.map +1 -0
  54. package/dist/fileset/constants.d.ts +18 -0
  55. package/dist/fileset/constants.d.ts.map +1 -0
  56. package/dist/fileset/constants.js +30 -0
  57. package/dist/fileset/constants.js.map +1 -0
  58. package/dist/fileset/diff.d.ts +16 -0
  59. package/dist/fileset/diff.d.ts.map +1 -0
  60. package/dist/fileset/diff.js +111 -0
  61. package/dist/fileset/diff.js.map +1 -0
  62. package/dist/fileset/execute.d.ts +29 -0
  63. package/dist/fileset/execute.d.ts.map +1 -0
  64. package/dist/fileset/execute.js +153 -0
  65. package/dist/fileset/execute.js.map +1 -0
  66. package/dist/fileset/gitignore.d.ts +20 -0
  67. package/dist/fileset/gitignore.d.ts.map +1 -0
  68. package/dist/fileset/gitignore.js +94 -0
  69. package/dist/fileset/gitignore.js.map +1 -0
  70. package/dist/fileset/index.d.ts +5 -0
  71. package/dist/fileset/index.d.ts.map +1 -0
  72. package/dist/fileset/index.js +22 -0
  73. package/dist/fileset/index.js.map +1 -0
  74. package/dist/fileset/markers.d.ts +22 -0
  75. package/dist/fileset/markers.d.ts.map +1 -0
  76. package/dist/fileset/markers.js +74 -0
  77. package/dist/fileset/markers.js.map +1 -0
  78. package/dist/fileset/package-files.d.ts +21 -0
  79. package/dist/fileset/package-files.d.ts.map +1 -0
  80. package/dist/fileset/package-files.js +102 -0
  81. package/dist/fileset/package-files.js.map +1 -0
  82. package/dist/fileset/purge.d.ts +18 -0
  83. package/dist/fileset/purge.d.ts.map +1 -0
  84. package/dist/fileset/purge.js +94 -0
  85. package/dist/fileset/purge.js.map +1 -0
  86. package/dist/fileset/test-utils.d.ts +21 -0
  87. package/dist/fileset/test-utils.d.ts.map +1 -0
  88. package/dist/fileset/test-utils.js +94 -0
  89. package/dist/fileset/test-utils.js.map +1 -0
  90. package/dist/index.d.ts +14 -0
  91. package/dist/index.d.ts.map +1 -0
  92. package/dist/index.js +19 -0
  93. package/dist/index.js.map +1 -0
  94. package/dist/package/action-check.d.ts +20 -0
  95. package/dist/package/action-check.d.ts.map +1 -0
  96. package/dist/package/action-check.js +65 -0
  97. package/dist/package/action-check.js.map +1 -0
  98. package/dist/package/action-extract.d.ts +20 -0
  99. package/dist/package/action-extract.d.ts.map +1 -0
  100. package/dist/package/action-extract.js +280 -0
  101. package/dist/package/action-extract.js.map +1 -0
  102. package/dist/package/action-init.d.ts +13 -0
  103. package/dist/package/action-init.d.ts.map +1 -0
  104. package/dist/package/action-init.js +83 -0
  105. package/dist/package/action-init.js.map +1 -0
  106. package/dist/package/action-list.d.ts +11 -0
  107. package/dist/package/action-list.d.ts.map +1 -0
  108. package/dist/package/action-list.js +12 -0
  109. package/dist/package/action-list.js.map +1 -0
  110. package/dist/package/action-purge.d.ts +19 -0
  111. package/dist/package/action-purge.d.ts.map +1 -0
  112. package/dist/package/action-purge.js +135 -0
  113. package/dist/package/action-purge.js.map +1 -0
  114. package/dist/package/calculate-diff.d.ts +12 -0
  115. package/dist/package/calculate-diff.d.ts.map +1 -0
  116. package/dist/package/calculate-diff.js +129 -0
  117. package/dist/package/calculate-diff.js.map +1 -0
  118. package/dist/package/config-merge.d.ts +19 -0
  119. package/dist/package/config-merge.d.ts.map +1 -0
  120. package/dist/package/config-merge.js +65 -0
  121. package/dist/package/config-merge.js.map +1 -0
  122. package/dist/package/config.d.ts +24 -0
  123. package/dist/package/config.d.ts.map +1 -0
  124. package/dist/package/config.js +86 -0
  125. package/dist/package/config.js.map +1 -0
  126. package/dist/package/content-replacements.d.ts +21 -0
  127. package/dist/package/content-replacements.d.ts.map +1 -0
  128. package/dist/package/content-replacements.js +94 -0
  129. package/dist/package/content-replacements.js.map +1 -0
  130. package/dist/package/index.d.ts +10 -0
  131. package/dist/package/index.d.ts.map +1 -0
  132. package/dist/package/index.js +16 -0
  133. package/dist/package/index.js.map +1 -0
  134. package/dist/package/resolve-files.d.ts +29 -0
  135. package/dist/package/resolve-files.d.ts.map +1 -0
  136. package/dist/package/resolve-files.js +225 -0
  137. package/dist/package/resolve-files.js.map +1 -0
  138. package/dist/package/source.d.ts +20 -0
  139. package/dist/package/source.d.ts.map +1 -0
  140. package/dist/package/source.js +193 -0
  141. package/dist/package/source.js.map +1 -0
  142. package/dist/package/symlinks.d.ts +25 -0
  143. package/dist/package/symlinks.d.ts.map +1 -0
  144. package/dist/package/symlinks.js +203 -0
  145. package/dist/package/symlinks.js.map +1 -0
  146. package/dist/types.d.ts +345 -0
  147. package/dist/types.d.ts.map +1 -0
  148. package/dist/types.js +3 -0
  149. package/dist/types.js.map +1 -0
  150. package/dist/utils.d.ts +60 -0
  151. package/dist/utils.d.ts.map +1 -0
  152. package/dist/utils.js +341 -0
  153. package/dist/utils.js.map +1 -0
  154. package/package.json +58 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/fileset/execute.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,aAAa,EACb,YAAY,EACZ,aAAa,EACb,aAAa,EACb,mBAAmB,EACpB,MAAM,UAAU,CAAC;AAOlB;;;;;;;;;;;;;;;;GAgBG;AAEH,wBAAsB,OAAO,CAC3B,GAAG,EAAE,aAAa,EAClB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,YAAY,EAC1B,GAAG,EAAE,aAAa,EAClB,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,mBAAmB,EAAE,EAErC,IAAI,CAAC,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,OAAO,GAChB,OAAO,CAAC,aAAa,CAAC,CAgHxB;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBvF;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAEpE"}
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.execute = execute;
7
+ exports.deleteFiles = deleteFiles;
8
+ exports.rollback = rollback;
9
+ /* eslint-disable no-console */
10
+ const node_fs_1 = __importDefault(require("node:fs"));
11
+ const node_path_1 = __importDefault(require("node:path"));
12
+ const utils_1 = require("../utils");
13
+ const content_replacements_1 = require("../package/content-replacements");
14
+ const markers_1 = require("./markers");
15
+ const gitignore_1 = require("./gitignore");
16
+ /**
17
+ * Apply an ExtractionMap to disk:
18
+ * - Copy toAdd and toModify files from source to dest
19
+ * - Make managed files read-only (unless unmanaged mode)
20
+ * - Delete toDelete files
21
+ * - Update .filedist marker file (unless dryRun or unmanaged)
22
+ * - Update .gitignore (unless dryRun, unmanaged, or gitignore=false)
23
+ *
24
+ * @param map The ExtractionMap produced by diff().
25
+ * @param outputDir Absolute path to the output directory.
26
+ * @param outputConfig OutputConfig controlling write behaviour.
27
+ * @param pkg PackageConfig for marker metadata.
28
+ * @param pkgVersion Installed package version for marker metadata.
29
+ * @param existingMarker Existing managed file entries (for incremental update).
30
+ * @param cwd Working directory (kept for API compatibility).
31
+ * @returns ExecuteResult with counts and list of newly created files for rollback.
32
+ */
33
+ // eslint-disable-next-line complexity
34
+ async function execute(map, outputDir, outputConfig, pkg, pkgVersion, existingMarker, _cwd, verbose) {
35
+ const dryRun = outputConfig.dryRun ?? false;
36
+ const unmanaged = outputConfig.managed === false;
37
+ const updateGitignore = outputConfig.gitignore !== false;
38
+ const displayBaseDir = _cwd ?? process.cwd();
39
+ const result = {
40
+ newlyCreated: [],
41
+ added: 0,
42
+ modified: 0,
43
+ deleted: 0,
44
+ skipped: map.toSkip.length,
45
+ };
46
+ // Write toAdd files
47
+ for (const op of map.toAdd) {
48
+ if (verbose) {
49
+ console.log(`[verbose] execute: adding file ${(0, utils_1.formatDisplayPath)(op.destPath, displayBaseDir)}`);
50
+ }
51
+ if (!dryRun) {
52
+ (0, utils_1.ensureDir)(node_path_1.default.dirname(op.destPath));
53
+ // Make writable if it exists (should be rare for toAdd, but defensive)
54
+ if (node_fs_1.default.existsSync(op.destPath)) {
55
+ node_fs_1.default.chmodSync(op.destPath, 0o644);
56
+ }
57
+ node_fs_1.default.copyFileSync(op.sourcePath, op.destPath);
58
+ if (!unmanaged) {
59
+ node_fs_1.default.chmodSync(op.destPath, 0o444); // read-only
60
+ }
61
+ result.newlyCreated.push(op.destPath);
62
+ }
63
+ result.added += 1;
64
+ }
65
+ // Write toModify files
66
+ for (const op of map.toModify) {
67
+ if (verbose) {
68
+ console.log(`[verbose] execute: modifying file ${(0, utils_1.formatDisplayPath)(op.destPath, displayBaseDir)}`);
69
+ }
70
+ if (!dryRun) {
71
+ (0, utils_1.ensureDir)(node_path_1.default.dirname(op.destPath));
72
+ if (node_fs_1.default.existsSync(op.destPath)) {
73
+ node_fs_1.default.chmodSync(op.destPath, 0o644); // make writable before overwriting
74
+ }
75
+ node_fs_1.default.copyFileSync(op.sourcePath, op.destPath);
76
+ if (!unmanaged) {
77
+ node_fs_1.default.chmodSync(op.destPath, 0o444); // read-only
78
+ }
79
+ }
80
+ result.modified += 1;
81
+ }
82
+ // Deletions are deferred: action-extract performs them after all filesets are
83
+ // processed and counts them independently via deferredDeletes.length.
84
+ // ExecuteResult.deleted is intentionally left at 0 here to avoid double-counting.
85
+ // result.deleted = 0; (already initialised to 0 above)
86
+ // Update marker and gitignore
87
+ if (!dryRun && !unmanaged) {
88
+ const marker = (0, markers_1.markerPath)(outputDir);
89
+ // Add newly extracted files to marker
90
+ const addedPaths = new Set([
91
+ ...map.toAdd.map((op) => op.relPath),
92
+ ...map.toModify.map((op) => op.relPath),
93
+ ]);
94
+ // Remove deleted paths, add/update new paths
95
+ const updatedEntries = existingMarker.filter((m) => !map.toDelete.includes(m.path) && !addedPaths.has(m.path));
96
+ for (const op of [...map.toAdd, ...map.toModify]) {
97
+ updatedEntries.push({
98
+ path: op.relPath,
99
+ packageName: pkg.name,
100
+ packageVersion: pkgVersion,
101
+ });
102
+ }
103
+ if (verbose) {
104
+ console.log(`[verbose] execute: writing marker file at ${(0, utils_1.formatDisplayPath)(marker, displayBaseDir)} (${updatedEntries.length} entries)`);
105
+ }
106
+ await (0, markers_1.writeMarker)(marker, updatedEntries);
107
+ if (updateGitignore) {
108
+ const managedPaths = updatedEntries.map((m) => m.path);
109
+ if (verbose) {
110
+ console.log(`[verbose] execute: updating .gitignore at ${(0, utils_1.formatDisplayPath)(outputDir, displayBaseDir)} (${managedPaths.length} paths)`);
111
+ }
112
+ await (0, gitignore_1.addToGitignore)(outputDir, managedPaths);
113
+ }
114
+ }
115
+ // Apply content replacements
116
+ if (!dryRun && outputConfig.contentReplacements && outputConfig.contentReplacements.length > 0) {
117
+ if (verbose) {
118
+ console.log(`[verbose] execute: applying ${outputConfig.contentReplacements.length} content replacement(s) in ${(0, utils_1.formatDisplayPath)(outputDir, displayBaseDir)}`);
119
+ }
120
+ await (0, content_replacements_1.applyContentReplacements)(outputDir, outputConfig.contentReplacements);
121
+ }
122
+ return result;
123
+ }
124
+ /**
125
+ * Delete a list of files from disk and make them writable first.
126
+ * Used for deferred deletions after all filesets have been processed.
127
+ */
128
+ async function deleteFiles(filePaths, verbose) {
129
+ for (const filePath of filePaths) {
130
+ if (!node_fs_1.default.existsSync(filePath))
131
+ continue;
132
+ if (verbose) {
133
+ console.log(`[verbose] execute: deleting file ${(0, utils_1.formatDisplayPath)(filePath)}`);
134
+ }
135
+ try {
136
+ node_fs_1.default.chmodSync(filePath, 0o644);
137
+ node_fs_1.default.unlinkSync(filePath);
138
+ }
139
+ catch (error) {
140
+ // Ignore errors for files that could not be deleted
141
+ if (verbose) {
142
+ console.error(`[verbose] execute: failed to delete ${(0, utils_1.formatDisplayPath)(filePath)}: ${error}`);
143
+ }
144
+ }
145
+ }
146
+ }
147
+ /**
148
+ * Rollback: delete newly created files (those that did not exist before this run).
149
+ */
150
+ async function rollback(newlyCreated) {
151
+ await deleteFiles(newlyCreated);
152
+ }
153
+ //# sourceMappingURL=execute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../src/fileset/execute.ts"],"names":[],"mappings":";;;;;AAmCA,0BA0HC;AAMD,kCAkBC;AAKD,4BAEC;AA5LD,+BAA+B;AAC/B,sDAAyB;AACzB,0DAA6B;AAS7B,oCAAwD;AACxD,0EAA2E;AAE3E,uCAAoD;AACpD,2CAA6C;AAE7C;;;;;;;;;;;;;;;;GAgBG;AACH,sCAAsC;AAC/B,KAAK,UAAU,OAAO,CAC3B,GAAkB,EAClB,SAAiB,EACjB,YAA0B,EAC1B,GAAkB,EAClB,UAAkB,EAClB,cAAqC,EAErC,IAAa,EACb,OAAiB;IAEjB,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,IAAI,KAAK,CAAC;IAC5C,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,KAAK,KAAK,CAAC;IACjD,MAAM,eAAe,GAAG,YAAY,CAAC,SAAS,KAAK,KAAK,CAAC;IACzD,MAAM,cAAc,GAAG,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAE7C,MAAM,MAAM,GAAkB;QAC5B,YAAY,EAAE,EAAE;QAChB,KAAK,EAAE,CAAC;QACR,QAAQ,EAAE,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,CAAC;QACD,MAAM,IAAA,+CAAwB,EAAC,SAAS,EAAE,YAAY,CAAC,mBAAmB,CAAC,CAAC;IAC9E,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,WAAW,CAAC,SAAmB,EAAE,OAAiB;IACtE,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,IAAI,CAAC,iBAAE,CAAC,UAAU,CAAC,QAAQ,CAAC;YAAE,SAAS;QACvC,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,GAAG,CAAC,oCAAoC,IAAA,yBAAiB,EAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACjF,CAAC;QACD,IAAI,CAAC;YACH,iBAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;YAC9B,iBAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC1B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,oDAAoD;YACpD,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO,CAAC,KAAK,CACX,uCAAuC,IAAA,yBAAiB,EAAC,QAAQ,CAAC,KAAK,KAAK,EAAE,CAC/E,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,QAAQ,CAAC,YAAsB;IACnD,MAAM,WAAW,CAAC,YAAY,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Add paths to the filedist-managed section in .gitignore.
3
+ * Creates the file if it does not exist.
4
+ * Always includes the MARKER_FILE itself in the managed section.
5
+ */
6
+ export declare function addToGitignore(markerDir: string, paths: string[]): Promise<void>;
7
+ /**
8
+ * Read the paths currently listed in the filedist-managed section.
9
+ */
10
+ export declare function readManagedGitignoreEntries(markerDir: string): Set<string>;
11
+ /**
12
+ * Remove specific paths from the filedist-managed section in .gitignore.
13
+ * Removes the entire section if no paths remain. Deletes the file if empty.
14
+ */
15
+ export declare function removeFromGitignore(markerDir: string, paths: string[]): Promise<void>;
16
+ /**
17
+ * Replace the entire filedist-managed gitignore section with a new set of paths.
18
+ */
19
+ export declare function updateGitignoreSection(markerDir: string, managedPaths: string[], createIfMissing: boolean): void;
20
+ //# sourceMappingURL=gitignore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitignore.d.ts","sourceRoot":"","sources":["../../src/fileset/gitignore.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAEtF;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAO1E;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAY3F;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EAAE,EACtB,eAAe,EAAE,OAAO,GACvB,IAAI,CAaN"}
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.addToGitignore = addToGitignore;
7
+ exports.readManagedGitignoreEntries = readManagedGitignoreEntries;
8
+ exports.removeFromGitignore = removeFromGitignore;
9
+ exports.updateGitignoreSection = updateGitignoreSection;
10
+ const node_fs_1 = __importDefault(require("node:fs"));
11
+ const node_path_1 = __importDefault(require("node:path"));
12
+ const constants_1 = require("./constants");
13
+ /**
14
+ * Add paths to the filedist-managed section in .gitignore.
15
+ * Creates the file if it does not exist.
16
+ * Always includes the MARKER_FILE itself in the managed section.
17
+ */
18
+ async function addToGitignore(markerDir, paths) {
19
+ updateGitignoreSection(markerDir, paths, true);
20
+ }
21
+ /**
22
+ * Read the paths currently listed in the filedist-managed section.
23
+ */
24
+ function readManagedGitignoreEntries(markerDir) {
25
+ const gitignorePath = node_path_1.default.join(markerDir, constants_1.GITIGNORE_FILE);
26
+ if (!node_fs_1.default.existsSync(gitignorePath))
27
+ return new Set();
28
+ const existingContent = node_fs_1.default.readFileSync(gitignorePath, 'utf8');
29
+ const { managedEntries } = parseSections(existingContent);
30
+ return new Set(managedEntries);
31
+ }
32
+ /**
33
+ * Remove specific paths from the filedist-managed section in .gitignore.
34
+ * Removes the entire section if no paths remain. Deletes the file if empty.
35
+ */
36
+ async function removeFromGitignore(markerDir, paths) {
37
+ const gitignorePath = node_path_1.default.join(markerDir, constants_1.GITIGNORE_FILE);
38
+ if (!node_fs_1.default.existsSync(gitignorePath))
39
+ return;
40
+ const existingContent = node_fs_1.default.readFileSync(gitignorePath, 'utf8');
41
+ const { beforeSection, managedEntries, afterSection } = parseSections(existingContent);
42
+ // Remove specified paths from the managed section
43
+ const pathSet = new Set(paths);
44
+ const remaining = managedEntries.filter((e) => !pathSet.has(e) && e !== constants_1.MARKER_FILE);
45
+ writeGitignore(gitignorePath, beforeSection, remaining, afterSection);
46
+ }
47
+ /**
48
+ * Replace the entire filedist-managed gitignore section with a new set of paths.
49
+ */
50
+ function updateGitignoreSection(markerDir, managedPaths, createIfMissing) {
51
+ const gitignorePath = node_path_1.default.join(markerDir, constants_1.GITIGNORE_FILE);
52
+ let existingContent = '';
53
+ if (node_fs_1.default.existsSync(gitignorePath)) {
54
+ existingContent = node_fs_1.default.readFileSync(gitignorePath, 'utf8');
55
+ }
56
+ const { beforeSection, afterSection, hasSection } = parseSections(existingContent);
57
+ if (!createIfMissing && !hasSection)
58
+ return;
59
+ writeGitignore(gitignorePath, beforeSection, managedPaths, afterSection);
60
+ }
61
+ function parseSections(content) {
62
+ const startIdx = content.indexOf(constants_1.GITIGNORE_START);
63
+ const endIdx = content.indexOf(constants_1.GITIGNORE_END);
64
+ const hasSection = startIdx !== -1 && endIdx !== -1 && startIdx < endIdx;
65
+ if (!hasSection) {
66
+ return { beforeSection: content, managedEntries: [], afterSection: '', hasSection: false };
67
+ }
68
+ const beforeSection = content.slice(0, startIdx).trimEnd();
69
+ const sectionContent = content.slice(startIdx + constants_1.GITIGNORE_START.length, endIdx);
70
+ const managedEntries = sectionContent
71
+ .split('\n')
72
+ .map((l) => l.trim())
73
+ .filter((l) => l.length > 0 && l !== constants_1.MARKER_FILE);
74
+ const afterSection = content.slice(endIdx + constants_1.GITIGNORE_END.length).trimStart();
75
+ return { beforeSection, managedEntries, afterSection, hasSection: true };
76
+ }
77
+ function writeGitignore(gitignorePath, beforeSection, managedPaths, afterSection) {
78
+ if (managedPaths.length === 0) {
79
+ // Remove the managed section entirely
80
+ const updatedContent = [beforeSection, afterSection].filter(Boolean).join('\n');
81
+ if (updatedContent.trim()) {
82
+ node_fs_1.default.writeFileSync(gitignorePath, `${updatedContent.trimEnd()}\n`, 'utf8');
83
+ }
84
+ else if (node_fs_1.default.existsSync(gitignorePath)) {
85
+ node_fs_1.default.unlinkSync(gitignorePath);
86
+ }
87
+ return;
88
+ }
89
+ const section = [constants_1.GITIGNORE_START, constants_1.MARKER_FILE, ...managedPaths.sort(), constants_1.GITIGNORE_END].join('\n');
90
+ const parts = [beforeSection, section, afterSection].filter(Boolean);
91
+ const updatedContent = `${parts.join('\n')}\n`;
92
+ node_fs_1.default.writeFileSync(gitignorePath, updatedContent, 'utf8');
93
+ }
94
+ //# sourceMappingURL=gitignore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitignore.js","sourceRoot":"","sources":["../../src/fileset/gitignore.ts"],"names":[],"mappings":";;;;;AAUA,wCAEC;AAKD,kEAOC;AAMD,kDAYC;AAKD,wDAiBC;AAhED,sDAAyB;AACzB,0DAA6B;AAE7B,2CAA0F;AAE1F;;;;GAIG;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AO,EAAE,YAAY,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACrE,MAAM,cAAc,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IAC/C,iBAAE,CAAC,aAAa,CAAC,aAAa,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { readMarker, writeMarker, markerPath, readOutputDirMarker } from './markers';
2
+ export { addToGitignore, removeFromGitignore, updateGitignoreSection } from './gitignore';
3
+ export { installedPackagePath, enumeratePackageFiles } from './package-files';
4
+ export { MARKER_FILE, DEFAULT_FILE_PATTERNS, DEFAULT_EXCLUDE_PATTERNS, GITIGNORE_FILE, } from './constants';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fileset/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,wBAAwB,EACxB,cAAc,GACf,MAAM,aAAa,CAAC"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GITIGNORE_FILE = exports.DEFAULT_EXCLUDE_PATTERNS = exports.DEFAULT_FILE_PATTERNS = exports.MARKER_FILE = exports.enumeratePackageFiles = exports.installedPackagePath = exports.updateGitignoreSection = exports.removeFromGitignore = exports.addToGitignore = exports.readOutputDirMarker = exports.markerPath = exports.writeMarker = exports.readMarker = void 0;
4
+ // Public fileset-layer API
5
+ var markers_1 = require("./markers");
6
+ Object.defineProperty(exports, "readMarker", { enumerable: true, get: function () { return markers_1.readMarker; } });
7
+ Object.defineProperty(exports, "writeMarker", { enumerable: true, get: function () { return markers_1.writeMarker; } });
8
+ Object.defineProperty(exports, "markerPath", { enumerable: true, get: function () { return markers_1.markerPath; } });
9
+ Object.defineProperty(exports, "readOutputDirMarker", { enumerable: true, get: function () { return markers_1.readOutputDirMarker; } });
10
+ var gitignore_1 = require("./gitignore");
11
+ Object.defineProperty(exports, "addToGitignore", { enumerable: true, get: function () { return gitignore_1.addToGitignore; } });
12
+ Object.defineProperty(exports, "removeFromGitignore", { enumerable: true, get: function () { return gitignore_1.removeFromGitignore; } });
13
+ Object.defineProperty(exports, "updateGitignoreSection", { enumerable: true, get: function () { return gitignore_1.updateGitignoreSection; } });
14
+ var package_files_1 = require("./package-files");
15
+ Object.defineProperty(exports, "installedPackagePath", { enumerable: true, get: function () { return package_files_1.installedPackagePath; } });
16
+ Object.defineProperty(exports, "enumeratePackageFiles", { enumerable: true, get: function () { return package_files_1.enumeratePackageFiles; } });
17
+ var constants_1 = require("./constants");
18
+ Object.defineProperty(exports, "MARKER_FILE", { enumerable: true, get: function () { return constants_1.MARKER_FILE; } });
19
+ Object.defineProperty(exports, "DEFAULT_FILE_PATTERNS", { enumerable: true, get: function () { return constants_1.DEFAULT_FILE_PATTERNS; } });
20
+ Object.defineProperty(exports, "DEFAULT_EXCLUDE_PATTERNS", { enumerable: true, get: function () { return constants_1.DEFAULT_EXCLUDE_PATTERNS; } });
21
+ Object.defineProperty(exports, "GITIGNORE_FILE", { enumerable: true, get: function () { return constants_1.GITIGNORE_FILE; } });
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/fileset/index.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AAC3B,qCAAqF;AAA5E,qGAAA,UAAU,OAAA;AAAE,sGAAA,WAAW,OAAA;AAAE,qGAAA,UAAU,OAAA;AAAE,8GAAA,mBAAmB,OAAA;AACjE,yCAA0F;AAAjF,2GAAA,cAAc,OAAA;AAAE,gHAAA,mBAAmB,OAAA;AAAE,mHAAA,sBAAsB,OAAA;AACpE,iDAA8E;AAArE,qHAAA,oBAAoB,OAAA;AAAE,sHAAA,qBAAqB,OAAA;AACpD,yCAKqB;AAJnB,wGAAA,WAAW,OAAA;AACX,kHAAA,qBAAqB,OAAA;AACrB,qHAAA,wBAAwB,OAAA;AACxB,2GAAA,cAAc,OAAA"}
@@ -0,0 +1,22 @@
1
+ import { ManagedFileMetadata } from '../types';
2
+ /**
3
+ * Read all managed file entries from a .filedist marker file.
4
+ * Format: path|packageName|packageVersion — one row per file, no header.
5
+ * Pipe is used as separator so file paths containing commas are handled safely.
6
+ */
7
+ export declare function readMarker(markerFilePath: string): Promise<ManagedFileMetadata[]>;
8
+ /**
9
+ * Write managed file entries to a .filedist marker file.
10
+ * Format: path|packageName|packageVersion — one row per file, no header.
11
+ * Makes the file read-only after writing.
12
+ */
13
+ export declare function writeMarker(markerFilePath: string, entries: ManagedFileMetadata[]): Promise<void>;
14
+ /**
15
+ * Returns the path of the .filedist marker file for a given output directory.
16
+ */
17
+ export declare function markerPath(outputDir: string): string;
18
+ /**
19
+ * Read all managed file entries from an output directory's .filedist marker.
20
+ */
21
+ export declare function readOutputDirMarker(outputDir: string): Promise<ManagedFileMetadata[]>;
22
+ //# sourceMappingURL=markers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markers.d.ts","sourceRoot":"","sources":["../../src/fileset/markers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAK/C;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAevF;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,mBAAmB,EAAE,GAC7B,OAAO,CAAC,IAAI,CAAC,CAqBf;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAE3F"}
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.readMarker = readMarker;
7
+ exports.writeMarker = writeMarker;
8
+ exports.markerPath = markerPath;
9
+ exports.readOutputDirMarker = readOutputDirMarker;
10
+ const node_fs_1 = __importDefault(require("node:fs"));
11
+ const node_path_1 = __importDefault(require("node:path"));
12
+ const utils_1 = require("../utils");
13
+ const constants_1 = require("./constants");
14
+ /**
15
+ * Read all managed file entries from a .filedist marker file.
16
+ * Format: path|packageName|packageVersion — one row per file, no header.
17
+ * Pipe is used as separator so file paths containing commas are handled safely.
18
+ */
19
+ async function readMarker(markerFilePath) {
20
+ if (!node_fs_1.default.existsSync(markerFilePath)) {
21
+ return [];
22
+ }
23
+ const content = node_fs_1.default.readFileSync(markerFilePath, 'utf8');
24
+ const lines = content.split('\n').filter((line) => line.trim() !== '');
25
+ return lines.map((line) => {
26
+ const fields = line.split('|');
27
+ return {
28
+ path: fields[0] ?? '',
29
+ packageName: fields[1] ?? '',
30
+ packageVersion: fields[2] ?? '',
31
+ kind: fields[3] === 'symlink' ? 'symlink' : 'file',
32
+ };
33
+ });
34
+ }
35
+ /**
36
+ * Write managed file entries to a .filedist marker file.
37
+ * Format: path|packageName|packageVersion — one row per file, no header.
38
+ * Makes the file read-only after writing.
39
+ */
40
+ async function writeMarker(markerFilePath, entries) {
41
+ (0, utils_1.ensureDir)(node_path_1.default.dirname(markerFilePath));
42
+ // Make writable if it already exists
43
+ if (node_fs_1.default.existsSync(markerFilePath)) {
44
+ node_fs_1.default.chmodSync(markerFilePath, 0o644);
45
+ }
46
+ if (entries.length === 0) {
47
+ // Remove empty marker
48
+ if (node_fs_1.default.existsSync(markerFilePath)) {
49
+ node_fs_1.default.unlinkSync(markerFilePath);
50
+ }
51
+ return;
52
+ }
53
+ const rows = entries.map((e) => {
54
+ if (e.kind === 'symlink') {
55
+ return `${e.path}|${e.packageName}|${e.packageVersion}|symlink`;
56
+ }
57
+ return `${e.path}|${e.packageName}|${e.packageVersion}`;
58
+ });
59
+ node_fs_1.default.writeFileSync(markerFilePath, `${rows.join('\n')}\n`, 'utf8');
60
+ node_fs_1.default.chmodSync(markerFilePath, 0o444);
61
+ }
62
+ /**
63
+ * Returns the path of the .filedist marker file for a given output directory.
64
+ */
65
+ function markerPath(outputDir) {
66
+ return node_path_1.default.join(outputDir, constants_1.MARKER_FILE);
67
+ }
68
+ /**
69
+ * Read all managed file entries from an output directory's .filedist marker.
70
+ */
71
+ async function readOutputDirMarker(outputDir) {
72
+ return readMarker(markerPath(outputDir));
73
+ }
74
+ //# sourceMappingURL=markers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markers.js","sourceRoot":"","sources":["../../src/fileset/markers.ts"],"names":[],"mappings":";;;;;AAaA,gCAeC;AAOD,kCAwBC;AAKD,gCAEC;AAKD,kDAEC;AAzED,sDAAyB;AACzB,0DAA6B;AAG7B,oCAAqC;AAErC,2CAA0C;AAE1C;;;;GAIG;AACI,KAAK,UAAU,UAAU,CAAC,cAAsB;IACrD,IAAI,CAAC,iBAAE,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;QACnC,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,OAAO,GAAG,iBAAE,CAAC,YAAY,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;IACxD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC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AAO,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;IAC1D,CAAC,CAAC,CAAC;IACH,iBAAE,CAAC,aAAa,CAAC,cAAc,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACjE,iBAAE,CAAC,SAAS,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;AACtC,CAAC;AAED;;GAEG;AACH,SAAgB,UAAU,CAAC,SAAiB;IAC1C,OAAO,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,uBAAW,CAAC,CAAC;AAC3C,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,mBAAmB,CAAC,SAAiB;IACzD,OAAO,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { SelectorConfig } from '../types';
2
+ /**
3
+ * Returns the installed package path from node_modules in cwd, or null if not found.
4
+ */
5
+ export declare function installedPackagePath(name: string, cwd?: string): string | null;
6
+ /**
7
+ * Enumerate all files in a package directory that match the selector.
8
+ * Applies DEFAULT_FILE_PATTERNS when `files` is absent; always applies DEFAULT_EXCLUDE_PATTERNS,
9
+ * appending any custom `exclude` patterns on top. Any default exclusion pattern that appears
10
+ * exactly as an entry in `files` is removed so the file can be explicitly included.
11
+ * Binary files always skip contentRegexes check (but are included by glob).
12
+ *
13
+ * @returns Array of relative file paths from the package root.
14
+ */
15
+ export declare function enumeratePackageFiles(pkgPath: string, selector: SelectorConfig): Promise<string[]>;
16
+ /**
17
+ * Check whether a relative file path matches the given glob patterns.
18
+ * Handles negative patterns (prefix !) and positive patterns.
19
+ */
20
+ export declare function matchesFilePatterns(relPath: string, patterns: string[]): boolean;
21
+ //# sourceMappingURL=package-files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-files.d.ts","sourceRoot":"","sources":["../../src/fileset/package-files.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAK1C;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQ9E;AAED;;;;;;;;GAQG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,cAAc,GACvB,OAAO,CAAC,MAAM,EAAE,CAAC,CAyDnB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAYhF"}
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.installedPackagePath = installedPackagePath;
7
+ exports.enumeratePackageFiles = enumeratePackageFiles;
8
+ exports.matchesFilePatterns = matchesFilePatterns;
9
+ const node_fs_1 = __importDefault(require("node:fs"));
10
+ const node_path_1 = __importDefault(require("node:path"));
11
+ const minimatch_1 = require("minimatch");
12
+ const utils_1 = require("../utils");
13
+ const constants_1 = require("./constants");
14
+ /**
15
+ * Returns the installed package path from node_modules in cwd, or null if not found.
16
+ */
17
+ function installedPackagePath(name, cwd) {
18
+ const workDir = cwd ?? process.cwd();
19
+ const pkgPath = node_path_1.default.join(workDir, 'node_modules', name, 'package.json');
20
+ if (node_fs_1.default.existsSync(pkgPath)) {
21
+ return node_path_1.default.dirname(pkgPath);
22
+ }
23
+ // eslint-disable-next-line unicorn/no-null
24
+ return null;
25
+ }
26
+ /**
27
+ * Enumerate all files in a package directory that match the selector.
28
+ * Applies DEFAULT_FILE_PATTERNS when `files` is absent; always applies DEFAULT_EXCLUDE_PATTERNS,
29
+ * appending any custom `exclude` patterns on top. Any default exclusion pattern that appears
30
+ * exactly as an entry in `files` is removed so the file can be explicitly included.
31
+ * Binary files always skip contentRegexes check (but are included by glob).
32
+ *
33
+ * @returns Array of relative file paths from the package root.
34
+ */
35
+ async function enumeratePackageFiles(pkgPath, selector) {
36
+ if (selector.files && selector.files.length === 0) {
37
+ return [];
38
+ }
39
+ // `selector.presets` is purely for filtering recursive filedist.sets; it has no effect on
40
+ // which files are selected from the package itself. When presets is specified without an
41
+ // explicit `files` pattern the caller intends only set-level recursion, so we return an
42
+ // empty list to avoid accidentally pulling in every file via DEFAULT_FILE_PATTERNS.
43
+ if (selector.presets && selector.presets.length > 0 && !selector.files) {
44
+ return [];
45
+ }
46
+ const filePatterns = selector.files ?? constants_1.DEFAULT_FILE_PATTERNS;
47
+ const filePatternGroups = selector.filePatternGroups ?? (selector.files ? [selector.files] : []);
48
+ const activeDefaultExcludes = constants_1.DEFAULT_EXCLUDE_PATTERNS.filter((p) => !filePatterns.includes(p));
49
+ const excludePatterns = [...activeDefaultExcludes, ...(selector.exclude ?? [])];
50
+ const contentRegexes = (selector.contentRegexes ?? []).map((r) => new RegExp(r));
51
+ const results = [];
52
+ const walkDir = (dir, basePath = '') => {
53
+ const entries = node_fs_1.default.readdirSync(dir);
54
+ for (const entry of entries) {
55
+ if (entry === constants_1.MARKER_FILE)
56
+ continue;
57
+ const fullPath = node_path_1.default.join(dir, entry);
58
+ const relPath = basePath ? `${basePath}/${entry}` : entry;
59
+ const lstat = node_fs_1.default.lstatSync(fullPath);
60
+ if (lstat.isSymbolicLink())
61
+ continue;
62
+ if (lstat.isDirectory()) {
63
+ walkDir(fullPath, relPath);
64
+ continue;
65
+ }
66
+ // Apply glob filter
67
+ if (!matchesFilePatterns(relPath, filePatterns))
68
+ continue;
69
+ if (filePatternGroups.some((group) => !matchesFilePatterns(relPath, group)))
70
+ continue;
71
+ // Apply exclude patterns
72
+ if (excludePatterns.some((pat) => (0, minimatch_1.minimatch)(relPath, pat, { dot: true })))
73
+ continue;
74
+ // Apply content regex filter (skip for binary files)
75
+ if (contentRegexes.length > 0 && !(0, utils_1.isBinaryFile)(fullPath)) {
76
+ const content = node_fs_1.default.readFileSync(fullPath, 'utf8');
77
+ const matches = contentRegexes.some((re) => re.test(content));
78
+ if (!matches)
79
+ continue;
80
+ }
81
+ // Binary files pass through when contentRegexes are set, since they
82
+ // cannot be scanned but may be legitimately needed
83
+ results.push(relPath);
84
+ }
85
+ };
86
+ walkDir(pkgPath);
87
+ return results;
88
+ }
89
+ /**
90
+ * Check whether a relative file path matches the given glob patterns.
91
+ * Handles negative patterns (prefix !) and positive patterns.
92
+ */
93
+ function matchesFilePatterns(relPath, patterns) {
94
+ if (patterns.length === 0)
95
+ return false;
96
+ const includes = patterns.filter((p) => !p.startsWith('!'));
97
+ const excludes = patterns.filter((p) => p.startsWith('!')).map((p) => p.slice(1));
98
+ const matchesIncludes = includes.length === 0 || includes.some((pat) => (0, minimatch_1.minimatch)(relPath, pat, { dot: true }));
99
+ const matchesExcludes = excludes.some((pat) => (0, minimatch_1.minimatch)(relPath, pat, { dot: true }));
100
+ return matchesIncludes && !matchesExcludes;
101
+ }
102
+ //# sourceMappingURL=package-files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-files.js","sourceRoot":"","sources":["../../src/fileset/package-files.ts"],"names":[],"mappings":";;;;;AAaA,oDAQC;AAWD,sDA4DC;AAMD,kDAYC;AA9GD,sDAAyB;AACzB,0DAA6B;AAE7B,yCAAsC;AAGtC,oCAAwC;AAExC,2CAA2F;AAE3F;;GAEG;AACH,SAAgB,oBAAoB,CAAC,IAAY,EAAE,GAAY;IAC7D,MAAM,OAAO,GAAG,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IACrC,MAAM,OAAO,GAAG,mBAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;IACzE,IAAI,iBAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,OA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eAAe,IAAI,CAAC,eAAe,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { ManagedFileMetadata, PurgeResult } from '../types';
2
+ /**
3
+ * Purge all managed files in entries from the output directory.
4
+ * Also removes symlinks, empty directories, and cleans up marker / gitignore entries.
5
+ *
6
+ * Marker update: only the paths listed in `entries` are removed from the marker.
7
+ * Entries belonging to other packages that share the same output directory are
8
+ * preserved. The marker file is deleted only when it becomes empty.
9
+ *
10
+ * Gitignore update: only entries for the purged paths are removed.
11
+ *
12
+ * @param outputDir Absolute path to the output directory.
13
+ * @param entries List of managed file entries to remove.
14
+ * @param dryRun If true, only report what would be removed without deleting.
15
+ * @returns PurgeResult with counts of deleted, symlinks removed, and dirs removed.
16
+ */
17
+ export declare function purgeFileset(outputDir: string, entries: ManagedFileMetadata[], dryRun: boolean): Promise<PurgeResult>;
18
+ //# sourceMappingURL=purge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"purge.d.ts","sourceRoot":"","sources":["../../src/fileset/purge.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAO5D;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,YAAY,CAChC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,mBAAmB,EAAE,EAC9B,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,WAAW,CAAC,CAyCtB"}