@vite-hub/cms 0.5.0 → 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`. */
@@ -113,5 +113,4 @@ function cmsConsoleAuthorize(context) {
113
113
  if (cmsCan(context.user, { comment: ["read"] })) sections.push("comments");
114
114
  return { sections };
115
115
  }
116
- //#endregion
117
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. */
@@ -36,5 +35,4 @@ interface CmsPresetOptions {
36
35
  publish?: "commit" | "pr";
37
36
  }
38
37
  declare const cms: ContentPreset<CmsPresetOptions>;
39
- //#endregion
40
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-BCWEbTZ8.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,6 +1,6 @@
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
3
+ // src/index.ts
4
4
  const cmsDefaultAuthorize = async (context) => {
5
5
  if (String(context.user?.role) !== context.user?.role) return false;
6
6
  const { cmsContentAuthorize } = await import("./access.js");
@@ -42,5 +42,4 @@ const cms = defineContentPreset({
42
42
  };
43
43
  }
44
44
  });
45
- //#endregion
46
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,9 +1,8 @@
1
- import { t as CmsPresetOptions } from "./index-BCWEbTZ8.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-NQkTpoab.d.ts
7
6
  interface HostCliRunResult {
8
7
  exitCode: number | null;
9
8
  stdout: string;
@@ -15,9 +14,6 @@ type HostCliRun = (command: string, args: readonly string[], options: {
15
14
  env: NodeJS.ProcessEnv;
16
15
  signal?: AbortSignal;
17
16
  }) => Promise<HostCliRunResult>;
18
- //#endregion
19
- //#region ../internal/dist/provision-k67k9T1h.d.ts
20
- //#region src/provision.d.ts
21
17
  type ProvisionProvider = "cloudflare" | "vercel";
22
18
  interface ProvisionLogger {
23
19
  log: (message: string) => void;
@@ -69,8 +65,6 @@ interface ProvisionStep {
69
65
  /** Describes the Provision State this step records. Runs without network access, also without credentials. */
70
66
  recordedState?: (context: Pick<ProvisionContext, "env">) => ProvisionStateCategory[];
71
67
  }
72
- //#endregion
73
- //#region ../internal/dist/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;
@@ -229,8 +220,6 @@ type ViteHubInspectionContributorFactory = () => ViteHubInspectionContributor |
229
220
  interface ViteHubInspectionPluginMetadata {
230
221
  inspect?: ViteHubInspectionContributor | ViteHubInspectionContributorFactory;
231
222
  }
232
- //#endregion
233
- //#region src/build.d.ts
234
223
  /** Import paths that select the `cms` preset in `server/content.ts`. */
235
224
  export declare const cmsPresetModules: readonly string[];
236
225
  /** How `server/content.ts` selects the `cms` preset, read from its source without running it. */
@@ -312,12 +301,8 @@ interface CmsWorkspaceImports {
312
301
  * can read both. The GitHub store reads its token on first use.
313
302
  */
314
303
  export declare function renderCmsWorkspaceModule(plan: CmsPresetPlan, imports: CmsWorkspaceImports): string;
315
- //#endregion
316
- //#region src/cli.d.ts
317
304
  /** The `vitehub cms` commands. */
318
305
  export declare function createCmsCliContributor(): ViteHubCliContributor;
319
- //#endregion
320
- //#region src/vite.d.ts
321
306
  export declare const CMS_VITE_PLUGIN_NAME = "@vite-hub/cms/vite";
322
307
  /** Generated Workspace Definition module of the `cms` preset, relative to the project root. */
323
308
  export declare const cmsWorkspaceModulePath = ".vitehub/content/workspace.mjs";
@@ -371,5 +356,4 @@ export type CmsVitePlugin = Plugin & {
371
356
  * dev server when the selection changes. Apps without the preset are unaffected.
372
357
  */
373
358
  export declare function hubCms(options?: CmsVitePluginOptions): CmsVitePlugin;
374
- //#endregion
375
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/vite-DGZFNpcx.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"],
@@ -184,8 +181,7 @@ function isMissingProjectMarker(error) {
184
181
  const code = error.code;
185
182
  return code === "ENOENT" || code === "ENOTDIR";
186
183
  }
187
- //#endregion
188
- //#region ../internal/dist/contributions.js
184
+ // ../internal/dist/contributions.js
189
185
  function isThenable(value) {
190
186
  return typeof value.then === "function";
191
187
  }
@@ -212,8 +208,7 @@ async function flattenPluginOptions(plugins) {
212
208
  await flattenPlugins(plugins ?? [], flattened, /* @__PURE__ */ new Set());
213
209
  return flattened;
214
210
  }
215
- //#endregion
216
- //#region src/database-lookup.injected.ts
211
+ // src/database-lookup.injected.ts
217
212
  /**
218
213
  * Generated module source that reads the Database of the cms preset. The build loads the generated module without the
219
214
  * app's Databases, and `useDatabase()` throws for a missing one, so the module keeps the error and throws it on first
@@ -233,8 +228,7 @@ function renderDatabaseLookup(database) {
233
228
  "}"
234
229
  ];
235
230
  }
236
- //#endregion
237
- //#region src/build.ts
231
+ // src/build.ts
238
232
  /** Import paths that select the `cms` preset in `server/content.ts`. */
239
233
  const cmsPresetModules = ["vite-hub/cms", "@vite-hub/cms"];
240
234
  function isNode(value) {
@@ -629,8 +623,7 @@ function renderGitHubWorkspaceModule(plan, github, imports) {
629
623
  ""
630
624
  ].join("\n");
631
625
  }
632
- //#endregion
633
- //#region src/cli.ts
626
+ // src/cli.ts
634
627
  const rolesUsage = "vitehub cms roles [--json]";
635
628
  function renderActions(actions) {
636
629
  return actions?.length ? actions.join(", ") : "-";
@@ -686,8 +679,7 @@ function createCmsCliContributor() {
686
679
  name: "cms"
687
680
  }] };
688
681
  }
689
- //#endregion
690
- //#region src/vite.ts
682
+ // src/vite.ts
691
683
  const CMS_VITE_PLUGIN_NAME = "@vite-hub/cms/vite";
692
684
  /** Generated Workspace Definition module of the `cms` preset, relative to the project root. */
693
685
  const cmsWorkspaceModulePath = ".vitehub/content/workspace.mjs";
@@ -954,5 +946,4 @@ function hubCms(options = {}) {
954
946
  }
955
947
  };
956
948
  }
957
- //#endregion
958
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.5.0",
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.5.0",
50
- "@vite-hub/source": "0.5.0",
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.5.0",
58
- "@vite-hub/database": "0.5.0",
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.5.0",
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.5.0",
75
- "@vite-hub/comments": "0.5.0",
76
- "@vite-hub/database": "0.5.0",
77
- "@vite-hub/workspace": "0.5.0",
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": {