sitedrift 0.3.2 → 0.3.4

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/assets/viewer.js CHANGED
@@ -4,7 +4,10 @@
4
4
  config.dev = location.origin;
5
5
  config.frameOrigins = { dev: location.origin, live: location.origin };
6
6
  for (const iframe of document.querySelectorAll('iframe[data-side]')) {
7
- iframe.setAttribute('sandbox', 'allow-downloads allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-scripts');
7
+ // Same-origin is required for Safari to apply `style-src 'self'` inside
8
+ // the frame. Scripts stay disabled so framed site code cannot reach
9
+ // the same-origin sitedrift parent.
10
+ iframe.setAttribute('sandbox', 'allow-downloads allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin');
8
11
  }
9
12
  }
10
13
  const root = document.documentElement;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sitedrift",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "Catch the drift between dev and live — frame your local site and production side-by-side on the same route, locked scroll, with a difference-blend overlay. Zero runtime dependencies.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -35,9 +35,9 @@ async function devResponse(context, route) {
35
35
  if (context.request.method === 'GET' && accept.includes('text/html')) {
36
36
  const clean = pathname.replace(/^\/+/, '');
37
37
  const candidates = pathname.endsWith('/')
38
- ? [`/__sitedrift/source/${clean}index.html.txt`]
39
- : [`/__sitedrift/source/${clean}.html.txt`, `/__sitedrift/source/${clean}/index.html.txt`];
40
- if (pathname === '/') candidates.unshift('/__sitedrift/source/index.html.txt');
38
+ ? [`/__sitedrift_source/${clean}index.html.txt`]
39
+ : [`/__sitedrift_source/${clean}.html.txt`, `/__sitedrift_source/${clean}/index.html.txt`];
40
+ if (pathname === '/') candidates.unshift('/__sitedrift_source/index.html.txt');
41
41
  for (const pathname of candidates) {
42
42
  const response = await context.env.ASSETS.fetch(new URL(pathname, requestUrl));
43
43
  if (response.ok) {
@@ -72,9 +72,6 @@ async function liveResponse(context, route, live) {
72
72
 
73
73
  export async function onRequest(context) {
74
74
  const requestUrl = new URL(context.request.url);
75
- if (requestUrl.pathname.startsWith('/__sitedrift/source')) {
76
- return new Response('Not found.', { status: 404 });
77
- }
78
75
  const match = requestUrl.pathname.match(/^\/__sitedrift\/(dev|live)(\/.*)?$/);
79
76
  if (!match) return context.env.ASSETS.fetch(context.request);
80
77
  if (!['GET', 'HEAD'].includes(context.request.method)) {
@@ -53,7 +53,7 @@ export function installCloudflarePreview({
53
53
 
54
54
  const liveUrl = secureLive(live);
55
55
  const internal = path.join(output, '__sitedrift');
56
- const source = path.join(internal, 'source');
56
+ const source = path.join(output, '__sitedrift_source');
57
57
  const assetDir = path.join(internal, 'assets');
58
58
  fs.mkdirSync(source, { recursive: true });
59
59
  fs.mkdirSync(assetDir, { recursive: true });