bearminion 1.15.0 → 1.16.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/CHANGELOG.md +8 -0
- package/dist/astro.d.ts +26 -4
- package/dist/astro.js +49 -11
- package/dist/collections-BbL4_4jt.js +735 -0
- package/dist/content.d.ts +1 -1
- package/dist/{draft-store-BaZYEe56.js → draft-store-DBEfw_Gq.js} +1 -36
- package/dist/{editor-context-CTfxXtny.d.ts → editor-context-BBsL5NFx.d.ts} +41 -3
- package/dist/{github-store-BT9uiq5W.d.ts → github-store-DLQazToO.d.ts} +2 -2
- package/dist/{github-store-D0bQOwdt.js → github-store-DUf07ODw.js} +102 -152
- package/dist/hosted-astro.d.ts +6 -0
- package/dist/hosted-astro.js +15 -0
- package/dist/hosted-middleware-DTnZoRsK.js +343 -0
- package/dist/hosted-overlay.d.ts +2 -0
- package/dist/hosted-overlay.js +2 -0
- package/dist/hosted.d.ts +151 -5
- package/dist/hosted.js +171 -6
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/{page-FipdIFb5.d.ts → page-D1pdneYm.d.ts} +223 -223
- package/dist/request-guards-BcSUj8Gc.js +90 -0
- package/dist/ui/mount.js +2 -1
- package/dist/upload-rules-Cao9uY5K.js +36 -0
- package/package.json +16 -3
- package/registry/default/registry.json +1 -1
- package/dist/preview-ImEm3T8k.js +0 -125
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bearminion",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.0",
|
|
4
4
|
"description": "A git-based CMS for Astro with no database and no server: JSON content in your repo, edited by clicking on the page during astro dev.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Jakub Lange",
|
|
@@ -59,6 +59,14 @@
|
|
|
59
59
|
"types": "./dist/hosted.d.ts",
|
|
60
60
|
"import": "./dist/hosted.js"
|
|
61
61
|
},
|
|
62
|
+
"./hosted-astro": {
|
|
63
|
+
"types": "./dist/hosted-astro.d.ts",
|
|
64
|
+
"import": "./dist/hosted-astro.js"
|
|
65
|
+
},
|
|
66
|
+
"./hosted-overlay": {
|
|
67
|
+
"types": "./dist/hosted-overlay.d.ts",
|
|
68
|
+
"import": "./dist/hosted-overlay.js"
|
|
69
|
+
},
|
|
62
70
|
"./package.json": "./package.json"
|
|
63
71
|
},
|
|
64
72
|
"files": [
|
|
@@ -76,7 +84,11 @@
|
|
|
76
84
|
"provenance": true
|
|
77
85
|
},
|
|
78
86
|
"dependencies": {
|
|
79
|
-
"
|
|
87
|
+
"mdast-util-from-markdown": "^2.1.0",
|
|
88
|
+
"mdast-util-gfm": "^3.1.0",
|
|
89
|
+
"micromark-extension-gfm": "^3.0.0",
|
|
90
|
+
"preact": "^11.0.1",
|
|
91
|
+
"yaml": "^2.9.1"
|
|
80
92
|
},
|
|
81
93
|
"peerDependencies": {
|
|
82
94
|
"astro": "^7.3.0",
|
|
@@ -84,6 +96,7 @@
|
|
|
84
96
|
},
|
|
85
97
|
"devDependencies": {
|
|
86
98
|
"@preact/signals": "2.11.3",
|
|
99
|
+
"@types/mdast": "^4.0.4",
|
|
87
100
|
"@types/node": "^22.19.0",
|
|
88
101
|
"astro": "^7.4.1",
|
|
89
102
|
"happy-dom": "^21.0.3",
|
|
@@ -101,7 +114,7 @@
|
|
|
101
114
|
"zod": "^4.6.7"
|
|
102
115
|
},
|
|
103
116
|
"scripts": {
|
|
104
|
-
"build": "tsdown",
|
|
117
|
+
"build": "tsdown && tsdown -c tsdown.overlay.config.ts",
|
|
105
118
|
"test": "vitest run",
|
|
106
119
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
107
120
|
"dev": "tsdown --watch --no-clean"
|
package/dist/preview-ImEm3T8k.js
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { r as fieldKey } from "./theme-BvqJ8UnS.js";
|
|
2
|
-
//#region src/errors.ts
|
|
3
|
-
function formatContentIssues(issues) {
|
|
4
|
-
return issues.map((issue) => {
|
|
5
|
-
return ` - ${issue.path.length > 0 ? issue.path.map(String).join(".") : "(root)"}: ${issue.message}`;
|
|
6
|
-
}).join("\n");
|
|
7
|
-
}
|
|
8
|
-
/** Base error for content that cannot be loaded. `filePath` is the file or directory involved. */
|
|
9
|
-
var ContentError = class extends Error {
|
|
10
|
-
filePath;
|
|
11
|
-
constructor(filePath, message) {
|
|
12
|
-
super(message);
|
|
13
|
-
this.name = new.target.name;
|
|
14
|
-
this.filePath = filePath;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
/** `site.json` or a page file failed schema validation. */
|
|
18
|
-
var ContentValidationError = class extends ContentError {
|
|
19
|
-
issues;
|
|
20
|
-
constructor(filePath, issues) {
|
|
21
|
-
super(filePath, `Invalid content in ${filePath}:\n${formatContentIssues(issues)}`);
|
|
22
|
-
this.issues = issues;
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
/** A content file or directory is missing, unreadable, or not valid JSON. */
|
|
26
|
-
var ContentReadError = class extends ContentError {};
|
|
27
|
-
//#endregion
|
|
28
|
-
//#region src/section-fields.ts
|
|
29
|
-
const WRAPPERS = /* @__PURE__ */ new Set([
|
|
30
|
-
"optional",
|
|
31
|
-
"nullable",
|
|
32
|
-
"default",
|
|
33
|
-
"prefault",
|
|
34
|
-
"readonly",
|
|
35
|
-
"catch",
|
|
36
|
-
"nonoptional"
|
|
37
|
-
]);
|
|
38
|
-
function defOf(schema) {
|
|
39
|
-
return schema._zod.def;
|
|
40
|
-
}
|
|
41
|
-
/** Strips optional, default, transforms and the like down to the schema that holds the data. */
|
|
42
|
-
function unwrap(schema) {
|
|
43
|
-
let current = schema;
|
|
44
|
-
for (let depth = 0; depth < 16; depth++) {
|
|
45
|
-
const def = defOf(current);
|
|
46
|
-
if (def.type === "pipe" && def.in) current = def.in;
|
|
47
|
-
else if (WRAPPERS.has(def.type) && def.innerType) current = def.innerType;
|
|
48
|
-
else return current;
|
|
49
|
-
}
|
|
50
|
-
return current;
|
|
51
|
-
}
|
|
52
|
-
/** Top-level prop names of a section schema. Empty when `props` is not an object. */
|
|
53
|
-
function schemaProps(schema) {
|
|
54
|
-
const def = defOf(unwrap(schema));
|
|
55
|
-
return def.type === "object" && def.shape ? Object.keys(def.shape) : [];
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Every string enum inside a section's props, by field key (`kind`, `steps[].icon`).
|
|
59
|
-
* The sidebar offers these as choices instead of a free text box.
|
|
60
|
-
*/
|
|
61
|
-
function enumFields(schema) {
|
|
62
|
-
const found = {};
|
|
63
|
-
const visit = (node, path) => {
|
|
64
|
-
const def = defOf(unwrap(node));
|
|
65
|
-
if (def.type === "enum" && def.entries) {
|
|
66
|
-
const values = Object.values(def.entries);
|
|
67
|
-
if (path !== "" && values.every((value) => typeof value === "string")) found[fieldKey(path)] = values;
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
if (def.type === "array" && def.element) visit(def.element, `${path}.0`);
|
|
71
|
-
else if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) visit(child, path === "" ? key : `${path}.${key}`);
|
|
72
|
-
};
|
|
73
|
-
visit(schema, "");
|
|
74
|
-
return found;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Every image inside a section's props (an object with `src` and `alt`), by field key (`poster`, `items[].image`).
|
|
78
|
-
* The sidebar offers an image slot for these even while the prop is missing, whatever the prop is called.
|
|
79
|
-
*/
|
|
80
|
-
function imageFields(schema) {
|
|
81
|
-
const found = [];
|
|
82
|
-
const visit = (node, path) => {
|
|
83
|
-
const def = defOf(unwrap(node));
|
|
84
|
-
if (def.type === "array" && def.element) visit(def.element, `${path}.0`);
|
|
85
|
-
else if (def.type === "object" && def.shape) {
|
|
86
|
-
if (path !== "" && "src" in def.shape && "alt" in def.shape) {
|
|
87
|
-
found.push(fieldKey(path));
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
for (const [key, child] of Object.entries(def.shape)) visit(child, path === "" ? key : `${path}.${key}`);
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
visit(schema, "");
|
|
94
|
-
return found;
|
|
95
|
-
}
|
|
96
|
-
//#endregion
|
|
97
|
-
//#region src/preview.ts
|
|
98
|
-
/**
|
|
99
|
-
* Declare a theme's preview renderer. Default-export it from the module named by `previewModule`
|
|
100
|
-
* (default `/src/lib/render-preview.ts`). The model type ties the inputs to your section registry and site:
|
|
101
|
-
*
|
|
102
|
-
* ```ts
|
|
103
|
-
* export default defineThemePreview<typeof contentModel>({
|
|
104
|
-
* async page({ sections, motion }) { ... },
|
|
105
|
-
* async site({ site, pathname }) { ... },
|
|
106
|
-
* })
|
|
107
|
-
* ```
|
|
108
|
-
*/
|
|
109
|
-
function defineThemePreview(preview) {
|
|
110
|
-
if (typeof preview?.page !== "function") throw new TypeError("defineThemePreview needs a `page` function.");
|
|
111
|
-
if (preview.site !== void 0 && typeof preview.site !== "function") throw new TypeError("defineThemePreview: `site` must be a function when given.");
|
|
112
|
-
return preview;
|
|
113
|
-
}
|
|
114
|
-
/** The theme has no renderer for this preview. The API answers 501 instead of 500. */
|
|
115
|
-
var PreviewUnavailableError = class extends Error {};
|
|
116
|
-
/** Load the preview module through the Vite SSR runner and check it default-exports a preview. */
|
|
117
|
-
async function loadThemePreview(environment, previewModule) {
|
|
118
|
-
const runner = environment.runner;
|
|
119
|
-
if (!runner?.import) throw new PreviewUnavailableError("The SSR dev environment cannot render a preview.");
|
|
120
|
-
const preview = (await runner.import(previewModule))?.default;
|
|
121
|
-
if (!preview || typeof preview.page !== "function") throw new Error(`${previewModule} must default-export defineThemePreview({ page, site? }).`);
|
|
122
|
-
return preview;
|
|
123
|
-
}
|
|
124
|
-
//#endregion
|
|
125
|
-
export { imageFields as a, ContentReadError as c, enumFields as i, ContentValidationError as l, defineThemePreview as n, schemaProps as o, loadThemePreview as r, ContentError as s, PreviewUnavailableError as t, formatContentIssues as u };
|