@netlify/spark-ui 1.31.0-alpha.4 → 1.31.0-alpha.5
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/components/preact/DropZone/DropZone.d.ts +6 -7
- package/dist/components/preact/DropZone/DropZone.js +5 -5
- package/dist/components/preact/DropZone/index.js +29 -29
- package/dist/components/preact/DropZone/useDropDeploy.d.ts +0 -1
- package/dist/components/preact/DropZone/useDropDeploy.js +25 -27
- package/dist/components/preact/index.js +10 -10
- package/dist/drop-core/authedApi.d.ts +0 -10
- package/dist/drop-core/authedApi.js +15 -20
- package/dist/drop-core/authedDropClient.d.ts +4 -11
- package/dist/drop-core/authedDropClient.js +24 -33
- package/dist/drop-core/buildClient.js +17 -16
- package/dist/drop-core/client.d.ts +3 -1
- package/dist/drop-core/client.js +19 -17
- package/dist/drop-core/constants.d.ts +29 -0
- package/dist/drop-core/constants.js +10 -0
- package/dist/drop-core/deploy.d.ts +2 -0
- package/dist/drop-core/deploy.js +56 -43
- package/dist/drop-core/errors.d.ts +29 -0
- package/dist/drop-core/errors.js +70 -33
- package/dist/drop-core/index.d.ts +22 -11
- package/dist/drop-core/index.js +45 -49
- package/package.json +1 -1
- package/packages/components/preact/DropZone/DropZone.tsx +6 -7
- package/packages/components/preact/DropZone/useDropDeploy.ts +13 -22
- package/packages/drop-core/README.md +91 -0
- package/packages/drop-core/authedApi.ts +0 -13
- package/packages/drop-core/authedDropClient.ts +12 -33
- package/packages/drop-core/buildClient.ts +2 -3
- package/packages/drop-core/client.ts +18 -6
- package/packages/drop-core/constants.ts +39 -0
- package/packages/drop-core/deploy.test.ts +42 -0
- package/packages/drop-core/deploy.ts +41 -5
- package/packages/drop-core/errors.test.ts +32 -3
- package/packages/drop-core/errors.ts +67 -10
- package/packages/drop-core/index.ts +41 -11
- package/packages/drop-core/readFiles.test.ts +0 -1
package/dist/drop-core/client.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { DEFAULT_API_BASE as p, DEFAULT_POLL_INTERVAL_MS as l, DEFAULT_TIMEOUT_MS as h } from "./constants.js";
|
|
2
|
+
import { DeployTimeoutError as d } from "./errors.js";
|
|
3
|
+
function i(r, t) {
|
|
4
|
+
return Object.assign(new Error(`${r} failed: ${t}`), { status: t });
|
|
3
5
|
}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
this.apiBase = t;
|
|
6
|
+
class y {
|
|
7
|
+
constructor(t = p, o = l, e = h) {
|
|
8
|
+
this.apiBase = t, this.pollIntervalMs = o, this.timeoutMs = e;
|
|
8
9
|
}
|
|
9
10
|
async getToken() {
|
|
10
11
|
const t = await fetch(`${this.apiBase}/drop/token`, { method: "POST" });
|
|
11
|
-
if (!t.ok) throw
|
|
12
|
+
if (!t.ok) throw i("drop/token", t.status);
|
|
12
13
|
return (await t.json()).token;
|
|
13
14
|
}
|
|
14
15
|
async createDeploy(t, o) {
|
|
@@ -17,29 +18,30 @@ class p {
|
|
|
17
18
|
headers: { "Content-Type": "application/json" },
|
|
18
19
|
body: JSON.stringify({ files: t, token: o })
|
|
19
20
|
});
|
|
20
|
-
if (!e.ok) throw
|
|
21
|
+
if (!e.ok) throw i("drop", e.status);
|
|
21
22
|
return e.json();
|
|
22
23
|
}
|
|
23
24
|
async uploadFile(t, o, e, a) {
|
|
24
|
-
const
|
|
25
|
+
const s = await fetch(`${this.apiBase}/deploys/${t}/files${o}`, {
|
|
25
26
|
method: "PUT",
|
|
26
27
|
headers: { "Content-Type": "application/octet-stream", Authorization: `Bearer ${a}` },
|
|
27
28
|
body: e
|
|
28
29
|
});
|
|
29
|
-
if (!
|
|
30
|
+
if (!s.ok) throw i(`upload ${o}`, s.status);
|
|
30
31
|
}
|
|
31
32
|
async waitUntilReady(t, o) {
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
const e = this.timeoutMs / this.pollIntervalMs;
|
|
34
|
+
for (let a = 0; a < e; a++) {
|
|
35
|
+
const s = await fetch(`${this.apiBase}/deploys/${t.deploy_id}`, {
|
|
34
36
|
headers: { Authorization: `Bearer ${o}` }
|
|
35
37
|
});
|
|
36
|
-
if (
|
|
37
|
-
await new Promise((
|
|
38
|
+
if (s.ok && (await s.json()).state === "ready") return;
|
|
39
|
+
await new Promise((n) => setTimeout(n, this.pollIntervalMs));
|
|
38
40
|
}
|
|
39
|
-
throw new
|
|
41
|
+
throw new d();
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
44
|
export {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
y as AnonymousDropClient,
|
|
46
|
+
i as apiError
|
|
45
47
|
};
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
*/
|
|
12
|
+
export declare const DEFAULT_PROXY_BASE = "/access-control/bb-api/api/v1";
|
|
13
|
+
/** Direct api.netlify.com root for the uploads the proxy's ~6MB Lambda body limit can't carry. */
|
|
14
|
+
export declare const DEFAULT_API_BASE = "https://api.netlify.com/api/v1";
|
|
15
|
+
export declare const DEFAULT_POLL_INTERVAL_MS = 1000;
|
|
16
|
+
export declare const DEFAULT_TIMEOUT_MS: number;
|
|
17
|
+
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
|
+
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
|
+
export declare const UPLOAD_RETRY_DELAYS_MS: readonly number[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const _ = "/access-control/bb-api/api/v1", E = "https://api.netlify.com/api/v1", t = 1e3, A = 6e5, c = 5, o = 2e4, s = [1e3, 2e3, 3e3];
|
|
2
|
+
export {
|
|
3
|
+
E as DEFAULT_API_BASE,
|
|
4
|
+
t as DEFAULT_POLL_INTERVAL_MS,
|
|
5
|
+
_ as DEFAULT_PROXY_BASE,
|
|
6
|
+
A as DEFAULT_TIMEOUT_MS,
|
|
7
|
+
c as MAX_CONCURRENT_UPLOADS,
|
|
8
|
+
o as TOKEN_REUSE_MS,
|
|
9
|
+
s as UPLOAD_RETRY_DELAYS_MS
|
|
10
|
+
};
|
|
@@ -5,6 +5,8 @@ import { DeployProgress, DeployResult, ProcessedFile } from './types';
|
|
|
5
5
|
import { ZipResult } from './zip';
|
|
6
6
|
export interface DeployOptions {
|
|
7
7
|
onProgress?: (e: DeployProgress) => void;
|
|
8
|
+
/** Waits between retries of a failed file upload. Override for tests or a different curve. */
|
|
9
|
+
retryDelays?: readonly number[];
|
|
8
10
|
}
|
|
9
11
|
export declare function deployFiles(client: DropClient, files: ProcessedFile[], opts?: DeployOptions): Promise<DeployResult>;
|
|
10
12
|
export interface BuildDeployResult {
|
package/dist/drop-core/deploy.js
CHANGED
|
@@ -1,53 +1,66 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
let u = 0
|
|
1
|
+
import { UPLOAD_RETRY_DELAYS_MS as w, MAX_CONCURRENT_UPLOADS as o } from "./constants.js";
|
|
2
|
+
import { getDigest as y } from "./digest.js";
|
|
3
|
+
import { zipFiles as f } from "./zip.js";
|
|
4
|
+
const s = /* @__PURE__ */ new Set([400, 422]);
|
|
5
|
+
async function m(e, l, n, t, a) {
|
|
6
|
+
for (let u = 0; ; u++)
|
|
7
|
+
try {
|
|
8
|
+
await e.uploadFile(l, n.path, n.content, t);
|
|
9
|
+
return;
|
|
10
|
+
} catch (i) {
|
|
11
|
+
const p = i.status;
|
|
12
|
+
if (p !== void 0 && s.has(p) || u >= a.length) throw i;
|
|
13
|
+
await new Promise((h) => setTimeout(h, a[u]));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
async function R(e, l, n, t, a, u, i) {
|
|
17
|
+
const p = n.filter((c) => t.has(c.sha));
|
|
18
|
+
let h = 0, r = 0;
|
|
7
19
|
const d = async () => {
|
|
8
|
-
for (;
|
|
9
|
-
const
|
|
10
|
-
await
|
|
20
|
+
for (; h < p.length; ) {
|
|
21
|
+
const c = p[h++];
|
|
22
|
+
await m(e, l, c, a, u), i == null || i(++r);
|
|
11
23
|
}
|
|
12
24
|
};
|
|
13
|
-
await Promise.all(Array.from({ length: Math.min(
|
|
25
|
+
await Promise.all(Array.from({ length: Math.min(o, p.length) }, d));
|
|
14
26
|
}
|
|
15
|
-
async function
|
|
16
|
-
if (!
|
|
17
|
-
const { onProgress: a } =
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
return
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
new Set(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
async function T(e, l, n = {}) {
|
|
28
|
+
if (!l.length) throw new Error("No files to deploy");
|
|
29
|
+
const { onProgress: t, retryDelays: a = w } = n;
|
|
30
|
+
t == null || t({ phase: "creating" });
|
|
31
|
+
const u = await e.getToken(), i = await e.createDeploy(y(l), u), p = i.required.length;
|
|
32
|
+
return t == null || t({ phase: "uploading", uploaded: 0, total: p }), await R(
|
|
33
|
+
e,
|
|
34
|
+
i.deploy_id,
|
|
35
|
+
l,
|
|
36
|
+
new Set(i.required),
|
|
37
|
+
u,
|
|
38
|
+
a,
|
|
39
|
+
(h) => t == null ? void 0 : t({ phase: "uploading", uploaded: h, total: p })
|
|
40
|
+
), t == null || t({ phase: "processing" }), await e.waitUntilReady(i, u), t == null || t({ phase: "ready" }), { deploy: i, token: u, url: `https://${i.subdomain}.netlify.app` };
|
|
28
41
|
}
|
|
29
|
-
async function
|
|
30
|
-
var
|
|
31
|
-
if (!
|
|
32
|
-
(
|
|
33
|
-
const
|
|
34
|
-
return
|
|
42
|
+
async function B(e, l, n = {}) {
|
|
43
|
+
var a;
|
|
44
|
+
if (!l.length) throw new Error("No files to deploy");
|
|
45
|
+
(a = n.onProgress) == null || a.call(n, { phase: "zipping" });
|
|
46
|
+
const t = await f(l);
|
|
47
|
+
return S(e, t, n);
|
|
35
48
|
}
|
|
36
|
-
async function
|
|
37
|
-
const { onProgress:
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
return
|
|
43
|
-
site:
|
|
44
|
-
build:
|
|
45
|
-
buildSettings:
|
|
46
|
-
url:
|
|
49
|
+
async function S(e, { file: l, buildSettings: n }, t = {}) {
|
|
50
|
+
const { onProgress: a, waitForBuild: u = !1 } = t;
|
|
51
|
+
a == null || a({ phase: "creating" });
|
|
52
|
+
const i = await e.createSite();
|
|
53
|
+
a == null || a({ phase: "uploading" });
|
|
54
|
+
const p = await e.createBuildFromZip(i.id, l);
|
|
55
|
+
return a == null || a({ phase: "building" }), u && await e.waitUntilBuildReady(p), a == null || a({ phase: "ready" }), {
|
|
56
|
+
site: i,
|
|
57
|
+
build: p,
|
|
58
|
+
buildSettings: n,
|
|
59
|
+
url: i.ssl_url || i.url || `https://${i.name}.netlify.app`
|
|
47
60
|
};
|
|
48
61
|
}
|
|
49
62
|
export {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
63
|
+
B as deployBuild,
|
|
64
|
+
T as deployFiles,
|
|
65
|
+
S as deployZippedBuild
|
|
53
66
|
};
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* deployed as a one-asset site (matches react-ui).
|
|
7
7
|
*/
|
|
8
8
|
export declare class UnsupportedDropError extends Error {
|
|
9
|
+
readonly code = "unsupported-drop";
|
|
9
10
|
constructor();
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
@@ -17,10 +18,21 @@ export declare class UnsupportedDropError extends Error {
|
|
|
17
18
|
* through login/signup and have them drop again.
|
|
18
19
|
*/
|
|
19
20
|
export declare class NotAuthenticatedError extends Error {
|
|
21
|
+
readonly code = "not-authenticated";
|
|
20
22
|
constructor(message?: string);
|
|
21
23
|
}
|
|
24
|
+
/**
|
|
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`.
|
|
31
|
+
*/
|
|
32
|
+
export declare function isNotAuthenticatedError(err: unknown): err is NotAuthenticatedError;
|
|
22
33
|
/** `POST …/sites` failed, so there is nothing to build into. Carries the HTTP status. */
|
|
23
34
|
export declare class SiteCreateError extends Error {
|
|
35
|
+
readonly code = "site-create-failed";
|
|
24
36
|
status?: number;
|
|
25
37
|
constructor(status?: number);
|
|
26
38
|
}
|
|
@@ -29,6 +41,7 @@ export declare class SiteCreateError extends Error {
|
|
|
29
41
|
* started. Distinct from `BuildFailedError`, which is a build that ran and broke.
|
|
30
42
|
*/
|
|
31
43
|
export declare class BuildCreateError extends Error {
|
|
44
|
+
readonly code = "build-create-failed";
|
|
32
45
|
status?: number;
|
|
33
46
|
constructor(status?: number);
|
|
34
47
|
}
|
|
@@ -40,10 +53,26 @@ export declare class BuildCreateError extends Error {
|
|
|
40
53
|
*/
|
|
41
54
|
export declare class BuildFailedError extends Error {
|
|
42
55
|
reason?: string | undefined;
|
|
56
|
+
readonly code = "build-failed";
|
|
43
57
|
constructor(reason?: string | undefined);
|
|
44
58
|
}
|
|
45
59
|
/** The build hadn't settled before the poller gave up. The build itself may still finish. */
|
|
46
60
|
export declare class BuildTimeoutError extends Error {
|
|
61
|
+
readonly code = "build-timeout";
|
|
62
|
+
constructor();
|
|
63
|
+
}
|
|
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
|
+
*/
|
|
68
|
+
export declare class DeployFailedError extends Error {
|
|
69
|
+
reason?: string | undefined;
|
|
70
|
+
readonly code = "deploy-failed";
|
|
71
|
+
constructor(reason?: string | undefined);
|
|
72
|
+
}
|
|
73
|
+
/** The deploy hadn't gone ready before the poller gave up. It may still finish. */
|
|
74
|
+
export declare class DeployTimeoutError extends Error {
|
|
75
|
+
readonly code = "deploy-timeout";
|
|
47
76
|
constructor();
|
|
48
77
|
}
|
|
49
78
|
/**
|
package/dist/drop-core/errors.js
CHANGED
|
@@ -1,53 +1,87 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
class
|
|
1
|
+
var a = Object.defineProperty;
|
|
2
|
+
var n = (e, r, t) => r in e ? a(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
|
|
3
|
+
var o = (e, r, t) => n(e, typeof r != "symbol" ? r + "" : r, t);
|
|
4
|
+
class l extends Error {
|
|
5
5
|
constructor() {
|
|
6
|
-
super("unsupported single file")
|
|
6
|
+
super("unsupported single file");
|
|
7
|
+
o(this, "code", "unsupported-drop");
|
|
8
|
+
this.name = "UnsupportedDropError";
|
|
7
9
|
}
|
|
8
10
|
}
|
|
9
11
|
class s extends Error {
|
|
10
12
|
constructor(t = "not authenticated") {
|
|
11
|
-
super(t)
|
|
13
|
+
super(t);
|
|
14
|
+
o(this, "code", "not-authenticated");
|
|
15
|
+
this.name = "NotAuthenticatedError";
|
|
12
16
|
}
|
|
13
17
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
function u(e) {
|
|
19
|
+
return e instanceof s ? !0 : e instanceof Error && e.code === "not-authenticated";
|
|
20
|
+
}
|
|
21
|
+
class c extends Error {
|
|
22
|
+
constructor(t) {
|
|
23
|
+
super(`site create failed${t ? `: ${t}` : ""}`);
|
|
24
|
+
o(this, "code", "site-create-failed");
|
|
25
|
+
o(this, "status");
|
|
26
|
+
this.name = "SiteCreateError", this.status = t;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
class p extends Error {
|
|
30
|
+
constructor(t) {
|
|
31
|
+
super(`build create failed${t ? `: ${t}` : ""}`);
|
|
32
|
+
o(this, "code", "build-create-failed");
|
|
33
|
+
o(this, "status");
|
|
34
|
+
this.name = "BuildCreateError", this.status = t;
|
|
19
35
|
}
|
|
20
36
|
}
|
|
21
37
|
class f extends Error {
|
|
22
|
-
constructor(
|
|
23
|
-
super(`build
|
|
24
|
-
|
|
25
|
-
this.
|
|
38
|
+
constructor(t) {
|
|
39
|
+
super(t ? `build failed: ${t}` : "build failed");
|
|
40
|
+
o(this, "code", "build-failed");
|
|
41
|
+
this.reason = t, this.name = "BuildFailedError";
|
|
26
42
|
}
|
|
27
43
|
}
|
|
28
|
-
class
|
|
44
|
+
class y extends Error {
|
|
45
|
+
constructor() {
|
|
46
|
+
super("Build did not finish in time");
|
|
47
|
+
o(this, "code", "build-timeout");
|
|
48
|
+
this.name = "BuildTimeoutError";
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
class h extends Error {
|
|
29
52
|
constructor(t) {
|
|
30
|
-
super(t ? `
|
|
53
|
+
super(t ? `deploy failed: ${t}` : "deploy failed");
|
|
54
|
+
o(this, "code", "deploy-failed");
|
|
55
|
+
this.reason = t, this.name = "DeployFailedError";
|
|
31
56
|
}
|
|
32
57
|
}
|
|
33
|
-
class
|
|
58
|
+
class g extends Error {
|
|
34
59
|
constructor() {
|
|
35
|
-
super("
|
|
60
|
+
super("Deploy did not become ready in time");
|
|
61
|
+
o(this, "code", "deploy-timeout");
|
|
62
|
+
this.name = "DeployTimeoutError";
|
|
36
63
|
}
|
|
37
64
|
}
|
|
38
|
-
function
|
|
65
|
+
function m(e) {
|
|
39
66
|
if (!(e instanceof Error)) return "Something went wrong. Please try again.";
|
|
40
|
-
|
|
67
|
+
const r = e.code;
|
|
68
|
+
if (r === "unsupported-drop")
|
|
41
69
|
return "To deploy, drop a folder or a .zip file — or a single HTML page.";
|
|
42
|
-
if (
|
|
70
|
+
if (r === "not-authenticated")
|
|
43
71
|
return "Please log in to Netlify to deploy this project, then try again.";
|
|
44
|
-
if (
|
|
72
|
+
if (r === "site-create-failed")
|
|
45
73
|
return "We couldn't create a project for this build. Please try again.";
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
|
|
74
|
+
if (r === "build-failed") {
|
|
75
|
+
const i = e.reason;
|
|
76
|
+
return i ? `Your build failed: ${i}` : "Your build failed. Check your build settings and try again.";
|
|
77
|
+
}
|
|
78
|
+
if (r === "deploy-failed") {
|
|
79
|
+
const i = e.reason;
|
|
80
|
+
return i ? `Your deploy failed: ${i}` : "Your deploy failed. Please try again.";
|
|
81
|
+
}
|
|
82
|
+
if (r === "build-timeout")
|
|
49
83
|
return "Your build is taking longer than expected. It may still finish — check your Netlify dashboard.";
|
|
50
|
-
if (
|
|
84
|
+
if (r === "deploy-timeout")
|
|
51
85
|
return "Your site is taking longer than expected to go live. Please try again in a moment.";
|
|
52
86
|
if (e instanceof TypeError)
|
|
53
87
|
return "Couldn't connect to Netlify. Check your internet connection and try again.";
|
|
@@ -72,11 +106,14 @@ function h(e) {
|
|
|
72
106
|
}
|
|
73
107
|
}
|
|
74
108
|
export {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
109
|
+
p as BuildCreateError,
|
|
110
|
+
f as BuildFailedError,
|
|
111
|
+
y as BuildTimeoutError,
|
|
112
|
+
h as DeployFailedError,
|
|
113
|
+
g as DeployTimeoutError,
|
|
78
114
|
s as NotAuthenticatedError,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
115
|
+
c as SiteCreateError,
|
|
116
|
+
l as UnsupportedDropError,
|
|
117
|
+
m as humanizeDropError,
|
|
118
|
+
u as isNotAuthenticatedError
|
|
82
119
|
};
|
|
@@ -1,14 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The public surface of drop-core — nothing is public unless named here.
|
|
3
|
+
* `export *` is reserved for the three modules that are contracts in their
|
|
4
|
+
* entirety: types, errors, and the analytics event map.
|
|
5
|
+
*/
|
|
1
6
|
export * from './types';
|
|
2
|
-
export * from './digest';
|
|
3
|
-
export * from './readFiles';
|
|
4
|
-
export * from './fileTypes';
|
|
5
|
-
export * from './detectBuild';
|
|
6
|
-
export * from './client';
|
|
7
|
-
export * from './authedApi';
|
|
8
|
-
export * from './authedDropClient';
|
|
9
|
-
export * from './buildClient';
|
|
10
|
-
export * from './zip';
|
|
11
|
-
export * from './buildStash';
|
|
12
|
-
export * from './deploy';
|
|
13
7
|
export * from './errors';
|
|
14
8
|
export * from './analytics';
|
|
9
|
+
export { getSingleNonIndexHtmlFileName, hasMultipleHtmlFilesWithoutIndex, readDataTransfer, readFileList, renameSingleNonIndexHtmlToIndex, } from './readFiles';
|
|
10
|
+
export { getFileTypes } from './fileTypes';
|
|
11
|
+
export { detectBuild, inferBuildSettings } from './detectBuild';
|
|
12
|
+
export type { BuildDetection, BuildReason, InferredBuildSettings } from './detectBuild';
|
|
13
|
+
export { zipFiles } from './zip';
|
|
14
|
+
export type { ZipOptions, ZipResult } from './zip';
|
|
15
|
+
export { AnonymousDropClient } from './client';
|
|
16
|
+
export type { DropClient } from './client';
|
|
17
|
+
export { AuthenticatedDropClient } from './authedDropClient';
|
|
18
|
+
export type { AuthenticatedDropClientConfig } from './authedDropClient';
|
|
19
|
+
export { AuthenticatedBuildClient } from './buildClient';
|
|
20
|
+
export type { AuthenticatedBuildClientConfig, BuildClient, BuildResponse } from './buildClient';
|
|
21
|
+
export { deployBuild, deployFiles, deployZippedBuild } from './deploy';
|
|
22
|
+
export type { BuildDeployOptions, BuildDeployResult, DeployOptions } from './deploy';
|
|
23
|
+
export { clearDropStash, hasDropStashMarker, loadDropStash, saveDropStash } from './buildStash';
|
|
24
|
+
export type { DropBuildStash } from './buildStash';
|
|
25
|
+
export { DEFAULT_API_BASE, DEFAULT_PROXY_BASE, UPLOAD_RETRY_DELAYS_MS } from './constants';
|
package/dist/drop-core/index.js
CHANGED
|
@@ -1,51 +1,47 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { DROPZONE_EVENTS as G } from "./analytics.js";
|
|
1
|
+
import { BuildCreateError as o, BuildFailedError as t, BuildTimeoutError as i, DeployFailedError as l, DeployTimeoutError as p, NotAuthenticatedError as d, SiteCreateError as a, UnsupportedDropError as n, humanizeDropError as m, isNotAuthenticatedError as u } from "./errors.js";
|
|
2
|
+
import { DROPZONE_EVENTS as s } from "./analytics.js";
|
|
3
|
+
import { getSingleNonIndexHtmlFileName as D, hasMultipleHtmlFilesWithoutIndex as f, readDataTransfer as S, readFileList as h, renameSingleNonIndexHtmlToIndex as A } from "./readFiles.js";
|
|
4
|
+
import { getFileTypes as F } from "./fileTypes.js";
|
|
5
|
+
import { detectBuild as _, inferBuildSettings as y } from "./detectBuild.js";
|
|
6
|
+
import { zipFiles as c } from "./zip.js";
|
|
7
|
+
import { AnonymousDropClient as C } from "./client.js";
|
|
8
|
+
import { AuthenticatedDropClient as L } from "./authedDropClient.js";
|
|
9
|
+
import { AuthenticatedBuildClient as P } from "./buildClient.js";
|
|
10
|
+
import { deployBuild as U, deployFiles as H, deployZippedBuild as M } from "./deploy.js";
|
|
11
|
+
import { clearDropStash as z, hasDropStashMarker as Z, loadDropStash as k, saveDropStash as v } from "./buildStash.js";
|
|
12
|
+
import { DEFAULT_API_BASE as W, DEFAULT_PROXY_BASE as X, UPLOAD_RETRY_DELAYS_MS as b } from "./constants.js";
|
|
14
13
|
export {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
d as renameSingleNonIndexHtmlToIndex,
|
|
49
|
-
H as saveDropStash,
|
|
50
|
-
U as zipFiles
|
|
14
|
+
C as AnonymousDropClient,
|
|
15
|
+
P as AuthenticatedBuildClient,
|
|
16
|
+
L as AuthenticatedDropClient,
|
|
17
|
+
o as BuildCreateError,
|
|
18
|
+
t as BuildFailedError,
|
|
19
|
+
i as BuildTimeoutError,
|
|
20
|
+
W as DEFAULT_API_BASE,
|
|
21
|
+
X as DEFAULT_PROXY_BASE,
|
|
22
|
+
s as DROPZONE_EVENTS,
|
|
23
|
+
l as DeployFailedError,
|
|
24
|
+
p as DeployTimeoutError,
|
|
25
|
+
d as NotAuthenticatedError,
|
|
26
|
+
a as SiteCreateError,
|
|
27
|
+
b as UPLOAD_RETRY_DELAYS_MS,
|
|
28
|
+
n as UnsupportedDropError,
|
|
29
|
+
z as clearDropStash,
|
|
30
|
+
U as deployBuild,
|
|
31
|
+
H as deployFiles,
|
|
32
|
+
M as deployZippedBuild,
|
|
33
|
+
_ as detectBuild,
|
|
34
|
+
F as getFileTypes,
|
|
35
|
+
D as getSingleNonIndexHtmlFileName,
|
|
36
|
+
Z as hasDropStashMarker,
|
|
37
|
+
f as hasMultipleHtmlFilesWithoutIndex,
|
|
38
|
+
m as humanizeDropError,
|
|
39
|
+
y as inferBuildSettings,
|
|
40
|
+
u as isNotAuthenticatedError,
|
|
41
|
+
k as loadDropStash,
|
|
42
|
+
S as readDataTransfer,
|
|
43
|
+
h as readFileList,
|
|
44
|
+
A as renameSingleNonIndexHtmlToIndex,
|
|
45
|
+
v as saveDropStash,
|
|
46
|
+
c as zipFiles
|
|
51
47
|
};
|
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.
|
|
4
|
+
"version": "1.31.0-alpha.5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/components/preact/index.js",
|
|
7
7
|
"types": "dist/components/preact/index.d.ts",
|
|
@@ -64,12 +64,11 @@ interface Props {
|
|
|
64
64
|
*/
|
|
65
65
|
siteDashboardUrl?: (siteName: string) => string;
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* point at your own destination.
|
|
67
|
+
* The signup hand-off for a build-required drop that can't be built here (no
|
|
68
|
+
* session, or no build wiring). The drop is stashed on this origin first, so
|
|
69
|
+
* a flow that returns the visitor to this page deploys it automatically —
|
|
70
|
+
* see `resumeStashedBuilds`. Defaults to the app signup page with
|
|
71
|
+
* `next=/drop`.
|
|
73
72
|
*/
|
|
74
73
|
buildSignupUrl?: string;
|
|
75
74
|
/**
|
|
@@ -79,7 +78,7 @@ interface Props {
|
|
|
79
78
|
* build-required drops build in place instead of being handed off to the app.
|
|
80
79
|
* On netlify.com this reads `GET /access-control/generate-access-control-token`.
|
|
81
80
|
* Resolving `null` means "no session": static drops fall back to the anonymous
|
|
82
|
-
* claim flow
|
|
81
|
+
* claim flow; build drops are stashed and handed to `buildSignupUrl`.
|
|
83
82
|
* See [Logged-in visitors](#logged-in-visitors).
|
|
84
83
|
*/
|
|
85
84
|
getUploadToken?: () => Promise<string | null>;
|