@netlify/spark-ui 1.31.0-alpha.5 → 1.31.0-alpha.6

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 (37) hide show
  1. package/README.md +3 -4
  2. package/dist/components/preact/DropZone/DropZone.d.ts +23 -97
  3. package/dist/drop-core/analytics.d.ts +4 -15
  4. package/dist/drop-core/authedApi.d.ts +9 -22
  5. package/dist/drop-core/authedDropClient.d.ts +13 -55
  6. package/dist/drop-core/authedDropClient.js +5 -18
  7. package/dist/drop-core/buildClient.d.ts +19 -53
  8. package/dist/drop-core/buildClient.js +27 -40
  9. package/dist/drop-core/buildStash.d.ts +6 -20
  10. package/dist/drop-core/client.d.ts +1 -1
  11. package/dist/drop-core/constants.d.ts +1 -21
  12. package/dist/drop-core/deploy.d.ts +5 -17
  13. package/dist/drop-core/detectBuild.d.ts +8 -26
  14. package/dist/drop-core/errors.d.ts +8 -27
  15. package/dist/drop-core/fileTypes.d.ts +4 -14
  16. package/dist/drop-core/readFiles.d.ts +5 -11
  17. package/dist/drop-core/types.d.ts +2 -4
  18. package/dist/drop-core/zip.d.ts +7 -30
  19. package/package.json +1 -1
  20. package/packages/components/preact/DropZone/DropZone.tsx +27 -121
  21. package/packages/components/preact/DropZone/useDropDeploy.ts +27 -60
  22. package/packages/drop-core/analytics.ts +4 -15
  23. package/packages/drop-core/authedApi.ts +9 -22
  24. package/packages/drop-core/authedDropClient.ts +13 -55
  25. package/packages/drop-core/buildClient.test.ts +19 -4
  26. package/packages/drop-core/buildClient.ts +21 -63
  27. package/packages/drop-core/buildStash.ts +9 -25
  28. package/packages/drop-core/client.ts +6 -10
  29. package/packages/drop-core/constants.ts +7 -21
  30. package/packages/drop-core/deploy.ts +6 -22
  31. package/packages/drop-core/detectBuild.ts +15 -50
  32. package/packages/drop-core/errors.test.ts +3 -1
  33. package/packages/drop-core/errors.ts +9 -30
  34. package/packages/drop-core/fileTypes.ts +5 -19
  35. package/packages/drop-core/readFiles.ts +5 -12
  36. package/packages/drop-core/types.ts +2 -4
  37. package/packages/drop-core/zip.ts +7 -30
