@nuxt/scripts 1.3.6 → 2.0.0-beta.2

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 (214) 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/B-kTnbRv.js +1 -0
  7. package/dist/devtools-client/_nuxt/{DTP8MRtW.js → BNPn63Jz.js} +1 -1
  8. package/dist/devtools-client/_nuxt/BuTlAAeI.js +152 -0
  9. package/dist/devtools-client/_nuxt/C41E8Pp1.js +8 -0
  10. package/dist/devtools-client/_nuxt/CDDBpkXG.js +3 -0
  11. package/dist/devtools-client/_nuxt/Cbmw_5H5.js +1 -0
  12. package/dist/devtools-client/_nuxt/DAsiyhPm.js +6 -0
  13. package/dist/devtools-client/_nuxt/{VICyrUSM.js → DabLKy7M.js} +1 -1
  14. package/dist/devtools-client/_nuxt/Dat651Oh.js +1 -0
  15. package/dist/devtools-client/_nuxt/DiZU_C4m.js +1 -0
  16. package/dist/devtools-client/_nuxt/KsX6Az5B.js +1 -0
  17. package/dist/devtools-client/_nuxt/UmWNrBO5.js +2 -0
  18. package/dist/devtools-client/_nuxt/builds/latest.json +1 -1
  19. package/dist/devtools-client/_nuxt/builds/meta/ca92700f-27e7-46dc-87da-4934fe1aa4b0.json +1 -0
  20. package/dist/devtools-client/_nuxt/{entry.CYUdJFoE.css → entry.9HJPJ6Hp.css} +1 -1
  21. package/dist/devtools-client/_nuxt/error-404.DnwL1N6v.css +1 -0
  22. package/dist/devtools-client/_nuxt/error-500.DEbXRLdm.css +1 -0
  23. package/dist/devtools-client/_nuxt/tYzzi6ZH.js +28 -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 +83 -346
  32. package/dist/registry.mjs +55 -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.d.vue.ts +1 -1
  86. package/dist/runtime/components/ScriptPayPalButtons.vue +7 -3
  87. package/dist/runtime/components/ScriptPayPalButtons.vue.d.ts +1 -1
  88. package/dist/runtime/components/ScriptPayPalMessages.d.vue.ts +1 -1
  89. package/dist/runtime/components/ScriptPayPalMessages.vue +8 -4
  90. package/dist/runtime/components/ScriptPayPalMessages.vue.d.ts +1 -1
  91. package/dist/runtime/composables/useScript.js +96 -49
  92. package/dist/runtime/composables/useScriptProxyUrl.d.ts +4 -8
  93. package/dist/runtime/composables/useScriptProxyUrl.js +0 -7
  94. package/dist/runtime/composables/useScriptTriggerIdleTimeout.d.ts +2 -1
  95. package/dist/runtime/composables/useScriptTriggerIdleTimeout.js +3 -34
  96. package/dist/runtime/composables/useScriptTriggerInteraction.d.ts +2 -1
  97. package/dist/runtime/composables/useScriptTriggerInteraction.js +13 -46
  98. package/dist/runtime/composables/useScriptTriggerServiceWorker.d.ts +2 -1
  99. package/dist/runtime/composables/useScriptTriggerServiceWorker.js +5 -38
  100. package/dist/runtime/leaflet-styles.d.ts +13 -0
  101. package/dist/runtime/leaflet-styles.js +684 -0
  102. package/dist/runtime/maplibre-styles.d.ts +17 -0
  103. package/dist/runtime/maplibre-styles.js +25 -0
  104. package/dist/runtime/npm-script-api-state.d.ts +4 -0
  105. package/dist/runtime/npm-script-api-state.js +13 -0
  106. package/dist/runtime/registry/_gcm-consent.js +30 -7
  107. package/dist/runtime/registry/crisp.d.ts +1 -1
  108. package/dist/runtime/registry/crisp.js +30 -18
  109. package/dist/runtime/registry/deskcrew.d.ts +52 -0
  110. package/dist/runtime/registry/deskcrew.js +31 -0
  111. package/dist/runtime/registry/google-analytics.d.ts +0 -2
  112. package/dist/runtime/registry/google-maps.d.ts +2 -11
  113. package/dist/runtime/registry/google-maps.js +31 -10
  114. package/dist/runtime/registry/google-tag-manager.d.ts +0 -2
  115. package/dist/runtime/registry/leaflet.d.ts +13 -0
  116. package/dist/runtime/registry/leaflet.js +29 -0
  117. package/dist/runtime/registry/maplibre.d.ts +19 -0
  118. package/dist/runtime/registry/maplibre.js +37 -0
  119. package/dist/runtime/registry/matomo-analytics.js +1 -8
  120. package/dist/runtime/registry/plausible-analytics.d.ts +4 -16
  121. package/dist/runtime/registry/plausible-analytics.js +15 -58
  122. package/dist/runtime/registry/rybbit-analytics.d.ts +0 -4
  123. package/dist/runtime/registry/rybbit-analytics.js +1 -4
  124. package/dist/runtime/registry/schemas.d.ts +61 -5
  125. package/dist/runtime/registry/schemas.js +64 -5
  126. package/dist/runtime/registry/speedcurve.js +12 -3
  127. package/dist/runtime/registry/tiktok-pixel.d.ts +2 -12
  128. package/dist/runtime/registry/tiktok-pixel.js +1 -1
  129. package/dist/runtime/registry/usercentrics.js +46 -6
  130. package/dist/runtime/registry/youtube-player.d.ts +3 -4
  131. package/dist/runtime/registry/youtube-player.js +30 -23
  132. package/dist/runtime/server/bluesky-embed-image.d.ts +1 -1
  133. package/dist/runtime/server/bluesky-embed.d.ts +1 -1
  134. package/dist/runtime/server/bluesky-embed.js +3 -6
  135. package/dist/runtime/server/gravatar-proxy.d.ts +1 -1
  136. package/dist/runtime/server/gravatar-proxy.js +2 -3
  137. package/dist/runtime/server/instagram-embed-asset.d.ts +1 -1
  138. package/dist/runtime/server/instagram-embed-image.d.ts +1 -1
  139. package/dist/runtime/server/instagram-embed.d.ts +1 -1
  140. package/dist/runtime/server/instagram-embed.js +4 -7
  141. package/dist/runtime/server/utils/cached-upstream.d.ts +4 -11
  142. package/dist/runtime/server/utils/embed-rewriters.d.ts +3 -5
  143. package/dist/runtime/server/utils/embed-rewriters.js +8 -8
  144. package/dist/runtime/server/utils/image-proxy.d.ts +1 -1
  145. package/dist/runtime/server/utils/image-proxy.js +2 -3
  146. package/dist/runtime/server/utils/instagram-embed.d.ts +6 -6
  147. package/dist/runtime/server/utils/instagram-embed.js +18 -19
  148. package/dist/runtime/server/utils/network-dispatcher.node.js +136 -11
  149. package/dist/runtime/server/utils/proxy-url.d.ts +5 -6
  150. package/dist/runtime/server/utils/proxy-url.js +1 -4
  151. package/dist/runtime/server/x-embed-image.d.ts +1 -1
  152. package/dist/runtime/server/x-embed.d.ts +48 -1
  153. package/dist/runtime/server/x-embed.js +3 -6
  154. package/dist/runtime/types.d.ts +13 -13
  155. package/dist/runtime/utils/abortable-promise.js +26 -5
  156. package/dist/runtime/utils/nuxt-ready-script-trigger.d.ts +3 -0
  157. package/dist/runtime/utils/nuxt-ready-script-trigger.js +16 -0
  158. package/dist/runtime/utils.js +21 -32
  159. package/dist/stats.mjs +14 -0
  160. package/dist/types-source.mjs +1183 -81
  161. package/dist/types.d.mts +2 -2
  162. package/package.json +34 -21
  163. package/LICENSE.md +0 -9
  164. package/bin/cli.mjs +0 -2
  165. package/dist/cli.d.mts +0 -2
  166. package/dist/cli.d.ts +0 -2
  167. package/dist/cli.mjs +0 -50
  168. package/dist/devtools-client/_nuxt/8ltZ0o6d.js +0 -1
  169. package/dist/devtools-client/_nuxt/B8_EBdhg.js +0 -152
  170. package/dist/devtools-client/_nuxt/BKdLzFmX.js +0 -3
  171. package/dist/devtools-client/_nuxt/Bf2Kt1P0.js +0 -28
  172. package/dist/devtools-client/_nuxt/CC0GKROJ.js +0 -1
  173. package/dist/devtools-client/_nuxt/CH5oUfNi.js +0 -1
  174. package/dist/devtools-client/_nuxt/CMXzQxJZ.js +0 -1
  175. package/dist/devtools-client/_nuxt/CP7c-Js6.js +0 -8
  176. package/dist/devtools-client/_nuxt/C_v3_O0R.js +0 -6
  177. package/dist/devtools-client/_nuxt/CxN78VhB.js +0 -1
  178. package/dist/devtools-client/_nuxt/Dkc7iTdR.js +0 -1
  179. package/dist/devtools-client/_nuxt/builds/meta/35e54cbc-079c-4313-8838-34632d9dac97.json +0 -1
  180. package/dist/devtools-client/_nuxt/error-404.Bq2JQbJs.css +0 -1
  181. package/dist/devtools-client/_nuxt/error-500.5E_FOzlc.css +0 -1
  182. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.d.vue.ts +0 -13
  183. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue +0 -15
  184. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue.d.ts +0 -13
  185. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.d.vue.ts +0 -27
  186. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.vue +0 -34
  187. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.vue.d.ts +0 -27
  188. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.d.vue.ts +0 -13
  189. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.vue +0 -11
  190. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.vue.d.ts +0 -13
  191. package/dist/runtime/components/GoogleMaps/bindGoogleMapsEvents.d.ts +0 -13
  192. package/dist/runtime/components/GoogleMaps/bindGoogleMapsEvents.js +0 -8
  193. package/dist/runtime/components/GoogleMaps/injectionKeys.d.ts +0 -10
  194. package/dist/runtime/components/GoogleMaps/injectionKeys.js +0 -2
  195. package/dist/runtime/composables/useScriptProxyToken.d.ts +0 -12
  196. package/dist/runtime/composables/useScriptProxyToken.js +0 -4
  197. package/dist/runtime/npm-script-stub.d.ts +0 -20
  198. package/dist/runtime/npm-script-stub.js +0 -72
  199. package/dist/runtime/plugins/proxy-token.server.d.ts +0 -10
  200. package/dist/runtime/plugins/proxy-token.server.js +0 -17
  201. package/dist/runtime/server/google-maps-geocode-proxy.d.ts +0 -2
  202. package/dist/runtime/server/google-maps-geocode-proxy.js +0 -43
  203. package/dist/runtime/server/google-static-maps-proxy.d.ts +0 -2
  204. package/dist/runtime/server/google-static-maps-proxy.js +0 -56
  205. package/dist/runtime/server/utils/proxy-query.d.ts +0 -2
  206. package/dist/runtime/server/utils/proxy-query.js +0 -10
  207. package/dist/runtime/server/utils/sign-constants.d.ts +0 -16
  208. package/dist/runtime/server/utils/sign-constants.js +0 -5
  209. package/dist/runtime/server/utils/sign.d.ts +0 -101
  210. package/dist/runtime/server/utils/sign.js +0 -91
  211. package/dist/runtime/server/utils/withSigning.d.ts +0 -23
  212. package/dist/runtime/server/utils/withSigning.js +0 -19
  213. package/dist/runtime/unhead-features.d.ts +0 -1
  214. package/dist/runtime/unhead-features.js +0 -3
