@taggor/runtime 0.0.0-stage → 0.2.0
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/LICENSE +21 -0
- package/README.md +49 -2
- package/dist/.tsbuildinfo +1 -0
- package/dist/compat/before-compat.d.ts +5 -0
- package/dist/compat/before-compat.d.ts.map +1 -0
- package/dist/compat/before-compat.js +15 -0
- package/dist/compat/before-compat.js.map +1 -0
- package/dist/compat/index.d.ts +90 -0
- package/dist/compat/index.d.ts.map +1 -0
- package/dist/compat/index.js +67 -0
- package/dist/compat/index.js.map +1 -0
- package/dist/compat/scope.d.ts +81 -0
- package/dist/compat/scope.d.ts.map +1 -0
- package/dist/compat/scope.js +107 -0
- package/dist/compat/scope.js.map +1 -0
- package/dist/element/attributes.d.ts +103 -0
- package/dist/element/attributes.d.ts.map +1 -0
- package/dist/element/attributes.js +153 -0
- package/dist/element/attributes.js.map +1 -0
- package/dist/element/component-controller.d.ts +98 -0
- package/dist/element/component-controller.d.ts.map +1 -0
- package/dist/element/component-controller.js +472 -0
- package/dist/element/component-controller.js.map +1 -0
- package/dist/element/contract-gate.d.ts +29 -0
- package/dist/element/contract-gate.d.ts.map +1 -0
- package/dist/element/contract-gate.js +37 -0
- package/dist/element/contract-gate.js.map +1 -0
- package/dist/element/create-component-element.d.ts +93 -0
- package/dist/element/create-component-element.d.ts.map +1 -0
- package/dist/element/create-component-element.js +302 -0
- package/dist/element/create-component-element.js.map +1 -0
- package/dist/element/define-element.d.ts +43 -0
- package/dist/element/define-element.d.ts.map +1 -0
- package/dist/element/define-element.js +61 -0
- package/dist/element/define-element.js.map +1 -0
- package/dist/element/diagnostics.d.ts +35 -0
- package/dist/element/diagnostics.d.ts.map +1 -0
- package/dist/element/diagnostics.js +52 -0
- package/dist/element/diagnostics.js.map +1 -0
- package/dist/element/error-boundary.d.ts +41 -0
- package/dist/element/error-boundary.d.ts.map +1 -0
- package/dist/element/error-boundary.js +36 -0
- package/dist/element/error-boundary.js.map +1 -0
- package/dist/element/error-report.d.ts +9 -0
- package/dist/element/error-report.d.ts.map +1 -0
- package/dist/element/error-report.js +51 -0
- package/dist/element/error-report.js.map +1 -0
- package/dist/element/events.d.ts +69 -0
- package/dist/element/events.d.ts.map +1 -0
- package/dist/element/events.js +115 -0
- package/dist/element/events.js.map +1 -0
- package/dist/element/handler-guard.d.ts +54 -0
- package/dist/element/handler-guard.d.ts.map +1 -0
- package/dist/element/handler-guard.js +162 -0
- package/dist/element/handler-guard.js.map +1 -0
- package/dist/element/index.d.ts +9 -0
- package/dist/element/index.d.ts.map +1 -0
- package/dist/element/index.js +9 -0
- package/dist/element/index.js.map +1 -0
- package/dist/element/props-script.d.ts +37 -0
- package/dist/element/props-script.d.ts.map +1 -0
- package/dist/element/props-script.js +63 -0
- package/dist/element/props-script.js.map +1 -0
- package/dist/element/styles.d.ts +45 -0
- package/dist/element/styles.d.ts.map +1 -0
- package/dist/element/styles.js +66 -0
- package/dist/element/styles.js.map +1 -0
- package/dist/element/types.d.ts +148 -0
- package/dist/element/types.d.ts.map +1 -0
- package/dist/element/types.js +3 -0
- package/dist/element/types.js.map +1 -0
- package/dist/host/api.d.ts +40 -0
- package/dist/host/api.d.ts.map +1 -0
- package/dist/host/api.js +144 -0
- package/dist/host/api.js.map +1 -0
- package/dist/host/barrier.d.ts +27 -0
- package/dist/host/barrier.d.ts.map +1 -0
- package/dist/host/barrier.js +47 -0
- package/dist/host/barrier.js.map +1 -0
- package/dist/host/index.d.ts +11 -0
- package/dist/host/index.d.ts.map +1 -0
- package/dist/host/index.js +9 -0
- package/dist/host/index.js.map +1 -0
- package/dist/host/registry.d.ts +21 -0
- package/dist/host/registry.d.ts.map +1 -0
- package/dist/host/registry.js +29 -0
- package/dist/host/registry.js.map +1 -0
- package/dist/host/types.d.ts +54 -0
- package/dist/host/types.d.ts.map +1 -0
- package/dist/host/types.js +11 -0
- package/dist/host/types.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/loader/config.d.ts +63 -0
- package/dist/loader/config.d.ts.map +1 -0
- package/dist/loader/config.js +115 -0
- package/dist/loader/config.js.map +1 -0
- package/dist/loader/entry.d.ts +2 -0
- package/dist/loader/entry.d.ts.map +1 -0
- package/dist/loader/entry.js +37 -0
- package/dist/loader/entry.js.map +1 -0
- package/dist/loader/lazy-transport.d.ts +26 -0
- package/dist/loader/lazy-transport.d.ts.map +1 -0
- package/dist/loader/lazy-transport.js +59 -0
- package/dist/loader/lazy-transport.js.map +1 -0
- package/dist/loader/loader-code.d.ts +2 -0
- package/dist/loader/loader-code.js +2 -0
- package/dist/loader/loading.d.ts +24 -0
- package/dist/loader/loading.d.ts.map +1 -0
- package/dist/loader/loading.js +29 -0
- package/dist/loader/loading.js.map +1 -0
- package/dist/loader/page-state.d.ts +66 -0
- package/dist/loader/page-state.d.ts.map +1 -0
- package/dist/loader/page-state.js +73 -0
- package/dist/loader/page-state.js.map +1 -0
- package/dist/loader/resilient-import.d.ts +32 -0
- package/dist/loader/resilient-import.d.ts.map +1 -0
- package/dist/loader/resilient-import.js +42 -0
- package/dist/loader/resilient-import.js.map +1 -0
- package/dist/loader/run.d.ts +45 -0
- package/dist/loader/run.d.ts.map +1 -0
- package/dist/loader/run.js +217 -0
- package/dist/loader/run.js.map +1 -0
- package/dist/loader/script-url.d.ts +50 -0
- package/dist/loader/script-url.d.ts.map +1 -0
- package/dist/loader/script-url.js +71 -0
- package/dist/loader/script-url.js.map +1 -0
- package/dist/loader/script.d.ts +31 -0
- package/dist/loader/script.d.ts.map +1 -0
- package/dist/loader/script.js +40 -0
- package/dist/loader/script.js.map +1 -0
- package/dist/server/render-fragment.d.ts +57 -0
- package/dist/server/render-fragment.d.ts.map +1 -0
- package/dist/server/render-fragment.js +182 -0
- package/dist/server/render-fragment.js.map +1 -0
- package/dist/server/ssr-code.d.ts +4 -0
- package/dist/server/ssr-code.js +3 -0
- package/dist/server/worker.d.ts +37 -0
- package/dist/server/worker.d.ts.map +1 -0
- package/dist/server/worker.js +71 -0
- package/dist/server/worker.js.map +1 -0
- package/package.json +86 -3
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** The page-global key the registry lives under (a symbol: invisible to `Object.keys`, TAG-610). */
|
|
2
|
+
const KEY = Symbol.for("taggor.live");
|
|
3
|
+
/**
|
|
4
|
+
* The registry of this page (TAG-309): one map shared by every copy of the runtime, so sites on
|
|
5
|
+
* different runtime majors, each importing its own copy, appear in the one `window.taggor`.
|
|
6
|
+
*
|
|
7
|
+
* Output: the map kept on the page's global, created by the first copy; a private map when the
|
|
8
|
+
* page replaced the value with something that is not a map or refuses new properties (the
|
|
9
|
+
* component still mounts, it just is not listed). Errors: none. Side effects: defines one
|
|
10
|
+
* non-enumerable symbol property on `globalThis` the first time.
|
|
11
|
+
*/
|
|
12
|
+
function pageRegistry() {
|
|
13
|
+
const page = globalThis;
|
|
14
|
+
try {
|
|
15
|
+
if (!(page[KEY] instanceof Map)) {
|
|
16
|
+
Object.defineProperty(page, KEY, { value: new Map(), configurable: true });
|
|
17
|
+
}
|
|
18
|
+
return page[KEY];
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return new Map();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The live components of the page, shared by every component element of every runtime copy on it.
|
|
26
|
+
* Read-only for everyone but the controller (`component-controller.ts`).
|
|
27
|
+
*/
|
|
28
|
+
export const liveComponents = pageRegistry();
|
|
29
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/host/registry.ts"],"names":[],"mappings":"AAkBA,oGAAoG;AACpG,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AAEtC;;;;;;;;GAQG;AACH,SAAS,YAAY;IACnB,MAAM,IAAI,GAAG,UAAqC,CAAC;IACnD,IAAI,CAAC;QACH,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,GAAG,CAAC,EAAE,CAAC;YAChC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,IAAI,GAAG,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7E,CAAC;QACD,OAAO,IAAI,CAAC,GAAG,CAAmB,CAAC;IACrC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,GAAG,EAAE,CAAC;IACnB,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAmB,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types of the host page API (TAG-214): what `window.taggor` offers the customer's site
|
|
3
|
+
* (`TaggorHostApi`) and what it says about one component element (`ComponentInfo`).
|
|
4
|
+
*
|
|
5
|
+
* These are the untyped shapes the runtime implements. The per-component declaration files the
|
|
6
|
+
* contract generates (`componentTypeDeclarations` in `@taggor/contract`, for `taggor types` and
|
|
7
|
+
* `GET /v1/components/{id}/types.d.ts`) declare the same API with the props and events of each
|
|
8
|
+
* component; `host-api-types.test.ts` keeps the two in agreement.
|
|
9
|
+
*/
|
|
10
|
+
/** Whether a component element shows its component (`mounted`) or its fallback after a failure. */
|
|
11
|
+
export type ComponentState = "mounted" | "failed";
|
|
12
|
+
/**
|
|
13
|
+
* What `taggor.get(el)` says about one connected component element. Frozen; `props` is deep-frozen,
|
|
14
|
+
* the very values the component renders with (property > attribute > script > default).
|
|
15
|
+
*/
|
|
16
|
+
export interface ComponentInfo {
|
|
17
|
+
/** The element itself. */
|
|
18
|
+
readonly element: HTMLElement;
|
|
19
|
+
/** The tag the element really has (`localName`; after a collision, the generic host's). */
|
|
20
|
+
readonly tag: string;
|
|
21
|
+
/** The component's name in its manifest. */
|
|
22
|
+
readonly name: string;
|
|
23
|
+
/** The published version the loader mounted, when it passed one. */
|
|
24
|
+
readonly version: string | undefined;
|
|
25
|
+
/** The contract version the component was mounted with. */
|
|
26
|
+
readonly contractVersion: string | undefined;
|
|
27
|
+
readonly state: ComponentState;
|
|
28
|
+
readonly props: Readonly<Record<string, unknown>>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* `window.taggor`, the API of the runtime for the host page. No method ever throws: an invalid
|
|
32
|
+
* argument gives `undefined` (and a `host-api` warning in debug mode).
|
|
33
|
+
*
|
|
34
|
+
* - `version`: the contract version this runtime implements; the API is versioned with it.
|
|
35
|
+
* - `ready()`: resolves (never rejects) once every component the loader found at the initial load
|
|
36
|
+
* was registered (defined, or settled as a collision or a failure); a new promise per call.
|
|
37
|
+
* - `get(element)`: the `ComponentInfo` of a component element in the document, `undefined` for anything
|
|
38
|
+
* else.
|
|
39
|
+
* - `on(tag, event, handler)`: calls `handler` with every `<tag>:<event>` dispatched in the
|
|
40
|
+
* document (capture phase, so non-bubbling events too) whose origin is a live component element;
|
|
41
|
+
* returns the function that stops it. Page code can still dispatch a forged event on a component
|
|
42
|
+
* element: check `taggor.get(event.composedPath()[0])` (not `event.target`, which a component nested in
|
|
43
|
+
* another is retargeted to) and the `detail` before trusting it. A handler that
|
|
44
|
+
* throws is page code: the browser reports it to `window.onerror`.
|
|
45
|
+
* - `components()`: the `ComponentInfo` of every connected component element, in connection order.
|
|
46
|
+
*/
|
|
47
|
+
export interface TaggorHostApi {
|
|
48
|
+
readonly version: string;
|
|
49
|
+
readonly ready: () => Promise<void>;
|
|
50
|
+
readonly get: (element: unknown) => ComponentInfo | undefined;
|
|
51
|
+
readonly on: (tag: unknown, event: unknown, handler: unknown) => (() => void) | undefined;
|
|
52
|
+
readonly components: () => readonly ComponentInfo[];
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/host/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,mGAAmG;AACnG,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,QAAQ,CAAC;AAElD;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,0BAA0B;IAC1B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,2FAA2F;IAC3F,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oEAAoE;IACpE,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,2DAA2D;IAC3D,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7C,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACnD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,aAAa,GAAG,SAAS,CAAC;IAC9D,QAAQ,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,KAAK,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IAC1F,QAAQ,CAAC,UAAU,EAAE,MAAM,SAAS,aAAa,EAAE,CAAC;CACrD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types of the host page API (TAG-214): what `window.taggor` offers the customer's site
|
|
3
|
+
* (`TaggorHostApi`) and what it says about one component element (`ComponentInfo`).
|
|
4
|
+
*
|
|
5
|
+
* These are the untyped shapes the runtime implements. The per-component declaration files the
|
|
6
|
+
* contract generates (`componentTypeDeclarations` in `@taggor/contract`, for `taggor types` and
|
|
7
|
+
* `GET /v1/components/{id}/types.d.ts`) declare the same API with the props and events of each
|
|
8
|
+
* component; `host-api-types.test.ts` keeps the two in agreement.
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/host/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @taggor/runtime: the browser side of Taggor. Created as a placeholder by TAG-001; TAG-302 added
|
|
3
|
+
* the Custom Element wrapper (`./element`); TAG-214 the host page API (`./host`, `window.taggor`).
|
|
4
|
+
* The site loader is TAG-301.
|
|
5
|
+
*
|
|
6
|
+
* Importing this module has no side effects (no `customElements.define`, no global, no Preact
|
|
7
|
+
* hook): everything happens when `createComponentElement` is called, and `window.taggor` exists only
|
|
8
|
+
* once the loader calls `installHostApi`.
|
|
9
|
+
*/
|
|
10
|
+
export * from "./element/index.js";
|
|
11
|
+
export { liveComponents, type LiveComponents, type ComponentInfoReader } from "./host/registry.js";
|
|
12
|
+
export type { TaggorHostApi, ComponentInfo, ComponentState } from "./host/types.js";
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACnG,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @taggor/runtime: the browser side of Taggor. Created as a placeholder by TAG-001; TAG-302 added
|
|
3
|
+
* the Custom Element wrapper (`./element`); TAG-214 the host page API (`./host`, `window.taggor`).
|
|
4
|
+
* The site loader is TAG-301.
|
|
5
|
+
*
|
|
6
|
+
* Importing this module has no side effects (no `customElements.define`, no global, no Preact
|
|
7
|
+
* hook): everything happens when `createComponentElement` is called, and `window.taggor` exists only
|
|
8
|
+
* once the loader calls `installHostApi`.
|
|
9
|
+
*/
|
|
10
|
+
export * from "./element/index.js";
|
|
11
|
+
export { liveComponents } from "./host/registry.js";
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,cAAc,EAAiD,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads the configuration the edge embeds in the site loader (TAG-301): the site manifest as
|
|
3
|
+
* served (`/m/<siteKey>.json` shape, plus the `servedOn` day) and two origins' worth of URLs.
|
|
4
|
+
* The loader treats it as untrusted-shaped input anyway (golden rule 5): a wrong type, a bundle
|
|
5
|
+
* outside the loader's own origin or a malformed tag drops that entry, never the page.
|
|
6
|
+
*
|
|
7
|
+
* Embedded shape (`LoaderEmbed`): `{ origin, runtimeUrl, manifest }`. `origin` is the delivery
|
|
8
|
+
* origin the edge answered from; `runtimeUrl` is the shared runtime module (`createComponentElement`
|
|
9
|
+
* and `liveComponents`); `manifest.components[]` are the `SiteManifestComponent` entries of
|
|
10
|
+
* `@taggor/contract`. No dependency on the contract package here: this file is in the 3 KB gate.
|
|
11
|
+
*
|
|
12
|
+
* TAG-709: the embed may also carry `data`: `{ moduleUrl, siteKey, turnstileSiteKey? }`, what a
|
|
13
|
+
* component that declares `data` needs to submit (the lazy data module of `@taggor/component`, the
|
|
14
|
+
* site key, Turnstile's public key). Absent or malformed, such components mount without a transport
|
|
15
|
+
* and their submissions end in the SDK's `unavailable` error.
|
|
16
|
+
*/
|
|
17
|
+
/** One component the loader may load, already checked. */
|
|
18
|
+
export interface LoaderComponent {
|
|
19
|
+
readonly tag: string;
|
|
20
|
+
/** Absolute URL of the immutable bundle, on the loader's own origin. */
|
|
21
|
+
readonly bundleUrl: string;
|
|
22
|
+
/** The `contractVersion` the published manifest names; the runtime gates on it (ADR 0019). */
|
|
23
|
+
readonly contractVersion: string;
|
|
24
|
+
/** The content address of the published version, reported by `window.taggor.get`. */
|
|
25
|
+
readonly version: string;
|
|
26
|
+
/** The props the site gives the component (TAG-613), unchecked: the runtime checks each one. */
|
|
27
|
+
readonly defaults: unknown;
|
|
28
|
+
/** The manifest's `loading` as found; only `idle` means something (TAG-335). */
|
|
29
|
+
readonly loading: string | undefined;
|
|
30
|
+
}
|
|
31
|
+
/** Where and how components with data reach the edge (TAG-709), already checked. */
|
|
32
|
+
export interface LoaderData {
|
|
33
|
+
/** Absolute URL of the lazy data module, on the loader's own origin. */
|
|
34
|
+
readonly moduleUrl: string;
|
|
35
|
+
/** The delivery origin the data API is on (`/d/<siteKey>/<collection>`). */
|
|
36
|
+
readonly baseUrl: string;
|
|
37
|
+
readonly siteKey: string;
|
|
38
|
+
/** The site's Turnstile public key, when it has one. */
|
|
39
|
+
readonly turnstileSiteKey: string | undefined;
|
|
40
|
+
}
|
|
41
|
+
/** What the loader runs with. */
|
|
42
|
+
export interface LoaderConfig {
|
|
43
|
+
/** Absolute URL of the runtime module, on the loader's own origin. */
|
|
44
|
+
readonly runtimeUrl: string;
|
|
45
|
+
/** The site's public key, when the manifest carries a well-formed one (TAG-610: dedupe key). */
|
|
46
|
+
readonly siteKey: string | undefined;
|
|
47
|
+
/** The ISO day the edge served the manifest, when it stamped one. */
|
|
48
|
+
readonly servedOn: string | undefined;
|
|
49
|
+
/** Active components by tag (the first entry of a tag wins). */
|
|
50
|
+
readonly components: ReadonlyMap<string, LoaderComponent>;
|
|
51
|
+
/** The data module and keys; absent when the embed has none or they are unusable (TAG-709). */
|
|
52
|
+
readonly data: LoaderData | undefined;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Checks the embedded configuration.
|
|
56
|
+
*
|
|
57
|
+
* Inputs: whatever the edge embedded. Output: a `LoaderConfig`, or `undefined` when the
|
|
58
|
+
* origin or the runtime URL is unusable (the loader then does nothing). Components that are
|
|
59
|
+
* disabled (the kill switch), duplicated, with a malformed tag, a missing contract version or a
|
|
60
|
+
* bundle URL outside `origin` are left out. Errors: none. Side effects: none.
|
|
61
|
+
*/
|
|
62
|
+
export declare function readLoaderConfig(raw: unknown): LoaderConfig | undefined;
|
|
63
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/loader/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAYH,0DAA0D;AAC1D,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,8FAA8F;IAC9F,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,qFAAqF;IACrF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,gGAAgG;IAChG,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,gFAAgF;IAChF,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC;AAED,oFAAoF;AACpF,MAAM,WAAW,UAAU;IACzB,wEAAwE;IACxE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,4EAA4E;IAC5E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,wDAAwD;IACxD,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/C;AAED,iCAAiC;AACjC,MAAM,WAAW,YAAY;IAC3B,sEAAsE;IACtE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,gGAAgG;IAChG,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,qEAAqE;IACrE,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,gEAAgE;IAChE,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC1D,+FAA+F;IAC/F,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,CAAC;CACvC;AAuCD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,GAAG,SAAS,CA8CvE"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads the configuration the edge embeds in the site loader (TAG-301): the site manifest as
|
|
3
|
+
* served (`/m/<siteKey>.json` shape, plus the `servedOn` day) and two origins' worth of URLs.
|
|
4
|
+
* The loader treats it as untrusted-shaped input anyway (golden rule 5): a wrong type, a bundle
|
|
5
|
+
* outside the loader's own origin or a malformed tag drops that entry, never the page.
|
|
6
|
+
*
|
|
7
|
+
* Embedded shape (`LoaderEmbed`): `{ origin, runtimeUrl, manifest }`. `origin` is the delivery
|
|
8
|
+
* origin the edge answered from; `runtimeUrl` is the shared runtime module (`createComponentElement`
|
|
9
|
+
* and `liveComponents`); `manifest.components[]` are the `SiteManifestComponent` entries of
|
|
10
|
+
* `@taggor/contract`. No dependency on the contract package here: this file is in the 3 KB gate.
|
|
11
|
+
*
|
|
12
|
+
* TAG-709: the embed may also carry `data`: `{ moduleUrl, siteKey, turnstileSiteKey? }`, what a
|
|
13
|
+
* component that declares `data` needs to submit (the lazy data module of `@taggor/component`, the
|
|
14
|
+
* site key, Turnstile's public key). Absent or malformed, such components mount without a transport
|
|
15
|
+
* and their submissions end in the SDK's `unavailable` error.
|
|
16
|
+
*/
|
|
17
|
+
/** A custom element name as the contract's `TAG_NAME_PATTERN` writes it (safe in a selector). */
|
|
18
|
+
const TAG_NAME = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)+$/;
|
|
19
|
+
/**
|
|
20
|
+
* Most components honored: the contract's `SITE_MANIFEST_MAX_COMPONENTS`, the platform ceiling
|
|
21
|
+
* (the highest plan's `componentsPerSite`, TAG-1623), not a plan's own limit. Repeated here because
|
|
22
|
+
* the loader cannot import the contract (3 KB gate); a test keeps the two equal.
|
|
23
|
+
*/
|
|
24
|
+
const MAX_COMPONENTS = 800;
|
|
25
|
+
/** An absolute http(s) URL of `origin` for `value`, or `undefined`. */
|
|
26
|
+
function ownUrl(value, origin) {
|
|
27
|
+
if (typeof value !== "string" || value.length > 2048)
|
|
28
|
+
return undefined;
|
|
29
|
+
try {
|
|
30
|
+
const url = new URL(value, origin);
|
|
31
|
+
return url.origin === origin && url.protocol.startsWith("http") ? url.href : undefined;
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/** A string field of an unknown record. */
|
|
38
|
+
function text(record, field) {
|
|
39
|
+
const value = record?.[field];
|
|
40
|
+
return typeof value === "string" ? value : undefined;
|
|
41
|
+
}
|
|
42
|
+
/** A short key as the edge and Turnstile write them: ASCII letters, digits, `_` and `-`. */
|
|
43
|
+
const PUBLIC_KEY = /^[A-Za-z0-9_-]{1,100}$/;
|
|
44
|
+
/** The `data` entry of the embed, or `undefined` when any part of it is unusable. */
|
|
45
|
+
function readData(raw, origin) {
|
|
46
|
+
const data = raw?.data;
|
|
47
|
+
const moduleUrl = ownUrl(text(data, "moduleUrl"), origin);
|
|
48
|
+
const siteKey = text(data, "siteKey");
|
|
49
|
+
const turnstile = text(data, "turnstileSiteKey");
|
|
50
|
+
if (moduleUrl === undefined || siteKey === undefined || !PUBLIC_KEY.test(siteKey)) {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
moduleUrl,
|
|
55
|
+
baseUrl: origin,
|
|
56
|
+
siteKey,
|
|
57
|
+
turnstileSiteKey: turnstile !== undefined && PUBLIC_KEY.test(turnstile) ? turnstile : undefined,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Checks the embedded configuration.
|
|
62
|
+
*
|
|
63
|
+
* Inputs: whatever the edge embedded. Output: a `LoaderConfig`, or `undefined` when the
|
|
64
|
+
* origin or the runtime URL is unusable (the loader then does nothing). Components that are
|
|
65
|
+
* disabled (the kill switch), duplicated, with a malformed tag, a missing contract version or a
|
|
66
|
+
* bundle URL outside `origin` are left out. Errors: none. Side effects: none.
|
|
67
|
+
*/
|
|
68
|
+
export function readLoaderConfig(raw) {
|
|
69
|
+
try {
|
|
70
|
+
const origin = new URL(text(raw, "origin") ?? "").origin;
|
|
71
|
+
const runtimeUrl = ownUrl(text(raw, "runtimeUrl"), origin);
|
|
72
|
+
const manifest = raw.manifest;
|
|
73
|
+
const list = manifest?.components;
|
|
74
|
+
if (runtimeUrl === undefined || !Array.isArray(list))
|
|
75
|
+
return undefined;
|
|
76
|
+
const components = new Map();
|
|
77
|
+
for (const entry of list.slice(0, MAX_COMPONENTS)) {
|
|
78
|
+
const tag = text(entry, "tag");
|
|
79
|
+
const bundleUrl = ownUrl(text(entry, "bundleUrl"), origin);
|
|
80
|
+
const contractVersion = text(entry, "contractVersion");
|
|
81
|
+
const version = text(entry, "versionHash");
|
|
82
|
+
if (tag === undefined ||
|
|
83
|
+
!TAG_NAME.test(tag) ||
|
|
84
|
+
components.has(tag) ||
|
|
85
|
+
text(entry, "status") !== "active" ||
|
|
86
|
+
bundleUrl === undefined ||
|
|
87
|
+
contractVersion === undefined ||
|
|
88
|
+
version === undefined) {
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
// Passed on as found: the runtime reads it with `?.[prop]` and checks each value with its
|
|
92
|
+
// prop's type, so a shape that is not an object only means no site values (TAG-613).
|
|
93
|
+
components.set(tag, {
|
|
94
|
+
tag,
|
|
95
|
+
bundleUrl,
|
|
96
|
+
contractVersion,
|
|
97
|
+
version,
|
|
98
|
+
defaults: entry.defaults,
|
|
99
|
+
loading: text(entry, "loading"),
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
const key = text(manifest, "siteKey");
|
|
103
|
+
return {
|
|
104
|
+
runtimeUrl,
|
|
105
|
+
siteKey: key !== undefined && PUBLIC_KEY.test(key) ? key : undefined,
|
|
106
|
+
servedOn: text(manifest, "servedOn"),
|
|
107
|
+
components: components,
|
|
108
|
+
data: readData(raw, origin),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/loader/config.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../../src/loader/entry.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The loader's browser entry (TAG-301), the only file of the loader with side effects. It is the
|
|
3
|
+
* body of the script the edge serves at `/s/<siteKey>.js`: `script.ts` wraps the built bundle in a
|
|
4
|
+
* function that receives the embedded configuration as `__TAGGOR_LOADER_CONFIG__`, so the loader
|
|
5
|
+
* creates no global of its own (the only one is `window.taggor`, installed by `startLoader`).
|
|
6
|
+
*/
|
|
7
|
+
import { pageState } from "./page-state.js";
|
|
8
|
+
import { startLoader } from "./run.js";
|
|
9
|
+
import { createScriptUrls } from "./script-url.js";
|
|
10
|
+
try {
|
|
11
|
+
const script = document.currentScript;
|
|
12
|
+
startLoader(__TAGGOR_LOADER_CONFIG__, {
|
|
13
|
+
document,
|
|
14
|
+
// The one computed import of the runtime: the loader loads the URLs of the manifest, which
|
|
15
|
+
// `readLoaderConfig` already restricted to the loader's own origin.
|
|
16
|
+
// `import()` reads a TrustedScriptURL as its string; the specifier type is string only in TS.
|
|
17
|
+
// (the lint exception is per file, in this workspace's eslint.config.js)
|
|
18
|
+
importModule: (url) => import(/* @vite-ignore */ url),
|
|
19
|
+
// TAG-310: the `taggor` Trusted Types policy for those URLs, where the browser has Trusted Types.
|
|
20
|
+
scriptUrl: createScriptUrls(globalThis.trustedTypes, (message) => {
|
|
21
|
+
console.warn(message);
|
|
22
|
+
},
|
|
23
|
+
// TAG-610: one policy per page, shared by every snippet.
|
|
24
|
+
pageState().policy),
|
|
25
|
+
observe: (callback, target) => {
|
|
26
|
+
const observer = new MutationObserver(callback);
|
|
27
|
+
observer.observe(target, { childList: true, subtree: true });
|
|
28
|
+
return observer;
|
|
29
|
+
},
|
|
30
|
+
beacon: (url, body) => navigator.sendBeacon(url, body),
|
|
31
|
+
nonce: script instanceof HTMLScriptElement && script.nonce !== "" ? script.nonce : undefined,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
// Golden rule 2.
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry.js","sourceRoot":"","sources":["../../src/loader/entry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAsB,MAAM,iBAAiB,CAAC;AAIvE,IAAI,CAAC;IACH,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC;IACtC,WAAW,CAAC,wBAAwB,EAAE;QACpC,QAAQ;QACR,2FAA2F;QAC3F,oEAAoE;QACpE,8FAA8F;QAC9F,yEAAyE;QACzE,YAAY,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,kBAAkB,CAAC,GAAa,CAAC;QAC/D,kGAAkG;QAClG,SAAS,EAAE,gBAAgB,CACxB,UAA+C,CAAC,YAAY,EAC7D,CAAC,OAAO,EAAE,EAAE;YACV,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxB,CAAC;QACD,yDAAyD;QACzD,SAAS,EAAE,CAAC,MAAM,CACnB;QACD,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE;YAC5B,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,QAAQ,CAAC,CAAC;YAChD,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;YAC7D,OAAO,QAAQ,CAAC;QAClB,CAAC;QACD,MAAM,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC;QACtD,KAAK,EAAE,MAAM,YAAY,iBAAiB,IAAI,MAAM,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;KAC7F,CAAC,CAAC;AACL,CAAC;AAAC,MAAM,CAAC;IACP,iBAAiB;AACnB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The lazy data transport (TAG-709): what the loader hands to a component that declares `data`, so
|
|
3
|
+
* the heavy part (the data module of `@taggor/component`: edge transport, retry, Turnstile client)
|
|
4
|
+
* is downloaded only when the component first submits or tracks, never at page load and never for a
|
|
5
|
+
* page without such a component. The Turnstile script itself is fetched later still, by the data
|
|
6
|
+
* module, on the first submission.
|
|
7
|
+
*
|
|
8
|
+
* The runtime does not depend on `@taggor/component` (the SDK depends on it), so the transport is
|
|
9
|
+
* described structurally here: `submit` and `track` as the SDK's `DataTransport` declares them.
|
|
10
|
+
*/
|
|
11
|
+
/** The part of the SDK's `DataTransport` this file forwards. */
|
|
12
|
+
export interface Transport {
|
|
13
|
+
readonly submit: (collection: string, body: unknown, signal?: AbortSignal) => Promise<unknown>;
|
|
14
|
+
readonly track: (body: unknown) => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Wraps a loader of the real transport.
|
|
18
|
+
*
|
|
19
|
+
* Inputs: `load`, which imports the data module and builds the transport (called at most once
|
|
20
|
+
* per success; a rejected load is tried again by the next call). Output: a `Transport` whose
|
|
21
|
+
* `submit` resolves to the real one's result, or to `network_error` when the module cannot be
|
|
22
|
+
* loaded, and whose `track` forwards or drops. Errors: none, ever. Side effects: the dynamic
|
|
23
|
+
* import `load` performs, on first use.
|
|
24
|
+
*/
|
|
25
|
+
export declare function createLazyTransport(load: () => Promise<Transport>): Transport;
|
|
26
|
+
//# sourceMappingURL=lazy-transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy-transport.d.ts","sourceRoot":"","sources":["../../src/loader/lazy-transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AASH,gEAAgE;AAChE,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,MAAM,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/F,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACzC;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,GAAG,SAAS,CAgC7E"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The lazy data transport (TAG-709): what the loader hands to a component that declares `data`, so
|
|
3
|
+
* the heavy part (the data module of `@taggor/component`: edge transport, retry, Turnstile client)
|
|
4
|
+
* is downloaded only when the component first submits or tracks, never at page load and never for a
|
|
5
|
+
* page without such a component. The Turnstile script itself is fetched later still, by the data
|
|
6
|
+
* module, on the first submission.
|
|
7
|
+
*
|
|
8
|
+
* The runtime does not depend on `@taggor/component` (the SDK depends on it), so the transport is
|
|
9
|
+
* described structurally here: `submit` and `track` as the SDK's `DataTransport` declares them.
|
|
10
|
+
*/
|
|
11
|
+
/** The failure the SDK reads as "could not reach the server" (a `SubmitResult`). */
|
|
12
|
+
const NETWORK_ERROR = Object.freeze({
|
|
13
|
+
ok: false,
|
|
14
|
+
code: "network_error",
|
|
15
|
+
fields: Object.freeze([]),
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Wraps a loader of the real transport.
|
|
19
|
+
*
|
|
20
|
+
* Inputs: `load`, which imports the data module and builds the transport (called at most once
|
|
21
|
+
* per success; a rejected load is tried again by the next call). Output: a `Transport` whose
|
|
22
|
+
* `submit` resolves to the real one's result, or to `network_error` when the module cannot be
|
|
23
|
+
* loaded, and whose `track` forwards or drops. Errors: none, ever. Side effects: the dynamic
|
|
24
|
+
* import `load` performs, on first use.
|
|
25
|
+
*/
|
|
26
|
+
export function createLazyTransport(load) {
|
|
27
|
+
let loading;
|
|
28
|
+
const transport = () => {
|
|
29
|
+
const started = (loading ??= load());
|
|
30
|
+
started.catch(() => {
|
|
31
|
+
if (loading === started)
|
|
32
|
+
loading = undefined;
|
|
33
|
+
});
|
|
34
|
+
return started;
|
|
35
|
+
};
|
|
36
|
+
return {
|
|
37
|
+
submit: (collection, body, signal) => {
|
|
38
|
+
try {
|
|
39
|
+
return transport().then((real) => real.submit(collection, body, signal), () => NETWORK_ERROR);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return Promise.resolve(NETWORK_ERROR);
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
track: (body) => {
|
|
46
|
+
try {
|
|
47
|
+
transport()
|
|
48
|
+
.then((real) => {
|
|
49
|
+
real.track(body);
|
|
50
|
+
})
|
|
51
|
+
.catch(() => undefined);
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
// No transport: tracking is best-effort.
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=lazy-transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy-transport.js","sourceRoot":"","sources":["../../src/loader/lazy-transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,oFAAoF;AACpF,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC;IAClC,EAAE,EAAE,KAAK;IACT,IAAI,EAAE,eAAe;IACrB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;CAC1B,CAAC,CAAC;AAQH;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAA8B;IAChE,IAAI,OAAuC,CAAC;IAC5C,MAAM,SAAS,GAAG,GAAuB,EAAE;QACzC,MAAM,OAAO,GAAG,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC,CAAC;QACrC,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE;YACjB,IAAI,OAAO,KAAK,OAAO;gBAAE,OAAO,GAAG,SAAS,CAAC;QAC/C,CAAC,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;IACF,OAAO;QACL,MAAM,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;YACnC,IAAI,CAAC;gBACH,OAAO,SAAS,EAAE,CAAC,IAAI,CACrB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,EAC/C,GAAG,EAAE,CAAC,aAAa,CACpB,CAAC;YACJ,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;YACxC,CAAC;QACH,CAAC;QACD,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE;YACd,IAAI,CAAC;gBACH,SAAS,EAAE;qBACR,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;oBACb,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBACnB,CAAC,CAAC;qBACD,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;YAC5B,CAAC;YAAC,MAAM,CAAC;gBACP,yCAAyC;YAC3C,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Generated by scripts/build-loader.ts (TAG-301); do not edit.
|
|
2
|
+
export const LOADER_CODE = "\"use strict\";(()=>{function N(){let n=new Set,e,t=()=>{},o=new Promise(r=>{t=r}),i=()=>{e?.size===0&&t()};return Object.freeze({expect:r=>{e??=new Set;for(let d of r)n.has(d)||e.add(d);i()},settle:r=>{n.add(r),e?.delete(r),i()},ready:()=>o.then(()=>{})})}var L=Symbol.for(\"taggor.loader\");function M(){return{sites:new Set,tags:new Map,barrier:N(),runtime:void 0,policy:{}}}function $(n){let e=n;return typeof e==\"object\"&&e!==null&&e.sites instanceof Set&&e.tags instanceof Map&&typeof e.barrier==\"object\"&&typeof e.policy==\"object\"}function _(n=globalThis){try{let e=n[L];if($(e))return e;let t=M();return Object.defineProperty(n,L,{value:t,configurable:!0}),t}catch{return M()}}function P(n,e){return e===void 0?!0:n.sites.has(e)?!1:(n.sites.add(e),!0)}function I(n,e,t,o){let i=`${o??\"\"}\n${t}`,r=n.tags.get(e);return r===void 0?(n.tags.set(e,i),\"mine\"):r===i?\"same\":\"other\"}var R=`${String(1)}.${String(10)}.0`;var H=Object.freeze({major:1,minor:10,majors:Object.freeze([Object.freeze({major:1})])}),E=\"(0|[1-9]\\\\d{0,5})\",ee=new RegExp(`^${E}\\\\.${E}\\\\.${E}$`);var b=Object.freeze({warn:()=>{},reportError:()=>{}});function h(n){return Object.freeze({warn:e=>{try{n.warn(e)}catch{}},reportError:e=>{try{n.reportError(e)}catch{}}})}function U(n){let e=h(n.diagnostics??b),t=r=>{e.warn({code:\"host-api\",tag:\"taggor\",message:`taggor.${r}: invalid argument, returned undefined`})},o=r=>r?.element.isConnected===!0?r:void 0,i=r=>{try{return o(n.live()?.get(r)?.())}catch{return}};return Object.freeze({version:R,ready:()=>n.barrier.ready(),get:r=>{let d=i(r);return d===void 0&&t(\"get\"),d},on:(r,d,s)=>{if(typeof r!=\"string\"||typeof d!=\"string\"||typeof s!=\"function\"){t(\"on\");return}try{let a=n.document??document,p=`${r}:${d}`,g=f=>{let T=!1;try{T=i(f.composedPath()[0])!==void 0}catch{}T&&s(f)};return a.addEventListener(p,g,!0),()=>{try{a.removeEventListener(p,g,!0)}catch{}}}catch{t(\"on\");return}},components:()=>{let r=[];try{for(let d of n.live()?.values()??[])try{let s=o(d());s!==void 0&&r.push(s)}catch{}}catch{}return Object.freeze(r)}})}function w(n,e=globalThis){try{return Object.hasOwn(e,\"taggor\")?!1:(Object.defineProperty(e,\"taggor\",{value:n,writable:!0,configurable:!0,enumerable:!1}),!0)}catch{return!1}}var F=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)+$/;function A(n,e){if(!(typeof n!=\"string\"||n.length>2048))try{let t=new URL(n,e);return t.origin===e&&t.protocol.startsWith(\"http\")?t.href:void 0}catch{return}}function u(n,e){let t=n?.[e];return typeof t==\"string\"?t:void 0}var O=/^[A-Za-z0-9_-]{1,100}$/;function G(n,e){let t=n?.data,o=A(u(t,\"moduleUrl\"),e),i=u(t,\"siteKey\"),r=u(t,\"turnstileSiteKey\");if(!(o===void 0||i===void 0||!O.test(i)))return{moduleUrl:o,baseUrl:e,siteKey:i,turnstileSiteKey:r!==void 0&&O.test(r)?r:void 0}}function v(n){try{let e=new URL(u(n,\"origin\")??\"\").origin,t=A(u(n,\"runtimeUrl\"),e),o=n.manifest,i=o?.components;if(t===void 0||!Array.isArray(i))return;let r=new Map;for(let s of i.slice(0,800)){let a=u(s,\"tag\"),p=A(u(s,\"bundleUrl\"),e),g=u(s,\"contractVersion\"),f=u(s,\"versionHash\");a===void 0||!F.test(a)||r.has(a)||u(s,\"status\")!==\"active\"||p===void 0||g===void 0||f===void 0||r.set(a,{tag:a,bundleUrl:p,contractVersion:g,version:f,defaults:s.defaults,loading:u(s,\"loading\")})}let d=u(o,\"siteKey\");return{runtimeUrl:t,siteKey:d!==void 0&&O.test(d)?d:void 0,servedOn:u(o,\"servedOn\"),components:r,data:G(n,e)}}catch{return}}var x=Object.freeze({ok:!1,code:\"network_error\",fields:Object.freeze([])});function D(n){let e,t=()=>{let o=e??=n();return o.catch(()=>{e===o&&(e=void 0)}),o};return{submit:(o,i,r)=>{try{return t().then(d=>d.submit(o,i,r),()=>x)}catch{return Promise.resolve(x)}},track:o=>{try{t().then(i=>{i.track(o)}).catch(()=>{})}catch{}}}}function k(n,e){let t=o=>new Promise((i,r)=>{let d=e.setTimeout(()=>{r(new Error(\"timeout\"))},1e4),s=()=>{e.clearTimeout(d)};n(o).then(a=>{s(),i(a)},a=>{s(),r(a instanceof Error?a:new Error(\"import failed\"))})});return o=>t(o).catch(()=>new Promise(i=>e.setTimeout(i,1e3)).then(()=>t(o)))}var z={setTimeout:(n,e)=>setTimeout(n,e),clearTimeout:n=>{clearTimeout(n)}};function B(n){return n?.default??void 0}function Y(n,e,t){return D(async()=>(await e(n.moduleUrl)).createDataTransport({baseUrl:n.baseUrl,siteKey:n.siteKey,turnstileSiteKey:n.turnstileSiteKey,nonce:t.nonce,scriptUrl:t.scriptUrl}))}function W(n,e){try{n?.warn({code:\"tag-collision\",tag:e,message:`<${e}> is already loaded by another snippet; the first stays.`})}catch{}}function X(n,e){let t=n?.manifest;return t?.tag===e.tag&&(t.contractVersion===void 0||t.contractVersion===e.contractVersion)}function j(n,e){try{let t={...e,importModule:k(e.importModule,e.timers??z)},o=_(t.target),{barrier:i}=o;w(U({live:()=>o.runtime?.liveComponents,barrier:i,...t.diagnostics===void 0?{}:{diagnostics:t.diagnostics}}),t.target);let r=v(n);if(r===void 0){o.sites.size===0&&i.expect([]);return}if(!P(o,r.siteKey))return;let d=e.scriptUrl??(c=>c),s=async c=>t.importModule(d(c,new URL(r.runtimeUrl).origin)),a=new Map(r.components),p,g=()=>p??=s(r.runtimeUrl).then(c=>(o.runtime=c,o.runtime)),f=async c=>{try{c.loading===\"idle\"&&await s(new URL(\"loading.js\",r.runtimeUrl).href).then(S=>S.idle(),()=>{});let[y,l]=await Promise.all([g(),s(c.bundleUrl)]),m=B(l);m!==void 0&&X(m,c)&&(y.createComponentElement(m,{contractVersion:c.contractVersion,version:c.version,origin:r.runtimeUrl,siteDefaults:c.defaults,...r.servedOn===void 0?{}:{servedOn:r.servedOn},...t.diagnostics===void 0?{}:{diagnostics:t.diagnostics},...t.nonce?{styleNonce:t.nonce}:{},...r.data!==void 0?{transport:Y(r.data,s,t)}:{}}),r.siteKey&&t.beacon?.(new URL(`/e/${r.siteKey}`,r.runtimeUrl),c.version))}catch{}finally{i.settle(c.tag)}},T=()=>{let c=[];if(a.size===0)return c;let y=t.document.querySelectorAll([...a.keys()].join(\",\"));for(let l of y){let m=a.get(l.localName);if(m===void 0)continue;a.delete(l.localName);let S=I(o,m.tag,m.version,r.siteKey);S===\"mine\"?c.push(m):S===\"other\"&&W(t.diagnostics,m.tag)}return c},C=()=>{try{let c=T();i.expect(c.map(l=>l.tag));for(let l of c)f(l);if(a.size===0)return;let y=t.observe(()=>{try{for(let l of T())f(l);a.size===0&&y.disconnect()}catch{}},t.document.documentElement)}catch{i.expect([])}};t.document.readyState===\"loading\"?t.document.addEventListener(\"DOMContentLoaded\",C,{once:!0}):C()}catch{}}var J=\"https://challenges.cloudflare.com\";function K(n,e){let t=new URL(n);if(t.origin!==e||!t.protocol.startsWith(\"http\"))throw new TypeError(\"module URL outside the loader origin\");return t.href}function V(n,e,t={}){return(o,i)=>{let r=K(o,i);if(t.tried!==!0&&n!==void 0){t.tried=!0;try{let d=[i,J];t.policy=n.createPolicy(\"taggor\",{createScriptURL:s=>{let{origin:a}=new URL(s);return K(s,d.includes(a)?a:\"\")}})}catch{e(\"Taggor: the page's trusted-types directive does not list 'taggor'; loading without it.\")}}if(t.policy===void 0)return r;try{return t.policy.createScriptURL(r,i)}catch{return r}}}try{let n=document.currentScript;j(__TAGGOR_LOADER_CONFIG__,{document,importModule:e=>import(e),scriptUrl:V(globalThis.trustedTypes,e=>{console.warn(e)},_().policy),observe:(e,t)=>{let o=new MutationObserver(e);return o.observe(t,{childList:!0,subtree:!0}),o},beacon:(e,t)=>navigator.sendBeacon(e,t),nonce:n instanceof HTMLScriptElement&&n.nonce!==\"\"?n.nonce:void 0})}catch{}})();";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The lazy `loading.js` module of the runtime release (TAG-335, ADR 0064): the waiting a component
|
|
3
|
+
* with `loading: "idle"` does before the loader imports its bundle. It is fetched only by a page
|
|
4
|
+
* that has such a component, so its bytes count against neither the loader nor the runtime budget.
|
|
5
|
+
* Built by `scripts/runtime-release/build.ts` into `rt/<version>/loading.js` (self-contained, no import).
|
|
6
|
+
*/
|
|
7
|
+
/** The longest an idle component waits for an idle moment, in ms: a busy page must not starve it. */
|
|
8
|
+
export declare const IDLE_TIMEOUT_MS = 2000;
|
|
9
|
+
/** The wait of browsers without `requestIdleCallback` (Safari), in ms. */
|
|
10
|
+
export declare const IDLE_FALLBACK_MS = 200;
|
|
11
|
+
/** The scheduling functions this module uses, injectable for tests. */
|
|
12
|
+
export interface IdleScheduler {
|
|
13
|
+
readonly requestIdleCallback?: (callback: () => void, options: {
|
|
14
|
+
timeout: number;
|
|
15
|
+
}) => unknown;
|
|
16
|
+
readonly setTimeout: (callback: () => void, ms: number) => unknown;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Resolves when the page is idle: `requestIdleCallback` (at most `IDLE_TIMEOUT_MS`), or a short
|
|
20
|
+
* timer where it does not exist. Inputs: a scheduler (default the page's, called as its methods).
|
|
21
|
+
* Output: a promise that always resolves, never rejects. Errors: none. Side effects: one callback.
|
|
22
|
+
*/
|
|
23
|
+
export declare function idle(scheduler?: IdleScheduler): Promise<void>;
|
|
24
|
+
//# sourceMappingURL=loading.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loading.d.ts","sourceRoot":"","sources":["../../src/loader/loading.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,qGAAqG;AACrG,eAAO,MAAM,eAAe,OAAO,CAAC;AAEpC,0EAA0E;AAC1E,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAEpC,uEAAuE;AACvE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,OAAO,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC;IAC/F,QAAQ,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;CACpE;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,SAAS,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAY7D"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The lazy `loading.js` module of the runtime release (TAG-335, ADR 0064): the waiting a component
|
|
3
|
+
* with `loading: "idle"` does before the loader imports its bundle. It is fetched only by a page
|
|
4
|
+
* that has such a component, so its bytes count against neither the loader nor the runtime budget.
|
|
5
|
+
* Built by `scripts/runtime-release/build.ts` into `rt/<version>/loading.js` (self-contained, no import).
|
|
6
|
+
*/
|
|
7
|
+
/** The longest an idle component waits for an idle moment, in ms: a busy page must not starve it. */
|
|
8
|
+
export const IDLE_TIMEOUT_MS = 2000;
|
|
9
|
+
/** The wait of browsers without `requestIdleCallback` (Safari), in ms. */
|
|
10
|
+
export const IDLE_FALLBACK_MS = 200;
|
|
11
|
+
/**
|
|
12
|
+
* Resolves when the page is idle: `requestIdleCallback` (at most `IDLE_TIMEOUT_MS`), or a short
|
|
13
|
+
* timer where it does not exist. Inputs: a scheduler (default the page's, called as its methods).
|
|
14
|
+
* Output: a promise that always resolves, never rejects. Errors: none. Side effects: one callback.
|
|
15
|
+
*/
|
|
16
|
+
export function idle(scheduler) {
|
|
17
|
+
return new Promise((done) => {
|
|
18
|
+
const when = scheduler ?? {
|
|
19
|
+
// Absent in Safari: the type says it exists, the browser may not.
|
|
20
|
+
requestIdleCallback: globalThis.requestIdleCallback?.bind(globalThis),
|
|
21
|
+
setTimeout: (callback, ms) => globalThis.setTimeout(callback, ms),
|
|
22
|
+
};
|
|
23
|
+
if (when.requestIdleCallback === undefined)
|
|
24
|
+
when.setTimeout(done, IDLE_FALLBACK_MS);
|
|
25
|
+
else
|
|
26
|
+
when.requestIdleCallback(done, { timeout: IDLE_TIMEOUT_MS });
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=loading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loading.js","sourceRoot":"","sources":["../../src/loader/loading.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,qGAAqG;AACrG,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC;AAEpC,0EAA0E;AAC1E,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAQpC;;;;GAIG;AACH,MAAM,UAAU,IAAI,CAAC,SAAyB;IAC5C,OAAO,IAAI,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAC1B,MAAM,IAAI,GAAG,SAAS,IAAI;YACxB,kEAAkE;YAClE,mBAAmB,EAAG,UAAyC,CAAC,mBAAmB,EAAE,IAAI,CACvF,UAAU,CACX;YACD,UAAU,EAAE,CAAC,QAAoB,EAAE,EAAU,EAAE,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC;SACtF,CAAC;QACF,IAAI,IAAI,CAAC,mBAAmB,KAAK,SAAS;YAAE,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;;YAC/E,IAAI,CAAC,mBAAmB,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;AACL,CAAC"}
|