@vite-hub/cms 0.4.1 → 0.5.1

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/access.d.ts CHANGED
@@ -2,7 +2,6 @@ import { AccessControl, Role, RoleAuthorizeRequest, Statements } from "better-au
2
2
  import * as betterAuthAdminAccess from "better-auth/plugins/admin/access";
3
3
  import { ContentAuthorize } from "@vite-hub/content";
4
4
  import { CommentsAuthorizeContext } from "@vite-hub/comments";
5
- //#region src/access.d.ts
6
5
  /**
7
6
  * The permissions of the Better Auth `admin` plugin, `user` and `session`, plus the CMS resources: `content` for the
8
7
  * actions of `content.can()`, and `comment` for Comments. `comment:delete` removes threads of other people.
@@ -65,5 +64,4 @@ export declare function cmsConsoleAuthorize(context: {
65
64
  user?: CmsUser | null;
66
65
  }): true | {
67
66
  sections: string[];
68
- };
69
- //#endregion
67
+ };
package/dist/access.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as betterAuthAccess from "better-auth/plugins/access";
2
2
  import * as betterAuthAdminAccess from "better-auth/plugins/admin/access";
3
- //#region src/access.ts
3
+ // src/access.ts
4
4
  const { createAccessControl } = betterAuthAccess;
5
5
  const { adminAc, defaultStatements, userAc } = betterAuthAdminAccess;
6
6
  /** The statements of `cmsAc`. */
