@notionhq/custom-blocks 0.1.28 → 0.1.29
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/bridge/loadManifest.d.ts +2 -1
- package/dist/bridge/loadManifest.d.ts.map +1 -1
- package/dist/bridge/loadManifest.js +3 -2
- package/dist/init.js +2 -1
- package/dist/version.js +1 -1
- package/docs/deployment.md +1 -1
- package/package.json +1 -1
- package/src/bridge/loadManifest.ts +3 -2
- package/src/init.ts +2 -1
|
@@ -11,7 +11,8 @@ export type ManifestLoadResult = {
|
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
13
|
* On the literal `localhost` hostname, attempts to load the custom block's optional self-hosted
|
|
14
|
-
* manifest exposed by the worker dev shell at
|
|
14
|
+
* manifest exposed by the worker dev shell, requested at the page-relative `manifest` path so
|
|
15
|
+
* blocks served from a subpath resolve it against their own base.
|
|
15
16
|
*
|
|
16
17
|
* It is up to the host to decide whether to use this manifest or provide its own persisted manifest.
|
|
17
18
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadManifest.d.ts","sourceRoot":"","sources":["../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/loadManifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAA;AACtF,OAAO,EACN,KAAK,mBAAmB,EAExB,MAAM,8CAA8C,CAAA;AAKrD,KAAK,2BAA2B,GAC7B,sBAAsB,GACtB,kBAAkB,GAClB,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;AAEhB,KAAK,uBAAuB,GAAG,oBAAoB,CAAC,2BAA2B,CAAC,CAAA;AAEhF,MAAM,MAAM,kBAAkB,GAC3B;IACA,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAAA;IACpC,KAAK,CAAC,EAAE,SAAS,CAAA;CAChB,GACD;IACA,QAAQ,EAAE,IAAI,CAAA;IACd,KAAK,EAAE,uBAAuB,CAAA;CAC7B,CAAA;AAEJ
|
|
1
|
+
{"version":3,"file":"loadManifest.d.ts","sourceRoot":"","sources":["../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/loadManifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAA;AACtF,OAAO,EACN,KAAK,mBAAmB,EAExB,MAAM,8CAA8C,CAAA;AAKrD,KAAK,2BAA2B,GAC7B,sBAAsB,GACtB,kBAAkB,GAClB,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;AAEhB,KAAK,uBAAuB,GAAG,oBAAoB,CAAC,2BAA2B,CAAC,CAAA;AAEhF,MAAM,MAAM,kBAAkB,GAC3B;IACA,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAAA;IACpC,KAAK,CAAC,EAAE,SAAS,CAAA;CAChB,GACD;IACA,QAAQ,EAAE,IAAI,CAAA;IACd,KAAK,EAAE,uBAAuB,CAAA;CAC7B,CAAA;AAEJ;;;;;;GAMG;AACH,wBAAsB,+BAA+B,CACpD,QAAQ,GAAE,MAAM,GAAG,SAEQ,GACzB,OAAO,CAAC,kBAAkB,CAAC,CAgE7B"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { manifestSchema, } from "../protocol/manifest.js";
|
|
2
2
|
import * as v from "valibot";
|
|
3
|
-
const MANIFEST_URL = "
|
|
3
|
+
const MANIFEST_URL = "manifest";
|
|
4
4
|
/**
|
|
5
5
|
* On the literal `localhost` hostname, attempts to load the custom block's optional self-hosted
|
|
6
|
-
* manifest exposed by the worker dev shell at
|
|
6
|
+
* manifest exposed by the worker dev shell, requested at the page-relative `manifest` path so
|
|
7
|
+
* blocks served from a subpath resolve it against their own base.
|
|
7
8
|
*
|
|
8
9
|
* It is up to the host to decide whether to use this manifest or provide its own persisted manifest.
|
|
9
10
|
*/
|
package/dist/init.js
CHANGED
|
@@ -40,7 +40,8 @@ export function initCustomBlock(opts = {}) {
|
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* Performs the host <-> sandbox SDK handshake:
|
|
43
|
-
* 1. On localhost, attempts to load the worker manifest from
|
|
43
|
+
* 1. On localhost, attempts to load the worker manifest from the page-relative
|
|
44
|
+
* `manifest` path
|
|
44
45
|
* 2. Sends `connect` with the manifest
|
|
45
46
|
* 3. Awaits the host's `init` message
|
|
46
47
|
* 4. Applies the `init` payload and acknowledges with `initResult` (fire-and-forget)
|
package/dist/version.js
CHANGED
package/docs/deployment.md
CHANGED
|
@@ -11,7 +11,7 @@ A custom block manifest describes the data sources a block requires, including t
|
|
|
11
11
|
|
|
12
12
|
Run `ntn customblocks dev` from a worker. It builds the worker, extracts its custom block declarations, starts one localhost Vite server per block, and renders them in the mock host at http://localhost:9873.
|
|
13
13
|
|
|
14
|
-
At startup, the SDK fetches
|
|
14
|
+
At startup, the SDK fetches the page-relative `manifest` path only when the bundle's hostname is exactly `localhost`, then forwards the response in `connect`. On every other hostname, the SDK skips this fetch and relies on the host-provided manifest from `init`.
|
|
15
15
|
|
|
16
16
|
## Types
|
|
17
17
|
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "@notionhq/custom-blocks-protocol/manifest.js"
|
|
6
6
|
import * as v from "valibot"
|
|
7
7
|
|
|
8
|
-
const MANIFEST_URL = "
|
|
8
|
+
const MANIFEST_URL = "manifest"
|
|
9
9
|
|
|
10
10
|
type CustomBlockConnectErrorCode =
|
|
11
11
|
| "manifest_unavailable"
|
|
@@ -26,7 +26,8 @@ export type ManifestLoadResult =
|
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* On the literal `localhost` hostname, attempts to load the custom block's optional self-hosted
|
|
29
|
-
* manifest exposed by the worker dev shell at
|
|
29
|
+
* manifest exposed by the worker dev shell, requested at the page-relative `manifest` path so
|
|
30
|
+
* blocks served from a subpath resolve it against their own base.
|
|
30
31
|
*
|
|
31
32
|
* It is up to the host to decide whether to use this manifest or provide its own persisted manifest.
|
|
32
33
|
*/
|
package/src/init.ts
CHANGED
|
@@ -84,7 +84,8 @@ export function initCustomBlock(
|
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
86
|
* Performs the host <-> sandbox SDK handshake:
|
|
87
|
-
* 1. On localhost, attempts to load the worker manifest from
|
|
87
|
+
* 1. On localhost, attempts to load the worker manifest from the page-relative
|
|
88
|
+
* `manifest` path
|
|
88
89
|
* 2. Sends `connect` with the manifest
|
|
89
90
|
* 3. Awaits the host's `init` message
|
|
90
91
|
* 4. Applies the `init` payload and acknowledges with `initResult` (fire-and-forget)
|