@nuxt/scripts 0.6.2 → 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.
Files changed (100) hide show
  1. package/dist/client/200.html +43 -43
  2. package/dist/client/404.html +43 -43
  3. package/dist/client/_nuxt/{G-Jz5hiA.js → 0ooBkv16.js} +1 -1
  4. package/dist/client/_nuxt/{CNkYXcD4.js → 1rqFXsGc.js} +2 -2
  5. package/dist/client/_nuxt/B8kiEHWd.js +31 -0
  6. package/dist/client/_nuxt/{BOnd8D4O.js → BB42E8aY.js} +3 -3
  7. package/dist/client/_nuxt/{GPY1wEXZ.js → BBBqETUW.js} +1 -1
  8. package/dist/client/_nuxt/{Buoqr_Oi.js → BMHPAh1U.js} +1 -1
  9. package/dist/client/_nuxt/BVLuctcA.js +1 -0
  10. package/dist/client/_nuxt/BVkeqZ59.js +1 -0
  11. package/dist/client/_nuxt/{DISxKEhY.js → Bdt_eLrj.js} +1 -1
  12. package/dist/client/_nuxt/{Dez-Qvcc.js → BeJnKnI_.js} +2 -2
  13. package/dist/client/_nuxt/{DG8tVHNj.js → Bi43K_FX.js} +1 -1
  14. package/dist/client/_nuxt/{BdfWgkoX.js → BnyYJeap.js} +1 -1
  15. package/dist/client/_nuxt/{wKgfcFVx.js → C1yTBzia.js} +1 -1
  16. package/dist/client/_nuxt/{o-cPXEvd.js → CBWrHyXe.js} +89 -84
  17. package/dist/client/_nuxt/CCqFro8U.js +3 -0
  18. package/dist/client/_nuxt/{C2pTd85Q.js → CE8XWCBP.js} +1 -1
  19. package/dist/client/_nuxt/CFF2d1j6.js +1 -0
  20. package/dist/client/_nuxt/{Lpdzc9s2.js → CJGKC1_q.js} +1 -1
  21. package/dist/client/_nuxt/{CcYwH0AH.js → CJIaz0BQ.js} +1 -1
  22. package/dist/client/_nuxt/CO7HdiM_.js +1 -0
  23. package/dist/client/_nuxt/Cb-F_BZP.js +1 -0
  24. package/dist/client/_nuxt/CgwOUXSn.js +1 -0
  25. package/dist/client/_nuxt/ChH25C4w.js +1 -0
  26. package/dist/client/_nuxt/{D4FSFK-1.js → D33OKbkv.js} +1 -1
  27. package/dist/client/_nuxt/{YdT6Gj0u.js → D7WeZTai.js} +1 -1
  28. package/dist/client/_nuxt/{DUdlC5k_.js → DJubGRtk.js} +1 -1
  29. package/dist/client/_nuxt/{C5gCGmDW.js → DK4oFTHQ.js} +1 -1
  30. package/dist/client/_nuxt/DM4HHECw.js +1 -0
  31. package/dist/client/_nuxt/DOqtC9FP.js +1 -0
  32. package/dist/client/_nuxt/{RyEv5ndP.js → DUCgB8kF.js} +1 -1
  33. package/dist/client/_nuxt/DV9JwLIa.js +1 -0
  34. package/dist/client/_nuxt/{BN0jYG70.js → DX8FDaDx.js} +1 -1
  35. package/dist/client/_nuxt/{zhgf4ixb.js → DrnZp123.js} +2 -2
  36. package/dist/client/_nuxt/{COIrKlfF.js → ECt0lbkd.js} +1 -1
  37. package/dist/client/_nuxt/builds/latest.json +1 -1
  38. package/dist/client/_nuxt/builds/meta/a56fe5f5-907d-4907-9967-836d6a0f3850.json +1 -0
  39. package/dist/client/_nuxt/cw46T5ID.js +61 -0
  40. package/dist/client/_nuxt/error-404.-RjlvToe.css +1 -0
  41. package/dist/client/_nuxt/error-500.Bz7LXgZy.css +1 -0
  42. package/dist/client/_nuxt/{D_T9yQUo.js → kuh6G-Sk.js} +2 -2
  43. package/dist/client/_nuxt/qxoleWdb.js +1 -0
  44. package/dist/client/_nuxt/{xtV5iK4E.js → yX2IItqj.js} +1 -1
  45. package/dist/client/index.html +43 -43
  46. package/dist/module.json +1 -1
  47. package/dist/module.mjs +84 -280
  48. package/dist/registry.mjs +33 -0
  49. package/dist/runtime/composables/useScript.js +1 -1
  50. package/dist/runtime/registry/clarity.js +1 -1
  51. package/dist/runtime/registry/cloudflare-web-analytics.js +1 -1
  52. package/dist/runtime/registry/crisp.d.ts +1 -1
  53. package/dist/runtime/registry/crisp.js +1 -1
  54. package/dist/runtime/registry/fathom-analytics.d.ts +1 -1
  55. package/dist/runtime/registry/fathom-analytics.js +1 -1
  56. package/dist/runtime/registry/google-adsense.d.ts +1 -1
  57. package/dist/runtime/registry/google-adsense.js +1 -1
  58. package/dist/runtime/registry/google-analytics.d.ts +13 -0
  59. package/dist/runtime/registry/google-analytics.js +31 -0
  60. package/dist/runtime/registry/google-maps.js +1 -1
  61. package/dist/runtime/registry/google-tag-manager.d.ts +13 -0
  62. package/dist/runtime/registry/google-tag-manager.js +27 -0
  63. package/dist/runtime/registry/hotjar.d.ts +1 -1
  64. package/dist/runtime/registry/hotjar.js +1 -1
  65. package/dist/runtime/registry/intercom.d.ts +1 -1
  66. package/dist/runtime/registry/intercom.js +1 -1
  67. package/dist/runtime/registry/lemon-squeezy.js +1 -1
  68. package/dist/runtime/registry/matomo-analytics.d.ts +1 -1
  69. package/dist/runtime/registry/matomo-analytics.js +1 -1
  70. package/dist/runtime/registry/meta-pixel.d.ts +1 -1
  71. package/dist/runtime/registry/meta-pixel.js +1 -1
  72. package/dist/runtime/registry/npm.d.ts +1 -1
  73. package/dist/runtime/registry/npm.js +1 -1
  74. package/dist/runtime/registry/plausible-analytics.js +1 -1
  75. package/dist/runtime/registry/segment.js +1 -1
  76. package/dist/runtime/registry/stripe.js +1 -1
  77. package/dist/runtime/registry/vimeo-player.js +1 -1
  78. package/dist/runtime/registry/x-pixel.d.ts +1 -1
  79. package/dist/runtime/registry/x-pixel.js +1 -1
  80. package/dist/runtime/registry/youtube-player.js +1 -1
  81. package/dist/runtime/types.d.ts +23 -7
  82. package/dist/runtime/utils.js +5 -1
  83. package/package.json +15 -14
  84. package/dist/client/_nuxt/B2BuIiKK.js +0 -1
  85. package/dist/client/_nuxt/B474tPdy.js +0 -66
  86. package/dist/client/_nuxt/BJn7Ek5W.js +0 -1
  87. package/dist/client/_nuxt/Bfj2ThZ4.js +0 -3
  88. package/dist/client/_nuxt/BmSZh3NL.js +0 -1
  89. package/dist/client/_nuxt/BrGg7AAd.js +0 -1
  90. package/dist/client/_nuxt/CBL0qBdF.js +0 -1
  91. package/dist/client/_nuxt/CHCTrc3a.js +0 -1
  92. package/dist/client/_nuxt/CIekO_uJ.js +0 -1
  93. package/dist/client/_nuxt/D7gg1Usp.js +0 -1
  94. package/dist/client/_nuxt/DDRuGeQH.js +0 -1
  95. package/dist/client/_nuxt/DKGhHdqV.js +0 -31
  96. package/dist/client/_nuxt/Djqq6n-7.js +0 -1
  97. package/dist/client/_nuxt/Dkb1Nx48.js +0 -1
  98. package/dist/client/_nuxt/builds/meta/45651e0f-66c7-4ff4-acab-e2f5a76c99b2.json +0 -1
  99. package/dist/client/_nuxt/error-404.DXyehy0d.css +0 -1
  100. package/dist/client/_nuxt/error-500.a_92Fvyl.css +0 -1
