@nuxt/scripts 0.5.0 → 0.6.0

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 (68) hide show
  1. package/README.md +2 -2
  2. package/dist/client/200.html +19 -16
  3. package/dist/client/404.html +19 -16
  4. package/dist/client/_nuxt/B474tPdy.js +66 -0
  5. package/dist/client/_nuxt/{DMNuDhJC.js → BN0jYG70.js} +1 -1
  6. package/dist/client/_nuxt/Buoqr_Oi.js +2 -0
  7. package/dist/client/_nuxt/C2pTd85Q.js +1 -0
  8. package/dist/client/_nuxt/{DCjyzNN-.js → D4FSFK-1.js} +1 -1
  9. package/dist/client/_nuxt/DAP_O-zg.js +1 -0
  10. package/dist/client/_nuxt/{o8H-iTt6.js → DG8tVHNj.js} +1 -1
  11. package/dist/client/_nuxt/DKGhHdqV.js +31 -0
  12. package/dist/client/_nuxt/DVC_qXWv.js +1 -0
  13. package/dist/client/_nuxt/{NL97_oaV.js → GPY1wEXZ.js} +1 -1
  14. package/dist/client/_nuxt/RyEv5ndP.js +1 -0
  15. package/dist/client/_nuxt/VQMr7AbF.js +1 -0
  16. package/dist/client/_nuxt/builds/latest.json +1 -1
  17. package/dist/client/_nuxt/builds/meta/c409c2fe-d448-45a5-84ca-3e109a1e08ad.json +1 -0
  18. package/dist/client/_nuxt/cW9vKj3g.js +1 -0
  19. package/dist/client/_nuxt/entry.DvGwvmL9.css +1 -0
  20. package/dist/client/_nuxt/error-404.DXyehy0d.css +1 -0
  21. package/dist/client/_nuxt/error-500.a_92Fvyl.css +1 -0
  22. package/dist/client/index.html +19 -16
  23. package/dist/module.d.mts +3 -3
  24. package/dist/module.d.ts +3 -3
  25. package/dist/module.json +2 -2
  26. package/dist/module.mjs +191 -59
  27. package/dist/registry.mjs +15 -2
  28. package/dist/runtime/components/ScriptCarbonAds.vue +5 -4
  29. package/dist/runtime/components/ScriptCrisp.vue +84 -0
  30. package/dist/runtime/components/ScriptGoogleAdsense.vue +23 -4
  31. package/dist/runtime/components/ScriptGoogleMaps.vue +15 -14
  32. package/dist/runtime/components/ScriptIntercom.vue +93 -0
  33. package/dist/runtime/components/ScriptLemonSqueezy.vue +45 -0
  34. package/dist/runtime/components/ScriptLoadingIndicator.vue +12 -3
  35. package/dist/runtime/components/ScriptStripePricingTable.vue +30 -18
  36. package/dist/runtime/components/ScriptVimeoPlayer.vue +13 -3
  37. package/dist/runtime/components/ScriptYouTubePlayer.vue +13 -3
  38. package/dist/runtime/composables/useScript.js +6 -1
  39. package/dist/runtime/composables/useScriptEventPage.d.ts +5 -0
  40. package/dist/runtime/composables/{useAnalyticsPageEvent.js → useScriptEventPage.js} +1 -1
  41. package/dist/runtime/composables/{useConsentScriptTrigger.d.ts → useScriptTriggerConsent.d.ts} +1 -1
  42. package/dist/runtime/composables/{useConsentScriptTrigger.js → useScriptTriggerConsent.js} +1 -1
  43. package/dist/runtime/composables/{useElementScriptTrigger.d.ts → useScriptTriggerElement.d.ts} +1 -1
  44. package/dist/runtime/composables/{useElementScriptTrigger.js → useScriptTriggerElement.js} +5 -4
  45. package/dist/runtime/registry/crisp.d.ts +62 -0
  46. package/dist/runtime/registry/crisp.js +76 -0
  47. package/dist/runtime/registry/google-adsense.d.ts +1 -1
  48. package/dist/runtime/registry/intercom.d.ts +1 -1
  49. package/dist/runtime/registry/lemon-squeezy.d.ts +19 -12
  50. package/dist/runtime/registry/stripe.d.ts +0 -1
  51. package/dist/runtime/registry/vimeo-player.d.ts +1 -1
  52. package/dist/runtime/registry/youtube-player.d.ts +0 -1
  53. package/dist/runtime/types.d.ts +18 -8
  54. package/dist/runtime/utils.js +2 -1
  55. package/dist/types.d.mts +2 -10
  56. package/dist/types.d.ts +2 -10
  57. package/package.json +36 -28
  58. package/dist/client/_nuxt/Bn0B8vkx.js +0 -1
  59. package/dist/client/_nuxt/BvlfuC5v.js +0 -31
  60. package/dist/client/_nuxt/Bx89rGXK.js +0 -1
  61. package/dist/client/_nuxt/CoEqzGFw.js +0 -44
  62. package/dist/client/_nuxt/builds/meta/ba7f19ad-4701-4a37-b1b2-908f0cc701a8.json +0 -1
  63. package/dist/client/_nuxt/entry.8LvBfYHJ.css +0 -1
  64. package/dist/client/_nuxt/error-404.Dbi768NS.css +0 -1
  65. package/dist/client/_nuxt/error-500.C23YdqXl.css +0 -1
  66. package/dist/client/_nuxt/jmWmhCGR.js +0 -1
  67. package/dist/runtime/components/ScriptLemonSqueezyButton.vue +0 -41
  68. package/dist/runtime/composables/useAnalyticsPageEvent.d.ts +0 -2
