okno 1.0.0-beta.44 → 1.0.0-beta.45
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/astro/index.d.ts +0 -8
- package/dist/astro/index.d.ts.map +1 -1
- package/dist/astro/index.js +6 -18
- package/dist/build-revision.d.ts +5 -0
- package/dist/build-revision.d.ts.map +1 -0
- package/dist/codegen/generate.d.ts.map +1 -1
- package/dist/codegen/modules.d.ts +12 -7
- package/dist/codegen/modules.d.ts.map +1 -1
- package/dist/codegen/validate-content.d.ts +39 -0
- package/dist/codegen/validate-content.d.ts.map +1 -0
- package/dist/{encode-BfJY0Xy5.js → content-path-Bc0rnTVl.js} +10 -6
- package/dist/dispatch-C1NpqUhY.js +1187 -0
- package/dist/editor/index.d.ts +5 -0
- package/dist/editor/index.d.ts.map +1 -0
- package/dist/editor/index.js +15324 -14664
- package/dist/engine/content-path.d.ts +5 -0
- package/dist/engine/content-path.d.ts.map +1 -0
- package/dist/engine/index.d.ts +1 -0
- package/dist/engine/index.d.ts.map +1 -1
- package/dist/engine/index.js +13 -12
- package/dist/index.js +1 -1
- package/dist/local/dispatch.d.ts.map +1 -1
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +39 -38
- package/dist/next/codegen.d.ts.map +1 -1
- package/dist/next/config.d.ts +3 -0
- package/dist/next/config.d.ts.map +1 -1
- package/dist/next/index.js +85 -77
- package/dist/plugin-4k3fA3lQ.js +504 -0
- package/dist/runtime/wrap.d.ts +13 -1
- package/dist/runtime/wrap.d.ts.map +1 -1
- package/dist/runtime/wrap.js +533 -432
- package/dist/types/fields.d.ts +6 -1
- package/dist/types/fields.d.ts.map +1 -1
- package/dist/types/schema.d.ts +6 -6
- package/dist/types/schema.d.ts.map +1 -1
- package/dist/vite/index.js +1 -1
- package/dist/vite/plugin.d.ts +12 -1
- package/dist/vite/plugin.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/runtime/wrap.test.ts +160 -1
- package/src/runtime/wrap.ts +223 -45
- package/dist/codegen/modules-instant.d.ts +0 -24
- package/dist/codegen/modules-instant.d.ts.map +0 -1
- package/dist/dispatch-CumCB1dI.js +0 -986
- package/dist/engine/materialize.d.ts +0 -66
- package/dist/engine/materialize.d.ts.map +0 -1
- package/dist/plugin-DCxkXmmG.js +0 -587
- package/dist/runtime/instant.d.ts +0 -60
- package/dist/runtime/instant.d.ts.map +0 -1
- package/dist/runtime/instant.js +0 -271
- package/src/runtime/instant.test.ts +0 -391
- package/src/runtime/instant.ts +0 -398
package/dist/astro/index.d.ts
CHANGED
|
@@ -5,14 +5,6 @@ interface AstroIntegrationLike {
|
|
|
5
5
|
"astro:config:setup"(opts: {
|
|
6
6
|
updateConfig(config: Record<string, unknown>): void;
|
|
7
7
|
injectScript(stage: "page" | "before-hydration" | "page-ssr" | "head-inline", code: string): void;
|
|
8
|
-
addMiddleware(opts: {
|
|
9
|
-
entrypoint: string;
|
|
10
|
-
order: "pre" | "post";
|
|
11
|
-
}): void;
|
|
12
|
-
command: "dev" | "build" | "preview" | "sync";
|
|
13
|
-
config: {
|
|
14
|
-
adapter?: unknown;
|
|
15
|
-
};
|
|
16
8
|
}): void;
|
|
17
9
|
};
|
|
18
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/astro/index.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/astro/index.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAGpD,UAAU,oBAAoB;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE;QACN,oBAAoB,CAAC,IAAI,EAAE;YAC1B,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;YACnD,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,kBAAkB,GAAG,UAAU,GAAG,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;SACjG,GAAG,IAAI,CAAA;KACR,CAAA;CACD;AAED,wBAAgB,IAAI,CAAC,MAAM,GAAE,UAAe,GAAG,oBAAoB,CAalE;AAED,eAAe,IAAI,CAAA"}
|
package/dist/astro/index.js
CHANGED
|
@@ -1,27 +1,15 @@
|
|
|
1
|
-
import { o as
|
|
2
|
-
|
|
3
|
-
import { readFileSync as p } from "node:fs";
|
|
4
|
-
function c(o) {
|
|
5
|
-
try {
|
|
6
|
-
return JSON.parse(p(d(process.cwd(), o, "project.json"), "utf-8"))?.instant === !0;
|
|
7
|
-
} catch {
|
|
8
|
-
return !1;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
function k(o = {}) {
|
|
1
|
+
import { o as e } from "../plugin-4k3fA3lQ.js";
|
|
2
|
+
function r(o = {}) {
|
|
12
3
|
return {
|
|
13
4
|
name: "okno",
|
|
14
5
|
hooks: {
|
|
15
|
-
"astro:config:setup"({ updateConfig:
|
|
16
|
-
|
|
17
|
-
t && !n.adapter && console.warn(
|
|
18
|
-
"[okno] instant is on in okno/project.json, but this Astro project has no adapter — falling back to the baked build. Add one (e.g. `npx astro add cloudflare`) and set `export const prerender = false` on okno-driven pages. See docs/instant.md."
|
|
19
|
-
), process.env.OKNO_INSTANT = t && n.adapter ? "1" : "0", e({ vite: { plugins: [i(o)] } }), r("page", 'import "okno/boot"'), t && n.adapter && a({ entrypoint: "okno/instant-middleware", order: "pre" });
|
|
6
|
+
"astro:config:setup"({ updateConfig: t, injectScript: n }) {
|
|
7
|
+
t({ vite: { plugins: [e(o, { imageMode: "astro" })] } }), n("page", 'import "okno/boot"');
|
|
20
8
|
}
|
|
21
9
|
}
|
|
22
10
|
};
|
|
23
11
|
}
|
|
24
12
|
export {
|
|
25
|
-
|
|
26
|
-
|
|
13
|
+
r as default,
|
|
14
|
+
r as okno
|
|
27
15
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** The only publication metadata a deployed site needs. It is generated from
|
|
2
|
+
* the checked-out content alongside the framework's ordinary build output. */
|
|
3
|
+
export declare function readPublicationRevision(oknoDir: string): number;
|
|
4
|
+
export declare function writeDeploymentMarker(oknoDir: string, staticRoot: string): void;
|
|
5
|
+
//# sourceMappingURL=build-revision.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-revision.d.ts","sourceRoot":"","sources":["../src/build-revision.ts"],"names":[],"mappings":"AAGA;8EAC8E;AAC9E,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAS/D;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAK/E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/codegen/generate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/codegen/generate.ts"],"names":[],"mappings":"AAqIA;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iBAoOhE"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
/** How a generated content module resolves `.image.src` for its framework.
|
|
2
|
+
* `raw` is the universal contract used by Next, Nuxt and generic Vite apps:
|
|
3
|
+
* their image component accepts a URL and owns optimization. Astro needs an
|
|
4
|
+
* imported asset instead, so its integration explicitly selects `astro`. */
|
|
5
|
+
export type ImageMode = "raw" | "astro";
|
|
6
|
+
/** Setup emitted into pages/collections/globals. Raw is deliberately the
|
|
7
|
+
* default: adding Okno's ordinary Vite plugin must never assume Astro semantics. */
|
|
8
|
+
export declare function imageMapSetup(mode?: ImageMode): string;
|
|
2
9
|
/** The `okno:runtime` module body (the built `dist/runtime/wrap.js`), or null
|
|
3
10
|
* when it's missing (unbuilt tree — run `bun run build:pkg`). */
|
|
4
11
|
export declare function getRuntimeSource(): string | null;
|
|
5
|
-
/** The `okno:instant` module body (the built `dist/runtime/instant.js`) —
|
|
6
|
-
* same resolution dance as the wrap runtime above. */
|
|
7
|
-
export declare function getInstantRuntimeSource(): string | null;
|
|
8
12
|
/** The umbrella `okno:content` module: one import, all kinds namespaced
|
|
9
13
|
* (`import * as okno from "okno/content"` → okno.pages / .globals /
|
|
10
14
|
* .collections) + the UI-strings store (okno.strings). Pure re-export — the
|
|
@@ -15,6 +19,7 @@ export declare function listContentFiles(dir: string): Promise<string[]>;
|
|
|
15
19
|
* and the `drafts` opt-in flag. Best-effort — a missing/unparseable schema
|
|
16
20
|
* yields empty (file order, no draft filtering). */
|
|
17
21
|
export declare function readCollectionConfig(oknoDir: string): {
|
|
22
|
+
names: string[];
|
|
18
23
|
orders: Record<string, string[]>;
|
|
19
24
|
/** Collections that OPTED OUT (`drafts: false`) — the workflow is on by default. */
|
|
20
25
|
draftsOff: Set<string>;
|
|
@@ -40,9 +45,9 @@ export declare function buildLocalesModule(oknoDir: string): string;
|
|
|
40
45
|
*/
|
|
41
46
|
export declare function buildStringsModule(oknoDir: string): Promise<string>;
|
|
42
47
|
/** Build virtual module for okno:pages */
|
|
43
|
-
export declare function buildPagesModule(oknoDir: string, used?: Set<string
|
|
48
|
+
export declare function buildPagesModule(oknoDir: string, used?: Set<string>, imageMode?: ImageMode): Promise<string>;
|
|
44
49
|
/** Build virtual module for okno:collections — exports each collection as a named array */
|
|
45
|
-
export declare function buildCollectionsModule(oknoDir: string, used?: Set<string>, isBuild?: boolean): Promise<string>;
|
|
50
|
+
export declare function buildCollectionsModule(oknoDir: string, used?: Set<string>, isBuild?: boolean, imageMode?: ImageMode): Promise<string>;
|
|
46
51
|
/** Build virtual module for okno:globals */
|
|
47
|
-
export declare function buildGlobalsModule(oknoDir: string, used?: Set<string
|
|
52
|
+
export declare function buildGlobalsModule(oknoDir: string, used?: Set<string>, imageMode?: ImageMode): Promise<string>;
|
|
48
53
|
//# sourceMappingURL=modules.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../../src/codegen/modules.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../../src/codegen/modules.ts"],"names":[],"mappings":"AAoBA;;;4EAG4E;AAC5E,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,OAAO,CAAA;AAMvC;oFACoF;AACpF,wBAAgB,aAAa,CAAC,IAAI,GAAE,SAAiB,GAAG,MAAM,CAE7D;AAoBD;kEACkE;AAClE,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAKhD;AAED;;;mCAGmC;AACnC,wBAAgB,kBAAkB,IAAI,MAAM,CAO3C;AA+CD,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAIrE;AAED;;qDAEqD;AACrD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG;IACtD,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;IAChC,oFAAoF;IACpF,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACtB,wEAAwE;IACxE,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAC1B,CAuBA;AAwBD,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEtD;AAMD;;;;;+EAK+E;AAC/E,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAoD1D;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAwDzE;AAED,0CAA0C;AAC1C,wBAAsB,gBAAgB,CACrC,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,GAAG,CAAC,MAAM,CAAa,EAC7B,SAAS,GAAE,SAAiB,GAC1B,OAAO,CAAC,MAAM,CAAC,CA8FjB;AAED,2FAA2F;AAC3F,wBAAsB,sBAAsB,CAC3C,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,GAAG,CAAC,MAAM,CAAa,EAC7B,OAAO,UAAQ,EACf,SAAS,GAAE,SAAiB,GAC1B,OAAO,CAAC,MAAM,CAAC,CAyJjB;AAED,4CAA4C;AAC5C,wBAAsB,kBAAkB,CACvC,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,GAAG,CAAC,MAAM,CAAa,EAC7B,SAAS,GAAE,SAAiB,GAC1B,OAAO,CAAC,MAAM,CAAC,CA+EjB"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
type Def = {
|
|
2
|
+
type?: string;
|
|
3
|
+
required?: boolean;
|
|
4
|
+
multiple?: boolean;
|
|
5
|
+
collection?: string;
|
|
6
|
+
block?: string;
|
|
7
|
+
blocks?: string[];
|
|
8
|
+
fields?: Fields;
|
|
9
|
+
options?: Array<string | {
|
|
10
|
+
value?: string;
|
|
11
|
+
}>;
|
|
12
|
+
};
|
|
13
|
+
type Fields = Record<string, Def>;
|
|
14
|
+
type Schema = {
|
|
15
|
+
pages?: Record<string, {
|
|
16
|
+
fields?: Fields;
|
|
17
|
+
}>;
|
|
18
|
+
collections?: Record<string, {
|
|
19
|
+
fields?: Fields;
|
|
20
|
+
}>;
|
|
21
|
+
globals?: Record<string, {
|
|
22
|
+
fields?: Fields;
|
|
23
|
+
}>;
|
|
24
|
+
blocks?: Record<string, {
|
|
25
|
+
fields?: Fields;
|
|
26
|
+
}>;
|
|
27
|
+
locales?: {
|
|
28
|
+
supported?: Array<string | {
|
|
29
|
+
id?: string;
|
|
30
|
+
}>;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
/** Validate the small part TypeScript cannot prove by itself: actual repository
|
|
34
|
+
* values against schema fields, polymorphic block tags, and reference targets.
|
|
35
|
+
* Content remains plain static TS; this runs during codegen/build and has no
|
|
36
|
+
* runtime or framework dependency. */
|
|
37
|
+
export declare function validateContent(oknoDir: string, schema: Schema | null): void;
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=validate-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-content.d.ts","sourceRoot":"","sources":["../../src/codegen/validate-content.ts"],"names":[],"mappings":"AAIA,KAAK,GAAG,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAA;AAC3L,KAAK,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AACjC,KAAK,MAAM,GAAG;IACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC5C,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG;YAAE,EAAE,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAAA;CACzD,CAAA;AAwBD;;;sCAGsC;AACtC,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAgH5E"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
function
|
|
2
|
-
const n = { date: t.now, author: t.author },
|
|
3
|
-
return `export default ${JSON.stringify(
|
|
1
|
+
function a(e, t) {
|
|
2
|
+
const n = { date: t.now, author: t.author }, r = { ...e, created: t.created ?? n, updated: n };
|
|
3
|
+
return `export default ${JSON.stringify(r, null, " ")}
|
|
4
4
|
`;
|
|
5
5
|
}
|
|
6
6
|
function o(e, t = `import type { Schema } from "okno"
|
|
@@ -9,12 +9,16 @@ function o(e, t = `import type { Schema } from "okno"
|
|
|
9
9
|
return `${t}export default ${JSON.stringify(e, null, " ")} satisfies Schema
|
|
10
10
|
`;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function i(e) {
|
|
13
13
|
return `export default ${JSON.stringify(e, null, " ")}
|
|
14
14
|
`;
|
|
15
15
|
}
|
|
16
|
+
function u(e) {
|
|
17
|
+
return /^collections\/(?:[^/]+\/){1,2}new\.ts$/.test(e);
|
|
18
|
+
}
|
|
16
19
|
export {
|
|
17
20
|
o as a,
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
i as b,
|
|
22
|
+
a as e,
|
|
23
|
+
u as i
|
|
20
24
|
};
|