@nuxt/scripts 1.0.0-beta.25 → 1.0.0-beta.27
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 +1 -1
- package/dist/client/404.html +1 -1
- package/dist/client/_nuxt/{DjhmCJlE.js → CwXQ1Eqw.js} +3 -3
- package/dist/client/_nuxt/{TJ5JFHov.js → JXDRhrZp.js} +1 -1
- package/dist/client/_nuxt/{C-7nRtzO.js → KCxg59bo.js} +1 -1
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/d0d06e27-af53-4f1a-b7ae-18727423b3ed.json +1 -0
- package/dist/client/_nuxt/{D5k4eN9O.js → viP3Pc9X.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/module.d.mts +1 -1
- package/dist/module.d.ts +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +38 -8
- package/dist/registry.mjs +2 -2
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.d.vue.ts +2 -5
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue +14 -15
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue.d.ts +2 -5
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.d.vue.ts +1 -4
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue +32 -41
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue.d.ts +1 -4
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsCircle.vue +19 -28
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.vue +18 -22
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsInfoWindow.vue +30 -37
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.d.vue.ts +1 -4
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.vue +31 -36
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.vue.d.ts +1 -4
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.vue +17 -22
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.vue +19 -28
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolygon.vue +19 -28
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolyline.vue +19 -28
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsRectangle.vue +19 -28
- package/dist/runtime/components/GoogleMaps/injectionKeys.d.ts +11 -0
- package/dist/runtime/components/GoogleMaps/injectionKeys.js +3 -0
- package/dist/runtime/components/GoogleMaps/useGoogleMapsResource.d.ts +26 -0
- package/dist/runtime/components/GoogleMaps/useGoogleMapsResource.js +37 -0
- package/dist/runtime/server/gravatar-proxy.d.ts +1 -1
- package/dist/runtime/server/gravatar-proxy.js +0 -1
- package/dist/stats.d.mts +97 -9
- package/dist/stats.d.ts +97 -9
- package/dist/stats.mjs +1233 -292
- package/package.json +8 -6
- package/dist/client/_nuxt/builds/meta/2ec0342e-5e00-4781-82aa-c3c0f9154516.json +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as o,o as s,c as a,a as t,t as r}from"./
|
|
1
|
+
import{_ as o,o as s,c as a,a as t,t as r}from"./CwXQ1Eqw.js";import{u as i}from"./KCxg59bo.js";const u={class:"antialiased bg-white dark:bg-[#020420] dark:text-white font-sans grid min-h-screen overflow-hidden place-content-center text-[#020420] tracking-wide"},l={class:"max-w-520px text-center"},c=["textContent"],d=["textContent"],p=["textContent"],f={__name:"error-500",props:{appName:{type:String,default:"Nuxt"},status:{type:Number,default:500},statusText:{type:String,default:"Internal server error"},description:{type:String,default:"This page is temporarily unavailable."},refresh:{type:String,default:"Refresh this page"}},setup(e){const n=e;return i({title:`${n.status} - ${n.statusText} | ${n.appName}`,script:[{innerHTML:`!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))r(e);new MutationObserver(e=>{for(const o of e)if("childList"===o.type)for(const e of o.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&r(e)}).observe(document,{childList:!0,subtree:!0})}function r(e){if(e.ep)return;e.ep=!0;const r=function(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?r.credentials="include":"anonymous"===e.crossOrigin?r.credentials="omit":r.credentials="same-origin",r}(e);fetch(e.href,r)}}();`}],style:[{innerHTML:'*,:after,:before{border-color:var(--un-default-border-color,#e5e7eb);border-style:solid;border-width:0;box-sizing:border-box}:after,:before{--un-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}h1,h2{font-size:inherit;font-weight:inherit}h1,h2,p{margin:0}*,:after,:before{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 transparent;--un-ring-shadow:0 0 transparent;--un-shadow-inset: ;--un-shadow:0 0 transparent;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgba(147,197,253,.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }'}]}),(h,m)=>(s(),a("div",u,[t("div",l,[t("h1",{class:"font-semibold leading-none mb-4 sm:text-[110px] tabular-nums text-[80px]",textContent:r(e.status)},null,8,c),t("h2",{class:"font-semibold mb-2 sm:text-3xl text-2xl",textContent:r(e.statusText)},null,8,d),t("p",{class:"mb-4 px-2 text-[#64748B] text-md",textContent:r(e.description)},null,8,p)])]))}},x=o(f,[["__scopeId","data-v-a4e5aa55"]]);export{x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as a,f as s,h as u,i as r,g as h}from"./
|
|
1
|
+
import{u as a,f as s,h as u,i as r,g as h}from"./CwXQ1Eqw.js";function i(t){const e=t||s();return e.ssrContext?.head||e.runWithContext(()=>{if(u()){const n=r(h);if(!n)throw new Error("[nuxt] [unhead] Missing Unhead instance.");return n}})}function d(t,e={}){const n=e.head||i(e.nuxt);return a(t,{head:n,...e})}export{d as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"d0d06e27-af53-4f1a-b7ae-18727423b3ed","timestamp":1773925113341}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"d0d06e27-af53-4f1a-b7ae-18727423b3ed","timestamp":1773925113341,"prerendered":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as s,o as a,c as i,a as t,t as n,b as u,w as c,d as l,e as d}from"./
|
|
1
|
+
import{_ as s,o as a,c as i,a as t,t as n,b as u,w as c,d as l,e as d}from"./CwXQ1Eqw.js";import{u as f}from"./KCxg59bo.js";const p={class:"antialiased bg-white dark:bg-[#020420] dark:text-white font-sans grid min-h-screen overflow-hidden place-content-center text-[#020420] tracking-wide"},m={class:"max-w-520px text-center"},h=["textContent"],b=["textContent"],x=["textContent"],g={class:"flex items-center justify-center w-full"},y={__name:"error-404",props:{appName:{type:String,default:"Nuxt"},status:{type:Number,default:404},statusText:{type:String,default:"Page 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(e){const r=e;return f({title:`${r.status} - ${r.statusText} | ${r.appName}`,script:[{innerHTML:`!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))r(e);new MutationObserver(e=>{for(const o of e)if("childList"===o.type)for(const e of o.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&r(e)}).observe(document,{childList:!0,subtree:!0})}function r(e){if(e.ep)return;e.ep=!0;const r=function(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?r.credentials="include":"anonymous"===e.crossOrigin?r.credentials="omit":r.credentials="same-origin",r}(e);fetch(e.href,r)}}();`}],style:[{innerHTML:'*,:after,:before{border-color:var(--un-default-border-color,#e5e7eb);border-style:solid;border-width:0;box-sizing:border-box}:after,:before{--un-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}h1,h2{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}h1,h2,p{margin:0}*,:after,:before{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 transparent;--un-ring-shadow:0 0 transparent;--un-shadow-inset: ;--un-shadow:0 0 transparent;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgba(147,197,253,.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }'}]}),(k,w)=>{const o=d;return a(),i("div",p,[t("div",m,[t("h1",{class:"font-semibold leading-none mb-4 sm:text-[110px] tabular-nums text-[80px]",textContent:n(e.status)},null,8,h),t("h2",{class:"font-semibold mb-2 sm:text-3xl text-2xl",textContent:n(e.statusText)},null,8,b),t("p",{class:"mb-4 px-2 text-[#64748B] text-md",textContent:n(e.description)},null,8,x),t("div",g,[u(o,{to:"/",class:"font-medium hover:text-[#00DC82] text-sm underline underline-offset-3"},{default:c(()=>[l(n(e.backHome),1)]),_:1})])])])}}},N=s(y,[["__scopeId","data-v-f04d276c"]]);export{N as default};
|
package/dist/client/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__nuxt-scripts/_nuxt/entry.C5SUNdim.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/
|
|
1
|
+
<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__nuxt-scripts/_nuxt/entry.C5SUNdim.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/CwXQ1Eqw.js"><script type="module" src="/__nuxt-scripts/_nuxt/CwXQ1Eqw.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{"nuxt-scripts":{version:"",defaultScriptOptions:{trigger:"onNuxtReady"},googleStaticMapsProxy:"",endpoints:{}}},app:{baseURL:"/__nuxt-scripts",buildId:"d0d06e27-af53-4f1a-b7ae-18727423b3ed",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1773925118838,false]</script></body></html>
|
package/dist/module.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
import { FetchOptions } from 'ofetch';
|
|
3
|
-
import { RegistryScripts, NuxtConfigScriptRegistry, NuxtUseScriptOptionsSerializable, NuxtUseScriptInput } from '../dist/runtime/types.js';
|
|
4
3
|
import { ProxyPrivacyInput } from '../dist/runtime/server/utils/privacy.js';
|
|
4
|
+
import { RegistryScripts, NuxtConfigScriptRegistry, NuxtUseScriptOptionsSerializable, NuxtUseScriptInput } from '../dist/runtime/types.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Global privacy override for all first-party proxy requests.
|
package/dist/module.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
import { FetchOptions } from 'ofetch';
|
|
3
|
-
import { RegistryScripts, NuxtConfigScriptRegistry, NuxtUseScriptOptionsSerializable, NuxtUseScriptInput } from '../dist/runtime/types.js';
|
|
4
3
|
import { ProxyPrivacyInput } from '../dist/runtime/server/utils/privacy.js';
|
|
4
|
+
import { RegistryScripts, NuxtConfigScriptRegistry, NuxtUseScriptOptionsSerializable, NuxtUseScriptInput } from '../dist/runtime/types.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Global privacy override for all first-party proxy requests.
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -21,6 +21,22 @@ import { hash } from 'ohash';
|
|
|
21
21
|
import { registry } from './registry.mjs';
|
|
22
22
|
import { g as getAllProxyConfigs, r as routesToInterceptRules } from './shared/scripts.ViOoYQXH.mjs';
|
|
23
23
|
|
|
24
|
+
function generatePartytownResolveUrl(interceptRules) {
|
|
25
|
+
const rulesJson = JSON.stringify(interceptRules);
|
|
26
|
+
return `function(url, location, type) {
|
|
27
|
+
var rules = ${rulesJson};
|
|
28
|
+
for (var i = 0; i < rules.length; i++) {
|
|
29
|
+
var rule = rules[i];
|
|
30
|
+
if (url.hostname === rule.pattern || url.hostname.endsWith('.' + rule.pattern)) {
|
|
31
|
+
if (rule.pathPrefix && !url.pathname.startsWith(rule.pathPrefix)) continue;
|
|
32
|
+
var path = rule.pathPrefix ? url.pathname.slice(rule.pathPrefix.length) : url.pathname;
|
|
33
|
+
var newPath = rule.target + (path.startsWith('/') ? '' : '/') + path + url.search;
|
|
34
|
+
return new URL(newPath, location.origin);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}`;
|
|
38
|
+
}
|
|
39
|
+
|
|
24
40
|
const logger = useLogger("@nuxt/scripts");
|
|
25
41
|
|
|
26
42
|
function generateInterceptPluginContents(interceptRules) {
|
|
@@ -255,13 +271,14 @@ Options:
|
|
|
255
271
|
See: https://scripts.nuxt.com/docs/guides/first-party#static-hosting`
|
|
256
272
|
);
|
|
257
273
|
}
|
|
274
|
+
let devtools;
|
|
258
275
|
if (nuxtOptions.dev) {
|
|
259
276
|
const allDomains = /* @__PURE__ */ new Set();
|
|
260
277
|
for (const s of devtoolsScripts) {
|
|
261
278
|
for (const d of s.domains)
|
|
262
279
|
allDomains.add(d);
|
|
263
280
|
}
|
|
264
|
-
|
|
281
|
+
devtools = {
|
|
265
282
|
enabled: true,
|
|
266
283
|
proxyPrefix,
|
|
267
284
|
privacyMode: privacyLabel,
|
|
@@ -270,6 +287,7 @@ See: https://scripts.nuxt.com/docs/guides/first-party#static-hosting`
|
|
|
270
287
|
totalDomains: allDomains.size
|
|
271
288
|
};
|
|
272
289
|
}
|
|
290
|
+
return { interceptRules, devtools };
|
|
273
291
|
}
|
|
274
292
|
|
|
275
293
|
const renderedScript = /* @__PURE__ */ new Map();
|
|
@@ -639,7 +657,7 @@ function resolveCalleeTarget(callee, scopeTracker) {
|
|
|
639
657
|
return "Image";
|
|
640
658
|
return null;
|
|
641
659
|
}
|
|
642
|
-
function rewriteScriptUrlsAST(content, filename, rewrites, postProcess) {
|
|
660
|
+
function rewriteScriptUrlsAST(content, filename, rewrites, postProcess, options) {
|
|
643
661
|
const s = new MagicString(content);
|
|
644
662
|
function needsLeadingSpace(start) {
|
|
645
663
|
const prev = content[start - 1];
|
|
@@ -689,7 +707,7 @@ function rewriteScriptUrlsAST(content, filename, rewrites, postProcess) {
|
|
|
689
707
|
s.overwrite(node.start, firstQuasi.end, `${needsLeadingSpace(node.start)}self.location.origin+\`${rewritten}`);
|
|
690
708
|
}
|
|
691
709
|
}
|
|
692
|
-
if (node.type === "CallExpression") {
|
|
710
|
+
if (node.type === "CallExpression" && !options?.skipApiRewrites) {
|
|
693
711
|
const callee = node.callee;
|
|
694
712
|
const canvasPropName = callee?.type === "MemberExpression" ? callee.computed ? callee.property?.type === "Literal" && typeof callee.property.value === "string" ? callee.property.value : null : callee.property?.name : null;
|
|
695
713
|
if (canvasPropName === "toDataURL" && callee.object) {
|
|
@@ -729,7 +747,7 @@ function rewriteScriptUrlsAST(content, filename, rewrites, postProcess) {
|
|
|
729
747
|
}
|
|
730
748
|
}
|
|
731
749
|
}
|
|
732
|
-
if (node.type === "NewExpression") {
|
|
750
|
+
if (node.type === "NewExpression" && !options?.skipApiRewrites) {
|
|
733
751
|
const callee = node.callee;
|
|
734
752
|
if (callee?.type === "Identifier" && callee.name === "XMLHttpRequest") {
|
|
735
753
|
if (!scopeTracker.getDeclaration("XMLHttpRequest"))
|
|
@@ -798,7 +816,7 @@ function normalizeScriptData(src, assetsBaseURL = "/_scripts/assets") {
|
|
|
798
816
|
return { url: src };
|
|
799
817
|
}
|
|
800
818
|
async function downloadScript(opts, renderedScript, fetchOptions, cacheMaxAge) {
|
|
801
|
-
const { src, url, filename, forceDownload, integrity, proxyRewrites, postProcess } = opts;
|
|
819
|
+
const { src, url, filename, forceDownload, integrity, proxyRewrites, postProcess, skipApiRewrites } = opts;
|
|
802
820
|
if (src === url || !filename) {
|
|
803
821
|
return;
|
|
804
822
|
}
|
|
@@ -836,7 +854,7 @@ async function downloadScript(opts, renderedScript, fetchOptions, cacheMaxAge) {
|
|
|
836
854
|
await storage.setItemRaw(`bundle:${filename}`, res);
|
|
837
855
|
if (proxyRewrites?.length && res) {
|
|
838
856
|
const content = res.toString("utf-8");
|
|
839
|
-
const rewritten = rewriteScriptUrlsAST(content, filename || "script.js", proxyRewrites, postProcess);
|
|
857
|
+
const rewritten = rewriteScriptUrlsAST(content, filename || "script.js", proxyRewrites, postProcess, { skipApiRewrites });
|
|
840
858
|
res = Buffer.from(rewritten, "utf-8");
|
|
841
859
|
logger.debug(`Rewrote ${proxyRewrites.length} URL patterns in ${filename}`);
|
|
842
860
|
}
|
|
@@ -1039,10 +1057,11 @@ function NuxtScriptBundleTransformer(options = {
|
|
|
1039
1057
|
const proxyConfig = !firstPartyOptOut && proxyConfigKey ? options.proxyConfigs?.[proxyConfigKey] : void 0;
|
|
1040
1058
|
const proxyRewrites = proxyConfig?.rewrite;
|
|
1041
1059
|
const postProcess = proxyConfig?.postProcess;
|
|
1060
|
+
const skipApiRewrites = !!(registryKey && options.partytownScripts?.has(registryKey));
|
|
1042
1061
|
deferredOps.push(async () => {
|
|
1043
1062
|
let url = _url;
|
|
1044
1063
|
try {
|
|
1045
|
-
await downloadScript({ src, url, filename, forceDownload, proxyRewrites, postProcess, integrity: options.integrity }, renderedScript, options.fetchOptions, options.cacheMaxAge);
|
|
1064
|
+
await downloadScript({ src, url, filename, forceDownload, proxyRewrites, postProcess, integrity: options.integrity, skipApiRewrites }, renderedScript, options.fetchOptions, options.cacheMaxAge);
|
|
1046
1065
|
} catch (e) {
|
|
1047
1066
|
if (options.fallbackOnSrcOnBundleFail) {
|
|
1048
1067
|
logger.warn(`[Nuxt Scripts: Bundle Transformer] Failed to bundle ${src}. Fallback to remote loading.`);
|
|
@@ -1570,7 +1589,7 @@ const module$1 = defineNuxtModule({
|
|
|
1570
1589
|
}
|
|
1571
1590
|
const { renderedScript } = setupPublicAssetStrategy(config.assets);
|
|
1572
1591
|
if (firstParty.enabled) {
|
|
1573
|
-
const devtoolsData = finalizeFirstParty({
|
|
1592
|
+
const { interceptRules, devtools: devtoolsData } = finalizeFirstParty({
|
|
1574
1593
|
firstParty,
|
|
1575
1594
|
registry: config.registry,
|
|
1576
1595
|
registryScripts,
|
|
@@ -1579,6 +1598,16 @@ const module$1 = defineNuxtModule({
|
|
|
1579
1598
|
if (devtoolsData) {
|
|
1580
1599
|
nuxt.options.runtimeConfig.public["nuxt-scripts-devtools"] = devtoolsData;
|
|
1581
1600
|
}
|
|
1601
|
+
if (config.partytown?.length && hasNuxtModule("@nuxtjs/partytown") && interceptRules.length) {
|
|
1602
|
+
const partytownConfig = nuxt.options.partytown || {};
|
|
1603
|
+
if (!partytownConfig.resolveUrl) {
|
|
1604
|
+
partytownConfig.resolveUrl = generatePartytownResolveUrl(interceptRules);
|
|
1605
|
+
nuxt.options.partytown = partytownConfig;
|
|
1606
|
+
logger.info("[partytown] Auto-configured resolveUrl for first-party proxy");
|
|
1607
|
+
} else {
|
|
1608
|
+
logger.warn("[partytown] Custom resolveUrl already set \u2014 first-party proxy URLs will not be auto-rewritten in Partytown worker. Add first-party proxy rules to your resolveUrl manually.");
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1582
1611
|
}
|
|
1583
1612
|
const moduleInstallPromises = /* @__PURE__ */ new Map();
|
|
1584
1613
|
addBuildPlugin(NuxtScriptsCheckScripts(), {
|
|
@@ -1589,6 +1618,7 @@ const module$1 = defineNuxtModule({
|
|
|
1589
1618
|
registryConfig: nuxt.options.runtimeConfig.public.scripts,
|
|
1590
1619
|
defaultBundle: firstParty.enabled || config.defaultScriptOptions?.bundle,
|
|
1591
1620
|
proxyConfigs: firstParty.proxyConfigs,
|
|
1621
|
+
partytownScripts: new Set(config.partytown || []),
|
|
1592
1622
|
moduleDetected(module) {
|
|
1593
1623
|
if (nuxt.options.dev && module !== "@nuxt/scripts" && !moduleInstallPromises.has(module) && !hasNuxtModule(module))
|
|
1594
1624
|
moduleInstallPromises.set(module, () => installNuxtModule(module));
|
package/dist/registry.mjs
CHANGED
|
@@ -43,12 +43,12 @@ const LOGOS = {
|
|
|
43
43
|
dark: `<svg height="30" width="35" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><filter id="a" height="138.7%" width="131.4%" x="-15.7%" y="-15.1%"><feMorphology in="SourceAlpha" operator="dilate" radius="1" result="shadowSpreadOuter1"/><feOffset dy="1" in="shadowSpreadOuter1" result="shadowOffsetOuter1"/><feGaussianBlur in="shadowOffsetOuter1" result="shadowBlurOuter1" stdDeviation="1"/><feComposite in="shadowBlurOuter1" in2="SourceAlpha" operator="out" result="shadowBlurOuter1"/><feColorMatrix in="shadowBlurOuter1" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.07 0"/></filter><path id="b" d="M14.23 20.46l-9.65 1.1L3 5.12 30.07 2l1.58 16.46-9.37 1.07-3.5 5.72-4.55-4.8z"/></defs><g fill="none" fill-rule="evenodd"><use fill="#000" filter="url(#a)" xlink:href="#b"/><use fill="#fff" stroke="#fff" stroke-width="2" xlink:href="#b"/></g></svg>`
|
|
44
44
|
},
|
|
45
45
|
npm: `<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 256 256"><path fill="#C12127" d="M0 256V0h256v256z"/><path fill="#FFF" d="M48 48h160v160h-32V80h-48v128H48z"/></svg>`,
|
|
46
|
-
googleRecaptcha: `<svg xmlns="http://www.w3.org/2000/svg"
|
|
46
|
+
googleRecaptcha: `<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 256 262"><path fill="#4285F4" d="M255.878 133.451c0-10.734-.871-18.567-2.756-26.69H130.55v48.448h71.947c-1.45 12.04-9.283 30.172-26.69 42.356l-.244 1.622l38.755 30.023l2.685.268c24.659-22.774 38.875-56.282 38.875-96.027"/><path fill="#34A853" d="M130.55 261.1c35.248 0 64.839-11.605 86.453-31.622l-41.196-31.913c-11.024 7.688-25.82 13.055-45.257 13.055c-34.523 0-63.824-22.773-74.269-54.25l-1.531.13l-40.298 31.187l-.527 1.465C35.393 231.798 79.49 261.1 130.55 261.1"/><path fill="#FBBC05" d="M56.281 156.37c-2.756-8.123-4.351-16.827-4.351-25.82c0-8.994 1.595-17.697 4.206-25.82l-.073-1.73L15.26 71.312l-1.335.635C5.077 89.644 0 109.517 0 130.55s5.077 40.905 13.925 58.602z"/><path fill="#EB4335" d="M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0C79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251"/></svg>`,
|
|
47
47
|
googleSignIn: `<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 256 262"><path fill="#4285F4" d="M255.878 133.451c0-10.734-.871-18.567-2.756-26.69H130.55v48.448h71.947c-1.45 12.04-9.283 30.172-26.69 42.356l-.244 1.622l38.755 30.023l2.685.268c24.659-22.774 38.875-56.282 38.875-96.027"/><path fill="#34A853" d="M130.55 261.1c35.248 0 64.839-11.605 86.453-31.622l-41.196-31.913c-11.024 7.688-25.82 13.055-45.257 13.055c-34.523 0-63.824-22.773-74.269-54.25l-1.531.13l-40.298 31.187l-.527 1.465C35.393 231.798 79.49 261.1 130.55 261.1"/><path fill="#FBBC05" d="M56.281 156.37c-2.756-8.123-4.351-16.827-4.351-25.82c0-8.994 1.595-17.697 4.206-25.82l-.073-1.73L15.26 71.312l-1.335.635C5.077 89.644 0 109.517 0 130.55s5.077 40.905 13.925 58.602z"/><path fill="#EB4335" d="M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0C79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251"/></svg>`,
|
|
48
48
|
googleTagManager: `<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 256 256"><path fill="#8AB4F8" d="m150.262 245.516l-44.437-43.331l95.433-97.454l46.007 45.091z"/><path fill="#4285F4" d="M150.45 53.938L106.176 8.731L9.36 104.629c-12.48 12.48-12.48 32.713 0 45.207l95.36 95.986l45.09-42.182l-72.654-76.407z"/><path fill="#8AB4F8" d="m246.625 105.37l-96-96c-12.494-12.494-32.756-12.494-45.25 0c-12.495 12.495-12.495 32.757 0 45.252l96 96c12.494 12.494 32.756 12.494 45.25 0c12.495-12.495 12.495-32.757 0-45.251"/><circle cx="127.265" cy="224.731" r="31.273" fill="#246FDB"/></svg>`,
|
|
49
49
|
googleAnalytics: `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" width="192px" height="192px" viewBox="0 0 192 192" enable-background="new 0 0 192 192" xml:space="preserve"><rect x="0" y="0" fill="none" width="192" height="192"/><g><g><path fill="#F9AB00" d="M130,29v132c0,14.77,10.19,23,21,23c10,0,21-7,21-23V30c0-13.54-10-22-21-22S130,17.33,130,29z"/></g><g><path fill="#E37400" d="M75,96v65c0,14.77,10.19,23,21,23c10,0,21-7,21-23V97c0-13.54-10-22-21-22S75,84.33,75,96z"/></g><g><circle fill="#E37400" cx="41" cy="163" r="21"/></g></g></svg>`,
|
|
50
50
|
umamiAnalytics: `<svg xmlns="http://www.w3.org/2000/svg" width="96" height="96" viewBox="0 0 24 24"><path fill="currentColor" d="M2.203 8.611H.857a.845.845 0 0 0-.841.841v.858a13 13 0 0 0-.016.6c0 6.627 5.373 12 12 12c6.527 0 11.837-5.212 11.996-11.701c0-.025.004-.05.004-.075V9.452a.845.845 0 0 0-.841-.841h-1.346c-1.159-4.329-5.112-7.521-9.805-7.521S3.363 4.282 2.203 8.611m18.444 0H3.37c1.127-3.702 4.57-6.399 8.638-6.399c4.069 0 7.512 2.697 8.639 6.399"/></svg>`,
|
|
51
|
-
gravatar: `<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0
|
|
51
|
+
gravatar: `<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 27 27"><path fill="#1d4fc4" d="M10.8 2.699v9.45a2.699 2.699 0 005.398 0V5.862a8.101 8.101 0 11-8.423 1.913 2.702 2.702 0 00-3.821-3.821A13.5 13.5 0 1013.499 0 2.699 2.699 0 0010.8 2.699z"/></svg>`,
|
|
52
52
|
bingUet: `<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 256 256"><path fill="#F25022" d="M0 0h121.5v121.5H0z"/><path fill="#7FBA00" d="M134.5 0H256v121.5H134.5z"/><path fill="#00A4EF" d="M0 134.5h121.5V256H0z"/><path fill="#FFB900" d="M134.5 134.5H256V256H134.5z"/></svg>`,
|
|
53
53
|
snapchatPixel: `<svg width="50" height="50" viewBox="147.353 39.286 514.631 514.631" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve"><path style="fill:#FFFC00;" d="M147.553,423.021v0.023c0.308,11.424,0.403,22.914,2.33,34.268 c2.042,12.012,4.961,23.725,10.53,34.627c7.529,14.756,17.869,27.217,30.921,37.396c9.371,7.309,19.608,13.111,30.94,16.771 c16.524,5.33,33.571,7.373,50.867,7.473c10.791,0.068,21.575,0.338,32.37,0.293c78.395-0.33,156.792,0.566,235.189-0.484 c10.403-0.141,20.636-1.41,30.846-3.277c19.569-3.582,36.864-11.932,51.661-25.133c17.245-15.381,28.88-34.205,34.132-56.924 c3.437-14.85,4.297-29.916,4.444-45.035v-3.016c0-1.17-0.445-256.892-0.486-260.272c-0.115-9.285-0.799-18.5-2.54-27.636 c-2.117-11.133-5.108-21.981-10.439-32.053c-5.629-10.641-12.68-20.209-21.401-28.57c-13.359-12.81-28.775-21.869-46.722-26.661 c-16.21-4.327-32.747-5.285-49.405-5.27c-0.027-0.004-0.09-0.173-0.094-0.255H278.56c-0.005,0.086-0.008,0.172-0.014,0.255 c-9.454,0.173-18.922,0.102-28.328,1.268c-10.304,1.281-20.509,3.21-30.262,6.812c-15.362,5.682-28.709,14.532-40.11,26.347 c-12.917,13.386-22.022,28.867-26.853,46.894c-4.31,16.084-5.248,32.488-5.271,49.008"/><path style="fill:#FFFFFF;" d="M407.001,473.488c-1.068,0-2.087-0.039-2.862-0.076c-0.615,0.053-1.25,0.076-1.886,0.076 c-22.437,0-37.439-10.607-50.678-19.973c-9.489-6.703-18.438-13.031-28.922-14.775c-5.149-0.854-10.271-1.287-15.22-1.287 c-8.917,0-15.964,1.383-21.109,2.389c-3.166,0.617-5.896,1.148-8.006,1.148c-2.21,0-4.895-0.49-6.014-4.311 c-0.887-3.014-1.523-5.934-2.137-8.746c-1.536-7.027-2.65-11.316-5.281-11.723c-28.141-4.342-44.768-10.738-48.08-18.484 c-0.347-0.814-0.541-1.633-0.584-2.443c-0.129-2.309,1.501-4.334,3.777-4.711c22.348-3.68,42.219-15.492,59.064-35.119 c13.049-15.195,19.457-29.713,20.145-31.316c0.03-0.072,0.065-0.148,0.101-0.217c3.247-6.588,3.893-12.281,1.926-16.916 c-3.626-8.551-15.635-12.361-23.58-14.882c-1.976-0.625-3.845-1.217-5.334-1.808c-7.043-2.782-18.626-8.66-17.083-16.773 c1.124-5.916,8.949-10.036,15.273-10.036c1.756,0,3.312,0.308,4.622,0.923c7.146,3.348,13.575,5.045,19.104,5.045 c6.876,0,10.197-2.618,11-3.362c-0.198-3.668-0.44-7.546-0.674-11.214c0-0.004-0.005-0.048-0.005-0.048 c-1.614-25.675-3.627-57.627,4.546-75.95c24.462-54.847,76.339-59.112,91.651-59.112c0.408,0,6.674-0.062,6.674-0.062 c0.283-0.005,0.59-0.009,0.908-0.009c15.354,0,67.339,4.27,91.816,59.15c8.173,18.335,6.158,50.314,4.539,76.016l-0.076,1.23 c-0.222,3.49-0.427,6.793-0.6,9.995c0.756,0.696,3.795,3.096,9.978,3.339c5.271-0.202,11.328-1.891,17.998-5.014 c2.062-0.968,4.345-1.169,5.895-1.169c2.343,0,4.727,0.456,6.714,1.285l0.106,0.041c5.66,2.009,9.367,6.024,9.447,10.242 c0.071,3.932-2.851,9.809-17.223,15.485c-1.472,0.583-3.35,1.179-5.334,1.808c-7.952,2.524-19.951,6.332-23.577,14.878 c-1.97,4.635-1.322,10.326,1.926,16.912c0.036,0.072,0.067,0.145,0.102,0.221c1,2.344,25.205,57.535,79.209,66.432 c2.275,0.379,3.908,2.406,3.778,4.711c-0.048,0.828-0.248,1.656-0.598,2.465c-3.289,7.703-19.915,14.09-48.064,18.438 c-2.642,0.408-3.755,4.678-5.277,11.668c-0.63,2.887-1.271,5.717-2.146,8.691c-0.819,2.797-2.641,4.164-5.567,4.164h-0.441 c-1.905,0-4.604-0.346-8.008-1.012c-5.95-1.158-12.623-2.236-21.109-2.236c-4.948,0-10.069,0.434-15.224,1.287 c-10.473,1.744-19.421,8.062-28.893,14.758C444.443,462.88,429.436,473.488,407.001,473.488"/><path style="fill:#020202;" d="M408.336,124.235c14.455,0,64.231,3.883,87.688,56.472c7.724,17.317,5.744,48.686,4.156,73.885 c-0.248,3.999-0.494,7.875-0.694,11.576l-0.084,1.591l1.062,1.185c0.429,0.476,4.444,4.672,13.374,5.017l0.144,0.008l0.15-0.003 c5.904-0.225,12.554-2.059,19.776-5.442c1.064-0.498,2.48-0.741,3.978-0.741c1.707,0,3.521,0.321,5.017,0.951l0.226,0.09 c3.787,1.327,6.464,3.829,6.505,6.093c0.022,1.28-0.935,5.891-14.359,11.194c-1.312,0.518-3.039,1.069-5.041,1.7 c-8.736,2.774-21.934,6.96-26.376,17.427c-2.501,5.896-1.816,12.854,2.034,20.678c1.584,3.697,26.52,59.865,82.631,69.111 c-0.011,0.266-0.079,0.557-0.229,0.9c-0.951,2.24-6.996,9.979-44.612,15.783c-5.886,0.902-7.328,7.5-9,15.17 c-0.604,2.746-1.218,5.518-2.062,8.381c-0.258,0.865-0.306,0.914-1.233,0.914c-0.128,0-0.278,0-0.442,0 c-1.668,0-4.2-0.346-7.135-0.922c-5.345-1.041-12.647-2.318-21.982-2.318c-5.21,0-10.577,0.453-15.962,1.352 c-11.511,1.914-20.872,8.535-30.786,15.543c-13.314,9.408-27.075,19.143-48.071,19.143c-0.917,0-1.812-0.031-2.709-0.076 l-0.236-0.01l-0.237,0.018c-0.515,0.045-1.034,0.068-1.564,0.068c-20.993,0-34.76-9.732-48.068-19.143 c-9.916-7.008-19.282-13.629-30.791-15.543c-5.38-0.896-10.752-1.352-15.959-1.352c-9.333,0-16.644,1.428-21.978,2.471 c-2.935,0.574-5.476,1.066-7.139,1.066c-1.362,0-1.388-0.08-1.676-1.064c-0.844-2.865-1.461-5.703-2.062-8.445 c-1.676-7.678-3.119-14.312-9.002-15.215c-37.613-5.809-43.659-13.561-44.613-15.795c-0.149-0.352-0.216-0.652-0.231-0.918 c56.11-9.238,81.041-65.408,82.63-69.119c3.857-7.818,4.541-14.775,2.032-20.678c-4.442-10.461-17.638-14.653-26.368-17.422 c-2.007-0.635-3.735-1.187-5.048-1.705c-11.336-4.479-14.823-8.991-14.305-11.725c0.601-3.153,6.067-6.359,10.837-6.359 c1.072,0,2.012,0.173,2.707,0.498c7.747,3.631,14.819,5.472,21.022,5.472c9.751,0,14.091-4.537,14.557-5.055l1.057-1.182 l-0.085-1.583c-0.197-3.699-0.44-7.574-0.696-11.565c-1.583-25.205-3.563-56.553,4.158-73.871 c23.37-52.396,72.903-56.435,87.525-56.435c0.36,0,6.717-0.065,6.717-0.065C407.744,124.239,408.033,124.235,408.336,124.235 M408.336,115.197h-0.017c-0.333,0-0.646,0-0.944,0.004c-2.376,0.024-6.282,0.062-6.633,0.066c-8.566,0-25.705,1.21-44.115,9.336 c-10.526,4.643-19.994,10.921-28.14,18.66c-9.712,9.221-17.624,20.59-23.512,33.796c-8.623,19.336-6.576,51.905-4.932,78.078 l0.006,0.041c0.176,2.803,0.361,5.73,0.53,8.582c-1.265,0.581-3.316,1.194-6.339,1.194c-4.864,0-10.648-1.555-17.187-4.619 c-1.924-0.896-4.12-1.349-6.543-1.349c-3.893,0-7.997,1.146-11.557,3.239c-4.479,2.63-7.373,6.347-8.159,10.468 c-0.518,2.726-0.493,8.114,5.492,13.578c3.292,3.008,8.128,5.782,14.37,8.249c1.638,0.645,3.582,1.261,5.641,1.914 c7.145,2.271,17.959,5.702,20.779,12.339c1.429,3.365,0.814,7.793-1.823,13.145c-0.069,0.146-0.138,0.289-0.201,0.439 c-0.659,1.539-6.807,15.465-19.418,30.152c-7.166,8.352-15.059,15.332-23.447,20.752c-10.238,6.617-21.316,10.943-32.923,12.855 c-4.558,0.748-7.813,4.809-7.559,9.424c0.078,1.33,0.39,2.656,0.931,3.939c0.004,0.008,0.009,0.016,0.013,0.023 c1.843,4.311,6.116,7.973,13.063,11.203c8.489,3.943,21.185,7.26,37.732,9.855c0.836,1.59,1.704,5.586,2.305,8.322 c0.629,2.908,1.285,5.898,2.22,9.074c1.009,3.441,3.626,7.553,10.349,7.553c2.548,0,5.478-0.574,8.871-1.232 c4.969-0.975,11.764-2.305,20.245-2.305c4.702,0,9.575,0.414,14.48,1.229c9.455,1.574,17.606,7.332,27.037,14 c13.804,9.758,29.429,20.803,53.302,20.803c0.651,0,1.304-0.021,1.949-0.066c0.789,0.037,1.767,0.066,2.799,0.066 c23.88,0,39.501-11.049,53.29-20.799l0.022-0.02c9.433-6.66,17.575-12.41,27.027-13.984c4.903-0.814,9.775-1.229,14.479-1.229 c8.102,0,14.517,1.033,20.245,2.15c3.738,0.736,6.643,1.09,8.872,1.09l0.218,0.004h0.226c4.917,0,8.53-2.699,9.909-7.422 c0.916-3.109,1.57-6.029,2.215-8.986c0.562-2.564,1.46-6.674,2.296-8.281c16.558-2.6,29.249-5.91,37.739-9.852 c6.931-3.215,11.199-6.873,13.053-11.166c0.556-1.287,0.881-2.621,0.954-3.979c0.261-4.607-2.999-8.676-7.56-9.424 c-51.585-8.502-74.824-61.506-75.785-63.758c-0.062-0.148-0.132-0.295-0.205-0.438c-2.637-5.354-3.246-9.777-1.816-13.148 c2.814-6.631,13.621-10.062,20.771-12.332c2.07-0.652,4.021-1.272,5.646-1.914c7.039-2.78,12.07-5.796,15.389-9.221 c3.964-4.083,4.736-7.995,4.688-10.555c-0.121-6.194-4.856-11.698-12.388-14.393c-2.544-1.052-5.445-1.607-8.399-1.607 c-2.011,0-4.989,0.276-7.808,1.592c-6.035,2.824-11.441,4.368-16.082,4.588c-2.468-0.125-4.199-0.66-5.32-1.171 c0.141-2.416,0.297-4.898,0.458-7.486l0.067-1.108c1.653-26.19,3.707-58.784-4.92-78.134c-5.913-13.253-13.853-24.651-23.604-33.892 c-8.178-7.744-17.678-14.021-28.242-18.661C434.052,116.402,416.914,115.197,408.336,115.197"/><rect x="147.553" y="39.443" style="fill:none;" width="514.231" height="514.23"/></svg>`
|
|
54
54
|
};
|
|
@@ -18,11 +18,8 @@ export interface PlaceholderOptions {
|
|
|
18
18
|
signature?: string;
|
|
19
19
|
}
|
|
20
20
|
import type { ElementScriptTrigger } from '#nuxt-scripts/types';
|
|
21
|
-
import type { HTMLAttributes, ImgHTMLAttributes,
|
|
22
|
-
export
|
|
23
|
-
map: ShallowRef<google.maps.Map | undefined>;
|
|
24
|
-
mapsApi: Ref<typeof google.maps | undefined>;
|
|
25
|
-
}>;
|
|
21
|
+
import type { HTMLAttributes, ImgHTMLAttributes, Ref, ReservedProps, ShallowRef } from 'vue';
|
|
22
|
+
export { MAP_INJECTION_KEY } from './injectionKeys.js';
|
|
26
23
|
declare const _default: typeof __VLS_export;
|
|
27
24
|
export default _default;
|
|
28
25
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
@@ -8,7 +8,8 @@ import { hash } from "ohash";
|
|
|
8
8
|
import { withQuery } from "ufo";
|
|
9
9
|
import { computed, onBeforeUnmount, onMounted, provide, ref, shallowRef, toRaw, watch } from "vue";
|
|
10
10
|
import ScriptAriaLoadingIndicator from "../ScriptAriaLoadingIndicator.vue";
|
|
11
|
-
|
|
11
|
+
import { MAP_INJECTION_KEY } from "./injectionKeys";
|
|
12
|
+
export { MAP_INJECTION_KEY } from "./injectionKeys";
|
|
12
13
|
</script>
|
|
13
14
|
|
|
14
15
|
<script setup>
|
|
@@ -78,14 +79,11 @@ const mapMarkers = ref(/* @__PURE__ */ new Map());
|
|
|
78
79
|
function isLocationQuery(s) {
|
|
79
80
|
return typeof s === "string" && (s.split(",").length > 2 || s.includes("+"));
|
|
80
81
|
}
|
|
81
|
-
function resetMapMarkerMap(_marker) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
resolve();
|
|
88
|
-
});
|
|
82
|
+
async function resetMapMarkerMap(_marker) {
|
|
83
|
+
const marker = _marker instanceof Promise ? await _marker : _marker;
|
|
84
|
+
if (marker) {
|
|
85
|
+
marker.setMap(null);
|
|
86
|
+
}
|
|
89
87
|
}
|
|
90
88
|
function normalizeAdvancedMapMarkerOptions(_options) {
|
|
91
89
|
const opts = typeof _options === "string" ? {
|
|
@@ -109,13 +107,12 @@ async function createAdvancedMapMarker(_options) {
|
|
|
109
107
|
const key = hash({ position: normalizedOptions.position });
|
|
110
108
|
if (mapMarkers.value.has(key))
|
|
111
109
|
return mapMarkers.value.get(key);
|
|
112
|
-
const p =
|
|
113
|
-
const lib = await importLibrary("marker");
|
|
110
|
+
const p = importLibrary("marker").then((lib) => {
|
|
114
111
|
const mapMarkerOptions = {
|
|
115
112
|
...toRaw(normalizedOptions),
|
|
116
113
|
map: toRaw(map.value)
|
|
117
114
|
};
|
|
118
|
-
|
|
115
|
+
return new lib.AdvancedMarkerElement(mapMarkerOptions);
|
|
119
116
|
});
|
|
120
117
|
mapMarkers.value.set(key, p);
|
|
121
118
|
return p;
|
|
@@ -367,12 +364,14 @@ const rootAttrs = computed(() => {
|
|
|
367
364
|
...trigger instanceof Promise ? trigger.ssrAttrs || {} : {}
|
|
368
365
|
});
|
|
369
366
|
});
|
|
370
|
-
onBeforeUnmount(
|
|
371
|
-
await Promise.all(Array.from(mapMarkers.value.entries(), ([, marker]) => resetMapMarkerMap(marker)));
|
|
372
|
-
mapMarkers.value.clear();
|
|
367
|
+
onBeforeUnmount(() => {
|
|
373
368
|
map.value?.unbindAll();
|
|
374
369
|
map.value = void 0;
|
|
375
370
|
mapEl.value?.firstChild?.remove();
|
|
371
|
+
libraries.clear();
|
|
372
|
+
queryToLatLngCache.clear();
|
|
373
|
+
Promise.all(Array.from(mapMarkers.value.entries(), ([, marker]) => resetMapMarkerMap(marker)));
|
|
374
|
+
mapMarkers.value.clear();
|
|
376
375
|
});
|
|
377
376
|
</script>
|
|
378
377
|
|
|
@@ -18,11 +18,8 @@ export interface PlaceholderOptions {
|
|
|
18
18
|
signature?: string;
|
|
19
19
|
}
|
|
20
20
|
import type { ElementScriptTrigger } from '#nuxt-scripts/types';
|
|
21
|
-
import type { HTMLAttributes, ImgHTMLAttributes,
|
|
22
|
-
export
|
|
23
|
-
map: ShallowRef<google.maps.Map | undefined>;
|
|
24
|
-
mapsApi: Ref<typeof google.maps | undefined>;
|
|
25
|
-
}>;
|
|
21
|
+
import type { HTMLAttributes, ImgHTMLAttributes, Ref, ReservedProps, ShallowRef } from 'vue';
|
|
22
|
+
export { MAP_INJECTION_KEY } from './injectionKeys.js';
|
|
26
23
|
declare const _default: typeof __VLS_export;
|
|
27
24
|
export default _default;
|
|
28
25
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const ADVANCED_MARKER_ELEMENT_INJECTION_KEY: InjectionKey<{
|
|
3
|
-
advancedMarkerElement: ShallowRef<google.maps.marker.AdvancedMarkerElement | undefined>;
|
|
4
|
-
}>;
|
|
1
|
+
export { ADVANCED_MARKER_ELEMENT_INJECTION_KEY } from './injectionKeys.js';
|
|
5
2
|
declare const _default: typeof __VLS_export;
|
|
6
3
|
export default _default;
|
|
7
4
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { MAP_INJECTION_KEY } from "./ScriptGoogleMaps.vue";
|
|
2
|
+
import { inject, provide, watch } from "vue";
|
|
3
|
+
import { ADVANCED_MARKER_ELEMENT_INJECTION_KEY } from "./injectionKeys";
|
|
5
4
|
import { MARKER_CLUSTERER_INJECTION_KEY } from "./ScriptGoogleMapsMarkerClusterer.vue";
|
|
6
|
-
|
|
5
|
+
import { useGoogleMapsResource } from "./useGoogleMapsResource";
|
|
6
|
+
export { ADVANCED_MARKER_ELEMENT_INJECTION_KEY } from "./injectionKeys";
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
9
|
<script setup>
|
|
@@ -36,51 +36,42 @@ const eventsWithMapMouseEventPayload = [
|
|
|
36
36
|
"mouseover",
|
|
37
37
|
"mouseup"
|
|
38
38
|
];
|
|
39
|
-
const mapContext = inject(MAP_INJECTION_KEY, void 0);
|
|
40
39
|
const markerClustererContext = inject(MARKER_CLUSTERER_INJECTION_KEY, void 0);
|
|
41
|
-
const advancedMarkerElement =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
40
|
+
const advancedMarkerElement = useGoogleMapsResource({
|
|
41
|
+
async create({ mapsApi, map }) {
|
|
42
|
+
await mapsApi.importLibrary("marker");
|
|
43
|
+
const marker = new mapsApi.marker.AdvancedMarkerElement(props.options);
|
|
44
|
+
setupEventListeners(marker);
|
|
45
|
+
if (markerClustererContext?.markerClusterer.value) {
|
|
46
|
+
markerClustererContext.markerClusterer.value.addMarker(marker, true);
|
|
47
|
+
markerClustererContext.requestRerender();
|
|
48
|
+
} else {
|
|
49
|
+
marker.map = map;
|
|
50
|
+
}
|
|
51
|
+
return marker;
|
|
52
|
+
},
|
|
53
|
+
cleanup(marker, { mapsApi }) {
|
|
54
|
+
mapsApi.event.clearInstanceListeners(marker);
|
|
55
|
+
if (markerClustererContext?.markerClusterer.value) {
|
|
56
|
+
markerClustererContext.markerClusterer.value.removeMarker(marker, true);
|
|
57
|
+
markerClustererContext.requestRerender();
|
|
58
|
+
} else {
|
|
59
|
+
marker.map = null;
|
|
57
60
|
}
|
|
58
|
-
}, {
|
|
59
|
-
deep: true
|
|
60
|
-
});
|
|
61
|
-
}, {
|
|
62
|
-
immediate: true,
|
|
63
|
-
once: true
|
|
64
|
-
});
|
|
65
|
-
onUnmounted(() => {
|
|
66
|
-
isUnmounted.value = true;
|
|
67
|
-
if (!advancedMarkerElement.value || !mapContext?.mapsApi.value) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
mapContext.mapsApi.value.event.clearInstanceListeners(advancedMarkerElement.value);
|
|
71
|
-
if (markerClustererContext) {
|
|
72
|
-
markerClustererContext.markerClusterer.value?.removeMarker(advancedMarkerElement.value);
|
|
73
|
-
} else {
|
|
74
|
-
advancedMarkerElement.value.map = null;
|
|
75
61
|
}
|
|
76
62
|
});
|
|
63
|
+
watch(() => props.options, (options) => {
|
|
64
|
+
if (advancedMarkerElement.value && options) {
|
|
65
|
+
Object.assign(advancedMarkerElement.value, options);
|
|
66
|
+
}
|
|
67
|
+
}, { deep: true });
|
|
77
68
|
provide(ADVANCED_MARKER_ELEMENT_INJECTION_KEY, { advancedMarkerElement });
|
|
78
|
-
function
|
|
69
|
+
function setupEventListeners(marker) {
|
|
79
70
|
eventsWithoutPayload.forEach((event) => {
|
|
80
|
-
|
|
71
|
+
marker.addListener(event, () => emit(event));
|
|
81
72
|
});
|
|
82
73
|
eventsWithMapMouseEventPayload.forEach((event) => {
|
|
83
|
-
|
|
74
|
+
marker.addListener(event, (payload) => emit(event, payload));
|
|
84
75
|
});
|
|
85
76
|
}
|
|
86
77
|
</script>
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const ADVANCED_MARKER_ELEMENT_INJECTION_KEY: InjectionKey<{
|
|
3
|
-
advancedMarkerElement: ShallowRef<google.maps.marker.AdvancedMarkerElement | undefined>;
|
|
4
|
-
}>;
|
|
1
|
+
export { ADVANCED_MARKER_ELEMENT_INJECTION_KEY } from './injectionKeys.js';
|
|
5
2
|
declare const _default: typeof __VLS_export;
|
|
6
3
|
export default _default;
|
|
7
4
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { MAP_INJECTION_KEY } from "./ScriptGoogleMaps.vue";
|
|
2
|
+
import { watch } from "vue";
|
|
3
|
+
import { useGoogleMapsResource } from "./useGoogleMapsResource";
|
|
5
4
|
const props = defineProps({
|
|
6
5
|
options: { type: Object, required: false }
|
|
7
6
|
});
|
|
@@ -23,36 +22,28 @@ const eventsWithMapMouseEventPayload = [
|
|
|
23
22
|
"mouseup",
|
|
24
23
|
"rightclick"
|
|
25
24
|
];
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
circle?.setOptions(options);
|
|
36
|
-
}, {
|
|
37
|
-
deep: true
|
|
38
|
-
});
|
|
39
|
-
}, {
|
|
40
|
-
immediate: true,
|
|
41
|
-
once: true
|
|
42
|
-
});
|
|
43
|
-
onUnmounted(() => {
|
|
44
|
-
if (!circle || !mapContext?.mapsApi.value) {
|
|
45
|
-
return;
|
|
25
|
+
const circle = useGoogleMapsResource({
|
|
26
|
+
create({ mapsApi, map }) {
|
|
27
|
+
const c = new mapsApi.Circle({ map, ...props.options });
|
|
28
|
+
setupEventListeners(c);
|
|
29
|
+
return c;
|
|
30
|
+
},
|
|
31
|
+
cleanup(c, { mapsApi }) {
|
|
32
|
+
mapsApi.event.clearInstanceListeners(c);
|
|
33
|
+
c.setMap(null);
|
|
46
34
|
}
|
|
47
|
-
mapContext.mapsApi.value.event.clearInstanceListeners(circle);
|
|
48
|
-
circle.setMap(null);
|
|
49
35
|
});
|
|
50
|
-
|
|
36
|
+
watch(() => props.options, (options) => {
|
|
37
|
+
if (circle.value && options) {
|
|
38
|
+
circle.value.setOptions(options);
|
|
39
|
+
}
|
|
40
|
+
}, { deep: true });
|
|
41
|
+
function setupEventListeners(c) {
|
|
51
42
|
eventsWithoutPayload.forEach((event) => {
|
|
52
|
-
|
|
43
|
+
c.addListener(event, () => emit(event));
|
|
53
44
|
});
|
|
54
45
|
eventsWithMapMouseEventPayload.forEach((event) => {
|
|
55
|
-
|
|
46
|
+
c.addListener(event, (payload) => emit(event, payload));
|
|
56
47
|
});
|
|
57
48
|
}
|
|
58
49
|
</script>
|
|
@@ -1,30 +1,26 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { MAP_INJECTION_KEY } from "./ScriptGoogleMaps.vue";
|
|
2
|
+
import { watch } from "vue";
|
|
3
|
+
import { useGoogleMapsResource } from "./useGoogleMapsResource";
|
|
5
4
|
const props = defineProps({
|
|
6
5
|
options: { type: Object, required: false }
|
|
7
6
|
});
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
deep: true
|
|
20
|
-
});
|
|
21
|
-
}, {
|
|
22
|
-
immediate: true,
|
|
23
|
-
once: true
|
|
24
|
-
});
|
|
25
|
-
onUnmounted(() => {
|
|
26
|
-
heatmapLayer?.setMap(null);
|
|
7
|
+
const heatmapLayer = useGoogleMapsResource({
|
|
8
|
+
async create({ mapsApi, map }) {
|
|
9
|
+
await mapsApi.importLibrary("visualization");
|
|
10
|
+
return new mapsApi.visualization.HeatmapLayer({
|
|
11
|
+
map,
|
|
12
|
+
...props.options
|
|
13
|
+
});
|
|
14
|
+
},
|
|
15
|
+
cleanup(layer) {
|
|
16
|
+
layer.setMap(null);
|
|
17
|
+
}
|
|
27
18
|
});
|
|
19
|
+
watch(() => props.options, (options) => {
|
|
20
|
+
if (heatmapLayer.value && options) {
|
|
21
|
+
heatmapLayer.value.setOptions(options);
|
|
22
|
+
}
|
|
23
|
+
}, { deep: true });
|
|
28
24
|
</script>
|
|
29
25
|
|
|
30
26
|
<template>
|