@nuxt/scripts 0.1.0 → 0.1.1
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/README.md +198 -46
- package/dist/client/200.html +233 -230
- package/dist/client/404.html +233 -230
- package/dist/client/_nuxt/{mojo.Cr5EkBff.js → -7WWnkdy.js} +9 -11
- package/dist/client/_nuxt/{bicep.BnL-ovff.js → 3ghuYFLd.js} +1 -1
- package/dist/client/_nuxt/7fd6vGzb.js +1 -0
- package/dist/client/_nuxt/8t4jSAMm.js +1 -0
- package/dist/client/_nuxt/A1WiD9SJ.js +1 -0
- package/dist/client/_nuxt/B6nY7VDA.js +25 -0
- package/dist/client/_nuxt/{angular-ts.BCBvF5Sf.js → B9E_xdxs.js} +1 -1
- package/dist/client/_nuxt/BBv1LFm6.js +6 -0
- package/dist/client/_nuxt/BILqrcpa.js +1 -0
- package/dist/client/_nuxt/BIMuYTWL.js +3 -0
- package/dist/client/_nuxt/BN4LRXf6.js +4 -0
- package/dist/client/_nuxt/{cpp.BnO_O5bK.js → BOnd8D4O.js} +1 -1
- package/dist/client/_nuxt/BR6CMsBL.js +1 -0
- package/dist/client/_nuxt/BTtaZsq5.js +1 -0
- package/dist/client/_nuxt/BXF7Vm5l.js +1 -0
- package/dist/client/_nuxt/BaNxgKSR.js +17 -0
- package/dist/client/_nuxt/Bbv8ARUV.js +13 -0
- package/dist/client/_nuxt/Bd7iooY8.js +8 -0
- package/dist/client/_nuxt/Bdb36Id5.js +1 -0
- package/dist/client/_nuxt/BeX7Iu5M.js +90 -0
- package/dist/client/_nuxt/{coffee.t_LrLW_f.js → Bg0wAK5a.js} +1 -1
- package/dist/client/_nuxt/{mdc.CdZ-F1IA.js → BgBwMnrY.js} +1 -1
- package/dist/client/_nuxt/BiDE021q.js +1 -0
- package/dist/client/_nuxt/{hack.B30vrIHT.js → BmCW-tYz.js} +1 -1
- package/dist/client/_nuxt/BsfQk1vf.js +1 -0
- package/dist/client/_nuxt/{zig.BEeHvBXh.js → Bsp1M94H.js} +1 -1
- package/dist/client/_nuxt/BswfO-CF.js +1 -0
- package/dist/client/_nuxt/{blade.Ge7MpD7w.js → C1DVX8_8.js} +1 -1
- package/dist/client/_nuxt/CGQbO34C.js +1 -0
- package/dist/client/_nuxt/CJQrLysU.js +1 -0
- package/dist/client/_nuxt/CJxX2Ta8.js +1 -0
- package/dist/client/_nuxt/CL7Ixq1B.js +1 -0
- package/dist/client/_nuxt/CPHkTjfH.js +1 -0
- package/dist/client/_nuxt/CQTpvb7m.js +1 -0
- package/dist/client/_nuxt/CQUCfALx.js +13 -0
- package/dist/client/_nuxt/CRWwmX0L.js +1 -0
- package/dist/client/_nuxt/CUVblut_.js +1 -0
- package/dist/client/_nuxt/CZZ6oYdA.js +1 -0
- package/dist/client/_nuxt/{html.CuK0VrWf.js → CbViG2Xw.js} +1 -1
- package/dist/client/_nuxt/CkMwVfOK.js +1 -0
- package/dist/client/_nuxt/CrjQeCwm.js +1 -0
- package/dist/client/_nuxt/{onig.BbrMXqi_.js → CsTmP73Z.js} +1 -1
- package/dist/client/_nuxt/CsYA0RN7.js +1 -0
- package/dist/client/_nuxt/{php.DEqKwr-6.js → Cthz8VOO.js} +1 -1
- package/dist/client/_nuxt/D-pQtGOP.js +1 -0
- package/dist/client/_nuxt/D4LaosRr.js +1 -0
- package/dist/client/_nuxt/D4k753MY.js +1 -0
- package/dist/client/_nuxt/DAVo6uMX.js +1 -0
- package/dist/client/_nuxt/{apl.7kPAH7yp.js → DC4hdoM9.js} +1 -1
- package/dist/client/_nuxt/{ruby.D5H8ZR7S.js → DCAtC51B.js} +1 -1
- package/dist/client/_nuxt/{twig.BOpxGNkQ.js → DCdPDLy4.js} +1 -1
- package/dist/client/_nuxt/DCj4DH6i.js +1 -0
- package/dist/client/_nuxt/{markdown.CRQpHayV.js → DCk2z-Tu.js} +1 -1
- package/dist/client/_nuxt/DJZWsvj0.js +1 -0
- package/dist/client/_nuxt/DLP9ZvWb.js +3 -0
- package/dist/client/_nuxt/DUdlC5k_.js +1 -0
- package/dist/client/_nuxt/DXpYegZJ.js +1 -0
- package/dist/client/_nuxt/DY7_9Ga-.js +1 -0
- package/dist/client/_nuxt/DZ3fVoEH.js +1 -0
- package/dist/client/_nuxt/DeBxnUN1.js +1 -0
- package/dist/client/_nuxt/{http.BZ0kU-IF.js → DfUNg_8t.js} +1 -1
- package/dist/client/_nuxt/{liquid.Cp8214eI.js → Dg0DGYq4.js} +1 -1
- package/dist/client/_nuxt/DggdVF2v.js +1 -0
- package/dist/client/_nuxt/DhFF74a2.js +1 -0
- package/dist/client/_nuxt/DnhXxWz-.js +1 -0
- package/dist/client/_nuxt/DouzTJIq.js +1 -0
- package/dist/client/_nuxt/{angular-html.833w9gUK.js → DsudziMp.js} +1 -1
- package/dist/client/_nuxt/Due3_iNp.js +36 -0
- package/dist/client/_nuxt/Dwo2i-71.js +1 -0
- package/dist/client/_nuxt/Dz2Ca8U2.js +1 -0
- package/dist/client/_nuxt/{imba.DxX1Vuw3.js → DzwdaLuO.js} +1 -1
- package/dist/client/_nuxt/IHMnEr_d.js +1 -0
- package/dist/client/_nuxt/NL97_oaV.js +1 -0
- package/dist/client/_nuxt/RE3ujT-k.js +1 -0
- package/dist/client/_nuxt/RgJsN3zu.js +1 -0
- package/dist/client/_nuxt/TQ9oWRfF.js +1 -0
- package/dist/client/_nuxt/UREJT2Bw.js +1 -0
- package/dist/client/_nuxt/WoBtJUue.js +1 -0
- package/dist/client/_nuxt/{andromeeda.Bv7o_0DK.js → YxQm0tCS.js} +1 -1
- package/dist/client/_nuxt/{julia.CO0c-z84.js → ZQC2c-5V.js} +2 -2
- package/dist/client/_nuxt/bmJ2objS.js +1 -0
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/40295b3c-3eb9-4043-bd2e-dac38ac5d90a.json +1 -0
- package/dist/client/_nuxt/doGI2cFk.js +1 -0
- package/dist/client/_nuxt/{entry.CYm5lUm_.css → entry.D91GVkD7.css} +1 -1
- package/dist/client/_nuxt/ithNYyXa.js +1 -0
- package/dist/client/_nuxt/sQpxpyUs.js +1 -0
- package/dist/client/_nuxt/wORFcijT.js +32 -0
- package/dist/client/_nuxt/{razor.Cstpb-uc.js → wPLeKH6q.js} +1 -1
- package/dist/client/index.html +233 -230
- package/dist/module.d.mts +35 -12
- package/dist/module.d.ts +35 -12
- package/dist/module.json +2 -2
- package/dist/module.mjs +218 -6
- package/dist/runtime/composables/createScriptConsentTrigger.d.ts +6 -0
- package/dist/runtime/composables/createScriptConsentTrigger.mjs +36 -0
- package/dist/runtime/composables/useAnalyticsPageEvent.d.ts +2 -0
- package/dist/runtime/composables/useAnalyticsPageEvent.mjs +35 -0
- package/dist/runtime/composables/useScript.d.ts +5 -4
- package/dist/runtime/composables/useScript.mjs +14 -17
- package/dist/runtime/types.d.ts +32 -6
- package/package.json +30 -16
- package/dist/client/_nuxt/Icon.CHLfKFL4.js +0 -1
- package/dist/client/_nuxt/Icon.Dis01nq0.css +0 -1
- package/dist/client/_nuxt/IconCSS.Cca5dNND.css +0 -1
- package/dist/client/_nuxt/IconCSS.sJLYSucz.js +0 -1
- package/dist/client/_nuxt/_plugin-vue_export-helper.DlAUqK2U.js +0 -1
- package/dist/client/_nuxt/astro.B72C2l14.js +0 -1
- package/dist/client/_nuxt/builds/meta/4475dec8-7a8e-4367-88b5-60d8bc425ff6.json +0 -1
- package/dist/client/_nuxt/catppuccin-frappe.CSSpeNoc.js +0 -1
- package/dist/client/_nuxt/catppuccin-latte.BKmRr8wc.js +0 -1
- package/dist/client/_nuxt/catppuccin-macchiato.3Hompcvk.js +0 -1
- package/dist/client/_nuxt/catppuccin-mocha.Bxe0CTgP.js +0 -1
- package/dist/client/_nuxt/cobol.V9VEyzKl.js +0 -1
- package/dist/client/_nuxt/crystal.kQaLR197.js +0 -25
- package/dist/client/_nuxt/dart.BmadmVm4.js +0 -1
- package/dist/client/_nuxt/elixir.CpdO1lki.js +0 -17
- package/dist/client/_nuxt/elm.DbZvrHdh.js +0 -1
- package/dist/client/_nuxt/entry.DGHcQ5Fj.js +0 -36
- package/dist/client/_nuxt/erb.PjiSmVwo.js +0 -1
- package/dist/client/_nuxt/error-404.DUbMs4uL.js +0 -1
- package/dist/client/_nuxt/error-500.BzL1fy75.js +0 -1
- package/dist/client/_nuxt/fortran-fixed-form.Cx0tWteX.js +0 -1
- package/dist/client/_nuxt/fsharp.DPkxF5yZ.js +0 -1
- package/dist/client/_nuxt/gdresource.Dyo1-XBj.js +0 -1
- package/dist/client/_nuxt/git-commit.aPmGthaS.js +0 -1
- package/dist/client/_nuxt/git-rebase.Cl-c85-0.js +0 -1
- package/dist/client/_nuxt/glimmer-js.C8_h80UD.js +0 -13
- package/dist/client/_nuxt/glimmer-ts.jzigfKdB.js +0 -13
- package/dist/client/_nuxt/glsl.-GlVTnW0.js +0 -1
- package/dist/client/_nuxt/go.XCGcAo4I.js +0 -1
- package/dist/client/_nuxt/graphql.C4V4xKFR.js +0 -4
- package/dist/client/_nuxt/haml.CAKsSe2e.js +0 -1
- package/dist/client/_nuxt/handlebars.W0zz18bm.js +0 -1
- package/dist/client/_nuxt/hcl.qyqQxnfZ.js +0 -1
- package/dist/client/_nuxt/html-derivative.fiapQfxX.js +0 -1
- package/dist/client/_nuxt/index.DKzsDYrr.js +0 -1
- package/dist/client/_nuxt/jinja.DWD-OL5F.js +0 -1
- package/dist/client/_nuxt/jison.CHwQvgii.js +0 -1
- package/dist/client/_nuxt/latex.DZUj4xYJ.js +0 -3
- package/dist/client/_nuxt/lua.0ontURQf.js +0 -1
- package/dist/client/_nuxt/marko.Dg8Ifwb-.js +0 -8
- package/dist/client/_nuxt/move.Dl0g34Y3.js +0 -1
- package/dist/client/_nuxt/nginx.DGQ8U8YC.js +0 -1
- package/dist/client/_nuxt/nim.By3iP3OP.js +0 -1
- package/dist/client/_nuxt/nushell.C56EW6Ky.js +0 -1
- package/dist/client/_nuxt/one-dark-pro.BC6PHXLE.js +0 -1
- package/dist/client/_nuxt/perl.Czv4QcIx.js +0 -1
- package/dist/client/_nuxt/pug.BWq4yR4F.js +0 -1
- package/dist/client/_nuxt/rst.CXc8L5wR.js +0 -1
- package/dist/client/_nuxt/sas.2Dj3KWk-.js +0 -1
- package/dist/client/_nuxt/scss.Dr-_CcBd.js +0 -90
- package/dist/client/_nuxt/shaderlab.D_C8j_yu.js +0 -1
- package/dist/client/_nuxt/shellscript.BVYSsK7b.js +0 -1
- package/dist/client/_nuxt/shellsession.BgTI27pK.js +0 -1
- package/dist/client/_nuxt/sparql.DJ46LgWq.js +0 -1
- package/dist/client/_nuxt/stata.DCIeX9IZ.js +0 -3
- package/dist/client/_nuxt/svelte.DPVrELNy.js +0 -1
- package/dist/client/_nuxt/terraform.CdYS7vZw.js +0 -1
- package/dist/client/_nuxt/tex.BKGhwytq.js +0 -1
- package/dist/client/_nuxt/vitesse-black.BO-UM1Vz.js +0 -1
- package/dist/client/_nuxt/vitesse-dark.CHrOy2Zl.js +0 -1
- package/dist/client/_nuxt/vitesse-light.BXgTKZPQ.js +0 -1
- package/dist/client/_nuxt/vue-html.CONbZieF.js +0 -1
- package/dist/client/_nuxt/vue.BIFGmPSe.js +0 -6
- package/dist/client/_nuxt/vue.f36acd1f.DH8ulvYW.js +0 -1
- package/dist/client/_nuxt/xml.BzTcx3OS.js +0 -1
- package/dist/client/_nuxt/xsl.lJB8dDLf.js +0 -1
- package/dist/runtime/composables/isDoNotTrackEnabled.d.ts +0 -1
- package/dist/runtime/composables/isDoNotTrackEnabled.mjs +0 -15
- package/dist/runtime/composables/useTrackingScript.d.ts +0 -5
- package/dist/runtime/composables/useTrackingScript.mjs +0 -32
- /package/dist/client/_nuxt/{scheme.1Je9_Reo.js → 1Je9_Reo.js} +0 -0
- /package/dist/client/_nuxt/{puppet.37ic6j3l.js → 37ic6j3l.js} +0 -0
- /package/dist/client/_nuxt/{rel.6Kuza3Wr.js → 6Kuza3Wr.js} +0 -0
- /package/dist/client/_nuxt/{splunk.6XBPEST2.js → 6XBPEST2.js} +0 -0
- /package/dist/client/_nuxt/{dracula-soft.9B1nZgL-.js → 9B1nZgL-.js} +0 -0
- /package/dist/client/_nuxt/{powershell.9ZOzOPqN.js → 9ZOzOPqN.js} +0 -0
- /package/dist/client/_nuxt/{riscv.AgnqFTPX.js → AgnqFTPX.js} +0 -0
- /package/dist/client/_nuxt/{zenscript.B1nm99XP.js → B1nm99XP.js} +0 -0
- /package/dist/client/_nuxt/{material-theme.B2BuIiKK.js → B2BuIiKK.js} +0 -0
- /package/dist/client/_nuxt/{csv.B2DkETJQ.js → B2DkETJQ.js} +0 -0
- /package/dist/client/_nuxt/{applescript.B4yE-MfL.js → B4yE-MfL.js} +0 -0
- /package/dist/client/_nuxt/{narrat.B9CT-1u6.js → B9CT-1u6.js} +0 -0
- /package/dist/client/_nuxt/{make.B9S9BZZh.js → B9S9BZZh.js} +0 -0
- /package/dist/client/_nuxt/{synthwave-84.BBDuFDsq.js → BBDuFDsq.js} +0 -0
- /package/dist/client/_nuxt/{prisma.BBJYjQ0k.js → BBJYjQ0k.js} +0 -0
- /package/dist/client/_nuxt/{clojure.BF6G6X0H.js → BF6G6X0H.js} +0 -0
- /package/dist/client/_nuxt/{ssh-config.BH1M7C1g.js → BH1M7C1g.js} +0 -0
- /package/dist/client/_nuxt/{prolog.BH_RS3WO.js → BH_RS3WO.js} +0 -0
- /package/dist/client/_nuxt/{wolfram.BICIrM8O.js → BICIrM8O.js} +0 -0
- /package/dist/client/_nuxt/{min-light.BITGhEdf.js → BITGhEdf.js} +0 -0
- /package/dist/client/_nuxt/{kotlin.BIxS-Weu.js → BIxS-Weu.js} +0 -0
- /package/dist/client/_nuxt/{viml.BLluXI4E.js → BLluXI4E.js} +0 -0
- /package/dist/client/_nuxt/{codeql.BOpLLL-w.js → BOpLLL-w.js} +0 -0
- /package/dist/client/_nuxt/{bat.BPiaQZfK.js → BPiaQZfK.js} +0 -0
- /package/dist/client/_nuxt/{vesper.BSB_bK09.js → BSB_bK09.js} +0 -0
- /package/dist/client/_nuxt/{mermaid.BSyl5yf0.js → BSyl5yf0.js} +0 -0
- /package/dist/client/_nuxt/{toml.BT9ZzGyQ.js → BT9ZzGyQ.js} +0 -0
- /package/dist/client/_nuxt/{jsonl.BUpeXbsf.js → BUpeXbsf.js} +0 -0
- /package/dist/client/_nuxt/{objective-cpp.BWKJ1FCf.js → BWKJ1FCf.js} +0 -0
- /package/dist/client/_nuxt/{r.BXfENWL6.js → BXfENWL6.js} +0 -0
- /package/dist/client/_nuxt/{wgsl.BZz1Hhek.js → BZz1Hhek.js} +0 -0
- /package/dist/client/_nuxt/{gdshader.B_SUYfiV.js → B_SUYfiV.js} +0 -0
- /package/dist/client/_nuxt/{aurora-x.BaWyeHV_.js → BaWyeHV_.js} +0 -0
- /package/dist/client/_nuxt/{bibtex.BaedD2tq.js → BaedD2tq.js} +0 -0
- /package/dist/client/_nuxt/{plsql.BbJj1K1w.js → BbJj1K1w.js} +0 -0
- /package/dist/client/_nuxt/{night-owl.BeocmOPF.js → BeocmOPF.js} +0 -0
- /package/dist/client/_nuxt/{cadence.Bgpqy2XC.js → Bgpqy2XC.js} +0 -0
- /package/dist/client/_nuxt/{json5.Bh8mriwU.js → Bh8mriwU.js} +0 -0
- /package/dist/client/_nuxt/{rose-pine-dawn.Bj5xdiaE.js → Bj5xdiaE.js} +0 -0
- /package/dist/client/_nuxt/{tsx.BlxWTfDV.js → BlxWTfDV.js} +0 -0
- /package/dist/client/_nuxt/{ayu-dark.Bn5gmY5k.js → Bn5gmY5k.js} +0 -0
- /package/dist/client/_nuxt/{material-theme-darker.BrGg7AAd.js → BrGg7AAd.js} +0 -0
- /package/dist/client/_nuxt/{light-plus.BsvsQ1iS.js → BsvsQ1iS.js} +0 -0
- /package/dist/client/_nuxt/{matlab.Btshr8M_.js → Btshr8M_.js} +0 -0
- /package/dist/client/_nuxt/{tasl.BxwAa5i0.js → BxwAa5i0.js} +0 -0
- /package/dist/client/_nuxt/{cypher.ByMv4Xf1.js → ByMv4Xf1.js} +0 -0
- /package/dist/client/_nuxt/{pascal.Bz4xi2rU.js → Bz4xi2rU.js} +0 -0
- /package/dist/client/_nuxt/{turtle.C15OxdQ5.js → C15OxdQ5.js} +0 -0
- /package/dist/client/_nuxt/{v.C2TBxDwV.js → C2TBxDwV.js} +0 -0
- /package/dist/client/_nuxt/{erlang.C3YqBJkQ.js → C3YqBJkQ.js} +0 -0
- /package/dist/client/_nuxt/{yaml.C5gCGmDW.js → C5gCGmDW.js} +0 -0
- /package/dist/client/_nuxt/{cue.C6Aznpr-.js → C6Aznpr-.js} +0 -0
- /package/dist/client/_nuxt/{slack-dark.C7oZ9nno.js → C7oZ9nno.js} +0 -0
- /package/dist/client/_nuxt/{solarized-dark.C86elO-m.js → C86elO-m.js} +0 -0
- /package/dist/client/_nuxt/{jsonnet.C9d3aiqh.js → C9d3aiqh.js} +0 -0
- /package/dist/client/_nuxt/{powerquery.CApMHEaB.js → CApMHEaB.js} +0 -0
- /package/dist/client/_nuxt/{material-theme-ocean.CBL0qBdF.js → CBL0qBdF.js} +0 -0
- /package/dist/client/_nuxt/{mdx.CBPJd_fO.js → CBPJd_fO.js} +0 -0
- /package/dist/client/_nuxt/{ara.CG4fK2Nq.js → CG4fK2Nq.js} +0 -0
- /package/dist/client/_nuxt/{clarity.CIekO_uJ.js → CIekO_uJ.js} +0 -0
- /package/dist/client/_nuxt/{sass.CMDmr8et.js → CMDmr8et.js} +0 -0
- /package/dist/client/_nuxt/{github-dark-dimmed.CRDKj6ck.js → CRDKj6ck.js} +0 -0
- /package/dist/client/_nuxt/{github-light.CRlnGVMD.js → CRlnGVMD.js} +0 -0
- /package/dist/client/_nuxt/{solidity.CThH5sBG.js → CThH5sBG.js} +0 -0
- /package/dist/client/_nuxt/{rose-pine.CX_FIdg1.js → CX_FIdg1.js} +0 -0
- /package/dist/client/_nuxt/{tcl.C_8Fx7bH.js → C_8Fx7bH.js} +0 -0
- /package/dist/client/_nuxt/{css.CbYhyuC0.js → CbYhyuC0.js} +0 -0
- /package/dist/client/_nuxt/{poimandres.Cda-MJFk.js → Cda-MJFk.js} +0 -0
- /package/dist/client/_nuxt/{rose-pine-moon.CdedUr_-.js → CdedUr_-.js} +0 -0
- /package/dist/client/_nuxt/{purescript.CfPQhs6g.js → CfPQhs6g.js} +0 -0
- /package/dist/client/_nuxt/{wasm.Cicx_DS6.js → Cicx_DS6.js} +0 -0
- /package/dist/client/_nuxt/{java.ClXEvkw9.js → ClXEvkw9.js} +0 -0
- /package/dist/client/_nuxt/{gdscript.CoEqzGFw.js → CoEqzGFw.js} +0 -0
- /package/dist/client/_nuxt/{ada.CowR2XfX.js → CowR2XfX.js} +0 -0
- /package/dist/client/_nuxt/{reg.CrhH3_Og.js → CrhH3_Og.js} +0 -0
- /package/dist/client/_nuxt/{nord.CsyjKwr8.js → CsyjKwr8.js} +0 -0
- /package/dist/client/_nuxt/{jsx.CsyrCbsw.js → CsyrCbsw.js} +0 -0
- /package/dist/client/_nuxt/{json.CupVZNk8.js → CupVZNk8.js} +0 -0
- /package/dist/client/_nuxt/{berry.CxrokwfH.js → CxrokwfH.js} +0 -0
- /package/dist/client/_nuxt/{github-dark.CzPA46E-.js → CzPA46E-.js} +0 -0
- /package/dist/client/_nuxt/{raku.D384ylkT.js → D384ylkT.js} +0 -0
- /package/dist/client/_nuxt/{wenyan.D3VXSfF0.js → D3VXSfF0.js} +0 -0
- /package/dist/client/_nuxt/{lisp.D4LhxNOI.js → D4LhxNOI.js} +0 -0
- /package/dist/client/_nuxt/{actionscript-3.D6NljDpC.js → D6NljDpC.js} +0 -0
- /package/dist/client/_nuxt/{fortran-free-form.D6pmzCqS.js → D6pmzCqS.js} +0 -0
- /package/dist/client/_nuxt/{material-theme-palenight.D7gg1Usp.js → D7gg1Usp.js} +0 -0
- /package/dist/client/_nuxt/{haskell.DAGYewaG.js → DAGYewaG.js} +0 -0
- /package/dist/client/_nuxt/{nextflow.DBxHOdLe.js → DBxHOdLe.js} +0 -0
- /package/dist/client/_nuxt/{typescript.DC8MraHL.js → DC8MraHL.js} +0 -0
- /package/dist/client/_nuxt/{material-theme-lighter.DDRuGeQH.js → DDRuGeQH.js} +0 -0
- /package/dist/client/_nuxt/{dracula.DGO8GyiP.js → DGO8GyiP.js} +0 -0
- /package/dist/client/_nuxt/{objective-c.DHmGyzbM.js → DHmGyzbM.js} +0 -0
- /package/dist/client/_nuxt/{csharp.DISxKEhY.js → DISxKEhY.js} +0 -0
- /package/dist/client/_nuxt/{kusto.DIr-ordK.js → DIr-ordK.js} +0 -0
- /package/dist/client/_nuxt/{docker.DNR26wTC.js → DNR26wTC.js} +0 -0
- /package/dist/client/_nuxt/{proto.DOtRmeXT.js → DOtRmeXT.js} +0 -0
- /package/dist/client/_nuxt/{stylus.DSrLtGYv.js → DSrLtGYv.js} +0 -0
- /package/dist/client/_nuxt/{smalltalk.DSsji4Hu.js → DSsji4Hu.js} +0 -0
- /package/dist/client/_nuxt/{verilog.DVfdqzEq.js → DVfdqzEq.js} +0 -0
- /package/dist/client/_nuxt/{abap.DXFkqnOI.js → DXFkqnOI.js} +0 -0
- /package/dist/client/_nuxt/{postcss.DXT9h7v2.js → DXT9h7v2.js} +0 -0
- /package/dist/client/_nuxt/{cmake.DXZpi2gR.js → DXZpi2gR.js} +0 -0
- /package/dist/client/_nuxt/{jsonc.DYI1rfmx.js → DYI1rfmx.js} +0 -0
- /package/dist/client/_nuxt/{hjson.DZqG9GXz.js → DZqG9GXz.js} +0 -0
- /package/dist/client/_nuxt/{sql.DbK06e1c.js → DbK06e1c.js} +0 -0
- /package/dist/client/_nuxt/{jssm.Dble9ECP.js → Dble9ECP.js} +0 -0
- /package/dist/client/_nuxt/{javascript.Dch3xQiY.js → Dch3xQiY.js} +0 -0
- /package/dist/client/_nuxt/{logo.DdacRhvC.js → DdacRhvC.js} +0 -0
- /package/dist/client/_nuxt/{ini.DeVv6D4_.js → DeVv6D4_.js} +0 -0
- /package/dist/client/_nuxt/{swift.Dez-Qvcc.js → Dez-Qvcc.js} +0 -0
- /package/dist/client/_nuxt/{fish.DfeQjIbs.js → DfeQjIbs.js} +0 -0
- /package/dist/client/_nuxt/{gherkin.DjTlIhuc.js → DjTlIhuc.js} +0 -0
- /package/dist/client/_nuxt/{hlsl.DmDrTTlz.js → DmDrTTlz.js} +0 -0
- /package/dist/client/_nuxt/{dax.DsfXcHUZ.js → DsfXcHUZ.js} +0 -0
- /package/dist/client/_nuxt/{nix.Dszwcx0o.js → Dszwcx0o.js} +0 -0
- /package/dist/client/_nuxt/{diff.DvyTQcux.js → DvyTQcux.js} +0 -0
- /package/dist/client/_nuxt/{python.DwuVtWc2.js → DwuVtWc2.js} +0 -0
- /package/dist/client/_nuxt/{less.DywwDckn.js → DywwDckn.js} +0 -0
- /package/dist/client/_nuxt/{system-verilog.DzPyIVdT.js → DzPyIVdT.js} +0 -0
- /package/dist/client/_nuxt/{dream-maker.Eh5U-gDp.js → Eh5U-gDp.js} +0 -0
- /package/dist/client/_nuxt/{typst.I4qd5QHW.js → I4qd5QHW.js} +0 -0
- /package/dist/client/_nuxt/{dark-plus.KEYLhlmT.js → KEYLhlmT.js} +0 -0
- /package/dist/client/_nuxt/{asm.PWN5J14X.js → PWN5J14X.js} +0 -0
- /package/dist/client/_nuxt/{d.PifQWv0n.js → PifQWv0n.js} +0 -0
- /package/dist/client/_nuxt/{vhdl.QZ3jNtnE.js → QZ3jNtnE.js} +0 -0
- /package/dist/client/_nuxt/{c.RCJZWN-0.js → RCJZWN-0.js} +0 -0
- /package/dist/client/_nuxt/{ocaml.RqY_Nz63.js → RqY_Nz63.js} +0 -0
- /package/dist/client/_nuxt/{apex.Sfo2eW0G.js → Sfo2eW0G.js} +0 -0
- /package/dist/client/_nuxt/{ballerina.T9ysyp6P.js → T9ysyp6P.js} +0 -0
- /package/dist/client/_nuxt/{beancount.Urb1RsFe.js → Urb1RsFe.js} +0 -0
- /package/dist/client/_nuxt/{vb.beD-FUib.js → beD-FUib.js} +0 -0
- /package/dist/client/_nuxt/{tokyo-night.eJfcURhx.js → eJfcURhx.js} +0 -0
- /package/dist/client/_nuxt/{slack-ochin.hXH8Gyq8.js → hXH8Gyq8.js} +0 -0
- /package/dist/client/_nuxt/{awk.i0IPvypD.js → i0IPvypD.js} +0 -0
- /package/dist/client/_nuxt/{min-dark.iSbrOpM4.js → iSbrOpM4.js} +0 -0
- /package/dist/client/_nuxt/{rust.j8KhMG0x.js → j8KhMG0x.js} +0 -0
- /package/dist/client/_nuxt/{red.jaXbsbtS.js → jaXbsbtS.js} +0 -0
- /package/dist/client/_nuxt/{gnuplot.nclm9rTJ.js → nclm9rTJ.js} +0 -0
- /package/dist/client/_nuxt/{vyper.o-cPXEvd.js → o-cPXEvd.js} +0 -0
- /package/dist/client/_nuxt/{apache.rS0jd3Ly.js → rS0jd3Ly.js} +0 -0
- /package/dist/client/_nuxt/{monokai.sMI-pExk.js → sMI-pExk.js} +0 -0
- /package/dist/client/_nuxt/{scala.vMsNTMhM.js → vMsNTMhM.js} +0 -0
- /package/dist/client/_nuxt/{groovy.wChcbJ1V.js → wChcbJ1V.js} +0 -0
- /package/dist/client/_nuxt/{solarized-light.xPNGhBYe.js → xPNGhBYe.js} +0 -0
package/dist/module.d.mts
CHANGED
|
@@ -1,21 +1,44 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { UseScriptOptions
|
|
1
|
+
import * as nuxt_schema from 'nuxt/schema';
|
|
2
|
+
import { UseScriptOptions } from '@unhead/schema';
|
|
3
|
+
import { UseScriptInput } from '@unhead/vue';
|
|
3
4
|
|
|
4
|
-
type NuxtUseScriptOptions<T = any> = UseScriptOptions<T
|
|
5
|
+
type NuxtUseScriptOptions<T = any> = Omit<UseScriptOptions<T>, 'trigger'> & {
|
|
6
|
+
/**
|
|
7
|
+
* The trigger to load the script:
|
|
8
|
+
* - `onNuxtReady` - Load the script when Nuxt is ready.
|
|
9
|
+
* - `manual` - Load the script manually by calling `$script.load()` or `$script.waitForLoad()`.
|
|
10
|
+
* - `Promise` - Load the script when the promise resolves.
|
|
11
|
+
*/
|
|
12
|
+
trigger?: UseScriptOptions<T>['trigger'] | 'onNuxtReady';
|
|
13
|
+
/**
|
|
14
|
+
* Should the script be bundled as an asset and loaded from your server. This is useful for improving the
|
|
15
|
+
* performance by avoiding the extra DNS lookup and reducing the number of requests. It also
|
|
16
|
+
* improves privacy by not sharing the user's IP address with third-party servers.
|
|
17
|
+
*/
|
|
18
|
+
assetStrategy?: 'bundle';
|
|
19
|
+
};
|
|
20
|
+
type NuxtUseScriptInput = UseScriptInput;
|
|
5
21
|
|
|
6
22
|
interface ModuleOptions {
|
|
7
23
|
/**
|
|
8
|
-
*
|
|
24
|
+
* Register scripts that should be loaded globally on all pages.
|
|
9
25
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
26
|
+
globals?: (NuxtUseScriptInput | [NuxtUseScriptInput, NuxtUseScriptOptions])[];
|
|
27
|
+
/**
|
|
28
|
+
* Override the static script options for specific scripts based on their provided `key` or `src`.
|
|
29
|
+
*/
|
|
30
|
+
overrides?: {
|
|
31
|
+
[key: string]: Pick<NuxtUseScriptOptions, 'assetStrategy'>;
|
|
32
|
+
};
|
|
33
|
+
/** Configure the way scripts assets are exposed */
|
|
34
|
+
assets?: {
|
|
15
35
|
/**
|
|
16
|
-
*
|
|
36
|
+
* The baseURL where scripts files are served.
|
|
37
|
+
* @default '/_scripts/'
|
|
17
38
|
*/
|
|
18
|
-
|
|
39
|
+
prefix?: string;
|
|
40
|
+
/** Currently scripts assets are exposed as public assets as part of the build. This will be configurable in future */
|
|
41
|
+
strategy?: 'public';
|
|
19
42
|
};
|
|
20
43
|
/**
|
|
21
44
|
* Whether the module is enabled.
|
|
@@ -39,6 +62,6 @@ interface ModuleHooks {
|
|
|
39
62
|
options: any;
|
|
40
63
|
}) => Promise<void>;
|
|
41
64
|
}
|
|
42
|
-
declare const _default:
|
|
65
|
+
declare const _default: nuxt_schema.NuxtModule<ModuleOptions>;
|
|
43
66
|
|
|
44
67
|
export { type ModuleHooks, type ModuleOptions, _default as default };
|
package/dist/module.d.ts
CHANGED
|
@@ -1,21 +1,44 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { UseScriptOptions
|
|
1
|
+
import * as nuxt_schema from 'nuxt/schema';
|
|
2
|
+
import { UseScriptOptions } from '@unhead/schema';
|
|
3
|
+
import { UseScriptInput } from '@unhead/vue';
|
|
3
4
|
|
|
4
|
-
type NuxtUseScriptOptions<T = any> = UseScriptOptions<T
|
|
5
|
+
type NuxtUseScriptOptions<T = any> = Omit<UseScriptOptions<T>, 'trigger'> & {
|
|
6
|
+
/**
|
|
7
|
+
* The trigger to load the script:
|
|
8
|
+
* - `onNuxtReady` - Load the script when Nuxt is ready.
|
|
9
|
+
* - `manual` - Load the script manually by calling `$script.load()` or `$script.waitForLoad()`.
|
|
10
|
+
* - `Promise` - Load the script when the promise resolves.
|
|
11
|
+
*/
|
|
12
|
+
trigger?: UseScriptOptions<T>['trigger'] | 'onNuxtReady';
|
|
13
|
+
/**
|
|
14
|
+
* Should the script be bundled as an asset and loaded from your server. This is useful for improving the
|
|
15
|
+
* performance by avoiding the extra DNS lookup and reducing the number of requests. It also
|
|
16
|
+
* improves privacy by not sharing the user's IP address with third-party servers.
|
|
17
|
+
*/
|
|
18
|
+
assetStrategy?: 'bundle';
|
|
19
|
+
};
|
|
20
|
+
type NuxtUseScriptInput = UseScriptInput;
|
|
5
21
|
|
|
6
22
|
interface ModuleOptions {
|
|
7
23
|
/**
|
|
8
|
-
*
|
|
24
|
+
* Register scripts that should be loaded globally on all pages.
|
|
9
25
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
26
|
+
globals?: (NuxtUseScriptInput | [NuxtUseScriptInput, NuxtUseScriptOptions])[];
|
|
27
|
+
/**
|
|
28
|
+
* Override the static script options for specific scripts based on their provided `key` or `src`.
|
|
29
|
+
*/
|
|
30
|
+
overrides?: {
|
|
31
|
+
[key: string]: Pick<NuxtUseScriptOptions, 'assetStrategy'>;
|
|
32
|
+
};
|
|
33
|
+
/** Configure the way scripts assets are exposed */
|
|
34
|
+
assets?: {
|
|
15
35
|
/**
|
|
16
|
-
*
|
|
36
|
+
* The baseURL where scripts files are served.
|
|
37
|
+
* @default '/_scripts/'
|
|
17
38
|
*/
|
|
18
|
-
|
|
39
|
+
prefix?: string;
|
|
40
|
+
/** Currently scripts assets are exposed as public assets as part of the build. This will be configurable in future */
|
|
41
|
+
strategy?: 'public';
|
|
19
42
|
};
|
|
20
43
|
/**
|
|
21
44
|
* Whether the module is enabled.
|
|
@@ -39,6 +62,6 @@ interface ModuleHooks {
|
|
|
39
62
|
options: any;
|
|
40
63
|
}) => Promise<void>;
|
|
41
64
|
}
|
|
42
|
-
declare const _default:
|
|
65
|
+
declare const _default: nuxt_schema.NuxtModule<ModuleOptions>;
|
|
43
66
|
|
|
44
67
|
export { type ModuleHooks, type ModuleOptions, _default as default };
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
import { useNuxt, defineNuxtModule, createResolver,
|
|
1
|
+
import { useNuxt, useLogger, addDevServerHandler, defineNuxtModule, createResolver, addImportsDir, addTemplate, addPlugin, addBuildPlugin } from '@nuxt/kit';
|
|
2
2
|
import { readPackageJSON } from 'pkg-types';
|
|
3
3
|
import { existsSync } from 'node:fs';
|
|
4
|
+
import { pathToFileURL } from 'node:url';
|
|
5
|
+
import { createUnplugin } from 'unplugin';
|
|
6
|
+
import { parseURL, parseQuery, joinURL, hasProtocol } from 'ufo';
|
|
7
|
+
import MagicString from 'magic-string';
|
|
8
|
+
import { walk } from 'estree-walker';
|
|
9
|
+
import fsp from 'node:fs/promises';
|
|
10
|
+
import { lazyEventHandler, eventHandler, createError } from 'h3';
|
|
11
|
+
import { fetch } from 'ofetch';
|
|
12
|
+
import { colors } from 'consola/utils';
|
|
13
|
+
import { defu } from 'defu';
|
|
14
|
+
import { join } from 'pathe';
|
|
15
|
+
import { hash } from 'ohash';
|
|
16
|
+
import { createStorage } from 'unstorage';
|
|
17
|
+
import fsDriver from 'unstorage/drivers/fs-lite';
|
|
4
18
|
|
|
5
19
|
const DEVTOOLS_UI_ROUTE = "/__nuxt-scripts";
|
|
6
20
|
const DEVTOOLS_UI_LOCAL_PORT = 3030;
|
|
@@ -44,12 +58,184 @@ function setupDevToolsUI(options, resolve, nuxt = useNuxt()) {
|
|
|
44
58
|
});
|
|
45
59
|
}
|
|
46
60
|
|
|
61
|
+
function NuxtScriptAssetBundlerTransformer(options) {
|
|
62
|
+
return createUnplugin(() => {
|
|
63
|
+
return {
|
|
64
|
+
name: "nuxt:scripts:asset-bundler-transformer",
|
|
65
|
+
enforce: "post",
|
|
66
|
+
transformInclude(id) {
|
|
67
|
+
const { pathname, search } = parseURL(decodeURIComponent(pathToFileURL(id).href));
|
|
68
|
+
const { type } = parseQuery(search);
|
|
69
|
+
if (pathname.endsWith(".vue") && (type === "script" || !search))
|
|
70
|
+
return true;
|
|
71
|
+
if (pathname.match(/\.((c|m)?j|t)sx?$/g))
|
|
72
|
+
return true;
|
|
73
|
+
if (pathname.includes("node_modules/@unhead") || pathname.includes("node_modules/vueuse"))
|
|
74
|
+
return false;
|
|
75
|
+
return false;
|
|
76
|
+
},
|
|
77
|
+
async transform(code, id) {
|
|
78
|
+
if (!code.includes("useScript"))
|
|
79
|
+
return;
|
|
80
|
+
const ast = this.parse(code);
|
|
81
|
+
const s = new MagicString(code);
|
|
82
|
+
walk(ast, {
|
|
83
|
+
enter(_node) {
|
|
84
|
+
if (_node.type === "CallExpression" && _node.callee.type === "Identifier" && _node.callee?.name === "useScript") {
|
|
85
|
+
const node = _node;
|
|
86
|
+
let scriptKey;
|
|
87
|
+
let scriptNode;
|
|
88
|
+
if (node.arguments[0].type === "Literal") {
|
|
89
|
+
scriptNode = node.arguments[0];
|
|
90
|
+
scriptKey = scriptNode.value;
|
|
91
|
+
} else if (node.arguments[0].type === "ObjectExpression") {
|
|
92
|
+
const srcProperty = node.arguments[0].properties.find(
|
|
93
|
+
(p) => p.key?.name === "src" || p.key?.value === "src"
|
|
94
|
+
);
|
|
95
|
+
const keyProperty = node.arguments[0].properties.find(
|
|
96
|
+
(p) => p.key?.name === "key" || p.key?.value === "key"
|
|
97
|
+
);
|
|
98
|
+
scriptKey = keyProperty?.value?.value || srcProperty?.value;
|
|
99
|
+
scriptNode = srcProperty?.value;
|
|
100
|
+
}
|
|
101
|
+
if (scriptNode) {
|
|
102
|
+
const src = scriptNode.value;
|
|
103
|
+
if (src) {
|
|
104
|
+
let hasAssetStrategy = false;
|
|
105
|
+
if (node.arguments[1]?.type === "ObjectExpression") {
|
|
106
|
+
const assetStrategyProperty = node.arguments[1]?.properties.find(
|
|
107
|
+
(p) => p.key?.name === "assetStrategy" || p.key?.value === "assetStrategy"
|
|
108
|
+
);
|
|
109
|
+
if (assetStrategyProperty) {
|
|
110
|
+
if (assetStrategyProperty?.value?.value !== "bundle")
|
|
111
|
+
return;
|
|
112
|
+
s.remove(assetStrategyProperty.start, assetStrategyProperty.end + 1);
|
|
113
|
+
hasAssetStrategy = true;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
hasAssetStrategy = hasAssetStrategy || options.overrides?.[scriptKey]?.assetStrategy === "bundle";
|
|
117
|
+
if (hasAssetStrategy) {
|
|
118
|
+
const newSrc = options.resolveScript(src);
|
|
119
|
+
s.overwrite(scriptNode.start, scriptNode.end, `'${newSrc}'`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
if (s.hasChanged()) {
|
|
127
|
+
return {
|
|
128
|
+
code: s.toString(),
|
|
129
|
+
map: s.generateMap({ includeContent: true, source: id })
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const logger = useLogger("@nuxt/scripts");
|
|
138
|
+
|
|
139
|
+
const ONE_YEAR_IN_SECONDS = 60 * 60 * 24 * 365;
|
|
140
|
+
function setupPublicAssetStrategy(options = {}) {
|
|
141
|
+
const assetsBaseURL = options.prefix || "/_scripts";
|
|
142
|
+
const nuxt = useNuxt();
|
|
143
|
+
const renderedScriptSrc = /* @__PURE__ */ new Map();
|
|
144
|
+
const storage = createStorage(fsDriver({
|
|
145
|
+
base: "node_modules/.cache/nuxt/scripts"
|
|
146
|
+
}));
|
|
147
|
+
function normalizeScriptData(src) {
|
|
148
|
+
if (hasProtocol(src, { acceptRelative: true })) {
|
|
149
|
+
src = src.replace(/^\/\//, "https://");
|
|
150
|
+
const url = parseURL(src);
|
|
151
|
+
const file = [
|
|
152
|
+
`${hash(url)}.js`
|
|
153
|
+
// force an extension
|
|
154
|
+
].filter(Boolean).join("-");
|
|
155
|
+
renderedScriptSrc.set(file, src);
|
|
156
|
+
return joinURL(assetsBaseURL, file);
|
|
157
|
+
}
|
|
158
|
+
return src;
|
|
159
|
+
}
|
|
160
|
+
addDevServerHandler({
|
|
161
|
+
route: assetsBaseURL,
|
|
162
|
+
handler: lazyEventHandler(async () => {
|
|
163
|
+
return eventHandler(async (event) => {
|
|
164
|
+
const filename = event.path.slice(1);
|
|
165
|
+
const url = renderedScriptSrc.get(event.path.slice(1));
|
|
166
|
+
if (!url)
|
|
167
|
+
throw createError({ statusCode: 404 });
|
|
168
|
+
const key = `data:scripts:${filename}`;
|
|
169
|
+
let res = await storage.getItemRaw(key);
|
|
170
|
+
if (!res) {
|
|
171
|
+
res = await fetch(url).then((r) => r.arrayBuffer()).then((r) => Buffer.from(r));
|
|
172
|
+
await storage.setItemRaw(key, res);
|
|
173
|
+
}
|
|
174
|
+
return res;
|
|
175
|
+
});
|
|
176
|
+
})
|
|
177
|
+
});
|
|
178
|
+
if (nuxt.options.dev) {
|
|
179
|
+
nuxt.options.routeRules ||= {};
|
|
180
|
+
nuxt.options.routeRules[joinURL(assetsBaseURL, "**")] = {
|
|
181
|
+
cache: {
|
|
182
|
+
maxAge: ONE_YEAR_IN_SECONDS
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
nuxt.options.nitro.publicAssets ||= [];
|
|
187
|
+
const cacheDir = join(nuxt.options.buildDir, "cache", "scripts");
|
|
188
|
+
nuxt.options.nitro.publicAssets.push();
|
|
189
|
+
nuxt.options.nitro = defu(nuxt.options.nitro, {
|
|
190
|
+
publicAssets: [{
|
|
191
|
+
dir: cacheDir,
|
|
192
|
+
maxAge: ONE_YEAR_IN_SECONDS,
|
|
193
|
+
baseURL: assetsBaseURL
|
|
194
|
+
}],
|
|
195
|
+
prerender: {
|
|
196
|
+
ignore: [assetsBaseURL]
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
nuxt.hook("nitro:init", async (nitro) => {
|
|
200
|
+
if (nuxt.options.dev)
|
|
201
|
+
return;
|
|
202
|
+
nitro.hooks.hook("rollup:before", async () => {
|
|
203
|
+
await fsp.rm(cacheDir, { recursive: true, force: true });
|
|
204
|
+
await fsp.mkdir(cacheDir, { recursive: true });
|
|
205
|
+
let banner = false;
|
|
206
|
+
for (const [filename, url] of renderedScriptSrc) {
|
|
207
|
+
const key = `data:scripts:${filename}`;
|
|
208
|
+
let res = await storage.getItemRaw(key);
|
|
209
|
+
if (!res) {
|
|
210
|
+
if (!banner) {
|
|
211
|
+
banner = true;
|
|
212
|
+
logger.info("Downloading scripts...");
|
|
213
|
+
}
|
|
214
|
+
let encoding;
|
|
215
|
+
let size = 0;
|
|
216
|
+
res = await fetch(url).then((r) => {
|
|
217
|
+
encoding = r.headers.get("content-encoding");
|
|
218
|
+
size = Number(r.headers.get("content-length") / 1024);
|
|
219
|
+
return r.arrayBuffer();
|
|
220
|
+
}).then((r) => Buffer.from(r));
|
|
221
|
+
logger.log(colors.gray(` \u251C\u2500 ${url} \u2192 ${joinURL(assetsBaseURL, filename)} (${size.toFixed(2)} kB ${encoding})`));
|
|
222
|
+
await storage.setItemRaw(key, res);
|
|
223
|
+
}
|
|
224
|
+
await fsp.writeFile(join(cacheDir, filename), res);
|
|
225
|
+
}
|
|
226
|
+
if (banner)
|
|
227
|
+
logger.success("Scripts downloaded and cached.");
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
return { normalizeScriptData };
|
|
231
|
+
}
|
|
232
|
+
|
|
47
233
|
const module = defineNuxtModule({
|
|
48
234
|
meta: {
|
|
49
235
|
name: "@nuxt/scripts",
|
|
50
236
|
configKey: "scripts",
|
|
51
237
|
compatibility: {
|
|
52
|
-
nuxt: "^3.
|
|
238
|
+
nuxt: "^3.11.1",
|
|
53
239
|
bridge: false
|
|
54
240
|
}
|
|
55
241
|
},
|
|
@@ -59,16 +245,42 @@ const module = defineNuxtModule({
|
|
|
59
245
|
},
|
|
60
246
|
async setup(config, nuxt) {
|
|
61
247
|
const { resolve } = createResolver(import.meta.url);
|
|
62
|
-
const {
|
|
63
|
-
|
|
64
|
-
if (config.enabled === false) {
|
|
248
|
+
const { version } = await readPackageJSON(resolve("../package.json"));
|
|
249
|
+
if (!config.enabled) {
|
|
65
250
|
logger.debug("The module is disabled, skipping setup.");
|
|
66
251
|
return;
|
|
67
252
|
}
|
|
68
253
|
nuxt.options.alias["#nuxt-scripts"] = resolve("./runtime/types");
|
|
69
254
|
nuxt.options.runtimeConfig["nuxt-scripts"] = { version };
|
|
70
|
-
nuxt.options.runtimeConfig.public["nuxt-scripts"] = { defaults: config.defaults };
|
|
71
255
|
addImportsDir(resolve("./runtime/composables"));
|
|
256
|
+
if (config.globals?.length) {
|
|
257
|
+
const template = addTemplate({
|
|
258
|
+
filename: "modules/nuxt-scripts/plugin.client.mjs",
|
|
259
|
+
getContents() {
|
|
260
|
+
return `import { defineNuxtPlugin, useScript } from '#imports'
|
|
261
|
+
export default defineNuxtPlugin({
|
|
262
|
+
setup() {
|
|
263
|
+
${config.globals?.map((g) => !Array.isArray(g) ? ` useScript("${g.toString()}")` : g.length === 2 ? ` useScript(${JSON.stringify(g[0])}, ${JSON.stringify(g[1])} })` : ` useScript(${JSON.stringify(g[0])})`).join("\n")}
|
|
264
|
+
})`;
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
addPlugin({
|
|
268
|
+
src: template.dst,
|
|
269
|
+
mode: "client"
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
const scriptMap = /* @__PURE__ */ new Map();
|
|
273
|
+
const { normalizeScriptData } = setupPublicAssetStrategy(config.assets);
|
|
274
|
+
addBuildPlugin(NuxtScriptAssetBundlerTransformer({
|
|
275
|
+
overrides: config.overrides,
|
|
276
|
+
resolveScript(src) {
|
|
277
|
+
if (scriptMap.has(src))
|
|
278
|
+
return scriptMap.get(src);
|
|
279
|
+
const url = normalizeScriptData(src);
|
|
280
|
+
scriptMap.set(src, url);
|
|
281
|
+
return url;
|
|
282
|
+
}
|
|
283
|
+
}));
|
|
72
284
|
if (nuxt.options.dev)
|
|
73
285
|
setupDevToolsUI(config, resolve);
|
|
74
286
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { isRef, onNuxtReady, ref, requestIdleCallback, toValue, tryUseNuxtApp, watch } from "#imports";
|
|
2
|
+
export function createScriptConsentTrigger(options) {
|
|
3
|
+
if (import.meta.server)
|
|
4
|
+
return new Promise(() => {
|
|
5
|
+
});
|
|
6
|
+
const consented = ref(false);
|
|
7
|
+
const nuxtApp = tryUseNuxtApp();
|
|
8
|
+
const promise = new Promise((resolve) => {
|
|
9
|
+
watch(consented, (ready) => {
|
|
10
|
+
if (ready) {
|
|
11
|
+
const runner = nuxtApp?.runWithContext || ((cb) => cb());
|
|
12
|
+
const idleTimeout = options?.loadOnNuxtReady ? nuxtApp ? onNuxtReady : requestIdleCallback : (cb) => cb();
|
|
13
|
+
runner(() => idleTimeout(resolve));
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
if (options?.consent) {
|
|
17
|
+
if (typeof options?.consent === "boolean") {
|
|
18
|
+
consented.value = true;
|
|
19
|
+
} else if (options?.consent instanceof Promise) {
|
|
20
|
+
options?.consent.then((res) => {
|
|
21
|
+
consented.value = typeof res === "boolean" ? res : true;
|
|
22
|
+
});
|
|
23
|
+
} else if (isRef(options?.consent)) {
|
|
24
|
+
watch(options.consent, (_val) => {
|
|
25
|
+
const val = toValue(_val);
|
|
26
|
+
if (typeof val === "boolean")
|
|
27
|
+
consented.value = val;
|
|
28
|
+
}, { immediate: true });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
promise.accept = () => {
|
|
33
|
+
consented.value = true;
|
|
34
|
+
};
|
|
35
|
+
return promise;
|
|
36
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { injectHead, ref, useNuxtApp, useRoute } from "#imports";
|
|
2
|
+
export function useAnalyticsPageEvent(onChange) {
|
|
3
|
+
const nuxt = useNuxtApp();
|
|
4
|
+
const route = useRoute();
|
|
5
|
+
const head = injectHead();
|
|
6
|
+
const payload = ref({
|
|
7
|
+
path: route.fullPath,
|
|
8
|
+
title: import.meta.client ? document.title : ""
|
|
9
|
+
});
|
|
10
|
+
if (import.meta.server)
|
|
11
|
+
return payload;
|
|
12
|
+
let lastPayload = { path: "", title: "" };
|
|
13
|
+
let stopDomWatcher;
|
|
14
|
+
nuxt.hooks.hook("page:finish", () => {
|
|
15
|
+
Promise.race([
|
|
16
|
+
// possibly no head update is needed
|
|
17
|
+
new Promise((resolve) => setTimeout(resolve, 100)),
|
|
18
|
+
new Promise((resolve) => {
|
|
19
|
+
stopDomWatcher = head.hooks.hook("dom:rendered", () => resolve());
|
|
20
|
+
})
|
|
21
|
+
]).finally(() => {
|
|
22
|
+
stopDomWatcher && stopDomWatcher();
|
|
23
|
+
}).then(() => {
|
|
24
|
+
payload.value = {
|
|
25
|
+
path: route.fullPath,
|
|
26
|
+
title: document.title
|
|
27
|
+
};
|
|
28
|
+
if (lastPayload.path !== payload.value.path || lastPayload.title !== payload.value.title) {
|
|
29
|
+
onChange && onChange(payload.value);
|
|
30
|
+
lastPayload = payload.value;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
return payload;
|
|
35
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { type UseScriptInput } from '@unhead/vue';
|
|
2
|
+
import type { UseScriptOptions } from '@unhead/schema';
|
|
3
|
+
export declare function useScript<T>(input: UseScriptInput, options?: Omit<UseScriptOptions<T>, 'trigger'> & {
|
|
4
|
+
trigger?: UseScriptOptions<T>['trigger'] | 'onNuxtReady';
|
|
5
|
+
}): any;
|
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
import { useScript as _useScript } from "@unhead/vue";
|
|
2
|
-
import {
|
|
1
|
+
import { useScript as _useScript, injectHead } from "@unhead/vue";
|
|
2
|
+
import { onNuxtReady, useNuxtApp } from "#imports";
|
|
3
3
|
export function useScript(input, options) {
|
|
4
4
|
input = typeof input === "string" ? { src: input } : input;
|
|
5
5
|
options = options || {};
|
|
6
|
+
if (options.trigger === "onNuxtReady")
|
|
7
|
+
options.trigger = onNuxtReady;
|
|
6
8
|
const nuxtApp = useNuxtApp();
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
await nuxtApp.hooks.callHook("scripts:transform", { script: script2, options });
|
|
10
|
-
return script2;
|
|
11
|
-
},
|
|
12
|
-
...options
|
|
13
|
-
});
|
|
14
|
-
if (import.meta.dev) {
|
|
9
|
+
const instance = _useScript(input, options);
|
|
10
|
+
if (import.meta.dev && import.meta.client) {
|
|
15
11
|
let syncScripts = function() {
|
|
16
|
-
nuxtApp._scripts[
|
|
12
|
+
nuxtApp._scripts[instance.$script.id] = payload;
|
|
17
13
|
nuxtApp.hooks.callHook("scripts:updated", { scripts: nuxtApp._scripts });
|
|
18
14
|
};
|
|
19
15
|
const payload = {
|
|
@@ -23,21 +19,21 @@ export function useScript(input, options) {
|
|
|
23
19
|
events: []
|
|
24
20
|
};
|
|
25
21
|
nuxtApp._scripts = nuxtApp._scripts || {};
|
|
26
|
-
if (!nuxtApp._scripts[
|
|
22
|
+
if (!nuxtApp._scripts[instance.$script.id]) {
|
|
27
23
|
const head = injectHead();
|
|
28
24
|
head.hooks.hook("script:updated", (ctx) => {
|
|
29
|
-
if (ctx.script.id !==
|
|
25
|
+
if (ctx.script.id !== instance.$script.id)
|
|
30
26
|
return;
|
|
31
27
|
payload.events.push({
|
|
32
28
|
type: "status",
|
|
33
29
|
status: ctx.script.status,
|
|
34
30
|
at: Date.now()
|
|
35
31
|
});
|
|
36
|
-
payload.$script =
|
|
32
|
+
payload.$script = instance.$script;
|
|
37
33
|
syncScripts();
|
|
38
34
|
});
|
|
39
35
|
head.hooks.hook("script:instance-fn", (ctx) => {
|
|
40
|
-
if (ctx.script.id !==
|
|
36
|
+
if (ctx.script.id !== instance.$script.id)
|
|
41
37
|
return;
|
|
42
38
|
payload.events.push({
|
|
43
39
|
type: "fn-call",
|
|
@@ -47,14 +43,15 @@ export function useScript(input, options) {
|
|
|
47
43
|
});
|
|
48
44
|
syncScripts();
|
|
49
45
|
});
|
|
50
|
-
payload.$script =
|
|
46
|
+
payload.$script = instance.$script;
|
|
51
47
|
payload.events.push({
|
|
52
48
|
type: "status",
|
|
53
49
|
status: "awaitingLoad",
|
|
50
|
+
trigger: options?.trigger,
|
|
54
51
|
at: Date.now()
|
|
55
52
|
});
|
|
56
53
|
syncScripts();
|
|
57
54
|
}
|
|
58
55
|
}
|
|
59
|
-
return
|
|
56
|
+
return instance;
|
|
60
57
|
}
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -1,9 +1,35 @@
|
|
|
1
1
|
import type { UseScriptOptions } from '@unhead/schema';
|
|
2
2
|
import type { UseScriptInput } from '@unhead/vue';
|
|
3
|
-
import type { Ref } from 'vue';
|
|
4
|
-
export type NuxtUseScriptOptions<T = any> = UseScriptOptions<T
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import type { ComputedRef, Ref } from 'vue';
|
|
4
|
+
export type NuxtUseScriptOptions<T = any> = Omit<UseScriptOptions<T>, 'trigger'> & {
|
|
5
|
+
/**
|
|
6
|
+
* The trigger to load the script:
|
|
7
|
+
* - `onNuxtReady` - Load the script when Nuxt is ready.
|
|
8
|
+
* - `manual` - Load the script manually by calling `$script.load()` or `$script.waitForLoad()`.
|
|
9
|
+
* - `Promise` - Load the script when the promise resolves.
|
|
10
|
+
*/
|
|
11
|
+
trigger?: UseScriptOptions<T>['trigger'] | 'onNuxtReady';
|
|
12
|
+
/**
|
|
13
|
+
* Should the script be bundled as an asset and loaded from your server. This is useful for improving the
|
|
14
|
+
* performance by avoiding the extra DNS lookup and reducing the number of requests. It also
|
|
15
|
+
* improves privacy by not sharing the user's IP address with third-party servers.
|
|
16
|
+
*/
|
|
17
|
+
assetStrategy?: 'bundle';
|
|
9
18
|
};
|
|
19
|
+
export type NuxtUseScriptInput = UseScriptInput;
|
|
20
|
+
export interface TrackedPage {
|
|
21
|
+
title?: string;
|
|
22
|
+
path: string;
|
|
23
|
+
}
|
|
24
|
+
export interface ConsentPromiseOptions {
|
|
25
|
+
/**
|
|
26
|
+
* An optional reactive (or promise) reference to the consent state. You can use this to accept the consent for scripts
|
|
27
|
+
* instead of using the accept() method.
|
|
28
|
+
*/
|
|
29
|
+
consent?: Promise<boolean | void> | Ref<boolean> | ComputedRef<boolean> | boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Should the script be loaded on the `requestIdleCallback` callback. This is useful for non-essential scripts that
|
|
32
|
+
* have already been consented to be loaded.
|
|
33
|
+
*/
|
|
34
|
+
loadOnNuxtReady?: boolean;
|
|
35
|
+
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/scripts",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
5
|
-
"packageManager": "pnpm@8.15.
|
|
4
|
+
"version": "0.1.1",
|
|
5
|
+
"packageManager": "pnpm@8.15.5",
|
|
6
6
|
"description": "Next-gen Scripts for Nuxt",
|
|
7
7
|
"author": {
|
|
8
8
|
"website": "https://harlanzw.com",
|
|
@@ -36,27 +36,41 @@
|
|
|
36
36
|
]
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@nuxt/devtools-kit": "^1.
|
|
40
|
-
"@nuxt/devtools-ui-kit": "^1.
|
|
41
|
-
"@nuxt/kit": "^3.
|
|
39
|
+
"@nuxt/devtools-kit": "^1.1.1",
|
|
40
|
+
"@nuxt/devtools-ui-kit": "^1.1.1",
|
|
41
|
+
"@nuxt/kit": "^3.11.1",
|
|
42
|
+
"consola": "^3.2.3",
|
|
43
|
+
"defu": "^6.1.4",
|
|
44
|
+
"estree-walker": "^3.0.3",
|
|
45
|
+
"h3": "^1.11.1",
|
|
46
|
+
"magic-string": "^0.30.8",
|
|
47
|
+
"ofetch": "^1.3.3",
|
|
48
|
+
"ohash": "^1.1.3",
|
|
49
|
+
"pathe": "^1.1.2",
|
|
42
50
|
"pkg-types": "^1.0.3",
|
|
43
|
-
"shiki": "^1.
|
|
51
|
+
"shiki": "^1.2.0",
|
|
44
52
|
"sirv": "^2.0.4",
|
|
45
|
-
"
|
|
53
|
+
"ufo": "^1.5.3",
|
|
54
|
+
"unplugin": "^1.10.0",
|
|
55
|
+
"unstorage": "^1.10.2"
|
|
46
56
|
},
|
|
47
57
|
"devDependencies": {
|
|
48
|
-
"@antfu/eslint-config": "2.8.
|
|
49
|
-
"@nuxt/devtools-ui-kit": "^1.
|
|
58
|
+
"@antfu/eslint-config": "2.8.3",
|
|
59
|
+
"@nuxt/devtools-ui-kit": "^1.1.1",
|
|
50
60
|
"@nuxt/module-builder": "^0.5.5",
|
|
51
|
-
"@nuxt/test-utils": "3.
|
|
52
|
-
"@
|
|
61
|
+
"@nuxt/test-utils": "3.12.0",
|
|
62
|
+
"@unhead/schema": "^1.8.20",
|
|
63
|
+
"acorn-loose": "^8.4.0",
|
|
53
64
|
"bumpp": "^9.4.0",
|
|
54
65
|
"eslint": "8.57.0",
|
|
55
|
-
"nuxt": "^3.
|
|
56
|
-
"nuxt-
|
|
57
|
-
"playwright": "^1.42.1",
|
|
58
|
-
"typescript": "^5.4.
|
|
59
|
-
"vitest": "^1.
|
|
66
|
+
"nuxt": "^3.11.1",
|
|
67
|
+
"nuxt-scripts-devtools": "latest",
|
|
68
|
+
"playwright-core": "^1.42.1",
|
|
69
|
+
"typescript": "^5.4.3",
|
|
70
|
+
"vitest": "^1.4.0"
|
|
71
|
+
},
|
|
72
|
+
"resolutions": {
|
|
73
|
+
"@nuxt/scripts": "workspace:*"
|
|
60
74
|
},
|
|
61
75
|
"scripts": {
|
|
62
76
|
"build": "pnpm prepack",
|