@netlify/spark-ui 1.26.0-alpha.1 → 1.26.0-alpha.3
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/chunks/{AskNetlify.B3RnU2w-.js → AskNetlify.bx0blyGV.js} +1 -1
- package/dist/chunks/_commonjsHelpers.C6fGbg64.js +6 -0
- package/dist/chunks/browser.D58rdxmc.js +444 -0
- package/dist/components/preact/AskNetlify/AskNetlify.js +1 -1
- package/dist/components/preact/DropZone/drop-core/client.d.ts +5 -5
- package/dist/components/preact/DropZone/drop-core/client.js +1 -1
- package/dist/components/preact/DropZone/drop-core/readFiles.js +276 -275
- package/dist/components/preact/DropZone/drop-core/types.d.ts +11 -2
- package/dist/components/preact/SearchModal/components/SearchModal/SearchModal.js +1 -1
- package/dist/components/preact/index.js +1 -1
- package/package.json +2 -2
- package/packages/components/preact/DropZone/drop-core/client.ts +9 -6
- package/packages/components/preact/DropZone/drop-core/readFiles.ts +12 -9
- package/packages/components/preact/DropZone/drop-core/types.ts +11 -2
- package/dist/chunks/_commonjsHelpers.DaMA6jEr.js +0 -8
- package/dist/chunks/jszip.min.DGG1sjYa.js +0 -2327
|
@@ -8,8 +8,17 @@ export interface ProcessedFile {
|
|
|
8
8
|
name: string;
|
|
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.
|
|
16
|
+
*/
|
|
17
|
+
export interface DropResponse {
|
|
18
|
+
/** site id (UUID) — surfaced to callers so they can build claim links */
|
|
12
19
|
id: string;
|
|
20
|
+
/** deploy id (BSON) — used for `/deploys/{deploy_id}` reads and file PUTs */
|
|
21
|
+
deploy_id: string;
|
|
13
22
|
/** the *.netlify.app subdomain assigned to the anonymous site */
|
|
14
23
|
subdomain: string;
|
|
15
24
|
/** SHAs the backend does NOT yet have — only these get uploaded */
|
|
@@ -17,7 +26,7 @@ export interface Deploy {
|
|
|
17
26
|
state?: string;
|
|
18
27
|
}
|
|
19
28
|
export interface DeployResult {
|
|
20
|
-
deploy:
|
|
29
|
+
deploy: DropResponse;
|
|
21
30
|
/** drop token — persist this to later claim the site into an account */
|
|
22
31
|
token: string;
|
|
23
32
|
url: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { u as e } from "../../../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
|
|
2
2
|
import { A as g, y as f, d } from "../../../../../chunks/hooks.module.DRcxknIz.js";
|
|
3
|
-
import { A as L, K as P } from "../../../../../chunks/AskNetlify.
|
|
3
|
+
import { A as L, K as P } from "../../../../../chunks/AskNetlify.bx0blyGV.js";
|
|
4
4
|
import M from "../../../Modal/Modal.js";
|
|
5
5
|
import h from "../../../KeyboardKey/KeyboardKey.js";
|
|
6
6
|
import O from "../SearchWindow.js";
|
|
@@ -4,7 +4,7 @@ import { default as m } from "./Icon/index.js";
|
|
|
4
4
|
import { default as s } from "./SearchModal/components/SearchLink/SearchLink.js";
|
|
5
5
|
import { default as u } from "./SearchModal/components/SearchHeading/SearchHeading.js";
|
|
6
6
|
import { default as i } from "./SearchModal/components/SearchToggle/SearchToggle.js";
|
|
7
|
-
import { A as S } from "../../chunks/AskNetlify.
|
|
7
|
+
import { A as S } from "../../chunks/AskNetlify.bx0blyGV.js";
|
|
8
8
|
import "preact";
|
|
9
9
|
import "../../chunks/hooks.module.DRcxknIz.js";
|
|
10
10
|
import { default as n } from "./SearchModal/components/SearchModal/SearchModal.js";
|
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.26.0-alpha.
|
|
4
|
+
"version": "1.26.0-alpha.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/components/preact/index.js",
|
|
7
7
|
"types": "dist/components/preact/index.d.ts",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@astro-community/astro-embed-youtube": "^0.5.10",
|
|
40
40
|
"@kapaai/react-sdk": "^0.9.0",
|
|
41
41
|
"@shikijs/transformers": "^3.3.0",
|
|
42
|
-
"
|
|
42
|
+
"fflate": "^0.8.2",
|
|
43
43
|
"marked": "^15.0.11",
|
|
44
44
|
"rusha": "^0.8.14"
|
|
45
45
|
},
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DropResponse, Digest } from './types';
|
|
2
2
|
|
|
3
3
|
export interface DropClient {
|
|
4
4
|
getToken(): Promise<string>;
|
|
5
|
-
createDeploy(digest: Digest, token: string): Promise<
|
|
5
|
+
createDeploy(digest: Digest, token: string): Promise<DropResponse>;
|
|
6
6
|
uploadFile(deployId: string, path: string, content: ArrayBuffer, token: string): Promise<void>;
|
|
7
|
-
waitUntilReady(deploy:
|
|
7
|
+
waitUntilReady(deploy: DropResponse, token: string): Promise<void>;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
const API = 'https://api.netlify.com/api/v1';
|
|
@@ -22,7 +22,7 @@ export class AnonymousDropClient implements DropClient {
|
|
|
22
22
|
return (await res.json()).token;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
async createDeploy(files: Digest, token: string): Promise<
|
|
25
|
+
async createDeploy(files: Digest, token: string): Promise<DropResponse> {
|
|
26
26
|
const res = await fetch(`${this.apiBase}/drop`, {
|
|
27
27
|
method: 'POST',
|
|
28
28
|
headers: { 'Content-Type': 'application/json' },
|
|
@@ -47,10 +47,13 @@ export class AnonymousDropClient implements DropClient {
|
|
|
47
47
|
if (!res.ok) throw new Error(`upload ${path} failed: ${res.status}`);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
async waitUntilReady(deploy:
|
|
50
|
+
async waitUntilReady(deploy: DropResponse, token: string): Promise<void> {
|
|
51
51
|
// Poll the deploy with the drop token until ready.
|
|
52
|
+
// Note: `/deploys/{id}` expects the deploy_id (BSON), not the site id (UUID)
|
|
53
|
+
// that lives at `deploy.id`. See drop_controller.rb; Deploy.find(uuid) is nil
|
|
54
|
+
// and the request 401s misleadingly via require_current_actor!.
|
|
52
55
|
for (let i = 0; i < 600; i++) {
|
|
53
|
-
const res = await fetch(`${this.apiBase}/deploys/${deploy.
|
|
56
|
+
const res = await fetch(`${this.apiBase}/deploys/${deploy.deploy_id}`, {
|
|
54
57
|
headers: { Authorization: `Bearer ${token}` },
|
|
55
58
|
});
|
|
56
59
|
if (res.ok && (await res.json()).state === 'ready') return;
|
|
@@ -89,16 +89,19 @@ export async function readFileList(files: FileList): Promise<ProcessedFile[]> {
|
|
|
89
89
|
// --- zip --------------------------------------------------------------------
|
|
90
90
|
|
|
91
91
|
export async function readZip(zip: File): Promise<ProcessedFile[]> {
|
|
92
|
-
const {
|
|
93
|
-
const
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
Object.entries(archive.files).map(async ([path, entry]) => {
|
|
97
|
-
if (entry.dir || /(^|\/)(__MACOSX\/|\.)/.test(path)) return;
|
|
98
|
-
const content = await entry.async('arraybuffer');
|
|
99
|
-
out.push(toProcessedFile(path, content, path.split('/').pop()!));
|
|
100
|
-
})
|
|
92
|
+
const { unzip } = await import('fflate');
|
|
93
|
+
const buf = new Uint8Array(await zip.arrayBuffer());
|
|
94
|
+
const entries = await new Promise<Record<string, Uint8Array>>((resolve, reject) =>
|
|
95
|
+
unzip(buf, (err, data) => (err ? reject(err) : resolve(data)))
|
|
101
96
|
);
|
|
97
|
+
const out: ProcessedFile[] = [];
|
|
98
|
+
for (const [path, bytes] of Object.entries(entries)) {
|
|
99
|
+
// fflate uses a trailing slash to signal directory entries; also skip the
|
|
100
|
+
// usual junk (macOS metadata, dotfiles at any depth).
|
|
101
|
+
if (path.endsWith('/') || /(^|\/)(__MACOSX\/|\.)/.test(path)) continue;
|
|
102
|
+
const content = bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
|
|
103
|
+
out.push(toProcessedFile(path, content, path.split('/').pop()!));
|
|
104
|
+
}
|
|
102
105
|
return normalizeFiles(out);
|
|
103
106
|
}
|
|
104
107
|
|
|
@@ -10,8 +10,17 @@ export interface ProcessedFile {
|
|
|
10
10
|
|
|
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.
|
|
18
|
+
*/
|
|
19
|
+
export interface DropResponse {
|
|
20
|
+
/** site id (UUID) — surfaced to callers so they can build claim links */
|
|
14
21
|
id: string;
|
|
22
|
+
/** deploy id (BSON) — used for `/deploys/{deploy_id}` reads and file PUTs */
|
|
23
|
+
deploy_id: string;
|
|
15
24
|
/** the *.netlify.app subdomain assigned to the anonymous site */
|
|
16
25
|
subdomain: string;
|
|
17
26
|
/** SHAs the backend does NOT yet have — only these get uploaded */
|
|
@@ -20,7 +29,7 @@ export interface Deploy {
|
|
|
20
29
|
}
|
|
21
30
|
|
|
22
31
|
export interface DeployResult {
|
|
23
|
-
deploy:
|
|
32
|
+
deploy: DropResponse;
|
|
24
33
|
/** drop token — persist this to later claim the site into an account */
|
|
25
34
|
token: string;
|
|
26
35
|
url: string; // https://<subdomain>.netlify.app
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
var o = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
2
|
-
function l(e) {
|
|
3
|
-
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
4
|
-
}
|
|
5
|
-
export {
|
|
6
|
-
o as c,
|
|
7
|
-
l as g
|
|
8
|
-
};
|