package/dist/module.mjs CHANGED
@@ -1,21 +1,20 @@
1
- import { createHash, randomBytes } from 'node:crypto';
2
- import { existsSync, readFileSync, writeFileSync, appendFileSync, readdirSync } from 'node:fs';
3
- import fsp, { open, stat, unlink } from 'node:fs/promises';
4
- import { setTimeout } from 'node:timers/promises';
5
- import { useNuxt, addDevServerHandler, extendRouteRules, tryUseNuxt, createResolver, extendViteConfig, logger as logger$1, useLogger, getNuxtVersion, addTypeTemplate, resolvePath, defineNuxtModule, addPluginTemplate, addServerHandler, addImports, addComponentsDir, addTemplate, hasNuxtModule, addBuildPlugin, addPlugin } from '@nuxt/kit';
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { findPackageJSON } from 'node:module';
3
+ import { useNuxt, addDevServerHandler, extendRouteRules, tryUseNuxt, createResolver, extendViteConfig, logger as logger$1, useLogger, getNuxtVersion, addTypeTemplate, resolvePath, defineNuxtModule, addPluginTemplate, addServerHandler, addImports, addComponentsDir, addTemplate, hasNuxtModule, addBuildPlugin } from '@nuxt/kit';
6
4
  import { defu } from 'defu';
