@nuxt/scripts 1.3.6 → 2.0.0-beta.1

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 (207) hide show
  1. package/THIRD_PARTY_LICENSES.md +124 -0
  2. package/dist/devtools-client/200.html +1 -1
  3. package/dist/devtools-client/404.html +1 -1
  4. package/dist/devtools-client/_nuxt/{B551Pnuh.js → 2p1_IuX2.js} +1 -1
  5. package/dist/devtools-client/_nuxt/{KxC4Q3ev.js → 9elIQxwW.js} +1 -1
  6. package/dist/devtools-client/_nuxt/{DTP8MRtW.js → BNPn63Jz.js} +1 -1
  7. package/dist/devtools-client/_nuxt/BjRLaDIG.js +152 -0
  8. package/dist/devtools-client/_nuxt/BtNUYBXT.js +8 -0
  9. package/dist/devtools-client/_nuxt/CDDBpkXG.js +3 -0
  10. package/dist/devtools-client/_nuxt/Cpb0XAYP.js +1 -0
  11. package/dist/devtools-client/_nuxt/DAsiyhPm.js +6 -0
  12. package/dist/devtools-client/_nuxt/{VICyrUSM.js → DabLKy7M.js} +1 -1
  13. package/dist/devtools-client/_nuxt/Dat651Oh.js +1 -0
  14. package/dist/devtools-client/_nuxt/DcG2ZXvY.js +1 -0
  15. package/dist/devtools-client/_nuxt/DmlGWZ2X.js +1 -0
  16. package/dist/devtools-client/_nuxt/KsX6Az5B.js +1 -0
  17. package/dist/devtools-client/_nuxt/RL1np866.js +28 -0
  18. package/dist/devtools-client/_nuxt/UmWNrBO5.js +2 -0
  19. package/dist/devtools-client/_nuxt/builds/latest.json +1 -1
  20. package/dist/devtools-client/_nuxt/builds/meta/e28b96f1-78e8-41a4-ad6f-904cd078f85e.json +1 -0
  21. package/dist/devtools-client/_nuxt/{entry.CYUdJFoE.css → entry.9HJPJ6Hp.css} +1 -1
  22. package/dist/devtools-client/_nuxt/error-404.DnwL1N6v.css +1 -0
  23. package/dist/devtools-client/_nuxt/error-500.DEbXRLdm.css +1 -0
  24. package/dist/devtools-client/docs/index.html +1 -1
  25. package/dist/devtools-client/first-party/index.html +1 -1
  26. package/dist/devtools-client/index.html +1 -1
  27. package/dist/devtools-client/registry/index.html +1 -1
  28. package/dist/module.d.mts +2 -86
  29. package/dist/module.d.ts +2 -86
  30. package/dist/module.json +3 -3
  31. package/dist/module.mjs +71 -328
  32. package/dist/registry.mjs +54 -22
  33. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.d.vue.ts +1 -28
  34. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue +7 -50
  35. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue.d.ts +1 -28
  36. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.d.vue.ts +0 -8
  37. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.vue +1 -13
  38. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.vue.d.ts +0 -8
  39. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsStaticMap.d.vue.ts +4 -4
  40. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsStaticMap.vue +9 -15
  41. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsStaticMap.vue.d.ts +4 -4
  42. package/dist/runtime/components/GoogleMaps/useGoogleMapsResource.d.ts +0 -22
  43. package/dist/runtime/components/GoogleMaps/useGoogleMapsResource.js +0 -31
  44. package/dist/runtime/components/Leaflet/ScriptLeafletGeoJson.d.vue.ts +31 -0
  45. package/dist/runtime/components/Leaflet/ScriptLeafletGeoJson.vue +43 -0
  46. package/dist/runtime/components/Leaflet/ScriptLeafletGeoJson.vue.d.ts +31 -0
  47. package/dist/runtime/components/Leaflet/ScriptLeafletMap.d.vue.ts +90 -0
  48. package/dist/runtime/components/Leaflet/ScriptLeafletMap.vue +171 -0
  49. package/dist/runtime/components/Leaflet/ScriptLeafletMap.vue.d.ts +90 -0
  50. package/dist/runtime/components/Leaflet/ScriptLeafletMarker.d.vue.ts +47 -0
  51. package/dist/runtime/components/Leaflet/ScriptLeafletMarker.vue +70 -0
  52. package/dist/runtime/components/Leaflet/ScriptLeafletMarker.vue.d.ts +47 -0
  53. package/dist/runtime/components/Leaflet/ScriptLeafletPopup.d.vue.ts +31 -0
  54. package/dist/runtime/components/Leaflet/ScriptLeafletPopup.vue +81 -0
  55. package/dist/runtime/components/Leaflet/ScriptLeafletPopup.vue.d.ts +31 -0
  56. package/dist/runtime/components/Leaflet/ScriptLeafletTileLayer.d.vue.ts +26 -0
  57. package/dist/runtime/components/Leaflet/ScriptLeafletTileLayer.vue +38 -0
  58. package/dist/runtime/components/Leaflet/ScriptLeafletTileLayer.vue.d.ts +26 -0
  59. package/dist/runtime/components/Leaflet/useLeafletResource.d.ts +30 -0
  60. package/dist/runtime/components/Leaflet/useLeafletResource.js +46 -0
  61. package/dist/runtime/components/MapLibre/ScriptMapLibreGeoJson.d.vue.ts +39 -0
  62. package/dist/runtime/components/MapLibre/ScriptMapLibreGeoJson.vue +84 -0
  63. package/dist/runtime/components/MapLibre/ScriptMapLibreGeoJson.vue.d.ts +39 -0
  64. package/dist/runtime/components/MapLibre/ScriptMapLibreMap.d.vue.ts +122 -0
  65. package/dist/runtime/components/MapLibre/ScriptMapLibreMap.vue +214 -0
  66. package/dist/runtime/components/MapLibre/ScriptMapLibreMap.vue.d.ts +122 -0
  67. package/dist/runtime/components/MapLibre/ScriptMapLibreMarker.d.vue.ts +35 -0
  68. package/dist/runtime/components/MapLibre/ScriptMapLibreMarker.vue +98 -0
  69. package/dist/runtime/components/MapLibre/ScriptMapLibreMarker.vue.d.ts +35 -0
  70. package/dist/runtime/components/MapLibre/ScriptMapLibreNavigationControl.d.vue.ts +12 -0
  71. package/dist/runtime/components/MapLibre/ScriptMapLibreNavigationControl.vue +23 -0
  72. package/dist/runtime/components/MapLibre/ScriptMapLibreNavigationControl.vue.d.ts +12 -0
  73. package/dist/runtime/components/MapLibre/ScriptMapLibrePopup.d.vue.ts +31 -0
  74. package/dist/runtime/components/MapLibre/ScriptMapLibrePopup.vue +99 -0
  75. package/dist/runtime/components/MapLibre/ScriptMapLibrePopup.vue.d.ts +31 -0
  76. package/dist/runtime/components/MapLibre/useMapLibreResource.d.ts +23 -0
  77. package/dist/runtime/components/MapLibre/useMapLibreResource.js +41 -0
  78. package/dist/runtime/components/ScriptCrisp.vue +20 -18
  79. package/dist/runtime/components/ScriptDeskCrew.d.vue.ts +40 -0
  80. package/dist/runtime/components/ScriptDeskCrew.vue +82 -0
  81. package/dist/runtime/components/ScriptDeskCrew.vue.d.ts +40 -0
  82. package/dist/runtime/components/ScriptIntercom.vue +21 -19
  83. package/dist/runtime/components/ScriptLoadingIndicator.d.vue.ts +1 -1
  84. package/dist/runtime/components/ScriptLoadingIndicator.vue.d.ts +1 -1
  85. package/dist/runtime/components/ScriptPayPalButtons.vue +7 -3
  86. package/dist/runtime/components/ScriptPayPalMessages.vue +8 -4
  87. package/dist/runtime/composables/useScript.js +96 -49
  88. package/dist/runtime/composables/useScriptProxyUrl.d.ts +4 -8
  89. package/dist/runtime/composables/useScriptProxyUrl.js +0 -7
  90. package/dist/runtime/composables/useScriptTriggerIdleTimeout.d.ts +2 -1
  91. package/dist/runtime/composables/useScriptTriggerIdleTimeout.js +3 -34
  92. package/dist/runtime/composables/useScriptTriggerInteraction.d.ts +2 -1
  93. package/dist/runtime/composables/useScriptTriggerInteraction.js +13 -46
  94. package/dist/runtime/composables/useScriptTriggerServiceWorker.d.ts +2 -1
  95. package/dist/runtime/composables/useScriptTriggerServiceWorker.js +5 -38
  96. package/dist/runtime/leaflet-styles.d.ts +13 -0
  97. package/dist/runtime/leaflet-styles.js +684 -0
  98. package/dist/runtime/maplibre-styles.d.ts +7 -0
  99. package/dist/runtime/maplibre-styles.js +25 -0
  100. package/dist/runtime/npm-script-api-state.d.ts +4 -0
  101. package/dist/runtime/npm-script-api-state.js +13 -0
  102. package/dist/runtime/registry/crisp.d.ts +1 -1
  103. package/dist/runtime/registry/crisp.js +30 -18
  104. package/dist/runtime/registry/deskcrew.d.ts +52 -0
  105. package/dist/runtime/registry/deskcrew.js +31 -0
  106. package/dist/runtime/registry/google-analytics.d.ts +0 -2
  107. package/dist/runtime/registry/google-maps.d.ts +2 -11
  108. package/dist/runtime/registry/google-maps.js +31 -10
  109. package/dist/runtime/registry/google-tag-manager.d.ts +0 -2
  110. package/dist/runtime/registry/leaflet.d.ts +13 -0
  111. package/dist/runtime/registry/leaflet.js +29 -0
  112. package/dist/runtime/registry/maplibre.d.ts +13 -0
  113. package/dist/runtime/registry/maplibre.js +29 -0
  114. package/dist/runtime/registry/matomo-analytics.js +1 -8
  115. package/dist/runtime/registry/plausible-analytics.d.ts +4 -16
  116. package/dist/runtime/registry/plausible-analytics.js +15 -58
  117. package/dist/runtime/registry/rybbit-analytics.d.ts +0 -4
  118. package/dist/runtime/registry/rybbit-analytics.js +1 -4
  119. package/dist/runtime/registry/schemas.d.ts +61 -5
  120. package/dist/runtime/registry/schemas.js +64 -5
  121. package/dist/runtime/registry/tiktok-pixel.d.ts +2 -12
  122. package/dist/runtime/registry/tiktok-pixel.js +1 -1
  123. package/dist/runtime/registry/usercentrics.js +46 -6
  124. package/dist/runtime/registry/youtube-player.d.ts +3 -4
  125. package/dist/runtime/registry/youtube-player.js +30 -23
  126. package/dist/runtime/server/bluesky-embed-image.d.ts +1 -1
  127. package/dist/runtime/server/bluesky-embed.d.ts +1 -1
  128. package/dist/runtime/server/bluesky-embed.js +3 -6
  129. package/dist/runtime/server/gravatar-proxy.d.ts +1 -1
  130. package/dist/runtime/server/gravatar-proxy.js +2 -3
  131. package/dist/runtime/server/instagram-embed-asset.d.ts +1 -1
  132. package/dist/runtime/server/instagram-embed-image.d.ts +1 -1
  133. package/dist/runtime/server/instagram-embed.d.ts +1 -1
  134. package/dist/runtime/server/instagram-embed.js +4 -7
  135. package/dist/runtime/server/utils/cached-upstream.d.ts +4 -11
  136. package/dist/runtime/server/utils/embed-rewriters.d.ts +3 -5
  137. package/dist/runtime/server/utils/embed-rewriters.js +8 -8
  138. package/dist/runtime/server/utils/image-proxy.d.ts +1 -1
  139. package/dist/runtime/server/utils/image-proxy.js +2 -3
  140. package/dist/runtime/server/utils/instagram-embed.d.ts +6 -6
  141. package/dist/runtime/server/utils/instagram-embed.js +18 -19
  142. package/dist/runtime/server/utils/proxy-url.d.ts +5 -6
  143. package/dist/runtime/server/utils/proxy-url.js +1 -4
  144. package/dist/runtime/server/x-embed-image.d.ts +1 -1
  145. package/dist/runtime/server/x-embed.d.ts +48 -1
  146. package/dist/runtime/server/x-embed.js +3 -6
  147. package/dist/runtime/types.d.ts +13 -13
  148. package/dist/runtime/utils/abortable-promise.js +26 -5
  149. package/dist/runtime/utils/nuxt-ready-script-trigger.d.ts +3 -0
  150. package/dist/runtime/utils/nuxt-ready-script-trigger.js +16 -0
  151. package/dist/runtime/utils.js +21 -32
  152. package/dist/stats.mjs +13 -0
  153. package/dist/types-source.mjs +1173 -100
  154. package/dist/types.d.mts +2 -2
  155. package/package.json +34 -21
  156. package/LICENSE.md +0 -9
  157. package/bin/cli.mjs +0 -2
  158. package/dist/cli.d.mts +0 -2
  159. package/dist/cli.d.ts +0 -2
  160. package/dist/cli.mjs +0 -50
  161. package/dist/devtools-client/_nuxt/8ltZ0o6d.js +0 -1
  162. package/dist/devtools-client/_nuxt/B8_EBdhg.js +0 -152
  163. package/dist/devtools-client/_nuxt/BKdLzFmX.js +0 -3
  164. package/dist/devtools-client/_nuxt/Bf2Kt1P0.js +0 -28
  165. package/dist/devtools-client/_nuxt/CC0GKROJ.js +0 -1
  166. package/dist/devtools-client/_nuxt/CH5oUfNi.js +0 -1
  167. package/dist/devtools-client/_nuxt/CMXzQxJZ.js +0 -1
  168. package/dist/devtools-client/_nuxt/CP7c-Js6.js +0 -8
  169. package/dist/devtools-client/_nuxt/C_v3_O0R.js +0 -6
  170. package/dist/devtools-client/_nuxt/CxN78VhB.js +0 -1
  171. package/dist/devtools-client/_nuxt/Dkc7iTdR.js +0 -1
  172. package/dist/devtools-client/_nuxt/builds/meta/35e54cbc-079c-4313-8838-34632d9dac97.json +0 -1
  173. package/dist/devtools-client/_nuxt/error-404.Bq2JQbJs.css +0 -1
  174. package/dist/devtools-client/_nuxt/error-500.5E_FOzlc.css +0 -1
  175. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.d.vue.ts +0 -13
  176. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue +0 -15
  177. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue.d.ts +0 -13
  178. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.d.vue.ts +0 -27
  179. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.vue +0 -34
  180. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.vue.d.ts +0 -27
  181. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.d.vue.ts +0 -13
  182. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.vue +0 -11
  183. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.vue.d.ts +0 -13
  184. package/dist/runtime/components/GoogleMaps/bindGoogleMapsEvents.d.ts +0 -13
  185. package/dist/runtime/components/GoogleMaps/bindGoogleMapsEvents.js +0 -8
  186. package/dist/runtime/components/GoogleMaps/injectionKeys.d.ts +0 -10
  187. package/dist/runtime/components/GoogleMaps/injectionKeys.js +0 -2
  188. package/dist/runtime/composables/useScriptProxyToken.d.ts +0 -12
  189. package/dist/runtime/composables/useScriptProxyToken.js +0 -4
  190. package/dist/runtime/npm-script-stub.d.ts +0 -20
  191. package/dist/runtime/npm-script-stub.js +0 -72
  192. package/dist/runtime/plugins/proxy-token.server.d.ts +0 -10
  193. package/dist/runtime/plugins/proxy-token.server.js +0 -17
  194. package/dist/runtime/server/google-maps-geocode-proxy.d.ts +0 -2
  195. package/dist/runtime/server/google-maps-geocode-proxy.js +0 -43
  196. package/dist/runtime/server/google-static-maps-proxy.d.ts +0 -2
  197. package/dist/runtime/server/google-static-maps-proxy.js +0 -56
  198. package/dist/runtime/server/utils/proxy-query.d.ts +0 -2
  199. package/dist/runtime/server/utils/proxy-query.js +0 -10
  200. package/dist/runtime/server/utils/sign-constants.d.ts +0 -16
  201. package/dist/runtime/server/utils/sign-constants.js +0 -5
  202. package/dist/runtime/server/utils/sign.d.ts +0 -101
  203. package/dist/runtime/server/utils/sign.js +0 -91
  204. package/dist/runtime/server/utils/withSigning.d.ts +0 -23
  205. package/dist/runtime/server/utils/withSigning.js +0 -19
  206. package/dist/runtime/unhead-features.d.ts +0 -1
  207. package/dist/runtime/unhead-features.js +0 -3