@@ -1,5 +1,5 @@
1
- import type { UseScriptOptions } from '@unhead/schema';
2
- import type { UseScriptInput, VueScriptInstance } from '@unhead/vue';
1
+ import type { UseScriptOptions, DataKeys, SchemaAugmentations, ScriptBase } from '@unhead/schema';
2
+ import type { UseScriptInput, VueScriptInstance, MaybeComputedRefEntriesOnly } 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';
@@ -18,8 +18,11 @@ import type { YouTubePlayerInput } from './registry/youtube-player.js';
18
18
  import type { PlausibleAnalyticsInput } from './registry/plausible-analytics.js';
19
19
  import type { NpmInput } from './registry/npm.js';
20
20
  import type { LemonSqueezyInput } from './registry/lemon-squeezy.js';
21
- import type { InferInput as GoogleTagManagerInput } from '#build/nuxt-scripts/tpc/google-tag-manager';
22
- import type { InferInput as GoogleAnalyticsInput } from '#build/nuxt-scripts/tpc/google-analytics';
21
+ import type { GoogleAdsenseInput } from './registry/google-adsense.js';
22
+ import type { ClarityInput } from './registry/clarity.js';
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';
23
26
  export type NuxtUseScriptOptions<T = any> = Omit<UseScriptOptions<T>, 'trigger'> & {
24
27
  /**
25
28
  * The trigger to load the script:
@@ -42,7 +45,9 @@ export type NuxtUseScriptOptions<T = any> = Omit<UseScriptOptions<T>, 'trigger'>
42
45
  */
43
46
  skipValidation?: boolean;
44
47
  };
45
- export type NuxtUseScriptIntegrationOptions = Omit<NuxtUseScriptOptions, 'use'>;
48
+ export type NuxtUseScriptOptionsSerializable = Omit<NuxtUseScriptOptions, 'use' | 'skipValidation' | 'stub' | 'trigger' | 'eventContext' | 'beforeInit'> & {
49
+ trigger?: 'client' | 'server' | 'onNuxtReady';
50
+ };
46
51
  export type NuxtUseScriptInput = UseScriptInput;
47
52
  export interface TrackedPage {
48
53
  title?: string;
@@ -74,10 +79,13 @@ export interface NuxtAppScript {
74
79
  }[];
75
80
  }
