@archie/devtools 0.0.7 → 0.0.9

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.
@@ -2,7 +2,7 @@ import {
2
2
  getAllowedOriginPatterns,
3
3
  getAllowedOrigins,
4
4
  isPreviewOrigin
5
- } from "./chunk-DLRODACA.mjs";
5
+ } from "./chunk-D5EA6RR5.mjs";
6
6
 
7
7
  // src/client/inject-inspector/injectInspector.ts
8
8
  var DEFAULT_SCRIPT_ID = "archie-inspector-script";
@@ -5,9 +5,15 @@ var ARCHIE_HOST_ORIGINS = [
5
5
  "https://app.archie.com"
6
6
  ];
7
7
  var ARCHIE_PREVIEW_ORIGIN_SUFFIXES = [
8
+ ".staging.archie-platform.com",
8
9
  ".archie-platform.com",
9
10
  ".archie.com"
10
11
  ];
12
+ var PREVIEW_DEPLOY_HOST_SUFFIXES = [
13
+ ".previews.staging.archie-platform.com",
14
+ ".previews.archie-platform.com",
15
+ ".previews.archie.com"
16
+ ];
11
17
  var LOCAL_DEV_ORIGINS = [
12
18
  "http://localhost:3000",
13
19
  "http://localhost:3001"
@@ -24,7 +30,7 @@ function isPreviewOrigin(origin) {
24
30
  if (!origin || typeof origin !== "string") return false;
25
31
  try {
26
32
  const host = new URL(origin).host;
27
- return ARCHIE_PREVIEW_ORIGIN_SUFFIXES.some((suffix) => host.endsWith(suffix));
33
+ return PREVIEW_DEPLOY_HOST_SUFFIXES.some((suffix) => host.endsWith(suffix));
28
34
  } catch {
29
35
  return false;
30
36
  }
@@ -33,6 +39,7 @@ function isPreviewOrigin(origin) {
33
39
  export {
34
40
  ARCHIE_HOST_ORIGINS,
35
41
  ARCHIE_PREVIEW_ORIGIN_SUFFIXES,
42
+ PREVIEW_DEPLOY_HOST_SUFFIXES,
36
43
  LOCAL_DEV_ORIGINS,
37
44
  getAllowedOrigins,
38
45
  getAllowedOriginPatterns,
@@ -1162,9 +1162,15 @@ var ARCHIE_HOST_ORIGINS = [
1162
1162
  "https://app.archie.com"
1163
1163
  ];
1164
1164
  var ARCHIE_PREVIEW_ORIGIN_SUFFIXES = [
1165
+ ".staging.archie-platform.com",
1165
1166
  ".archie-platform.com",
1166
1167
  ".archie.com"
1167
1168
  ];
1169
+ var PREVIEW_DEPLOY_HOST_SUFFIXES = [
1170
+ ".previews.staging.archie-platform.com",
1171
+ ".previews.archie-platform.com",
1172
+ ".previews.archie.com"
1173
+ ];
1168
1174
  var LOCAL_DEV_ORIGINS = [
1169
1175
  "http://localhost:3000",
1170
1176
  "http://localhost:3001"
@@ -1181,7 +1187,7 @@ function isPreviewOrigin(origin) {
1181
1187
  if (!origin || typeof origin !== "string") return false;
1182
1188
  try {
1183
1189
  const host = new URL(origin).host;
1184
- return ARCHIE_PREVIEW_ORIGIN_SUFFIXES.some((suffix) => host.endsWith(suffix));
1190
+ return PREVIEW_DEPLOY_HOST_SUFFIXES.some((suffix) => host.endsWith(suffix));
1185
1191
  } catch {
1186
1192
  return false;
1187
1193
  }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  injectInspector
3
- } from "../../chunk-JPNYFFBN.mjs";
4
- import "../../chunk-DLRODACA.mjs";
3
+ } from "../../chunk-6HHNPJXA.mjs";
4
+ import "../../chunk-D5EA6RR5.mjs";
5
5
 
6
6
  // src/client/inject-inspector/auto.ts
7
7
  injectInspector();
@@ -1180,9 +1180,15 @@ var ARCHIE_HOST_ORIGINS = [
1180
1180
  "https://app.archie.com"
1181
1181
  ];
1182
1182
  var ARCHIE_PREVIEW_ORIGIN_SUFFIXES = [
1183
+ ".staging.archie-platform.com",
1183
1184
  ".archie-platform.com",
1184
1185
  ".archie.com"
1185
1186
  ];
1187
+ var PREVIEW_DEPLOY_HOST_SUFFIXES = [
1188
+ ".previews.staging.archie-platform.com",
1189
+ ".previews.archie-platform.com",
1190
+ ".previews.archie.com"
1191
+ ];
1186
1192
  var LOCAL_DEV_ORIGINS = [
1187
1193
  "http://localhost:3000",
1188
1194
  "http://localhost:3001"
@@ -1199,7 +1205,7 @@ function isPreviewOrigin(origin) {
1199
1205
  if (!origin || typeof origin !== "string") return false;
1200
1206
  try {
1201
1207
  const host = new URL(origin).host;
1202
- return ARCHIE_PREVIEW_ORIGIN_SUFFIXES.some((suffix) => host.endsWith(suffix));
1208
+ return PREVIEW_DEPLOY_HOST_SUFFIXES.some((suffix) => host.endsWith(suffix));
1203
1209
  } catch {
1204
1210
  return false;
1205
1211
  }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  injectInspector
3
- } from "../../chunk-JPNYFFBN.mjs";
4
- import "../../chunk-DLRODACA.mjs";
3
+ } from "../../chunk-6HHNPJXA.mjs";
4
+ import "../../chunk-D5EA6RR5.mjs";
5
5
  export {
6
6
  injectInspector
7
7
  };
@@ -8,9 +8,17 @@
8
8
  declare const ARCHIE_HOST_ORIGINS: readonly ["https://app.dev.archie-platform.com", "https://app.staging.archie-platform.com", "https://app.archie.com"];
9
9
  /**
10
10
  * Origin suffix patterns for Archie preview iframes (e.g. deploy previews).
11
- * The inspector allows any origin whose host ends with one of these suffixes,
11
+ * The inspector allows any origin whose host ends with one of these suffixes
12
+ * to send messages to the inspector (allowlist).
12
13
  */
13
- declare const ARCHIE_PREVIEW_ORIGIN_SUFFIXES: readonly [".archie-platform.com", ".archie.com"];
14
+ declare const ARCHIE_PREVIEW_ORIGIN_SUFFIXES: readonly [".staging.archie-platform.com", ".archie-platform.com", ".archie.com"];
15
+ /**
16
+ * Host suffixes that identify a **preview deploy** iframe (e.g. 0cf7f787-....previews.staging.archie-platform.com).
17
+ * Used only by isPreviewOrigin() to decide "don't use referrer as targetOrigin" when the *current page*
18
+ * is a preview iframe. Must be narrower than ARCHIE_PREVIEW_ORIGIN_SUFFIXES so that the parent
19
+ * (e.g. app.dev.archie-platform.com) is not treated as a preview and its origin is used as targetOrigin.
20
+ */
21
+ declare const PREVIEW_DEPLOY_HOST_SUFFIXES: readonly [".previews.staging.archie-platform.com", ".previews.archie-platform.com", ".previews.archie.com"];
14
22
  /**
15
23
  * Common local origins for development. Add these when testing the inspector
16
24
  * with the host running on localhost (e.g. host on :3000, preview iframe on :5173).
@@ -31,9 +39,10 @@ declare function getAllowedOrigins(includeLocal?: boolean): string[];
31
39
  */
32
40
  declare function getAllowedOriginPatterns(): string[];
33
41
  /**
34
- * Returns true if the given origin is a known Archie preview origin (e.g. deploy preview iframe).
35
- * When the inspector runs inside a preview iframe, targetOrigin for postMessage must be
42
+ * Returns true if the given origin is a preview **deploy** iframe (e.g. xxx.previews.staging.archie-platform.com).
43
+ * Used so we don't use that origin as postMessage targetOrigin; the target must be the parent app.
44
+ * Does not match app.dev.archie-platform.com / app.staging.archie-platform.com (so they can be used as target).
36
45
  */
37
46
  declare function isPreviewOrigin(origin: string): boolean;
38
47
 
39
- export { ARCHIE_HOST_ORIGINS, ARCHIE_PREVIEW_ORIGIN_SUFFIXES, type ArchieHostOrigin, LOCAL_DEV_ORIGINS, getAllowedOriginPatterns, getAllowedOrigins, isPreviewOrigin };
48
+ export { ARCHIE_HOST_ORIGINS, ARCHIE_PREVIEW_ORIGIN_SUFFIXES, type ArchieHostOrigin, LOCAL_DEV_ORIGINS, PREVIEW_DEPLOY_HOST_SUFFIXES, getAllowedOriginPatterns, getAllowedOrigins, isPreviewOrigin };
@@ -8,9 +8,17 @@
8
8
  declare const ARCHIE_HOST_ORIGINS: readonly ["https://app.dev.archie-platform.com", "https://app.staging.archie-platform.com", "https://app.archie.com"];
9
9
  /**
10
10
  * Origin suffix patterns for Archie preview iframes (e.g. deploy previews).
11
- * The inspector allows any origin whose host ends with one of these suffixes,
11
+ * The inspector allows any origin whose host ends with one of these suffixes
12
+ * to send messages to the inspector (allowlist).
12
13
  */
13
- declare const ARCHIE_PREVIEW_ORIGIN_SUFFIXES: readonly [".archie-platform.com", ".archie.com"];
14
+ declare const ARCHIE_PREVIEW_ORIGIN_SUFFIXES: readonly [".staging.archie-platform.com", ".archie-platform.com", ".archie.com"];
15
+ /**
16
+ * Host suffixes that identify a **preview deploy** iframe (e.g. 0cf7f787-....previews.staging.archie-platform.com).
17
+ * Used only by isPreviewOrigin() to decide "don't use referrer as targetOrigin" when the *current page*
18
+ * is a preview iframe. Must be narrower than ARCHIE_PREVIEW_ORIGIN_SUFFIXES so that the parent
19
+ * (e.g. app.dev.archie-platform.com) is not treated as a preview and its origin is used as targetOrigin.
20
+ */
21
+ declare const PREVIEW_DEPLOY_HOST_SUFFIXES: readonly [".previews.staging.archie-platform.com", ".previews.archie-platform.com", ".previews.archie.com"];
14
22
  /**
15
23
  * Common local origins for development. Add these when testing the inspector
16
24
  * with the host running on localhost (e.g. host on :3000, preview iframe on :5173).
@@ -31,9 +39,10 @@ declare function getAllowedOrigins(includeLocal?: boolean): string[];
31
39
  */
32
40
  declare function getAllowedOriginPatterns(): string[];
33
41
  /**
34
- * Returns true if the given origin is a known Archie preview origin (e.g. deploy preview iframe).
35
- * When the inspector runs inside a preview iframe, targetOrigin for postMessage must be
42
+ * Returns true if the given origin is a preview **deploy** iframe (e.g. xxx.previews.staging.archie-platform.com).
43
+ * Used so we don't use that origin as postMessage targetOrigin; the target must be the parent app.
44
+ * Does not match app.dev.archie-platform.com / app.staging.archie-platform.com (so they can be used as target).
36
45
  */
37
46
  declare function isPreviewOrigin(origin: string): boolean;
38
47
 
39
- export { ARCHIE_HOST_ORIGINS, ARCHIE_PREVIEW_ORIGIN_SUFFIXES, type ArchieHostOrigin, LOCAL_DEV_ORIGINS, getAllowedOriginPatterns, getAllowedOrigins, isPreviewOrigin };
48
+ export { ARCHIE_HOST_ORIGINS, ARCHIE_PREVIEW_ORIGIN_SUFFIXES, type ArchieHostOrigin, LOCAL_DEV_ORIGINS, PREVIEW_DEPLOY_HOST_SUFFIXES, getAllowedOriginPatterns, getAllowedOrigins, isPreviewOrigin };
@@ -23,6 +23,7 @@ __export(archieOrigins_exports, {
23
23
  ARCHIE_HOST_ORIGINS: () => ARCHIE_HOST_ORIGINS,
24
24
  ARCHIE_PREVIEW_ORIGIN_SUFFIXES: () => ARCHIE_PREVIEW_ORIGIN_SUFFIXES,
25
25
  LOCAL_DEV_ORIGINS: () => LOCAL_DEV_ORIGINS,
26
+ PREVIEW_DEPLOY_HOST_SUFFIXES: () => PREVIEW_DEPLOY_HOST_SUFFIXES,
26
27
  getAllowedOriginPatterns: () => getAllowedOriginPatterns,
27
28
  getAllowedOrigins: () => getAllowedOrigins,
28
29
  isPreviewOrigin: () => isPreviewOrigin
@@ -34,9 +35,15 @@ var ARCHIE_HOST_ORIGINS = [
34
35
  "https://app.archie.com"
35
36
  ];
36
37
  var ARCHIE_PREVIEW_ORIGIN_SUFFIXES = [
38
+ ".staging.archie-platform.com",
37
39
  ".archie-platform.com",
38
40
  ".archie.com"
39
41
  ];
42
+ var PREVIEW_DEPLOY_HOST_SUFFIXES = [
43
+ ".previews.staging.archie-platform.com",
44
+ ".previews.archie-platform.com",
45
+ ".previews.archie.com"
46
+ ];
40
47
  var LOCAL_DEV_ORIGINS = [
41
48
  "http://localhost:3000",
42
49
  "http://localhost:3001"
@@ -53,7 +60,7 @@ function isPreviewOrigin(origin) {
53
60
  if (!origin || typeof origin !== "string") return false;
54
61
  try {
55
62
  const host = new URL(origin).host;
56
- return ARCHIE_PREVIEW_ORIGIN_SUFFIXES.some((suffix) => host.endsWith(suffix));
63
+ return PREVIEW_DEPLOY_HOST_SUFFIXES.some((suffix) => host.endsWith(suffix));
57
64
  } catch {
58
65
  return false;
59
66
  }
@@ -63,6 +70,7 @@ function isPreviewOrigin(origin) {
63
70
  ARCHIE_HOST_ORIGINS,
64
71
  ARCHIE_PREVIEW_ORIGIN_SUFFIXES,
65
72
  LOCAL_DEV_ORIGINS,
73
+ PREVIEW_DEPLOY_HOST_SUFFIXES,
66
74
  getAllowedOriginPatterns,
67
75
  getAllowedOrigins,
68
76
  isPreviewOrigin
@@ -2,14 +2,16 @@ import {
2
2
  ARCHIE_HOST_ORIGINS,
3
3
  ARCHIE_PREVIEW_ORIGIN_SUFFIXES,
4
4
  LOCAL_DEV_ORIGINS,
5
+ PREVIEW_DEPLOY_HOST_SUFFIXES,
5
6
  getAllowedOriginPatterns,
6
7
  getAllowedOrigins,
7
8
  isPreviewOrigin
8
- } from "../chunk-DLRODACA.mjs";
9
+ } from "../chunk-D5EA6RR5.mjs";
9
10
  export {
10
11
  ARCHIE_HOST_ORIGINS,
11
12
  ARCHIE_PREVIEW_ORIGIN_SUFFIXES,
12
13
  LOCAL_DEV_ORIGINS,
14
+ PREVIEW_DEPLOY_HOST_SUFFIXES,
13
15
  getAllowedOriginPatterns,
14
16
  getAllowedOrigins,
15
17
  isPreviewOrigin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archie/devtools",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "DevTools for Archie generated applications - Route synchronization and editor communication",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",