@nuxt/scripts 1.0.0-beta.24 → 1.0.0-beta.26
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.
- package/dist/client/200.html +1 -1
- package/dist/client/404.html +1 -1
- package/dist/client/_nuxt/{Bh9fd9qr.js → C-7nRtzO.js} +1 -1
- package/dist/client/_nuxt/{UTi7FhVv.js → D5k4eN9O.js} +1 -1
- package/dist/client/_nuxt/DjhmCJlE.js +162 -0
- package/dist/client/_nuxt/{B7aPLMNo.js → TJ5JFHov.js} +1 -1
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/33e1ac0e-aba1-4856-8beb-775c426be236.json +1 -0
- package/dist/client/_nuxt/entry.C5SUNdim.css +1 -0
- package/dist/client/_nuxt/error-404.C_3_IG5y.css +1 -0
- package/dist/client/_nuxt/error-500.DSv6YikH.css +1 -0
- package/dist/client/index.html +1 -1
- package/dist/module.d.mts +6 -20
- package/dist/module.d.ts +6 -20
- package/dist/module.json +1 -1
- package/dist/module.mjs +303 -277
- package/dist/registry.mjs +121 -71
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.d.vue.ts +2 -5
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue +14 -15
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue.d.ts +2 -5
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.d.vue.ts +1 -4
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue +30 -37
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue.d.ts +1 -4
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsCircle.vue +19 -28
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.vue +18 -22
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsInfoWindow.vue +30 -37
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.d.vue.ts +1 -4
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.vue +31 -36
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.vue.d.ts +1 -4
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.vue +17 -22
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.vue +19 -28
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolygon.vue +19 -28
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolyline.vue +19 -28
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsRectangle.vue +19 -28
- package/dist/runtime/components/GoogleMaps/injectionKeys.d.ts +11 -0
- package/dist/runtime/components/GoogleMaps/injectionKeys.js +3 -0
- package/dist/runtime/components/GoogleMaps/useGoogleMapsResource.d.ts +26 -0
- package/dist/runtime/components/GoogleMaps/useGoogleMapsResource.js +37 -0
- package/dist/runtime/composables/useScriptTriggerConsent.d.ts +10 -0
- package/dist/runtime/composables/useScriptTriggerConsent.js +32 -19
- package/dist/runtime/registry/bing-uet.d.ts +20 -0
- package/dist/runtime/registry/bing-uet.js +29 -0
- package/dist/runtime/registry/bluesky-embed.d.ts +1 -1
- package/dist/runtime/registry/crisp.d.ts +1 -1
- package/dist/runtime/registry/fathom-analytics.d.ts +1 -1
- package/dist/runtime/registry/google-adsense.d.ts +1 -1
- package/dist/runtime/registry/hotjar.d.ts +1 -1
- package/dist/runtime/registry/instagram-embed.d.ts +1 -1
- package/dist/runtime/registry/intercom.d.ts +1 -1
- package/dist/runtime/registry/matomo-analytics.d.ts +1 -1
- package/dist/runtime/registry/meta-pixel.d.ts +1 -1
- package/dist/runtime/registry/mixpanel-analytics.d.ts +22 -0
- package/dist/runtime/registry/mixpanel-analytics.js +46 -0
- package/dist/runtime/registry/npm.d.ts +1 -1
- package/dist/runtime/registry/reddit-pixel.d.ts +1 -1
- package/dist/runtime/registry/schemas.d.ts +19 -0
- package/dist/runtime/registry/schemas.js +19 -0
- package/dist/runtime/registry/snapchat-pixel.d.ts +1 -1
- package/dist/runtime/registry/tiktok-pixel.d.ts +1 -1
- package/dist/runtime/registry/vercel-analytics.d.ts +1 -1
- package/dist/runtime/registry/x-embed.d.ts +1 -1
- package/dist/runtime/registry/x-pixel.d.ts +1 -1
- package/dist/runtime/server/proxy-handler.js +36 -23
- package/dist/runtime/server/utils/privacy.d.ts +1 -1
- package/dist/runtime/server/utils/privacy.js +3 -3
- package/dist/runtime/types.d.ts +30 -18
- package/dist/runtime/utils/pure.d.ts +1 -1
- package/dist/runtime/utils.js +1 -1
- package/dist/shared/scripts.ViOoYQXH.mjs +381 -0
- package/dist/stats.d.mts +95 -3
- package/dist/stats.d.ts +95 -3
- package/dist/stats.mjs +2845 -169
- package/dist/types-source.mjs +47 -0
- package/package.json +13 -13
- package/dist/client/_nuxt/BNNMZFwZ.js +0 -162
- package/dist/client/_nuxt/builds/meta/78647cef-f45a-4560-82b4-b9364815198a.json +0 -1
- package/dist/client/_nuxt/entry.CACgbLJl.css +0 -1
- package/dist/client/_nuxt/error-404.DMdWw4vT.css +0 -1
- package/dist/client/_nuxt/error-500.CROTF27X.css +0 -1
- package/dist/shared/scripts.Crpn87WB.mjs +0 -318
|
@@ -38,5 +38,5 @@ declare global {
|
|
|
38
38
|
interface Window extends SnapPixelApi {
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
export type SnapTrPixelInput = RegistryScriptInput<typeof SnapTrPixelOptions, true, false
|
|
41
|
+
export type SnapTrPixelInput = RegistryScriptInput<typeof SnapTrPixelOptions, true, false>;
|
|
42
42
|
export declare function useScriptSnapchatPixel<T extends SnapPixelApi>(_options?: SnapTrPixelInput): import("#nuxt-scripts/types").UseScriptContext<T>;
|
|
@@ -37,5 +37,5 @@ declare global {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
export { TikTokPixelOptions };
|
|
40
|
-
export type TikTokPixelInput = RegistryScriptInput<typeof TikTokPixelOptions, true, false
|
|
40
|
+
export type TikTokPixelInput = RegistryScriptInput<typeof TikTokPixelOptions, true, false>;
|
|
41
41
|
export declare function useScriptTikTokPixel<T extends TikTokPixelApi>(_options?: TikTokPixelInput): import("#nuxt-scripts/types").UseScriptContext<T>;
|
|
@@ -8,7 +8,7 @@ export interface BeforeSendEvent {
|
|
|
8
8
|
url: string;
|
|
9
9
|
}
|
|
10
10
|
export type BeforeSend = (event: BeforeSendEvent) => BeforeSendEvent | null;
|
|
11
|
-
export type VercelAnalyticsInput = RegistryScriptInput<typeof VercelAnalyticsOptions, false, false
|
|
11
|
+
export type VercelAnalyticsInput = RegistryScriptInput<typeof VercelAnalyticsOptions, false, false> & {
|
|
12
12
|
beforeSend?: BeforeSend;
|
|
13
13
|
};
|
|
14
14
|
export interface VercelAnalyticsApi {
|
|
@@ -48,7 +48,7 @@ export interface XEmbedTweetData {
|
|
|
48
48
|
};
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
export type XEmbedInput = RegistryScriptInput<typeof XEmbedOptions, false, false
|
|
51
|
+
export type XEmbedInput = RegistryScriptInput<typeof XEmbedOptions, false, false>;
|
|
52
52
|
/**
|
|
53
53
|
* Proxy an X/Twitter image URL through the server
|
|
54
54
|
*/
|
|
@@ -29,5 +29,5 @@ declare global {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
export { XPixelOptions };
|
|
32
|
-
export type XPixelInput = RegistryScriptInput<typeof XPixelOptions, true, false
|
|
32
|
+
export type XPixelInput = RegistryScriptInput<typeof XPixelOptions, true, false>;
|
|
33
33
|
export declare function useScriptXPixel<T extends XPixelApi>(_options?: XPixelInput): import("#nuxt-scripts/types").UseScriptContext<T>;
|
|
@@ -168,37 +168,50 @@ export default defineEventHandler(async (event) => {
|
|
|
168
168
|
} else if (typeof rawBody === "object") {
|
|
169
169
|
body = stripPayloadFingerprinting(rawBody, privacy);
|
|
170
170
|
} else if (typeof rawBody === "string") {
|
|
171
|
-
if (
|
|
172
|
-
let parsed = null;
|
|
173
|
-
try {
|
|
174
|
-
parsed = JSON.parse(rawBody);
|
|
175
|
-
} catch {
|
|
176
|
-
}
|
|
177
|
-
if (Array.isArray(parsed)) {
|
|
178
|
-
body = parsed.map(
|
|
179
|
-
(item) => item && typeof item === "object" && !Array.isArray(item) ? stripPayloadFingerprinting(item, privacy) : item
|
|
180
|
-
);
|
|
181
|
-
} else if (parsed && typeof parsed === "object") {
|
|
182
|
-
body = stripPayloadFingerprinting(parsed, privacy);
|
|
183
|
-
} else {
|
|
184
|
-
body = rawBody;
|
|
185
|
-
}
|
|
186
|
-
} else if (contentType.includes("application/x-www-form-urlencoded")) {
|
|
171
|
+
if (contentType.includes("application/x-www-form-urlencoded")) {
|
|
187
172
|
const params = new URLSearchParams(rawBody);
|
|
188
173
|
const obj = {};
|
|
189
|
-
params.
|
|
190
|
-
|
|
191
|
-
|
|
174
|
+
for (const [key, value] of params.entries()) {
|
|
175
|
+
if (key in obj) {
|
|
176
|
+
const existing = obj[key];
|
|
177
|
+
obj[key] = Array.isArray(existing) ? [...existing, value] : [existing, value];
|
|
178
|
+
} else {
|
|
179
|
+
obj[key] = value;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
192
182
|
const stripped = stripPayloadFingerprinting(obj, privacy);
|
|
193
|
-
const
|
|
183
|
+
const out = new URLSearchParams();
|
|
194
184
|
for (const [k, v] of Object.entries(stripped)) {
|
|
195
185
|
if (v === void 0 || v === null)
|
|
196
186
|
continue;
|
|
197
|
-
|
|
187
|
+
if (Array.isArray(v)) {
|
|
188
|
+
for (const item of v)
|
|
189
|
+
out.append(k, typeof item === "string" ? item : JSON.stringify(item));
|
|
190
|
+
} else {
|
|
191
|
+
out.append(k, typeof v === "string" ? v : JSON.stringify(v));
|
|
192
|
+
}
|
|
198
193
|
}
|
|
199
|
-
body =
|
|
194
|
+
body = out.toString();
|
|
200
195
|
} else {
|
|
201
|
-
|
|
196
|
+
const maybeJson = contentType.includes("json") || (rawBody.startsWith("{") || rawBody.startsWith("["));
|
|
197
|
+
if (maybeJson) {
|
|
198
|
+
let parsed = null;
|
|
199
|
+
try {
|
|
200
|
+
parsed = JSON.parse(rawBody);
|
|
201
|
+
} catch {
|
|
202
|
+
}
|
|
203
|
+
if (Array.isArray(parsed)) {
|
|
204
|
+
body = parsed.map(
|
|
205
|
+
(item) => item && typeof item === "object" && !Array.isArray(item) ? stripPayloadFingerprinting(item, privacy) : item
|
|
206
|
+
);
|
|
207
|
+
} else if (parsed && typeof parsed === "object") {
|
|
208
|
+
body = stripPayloadFingerprinting(parsed, privacy);
|
|
209
|
+
} else {
|
|
210
|
+
body = rawBody;
|
|
211
|
+
}
|
|
212
|
+
} else {
|
|
213
|
+
body = rawBody;
|
|
214
|
+
}
|
|
202
215
|
}
|
|
203
216
|
} else {
|
|
204
217
|
body = rawBody;
|
|
@@ -20,7 +20,7 @@ export interface ProxyPrivacy {
|
|
|
20
20
|
* Privacy input: `true` = full anonymize, `false` = passthrough (still strips sensitive headers),
|
|
21
21
|
* or a `ProxyPrivacy` object for granular control (unset flags default to `false` — opt-in).
|
|
22
22
|
*/
|
|
23
|
-
export type ProxyPrivacyInput = boolean | ProxyPrivacy
|
|
23
|
+
export type ProxyPrivacyInput = boolean | ProxyPrivacy;
|
|
24
24
|
/** Resolved privacy with all flags explicitly set. */
|
|
25
25
|
export type ResolvedProxyPrivacy = Required<ProxyPrivacy>;
|
|
26
26
|
/**
|
|
@@ -10,7 +10,7 @@ const LANG_CODE_RE = /^[a-z]{2}(?:-[a-z]{2,})?$/i;
|
|
|
10
10
|
export function resolvePrivacy(input) {
|
|
11
11
|
if (input === true)
|
|
12
12
|
return { ...FULL_PRIVACY };
|
|
13
|
-
if (input === false || input === void 0
|
|
13
|
+
if (input === false || input === void 0)
|
|
14
14
|
return { ...NO_PRIVACY };
|
|
15
15
|
return {
|
|
16
16
|
ip: input.ip ?? false,
|
|
@@ -22,7 +22,7 @@ export function resolvePrivacy(input) {
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
export function mergePrivacy(base, override) {
|
|
25
|
-
if (override === void 0
|
|
25
|
+
if (override === void 0)
|
|
26
26
|
return base;
|
|
27
27
|
if (typeof override === "boolean")
|
|
28
28
|
return resolvePrivacy(override);
|
|
@@ -288,7 +288,7 @@ export function stripPayloadFingerprinting(payload, privacy) {
|
|
|
288
288
|
continue;
|
|
289
289
|
}
|
|
290
290
|
if (matchesParam(key, STRIP_PARAMS.hardware)) {
|
|
291
|
-
result[key] = p.
|
|
291
|
+
result[key] = p.hardware ? generalizeHardware(value) : value;
|
|
292
292
|
continue;
|
|
293
293
|
}
|
|
294
294
|
if (matchesParam(key, STRIP_PARAMS.version)) {
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { Script } from '@unhead/vue/types';
|
|
|
3
3
|
import type { Import } from 'unimport';
|
|
4
4
|
import type { InferInput, ObjectSchema, UnionSchema, ValiError } from 'valibot';
|
|
5
5
|
import type { ComputedRef, Ref } from 'vue';
|
|
6
|
+
import type { BingUetInput } from './registry/bing-uet.js';
|
|
6
7
|
import type { BlueskyEmbedInput } from './registry/bluesky-embed.js';
|
|
7
8
|
import type { ClarityInput } from './registry/clarity.js';
|
|
8
9
|
import type { CloudflareWebAnalyticsInput } from './registry/cloudflare-web-analytics.js';
|
|
@@ -17,10 +18,12 @@ import type { GoogleSignInInput } from './registry/google-sign-in.js';
|
|
|
17
18
|
import type { GoogleTagManagerInput } from './registry/google-tag-manager.js';
|
|
18
19
|
import type { GravatarInput } from './registry/gravatar.js';
|
|
19
20
|
import type { HotjarInput } from './registry/hotjar.js';
|
|
21
|
+
import type { InstagramEmbedInput } from './registry/instagram-embed.js';
|
|
20
22
|
import type { IntercomInput } from './registry/intercom.js';
|
|
21
23
|
import type { LemonSqueezyInput } from './registry/lemon-squeezy.js';
|
|
22
24
|
import type { MatomoAnalyticsInput } from './registry/matomo-analytics.js';
|
|
23
25
|
import type { MetaPixelInput } from './registry/meta-pixel.js';
|
|
26
|
+
import type { MixpanelAnalyticsInput } from './registry/mixpanel-analytics.js';
|
|
24
27
|
import type { NpmInput } from './registry/npm.js';
|
|
25
28
|
import type { PayPalInput } from './registry/paypal.js';
|
|
26
29
|
import type { PlausibleAnalyticsInput } from './registry/plausible-analytics.js';
|
|
@@ -34,6 +37,7 @@ import type { TikTokPixelInput } from './registry/tiktok-pixel.js';
|
|
|
34
37
|
import type { UmamiAnalyticsInput } from './registry/umami-analytics.js';
|
|
35
38
|
import type { VercelAnalyticsInput } from './registry/vercel-analytics.js';
|
|
36
39
|
import type { VimeoPlayerInput } from './registry/vimeo-player.js';
|
|
40
|
+
import type { XEmbedInput } from './registry/x-embed.js';
|
|
37
41
|
import type { XPixelInput } from './registry/x-pixel.js';
|
|
38
42
|
import type { YouTubePlayerInput } from './registry/youtube-player.js';
|
|
39
43
|
export type WarmupStrategy = false | 'preload' | 'preconnect' | 'dns-prefetch';
|
|
@@ -156,13 +160,16 @@ export interface NuxtDevToolsScriptInstance {
|
|
|
156
160
|
}[];
|
|
157
161
|
}
|
|
158
162
|
export interface ScriptRegistry {
|
|
163
|
+
bingUet?: BingUetInput;
|
|
159
164
|
blueskyEmbed?: BlueskyEmbedInput;
|
|
165
|
+
carbonAds?: true;
|
|
160
166
|
crisp?: CrispInput;
|
|
161
167
|
clarity?: ClarityInput;
|
|
162
168
|
cloudflareWebAnalytics?: CloudflareWebAnalyticsInput;
|
|
163
169
|
databuddyAnalytics?: DatabuddyAnalyticsInput;
|
|
164
170
|
metaPixel?: MetaPixelInput;
|
|
165
171
|
fathomAnalytics?: FathomAnalyticsInput;
|
|
172
|
+
instagramEmbed?: InstagramEmbedInput;
|
|
166
173
|
plausibleAnalytics?: PlausibleAnalyticsInput;
|
|
167
174
|
googleAdsense?: GoogleAdsenseInput;
|
|
168
175
|
googleAnalytics?: GoogleAnalyticsInput;
|
|
@@ -176,11 +183,13 @@ export interface ScriptRegistry {
|
|
|
176
183
|
paypal?: PayPalInput;
|
|
177
184
|
posthog?: PostHogInput;
|
|
178
185
|
matomoAnalytics?: MatomoAnalyticsInput;
|
|
186
|
+
mixpanelAnalytics?: MixpanelAnalyticsInput;
|
|
179
187
|
rybbitAnalytics?: RybbitAnalyticsInput;
|
|
180
188
|
redditPixel?: RedditPixelInput;
|
|
181
189
|
segment?: SegmentInput;
|
|
182
190
|
stripe?: StripeInput;
|
|
183
191
|
tiktokPixel?: TikTokPixelInput;
|
|
192
|
+
xEmbed?: XEmbedInput;
|
|
184
193
|
xPixel?: XPixelInput;
|
|
185
194
|
snapchatPixel?: SnapTrPixelInput;
|
|
186
195
|
youtubePlayer?: YouTubePlayerInput;
|
|
@@ -188,9 +197,20 @@ export interface ScriptRegistry {
|
|
|
188
197
|
vimeoPlayer?: VimeoPlayerInput;
|
|
189
198
|
umamiAnalytics?: UmamiAnalyticsInput;
|
|
190
199
|
gravatar?: GravatarInput;
|
|
200
|
+
npm?: NpmInput;
|
|
191
201
|
[key: `${string}-npm`]: NpmInput;
|
|
192
202
|
}
|
|
193
|
-
|
|
203
|
+
/**
|
|
204
|
+
* Built-in registry script keys — not affected by module augmentation.
|
|
205
|
+
* Use this to type-check records that must enumerate all built-in scripts (logos, meta, etc.).
|
|
206
|
+
*/
|
|
207
|
+
export type BuiltInRegistryScriptKey = 'bingUet' | 'blueskyEmbed' | 'carbonAds' | 'crisp' | 'clarity' | 'cloudflareWebAnalytics' | 'databuddyAnalytics' | 'metaPixel' | 'fathomAnalytics' | 'instagramEmbed' | 'plausibleAnalytics' | 'googleAdsense' | 'googleAnalytics' | 'googleMaps' | 'googleRecaptcha' | 'googleSignIn' | 'lemonSqueezy' | 'googleTagManager' | 'hotjar' | 'intercom' | 'paypal' | 'posthog' | 'matomoAnalytics' | 'mixpanelAnalytics' | 'rybbitAnalytics' | 'redditPixel' | 'segment' | 'stripe' | 'tiktokPixel' | 'xEmbed' | 'xPixel' | 'snapchatPixel' | 'youtubePlayer' | 'vercelAnalytics' | 'vimeoPlayer' | 'umamiAnalytics' | 'gravatar' | 'npm';
|
|
208
|
+
/**
|
|
209
|
+
* Union of all explicit registry script keys (excludes npm pattern).
|
|
210
|
+
* Includes both built-in and augmented keys.
|
|
211
|
+
*/
|
|
212
|
+
export type RegistryScriptKey = Exclude<keyof ScriptRegistry, `${string}-npm`>;
|
|
213
|
+
export type NuxtConfigScriptRegistryEntry<T> = true | false | 'mock' | T | [T, NuxtUseScriptOptionsSerializable];
|
|
194
214
|
export type NuxtConfigScriptRegistry<T extends keyof ScriptRegistry = keyof ScriptRegistry> = Partial<{
|
|
195
215
|
[key in T]: NuxtConfigScriptRegistryEntry<ScriptRegistry[key]>;
|
|
196
216
|
}> & Record<string & {}, NuxtConfigScriptRegistryEntry<any>>;
|
|
@@ -201,21 +221,15 @@ declare const _emptyOptions: ObjectSchema<{}, undefined>;
|
|
|
201
221
|
export type EmptyOptionsSchema = typeof _emptyOptions;
|
|
202
222
|
type ScriptInput = Script;
|
|
203
223
|
export type InferIfSchema<T> = T extends ObjectSchema<any, any> | UnionSchema<any, any> ? InferInput<T> : T;
|
|
204
|
-
export
|
|
224
|
+
export interface RegistryScriptInputExtras<Bundelable extends boolean = true, Usable extends boolean = false> {
|
|
205
225
|
/**
|
|
206
226
|
* A unique key to use for the script, this can be used to load multiple of the same script with different options.
|
|
207
227
|
*/
|
|
208
228
|
key?: string;
|
|
209
229
|
scriptInput?: ScriptInput;
|
|
210
230
|
scriptOptions?: Omit<NuxtUseScriptOptions, Bundelable extends true ? '' : 'bundle' | Usable extends true ? '' : 'use'>;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
* A unique key to use for the script, this can be used to load multiple of the same script with different options.
|
|
214
|
-
*/
|
|
215
|
-
key?: string;
|
|
216
|
-
scriptInput: Required<Pick<ScriptInput, 'src'>> & ScriptInput;
|
|
217
|
-
scriptOptions?: Omit<NuxtUseScriptOptions, Bundelable extends true ? '' : 'bundle' | Usable extends true ? '' : 'use'>;
|
|
218
|
-
} : never);
|
|
231
|
+
}
|
|
232
|
+
export type RegistryScriptInput<T = EmptyOptionsSchema, Bundelable extends boolean = true, Usable extends boolean = false> = Partial<InferIfSchema<T>> & RegistryScriptInputExtras<Bundelable, Usable>;
|
|
219
233
|
export interface RegistryScriptServerHandler {
|
|
220
234
|
route: string;
|
|
221
235
|
handler: string;
|
|
@@ -226,20 +240,18 @@ export interface RegistryScript {
|
|
|
226
240
|
* The config key used in `scripts.registry` in nuxt.config (e.g., 'googleAnalytics', 'plausibleAnalytics').
|
|
227
241
|
* Used for direct lookup from config to script — avoids fragile import name convention matching.
|
|
228
242
|
*/
|
|
229
|
-
registryKey?:
|
|
243
|
+
registryKey?: RegistryScriptKey;
|
|
230
244
|
import?: Import;
|
|
231
245
|
scriptBundling?: false | ((options?: any) => string | false);
|
|
232
246
|
/**
|
|
233
|
-
* First-party
|
|
234
|
-
*
|
|
235
|
-
* - `false` - Explicitly disable first-party routing for this script
|
|
236
|
-
* - `undefined` - Use the default key derived from the function name
|
|
247
|
+
* First-party proxy config alias. Only needed when a script shares another script's
|
|
248
|
+
* proxy config (e.g., googleAdsense uses `proxy: 'googleAnalytics'`).
|
|
237
249
|
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
250
|
+
* By default, the proxy config is looked up by `registryKey`. Set to `false` to
|
|
251
|
+
* explicitly disable first-party routing for this script.
|
|
240
252
|
* @internal
|
|
241
253
|
*/
|
|
242
|
-
proxy?:
|
|
254
|
+
proxy?: RegistryScriptKey | false;
|
|
243
255
|
label?: string;
|
|
244
256
|
src?: string | false;
|
|
245
257
|
category?: string;
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
export interface ProxyRewrite {
|
|
5
5
|
/** Domain and path to match (e.g., 'www.google-analytics.com/g/collect') */
|
|
6
6
|
from: string;
|
|
7
|
-
/** Local path to rewrite to (e.g., '/_scripts/
|
|
7
|
+
/** Local path to rewrite to (e.g., '/_scripts/p/ga/g/collect') */
|
|
8
8
|
to: string;
|
|
9
9
|
}
|
package/dist/runtime/utils.js
CHANGED
|
@@ -32,7 +32,7 @@ export function requireRegistryEndpoint(componentName, registryKey) {
|
|
|
32
32
|
}
|
|
33
33
|
export function useRegistryScript(registryKey, optionsFn, _userOptions) {
|
|
34
34
|
const scriptConfig = scriptRuntimeConfig(registryKey);
|
|
35
|
-
const userOptions =
|
|
35
|
+
const userOptions = defu(_userOptions || {}, typeof scriptConfig === "object" ? scriptConfig : {});
|
|
36
36
|
const options = optionsFn(userOptions, { scriptInput: userOptions.scriptInput });
|
|
37
37
|
if (options.scriptMode === "npm") {
|
|
38
38
|
return createNpmScriptStub({
|