@nuxt/scripts 0.6.3 → 0.6.4
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 +8 -8
- package/dist/client/404.html +8 -8
- package/dist/client/_nuxt/{BeuDC-PU.js → B8kiEHWd.js} +11 -11
- package/dist/client/_nuxt/{zTM8DS5E.js → CE8XWCBP.js} +1 -1
- package/dist/client/_nuxt/{DZ6siU6J.js → DUCgB8kF.js} +1 -1
- package/dist/client/_nuxt/{Cg8NGlPg.js → DX8FDaDx.js} +1 -1
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/a56fe5f5-907d-4907-9967-836d6a0f3850.json +1 -0
- package/dist/client/_nuxt/error-404.-RjlvToe.css +1 -0
- package/dist/client/_nuxt/error-500.Bz7LXgZy.css +1 -0
- package/dist/client/index.html +8 -8
- package/dist/module.json +1 -1
- package/dist/module.mjs +84 -279
- package/dist/registry.mjs +33 -0
- package/dist/runtime/composables/useScript.js +1 -1
- package/dist/runtime/registry/clarity.js +1 -1
- package/dist/runtime/registry/cloudflare-web-analytics.js +1 -1
- package/dist/runtime/registry/crisp.d.ts +1 -1
- package/dist/runtime/registry/crisp.js +1 -1
- package/dist/runtime/registry/fathom-analytics.d.ts +1 -1
- package/dist/runtime/registry/fathom-analytics.js +1 -1
- package/dist/runtime/registry/google-adsense.d.ts +1 -1
- package/dist/runtime/registry/google-adsense.js +1 -1
- package/dist/runtime/registry/google-analytics.d.ts +13 -0
- package/dist/runtime/registry/google-analytics.js +31 -0
- package/dist/runtime/registry/google-maps.js +1 -1
- package/dist/runtime/registry/google-tag-manager.d.ts +13 -0
- package/dist/runtime/registry/google-tag-manager.js +27 -0
- package/dist/runtime/registry/hotjar.d.ts +1 -1
- package/dist/runtime/registry/hotjar.js +1 -1
- package/dist/runtime/registry/intercom.d.ts +1 -1
- package/dist/runtime/registry/intercom.js +1 -1
- package/dist/runtime/registry/lemon-squeezy.js +1 -1
- package/dist/runtime/registry/matomo-analytics.d.ts +1 -1
- package/dist/runtime/registry/matomo-analytics.js +1 -1
- package/dist/runtime/registry/meta-pixel.d.ts +1 -1
- package/dist/runtime/registry/meta-pixel.js +1 -1
- package/dist/runtime/registry/npm.d.ts +1 -1
- package/dist/runtime/registry/npm.js +1 -1
- package/dist/runtime/registry/plausible-analytics.js +1 -1
- package/dist/runtime/registry/segment.js +1 -1
- package/dist/runtime/registry/stripe.js +1 -1
- package/dist/runtime/registry/vimeo-player.js +1 -1
- package/dist/runtime/registry/x-pixel.d.ts +1 -1
- package/dist/runtime/registry/x-pixel.js +1 -1
- package/dist/runtime/registry/youtube-player.js +1 -1
- package/dist/runtime/types.d.ts +23 -7
- package/dist/runtime/utils.js +5 -1
- package/package.json +10 -9
- package/dist/client/_nuxt/builds/meta/9996546f-d612-4447-9ee7-fc387b136ee4.json +0 -1
- package/dist/client/_nuxt/error-404.DXyehy0d.css +0 -1
- package/dist/client/_nuxt/error-500.a_92Fvyl.css +0 -1
|
@@ -23,7 +23,7 @@ export const FathomAnalyticsOptions = object({
|
|
|
23
23
|
honorDnt: optional(boolean())
|
|
24
24
|
});
|
|
25
25
|
export function useScriptFathomAnalytics(_options) {
|
|
26
|
-
return useRegistryScript("fathomAnalytics", (options) => ({
|
|
26
|
+
return useRegistryScript(_options?.key || "fathomAnalytics", (options) => ({
|
|
27
27
|
scriptInput: {
|
|
28
28
|
src: "https://cdn.usefathom.com/script.js",
|
|
29
29
|
// can't be bundled
|
|
@@ -5,7 +5,7 @@ export declare const GoogleAdsenseOptions: import("valibot").ObjectSchema<{
|
|
|
5
5
|
*/
|
|
6
6
|
readonly client: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, never>;
|
|
7
7
|
}, undefined>;
|
|
8
|
-
export type GoogleAdsenseInput = RegistryScriptInput<typeof GoogleAdsenseOptions>;
|
|
8
|
+
export type GoogleAdsenseInput = RegistryScriptInput<typeof GoogleAdsenseOptions, true, false, false>;
|
|
9
9
|
export interface GoogleAdsenseApi {
|
|
10
10
|
/**
|
|
11
11
|
* The Google Adsense API.
|
|
@@ -9,7 +9,7 @@ export const GoogleAdsenseOptions = object({
|
|
|
9
9
|
client: optional(string())
|
|
10
10
|
});
|
|
11
11
|
export function useScriptGoogleAdsense(_options) {
|
|
12
|
-
return useRegistryScript("googleAdsense", (options) => ({
|
|
12
|
+
return useRegistryScript(_options?.key || "googleAdsense", (options) => ({
|
|
13
13
|
scriptInput: {
|
|
14
14
|
src: "https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"
|
|
15
15
|
},
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { GoogleAnalyticsApi } from 'third-party-capital';
|
|
2
|
+
import type { RegistryScriptInput } from '#nuxt-scripts';
|
|
3
|
+
export declare const GoogleAnalyticsOptions: import("valibot").ObjectSchema<{
|
|
4
|
+
readonly id: import("valibot").StringSchema<undefined>;
|
|
5
|
+
}, undefined>;
|
|
6
|
+
declare global {
|
|
7
|
+
interface Window extends GoogleAnalyticsApi {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export type GoogleAnalyticsInput = RegistryScriptInput<typeof GoogleAnalyticsOptions>;
|
|
11
|
+
export declare function useScriptGoogleAnalytics<T extends GoogleAnalyticsApi>(_options?: GoogleAnalyticsInput): T & {
|
|
12
|
+
$script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { withQuery } from "ufo";
|
|
2
|
+
import { useRegistryScript } from "#nuxt-scripts-utils";
|
|
3
|
+
import { object, string } from "#nuxt-scripts-validator";
|
|
4
|
+
export const GoogleAnalyticsOptions = object({ id: string() });
|
|
5
|
+
export function useScriptGoogleAnalytics(_options) {
|
|
6
|
+
return useRegistryScript(_options?.key || "google-analytics", (options) => ({
|
|
7
|
+
scriptInput: {
|
|
8
|
+
src: withQuery("https://www.googletagmanager.com/gtag/js", { id: options?.id })
|
|
9
|
+
},
|
|
10
|
+
schema: import.meta.dev ? void 0 : GoogleAnalyticsOptions,
|
|
11
|
+
scriptOptions: {
|
|
12
|
+
use: () => {
|
|
13
|
+
return { dataLayer: window.dataLayer, gtag: window.gtag };
|
|
14
|
+
},
|
|
15
|
+
stub: import.meta.client ? void 0 : ({ fn }) => {
|
|
16
|
+
return fn === "dataLayer" ? [] : void 0;
|
|
17
|
+
},
|
|
18
|
+
performanceMarkFeature: "nuxt-third-parties-ga",
|
|
19
|
+
...{ tagPriority: 1 }
|
|
20
|
+
},
|
|
21
|
+
// eslint-disable-next-line
|
|
22
|
+
clientInit: import.meta.server ? void 0 : () => {
|
|
23
|
+
window.dataLayer = window.dataLayer || [];
|
|
24
|
+
window.gtag = function gtag() {
|
|
25
|
+
window.dataLayer.push(arguments);
|
|
26
|
+
};
|
|
27
|
+
window.gtag("js", /* @__PURE__ */ new Date());
|
|
28
|
+
window.gtag("config", options.id);
|
|
29
|
+
}
|
|
30
|
+
}), _options);
|
|
31
|
+
}
|
|
@@ -8,7 +8,7 @@ export const GoogleMapsOptions = object({
|
|
|
8
8
|
});
|
|
9
9
|
export function useScriptGoogleMaps(_options) {
|
|
10
10
|
let readyPromise = Promise.resolve();
|
|
11
|
-
return useRegistryScript("googleMaps", (options) => {
|
|
11
|
+
return useRegistryScript(_options?.key || "googleMaps", (options) => {
|
|
12
12
|
const libraries = options?.libraries || ["places"];
|
|
13
13
|
return {
|
|
14
14
|
scriptInput: {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { GoogleTagManagerApi } from 'third-party-capital';
|
|
2
|
+
import type { RegistryScriptInput } from '#nuxt-scripts';
|
|
3
|
+
export declare const GoogleTagManagerOptions: import("valibot").ObjectSchema<{
|
|
4
|
+
readonly id: import("valibot").StringSchema<undefined>;
|
|
5
|
+
}, undefined>;
|
|
6
|
+
declare global {
|
|
7
|
+
interface Window extends GoogleTagManagerApi {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export type GoogleTagManagerInput = RegistryScriptInput<typeof GoogleTagManagerOptions>;
|
|
11
|
+
export declare function useScriptGoogleTagManager<T extends GoogleTagManagerApi>(_options?: GoogleTagManagerInput): T & {
|
|
12
|
+
$script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { withQuery } from "ufo";
|
|
2
|
+
import { useRegistryScript } from "#nuxt-scripts-utils";
|
|
3
|
+
import { object, string } from "#nuxt-scripts-validator";
|
|
4
|
+
export const GoogleTagManagerOptions = object({ id: string() });
|
|
5
|
+
export function useScriptGoogleTagManager(_options) {
|
|
6
|
+
return useRegistryScript(_options?.key || "google-tag-manager", (options) => ({
|
|
7
|
+
scriptInput: {
|
|
8
|
+
src: withQuery("https://www.googletagmanager.com/gtm.js", { id: options?.id })
|
|
9
|
+
},
|
|
10
|
+
schema: import.meta.dev ? void 0 : GoogleTagManagerOptions,
|
|
11
|
+
scriptOptions: {
|
|
12
|
+
use: () => {
|
|
13
|
+
return { dataLayer: window.dataLayer, google_tag_manager: window.google_tag_manager };
|
|
14
|
+
},
|
|
15
|
+
stub: import.meta.client ? void 0 : ({ fn }) => {
|
|
16
|
+
return fn === "dataLayer" ? [] : void 0;
|
|
17
|
+
},
|
|
18
|
+
performanceMarkFeature: "nuxt-third-parties-gtm",
|
|
19
|
+
...{ tagPriority: 1 }
|
|
20
|
+
},
|
|
21
|
+
// eslint-disable-next-line
|
|
22
|
+
clientInit: import.meta.server ? void 0 : () => {
|
|
23
|
+
window.dataLayer = window.dataLayer || [];
|
|
24
|
+
window.dataLayer.push({ "gtm.start": (/* @__PURE__ */ new Date()).getTime(), event: "gtm.js" });
|
|
25
|
+
}
|
|
26
|
+
}), _options);
|
|
27
|
+
}
|
|
@@ -16,7 +16,7 @@ export declare const HotjarOptions: import("valibot").ObjectSchema<{
|
|
|
16
16
|
readonly id: import("valibot").NumberSchema<undefined>;
|
|
17
17
|
readonly sv: import("valibot").OptionalSchema<import("valibot").NumberSchema<undefined>, never>;
|
|
18
18
|
}, undefined>;
|
|
19
|
-
export type HotjarInput = RegistryScriptInput<typeof HotjarOptions>;
|
|
19
|
+
export type HotjarInput = RegistryScriptInput<typeof HotjarOptions, true, false, false>;
|
|
20
20
|
export declare function useScriptHotjar<T extends HotjarApi>(_options?: HotjarInput): T & {
|
|
21
21
|
$script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
|
|
22
22
|
};
|
|
@@ -5,7 +5,7 @@ export const HotjarOptions = object({
|
|
|
5
5
|
sv: optional(number())
|
|
6
6
|
});
|
|
7
7
|
export function useScriptHotjar(_options) {
|
|
8
|
-
return useRegistryScript("hotjar", (options) => ({
|
|
8
|
+
return useRegistryScript(_options?.key || "hotjar", (options) => ({
|
|
9
9
|
scriptInput: {
|
|
10
10
|
src: `https://static.hotjar.com/c/hotjar-${options?.id}.js?sv=${options?.sv || 6}`
|
|
11
11
|
},
|
|
@@ -10,7 +10,7 @@ export declare const IntercomOptions: import("valibot").ObjectSchema<{
|
|
|
10
10
|
readonly horizontal_padding: import("valibot").OptionalSchema<import("valibot").NumberSchema<undefined>, never>;
|
|
11
11
|
readonly vertical_padding: import("valibot").OptionalSchema<import("valibot").NumberSchema<undefined>, never>;
|
|
12
12
|
}, undefined>;
|
|
13
|
-
export type IntercomInput = RegistryScriptInput<typeof IntercomOptions>;
|
|
13
|
+
export type IntercomInput = RegistryScriptInput<typeof IntercomOptions, true, false, false>;
|
|
14
14
|
export interface IntercomApi {
|
|
15
15
|
Intercom: ((event: 'boot', data?: InferInput<typeof IntercomOptions>) => void) & ((event: 'shutdown') => void) & ((event: 'update', options?: InferInput<typeof IntercomOptions>) => void) & ((event: 'hide') => void) & ((event: 'show') => void) & ((event: 'showSpace', spaceName: 'home' | 'messages' | 'help' | 'news' | 'tasks' | 'tickets' | string) => void) & ((event: 'showMessages') => void) & ((event: 'showNewMessage', content?: string) => void) & ((event: 'onHide', fn: () => void) => void) & ((event: 'onShow', fn: () => void) => void) & ((event: 'onUnreadCountChange', fn: () => void) => void) & ((event: 'trackEvent', eventName: string, metadata?: Record<string, any>) => void) & ((event: 'getVisitorId') => Promise<string>) & ((event: 'startTour', tourId: string | number) => void) & ((event: 'showArticle', articleId: string | number) => void) & ((event: 'showNews', newsItemId: string | number) => void) & ((event: 'startSurvey', surveyId: string | number) => void) & ((event: 'startChecklist', checklistId: string | number) => void) & ((event: 'showTicket', ticketId: string | number) => void) & ((event: 'showConversation', conversationId: string | number) => void) & ((event: 'onUserEmailSupplied', fn: () => void) => void) & ((event: string, ...params: any[]) => void);
|
|
16
16
|
}
|
|
@@ -13,7 +13,7 @@ export const IntercomOptions = object({
|
|
|
13
13
|
vertical_padding: optional(number())
|
|
14
14
|
});
|
|
15
15
|
export function useScriptIntercom(_options) {
|
|
16
|
-
return useRegistryScript("intercom", (options) => ({
|
|
16
|
+
return useRegistryScript(_options?.key || "intercom", (options) => ({
|
|
17
17
|
scriptInput: {
|
|
18
18
|
src: joinURL(`https://widget.intercom.io/widget`, options?.app_id || "")
|
|
19
19
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useRegistryScript } from "../utils.js";
|
|
2
2
|
export function useScriptLemonSqueezy(_options) {
|
|
3
|
-
return useRegistryScript("lemonSqueezy", () => ({
|
|
3
|
+
return useRegistryScript(_options?.key || "lemonSqueezy", () => ({
|
|
4
4
|
scriptInput: {
|
|
5
5
|
src: "https://assets.lemonsqueezy.com/lemon.js",
|
|
6
6
|
crossorigin: false
|
|
@@ -5,7 +5,7 @@ export declare const MatomoAnalyticsOptions: import("valibot").ObjectSchema<{
|
|
|
5
5
|
readonly trackPageView: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, never>;
|
|
6
6
|
readonly enableLinkTracking: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, never>;
|
|
7
7
|
}, undefined>;
|
|
8
|
-
export type MatomoAnalyticsInput = RegistryScriptInput<typeof MatomoAnalyticsOptions, false>;
|
|
8
|
+
export type MatomoAnalyticsInput = RegistryScriptInput<typeof MatomoAnalyticsOptions, false, false, false>;
|
|
9
9
|
interface MatomoAnalyticsApi {
|
|
10
10
|
_paq: unknown[];
|
|
11
11
|
}
|
|
@@ -9,7 +9,7 @@ export const MatomoAnalyticsOptions = object({
|
|
|
9
9
|
enableLinkTracking: optional(boolean())
|
|
10
10
|
});
|
|
11
11
|
export function useScriptMatomoAnalytics(_options) {
|
|
12
|
-
return useRegistryScript("matomoAnalytics", (options) => ({
|
|
12
|
+
return useRegistryScript(_options?.key || "matomoAnalytics", (options) => ({
|
|
13
13
|
scriptInput: {
|
|
14
14
|
src: withBase(`/matomo.js`, withHttps(options?.matomoUrl)),
|
|
15
15
|
crossorigin: false
|
|
@@ -35,7 +35,7 @@ declare global {
|
|
|
35
35
|
export declare const MetaPixelOptions: import("valibot").ObjectSchema<{
|
|
36
36
|
readonly id: import("valibot").UnionSchema<[import("valibot").StringSchema<undefined>, import("valibot").NumberSchema<undefined>], undefined>;
|
|
37
37
|
}, undefined>;
|
|
38
|
-
export type MetaPixelInput = RegistryScriptInput<typeof MetaPixelOptions>;
|
|
38
|
+
export type MetaPixelInput = RegistryScriptInput<typeof MetaPixelOptions, true, false, false>;
|
|
39
39
|
export declare function useScriptMetaPixel<T extends MetaPixelApi>(_options?: MetaPixelInput): T & {
|
|
40
40
|
$script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
|
|
41
41
|
};
|
|
@@ -4,7 +4,7 @@ export const MetaPixelOptions = object({
|
|
|
4
4
|
id: union([string(), number()])
|
|
5
5
|
});
|
|
6
6
|
export function useScriptMetaPixel(_options) {
|
|
7
|
-
return useRegistryScript("metaPixel", (options) => ({
|
|
7
|
+
return useRegistryScript(_options?.key || "metaPixel", (options) => ({
|
|
8
8
|
scriptInput: {
|
|
9
9
|
src: "https://connect.facebook.net/en_US/fbevents.js",
|
|
10
10
|
crossorigin: false
|
|
@@ -5,7 +5,7 @@ export declare const NpmOptions: import("valibot").ObjectSchema<{
|
|
|
5
5
|
readonly version: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, never>;
|
|
6
6
|
readonly type: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, never>;
|
|
7
7
|
}, undefined>;
|
|
8
|
-
export type NpmInput = RegistryScriptInput<typeof NpmOptions>;
|
|
8
|
+
export type NpmInput = RegistryScriptInput<typeof NpmOptions, true, true, false>;
|
|
9
9
|
export declare function useScriptNpm<T extends Record<string | symbol, any>>(_options: NpmInput): T & {
|
|
10
10
|
$script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
|
|
11
11
|
};
|
|
@@ -8,7 +8,7 @@ export const NpmOptions = object({
|
|
|
8
8
|
type: optional(string())
|
|
9
9
|
});
|
|
10
10
|
export function useScriptNpm(_options) {
|
|
11
|
-
return useRegistryScript(`${_options.packageName}-npm`, (options) => ({
|
|
11
|
+
return useRegistryScript(_options?.key || `${_options.packageName}-npm`, (options) => ({
|
|
12
12
|
scriptInput: {
|
|
13
13
|
src: withBase(options.file || "", `https://unpkg.com/${options?.packageName}@${options.version || "latest"}`)
|
|
14
14
|
},
|
|
@@ -17,7 +17,7 @@ export const PlausibleAnalyticsOptions = object({
|
|
|
17
17
|
extension: optional(union([union(extensions), array(union(extensions))]))
|
|
18
18
|
});
|
|
19
19
|
export function useScriptPlausibleAnalytics(_options) {
|
|
20
|
-
return useRegistryScript("plausibleAnalytics", (options) => {
|
|
20
|
+
return useRegistryScript(_options?.key || "plausibleAnalytics", (options) => {
|
|
21
21
|
const extensions2 = Array.isArray(options?.extension) ? options.extension.join(".") : [options?.extension];
|
|
22
22
|
return {
|
|
23
23
|
scriptInput: {
|
|
@@ -7,7 +7,7 @@ export const SegmentOptions = object({
|
|
|
7
7
|
});
|
|
8
8
|
const methods = ["track", "page", "identify", "group", "alias", "reset"];
|
|
9
9
|
export function useScriptSegment(_options) {
|
|
10
|
-
return useRegistryScript("segment", (options) => {
|
|
10
|
+
return useRegistryScript(_options?.key || "segment", (options) => {
|
|
11
11
|
const k = options?.analyticsKey ?? "analytics";
|
|
12
12
|
return {
|
|
13
13
|
scriptInput: {
|
|
@@ -5,7 +5,7 @@ export const StripeOptions = object({
|
|
|
5
5
|
advancedFraudSignals: optional(boolean())
|
|
6
6
|
});
|
|
7
7
|
export function useScriptStripe(_options) {
|
|
8
|
-
return useRegistryScript("stripe", (options) => ({
|
|
8
|
+
return useRegistryScript(_options?.key || "stripe", (options) => ({
|
|
9
9
|
scriptInput: {
|
|
10
10
|
src: withQuery(
|
|
11
11
|
`https://js.stripe.com/v3/`,
|
|
@@ -2,7 +2,7 @@ import { watch } from "vue";
|
|
|
2
2
|
import { useRegistryScript } from "../utils.js";
|
|
3
3
|
import { useHead } from "#imports";
|
|
4
4
|
export function useScriptVimeoPlayer(_options) {
|
|
5
|
-
const instance = useRegistryScript("vimeoPlayer", () => ({
|
|
5
|
+
const instance = useRegistryScript(_options?.key || "vimeoPlayer", () => ({
|
|
6
6
|
scriptInput: {
|
|
7
7
|
src: "https://player.vimeo.com/api/player.js"
|
|
8
8
|
},
|
|
@@ -31,7 +31,7 @@ export declare const XPixelOptions: import("valibot").ObjectSchema<{
|
|
|
31
31
|
readonly id: import("valibot").StringSchema<undefined>;
|
|
32
32
|
readonly version: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, never>;
|
|
33
33
|
}, undefined>;
|
|
34
|
-
export type XPixelInput = RegistryScriptInput<typeof XPixelOptions>;
|
|
34
|
+
export type XPixelInput = RegistryScriptInput<typeof XPixelOptions, true, false, false>;
|
|
35
35
|
export declare function useScriptXPixel<T extends XPixelApi>(_options?: XPixelInput): T & {
|
|
36
36
|
$script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
|
|
37
37
|
};
|
|
@@ -5,7 +5,7 @@ export const XPixelOptions = object({
|
|
|
5
5
|
version: optional(string())
|
|
6
6
|
});
|
|
7
7
|
export function useScriptXPixel(_options) {
|
|
8
|
-
return useRegistryScript("xPixel", (options) => {
|
|
8
|
+
return useRegistryScript(_options?.key || "xPixel", (options) => {
|
|
9
9
|
return {
|
|
10
10
|
scriptInput: {
|
|
11
11
|
src: "https://static.ads-twitter.com/uwt.js",
|
|
@@ -3,7 +3,7 @@ import { useRegistryScript } from "../utils.js";
|
|
|
3
3
|
import { useHead } from "#imports";
|
|
4
4
|
export function useScriptYouTubePlayer(_options) {
|
|
5
5
|
let readyPromise = Promise.resolve();
|
|
6
|
-
const instance = useRegistryScript("youtubePlayer", () => ({
|
|
6
|
+
const instance = useRegistryScript(_options?.key || "youtubePlayer", () => ({
|
|
7
7
|
scriptInput: {
|
|
8
8
|
src: "https://www.youtube.com/iframe_api",
|
|
9
9
|
crossorigin: false
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { UseScriptOptions, DataKeys, SchemaAugmentations, ScriptBase } from '@unhead/schema';
|
|
2
|
-
import type { UseScriptInput, VueScriptInstance
|
|
2
|
+
import type { UseScriptInput, VueScriptInstance } from '@unhead/vue';
|
|
3
3
|
import type { ComputedRef, Ref } from 'vue';
|
|
4
4
|
import type { InferInput, ObjectSchema } from 'valibot';
|
|
5
5
|
import type { Import } from 'unimport';
|
|
@@ -21,8 +21,8 @@ import type { LemonSqueezyInput } from './registry/lemon-squeezy.js';
|
|
|
21
21
|
import type { GoogleAdsenseInput } from './registry/google-adsense.js';
|
|
22
22
|
import type { ClarityInput } from './registry/clarity.js';
|
|
23
23
|
import type { CrispInput } from './registry/crisp.js';
|
|
24
|
-
import type {
|
|
25
|
-
import type {
|
|
24
|
+
import type { GoogleAnalyticsInput } from './registry/google-analytics.js';
|
|
25
|
+
import type { GoogleTagManagerInput } from './registry/google-tag-manager.js';
|
|
26
26
|
export type NuxtUseScriptOptions<T = any> = Omit<UseScriptOptions<T>, 'trigger'> & {
|
|
27
27
|
/**
|
|
28
28
|
* The trigger to load the script:
|
|
@@ -44,6 +44,10 @@ export type NuxtUseScriptOptions<T = any> = Omit<UseScriptOptions<T>, 'trigger'>
|
|
|
44
44
|
* loading the actual script and not getting warnings.
|
|
45
45
|
*/
|
|
46
46
|
skipValidation?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
performanceMarkFeature?: string;
|
|
47
51
|
};
|
|
48
52
|
export type NuxtUseScriptOptionsSerializable = Omit<NuxtUseScriptOptions, 'use' | 'skipValidation' | 'stub' | 'trigger' | 'eventContext' | 'beforeInit'> & {
|
|
49
53
|
trigger?: 'client' | 'server' | 'onNuxtReady';
|
|
@@ -106,10 +110,22 @@ export type NuxtConfigScriptRegistry<T extends keyof ScriptRegistry = keyof Scri
|
|
|
106
110
|
}>;
|
|
107
111
|
declare const emptyOptions: ObjectSchema<{}, undefined>;
|
|
108
112
|
export type EmptyOptionsSchema = typeof emptyOptions;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
+
type ScriptInput = ScriptBase & DataKeys & SchemaAugmentations['script'];
|
|
114
|
+
export type RegistryScriptInput<T extends ObjectSchema<any, any> = EmptyOptionsSchema, Bundelable extends boolean = true, Usable extends boolean = false, CanBypassOptions extends boolean = true> = (InferInput<T> & {
|
|
115
|
+
/**
|
|
116
|
+
* A unique key to use for the script, this can be used to load multiple of the same script with different options.
|
|
117
|
+
*/
|
|
118
|
+
key?: string;
|
|
119
|
+
scriptInput?: ScriptInput;
|
|
120
|
+
scriptOptions?: Omit<NuxtUseScriptOptions, Bundelable extends true ? '' : 'bundle' | Usable extends true ? '' : 'use'>;
|
|
121
|
+
}) | Partial<InferInput<T>> & (CanBypassOptions extends true ? {
|
|
122
|
+
/**
|
|
123
|
+
* A unique key to use for the script, this can be used to load multiple of the same script with different options.
|
|
124
|
+
*/
|
|
125
|
+
key?: string;
|
|
126
|
+
scriptInput: Required<Pick<ScriptInput, 'src'>> & ScriptInput;
|
|
127
|
+
scriptOptions?: Omit<NuxtUseScriptOptions, Bundelable extends true ? '' : 'bundle' | Usable extends true ? '' : 'use'>;
|
|
128
|
+
} : never);
|
|
113
129
|
export interface RegistryScript {
|
|
114
130
|
import?: Import;
|
|
115
131
|
scriptBundling?: false | ((options?: any) => string | false);
|
package/dist/runtime/utils.js
CHANGED
|
@@ -23,7 +23,11 @@ export function useRegistryScript(key, optionsFn, _userOptions) {
|
|
|
23
23
|
const scriptOptions = Object.assign(userOptions?.scriptOptions || {}, options.scriptOptions || {});
|
|
24
24
|
const init = scriptOptions.beforeInit;
|
|
25
25
|
scriptOptions.beforeInit = () => {
|
|
26
|
-
import.meta.dev && !scriptOptions.skipValidation && options.schema
|
|
26
|
+
if (import.meta.dev && !scriptOptions.skipValidation && options.schema) {
|
|
27
|
+
if (!userOptions.scriptInput?.src) {
|
|
28
|
+
validateScriptInputSchema(key, options.schema, userOptions);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
27
31
|
init?.();
|
|
28
32
|
if (import.meta.client) {
|
|
29
33
|
options.clientInit?.();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/scripts",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.4",
|
|
5
5
|
"packageManager": "pnpm@9.5.0",
|
|
6
6
|
"description": "Load third-party scripts with better performance, privacy and DX in Nuxt Apps.",
|
|
7
7
|
"author": {
|
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
"lint": "eslint .",
|
|
49
49
|
"lint:fix": "eslint . --fix",
|
|
50
50
|
"test": "vitest",
|
|
51
|
-
"test:types": "npx nuxi typecheck"
|
|
51
|
+
"test:types": "npx nuxi typecheck",
|
|
52
|
+
"script:generate-tpc": "bun ./scripts/generateTpcScripts.ts && pnpm lint:fix"
|
|
52
53
|
},
|
|
53
54
|
"build": {
|
|
54
55
|
"externals": [
|
|
@@ -59,8 +60,8 @@
|
|
|
59
60
|
"third-party-capital",
|
|
60
61
|
"knitwork",
|
|
61
62
|
"estree-walker",
|
|
62
|
-
"#build/nuxt-scripts
|
|
63
|
-
"#build/nuxt-scripts
|
|
63
|
+
"#build/modules/nuxt-scripts-gtm",
|
|
64
|
+
"#build/modules/nuxt-scripts-ga",
|
|
64
65
|
"@vimeo/player",
|
|
65
66
|
"esbuild"
|
|
66
67
|
]
|
|
@@ -73,9 +74,8 @@
|
|
|
73
74
|
"@types/stripe-v3": "^3.1.33",
|
|
74
75
|
"@types/vimeo__player": "^2.18.3",
|
|
75
76
|
"@types/youtube": "^0.0.50",
|
|
76
|
-
"@unhead/vue": "^1.9.
|
|
77
|
+
"@unhead/vue": "^1.9.16",
|
|
77
78
|
"@vueuse/core": "^10.11.0",
|
|
78
|
-
"acorn": "^8.12.1",
|
|
79
79
|
"consola": "^3.2.3",
|
|
80
80
|
"defu": "^6.1.4",
|
|
81
81
|
"h3": "^1.12.0",
|
|
@@ -103,11 +103,11 @@
|
|
|
103
103
|
"@nuxt/test-utils": "3.13.1",
|
|
104
104
|
"@types/semver": "^7.5.8",
|
|
105
105
|
"@typescript-eslint/typescript-estree": "^7.16.0",
|
|
106
|
-
"@unhead/schema": "^1.9.
|
|
106
|
+
"@unhead/schema": "^1.9.16",
|
|
107
107
|
"acorn-loose": "^8.4.0",
|
|
108
108
|
"bumpp": "^9.4.1",
|
|
109
109
|
"changelogen": "^0.5.5",
|
|
110
|
-
"eslint": "9.
|
|
110
|
+
"eslint": "9.7.0",
|
|
111
111
|
"eslint-plugin-n": "^17.9.0",
|
|
112
112
|
"knitwork": "^1.1.0",
|
|
113
113
|
"nuxt": "^3.12.3",
|
|
@@ -123,6 +123,7 @@
|
|
|
123
123
|
"nuxt": "^3.12.3",
|
|
124
124
|
"nuxt-scripts-devtools": "workspace:*",
|
|
125
125
|
"vue": "^3.4.31",
|
|
126
|
-
"vue-router": "^4.4.0"
|
|
126
|
+
"vue-router": "^4.4.0",
|
|
127
|
+
"shiki": "1.10.3"
|
|
127
128
|
}
|
|
128
129
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"id":"9996546f-d612-4447-9ee7-fc387b136ee4","timestamp":1720689465442,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.spotlight[data-v-3d041961]{background:linear-gradient(45deg,#00dc82,#36e4da 50%,#0047e1);bottom:-30vh;filter:blur(20vh);height:40vh}.gradient-border[data-v-3d041961]{-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border-radius:.5rem;position:relative}@media (prefers-color-scheme:light){.gradient-border[data-v-3d041961]{background-color:#ffffff4d}.gradient-border[data-v-3d041961]:before{background:linear-gradient(90deg,#e2e2e2,#e2e2e2 25%,#00dc82,#36e4da 75%,#0047e1)}}@media (prefers-color-scheme:dark){.gradient-border[data-v-3d041961]{background-color:#1414144d}.gradient-border[data-v-3d041961]:before{background:linear-gradient(90deg,#303030,#303030 25%,#00dc82,#36e4da 75%,#0047e1)}}.gradient-border[data-v-3d041961]:before{background-size:400% auto;border-radius:.5rem;bottom:0;content:"";left:0;-webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);-webkit-mask-composite:xor;mask-composite:exclude;opacity:.5;padding:2px;position:absolute;right:0;top:0;transition:background-position .3s ease-in-out,opacity .2s ease-in-out;width:100%}.gradient-border[data-v-3d041961]:hover:before{background-position:-50% 0;opacity:1}.fixed[data-v-3d041961]{position:fixed}.left-0[data-v-3d041961]{left:0}.right-0[data-v-3d041961]{right:0}.z-10[data-v-3d041961]{z-index:10}.z-20[data-v-3d041961]{z-index:20}.grid[data-v-3d041961]{display:grid}.mb-16[data-v-3d041961]{margin-bottom:4rem}.mb-8[data-v-3d041961]{margin-bottom:2rem}.max-w-520px[data-v-3d041961]{max-width:520px}.min-h-screen[data-v-3d041961]{min-height:100vh}.w-full[data-v-3d041961]{width:100%}.flex[data-v-3d041961]{display:flex}.cursor-pointer[data-v-3d041961]{cursor:pointer}.place-content-center[data-v-3d041961]{place-content:center}.items-center[data-v-3d041961]{align-items:center}.justify-center[data-v-3d041961]{justify-content:center}.overflow-hidden[data-v-3d041961]{overflow:hidden}.bg-white[data-v-3d041961]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-4[data-v-3d041961]{padding-left:1rem;padding-right:1rem}.px-8[data-v-3d041961]{padding-left:2rem;padding-right:2rem}.py-2[data-v-3d041961]{padding-bottom:.5rem;padding-top:.5rem}.text-center[data-v-3d041961]{text-align:center}.text-8xl[data-v-3d041961]{font-size:6rem;line-height:1}.text-xl[data-v-3d041961]{font-size:1.25rem;line-height:1.75rem}.text-black[data-v-3d041961]{--un-text-opacity:1;color:rgb(0 0 0/var(--un-text-opacity))}.font-light[data-v-3d041961]{font-weight:300}.font-medium[data-v-3d041961]{font-weight:500}.leading-tight[data-v-3d041961]{line-height:1.25}.font-sans[data-v-3d041961]{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.antialiased[data-v-3d041961]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (prefers-color-scheme:dark){.dark\:bg-black[data-v-3d041961]{--un-bg-opacity:1;background-color:rgb(0 0 0/var(--un-bg-opacity))}.dark\:text-white[data-v-3d041961]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media (min-width:640px){.sm\:px-0[data-v-3d041961]{padding-left:0;padding-right:0}.sm\:px-6[data-v-3d041961]{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-3[data-v-3d041961]{padding-bottom:.75rem;padding-top:.75rem}.sm\:text-4xl[data-v-3d041961]{font-size:2.25rem;line-height:2.5rem}.sm\:text-xl[data-v-3d041961]{font-size:1.25rem;line-height:1.75rem}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.spotlight[data-v-0e0e2529]{background:linear-gradient(45deg,#00dc82,#36e4da 50%,#0047e1);filter:blur(20vh)}.fixed[data-v-0e0e2529]{position:fixed}.-bottom-1\/2[data-v-0e0e2529]{bottom:-50%}.left-0[data-v-0e0e2529]{left:0}.right-0[data-v-0e0e2529]{right:0}.grid[data-v-0e0e2529]{display:grid}.mb-16[data-v-0e0e2529]{margin-bottom:4rem}.mb-8[data-v-0e0e2529]{margin-bottom:2rem}.h-1\/2[data-v-0e0e2529]{height:50%}.max-w-520px[data-v-0e0e2529]{max-width:520px}.min-h-screen[data-v-0e0e2529]{min-height:100vh}.place-content-center[data-v-0e0e2529]{place-content:center}.overflow-hidden[data-v-0e0e2529]{overflow:hidden}.bg-white[data-v-0e0e2529]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-8[data-v-0e0e2529]{padding-left:2rem;padding-right:2rem}.text-center[data-v-0e0e2529]{text-align:center}.text-8xl[data-v-0e0e2529]{font-size:6rem;line-height:1}.text-xl[data-v-0e0e2529]{font-size:1.25rem;line-height:1.75rem}.text-black[data-v-0e0e2529]{--un-text-opacity:1;color:rgb(0 0 0/var(--un-text-opacity))}.font-light[data-v-0e0e2529]{font-weight:300}.font-medium[data-v-0e0e2529]{font-weight:500}.leading-tight[data-v-0e0e2529]{line-height:1.25}.font-sans[data-v-0e0e2529]{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.antialiased[data-v-0e0e2529]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (prefers-color-scheme:dark){.dark\:bg-black[data-v-0e0e2529]{--un-bg-opacity:1;background-color:rgb(0 0 0/var(--un-bg-opacity))}.dark\:text-white[data-v-0e0e2529]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media (min-width:640px){.sm\:px-0[data-v-0e0e2529]{padding-left:0;padding-right:0}.sm\:text-4xl[data-v-0e0e2529]{font-size:2.25rem;line-height:2.5rem}}
|