@nuxt/scripts 1.0.0-rc.1 → 1.0.0-rc.10

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.
Files changed (164) hide show
  1. package/bin/cli.mjs +2 -0
  2. package/dist/cli.d.mts +2 -0
  3. package/dist/cli.d.ts +2 -0
  4. package/dist/cli.mjs +50 -0
  5. package/dist/devtools-client/200.html +1 -1
  6. package/dist/devtools-client/404.html +1 -1
  7. package/dist/devtools-client/_nuxt/{ajngqPCs.js → BgPDxVUn.js} +1 -1
  8. package/dist/devtools-client/_nuxt/{DKL6PHO3.js → BmlapxLP.js} +1 -1
  9. package/dist/devtools-client/_nuxt/CM2vefXI.js +188 -0
  10. package/dist/devtools-client/_nuxt/{CfOsp0mU.js → DAF5Qk9P.js} +1 -1
  11. package/dist/devtools-client/_nuxt/{B3kN3DAy.js → Dx6HhVmj.js} +1 -1
  12. package/dist/devtools-client/_nuxt/{dlaR8P-P.js → S8LiR9M1.js} +1 -1
  13. package/dist/devtools-client/_nuxt/builds/latest.json +1 -1
  14. package/dist/devtools-client/_nuxt/builds/meta/5458a3f2-af35-479c-8852-bf6f92fed611.json +1 -0
  15. package/dist/devtools-client/_nuxt/{entry.BwpOBArY.css → entry.BKkVrcJj.css} +1 -1
  16. package/dist/devtools-client/_nuxt/error-404.d44aGwWI.css +1 -0
  17. package/dist/devtools-client/_nuxt/error-500.NthMfIEt.css +1 -0
  18. package/dist/devtools-client/_nuxt/index.DZD1lwyI.css +1 -0
  19. package/dist/devtools-client/_nuxt/vBkR1GJq.js +1 -0
  20. package/dist/devtools-client/docs/index.html +1 -1
  21. package/dist/devtools-client/first-party/index.html +1 -1
  22. package/dist/devtools-client/index.html +1 -1
  23. package/dist/devtools-client/registry/index.html +1 -1
  24. package/dist/module.d.mts +66 -2
  25. package/dist/module.d.ts +66 -2
  26. package/dist/module.json +1 -1
  27. package/dist/module.mjs +144 -28
  28. package/dist/registry.d.mts +1 -0
  29. package/dist/registry.d.ts +1 -0
  30. package/dist/registry.mjs +14 -14
  31. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.d.vue.ts +73 -97
  32. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue +81 -58
  33. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue.d.ts +73 -97
  34. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsInfoWindow.d.vue.ts +2 -3
  35. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsInfoWindow.vue +1 -0
  36. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsInfoWindow.vue.d.ts +2 -3
  37. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.d.vue.ts +2 -3
  38. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.vue +2 -1
  39. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.vue.d.ts +2 -3
  40. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.d.vue.ts +10 -43
  41. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.vue +3 -1
  42. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.vue.d.ts +10 -43
  43. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.d.vue.ts +50 -30
  44. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.vue +145 -104
  45. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.vue.d.ts +50 -30
  46. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsStaticMap.vue +7 -2
  47. package/dist/runtime/components/GoogleMaps/types.d.ts +42 -0
  48. package/dist/runtime/components/GoogleMaps/types.js +1 -0
  49. package/dist/runtime/components/GoogleMaps/useGoogleMapsResource.d.ts +50 -0
  50. package/dist/runtime/components/GoogleMaps/useGoogleMapsResource.js +76 -1
  51. package/dist/runtime/components/ScriptBlueskyEmbed.d.vue.ts +10 -12
  52. package/dist/runtime/components/ScriptBlueskyEmbed.vue +13 -10
  53. package/dist/runtime/components/ScriptBlueskyEmbed.vue.d.ts +10 -12
  54. package/dist/runtime/components/ScriptCarbonAds.d.vue.ts +4 -7
  55. package/dist/runtime/components/ScriptCarbonAds.vue +1 -0
  56. package/dist/runtime/components/ScriptCarbonAds.vue.d.ts +4 -7
  57. package/dist/runtime/components/ScriptCrisp.d.vue.ts +7 -11
  58. package/dist/runtime/components/ScriptCrisp.vue +1 -0
  59. package/dist/runtime/components/ScriptCrisp.vue.d.ts +7 -11
  60. package/dist/runtime/components/ScriptGoogleAdsense.d.vue.ts +4 -7
  61. package/dist/runtime/components/ScriptGoogleAdsense.vue +1 -0
  62. package/dist/runtime/components/ScriptGoogleAdsense.vue.d.ts +4 -7
  63. package/dist/runtime/components/ScriptInstagramEmbed.d.vue.ts +11 -13
  64. package/dist/runtime/components/ScriptInstagramEmbed.vue +4 -1
  65. package/dist/runtime/components/ScriptInstagramEmbed.vue.d.ts +11 -13
  66. package/dist/runtime/components/ScriptIntercom.d.vue.ts +7 -11
  67. package/dist/runtime/components/ScriptIntercom.vue +1 -0
  68. package/dist/runtime/components/ScriptIntercom.vue.d.ts +7 -11
  69. package/dist/runtime/components/ScriptLemonSqueezy.d.vue.ts +2 -3
  70. package/dist/runtime/components/ScriptLemonSqueezy.vue +1 -0
  71. package/dist/runtime/components/ScriptLemonSqueezy.vue.d.ts +2 -3
  72. package/dist/runtime/components/ScriptPayPalButtons.d.vue.ts +8 -13
  73. package/dist/runtime/components/ScriptPayPalButtons.vue +1 -0
  74. package/dist/runtime/components/ScriptPayPalButtons.vue.d.ts +8 -13
  75. package/dist/runtime/components/ScriptPayPalMessages.d.vue.ts +8 -13
  76. package/dist/runtime/components/ScriptPayPalMessages.vue +1 -0
  77. package/dist/runtime/components/ScriptPayPalMessages.vue.d.ts +8 -13
  78. package/dist/runtime/components/ScriptStripePricingTable.d.vue.ts +5 -9
  79. package/dist/runtime/components/ScriptStripePricingTable.vue +1 -0
  80. package/dist/runtime/components/ScriptStripePricingTable.vue.d.ts +5 -9
  81. package/dist/runtime/components/ScriptVimeoPlayer.d.vue.ts +8 -11
  82. package/dist/runtime/components/ScriptVimeoPlayer.vue +1 -0
  83. package/dist/runtime/components/ScriptVimeoPlayer.vue.d.ts +8 -11
  84. package/dist/runtime/components/ScriptXEmbed.d.vue.ts +10 -12
  85. package/dist/runtime/components/ScriptXEmbed.vue +12 -9
  86. package/dist/runtime/components/ScriptXEmbed.vue.d.ts +10 -12
  87. package/dist/runtime/components/ScriptYouTubePlayer.d.vue.ts +8 -13
  88. package/dist/runtime/components/ScriptYouTubePlayer.vue +1 -0
  89. package/dist/runtime/components/ScriptYouTubePlayer.vue.d.ts +8 -13
  90. package/dist/runtime/composables/useScript.js +17 -6
  91. package/dist/runtime/composables/useScriptProxyToken.d.ts +12 -0
  92. package/dist/runtime/composables/useScriptProxyToken.js +4 -0
  93. package/dist/runtime/composables/useScriptProxyUrl.d.ts +12 -0
  94. package/dist/runtime/composables/useScriptProxyUrl.js +27 -0
  95. package/dist/runtime/plugins/proxy-token.server.d.ts +10 -0
  96. package/dist/runtime/plugins/proxy-token.server.js +17 -0
  97. package/dist/runtime/registry/bing-uet.d.ts +189 -11
  98. package/dist/runtime/registry/bing-uet.js +16 -2
  99. package/dist/runtime/registry/bluesky-embed.d.ts +0 -4
  100. package/dist/runtime/registry/bluesky-embed.js +0 -4
  101. package/dist/runtime/registry/clarity.d.ts +6 -2
  102. package/dist/runtime/registry/clarity.js +12 -1
  103. package/dist/runtime/registry/google-analytics.d.ts +6 -2
  104. package/dist/runtime/registry/google-analytics.js +12 -1
  105. package/dist/runtime/registry/google-tag-manager.d.ts +6 -2
  106. package/dist/runtime/registry/google-tag-manager.js +10 -1
  107. package/dist/runtime/registry/gravatar.js +10 -13
  108. package/dist/runtime/registry/matomo-analytics.d.ts +9 -3
  109. package/dist/runtime/registry/matomo-analytics.js +28 -1
  110. package/dist/runtime/registry/meta-pixel.d.ts +8 -2
  111. package/dist/runtime/registry/meta-pixel.js +10 -1
  112. package/dist/runtime/registry/mixpanel-analytics.d.ts +12 -2
  113. package/dist/runtime/registry/mixpanel-analytics.js +16 -4
  114. package/dist/runtime/registry/posthog.d.ts +8 -2
  115. package/dist/runtime/registry/posthog.js +15 -4
  116. package/dist/runtime/registry/schemas.d.ts +65 -0
  117. package/dist/runtime/registry/schemas.js +75 -8
  118. package/dist/runtime/registry/tiktok-pixel.d.ts +16 -2
  119. package/dist/runtime/registry/tiktok-pixel.js +22 -1
  120. package/dist/runtime/registry/x-embed.d.ts +0 -4
  121. package/dist/runtime/registry/x-embed.js +0 -4
  122. package/dist/runtime/server/bluesky-embed-image.d.ts +1 -1
  123. package/dist/runtime/server/bluesky-embed.d.ts +1 -15
  124. package/dist/runtime/server/bluesky-embed.js +25 -6
  125. package/dist/runtime/server/google-maps-geocode-proxy.js +12 -8
  126. package/dist/runtime/server/google-static-maps-proxy.d.ts +1 -1
  127. package/dist/runtime/server/google-static-maps-proxy.js +17 -11
  128. package/dist/runtime/server/gravatar-proxy.d.ts +1 -1
  129. package/dist/runtime/server/gravatar-proxy.js +10 -10
  130. package/dist/runtime/server/instagram-embed-asset.d.ts +1 -1
  131. package/dist/runtime/server/instagram-embed-image.d.ts +1 -1
  132. package/dist/runtime/server/instagram-embed.d.ts +1 -16
  133. package/dist/runtime/server/instagram-embed.js +26 -125
  134. package/dist/runtime/server/proxy-handler.js +1 -2
  135. package/dist/runtime/server/utils/cached-upstream.d.ts +55 -0
  136. package/dist/runtime/server/utils/cached-upstream.js +65 -0
  137. package/dist/runtime/server/utils/embed-rewriters.d.ts +19 -0
  138. package/dist/runtime/server/utils/embed-rewriters.js +41 -0
  139. package/dist/runtime/server/utils/image-proxy.d.ts +3 -1
  140. package/dist/runtime/server/utils/image-proxy.js +11 -8
  141. package/dist/runtime/server/utils/instagram-embed.d.ts +16 -0
  142. package/dist/runtime/server/utils/instagram-embed.js +153 -0
  143. package/dist/runtime/server/utils/proxy-url.d.ts +9 -0
  144. package/dist/runtime/server/utils/proxy-url.js +21 -0
  145. package/dist/runtime/server/utils/sign-constants.d.ts +16 -0
  146. package/dist/runtime/server/utils/sign-constants.js +5 -0
  147. package/dist/runtime/server/utils/sign.d.ts +101 -0
  148. package/dist/runtime/server/utils/sign.js +91 -0
  149. package/dist/runtime/server/utils/withSigning.d.ts +23 -0
  150. package/dist/runtime/server/utils/withSigning.js +19 -0
  151. package/dist/runtime/server/x-embed-image.d.ts +1 -1
  152. package/dist/runtime/server/x-embed.js +23 -4
  153. package/dist/runtime/types.d.ts +41 -6
  154. package/dist/runtime/types.js +1 -0
  155. package/dist/stats.mjs +298 -338
  156. package/dist/types-source.mjs +537 -164
  157. package/dist/types.d.mts +2 -2
  158. package/package.json +10 -6
  159. package/dist/devtools-client/_nuxt/C8jhSQ8l.js +0 -1
  160. package/dist/devtools-client/_nuxt/CJD6wrkT.js +0 -188
  161. package/dist/devtools-client/_nuxt/builds/meta/b800a0be-5cab-4ea6-89e3-dd3a85690a73.json +0 -1
  162. package/dist/devtools-client/_nuxt/error-404.CvOVjXeC.css +0 -1
  163. package/dist/devtools-client/_nuxt/error-500.BIm53nmx.css +0 -1
  164. package/dist/devtools-client/_nuxt/index.CA-OpSj0.css +0 -1
