Skip to content

Commit 2db3380

Browse files
authored
refactor!: drop legacy compatibility for v2 (#851)
1 parent 3b4a191 commit 2db3380

86 files changed

Lines changed: 1584 additions & 3552 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/nightly.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Setup Node
2727
uses: actions/setup-node@v7
2828
with:
29-
node-version: lts/*
29+
node-version: 24
3030
registry-url: https://registry.npmjs.org/
3131
cache: pnpm
3232

‎.github/workflows/release.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Setup Node
2626
uses: actions/setup-node@v7
2727
with:
28-
node-version: lts/*
28+
node-version: 24
2929
cache: pnpm
3030
registry-url: https://registry.npmjs.org
3131

‎docs/content/docs/1.getting-started/2.installation.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ description: Install Nuxt Scripts in an existing Nuxt project.
55

66
## Quick Start
77

8-
Nuxt Scripts 2 requires Nuxt 4.5.1 or newer and Unhead 3.3.1 or newer. Upgrade an
9-
existing project before installing:
8+
Nuxt Scripts 2 requires [Node.js](https://nodejs.org) 24 or newer, Nuxt 4.5.1 or
9+
newer, including Nuxt 5, and Unhead `>=3.3.1 <4`. Upgrade an existing project
10+
before installing:
1011

1112
```bash
1213
npx nuxi@latest upgrade --force

‎docs/content/docs/1.guides/2.first-party.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export default defineNuxtConfig({
6060
metaPixel: { id: '123456' },
6161

6262
// Infrastructure + global auto-load
63-
plausibleAnalytics: { domain: 'mysite.com', trigger: 'onNuxtReady' },
63+
plausibleAnalytics: { scriptId: 'YOUR_SCRIPT_ID', trigger: 'onNuxtReady' },
6464
}
6565
}
6666
})
@@ -137,7 +137,7 @@ export default defineNuxtConfig({
137137
scripts: {
138138
registry: {
139139
// Apply all privacy transforms to Plausible instead of its IP-only default
140-
plausibleAnalytics: { domain: 'mysite.com', privacy: true },
140+
plausibleAnalytics: { scriptId: 'YOUR_SCRIPT_ID', privacy: true },
141141
// IP-only for self-hosted PostHog where you control the data
142142
posthog: { apiKey: 'phc_xxx', privacy: { ip: true } },
143143
}
@@ -210,7 +210,7 @@ Disable proxying for a specific script using `proxy: false` in its registry conf
210210
exportdefaultdefineNuxtConfig({
211211
scripts: {
212212
registry: {
213-
plausibleAnalytics: { domain: 'mysite.com', proxy: false },
213+
plausibleAnalytics: { scriptId: 'YOUR_SCRIPT_ID', proxy: false },
214214
googleAnalytics: { id: 'G-XXXXXX' }, // still proxied
215215
}
216216
}

‎docs/content/docs/3.api/5.nuxt-config.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default defineNuxtConfig({
2121
// Infrastructure only (composable driven)
2222
googleAnalytics: { id: 'G-XXXXXX' },
2323
// Infrastructure + global auto-load
24-
plausibleAnalytics: { domain: 'mysite.com', trigger: 'onNuxtReady' },
24+
plausibleAnalytics: { scriptId: 'YOUR_SCRIPT_ID', trigger: 'onNuxtReady' },
2525
// Opt out of proxy
2626
posthog: { apiKey: 'phc_xxx', proxy: false },
2727
// Testing stub (no script loaded, validation skipped)

‎docs/content/docs/4.migration-guide/2.v1-to-v2.md‎

Lines changed: 71 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ other components.
1212

1313
| Dependency | Required version |
1414
|---|---|
15-
| Nuxt |`>=4.5.1`|
15+
|[Node.js](https://nodejs.org)|`>=24`|
16+
| Nuxt |`>=4.5.1`, including Nuxt 5 and Nitro 3 |
1617
|`@unhead/vue`|`>=3.3.1 <4`|
1718
|`unhead`|`>=3.3.1 <4`|
1819

@@ -22,9 +23,77 @@ Upgrade Nuxt and refresh its locked dependencies before installing v2:
2223
npx nuxi@latest upgrade --force
2324
```
2425

26+
Run the dedicated migration CLI from the project root. Preview its changes first
27+
if the project has dynamic Nuxt configuration:
28+
29+
```bash
30+
npx @nuxt/scripts-cli migrate v2 --dry-run
31+
npx @nuxt/scripts-cli migrate v2
32+
```
33+
34+
The CLI handles static registry configuration and mechanical API renames. It
35+
lists dynamic configuration and removed components that need manual follow-up.
36+
2537
The module now stops setup with an actionable error when either Unhead package
2638
is missing or outside the supported range.
2739

40+
## Registry configuration
41+
42+
Registry entries now accept a flat object, `'mock'`, or `false`. Nuxt Scripts 2
43+
removes the deprecated `true`, `'proxy-only'`, tuple, nested `scriptOptions`,
44+
and `reverseProxyIntercept` forms.
45+
46+
```diff
47+
scripts: {
48+
registry: {
49+
- googleAnalytics: true,
50+
- plausibleAnalytics: [{ scriptId: 'YOUR_SCRIPT_ID' }, { proxy: false }],
51+
- calendly: { scriptOptions: { bundle: false } },
52+
- posthog: { reverseProxyIntercept: false },
53+
+ googleAnalytics: { trigger: 'onNuxtReady' },
54+
+ plausibleAnalytics: { scriptId: 'YOUR_SCRIPT_ID', proxy: false },
55+
+ calendly: { bundle: false },
56+
+ posthog: { proxy: false },
57+
},
58+
}
59+
```
60+
61+
Nuxt Scripts 2 also removes the deprecated top-level `globals` array. Use a
62+
keyed object so each script has a stable name.
63+
64+
## Google Maps
65+
66+
Nuxt Scripts 2 removes these v1 compatibility aliases and components:
67+
68+
| Removed | Replacement |
69+
|---|---|
70+
|`center` and `zoom` props on `<ScriptGoogleMaps>`{lang="html"} |`mapOptions.center` and `mapOptions.zoom`|
71+
|`googleMaps` template ref key |`mapsApi`|
72+
|`overlay` template ref key |`overlayView`|
73+
|`<ScriptGoogleMapsAdvancedMarkerElement>`{lang="html"} |`<ScriptGoogleMapsMarker>`{lang="html"} |
74+
|`<ScriptGoogleMapsPinElement>`{lang="html"} | The marker `#content` slot |
75+
|`<ScriptGoogleMapsHeatmapLayer>`{lang="html"} | A maintained heatmap library such as deck.gl |
76+
77+
Google removed `HeatmapLayer` from Maps JavaScript API v3.65, so Nuxt Scripts
78+
no longer ships a component that depends on it.
79+
80+
Nuxt Scripts 2 removes the legacy `googleStaticMapsProxy` option and the
81+
billable Google Maps server proxies. Static maps load directly from Google with
82+
the public browser key. `resolveQueryToLatLng()`{lang="ts"} uses the client Places service.
83+
Apply website and API restrictions to the key, then configure quota limits.
84+
85+
## Registry APIs
86+
87+
Nuxt Scripts 2 removes these deprecated registry API shapes:
88+
89+
| Removed | Replacement |
90+
|---|---|
91+
|`proxy.rybbit.pageview()`{lang="ts"} |`proxy.pageview()`{lang="ts"} |
92+
|`proxy.ttq('page')`{lang="ts"} |`proxy.ttq.page()`{lang="ts"} |
93+
|`proxy.ttq('track', ...)`{lang="ts"} |`proxy.ttq.track(...)`{lang="ts"} |
94+
| Matomo `trackPageView` option |`watch`, which defaults to `true`|
95+
| Plausible `domain` and `extension` options |`scriptId` and current init options |
96+
2897
## Consumer scopes
2998

3099
Every `useScript()`{lang="ts"} call now returns an Unhead consumer scope.
@@ -42,7 +111,7 @@ longer necessary.
42111

43112
## Custom readiness callbacks
44113

45-
The legacy `use` option remains supported. Callback-driven SDKs should migrate
114+
The `use` option remains supported. Callback-driven SDKs should migrate
46115
to `resolve({ waitFor })`{lang="ts"}, which automatically removes listeners and
47116
rejects pending readiness when the script lifecycle ends.
48117

‎docs/content/scripts/google-maps/1.guides/7.billing.md‎

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ Enable only the APIs your implementation uses:
1111
|---|---|---|
1212
|[Maps JavaScript API](https://developers.google.com/maps/documentation/javascript/get-api-key)| Yes | Interactive map rendering |
1313
|[Maps Static API](https://developers.google.com/maps/documentation/maps-static/get-api-key)| Optional | A `<ScriptGoogleMapsStaticMap>`{lang="html"} image, including one placed in the `#placeholder` slot |
14-
|[Geocoding API](https://developers.google.com/maps/documentation/geocoding/guides-v3/get-api-key)| Optional | Server-side address resolution when you enable the Google Maps registry entry |
15-
|[Places API (Legacy)](https://developers.google.com/maps/documentation/javascript/legacy/places)| Optional | Client-side `findPlaceFromQuery` fallback when the geocoding proxy is unavailable |
14+
|[Places API (Legacy)](https://developers.google.com/maps/documentation/javascript/legacy/places)| Optional | Address resolution through `resolveQueryToLatLng()`{lang="ts"} |
1615

1716
The placeholder slot is empty by default, so a normal `<ScriptGoogleMaps>`{lang="html"} does not call the Maps Static API.
1817

@@ -24,8 +23,7 @@ Google charges each API by SKU and applies a separate monthly free usage cap to
2423
|---|---|---:|---:|---|
2524
| Load the interactive map | Dynamic Maps | 10,000 | $7 | Each time the Maps JavaScript API creates a map |
2625
| Load a static preview | Static Maps | 10,000 | $2 | Each `<ScriptGoogleMapsStaticMap>`{lang="html"} image request |
27-
| Resolve an address on the server | Geocoding | 10,000 | $5 | Each uncached Geocoding API request |
28-
| Resolve an address in the browser | Find Place (legacy) | 5,000 | $17 | When the proxy is unavailable and `resolveQueryToLatLng()`{lang="ts"} falls back to Places |
26+
| Resolve an address in the browser | Find Place (legacy) | 5,000 | $17 | Each `resolveQueryToLatLng()`{lang="ts"} lookup |
2927

3028
These are USD list prices for the first paid volume tier. Higher-volume tiers, regional pricing, and product changes can alter the total; check the [current Google Maps Platform price list](https://developers.google.com/maps/billing-and-pricing/pricing) before budgeting.
3129

@@ -39,17 +37,13 @@ Google replaced the old recurring $200 monthly credit with per-SKU free usage ca
3937

4038
**No default static request:**`<ScriptGoogleMaps>`{lang="html"} leaves its placeholder empty. Add `<ScriptGoogleMapsStaticMap>`{lang="html"} only when a map preview is worth the extra Static Maps event.
4139

42-
**Address resolution:**Registering Google Maps enables a server endpoint that uses the Geocoding API. Without that endpoint, `resolveQueryToLatLng()`{lang="ts"} falls back to the browser's Places library. Coordinates avoid either lookup.
40+
**Address resolution:**`resolveQueryToLatLng()`{lang="ts"} uses the browser's Places library. Coordinates avoid this lookup.
4341

44-
::callout{color="amber"}
45-
The current static-map proxy stores and serves Google map images from your server. Google's [Maps Platform FAQ](https://developers.google.com/maps/faq#static_map) says browser applications must load Static Maps images directly from Google and must not store and serve copies. Pass an explicit `api-key` to `<ScriptGoogleMapsStaticMap>`{lang="html"} to bypass the proxy, and review the current [Maps Platform Terms](https://cloud.google.com/maps-platform/terms) for your use case.
46-
::
47-
48-
Google's terms allow limited Geocoding result caching under specific conditions. The Nuxt endpoint caches upstream geocoding responses for 30 days, so confirm that your use meets the current [service-specific caching terms](https://cloud.google.com/maps-platform/terms/maps-service-terms#6.-geocoding-api).
42+
**Direct static maps:**`<ScriptGoogleMapsStaticMap>`{lang="html"} loads images directly from Google with a public browser key. Give it a separate key restricted to your website and the Maps Static API, or allow the shared registry key to access the Maps JavaScript API, Places API (Legacy), and Maps Static API.
4943

5044
## Cost Controls
5145

52-
1.**Use coordinates when you have them.** Pass `center` as `{ lat, lng }` instead of an address to avoid Geocoding or Places requests.
46+
1.**Use coordinates when you have them.** Pass `center` as `{ lat, lng }` instead of resolving an address through Places.
5347

5448
2.**Keep the default lazy trigger.** Use `trigger="immediate"` only when the map should start loading after hydration instead of waiting for an element interaction.
5549

@@ -79,4 +73,4 @@ For 100,000 monthly page views under the July 2026 global list prices:
7973
| Static preview on every view, no interaction | $180 |
8074
| Static preview on every view and 20% interact | $250 |
8175
82-
These examples apply each SKU's free usage cap and exclude geocoding, Places requests, taxes, negotiated discounts, and other projects on the same billing account.
76+
These examples apply each SKU's free usage cap and exclude Places requests, taxes, negotiated discounts, and other projects on the same billing account.

‎docs/content/scripts/google-maps/2.api/1.script-google-maps.md‎

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,28 +21,13 @@ The default events are `mouseenter`, `mouseover`, and `mousedown`.
2121

2222
See the [Facade Component API](/docs/guides/facade-components#facade-components-api) for all props, events, and slots.
2323

24-
::tip
25-
**Deprecated:** the top-level `center` and `zoom` props are now deprecated. Pass them via `mapOptions` instead. The legacy props still work and emit a dev-mode warning when used. `mapOptions.center` and `mapOptions.zoom` take precedence when both are set.
26-
27-
```vue
28-
<template>
29-
<!-- Before (deprecated) -->
30-
<ScriptGoogleMaps :center="{ lat, lng }" :zoom="12" />
31-
32-
<!-- After -->
33-
<ScriptGoogleMaps :map-options="{ center: { lat, lng }, zoom: 12 }" />
34-
</template>
35-
```
36-
::
37-
3824
## Template Ref API
3925

4026
Access the basic Google Maps instances via a template ref. The exposed object contains:
4127

4228
| Property | Type | Description |
4329
|----------|------|-------------|
4430
|`mapsApi`|`typeof google.maps \| undefined`{lang="html"} | The core Maps API namespace (`google.maps`). |
45-
|`googleMaps`|`typeof google.maps \| undefined`{lang="html"} |**Deprecated.** Alias for `mapsApi`; emits a dev-mode warning. Slated for removal in a future major version. |
4631
|`map`|`google.maps.Map \| undefined`{lang="html"} | The map instance. |
4732
|`resolveQueryToLatLng`|`(query) => Promise<google.maps.LatLng \| google.maps.LatLngLiteral \| undefined>`{lang="html"} | Geocode an address to coordinates. The promise rejects when Google returns no location or the request fails. |
4833
|`importLibrary`|`(name) => Promise<Library>`{lang="html"} | Load additional Google Maps libraries at runtime. |
@@ -66,7 +51,7 @@ async function flyToSydney() {
6651
</template>
6752
```
6853

69-
Vue unwraps the exposed refs when you access them through a component template ref, as in the example above. The `@ready` payload uses the raw exposed object, so its `mapsApi`, `googleMaps`, and `map` properties are `ShallowRef`s.
54+
Vue unwraps the exposed refs when you access them through a component template ref, as in the example above. The `@ready` payload uses the raw exposed object, so its `mapsApi` and `map` properties are `ShallowRef`s.
7055

7156
## Map events
7257

‎docs/content/scripts/google-maps/2.api/10.heatmap-layer.md‎

Lines changed: 0 additions & 128 deletions
This file was deleted.

0 commit comments

Comments
 (0)