@vercel/analytics 0.1.4 → 0.1.5
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/index.cjs +3 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +3 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +3 -1
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -38,7 +38,9 @@ function isBrowser() {
|
|
|
38
38
|
return typeof window !== "undefined";
|
|
39
39
|
}
|
|
40
40
|
function isDevelopment() {
|
|
41
|
-
|
|
41
|
+
if (typeof process === "undefined")
|
|
42
|
+
return false;
|
|
43
|
+
return process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
// src/generic.ts
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/generic.ts","../src/queue.ts","../src/utils.ts"],"sourcesContent":["import { initQueue } from './queue';\nimport type { AnalyticsProps } from './types';\nimport { isBrowser, isDevelopment } from './utils';\n\nexport const inject = (\n { beforeSend, debug }: AnalyticsProps = { debug: isDevelopment() },\n): void => {\n if (!isBrowser()) return;\n initQueue();\n\n if (beforeSend) {\n window.va?.('beforeSend', beforeSend);\n }\n const src = isDevelopment()\n ? 'https://cdn.vercel-insights.com/v1/script.debug.js'\n : '/_vercel/insights/script.js';\n\n if (document.head.querySelector(`script[src*=\"${src}\"]`)) return;\n\n const script = document.createElement('script');\n script.src = src;\n script.defer = true;\n\n if (isDevelopment() && debug === false) {\n script.setAttribute('data-debug', 'false');\n }\n\n document.head.appendChild(script);\n};\n","export const initQueue = (): void => {\n // initialise va until script is loaded\n if (window.va) return;\n\n window.va = function a(...params): void {\n (window.vaq = window.vaq || []).push(params);\n };\n};\n","export function isBrowser(): boolean {\n return typeof window !== 'undefined';\n}\n\nexport function isDevelopment(): boolean {\n return (\n
|
|
1
|
+
{"version":3,"sources":["../src/generic.ts","../src/queue.ts","../src/utils.ts"],"sourcesContent":["import { initQueue } from './queue';\nimport type { AnalyticsProps } from './types';\nimport { isBrowser, isDevelopment } from './utils';\n\nexport const inject = (\n { beforeSend, debug }: AnalyticsProps = { debug: isDevelopment() },\n): void => {\n if (!isBrowser()) return;\n initQueue();\n\n if (beforeSend) {\n window.va?.('beforeSend', beforeSend);\n }\n const src = isDevelopment()\n ? 'https://cdn.vercel-insights.com/v1/script.debug.js'\n : '/_vercel/insights/script.js';\n\n if (document.head.querySelector(`script[src*=\"${src}\"]`)) return;\n\n const script = document.createElement('script');\n script.src = src;\n script.defer = true;\n\n if (isDevelopment() && debug === false) {\n script.setAttribute('data-debug', 'false');\n }\n\n document.head.appendChild(script);\n};\n","export const initQueue = (): void => {\n // initialise va until script is loaded\n if (window.va) return;\n\n window.va = function a(...params): void {\n (window.vaq = window.vaq || []).push(params);\n };\n};\n","export function isBrowser(): boolean {\n return typeof window !== 'undefined';\n}\n\nexport function isDevelopment(): boolean {\n if (typeof process === 'undefined') return false;\n return (\n process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test'\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,YAAY,MAAY;AAEnC,MAAI,OAAO;AAAI;AAEf,SAAO,KAAK,SAAS,KAAK,QAAc;AACtC,KAAC,OAAO,MAAM,OAAO,OAAO,CAAC,GAAG,KAAK,MAAM;AAAA,EAC7C;AACF;;;ACPO,SAAS,YAAqB;AACnC,SAAO,OAAO,WAAW;AAC3B;AAEO,SAAS,gBAAyB;AACvC,MAAI,OAAO,YAAY;AAAa,WAAO;AAC3C,SACE,QAAQ,IAAI,aAAa,iBAAiB,QAAQ,IAAI,aAAa;AAEvE;;;AFLO,IAAM,SAAS,CACpB,EAAE,YAAY,MAAM,IAAoB,EAAE,OAAO,cAAc,EAAE,MACxD;AANX;AAOE,MAAI,CAAC,UAAU;AAAG;AAClB,YAAU;AAEV,MAAI,YAAY;AACd,iBAAO,OAAP,gCAAY,cAAc;AAAA,EAC5B;AACA,QAAM,MAAM,cAAc,IACtB,uDACA;AAEJ,MAAI,SAAS,KAAK,cAAc,gBAAgB,OAAO;AAAG;AAE1D,QAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,SAAO,MAAM;AACb,SAAO,QAAQ;AAEf,MAAI,cAAc,KAAK,UAAU,OAAO;AACtC,WAAO,aAAa,cAAc,OAAO;AAAA,EAC3C;AAEA,WAAS,KAAK,YAAY,MAAM;AAClC;","names":[]}
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,9 @@ function isBrowser() {
|
|
|
12
12
|
return typeof window !== "undefined";
|
|
13
13
|
}
|
|
14
14
|
function isDevelopment() {
|
|
15
|
-
|
|
15
|
+
if (typeof process === "undefined")
|
|
16
|
+
return false;
|
|
17
|
+
return process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
// src/generic.ts
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/queue.ts","../src/utils.ts","../src/generic.ts"],"sourcesContent":["export const initQueue = (): void => {\n // initialise va until script is loaded\n if (window.va) return;\n\n window.va = function a(...params): void {\n (window.vaq = window.vaq || []).push(params);\n };\n};\n","export function isBrowser(): boolean {\n return typeof window !== 'undefined';\n}\n\nexport function isDevelopment(): boolean {\n return (\n
|
|
1
|
+
{"version":3,"sources":["../src/queue.ts","../src/utils.ts","../src/generic.ts"],"sourcesContent":["export const initQueue = (): void => {\n // initialise va until script is loaded\n if (window.va) return;\n\n window.va = function a(...params): void {\n (window.vaq = window.vaq || []).push(params);\n };\n};\n","export function isBrowser(): boolean {\n return typeof window !== 'undefined';\n}\n\nexport function isDevelopment(): boolean {\n if (typeof process === 'undefined') return false;\n return (\n process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test'\n );\n}\n","import { initQueue } from './queue';\nimport type { AnalyticsProps } from './types';\nimport { isBrowser, isDevelopment } from './utils';\n\nexport const inject = (\n { beforeSend, debug }: AnalyticsProps = { debug: isDevelopment() },\n): void => {\n if (!isBrowser()) return;\n initQueue();\n\n if (beforeSend) {\n window.va?.('beforeSend', beforeSend);\n }\n const src = isDevelopment()\n ? 'https://cdn.vercel-insights.com/v1/script.debug.js'\n : '/_vercel/insights/script.js';\n\n if (document.head.querySelector(`script[src*=\"${src}\"]`)) return;\n\n const script = document.createElement('script');\n script.src = src;\n script.defer = true;\n\n if (isDevelopment() && debug === false) {\n script.setAttribute('data-debug', 'false');\n }\n\n document.head.appendChild(script);\n};\n"],"mappings":";AAAO,IAAM,YAAY,MAAY;AAEnC,MAAI,OAAO;AAAI;AAEf,SAAO,KAAK,SAAS,KAAK,QAAc;AACtC,KAAC,OAAO,MAAM,OAAO,OAAO,CAAC,GAAG,KAAK,MAAM;AAAA,EAC7C;AACF;;;ACPO,SAAS,YAAqB;AACnC,SAAO,OAAO,WAAW;AAC3B;AAEO,SAAS,gBAAyB;AACvC,MAAI,OAAO,YAAY;AAAa,WAAO;AAC3C,SACE,QAAQ,IAAI,aAAa,iBAAiB,QAAQ,IAAI,aAAa;AAEvE;;;ACLO,IAAM,SAAS,CACpB,EAAE,YAAY,MAAM,IAAoB,EAAE,OAAO,cAAc,EAAE,MACxD;AANX;AAOE,MAAI,CAAC,UAAU;AAAG;AAClB,YAAU;AAEV,MAAI,YAAY;AACd,iBAAO,OAAP,gCAAY,cAAc;AAAA,EAC5B;AACA,QAAM,MAAM,cAAc,IACtB,uDACA;AAEJ,MAAI,SAAS,KAAK,cAAc,gBAAgB,OAAO;AAAG;AAE1D,QAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,SAAO,MAAM;AACb,SAAO,QAAQ;AAEf,MAAI,cAAc,KAAK,UAAU,OAAO;AACtC,WAAO,aAAa,cAAc,OAAO;AAAA,EAC3C;AAEA,WAAS,KAAK,YAAY,MAAM;AAClC;","names":[]}
|
package/dist/react/index.cjs
CHANGED
|
@@ -39,7 +39,9 @@ function isBrowser() {
|
|
|
39
39
|
return typeof window !== "undefined";
|
|
40
40
|
}
|
|
41
41
|
function isDevelopment() {
|
|
42
|
-
|
|
42
|
+
if (typeof process === "undefined")
|
|
43
|
+
return false;
|
|
44
|
+
return process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
// src/generic.ts
|
package/dist/react/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/react.tsx","../../src/queue.ts","../../src/utils.ts","../../src/generic.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport { inject } from './generic';\nimport type { AnalyticsProps } from './types';\nimport { isDevelopment } from './utils';\n\nexport function Analytics({\n beforeSend,\n debug = isDevelopment(),\n}: AnalyticsProps): null {\n useEffect(() => {\n inject({ beforeSend, debug });\n }, [beforeSend, debug]);\n\n return null;\n}\n","export const initQueue = (): void => {\n // initialise va until script is loaded\n if (window.va) return;\n\n window.va = function a(...params): void {\n (window.vaq = window.vaq || []).push(params);\n };\n};\n","export function isBrowser(): boolean {\n return typeof window !== 'undefined';\n}\n\nexport function isDevelopment(): boolean {\n return (\n
|
|
1
|
+
{"version":3,"sources":["../../src/react.tsx","../../src/queue.ts","../../src/utils.ts","../../src/generic.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport { inject } from './generic';\nimport type { AnalyticsProps } from './types';\nimport { isDevelopment } from './utils';\n\nexport function Analytics({\n beforeSend,\n debug = isDevelopment(),\n}: AnalyticsProps): null {\n useEffect(() => {\n inject({ beforeSend, debug });\n }, [beforeSend, debug]);\n\n return null;\n}\n","export const initQueue = (): void => {\n // initialise va until script is loaded\n if (window.va) return;\n\n window.va = function a(...params): void {\n (window.vaq = window.vaq || []).push(params);\n };\n};\n","export function isBrowser(): boolean {\n return typeof window !== 'undefined';\n}\n\nexport function isDevelopment(): boolean {\n if (typeof process === 'undefined') return false;\n return (\n process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test'\n );\n}\n","import { initQueue } from './queue';\nimport type { AnalyticsProps } from './types';\nimport { isBrowser, isDevelopment } from './utils';\n\nexport const inject = (\n { beforeSend, debug }: AnalyticsProps = { debug: isDevelopment() },\n): void => {\n if (!isBrowser()) return;\n initQueue();\n\n if (beforeSend) {\n window.va?.('beforeSend', beforeSend);\n }\n const src = isDevelopment()\n ? 'https://cdn.vercel-insights.com/v1/script.debug.js'\n : '/_vercel/insights/script.js';\n\n if (document.head.querySelector(`script[src*=\"${src}\"]`)) return;\n\n const script = document.createElement('script');\n script.src = src;\n script.defer = true;\n\n if (isDevelopment() && debug === false) {\n script.setAttribute('data-debug', 'false');\n }\n\n document.head.appendChild(script);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;;;ACAnB,IAAM,YAAY,MAAY;AAEnC,MAAI,OAAO;AAAI;AAEf,SAAO,KAAK,SAAS,KAAK,QAAc;AACtC,KAAC,OAAO,MAAM,OAAO,OAAO,CAAC,GAAG,KAAK,MAAM;AAAA,EAC7C;AACF;;;ACPO,SAAS,YAAqB;AACnC,SAAO,OAAO,WAAW;AAC3B;AAEO,SAAS,gBAAyB;AACvC,MAAI,OAAO,YAAY;AAAa,WAAO;AAC3C,SACE,QAAQ,IAAI,aAAa,iBAAiB,QAAQ,IAAI,aAAa;AAEvE;;;ACLO,IAAM,SAAS,CACpB,EAAE,YAAY,MAAM,IAAoB,EAAE,OAAO,cAAc,EAAE,MACxD;AANX;AAOE,MAAI,CAAC,UAAU;AAAG;AAClB,YAAU;AAEV,MAAI,YAAY;AACd,iBAAO,OAAP,gCAAY,cAAc;AAAA,EAC5B;AACA,QAAM,MAAM,cAAc,IACtB,uDACA;AAEJ,MAAI,SAAS,KAAK,cAAc,gBAAgB,OAAO;AAAG;AAE1D,QAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,SAAO,MAAM;AACb,SAAO,QAAQ;AAEf,MAAI,cAAc,KAAK,UAAU,OAAO;AACtC,WAAO,aAAa,cAAc,OAAO;AAAA,EAC3C;AAEA,WAAS,KAAK,YAAY,MAAM;AAClC;;;AHvBO,SAAS,UAAU;AAAA,EACxB;AAAA,EACA,QAAQ,cAAc;AACxB,GAAyB;AACvB,8BAAU,MAAM;AACd,WAAO,EAAE,YAAY,MAAM,CAAC;AAAA,EAC9B,GAAG,CAAC,YAAY,KAAK,CAAC;AAEtB,SAAO;AACT;","names":[]}
|
package/dist/react/index.js
CHANGED
|
@@ -15,7 +15,9 @@ function isBrowser() {
|
|
|
15
15
|
return typeof window !== "undefined";
|
|
16
16
|
}
|
|
17
17
|
function isDevelopment() {
|
|
18
|
-
|
|
18
|
+
if (typeof process === "undefined")
|
|
19
|
+
return false;
|
|
20
|
+
return process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
// src/generic.ts
|
package/dist/react/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/react.tsx","../../src/queue.ts","../../src/utils.ts","../../src/generic.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport { inject } from './generic';\nimport type { AnalyticsProps } from './types';\nimport { isDevelopment } from './utils';\n\nexport function Analytics({\n beforeSend,\n debug = isDevelopment(),\n}: AnalyticsProps): null {\n useEffect(() => {\n inject({ beforeSend, debug });\n }, [beforeSend, debug]);\n\n return null;\n}\n","export const initQueue = (): void => {\n // initialise va until script is loaded\n if (window.va) return;\n\n window.va = function a(...params): void {\n (window.vaq = window.vaq || []).push(params);\n };\n};\n","export function isBrowser(): boolean {\n return typeof window !== 'undefined';\n}\n\nexport function isDevelopment(): boolean {\n return (\n
|
|
1
|
+
{"version":3,"sources":["../../src/react.tsx","../../src/queue.ts","../../src/utils.ts","../../src/generic.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport { inject } from './generic';\nimport type { AnalyticsProps } from './types';\nimport { isDevelopment } from './utils';\n\nexport function Analytics({\n beforeSend,\n debug = isDevelopment(),\n}: AnalyticsProps): null {\n useEffect(() => {\n inject({ beforeSend, debug });\n }, [beforeSend, debug]);\n\n return null;\n}\n","export const initQueue = (): void => {\n // initialise va until script is loaded\n if (window.va) return;\n\n window.va = function a(...params): void {\n (window.vaq = window.vaq || []).push(params);\n };\n};\n","export function isBrowser(): boolean {\n return typeof window !== 'undefined';\n}\n\nexport function isDevelopment(): boolean {\n if (typeof process === 'undefined') return false;\n return (\n process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test'\n );\n}\n","import { initQueue } from './queue';\nimport type { AnalyticsProps } from './types';\nimport { isBrowser, isDevelopment } from './utils';\n\nexport const inject = (\n { beforeSend, debug }: AnalyticsProps = { debug: isDevelopment() },\n): void => {\n if (!isBrowser()) return;\n initQueue();\n\n if (beforeSend) {\n window.va?.('beforeSend', beforeSend);\n }\n const src = isDevelopment()\n ? 'https://cdn.vercel-insights.com/v1/script.debug.js'\n : '/_vercel/insights/script.js';\n\n if (document.head.querySelector(`script[src*=\"${src}\"]`)) return;\n\n const script = document.createElement('script');\n script.src = src;\n script.defer = true;\n\n if (isDevelopment() && debug === false) {\n script.setAttribute('data-debug', 'false');\n }\n\n document.head.appendChild(script);\n};\n"],"mappings":";AAAA,SAAS,iBAAiB;;;ACAnB,IAAM,YAAY,MAAY;AAEnC,MAAI,OAAO;AAAI;AAEf,SAAO,KAAK,SAAS,KAAK,QAAc;AACtC,KAAC,OAAO,MAAM,OAAO,OAAO,CAAC,GAAG,KAAK,MAAM;AAAA,EAC7C;AACF;;;ACPO,SAAS,YAAqB;AACnC,SAAO,OAAO,WAAW;AAC3B;AAEO,SAAS,gBAAyB;AACvC,MAAI,OAAO,YAAY;AAAa,WAAO;AAC3C,SACE,QAAQ,IAAI,aAAa,iBAAiB,QAAQ,IAAI,aAAa;AAEvE;;;ACLO,IAAM,SAAS,CACpB,EAAE,YAAY,MAAM,IAAoB,EAAE,OAAO,cAAc,EAAE,MACxD;AANX;AAOE,MAAI,CAAC,UAAU;AAAG;AAClB,YAAU;AAEV,MAAI,YAAY;AACd,iBAAO,OAAP,gCAAY,cAAc;AAAA,EAC5B;AACA,QAAM,MAAM,cAAc,IACtB,uDACA;AAEJ,MAAI,SAAS,KAAK,cAAc,gBAAgB,OAAO;AAAG;AAE1D,QAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,SAAO,MAAM;AACb,SAAO,QAAQ;AAEf,MAAI,cAAc,KAAK,UAAU,OAAO;AACtC,WAAO,aAAa,cAAc,OAAO;AAAA,EAC3C;AAEA,WAAS,KAAK,YAAY,MAAM;AAClC;;;AHvBO,SAAS,UAAU;AAAA,EACxB;AAAA,EACA,QAAQ,cAAc;AACxB,GAAyB;AACvB,YAAU,MAAM;AACd,WAAO,EAAE,YAAY,MAAM,CAAC;AAAA,EAC9B,GAAG,CAAC,YAAY,KAAK,CAAC;AAEtB,SAAO;AACT;","names":[]}
|