@netlify/spark-ui 1.31.0-alpha.4 → 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 (53) hide show
  1. package/README.md +3 -4
  2. package/dist/components/preact/DropZone/DropZone.d.ts +23 -98
  3. package/dist/components/preact/DropZone/DropZone.js +5 -5
  4. package/dist/components/preact/DropZone/index.js +29 -29
  5. package/dist/components/preact/DropZone/useDropDeploy.d.ts +0 -1
  6. package/dist/components/preact/DropZone/useDropDeploy.js +25 -27
  7. package/dist/components/preact/index.js +10 -10
  8. package/dist/drop-core/analytics.d.ts +4 -15
  9. package/dist/drop-core/authedApi.d.ts +9 -32
  10. package/dist/drop-core/authedApi.js +15 -20
  11. package/dist/drop-core/authedDropClient.d.ts +15 -64
  12. package/dist/drop-core/authedDropClient.js +27 -49
  13. package/dist/drop-core/buildClient.d.ts +19 -53
  14. package/dist/drop-core/buildClient.js +32 -44
  15. package/dist/drop-core/buildStash.d.ts +6 -20
  16. package/dist/drop-core/client.d.ts +4 -2
  17. package/dist/drop-core/client.js +19 -17
  18. package/dist/drop-core/constants.d.ts +9 -0
  19. package/dist/drop-core/constants.js +10 -0
  20. package/dist/drop-core/deploy.d.ts +7 -17
  21. package/dist/drop-core/deploy.js +56 -43
  22. package/dist/drop-core/detectBuild.d.ts +8 -26
  23. package/dist/drop-core/errors.d.ts +27 -17
  24. package/dist/drop-core/errors.js +70 -33
  25. package/dist/drop-core/fileTypes.d.ts +4 -14
  26. package/dist/drop-core/index.d.ts +22 -11
  27. package/dist/drop-core/index.js +45 -49
  28. package/dist/drop-core/readFiles.d.ts +5 -11
  29. package/dist/drop-core/types.d.ts +2 -4
  30. package/dist/drop-core/zip.d.ts +7 -30
  31. package/package.json +1 -1
  32. package/packages/components/preact/DropZone/DropZone.tsx +27 -122
  33. package/packages/components/preact/DropZone/useDropDeploy.ts +31 -73
  34. package/packages/drop-core/README.md +91 -0
  35. package/packages/drop-core/analytics.ts +4 -15
  36. package/packages/drop-core/authedApi.ts +9 -35
  37. package/packages/drop-core/authedDropClient.ts +23 -86
  38. package/packages/drop-core/buildClient.test.ts +19 -4
  39. package/packages/drop-core/buildClient.ts +23 -66
  40. package/packages/drop-core/buildStash.ts +9 -25
  41. package/packages/drop-core/client.ts +19 -11
  42. package/packages/drop-core/constants.ts +25 -0
  43. package/packages/drop-core/deploy.test.ts +42 -0
  44. package/packages/drop-core/deploy.ts +42 -22
  45. package/packages/drop-core/detectBuild.ts +15 -50
  46. package/packages/drop-core/errors.test.ts +34 -3
  47. package/packages/drop-core/errors.ts +63 -27
  48. package/packages/drop-core/fileTypes.ts +5 -19
  49. package/packages/drop-core/index.ts +41 -11
  50. package/packages/drop-core/readFiles.test.ts +0 -1
  51. package/packages/drop-core/readFiles.ts +5 -12
  52. package/packages/drop-core/types.ts +2 -4
  53. package/packages/drop-core/zip.ts +7 -30
@@ -11,10 +11,8 @@ export interface ProcessedFile {
11
11
  export type Digest = Record<string, string>; // { "/index.html": "<sha1>" }
12
12
 
13
13
  /**
14
- * Response body of `POST /api/v1/drop`. Not a canonical Deploy resource —
15
- * it's a mixed shape carrying both the anonymous site and the initial deploy
16
- * so the client has everything it needs to upload, poll, and hand off to the
17
- * user in one round trip.
14
+ * Response of `POST /api/v1/drop` — a mixed site+deploy shape, everything the
15
+ * client needs to upload, poll, and hand off in one round trip.
18
16
  */
19
17
  export interface DropResponse {
20
18
  /** site id (UUID) — surfaced to callers so they can build claim links */
@@ -13,12 +13,7 @@ function escapeTomlString(value: string): string {
13
13
  .replace(/\t/g, '\\t');
14
14
  }
15
15
 
16
- /**
17
- * Render inferred settings as a `[build]` table. Only `command` and `publish`
18
- * are written: everything else (functions directory, plugins, node version)
19
- * is zero-config on Netlify's side and guessing at it would override detection
20
- * that is better informed than we are.
21
- */
16
+ /** Renders a [build] table — command and publish only; everything else is zero-config server-side. */
22
17
  export function generateNetlifyToml({ command, publish }: InferredBuildSettings): string {
23
18
  return [
24
19
  '[build]',
@@ -31,22 +26,14 @@ export function generateNetlifyToml({ command, publish }: InferredBuildSettings)
31
26
  export interface ZipOptions {
32
27
  /** Filename given to the produced `File`. Shows up as the build's source archive. */
33
28
  name?: string;
34
- /**
35
- * Synthesise a `netlify.toml` `[build]` table from `inferBuildSettings` when the
36
- * drop doesn't declare one (default `true`). Set `false` to upload the files
37
- * exactly as dropped and let buildbot resolve every setting itself.
38
- */
29
+ /** Synthesise a [build] table when the drop lacks one (default true); false uploads as-dropped. */
39
30
  synthesizeNetlifyToml?: boolean;
40
31
  }
41
32
 
42
33
  export interface ZipResult {
43
34
  /** The archive, ready to hand to `createBuildFromZip`. */
44
35
  file: File;
45
- /**
46
- * The settings written into `netlify.toml`, or `null` when the archive is a
47
- * faithful copy of the drop — either because it already declared a `[build]`
48
- * table, or because nothing could be inferred with confidence.
49
- */
36
+ /** Settings written into netlify.toml, or null when the archive is a faithful copy. */
50
37
  buildSettings: InferredBuildSettings | null;
51
38
  }
52
39
 
@@ -58,20 +45,10 @@ function toBytes(content: ArrayBuffer): Uint8Array {
58
45
  }
59
46
 
60
47
  /**
61
- * Zip an already-read file set into the source archive that
62
- * `POST /sites/{id}/builds` expects.
63
- *
64
- * The input is the same root-normalized `ProcessedFile[]` the static deploy path
65
- * uses (see `readFiles`), so junk — dotfiles, `node_modules`, macOS metadata — is
66
- * already gone and paths sit at the deploy root. Output directories (`dist/`,
67
- * `build/`) are deliberately *not* stripped: buildbot regenerates them when
68
- * there's a build command, and a drop whose `netlify.toml` publishes a committed
69
- * directory without a command would break if we removed it.
70
- *
71
- * When the drop needs a build but declares no `[build]` table, an inferred one is
72
- * written in (appended to an existing `netlify.toml`, or created if there is
73
- * none) so buildbot doesn't publish the project's source. See
74
- * `inferBuildSettings` for how conservative that inference is.
48
+ * Zip a read file set into the archive `POST /sites/{id}/builds` expects.
49
+ * Junk is already gone (readFiles); dist/build are deliberately kept — a drop
50
+ * publishing a committed directory without a command would break without them.
51
+ * A [build] table is synthesised when missing (appended, so redirects survive).
75
52
  */
76
53
  export async function zipFiles(
77
54
  files: ProcessedFile[],