76
81
  export interface ScriptRegistry {
82
+ crisp?: CrispInput;
83
+ clarity?: ClarityInput;
77
84
  cloudflareWebAnalytics?: CloudflareWebAnalyticsInput;
78
85
  metaPixel?: MetaPixelInput;
79
86
  fathomAnalytics?: FathomAnalyticsInput;
80
87
  plausibleAnalytics?: PlausibleAnalyticsInput;
88
+ googleAdsense?: GoogleAdsenseInput;
81
89
  googleAnalytics?: GoogleAnalyticsInput;
82
90
  googleMaps?: GoogleMapsInput;
83
91
  lemonSqueezy?: LemonSqueezyInput;
@@ -92,12 +100,14 @@ export interface ScriptRegistry {
92
100
  vimeoPlayer?: VimeoPlayerInput;
93
101
  [key: `${string}-npm`]: NpmInput;
94
102
  }
95
- export type NuxtConfigScriptRegistryEntry<T> = true | 'mock' | T | [T, NuxtUseScriptOptions<T>];
96
- export type NuxtConfigScriptRegistry<T extends keyof ScriptRegistry = keyof ScriptRegistry> = Partial<Record<T, NuxtConfigScriptRegistryEntry<ScriptRegistry[T]>>>;
103
+ export type NuxtConfigScriptRegistryEntry<T> = true | 'mock' | T | [T, NuxtUseScriptOptionsSerializable];
104
+ export type NuxtConfigScriptRegistry<T extends keyof ScriptRegistry = keyof ScriptRegistry> = Partial<{
105
+ [key in T]: NuxtConfigScriptRegistryEntry<ScriptRegistry[key]>;
106
+ }>;
97
107
  declare const emptyOptions: ObjectSchema<{}, undefined>;
98
108
  export type EmptyOptionsSchema = typeof emptyOptions;
99
109
  export type RegistryScriptInput<T extends ObjectSchema<any, any> = EmptyOptionsSchema, Bundelable extends boolean = true> = InferInput<T> & {
100
- scriptInput?: UseScriptInput;
110
+ scriptInput?: MaybeComputedRefEntriesOnly<Omit<ScriptBase & DataKeys & SchemaAugmentations['script'], 'src'>>;
101
111
  scriptOptions?: Bundelable extends true ? Omit<NuxtUseScriptOptions, 'use'> : Omit<NuxtUseScriptOptions, 'bundle' | 'use'>;
102
112
  };
103
113
  export interface RegistryScript {
@@ -1,6 +1,7 @@
1
1
  import { defu } from "defu";
2
+ import { useScript } from "./composables/useScript.js";
2
3
  import { parse } from "#nuxt-scripts-validator";
3
- import { useRuntimeConfig, useScript } from "#imports";
4
+ import { useRuntimeConfig } from "#imports";
4
5
  function validateScriptInputSchema(key, schema, options) {
5
6
  if (import.meta.dev) {
6
7
  try {
package/dist/types.d.mts CHANGED
@@ -1,19 +1,11 @@
1
-
2
- import type { ModuleOptions, ModuleHooks } from './module.js'
3
-
4
-
1
+ import type { ModuleHooks } from './module.js'
5
2
 
6
3
  declare module '@nuxt/schema' {
7
- interface NuxtConfig { ['scripts']?: Partial<ModuleOptions> }
8
- interface NuxtOptions { ['scripts']?: ModuleOptions }
9
4
  interface NuxtHooks extends ModuleHooks {}
10
5
  }
11
6
 
12
7
  declare module 'nuxt/schema' {
13
- interface NuxtConfig { ['scripts']?: Partial<ModuleOptions> }
14
- interface NuxtOptions { ['scripts']?: ModuleOptions }
15
8
  interface NuxtHooks extends ModuleHooks {}
16
9
  }
17
10
 
18
-
19
- export type { ModuleHooks, ModuleOptions, default } from './module.js'
11
+ export { type ModuleHooks, type ModuleOptions, default } from './module.js'
package/dist/types.d.ts CHANGED
@@ -1,19 +1,11 @@
1
-
2
- import type { ModuleOptions, ModuleHooks } from './module'
3
-
4
-
1
+ import type { ModuleHooks } from './module'
5
2
 
6
3
  declare module '@nuxt/schema' {
7
- interface NuxtConfig { ['scripts']?: Partial<ModuleOptions> }
8
- interface NuxtOptions { ['scripts']?: ModuleOptions }
9
4
  interface NuxtHooks extends ModuleHooks {}
10
5
  }
11
6
 
12
7
  declare module 'nuxt/schema' {
13
- interface NuxtConfig { ['scripts']?: Partial<ModuleOptions> }
14
- interface NuxtOptions { ['scripts']?: ModuleOptions }
15
8
  interface NuxtHooks extends ModuleHooks {}
16
9
  }
17
10
 
18
-
19
- export type { ModuleHooks, ModuleOptions, default } from './module'
11
+ export { type ModuleHooks, type ModuleOptions, default } from './module'
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@nuxt/scripts",
3
3
  "type": "module",
4
- "version": "0.5.0",
5
- "packageManager": "pnpm@9.3.0",
4
+ "version": "0.6.0",
5
+ "packageManager": "pnpm@9.4.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",
@@ -57,64 +57,72 @@
57
57
  "#nuxt-scripts",
58
58
  "#nuxt-scripts-validator",
59
59
  "third-party-capital",
60
- "knitwork"
60
+ "knitwork",
61
+ "estree-walker",
62
+ "#build/nuxt-scripts/tpc/google-tag-manager",
63
+ "#build/nuxt-scripts/tpc/google-analytics",
64
+ "@vimeo/player",
65
+ "esbuild"
61
66
  ]
62
67
  },
63
68
  "dependencies": {
64
- "@nuxt/devtools-kit": "^1.3.3",
65
- "@nuxt/devtools-ui-kit": "^1.3.3",
66
- "@nuxt/kit": "^3.12.1",
67
- "@types/google.maps": "^3.55.9",
69
+ "@nuxt/devtools-kit": "^1.3.9",
70
+ "@nuxt/devtools-ui-kit": "^1.3.9",
71
+ "@nuxt/kit": "^3.12.3",
72
+ "@types/google.maps": "^3.55.11",
68
73
  "@types/stripe-v3": "^3.1.33",
69
74
  "@types/vimeo__player": "^2.18.3",
70
75
  "@types/youtube": "^0.0.50",
71
- "@unhead/vue": "^1.9.12",
72
- "@vueuse/core": "^10.10.1",
76
+ "@unhead/vue": "^1.9.15",
77
+ "@vueuse/core": "^10.11.0",
78
+ "acorn": "^8.12.1",
73
79
  "consola": "^3.2.3",
74
80
  "defu": "^6.1.4",
75
- "estree-walker": "^3.0.3",
76
- "h3": "^1.11.1",
81
+ "h3": "^1.12.0",
77
82
  "magic-string": "^0.30.10",
78
83
  "mlly": "^1.7.1",
84
+ "nuxt-scripts-devtools": "workspace:*",
79
85
  "ofetch": "^1.3.4",
80
86
  "ohash": "^1.1.3",
81
87
  "pathe": "^1.1.2",
82
- "pkg-types": "^1.1.1",
88
+ "pkg-types": "^1.1.3",
83
89
  "semver": "^7.6.2",
84
- "shiki": "^1.6.4",
90
+ "shiki": "^1.10.1",
85
91
  "sirv": "^2.0.4",
86
92
  "std-env": "^3.7.0",
87
- "third-party-capital": "^1.0.30",
93
+ "third-party-capital": "^1.0.31",
88
94
  "ufo": "^1.5.3",
89
95
  "unimport": "^3.7.2",
90
- "unplugin": "^1.10.1",
96
+ "unplugin": "^1.11.0",
91
97
  "unstorage": "^1.10.2",
92
- "valibot": "^0.31.1"
98
+ "valibot": "^0.36.0"
93
99
  },
94
100
  "devDependencies": {
95
- "@nuxt/devtools-ui-kit": "^1.3.3",
101
+ "@nuxt/devtools-ui-kit": "^1.3.9",
96
102
  "@nuxt/eslint-config": "^0.3.13",
97
- "@nuxt/module-builder": "^0.7.1",
103
+ "@nuxt/module-builder": "^0.8.1",
98
104
  "@nuxt/test-utils": "3.13.1",
99
105
  "@types/semver": "^7.5.8",
100
- "@unhead/schema": "^1.9.12",
106
+ "@typescript-eslint/typescript-estree": "^7.15.0",
107
+ "@unhead/schema": "^1.9.15",
101
108
  "acorn-loose": "^8.4.0",
102
109
  "bumpp": "^9.4.1",
103
110
  "changelogen": "^0.5.5",
104
- "eslint": "9.4.0",
111
+ "eslint": "9.6.0",
112
+ "eslint-plugin-n": "^17.9.0",
105
113
  "knitwork": "^1.1.0",
106
- "nuxt": "^3.12.1",
107
- "playwright-core": "^1.44.1",
108
- "typescript": "^5.4.5",
114
+ "nuxt": "^3.12.3",
115
+ "playwright-core": "^1.45.1",
116
+ "typescript": "^5.5.3",
109
117
  "vitest": "^1.6.0",
110
- "vue": "^3.4.27",
111
- "vue-router": "^4.3.3"
118
+ "vue": "^3.4.31",
119
+ "vue-router": "^4.4.0"
112
120
  },
113
121
  "resolutions": {
114
122
  "@nuxt/scripts": "workspace:*",
115
- "nuxt": "^3.12.1",
123
+ "nuxt": "^3.12.3",
116
124
  "nuxt-scripts-devtools": "workspace:*",
117
- "vue": "^3.4.27",
118
- "vue-router": "^4.3.3"
125
+ "vue": "^3.4.31",
126
+ "vue-router": "^4.4.0"
119
127
  }
120
128
  }
@@ -1 +0,0 @@
1
- import{i as u,r as c,f,g as v,h as d,j as l,k as i,l as h,m as p}from"./BvlfuC5v.js";function g(t,a={}){const e=a.head||u();if(e)return e.ssr?e.push(t,a):m(e,t,a)}function m(t,a,e={}){const s=c(!1),n=c({});f(()=>{n.value=s.value?{}:h(a)});const r=t.push(n.value,e);return v(n,o=>{r.patch(o)}),p()&&(d(()=>{r.dispose()}),l(()=>{s.value=!0}),i(()=>{s.value=!1})),r}const I=(t,a)=>{const e=t.__vccOpts||t;for(const[s,n]of a)e[s]=n;return e};export{I as _,g as u};