@@ -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
@@ -1,5 +1,5 @@
1
1
  import type { UseScriptOptions, DataKeys, SchemaAugmentations, ScriptBase } from '@unhead/schema';
2
- import type { UseScriptInput, VueScriptInstance, MaybeComputedRefEntriesOnly } from '@unhead/vue';
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 { Input as GoogleTagManagerInput } from '#build/nuxt-scripts/tpc/google-tag-manager';
25
- import type { Input as GoogleAnalyticsInput } from '#build/nuxt-scripts/tpc/google-analytics';
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
- export type RegistryScriptInput<T extends ObjectSchema<any, any> = EmptyOptionsSchema, Bundelable extends boolean = true> = InferInput<T> & {
110
- scriptInput?: MaybeComputedRefEntriesOnly<Omit<ScriptBase & DataKeys & SchemaAugmentations['script'], 'src'>>;
111
- scriptOptions?: Bundelable extends true ? Omit<NuxtUseScriptOptions, 'use'> : Omit<NuxtUseScriptOptions, 'bundle' | 'use'>;
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);
@@ -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 && validateScriptInputSchema(key, options.schema, userOptions);
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,8 +1,8 @@
1
1
  {
2
2
  "name": "@nuxt/scripts",
3
3
  "type": "module",
4
- "version": "0.6.2",
5
- "packageManager": "pnpm@9.4.0",
4
+ "version": "0.6.4",
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": {
8
8
  "website": "https://harlanzw.com",
@@ -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/tpc/google-tag-manager",
63
- "#build/nuxt-scripts/tpc/google-analytics",
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.15",
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",
@@ -86,7 +86,7 @@
86
86
  "pathe": "^1.1.2",
87
87
  "pkg-types": "^1.1.3",
88
88
  "semver": "^7.6.2",
89
- "shiki": "^1.10.1",
89
+ "shiki": "^1.10.3",
90
90
  "sirv": "^2.0.4",
91
91
  "std-env": "^3.7.0",
92
92
  "third-party-capital": "^1.0.31",
@@ -97,24 +97,24 @@
97
97
  "valibot": "^0.36.0"
98
98
  },
99
99
  "devDependencies": {
100
- "nuxt-scripts-devtools": "workspace:*",
101
100
  "@nuxt/devtools-ui-kit": "^1.3.9",
102
101
  "@nuxt/eslint-config": "^0.3.13",
103
102
  "@nuxt/module-builder": "^0.8.1",
104
103
  "@nuxt/test-utils": "3.13.1",
105
104
  "@types/semver": "^7.5.8",
106
- "@typescript-eslint/typescript-estree": "^7.15.0",
107
- "@unhead/schema": "^1.9.15",
105
+ "@typescript-eslint/typescript-estree": "^7.16.0",
106
+ "@unhead/schema": "^1.9.16",
108
107
  "acorn-loose": "^8.4.0",
109
108
  "bumpp": "^9.4.1",
110
109
  "changelogen": "^0.5.5",
111
- "eslint": "9.6.0",
110
+ "eslint": "9.7.0",
112
111
  "eslint-plugin-n": "^17.9.0",
113
112
  "knitwork": "^1.1.0",
114
113
  "nuxt": "^3.12.3",
114
+ "nuxt-scripts-devtools": "workspace:*",
115
115
  "playwright-core": "^1.45.1",
116
116
  "typescript": "^5.5.3",
117
- "vitest": "^1.6.0",
117
+ "vitest": "^2.0.2",
118
118
  "vue": "^3.4.31",
119
119
  "vue-router": "^4.4.0"
120
120
  },