7
- import { join, resolve, dirname } from 'pathe';
8
- import { resolvePackageJSON, readPackageJSON } from 'pkg-types';
5
+ import { satisfies } from 'semver';
9
6
  import { lazyEventHandler, eventHandler, createError, setHeader } from 'h3';
10
7
  import { fetch, $fetch } from 'ofetch';
8
+ import { join, resolve, dirname } from 'pathe';
11
9
  import { joinURL, parseURL, parseQuery, hasProtocol } from 'ufo';
12
10
  import { createStorage } from 'unstorage';
13
11
  import fsDriver from 'unstorage/drivers/fs-lite';
14
- import { Buffer as Buffer$1 } from 'node:buffer';
15
- import { isCI, provider } from 'std-env';
16
12
  import { pathToFileURL } from 'node:url';
13
+ import { isCI, provider } from 'std-env';
17
14
  import { parseAndWalk, ScopeTracker, walk, ScopeTrackerFunction, ScopeTrackerIdentifier, ScopeTrackerFunctionParam, ScopeTrackerVariable } from 'oxc-walker';
18
15
  import { createUnplugin } from 'unplugin';
16
+ import { createHash } from 'node:crypto';
17
+ import fsp from 'node:fs/promises';
19
18
  import { colors } from 'consola/utils';
20
19
  import MagicString from 'magic-string';
21
20
  import { hash } from 'ohash';
