astronaut-cms 0.0.1 → 1.1.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 +84 -3
- package/dist/admin/THIRD_PARTY_LICENSES.md +7646 -0
- package/dist/admin/assets/assistant-DTlSNidc.js +235 -0
- package/dist/admin/assets/badge-BfN73-be.js +1 -0
- package/dist/admin/assets/changes-h1lmD7AA.js +1 -0
- package/dist/admin/assets/client-B4PWCmC4.js +5 -0
- package/dist/admin/assets/clsx-DB0hHKMi.js +1 -0
- package/dist/admin/assets/collapsible-item-zlnNAUdM.js +1 -0
- package/dist/admin/assets/collapsible-mcJ6G3X4.js +1 -0
- package/dist/admin/assets/collections._collection-D-rC9E9v.js +1 -0
- package/dist/admin/assets/collections._collection._entry-UD8hLmC1.js +52 -0
- package/dist/admin/assets/collections._collection.index-Cgc93hCD.js +1 -0
- package/dist/admin/assets/component-lookup-8lVQh8pl.js +4 -0
- package/dist/admin/assets/config-Pm_BHLNT.js +1 -0
- package/dist/admin/assets/copy-DxuErr3x.js +1 -0
- package/dist/admin/assets/css-BGIxQoYs.js +1 -0
- package/dist/admin/assets/css-DgaLhXQH.js +1 -0
- package/dist/admin/assets/diff-woXpYk--.js +1 -0
- package/dist/admin/assets/dist-DVv3ALC7.js +1 -0
- package/dist/admin/assets/dist-Dpyc1riS.js +1 -0
- package/dist/admin/assets/docx-BctAmX91.js +56 -0
- package/dist/admin/assets/editor-BauN0yXd.js +2 -0
- package/dist/admin/assets/empty-DAOUBpWb.js +1 -0
- package/dist/admin/assets/entry-link-DhcL6M5c.js +158 -0
- package/dist/admin/assets/error-banner-CNWZU5u_.js +161 -0
- package/dist/admin/assets/errors-DkJ5E_ak.js +1 -0
- package/dist/admin/assets/field-CbbZZGxO.js +41 -0
- package/dist/admin/assets/field-schema-CacrjSYw.js +1 -0
- package/dist/admin/assets/file-text-Ciz5Mr4S.js +1 -0
- package/dist/admin/assets/github-dark-C-LZuMrd.js +1 -0
- package/dist/admin/assets/github-light-EUqPIrTm.js +1 -0
- package/dist/admin/assets/highlighted-body-JLMTFACH-D1bycIV3.js +1 -0
- package/dist/admin/assets/html-CvFb5cGI.js +1 -0
- package/dist/admin/assets/javascript-BzbQS41l.js +1 -0
- package/dist/admin/assets/javascript-CpIGwZ_Y.js +1 -0
- package/dist/admin/assets/json-qhed-kSA.js +1 -0
- package/dist/admin/assets/jsx-Bz0zcwM4.js +1 -0
- package/dist/admin/assets/lib-CC_S4yjQ.js +21 -0
- package/dist/admin/assets/library-Da82FNwp.js +1 -0
- package/dist/admin/assets/list-skeleton-BXLP4Fak.js +1 -0
- package/dist/admin/assets/markdown-BYOwaDjH.js +1 -0
- package/dist/admin/assets/matchContext-BjW1F-Cq.js +2 -0
- package/dist/admin/assets/media-browser-DeKpWCUD.js +1 -0
- package/dist/admin/assets/media._library-DGnXJc0I.js +1 -0
- package/dist/admin/assets/mermaid-WFAXDIZX-CqFnahFh.js +1 -0
- package/dist/admin/assets/page-header-C2Uwa_yv.js +1 -0
- package/dist/admin/assets/pdf-BSEX-sd8.js +106 -0
- package/dist/admin/assets/python-gzcpVVnB.js +1 -0
- package/dist/admin/assets/react-CXnqG51l.js +1 -0
- package/dist/admin/assets/rolldown-runtime-BWaJ3C7D.js +1 -0
- package/dist/admin/assets/routes-Bx9rPcHA.js +1 -0
- package/dist/admin/assets/routes-D7tEdYGV.js +1 -0
- package/dist/admin/assets/save-actions-DrVgh3KH.js +32 -0
- package/dist/admin/assets/select-CMV39q80.js +1 -0
- package/dist/admin/assets/separator-C9bNKNSU.js +3 -0
- package/dist/admin/assets/shell-DBEiq06l.js +1 -0
- package/dist/admin/assets/shellscript-CLZ0U2zV.js +1 -0
- package/dist/admin/assets/skeleton-DTwTUSqm.js +1 -0
- package/dist/admin/assets/sql-CEbI0hMM.js +1 -0
- package/dist/admin/assets/syntax-DDPd1mQn.js +8 -0
- package/dist/admin/assets/toggle-B6ASf-kL.js +1 -0
- package/dist/admin/assets/toml-BPTmHmyx.js +1 -0
- package/dist/admin/assets/tsx-udAQXfEw.js +1 -0
- package/dist/admin/assets/typescript-bsJCZSQ-.js +1 -0
- package/dist/admin/assets/ui.module.css-BdAmwQeM.js +56 -0
- package/dist/admin/assets/use-entries-CrNqaMfa.js +1 -0
- package/dist/admin/assets/useSelector-Cs39W18m.js +1 -0
- package/dist/admin/assets/yaml-rwi0_p6S.js +1 -0
- package/dist/admin/assets/zwitch-Wwuax-dJ.js +1 -0
- package/dist/admin/bootstrap.d.ts +1 -0
- package/dist/admin/bootstrap.js +1 -0
- package/dist/admin/editor.d.ts +1065 -0
- package/dist/admin/editor.js +1 -0
- package/dist/server/THIRD_PARTY_LICENSES.md +49 -0
- package/dist/server/assets.d.ts +30 -0
- package/dist/server/assets.js +30 -0
- package/dist/server/chunks/anchors-DuZ1fokt.js +86 -0
- package/dist/server/chunks/auth-DJP9ryVd.js +44 -0
- package/dist/server/chunks/cms-markers-CUqrOnfA.js +78 -0
- package/dist/server/chunks/component-lookup-DAFg_Qg8.js +128 -0
- package/dist/server/chunks/config-BsOYly9a.d.ts +1210 -0
- package/dist/server/chunks/digest-tkKu_Wj5.js +753 -0
- package/dist/server/chunks/entry-checks-3SxhoHwH.js +608 -0
- package/dist/server/chunks/field-schema-CfdN75jT.js +48 -0
- package/dist/server/chunks/http-BnsNh57m.d.ts +35 -0
- package/dist/server/chunks/i18n-BPmx7ESy.d.ts +15 -0
- package/dist/server/chunks/index-CYbkNvu5.d.ts +22 -0
- package/dist/server/chunks/media-BhqUVVYY.js +223 -0
- package/dist/server/chunks/paths-CEW9fvg8.js +17 -0
- package/dist/server/chunks/paths-Dztx2eUw.js +13 -0
- package/dist/server/chunks/types-DkkewFTT.js +418 -0
- package/dist/server/chunks/types-Dkx4Xovf.d.ts +359 -0
- package/dist/server/chunks/types-Jew_-Qpp.d.ts +273 -0
- package/dist/server/chunks/user-config-CqNK-Ebs.js +292 -0
- package/dist/server/chunks/xml-D8qPILJU.js +81 -0
- package/dist/server/config.d.ts +3 -0
- package/dist/server/config.js +22 -0
- package/dist/server/content.d.ts +58 -0
- package/dist/server/content.js +83 -0
- package/dist/server/endpoint.d.ts +16 -0
- package/dist/server/endpoint.js +2726 -0
- package/dist/server/integration.d.ts +7 -0
- package/dist/server/integration.js +1187 -0
- package/dist/server/internal.d.ts +100 -0
- package/dist/server/internal.js +30 -0
- package/dist/server/server-local.d.ts +453 -0
- package/dist/server/server-local.js +336 -0
- package/dist/styles/THIRD_PARTY_LICENSES.md +193 -0
- package/dist/styles/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
- package/dist/styles/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
- package/dist/styles/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/dist/styles/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/dist/styles/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
- package/dist/styles/styles.css +3 -0
- package/package.json +151 -5
- package/src/astro/Image.astro +28 -0
- package/src/astro/Video.astro +44 -0
- package/src/astro/admin.astro +137 -0
- package/src/astro/licenses.ts +5 -0
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import { u as globRoots } from "./chunks/types-DkkewFTT.js";
|
|
2
|
+
import { d as getErrorCode, h as staleWrite, i as StorageBase, n as sha256, p as isNotFound } from "./chunks/digest-tkKu_Wj5.js";
|
|
3
|
+
import { n as isWithin, t as assertWithinBase } from "./chunks/paths-Dztx2eUw.js";
|
|
4
|
+
import { c as partialContent } from "./chunks/component-lookup-DAFg_Qg8.js";
|
|
5
|
+
import { u as libraryDirectories } from "./chunks/media-BhqUVVYY.js";
|
|
6
|
+
import { openAsBlob } from "node:fs";
|
|
7
|
+
import { basename, dirname, join, relative } from "pathe";
|
|
8
|
+
import { link, mkdir, readFile, readdir, realpath, rm, stat, writeFile } from "node:fs/promises";
|
|
9
|
+
import { execFile } from "node:child_process";
|
|
10
|
+
import { promisify } from "node:util";
|
|
11
|
+
// src/server/storage/git-changes.ts
|
|
12
|
+
/**
|
|
13
|
+
* Git-backed changeset for the local (dev) storage backend.
|
|
14
|
+
*
|
|
15
|
+
* The remote backends get their changeset for free: everything on the user's
|
|
16
|
+
* draft branch is pending, and publishing merges it. Local storage writes
|
|
17
|
+
* straight into the working tree, so the equivalent comes from git itself: what
|
|
18
|
+
* the working tree holds beyond the index. The index is the developer's own
|
|
19
|
+
* checkpoint, so whatever they staged is theirs, and neither listed nor
|
|
20
|
+
* discarded. Every command is scoped to the paths the CMS manages (collection
|
|
21
|
+
* directories, file-collection files, the media directory), so a discard can
|
|
22
|
+
* never touch the developer's source edits either.
|
|
23
|
+
*/
|
|
24
|
+
var run = promisify(execFile);
|
|
25
|
+
var MAX_OUTPUT = 33554432;
|
|
26
|
+
async function git(rootDir, args) {
|
|
27
|
+
const { stdout } = await run("git", args, {
|
|
28
|
+
cwd: rootDir,
|
|
29
|
+
maxBuffer: MAX_OUTPUT
|
|
30
|
+
});
|
|
31
|
+
return stdout;
|
|
32
|
+
}
|
|
33
|
+
async function gitDiff(rootDir, args) {
|
|
34
|
+
try {
|
|
35
|
+
return await git(rootDir, args) || void 0;
|
|
36
|
+
} catch (error) {
|
|
37
|
+
return error.stdout || void 0;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The project's position inside the repository (`""` at its root), or null when
|
|
42
|
+
* there is no repository. Porcelain paths are repository-relative while the rest
|
|
43
|
+
* of the CMS is project-relative, so this prefix is what translates between them.
|
|
44
|
+
*/
|
|
45
|
+
async function repositoryPrefix(rootDir) {
|
|
46
|
+
try {
|
|
47
|
+
return (await git(rootDir, ["rev-parse", "--show-prefix"])).trim();
|
|
48
|
+
} catch {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function toKind(worktree) {
|
|
53
|
+
if (worktree === "?") return "added";
|
|
54
|
+
if (worktree === "D") return "deleted";
|
|
55
|
+
return "modified";
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Parses `git status --porcelain=v1 -z`: NUL-terminated records of `XY <path>`,
|
|
59
|
+
* where a staged rename or copy is followed by a second record holding the old
|
|
60
|
+
* path. Only records whose working tree differs from the index are kept, since
|
|
61
|
+
* whatever the developer staged is theirs. Paths are made project-relative by
|
|
62
|
+
* stripping the repository prefix.
|
|
63
|
+
*/
|
|
64
|
+
function parseStatus(stdout, prefix) {
|
|
65
|
+
const records = stdout.split("\0").filter(Boolean).values();
|
|
66
|
+
const entries = [];
|
|
67
|
+
const strip = (path) => path.startsWith(prefix) ? path.slice(prefix.length) : path;
|
|
68
|
+
for (const record of records) {
|
|
69
|
+
const [staged = " ", worktree = " "] = record;
|
|
70
|
+
if (staged === "R" || staged === "C") records.next();
|
|
71
|
+
if (worktree === " ") continue;
|
|
72
|
+
entries.push({
|
|
73
|
+
path: strip(record.slice(3)),
|
|
74
|
+
kind: toKind(worktree),
|
|
75
|
+
untracked: worktree === "?"
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return entries;
|
|
79
|
+
}
|
|
80
|
+
async function readStatus(rootDir, paths, prefix) {
|
|
81
|
+
if (paths.length === 0) return [];
|
|
82
|
+
return parseStatus(await git(rootDir, [
|
|
83
|
+
"status",
|
|
84
|
+
"--porcelain=v1",
|
|
85
|
+
"-z",
|
|
86
|
+
"-uall",
|
|
87
|
+
"--",
|
|
88
|
+
...paths
|
|
89
|
+
]), prefix);
|
|
90
|
+
}
|
|
91
|
+
async function toFileChange(rootDir, entry) {
|
|
92
|
+
const patch = entry.untracked ? await gitDiff(rootDir, [
|
|
93
|
+
"diff",
|
|
94
|
+
"--no-index",
|
|
95
|
+
"--",
|
|
96
|
+
"/dev/null",
|
|
97
|
+
entry.path
|
|
98
|
+
]) : await gitDiff(rootDir, [
|
|
99
|
+
"diff",
|
|
100
|
+
"--",
|
|
101
|
+
entry.path
|
|
102
|
+
]);
|
|
103
|
+
return {
|
|
104
|
+
path: entry.path,
|
|
105
|
+
kind: entry.kind,
|
|
106
|
+
patch
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/** Unstaged changes to the managed paths, in the shape the git backends report. */
|
|
110
|
+
async function readChanges(rootDir, paths) {
|
|
111
|
+
const prefix = await repositoryPrefix(rootDir);
|
|
112
|
+
if (prefix === null) return [];
|
|
113
|
+
const entries = await readStatus(rootDir, paths, prefix);
|
|
114
|
+
return Promise.all(entries.map((entry) => toFileChange(rootDir, entry)));
|
|
115
|
+
}
|
|
116
|
+
/** Restores every managed path to its staged state, deleting files that were newly added. */
|
|
117
|
+
async function discardChanges(rootDir, paths) {
|
|
118
|
+
const prefix = await repositoryPrefix(rootDir);
|
|
119
|
+
if (prefix === null) return;
|
|
120
|
+
const entries = await readStatus(rootDir, paths, prefix);
|
|
121
|
+
const tracked = entries.filter((entry) => !entry.untracked);
|
|
122
|
+
const untracked = entries.filter((entry) => entry.untracked);
|
|
123
|
+
if (tracked.length > 0) await git(rootDir, [
|
|
124
|
+
"restore",
|
|
125
|
+
"--worktree",
|
|
126
|
+
"--",
|
|
127
|
+
...tracked.map((entry) => entry.path)
|
|
128
|
+
]);
|
|
129
|
+
await Promise.all(untracked.map((entry) => {
|
|
130
|
+
const filePath = join(rootDir, entry.path);
|
|
131
|
+
assertWithinBase(filePath, rootDir);
|
|
132
|
+
return rm(filePath, { force: true });
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* The project-relative paths the CMS owns: every collection's storage location
|
|
137
|
+
* plus the media directories. Anything outside this set is the developer's, and
|
|
138
|
+
* no CMS command may read or write it.
|
|
139
|
+
*/
|
|
140
|
+
function managedPaths(options) {
|
|
141
|
+
const { rootDir, mediaDirs, collections } = options;
|
|
142
|
+
return [.../* @__PURE__ */ new Set([...mediaDirs.map((dir) => relative(rootDir, dir)), ...Object.values(collections).flatMap((collection) => collection.loaderFileName ? [collection.loaderFileName] : globRoots(collection).map((root) => root.path))])].filter((path) => path !== "");
|
|
143
|
+
}
|
|
144
|
+
// src/server/storage/local.ts
|
|
145
|
+
/**
|
|
146
|
+
* The working tree as a storage backend, used by `astro dev`.
|
|
147
|
+
*
|
|
148
|
+
* It is a peer of the Git backends rather than a separate API: the same
|
|
149
|
+
* operations reach it, validated the same way, so nothing above the storage
|
|
150
|
+
* layer knows which one it is talking to. Writes are bounded to the paths the
|
|
151
|
+
* CMS manages, so a crafted entry id or media path cannot reach the developer's
|
|
152
|
+
* own files.
|
|
153
|
+
*
|
|
154
|
+
* Node-only. The integration substitutes a stub for it in any build that is not
|
|
155
|
+
* a dev run, so `node:fs` never enters a Workers or edge bundle.
|
|
156
|
+
*/
|
|
157
|
+
var LocalStorage = class extends StorageBase {
|
|
158
|
+
rootDir;
|
|
159
|
+
managed;
|
|
160
|
+
/** The roots as the filesystem actually names them. Fixed, so resolved once. */
|
|
161
|
+
canonicalRoots;
|
|
162
|
+
constructor(config, options) {
|
|
163
|
+
super(options);
|
|
164
|
+
this.rootDir = config.rootDir;
|
|
165
|
+
this.managed = managedPaths({
|
|
166
|
+
rootDir: config.rootDir,
|
|
167
|
+
mediaDirs: libraryDirectories(options.media).map((dir) => join(config.rootDir, dir)),
|
|
168
|
+
collections: options.collections
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
roots() {
|
|
172
|
+
this.canonicalRoots ??= (async () => {
|
|
173
|
+
const [root, managed] = await Promise.all([canonical(this.rootDir), Promise.all(this.managed.map(async (dir) => {
|
|
174
|
+
const absolute = join(this.rootDir, dir);
|
|
175
|
+
return [absolute, await canonical(absolute)];
|
|
176
|
+
}))]);
|
|
177
|
+
return {
|
|
178
|
+
root,
|
|
179
|
+
managed: new Map(managed)
|
|
180
|
+
};
|
|
181
|
+
})();
|
|
182
|
+
return this.canonicalRoots;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* A project-relative path lowered to an absolute one the CMS is allowed to
|
|
186
|
+
* touch. Joining first means a crafted `..` cannot smuggle a path out of the
|
|
187
|
+
* project, and the allowlist then bounds it to the content model.
|
|
188
|
+
*/
|
|
189
|
+
async resolve(path) {
|
|
190
|
+
const fullPath = join(this.rootDir, path);
|
|
191
|
+
assertWithinBase(fullPath, this.rootDir);
|
|
192
|
+
const { root, managed } = await this.roots();
|
|
193
|
+
const actualManagedRoot = managed.entries().find(([absolute]) => isWithin(fullPath, absolute))?.[1];
|
|
194
|
+
if (actualManagedRoot === void 0) throw new Error(`Path is not managed by the CMS: ${path}`);
|
|
195
|
+
if (!isWithin(actualManagedRoot, root) || !isWithin(await canonical(fullPath), actualManagedRoot)) throw new Error(`Path escapes the managed directory: ${path}`);
|
|
196
|
+
return fullPath;
|
|
197
|
+
}
|
|
198
|
+
/** Every file below a managed directory, or the managed file itself, project-relative. */
|
|
199
|
+
async filesAt(path, file = false) {
|
|
200
|
+
try {
|
|
201
|
+
if (file) return (await stat(await this.resolve(path))).isFile() ? [path] : [];
|
|
202
|
+
return (await readdir(await this.resolve(path), {
|
|
203
|
+
withFileTypes: true,
|
|
204
|
+
recursive: true
|
|
205
|
+
})).filter((entry) => !entry.isDirectory()).map((entry) => relative(this.rootDir, join(entry.parentPath, entry.name)));
|
|
206
|
+
} catch (error) {
|
|
207
|
+
if (isNotFound(error)) return [];
|
|
208
|
+
throw error;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
async fileAt(path) {
|
|
212
|
+
const stats = await stat(await this.resolve(path));
|
|
213
|
+
return {
|
|
214
|
+
path,
|
|
215
|
+
size: stats.size,
|
|
216
|
+
version: statVersion(stats)
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
async writeFileAt(path, content, createOnly = false) {
|
|
220
|
+
const fullPath = await this.resolve(path);
|
|
221
|
+
await mkdir(dirname(fullPath), { recursive: true });
|
|
222
|
+
try {
|
|
223
|
+
await writeFile(fullPath, content, createOnly ? { flag: "wx" } : void 0);
|
|
224
|
+
} catch (error) {
|
|
225
|
+
if (createOnly && getErrorCode(error) === "EEXIST") throw staleWrite(path);
|
|
226
|
+
throw error;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
async globPaths(col) {
|
|
230
|
+
return (await Promise.all(globRoots(col).map(({ path, file }) => this.filesAt(path, file)))).flat();
|
|
231
|
+
}
|
|
232
|
+
async fetchFileContent(path) {
|
|
233
|
+
const content = await readFile(await this.resolve(path), "utf-8");
|
|
234
|
+
return {
|
|
235
|
+
content,
|
|
236
|
+
version: await sha256(content)
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* The working tree has nothing that names a file's state, so the state is
|
|
241
|
+
* named by its contents. A dev run is one editor, but the assistant writes
|
|
242
|
+
* here too, and the check being exercised in development is how it is known to
|
|
243
|
+
* work in production.
|
|
244
|
+
*/
|
|
245
|
+
async commitFile(path, content, _message, precondition) {
|
|
246
|
+
const absent = precondition !== void 0 && "absent" in precondition;
|
|
247
|
+
if (precondition !== void 0 && !absent) await this.assertVersion(path, precondition.version);
|
|
248
|
+
await this.writeFileAt(path, content, absent);
|
|
249
|
+
return sha256(content);
|
|
250
|
+
}
|
|
251
|
+
async removeFile(path, _message, expectedVersion) {
|
|
252
|
+
if (expectedVersion !== void 0) await this.assertVersion(path, expectedVersion);
|
|
253
|
+
await rm(await this.resolve(path), { force: true });
|
|
254
|
+
}
|
|
255
|
+
/** The working tree names a file's state by its contents, so this reads them back. */
|
|
256
|
+
async assertVersion(path, expectedVersion) {
|
|
257
|
+
if ((await this.fetchFileContent(path).catch(() => null))?.version !== expectedVersion) throw staleWrite(path);
|
|
258
|
+
}
|
|
259
|
+
async listMedia() {
|
|
260
|
+
const paths = await this.filesAt(this.mediaDirectory);
|
|
261
|
+
return this.mediaFiles(await Promise.all(paths.map((path) => this.fileAt(path))));
|
|
262
|
+
}
|
|
263
|
+
async writeMedia(repoPath, bytes, overwrite) {
|
|
264
|
+
await this.writeFileAt(repoPath, bytes, !overwrite);
|
|
265
|
+
}
|
|
266
|
+
async moveMedia(from, to) {
|
|
267
|
+
const source = await this.resolve(from);
|
|
268
|
+
const target = await this.resolve(to);
|
|
269
|
+
await mkdir(dirname(target), { recursive: true });
|
|
270
|
+
try {
|
|
271
|
+
await link(source, target);
|
|
272
|
+
} catch (error) {
|
|
273
|
+
if (getErrorCode(error) === "EEXIST") throw staleWrite(to);
|
|
274
|
+
throw error;
|
|
275
|
+
}
|
|
276
|
+
await rm(source);
|
|
277
|
+
}
|
|
278
|
+
async removeMedia(repoPath) {
|
|
279
|
+
await this.removeFile(repoPath);
|
|
280
|
+
}
|
|
281
|
+
/** Streamed from disk, and only the range asked for, so no read costs the whole file. */
|
|
282
|
+
async readMedia(path, range) {
|
|
283
|
+
const fullPath = await this.resolve(this.mediaRepoPath(path));
|
|
284
|
+
const stats = await stat(fullPath);
|
|
285
|
+
const partial = range && partialContent(range, stats.size);
|
|
286
|
+
const base = {
|
|
287
|
+
version: statVersion(stats),
|
|
288
|
+
partial
|
|
289
|
+
};
|
|
290
|
+
if (partial && !partial.span) return {
|
|
291
|
+
...base,
|
|
292
|
+
body: null
|
|
293
|
+
};
|
|
294
|
+
const blob = await openAsBlob(fullPath);
|
|
295
|
+
return {
|
|
296
|
+
...base,
|
|
297
|
+
body: partial?.span ? blob.slice(partial.span.start, partial.span.end + 1) : blob
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
async publish() {}
|
|
301
|
+
async update() {}
|
|
302
|
+
async discard() {
|
|
303
|
+
await discardChanges(this.rootDir, this.managed);
|
|
304
|
+
this.invalidate();
|
|
305
|
+
}
|
|
306
|
+
async getStatus() {
|
|
307
|
+
return {
|
|
308
|
+
branch: "",
|
|
309
|
+
behind: 0
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
async getChanges() {
|
|
313
|
+
return readChanges(this.rootDir, this.managed);
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
/** Resolves every existing segment and preserves the missing tail of a new path. */
|
|
317
|
+
async function canonical(path) {
|
|
318
|
+
const tail = [];
|
|
319
|
+
let existing = path;
|
|
320
|
+
for (;;) try {
|
|
321
|
+
return join(await realpath(existing), ...tail);
|
|
322
|
+
} catch (err) {
|
|
323
|
+
if (!isNotFound(err)) throw err;
|
|
324
|
+
const parent = dirname(existing);
|
|
325
|
+
if (parent === existing) throw err;
|
|
326
|
+
tail.unshift(basename(existing));
|
|
327
|
+
existing = parent;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* A media file's version, read off its metadata so neither a listing nor a read
|
|
332
|
+
* has to hash the bytes. A write changes the modification time, which is all
|
|
333
|
+
* the admin's cache needs to notice a replaced file.
|
|
334
|
+
*/
|
|
335
|
+
var statVersion = ({ size, mtimeMs }) => `${size}-${mtimeMs}`;
|
|
336
|
+
export { LocalStorage };
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# Licenses
|
|
2
|
+
|
|
3
|
+
## @fontsource-variable/geist - 5.3.0 (OFL-1.1)
|
|
4
|
+
|
|
5
|
+
Copyright 2024 The Geist Project Authors (https://github.com/vercel/geist-font) Geist-Italic[wght].ttf: Copyright 2024 The Geist Project Authors (https://github.com/vercel/geist-font)
|
|
6
|
+
|
|
7
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
8
|
+
This license is copied below, and is also available with a FAQ at:
|
|
9
|
+
http://scripts.sil.org/OFL
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
-----------------------------------------------------------
|
|
13
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
14
|
+
-----------------------------------------------------------
|
|
15
|
+
|
|
16
|
+
PREAMBLE
|
|
17
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
18
|
+
development of collaborative font projects, to support the font creation
|
|
19
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
20
|
+
open framework in which fonts may be shared and improved in partnership
|
|
21
|
+
with others.
|
|
22
|
+
|
|
23
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
24
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
25
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
26
|
+
redistributed and/or sold with any software provided that any reserved
|
|
27
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
28
|
+
however, cannot be released under any other type of license. The
|
|
29
|
+
requirement for fonts to remain under this license does not apply
|
|
30
|
+
to any document created using the fonts or their derivatives.
|
|
31
|
+
|
|
32
|
+
DEFINITIONS
|
|
33
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
34
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
35
|
+
include source files, build scripts and documentation.
|
|
36
|
+
|
|
37
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
38
|
+
copyright statement(s).
|
|
39
|
+
|
|
40
|
+
"Original Version" refers to the collection of Font Software components as
|
|
41
|
+
distributed by the Copyright Holder(s).
|
|
42
|
+
|
|
43
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
44
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
45
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
46
|
+
new environment.
|
|
47
|
+
|
|
48
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
49
|
+
writer or other person who contributed to the Font Software.
|
|
50
|
+
|
|
51
|
+
PERMISSION & CONDITIONS
|
|
52
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
53
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
54
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
55
|
+
Software, subject to the following conditions:
|
|
56
|
+
|
|
57
|
+
1) Neither the Font Software nor any of its individual components,
|
|
58
|
+
in Original or Modified Versions, may be sold by itself.
|
|
59
|
+
|
|
60
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
61
|
+
redistributed and/or sold with any software, provided that each copy
|
|
62
|
+
contains the above copyright notice and this license. These can be
|
|
63
|
+
included either as stand-alone text files, human-readable headers or
|
|
64
|
+
in the appropriate machine-readable metadata fields within text or
|
|
65
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
66
|
+
|
|
67
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
68
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
69
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
70
|
+
presented to the users.
|
|
71
|
+
|
|
72
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
73
|
+
Software shall not be used to promote, endorse or advertise any
|
|
74
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
75
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
76
|
+
permission.
|
|
77
|
+
|
|
78
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
79
|
+
must be distributed entirely under this license, and must not be
|
|
80
|
+
distributed under any other license. The requirement for fonts to
|
|
81
|
+
remain under this license does not apply to any document created
|
|
82
|
+
using the Font Software.
|
|
83
|
+
|
|
84
|
+
TERMINATION
|
|
85
|
+
This license becomes null and void if any of the above conditions are
|
|
86
|
+
not met.
|
|
87
|
+
|
|
88
|
+
DISCLAIMER
|
|
89
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
90
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
91
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
92
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
93
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
94
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
95
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
96
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
97
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
98
|
+
|
|
99
|
+
## @mdxeditor/editor - 4.5.0 (MIT)
|
|
100
|
+
|
|
101
|
+
MIT License
|
|
102
|
+
|
|
103
|
+
Copyright (c) 2023 Petyo Ivanov
|
|
104
|
+
|
|
105
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
106
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
107
|
+
in the Software without restriction, including without limitation the rights
|
|
108
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
109
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
110
|
+
furnished to do so, subject to the following conditions:
|
|
111
|
+
|
|
112
|
+
The above copyright notice and this permission notice shall be included in all
|
|
113
|
+
copies or substantial portions of the Software.
|
|
114
|
+
|
|
115
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
116
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
117
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
118
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
119
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
120
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
121
|
+
SOFTWARE.
|
|
122
|
+
|
|
123
|
+
## @tailwindcss/typography - 0.5.20 (MIT)
|
|
124
|
+
|
|
125
|
+
MIT License
|
|
126
|
+
|
|
127
|
+
Copyright (c) Tailwind Labs, Inc.
|
|
128
|
+
|
|
129
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
130
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
131
|
+
in the Software without restriction, including without limitation the rights
|
|
132
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
133
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
134
|
+
furnished to do so, subject to the following conditions:
|
|
135
|
+
|
|
136
|
+
The above copyright notice and this permission notice shall be included in all
|
|
137
|
+
copies or substantial portions of the Software.
|
|
138
|
+
|
|
139
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
140
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
141
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
142
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
143
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
144
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
145
|
+
SOFTWARE.
|
|
146
|
+
|
|
147
|
+
## tailwindcss - 4.3.5 (MIT)
|
|
148
|
+
|
|
149
|
+
MIT License
|
|
150
|
+
|
|
151
|
+
Copyright (c) Tailwind Labs, Inc.
|
|
152
|
+
|
|
153
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
154
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
155
|
+
in the Software without restriction, including without limitation the rights
|
|
156
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
157
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
158
|
+
furnished to do so, subject to the following conditions:
|
|
159
|
+
|
|
160
|
+
The above copyright notice and this permission notice shall be included in all
|
|
161
|
+
copies or substantial portions of the Software.
|
|
162
|
+
|
|
163
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
164
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
165
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
166
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
167
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
168
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
169
|
+
SOFTWARE.
|
|
170
|
+
|
|
171
|
+
## tw-animate-css - 1.4.0 (MIT)
|
|
172
|
+
|
|
173
|
+
MIT License
|
|
174
|
+
|
|
175
|
+
Copyright (c) 2025 Wombosvideo
|
|
176
|
+
|
|
177
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
178
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
179
|
+
in the Software without restriction, including without limitation the rights
|
|
180
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
181
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
182
|
+
furnished to do so, subject to the following conditions:
|
|
183
|
+
|
|
184
|
+
The above copyright notice and this permission notice shall be included in all
|
|
185
|
+
copies or substantial portions of the Software.
|
|
186
|
+
|
|
187
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
188
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
189
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
190
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
191
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
192
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
193
|
+
SOFTWARE.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|