@@ -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
- var e=Object.freeze({colors:{"activityBar.activeBorder":"#80CBC4","activityBar.background":"#263238","activityBar.border":"#26323860","activityBar.dropBackground":"#f0717880","activityBar.foreground":"#EEFFFF","activityBarBadge.background":"#80CBC4","activityBarBadge.foreground":"#000000","badge.background":"#00000030","badge.foreground":"#546E7A","breadcrumb.activeSelectionForeground":"#80CBC4","breadcrumb.background":"#263238","breadcrumb.focusForeground":"#EEFFFF","breadcrumb.foreground":"#6c8692","breadcrumbPicker.background":"#263238","button.background":"#80CBC420","button.foreground":"#ffffff","debugConsole.errorForeground":"#f07178","debugConsole.infoForeground":"#89DDFF","debugConsole.warningForeground":"#FFCB6B","debugToolBar.background":"#263238","diffEditor.insertedTextBackground":"#89DDFF20","diffEditor.removedTextBackground":"#ff9cac20","dropdown.background":"#263238","dropdown.border":"#FFFFFF10","editor.background":"#263238","editor.findMatchBackground":"#000000","editor.findMatchBorder":"#80CBC4","editor.findMatchHighlight":"#EEFFFF","editor.findMatchHighlightBackground":"#00000050","editor.findMatchHighlightBorder":"#ffffff30","editor.findRangeHighlightBackground":"#FFCB6B30","editor.foreground":"#EEFFFF","editor.lineHighlightBackground":"#00000050","editor.lineHighlightBorder":"#00000000","editor.rangeHighlightBackground":"#FFFFFF0d","editor.selectionBackground":"#80CBC420","editor.selectionHighlightBackground":"#FFCC0020","editor.wordHighlightBackground":"#ff9cac30","editor.wordHighlightStrongBackground":"#C3E88D30","editorBracketMatch.background":"#263238","editorBracketMatch.border":"#FFCC0050","editorCursor.foreground":"#FFCC00","editorError.foreground":"#f0717870","editorGroup.border":"#00000030","editorGroup.dropBackground":"#f0717880","editorGroup.focusedEmptyBorder":"#f07178","editorGroupHeader.tabsBackground":"#263238","editorGutter.addedBackground":"#C3E88D60","editorGutter.deletedBackground":"#f0717860","editorGutter.modifiedBackground":"#82AAFF60","editorHoverWidget.background":"#263238","editorHoverWidget.border":"#FFFFFF10","editorIndentGuide.activeBackground":"#37474F","editorIndentGuide.background":"#37474F70","editorInfo.foreground":"#82AAFF70","editorLineNumber.activeForeground":"#6c8692","editorLineNumber.foreground":"#465A64","editorLink.activeForeground":"#EEFFFF","editorMarkerNavigation.background":"#EEFFFF05","editorOverviewRuler.border":"#263238","editorOverviewRuler.errorForeground":"#f0717840","editorOverviewRuler.findMatchForeground":"#80CBC4","editorOverviewRuler.infoForeground":"#82AAFF40","editorOverviewRuler.warningForeground":"#FFCB6B40","editorRuler.foreground":"#37474F","editorSuggestWidget.background":"#263238","editorSuggestWidget.border":"#FFFFFF10","editorSuggestWidget.foreground":"#EEFFFF","editorSuggestWidget.highlightForeground":"#80CBC4","editorSuggestWidget.selectedBackground":"#00000050","editorWarning.foreground":"#FFCB6B70","editorWhitespace.foreground":"#EEFFFF40","editorWidget.background":"#263238","editorWidget.border":"#80CBC4","editorWidget.resizeBorder":"#80CBC4","extensionBadge.remoteForeground":"#EEFFFF","extensionButton.prominentBackground":"#C3E88D90","extensionButton.prominentForeground":"#EEFFFF","extensionButton.prominentHoverBackground":"#C3E88D",focusBorder:"#FFFFFF00",foreground:"#EEFFFF","gitDecoration.conflictingResourceForeground":"#FFCB6B90","gitDecoration.deletedResourceForeground":"#f0717890","gitDecoration.ignoredResourceForeground":"#6c869290","gitDecoration.modifiedResourceForeground":"#82AAFF90","gitDecoration.untrackedResourceForeground":"#C3E88D90","input.background":"#303C41","input.border":"#FFFFFF10","input.foreground":"#EEFFFF","input.placeholderForeground":"#EEFFFF60","inputOption.activeBackground":"#EEFFFF30","inputOption.activeBorder":"#EEFFFF30","inputValidation.errorBorder":"#f07178","inputValidation.infoBorder":"#82AAFF","inputValidation.warningBorder":"#FFCB6B","list.activeSelectionBackground":"#263238","list.activeSelectionForeground":"#80CBC4","list.dropBackground":"#f0717880","list.focusBackground":"#EEFFFF20","list.focusForeground":"#EEFFFF","list.highlightForeground":"#80CBC4","list.hoverBackground":"#263238","list.hoverForeground":"#FFFFFF","list.inactiveSelectionBackground":"#00000030","list.inactiveSelectionForeground":"#80CBC4","listFilterWidget.background":"#00000030","listFilterWidget.noMatchesOutline":"#00000030","listFilterWidget.outline":"#00000030","menu.background":"#263238","menu.foreground":"#EEFFFF","menu.selectionBackground":"#00000050","menu.selectionBorder":"#00000030","menu.selectionForeground":"#80CBC4","menu.separatorBackground":"#EEFFFF","menubar.selectionBackground":"#00000030","menubar.selectionBorder":"#00000030","menubar.selectionForeground":"#80CBC4","notebook.focusedCellBorder":"#80CBC4","notebook.inactiveFocusedCellBorder":"#80CBC450","notificationLink.foreground":"#80CBC4","notifications.background":"#263238","notifications.foreground":"#EEFFFF","panel.background":"#263238","panel.border":"#26323860","panel.dropBackground":"#EEFFFF","panelTitle.activeBorder":"#80CBC4","panelTitle.activeForeground":"#FFFFFF","panelTitle.inactiveForeground":"#EEFFFF","peekView.border":"#00000030","peekViewEditor.background":"#EEFFFF05","peekViewEditor.matchHighlightBackground":"#80CBC420","peekViewEditorGutter.background":"#EEFFFF05","peekViewResult.background":"#EEFFFF05","peekViewResult.matchHighlightBackground":"#80CBC420","peekViewResult.selectionBackground":"#6c869270","peekViewTitle.background":"#EEFFFF05","peekViewTitleDescription.foreground":"#EEFFFF60","pickerGroup.border":"#FFFFFF1a","pickerGroup.foreground":"#80CBC4","progressBar.background":"#80CBC4","quickInput.background":"#263238","quickInput.foreground":"#6c8692","quickInput.list.focusBackground":"#EEFFFF20","sash.hoverBorder":"#80CBC450","scrollbar.shadow":"#00000030","scrollbarSlider.activeBackground":"#80CBC4","scrollbarSlider.background":"#EEFFFF20","scrollbarSlider.hoverBackground":"#EEFFFF10","selection.background":"#00000080","settings.checkboxBackground":"#263238","settings.checkboxForeground":"#EEFFFF","settings.dropdownBackground":"#263238","settings.dropdownForeground":"#EEFFFF","settings.headerForeground":"#80CBC4","settings.modifiedItemIndicator":"#80CBC4","settings.numberInputBackground":"#263238","settings.numberInputForeground":"#EEFFFF","settings.textInputBackground":"#263238","settings.textInputForeground":"#EEFFFF","sideBar.background":"#263238","sideBar.border":"#26323860","sideBar.foreground":"#6c8692","sideBarSectionHeader.background":"#263238","sideBarSectionHeader.border":"#26323860","sideBarTitle.foreground":"#EEFFFF","statusBar.background":"#263238","statusBar.border":"#26323860","statusBar.debuggingBackground":"#C792EA","statusBar.debuggingForeground":"#ffffff","statusBar.foreground":"#546E7A","statusBar.noFolderBackground":"#263238","statusBarItem.activeBackground":"#f0717880","statusBarItem.hoverBackground":"#546E7A20","statusBarItem.remoteBackground":"#80CBC4","statusBarItem.remoteForeground":"#000000","tab.activeBackground":"#263238","tab.activeBorder":"#80CBC4","tab.activeForeground":"#FFFFFF","tab.activeModifiedBorder":"#6c8692","tab.border":"#263238","tab.inactiveBackground":"#263238","tab.inactiveForeground":"#6c8692","tab.inactiveModifiedBorder":"#904348","tab.unfocusedActiveBorder":"#546E7A","tab.unfocusedActiveForeground":"#EEFFFF","tab.unfocusedActiveModifiedBorder":"#c05a60","tab.unfocusedInactiveModifiedBorder":"#904348","terminal.ansiBlack":"#000000","terminal.ansiBlue":"#82AAFF","terminal.ansiBrightBlack":"#546E7A","terminal.ansiBrightBlue":"#82AAFF","terminal.ansiBrightCyan":"#89DDFF","terminal.ansiBrightGreen":"#C3E88D","terminal.ansiBrightMagenta":"#C792EA","terminal.ansiBrightRed":"#f07178","terminal.ansiBrightWhite":"#ffffff","terminal.ansiBrightYellow":"#FFCB6B","terminal.ansiCyan":"#89DDFF","terminal.ansiGreen":"#C3E88D","terminal.ansiMagenta":"#C792EA","terminal.ansiRed":"#f07178","terminal.ansiWhite":"#ffffff","terminal.ansiYellow":"#FFCB6B","terminalCursor.background":"#000000","terminalCursor.foreground":"#FFCB6B","textLink.activeForeground":"#EEFFFF","textLink.foreground":"#80CBC4","titleBar.activeBackground":"#263238","titleBar.activeForeground":"#EEFFFF","titleBar.border":"#26323860","titleBar.inactiveBackground":"#263238","titleBar.inactiveForeground":"#6c8692","tree.indentGuidesStroke":"#37474F","widget.shadow":"#00000030"},displayName:"Material Theme",name:"material-theme",semanticHighlighting:!0,tokenColors:[{settings:{background:"#263238",foreground:"#EEFFFF"}},{scope:"string",settings:{foreground:"#C3E88D"}},{scope:"punctuation, constant.other.symbol",settings:{foreground:"#89DDFF"}},{scope:"constant.character.escape, text.html constant.character.entity.named",settings:{foreground:"#EEFFFF"}},{scope:"constant.language.boolean",settings:{foreground:"#ff9cac"}},{scope:"constant.numeric",settings:{foreground:"#F78C6C"}},{scope:"variable, variable.parameter, support.variable, variable.language, support.constant, meta.definition.variable entity.name.function, meta.function-call.arguments",settings:{foreground:"#EEFFFF"}},{scope:"keyword.other",settings:{foreground:"#F78C6C"}},{scope:"keyword, modifier, variable.language.this, support.type.object, constant.language",settings:{foreground:"#89DDFF"}},{scope:"entity.name.function, support.function",settings:{foreground:"#82AAFF"}},{scope:"storage.type, storage.modifier, storage.control",settings:{foreground:"#C792EA"}},{scope:"support.module, support.node",settings:{fontStyle:"italic",foreground:"#f07178"}},{scope:"support.type, constant.other.key",settings:{foreground:"#FFCB6B"}},{scope:"entity.name.type, entity.other.inherited-class, entity.other",settings:{foreground:"#FFCB6B"}},{scope:"comment",settings:{fontStyle:"italic",foreground:"#546E7A"}},{scope:"comment punctuation.definition.comment, string.quoted.docstring",settings:{fontStyle:"italic",foreground:"#546E7A"}},{scope:"punctuation",settings:{foreground:"#89DDFF"}},{scope:"entity.name, entity.name.type.class, support.type, support.class, meta.use",settings:{foreground:"#FFCB6B"}},{scope:"variable.object.property, meta.field.declaration entity.name.function",settings:{foreground:"#f07178"}},{scope:"meta.definition.method entity.name.function",settings:{foreground:"#f07178"}},{scope:"meta.function entity.name.function",settings:{foreground:"#82AAFF"}},{scope:"template.expression.begin, template.expression.end, punctuation.definition.template-expression.begin, punctuation.definition.template-expression.end",settings:{foreground:"#89DDFF"}},{scope:"meta.embedded, source.groovy.embedded, meta.template.expression",settings:{foreground:"#EEFFFF"}},{scope:"entity.name.tag.yaml",settings:{foreground:"#f07178"}},{scope:"meta.object-literal.key, meta.object-literal.key string, support.type.property-name.json",settings:{foreground:"#f07178"}},{scope:"constant.language.json",settings:{foreground:"#89DDFF"}},{scope:"entity.other.attribute-name.class",settings:{foreground:"#FFCB6B"}},{scope:"entity.other.attribute-name.id",settings:{foreground:"#F78C6C"}},{scope:"source.css entity.name.tag",settings:{foreground:"#FFCB6B"}},{scope:"support.type.property-name.css",settings:{foreground:"#B2CCD6"}},{scope:"meta.tag, punctuation.definition.tag",settings:{foreground:"#89DDFF"}},{scope:"entity.name.tag",settings:{foreground:"#f07178"}},{scope:"entity.other.attribute-name",settings:{foreground:"#C792EA"}},{scope:"punctuation.definition.entity.html",settings:{foreground:"#EEFFFF"}},{scope:"markup.heading",settings:{foreground:"#89DDFF"}},{scope:"text.html.markdown meta.link.inline, meta.link.reference",settings:{foreground:"#f07178"}},{scope:"text.html.markdown beginning.punctuation.definition.list",settings:{foreground:"#89DDFF"}},{scope:"markup.italic",settings:{fontStyle:"italic",foreground:"#f07178"}},{scope:"markup.bold",settings:{fontStyle:"bold",foreground:"#f07178"}},{scope:"markup.bold markup.italic, markup.italic markup.bold",settings:{fontStyle:"italic bold",foreground:"#f07178"}},{scope:"markup.fenced_code.block.markdown punctuation.definition.markdown",settings:{foreground:"#C3E88D"}},{scope:"markup.inline.raw.string.markdown",settings:{foreground:"#C3E88D"}},{scope:"keyword.other.definition.ini",settings:{foreground:"#f07178"}},{scope:"entity.name.section.group-title.ini",settings:{foreground:"#89DDFF"}},{scope:"source.cs meta.class.identifier storage.type",settings:{foreground:"#FFCB6B"}},{scope:"source.cs meta.method.identifier entity.name.function",settings:{foreground:"#f07178"}},{scope:"source.cs meta.method-call meta.method, source.cs entity.name.function",settings:{foreground:"#82AAFF"}},{scope:"source.cs storage.type",settings:{foreground:"#FFCB6B"}},{scope:"source.cs meta.method.return-type",settings:{foreground:"#FFCB6B"}},{scope:"source.cs meta.preprocessor",settings:{foreground:"#546E7A"}},{scope:"source.cs entity.name.type.namespace",settings:{foreground:"#EEFFFF"}},{scope:"meta.jsx.children, SXNested",settings:{foreground:"#EEFFFF"}},{scope:"support.class.component",settings:{foreground:"#FFCB6B"}},{scope:"source.cpp meta.block variable.other",settings:{foreground:"#EEFFFF"}},{scope:"source.python meta.member.access.python",settings:{foreground:"#f07178"}},{scope:"source.python meta.function-call.python, meta.function-call.arguments",settings:{foreground:"#82AAFF"}},{scope:"meta.block",settings:{foreground:"#f07178"}},{scope:"entity.name.function.call",settings:{foreground:"#82AAFF"}},{scope:"source.php support.other.namespace, source.php meta.use support.class",settings:{foreground:"#EEFFFF"}},{scope:"constant.keyword",settings:{fontStyle:"italic",foreground:"#89DDFF"}},{scope:"entity.name.function",settings:{foreground:"#82AAFF"}},{settings:{background:"#263238",foreground:"#EEFFFF"}},{scope:["constant.other.placeholder"],settings:{foreground:"#f07178"}},{scope:["markup.deleted"],settings:{foreground:"#f07178"}},{scope:["markup.inserted"],settings:{foreground:"#C3E88D"}},{scope:["markup.underline"],settings:{fontStyle:"underline"}},{scope:["keyword.control"],settings:{fontStyle:"italic",foreground:"#89DDFF"}},{scope:["variable.parameter"],settings:{fontStyle:"italic"}},{scope:["variable.parameter.function.language.special.self.python"],settings:{fontStyle:"italic",foreground:"#f07178"}},{scope:["constant.character.format.placeholder.other.python"],settings:{foreground:"#F78C6C"}},{scope:["markup.quote"],settings:{fontStyle:"italic",foreground:"#89DDFF"}},{scope:["markup.fenced_code.block"],settings:{foreground:"#EEFFFF90"}},{scope:["punctuation.definition.quote"],settings:{foreground:"#ff9cac"}},{scope:["meta.structure.dictionary.json support.type.property-name.json"],settings:{foreground:"#C792EA"}},{scope:["meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json"],settings:{foreground:"#FFCB6B"}},{scope:["meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json"],settings:{foreground:"#F78C6C"}},{scope:["meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json"],settings:{foreground:"#f07178"}},{scope:["meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json"],settings:{foreground:"#916b53"}},{scope:["meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json"],settings:{foreground:"#82AAFF"}},{scope:["meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json"],settings:{foreground:"#ff9cac"}},{scope:["meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json"],settings:{foreground:"#C792EA"}},{scope:["meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json"],settings:{foreground:"#C3E88D"}}],type:"dark"});export{e as default};
@@ -1,66 +0,0 @@
1
- const e=Object.freeze({displayName:"GDScript",fileTypes:["gd"],name:"gdscript",patterns:[{include:"#statement"},{include:"#expression"}],repository:{annotated_parameter:{begin:`(?x)
2
- \\s* ([a-zA-Z_]\\w*) \\s* (:)\\s* ([a-zA-Z_]\\w*)?
3
- `,beginCaptures:{1:{name:"variable.parameter.function.language.gdscript"},2:{name:"punctuation.separator.annotation.gdscript"},3:{name:"entity.name.type.class.gdscript"}},end:"(,)|(?=\\))",endCaptures:{1:{name:"punctuation.separator.parameters.gdscript"}},patterns:[{include:"#base_expression"},{match:"=(?!=)",name:"keyword.operator.assignment.gdscript"}]},annotations:{captures:{1:{name:"entity.name.function.decorator.gdscript"},2:{name:"entity.name.function.decorator.gdscript"}},match:"(@)(export|export_color_no_alpha|export_dir|export_enum|export_exp_easing|export_file|export_flags|export_flags_2d_navigation|export_flags_2d_physics|export_flags_2d_render|export_flags_3d_navigation|export_flags_3d_physics|export_flags_3d_render|export_global_dir|export_global_file|export_multiline|export_node_path|export_placeholder|export_range|icon|onready|rpc|tool|warning_ignore|abstract)\\b"},any_method:{match:"\\b([A-Za-z_]\\w*)\\b(?=\\s*(?:[(]))",name:"support.function.any-method.gdscript"},any_property:{captures:{1:{name:"punctuation.accessor.gdscript"},2:{name:"constant.language.gdscript"},3:{name:"variable.other.property.gdscript"}},match:"\\b(\\.)\\s*(?<![@\\$#%])(?:([A-Z_][A-Z_0-9]*)|([A-Za-z_]\\w*))\\b(?![(])"},any_variable:{match:"\\b(?<![@\\$#%])([A-Za-z_]\\w*)\\b(?![(])",name:"variable.other.gdscript"},arithmetic_operator:{match:"->|\\+=|-=|\\*=|\\^=|/=|%=|&=|~=|\\|=|\\*\\*|\\*|/|%|\\+|-",name:"keyword.operator.arithmetic.gdscript"},assignment_operator:{match:"=",name:"keyword.operator.assignment.gdscript"},base_expression:{patterns:[{include:"#builtin_get_node_shorthand"},{include:"#nodepath_object"},{include:"#nodepath_function"},{include:"#strings"},{include:"#builtin_classes"},{include:"#const_vars"},{include:"#keywords"},{include:"#operators"},{include:"#lambda_declaration"},{include:"#class_declaration"},{include:"#variable_declaration"},{include:"#signal_declaration_bare"},{include:"#signal_declaration"},{include:"#function_declaration"},{include:"#statement_keyword"},{include:"#assignment_operator"},{include:"#in_keyword"},{include:"#control_flow"},{include:"#round_braces"},{include:"#function_call"},{include:"#comment"},{include:"#self"},{include:"#func"},{include:"#letter"},{include:"#numbers"},{include:"#pascal_case_class"},{include:"#line_continuation"}]},bitwise_operator:{match:"&|\\||<<=|>>=|<<|>>|\\^|~",name:"keyword.operator.bitwise.gdscript"},boolean_operator:{match:"(&&|\\|\\|)",name:"keyword.operator.boolean.gdscript"},builtin_classes:{match:"(?<![^.]\\.|:)\\b(OS|GDScript|Vector2|Vector2i|Vector3|Vector3i|Color|Rect2|Rect2i|Array|Basis|Dictionary|Plane|Quat|RID|Rect3|Transform|Transform2D|Transform3D|AABB|String|Color|NodePath|Object|PoolByteArray|PoolIntArray|PoolRealArray|PoolStringArray|PoolVector2Array|PoolVector3Array|PoolColorArray|bool|int|float|StringName|Quaternion|PackedByteArray|PackedInt32Array|PackedInt64Array|PackedFloat32Array|PackedFloat64Array|PackedStringArray|PackedVector2Array|PackedVector2iArray|PackedVector3Array|PackedVector3iArray|PackedColorArray|super)\\b",name:"entity.name.type.class.builtin.gdscript"},builtin_get_node_shorthand:{patterns:[{include:"#builtin_get_node_shorthand_quoted"},{include:"#builtin_get_node_shorthand_bare"},{include:"#builtin_get_node_shorthand_bare_multi"}]},builtin_get_node_shorthand_bare:{captures:{1:{name:"keyword.control.flow.gdscript"},2:{name:"constant.character.escape.gdscript"},3:{name:"constant.character.escape.gdscript"}},match:"(?<!/\\s*)(\\$|%|\\$%)([a-zA-Z_]\\w*)\\b(?!\\s*/)",name:"meta.literal.nodepath.gdscript"},builtin_get_node_shorthand_bare_multi:{begin:"(\\$|%|\\$%)([a-zA-Z_]\\w*)",beginCaptures:{1:{name:"keyword.control.flow.gdscript"},2:{name:"constant.character.escape.gdscript"}},end:"(?!\\s*/\\s*%?\\s*[a-zA-Z_]\\w*)",name:"meta.literal.nodepath.gdscript",patterns:[{captures:{1:{name:"constant.character.escape.gdscript"},2:{name:"keyword.control.flow.gdscript"},3:{name:"constant.character.escape.gdscript"}},match:"(/)\\s*(%)?\\s*([a-zA-Z_]\\w*)\\s*"}]},builtin_get_node_shorthand_quoted:{begin:`(?:(\\$)|(&|\\^|@))("|')`,beginCaptures:{1:{name:"keyword.control.flow.gdscript"},2:{name:"variable.other.enummember.gdscript"}},end:"(\\3)",name:"string.quoted.gdscript meta.literal.nodepath.gdscript constant.character.escape.gdscript",patterns:[{match:"%",name:"keyword.control.flow"}]},class_declaration:{captures:{1:{name:"entity.name.type.class.gdscript"},2:{name:"class.other.gdscript"}},match:"(?<=^class)\\s+([a-zA-Z_]\\w*)\\s*(?=:)"},class_enum:{captures:{1:{name:"entity.name.type.class.gdscript"},2:{name:"constant.language.gdscript"}},match:"\\b([A-Z][a-zA-Z_0-9]*)\\.([A-Z_0-9]+)"},class_is:{captures:{1:{name:"storage.type.is.gdscript"},2:{name:"entity.name.type.class.gdscript"}},match:"\\s+(is)\\s+([a-zA-Z_]\\w*)"},class_name:{captures:{1:{name:"entity.name.type.class.gdscript"},2:{name:"class.other.gdscript"}},match:"(?<=class_name)\\s+([a-zA-Z_]\\w*(\\.([a-zA-Z_]\\w*))?)"},class_new:{captures:{1:{name:"entity.name.type.class.gdscript"},2:{name:"storage.type.new.gdscript"},3:{name:"punctuation.parenthesis.begin.gdscript"}},match:"\\b([a-zA-Z_]\\w*).(new)\\("},comment:{captures:{1:{name:"punctuation.definition.comment.number-sign.gdscript"}},match:"(##|#).*$\\n?",name:"comment.line.number-sign.gdscript"},compare_operator:{match:"<=|>=|==|<|>|!=|!",name:"keyword.operator.comparison.gdscript"},const_vars:{match:"\\b([A-Z_][A-Z_0-9]*)\\b",name:"constant.language.gdscript"},control_flow:{match:"\\b(?:if|elif|else|while|break|continue|pass|return|match|when|yield|await)\\b",name:"keyword.control.gdscript"},expression:{patterns:[{include:"#base_expression"},{include:"#getter_setter_godot4"},{include:"#assignment_operator"},{include:"#annotations"},{include:"#class_name"},{include:"#builtin_classes"},{include:"#class_new"},{include:"#class_is"},{include:"#class_enum"},{include:"#any_method"},{include:"#any_variable"},{include:"#any_property"}]},extends_statement:{captures:{1:{name:"keyword.language.gdscript"},2:{name:"entity.other.inherited-class.gdscript"}},match:"(extends)\\s+([a-zA-Z_]\\w*\\.[a-zA-Z_]\\w*)?"},func:{match:"\\bfunc\\b",name:"keyword.language.gdscript"},function_arguments:{begin:"(\\()",beginCaptures:{1:{name:"punctuation.definition.arguments.begin.gdscript"}},contentName:"meta.function.parameters.gdscript",end:"(?=\\))(?!\\)\\s*\\()",patterns:[{match:"(,)",name:"punctuation.separator.arguments.gdscript"},{captures:{1:{name:"variable.parameter.function-call.gdscript"},2:{name:"keyword.operator.assignment.gdscript"}},match:"\\b([a-zA-Z_]\\w*)\\s*(=)(?!=)"},{match:"=(?!=)",name:"keyword.operator.assignment.gdscript"},{include:"#base_expression"},{captures:{1:{name:"punctuation.definition.arguments.end.gdscript"},2:{name:"punctuation.definition.arguments.begin.gdscript"}},match:"\\s*(\\))\\s*(\\()"},{include:"#letter"},{include:"#any_variable"},{include:"#any_property"},{include:"#keywords"}]},function_call:{begin:`(?x)
4
- \\b(?=
5
- ([a-zA-Z_]\\w*) \\s* (\\()
6
- )
7
- `,beginCaptures:{2:{name:"punctuation.definition.arguments.begin.gdscript"}},comment:'Regular function call of the type "name(args)"',end:"(\\))",endCaptures:{1:{name:"punctuation.definition.arguments.end.gdscript"}},name:"meta.function-call.gdscript",patterns:[{include:"#function_name"},{include:"#function_arguments"}]},function_declaration:{begin:`(?x) \\s*
8
- (func) \\s+
9
- ([a-zA-Z_]\\w*) \\s*
10
- (?=\\()`,beginCaptures:{1:{name:"keyword.language.gdscript storage.type.function.gdscript"},2:{name:"entity.name.function.gdscript"}},end:`(:|(?=[#'"\\n]))`,end2:"(\\s*(\\-\\>)\\s*(void\\w*)|([a-zA-Z_]\\w*)\\s*\\:)",endCaptures2:{1:{name:"punctuation.separator.annotation.result.gdscript"},2:{name:"keyword.language.void.gdscript"},3:{name:"entity.name.type.class.gdscript markup.italic"}},name:"meta.function.gdscript",patterns:[{include:"#parameters"},{include:"#line_continuation"},{include:"#base_expression"}]},function_name:{patterns:[{include:"#builtin_classes"},{comment:"Some color schemas support meta.function-call.generic scope",match:`(?x)
11
- \\b ([a-zA-Z_]\\w*) \\b
12
- `,name:"support.function.any-method.gdscript"}]},getter_setter_godot4:{patterns:[{captures:{1:{name:"entity.name.function.gdscript"}},match:"\\b(get):"},{begin:`(?x) \\s+
13
- (set) \\s*
14
- (?=\\()`,beginCaptures:{1:{name:"entity.name.function.gdscript"}},end:`(:|(?=[#'"\\n]))`,name:"meta.function.gdscript",patterns:[{include:"#parameters"},{include:"#line_continuation"}]}]},in_keyword:{patterns:[{begin:"\\b(for)\\b",captures:{1:{name:"keyword.control.gdscript"}},end:":",patterns:[{match:"\\bin\\b",name:"keyword.control.gdscript"},{include:"#base_expression"},{include:"#any_variable"},{include:"#any_property"}]},{match:"\\bin\\b",name:"keyword.operator.wordlike.gdscript"}]},keywords:{match:"\\b(?:class|class_name|is|onready|tool|static|export|as|void|enum|preload|assert|breakpoint|sync|remote|master|puppet|slave|remotesync|mastersync|puppetsync|trait|namespace)\\b",name:"keyword.language.gdscript"},lambda_declaration:{begin:"(func)\\s?(?=\\()",beginCaptures:{1:{name:"keyword.language.gdscript storage.type.function.gdscript"},2:{name:"entity.name.function.gdscript"}},end:`(:|(?=[#'"\\n]))`,end2:"(\\s*(\\-\\>)\\s*(void\\w*)|([a-zA-Z_]\\w*)\\s*\\:)",endCaptures2:{1:{name:"punctuation.separator.annotation.result.gdscript"},2:{name:"keyword.language.void.gdscript"},3:{name:"entity.name.type.class.gdscript markup.italic"}},name:"meta.function.gdscript",patterns:[{include:"#parameters"},{include:"#line_continuation"},{include:"#base_expression"},{include:"#any_variable"},{include:"#any_property"}]},letter:{match:"\\b(?:true|false|null)\\b",name:"constant.language.gdscript"},line_continuation:{patterns:[{captures:{1:{name:"punctuation.separator.continuation.line.gdscript"},2:{name:"invalid.illegal.line.continuation.gdscript"}},match:"(\\\\)\\s*(\\S.*$\\n?)"},{begin:"(\\\\)\\s*$\\n?",beginCaptures:{1:{name:"punctuation.separator.continuation.line.gdscript"}},end:`(?x)
15
- (?=^\\s*$)
16
- |
17
- (?! (\\s* [rR]? (\\'\\'\\'|\\"\\"\\"|\\'|\\"))
18
- |
19
- (\\G $) (?# '\\G' is necessary for ST)
20
- )
21
- `,patterns:[{include:"#base_expression"}]}]},loose_default:{begin:"(=)",beginCaptures:{1:{name:"keyword.operator.gdscript"}},end:"(,)|(?=\\))",endCaptures:{1:{name:"punctuation.separator.parameters.gdscript"}},patterns:[{include:"#base_expression"}]},nodepath_function:{begin:"(get_node_or_null|has_node|has_node_and_resource|find_node|get_node)\\s*(\\()",beginCaptures:{1:{name:"entity.name.function.gdscript"},2:{name:"punctuation.definition.parameters.begin.gdscript"}},end:"(\\))",endCaptures:{1:{name:"punctuation.definition.parameters.end.gdscript"}},patterns:[{begin:`("|')`,end:"\\1",name:"string.quoted.gdscript meta.literal.nodepath.gdscript constant.character.escape",patterns:[{match:"%",name:"keyword.control.flow"}]}]},nodepath_object:{begin:"(NodePath)\\s*(?:\\()",beginCaptures:{1:{name:"support.class.library.gdscript"}},end:"(?:\\))",name:"meta.literal.nodepath.gdscript",patterns:[{begin:`("|')`,end:"\\1",name:"string.quoted.gdscript constant.character.escape.gdscript",patterns:[{match:"%",name:"keyword.control.flow.gdscript"}]}]},numbers:{patterns:[{match:"0b[01_]+",name:"constant.numeric.integer.binary.gdscript"},{match:"0x[0-9A-Fa-f_]+",name:"constant.numeric.integer.hexadecimal.gdscript"},{match:"[-]?([0-9][0-9_]+\\.[0-9_]*(e[\\-\\+]?[0-9_]+)?)",name:"constant.numeric.float.gdscript"},{match:"[-]?(\\.[0-9][0-9_]*(e[\\-\\+]?[0-9_]+)?)",name:"constant.numeric.float.gdscript"},{match:"[-]?([0-9][0-9_]*e[\\-\\+]?\\[0-9_])",name:"constant.numeric.float.gdscript"},{match:"[-]?[0-9][0-9_]*",name:"constant.numeric.integer.gdscript"}]},operators:{patterns:[{include:"#wordlike_operator"},{include:"#boolean_operator"},{include:"#arithmetic_operator"},{include:"#bitwise_operator"},{include:"#compare_operator"}]},parameters:{begin:"(\\()",beginCaptures:{1:{name:"punctuation.definition.parameters.begin.gdscript"}},end:"(\\))",endCaptures:{1:{name:"punctuation.definition.parameters.end.gdscript"}},name:"meta.function.parameters.gdscript",patterns:[{include:"#annotated_parameter"},{captures:{1:{name:"variable.parameter.function.language.gdscript"},2:{name:"punctuation.separator.parameters.gdscript"}},match:`(?x)
22
- ([a-zA-Z_]\\w*)
23
- \\s* (?: (,) | (?=[)#\\n=]))
24
- `},{include:"#comment"},{include:"#loose_default"}]},pascal_case_class:{match:"\\b([A-Z]+[a-z_0-9]*([A-Z]?[a-z_0-9]+)*[A-Z]?)\\b",name:"entity.name.type.class.gdscript"},round_braces:{begin:"\\(",beginCaptures:{0:{name:"punctuation.parenthesis.begin.gdscript"}},end:"\\)",endCaptures:{0:{name:"punctuation.parenthesis.end.gdscript"}},patterns:[{include:"#base_expression"},{include:"#any_variable"}]},self:{match:"\\bself\\b",name:"variable.language.gdscript"},signal_declaration:{begin:`(?x) \\s*
25
- (signal) \\s+
26
- ([a-zA-Z_]\\w*) \\s*
27
- (?=\\()`,beginCaptures:{1:{name:"keyword.language.gdscript storage.type.function.gdscript"},2:{name:"entity.name.function.gdscript"}},end:`((?=[#'"\\n]))`,name:"meta.signal.gdscript",patterns:[{include:"#parameters"},{include:"#line_continuation"}]},signal_declaration_bare:{captures:{1:{name:"keyword.language.gdscript storage.type.function.gdscript"},2:{name:"entity.name.function.gdscript"}},match:`(?x) \\s*
28
- (signal) \\s+
29
- ([a-zA-Z_]\\w*)(?=[\\n\\s])`,name:"meta.signal.gdscript"},statement:{patterns:[{include:"#extends_statement"}]},statement_keyword:{patterns:[{match:`(?x)
30
- \\b(?<!\\.)(
31
- continue | assert | break | elif | else | if | pass | return | while )\\b
32
- `,name:"keyword.control.flow.gdscript"},{match:"\\b(?<!\\.)(class)\\b",name:"storage.type.class.gdscript"},{captures:{1:{name:"keyword.control.flow.gdscript"}},match:`(?x)
33
- ^\\s*(
34
- case | match
35
- )(?=\\s*([-+\\w\\d(\\[{'":#]|$))\\b
36
- `}]},string_bracket_placeholders:{patterns:[{captures:{1:{name:"constant.character.format.placeholder.other.gdscript"},3:{name:"storage.type.format.gdscript"},4:{name:"storage.type.format.gdscript"}},match:`(?x)
37
- (
38
- {{ | }}
39
- | (?:
40
- {
41
- \\w* (\\.[[:alpha:]_]\\w* | \\[[^\\]'"]+\\])*
42
- (![rsa])?
43
- ( : \\w? [<>=^]? [-+ ]? \\#?
44
- \\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )?
45
- })
46
- )
47
- `,name:"meta.format.brace.gdscript"},{captures:{1:{name:"constant.character.format.placeholder.other.gdscript"},3:{name:"storage.type.format.gdscript"},4:{name:"storage.type.format.gdscript"}},match:`(?x)
48
- (
49
- {
50
- \\w* (\\.[[:alpha:]_]\\w* | \\[[^\\]'"]+\\])*
51
- (![rsa])?
52
- (:)
53
- [^'"{}\\n]* (?:
54
- \\{ [^'"}\\n]*? \\} [^'"{}\\n]*
55
- )*
56
- }
57
- )
58
- `,name:"meta.format.brace.gdscript"}]},string_percent_placeholders:{captures:{1:{name:"constant.character.format.placeholder.other.gdscript"}},match:`(?x)
59
- (
60
- % (\\([\\w\\s]*\\))?
61
- [-+#0 ]*
62
- (\\d+|\\*)? (\\.(\\d+|\\*))?
63
- ([hlL])?
64
- [diouxXeEfFgGcrsab%]
65
- )
66
- `,name:"meta.format.percent.gdscript"},strings:{begin:`(r)?("""|'''|"|')`,beginCaptures:{1:{name:"constant.character.escape.gdscript"}},end:"\\2",name:"string.quoted.gdscript",patterns:[{match:"\\\\.",name:"constant.character.escape.gdscript"},{include:"#string_percent_placeholders"},{include:"#string_bracket_placeholders"}]},variable_declaration:{begin:"\\b(?:(var)|(const))\\s+(?:(\\b[A-Z_][A-Z_0-9]*\\b)|([A-Za-z_]\\w*))\\s*",beginCaptures:{1:{name:"keyword.language.gdscript storage.type.var.gdscript"},2:{name:"keyword.language.gdscript storage.type.const.gdscript"},3:{name:"constant.language.gdscript"},4:{name:"variable.other.gdscript"}},end:"$|;",name:"meta.variable.gdscript",patterns:[{captures:{1:{name:"punctuation.separator.annotation.gdscript"},2:{name:"keyword.language.gdscript storage.type.const.gdscript"},3:{name:"entity.name.function.gdscript"}},match:"(:)?\\s*(set|get)\\s+=\\s+([a-zA-Z_]\\w*)"},{match:":=|=(?!=)",name:"keyword.operator.assignment.gdscript"},{captures:{1:{name:"punctuation.separator.annotation.gdscript"},2:{name:"entity.name.type.class.gdscript"}},match:"(:)\\s*([a-zA-Z_]\\w*)?"},{captures:{1:{name:"keyword.language.gdscript storage.type.const.gdscript"},2:{name:"entity.name.function.gdscript"},3:{name:"entity.name.function.gdscript"}},match:"(setget)\\s+([a-zA-Z_]\\w*)(?:[,]\\s*([a-zA-Z_]\\w*))?"},{include:"#expression"},{include:"#letter"},{include:"#any_variable"},{include:"#any_property"},{include:"#keywords"}]},wordlike_operator:{match:"\\b(and|or|not)\\b",name:"keyword.operator.wordlike.gdscript"}},scopeName:"source.gdscript"});var t=[e];export{t as default};