@accelerated-agency/visual-editor 0.1.7 → 0.1.8

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/vite.cjs CHANGED
@@ -1919,6 +1919,23 @@ function createVisualEditorMiddleware(options) {
1919
1919
  }
1920
1920
  return;
1921
1921
  }
1922
+ const isRootProxyPath = pathname === "/api/proxy" || pathname.startsWith("/api/proxy/");
1923
+ if (!isRootProxyPath && pathname.includes("api/proxy")) {
1924
+ if ((req.method || "GET").toUpperCase() === "OPTIONS") {
1925
+ res.statusCode = 204;
1926
+ res.setHeader("Access-Control-Allow-Origin", "*");
1927
+ res.setHeader("Access-Control-Allow-Methods", "GET, HEAD, POST, OPTIONS");
1928
+ res.setHeader("Access-Control-Allow-Headers", "*");
1929
+ res.end();
1930
+ return;
1931
+ }
1932
+ res.statusCode = 200;
1933
+ res.setHeader("Content-Type", "application/json; charset=utf-8");
1934
+ res.setHeader("Cache-Control", "no-store");
1935
+ res.setHeader("Access-Control-Allow-Origin", "*");
1936
+ res.end("{}");
1937
+ return;
1938
+ }
1922
1939
  if (pathname.startsWith("/api/proxy")) {
1923
1940
  try {
1924
1941
  const url = new URL(req.url || "", "http://localhost");
package/dist/vite.js CHANGED
@@ -1911,6 +1911,23 @@ function createVisualEditorMiddleware(options) {
1911
1911
  }
1912
1912
  return;
1913
1913
  }
1914
+ const isRootProxyPath = pathname === "/api/proxy" || pathname.startsWith("/api/proxy/");
1915
+ if (!isRootProxyPath && pathname.includes("api/proxy")) {
1916
+ if ((req.method || "GET").toUpperCase() === "OPTIONS") {
1917
+ res.statusCode = 204;
1918
+ res.setHeader("Access-Control-Allow-Origin", "*");
1919
+ res.setHeader("Access-Control-Allow-Methods", "GET, HEAD, POST, OPTIONS");
1920
+ res.setHeader("Access-Control-Allow-Headers", "*");
1921
+ res.end();
1922
+ return;
1923
+ }
1924
+ res.statusCode = 200;
1925
+ res.setHeader("Content-Type", "application/json; charset=utf-8");
1926
+ res.setHeader("Cache-Control", "no-store");
1927
+ res.setHeader("Access-Control-Allow-Origin", "*");
1928
+ res.end("{}");
1929
+ return;
1930
+ }
1914
1931
  if (pathname.startsWith("/api/proxy")) {
1915
1932
  try {
1916
1933
  const url = new URL(req.url || "", "http://localhost");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@accelerated-agency/visual-editor",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "private": false,
5
5
  "description": "Conversion visual editor as a reusable React package",
6
6
  "type": "module",