@nuxt/scripts 1.3.0 → 1.3.2
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/devtools-client/200.html +1 -1
- package/dist/devtools-client/404.html +1 -1
- package/dist/devtools-client/_nuxt/B551Pnuh.js +1 -0
- package/dist/devtools-client/_nuxt/BDNMzG2s.js +1 -0
- package/dist/devtools-client/_nuxt/BGGk5RYW.js +1 -0
- package/dist/devtools-client/_nuxt/BKdLzFmX.js +3 -0
- package/dist/devtools-client/_nuxt/BZCL-v6S.js +1 -0
- package/dist/devtools-client/_nuxt/BgS3c2Ky.js +1 -0
- package/dist/devtools-client/_nuxt/CBuBrHyL.js +152 -0
- package/dist/devtools-client/_nuxt/CH5oUfNi.js +1 -0
- package/dist/devtools-client/_nuxt/C_v3_O0R.js +6 -0
- package/dist/devtools-client/_nuxt/CxN78VhB.js +1 -0
- package/dist/devtools-client/_nuxt/DAubxma0.js +1 -0
- package/dist/devtools-client/_nuxt/DK3Fl9T5.js +1 -0
- package/dist/devtools-client/_nuxt/DMbpbO54.js +1 -0
- package/dist/devtools-client/_nuxt/DgAtAWdT.js +1 -0
- package/dist/devtools-client/_nuxt/DvC3yV2P.js +1 -0
- package/dist/devtools-client/_nuxt/DzbSCA_w.js +1 -0
- package/dist/devtools-client/_nuxt/N_y8tuWA.js +28 -0
- package/dist/devtools-client/_nuxt/VICyrUSM.js +1 -0
- package/dist/devtools-client/_nuxt/VbXTXTou.js +1 -0
- package/dist/devtools-client/_nuxt/WOtyQdps.js +1 -0
- package/dist/devtools-client/_nuxt/builds/latest.json +1 -1
- package/dist/devtools-client/_nuxt/builds/meta/e2926f35-ae20-45a0-929d-54d3919623c3.json +1 -0
- package/dist/devtools-client/_nuxt/entry.CYUdJFoE.css +2 -0
- package/dist/devtools-client/_nuxt/error-404.CIn5oEzb.css +1 -0
- package/dist/devtools-client/_nuxt/error-500.B1YZl8g8.css +1 -0
- package/dist/devtools-client/_nuxt/first-party.D_Sf91yr.css +1 -0
- package/dist/devtools-client/_nuxt/pages.BF1VnccH.css +1 -0
- package/dist/devtools-client/_nuxt/qhed-kSA.js +1 -0
- package/dist/devtools-client/_nuxt/registry.DgEsTieW.css +1 -0
- package/dist/devtools-client/_nuxt/xAZ2vgo3.js +8 -0
- package/dist/devtools-client/docs/index.html +1 -1
- package/dist/devtools-client/first-party/index.html +1 -1
- package/dist/devtools-client/index.html +1 -1
- package/dist/devtools-client/registry/index.html +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +165 -2
- package/dist/registry.mjs +8 -2
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.d.vue.ts +2 -0
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.vue.d.ts +2 -0
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsStaticMap.vue +1 -0
- package/dist/runtime/composables/useScript.js +1 -1
- package/dist/runtime/registry/vimeo-player.d.ts +1 -2
- package/dist/runtime/registry/youtube-player.d.ts +1 -2
- package/dist/runtime/server/instagram-embed.js +2 -1
- package/dist/runtime/server/proxy-handler.js +45 -63
- package/dist/runtime/server/utils/cached-upstream.d.ts +2 -1
- package/dist/runtime/server/utils/cached-upstream.js +6 -3
- package/dist/runtime/types.d.ts +31 -1
- package/package.json +9 -6
- package/dist/devtools-client/_nuxt/B8PEiB0p.js +0 -1
- package/dist/devtools-client/_nuxt/BHx4OUbM.js +0 -195
- package/dist/devtools-client/_nuxt/CGpx20cA.js +0 -1
- package/dist/devtools-client/_nuxt/CVO1_9PV.js +0 -1
- package/dist/devtools-client/_nuxt/Cp-IABpG.js +0 -1
- package/dist/devtools-client/_nuxt/CrquxyIP.js +0 -1
- package/dist/devtools-client/_nuxt/D0r3Knsf.js +0 -1
- package/dist/devtools-client/_nuxt/D2og3hsL.js +0 -1
- package/dist/devtools-client/_nuxt/DSsHxmoa.js +0 -1
- package/dist/devtools-client/_nuxt/DfHxEc1R.js +0 -1
- package/dist/devtools-client/_nuxt/HwG19HWB.js +0 -1
- package/dist/devtools-client/_nuxt/builds/meta/95e11f41-6ffd-4129-ac40-6ad3d141308e.json +0 -1
- package/dist/devtools-client/_nuxt/entry.DehJww9T.css +0 -1
- package/dist/devtools-client/_nuxt/error-404.LWbgYmYe.css +0 -1
- package/dist/devtools-client/_nuxt/error-500.C19ZIySL.css +0 -1
- package/dist/devtools-client/_nuxt/first-party.D_SBdnka.css +0 -1
- package/dist/devtools-client/_nuxt/index.DIj4bh55.css +0 -1
- package/dist/devtools-client/_nuxt/registry.CDbTq1x3.css +0 -1
- package/dist/devtools-client/_nuxt/wDzz0qaB.js +0 -1
|
@@ -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.
|
|
1
|
+
<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><script type="importmap">{"imports":{"#entry":"/__nuxt-scripts/_nuxt/N_y8tuWA.js"}}</script><link rel="stylesheet" href="/__nuxt-scripts/_nuxt/entry.CYUdJFoE.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/N_y8tuWA.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/B551Pnuh.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/BKdLzFmX.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/CH5oUfNi.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/xAZ2vgo3.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/DK3Fl9T5.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/C_v3_O0R.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/BGGk5RYW.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/CBuBrHyL.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/CxN78VhB.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/BDNMzG2s.js"><script type="module" src="/__nuxt-scripts/_nuxt/N_y8tuWA.js" crossorigin></script><link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/DMbpbO54.js"><link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/qhed-kSA.js"><link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/BgS3c2Ky.js"><link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/VbXTXTou.js"><link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/BZCL-v6S.js"><link rel="prefetch" as="style" crossorigin href="/__nuxt-scripts/_nuxt/error-404.CIn5oEzb.css"><link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/DzbSCA_w.js"><link rel="prefetch" as="style" crossorigin href="/__nuxt-scripts/_nuxt/error-500.B1YZl8g8.css"><link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/WOtyQdps.js"><script>"use strict";(()=>{const o=window,e=document.documentElement,c=["dark","light"],s=getStorageValue("localStorage","nuxt-color-mode")||"system";let r=s==="system"?f():s;const l=e.getAttribute("data-color-mode-forced");l&&(r=l),i(r),o["__NUXT_COLOR_MODE__"]={preference:s,value:r,getColorScheme:f,addColorScheme:i,removeColorScheme:d};function i(t){const a=""+t+"",n="";e.classList?e.classList.add(a):e.className+=" "+a,n&&e.setAttribute("data-"+n,t)}function d(t){const a=""+t+"",n="";e.classList?e.classList.remove(a):e.className=e.className.replace(new RegExp(a,"g"),""),n&&e.removeAttribute("data-"+n)}function u(t){return o.matchMedia("(prefers-color-scheme"+t+")")}function f(){if(o.matchMedia&&u("").media!=="not all"){for(const t of c)if(u(":"+t).matches)return t}return"light"}})();function getStorageValue(o,e){switch(o){case"localStorage":try{return window.localStorage.getItem(e)}catch{return null}case"sessionStorage":try{return window.sessionStorage.getItem(e)}catch{return null}case"cookie":try{return getCookie(e)}catch{return null}default:return null}}function getCookie(o){const c=("; "+window.document.cookie).split("; "+o+"=");if(c.length===2){const s=c.pop();return s?s.split(";").shift():null}}</script></head><body><div id="__nuxt" class="isolate"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-scripts",buildId:"e2926f35-ae20-45a0-929d-54d3919623c3",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1784644746055,false]</script></body></html>
|
|
@@ -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.
|
|
1
|
+
<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><script type="importmap">{"imports":{"#entry":"/__nuxt-scripts/_nuxt/N_y8tuWA.js"}}</script><link rel="stylesheet" href="/__nuxt-scripts/_nuxt/entry.CYUdJFoE.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/N_y8tuWA.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/B551Pnuh.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/BKdLzFmX.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/CH5oUfNi.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/xAZ2vgo3.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/DK3Fl9T5.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/C_v3_O0R.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/BGGk5RYW.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/CBuBrHyL.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/CxN78VhB.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/BDNMzG2s.js"><script type="module" src="/__nuxt-scripts/_nuxt/N_y8tuWA.js" crossorigin></script><link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/DMbpbO54.js"><link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/qhed-kSA.js"><link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/BgS3c2Ky.js"><link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/VbXTXTou.js"><link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/BZCL-v6S.js"><link rel="prefetch" as="style" crossorigin href="/__nuxt-scripts/_nuxt/error-404.CIn5oEzb.css"><link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/DzbSCA_w.js"><link rel="prefetch" as="style" crossorigin href="/__nuxt-scripts/_nuxt/error-500.B1YZl8g8.css"><link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/WOtyQdps.js"><script>"use strict";(()=>{const o=window,e=document.documentElement,c=["dark","light"],s=getStorageValue("localStorage","nuxt-color-mode")||"system";let r=s==="system"?f():s;const l=e.getAttribute("data-color-mode-forced");l&&(r=l),i(r),o["__NUXT_COLOR_MODE__"]={preference:s,value:r,getColorScheme:f,addColorScheme:i,removeColorScheme:d};function i(t){const a=""+t+"",n="";e.classList?e.classList.add(a):e.className+=" "+a,n&&e.setAttribute("data-"+n,t)}function d(t){const a=""+t+"",n="";e.classList?e.classList.remove(a):e.className=e.className.replace(new RegExp(a,"g"),""),n&&e.removeAttribute("data-"+n)}function u(t){return o.matchMedia("(prefers-color-scheme"+t+")")}function f(){if(o.matchMedia&&u("").media!=="not all"){for(const t of c)if(u(":"+t).matches)return t}return"light"}})();function getStorageValue(o,e){switch(o){case"localStorage":try{return window.localStorage.getItem(e)}catch{return null}case"sessionStorage":try{return window.sessionStorage.getItem(e)}catch{return null}case"cookie":try{return getCookie(e)}catch{return null}default:return null}}function getCookie(o){const c=("; "+window.document.cookie).split("; "+o+"=");if(c.length===2){const s=c.pop();return s?s.split(";").shift():null}}</script></head><body><div id="__nuxt" class="isolate"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-scripts",buildId:"e2926f35-ae20-45a0-929d-54d3919623c3",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1784644746054,false]</script></body></html>
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -617,9 +617,146 @@ function rewriteScriptUrlsAST(content, filename, rewrites, sdkPatches, options)
|
|
|
617
617
|
const prev = content[start - 1];
|
|
618
618
|
return prev && WORD_OR_DOLLAR_RE.test(prev) ? " " : "";
|
|
619
619
|
}
|
|
620
|
+
function sourceOf(node) {
|
|
621
|
+
return content.slice(node.start, node.end);
|
|
622
|
+
}
|
|
620
623
|
const scopeTracker = new ScopeTracker({ preserveExitedScopes: true });
|
|
621
624
|
const { program } = parseAndWalk(content, filename, { scopeTracker });
|
|
622
625
|
scopeTracker.freeze();
|
|
626
|
+
const scriptLoaderUrlPatches = sdkPatches?.filter((p) => p.type === "replace-script-loader-url") ?? [];
|
|
627
|
+
const scriptLoaderFunctionKeys = /* @__PURE__ */ new Set();
|
|
628
|
+
function isIdentifier(node, name) {
|
|
629
|
+
return node?.type === "Identifier" && (!name || node.name === name);
|
|
630
|
+
}
|
|
631
|
+
function propertyName(node) {
|
|
632
|
+
if (!node)
|
|
633
|
+
return null;
|
|
634
|
+
if (node.type === "Identifier")
|
|
635
|
+
return node.name;
|
|
636
|
+
if (node.type === "Literal" && typeof node.value === "string")
|
|
637
|
+
return node.value;
|
|
638
|
+
return null;
|
|
639
|
+
}
|
|
640
|
+
function firstParamName(node) {
|
|
641
|
+
const param = node?.params?.[0];
|
|
642
|
+
return param?.type === "Identifier" ? param.name : null;
|
|
643
|
+
}
|
|
644
|
+
function functionName(node, parent) {
|
|
645
|
+
if (node.type === "FunctionDeclaration" && node.id?.type === "Identifier")
|
|
646
|
+
return node.id.name;
|
|
647
|
+
if ((node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression") && parent?.type === "VariableDeclarator" && parent.id?.type === "Identifier") {
|
|
648
|
+
return parent.id.name;
|
|
649
|
+
}
|
|
650
|
+
if ((node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression") && parent?.type === "AssignmentExpression" && parent.left?.type === "Identifier") {
|
|
651
|
+
return parent.left.name;
|
|
652
|
+
}
|
|
653
|
+
return null;
|
|
654
|
+
}
|
|
655
|
+
function declarationKey(name) {
|
|
656
|
+
const decl = scopeTracker.getDeclaration(name);
|
|
657
|
+
if (decl) {
|
|
658
|
+
const node = decl.node;
|
|
659
|
+
return `${decl.type}:${decl.scope}:${node?.start ?? decl.start}:${node?.end ?? decl.end}`;
|
|
660
|
+
}
|
|
661
|
+
return `global:${name}`;
|
|
662
|
+
}
|
|
663
|
+
function isScriptLoaderPathLiteral(value, pathPrefix) {
|
|
664
|
+
return value === pathPrefix || value.startsWith(`${pathPrefix}/`);
|
|
665
|
+
}
|
|
666
|
+
function getIdentifierInit(name) {
|
|
667
|
+
const decl = scopeTracker.getDeclaration(name);
|
|
668
|
+
if (!(decl instanceof ScopeTrackerVariable))
|
|
669
|
+
return null;
|
|
670
|
+
const declarators = decl.variableNode.declarations;
|
|
671
|
+
if (!declarators)
|
|
672
|
+
return null;
|
|
673
|
+
for (const declarator of declarators) {
|
|
674
|
+
if (declarator.id?.type === "Identifier" && declarator.id.name === name)
|
|
675
|
+
return declarator.init ?? null;
|
|
676
|
+
}
|
|
677
|
+
return null;
|
|
678
|
+
}
|
|
679
|
+
function findScriptLoaderPathExpression(node, pathPrefix, seenIdentifiers = /* @__PURE__ */ new Set()) {
|
|
680
|
+
if (!node)
|
|
681
|
+
return null;
|
|
682
|
+
if (node.type === "Identifier") {
|
|
683
|
+
if (seenIdentifiers.has(node.name))
|
|
684
|
+
return null;
|
|
685
|
+
const init = getIdentifierInit(node.name);
|
|
686
|
+
if (!init)
|
|
687
|
+
return null;
|
|
688
|
+
seenIdentifiers.add(node.name);
|
|
689
|
+
return findScriptLoaderPathExpression(init, pathPrefix, seenIdentifiers) ? node : null;
|
|
690
|
+
}
|
|
691
|
+
if (node.type === "Literal" && typeof node.value === "string" && isScriptLoaderPathLiteral(node.value, pathPrefix))
|
|
692
|
+
return node;
|
|
693
|
+
if (node.type === "TemplateLiteral") {
|
|
694
|
+
const hasConfigPrefix = node.quasis?.some((q) => {
|
|
695
|
+
const value = q.value?.cooked ?? q.value?.raw;
|
|
696
|
+
return typeof value === "string" && isScriptLoaderPathLiteral(value, pathPrefix);
|
|
697
|
+
});
|
|
698
|
+
return hasConfigPrefix ? node : null;
|
|
699
|
+
}
|
|
700
|
+
if (node.type === "CallExpression") {
|
|
701
|
+
for (const arg of node.arguments ?? []) {
|
|
702
|
+
const found = findScriptLoaderPathExpression(arg, pathPrefix, seenIdentifiers);
|
|
703
|
+
if (found)
|
|
704
|
+
return found;
|
|
705
|
+
}
|
|
706
|
+
return null;
|
|
707
|
+
}
|
|
708
|
+
if (node.type === "BinaryExpression" || node.type === "LogicalExpression")
|
|
709
|
+
return findScriptLoaderPathExpression(node.right, pathPrefix, seenIdentifiers) || findScriptLoaderPathExpression(node.left, pathPrefix, seenIdentifiers);
|
|
710
|
+
if (node.type === "ConditionalExpression")
|
|
711
|
+
return findScriptLoaderPathExpression(node.consequent, pathPrefix, seenIdentifiers) || findScriptLoaderPathExpression(node.alternate, pathPrefix, seenIdentifiers);
|
|
712
|
+
if (node.type === "SequenceExpression") {
|
|
713
|
+
for (let i = node.expressions.length - 1; i >= 0; i--) {
|
|
714
|
+
const found = findScriptLoaderPathExpression(node.expressions[i], pathPrefix, seenIdentifiers);
|
|
715
|
+
if (found)
|
|
716
|
+
return found;
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
return null;
|
|
720
|
+
}
|
|
721
|
+
function isScriptLoaderFunction(node, urlParam) {
|
|
722
|
+
let matches = false;
|
|
723
|
+
walk(node.body, {
|
|
724
|
+
enter(child) {
|
|
725
|
+
if (child !== node.body && (child.type === "FunctionDeclaration" || child.type === "FunctionExpression" || child.type === "ArrowFunctionExpression")) {
|
|
726
|
+
this.skip();
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
729
|
+
if (child.type === "CallExpression" && child.callee?.type === "Identifier" && child.callee.name === "importScripts" && isIdentifier(child.arguments?.[0], urlParam)) {
|
|
730
|
+
matches = true;
|
|
731
|
+
}
|
|
732
|
+
if (child.type === "CallExpression" && child.callee?.type === "MemberExpression" && propertyName(child.callee.property) === "setAttribute" && child.arguments?.[0]?.type === "Literal" && child.arguments[0].value === "src" && isIdentifier(child.arguments?.[1], urlParam)) {
|
|
733
|
+
matches = true;
|
|
734
|
+
}
|
|
735
|
+
if (child.type === "Property" && propertyName(child.key) === "src" && isIdentifier(child.value, urlParam)) {
|
|
736
|
+
matches = true;
|
|
737
|
+
}
|
|
738
|
+
if (child.type === "AssignmentExpression" && child.left?.type === "MemberExpression" && propertyName(child.left.property) === "src" && isIdentifier(child.right, urlParam)) {
|
|
739
|
+
matches = true;
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
});
|
|
743
|
+
return matches;
|
|
744
|
+
}
|
|
745
|
+
if (scriptLoaderUrlPatches.length) {
|
|
746
|
+
walk(program, {
|
|
747
|
+
scopeTracker,
|
|
748
|
+
enter(node, parent) {
|
|
749
|
+
if (node.type !== "FunctionDeclaration" && node.type !== "FunctionExpression" && node.type !== "ArrowFunctionExpression")
|
|
750
|
+
return;
|
|
751
|
+
const name = functionName(node, parent);
|
|
752
|
+
const param = firstParamName(node);
|
|
753
|
+
if (!name || !param)
|
|
754
|
+
return;
|
|
755
|
+
if (isScriptLoaderFunction(node, param))
|
|
756
|
+
scriptLoaderFunctionKeys.add(declarationKey(name));
|
|
757
|
+
}
|
|
758
|
+
});
|
|
759
|
+
}
|
|
623
760
|
walk(program, {
|
|
624
761
|
scopeTracker,
|
|
625
762
|
enter(node, parent, ctx) {
|
|
@@ -759,6 +896,31 @@ function rewriteScriptUrlsAST(content, filename, rewrites, sdkPatches, options)
|
|
|
759
896
|
}
|
|
760
897
|
}
|
|
761
898
|
}
|
|
899
|
+
if (sdkPatches?.some((p) => p.type === "replace-new-url-host") && node.type === "MemberExpression" && !node.computed) {
|
|
900
|
+
const obj = node.object;
|
|
901
|
+
const prop = node.property;
|
|
902
|
+
if (prop?.type === "Identifier" && (prop.name === "host" || prop.name === "hostname") && obj?.type === "NewExpression" && obj.callee?.type === "Identifier" && obj.callee.name === "URL" && obj.arguments?.length >= 1) {
|
|
903
|
+
const patch = sdkPatches.find((p) => p.type === "replace-new-url-host");
|
|
904
|
+
if (patch)
|
|
905
|
+
s.overwrite(node.start, node.end, `${needsLeadingSpace(node.start)}${JSON.stringify(patch.host)}`);
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
if (scriptLoaderUrlPatches.length && node.type === "CallExpression" && node.callee?.type === "Identifier" && scriptLoaderFunctionKeys.has(declarationKey(node.callee.name))) {
|
|
909
|
+
const urlArg = node.arguments?.[0];
|
|
910
|
+
if (urlArg) {
|
|
911
|
+
for (const patch of scriptLoaderUrlPatches) {
|
|
912
|
+
const rewrite = rewrites.find((r) => r.from === patch.fromDomain);
|
|
913
|
+
if (!rewrite)
|
|
914
|
+
continue;
|
|
915
|
+
const pathNode = findScriptLoaderPathExpression(urlArg, patch.pathPrefix);
|
|
916
|
+
if (!pathNode)
|
|
917
|
+
continue;
|
|
918
|
+
s.overwrite(urlArg.start, urlArg.end, `${needsLeadingSpace(urlArg.start)}self.location.origin+"${rewrite.to}"+${sourceOf(pathNode)}`);
|
|
919
|
+
this.skip();
|
|
920
|
+
break;
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
}
|
|
762
924
|
if (node.type === "NewExpression" && !options?.skipApiRewrites) {
|
|
763
925
|
const callee = node.callee;
|
|
764
926
|
if (callee?.type === "Identifier" && callee.name === "XMLHttpRequest") {
|
|
@@ -894,7 +1056,7 @@ async function downloadScript(opts, renderedScript, fetchOptions, cacheMaxAge) {
|
|
|
894
1056
|
function NuxtScriptBundleTransformer(options = {
|
|
895
1057
|
renderedScript: /* @__PURE__ */ new Map()
|
|
896
1058
|
}) {
|
|
897
|
-
const nuxt = useNuxt();
|
|
1059
|
+
const nuxt = options.nuxt ?? useNuxt();
|
|
898
1060
|
const { renderedScript = /* @__PURE__ */ new Map() } = options;
|
|
899
1061
|
const cacheDir = join(nuxt.options.buildDir, "cache", "scripts");
|
|
900
1062
|
nuxt.hooks.hook("build:done", async () => {
|
|
@@ -914,7 +1076,7 @@ function NuxtScriptBundleTransformer(options = {
|
|
|
914
1076
|
await Promise.all(scripts.map(async ([url, content]) => {
|
|
915
1077
|
if (content instanceof Error || !content.filename)
|
|
916
1078
|
return;
|
|
917
|
-
await fsp.writeFile(join(
|
|
1079
|
+
await fsp.writeFile(join(cacheDir, content.filename), content.content);
|
|
918
1080
|
logger.debug(colors.gray(` \u251C\u2500 ${url} \u2192 ${joinURL(content.src)} (${content.size.toFixed(2)} kB ${content.encoding})`));
|
|
919
1081
|
}));
|
|
920
1082
|
});
|
|
@@ -2149,6 +2311,7 @@ Options: configure platform rewrites, switch to server-rendered mode, or disable
|
|
|
2149
2311
|
dev: true
|
|
2150
2312
|
});
|
|
2151
2313
|
addBuildPlugin(NuxtScriptBundleTransformer({
|
|
2314
|
+
nuxt,
|
|
2152
2315
|
scripts: registryScriptsWithImport,
|
|
2153
2316
|
registryConfig: nuxt.options.runtimeConfig.public.scripts,
|
|
2154
2317
|
proxyConfigs,
|
package/dist/registry.mjs
CHANGED
|
@@ -456,10 +456,16 @@ async function registry(resolve) {
|
|
|
456
456
|
src: "https://sc-static.net/scevent.min.js",
|
|
457
457
|
category: "ad",
|
|
458
458
|
envDefaults: { id: "" },
|
|
459
|
-
bundle:
|
|
459
|
+
bundle: {
|
|
460
|
+
sdkPatches: [{ type: "replace-new-url-host", host: "sc-static.net" }]
|
|
461
|
+
},
|
|
460
462
|
proxy: {
|
|
461
463
|
domains: ["sc-static.net", "tr.snapchat.com", "pixel.tapad.com"],
|
|
462
|
-
privacy: PRIVACY_FULL
|
|
464
|
+
privacy: PRIVACY_FULL,
|
|
465
|
+
sdkPatches: [
|
|
466
|
+
{ type: "replace-new-url-host", host: "sc-static.net" },
|
|
467
|
+
{ type: "replace-script-loader-url", fromDomain: "tr.snapchat.com", pathPrefix: "/config" }
|
|
468
|
+
]
|
|
463
469
|
},
|
|
464
470
|
partytown: { forwards: ["snaptr"] }
|
|
465
471
|
}),
|
|
@@ -84,10 +84,12 @@ declare const _default: typeof __VLS_export;
|
|
|
84
84
|
export default _default;
|
|
85
85
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ScriptGoogleMapsOverlayViewProps & {
|
|
86
86
|
open?: boolean;
|
|
87
|
+
openModifiers?: Partial<Record<"open", true>>;
|
|
87
88
|
}, ScriptGoogleMapsOverlayViewExpose, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
88
89
|
"update:open": (value: boolean) => any;
|
|
89
90
|
}, string, import("vue").PublicProps, Readonly<ScriptGoogleMapsOverlayViewProps & {
|
|
90
91
|
open?: boolean;
|
|
92
|
+
openModifiers?: Partial<Record<"open", true>>;
|
|
91
93
|
}> & Readonly<{
|
|
92
94
|
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
93
95
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ScriptGoogleMapsOverlayViewSlots>;
|
|
@@ -84,10 +84,12 @@ declare const _default: typeof __VLS_export;
|
|
|
84
84
|
export default _default;
|
|
85
85
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ScriptGoogleMapsOverlayViewProps & {
|
|
86
86
|
open?: boolean;
|
|
87
|
+
openModifiers?: Partial<Record<"open", true>>;
|
|
87
88
|
}, ScriptGoogleMapsOverlayViewExpose, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
88
89
|
"update:open": (value: boolean) => any;
|
|
89
90
|
}, string, import("vue").PublicProps, Readonly<ScriptGoogleMapsOverlayViewProps & {
|
|
90
91
|
open?: boolean;
|
|
92
|
+
openModifiers?: Partial<Record<"open", true>>;
|
|
91
93
|
}> & Readonly<{
|
|
92
94
|
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
93
95
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ScriptGoogleMapsOverlayViewSlots>;
|
|
@@ -203,7 +203,7 @@ export function useScript(input, options) {
|
|
|
203
203
|
logger.info(out);
|
|
204
204
|
}
|
|
205
205
|
} else if (options.trigger === "onNuxtReady" || options.trigger === "client") {
|
|
206
|
-
if (
|
|
206
|
+
if (options.warmupStrategy === void 0) {
|
|
207
207
|
options.warmupStrategy = "preload";
|
|
208
208
|
}
|
|
209
209
|
if (options.trigger === "onNuxtReady") {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { UseScriptContext } from '@unhead/vue';
|
|
2
1
|
import type Vimeo from '@vimeo/player';
|
|
3
|
-
import type { RegistryScriptInput } from '#nuxt-scripts/types';
|
|
2
|
+
import type { RegistryScriptInput, UseScriptContext } from '#nuxt-scripts/types';
|
|
4
3
|
type Constructor<T extends new (...args: any) => any> = T extends new (...args: infer A) => infer R ? new (...args: A) => R : never;
|
|
5
4
|
export interface VimeoPlayerApi {
|
|
6
5
|
Vimeo: {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { UseScriptContext } from '
|
|
2
|
-
import type { RegistryScriptInput } from '#nuxt-scripts/types';
|
|
1
|
+
import type { RegistryScriptInput, UseScriptContext } from '#nuxt-scripts/types';
|
|
3
2
|
import type { MaybePromise } from '../utils.js';
|
|
4
3
|
export interface YouTubePlayerApi {
|
|
5
4
|
YT: MaybePromise<{
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createError, defineEventHandler, getQuery, setHeader } from "h3";
|
|
2
2
|
import { defineCachedFunction, useRuntimeConfig } from "nitropack/runtime";
|
|
3
3
|
import { $fetch } from "ofetch";
|
|
4
|
+
import { hash } from "ohash";
|
|
4
5
|
import { ELEMENT_NODE, parse, renderSync, TEXT_NODE, walkSync } from "ultrahtml";
|
|
5
6
|
import { createCachedJsonFetch } from "./utils/cached-upstream.js";
|
|
6
7
|
import { isEmbedShell, proxyAssetUrl, rewriteUrl, rewriteUrlsInText, RSRC_RE, scopeCss } from "./utils/instagram-embed.js";
|
|
@@ -33,7 +34,7 @@ const cachedEmbedFetch = defineCachedFunction(
|
|
|
33
34
|
const parts = [url];
|
|
34
35
|
for (const [k, v] of Object.entries(headers).sort(([a], [b]) => a.localeCompare(b)))
|
|
35
36
|
parts.push(`${k}=${v}`);
|
|
36
|
-
return parts
|
|
37
|
+
return hash(parts);
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createError, defineEventHandler, getHeaders, getQuery, getRequestIP, getRequestWebStream, readBody, setResponseHeader, setResponseStatus } from "h3";
|
|
1
|
+
import { createError, defineEventHandler, getHeaders, getQuery, getRequestIP, getRequestWebStream, readBody, readRawBody, setResponseHeader, setResponseStatus } from "h3";
|
|
2
2
|
import { useNitroApp, useRuntimeConfig } from "nitropack/runtime";
|
|
3
3
|
import { matchDomain } from "./utils/match-domain.js";
|
|
4
4
|
import {
|
|
@@ -83,11 +83,15 @@ export default defineEventHandler(async (event) => {
|
|
|
83
83
|
const anyPrivacy = privacy.ip || privacy.userAgent || privacy.language || privacy.screen || privacy.timezone || privacy.hardware;
|
|
84
84
|
const originalHeaders = getHeaders(event);
|
|
85
85
|
const originalQuery = getQuery(event);
|
|
86
|
-
const contentType = originalHeaders["content-type"] || "";
|
|
86
|
+
const contentType = originalHeaders["content-type"]?.toLowerCase() || "";
|
|
87
87
|
const compressionParam = originalQuery.compression || "";
|
|
88
|
-
const
|
|
88
|
+
const method = event.method?.toUpperCase();
|
|
89
|
+
const isWriteMethod = method === "POST" || method === "PUT" || method === "PATCH";
|
|
90
|
+
const transformableBodyType = contentType.includes("application/x-www-form-urlencoded") ? "form" : contentType.includes("json") ? "json" : void 0;
|
|
91
|
+
const hasOpaqueBodyEncoding = Boolean(
|
|
89
92
|
originalHeaders["content-encoding"] || contentType.includes("octet-stream") || compressionParam && COMPRESSION_RE.test(compressionParam)
|
|
90
93
|
);
|
|
94
|
+
const shouldTransformBody = isWriteMethod && anyPrivacy && !hasOpaqueBodyEncoding && transformableBodyType !== void 0;
|
|
91
95
|
let targetUrl = targetBase + remainingPath;
|
|
92
96
|
let strippedQueryRecord;
|
|
93
97
|
if (anyPrivacy) {
|
|
@@ -114,7 +118,7 @@ export default defineEventHandler(async (event) => {
|
|
|
114
118
|
if (SENSITIVE_HEADERS.includes(lowerKey))
|
|
115
119
|
continue;
|
|
116
120
|
if (lowerKey === "content-length") {
|
|
117
|
-
if (
|
|
121
|
+
if (shouldTransformBody)
|
|
118
122
|
continue;
|
|
119
123
|
headers[lowerKey] = value;
|
|
120
124
|
continue;
|
|
@@ -160,69 +164,47 @@ export default defineEventHandler(async (event) => {
|
|
|
160
164
|
let body;
|
|
161
165
|
let rawBody;
|
|
162
166
|
let passthroughBody = false;
|
|
163
|
-
const method = event.method?.toUpperCase();
|
|
164
|
-
const isWriteMethod = method === "POST" || method === "PUT" || method === "PATCH";
|
|
165
167
|
if (isWriteMethod) {
|
|
166
|
-
if (
|
|
168
|
+
if (!shouldTransformBody) {
|
|
167
169
|
passthroughBody = true;
|
|
168
|
-
} else {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
if (contentType.includes("application/x-www-form-urlencoded")) {
|
|
179
|
-
const params = new URLSearchParams(rawBody);
|
|
180
|
-
const obj = {};
|
|
181
|
-
for (const [key, value] of params.entries()) {
|
|
182
|
-
if (key in obj) {
|
|
183
|
-
const existing = obj[key];
|
|
184
|
-
obj[key] = Array.isArray(existing) ? [...existing, value] : [existing, value];
|
|
185
|
-
} else {
|
|
186
|
-
obj[key] = value;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
const stripped = stripPayloadFingerprinting(obj, privacy);
|
|
190
|
-
const out = new URLSearchParams();
|
|
191
|
-
for (const [k, v] of Object.entries(stripped)) {
|
|
192
|
-
if (v === void 0 || v === null)
|
|
193
|
-
continue;
|
|
194
|
-
if (Array.isArray(v)) {
|
|
195
|
-
for (const item of v)
|
|
196
|
-
out.append(k, typeof item === "string" ? item : JSON.stringify(item));
|
|
197
|
-
} else {
|
|
198
|
-
out.append(k, typeof v === "string" ? v : JSON.stringify(v));
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
body = out.toString();
|
|
170
|
+
} else if (transformableBodyType === "form") {
|
|
171
|
+
const formBody = await readRawBody(event);
|
|
172
|
+
rawBody = formBody;
|
|
173
|
+
if (formBody != null) {
|
|
174
|
+
const params = new URLSearchParams(formBody);
|
|
175
|
+
const formRecord = /* @__PURE__ */ Object.create(null);
|
|
176
|
+
for (const [key, value] of params.entries()) {
|
|
177
|
+
if (Object.hasOwn(formRecord, key)) {
|
|
178
|
+
const existing = formRecord[key];
|
|
179
|
+
formRecord[key] = Array.isArray(existing) ? [...existing, value] : [existing, value];
|
|
202
180
|
} else {
|
|
203
|
-
|
|
204
|
-
if (maybeJson) {
|
|
205
|
-
let parsed = null;
|
|
206
|
-
try {
|
|
207
|
-
parsed = JSON.parse(rawBody);
|
|
208
|
-
} catch {
|
|
209
|
-
}
|
|
210
|
-
if (Array.isArray(parsed)) {
|
|
211
|
-
body = parsed.map(
|
|
212
|
-
(item) => item && typeof item === "object" && !Array.isArray(item) ? stripPayloadFingerprinting(item, privacy) : item
|
|
213
|
-
);
|
|
214
|
-
} else if (parsed && typeof parsed === "object") {
|
|
215
|
-
body = stripPayloadFingerprinting(parsed, privacy);
|
|
216
|
-
} else {
|
|
217
|
-
body = rawBody;
|
|
218
|
-
}
|
|
219
|
-
} else {
|
|
220
|
-
body = rawBody;
|
|
221
|
-
}
|
|
181
|
+
formRecord[key] = value;
|
|
222
182
|
}
|
|
223
|
-
} else {
|
|
224
|
-
body = rawBody;
|
|
225
183
|
}
|
|
184
|
+
const stripped = stripPayloadFingerprinting(formRecord, privacy);
|
|
185
|
+
const transformedValues = /* @__PURE__ */ new Map();
|
|
186
|
+
for (const [key, value] of Object.entries(stripped)) {
|
|
187
|
+
transformedValues.set(key, Array.isArray(value) ? [...value] : [value]);
|
|
188
|
+
}
|
|
189
|
+
const transformed = new URLSearchParams();
|
|
190
|
+
for (const [key] of params.entries()) {
|
|
191
|
+
const value = transformedValues.get(key)?.shift();
|
|
192
|
+
if (value === void 0 || value === null)
|
|
193
|
+
continue;
|
|
194
|
+
transformed.append(key, typeof value === "string" ? value : JSON.stringify(value));
|
|
195
|
+
}
|
|
196
|
+
body = transformed.toString();
|
|
197
|
+
}
|
|
198
|
+
} else {
|
|
199
|
+
rawBody = await readBody(event);
|
|
200
|
+
if (Array.isArray(rawBody)) {
|
|
201
|
+
body = rawBody.map(
|
|
202
|
+
(item) => item && typeof item === "object" && !Array.isArray(item) ? stripPayloadFingerprinting(item, privacy) : item
|
|
203
|
+
);
|
|
204
|
+
} else if (rawBody !== null && typeof rawBody === "object") {
|
|
205
|
+
body = stripPayloadFingerprinting(rawBody, privacy);
|
|
206
|
+
} else {
|
|
207
|
+
body = rawBody;
|
|
226
208
|
}
|
|
227
209
|
}
|
|
228
210
|
}
|
|
@@ -256,7 +238,7 @@ export default defineEventHandler(async (event) => {
|
|
|
256
238
|
if (passthroughBody) {
|
|
257
239
|
fetchBody = getRequestWebStream(event);
|
|
258
240
|
} else if (body !== void 0) {
|
|
259
|
-
fetchBody =
|
|
241
|
+
fetchBody = transformableBodyType === "json" ? JSON.stringify(body) : String(body);
|
|
260
242
|
}
|
|
261
243
|
let response;
|
|
262
244
|
try {
|
|
@@ -45,7 +45,8 @@ export declare function createCachedBinaryFetch(name: string, maxAge: number): (
|
|
|
45
45
|
/**
|
|
46
46
|
* Cache upstream JSON/text fetches. `getKey` is caller-controlled so handlers
|
|
47
47
|
* can normalize on whichever inner params identify the resource (tweet ID,
|
|
48
|
-
* post URL, query hash).
|
|
48
|
+
* post URL, query hash). The normalized value is hashed before it reaches
|
|
49
|
+
* Nitro storage because raw URLs can contain reserved key characters.
|
|
49
50
|
*/
|
|
50
51
|
export declare function createCachedJsonFetch<T>(name: string, maxAge: number, getKey: (url: string, opts?: {
|
|
51
52
|
headers?: Record<string, string>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Buffer } from "node:buffer";
|
|
2
2
|
import { defineCachedFunction } from "nitropack/runtime";
|
|
3
3
|
import { $fetch } from "ofetch";
|
|
4
|
+
import { hash } from "ohash";
|
|
4
5
|
export function createCachedBinaryFetch(name, maxAge) {
|
|
5
6
|
const cached = defineCachedFunction(
|
|
6
7
|
async (url, opts) => {
|
|
@@ -25,7 +26,7 @@ export function createCachedBinaryFetch(name, maxAge) {
|
|
|
25
26
|
staleMaxAge: maxAge,
|
|
26
27
|
getKey: (url, opts) => {
|
|
27
28
|
if (!opts)
|
|
28
|
-
return url;
|
|
29
|
+
return hash(url);
|
|
29
30
|
const parts = [url];
|
|
30
31
|
if (opts.headers) {
|
|
31
32
|
const entries = Object.entries(opts.headers).sort(([a], [b]) => a.localeCompare(b));
|
|
@@ -34,7 +35,9 @@ export function createCachedBinaryFetch(name, maxAge) {
|
|
|
34
35
|
}
|
|
35
36
|
if (opts.redirect)
|
|
36
37
|
parts.push(`redirect=${opts.redirect}`);
|
|
37
|
-
|
|
38
|
+
if (opts.ignoreResponseError !== void 0)
|
|
39
|
+
parts.push(`ignoreResponseError=${opts.ignoreResponseError}`);
|
|
40
|
+
return hash(parts);
|
|
38
41
|
}
|
|
39
42
|
}
|
|
40
43
|
);
|
|
@@ -59,7 +62,7 @@ export function createCachedJsonFetch(name, maxAge, getKey) {
|
|
|
59
62
|
maxAge,
|
|
60
63
|
swr: true,
|
|
61
64
|
staleMaxAge: maxAge,
|
|
62
|
-
getKey
|
|
65
|
+
getKey: (url, opts) => hash(getKey(url, opts))
|
|
63
66
|
}
|
|
64
67
|
);
|
|
65
68
|
}
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UseScriptInput, UseScriptOptions, VueScriptInstance } from '@unhead/vue';
|
|
1
|
+
import type { UseScriptInput, UseScriptOptions, VueScriptInstance } from '@unhead/vue/scripts';
|
|
2
2
|
import type { Script } from '@unhead/vue/types';
|
|
3
3
|
import type { Import } from 'unimport';
|
|
4
4
|
import type { InferInput, ObjectEntries, ObjectSchema, UnionSchema, ValiError } from 'valibot';
|
|
@@ -423,6 +423,36 @@ export type SdkPatch = {
|
|
|
423
423
|
| {
|
|
424
424
|
type: 'replace-new-url-origin';
|
|
425
425
|
fromDomain: string;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Replace `new URL(<expr>).host` / `.hostname` with a known vendor host.
|
|
429
|
+
* Used by SDKs that detect self-hosting from their own script URL and switch
|
|
430
|
+
* into a different endpoint mode when bundled.
|
|
431
|
+
*
|
|
432
|
+
* Applies to EVERY `new URL(...).host` / `.hostname` in the bundle, not just
|
|
433
|
+
* the self-src detection — only use it for SDKs that don't parse other URLs
|
|
434
|
+
* (e.g. referrers, click-throughs) with this pattern.
|
|
435
|
+
*/
|
|
436
|
+
| {
|
|
437
|
+
type: 'replace-new-url-host';
|
|
438
|
+
host: string;
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Replace script loader calls that receive a known path prefix with the
|
|
442
|
+
* configured proxied domain. This covers SDKs that assemble URLs from
|
|
443
|
+
* minified variables before passing them to a script `src` helper or
|
|
444
|
+
* `importScripts`, where ordinary string literal URL rewriting cannot see
|
|
445
|
+
* the final host.
|
|
446
|
+
*
|
|
447
|
+
* The loader's whole first argument is replaced with
|
|
448
|
+
* `origin + proxyPath + <matched path expression>` — any parts of the
|
|
449
|
+
* argument outside the matched path expression (e.g. an appended query
|
|
450
|
+
* string) are dropped.
|
|
451
|
+
*/
|
|
452
|
+
| {
|
|
453
|
+
type: 'replace-script-loader-url';
|
|
454
|
+
fromDomain: string;
|
|
455
|
+
pathPrefix: string;
|
|
426
456
|
};
|
|
427
457
|
/**
|
|
428
458
|
* Partytown capability config. When present, the script can run in a
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/scripts",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.2",
|
|
5
5
|
"description": "Load third-party scripts with better performance, privacy and DX in Nuxt Apps.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Harlan Wilton",
|
|
@@ -101,6 +101,9 @@
|
|
|
101
101
|
"@types/youtube": {
|
|
102
102
|
"optional": true
|
|
103
103
|
},
|
|
104
|
+
"@unhead/vue": {
|
|
105
|
+
"optional": true
|
|
106
|
+
},
|
|
104
107
|
"posthog-js": {
|
|
105
108
|
"optional": true
|
|
106
109
|
}
|
|
@@ -112,23 +115,23 @@
|
|
|
112
115
|
"consola": "^3.4.2",
|
|
113
116
|
"defu": "^6.1.7",
|
|
114
117
|
"h3": "^1.15.11",
|
|
115
|
-
"magic-string": "^0.
|
|
118
|
+
"magic-string": "^1.0.0",
|
|
116
119
|
"ofetch": "^1.5.1",
|
|
117
120
|
"ohash": "^2.0.11",
|
|
118
|
-
"oxc-parser": "^0.
|
|
121
|
+
"oxc-parser": "^0.140.0",
|
|
119
122
|
"oxc-walker": "^1.0.0",
|
|
120
123
|
"pathe": "^2.0.3",
|
|
121
124
|
"pkg-types": "^2.3.1",
|
|
122
125
|
"sirv": "^3.0.2",
|
|
123
|
-
"std-env": "^4.
|
|
126
|
+
"std-env": "^4.2.0",
|
|
124
127
|
"ufo": "^1.6.4",
|
|
125
|
-
"ultrahtml": "^1.
|
|
128
|
+
"ultrahtml": "^1.7.0",
|
|
126
129
|
"unplugin": "^3.3.0",
|
|
127
130
|
"unstorage": "^1.17.5",
|
|
128
131
|
"valibot": "^1.4.2"
|
|
129
132
|
},
|
|
130
133
|
"devDependencies": {
|
|
131
|
-
"@nuxt/kit": "^4.
|
|
134
|
+
"@nuxt/kit": "^4.5.0",
|
|
132
135
|
"@nuxt/module-builder": "^1.0.2",
|
|
133
136
|
"@speedcurve/lux": "^4.4.3",
|
|
134
137
|
"rollup": "^4.62.2",
|