@@ -151,7 +150,7 @@ function setupStandaloneApi(nuxt) {
151
150
  req.off("error", onAborted);
152
151
  }, onAborted = function() {
153
152
  finished = true;
154
- chunks = [];
153
+ chunks.length = 0;
155
154
  cleanup();
156
155
  }, onData = function(chunk) {
157
156
  if (finished)
@@ -159,7 +158,7 @@ function setupStandaloneApi(nuxt) {
159
158
  size += chunk.byteLength;
160
159
  if (size > DEVTOOLS_API_MAX_BODY_SIZE) {
161
160
  finished = true;
162
- chunks = [];
161
+ chunks.length = 0;
163
162
  cleanup();
164
163
  req.once("error", () => {
165
164
  });
@@ -175,7 +174,7 @@ function setupStandaloneApi(nuxt) {
175
174
  finished = true;
176
175
  cleanup();
177
176
  try {
178
- const data = JSON.parse(Buffer$1.concat(chunks, size).toString("utf8"));
177
+ const data = JSON.parse(Buffer.concat(chunks).toString("utf8"));
179
178
  scriptsState = { ...data, updatedAt: Date.now() };
180
179
  res.statusCode = 200;
181
180
  res.end("ok");
@@ -183,9 +182,9 @@ function setupStandaloneApi(nuxt) {
183
182
  res.statusCode = 400;
184
183
  res.end("invalid json");
185
184
  }
186
- chunks = [];
185
+ chunks.length = 0;
187
186
  };
188
- let chunks = [];
187
+ const chunks = [];
189
188
  let size = 0;
190
189
  let finished = false;
191
190
  req.on("data", onData);
@@ -252,9 +251,16 @@ function buildDevtoolsData(proxyPrefix, privacyLabel, scripts, aliasToDomain) {
252
251
 
253
252
  const isStackblitz = provider === "stackblitz";
254
253
  async function promptToInstall(name, installCommand, options) {
255
- if (await resolvePackageJSON(name).catch(() => {
256
- return null;
257
- })) {
254
+ const installed = [options.rootDir, ...options.searchPaths || []].some((searchPath) => {
255
+ try {
256
+ return !!findPackageJSON(name, pathToFileURL(`${searchPath.replace(/\/$/, "")}/`));
257
+ } catch (error) {
258
+ if (error.code === "ERR_MODULE_NOT_FOUND")
259
+ return false;
260
+ throw error;
261
+ }
262
+ });
263
+ if (installed) {
258
264
  return true;
259
265
  }
260
266
  logger$1.info(`Package ${name} is missing`);
@@ -384,81 +390,34 @@ function extractRequiredFields(schema) {
384
390
  return [];
385
391
  return Object.entries(schema.entries).filter(([, field]) => field?.type !== "optional").map(([key]) => key);
386
392
  }
387
- function migrateDeprecatedRegistryKeys(registry, warn) {
388
- for (const key of Object.keys(registry)) {
389
- const entry = registry[key];
390
- if (!entry || typeof entry !== "object")
391
- continue;
392
- if (Array.isArray(entry)) {
393
- const opts = entry[1];
394
- if (opts && typeof opts === "object" && "reverseProxyIntercept" in opts) {
395
- warn(`[nuxt-scripts] registry.${key}: \`reverseProxyIntercept\` has been renamed to \`proxy\`. Please update your config. Auto-migrating for now.`);
396
- const o = opts;
397
- o.proxy ??= o.reverseProxyIntercept;
398
- delete o.reverseProxyIntercept;
399
- }
400
- } else {
401
- const obj = entry;
402
- if ("reverseProxyIntercept" in obj) {
403
- warn(`[nuxt-scripts] registry.${key}: \`reverseProxyIntercept\` has been renamed to \`proxy\`. Please update your config. Auto-migrating for now.`);
404
- obj.proxy ??= obj.reverseProxyIntercept;
405
- delete obj.reverseProxyIntercept;
406
- }
407
- const so = obj.scriptOptions;
408
- if (so && typeof so === "object" && "reverseProxyIntercept" in so) {
409
- warn(`[nuxt-scripts] registry.${key}: \`scriptOptions.reverseProxyIntercept\` has been renamed to \`proxy\`. Please update your config. Auto-migrating for now.`);
410
- const s = so;
411
- s.proxy ??= s.reverseProxyIntercept;
412
- delete s.reverseProxyIntercept;
413
- }
414
- }
415
- }
416
- }
417
- function normalizeRegistryConfig(registry, warn, componentOnlyKeys) {
393
+ function normalizeRegistryConfig(registry) {
418
394
  for (const key of Object.keys(registry)) {
419
395
  const entry = registry[key];
420
- if (!entry) {
396
+ if (entry === false || entry === null || entry === void 0) {
421
397
  delete registry[key];
422
398
  continue;
423
399
  }
424
- if (entry === true) {
425
- if (componentOnlyKeys?.has(key)) {
426
- registry[key] = [{}];
427
- continue;
428
- }
429
- warn?.(`[nuxt-scripts] registry.${key}: \`true\` shorthand is deprecated. Use \`{ trigger: 'onNuxtReady' }\` instead.`);
430
- registry[key] = [{}, { trigger: "onNuxtReady" }];
431
- continue;
432
- }
433
- if (entry === "proxy-only") {
434
- throw new Error(
435
- `[nuxt-scripts] registry.${key}: \`'proxy-only'\` is no longer supported. Use \`{}\` instead (infrastructure only is now the default behavior).`
436
- );
437
- }
438
400
  if (entry === "mock") {
439
401
  registry[key] = [{}, { trigger: "manual", skipValidation: true }];
440
- } else if (Array.isArray(entry)) {
441
- if (!entry[0] && !entry[1]) {
442
- delete registry[key];
443
- continue;
444
- }
445
- if (!entry[0])
446
- entry[0] = {};
447
- } else if (typeof entry === "object") {
448
- const { scriptOptions, ...rest } = entry;
402
+ } else if (typeof entry === "object" && !Array.isArray(entry)) {
449
403
  const input = {};
450
- const mergedScriptOptions = {};
451
- if (scriptOptions && typeof scriptOptions === "object")
452
- Object.assign(mergedScriptOptions, scriptOptions);
453
- for (const [k, v] of Object.entries(rest)) {
404
+ const scriptOptions = {};
405
+ for (const [k, v] of Object.entries(entry)) {
406
+ if (k === "scriptOptions" || k === "reverseProxyIntercept") {
407
+ throw new TypeError(
408
+ `[nuxt-scripts] registry.${key}.${k} is no longer supported.`
409
+ );
410
+ }
454
411
  if (SCRIPT_OPTION_KEYS.includes(k))
455
- mergedScriptOptions[k] = v;
412
+ scriptOptions[k] = v;
456
413
  else
457
414
  input[k] = v;
458
415
  }
459
- registry[key] = Object.keys(mergedScriptOptions).length > 0 ? [input, mergedScriptOptions] : [input];
416
+ registry[key] = Object.keys(scriptOptions).length > 0 ? [input, scriptOptions] : [input];
460
417
  } else {
461
- delete registry[key];
418
+ throw new TypeError(
419
+ `[nuxt-scripts] registry.${key}: invalid entry. Use a flat config object, 'mock', or false.`
420
+ );
462
421
  }
463
422
  }
464
423
  }
@@ -484,26 +443,21 @@ function isVue(id, opts = {}) {
484
443
  }
485
444
  return true;
486
445
  }
487
- const JS_RE$1 = /\.(?:[cm]?j|t)sx?$/;
488
- function isJS(id) {
489
- const { pathname } = parseURL(decodeURIComponent(pathToFileURL(id).href));
490
- return JS_RE$1.test(pathname);
491
- }
492
446
 
493
- const VUE_RE$1 = /\.vue/;
447
+ const VUE_RE$1 = /\.vue(?:\?|$)/;
448
+ const USE_SCRIPT_CODE_MARKER$1 = "useScript";
494
449
  function NuxtScriptsCheckScripts() {
495
450
  return createUnplugin(() => {
496
451
  return {
497
452
  name: "nuxt-scripts:check-scripts",
498
453
  transform: {
499
454
  filter: {
500
- id: VUE_RE$1
455
+ id: VUE_RE$1,
456
+ code: USE_SCRIPT_CODE_MARKER$1
501
457
  },
502
458
  handler(code, id) {
503
459
  if (!isVue(id, { type: ["script"] }))
504
460
  return;
505
- if (!code.includes("useScript"))
506
- return;
507
461
  let nameNode;
508
462
  let errorNode;
509
463
  parseAndWalk(code, id, (_node) => {
@@ -1081,9 +1035,10 @@ function rewriteScriptUrlsAST(content, filename, rewrites, sdkPatches, options)
1081
1035
 
1082
1036
  const SEVEN_DAYS_IN_MS = 7 * 24 * 60 * 60 * 1e3;
1083
1037
  const PROTOCOL_RELATIVE_RE = /^\/\//;
1084
- const VUE_RE = /\.vue/;
1085
- const JS_RE = /\.[cm]?[jt]sx?$/;
1038
+ const VUE_RE = /\.vue(?:\?|$)/;
1039
+ const JS_RE = /\.[cm]?[jt]sx?(?:\?|$)/;
1086
1040
  const TEST_RE = /\.(?:test|spec)\./;
1041
+ const USE_SCRIPT_CODE_MARKER = "useScript";
1087
1042
  const UPPERCASE_RE = /^[A-Z]$/;
1088
1043
  const USE_SCRIPT_RE = /^useScript/;
1089
1044
  function calculateIntegrity(content, algorithm = "sha384") {
@@ -1214,12 +1169,11 @@ function NuxtScriptBundleTransformer(options = {
1214
1169
  id: {
1215
1170
  include: [VUE_RE, JS_RE],
1216
1171
  exclude: [TEST_RE]
1217
- }
1172
+ },
1173
+ code: USE_SCRIPT_CODE_MARKER
1218
1174
  },
1219
1175
  async handler(code, id) {
1220
- if (!isVue(id, { type: ["template", "script"] }) && !isJS(id))
1221
- return;
1222
- if (!code.includes("useScript"))
1176
+ if (VUE_RE.test(id) && !isVue(id, { type: ["template", "script"] }))
1223
1177
  return;
1224
1178
  const s = new MagicString(code);
1225
1179
  const deferredOps = [];
@@ -1586,10 +1540,6 @@ function resolveTriggerForTemplate(trigger) {
1586
1540
  return null;
1587
1541
  }
1588
1542
  function templatePlugin(config, registry) {
1589
- if (Array.isArray(config.globals)) {
1590
- config.globals = Object.fromEntries(config.globals.map((i) => [hash(i), i]));
1591
- logger.warn("The `globals` array option is deprecated. Convert to an object: `globals: { myScript: 'https://example.com/script.js' }`");
1592
- }
1593
1543
  const imports = [];
1594
1544
  const inits = [];
1595
1545
  const globalMapEntries = [];
@@ -1718,20 +1668,6 @@ function templatePlugin(config, registry) {
1718
1668
  ].join("\n");
1719
1669
  }
1720
1670
 
1721
- const SOURCE_LESS_SCRIPT_LOADER_TYPE = /\bUseScriptLoaderInput\b/;
1722
- function hasUnheadSourceLessScriptLoader(typesSource) {
1723
- return SOURCE_LESS_SCRIPT_LOADER_TYPE.test(typesSource);
1724
- }
1725
- function hasUnheadSourceLessScriptLoaderFile(typesPath) {
1726
- if (!typesPath || !existsSync(typesPath))
1727
- return false;
1728
- try {
1729
- return hasUnheadSourceLessScriptLoader(readFileSync(typesPath, "utf8"));
1730
- } catch {
1731
- return false;
1732
- }
1733
- }
1734
-
1735
1671
  const UPPER_RE$1 = /([A-Z])/g;
1736
1672
  const toScreamingSnake$1 = (s) => s.replace(UPPER_RE$1, "_$1").toUpperCase();
1737
1673
  const ENV_PREFIX = "NUXT_PUBLIC_SCRIPTS_";
@@ -1884,148 +1820,22 @@ function validateScriptsEnvVars(scripts, enabledRegistryKeys, logger, globalsKey
1884
1820
  }
1885
1821
  }
1886
1822
 
1887
- const SELF_CLOSING_SCRIPT_RE = /<((?:Script[A-Z]|script-)\w[\w-]*)\b([^>]*?)\/\s*>/g;
1888
- function fixSelfClosingScriptComponents(nuxt) {
1889
- function expandTags(content) {
1890
- SELF_CLOSING_SCRIPT_RE.lastIndex = 0;
1891
- if (!SELF_CLOSING_SCRIPT_RE.test(content))
1892
- return null;
1893
- SELF_CLOSING_SCRIPT_RE.lastIndex = 0;
1894
- return content.replace(SELF_CLOSING_SCRIPT_RE, (_, tag, attrs) => `<${tag}${attrs.trimEnd()}></${tag}>`);
1895
- }
1896
- function fixFile(filePath) {
1897
- if (!existsSync(filePath))
1898
- return;
1899
- const content = readFileSync(filePath, "utf-8");
1900
- const fixed = expandTags(content);
1901
- if (fixed)
1902
- nuxt.vfs[filePath] = fixed;
1903
- }
1904
- function scanDir(dir) {
1905
- if (!existsSync(dir))
1906
- return;
1907
- for (const entry of readdirSync(dir, { withFileTypes: true })) {
1908
- const fullPath = resolve(dir, entry.name);
1909
- if (entry.isDirectory())
1910
- scanDir(fullPath);
1911
- else if (entry.name.endsWith(".vue"))
1912
- fixFile(fullPath);
1913
- }
1914
- }
1915
- const pagesDirs = /* @__PURE__ */ new Set();
1916
- for (const layer of nuxt.options._layers) {
1917
- pagesDirs.add(resolve(
1918
- layer.config.srcDir,
1919
- layer.config.dir?.pages || "pages"
1920
- ));
1921
- }
1922
- for (const dir of pagesDirs) scanDir(dir);
1923
- if (nuxt.options.dev) {
1924
- nuxt.hook("builder:watch", (_event, relativePath) => {
1925
- if (!relativePath.endsWith(".vue"))
1926
- return;
1927
- for (const layer of nuxt.options._layers) {
1928
- const fullPath = resolve(layer.config.srcDir, relativePath);
1929
- for (const dir of pagesDirs) {
1930
- if (fullPath.startsWith(`${dir}/`)) {
1931
- fixFile(fullPath);
1932
- return;
1933
- }
1934
- }
1935
- }
1936
- });
1937
- }
1938
- }
1939
1823
  const UPPER_RE = /([A-Z])/g;
1940
1824
  const toScreamingSnake = (s) => s.replace(UPPER_RE, "_$1").toUpperCase();
1941
- const PROXY_SECRET_ENV_KEY = "NUXT_SCRIPTS_PROXY_SECRET";
1942
- const PROXY_SECRET_ENV_LINE_RE = /^NUXT_SCRIPTS_PROXY_SECRET=.*$/m;
1943
- const PROXY_SECRET_ENV_VALUE_RE = /^NUXT_SCRIPTS_PROXY_SECRET=(.+)$/m;
1944
- const PROXY_SECRET_LOCK_RETRY_MS = 10;
1945
- const PROXY_SECRET_LOCK_TIMEOUT_MS = 2e3;
1946
- async function withProxySecretFileLock(envPath, effect) {
1947
- const lockPath = `${envPath}.nuxt-scripts.lock`;
1948
- const deadline = Date.now() + PROXY_SECRET_LOCK_TIMEOUT_MS;
1949
- let lockHandle;
1950
- while (!lockHandle) {
1951
- const acquisition = await open(lockPath, "wx").then((handle) => ({ _tag: "Acquired", handle })).catch((error) => {
1952
- if (error.code === "EEXIST")
1953
- return { _tag: "Busy" };
1954
- throw error;
1955
- });
1956
- if (acquisition._tag === "Acquired") {
1957
- lockHandle = acquisition.handle;
1958
- break;
1959
- }
1960
- const existingLock = await stat(lockPath).then((lockStat) => ({ _tag: "Found", mtimeMs: lockStat.mtimeMs })).catch((error) => {
1961
- if (error.code === "ENOENT")
1962
- return { _tag: "Missing" };
1963
- throw error;
1964
- });
1965
- if (existingLock._tag === "Found" && Date.now() - existingLock.mtimeMs >= PROXY_SECRET_LOCK_TIMEOUT_MS) {
1966
- await unlink(lockPath).catch((error) => {
1967
- if (error.code !== "ENOENT")
1968
- throw error;
1969
- });
1970
- continue;
1971
- }
1972
- if (Date.now() >= deadline)
1973
- throw Object.assign(new Error("Timed out waiting for proxy secret file lock"), { code: "ETIMEDOUT" });
1974
- await setTimeout(PROXY_SECRET_LOCK_RETRY_MS);
1975
- }
1976
- let effectResult;
1825
+ const UNHEAD_VERSION_RANGE = ">=3.3.1 <4";
1826
+ function readInstalledPackageVersion(name) {
1827
+ let packagePath;
1977
1828
  try {
1978
- effectResult = { _tag: "Success", value: effect() };
1829
+ packagePath = findPackageJSON(name, import.meta.url);
1979
1830
  } catch (error) {
1980
- effectResult = { _tag: "Failure", error };
1981
- }
1982
- const closeResult = await lockHandle.close().then(() => ({ _tag: "Success" })).catch((error) => ({ _tag: "Failure", error }));
1983
- const unlinkResult = await unlink(lockPath).then(() => ({ _tag: "Success" })).catch((error) => error.code === "ENOENT" ? { _tag: "Success" } : { _tag: "Failure", error });
1984
- if (closeResult._tag === "Failure")
1985
- logger.warn(`[security] Failed to close the proxy secret lock: ${closeResult.error.message}`);
1986
- if (unlinkResult._tag === "Failure")
1987
- logger.warn(`[security] Failed to remove the proxy secret lock: ${unlinkResult.error.message}`);
1988
- if (effectResult._tag === "Failure")
1989
- throw effectResult.error;
1990
- return effectResult.value;
1991
- }
1992
- async function resolveProxySecret(rootDir, isDev, configSecret, autoGenerate = true) {
1993
- if (configSecret)
1994
- return { secret: configSecret, ephemeral: false, source: "config" };
1995
- const envSecret = process.env[PROXY_SECRET_ENV_KEY];
1996
- if (envSecret)
1997
- return { secret: envSecret, ephemeral: false, source: "env" };
1998
- if (!isDev || !autoGenerate)
1999
- return void 0;
2000
- const secret = randomBytes(32).toString("hex");
2001
- const envPath = resolve(rootDir, ".env");
2002
- const line = `${PROXY_SECRET_ENV_KEY}=${secret}
2003
- `;
2004
- try {
2005
- const persistedSecret = await withProxySecretFileLock(envPath, () => {
2006
- if (existsSync(envPath)) {
2007
- const contents = readFileSync(envPath, "utf-8");
2008
- const existingSecret = contents.match(PROXY_SECRET_ENV_VALUE_RE)?.[1]?.trim();
2009
- if (existingSecret)
2010
- return existingSecret;
2011
- if (PROXY_SECRET_ENV_LINE_RE.test(contents)) {
2012
- writeFileSync(envPath, contents.replace(PROXY_SECRET_ENV_LINE_RE, `${PROXY_SECRET_ENV_KEY}=${secret}`));
2013
- } else {
2014
- appendFileSync(envPath, contents.endsWith("\n") ? line : `
2015
- ${line}`);
2016
- }
2017
- } else {
2018
- writeFileSync(envPath, `# Generated by @nuxt/scripts
2019
- ${line}`);
2020
- }
2021
- return secret;
2022
- });
2023
- process.env[PROXY_SECRET_ENV_KEY] = persistedSecret;
2024
- return { secret: persistedSecret, ephemeral: false, source: "dotenv-generated" };
2025
- } catch {
2026
- process.env[PROXY_SECRET_ENV_KEY] = secret;
2027
- return { secret, ephemeral: true, source: "memory-generated" };
1831
+ if (error.code === "ERR_MODULE_NOT_FOUND")
1832
+ return;
1833
+ throw error;
2028
1834
  }
1835
+ if (!packagePath)
1836
+ return;
1837
+ const parsed = JSON.parse(readFileSync(packagePath, "utf8"));
1838
+ return typeof parsed.version === "string" ? parsed.version : void 0;
2029
1839
  }
2030
1840
  function isProxyDisabled(registryKey, registry2, runtimeConfig) {
2031
1841
  const entry = registry2?.[registryKey];
@@ -2099,7 +1909,7 @@ const module$1 = defineNuxtModule({
2099
1909
  name: "@nuxt/scripts",
2100
1910
  configKey: "scripts",
2101
1911
  compatibility: {
2102
- nuxt: ">=3.16"
1912
+ nuxt: ">=4.5.1"
2103
1913
  }
2104
1914
  },
2105
1915
  defaults: {
@@ -2116,16 +1926,12 @@ const module$1 = defineNuxtModule({
2116
1926
  // Configures the maximum time (in milliseconds) allowed for each fetch attempt.
2117
1927
  }
2118
1928
  },
2119
- googleStaticMapsProxy: {
2120
- enabled: false,
2121
- cacheMaxAge: 3600
2122
- },
2123
1929
  enabled: true,
2124
1930
  debug: false
2125
1931
  },
2126
1932
  async setup(config, nuxt) {
2127
1933
  const { resolve: resolveModule, resolvePath } = createResolver(import.meta.url);
2128
- const { version, name } = await readPackageJSON(await resolvePath("../package.json"));
1934
+ const { version, name } = JSON.parse(readFileSync(await resolvePath("../package.json"), "utf8"));
2129
1935
  nuxt.options.alias["#nuxt-scripts"] = await resolvePath("./runtime");
2130
1936
  logger.level = config.debug || nuxt.options.debug ? 4 : 3;
2131
1937
  if (!config.enabled) {
@@ -2152,29 +1958,22 @@ const module$1 = defineNuxtModule({
2152
1958
  });
2153
1959
  }
2154
1960
  }
2155
- const unheadScriptsAlias = nuxt.options.alias["@unhead/vue/scripts"];
2156
- const unheadPackagePath = await (typeof unheadScriptsAlias === "string" ? resolvePackageJSON(unheadScriptsAlias) : Promise.reject(new Error("No Unhead scripts alias"))).catch(() => resolvePackageJSON("@unhead/vue", {
2157
- // Match the package instance imported by the built runtime. An app can
2158
- // contain another Unhead version with different loader capabilities.
2159
- from: [resolveModule("./runtime")]
2160
- })).catch(() => {
2161
- return null;
2162
- });
2163
- const unheadPackage = unheadPackagePath ? await readPackageJSON(unheadPackagePath).catch(() => {
2164
- return null;
2165
- }) : null;
2166
- const unheadVersion = unheadPackage?.version;
2167
- const scriptsTypesExport = unheadPackage?.exports?.["./scripts"]?.types;
2168
- const scriptsTypesPath = unheadPackagePath && typeof scriptsTypesExport === "string" ? resolve(dirname(unheadPackagePath), scriptsTypesExport) : null;
2169
- const unheadSourceLessScriptLoader = hasUnheadSourceLessScriptLoaderFile(scriptsTypesPath);
2170
- if (unheadVersion?.startsWith("1")) {
2171
- logger.error(`Nuxt Scripts requires Unhead >= 2, you are using v${unheadVersion}. Please run \`nuxi upgrade --clean\` to upgrade...`);
1961
+ const unheadVersions = [
1962
+ ["@unhead/vue", readInstalledPackageVersion("@unhead/vue")],
1963
+ ["unhead", readInstalledPackageVersion("unhead")]
1964
+ ];
1965
+ const incompatibleUnheadPackages = unheadVersions.filter(
1966
+ ([, dependencyVersion]) => !dependencyVersion || !satisfies(dependencyVersion, UNHEAD_VERSION_RANGE)
1967
+ );
1968
+ if (incompatibleUnheadPackages.length) {
1969
+ const resolvedVersions = incompatibleUnheadPackages.map(([dependency, dependencyVersion]) => `${dependency}=${dependencyVersion ? `v${dependencyVersion}` : "missing"}`).join(", ");
1970
+ throw new Error(
1971
+ `[nuxt-scripts] Nuxt Scripts 2 requires @unhead/vue and unhead ${UNHEAD_VERSION_RANGE}; resolved ${resolvedVersions}. Run \`npx nuxi@latest upgrade --force\` to upgrade Nuxt and refresh its dependencies.`
1972
+ );
2172
1973
  }
2173
1974
  const scripts = await registry(resolvePath);
2174
1975
  if (config.registry) {
2175
- const componentOnlyKeys = new Set(scripts.filter((s) => !s.import).map((s) => s.registryKey));
2176
- migrateDeprecatedRegistryKeys(config.registry, (msg) => logger.warn(msg));
2177
- normalizeRegistryConfig(config.registry, (msg) => logger.warn(msg), componentOnlyKeys);
1976
+ normalizeRegistryConfig(config.registry);
2178
1977
  nuxt.options.runtimeConfig.public = nuxt.options.runtimeConfig.public || {};
2179
1978
  const registryWithDefaults = {};
2180
1979
  for (const [key, entry] of Object.entries(config.registry)) {
@@ -2210,33 +2009,25 @@ const module$1 = defineNuxtModule({
2210
2009
  logger,
2211
2010
  Object.keys(config.globals || {})
2212
2011
  );
2213
- const googleMapsEnabled = config.googleStaticMapsProxy?.enabled || !!config.registry?.googleMaps;
2214
2012
  nuxt.options.runtimeConfig["nuxt-scripts"] = {
2215
- version,
2216
- // Private proxy config with API key (server-side only)
2217
- googleStaticMapsProxy: googleMapsEnabled ? { apiKey: nuxt.options.runtimeConfig.public.scripts?.googleMaps?.apiKey } : void 0
2013
+ version
2218
2014
  };
2219
2015
  nuxt.options.runtimeConfig.public["nuxt-scripts"] = {
2220
2016
  // expose for devtools
2221
2017
  version: nuxt.options.dev ? version : void 0,
2222
2018
  prefix: config.prefix || "/_scripts",
2223
- defaultScriptOptions: config.defaultScriptOptions,
2224
- // Only expose enabled and cacheMaxAge to client, not apiKey
2225
- googleStaticMapsProxy: googleMapsEnabled ? { enabled: true, cacheMaxAge: config.googleStaticMapsProxy?.cacheMaxAge ?? 3600 } : void 0
2019
+ defaultScriptOptions: config.defaultScriptOptions
2226
2020
  };
2227
2021
  const debugConst = JSON.stringify(!!config.debug);
2228
- const unheadSourceLessConst = JSON.stringify(unheadSourceLessScriptLoader);
2229
2022
  nuxt.options.vite ||= {};
2230
2023
  nuxt.options.vite.define = {
2231
2024
  ...nuxt.options.vite.define,
2232
- __NUXT_SCRIPTS_DEBUG__: debugConst,
2233
- __NUXT_SCRIPTS_UNHEAD_SOURCELESS__: unheadSourceLessConst
2025
+ __NUXT_SCRIPTS_DEBUG__: debugConst
2234
2026
  };
2235
2027
  nuxt.options.nitro ||= {};
2236
2028
  nuxt.options.nitro.replace = {
2237
2029
  ...nuxt.options.nitro.replace,
2238
- __NUXT_SCRIPTS_DEBUG__: debugConst,
2239
- __NUXT_SCRIPTS_UNHEAD_SOURCELESS__: unheadSourceLessConst
2030
+ __NUXT_SCRIPTS_DEBUG__: debugConst
2240
2031
  };
2241
2032
  const scriptsBase = config.prefix || "/_scripts";
2242
2033
  const proxyPrefix = `${scriptsBase}/p`;
@@ -2253,7 +2044,6 @@ const module$1 = defineNuxtModule({
2253
2044
  const composables = [
2254
2045
  "useScript",
2255
2046
  "useScriptEventPage",
2256
- "useScriptProxyToken",
2257
2047
  "useScriptProxyUrl",
2258
2048
  "useScriptTriggerConsent",
2259
2049
  "useScriptTriggerElement",
@@ -2273,7 +2063,6 @@ const module$1 = defineNuxtModule({
2273
2063
  path: await resolvePath("./runtime/components"),
2274
2064
  pathPrefix: false
2275
2065
  });
2276
- fixSelfClosingScriptComponents(nuxt);
2277
2066
  addTemplate({
2278
2067
  filename: "nuxt-scripts-trigger-resolver.mjs",
2279
2068
  getContents() {
@@ -2510,7 +2299,7 @@ They will load directly from third-party servers.`
2510
2299
  if (proxyStaticPresets.includes(proxyPreset)) {
2511
2300
  logger.warn(
2512
2301
  `Proxy collection endpoints require a server runtime (detected: ${proxyPreset || "static"}).
2513
- Scripts will be bundled, but collection requests will not be proxied and URL signing will be unavailable.
2302
+ Scripts will be bundled, but collection requests will not be proxied.
2514
2303
  Options: configure platform rewrites, switch to server-rendered mode, or disable with proxy: false.`
2515
2304
  );
2516
2305
  }
@@ -2529,9 +2318,8 @@ Options: configure platform rewrites, switch to server-rendered mode, or disable
2529
2318
  }
2530
2319
  }
2531
2320
  const moduleInstallPromises = /* @__PURE__ */ new Map();
2532
- addBuildPlugin(NuxtScriptsCheckScripts(), {
2533
- dev: true
2534
- });
2321
+ if (nuxt.options.dev)
2322
+ addBuildPlugin(NuxtScriptsCheckScripts());
2535
2323
  addBuildPlugin(NuxtScriptBundleTransformer({
2536
2324
  nuxt,
2537
2325
  scripts: registryScriptsWithImport,
@@ -2559,11 +2347,10 @@ Options: configure platform rewrites, switch to server-rendered mode, or disable
2559
2347
  });
2560
2348
  const scriptsPrefix = config.prefix || "/_scripts";
2561
2349
  const enabledEndpoints = {};
2562
- let anyHandlerRequiresSigning = false;
2563
2350
  for (const script of scripts) {
2564
2351
  if (!script.serverHandlers?.length || !script.registryKey)
2565
2352
  continue;
2566
- const isEnabled = script.registryKey === "googleMaps" ? config.googleStaticMapsProxy?.enabled || config.registry?.googleMaps : config.registry?.[script.registryKey];
2353
+ const isEnabled = config.registry?.[script.registryKey];
2567
2354
  if (!isEnabled)
2568
2355
  continue;
2569
2356
  enabledEndpoints[script.registryKey] = true;
@@ -2574,8 +2361,6 @@ Options: configure platform rewrites, switch to server-rendered mode, or disable
2574
2361
  handler: handler.handler,
2575
2362
  middleware: handler.middleware
2576
2363
  });
2577
- if (handler.requiresSigning)
2578
- anyHandlerRequiresSigning = true;
2579
2364
  }
2580
2365
  if (script.registryKey === "gravatar") {
2581
2366
  const gravatarConfig = config.registry?.gravatar?.[0] || {};
@@ -2584,61 +2369,13 @@ Options: configure platform rewrites, switch to server-rendered mode, or disable
2584
2369
  nuxt.options.runtimeConfig.public["nuxt-scripts"]
2585
2370
  );
2586
2371
  }
2587
- if (script.registryKey === "googleMaps") {
2588
- nuxt.options.runtimeConfig["nuxt-scripts"] = defu(
2589
- { googleMapsGeocodeProxy: { apiKey: nuxt.options.runtimeConfig.public.scripts?.googleMaps?.apiKey } },
2590
- nuxt.options.runtimeConfig["nuxt-scripts"]
2591
- );
2592
- }
2593
2372
  }
2594
2373
  ensureNuxtScriptsCacheStorage(nuxt.options.nitro);
2595
2374
  nuxt.options.runtimeConfig.public["nuxt-scripts"] = defu(
2596
2375
  { endpoints: enabledEndpoints },
2597
2376
  nuxt.options.runtimeConfig.public["nuxt-scripts"]
2598
2377
  );
2599
- const staticPresets = ["static", "github-pages", "cloudflare-pages-static", "netlify-static", "azure-static", "firebase-static"];
2600
- const nitroPreset = process.env.NITRO_PRESET || "";
2601
- const isStaticTarget = staticPresets.includes(nitroPreset);
2602
- const isSpa = nuxt.options.ssr === false;
2603
- if (config.security === false) {
2604
- if (anyHandlerRequiresSigning && !nuxt.options.dev) {
2605
- logger.info("[security] Proxy security disabled via `security: false`. Proxy endpoints will pass requests through without signature verification.");
2606
- }
2607
- } else if (anyHandlerRequiresSigning && (isSpa || isStaticTarget)) {
2608
- logger.warn(
2609
- `[security] URL signing requires a server runtime${isStaticTarget ? ` (detected preset: ${nitroPreset})` : " (ssr: false)"}.
2610
- Proxy endpoints will work without signature verification.
2611
- To enable signing, deploy with a server-rendered target or configure platform-level rewrites.`
2612
- );
2613
- } else if (anyHandlerRequiresSigning) {
2614
- const proxySecretResolved = await resolveProxySecret(
2615
- nuxt.options.rootDir,
2616
- !!nuxt.options.dev,
2617
- config.security?.secret,
2618
- config.security?.autoGenerateSecret !== false
2619
- );
2620
- if (proxySecretResolved?.source === "dotenv-generated")
2621
- logger.info(`[security] Generated ${PROXY_SECRET_ENV_KEY} in .env for signed proxy URLs.`);
2622
- else if (proxySecretResolved?.source === "memory-generated")
2623
- logger.warn(`[security] Generated an in-memory ${PROXY_SECRET_ENV_KEY} (could not write .env). Signed URLs will break across restarts.`);
2624
- if (proxySecretResolved?.secret) {
2625
- const scriptsRuntime = nuxt.options.runtimeConfig["nuxt-scripts"];
2626
- scriptsRuntime.proxySecret = proxySecretResolved.secret;
2627
- if (config.security?.pageTokenMaxAge !== void 0)
2628
- scriptsRuntime.pageTokenMaxAge = config.security.pageTokenMaxAge;
2629
- addPlugin({
2630
- src: await resolvePath("./runtime/plugins/proxy-token.server"),
2631
- mode: "server"
2632
- });
2633
- } else if (!nuxt.options.dev) {
2634
- logger.warn(
2635
- `[security] ${PROXY_SECRET_ENV_KEY} is not set. Proxy endpoints will pass requests through without signature verification.
2636
- Generate one with: npx @nuxt/scripts generate-secret
2637
- Then set the env var: ${PROXY_SECRET_ENV_KEY}=<secret>`
2638
- );
2639
- }
2640
- }
2641
2378
  }
2642
2379
  });
2643
2380
 
2644
- export { applyAutoInject, module$1 as default, findMissingRequiredFields, isProxyDisabled, resolveConfiguredProxyDomains, resolveProxySecret };
2381
+ export { applyAutoInject, module$1 as default, findMissingRequiredFields, isProxyDisabled, resolveConfiguredProxyDomains };