@@ -70,7 +70,6 @@ const cmsAccess = {
70
70
  function isCmsRoleName(name) {
71
71
  return Object.hasOwn(cmsRoles, name);
72
72
  }
73
- /** The known CMS roles of a user. `role` holds one role, or several separated by commas, as Better Auth stores them. */
74
73
  function cmsRolesOf(user) {
75
74
  const role = user?.role;
76
75
  if (String(role) !== role) return [];
@@ -89,7 +88,6 @@ function cmsCan(user, permissions) {
89
88
  * Only CMS roles have `content:read`, so `/api/content/**` needs `defineContent({ access: "public" })` to serve visitors.
90
89
  */
91
90
  const cmsContentAuthorize = ({ user, action }) => cmsCan(user, { content: [action] });
92
- /** The `comment` permission of each Comments action. Only `publisher` and `admin` delete. */
93
91
  const commentPermissions = {
94
92
  read: "read",
95
93
  write: "create",
@@ -115,5 +113,4 @@ function cmsConsoleAuthorize(context) {
115
113
  if (cmsCan(context.user, { comment: ["read"] })) sections.push("comments");
116
114
  return { sections };
117
115
  }
118
- //#endregion
119
116
  export { cmsAc, cmsAccess, cmsCan, cmsCommentsAuthorize, cmsConsoleAuthorize, cmsContentAuthorize, cmsRoles, cmsStatements };
@@ -1,5 +1,4 @@
1
1
  import { ContentPreset } from "@vite-hub/content";
2
- //#region src/index.d.ts
3
2
  /** Options of the `cms` Content preset. Use literal values, such as `roles: true`, so the build can read them. */
4
3
  interface CmsPresetOptions {
5
4
  /** Opt into the CMS roles of `admin(cmsAccess)`. Without it, set `defineContent({ authorize })` to allow access. */
@@ -35,19 +34,5 @@ interface CmsPresetOptions {
35
34
  /** GitHub store: how a publish reaches `branch`. `"commit"` (default) commits to it. `"pr"` opens a pull request from a `vitehub/publish/*` branch, which only Console access or a signed link previews. */
36
35
  publish?: "commit" | "pr";
37
36
  }
38
- /**
39
- * Store editable collections without wiring. `vitehub()` turns on Workspace, Database, and Blob when they are unset.
40
- * At build time `hubCms()` from `@vite-hub/cms/vite` adds a Workspace named `content` on the Blob + Database Store,
41
- * using the `default` Blob store and the default or only Database, and adds the Workspace history tables to that
42
- * Database. When the app has no Database Definition, that is the implicit `default` Database. `defineContent({ extends: cms })`
43
- * then uses that Workspace.
44
- *
45
- * With `repo` (or `store: "github"`) the Workspace is a GitHub repository instead: published content on one branch, drafts on
46
- * another, and no Blob store. The Database keeps editor sessions.
47
- *
48
- * With `roles: true` and no `authorize` in `defineContent()`, the CMS roles of the Better Auth `admin` plugin decide
49
- * who reads drafts, writes, and publishes. See `cmsAccess` from `@vite-hub/cms/access`.
50
- */
51
37
  declare const cms: ContentPreset<CmsPresetOptions>;
52
- //#endregion
53
38
  export { cms as n, CmsPresetOptions as t };
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { n as cms, t as CmsPresetOptions } from "./index-BQk9e5ua.js";
1
+ import { n as cms, t as CmsPresetOptions } from "./index-CRxYfJPJ.js";
2
2
  export { CmsPresetOptions, cms, cms as default };
package/dist/index.js CHANGED
@@ -1,28 +1,11 @@
1
- import { a as cmsRenamedAccessProblem, i as cmsOptionsProblem, n as cmsOptionKeys, o as cmsStoreOf, r as cmsOptionProblem, s as cmsErrorDiagnostics, t as cmsGitHubDefaults } from "./options-BCArcTOP.js";
1
+ import { a as cmsRenamedAccessProblem, i as cmsOptionsProblem, n as cmsOptionKeys, o as cmsStoreOf, r as cmsOptionProblem, s as cmsErrorDiagnostics, t as cmsGitHubDefaults } from "./options-C5YZwuGY.js";
2
2
  import { defineContentPreset } from "@vite-hub/content";
3
- //#region src/index.ts
4
- /**
5
- * The policy for `roles: true` when the app sets no `authorize`. A user without a string role is denied before
6
- * Better Auth loads. The preset never interprets application roles unless the app explicitly opts in.
7
- */
3
+ // src/index.ts
8
4
  const cmsDefaultAuthorize = async (context) => {
9
5
  if (String(context.user?.role) !== context.user?.role) return false;
10
6
  const { cmsContentAuthorize } = await import("./access.js");
11
7
  return await cmsContentAuthorize(context);
12
8
  };
13
- /**
14
- * Store editable collections without wiring. `vitehub()` turns on Workspace, Database, and Blob when they are unset.
15
- * At build time `hubCms()` from `@vite-hub/cms/vite` adds a Workspace named `content` on the Blob + Database Store,
16
- * using the `default` Blob store and the default or only Database, and adds the Workspace history tables to that
17
- * Database. When the app has no Database Definition, that is the implicit `default` Database. `defineContent({ extends: cms })`
18
- * then uses that Workspace.
19
- *
20
- * With `repo` (or `store: "github"`) the Workspace is a GitHub repository instead: published content on one branch, drafts on
21
- * another, and no Blob store. The Database keeps editor sessions.
22
- *
23
- * With `roles: true` and no `authorize` in `defineContent()`, the CMS roles of the Better Auth `admin` plugin decide
24
- * who reads drafts, writes, and publishes. See `cmsAccess` from `@vite-hub/cms/access`.
25
- */
26
9
  const cms = defineContentPreset({
27
10
  name: "cms",
28
11
  options: {
@@ -59,5 +42,4 @@ const cms = defineContentPreset({
59
42
  };
60
43
  }
61
44
  });
62
- //#endregion
63
45
  export { cms, cms as default };
@@ -1,5 +1,5 @@
1
1
  import { defineDiagnostics } from "nostics";
2
- //#region src/error-diagnostics.ts
2
+ // src/error-diagnostics.ts
3
3
  const cmsErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
4
4
  docsBase: "https://vitehub.dev/docs/content/diagnostics",
5
5
  codes: {
@@ -18,8 +18,7 @@ const cmsErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
18
18
  }
19
19
  }
20
20
  });
21
- //#endregion
22
- //#region src/options.ts
21
+ // src/options.ts
23
22
  /** Options of the `cms` preset that name a resource of the Blob + Database store. */
24
23
  const cmsNameOptions = [
25
24
  "blob",
@@ -94,5 +93,4 @@ function cmsOptionsProblem(options) {
94
93
  const branch = get("branch") ?? cmsGitHubDefaults.branch;
95
94
  if (branch === (get("draftBranch") ?? cmsGitHubDefaults.draftBranch)) return `option "draftBranch" must differ from "branch". Both are ${JSON.stringify(branch)}.`;
96
95
  }
97
- //#endregion
98
96
  export { cmsRenamedAccessProblem as a, cmsOptionsProblem as i, cmsOptionKeys as n, cmsStoreOf as o, cmsOptionProblem as r, cmsErrorDiagnostics as s, cmsGitHubDefaults as t };
package/dist/vite.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { t as CmsPresetOptions } from "./index-BQk9e5ua.js";
1
+ import { t as CmsPresetOptions } from "./index-CRxYfJPJ.js";
2
2
  import "nostics";
3
3
  import { Plugin } from "vite";
4
4
  import { DatabaseContributionFactory } from "@vite-hub/database/vite";
5
5
  import { WorkspaceContributionFactory } from "@vite-hub/workspace/vite";
6
- //#region ../internal/dist/host-credentials-MN0OQ2os.d.ts
7
6
  interface HostCliRunResult {
8
7
  exitCode: number | null;
9
8
  stdout: string;
9
+ stderr?: string;
10
10
  }
11
11
  /** Runs a host CLI with an argument array and no shell, and returns its stdout. */
12
12
  type HostCliRun = (command: string, args: readonly string[], options: {
@@ -14,9 +14,6 @@ type HostCliRun = (command: string, args: readonly string[], options: {
14
14
  env: NodeJS.ProcessEnv;
15
15
  signal?: AbortSignal;
16
16
  }) => Promise<HostCliRunResult>;
17
- //#endregion
18
- //#region ../internal/dist/provision-k67k9T1h.d.ts
19
- //#region src/provision.d.ts
20
17
  type ProvisionProvider = "cloudflare" | "vercel";
21
18
  interface ProvisionLogger {
22
19
  log: (message: string) => void;
@@ -68,9 +65,6 @@ interface ProvisionStep {
68
65
  /** Describes the Provision State this step records. Runs without network access, also without credentials. */
69
66
  recordedState?: (context: Pick<ProvisionContext, "env">) => ProvisionStateCategory[];
70
67
  }
71
- //#endregion
72
- //#region ../internal/dist/cli.d.ts
73
- //#region src/cli.d.ts
74
68
  interface ViteHubCliStreams {
75
69
  stderr: {
76
70
  write: (chunk: string | Uint8Array, encoding?: BufferEncoding | StdoutWriteCallback, callback?: StdoutWriteCallback) => unknown;
@@ -165,9 +159,6 @@ interface ViteHubCliPluginMetadata {
165
159
  cli?: ViteHubCliContributor | ViteHubCliContributorFactory;
166
160
  }
167
161
  type StdoutWriteCallback = (error?: Error | null) => void;
168
- //#endregion
169
- //#region ../internal/dist/inspect.d.ts
170
- //#region src/inspect.d.ts
171
162
  interface ViteHubDefinitionField {
172
163
  label: string;
173
164
  value: string;
@@ -217,6 +208,8 @@ interface ViteHubResourceSummary {
217
208
  owner: string;
218
209
  /** Absent when no id is known yet. */
219
210
  source?: ViteHubResourceIdSource;
211
+ /** The resource is in the Wrangler config of a standalone Provider Output Worker, not in Nitro's. */
212
+ standalone?: boolean;
220
213
  }
221
214
  interface ViteHubInspectionContributor {
222
215
  definitions?: readonly ViteHubDefinitionInspector[];
@@ -227,8 +220,6 @@ type ViteHubInspectionContributorFactory = () => ViteHubInspectionContributor |
227
220
  interface ViteHubInspectionPluginMetadata {
228
221
  inspect?: ViteHubInspectionContributor | ViteHubInspectionContributorFactory;
229
222
  }
230
- //#endregion
231
- //#region src/build.d.ts
232
223
  /** Import paths that select the `cms` preset in `server/content.ts`. */
233
224
  export declare const cmsPresetModules: readonly string[];
234
225
  /** How `server/content.ts` selects the `cms` preset, read from its source without running it. */
@@ -295,8 +286,6 @@ interface CmsDatabaseChoices {
295
286
  export declare function resolveCmsPresetPlan(usage: CmsPresetUsage, databases: CmsDatabaseChoices, projectRoot: string): CmsPresetPlan;
296
287
  /** Import paths that the generated Workspace module uses. */
297
288
  interface CmsWorkspaceImports {
298
- /** Exports `blob`. */
299
- blob: string;
300
289
  /** Exports `createBlobDatabaseWorkspaceStore` and `workspaceHistorySchema`. */
301
290
  blobDatabase: string;
302
291
  /** Exports `contentSessionsSchema`, the presence and edit lease table that the preset adds to its Database. */
@@ -307,16 +296,13 @@ interface CmsWorkspaceImports {
307
296
  workspace: string;
308
297
  }
309
298
  /**
310
- * The generated Workspace Definition module. It only reads the Database registry and creates a lazy store when it
311
- * loads, so the build can load it to bundle Workspace assets. The GitHub store reads its token on first use.
299
+ * The generated Workspace Definition module. It creates a lazy store when it loads, so the build can load it to bundle
300
+ * Workspace assets. The Blob + Database Store looks up its Blob store and Database by name on first use, so durability
301
+ * can read both. The GitHub store reads its token on first use.
312
302
  */
313
303
  export declare function renderCmsWorkspaceModule(plan: CmsPresetPlan, imports: CmsWorkspaceImports): string;
314
- //#endregion
315
- //#region src/cli.d.ts
316
304
  /** The `vitehub cms` commands. */
317
305
  export declare function createCmsCliContributor(): ViteHubCliContributor;
318
- //#endregion
319
- //#region src/vite.d.ts
320
306
  export declare const CMS_VITE_PLUGIN_NAME = "@vite-hub/cms/vite";
321
307
  /** Generated Workspace Definition module of the `cms` preset, relative to the project root. */
322
308
  export declare const cmsWorkspaceModulePath = ".vitehub/content/workspace.mjs";
@@ -370,5 +356,4 @@ export type CmsVitePlugin = Plugin & {
370
356
  * dev server when the selection changes. Apps without the preset are unaffected.
371
357
  */
372
358
  export declare function hubCms(options?: CmsVitePluginOptions): CmsVitePlugin;
373
- //#endregion
374
359
  export { type CmsDatabaseChoices, type CmsGitHubPlan, type CmsPresetPlan, type CmsPresetUsage, type CmsWorkspaceImports, hubCms as default };
package/dist/vite.js CHANGED
@@ -1,17 +1,11 @@
1
- import { a as cmsRenamedAccessProblem, i as cmsOptionsProblem, n as cmsOptionKeys, o as cmsStoreOf, r as cmsOptionProblem, s as cmsErrorDiagnostics, t as cmsGitHubDefaults } from "./options-BCArcTOP.js";
1
+ import { a as cmsRenamedAccessProblem, i as cmsOptionsProblem, n as cmsOptionKeys, o as cmsStoreOf, r as cmsOptionProblem, s as cmsErrorDiagnostics, t as cmsGitHubDefaults } from "./options-C5YZwuGY.js";
2
2
  import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
3
3
  import { basename, dirname, join, parse, relative, resolve } from "node:path";
4
4
  import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
5
5
  import { tmpdir } from "node:os";
6
6
  import { findContentEntry } from "@vite-hub/source/vite";
7
7
  import { parseAst } from "vite";
8
- //#region ../internal/dist/object.js
9
- /** A non-null object that is not an array. Functions do not pass. */
10
- function isRecord(value) {
11
- return typeof value === "object" && value !== null && !Array.isArray(value);
12
- }
13
- //#endregion
14
- //#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
8
+ // ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
15
9
  const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
16
10
  function normalizeWindowsPath(input = "") {
17
11
  if (!input) return input;
@@ -102,16 +96,19 @@ const relative$1 = function(from, to) {
102
96
  }
103
97
  return [..._from.map(() => ".."), ..._to].join("/");
104
98
  };
105
- //#endregion
106
- //#region ../internal/dist/inspect.js
99
+ // ../internal/dist/inspect.js
107
100
  function relativeDefinitionFile(projectRoot, file) {
108
101
  return relative$1(projectRoot, file).replaceAll("\\", "/");
109
102
  }
110
103
  const secretKeyPattern = /secret|token|passw(?:or)?d|credential|api[-_\s]?key|private[-_\s]?key|authorization|cookie|signature|dsn|connection[-_\s]?string/i;
111
104
  new RegExp(String.raw`\b([\w-]*authorization[\w-]*["']?\s*[:=]\s*)(?!\[redacted\](?=$|[\s,;}&]))(?:"(?:\\[^\r\n]|[^"\\\r\n])*"|'(?:\\[^\r\n]|[^'\\\r\n])*'|[^\r\n]+?(?=\s*(?:[,;])?\s*(?:${secretKeyPattern.source})[\w-]*\s*[:=]|\s+rejected\b|$))`, "gi");
112
105
  new RegExp(String.raw`\b([\w-]*(?:${secretKeyPattern.source})[\w-]*["']?\s*[:=]\s*)(?!\[redacted\](?=$|[\s,;}&]))(?:"(?:\\[^\r\n]|[^"\\\r\n])*"|'(?:\\[^\r\n]|[^'\\\r\n])*'|[^\s,;&#&]+)`, "gi");
113
- //#endregion
114
- //#region ../internal/dist/build/vite.js
106
+ // ../internal/dist/object.js
107
+ /** A non-null object that is not an array. Functions do not pass. */
108
+ function isRecord(value) {
109
+ return typeof value === "object" && value !== null && !Array.isArray(value);
110
+ }
111
+ // ../internal/dist/vite-CELQZdD3.js
115
112
  const projectRootDirectoryMarkers = [
116
113
  ["server", "agents"],
117
114
  ["server", "channels"],
@@ -161,7 +158,7 @@ function hasProjectRootDirectoryMarker(root) {
161
158
  for (const marker of projectRootDirectoryMarkers) try {
162
159
  if (statSync(resolve(root, ...marker)).isDirectory()) return true;
163
160
  } catch (error) {
164
- if (error.code !== "ENOENT") throw error;
161
+ if (!isMissingProjectMarker(error)) throw error;
165
162
  }
166
163
  return false;
167
164
  }
@@ -175,13 +172,16 @@ function hasProjectRootFileMarker(root, markers) {
175
172
  try {
176
173
  if (statSync(resolve(root, ...path)).isFile()) return true;
177
174
  } catch (error) {
178
- if (error.code !== "ENOENT") throw error;
175
+ if (!isMissingProjectMarker(error)) throw error;
179
176
  }
180
177
  }
181
178
  return false;
182
179
  }
183
- //#endregion
184
- //#region ../internal/dist/contributions.js
180
+ function isMissingProjectMarker(error) {
181
+ const code = error.code;
182
+ return code === "ENOENT" || code === "ENOTDIR";
183
+ }
184
+ // ../internal/dist/contributions.js
185
185
  function isThenable(value) {
186
186
  return typeof value.then === "function";
187
187
  }
@@ -208,8 +208,7 @@ async function flattenPluginOptions(plugins) {
208
208
  await flattenPlugins(plugins ?? [], flattened, /* @__PURE__ */ new Set());
209
209
  return flattened;
210
210
  }
211
- //#endregion
212
- //#region src/database-lookup.injected.ts
211
+ // src/database-lookup.injected.ts
213
212
  /**
214
213
  * Generated module source that reads the Database of the cms preset. The build loads the generated module without the
215
214
  * app's Databases, and `useDatabase()` throws for a missing one, so the module keeps the error and throws it on first
@@ -229,14 +228,12 @@ function renderDatabaseLookup(database) {
229
228
  "}"
230
229
  ];
231
230
  }
232
- //#endregion
233
- //#region src/build.ts
231
+ // src/build.ts
234
232
  /** Import paths that select the `cms` preset in `server/content.ts`. */
235
233
  const cmsPresetModules = ["vite-hub/cms", "@vite-hub/cms"];
236
234
  function isNode(value) {
237
235
  return value !== null && Object(value) === value && String(Reflect.get(Object(value), "type")) === Reflect.get(Object(value), "type");
238
236
  }
239
- /** Drop type-only and grouping wrappers such as `x satisfies T`, `x as T`, and `(x)`. */
240
237
  function unwrap(node) {
241
238
  let current = node;
242
239
  while (isNode(current) && [
@@ -255,7 +252,6 @@ function propertyName(node) {
255
252
  if (key.type === "Identifier") return String(key.name);
256
253
  if (key.type === "Literal" && String(key.value) === key.value) return key.value;
257
254
  }
258
- /** A string or `true` literal: the values that the cms preset options take. */
259
255
  function literalValue(node) {
260
256
  const value = unwrap(node);
261
257
  if (isNode(value) && value.type === "Literal" && value.value === true) return true;
@@ -274,7 +270,6 @@ function stringValue(node) {
274
270
  function displayPath(file, projectRoot) {
275
271
  return JSON.stringify(relative(projectRoot, file).replaceAll("\\", "/"));
276
272
  }
277
- /** The build cannot read how the Definition selects the preset. */
278
273
  function presetError(file, projectRoot, message) {
279
274
  return cmsErrorDiagnostics.CONTENT_B0001({ message: `[vitehub] ${displayPath(file, projectRoot)}: ${message}` });
280
275
  }
@@ -290,7 +285,6 @@ function cmsRequirementError(file, projectRoot, message) {
290
285
  function readCmsPresetUsage(source, file, projectRoot, parseAst) {
291
286
  return readCmsPresetUsageInternal(source, file, projectRoot, parseAst, /* @__PURE__ */ new Set(), "default");
292
287
  }
293
- /** `exportName` is the export that holds the Content Definition: `default` in `server/content.ts`, or the name that it re-exports. */
294
288
  function readCmsPresetUsageInternal(source, file, projectRoot, parseAst, seen, exportName) {
295
289
  const resolvedFile = resolve(file);
296
290
  if (seen.has(resolvedFile)) return;
@@ -585,24 +579,21 @@ let lastPresetCheck;
585
579
  /** Export of the generated module that holds the Workspace Definition. */
586
580
  const cmsWorkspaceExport = "contentWorkspace";
587
581
  /**
588
- * The generated Workspace Definition module. It only reads the Database registry and creates a lazy store when it
589
- * loads, so the build can load it to bundle Workspace assets. The GitHub store reads its token on first use.
582
+ * The generated Workspace Definition module. It creates a lazy store when it loads, so the build can load it to bundle
583
+ * Workspace assets. The Blob + Database Store looks up its Blob store and Database by name on first use, so durability
584
+ * can read both. The GitHub store reads its token on first use.
590
585
  */
591
586
  function renderCmsWorkspaceModule(plan, imports) {
592
587
  if (plan.store === "github" && plan.github) return renderGitHubWorkspaceModule(plan, plan.github, imports);
593
588
  return [
594
589
  "// Generated by @vite-hub/cms for the cms preset in server/content.ts. Do not edit.",
595
- `import { blob } from ${JSON.stringify(imports.blob)}`,
596
- `import { useDatabase } from ${JSON.stringify(imports.database)}`,
597
590
  `import { defineWorkspace } from ${JSON.stringify(imports.workspace)}`,
598
591
  `import { createBlobDatabaseWorkspaceStore } from ${JSON.stringify(imports.blobDatabase)}`,
599
592
  "",
600
- ...renderDatabaseLookup(plan.database),
601
- "",
602
593
  `export const ${cmsWorkspaceExport} = defineWorkspace({`,
603
594
  " store: createBlobDatabaseWorkspaceStore({",
604
- ` blob: blob.store(${JSON.stringify(plan.blob ?? "default")}),`,
605
- " database,",
595
+ ` blob: ${JSON.stringify(plan.blob ?? "default")},`,
596
+ ` database: ${JSON.stringify(plan.database)},`,
606
597
  ` workspace: ${JSON.stringify(plan.workspace)},`,
607
598
  " }),",
608
599
  "})",
@@ -632,8 +623,7 @@ function renderGitHubWorkspaceModule(plan, github, imports) {
632
623
  ""
633
624
  ].join("\n");
634
625
  }
635
- //#endregion
636
- //#region src/cli.ts
626
+ // src/cli.ts
637
627
  const rolesUsage = "vitehub cms roles [--json]";
638
628
  function renderActions(actions) {
639
629
  return actions?.length ? actions.join(", ") : "-";
@@ -689,8 +679,7 @@ function createCmsCliContributor() {
689
679
  name: "cms"
690
680
  }] };
691
681
  }
692
- //#endregion
693
- //#region src/vite.ts
682
+ // src/vite.ts
694
683
  const CMS_VITE_PLUGIN_NAME = "@vite-hub/cms/vite";
695
684
  /** Generated Workspace Definition module of the `cms` preset, relative to the project root. */
696
685
  const cmsWorkspaceModulePath = ".vitehub/content/workspace.mjs";
@@ -706,7 +695,6 @@ function cmsStore(input) {
706
695
  return cmsPresetStoreSync(input, parseAst);
707
696
  }
708
697
  const defaultImports = {
709
- blob: "@vite-hub/blob",
710
698
  blobDatabase: "@vite-hub/workspace/blob-database",
711
699
  contentDatabase: "@vite-hub/content/database",
712
700
  database: "@vite-hub/database",
@@ -741,14 +729,9 @@ function databaseDiscoveryRoot(plugins, fallback) {
741
729
  }
742
730
  return fallback;
743
731
  }
744
- /**
745
- * The other plugins of the app. `vitehub()` nests the CMS plugin in an array, and the Database contributions that
746
- * the hooks collect would call the hook again through that nested copy, so flatten first.
747
- */
748
732
  async function pluginsWithoutCms(plugins) {
749
733
  return (await flattenPluginOptions(plugins)).filter((plugin) => Reflect.get(plugin, "name") !== CMS_VITE_PLUGIN_NAME);
750
734
  }
751
- /** Store names of the Blob plugin, or false when Blob is off. */
752
735
  function blobStoreNames(plugin) {
753
736
  if (!plugin) return false;
754
737
  const getConfig = Reflect.get(Object(Reflect.get(plugin, "api")), "getConfig");
@@ -832,7 +815,7 @@ function hubCms(options = {}) {
832
815
  }] };
833
816
  },
834
817
  async workspaces(context) {
835
- const projectRoot = context.projectRoot ?? context.root;
818
+ const projectRoot = context.projectRoot;
836
819
  const otherPlugins = await pluginsWithoutCms(context.plugins);
837
820
  const databaseRoot = databaseDiscoveryRoot(otherPlugins, projectRoot);
838
821
  const { collectDatabaseContributions } = await import("@vite-hub/database/vite");
@@ -963,5 +946,4 @@ function hubCms(options = {}) {
963
946
  }
964
947
  };
965
948
  }
966
- //#endregion
967
949
  export { CMS_VITE_PLUGIN_NAME, cmsPresetModules, cmsStore, cmsWorkspaceModulePath, createCmsCliContributor, hubCms as default, hubCms, readCmsPresetUsage, renderCmsWorkspaceModule, resolveCmsPresetPlan, usesCms };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vite-hub/cms",
3
- "version": "0.4.1",
3
+ "version": "0.5.1",
4
4
  "description": "Editable Content collections on a generated ViteHub Workspace, in Blob and Database or in a GitHub repository.",
5
5
  "keywords": [
6
6
  "cms",
@@ -46,38 +46,38 @@
46
46
  "./package.json": "./package.json"
47
47
  },
48
48
  "dependencies": {
49
- "@vite-hub/content": "0.4.1",
50
- "@vite-hub/source": "0.4.1",
49
+ "@vite-hub/content": "0.5.1",
50
+ "@vite-hub/source": "0.5.1",
51
51
  "nostics": "1.4.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@comark/html": "^0.9.0",
54
+ "@comark/html": "^0.9.2",
55
55
  "@libsql/client": "^0.18.0",
56
- "@types/node": "^24.19.1",
57
- "@vite-hub/comments": "0.4.1",
58
- "@vite-hub/database": "0.4.1",
56
+ "@types/node": "^24.19.2",
57
+ "@vite-hub/comments": "0.5.1",
58
+ "@vite-hub/database": "0.5.1",
59
59
  "@vite-hub/internal": "0.0.1",
60
- "@vite-hub/workspace": "0.4.1",
61
- "better-auth": "^1.7.15",
62
- "comark": "^0.9.0",
63
- "comark-ui": "^0.12.0",
64
- "drizzle-orm": "1.0.0-rc.5",
60
+ "@vite-hub/workspace": "0.5.1",
61
+ "better-auth": "^1.7.27",
62
+ "comark": "^0.9.2",
63
+ "comark-ui": "^0.12.2",
64
+ "drizzle-orm": "1.0.0-rc.6",
65
65
  "publint": "^0.3.25",
66
66
  "typescript": "^6.0.3",
67
- "vite": "^8.2.2",
68
- "vite-plus": "^0.3.3",
69
- "vitest": "^4.1.11",
67
+ "vite": "^8.3.8",
68
+ "vite-plus": "^1.7.0",
69
+ "vitest": "5.1.0",
70
70
  "zod": "^4.6.7"
71
71
  },
72
72
  "peerDependencies": {
73
- "@comark/html": "^0.9.0",
74
- "@vite-hub/blob": "0.4.1",
75
- "@vite-hub/comments": "0.4.1",
76
- "@vite-hub/database": "0.4.1",
77
- "@vite-hub/workspace": "0.4.1",
78
- "better-auth": "^1.7.15",
79
- "comark": "^0.9.0",
80
- "comark-ui": "^0.12.0",
73
+ "@comark/html": "^0.9.2",
74
+ "@vite-hub/blob": "0.5.1",
75
+ "@vite-hub/comments": "0.5.1",
76
+ "@vite-hub/database": "0.5.1",
77
+ "@vite-hub/workspace": "0.5.1",
78
+ "better-auth": "^1.7.27",
79
+ "comark": "^0.9.2",
80
+ "comark-ui": "^0.12.2",
81
81
  "vite": ">=8.0.0"
82
82
  },
83
83
  "peerDependenciesMeta": {