@nuxt/scripts 1.0.0-beta.1 → 1.0.0-beta.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/README.md +6 -0
- package/dist/client/200.html +1 -1
- package/dist/client/404.html +1 -1
- package/dist/client/_nuxt/B66N9HCo.js +1 -0
- package/dist/client/_nuxt/B8XOar-X.js +162 -0
- package/dist/client/_nuxt/{DTDyDxvR.js → DfLgoB--.js} +1 -1
- package/dist/client/_nuxt/DvH517bE.js +1 -0
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/133a46c5-a5c1-4a63-87d1-037947a5bcdb.json +1 -0
- package/dist/client/_nuxt/entry.D45OuV0w.css +1 -0
- package/dist/client/_nuxt/error-404.B57D-jUQ.css +1 -0
- package/dist/client/_nuxt/error-500.DTHUW7BI.css +1 -0
- package/dist/client/index.html +1 -1
- package/dist/module.d.mts +80 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +630 -142
- package/dist/registry.mjs +10 -0
- package/dist/runtime/components/ScriptInstagramEmbed.d.vue.ts +53 -0
- package/dist/runtime/components/ScriptInstagramEmbed.vue +38 -0
- package/dist/runtime/components/ScriptInstagramEmbed.vue.d.ts +53 -0
- package/dist/runtime/components/ScriptXEmbed.d.vue.ts +82 -0
- package/dist/runtime/components/ScriptXEmbed.vue +76 -0
- package/dist/runtime/components/ScriptXEmbed.vue.d.ts +82 -0
- package/dist/runtime/composables/useScript.js +24 -3
- package/dist/runtime/composables/useScriptTriggerServiceWorker.d.ts +7 -0
- package/dist/runtime/composables/useScriptTriggerServiceWorker.js +39 -0
- package/dist/runtime/plugins/sw-register.client.d.ts +2 -0
- package/dist/runtime/plugins/sw-register.client.js +12 -0
- package/dist/runtime/registry/instagram-embed.d.ts +23 -0
- package/dist/runtime/registry/instagram-embed.js +22 -0
- package/dist/runtime/registry/lemon-squeezy.d.ts +0 -1
- package/dist/runtime/registry/plausible-analytics.js +2 -2
- package/dist/runtime/registry/tiktok-pixel.d.ts +1 -0
- package/dist/runtime/registry/tiktok-pixel.js +1 -0
- package/dist/runtime/registry/x-embed.d.ts +77 -0
- package/dist/runtime/registry/x-embed.js +41 -0
- package/dist/runtime/server/instagram-embed-asset.d.ts +2 -0
- package/dist/runtime/server/instagram-embed-asset.js +42 -0
- package/dist/runtime/server/instagram-embed-image.d.ts +2 -0
- package/dist/runtime/server/instagram-embed-image.js +54 -0
- package/dist/runtime/server/instagram-embed.d.ts +2 -0
- package/dist/runtime/server/instagram-embed.js +91 -0
- package/dist/runtime/server/proxy-handler.d.ts +6 -0
- package/dist/runtime/server/proxy-handler.js +230 -0
- package/dist/runtime/server/sw-handler.d.ts +2 -0
- package/dist/runtime/server/sw-handler.js +25 -0
- package/dist/runtime/server/utils/privacy.d.ts +97 -0
- package/dist/runtime/server/utils/privacy.js +268 -0
- package/dist/runtime/server/x-embed-image.d.ts +2 -0
- package/dist/runtime/server/x-embed-image.js +53 -0
- package/dist/runtime/server/x-embed.d.ts +49 -0
- package/dist/runtime/server/x-embed.js +31 -0
- package/dist/runtime/sw/proxy-sw.template.d.ts +1 -0
- package/dist/runtime/sw/proxy-sw.template.js +54 -0
- package/dist/runtime/types.d.ts +29 -0
- package/dist/runtime/utils/pure.d.ts +13 -0
- package/dist/runtime/utils/pure.js +67 -0
- package/dist/runtime/utils.d.ts +1 -1
- package/dist/runtime/utils.js +2 -1
- package/dist/types.d.mts +1 -1
- package/package.json +27 -26
- package/dist/client/_nuxt/Bdf7Qtwg.js +0 -1
- package/dist/client/_nuxt/CoyZWCgl.js +0 -162
- package/dist/client/_nuxt/Ds1k3yKJ.js +0 -1
- package/dist/client/_nuxt/builds/meta/62574f80-71d4-4f9e-8b96-145c85230d99.json +0 -1
- package/dist/client/_nuxt/entry.BjfcJo5q.css +0 -1
- package/dist/client/_nuxt/error-404.D45Vtjcx.css +0 -1
- package/dist/client/_nuxt/error-500.BOm1rWQf.css +0 -1
package/dist/registry.mjs
CHANGED
|
@@ -79,6 +79,7 @@ async function registry(resolve) {
|
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
81
|
label: "Segment",
|
|
82
|
+
proxy: "segment",
|
|
82
83
|
scriptBundling: (options) => {
|
|
83
84
|
return joinURL("https://cdn.segment.com/analytics.js/v1", options?.writeKey || "", "analytics.min.js");
|
|
84
85
|
},
|
|
@@ -91,6 +92,7 @@ async function registry(resolve) {
|
|
|
91
92
|
},
|
|
92
93
|
{
|
|
93
94
|
label: "Meta Pixel",
|
|
95
|
+
proxy: "metaPixel",
|
|
94
96
|
src: "https://connect.facebook.net/en_US/fbevents.js",
|
|
95
97
|
category: "tracking",
|
|
96
98
|
logo: `<svg xmlns="http://www.w3.org/2000/svg" width="47.91" height="32" viewBox="0 0 256 171"><defs><linearGradient id="logosMetaIcon0" x1="13.878%" x2="89.144%" y1="55.934%" y2="58.694%"><stop offset="0%" stop-color="#0064E1"/><stop offset="40%" stop-color="#0064E1"/><stop offset="83%" stop-color="#0073EE"/><stop offset="100%" stop-color="#0082FB"/></linearGradient><linearGradient id="logosMetaIcon1" x1="54.315%" x2="54.315%" y1="82.782%" y2="39.307%"><stop offset="0%" stop-color="#0082FB"/><stop offset="100%" stop-color="#0064E0"/></linearGradient></defs><path fill="#0081FB" d="M27.651 112.136c0 9.775 2.146 17.28 4.95 21.82c3.677 5.947 9.16 8.466 14.751 8.466c7.211 0 13.808-1.79 26.52-19.372c10.185-14.092 22.186-33.874 30.26-46.275l13.675-21.01c9.499-14.591 20.493-30.811 33.1-41.806C161.196 4.985 172.298 0 183.47 0c18.758 0 36.625 10.87 50.3 31.257C248.735 53.584 256 81.707 256 110.729c0 17.253-3.4 29.93-9.187 39.946c-5.591 9.686-16.488 19.363-34.818 19.363v-27.616c15.695 0 19.612-14.422 19.612-30.927c0-23.52-5.484-49.623-17.564-68.273c-8.574-13.23-19.684-21.313-31.907-21.313c-13.22 0-23.859 9.97-35.815 27.75c-6.356 9.445-12.882 20.956-20.208 33.944l-8.066 14.289c-16.203 28.728-20.307 35.271-28.408 46.07c-14.2 18.91-26.324 26.076-42.287 26.076c-18.935 0-30.91-8.2-38.325-20.556C2.973 139.413 0 126.202 0 111.148z"/><path fill="url(#logosMetaIcon0)" d="M21.802 33.206C34.48 13.666 52.774 0 73.757 0C85.91 0 97.99 3.597 110.605 13.897c13.798 11.261 28.505 29.805 46.853 60.368l6.58 10.967c15.881 26.459 24.917 40.07 30.205 46.49c6.802 8.243 11.565 10.7 17.752 10.7c15.695 0 19.612-14.422 19.612-30.927l24.393-.766c0 17.253-3.4 29.93-9.187 39.946c-5.591 9.686-16.488 19.363-34.818 19.363c-11.395 0-21.49-2.475-32.654-13.007c-8.582-8.083-18.615-22.443-26.334-35.352l-22.96-38.352C118.528 64.08 107.96 49.73 101.845 43.23c-6.578-6.988-15.036-15.428-28.532-15.428c-10.923 0-20.2 7.666-27.963 19.39z"/><path fill="url(#logosMetaIcon1)" d="M73.312 27.802c-10.923 0-20.2 7.666-27.963 19.39c-10.976 16.568-17.698 41.245-17.698 64.944c0 9.775 2.146 17.28 4.95 21.82L9.027 149.482C2.973 139.413 0 126.202 0 111.148C0 83.772 7.514 55.24 21.802 33.206C34.48 13.666 52.774 0 73.757 0z"/></svg>`,
|
|
@@ -101,6 +103,7 @@ async function registry(resolve) {
|
|
|
101
103
|
},
|
|
102
104
|
{
|
|
103
105
|
label: "X Pixel",
|
|
106
|
+
proxy: "xPixel",
|
|
104
107
|
src: "https://static.ads-twitter.com/uwt.js",
|
|
105
108
|
category: "tracking",
|
|
106
109
|
logo: {
|
|
@@ -114,6 +117,7 @@ async function registry(resolve) {
|
|
|
114
117
|
},
|
|
115
118
|
{
|
|
116
119
|
label: "TikTok Pixel",
|
|
120
|
+
proxy: "tiktokPixel",
|
|
117
121
|
category: "tracking",
|
|
118
122
|
logo: `<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 256 256"><path d="M224 72a52.059 52.059 0 0 1-52-52a4 4 0 0 0-4-4h-40a4 4 0 0 0-4 4v132a28 28 0 1 1-40.567-25.019a4 4 0 0 0 2.567-3.734V80a4 4 0 0 0-4.652-3.949A84.032 84.032 0 1 0 156 152v-43.047a99.432 99.432 0 0 0 52 14.586a4 4 0 0 0 4-4V76a4 4 0 0 0-4-4z" fill="currentColor"/></svg>`,
|
|
119
123
|
import: {
|
|
@@ -128,6 +132,7 @@ async function registry(resolve) {
|
|
|
128
132
|
},
|
|
129
133
|
{
|
|
130
134
|
label: "Snapchat Pixel",
|
|
135
|
+
proxy: "snapchatPixel",
|
|
131
136
|
src: "https://sc-static.net/scevent.min.js",
|
|
132
137
|
category: "tracking",
|
|
133
138
|
logo: '<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>',
|
|
@@ -138,6 +143,7 @@ async function registry(resolve) {
|
|
|
138
143
|
},
|
|
139
144
|
{
|
|
140
145
|
label: "Reddit Pixel",
|
|
146
|
+
proxy: "redditPixel",
|
|
141
147
|
src: "https://www.redditstatic.com/ads/pixel.js",
|
|
142
148
|
category: "tracking",
|
|
143
149
|
logo: `<svg viewBox="0 0 800 800" xmlns="http://www.w3.org/2000/svg" width="32" height="32"> <circle cx="400" cy="400" fill="#ff4500" r="400"/> <path d="M666.8 400c.08 5.48-.6 10.95-2.04 16.24s-3.62 10.36-6.48 15.04c-2.85 4.68-6.35 8.94-10.39 12.65s-8.58 6.83-13.49 9.27c.11 1.46.2 2.93.25 4.4a107.268 107.268 0 0 1 0 8.8c-.05 1.47-.14 2.94-.25 4.4 0 89.6-104.4 162.4-233.2 162.4S168 560.4 168 470.8c-.11-1.46-.2-2.93-.25-4.4a107.268 107.268 0 0 1 0-8.8c.05-1.47.14-2.94.25-4.4a58.438 58.438 0 0 1-31.85-37.28 58.41 58.41 0 0 1 7.8-48.42 58.354 58.354 0 0 1 41.93-25.4 58.4 58.4 0 0 1 46.52 15.5 286.795 286.795 0 0 1 35.89-20.71c12.45-6.02 25.32-11.14 38.51-15.3s26.67-7.35 40.32-9.56 27.45-3.42 41.28-3.63L418 169.6c.33-1.61.98-3.13 1.91-4.49.92-1.35 2.11-2.51 3.48-3.4 1.38-.89 2.92-1.5 4.54-1.8 1.61-.29 3.27-.26 4.87.09l98 19.6c9.89-16.99 30.65-24.27 48.98-17.19s28.81 26.43 24.71 45.65c-4.09 19.22-21.55 32.62-41.17 31.61-19.63-1.01-35.62-16.13-37.72-35.67L440 186l-26 124.8c13.66.29 27.29 1.57 40.77 3.82a284.358 284.358 0 0 1 77.8 24.86A284.412 284.412 0 0 1 568 360a58.345 58.345 0 0 1 29.4-15.21 58.361 58.361 0 0 1 32.95 3.21 58.384 58.384 0 0 1 25.91 20.61A58.384 58.384 0 0 1 666.8 400zm-396.96 55.31c2.02 4.85 4.96 9.26 8.68 12.97 3.71 3.72 8.12 6.66 12.97 8.68A40.049 40.049 0 0 0 306.8 480c16.18 0 30.76-9.75 36.96-24.69 6.19-14.95 2.76-32.15-8.68-43.59s-28.64-14.87-43.59-8.68c-14.94 6.2-24.69 20.78-24.69 36.96 0 5.25 1.03 10.45 3.04 15.31zm229.1 96.02c2.05-2 3.22-4.73 3.26-7.59.04-2.87-1.07-5.63-3.07-7.68s-4.73-3.22-7.59-3.26c-2.87-.04-5.63 1.07-7.94 2.8a131.06 131.06 0 0 1-19.04 11.35 131.53 131.53 0 0 1-20.68 7.99c-7.1 2.07-14.37 3.54-21.72 4.39-7.36.85-14.77 1.07-22.16.67-7.38.33-14.78.03-22.11-.89a129.01 129.01 0 0 1-21.64-4.6c-7.08-2.14-13.95-4.88-20.56-8.18s-12.93-7.16-18.89-11.53c-2.07-1.7-4.7-2.57-7.38-2.44s-5.21 1.26-7.11 3.15c-1.89 1.9-3.02 4.43-3.15 7.11s.74 5.31 2.44 7.38c7.03 5.3 14.5 9.98 22.33 14s16 7.35 24.4 9.97 17.01 4.51 25.74 5.66c8.73 1.14 17.54 1.53 26.33 1.17 8.79.36 17.6-.03 26.33-1.17A153.961 153.961 0 0 0 476.87 564c7.83-4.02 15.3-8.7 22.33-14zm-7.34-68.13c5.42.06 10.8-.99 15.81-3.07 5.01-2.09 9.54-5.17 13.32-9.06s6.72-8.51 8.66-13.58A39.882 39.882 0 0 0 532 441.6c0-16.18-9.75-30.76-24.69-36.96-14.95-6.19-32.15-2.76-43.59 8.68s-14.87 28.64-8.68 43.59c6.2 14.94 20.78 24.69 36.96 24.69z" fill="#fff"/> </svg>`,
|
|
@@ -188,6 +194,7 @@ async function registry(resolve) {
|
|
|
188
194
|
},
|
|
189
195
|
{
|
|
190
196
|
label: "Hotjar",
|
|
197
|
+
proxy: "hotjar",
|
|
191
198
|
scriptBundling(options) {
|
|
192
199
|
if (!options?.id) {
|
|
193
200
|
return false;
|
|
@@ -205,6 +212,7 @@ async function registry(resolve) {
|
|
|
205
212
|
},
|
|
206
213
|
{
|
|
207
214
|
label: "Clarity",
|
|
215
|
+
proxy: "clarity",
|
|
208
216
|
scriptBundling(options) {
|
|
209
217
|
if (!options?.id) {
|
|
210
218
|
return false;
|
|
@@ -337,6 +345,7 @@ async function registry(resolve) {
|
|
|
337
345
|
{
|
|
338
346
|
label: "Google Tag Manager",
|
|
339
347
|
category: "tracking",
|
|
348
|
+
proxy: "googleTagManager",
|
|
340
349
|
import: {
|
|
341
350
|
name: "useScriptGoogleTagManager",
|
|
342
351
|
from: await resolve("./runtime/registry/google-tag-manager")
|
|
@@ -363,6 +372,7 @@ async function registry(resolve) {
|
|
|
363
372
|
{
|
|
364
373
|
label: "Google Analytics",
|
|
365
374
|
category: "analytics",
|
|
375
|
+
proxy: "googleAnalytics",
|
|
366
376
|
import: {
|
|
367
377
|
name: "useScriptGoogleAnalytics",
|
|
368
378
|
from: await resolve("./runtime/registry/google-analytics")
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'vue';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/**
|
|
4
|
+
* The Instagram post URL to embed
|
|
5
|
+
* e.g., https://www.instagram.com/p/ABC123/
|
|
6
|
+
*/
|
|
7
|
+
postUrl: string;
|
|
8
|
+
/**
|
|
9
|
+
* Whether to include captions in the embed
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
captions?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Custom API endpoint for fetching embed HTML
|
|
15
|
+
* @default '/api/_scripts/instagram-embed'
|
|
16
|
+
*/
|
|
17
|
+
apiEndpoint?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Root element attributes
|
|
20
|
+
*/
|
|
21
|
+
rootAttrs?: HTMLAttributes;
|
|
22
|
+
};
|
|
23
|
+
declare var __VLS_1: {}, __VLS_3: {
|
|
24
|
+
error: import("nuxt/app").NuxtError<unknown> | undefined;
|
|
25
|
+
}, __VLS_5: {
|
|
26
|
+
html: string;
|
|
27
|
+
shortcode: string | undefined;
|
|
28
|
+
postUrl: string;
|
|
29
|
+
};
|
|
30
|
+
type __VLS_Slots = {} & {
|
|
31
|
+
loading?: (props: typeof __VLS_1) => any;
|
|
32
|
+
} & {
|
|
33
|
+
error?: (props: typeof __VLS_3) => any;
|
|
34
|
+
} & {
|
|
35
|
+
default?: (props: typeof __VLS_5) => any;
|
|
36
|
+
};
|
|
37
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
38
|
+
html: import("vue").Ref<string | undefined, string | undefined>;
|
|
39
|
+
status: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus, import("nuxt/app").AsyncDataRequestStatus>;
|
|
40
|
+
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined, import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
41
|
+
shortcode: import("vue").ComputedRef<string | undefined>;
|
|
42
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
43
|
+
captions: boolean;
|
|
44
|
+
apiEndpoint: string;
|
|
45
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
46
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
47
|
+
declare const _default: typeof __VLS_export;
|
|
48
|
+
export default _default;
|
|
49
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
50
|
+
new (): {
|
|
51
|
+
$slots: S;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { useAsyncData } from "nuxt/app";
|
|
4
|
+
import { extractInstagramShortcode } from "../registry/instagram-embed";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
postUrl: { type: String, required: true },
|
|
7
|
+
captions: { type: Boolean, required: false, default: true },
|
|
8
|
+
apiEndpoint: { type: String, required: false, default: "/api/_scripts/instagram-embed" },
|
|
9
|
+
rootAttrs: { type: Object, required: false }
|
|
10
|
+
});
|
|
11
|
+
const shortcode = computed(() => extractInstagramShortcode(props.postUrl));
|
|
12
|
+
const { data: html, status, error } = useAsyncData(
|
|
13
|
+
`instagram-embed-${props.postUrl}`,
|
|
14
|
+
() => $fetch(`${props.apiEndpoint}?url=${encodeURIComponent(props.postUrl)}&captions=${props.captions}`),
|
|
15
|
+
{ watch: [() => props.postUrl, () => props.captions] }
|
|
16
|
+
);
|
|
17
|
+
defineExpose({
|
|
18
|
+
html,
|
|
19
|
+
status,
|
|
20
|
+
error,
|
|
21
|
+
shortcode
|
|
22
|
+
});
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<div v-bind="rootAttrs">
|
|
27
|
+
<slot v-if="status === 'pending'" name="loading">
|
|
28
|
+
<div>Loading Instagram post...</div>
|
|
29
|
+
</slot>
|
|
30
|
+
<slot v-else-if="status === 'error'" name="error" :error="error">
|
|
31
|
+
<div>Failed to load Instagram post</div>
|
|
32
|
+
</slot>
|
|
33
|
+
<slot v-else-if="html" :html="html" :shortcode="shortcode" :post-url="postUrl">
|
|
34
|
+
<!-- eslint-disable-next-line vue/no-v-html -->
|
|
35
|
+
<div v-html="html" />
|
|
36
|
+
</slot>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'vue';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/**
|
|
4
|
+
* The Instagram post URL to embed
|
|
5
|
+
* e.g., https://www.instagram.com/p/ABC123/
|
|
6
|
+
*/
|
|
7
|
+
postUrl: string;
|
|
8
|
+
/**
|
|
9
|
+
* Whether to include captions in the embed
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
captions?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Custom API endpoint for fetching embed HTML
|
|
15
|
+
* @default '/api/_scripts/instagram-embed'
|
|
16
|
+
*/
|
|
17
|
+
apiEndpoint?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Root element attributes
|
|
20
|
+
*/
|
|
21
|
+
rootAttrs?: HTMLAttributes;
|
|
22
|
+
};
|
|
23
|
+
declare var __VLS_1: {}, __VLS_3: {
|
|
24
|
+
error: import("nuxt/app").NuxtError<unknown> | undefined;
|
|
25
|
+
}, __VLS_5: {
|
|
26
|
+
html: string;
|
|
27
|
+
shortcode: string | undefined;
|
|
28
|
+
postUrl: string;
|
|
29
|
+
};
|
|
30
|
+
type __VLS_Slots = {} & {
|
|
31
|
+
loading?: (props: typeof __VLS_1) => any;
|
|
32
|
+
} & {
|
|
33
|
+
error?: (props: typeof __VLS_3) => any;
|
|
34
|
+
} & {
|
|
35
|
+
default?: (props: typeof __VLS_5) => any;
|
|
36
|
+
};
|
|
37
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
38
|
+
html: import("vue").Ref<string | undefined, string | undefined>;
|
|
39
|
+
status: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus, import("nuxt/app").AsyncDataRequestStatus>;
|
|
40
|
+
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined, import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
41
|
+
shortcode: import("vue").ComputedRef<string | undefined>;
|
|
42
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
43
|
+
captions: boolean;
|
|
44
|
+
apiEndpoint: string;
|
|
45
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
46
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
47
|
+
declare const _default: typeof __VLS_export;
|
|
48
|
+
export default _default;
|
|
49
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
50
|
+
new (): {
|
|
51
|
+
$slots: S;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'vue';
|
|
2
|
+
import type { XEmbedTweetData } from '../registry/x-embed.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
/**
|
|
5
|
+
* The tweet ID to embed
|
|
6
|
+
*/
|
|
7
|
+
tweetId: string;
|
|
8
|
+
/**
|
|
9
|
+
* Custom API endpoint for fetching tweet data
|
|
10
|
+
* @default '/_scripts/x-embed'
|
|
11
|
+
*/
|
|
12
|
+
apiEndpoint?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Custom image proxy endpoint
|
|
15
|
+
* @default '/_scripts/x-embed-image'
|
|
16
|
+
*/
|
|
17
|
+
imageProxyEndpoint?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Root element attributes
|
|
20
|
+
*/
|
|
21
|
+
rootAttrs?: HTMLAttributes;
|
|
22
|
+
};
|
|
23
|
+
declare var __VLS_1: {}, __VLS_3: {
|
|
24
|
+
error: import("nuxt/app").NuxtError<unknown> | undefined;
|
|
25
|
+
}, __VLS_5: {
|
|
26
|
+
tweet: XEmbedTweetData;
|
|
27
|
+
userName: string;
|
|
28
|
+
userHandle: string;
|
|
29
|
+
userAvatar: string;
|
|
30
|
+
userAvatarOriginal: string;
|
|
31
|
+
isVerified: boolean | undefined;
|
|
32
|
+
text: string;
|
|
33
|
+
datetime: string;
|
|
34
|
+
createdAt: Date;
|
|
35
|
+
likes: number;
|
|
36
|
+
likesFormatted: string;
|
|
37
|
+
replies: number;
|
|
38
|
+
repliesFormatted: string;
|
|
39
|
+
photos: {
|
|
40
|
+
proxiedUrl: string;
|
|
41
|
+
url: string;
|
|
42
|
+
width: number;
|
|
43
|
+
height: number;
|
|
44
|
+
}[] | undefined;
|
|
45
|
+
video: {
|
|
46
|
+
posterProxied: string;
|
|
47
|
+
poster: string;
|
|
48
|
+
variants: Array<{
|
|
49
|
+
type: string;
|
|
50
|
+
src: string;
|
|
51
|
+
}>;
|
|
52
|
+
} | null;
|
|
53
|
+
tweetUrl: string;
|
|
54
|
+
userUrl: string;
|
|
55
|
+
quotedTweet: XEmbedTweetData | undefined;
|
|
56
|
+
isReply: boolean;
|
|
57
|
+
replyToUser: string | undefined;
|
|
58
|
+
proxyImage: (url: string) => string;
|
|
59
|
+
};
|
|
60
|
+
type __VLS_Slots = {} & {
|
|
61
|
+
loading?: (props: typeof __VLS_1) => any;
|
|
62
|
+
} & {
|
|
63
|
+
error?: (props: typeof __VLS_3) => any;
|
|
64
|
+
} & {
|
|
65
|
+
default?: (props: typeof __VLS_5) => any;
|
|
66
|
+
};
|
|
67
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
68
|
+
tweet: import("vue").Ref<XEmbedTweetData | undefined, XEmbedTweetData | undefined>;
|
|
69
|
+
status: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus, import("nuxt/app").AsyncDataRequestStatus>;
|
|
70
|
+
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined, import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
71
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
72
|
+
apiEndpoint: string;
|
|
73
|
+
imageProxyEndpoint: string;
|
|
74
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
75
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
76
|
+
declare const _default: typeof __VLS_export;
|
|
77
|
+
export default _default;
|
|
78
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
79
|
+
new (): {
|
|
80
|
+
$slots: S;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { useAsyncData } from "nuxt/app";
|
|
4
|
+
import { formatCount, formatTweetDate, proxyXImageUrl } from "../registry/x-embed";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
tweetId: { type: String, required: true },
|
|
7
|
+
apiEndpoint: { type: String, required: false, default: "/api/_scripts/x-embed" },
|
|
8
|
+
imageProxyEndpoint: { type: String, required: false, default: "/api/_scripts/x-embed-image" },
|
|
9
|
+
rootAttrs: { type: Object, required: false }
|
|
10
|
+
});
|
|
11
|
+
const cacheKey = computed(() => `x-embed-${props.tweetId}`);
|
|
12
|
+
const { data: tweet, status, error } = useAsyncData(
|
|
13
|
+
cacheKey,
|
|
14
|
+
() => $fetch(`${props.apiEndpoint}?id=${props.tweetId}`)
|
|
15
|
+
);
|
|
16
|
+
const slotProps = computed(() => {
|
|
17
|
+
if (!tweet.value)
|
|
18
|
+
return null;
|
|
19
|
+
const t = tweet.value;
|
|
20
|
+
return {
|
|
21
|
+
// Raw data
|
|
22
|
+
tweet: t,
|
|
23
|
+
// User info
|
|
24
|
+
userName: t.user.name,
|
|
25
|
+
userHandle: t.user.screen_name,
|
|
26
|
+
userAvatar: proxyXImageUrl(t.user.profile_image_url_https, props.imageProxyEndpoint),
|
|
27
|
+
userAvatarOriginal: t.user.profile_image_url_https,
|
|
28
|
+
isVerified: t.user.verified || t.user.is_blue_verified,
|
|
29
|
+
// Tweet content
|
|
30
|
+
text: t.text,
|
|
31
|
+
// Formatted values
|
|
32
|
+
datetime: formatTweetDate(t.created_at),
|
|
33
|
+
createdAt: new Date(t.created_at),
|
|
34
|
+
likes: t.favorite_count,
|
|
35
|
+
likesFormatted: formatCount(t.favorite_count),
|
|
36
|
+
replies: t.conversation_count,
|
|
37
|
+
repliesFormatted: formatCount(t.conversation_count),
|
|
38
|
+
// Media
|
|
39
|
+
photos: t.photos?.map((p) => ({
|
|
40
|
+
...p,
|
|
41
|
+
proxiedUrl: proxyXImageUrl(p.url, props.imageProxyEndpoint)
|
|
42
|
+
})),
|
|
43
|
+
video: t.video ? {
|
|
44
|
+
...t.video,
|
|
45
|
+
posterProxied: proxyXImageUrl(t.video.poster, props.imageProxyEndpoint)
|
|
46
|
+
} : null,
|
|
47
|
+
// Links
|
|
48
|
+
tweetUrl: `https://x.com/${t.user.screen_name}/status/${t.id_str}`,
|
|
49
|
+
userUrl: `https://x.com/${t.user.screen_name}`,
|
|
50
|
+
// Quoted tweet
|
|
51
|
+
quotedTweet: t.quoted_tweet,
|
|
52
|
+
// Reply context
|
|
53
|
+
isReply: !!t.parent,
|
|
54
|
+
replyToUser: t.parent?.user.screen_name,
|
|
55
|
+
// Helpers
|
|
56
|
+
proxyImage: (url) => proxyXImageUrl(url, props.imageProxyEndpoint)
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
defineExpose({
|
|
60
|
+
tweet,
|
|
61
|
+
status,
|
|
62
|
+
error
|
|
63
|
+
});
|
|
64
|
+
</script>
|
|
65
|
+
|
|
66
|
+
<template>
|
|
67
|
+
<div v-bind="rootAttrs">
|
|
68
|
+
<slot v-if="status === 'pending'" name="loading">
|
|
69
|
+
<div>Loading tweet...</div>
|
|
70
|
+
</slot>
|
|
71
|
+
<slot v-else-if="status === 'error'" name="error" :error="error">
|
|
72
|
+
<div>Failed to load tweet</div>
|
|
73
|
+
</slot>
|
|
74
|
+
<slot v-else-if="slotProps" v-bind="slotProps" />
|
|
75
|
+
</div>
|
|
76
|
+
</template>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'vue';
|
|
2
|
+
import type { XEmbedTweetData } from '../registry/x-embed.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
/**
|
|
5
|
+
* The tweet ID to embed
|
|
6
|
+
*/
|
|
7
|
+
tweetId: string;
|
|
8
|
+
/**
|
|
9
|
+
* Custom API endpoint for fetching tweet data
|
|
10
|
+
* @default '/_scripts/x-embed'
|
|
11
|
+
*/
|
|
12
|
+
apiEndpoint?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Custom image proxy endpoint
|
|
15
|
+
* @default '/_scripts/x-embed-image'
|
|
16
|
+
*/
|
|
17
|
+
imageProxyEndpoint?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Root element attributes
|
|
20
|
+
*/
|
|
21
|
+
rootAttrs?: HTMLAttributes;
|
|
22
|
+
};
|
|
23
|
+
declare var __VLS_1: {}, __VLS_3: {
|
|
24
|
+
error: import("nuxt/app").NuxtError<unknown> | undefined;
|
|
25
|
+
}, __VLS_5: {
|
|
26
|
+
tweet: XEmbedTweetData;
|
|
27
|
+
userName: string;
|
|
28
|
+
userHandle: string;
|
|
29
|
+
userAvatar: string;
|
|
30
|
+
userAvatarOriginal: string;
|
|
31
|
+
isVerified: boolean | undefined;
|
|
32
|
+
text: string;
|
|
33
|
+
datetime: string;
|
|
34
|
+
createdAt: Date;
|
|
35
|
+
likes: number;
|
|
36
|
+
likesFormatted: string;
|
|
37
|
+
replies: number;
|
|
38
|
+
repliesFormatted: string;
|
|
39
|
+
photos: {
|
|
40
|
+
proxiedUrl: string;
|
|
41
|
+
url: string;
|
|
42
|
+
width: number;
|
|
43
|
+
height: number;
|
|
44
|
+
}[] | undefined;
|
|
45
|
+
video: {
|
|
46
|
+
posterProxied: string;
|
|
47
|
+
poster: string;
|
|
48
|
+
variants: Array<{
|
|
49
|
+
type: string;
|
|
50
|
+
src: string;
|
|
51
|
+
}>;
|
|
52
|
+
} | null;
|
|
53
|
+
tweetUrl: string;
|
|
54
|
+
userUrl: string;
|
|
55
|
+
quotedTweet: XEmbedTweetData | undefined;
|
|
56
|
+
isReply: boolean;
|
|
57
|
+
replyToUser: string | undefined;
|
|
58
|
+
proxyImage: (url: string) => string;
|
|
59
|
+
};
|
|
60
|
+
type __VLS_Slots = {} & {
|
|
61
|
+
loading?: (props: typeof __VLS_1) => any;
|
|
62
|
+
} & {
|
|
63
|
+
error?: (props: typeof __VLS_3) => any;
|
|
64
|
+
} & {
|
|
65
|
+
default?: (props: typeof __VLS_5) => any;
|
|
66
|
+
};
|
|
67
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
68
|
+
tweet: import("vue").Ref<XEmbedTweetData | undefined, XEmbedTweetData | undefined>;
|
|
69
|
+
status: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus, import("nuxt/app").AsyncDataRequestStatus>;
|
|
70
|
+
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined, import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
71
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
72
|
+
apiEndpoint: string;
|
|
73
|
+
imageProxyEndpoint: string;
|
|
74
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
75
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
76
|
+
declare const _default: typeof __VLS_export;
|
|
77
|
+
export default _default;
|
|
78
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
79
|
+
new (): {
|
|
80
|
+
$slots: S;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defu } from "defu";
|
|
2
2
|
import { useScript as _useScript } from "@unhead/vue/scripts";
|
|
3
|
-
import { reactive } from "vue";
|
|
4
|
-
import { onNuxtReady, useNuxtApp, useRuntimeConfig, injectHead } from "nuxt/app";
|
|
3
|
+
import { reactive, ref } from "vue";
|
|
4
|
+
import { onNuxtReady, useNuxtApp, useRuntimeConfig, injectHead, useHead } from "nuxt/app";
|
|
5
5
|
import { logger } from "../logger.js";
|
|
6
6
|
import { resolveTrigger } from "#build/nuxt-scripts-trigger-resolver";
|
|
7
7
|
function useNuxtScriptRuntimeConfig() {
|
|
@@ -13,6 +13,27 @@ export function resolveScriptKey(input) {
|
|
|
13
13
|
export function useScript(input, options) {
|
|
14
14
|
input = typeof input === "string" ? { src: input } : input;
|
|
15
15
|
options = defu(options, useNuxtScriptRuntimeConfig()?.defaultScriptOptions);
|
|
16
|
+
if (options.partytown) {
|
|
17
|
+
const src = input.src;
|
|
18
|
+
if (!src) {
|
|
19
|
+
throw new Error("useScript with partytown requires a src");
|
|
20
|
+
}
|
|
21
|
+
useHead({
|
|
22
|
+
script: [{ src, type: "text/partytown" }]
|
|
23
|
+
});
|
|
24
|
+
const nuxtApp2 = useNuxtApp();
|
|
25
|
+
nuxtApp2.$scripts = nuxtApp2.$scripts || reactive({});
|
|
26
|
+
const status = ref("loaded");
|
|
27
|
+
const stub = {
|
|
28
|
+
id: src,
|
|
29
|
+
status,
|
|
30
|
+
load: () => Promise.resolve({}),
|
|
31
|
+
remove: () => false,
|
|
32
|
+
entry: void 0
|
|
33
|
+
};
|
|
34
|
+
nuxtApp2.$scripts[src] = stub;
|
|
35
|
+
return stub;
|
|
36
|
+
}
|
|
16
37
|
if (import.meta.dev && options.bundle === "unsupported") {
|
|
17
38
|
console.warn("[Nuxt Scripts] Bundling is not supported for dynamic script sources. Static URLs are required for bundling.");
|
|
18
39
|
options.bundle = false;
|
|
@@ -23,8 +44,8 @@ export function useScript(input, options) {
|
|
|
23
44
|
options.trigger = resolved;
|
|
24
45
|
}
|
|
25
46
|
}
|
|
26
|
-
const id = String(resolveScriptKey(input));
|
|
27
47
|
const nuxtApp = useNuxtApp();
|
|
48
|
+
const id = String(resolveScriptKey(input));
|
|
28
49
|
options.head = options.head || injectHead();
|
|
29
50
|
if (!options.head) {
|
|
30
51
|
throw new Error("useScript() has been called without Nuxt context.");
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a trigger that loads a script after the service worker is controlling the page.
|
|
3
|
+
* Falls back to immediate loading if service workers are not supported or after timeout.
|
|
4
|
+
*/
|
|
5
|
+
export declare function useScriptTriggerServiceWorker(options?: {
|
|
6
|
+
timeout?: number;
|
|
7
|
+
}): Promise<boolean>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { tryOnScopeDispose } from "@vueuse/shared";
|
|
2
|
+
export function useScriptTriggerServiceWorker(options) {
|
|
3
|
+
if (import.meta.server)
|
|
4
|
+
return new Promise(() => {
|
|
5
|
+
});
|
|
6
|
+
const timeout = options?.timeout ?? 3e3;
|
|
7
|
+
return new Promise((resolve) => {
|
|
8
|
+
if (!("serviceWorker" in navigator)) {
|
|
9
|
+
resolve(true);
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
let resolved = false;
|
|
13
|
+
const done = () => {
|
|
14
|
+
if (resolved)
|
|
15
|
+
return;
|
|
16
|
+
resolved = true;
|
|
17
|
+
resolve(true);
|
|
18
|
+
};
|
|
19
|
+
if (navigator.serviceWorker.controller) {
|
|
20
|
+
done();
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const onControllerChange = () => {
|
|
24
|
+
navigator.serviceWorker.removeEventListener("controllerchange", onControllerChange);
|
|
25
|
+
done();
|
|
26
|
+
};
|
|
27
|
+
navigator.serviceWorker.addEventListener("controllerchange", onControllerChange);
|
|
28
|
+
const timer = setTimeout(() => {
|
|
29
|
+
navigator.serviceWorker.removeEventListener("controllerchange", onControllerChange);
|
|
30
|
+
console.warn("[nuxt-scripts] Service worker not controlling after timeout, loading scripts anyway");
|
|
31
|
+
done();
|
|
32
|
+
}, timeout);
|
|
33
|
+
tryOnScopeDispose(() => {
|
|
34
|
+
navigator.serviceWorker.removeEventListener("controllerchange", onControllerChange);
|
|
35
|
+
clearTimeout(timer);
|
|
36
|
+
resolve(false);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineNuxtPlugin } from "nuxt/app";
|
|
2
|
+
export default defineNuxtPlugin({
|
|
3
|
+
name: "nuxt-scripts:sw-register",
|
|
4
|
+
enforce: "pre",
|
|
5
|
+
async setup() {
|
|
6
|
+
if (!("serviceWorker" in navigator))
|
|
7
|
+
return;
|
|
8
|
+
await navigator.serviceWorker.register(SW_PATH, { scope: "/" }).catch((err) => {
|
|
9
|
+
console.warn("[nuxt-scripts] Service worker registration failed:", err);
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { RegistryScriptInput } from '#nuxt-scripts/types';
|
|
2
|
+
export declare const InstagramEmbedOptions: import("valibot").ObjectSchema<{
|
|
3
|
+
/**
|
|
4
|
+
* The Instagram post URL to embed
|
|
5
|
+
* e.g., https://www.instagram.com/p/ABC123/
|
|
6
|
+
*/
|
|
7
|
+
readonly postUrl: import("valibot").StringSchema<undefined>;
|
|
8
|
+
/**
|
|
9
|
+
* Whether to include captions in the embed
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
readonly captions: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
|
|
13
|
+
/**
|
|
14
|
+
* Custom API endpoint for fetching embed HTML
|
|
15
|
+
* @default '/api/_scripts/instagram-embed'
|
|
16
|
+
*/
|
|
17
|
+
readonly apiEndpoint: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
|
|
18
|
+
}, undefined>;
|
|
19
|
+
export type InstagramEmbedInput = RegistryScriptInput<typeof InstagramEmbedOptions, false, false, false>;
|
|
20
|
+
/**
|
|
21
|
+
* Extract the post shortcode from an Instagram URL
|
|
22
|
+
*/
|
|
23
|
+
export declare function extractInstagramShortcode(url: string): string | undefined;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { boolean, object, optional, string } from "#nuxt-scripts-validator";
|
|
2
|
+
export const InstagramEmbedOptions = object({
|
|
3
|
+
/**
|
|
4
|
+
* The Instagram post URL to embed
|
|
5
|
+
* e.g., https://www.instagram.com/p/ABC123/
|
|
6
|
+
*/
|
|
7
|
+
postUrl: string(),
|
|
8
|
+
/**
|
|
9
|
+
* Whether to include captions in the embed
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
captions: optional(boolean()),
|
|
13
|
+
/**
|
|
14
|
+
* Custom API endpoint for fetching embed HTML
|
|
15
|
+
* @default '/api/_scripts/instagram-embed'
|
|
16
|
+
*/
|
|
17
|
+
apiEndpoint: optional(string())
|
|
18
|
+
});
|
|
19
|
+
export function extractInstagramShortcode(url) {
|
|
20
|
+
const match = url.match(/instagram\.com\/(?:p|reel|tv)\/([^/?]+)/);
|
|
21
|
+
return match?.[1];
|
|
22
|
+
}
|
|
@@ -21,7 +21,6 @@ export type LemonSqueezyEventPayload = {
|
|
|
21
21
|
export interface LemonSqueezyApi {
|
|
22
22
|
/**
|
|
23
23
|
* Initialises Lemon.js on your page.
|
|
24
|
-
* @param options - An object with a single property, eventHandler, which is a function that will be called when Lemon.js emits an event.
|
|
25
24
|
*/
|
|
26
25
|
Setup: (options: {
|
|
27
26
|
eventHandler: (event: LemonSqueezyEventPayload) => void;
|