@@ -7,15 +7,11 @@ type __VLS_Props = {
7
7
  customerEmail?: string;
8
8
  customerSessionClientSecret?: string;
9
9
  };
10
- declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {}, __VLS_7: {};
11
- type __VLS_Slots = {} & {
12
- loading?: (props: typeof __VLS_1) => any;
13
- } & {
14
- awaitingLoad?: (props: typeof __VLS_3) => any;
15
- } & {
16
- error?: (props: typeof __VLS_5) => any;
17
- } & {
18
- default?: (props: typeof __VLS_7) => any;
10
+ type __VLS_Slots = {
11
+ default?: () => any;
12
+ loading?: () => any;
13
+ awaitingLoad?: () => any;
14
+ error?: () => any;
19
15
  };
20
16
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
21
17
  error: () => any;
@@ -11,6 +11,7 @@ const props = defineProps({
11
11
  customerSessionClientSecret: { type: String, required: false }
12
12
  });
13
13
  const emit = defineEmits(["ready", "error"]);
14
+ defineSlots();
14
15
  const rootEl = ref();
15
16
  const containerEl = ref();
16
17
  const trigger = useScriptTriggerElement({ trigger: props.trigger, el: rootEl });
@@ -7,15 +7,11 @@ type __VLS_Props = {
7
7
  customerEmail?: string;
8
8
  customerSessionClientSecret?: string;
9
9
  };
10
- declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {}, __VLS_7: {};
11
- type __VLS_Slots = {} & {
12
- loading?: (props: typeof __VLS_1) => any;
13
- } & {
14
- awaitingLoad?: (props: typeof __VLS_3) => any;
15
- } & {
16
- error?: (props: typeof __VLS_5) => any;
17
- } & {
18
- default?: (props: typeof __VLS_7) => any;
10
+ type __VLS_Slots = {
11
+ default?: () => any;
12
+ loading?: () => any;
13
+ awaitingLoad?: () => any;
14
+ error?: () => any;
19
15
  };
20
16
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
21
17
  error: () => any;
@@ -44,17 +44,14 @@ type __VLS_Props = {
44
44
  */
45
45
  placeholderObjectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
46
46
  };
47
- declare var __VLS_1: any, __VLS_3: {}, __VLS_10: {}, __VLS_12: {}, __VLS_14: {};
48
- type __VLS_Slots = {} & {
49
- placeholder?: (props: typeof __VLS_1) => any;
50
- } & {
51
- loading?: (props: typeof __VLS_3) => any;
52
- } & {
53
- awaitingLoad?: (props: typeof __VLS_10) => any;
54
- } & {
55
- error?: (props: typeof __VLS_12) => any;
56
- } & {
57
- default?: (props: typeof __VLS_14) => any;
47
+ type __VLS_Slots = {
48
+ default?: () => any;
49
+ placeholder?: (props: {
50
+ placeholder: string | undefined;
51
+ }) => any;
52
+ loading?: () => any;
53
+ awaitingLoad?: () => any;
54
+ error?: () => any;
58
55
  };
59
56
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
60
57
  play: () => Promise<void> | undefined;
@@ -17,6 +17,7 @@ const props = defineProps({
17
17
  placeholderObjectFit: { type: String, required: false, default: "contain" }
18
18
  });
19
19
  const emits = defineEmits(["play", "playing", "pause", "ended", "timeupdate", "progress", "seeking", "seeked", "texttrackchange", "chapterchange", "cuechange", "cuepoint", "volumechange", "playbackratechange", "bufferstart", "bufferend", "error", "loaded", "durationchange", "fullscreenchange", "qualitychange", "camerachange", "resize", "enterpictureinpicture", "leavepictureinpicture"]);
20
+ defineSlots();
20
21
  const events = [
21
22
  "play",
22
23
  "playing",
@@ -44,17 +44,14 @@ type __VLS_Props = {
44
44
  */
45
45
  placeholderObjectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
46
46
  };
47
- declare var __VLS_1: any, __VLS_3: {}, __VLS_10: {}, __VLS_12: {}, __VLS_14: {};
48
- type __VLS_Slots = {} & {
49
- placeholder?: (props: typeof __VLS_1) => any;
50
- } & {
51
- loading?: (props: typeof __VLS_3) => any;
52
- } & {
53
- awaitingLoad?: (props: typeof __VLS_10) => any;
54
- } & {
55
- error?: (props: typeof __VLS_12) => any;
56
- } & {
57
- default?: (props: typeof __VLS_14) => any;
47
+ type __VLS_Slots = {
48
+ default?: () => any;
49
+ placeholder?: (props: {
50
+ placeholder: string | undefined;
51
+ }) => any;
52
+ loading?: () => any;
53
+ awaitingLoad?: () => any;
54
+ error?: () => any;
58
55
  };
59
56
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
60
57
  play: () => Promise<void> | undefined;
@@ -18,14 +18,19 @@ type __VLS_Props = {
18
18
  */
19
19
  rootAttrs?: HTMLAttributes;
20
20
  };
21
- declare var __VLS_1: {}, __VLS_3: {
22
- error: import("nuxt/app").NuxtError<unknown> | undefined;
23
- }, __VLS_5: {
21
+ type __VLS_Slots = {
22
+ default?: (props: NonNullable<typeof slotProps.value>) => any;
23
+ loading?: () => any;
24
+ error?: (props: {
25
+ error: typeof error.value;
26
+ }) => any;
27
+ };
28
+ declare const error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined, import("nuxt/app").NuxtError<unknown> | undefined>;
29
+ declare const slotProps: import("vue").ComputedRef<{
24
30
  tweet: XEmbedTweetData;
25
31
  userName: string;
26
32
  userHandle: string;
27
33
  userAvatar: string;
28
- userAvatarOriginal: string;
29
34
  isVerified: boolean | undefined;
30
35
  text: string;
31
36
  datetime: string;
@@ -54,14 +59,7 @@ declare var __VLS_1: {}, __VLS_3: {
54
59
  isReply: boolean;
55
60
  replyToUser: string | undefined;
56
61
  proxyImage: (url: string) => string;
57
- };
58
- type __VLS_Slots = {} & {
59
- loading?: (props: typeof __VLS_1) => any;
60
- } & {
61
- error?: (props: typeof __VLS_3) => any;
62
- } & {
63
- default?: (props: typeof __VLS_5) => any;
64
- };
62
+ } | null>;
65
63
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
66
64
  tweet: import("vue").Ref<XEmbedTweetData | undefined, XEmbedTweetData | undefined>;
67
65
  status: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus, import("nuxt/app").AsyncDataRequestStatus>;
@@ -1,7 +1,8 @@
1
1
  <script setup>
2
2
  import { useAsyncData } from "nuxt/app";
3
3
  import { computed } from "vue";
4
- import { formatCount, formatTweetDate, proxyXImageUrl } from "../registry/x-embed";
4
+ import { useScriptProxyUrl } from "../composables/useScriptProxyUrl";
5
+ import { formatCount, formatTweetDate } from "../registry/x-embed";
5
6
  import { requireRegistryEndpoint, scriptsPrefix } from "../utils";
6
7
  const props = defineProps({
7
8
  tweetId: { type: String, required: true },
@@ -9,15 +10,17 @@ const props = defineProps({
9
10
  imageProxyEndpoint: { type: String, required: false, default: void 0 },
10
11
  rootAttrs: { type: Object, required: false }
11
12
  });
13
+ defineSlots();
12
14
  const prefix = scriptsPrefix();
13
15
  const apiEndpoint = computed(() => props.apiEndpoint || `${prefix}/embed/x`);
14
16
  const resolvedImageProxyEndpoint = computed(() => props.imageProxyEndpoint || `${prefix}/embed/x-image`);
15
17
  if (!props.apiEndpoint)
16
18
  requireRegistryEndpoint("ScriptXEmbed", "xEmbed");
19
+ const proxyUrl = useScriptProxyUrl();
17
20
  const cacheKey = computed(() => `x-embed-${props.tweetId}`);
18
21
  const { data: tweet, status, error } = useAsyncData(
19
22
  cacheKey,
20
- () => $fetch(`${apiEndpoint.value}?id=${props.tweetId}`)
23
+ () => $fetch(proxyUrl(apiEndpoint.value, { id: props.tweetId }))
21
24
  );
22
25
  const slotProps = computed(() => {
23
26
  if (!tweet.value)
@@ -29,8 +32,7 @@ const slotProps = computed(() => {
29
32
  // User info
30
33
  userName: t.user.name,
31
34
  userHandle: t.user.screen_name,
32
- userAvatar: proxyXImageUrl(t.user.profile_image_url_https, resolvedImageProxyEndpoint.value),
33
- userAvatarOriginal: t.user.profile_image_url_https,
35
+ userAvatar: t.user.profile_image_url_https,
34
36
  isVerified: t.user.verified || t.user.is_blue_verified,
35
37
  // Tweet content
36
38
  text: t.text,
@@ -41,14 +43,14 @@ const slotProps = computed(() => {
41
43
  likesFormatted: formatCount(t.favorite_count),
42
44
  replies: t.conversation_count,
43
45
  repliesFormatted: formatCount(t.conversation_count),
44
- // Media
46
+ // Media (already proxied)
45
47
  photos: t.photos?.map((p) => ({
46
48
  ...p,
47
- proxiedUrl: proxyXImageUrl(p.url, resolvedImageProxyEndpoint.value)
49
+ proxiedUrl: p.url
48
50
  })),
49
51
  video: t.video ? {
50
52
  ...t.video,
51
- posterProxied: proxyXImageUrl(t.video.poster, resolvedImageProxyEndpoint.value)
53
+ posterProxied: t.video.poster
52
54
  } : null,
53
55
  // Links
54
56
  tweetUrl: `https://x.com/${t.user.screen_name}/status/${t.id_str}`,
@@ -58,8 +60,9 @@ const slotProps = computed(() => {
58
60
  // Reply context
59
61
  isReply: !!t.parent,
60
62
  replyToUser: t.parent?.user.screen_name,
61
- // Helpers
62
- proxyImage: (url) => proxyXImageUrl(url, resolvedImageProxyEndpoint.value)
63
+ // Helpers — proxy an arbitrary URL through the image endpoint at runtime.
64
+ // Uses the page token emitted during SSR so client-generated URLs validate.
65
+ proxyImage: (url) => proxyUrl(resolvedImageProxyEndpoint.value, { url })
63
66
  };
64
67
  });
65
68
  defineExpose({
@@ -18,14 +18,19 @@ type __VLS_Props = {
18
18
  */
19
19
  rootAttrs?: HTMLAttributes;
20
20
  };
21
- declare var __VLS_1: {}, __VLS_3: {
22
- error: import("nuxt/app").NuxtError<unknown> | undefined;
23
- }, __VLS_5: {
21
+ type __VLS_Slots = {
22
+ default?: (props: NonNullable<typeof slotProps.value>) => any;
23
+ loading?: () => any;
24
+ error?: (props: {
25
+ error: typeof error.value;
26
+ }) => any;
27
+ };
28
+ declare const error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined, import("nuxt/app").NuxtError<unknown> | undefined>;
29
+ declare const slotProps: import("vue").ComputedRef<{
24
30
  tweet: XEmbedTweetData;
25
31
  userName: string;
26
32
  userHandle: string;
27
33
  userAvatar: string;
28
- userAvatarOriginal: string;
29
34
  isVerified: boolean | undefined;
30
35
  text: string;
31
36
  datetime: string;
@@ -54,14 +59,7 @@ declare var __VLS_1: {}, __VLS_3: {
54
59
  isReply: boolean;
55
60
  replyToUser: string | undefined;
56
61
  proxyImage: (url: string) => string;
57
- };
58
- type __VLS_Slots = {} & {
59
- loading?: (props: typeof __VLS_1) => any;
60
- } & {
61
- error?: (props: typeof __VLS_3) => any;
62
- } & {
63
- default?: (props: typeof __VLS_5) => any;
64
- };
62
+ } | null>;
65
63
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
66
64
  tweet: import("vue").Ref<XEmbedTweetData | undefined, XEmbedTweetData | undefined>;
67
65
  status: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus, import("nuxt/app").AsyncDataRequestStatus>;
@@ -27,19 +27,14 @@ type __VLS_Props = {
27
27
  */
28
28
  placeholderObjectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
29
29
  };
30
- declare var __VLS_1: {
31
- placeholder: string;
32
- }, __VLS_3: {}, __VLS_10: {}, __VLS_12: {}, __VLS_14: {};
33
- type __VLS_Slots = {} & {
34
- placeholder?: (props: typeof __VLS_1) => any;
35
- } & {
36
- loading?: (props: typeof __VLS_3) => any;
37
- } & {
38
- awaitingLoad?: (props: typeof __VLS_10) => any;
39
- } & {
40
- error?: (props: typeof __VLS_12) => any;
41
- } & {
42
- default?: (props: typeof __VLS_14) => any;
30
+ type __VLS_Slots = {
31
+ default?: () => any;
32
+ placeholder?: (props: {
33
+ placeholder: string;
34
+ }) => any;
35
+ loading?: () => any;
36
+ awaitingLoad?: () => any;
37
+ error?: () => any;
43
38
  };
44
39
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
45
40
  player: Ref<YT.Player | undefined, YT.Player | undefined>;
@@ -22,6 +22,7 @@ const props = defineProps({
22
22
  placeholderObjectFit: { type: String, required: false, default: "cover" }
23
23
  });
24
24
  const emits = defineEmits(["ready", "state-change", "playback-quality-change", "playback-rate-change", "error", "api-change"]);
25
+ defineSlots();
25
26
  const events = [
26
27
  "onReady",
27
28
  "onStateChange",
@@ -27,19 +27,14 @@ type __VLS_Props = {
27
27
  */
28
28
  placeholderObjectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
29
29
  };
30
- declare var __VLS_1: {
31
- placeholder: string;
32
- }, __VLS_3: {}, __VLS_10: {}, __VLS_12: {}, __VLS_14: {};
33
- type __VLS_Slots = {} & {
34
- placeholder?: (props: typeof __VLS_1) => any;
35
- } & {
36
- loading?: (props: typeof __VLS_3) => any;
37
- } & {
38
- awaitingLoad?: (props: typeof __VLS_10) => any;
39
- } & {
40
- error?: (props: typeof __VLS_12) => any;
41
- } & {
42
- default?: (props: typeof __VLS_14) => any;
30
+ type __VLS_Slots = {
31
+ default?: () => any;
32
+ placeholder?: (props: {
33
+ placeholder: string;
34
+ }) => any;
35
+ loading?: () => any;
36
+ awaitingLoad?: () => any;
37
+ error?: () => any;
43
38
  };
44
39
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
45
40
  player: Ref<YT.Player | undefined, YT.Player | undefined>;
@@ -26,11 +26,22 @@ function toNetworkRequest(entry, proxyPrefix) {
26
26
  isProxied
27
27
  };
28
28
  }
29
- function createDomainMatcher(domains, proxyPrefix) {
29
+ function createDomainMatcher(domains, proxyPrefix, scriptSrc) {
30
30
  const localHostname = window.location.hostname;
31
+ const scriptUrl = (() => {
32
+ if (!scriptSrc)
33
+ return "";
34
+ try {
35
+ return new URL(scriptSrc, window.location.origin).href;
36
+ } catch {
37
+ return "";
38
+ }
39
+ })();
31
40
  return function matchesScript(entry) {
32
41
  try {
33
42
  const entryUrl = new URL(entry.name, window.location.origin);
43
+ if (scriptUrl && entryUrl.href === scriptUrl)
44
+ return true;
34
45
  if (entryUrl.hostname !== localHostname && domains.has(entryUrl.hostname))
35
46
  return true;
36
47
  const proxyPath = `${proxyPrefix}/`;
@@ -46,12 +57,12 @@ function createDomainMatcher(domains, proxyPrefix) {
46
57
  return false;
47
58
  };
48
59
  }
49
- function observeNetworkRequests(payload, domains, onUpdate) {
60
+ function observeNetworkRequests(payload, domains, onUpdate, scriptSrc) {
50
61
  if (typeof PerformanceObserver === "undefined")
51
62
  return () => {
52
63
  };
53
64
  const proxyPrefix = resolveProxyPrefix();
54
- const matchesScript = createDomainMatcher(domains, proxyPrefix);
65
+ const matchesScript = createDomainMatcher(domains, proxyPrefix, scriptSrc);
55
66
  const seen = /* @__PURE__ */ new Set();
56
67
  function entryKey(entry) {
57
68
  return `${entry.name}@${entry.startTime}`;
@@ -148,7 +159,7 @@ export function useScript(input, options) {
148
159
  ],
149
160
  networkRequests: []
150
161
  };
151
- disconnectObserver = observeNetworkRequests(payload, domains, syncScripts);
162
+ disconnectObserver = observeNetworkRequests(payload, domains, syncScripts, src);
152
163
  syncScripts();
153
164
  }
154
165
  return stub;
@@ -274,7 +285,7 @@ export function useScript(input, options) {
274
285
  ...scriptHostname ? [scriptHostname] : [],
275
286
  ...options.devtools?.domains || []
276
287
  ]);
277
- let disconnectObserver = observeNetworkRequests(payload, domains, syncScripts);
288
+ let disconnectObserver = observeNetworkRequests(payload, domains, syncScripts, input.src);
278
289
  const _origRemove = instance.remove;
279
290
  const _origReload = instance.reload;
280
291
  instance.remove = () => {
@@ -284,7 +295,7 @@ export function useScript(input, options) {
284
295
  instance.reload = async () => {
285
296
  disconnectObserver();
286
297
  const result = await _origReload();
287
- disconnectObserver = observeNetworkRequests(payload, domains, syncScripts);
298
+ disconnectObserver = observeNetworkRequests(payload, domains, syncScripts, input.src);
288
299
  return result;
289
300
  };
290
301
  syncScripts();
@@ -0,0 +1,12 @@
1
+ export interface ScriptProxyToken {
2
+ token: string;
3
+ ts: number;
4
+ }
5
+ /**
6
+ * Shared `useState` holding the proxy page token emitted during SSR.
7
+ *
8
+ * Populated by the `nuxt-scripts:proxy-token` server plugin when
9
+ * `runtimeConfig['nuxt-scripts'].proxySecret` is set, and hydrated to the
10
+ * client via the Nuxt payload. Stays null when signing is disabled.
11
+ */
12
+ export declare function useScriptProxyToken(): import("vue").Ref<ScriptProxyToken | null, ScriptProxyToken | null>;
@@ -0,0 +1,4 @@
1
+ import { useState } from "nuxt/app";
2
+ export function useScriptProxyToken() {
3
+ return useState("nuxt-scripts:proxy-token", () => null);
4
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Build proxy URLs that the server's `withSigning` middleware accepts.
3
+ *
4
+ * Attaches the page token emitted during SSR (`_pt` + `_ts`) when one is
5
+ * available, so client-driven proxy calls (e.g. reactive fetches, dynamic
6
+ * image helpers exposed in slot props) authenticate without needing a
7
+ * server round-trip to sign each URL.
8
+ *
9
+ * When no token is present (signing disabled or no secret), emits plain
10
+ * `?url=...` URLs, matching the pre-signing behavior.
11
+ */
12
+ export declare function useScriptProxyUrl(): (path: string, query?: Record<string, unknown>) => string;
@@ -0,0 +1,27 @@
1
+ import { PAGE_TOKEN_PARAM, PAGE_TOKEN_TS_PARAM } from "../server/utils/sign-constants.js";
2
+ import { useScriptProxyToken } from "./useScriptProxyToken.js";
3
+ export function useScriptProxyUrl() {
4
+ const token = useScriptProxyToken();
5
+ return (path, query = {}) => {
6
+ const parts = [];
7
+ for (const [key, value] of Object.entries(query)) {
8
+ if (value === void 0 || value === null)
9
+ continue;
10
+ const encodedKey = encodeURIComponent(key);
11
+ if (Array.isArray(value)) {
12
+ for (const item of value) {
13
+ if (item === void 0 || item === null)
14
+ continue;
15
+ parts.push(`${encodedKey}=${encodeURIComponent(String(item))}`);
16
+ }
17
+ } else {
18
+ parts.push(`${encodedKey}=${encodeURIComponent(String(value))}`);
19
+ }
20
+ }
21
+ if (token.value) {
22
+ parts.push(`${PAGE_TOKEN_PARAM}=${encodeURIComponent(token.value.token)}`);
23
+ parts.push(`${PAGE_TOKEN_TS_PARAM}=${token.value.ts}`);
24
+ }
25
+ return parts.length ? `${path}?${parts.join("&")}` : path;
26
+ };
27
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Emit a per-request proxy page token into the SSR payload.
3
+ *
4
+ * The token authorizes client-side proxy calls (`/embed/x-image?url=...`,
5
+ * `/embed/bluesky?url=...`, etc.) without needing each URL to be signed
6
+ * ahead of time. It stays null when no proxy secret is configured, in
7
+ * which case `withSigning` passes requests through unchecked.
8
+ */
9
+ declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
10
+ export default _default;
@@ -0,0 +1,17 @@
1
+ import { defineNuxtPlugin, useRuntimeConfig } from "nuxt/app";
2
+ import { useScriptProxyToken } from "../composables/useScriptProxyToken.js";
3
+ import { generateProxyToken } from "../server/utils/sign.js";
4
+ export default defineNuxtPlugin({
5
+ name: "nuxt-scripts:proxy-token",
6
+ enforce: "pre",
7
+ setup() {
8
+ const secret = useRuntimeConfig()["nuxt-scripts"]?.proxySecret;
9
+ if (!secret)
10
+ return;
11
+ const ts = Math.floor(Date.now() / 1e3);
12
+ useScriptProxyToken().value = {
13
+ token: generateProxyToken(secret, ts),
14
+ ts
15
+ };
16
+ }
17
+ });