veryfront 0.1.54 → 0.1.55

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/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.54",
3
+ "version": "0.1.55",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "exclude": [
@@ -24,10 +24,6 @@ interface MarkdownHtmlOptions {
24
24
  projectId: string;
25
25
  /** File path of the markdown file. */
26
26
  filePath: string;
27
- /** Branch ID for Yjs room GUID computation. */
28
- branchId?: string | null;
29
- /** API base URL for computing the WebSocket URL (e.g. "https://api.veryfront.com"). */
30
- apiBaseUrl?: string;
31
27
  }
32
28
  /**
33
29
  * Generate a complete HTML document for markdown preview rendering.
@@ -1 +1 @@
1
- {"version":3,"file":"markdown-html-generator.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/handlers/preview/markdown-html-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,OAAO,MAAM,2BAA2B,CAAC;AAKrD,oDAAoD;AACpD,UAAU,mBAAmB;IAC3B,wDAAwD;IACxD,OAAO,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,iDAAiD;IACjD,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC;IACzB,gDAAgD;IAChD,GAAG,EAAE,GAAG,CAAC;IACT,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,uFAAuF;IACvF,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AA0ED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CA2FzE"}
1
+ {"version":3,"file":"markdown-html-generator.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/handlers/preview/markdown-html-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,OAAO,MAAM,2BAA2B,CAAC;AAKrD,oDAAoD;AACpD,UAAU,mBAAmB;IAC3B,wDAAwD;IACxD,OAAO,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,iDAAiD;IACjD,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC;IACzB,gDAAgD;IAChD,GAAG,EAAE,GAAG,CAAC;IACT,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAuDD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CA0FzE"}
@@ -21,42 +21,23 @@ function detectTheme(req, url) {
21
21
  }
22
22
  /**
23
23
  * Generate the studio bridge `<script>` tag.
24
- * Injected when embedded in Studio (`studio_embed=true`) or for standalone
25
- * markdown/MDX pages so the edit button and editor features are available.
24
+ * Injected only when embedded in Studio (`studio_embed=true`).
26
25
  */
27
- function buildStudioScript(url, projectId, filePath, branchId, apiBaseUrl) {
26
+ function buildStudioScript(url, projectId, filePath) {
28
27
  const studioEmbed = url.searchParams.get("studio_embed") === "true";
29
- const isMarkdown = /\.mdx?$/i.test(filePath);
30
- if (!studioEmbed && !isMarkdown)
28
+ if (!studioEmbed)
31
29
  return "";
32
30
  const rawQueryProjectId = url.searchParams.get("vf_project_id")?.trim() || "";
33
- // Validate query param to prevent path traversal in WebSocket URL
31
+ // Validate query param before using it in bridge config.
34
32
  const queryProjectId = /^[a-zA-Z0-9_-]+$/.test(rawQueryProjectId) ? rawQueryProjectId : "";
35
33
  const queryFileId = url.searchParams.get("vf_file_id")?.trim() || "";
36
34
  const canonicalProjectId = queryProjectId || projectId;
37
35
  const canonicalPageId = queryFileId || filePath;
38
- // Compute Yjs WebSocket URL from the API base URL (Yjs endpoint lives on the API server)
39
- let wsUrl = "";
40
- if (apiBaseUrl) {
41
- try {
42
- const apiUrl = new URL(apiBaseUrl);
43
- const wsProtocol = apiUrl.protocol === "https:" ? "wss:" : "ws:";
44
- wsUrl = `${wsProtocol}//${apiUrl.host}/ws/${canonicalProjectId}/yjs`;
45
- }
46
- catch (_) {
47
- /* expected: invalid API URL — wsUrl stays empty, bridge won't self-connect */
48
- }
49
- }
50
- const yjsGuid = branchId ? `${canonicalProjectId}:${branchId}` : canonicalProjectId;
51
36
  const bridgeConfig = {
52
37
  projectId: canonicalProjectId,
53
38
  pageId: canonicalPageId,
54
39
  pagePath: filePath,
55
40
  };
56
- if (wsUrl)
57
- bridgeConfig.wsUrl = wsUrl;
58
- if (yjsGuid)
59
- bridgeConfig.yjsGuid = yjsGuid;
60
41
  // Escape </script> sequences to prevent XSS breakout from inline JSON
61
42
  const safeJson = JSON.stringify(bridgeConfig).replace(/</g, "\\u003c");
62
43
  return `<script>window.__VF_BRIDGE_CONFIG__=${safeJson};</script>
@@ -70,9 +51,9 @@ function buildStudioScript(url, projectId, filePath, branchId, apiBaseUrl) {
70
51
  * studio bridge integration.
71
52
  */
72
53
  export function generateMarkdownHtml(options) {
73
- const { rawHtml, title, description, request, url, projectId, filePath, branchId, apiBaseUrl } = options;
54
+ const { rawHtml, title, description, request, url, projectId, filePath } = options;
74
55
  const theme = detectTheme(request, url);
75
- const studioScript = buildStudioScript(url, projectId, filePath, branchId, apiBaseUrl);
56
+ const studioScript = buildStudioScript(url, projectId, filePath);
76
57
  const themeAttrs = theme ? ` data-theme="${theme}" style="color-scheme: ${theme};"` : "";
77
58
  return `<!DOCTYPE html>
78
59
  <html lang="en"${themeAttrs}>
@@ -1 +1 @@
1
- {"version":3,"file":"markdown-preview.handler.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/handlers/preview/markdown-preview.handler.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,OAAO,MAAM,2BAA2B,CAAC;AAGrD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAmB,aAAa,EAAE,MAAM,aAAa,CAAC;AAiBnG,qBAAa,sBAAuB,SAAQ,WAAW;IACrD,QAAQ,EAAE,eAAe,CAKvB;IAEI,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;YAiEjE,cAAc;CAmF7B"}
1
+ {"version":3,"file":"markdown-preview.handler.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/handlers/preview/markdown-preview.handler.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,OAAO,MAAM,2BAA2B,CAAC;AAGrD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAmB,aAAa,EAAE,MAAM,aAAa,CAAC;AAgBnG,qBAAa,sBAAuB,SAAQ,WAAW;IACrD,QAAQ,EAAE,eAAe,CAKvB;IAEI,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;YAiEjE,cAAc;CAiF7B"}
@@ -7,7 +7,6 @@ import { isExtendedFSAdapter } from "../../../platform/adapters/fs/wrapper.js";
7
7
  import { getEnv } from "../../../platform/compat/process.js";
8
8
  import { tryNotFoundFallback } from "../request/ssr/not-found-fallback.js";
9
9
  import { generateMarkdownHtml } from "./markdown-html-generator.js";
10
- import { getEnvironmentConfig } from "../../../config/environment-config.js";
11
10
  import { validatePathSync } from "../../../security/index.js";
12
11
  const logger = serverLogger.component("markdown-preview-handler");
13
12
  // Priority 900: between MEDIUM (600) and LOW/SSR (1000)
@@ -110,8 +109,6 @@ export class MarkdownPreviewHandler extends BaseHandler {
110
109
  url,
111
110
  projectId: ctx.projectSlug || ctx.projectId || "markdown-preview",
112
111
  filePath,
113
- branchId: ctx.parsedDomain?.branch ?? null,
114
- apiBaseUrl: getEnvironmentConfig().publicApiBaseUrl,
115
112
  });
116
113
  const responseBuilder = this.createResponseBuilder(ctx)
117
114
  .withCache("no-cache")
@@ -1 +1 @@
1
- {"version":3,"file":"bridge-bundle.generated.d.ts","sourceRoot":"","sources":["../../../../src/src/studio/bridge/bridge-bundle.generated.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,oBAAoB,EAAE,MAAy8qK,CAAC"}
1
+ {"version":3,"file":"bridge-bundle.generated.d.ts","sourceRoot":"","sources":["../../../../src/src/studio/bridge/bridge-bundle.generated.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,oBAAoB,EAAE,MAA67nD,CAAC"}