@shipstatic/drop 2.13.0 → 2.14.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -270,6 +270,7 @@ function applyStatus(files, status, statusMessage) {
270
270
  ...statusMessage === void 0 ? {} : { statusMessage }
271
271
  }));
272
272
  }
273
+ var NEVER_SOURCE = /* @__PURE__ */ new Set(["node_modules", ".git", "__MACOSX"]);
273
274
  function segments(file) {
274
275
  return filePath(file).replace(/\\/g, "/").split("/").filter(Boolean);
275
276
  }
@@ -287,7 +288,7 @@ function rebase(line, base) {
287
288
  return `${negated ? "!" : ""}${rebased}${directoryOnly ? "/" : ""}`;
288
289
  }
289
290
  async function projectSource(files) {
290
- const source = files.filter((file) => !segments(file).includes("node_modules"));
291
+ const source = files.filter((file) => !segments(file).some((part) => NEVER_SOURCE.has(part)));
291
292
  const rules = source.map((file) => ({ file, parts: segments(file) })).filter(({ parts }) => parts.at(-1) === ".gitignore").sort((a, b) => a.parts.length - b.parts.length);
292
293
  if (rules.length === 0) return source;
293
294
  const matcher = ignore__default.default({ allowRelativePaths: true });
@@ -1018,10 +1019,11 @@ async function processFiles(input, { limits, onStatus }) {
1018
1019
  }
1019
1020
  const needsBuild = files.some((f) => hasUnbuiltMarker(filePath(f)));
1020
1021
  if (needsBuild) files = await projectSource(files);
1021
- const kept = new Set(ship.filterJunk(files.map(filePath), { allowUnbuilt: needsBuild }));
1022
- const finalFiles = stripCommonPrefix(
1023
- files.filter((f) => kept.has(filePath(f))).map((f) => createProcessedFile(f))
1024
- );
1022
+ if (!needsBuild) {
1023
+ const kept = new Set(ship.filterJunk(files.map(filePath)));
1024
+ files = files.filter((f) => kept.has(filePath(f)));
1025
+ }
1026
+ const finalFiles = stripCommonPrefix(files.map((f) => createProcessedFile(f)));
1025
1027
  if (needsBuild) {
1026
1028
  const ready = applyStatus(finalFiles, FileValidationStatus.READY);
1027
1029
  return {