@@ -88,11 +88,11 @@ function sanitizeCssUrls(css, proxyPrefix) {
88
88
  return value.startsWith(allowedPrefix) ? match : 'url("")';
89
89
  });
90
90
  }
91
- function rewriteMediaUrl(url, prefix, secret) {
92
- const rewritten = rewriteUrl(url, prefix, secret);
91
+ function rewriteMediaUrl(url, prefix) {
92
+ const rewritten = rewriteUrl(url, prefix);
93
93
  return rewritten === url ? void 0 : rewritten;
94
94
  }
95
- export function sanitizeInstagramEmbedHtml(html, prefix, secret) {
95
+ export function sanitizeInstagramEmbedHtml(html, prefix) {
96
96
  const ast = parse(html);
97
97
  const cssUrls = /* @__PURE__ */ new Set();
98
98
  walkSync(ast, (node) => {
@@ -122,7 +122,7 @@ export function sanitizeInstagramEmbedHtml(html, prefix, secret) {
122
122
  continue;
123
123
  }
124
124
  if (lowerName === "src" || lowerName === "poster") {
125
- const rewritten = rewriteMediaUrl(value, prefix, secret);
125
+ const rewritten = rewriteMediaUrl(value, prefix);
126
126
  if (rewritten)
127
127
  node.attributes[name] = rewritten;
128
128
  else
@@ -132,7 +132,7 @@ export function sanitizeInstagramEmbedHtml(html, prefix, secret) {
132
132
  if (lowerName === "srcset") {
133
133
  const entries = value.split(",").flatMap((entry) => {
134
134
  const [url, descriptor, ...rest] = entry.trim().split(SRCSET_SPLIT_RE);
135
- const rewritten = url ? rewriteMediaUrl(url, prefix, secret) : void 0;
135
+ const rewritten = url ? rewriteMediaUrl(url, prefix) : void 0;
136
136
  const safeDescriptor = !descriptor || /^\d+(?:\.\d+)?[wx]$/.test(descriptor);
137
137
  return rewritten && safeDescriptor && rest.length === 0 ? [`${rewritten}${descriptor ? ` ${descriptor}` : ""}`] : [];
138
138
  });
@@ -143,7 +143,7 @@ export function sanitizeInstagramEmbedHtml(html, prefix, secret) {
143
143
  continue;
144
144
  }
145
145
  if (lowerName === "style") {
146
- const rewritten = rewriteUrlsInText(value, prefix, secret);
146
+ const rewritten = rewriteUrlsInText(value, prefix);
147
147
  if (DANGEROUS_STYLE_RE.test(rewritten))
148
148
  delete node.attributes[name];
149
149
  else
@@ -163,33 +163,32 @@ export function sanitizeInstagramEmbedHtml(html, prefix, secret) {
163
163
  cssUrls: [...cssUrls]
164
164
  };
165
165
  }
166
- export function sanitizeInstagramEmbedCss(css, scopeSelector, prefix, secret) {
166
+ export function sanitizeInstagramEmbedCss(css, scopeSelector, prefix) {
167
167
  const rewritten = rewriteUrlsInText(
168
- css.replace(RSRC_RE, (_match, path) => `url(${proxyAssetUrl(`https://${INSTAGRAM_ASSET_HOST}/rsrc.php${path}`, prefix, secret)})`),
169
- prefix,
170
- secret
168
+ css.replace(RSRC_RE, (_match, path) => `url(${proxyAssetUrl(`https://${INSTAGRAM_ASSET_HOST}/rsrc.php${path}`, prefix)})`),
169
+ prefix
171
170
  );
172
171
  return sanitizeCssUrls(scopeCss(rewritten, scopeSelector), prefix).replace(/<\/style/gi, "<\\/style");
173
172
  }
174
- export function proxyImageUrl(url, prefix = "/_scripts", secret) {
175
- return buildProxyUrl(`${prefix}/embed/instagram-image`, { url: url.replace(AMP_RE, "&") }, secret);
173
+ export function proxyImageUrl(url, prefix = "/_scripts") {
174
+ return buildProxyUrl(`${prefix}/embed/instagram-image`, { url: url.replace(AMP_RE, "&") });
176
175
  }
177
- export function proxyAssetUrl(url, prefix = "/_scripts", secret) {
178
- return buildProxyUrl(`${prefix}/embed/instagram-asset`, { url: url.replace(AMP_RE, "&") }, secret);
176
+ export function proxyAssetUrl(url, prefix = "/_scripts") {
177
+ return buildProxyUrl(`${prefix}/embed/instagram-asset`, { url: url.replace(AMP_RE, "&") });
179
178
  }
180
- export function rewriteUrl(url, prefix = "/_scripts", secret) {
179
+ export function rewriteUrl(url, prefix = "/_scripts") {
181
180
  try {
182
181
  const parsed = new URL(url);
183
182
  if (parsed.hostname === INSTAGRAM_ASSET_HOST)
184
- return proxyAssetUrl(url, prefix, secret);
183
+ return proxyAssetUrl(url, prefix);
185
184
  if (INSTAGRAM_IMAGE_HOSTS.some((h) => parsed.hostname === h || parsed.hostname.endsWith(`.cdninstagram.com`)))
186
- return proxyImageUrl(url, prefix, secret);
185
+ return proxyImageUrl(url, prefix);
187
186
  } catch {
188
187
  }
189
188
  return url;
190
189
  }
191
- export function rewriteUrlsInText(text, prefix = "/_scripts", secret) {
192
- return text.replace(SCONTENT_RE, (m) => proxyImageUrl(m, prefix, secret)).replace(STATIC_CDN_RE, (m) => proxyAssetUrl(m, prefix, secret)).replace(LOOKASIDE_RE, (m) => proxyImageUrl(m, prefix, secret));
190
+ export function rewriteUrlsInText(text, prefix = "/_scripts") {
191
+ return text.replace(SCONTENT_RE, (m) => proxyImageUrl(m, prefix)).replace(STATIC_CDN_RE, (m) => proxyAssetUrl(m, prefix)).replace(LOOKASIDE_RE, (m) => proxyImageUrl(m, prefix));
193
192
  }
194
193
  export function scopeCss(css, scopeSelector) {
195
194
  let result = css.replace(CHARSET_RE, "");
@@ -1,9 +1,8 @@
1
1
  /**
2
- * Build a proxy URL with query params, signing it when a secret is available.
2
+ * Build a proxy URL with query params.
3
3
  *
4
- * Used by embed handlers that inject proxy URLs into HTML/JSON responses.
5
- * When `secret` is set, URLs are HMAC-signed so clients can fetch them without
6
- * needing a page token. When it's undefined, URLs fall back to unsigned form
7
- * (which is only safe when the `withSigning` middleware has no secret either).
4
+ * Used by embed handlers that inject proxy URLs into HTML/JSON responses so
5
+ * the client loads upstream assets through the site origin. The proxy
6
+ * endpoints are restricted to an allowlist of upstream domains.
8
7
  */
9
- export declare function buildProxyUrl(path: string, query: Record<string, unknown>, secret?: string): string;
8
+ export declare function buildProxyUrl(path: string, query: Record<string, unknown>): string;
@@ -1,7 +1,4 @@
1
- import { buildSignedProxyUrl } from "./sign.js";
2
- export function buildProxyUrl(path, query, secret) {
3
- if (secret)
4
- return buildSignedProxyUrl(path, query, secret);
1
+ export function buildProxyUrl(path, query) {
5
2
  const parts = [];
6
3
  for (const [key, value] of Object.entries(query)) {
7
4
  if (value === void 0 || value === null)
@@ -1,2 +1,2 @@
1
- declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, any>;
1
+ declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<Buffer<ArrayBufferLike>>>;
2
2
  export default _default;
@@ -1,2 +1,49 @@
1
- declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, any>;
1
+ interface TweetData {
2
+ id_str: string;
3
+ text: string;
4
+ created_at: string;
5
+ favorite_count: number;
6
+ conversation_count: number;
7
+ user: {
8
+ name: string;
9
+ screen_name: string;
10
+ profile_image_url_https: string;
11
+ verified?: boolean;
12
+ is_blue_verified?: boolean;
13
+ };
14
+ entities?: {
15
+ media?: Array<{
16
+ media_url_https: string;
17
+ type: string;
18
+ sizes: Record<string, {
19
+ w: number;
20
+ h: number;
21
+ }>;
22
+ }>;
23
+ urls?: Array<{
24
+ url: string;
25
+ expanded_url: string;
26
+ display_url: string;
27
+ }>;
28
+ };
29
+ photos?: Array<{
30
+ url: string;
31
+ width: number;
32
+ height: number;
33
+ }>;
34
+ video?: {
35
+ poster: string;
36
+ variants: Array<{
37
+ type: string;
38
+ src: string;
39
+ }>;
40
+ };
41
+ quoted_tweet?: TweetData;
42
+ parent?: {
43
+ user: {
44
+ screen_name: string;
45
+ };
46
+ };
47
+ }
48
+ declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<TweetData>>;
2
49
  export default _default;
@@ -1,8 +1,6 @@
1
1
  import { createError, defineEventHandler, getQuery, setHeader } from "#nuxt-scripts/h3";
2
- import { useRuntimeConfig } from "#nuxt-scripts/nitro";
3
2
  import { createCachedJsonFetch, isSafeHttpsUrl } from "./utils/cached-upstream.js";
4
3
  import { rewriteTweetImages } from "./utils/embed-rewriters.js";
5
- import { withSigning } from "./utils/withSigning.js";
6
4
  const TWEET_ID_RE = /^\d+$/;
7
5
  const EMBED_X_SUFFIX_RE = /\/embed\/x$/;
8
6
  const TWEET_ID_FROM_URL_RE = /[?&]id=(\d+)/;
@@ -18,7 +16,7 @@ const cachedTweetFetch = createCachedJsonFetch(
18
16
  contentTypePrefixes: ["application/json"]
19
17
  }
20
18
  );
21
- export default withSigning(defineEventHandler(async (event) => {
19
+ export default defineEventHandler(async (event) => {
22
20
  const query = getQuery(event);
23
21
  const tweetId = query.id;
24
22
  if (!tweetId || !TWEET_ID_RE.test(tweetId)) {
@@ -47,9 +45,8 @@ export default withSigning(defineEventHandler(async (event) => {
47
45
  const handlerPath = event.path?.split("?")[0] || "";
48
46
  const prefix = handlerPath.replace(EMBED_X_SUFFIX_RE, "") || "/_scripts";
49
47
  const imagePath = `${prefix}/embed/x-image`;
50
- const secret = useRuntimeConfig()["nuxt-scripts"]?.proxySecret;
51
- rewriteTweetImages(tweetData, imagePath, secret);
48
+ rewriteTweetImages(tweetData, imagePath);
52
49
  setHeader(event, "Content-Type", "application/json");
53
50
  setHeader(event, "Cache-Control", "public, max-age=600, s-maxage=600");
54
51
  return tweetData;
55
- }));
52
+ });
@@ -1,4 +1,4 @@
1
- import type { UseScriptInput, UseScriptOptions, VueScriptInstance } from '@unhead/vue/scripts';
1
+ import type { UseScriptInput, UseScriptOptions, VueScriptInstance, VueScriptScope } from '@unhead/vue/scripts';
2
2
  import type { Script } from '@unhead/vue/types';
3
3
  import type { Import } from 'unimport';
4
4
  import type { InferInput, ObjectEntries, ObjectSchema, UnionSchema, ValiError } from 'valibot';
@@ -11,6 +11,7 @@ import type { ClarityInput } from './registry/clarity.js';
11
11
  import type { CloudflareWebAnalyticsInput } from './registry/cloudflare-web-analytics.js';
12
12
  import type { CrispInput } from './registry/crisp.js';
13
13
  import type { DatabuddyAnalyticsInput } from './registry/databuddy-analytics.js';
14
+ import type { DeskCrewInput } from './registry/deskcrew.js';
14
15
  import type { FathomAnalyticsInput } from './registry/fathom-analytics.js';
15
16
  import type { GoogleAdsenseInput } from './registry/google-adsense.js';
16
17
  import type { GoogleAnalyticsInput } from './registry/google-analytics.js';
@@ -22,8 +23,10 @@ import type { GravatarInput } from './registry/gravatar.js';
22
23
  import type { HotjarInput } from './registry/hotjar.js';
23
24
  import type { InstagramEmbedInput } from './registry/instagram-embed.js';
24
25
  import type { IntercomInput } from './registry/intercom.js';
26
+ import type { LeafletInput } from './registry/leaflet.js';
25
27
  import type { LemonSqueezyInput } from './registry/lemon-squeezy.js';
26
28
  import type { LinkedInInsightInput } from './registry/linkedin-insight.js';
29
+ import type { MapLibreInput } from './registry/maplibre.js';
27
30
  import type { MatomoAnalyticsInput } from './registry/matomo-analytics.js';
28
31
  import type { MetaPixelInput } from './registry/meta-pixel.js';
29
32
  import type { MixpanelAnalyticsInput } from './registry/mixpanel-analytics.js';
@@ -81,7 +84,7 @@ export interface GcmConsentApi {
81
84
  /** Push `['consent','update', state]` (or equivalent gtag call) with GCMv2 partial state. */
82
85
  update: (state: ConsentState) => void;
83
86
  }
84
- export type UseScriptContext<T extends Record<symbol | string, any>, C = unknown> = VueScriptInstance<T> & {
87
+ export type UseScriptContext<T extends Record<symbol | string, any>, C = unknown> = VueScriptScope<T> & {
85
88
  /**
86
89
  * Remove and reload the script. Useful for scripts that need to re-execute
87
90
  * after SPA navigation (e.g., DOM-scanning scripts like iubenda).
@@ -240,6 +243,7 @@ export interface ScriptRegistry {
240
243
  carbonAds?: true;
241
244
  calendly?: CalendlyInput;
242
245
  crisp?: CrispInput;
246
+ deskcrew?: DeskCrewInput;
243
247
  clarity?: ClarityInput;
244
248
  cloudflareWebAnalytics?: CloudflareWebAnalyticsInput;
245
249
  databuddyAnalytics?: DatabuddyAnalyticsInput;
@@ -250,6 +254,8 @@ export interface ScriptRegistry {
250
254
  googleAdsense?: GoogleAdsenseInput;
251
255
  googleAnalytics?: GoogleAnalyticsInput;
252
256
  googleMaps?: GoogleMapsInput;
257
+ leaflet?: LeafletInput;
258
+ maplibre?: MapLibreInput;
253
259
  googleRecaptcha?: GoogleRecaptchaInput;
254
260
  googleSignIn?: GoogleSignInInput;
255
261
  lemonSqueezy?: LemonSqueezyInput;
@@ -283,14 +289,14 @@ export interface ScriptRegistry {
283
289
  * Built-in registry script keys — not affected by module augmentation.
284
290
  * Use this to type-check records that must enumerate all built-in scripts (logos, meta, etc.).
285
291
  */
286
- export type BuiltInRegistryScriptKey = 'ahrefsAnalytics' | 'bingUet' | 'blueskyEmbed' | 'calendly' | 'carbonAds' | 'crisp' | 'clarity' | 'cloudflareWebAnalytics' | 'databuddyAnalytics' | 'metaPixel' | 'fathomAnalytics' | 'instagramEmbed' | 'plausibleAnalytics' | 'googleAdsense' | 'googleAnalytics' | 'googleMaps' | 'googleRecaptcha' | 'googleSignIn' | 'lemonSqueezy' | 'googleTagManager' | 'hotjar' | 'intercom' | 'linkedinInsight' | 'paypal' | 'posthog' | 'matomoAnalytics' | 'mixpanelAnalytics' | 'rybbitAnalytics' | 'redditPixel' | 'segment' | 'stripe' | 'tiktokPixel' | 'xEmbed' | 'xPixel' | 'snapchatPixel' | 'speedcurve' | 'youtubePlayer' | 'vercelAnalytics' | 'vimeoPlayer' | 'umamiAnalytics' | 'usercentrics' | 'gravatar' | 'npm';
292
+ export type BuiltInRegistryScriptKey = 'ahrefsAnalytics' | 'bingUet' | 'blueskyEmbed' | 'calendly' | 'carbonAds' | 'crisp' | 'clarity' | 'cloudflareWebAnalytics' | 'databuddyAnalytics' | 'deskcrew' | 'metaPixel' | 'fathomAnalytics' | 'instagramEmbed' | 'plausibleAnalytics' | 'googleAdsense' | 'googleAnalytics' | 'googleMaps' | 'leaflet' | 'maplibre' | 'googleRecaptcha' | 'googleSignIn' | 'lemonSqueezy' | 'googleTagManager' | 'hotjar' | 'intercom' | 'linkedinInsight' | 'paypal' | 'posthog' | 'matomoAnalytics' | 'mixpanelAnalytics' | 'rybbitAnalytics' | 'redditPixel' | 'segment' | 'stripe' | 'tiktokPixel' | 'xEmbed' | 'xPixel' | 'snapchatPixel' | 'speedcurve' | 'youtubePlayer' | 'vercelAnalytics' | 'vimeoPlayer' | 'umamiAnalytics' | 'usercentrics' | 'gravatar' | 'npm';
287
293
  /**
288
294
  * Union of all explicit registry script keys (excludes npm pattern).
289
295
  * Includes both built-in and augmented keys.
290
296
  */
291
297
  export type RegistryScriptKey = Exclude<keyof ScriptRegistry, `${string}-npm`>;
292
298
  type RegistryConfigInput<T> = 0 extends 1 & T ? Record<string, any> : [T] extends [true] ? Record<string, never> : T;
293
- export type NuxtConfigScriptRegistryEntry<T> = true | false | 'mock' | (RegistryConfigInput<T> & {
299
+ export type NuxtConfigScriptRegistryEntry<T> = false | 'mock' | (RegistryConfigInput<T> & {
294
300
  trigger?: NuxtUseScriptOptionsSerializable['trigger'] | false;
295
301
  proxy?: boolean;
296
302
  bundle?: boolean;
@@ -304,8 +310,10 @@ export interface NuxtConfigScriptRegistry extends _NuxtConfigScriptRegistryEntri
304
310
  [key: string]: any;
305
311
  }
306
312
  export type UseFunctionType<T, U> = T extends {
313
+ resolve: infer V;
314
+ } ? V extends (...args: any) => any ? NonNullable<Awaited<ReturnType<V>>> : U : T extends {
307
315
  use: infer V;
308
- } ? V extends (...args: any) => any ? ReturnType<V> : U : U;
316
+ } ? V extends (...args: any) => any ? NonNullable<Awaited<ReturnType<V>>> : U : U;
309
317
  export type EmptyOptionsSchema = ObjectSchema<ObjectEntries, undefined>;
310
318
  type ScriptInput = Script;
311
319
  export type InferIfSchema<T> = T extends ObjectSchema<any, any> | UnionSchema<any, any> ? InferInput<T> : T;
@@ -322,14 +330,6 @@ export interface RegistryScriptServerHandler {
322
330
  route: string;
323
331
  handler: string;
324
332
  middleware?: boolean;
325
- /**
326
- * Whether this handler verifies HMAC signatures via `withSigning()`.
327
- *
328
- * When any enabled script registers a handler with `requiresSigning: true`,
329
- * the module enforces that `NUXT_SCRIPTS_PROXY_SECRET` is set in production,
330
- * and the `/_scripts/sign` endpoint will accept this route as a signable path.
331
- */
332
- requiresSigning?: boolean;
333
333
  }
334
334
  /**
335
335
  * Declares what optimization modes a script supports and what's active by default.
@@ -7,9 +7,11 @@ export function createAbortablePromise(setup, options = {}) {
7
7
  const { signal, abortMessage } = options;
8
8
  return new Promise((outerResolve, outerReject) => {
9
9
  let settled = false;
10
+ let setupComplete = false;
10
11
  let cleanup;
11
12
  let onAbort;
12
- const finish = (settle, value) => {
13
+ let pendingSettlement;
14
+ const settleNow = (settle, value) => {
13
15
  if (settled)
14
16
  return;
15
17
  settled = true;
@@ -24,6 +26,15 @@ export function createAbortablePromise(setup, options = {}) {
24
26
  }
25
27
  settle(value);
26
28
  };
29
+ const finish = (settle, value) => {
30
+ if (settled || pendingSettlement)
31
+ return;
32
+ if (!setupComplete) {
33
+ pendingSettlement = { settle, value };
34
+ return;
35
+ }
36
+ settleNow(settle, value);
37
+ };
27
38
  const reject = (reason) => finish(outerReject, reason);
28
39
  const resolve = (value) => {
29
40
  if (typeof value === "object" && value !== null || typeof value === "function") {
@@ -46,18 +57,28 @@ export function createAbortablePromise(setup, options = {}) {
46
57
  };
47
58
  onAbort = () => reject(createAbortError(abortMessage));
48
59
  if (signal?.aborted) {
60
+ setupComplete = true;
49
61
  onAbort();
50
62
  return;
51
63
  }
52
64
  signal?.addEventListener("abort", onAbort, { once: true });
53
65
  try {
54
66
  cleanup = setup(resolve, reject) || void 0;
55
- if (settled) {
56
- cleanup?.();
57
- cleanup = void 0;
67
+ setupComplete = true;
68
+ if (pendingSettlement) {
69
+ const { settle, value } = pendingSettlement;
70
+ pendingSettlement = void 0;
71
+ settleNow(settle, value);
58
72
  }
59
73
  } catch (error) {
60
- reject(error);
74
+ setupComplete = true;
75
+ if (pendingSettlement) {
76
+ const { settle, value } = pendingSettlement;
77
+ pendingSettlement = void 0;
78
+ settleNow(settle, value);
79
+ } else {
80
+ reject(error);
81
+ }
61
82
  }
62
83
  });
63
84
  }
@@ -0,0 +1,3 @@
1
+ import type { UseScriptTrigger } from '@unhead/vue/scripts';
2
+ /** Install an Unhead trigger after Nuxt has completed client startup. */
3
+ export declare function createNuxtReadyScriptTrigger(trigger: UseScriptTrigger): UseScriptTrigger;
@@ -0,0 +1,16 @@
1
+ import { onNuxtReady } from "nuxt/app";
2
+ export function createNuxtReadyScriptTrigger(trigger) {
3
+ return (load) => {
4
+ let disposed = false;
5
+ let cleanup;
6
+ onNuxtReady(() => {
7
+ if (!disposed)
8
+ cleanup = trigger(load);
9
+ });
10
+ return () => {
11
+ disposed = true;
12
+ cleanup?.();
13
+ cleanup = void 0;
14
+ };
15
+ };
16
+ }
@@ -3,10 +3,9 @@ import { createError, useRuntimeConfig } from "nuxt/app";
3
3
  import { parseQuery, parseURL, withQuery } from "ufo";
4
4
  import { parse } from "valibot";
5
5
  import { useScript } from "./composables/useScript.js";
6
+ import { createNpmScriptApiState } from "./npm-script-api-state.js";
6
7
  import { createNpmScriptProxy } from "./npm-script-proxy.js";
7
- import { createNpmScriptStub } from "./npm-script-stub.js";
8
8
  import { attachGcmConsent } from "./registry/_gcm-consent.js";
9
- import { isUnheadSourceLessScriptLoaderEnabled } from "./unhead-features.js";
10
9
  const URL_MATCH_RE = /https?:\/\/[^/]+\/_nuxt\/(.+\.vue)(?:\?[^)]*)?:(\d+):(\d+)/;
11
10
  const URL_PAREN_MATCH_RE = /\(https?:\/\/[^/]+\/_nuxt\/(.+\.vue)(?:\?[^)]*)?:(\d+):(\d+)\)/;
12
11
  const VUE_MATCH_RE = /([^/\s]+\.vue):(\d+):(\d+)/;
@@ -48,38 +47,28 @@ export function useRegistryScript(registryKey, optionsFn, _userOptions) {
48
47
  const userOptions = defu(_userOptions || {}, typeof scriptConfig === "object" ? scriptConfig : {});
49
48
  const options = optionsFn(userOptions, { scriptInput: userOptions.scriptInput });
50
49
  if (options.scriptMode === "npm") {
51
- if (isUnheadSourceLessScriptLoaderEnabled()) {
52
- const scriptOptions2 = { ...userOptions.scriptOptions, ...options.scriptOptions };
53
- const resolveApi = scriptOptions2.use;
54
- const clientUse = resolveClientUse(resolveApi);
55
- delete scriptOptions2.use;
56
- if (typeof scriptOptions2.trigger === "undefined")
57
- scriptOptions2.trigger = "client";
58
- let api;
59
- const instance2 = useScript({
60
- key: String(registryKey),
61
- async loader({ signal }) {
62
- const initialized = await options.clientInit?.({ signal });
63
- if (signal.aborted)
64
- throw signal.reason || new Error(`Loading ${String(registryKey)} was aborted`);
65
- api = await Promise.resolve(api || resolveApi?.() || initialized || {});
66
- return api;
67
- }
68
- }, scriptOptions2);
69
- const sharedInstance = instance2.script || instance2;
70
- if (!sharedInstance[NPM_SCRIPT_PROXY_DECORATED]) {
71
- api = clientUse?.();
72
- sharedInstance.proxy = createNpmScriptProxy(sharedInstance.proxy, () => api);
73
- Object.defineProperty(sharedInstance, NPM_SCRIPT_PROXY_DECORATED, { value: true });
50
+ const scriptOptions2 = { ...userOptions.scriptOptions, ...options.scriptOptions };
51
+ const resolveApi = scriptOptions2.use;
52
+ const clientUse = resolveClientUse(resolveApi);
53
+ delete scriptOptions2.use;
54
+ if (typeof scriptOptions2.trigger === "undefined")
55
+ scriptOptions2.trigger = "client";
56
+ const apiState = createNpmScriptApiState(clientUse);
57
+ const instance2 = useScript({
58
+ key: String(registryKey),
59
+ async loader({ signal }) {
60
+ const initialized = await options.clientInit?.({ signal });
61
+ if (signal.aborted)
62
+ throw signal.reason || new Error(`Loading ${String(registryKey)} was aborted`);
63
+ return apiState.load(resolveApi, initialized);
74
64
  }
75
- return instance2;
65
+ }, scriptOptions2);
66
+ const sharedInstance = instance2.script || instance2;
67
+ if (!sharedInstance[NPM_SCRIPT_PROXY_DECORATED]) {
68
+ sharedInstance.proxy = createNpmScriptProxy(sharedInstance.proxy, apiState.current);
69
+ Object.defineProperty(sharedInstance, NPM_SCRIPT_PROXY_DECORATED, { value: true });
76
70
  }
77
- return createNpmScriptStub({
78
- key: String(registryKey),
79
- use: resolveClientUse(options.scriptOptions?.use),
80
- clientInit: options.clientInit,
81
- trigger: userOptions.scriptOptions?.trigger
82
- });
71
+ return instance2;
83
72
  }
84
73
  let finalScriptInput = options.scriptInput;
85
74
  const userSrc = userOptions.scriptInput?.src;
package/dist/stats.mjs CHANGED
@@ -124,6 +124,11 @@ const scriptMeta = {
124
124
  trackedData: ["user-identity", "events"],
125
125
  testId: "akg5rmxb"
126
126
  },
127
+ deskcrew: {
128
+ urls: ["https://deskcrew.io/desk.js"],
129
+ trackedData: ["user-identity", "events", "errors"],
130
+ testId: "pub_deskcrewdemo"
131
+ },
127
132
  crisp: {
128
133
  urls: ["https://client.crisp.chat/l.js"],
129
134
  trackedData: ["user-identity", "events"],
@@ -157,6 +162,14 @@ const scriptMeta = {
157
162
  // Dynamic URL with API key
158
163
  trackedData: []
159
164
  },
165
+ leaflet: {
166
+ urls: ["https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"],
167
+ trackedData: []
168
+ },
169
+ maplibre: {
170
+ urls: ["https://unpkg.com/maplibre-gl@5.24.0/dist/maplibre-gl.js"],
171
+ trackedData: []
172
+ },
160
173
  // CDN
161
174
  npm: {
162
175
  urls: [],