@nuxt/scripts 1.0.0-beta.19 → 1.0.0-beta.20
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/{BAII0Gd6.js → 9LJPrOyI.js} +1 -1
- package/dist/client/_nuxt/DFEfk2pB.js +162 -0
- package/dist/client/_nuxt/{BFIM6xmj.js → DMlY-BNa.js} +1 -1
- package/dist/client/_nuxt/{XsmoCkZQ.js → __ZZTkMj.js} +1 -1
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/8212d4fa-7985-421b-815a-03a886e667d4.json +1 -0
- package/dist/client/_nuxt/entry.CACgbLJl.css +1 -0
- package/dist/client/_nuxt/error-404.CHeaW3dp.css +1 -0
- package/dist/client/_nuxt/error-500.DvOvWme_.css +1 -0
- package/dist/client/index.html +1 -1
- package/dist/module.d.mts +7 -5
- package/dist/module.d.ts +7 -5
- package/dist/module.json +1 -1
- package/dist/module.mjs +389 -197
- package/dist/registry.mjs +5 -2
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue +1 -1
- package/dist/runtime/components/ScriptYouTubePlayer.vue +2 -1
- package/dist/runtime/registry/clarity.d.ts +8 -8
- package/dist/runtime/registry/crisp.d.ts +7 -7
- package/dist/runtime/registry/databuddy-analytics.js +18 -0
- package/dist/runtime/registry/fathom-analytics.d.ts +4 -3
- package/dist/runtime/registry/fathom-analytics.js +0 -1
- package/dist/runtime/registry/google-analytics.d.ts +1 -1
- package/dist/runtime/registry/google-recaptcha.js +1 -1
- package/dist/runtime/registry/google-tag-manager.js +1 -1
- package/dist/runtime/registry/hotjar.d.ts +1 -1
- package/dist/runtime/registry/instagram-embed.js +2 -1
- package/dist/runtime/registry/intercom.d.ts +1 -1
- package/dist/runtime/registry/meta-pixel.d.ts +1 -1
- package/dist/runtime/registry/reddit-pixel.d.ts +2 -1
- package/dist/runtime/registry/rybbit-analytics.js +1 -1
- package/dist/runtime/registry/schemas.d.ts +6 -0
- package/dist/runtime/registry/schemas.js +7 -1
- package/dist/runtime/registry/snapchat-pixel.d.ts +1 -1
- package/dist/runtime/registry/tiktok-pixel.d.ts +1 -1
- package/dist/runtime/registry/x-pixel.d.ts +1 -1
- package/dist/runtime/server/gravatar-proxy.js +1 -1
- package/dist/runtime/server/instagram-embed-asset.js +2 -1
- package/dist/runtime/server/instagram-embed-image.js +2 -1
- package/dist/runtime/server/instagram-embed.js +21 -12
- package/dist/runtime/server/proxy-handler.js +37 -27
- package/dist/runtime/server/utils/privacy.js +14 -7
- package/dist/runtime/server/x-embed.js +3 -2
- package/dist/runtime/utils.js +7 -3
- package/dist/shared/{scripts.Bg4pl9Yo.mjs → scripts.Crpn87WB.mjs} +15 -7
- package/dist/stats.mjs +7 -4
- package/dist/types-source.mjs +29 -18
- package/package.json +14 -14
- package/dist/client/_nuxt/8nZpL1GZ.js +0 -162
- package/dist/client/_nuxt/builds/meta/4f48c83d-e40d-436a-afd0-3b8e6ac6f303.json +0 -1
- package/dist/client/_nuxt/entry.D45OuV0w.css +0 -1
- package/dist/client/_nuxt/error-404.Cqp3ffuH.css +0 -1
- package/dist/client/_nuxt/error-500.B9hH8BAi.css +0 -1
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
const FULL_PRIVACY = { ip: true, userAgent: true, language: true, screen: true, timezone: true, hardware: true };
|
|
2
2
|
const NO_PRIVACY = { ip: false, userAgent: false, language: false, screen: false, timezone: false, hardware: false };
|
|
3
|
+
const MAJOR_VERSION_RE = /^(\d+)/;
|
|
4
|
+
const VERSION_RE = /^(\d+)(([.\-_])\d+)*/;
|
|
5
|
+
const VERSION_SPLIT_RE = /[.\-_]/;
|
|
6
|
+
const SNAPCHAT_VERSION_RE = /("version"\s*:\s*")(\d+(?:\.\d+)*)/g;
|
|
7
|
+
const GA_VERSION_RE = /;(\d+(?:\.\d+)*)/g;
|
|
8
|
+
const UPPERCASE_RE = /^[A-Z]/;
|
|
9
|
+
const LANG_CODE_RE = /^[a-z]{2}(?:-[a-z]{2,})?$/i;
|
|
3
10
|
export function resolvePrivacy(input) {
|
|
4
11
|
if (input === true)
|
|
5
12
|
return { ...FULL_PRIVACY };
|
|
@@ -107,7 +114,7 @@ export function normalizeUserAgent(ua) {
|
|
|
107
114
|
const idx = ua.indexOf(pattern);
|
|
108
115
|
if (idx !== -1) {
|
|
109
116
|
const versionStart = idx + pattern.length;
|
|
110
|
-
const majorVersion = ua.slice(versionStart).match(
|
|
117
|
+
const majorVersion = ua.slice(versionStart).match(MAJOR_VERSION_RE)?.[1];
|
|
111
118
|
if (majorVersion)
|
|
112
119
|
return `Mozilla/5.0 (compatible; ${family}/${majorVersion}.0)`;
|
|
113
120
|
}
|
|
@@ -158,12 +165,12 @@ export function generalizeHardware(value) {
|
|
|
158
165
|
export function generalizeVersion(value) {
|
|
159
166
|
if (typeof value !== "string")
|
|
160
167
|
return String(value);
|
|
161
|
-
const match = value.match(
|
|
168
|
+
const match = value.match(VERSION_RE);
|
|
162
169
|
if (!match)
|
|
163
170
|
return String(value);
|
|
164
171
|
const major = match[1];
|
|
165
172
|
const sep = match[3] || ".";
|
|
166
|
-
const segmentCount = value.split(
|
|
173
|
+
const segmentCount = value.split(VERSION_SPLIT_RE).length;
|
|
167
174
|
return major + `${sep}0`.repeat(segmentCount - 1);
|
|
168
175
|
}
|
|
169
176
|
export function generalizeBrowserVersions(value) {
|
|
@@ -174,9 +181,9 @@ export function generalizeBrowserVersions(value) {
|
|
|
174
181
|
return parts[0] + parts.slice(1).map(() => ".0").join("");
|
|
175
182
|
};
|
|
176
183
|
if (value.includes('"version"'))
|
|
177
|
-
return value.replace(
|
|
184
|
+
return value.replace(SNAPCHAT_VERSION_RE, (_, prefix, ver) => prefix + zeroSegments(ver));
|
|
178
185
|
if (value.includes(";"))
|
|
179
|
-
return value.replace(
|
|
186
|
+
return value.replace(GA_VERSION_RE, (_, ver) => `;${zeroSegments(ver)}`);
|
|
180
187
|
return value;
|
|
181
188
|
}
|
|
182
189
|
export function generalizeTimezone(value) {
|
|
@@ -196,11 +203,11 @@ export function anonymizeDeviceInfo(value) {
|
|
|
196
203
|
const result = [...parts];
|
|
197
204
|
for (let i = 0; i < parts.length; i++) {
|
|
198
205
|
const part = parts[i];
|
|
199
|
-
if (part.includes("/") &&
|
|
206
|
+
if (part.includes("/") && UPPERCASE_RE.test(part)) {
|
|
200
207
|
result[i] = String(generalizeTimezone(part));
|
|
201
208
|
continue;
|
|
202
209
|
}
|
|
203
|
-
if (
|
|
210
|
+
if (LANG_CODE_RE.test(part)) {
|
|
204
211
|
result[i] = normalizeLanguage(part);
|
|
205
212
|
continue;
|
|
206
213
|
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { createError, defineEventHandler, getQuery, setHeader } from "h3";
|
|
2
2
|
import { $fetch } from "ofetch";
|
|
3
|
+
const TWEET_ID_RE = /^\d+$/;
|
|
3
4
|
export default defineEventHandler(async (event) => {
|
|
4
5
|
const query = getQuery(event);
|
|
5
6
|
const tweetId = query.id;
|
|
6
|
-
if (!tweetId ||
|
|
7
|
+
if (!tweetId || !TWEET_ID_RE.test(tweetId)) {
|
|
7
8
|
throw createError({
|
|
8
9
|
statusCode: 400,
|
|
9
10
|
statusMessage: "Valid Tweet ID is required"
|
|
10
11
|
});
|
|
11
12
|
}
|
|
12
|
-
const randomToken =
|
|
13
|
+
const randomToken = Array.from(Array.from({ length: 11 }), () => (Math.random() * 36).toString(36)[2]).join("");
|
|
13
14
|
const params = new URLSearchParams({ id: tweetId, token: randomToken });
|
|
14
15
|
const tweetData = await $fetch(
|
|
15
16
|
`https://cdn.syndication.twimg.com/tweet-result?${params.toString()}`,
|
package/dist/runtime/utils.js
CHANGED
|
@@ -4,6 +4,10 @@ import { useRuntimeConfig } from "nuxt/app";
|
|
|
4
4
|
import { parseQuery, parseURL, withQuery } from "ufo";
|
|
5
5
|
import { useScript } from "./composables/useScript.js";
|
|
6
6
|
import { createNpmScriptStub } from "./npm-script-stub.js";
|
|
7
|
+
const URL_MATCH_RE = /https?:\/\/[^/]+\/_nuxt\/(.+\.vue)(?:\?[^)]*)?:(\d+):(\d+)/;
|
|
8
|
+
const URL_PAREN_MATCH_RE = /\(https?:\/\/[^/]+\/_nuxt\/(.+\.vue)(?:\?[^)]*)?:(\d+):(\d+)\)/;
|
|
9
|
+
const VUE_MATCH_RE = /([^/\s]+\.vue):(\d+):(\d+)/;
|
|
10
|
+
const CLEAN_CALLER_RE = /^\s*at\s+/;
|
|
7
11
|
function validateScriptInputSchema(key, schema, options) {
|
|
8
12
|
if (import.meta.dev) {
|
|
9
13
|
try {
|
|
@@ -54,17 +58,17 @@ export function useRegistryScript(registryKey, optionsFn, _userOptions) {
|
|
|
54
58
|
);
|
|
55
59
|
let loadedFrom = "unknown";
|
|
56
60
|
if (callerLine) {
|
|
57
|
-
const urlMatch = callerLine.match(
|
|
61
|
+
const urlMatch = callerLine.match(URL_MATCH_RE) || callerLine.match(URL_PAREN_MATCH_RE);
|
|
58
62
|
if (urlMatch) {
|
|
59
63
|
const [, filePath, line, column] = urlMatch;
|
|
60
64
|
loadedFrom = `./${filePath}:${line}:${column}`;
|
|
61
65
|
} else {
|
|
62
|
-
const vueMatch = callerLine.match(
|
|
66
|
+
const vueMatch = callerLine.match(VUE_MATCH_RE);
|
|
63
67
|
if (vueMatch) {
|
|
64
68
|
const [, fileName, line, column] = vueMatch;
|
|
65
69
|
loadedFrom = `./${fileName}:${line}:${column}`;
|
|
66
70
|
} else {
|
|
67
|
-
loadedFrom = callerLine.trim().replace(
|
|
71
|
+
loadedFrom = callerLine.trim().replace(CLEAN_CALLER_RE, "");
|
|
68
72
|
}
|
|
69
73
|
}
|
|
70
74
|
}
|
|
@@ -129,13 +129,16 @@ function buildProxyConfig(collectPrefix) {
|
|
|
129
129
|
// Data collection endpoint
|
|
130
130
|
{ from: "d.clarity.ms", to: `${collectPrefix}/clarity-data` },
|
|
131
131
|
// Event collection endpoint
|
|
132
|
-
{ from: "e.clarity.ms", to: `${collectPrefix}/clarity-events` }
|
|
132
|
+
{ from: "e.clarity.ms", to: `${collectPrefix}/clarity-events` },
|
|
133
|
+
// Collect/beacon endpoint
|
|
134
|
+
{ from: "k.clarity.ms", to: `${collectPrefix}/clarity-collect` }
|
|
133
135
|
],
|
|
134
136
|
routes: {
|
|
135
137
|
[`${collectPrefix}/clarity/**`]: { proxy: "https://www.clarity.ms/**" },
|
|
136
138
|
[`${collectPrefix}/clarity-scripts/**`]: { proxy: "https://scripts.clarity.ms/**" },
|
|
137
139
|
[`${collectPrefix}/clarity-data/**`]: { proxy: "https://d.clarity.ms/**" },
|
|
138
|
-
[`${collectPrefix}/clarity-events/**`]: { proxy: "https://e.clarity.ms/**" }
|
|
140
|
+
[`${collectPrefix}/clarity-events/**`]: { proxy: "https://e.clarity.ms/**" },
|
|
141
|
+
[`${collectPrefix}/clarity-collect/**`]: { proxy: "https://k.clarity.ms/**" }
|
|
139
142
|
}
|
|
140
143
|
},
|
|
141
144
|
posthog: {
|
|
@@ -212,7 +215,8 @@ function buildProxyConfig(collectPrefix) {
|
|
|
212
215
|
umami: {
|
|
213
216
|
privacy: { ip: false, userAgent: false, language: false, screen: false, timezone: false, hardware: false },
|
|
214
217
|
rewrite: [
|
|
215
|
-
{ from: "cloud.umami.is", to: `${collectPrefix}/umami` }
|
|
218
|
+
{ from: "cloud.umami.is", to: `${collectPrefix}/umami` },
|
|
219
|
+
{ from: "api-gateway.umami.dev", to: `${collectPrefix}/umami` }
|
|
216
220
|
],
|
|
217
221
|
routes: {
|
|
218
222
|
[`${collectPrefix}/umami/**`]: { proxy: "https://cloud.umami.is/**" }
|
|
@@ -244,13 +248,15 @@ function buildProxyConfig(collectPrefix) {
|
|
|
244
248
|
{ from: "widget.intercom.io", to: `${collectPrefix}/intercom` },
|
|
245
249
|
{ from: "api-iam.intercom.io", to: `${collectPrefix}/intercom-api` },
|
|
246
250
|
{ from: "api-iam.eu.intercom.io", to: `${collectPrefix}/intercom-api-eu` },
|
|
247
|
-
{ from: "api-iam.au.intercom.io", to: `${collectPrefix}/intercom-api-au` }
|
|
251
|
+
{ from: "api-iam.au.intercom.io", to: `${collectPrefix}/intercom-api-au` },
|
|
252
|
+
{ from: "js.intercomcdn.com", to: `${collectPrefix}/intercom-cdn` }
|
|
248
253
|
],
|
|
249
254
|
routes: {
|
|
250
255
|
[`${collectPrefix}/intercom/**`]: { proxy: "https://widget.intercom.io/**" },
|
|
251
256
|
[`${collectPrefix}/intercom-api/**`]: { proxy: "https://api-iam.intercom.io/**" },
|
|
252
257
|
[`${collectPrefix}/intercom-api-eu/**`]: { proxy: "https://api-iam.eu.intercom.io/**" },
|
|
253
|
-
[`${collectPrefix}/intercom-api-au/**`]: { proxy: "https://api-iam.au.intercom.io/**" }
|
|
258
|
+
[`${collectPrefix}/intercom-api-au/**`]: { proxy: "https://api-iam.au.intercom.io/**" },
|
|
259
|
+
[`${collectPrefix}/intercom-cdn/**`]: { proxy: "https://js.intercomcdn.com/**" }
|
|
254
260
|
}
|
|
255
261
|
},
|
|
256
262
|
crisp: {
|
|
@@ -293,14 +299,16 @@ function getProxyConfig(key, collectPrefix) {
|
|
|
293
299
|
function getAllProxyConfigs(collectPrefix) {
|
|
294
300
|
return buildProxyConfig(collectPrefix);
|
|
295
301
|
}
|
|
302
|
+
const PROXY_URL_RE = /^https?:\/\/([^/]+)(\/.*)?\/\*\*$/;
|
|
303
|
+
const ROUTE_WILDCARD_RE = /\/\*\*$/;
|
|
296
304
|
function routesToInterceptRules(routes) {
|
|
297
305
|
const rules = [];
|
|
298
306
|
for (const [localPath, { proxy }] of Object.entries(routes)) {
|
|
299
|
-
const match = proxy.match(
|
|
307
|
+
const match = proxy.match(PROXY_URL_RE);
|
|
300
308
|
if (match?.[1]) {
|
|
301
309
|
const domain = match[1];
|
|
302
310
|
const pathPrefix = match[2] || "";
|
|
303
|
-
const target = localPath.replace(
|
|
311
|
+
const target = localPath.replace(ROUTE_WILDCARD_RE, "");
|
|
304
312
|
rules.push({ pattern: domain, pathPrefix, target });
|
|
305
313
|
}
|
|
306
314
|
}
|
package/dist/stats.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getAllProxyConfigs } from './shared/scripts.
|
|
1
|
+
import { g as getAllProxyConfigs } from './shared/scripts.Crpn87WB.mjs';
|
|
2
2
|
|
|
3
3
|
const scriptMeta = {
|
|
4
4
|
// Analytics
|
|
@@ -696,6 +696,9 @@ const scriptSizes = {
|
|
|
696
696
|
vercelAnalytics: vercelAnalytics
|
|
697
697
|
};
|
|
698
698
|
|
|
699
|
+
const DOMAIN_RE = /^https?:\/\/([^/]+)/;
|
|
700
|
+
const USE_SCRIPT_RE = /^useScript/;
|
|
701
|
+
const WORD_SPLIT_RE = /[\s-]+/;
|
|
699
702
|
function computePrivacyLevel(privacy) {
|
|
700
703
|
if (!privacy)
|
|
701
704
|
return "unknown";
|
|
@@ -709,7 +712,7 @@ function computePrivacyLevel(privacy) {
|
|
|
709
712
|
function extractDomains(routes) {
|
|
710
713
|
const domains = /* @__PURE__ */ new Set();
|
|
711
714
|
for (const { proxy } of Object.values(routes)) {
|
|
712
|
-
const match = proxy.match(
|
|
715
|
+
const match = proxy.match(DOMAIN_RE);
|
|
713
716
|
if (match?.[1])
|
|
714
717
|
domains.add(match[1]);
|
|
715
718
|
}
|
|
@@ -717,11 +720,11 @@ function extractDomains(routes) {
|
|
|
717
720
|
}
|
|
718
721
|
function deriveMetaKey(importName, label) {
|
|
719
722
|
if (importName) {
|
|
720
|
-
const stripped = importName.replace(
|
|
723
|
+
const stripped = importName.replace(USE_SCRIPT_RE, "");
|
|
721
724
|
return stripped.charAt(0).toLowerCase() + stripped.slice(1);
|
|
722
725
|
}
|
|
723
726
|
if (label) {
|
|
724
|
-
const words = label.split(
|
|
727
|
+
const words = label.split(WORD_SPLIT_RE);
|
|
725
728
|
return words.map(
|
|
726
729
|
(w, i) => i === 0 ? w.toLowerCase() : w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()
|
|
727
730
|
).join("");
|
package/dist/types-source.mjs
CHANGED
|
@@ -26,7 +26,7 @@ const clarity = [
|
|
|
26
26
|
{
|
|
27
27
|
name: "ClarityFunctions",
|
|
28
28
|
kind: "type",
|
|
29
|
-
code: "type ClarityFunctions = ((fn: 'start', options
|
|
29
|
+
code: "type ClarityFunctions = ((fn: 'start', options?: { content?: boolean, cookies?: string[], dob?: number, expire?: number, projectId?: string, upload?: string }) => void)\n & ((fn: 'identify', id: string, session?: string, page?: string, userHint?: string) => Promise<{\n id: string\n session: string\n page: string\n userHint: string\n }>)\n & ((fn: 'consent', enabled?: boolean | Record<string, string>) => void)\n & ((fn: 'set', key: string, value: string | string[]) => void)\n & ((fn: 'event', value: string) => void)\n & ((fn: 'upgrade', upgradeReason: string) => void)\n & ((fn: (string & {}), ...args: any[]) => void)"
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
name: "ClarityApi",
|
|
@@ -43,7 +43,7 @@ const crisp = [
|
|
|
43
43
|
{
|
|
44
44
|
name: "CrispApi",
|
|
45
45
|
kind: "interface",
|
|
46
|
-
code: "export interface CrispApi {\n push: (...args: any[]) => void\n is: (name: 'chat:opened' | 'chat:closed' | 'chat:visible' | 'chat:hidden' | 'chat:small' | 'chat:large' | 'session:ongoing' | 'website:available' | 'overlay:opened' | 'overlay:closed' | string) => boolean\n set: (name: 'message:text' | '
|
|
46
|
+
code: "export interface CrispApi {\n push: (...args: any[]) => void\n is: (name: 'chat:opened' | 'chat:closed' | 'chat:visible' | 'chat:hidden' | 'chat:small' | 'chat:large' | 'session:ongoing' | 'website:available' | 'overlay:opened' | 'overlay:closed' | (string & {})) => boolean\n set: ((name: 'message:text' | 'user:email' | 'user:phone' | 'user:nickname' | 'user:avatar' | 'user:company', value: string) => void)\n & ((name: 'session:data', value: [[string, string | number | boolean], ...[string, string | number | boolean][]]) => void)\n & ((name: 'session:segments', value: string[]) => void)\n & ((name: 'session:event', value: [[string, Record<string, any>?, string?]]) => void)\n & ((name: (string & {}), value: any) => void)\n get: ((name: 'chat:unread:count') => number)\n & ((name: 'message:text' | 'session:identifier' | 'user:email' | 'user:phone' | 'user:nickname' | 'user:avatar' | 'user:company') => string)\n & ((name: 'session:data', key: string) => string | number | boolean)\n & ((name: (string & {})) => any)\n do: (name: 'chat:open' | 'chat:close' | 'chat:toggle' | 'chat:show' | 'chat:hide' | 'helpdesk:search' | 'helpdesk:article:open' | 'helpdesk:query' | 'overlay:open' | 'overlay:close' | 'message:send' | 'message:show' | 'message:read' | 'message:thread:start' | 'message:thread:end' | 'session:reset' | 'trigger:run', arg2?: any) => any\n on: (name: 'session:loaded' | 'chat:initiated' | 'chat:opened' | 'chat:closed' | 'message:sent' | 'message:received' | 'message:compose:sent' | 'message:compose:received' | 'user:email:changed' | 'user:phone:changed' | 'user:nickname:changed' | 'user:avatar:changed' | 'website:availability:changed' | 'helpdesk:queried' | (string & {}), callback: (...args: any[]) => any) => void\n off: (name: 'session:loaded' | 'chat:initiated' | 'chat:opened' | 'chat:closed' | 'message:sent' | 'message:received' | 'message:compose:sent' | 'message:compose:received' | 'user:email:changed' | 'user:phone:changed' | 'user:nickname:changed' | 'user:avatar:changed' | 'website:availability:changed' | 'helpdesk:queried' | (string & {}), callback: (...args: any[]) => any) => void\n config: ((name: 'container:index', value: number) => void)\n & ((name: 'color:theme', value: 'default' | 'amber' | 'black' | 'blue' | 'blue_grey' | 'light_blue' | 'brown' | 'cyan' | 'green' | 'light_green' | 'grey' | 'indigo' | 'orange' | 'deep_orange' | 'pink' | 'purple' | 'deep_purple' | 'red' | 'teal') => void)\n & ((name: 'position:reverse' | 'hide:on:mobile' | 'hide:on:away' | 'lock:maximized' | 'lock:fullview' | 'show:operator:count' | 'sound:mute', value: boolean) => void)\n & ((name: (string & {}), value: any) => void)\n help: () => void\n [key: string]: any\n}"
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
49
|
name: "ScriptCrispProps",
|
|
@@ -72,7 +72,7 @@ const hotjar = [
|
|
|
72
72
|
{
|
|
73
73
|
name: "HotjarApi",
|
|
74
74
|
kind: "interface",
|
|
75
|
-
code: "export interface HotjarApi {\n hj: ((event: 'identify', userId: string, attributes?: Record<string, any>) => void) & ((event: 'stateChange', path: string) => void) & ((event: '
|
|
75
|
+
code: "export interface HotjarApi {\n hj: ((event: 'identify', userId: string, attributes?: Record<string, any>) => void) & ((event: 'stateChange', path: string) => void) & ((event: 'vPageView', path: string) => void) & ((event: 'event', eventName: string) => void) & ((event: (string & {}), ...args: any[]) => void) & {\n q: any[]\n }\n}"
|
|
76
76
|
}
|
|
77
77
|
];
|
|
78
78
|
const intercom = [
|
|
@@ -84,7 +84,7 @@ const intercom = [
|
|
|
84
84
|
{
|
|
85
85
|
name: "IntercomApi",
|
|
86
86
|
kind: "interface",
|
|
87
|
-
code: "export interface IntercomApi {\n Intercom: ((event: 'boot', data?: InferInput<typeof IntercomOptions>) => void)\n & ((event: 'shutdown') => void)\n & ((event: 'update', options?: InferInput<typeof IntercomOptions>) => void)\n & ((event: 'hide') => void)\n & ((event: 'show') => void)\n & ((event: 'showSpace', spaceName: 'home' | 'messages' | 'help' | 'news' | 'tasks' | 'tickets' | string) => void)\n & ((event: 'showMessages') => void)\n & ((event: 'showNewMessage', content?: string) => void)\n & ((event: 'onHide', fn: () => void) => void)\n & ((event: 'onShow', fn: () => void) => void)\n & ((event: 'onUnreadCountChange', fn: () => void) => void)\n & ((event: 'trackEvent', eventName: string, metadata?: Record<string, any>) => void)\n & ((event: 'getVisitorId') => Promise<string>)\n & ((event: 'startTour', tourId: string | number) => void)\n & ((event: 'showArticle', articleId: string | number) => void)\n & ((event: 'showNews', newsItemId: string | number) => void)\n & ((event: 'startSurvey', surveyId: string | number) => void)\n & ((event: 'startChecklist', checklistId: string | number) => void)\n & ((event: 'showTicket', ticketId: string | number) => void)\n & ((event: 'showConversation', conversationId: string | number) => void)\n & ((event: 'onUserEmailSupplied', fn: () => void) => void)\n & ((event: string, ...params: any[]) => void)\n}"
|
|
87
|
+
code: "export interface IntercomApi {\n Intercom: ((event: 'boot', data?: InferInput<typeof IntercomOptions>) => void)\n & ((event: 'shutdown') => void)\n & ((event: 'update', options?: InferInput<typeof IntercomOptions>) => void)\n & ((event: 'hide') => void)\n & ((event: 'show') => void)\n & ((event: 'showSpace', spaceName: 'home' | 'messages' | 'help' | 'news' | 'tasks' | 'tickets' | (string & {})) => void)\n & ((event: 'showMessages') => void)\n & ((event: 'showNewMessage', content?: string) => void)\n & ((event: 'onHide', fn: () => void) => void)\n & ((event: 'onShow', fn: () => void) => void)\n & ((event: 'onUnreadCountChange', fn: () => void) => void)\n & ((event: 'trackEvent', eventName: string, metadata?: Record<string, any>) => void)\n & ((event: 'getVisitorId') => Promise<string>)\n & ((event: 'startTour', tourId: string | number) => void)\n & ((event: 'showArticle', articleId: string | number) => void)\n & ((event: 'showNews', newsItemId: string | number) => void)\n & ((event: 'startSurvey', surveyId: string | number) => void)\n & ((event: 'startChecklist', checklistId: string | number) => void)\n & ((event: 'showTicket', ticketId: string | number) => void)\n & ((event: 'showConversation', conversationId: string | number) => void)\n & ((event: 'onUserEmailSupplied', fn: () => void) => void)\n & ((event: (string & {}), ...params: any[]) => void)\n}"
|
|
88
88
|
},
|
|
89
89
|
{
|
|
90
90
|
name: "ScriptIntercomProps",
|
|
@@ -228,7 +228,7 @@ const registryTypes = {
|
|
|
228
228
|
{
|
|
229
229
|
name: "FathomAnalyticsApi",
|
|
230
230
|
kind: "interface",
|
|
231
|
-
code: "export interface FathomAnalyticsApi {\n beacon: (ctx: { url: string, referrer?: string }) => void\n blockTrackingForMe: () => void\n enableTrackingForMe: () => void\n isTrackingEnabled: () => boolean\n send: (type: string, data: unknown) => void\n setSite: (siteId: string) => void\n
|
|
231
|
+
code: "export interface FathomAnalyticsApi {\n beacon: (ctx: { url: string, referrer?: string }) => void\n blockTrackingForMe: () => void\n enableTrackingForMe: () => void\n isTrackingEnabled: () => boolean\n send: (type: string, data: unknown) => void\n setSite: (siteId: string) => void\n siteId: string\n trackPageview: (ctx?: { url: string, referrer?: string }) => void\n trackGoal: (goalId: string, cents: number) => void\n trackEvent: (eventName: string, value?: { _value?: number, _site_id?: string }) => void\n}"
|
|
232
232
|
}
|
|
233
233
|
],
|
|
234
234
|
"google-adsense": [
|
|
@@ -282,7 +282,7 @@ const registryTypes = {
|
|
|
282
282
|
{
|
|
283
283
|
name: "DefaultEventName",
|
|
284
284
|
kind: "type",
|
|
285
|
-
code: "export type DefaultEventName\n = | 'add_payment_info'\n | 'add_shipping_info'\n | 'add_to_cart'\n | 'add_to_wishlist'\n | 'begin_checkout'\n | 'purchase'\n | 'refund'\n | 'remove_from_cart'\n | 'select_item'\n | 'select_promotion'\n | 'view_cart'\n | 'view_item'\n | 'view_item_list'\n | 'view_promotion'\n | 'login'\n | 'sign_up'\n | 'search'\n | 'page_view'\n | 'screen_view'\n | string"
|
|
285
|
+
code: "export type DefaultEventName\n = | 'add_payment_info'\n | 'add_shipping_info'\n | 'add_to_cart'\n | 'add_to_wishlist'\n | 'begin_checkout'\n | 'purchase'\n | 'refund'\n | 'remove_from_cart'\n | 'select_item'\n | 'select_promotion'\n | 'view_cart'\n | 'view_item'\n | 'view_item_list'\n | 'view_promotion'\n | 'login'\n | 'sign_up'\n | 'search'\n | 'page_view'\n | 'screen_view'\n | (string & {})"
|
|
286
286
|
},
|
|
287
287
|
{
|
|
288
288
|
name: "GTag",
|
|
@@ -556,7 +556,7 @@ const registryTypes = {
|
|
|
556
556
|
{
|
|
557
557
|
name: "EventObjectProperties",
|
|
558
558
|
kind: "interface",
|
|
559
|
-
code: "interface EventObjectProperties {\n content_category?: string\n content_ids?: string[]\n content_name?: string\n content_type?: string\n contents?: { id: string, quantity: number }[]\n currency?: string\n delivery_category?: 'in_store' | 'curbside' | 'home_delivery'\n num_items?: number\n predicted_ltv?: number\n search_string?: string\n status?: 'completed' | 'updated' | 'viewed' | 'added_to_cart' | 'removed_from_cart' | string\n value?: number\n [key: string]: any\n}"
|
|
559
|
+
code: "interface EventObjectProperties {\n content_category?: string\n content_ids?: string[]\n content_name?: string\n content_type?: string\n contents?: { id: string, quantity: number }[]\n currency?: string\n delivery_category?: 'in_store' | 'curbside' | 'home_delivery'\n num_items?: number\n predicted_ltv?: number\n search_string?: string\n status?: 'completed' | 'updated' | 'viewed' | 'added_to_cart' | 'removed_from_cart' | (string & {})\n value?: number\n [key: string]: any\n}"
|
|
560
560
|
},
|
|
561
561
|
{
|
|
562
562
|
name: "ConsentAction",
|
|
@@ -610,10 +610,15 @@ const registryTypes = {
|
|
|
610
610
|
],
|
|
611
611
|
posthog: posthog,
|
|
612
612
|
"reddit-pixel": [
|
|
613
|
+
{
|
|
614
|
+
name: "StandardEvents",
|
|
615
|
+
kind: "type",
|
|
616
|
+
code: "type StandardEvents = 'PageVisit' | 'ViewContent' | 'Search' | 'AddToCart' | 'AddToWishlist' | 'Purchase' | 'Lead' | 'SignUp'"
|
|
617
|
+
},
|
|
613
618
|
{
|
|
614
619
|
name: "RdtFns",
|
|
615
620
|
kind: "type",
|
|
616
|
-
code: "type RdtFns\n = & ((event: 'init', id: string) => void)\n & ((event: 'track', eventName: string) => void)"
|
|
621
|
+
code: "type RdtFns\n = & ((event: 'init', id: string) => void)\n & ((event: 'track', eventName: StandardEvents | (string & {}), properties?: Record<string, any>) => void)"
|
|
617
622
|
},
|
|
618
623
|
{
|
|
619
624
|
name: "RedditPixelApi",
|
|
@@ -630,7 +635,7 @@ const registryTypes = {
|
|
|
630
635
|
{
|
|
631
636
|
name: "RybbitAnalyticsOptions",
|
|
632
637
|
kind: "const",
|
|
633
|
-
code: "export const RybbitAnalyticsOptions = object({\n /**\n * Your Rybbit site ID.\n * @see https://rybbit.io/docs\n */\n siteId: union([string(), number()]),\n /**\n * Automatically track page views.\n * @default true\n */\n autoTrackPageview: optional(boolean()),\n /**\n * Enable SPA (single-page app) route tracking.\n * @default true\n */\n trackSpa: optional(boolean()),\n /**\n * Include query parameters in tracked URLs.\n */\n trackQuery: optional(boolean()),\n /**\n * Track outbound link clicks.\n */\n trackOutbound: optional(boolean()),\n /**\n * Track JavaScript errors.\n */\n trackErrors: optional(boolean()),\n /**\n * Enable session replay recording.\n */\n sessionReplay: optional(boolean()),\n /**\n * Enable Web Vitals tracking (LCP, FID, CLS, etc.).\n */\n webVitals: optional(boolean()),\n /**\n * URL patterns to skip from tracking (glob syntax).\n */\n skipPatterns: optional(array(string())),\n /**\n * URL patterns to mask in tracked data (glob syntax).\n */\n maskPatterns: optional(array(string())),\n /**\n * Debounce interval (in ms) for page view tracking.\n */\n debounce: optional(number()),\n /**\n * API key for authenticated tracking.\n */\n apiKey: optional(string()),\n})"
|
|
638
|
+
code: "export const RybbitAnalyticsOptions = object({\n /**\n * Your Rybbit site ID.\n * @see https://rybbit.io/docs\n */\n siteId: union([string(), number()]),\n /**\n * Automatically track page views.\n * @default true\n */\n autoTrackPageview: optional(boolean()),\n /**\n * Enable SPA (single-page app) route tracking.\n * @default true\n */\n trackSpa: optional(boolean()),\n /**\n * Include query parameters in tracked URLs.\n */\n trackQuery: optional(boolean()),\n /**\n * Track outbound link clicks.\n */\n trackOutbound: optional(boolean()),\n /**\n * Track JavaScript errors.\n */\n trackErrors: optional(boolean()),\n /**\n * Enable session replay recording.\n */\n sessionReplay: optional(boolean()),\n /**\n * Enable Web Vitals tracking (LCP, FID, CLS, etc.).\n */\n webVitals: optional(boolean()),\n /**\n * URL patterns to skip from tracking (glob syntax).\n */\n skipPatterns: optional(array(string())),\n /**\n * URL patterns to mask in tracked data (glob syntax).\n */\n maskPatterns: optional(array(string())),\n /**\n * Debounce interval (in ms) for page view tracking.\n */\n debounce: optional(number()),\n /**\n * API key for authenticated tracking.\n */\n apiKey: optional(string()),\n /**\n * Override the analytics host URL. When first-party mode is enabled, this is\n * auto-injected to route through the proxy. The SDK derives its API endpoint\n * from the script src, so this changes the script src to `${analyticsHost}/script.js`.\n */\n analyticsHost: optional(string()),\n})"
|
|
634
639
|
},
|
|
635
640
|
{
|
|
636
641
|
name: "RybbitAnalyticsApi",
|
|
@@ -673,7 +678,7 @@ const registryTypes = {
|
|
|
673
678
|
{
|
|
674
679
|
name: "SnapTrFns",
|
|
675
680
|
kind: "type",
|
|
676
|
-
code: "type SnapTrFns\n = ((event: 'track', eventName: StandardEvents |
|
|
681
|
+
code: "type SnapTrFns\n = ((event: 'track', eventName: StandardEvents | (string & {}), data?: EventObjectProperties) => void)\n & ((event: 'init', id: string, data?: Record<string, any>) => void)\n & ((event: 'init', id: string, data?: InitObjectProperties) => void)\n & ((event: (string & {}), ...params: any[]) => void)"
|
|
677
682
|
},
|
|
678
683
|
{
|
|
679
684
|
name: "SnapPixelApi",
|
|
@@ -701,7 +706,7 @@ const registryTypes = {
|
|
|
701
706
|
{
|
|
702
707
|
name: "TtqFns",
|
|
703
708
|
kind: "type",
|
|
704
|
-
code: "type TtqFns\n = ((cmd: 'track', event: StandardEvents | string, properties?: EventProperties) => void)\n & ((cmd: 'page') => void)\n & ((cmd: 'identify', properties: IdentifyProperties) => void)\n & ((cmd: string, ...args: any[]) => void)"
|
|
709
|
+
code: "type TtqFns\n = ((cmd: 'track', event: StandardEvents | (string & {}), properties?: EventProperties) => void)\n & ((cmd: 'page') => void)\n & ((cmd: 'identify', properties: IdentifyProperties) => void)\n & ((cmd: (string & {}), ...args: any[]) => void)"
|
|
705
710
|
},
|
|
706
711
|
{
|
|
707
712
|
name: "TikTokPixelApi",
|
|
@@ -816,7 +821,7 @@ const registryTypes = {
|
|
|
816
821
|
{
|
|
817
822
|
name: "TwqFns",
|
|
818
823
|
kind: "type",
|
|
819
|
-
code: "type TwqFns\n = ((event: 'event', eventId: string, data?: EventObjectProperties) => void)\n & ((event: 'config', id: string) => void)\n & ((event: string, ...params: any[]) => void)"
|
|
824
|
+
code: "type TwqFns\n = ((event: 'event', eventId: string, data?: EventObjectProperties) => void)\n & ((event: 'config', id: string) => void)\n & ((event: (string & {}), ...params: any[]) => void)"
|
|
820
825
|
},
|
|
821
826
|
{
|
|
822
827
|
name: "XPixelApi",
|
|
@@ -855,6 +860,12 @@ const registryTypes = {
|
|
|
855
860
|
]
|
|
856
861
|
};
|
|
857
862
|
|
|
863
|
+
const JSDOC_START_RE = /^\s*\/\*\*/;
|
|
864
|
+
const JSDOC_END_RE = /^\s*\*\//;
|
|
865
|
+
const DOC_LINE_RE = /^\s*\*\s?(.*)/;
|
|
866
|
+
const DEFAULT_TAG_RE = /^@default\s*/;
|
|
867
|
+
const NAME_MATCH_RE = /^\s*(\w+)/;
|
|
868
|
+
const FIELD_MATCH_RE = /^\s*(\w+)\s*:/;
|
|
858
869
|
function getRegistryTypes() {
|
|
859
870
|
return registryTypes;
|
|
860
871
|
}
|
|
@@ -892,18 +903,18 @@ function parseComments(code) {
|
|
|
892
903
|
let desc = "";
|
|
893
904
|
let def = "";
|
|
894
905
|
for (const line of lines) {
|
|
895
|
-
if (
|
|
906
|
+
if (JSDOC_START_RE.test(line)) {
|
|
896
907
|
desc = "";
|
|
897
908
|
def = "";
|
|
898
909
|
continue;
|
|
899
910
|
}
|
|
900
|
-
if (
|
|
911
|
+
if (JSDOC_END_RE.test(line))
|
|
901
912
|
continue;
|
|
902
|
-
const docLine = line.match(
|
|
913
|
+
const docLine = line.match(DOC_LINE_RE);
|
|
903
914
|
if (docLine) {
|
|
904
915
|
const content = docLine[1].trim();
|
|
905
916
|
if (content.startsWith("@default"))
|
|
906
|
-
def = content.replace(
|
|
917
|
+
def = content.replace(DEFAULT_TAG_RE, "");
|
|
907
918
|
else if (!content.startsWith("@") && content)
|
|
908
919
|
desc += (desc ? " " : "") + content;
|
|
909
920
|
continue;
|
|
@@ -911,7 +922,7 @@ function parseComments(code) {
|
|
|
911
922
|
const colonIdx = line.indexOf(":");
|
|
912
923
|
const commentIdx = colonIdx > 0 ? line.indexOf("//", colonIdx) : -1;
|
|
913
924
|
if (colonIdx > 0 && commentIdx > colonIdx) {
|
|
914
|
-
const nameMatch = line.match(
|
|
925
|
+
const nameMatch = line.match(NAME_MATCH_RE);
|
|
915
926
|
if (nameMatch) {
|
|
916
927
|
const comment = line.slice(commentIdx + 2).trim();
|
|
917
928
|
result[nameMatch[1]] = { description: desc || comment, defaultValue: def || void 0 };
|
|
@@ -920,7 +931,7 @@ function parseComments(code) {
|
|
|
920
931
|
continue;
|
|
921
932
|
}
|
|
922
933
|
}
|
|
923
|
-
const fieldMatch = line.match(
|
|
934
|
+
const fieldMatch = line.match(FIELD_MATCH_RE);
|
|
924
935
|
if (fieldMatch) {
|
|
925
936
|
if (desc || def)
|
|
926
937
|
result[fieldMatch[1]] = { description: desc || void 0, defaultValue: def || void 0 };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/scripts",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-beta.
|
|
4
|
+
"version": "1.0.0-beta.20",
|
|
5
5
|
"description": "Load third-party scripts with better performance, privacy and DX in Nuxt Apps.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Harlan Wilton",
|
|
@@ -96,52 +96,52 @@
|
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"dependencies": {
|
|
99
|
-
"@nuxt/devtools-kit": "^3.2.
|
|
99
|
+
"@nuxt/devtools-kit": "^3.2.3",
|
|
100
100
|
"@nuxt/kit": "^4.3.1",
|
|
101
101
|
"@vueuse/core": "^14.2.1",
|
|
102
102
|
"consola": "^3.4.2",
|
|
103
103
|
"defu": "^6.1.4",
|
|
104
|
-
"h3": "^1.15.
|
|
104
|
+
"h3": "^1.15.6",
|
|
105
105
|
"magic-string": "^0.30.21",
|
|
106
106
|
"ofetch": "^1.5.1",
|
|
107
107
|
"ohash": "^2.0.11",
|
|
108
|
-
"oxc-parser": "^0.
|
|
108
|
+
"oxc-parser": "^0.117.0",
|
|
109
109
|
"oxc-walker": "^0.7.0",
|
|
110
110
|
"pathe": "^2.0.3",
|
|
111
111
|
"pkg-types": "^2.3.0",
|
|
112
112
|
"sirv": "^3.0.2",
|
|
113
|
-
"std-env": "^
|
|
113
|
+
"std-env": "^4.0.0",
|
|
114
114
|
"ufo": "^1.6.3",
|
|
115
115
|
"unplugin": "^3.0.0",
|
|
116
116
|
"unstorage": "^1.17.4",
|
|
117
117
|
"valibot": "^1.2.0"
|
|
118
118
|
},
|
|
119
119
|
"devDependencies": {
|
|
120
|
-
"@antfu/eslint-config": "^7.
|
|
121
|
-
"@nuxt/devtools-ui-kit": "^3.2.
|
|
120
|
+
"@antfu/eslint-config": "^7.7.0",
|
|
121
|
+
"@nuxt/devtools-ui-kit": "^3.2.3",
|
|
122
122
|
"@nuxt/module-builder": "^1.0.2",
|
|
123
123
|
"@nuxt/test-utils": "^4.0.0",
|
|
124
124
|
"@nuxtjs/partytown": "^2.0.0",
|
|
125
125
|
"@paypal/paypal-js": "^9.4.0",
|
|
126
126
|
"@types/semver": "^7.7.1",
|
|
127
127
|
"@types/youtube": "^0.1.2",
|
|
128
|
-
"@typescript-eslint/typescript-estree": "^8.
|
|
128
|
+
"@typescript-eslint/typescript-estree": "^8.57.0",
|
|
129
129
|
"@vue/test-utils": "^2.4.6",
|
|
130
130
|
"bumpp": "^10.4.1",
|
|
131
|
-
"eslint": "^10.0.
|
|
132
|
-
"eslint-plugin-harlanzw": "^0.5.
|
|
131
|
+
"eslint": "^10.0.3",
|
|
132
|
+
"eslint-plugin-harlanzw": "^0.5.17",
|
|
133
133
|
"happy-dom": "^20.8.3",
|
|
134
134
|
"knitwork": "^1.3.0",
|
|
135
135
|
"nuxt": "^4.3.1",
|
|
136
136
|
"playwright-core": "^1.58.2",
|
|
137
|
-
"posthog-js": "^1.
|
|
138
|
-
"shiki": "^4.0.
|
|
137
|
+
"posthog-js": "^1.360.0",
|
|
138
|
+
"shiki": "^4.0.2",
|
|
139
139
|
"typescript": "^5.9.3",
|
|
140
140
|
"vitest": "^4.0.18",
|
|
141
|
-
"vue": "^3.5.
|
|
141
|
+
"vue": "^3.5.30",
|
|
142
142
|
"vue-router": "^5.0.3",
|
|
143
143
|
"vue-tsc": "^3.2.5",
|
|
144
|
-
"@nuxt/scripts": "1.0.0-beta.
|
|
144
|
+
"@nuxt/scripts": "1.0.0-beta.20"
|
|
145
145
|
},
|
|
146
146
|
"resolutions": {
|
|
147
147
|
"@nuxt/scripts": "workspace:*"
|