@nuxt/scripts 0.1.5 → 0.1.7
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 +7 -6
- package/dist/client/404.html +7 -6
- package/dist/client/_nuxt/BG_OyJVq.js +1 -0
- package/dist/client/_nuxt/{YkgnKQjM.js → BVIyUFBp.js} +3 -3
- package/dist/client/_nuxt/{C6qP6ksw.js → CV_REd8b.js} +1 -1
- package/dist/client/_nuxt/{D2oMNJSZ.js → D1ek2jBE.js} +1 -1
- package/dist/client/_nuxt/DnLUQrgA.js +1 -0
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/b5db882d-dfbd-4edf-87b5-38d1f0a456e3.json +1 -0
- package/dist/client/_nuxt/{BBafEUG8.js → vqIOxd68.js} +1 -1
- package/dist/client/index.html +7 -6
- package/dist/module.d.mts +13 -67
- package/dist/module.d.ts +13 -67
- package/dist/module.json +1 -1
- package/dist/module.mjs +185 -120
- package/dist/runtime/composables/useScript.mjs +3 -2
- package/dist/runtime/composables/validateScriptInputSchema.d.ts +2 -7
- package/dist/runtime/composables/validateScriptInputSchema.mjs +9 -7
- package/dist/runtime/registry/cloudflare-web-analytics.mjs +3 -7
- package/dist/runtime/registry/confetti.d.ts +9 -1
- package/dist/runtime/registry/confetti.mjs +8 -5
- package/dist/runtime/registry/facebook-pixel.d.ts +1 -1
- package/dist/runtime/registry/facebook-pixel.mjs +4 -7
- package/dist/runtime/registry/fathom-analytics.d.ts +1 -2
- package/dist/runtime/registry/fathom-analytics.mjs +4 -7
- package/dist/runtime/registry/hotjar.d.ts +4 -5
- package/dist/runtime/registry/hotjar.mjs +4 -6
- package/dist/runtime/registry/intercom.d.ts +5 -5
- package/dist/runtime/registry/intercom.mjs +4 -6
- package/dist/runtime/registry/npm.d.ts +12 -0
- package/dist/runtime/registry/npm.mjs +18 -0
- package/dist/runtime/registry/segment.d.ts +4 -5
- package/dist/runtime/registry/segment.mjs +3 -6
- package/dist/runtime/types.d.ts +32 -3
- package/package.json +5 -5
- package/dist/client/_nuxt/CkMwVfOK.js +0 -1
- package/dist/client/_nuxt/builds/meta/72c1a85e-b70c-4e27-93ec-d6316f40b143.json +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as i,u as a}from"./
|
|
1
|
+
import{_ as i,u as a}from"./D1ek2jBE.js";import{o as r,c as n,a as e,t as s,p as l,e as d}from"./BVIyUFBp.js";const c=t=>(l("data-v-c967d9a9"),t=t(),d(),t),p={class:"font-sans antialiased bg-white dark:bg-black text-black dark:text-white grid min-h-screen place-content-center overflow-hidden"},h=c(()=>e("div",{class:"fixed -bottom-1/2 left-0 right-0 h-1/2 spotlight"},null,-1)),f={class:"max-w-520px text-center"},m=["textContent"],g=["textContent"],x={__name:"error-500",props:{appName:{type:String,default:"Nuxt"},version:{type:String,default:""},statusCode:{type:Number,default:500},statusMessage:{type:String,default:"Server error"},description:{type:String,default:"This page is temporarily unavailable."}},setup(t){const o=t;return a({title:`${o.statusCode} - ${o.statusMessage} | ${o.appName}`,script:[],style:[{children:'*,:before,:after{-webkit-box-sizing:border-box;box-sizing:border-box;border-width:0;border-style:solid;border-color:#e0e0e0}*{--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(14, 165, 233, .5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000}:root{-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{margin:0;font-family:inherit;line-height:inherit}html{-webkit-text-size-adjust:100%;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";line-height:1.5}h1,p{margin:0}h1{font-size:inherit;font-weight:inherit}'}]}),(b,u)=>(r(),n("div",p,[h,e("div",f,[e("h1",{class:"text-8xl sm:text-10xl font-medium mb-8",textContent:s(t.statusCode)},null,8,m),e("p",{class:"text-xl px-8 sm:px-0 sm:text-4xl font-light mb-16 leading-tight",textContent:s(t.description)},null,8,g)])]))}},y=i(x,[["__scopeId","data-v-c967d9a9"]]);export{y as default};
|
|
@@ -1 +1 @@
|
|
|
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"./
|
|
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"./BVIyUFBp.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const t=Object.freeze({displayName:"TSV",fileTypes:["tsv","tab"],name:"tsv",patterns:[{captures:{1:{name:"rainbow1"},2:{name:"keyword.rainbow2"},3:{name:"entity.name.function.rainbow3"},4:{name:"comment.rainbow4"},5:{name:"string.rainbow5"},6:{name:"variable.parameter.rainbow6"},7:{name:"constant.numeric.rainbow7"},8:{name:"entity.name.type.rainbow8"},9:{name:"markup.bold.rainbow9"},10:{name:"invalid.rainbow10"}},match:"([^\\t]*\\t?)([^\\t]*\\t?)([^\\t]*\\t?)([^\\t]*\\t?)([^\\t]*\\t?)([^\\t]*\\t?)([^\\t]*\\t?)([^\\t]*\\t?)([^\\t]*\\t?)([^\\t]*\\t?)",name:"rainbowgroup"}],scopeName:"text.tsv"});var a=[t];export{a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"b5db882d-dfbd-4edf-87b5-38d1f0a456e3","timestamp":1711951597713}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"b5db882d-dfbd-4edf-87b5-38d1f0a456e3","timestamp":1711951597713,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as a,c as n,a as e,t as s,b as r,w as l,d,_ as c,p,e as m}from"./
|
|
1
|
+
import{o as a,c as n,a as e,t as s,b as r,w as l,d,_ as c,p,e as m}from"./BVIyUFBp.js";import{_ as f,u as h}from"./D1ek2jBE.js";const x=t=>(p("data-v-05a2b8a3"),t=t(),m(),t),u={class:"font-sans antialiased bg-white dark:bg-black text-black dark:text-white grid min-h-screen place-content-center overflow-hidden"},g=x(()=>e("div",{class:"fixed left-0 right-0 spotlight z-10"},null,-1)),b={class:"max-w-520px text-center z-20"},_=["textContent"],w=["textContent"],y={class:"w-full flex items-center justify-center"},S={__name:"error-404",props:{appName:{type:String,default:"Nuxt"},version:{type:String,default:""},statusCode:{type:Number,default:404},statusMessage:{type:String,default:"Not Found"},description:{type:String,default:"Sorry, the page you are looking for could not be found."},backHome:{type:String,default:"Go back home"}},setup(t){const o=t;return h({title:`${o.statusCode} - ${o.statusMessage} | ${o.appName}`,script:[],style:[{children:'*,:before,:after{-webkit-box-sizing:border-box;box-sizing:border-box;border-width:0;border-style:solid;border-color:#e0e0e0}*{--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(14, 165, 233, .5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000}:root{-moz-tab-size:4;-o-tab-size:4;tab-size:4}a{color:inherit;text-decoration:inherit}body{margin:0;font-family:inherit;line-height:inherit}html{-webkit-text-size-adjust:100%;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";line-height:1.5}h1,p{margin:0}h1{font-size:inherit;font-weight:inherit}'}]}),(k,N)=>{const i=c;return a(),n("div",u,[g,e("div",b,[e("h1",{class:"text-8xl sm:text-10xl font-medium mb-8",textContent:s(t.statusCode)},null,8,_),e("p",{class:"text-xl px-8 sm:px-0 sm:text-4xl font-light mb-16 leading-tight",textContent:s(t.description)},null,8,w),e("div",y,[r(i,{to:"/",class:"gradient-border text-md sm:text-xl py-2 px-4 sm:py-3 sm:px-6 cursor-pointer"},{default:l(()=>[d(s(t.backHome),1)]),_:1})])])])}}},C=f(S,[["__scopeId","data-v-05a2b8a3"]]);export{C as default};
|
package/dist/client/index.html
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!DOCTYPE html><html><head><meta charset="utf-8">
|
|
2
2
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
3
3
|
<link rel="stylesheet" href="/__nuxt-scripts/_nuxt/entry.D91GVkD7.css">
|
|
4
|
-
<link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/
|
|
4
|
+
<link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/BVIyUFBp.js">
|
|
5
5
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/DXFkqnOI.js">
|
|
6
6
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/D6NljDpC.js">
|
|
7
7
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/CowR2XfX.js">
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/DUdlC5k_.js">
|
|
89
89
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/C5gCGmDW.js">
|
|
90
90
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/DAGYewaG.js">
|
|
91
|
-
<link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/
|
|
91
|
+
<link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/BG_OyJVq.js">
|
|
92
92
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/DZqG9GXz.js">
|
|
93
93
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/DmDrTTlz.js">
|
|
94
94
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/BR6CMsBL.js">
|
|
@@ -167,6 +167,7 @@
|
|
|
167
167
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/C_8Fx7bH.js">
|
|
168
168
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/7fd6vGzb.js">
|
|
169
169
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/BT9ZzGyQ.js">
|
|
170
|
+
<link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/DnLUQrgA.js">
|
|
170
171
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/DCdPDLy4.js">
|
|
171
172
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/I4qd5QHW.js">
|
|
172
173
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/C2TBxDwV.js">
|
|
@@ -229,10 +230,10 @@
|
|
|
229
230
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/DggdVF2v.js">
|
|
230
231
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/A1WiD9SJ.js">
|
|
231
232
|
<link rel="prefetch" as="style" href="/__nuxt-scripts/_nuxt/error-404.ORekjfyJ.css">
|
|
232
|
-
<link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/
|
|
233
|
-
<link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/
|
|
233
|
+
<link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/vqIOxd68.js">
|
|
234
|
+
<link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/D1ek2jBE.js">
|
|
234
235
|
<link rel="prefetch" as="style" href="/__nuxt-scripts/_nuxt/error-500.BIuFL0tW.css">
|
|
235
|
-
<link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/
|
|
236
|
-
<script type="module" src="/__nuxt-scripts/_nuxt/
|
|
236
|
+
<link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/CV_REd8b.js">
|
|
237
|
+
<script type="module" src="/__nuxt-scripts/_nuxt/BVIyUFBp.js" crossorigin></script><script>"use strict";(()=>{const a=window,e=document.documentElement,c=window.localStorage,d=["dark","light"],n=c&&c.getItem&&c.getItem("nuxt-color-mode")||"system";let l=n==="system"?f():n;const i=e.getAttribute("data-color-mode-forced");i&&(l=i),r(l),a["__NUXT_COLOR_MODE__"]={preference:n,value:l,getColorScheme:f,addColorScheme:r,removeColorScheme:u};function r(o){const t=""+o+"",s="";e.classList?e.classList.add(t):e.className+=" "+t,s&&e.setAttribute("data-"+s,o)}function u(o){const t=""+o+"",s="";e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp(t,"g"),""),s&&e.removeAttribute("data-"+s)}function m(o){return a.matchMedia("(prefers-color-scheme"+o+")")}function f(){if(a.matchMedia&&m("").media!=="not all"){for(const o of d)if(m(":"+o).matches)return o}return"light"}})();
|
|
237
238
|
</script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" id="__NUXT_DATA__" data-ssr="false">[{"_errors":1,"serverRendered":2,"data":3,"state":4,"once":5},{},false,{},{},["Set"]]</script>
|
|
238
239
|
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-scripts",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/module.d.mts
CHANGED
|
@@ -1,68 +1,15 @@
|
|
|
1
1
|
import * as nuxt_schema from 'nuxt/schema';
|
|
2
|
-
import
|
|
3
|
-
import { Input } from 'valibot';
|
|
4
|
-
import { UseScriptOptions } from '@unhead/schema';
|
|
5
|
-
import { UseScriptInput } from '@unhead/vue';
|
|
6
|
-
|
|
7
|
-
type NuxtUseScriptOptions<T = any> = Omit<UseScriptOptions<T>, 'trigger'> & {
|
|
8
|
-
/**
|
|
9
|
-
* The trigger to load the script:
|
|
10
|
-
* - `onNuxtReady` - Load the script when Nuxt is ready.
|
|
11
|
-
* - `manual` - Load the script manually by calling `$script.load()` or `$script.waitForLoad()`.
|
|
12
|
-
* - `Promise` - Load the script when the promise resolves.
|
|
13
|
-
*/
|
|
14
|
-
trigger?: UseScriptOptions<T>['trigger'] | 'onNuxtReady';
|
|
15
|
-
/**
|
|
16
|
-
* Should the script be bundled as an asset and loaded from your server. This is useful for improving the
|
|
17
|
-
* performance by avoiding the extra DNS lookup and reducing the number of requests. It also
|
|
18
|
-
* improves privacy by not sharing the user's IP address with third-party servers.
|
|
19
|
-
*/
|
|
20
|
-
assetStrategy?: 'bundle';
|
|
21
|
-
/**
|
|
22
|
-
* A hook to run when a script does not exist and will be initialized for the first time.
|
|
23
|
-
*/
|
|
24
|
-
beforeInit?: () => void;
|
|
25
|
-
};
|
|
26
|
-
type NuxtUseScriptInput = UseScriptInput;
|
|
27
|
-
|
|
28
|
-
interface CloudflareWebAnalyticsApi {
|
|
29
|
-
__cfBeacon: {
|
|
30
|
-
load: 'single';
|
|
31
|
-
spa: boolean;
|
|
32
|
-
token: string;
|
|
33
|
-
};
|
|
34
|
-
__cfRl?: unknown;
|
|
35
|
-
}
|
|
36
|
-
declare global {
|
|
37
|
-
interface Window extends CloudflareWebAnalyticsApi {
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
declare const CloudflareWebAnalyticsOptions: valibot.ObjectSchema<{
|
|
41
|
-
/**
|
|
42
|
-
* The Cloudflare Web Analytics token.
|
|
43
|
-
*
|
|
44
|
-
* Required when used for the first time.
|
|
45
|
-
*/
|
|
46
|
-
token: valibot.StringSchema<string>;
|
|
47
|
-
/**
|
|
48
|
-
* Cloudflare Web Analytics enables measuring SPAs automatically by overriding the History API’s pushState function
|
|
49
|
-
* and listening to the onpopstate. Hash-based router is not supported.
|
|
50
|
-
*
|
|
51
|
-
* @default true
|
|
52
|
-
*/
|
|
53
|
-
spa: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, undefined, boolean | undefined>;
|
|
54
|
-
}, undefined, {
|
|
55
|
-
token: string;
|
|
56
|
-
spa?: boolean | undefined;
|
|
57
|
-
}>;
|
|
2
|
+
import { ScriptRegistry, NuxtUseScriptOptions, NuxtUseScriptInput, RegistryScripts } from '#nuxt-scripts';
|
|
58
3
|
|
|
59
4
|
interface ModuleOptions {
|
|
60
5
|
/**
|
|
61
6
|
* Register scripts globally.
|
|
62
7
|
*/
|
|
63
|
-
register?:
|
|
64
|
-
|
|
65
|
-
|
|
8
|
+
register?: ScriptRegistry;
|
|
9
|
+
/**
|
|
10
|
+
* Default options for scripts.
|
|
11
|
+
*/
|
|
12
|
+
defaultScriptOptions?: NuxtUseScriptOptions;
|
|
66
13
|
/**
|
|
67
14
|
* Register scripts that should be loaded globally on all pages.
|
|
68
15
|
*/
|
|
@@ -70,9 +17,7 @@ interface ModuleOptions {
|
|
|
70
17
|
/**
|
|
71
18
|
* Override the static script options for specific scripts based on their provided `key` or `src`.
|
|
72
19
|
*/
|
|
73
|
-
overrides?:
|
|
74
|
-
[key: string]: Pick<NuxtUseScriptOptions, 'assetStrategy'>;
|
|
75
|
-
};
|
|
20
|
+
overrides?: Record<keyof ScriptRegistry, Pick<NuxtUseScriptOptions, 'assetStrategy'>>;
|
|
76
21
|
/** Configure the way scripts assets are exposed */
|
|
77
22
|
assets?: {
|
|
78
23
|
/**
|
|
@@ -80,7 +25,11 @@ interface ModuleOptions {
|
|
|
80
25
|
* @default '/_scripts/'
|
|
81
26
|
*/
|
|
82
27
|
prefix?: string;
|
|
83
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Scripts assets are exposed as public assets as part of the build.
|
|
30
|
+
*
|
|
31
|
+
* TODO Make configurable in future.
|
|
32
|
+
*/
|
|
84
33
|
strategy?: 'public';
|
|
85
34
|
};
|
|
86
35
|
/**
|
|
@@ -100,10 +49,7 @@ interface ModuleHooks {
|
|
|
100
49
|
/**
|
|
101
50
|
* Transform a script before it's registered.
|
|
102
51
|
*/
|
|
103
|
-
'scripts:
|
|
104
|
-
script: string;
|
|
105
|
-
options: any;
|
|
106
|
-
}) => Promise<void>;
|
|
52
|
+
'scripts:registry': (registry: RegistryScripts) => Promise<void>;
|
|
107
53
|
}
|
|
108
54
|
declare const _default: nuxt_schema.NuxtModule<ModuleOptions>;
|
|
109
55
|
|
package/dist/module.d.ts
CHANGED
|
@@ -1,68 +1,15 @@
|
|
|
1
1
|
import * as nuxt_schema from 'nuxt/schema';
|
|
2
|
-
import
|
|
3
|
-
import { Input } from 'valibot';
|
|
4
|
-
import { UseScriptOptions } from '@unhead/schema';
|
|
5
|
-
import { UseScriptInput } from '@unhead/vue';
|
|
6
|
-
|
|
7
|
-
type NuxtUseScriptOptions<T = any> = Omit<UseScriptOptions<T>, 'trigger'> & {
|
|
8
|
-
/**
|
|
9
|
-
* The trigger to load the script:
|
|
10
|
-
* - `onNuxtReady` - Load the script when Nuxt is ready.
|
|
11
|
-
* - `manual` - Load the script manually by calling `$script.load()` or `$script.waitForLoad()`.
|
|
12
|
-
* - `Promise` - Load the script when the promise resolves.
|
|
13
|
-
*/
|
|
14
|
-
trigger?: UseScriptOptions<T>['trigger'] | 'onNuxtReady';
|
|
15
|
-
/**
|
|
16
|
-
* Should the script be bundled as an asset and loaded from your server. This is useful for improving the
|
|
17
|
-
* performance by avoiding the extra DNS lookup and reducing the number of requests. It also
|
|
18
|
-
* improves privacy by not sharing the user's IP address with third-party servers.
|
|
19
|
-
*/
|
|
20
|
-
assetStrategy?: 'bundle';
|
|
21
|
-
/**
|
|
22
|
-
* A hook to run when a script does not exist and will be initialized for the first time.
|
|
23
|
-
*/
|
|
24
|
-
beforeInit?: () => void;
|
|
25
|
-
};
|
|
26
|
-
type NuxtUseScriptInput = UseScriptInput;
|
|
27
|
-
|
|
28
|
-
interface CloudflareWebAnalyticsApi {
|
|
29
|
-
__cfBeacon: {
|
|
30
|
-
load: 'single';
|
|
31
|
-
spa: boolean;
|
|
32
|
-
token: string;
|
|
33
|
-
};
|
|
34
|
-
__cfRl?: unknown;
|
|
35
|
-
}
|
|
36
|
-
declare global {
|
|
37
|
-
interface Window extends CloudflareWebAnalyticsApi {
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
declare const CloudflareWebAnalyticsOptions: valibot.ObjectSchema<{
|
|
41
|
-
/**
|
|
42
|
-
* The Cloudflare Web Analytics token.
|
|
43
|
-
*
|
|
44
|
-
* Required when used for the first time.
|
|
45
|
-
*/
|
|
46
|
-
token: valibot.StringSchema<string>;
|
|
47
|
-
/**
|
|
48
|
-
* Cloudflare Web Analytics enables measuring SPAs automatically by overriding the History API’s pushState function
|
|
49
|
-
* and listening to the onpopstate. Hash-based router is not supported.
|
|
50
|
-
*
|
|
51
|
-
* @default true
|
|
52
|
-
*/
|
|
53
|
-
spa: valibot.OptionalSchema<valibot.BooleanSchema<boolean>, undefined, boolean | undefined>;
|
|
54
|
-
}, undefined, {
|
|
55
|
-
token: string;
|
|
56
|
-
spa?: boolean | undefined;
|
|
57
|
-
}>;
|
|
2
|
+
import { ScriptRegistry, NuxtUseScriptOptions, NuxtUseScriptInput, RegistryScripts } from '#nuxt-scripts';
|
|
58
3
|
|
|
59
4
|
interface ModuleOptions {
|
|
60
5
|
/**
|
|
61
6
|
* Register scripts globally.
|
|
62
7
|
*/
|
|
63
|
-
register?:
|
|
64
|
-
|
|
65
|
-
|
|
8
|
+
register?: ScriptRegistry;
|
|
9
|
+
/**
|
|
10
|
+
* Default options for scripts.
|
|
11
|
+
*/
|
|
12
|
+
defaultScriptOptions?: NuxtUseScriptOptions;
|
|
66
13
|
/**
|
|
67
14
|
* Register scripts that should be loaded globally on all pages.
|
|
68
15
|
*/
|
|
@@ -70,9 +17,7 @@ interface ModuleOptions {
|
|
|
70
17
|
/**
|
|
71
18
|
* Override the static script options for specific scripts based on their provided `key` or `src`.
|
|
72
19
|
*/
|
|
73
|
-
overrides?:
|
|
74
|
-
[key: string]: Pick<NuxtUseScriptOptions, 'assetStrategy'>;
|
|
75
|
-
};
|
|
20
|
+
overrides?: Record<keyof ScriptRegistry, Pick<NuxtUseScriptOptions, 'assetStrategy'>>;
|
|
76
21
|
/** Configure the way scripts assets are exposed */
|
|
77
22
|
assets?: {
|
|
78
23
|
/**
|
|
@@ -80,7 +25,11 @@ interface ModuleOptions {
|
|
|
80
25
|
* @default '/_scripts/'
|
|
81
26
|
*/
|
|
82
27
|
prefix?: string;
|
|
83
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Scripts assets are exposed as public assets as part of the build.
|
|
30
|
+
*
|
|
31
|
+
* TODO Make configurable in future.
|
|
32
|
+
*/
|
|
84
33
|
strategy?: 'public';
|
|
85
34
|
};
|
|
86
35
|
/**
|
|
@@ -100,10 +49,7 @@ interface ModuleHooks {
|
|
|
100
49
|
/**
|
|
101
50
|
* Transform a script before it's registered.
|
|
102
51
|
*/
|
|
103
|
-
'scripts:
|
|
104
|
-
script: string;
|
|
105
|
-
options: any;
|
|
106
|
-
}) => Promise<void>;
|
|
52
|
+
'scripts:registry': (registry: RegistryScripts) => Promise<void>;
|
|
107
53
|
}
|
|
108
54
|
declare const _default: nuxt_schema.NuxtModule<ModuleOptions>;
|
|
109
55
|
|
package/dist/module.json
CHANGED