@shipstatic/drop 2.12.0 → 2.12.2-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.d.cts CHANGED
@@ -26,9 +26,9 @@ interface DropOutcome {
26
26
  /**
27
27
  * Run the pipeline.
28
28
  *
29
- * Never throws: an unbuilt project rejected by `filterJunk`, a missing entry
30
- * point, a file over the limit, and an unexpected host-object failure all come
31
- * back as an `error` outcome. Callers need no try/catch.
29
+ * Never throws: a missing entry point, a file over the limit, and an
30
+ * unexpected host-object failure all come back as an `error` outcome. Callers
31
+ * need no try/catch.
32
32
  */
33
33
  declare function processFiles(input: File[], { limits, onStatus }: ProcessFilesOptions): Promise<DropOutcome>;
34
34
 
package/dist/index.d.ts CHANGED
@@ -26,9 +26,9 @@ interface DropOutcome {
26
26
  /**
27
27
  * Run the pipeline.
28
28
  *
29
- * Never throws: an unbuilt project rejected by `filterJunk`, a missing entry
30
- * point, a file over the limit, and an unexpected host-object failure all come
31
- * back as an `error` outcome. Callers need no try/catch.
29
+ * Never throws: a missing entry point, a file over the limit, and an
30
+ * unexpected host-object failure all come back as an `error` outcome. Callers
31
+ * need no try/catch.
32
32
  */
33
33
  declare function processFiles(input: File[], { limits, onStatus }: ProcessFilesOptions): Promise<DropOutcome>;
34
34
 
package/dist/index.js CHANGED
@@ -951,12 +951,12 @@ function detectSourceName(files) {
951
951
  return path.includes("/") ? path.split("/")[0] : first.name;
952
952
  }
953
953
  function failure(params) {
954
- const { title, details, errors, files = [], sourceName, needsBuild = false } = params;
954
+ const { title, details, errors, files = [], sourceName } = params;
955
955
  return {
956
956
  phase: "error",
957
957
  files,
958
958
  sourceName,
959
- needsBuild,
959
+ needsBuild: false,
960
960
  // `details` carries the single user-facing message; `errors` is for per-item
961
961
  // breakdowns. Omitted when empty, otherwise consumers that render both
962
962
  // fields show the message twice.
@@ -986,19 +986,6 @@ async function processFiles(input, { limits, onStatus }) {
986
986
  const finalFiles = stripCommonPrefix(
987
987
  files.filter((f) => kept.has(filePath(f))).map((f) => createProcessedFile(f))
988
988
  );
989
- if (finalFiles.length > 0) {
990
- const hasIndex = needsBuild ? finalFiles.some((f) => f.path === "index.html" || f.path.endsWith("/index.html")) : finalFiles.some((f) => f.path === "index.html");
991
- if (!hasIndex) {
992
- const details = needsBuild ? "No index.html found \u2014 every web project needs an index.html entry point" : "No index.html at root \u2014 the entry point must be in the top-level directory";
993
- return failure({
994
- title: CANT_DEPLOY,
995
- details,
996
- sourceName,
997
- needsBuild,
998
- files: applyStatus(finalFiles, FileValidationStatus.VALIDATION_FAILED, details)
999
- });
1000
- }
1001
- }
1002
989
  if (needsBuild) {
1003
990
  const ready = applyStatus(finalFiles, FileValidationStatus.READY);
1004
991
  return {
@@ -1012,6 +999,15 @@ async function processFiles(input, { limits, onStatus }) {
1012
999
  }
1013
1000
  };
1014
1001
  }
1002
+ if (finalFiles.length > 0 && !finalFiles.some((f) => f.path === "index.html")) {
1003
+ const details = "No index.html at root \u2014 the entry point must be in the top-level directory";
1004
+ return failure({
1005
+ title: CANT_DEPLOY,
1006
+ details,
1007
+ sourceName,
1008
+ files: applyStatus(finalFiles, FileValidationStatus.VALIDATION_FAILED, details)
1009
+ });
1010
+ }
1015
1011
  const validation = validateFiles(finalFiles.map(toValidatable), limits);
1016
1012
  const validated = finalFiles.map((file, i) => ({
1017
1013
  ...file,