@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/README.md CHANGED
@@ -188,7 +188,7 @@ const ready = drop.files.filter(f => f.status === FileValidationStatus.READY);
188
188
 
189
189
  ## Build on upload
190
190
 
191
- Drop recognises an unbuilt project (source files with `package.json` / `node_modules`) and sets `needsBuild`. `node_modules` is skipped during traversal and stripped from folder-picker selections, deploy validation is skipped (source files aren't build output), and every file goes straight to `ready`.
191
+ Drop recognises an unbuilt project (source files with `package.json` / `node_modules`) and sets `needsBuild`. `node_modules` is skipped during traversal and stripped from folder-picker selections. A project's source isn't the site, so neither the entry-point check nor deploy validation applies to it: Astro, Next.js, SvelteKit and Eleventy have no `index.html` until they are built. Every file goes straight to `ready`, and the build gives the verdict.
192
192
 
193
193
  Pass the signal through to the SDK:
194
194
 
@@ -221,7 +221,7 @@ if (outcome.phase === 'ready') {
221
221
  }
222
222
  ```
223
223
 
224
- It never throws — a missing entry point, an oversized file, an unbuilt project, and an unexpected failure all come back as an `error` outcome. Pass `onStatus` to report progress during extraction.
224
+ It never throws: a missing entry point, an oversized file, and an unexpected failure all come back as an `error` outcome. Pass `onStatus` to report progress during extraction.
225
225
 
226
226
  ## Testing your components
227
227
 
package/dist/index.cjs CHANGED
@@ -953,12 +953,12 @@ function detectSourceName(files) {
953
953
  return path.includes("/") ? path.split("/")[0] : first.name;
954
954
  }
955
955
  function failure(params) {
956
- const { title, details, errors, files = [], sourceName, needsBuild = false } = params;
956
+ const { title, details, errors, files = [], sourceName } = params;
957
957
  return {
958
958
  phase: "error",
959
959
  files,
960
960
  sourceName,
961
- needsBuild,
961
+ needsBuild: false,
962
962
  // `details` carries the single user-facing message; `errors` is for per-item
963
963
  // breakdowns. Omitted when empty, otherwise consumers that render both
964
964
  // fields show the message twice.
@@ -988,19 +988,6 @@ async function processFiles(input, { limits, onStatus }) {
988
988
  const finalFiles = stripCommonPrefix(
989
989
  files.filter((f) => kept.has(filePath(f))).map((f) => createProcessedFile(f))
990
990
  );
991
- if (finalFiles.length > 0) {
992
- const hasIndex = needsBuild ? finalFiles.some((f) => f.path === "index.html" || f.path.endsWith("/index.html")) : finalFiles.some((f) => f.path === "index.html");
993
- if (!hasIndex) {
994
- 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";
995
- return failure({
996
- title: CANT_DEPLOY,
997
- details,
998
- sourceName,
999
- needsBuild,
1000
- files: applyStatus(finalFiles, FileValidationStatus.VALIDATION_FAILED, details)
1001
- });
1002
- }
1003
- }
1004
991
  if (needsBuild) {
1005
992
  const ready = applyStatus(finalFiles, FileValidationStatus.READY);
1006
993
  return {
@@ -1014,6 +1001,15 @@ async function processFiles(input, { limits, onStatus }) {
1014
1001
  }
1015
1002
  };
1016
1003
  }
1004
+ if (finalFiles.length > 0 && !finalFiles.some((f) => f.path === "index.html")) {
1005
+ const details = "No index.html at root \u2014 the entry point must be in the top-level directory";
1006
+ return failure({
1007
+ title: CANT_DEPLOY,
1008
+ details,
1009
+ sourceName,
1010
+ files: applyStatus(finalFiles, FileValidationStatus.VALIDATION_FAILED, details)
1011
+ });
1012
+ }
1017
1013
  const validation = ship.validateFiles(finalFiles.map(toValidatable), limits);
1018
1014
  const validated = finalFiles.map((file, i) => ({
1019
1015
  ...file,