@@ -1,16 +1,16 @@
1
- var u = Object.defineProperty;
2
- var d = (r, t, e) => t in r ? u(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
- var o = (r, t, e) => d(r, typeof t != "symbol" ? t + "" : t, e);
1
+ var d = Object.defineProperty;
2
+ var u = (i, t, e) => t in i ? d(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
+ var o = (i, t, e) => u(i, typeof t != "symbol" ? t + "" : t, e);
4
4
  import { createSiteInAccount as c, pollDeployUntilSettled as h } from "./authedApi.js";
5
5
  import { DEFAULT_PROXY_BASE as m, DEFAULT_API_BASE as B, DEFAULT_POLL_INTERVAL_MS as y, DEFAULT_TIMEOUT_MS as w } from "./constants.js";
6
- import { NotAuthenticatedError as l, BuildCreateError as f, BuildFailedError as A, BuildTimeoutError as E } from "./errors.js";
7
- class U {
6
+ import { BuildCreateError as l, BuildFailedError as M, BuildTimeoutError as T } from "./errors.js";
7
+ class _ {
8
8
  constructor({
9
9
  proxyBase: t = m,
10
10
  apiBase: e = B,
11
11
  getUploadToken: a,
12
- accountSlug: s,
13
- title: i = "Build from drop deployment",
12
+ accountSlug: r,
13
+ title: s = "Build from drop deployment",
14
14
  pollIntervalMs: n = y,
15
15
  timeoutMs: p = w
16
16
  }) {
@@ -21,52 +21,39 @@ class U {
21
21
  o(this, "title");
22
22
  o(this, "pollIntervalMs");
23
23
  o(this, "timeoutMs");
24
- this.proxyBase = t, this.apiBase = e, this.getUploadToken = a, this.accountSlug = s, this.title = i, this.pollIntervalMs = n, this.timeoutMs = p;
24
+ this.proxyBase = t, this.apiBase = e, this.getUploadToken = a, this.accountSlug = r, this.title = s, this.pollIntervalMs = n, this.timeoutMs = p;
25
25
  }
26
- /**
27
- * Create the site the build deploys into. A logged-out visitor fails here,
28
- * before anything is created — see `createSiteInAccount` for the error
29
- * mapping that makes the signup fallback safe.
30
- */
26
+ /** A logged-out visitor fails here, before anything is created (see `createSiteInAccount`). */
31
27
  async createSite() {
32
28
  return c(this.proxyBase, this.accountSlug);
33
29
  }
34
30
  /**
35
- * Upload the source archive and enqueue a build. Direct to `api.netlify.com`
36
- * (see the note on `apiBase`), authorized by a freshly minted bearer token.
37
- * `Content-Type` is left unset on purpose so the browser adds the multipart
38
- * boundary itself.
31
+ * One multipart request on a fresh 30s bearer — a slower zip fails mid-flight
32
+ * (the app origin gets 300s; raising ours is a platform-side change).
33
+ * Content-Type stays unset so the browser adds the multipart boundary.
39
34
  *
40
- * Known ceiling: this is one request on a 30s token, and re-minting can't
41
- * help once it is in flight. A zip that takes longer than that to upload will
42
- * fail — the app origin gets 300s for exactly this reason, and lifting the
43
- * limit for other origins is a platform-side change.
35
+ * Never NotAuthenticatedError, including for a 401: the site exists by the
36
+ * time this runs, so signalling "no session" would strand it and re-stash
37
+ * the drop for the next visit to strand another. `createSite` is the auth
38
+ * gate for this path.
44
39
  */
45
40
  async createBuildFromZip(t, e) {
46
41
  const a = await this.getUploadToken();
47
42
  if (!a) throw new l();
48
- const s = new FormData();
49
- s.append("zip", e), s.append("title", this.title);
50
- const i = await fetch(`${this.apiBase}/sites/${t}/builds`, {
43
+ const r = new FormData();
44
+ r.append("zip", e), r.append("title", this.title);
45
+ const s = await fetch(`${this.apiBase}/sites/${t}/builds`, {
51
46
  method: "POST",
52
47
  headers: { Authorization: `Bearer ${a}` },
53
- body: s
48
+ body: r
54
49
  });
55
- if (i.status === 401 || i.status === 403) throw new l();
56
- if (!i.ok) throw new f(i.status);
57
- return i.json();
50
+ if (!s.ok) throw new l(s.status);
51
+ return s.json();
58
52
  }
59
53
  /**
60
- * Poll the build's deploy until it settles, mirroring
61
- * `AnonymousDropClient.waitUntilReady` — resolve on `ready`, throw on
62
- * `error`/`rejected`, throw on timeout. A build that hasn't been given a
63
- * deploy id yet has nothing pollable, so it resolves immediately and the
64
- * caller falls back to the site page.
65
- *
66
- * Optional in the drop flow, and off by default: a build takes minutes, so
67
- * the useful hand-off is usually the project page rather than a spinner.
68
- * Polling rides the session cookie, so it cannot outlive its credentials the
69
- * way a 30s bearer would.
54
+ * Optional (a build takes minutes; the useful hand-off is the project page).
55
+ * Polls on the cookie, so it can't outlive its credentials; no deploy id yet
56
+ * means nothing pollable, so it resolves immediately.
70
57
  */
71
58
  async waitUntilBuildReady(t) {
72
59
  if (!t.deploy_id) return;
@@ -77,9 +64,9 @@ class U {
77
64
  timeoutMs: this.timeoutMs
78
65
  });
79
66
  if (e.outcome !== "ready")
80
- throw e.outcome === "failed" ? new A(e.errorMessage) : new E();
67
+ throw e.outcome === "failed" ? new M(e.errorMessage) : new T();
81
68
  }
82
69
  }
83
70
  export {
84
- U as AuthenticatedBuildClient
71
+ _ as AuthenticatedBuildClient
85
72
  };
@@ -1,20 +1,10 @@
1
1
  import { InferredBuildSettings } from './detectBuild';
2
2
  /**
3
- * Carry a build-required drop across the signup round-trip.
4
- *
5
- * A logged-out visitor's drop can't be built (builds have no anonymous
6
- * equivalent), so before handing them to signup the zone stashes the source
7
- * archive here — IndexedDB, because the zip is far beyond localStorage's
8
- * budget. When they return to this origin authenticated, the zone deploys the
9
- * stash automatically instead of asking them to drop again.
10
- *
11
- * Storage is per-origin: a stash written on www.netlify.com can only ever be
12
- * resumed on www.netlify.com. That is the design, not a limitation — it is
13
- * exactly why the hand-off page must bring the visitor back here.
14
- *
15
- * Every operation is failure-swallowing: the stash is an enhancement, and a
16
- * browser without IndexedDB (or with a full quota) degrades to the plain
17
- * signup redirect the zone always supported.
3
+ * Carries a build drop across the signup round-trip: stash the zip in
4
+ * IndexedDB before the hand-off, deploy it when the visitor returns
5
+ * authenticated. Storage is per-origin by design — the hand-off must bring
6
+ * them back here. Every operation swallows failures: no storage means the
7
+ * plain signup redirect the zone always supported.
18
8
  */
19
9
  export interface DropBuildStash {
20
10
  /** The `source.zip` exactly as it would have been uploaded. */
@@ -23,11 +13,7 @@ export interface DropBuildStash {
23
13
  buildSettings: InferredBuildSettings | null;
24
14
  createdAt: number;
25
15
  }
26
- /**
27
- * Stash a drop's source archive for an automatic deploy after signup. Returns
28
- * whether it was actually stored — callers use that only to phrase the
29
- * hand-off, never to block it.
30
- */
16
+ /** Stash the archive for auto-deploy after signup. The result phrases the hand-off, never blocks it. */
31
17
  export declare function saveDropStash(zipFile: File, buildSettings?: InferredBuildSettings | null): Promise<boolean>;
32
18
  /** The stashed drop, or null when there is none, it expired, or storage is unavailable. */
33
19
  export declare function loadDropStash(): Promise<DropBuildStash | null>;
@@ -11,7 +11,7 @@ export interface DropClient {
11
11
  }
12
12
  /**
13
13
  * Unauthenticated drop client. Authorized server-side by the Referer header,
14
- * so it only works from an allowlisted origin (see backend checklist).
14
+ * so it only works from an allowlisted origin.
15
15
  */
16
16
  export declare class AnonymousDropClient implements DropClient {
17
17
  private apiBase;
@@ -1,29 +1,9 @@
1
- /**
2
- * The tunables shared across drop-core, one place and one comment each.
3
- * Module-specific constants (e.g. buildStash's storage caps) stay with their
4
- * module; anything two modules read belongs here.
5
- */
6
- /**
7
- * Root for session-cookie JSON calls, via the consumer's access-control
8
- * rewrite. On netlify.com, `/access-control/*` targets the app's
9
- * access-control function; the paths an origin may call are allowlisted
10
- * server-side.
11
- */
1
+ /** Tunables shared across drop-core. Module-specific constants stay with their module. */
12
2
  export declare const DEFAULT_PROXY_BASE = "/access-control/bb-api/api/v1";
13
3
  /** Direct api.netlify.com root for the uploads the proxy's ~6MB Lambda body limit can't carry. */
14
4
  export declare const DEFAULT_API_BASE = "https://api.netlify.com/api/v1";
15
5
  export declare const DEFAULT_POLL_INTERVAL_MS = 1000;
16
6
  export declare const DEFAULT_TIMEOUT_MS: number;
17
7
  export declare const MAX_CONCURRENT_UPLOADS = 5;
18
- /**
19
- * How long a minted upload token is reused before minting another: 20 seconds.
20
- * The server issues non-app origins a 30s token; the gap leaves margin for the
21
- * request the token authorizes to finish.
22
- */
23
8
  export declare const TOKEN_REUSE_MS: number;
24
- /**
25
- * Waits between attempts of a failed file upload, as data so the whole curve
26
- * can be overridden (the tus-js-client `retryDelays` idiom). Three retries,
27
- * linear backoff; 400/422 responses never retry — see `uploadWithRetry`.
28
- */
29
9
  export declare const UPLOAD_RETRY_DELAYS_MS: readonly number[];
@@ -10,7 +10,6 @@ export interface DeployOptions {
10
10
  }
11
11
  export declare function deployFiles(client: DropClient, files: ProcessedFile[], opts?: DeployOptions): Promise<DeployResult>;
12
12
  export interface BuildDeployResult {
13
- /** The site created for this build. */
14
13
  site: BuildSite;
15
14
  /** The enqueued build; `deploy_id` is what the app's deploy page keys off. */
16
15
  build: BuildResponse;
@@ -21,26 +20,15 @@ export interface BuildDeployResult {
21
20
  }
22
21
  export interface BuildDeployOptions extends DeployOptions {
23
22
  /**
24
- * Poll until the build finishes instead of returning as soon as it's enqueued.
25
- * Off by default: a build takes minutes, so the useful hand-off is usually the
26
- * app's deploy page with its live logs, not a spinner. Turn it on when the
27
- * caller needs to know the outcome — only then can a `BuildFailedError` reach
28
- * it with the build's own error message.
23
+ * Wait for the build instead of returning at enqueue. Off by default (builds
24
+ * take minutes); on is the only way a BuildFailedError reaches the caller.
29
25
  */
30
26
  waitForBuild?: boolean;
31
27
  }
32
28
  /**
33
- * The build counterpart to `deployFiles`: zip the drop, create a site in the
34
- * user's account, and hand the archive to buildbot. Requires an authenticated
35
- * client — builds have no anonymous equivalent.
36
- *
37
- * Site creation deliberately happens *after* zipping, so a zip that fails
38
- * doesn't leave an empty site behind in the user's account.
29
+ * Zip the drop, create a site, hand buildbot the archive. Zipping comes first
30
+ * on purpose: a failed zip must not leave an empty site behind.
39
31
  */
40
32
  export declare function deployBuild(client: BuildClient, files: ProcessedFile[], opts?: BuildDeployOptions): Promise<BuildDeployResult>;
41
- /**
42
- * Deploy an archive that was already zipped — the resume path for a drop
43
- * stashed across the signup round-trip (see `buildStash`), where `source.zip`
44
- * and its synthesised settings were produced before the visitor left.
45
- */
33
+ /** Deploy an already-zipped archive — the resume path for a stashed drop (see `buildStash`). */
46
34
  export declare function deployZippedBuild(client: BuildClient, { file: zip, buildSettings }: ZipResult, opts?: BuildDeployOptions): Promise<BuildDeployResult>;
@@ -2,23 +2,15 @@ import { ProcessedFile } from './types';
2
2
  /** Why a drop was judged to need a build — surfaced to analytics and `onBuildRequired`. */
3
3
  export type BuildReason = 'netlify-toml-build' | 'package-json-build-script' | 'framework-dependency' | 'functions-directory';
4
4
  export interface BuildDetection {
5
- /** True when the dropped project needs a build step and can't be served as static files. */
5
+ /** The drop can't be served as static files. */
6
6
  buildRequired: boolean;
7
7
  /** The signal that decided it (first match wins), or null for a plain static drop. */
8
8
  reason: BuildReason | null;
9
9
  }
10
10
  /**
11
- * Decide whether a dropped project needs a build. Runs on the already-read,
12
- * root-normalized `ProcessedFile[]` (a dropped `.zip` is expanded and the common
13
- * root folder stripped upstream in `readFiles`), so build config sits at the
14
- * deploy root, e.g. `/netlify.toml`, `/package.json`.
15
- *
16
- * The anonymous drop API only performs static deploys, so a build-required
17
- * project can't go through it — the consumer redirects such drops to the
18
- * authenticated Drop page instead. This heuristic is deliberately lightweight
19
- * (no framework-detection dependency): it reads the two config files and looks
20
- * for the zero-config functions directories. A plain static site (HTML/CSS/JS,
21
- * no build config) returns `{ buildRequired: false }`.
11
+ * Does this drop need a build? Deliberately lightweight (two config files +
12
+ * the functions dirs; no framework-detection dependency). Input is
13
+ * root-normalized by `readFiles`, so config sits at `/netlify.toml` etc.
22
14
  */
23
15
  export declare function detectBuild(files: ProcessedFile[]): BuildDetection;
24
16
  /** Build settings confident enough to write into a `netlify.toml` for buildbot. */
@@ -31,19 +23,9 @@ export interface InferredBuildSettings {
31
23
  framework: string;
32
24
  }
33
25
  /**
34
- * Infer the build command and publish directory for a build-required drop, so
35
- * `zipFiles` can write them into a `netlify.toml` that buildbot reads.
36
- *
37
- * Deliberately conservative: it returns settings **only** when both halves are
38
- * known — a `build` script (which gives the command) and a recognised framework
39
- * with a fixed default publish directory (which gives the output). Anything else
40
- * returns `null`, leaving the zip without a synthesised `[build]` table so
41
- * buildbot's own framework detection resolves the settings instead. That matters
42
- * because a `[build]` table with a command but no `publish` makes buildbot
43
- * publish the deploy root — shipping the project's *source* rather than its
44
- * built output, which is worse than not guessing at all.
45
- *
46
- * Returns `null` too when the drop already declares a `[build]` table: the
47
- * author's own config always wins.
26
+ * Build settings for the synthesised netlify.toml — only when BOTH halves are
27
+ * known (build script → command, known framework → publish). Guessing publish
28
+ * wrong ships source instead of output, so `null` beats a bad guess. An
29
+ * author-declared [build] table always wins (also `null`).
48
30
  */
49
31
  export declare function inferBuildSettings(files: ProcessedFile[]): InferredBuildSettings | null;
@@ -1,33 +1,22 @@
1
1
  /**
2
- * Thrown when the user drops or picks a single loose file that Drop can't turn
3
- * into a site on its own — anything that isn't a `.zip` (a site archive) or an
4
- * HTML page (served as index.html). A folder, multiple files, a zip, or a lone
5
- * HTML file are all fine; any other single file is rejected rather than
6
- * deployed as a one-asset site (matches react-ui).
2
+ * A single loose file that can't stand up a site — only a zip, folder,
3
+ * multiple files, or a lone HTML page may deploy (matches react-ui).
7
4
  */
8
5
  export declare class UnsupportedDropError extends Error {
9
6
  readonly code = "unsupported-drop";
10
7
  constructor();
11
8
  }
12
9
  /**
13
- * Thrown when an authenticated path (static or build) turns out to have no
14
- * usable session — the short-lived upload token came back empty, or the
15
- * session-cookie site create was refused, so nothing was created. For static
16
- * drops the flow falls back to the anonymous drop + claim; builds have no
17
- * anonymous equivalent, so the consumer's only recourse is to send the visitor
18
- * through login/signup and have them drop again.
10
+ * The pre-mutation "no session" signal: nothing was created yet, so static
11
+ * drops may fall back to the anonymous flow and build drops stash + hand off.
19
12
  */
20
13
  export declare class NotAuthenticatedError extends Error {
21
14
  readonly code = "not-authenticated";
22
15
  constructor(message?: string);
23
16
  }
24
17
  /**
25
- * Whether an error is the pre-mutation "no session" signal, however it
26
- * traveled. This package ships as both raw TypeScript (`./components`) and
27
- * compiled dist (`./preact`, `./drop-core`), so two copies of the class can
28
- * coexist in one app and defeat `instanceof` — the `code` brand is the
29
- * copy-proof fallback. Control flow that decides whether an anonymous retry
30
- * is safe must use this, never a bare `instanceof`.
18
+ * Copy-proof check for the "no session" error — `instanceof` misses class
19
+ * copies from the package's other entrypoint. Fallback gates must use this.
31
20
  */
32
21
  export declare function isNotAuthenticatedError(err: unknown): err is NotAuthenticatedError;
33
22
  /** `POST …/sites` failed, so there is nothing to build into. Carries the HTTP status. */
@@ -45,12 +34,7 @@ export declare class BuildCreateError extends Error {
45
34
  status?: number;
46
35
  constructor(status?: number);
47
36
  }
48
- /**
49
- * The build ran and ended in `error`/`rejected`. `reason` is the API's
50
- * `error_message` when there is one — it's the only part of a build failure that
51
- * says anything actionable (a failing build command, a missing dependency), so
52
- * it is surfaced to the user rather than swallowed.
53
- */
37
+ /** The build ran and broke. `reason` carries the API's `error_message` — the only actionable part. */
54
38
  export declare class BuildFailedError extends Error {
55
39
  reason?: string | undefined;
56
40
  readonly code = "build-failed";
@@ -61,10 +45,7 @@ export declare class BuildTimeoutError extends Error {
61
45
  readonly code = "build-timeout";
62
46
  constructor();
63
47
  }
64
- /**
65
- * A static deploy ran and ended in `error`/`rejected`. Like a build failure,
66
- * the API's `error_message` is the actionable part, so it travels on the error.
67
- */
48
+ /** A static deploy ran and ended in `error`/`rejected`; `reason` carries the API's `error_message`. */
68
49
  export declare class DeployFailedError extends Error {
69
50
  reason?: string | undefined;
70
51
  readonly code = "deploy-failed";
@@ -1,17 +1,7 @@
1
1
  /**
2
- * Distinct MIME types across a drop or file-picker selection, sorted so the same
3
- * selection always yields the same array.
4
- *
5
- * Read from the raw `File.type` at the drop boundary rather than from
6
- * `ProcessedFile`s: the MIME type only exists on the original `File`, and reading
7
- * can throw before any `ProcessedFile` does (an unsupported single file) — the
8
- * very case the file type is most worth knowing about.
9
- *
10
- * Browsers leave `File.type` empty for anything they don't recognise — a dragged
11
- * folder, an `.exe`, an extensionless file — so those collapse to
12
- * `application/octet-stream` and the property never carries an empty string.
13
- *
14
- * Call this synchronously inside the drop handler: a `DataTransfer` detaches once
15
- * the event turn ends.
2
+ * Distinct, sorted MIME types of a selection. Read at the drop boundary — the
3
+ * type only exists on the original File, and reading can throw before any
4
+ * ProcessedFile exists. Call synchronously in the drop handler: a DataTransfer
5
+ * detaches after the event turn.
16
6
  */
17
7
  export declare function getFileTypes(files: FileList | null | undefined): string[];
@@ -1,21 +1,15 @@
1
1
  import { ProcessedFile } from './types';
2
2
  /**
3
- * Read a DataTransfer from a drop event into ProcessedFiles.
4
- *
5
- * NOTE: `webkitGetAsEntry()` must be called synchronously inside the drop
6
- * handler — the DataTransfer is detached once the event turn ends. The
7
- * component captures entries first (see `readDroppedEntries`) then calls the
8
- * async readers, so this function is safe to `await`.
3
+ * Read a drop's DataTransfer into ProcessedFiles. `webkitGetAsEntry()` runs
4
+ * synchronously before the first await — the DataTransfer detaches once the
5
+ * event turn ends.
9
6
  */
10
7
  export declare function readDataTransfer(dt: DataTransfer): Promise<ProcessedFile[]>;
11
8
  export declare function readFileList(files: FileList): Promise<ProcessedFile[]>;
12
9
  export declare function getSingleNonIndexHtmlFileName(files: ProcessedFile[]): string | null;
13
10
  export declare function hasMultipleHtmlFilesWithoutIndex(files: ProcessedFile[]): boolean;
14
11
  /**
15
- * When the set has no index.html but exactly one HTML file (a lone page
16
- * alongside its assets, or a single dropped file), rename that file to
17
- * index.html — keeping its directory — so it is served at the site root
18
- * instead of 404ing. Content and sha are untouched. Any other set (already has
19
- * an index, multiple HTML files, or no HTML) is returned unchanged.
12
+ * A lone non-index HTML page is renamed to index.html (same directory,
13
+ * content/sha untouched) so it serves instead of 404ing. Other sets unchanged.
20
14
  */
21
15
  export declare function renameSingleNonIndexHtmlToIndex(files: ProcessedFile[]): ProcessedFile[];
@@ -9,10 +9,8 @@ export interface ProcessedFile {
9
9
  }
10
10
  export type Digest = Record<string, string>;
11
11
  /**
12
- * Response body of `POST /api/v1/drop`. Not a canonical Deploy resource —
13
- * it's a mixed shape carrying both the anonymous site and the initial deploy
14
- * so the client has everything it needs to upload, poll, and hand off to the
15
- * user in one round trip.
12
+ * Response of `POST /api/v1/drop` — a mixed site+deploy shape, everything the
13
+ * client needs to upload, poll, and hand off in one round trip.
16
14
  */
17
15
  export interface DropResponse {
18
16
  /** site id (UUID) — surfaced to callers so they can build claim links */
@@ -1,46 +1,23 @@
1
1
  import { InferredBuildSettings } from './detectBuild';
2
2
  import { ProcessedFile } from './types';
3
- /**
4
- * Render inferred settings as a `[build]` table. Only `command` and `publish`
5
- * are written: everything else (functions directory, plugins, node version)
6
- * is zero-config on Netlify's side and guessing at it would override detection
7
- * that is better informed than we are.
8
- */
3
+ /** Renders a [build] table — command and publish only; everything else is zero-config server-side. */
9
4
  export declare function generateNetlifyToml({ command, publish }: InferredBuildSettings): string;
10
5
  export interface ZipOptions {
11
6
  /** Filename given to the produced `File`. Shows up as the build's source archive. */
12
7
  name?: string;
13
- /**
14
- * Synthesise a `netlify.toml` `[build]` table from `inferBuildSettings` when the
15
- * drop doesn't declare one (default `true`). Set `false` to upload the files
16
- * exactly as dropped and let buildbot resolve every setting itself.
17
- */
8
+ /** Synthesise a [build] table when the drop lacks one (default true); false uploads as-dropped. */
18
9
  synthesizeNetlifyToml?: boolean;
19
10
  }
20
11
  export interface ZipResult {
21
12
  /** The archive, ready to hand to `createBuildFromZip`. */
22
13
  file: File;
23
- /**
24
- * The settings written into `netlify.toml`, or `null` when the archive is a
25
- * faithful copy of the drop — either because it already declared a `[build]`
26
- * table, or because nothing could be inferred with confidence.
27
- */
14
+ /** Settings written into netlify.toml, or null when the archive is a faithful copy. */
28
15
  buildSettings: InferredBuildSettings | null;
29
16
  }
30
17
  /**
31
- * Zip an already-read file set into the source archive that
32
- * `POST /sites/{id}/builds` expects.
33
- *
34
- * The input is the same root-normalized `ProcessedFile[]` the static deploy path
35
- * uses (see `readFiles`), so junk — dotfiles, `node_modules`, macOS metadata — is
36
- * already gone and paths sit at the deploy root. Output directories (`dist/`,
37
- * `build/`) are deliberately *not* stripped: buildbot regenerates them when
38
- * there's a build command, and a drop whose `netlify.toml` publishes a committed
39
- * directory without a command would break if we removed it.
40
- *
41
- * When the drop needs a build but declares no `[build]` table, an inferred one is
42
- * written in (appended to an existing `netlify.toml`, or created if there is
43
- * none) so buildbot doesn't publish the project's source. See
44
- * `inferBuildSettings` for how conservative that inference is.
18
+ * Zip a read file set into the archive `POST /sites/{id}/builds` expects.
19
+ * Junk is already gone (readFiles); dist/build are deliberately kept — a drop
20
+ * publishing a committed directory without a command would break without them.
21
+ * A [build] table is synthesised when missing (appended, so redirects survive).
45
22
  */
46
23
  export declare function zipFiles(files: ProcessedFile[], { name, synthesizeNetlifyToml }?: ZipOptions): Promise<ZipResult>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@netlify/spark-ui",
3
3
  "description": "Assets, design tokens, components, and utilities",
4
- "version": "1.31.0-alpha.5",
4
+ "version": "1.31.0-alpha.6",
5
5
  "type": "module",
6
6
  "main": "dist/components/preact/index.js",
7
7
  "types": "dist/components/preact/index.d.ts",