From fcee0baa77b99db430731863c48d8784273126fe Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Wed, 16 Oct 2024 14:28:23 +0100 Subject: [PATCH 01/22] feat: safer string truncation --- .../replay/sessionrecording-utils.test.ts | 3 +- src/__tests__/utils/string-utils.test.ts | 37 +++++++++++++++++++ .../replay/sessionrecording-utils.ts | 15 ++++---- src/utils/index.ts | 3 +- src/utils/string-utils.ts | 19 ++++++++++ 5 files changed, 68 insertions(+), 9 deletions(-) create mode 100644 src/__tests__/utils/string-utils.test.ts create mode 100644 src/utils/string-utils.ts diff --git a/src/__tests__/extensions/replay/sessionrecording-utils.test.ts b/src/__tests__/extensions/replay/sessionrecording-utils.test.ts index d0faef5b1..521263f42 100644 --- a/src/__tests__/extensions/replay/sessionrecording-utils.test.ts +++ b/src/__tests__/extensions/replay/sessionrecording-utils.test.ts @@ -193,7 +193,8 @@ describe(`SessionRecording utility functions`, () => { data: { plugin: CONSOLE_LOG_PLUGIN_NAME, payload: { - payload: ['a', largeString.slice(0, 2000) + '...[truncated]'], + // 14 is the length of the '...[truncated]' string + payload: ['a', largeString.slice(0, 2000 - 14) + '...[truncated]'], }, }, }) diff --git a/src/__tests__/utils/string-utils.test.ts b/src/__tests__/utils/string-utils.test.ts new file mode 100644 index 000000000..4cc874b05 --- /dev/null +++ b/src/__tests__/utils/string-utils.test.ts @@ -0,0 +1,37 @@ +import { truncateString } from '../../utils/string-utils' + +describe('string-utils', () => { + it.each([ + // Basic string truncation without suffix + ['hello world', 5, undefined, 'hello'], + + // Basic string truncation without suffix + ['hello world ', 15, undefined, 'hello world'], + + // String with surrogate pair (emoji) + ['hello 😄 world', 7, undefined, 'hello 😄'], + + // String with surrogate pair, truncated in the middle of the emoji + ['hello 😄 world', 6, undefined, 'hello'], + + // Truncation with a suffix added + ['hello world', 5, '...', 'he...'], + + // Handling whitespace and suffix + [' hello world ', 7, '...', 'hell...'], + + // Empty string with suffix + ['', 5, '-', ''], + + // invalid input string with suffix + [null, 5, '-', ''], + + // Truncation without a suffix and with an emoji + ['hello 😄 world', 8, undefined, 'hello 😄'], + ])( + 'should truncate string "%s" to max length %d with suffix "%s" and return "%s"', + (input: string, maxLength: number, suffix: string | undefined, expected: string) => { + expect(truncateString(input, maxLength, suffix)).toEqual(expected) + } + ) +}) diff --git a/src/extensions/replay/sessionrecording-utils.ts b/src/extensions/replay/sessionrecording-utils.ts index aba786e87..67e5f838b 100644 --- a/src/extensions/replay/sessionrecording-utils.ts +++ b/src/extensions/replay/sessionrecording-utils.ts @@ -11,8 +11,9 @@ import type { } from '@rrweb/types' import type { DataURLOptions, MaskInputFn, MaskInputOptions, MaskTextFn, Mirror, SlimDOMOptions } from 'rrweb-snapshot' -import { isObject } from '../../utils/type-utils' +import { isNullish, isObject } from '../../utils/type-utils' import { SnapshotBuffer } from './sessionrecording' +import { truncateString } from '../../utils/string-utils' // taken from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cyclic_object_value#circular_references export function circularReferenceReplacer() { @@ -146,15 +147,15 @@ export function truncateLargeConsoleLogs(_event: eventWithTime) { } const updatedPayload = [] for (let i = 0; i < event.data.payload.payload.length; i++) { - if ( - event.data.payload.payload[i] && // Value can be null - event.data.payload.payload[i].length > MAX_STRING_SIZE - ) { - updatedPayload.push(event.data.payload.payload[i].slice(0, MAX_STRING_SIZE) + '...[truncated]') - } else { + if (isNullish(event.data.payload.payload[i])) { + // we expect nullish values to be logged unchanged, + // TODO test if this is still necessary https://github.com/PostHog/posthog-js/pull/385 updatedPayload.push(event.data.payload.payload[i]) + } else { + updatedPayload.push(truncateString(event.data.payload.payload[i], MAX_STRING_SIZE, '...[truncated]')) } } + event.data.payload.payload = updatedPayload // Return original type return _event diff --git a/src/utils/index.ts b/src/utils/index.ts index 435a107d8..e706c268b 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -2,6 +2,7 @@ import { Breaker, EventHandler, Properties } from '../types' import { isArray, isFormData, isFunction, isNull, isNullish, isString, hasOwnProperty } from './type-utils' import { logger } from './logger' import { window, nativeForEach, nativeIndexOf } from './globals' +import { truncateString } from './string-utils' const breaker: Breaker = {} @@ -207,7 +208,7 @@ export function _copyAndTruncateStrings = Record { if (isString(value) && !isNull(maxStringLength)) { - return (value as string).slice(0, maxStringLength) + return truncateString(value, maxStringLength) } return value }) as T diff --git a/src/utils/string-utils.ts b/src/utils/string-utils.ts new file mode 100644 index 000000000..06c965b27 --- /dev/null +++ b/src/utils/string-utils.ts @@ -0,0 +1,19 @@ +/** + * Truncate a string to a maximum length and optionally append a suffix only if the string is longer than the maximum length. + */ +export const truncateString = (str: unknown, maxLength: number, suffix?: string): string => { + if (typeof str !== 'string') { + return '' + } + + const trimmedSuffix = suffix?.trim() + const trimmedStr = str.trim() + + let sliceLength = maxLength + if (trimmedSuffix?.length) { + sliceLength -= trimmedSuffix.length + } + const sliced = Array.from(trimmedStr).slice(0, sliceLength).join('').trim() + const addSuffix = trimmedStr.length > maxLength + return sliced + (addSuffix ? trimmedSuffix || '' : '') +} From e1f244d69ac0d51a03985c8e4efea9d46998dd71 Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Wed, 16 Oct 2024 14:52:23 +0100 Subject: [PATCH 02/22] add array from polyfill --- src/entrypoints/array.full.ts | 2 ++ src/entrypoints/array.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/entrypoints/array.full.ts b/src/entrypoints/array.full.ts index 507e0e4f1..6a15c0467 100644 --- a/src/entrypoints/array.full.ts +++ b/src/entrypoints/array.full.ts @@ -1,3 +1,5 @@ +// for IE11 support we import this polyfill +import './polyfills/array-from-polyfill.ts' // Same as loader-globals.ts except includes all additional extension loaders import './all-external-dependencies' import './array' diff --git a/src/entrypoints/array.ts b/src/entrypoints/array.ts index c2e1b2ae7..6bf50a06b 100644 --- a/src/entrypoints/array.ts +++ b/src/entrypoints/array.ts @@ -1,2 +1,4 @@ +// for IE11 support we import this polyfill +import './polyfills/array-from-polyfill.ts' import './external-scripts-loader' import './array.no-external' From 03e68118e3c9755dfc83f5f6173742b18fea2d37 Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Wed, 16 Oct 2024 14:55:40 +0100 Subject: [PATCH 03/22] doh --- src/entrypoints/array.full.ts | 2 +- src/entrypoints/array.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/entrypoints/array.full.ts b/src/entrypoints/array.full.ts index 6a15c0467..d51f273e6 100644 --- a/src/entrypoints/array.full.ts +++ b/src/entrypoints/array.full.ts @@ -1,5 +1,5 @@ // for IE11 support we import this polyfill -import './polyfills/array-from-polyfill.ts' +import '../utils/array-polyfill' // Same as loader-globals.ts except includes all additional extension loaders import './all-external-dependencies' import './array' diff --git a/src/entrypoints/array.ts b/src/entrypoints/array.ts index 6bf50a06b..fae775d47 100644 --- a/src/entrypoints/array.ts +++ b/src/entrypoints/array.ts @@ -1,4 +1,4 @@ // for IE11 support we import this polyfill -import './polyfills/array-from-polyfill.ts' +import '../utils/array-polyfill' import './external-scripts-loader' import './array.no-external' From 8397e4275d5ab4158d8143b3da08c4122b5b3b41 Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Wed, 16 Oct 2024 15:03:18 +0100 Subject: [PATCH 04/22] move the file :/ --- src/utils/array-polyfill.ts | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/utils/array-polyfill.ts diff --git a/src/utils/array-polyfill.ts b/src/utils/array-polyfill.ts new file mode 100644 index 000000000..23f72fd68 --- /dev/null +++ b/src/utils/array-polyfill.ts @@ -0,0 +1,41 @@ +// Polyfill for Array.from for IE11 +// thanks ChatGPT 🙈 +import { isFunction } from './type-utils' + +if (!Array.from) { + Array.from = (function () { + // Polyfill for TypeScript signature: + // from(arrayLike: ArrayLike): T[]; + // from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; + return function from(arrayLike: ArrayLike, mapfn?: (v: T, k: number) => U, thisArg?: any): (T | U)[] { + // Use Array as the constructor without relying on `this` + const C = Array + const items = Object(arrayLike) + + if (arrayLike == null) { + throw new TypeError('Array.from requires an array-like object - not null or undefined') + } + + const len = Math.min(Math.max(Number(items.length) || 0, 0), Number.MAX_SAFE_INTEGER) + const result: (T | U)[] = isFunction(C) ? Object(new (C as any)(len)) : new Array(len) + + let k = 0 + + if (isFunction(mapfn)) { + while (k < len) { + const kValue = items[k] + result[k] = mapfn.call(thisArg, kValue, k) + k++ + } + } else { + while (k < len) { + result[k] = items[k] + k++ + } + } + + result.length = len + return result + } + })() +} From 8eab37e8a68275518d5bd117eea0486faf3fe4ff Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Wed, 16 Oct 2024 15:07:35 +0100 Subject: [PATCH 05/22] now? --- src/utils/array-polyfill.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/utils/array-polyfill.ts b/src/utils/array-polyfill.ts index 23f72fd68..f753631fb 100644 --- a/src/utils/array-polyfill.ts +++ b/src/utils/array-polyfill.ts @@ -16,25 +16,33 @@ if (!Array.from) { throw new TypeError('Array.from requires an array-like object - not null or undefined') } - const len = Math.min(Math.max(Number(items.length) || 0, 0), Number.MAX_SAFE_INTEGER) - const result: (T | U)[] = isFunction(C) ? Object(new (C as any)(len)) : new Array(len) + const len = Number(items.length) // Get the length as a number + + // Ensure length is a finite, positive integer, or set to 0 + if (isNaN(len) || len < 0 || !isFinite(len)) { + throw new RangeError('Array length must be a finite positive integer') + } + + const finalLen = Math.min(Math.max(len, 0), Number.MAX_SAFE_INTEGER) // Ensure within bounds + + const result: (T | U)[] = isFunction(C) ? Object(new (C as any)(finalLen)) : new Array(finalLen) let k = 0 if (isFunction(mapfn)) { - while (k < len) { + while (k < finalLen) { const kValue = items[k] result[k] = mapfn.call(thisArg, kValue, k) k++ } } else { - while (k < len) { + while (k < finalLen) { result[k] = items[k] k++ } } - result.length = len + result.length = finalLen return result } })() From bdcc00e92d4cc9e5055da2168e589de000fa3ad7 Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Wed, 16 Oct 2024 15:16:54 +0100 Subject: [PATCH 06/22] i too love ie11 --- src/utils/array-polyfill.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/utils/array-polyfill.ts b/src/utils/array-polyfill.ts index f753631fb..532daf0c2 100644 --- a/src/utils/array-polyfill.ts +++ b/src/utils/array-polyfill.ts @@ -4,9 +4,6 @@ import { isFunction } from './type-utils' if (!Array.from) { Array.from = (function () { - // Polyfill for TypeScript signature: - // from(arrayLike: ArrayLike): T[]; - // from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; return function from(arrayLike: ArrayLike, mapfn?: (v: T, k: number) => U, thisArg?: any): (T | U)[] { // Use Array as the constructor without relying on `this` const C = Array @@ -16,14 +13,14 @@ if (!Array.from) { throw new TypeError('Array.from requires an array-like object - not null or undefined') } - const len = Number(items.length) // Get the length as a number - - // Ensure length is a finite, positive integer, or set to 0 - if (isNaN(len) || len < 0 || !isFinite(len)) { + // Convert the length to a number and ensure it's finite and non-negative + const len = Number(items.length) + if (!isFinite(len) || len < 0) { throw new RangeError('Array length must be a finite positive integer') } - const finalLen = Math.min(Math.max(len, 0), Number.MAX_SAFE_INTEGER) // Ensure within bounds + // Truncate the length to avoid any floating-point errors (i.e., avoid fractional lengths) + const finalLen = Math.min(Math.max(Math.trunc(len), 0), Number.MAX_SAFE_INTEGER) const result: (T | U)[] = isFunction(C) ? Object(new (C as any)(finalLen)) : new Array(finalLen) From 1a9bc63d203fc0b6d87bb53d8d24781ba2f73af6 Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Wed, 16 Oct 2024 15:26:48 +0100 Subject: [PATCH 07/22] i too love ie11 --- src/utils/array-polyfill.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/array-polyfill.ts b/src/utils/array-polyfill.ts index 532daf0c2..8c7f49b3b 100644 --- a/src/utils/array-polyfill.ts +++ b/src/utils/array-polyfill.ts @@ -15,12 +15,12 @@ if (!Array.from) { // Convert the length to a number and ensure it's finite and non-negative const len = Number(items.length) - if (!isFinite(len) || len < 0) { - throw new RangeError('Array length must be a finite positive integer') - } // Truncate the length to avoid any floating-point errors (i.e., avoid fractional lengths) const finalLen = Math.min(Math.max(Math.trunc(len), 0), Number.MAX_SAFE_INTEGER) + if (!isFinite(finalLen) || finalLen < 0) { + throw new RangeError('Array length must be a finite positive integer') + } const result: (T | U)[] = isFunction(C) ? Object(new (C as any)(finalLen)) : new Array(finalLen) From d47c568b612d511a3f3cfd0e6ba8f7870abd7cfe Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Wed, 16 Oct 2024 15:27:18 +0100 Subject: [PATCH 08/22] i too love ie11 --- src/utils/array-polyfill.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/array-polyfill.ts b/src/utils/array-polyfill.ts index 8c7f49b3b..5d4e1f0a6 100644 --- a/src/utils/array-polyfill.ts +++ b/src/utils/array-polyfill.ts @@ -19,7 +19,7 @@ if (!Array.from) { // Truncate the length to avoid any floating-point errors (i.e., avoid fractional lengths) const finalLen = Math.min(Math.max(Math.trunc(len), 0), Number.MAX_SAFE_INTEGER) if (!isFinite(finalLen) || finalLen < 0) { - throw new RangeError('Array length must be a finite positive integer') + throw new RangeError('Array length must be a finite positive integer - not "' + finalLen + '"') } const result: (T | U)[] = isFunction(C) ? Object(new (C as any)(finalLen)) : new Array(finalLen) From 4fe7d682a27f9c696e8f126aa86677403ddb32a8 Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Wed, 16 Oct 2024 15:50:21 +0100 Subject: [PATCH 09/22] i too love ie11 --- src/utils/array-polyfill.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/utils/array-polyfill.ts b/src/utils/array-polyfill.ts index 5d4e1f0a6..d50e5aadf 100644 --- a/src/utils/array-polyfill.ts +++ b/src/utils/array-polyfill.ts @@ -1,6 +1,6 @@ // Polyfill for Array.from for IE11 // thanks ChatGPT 🙈 -import { isFunction } from './type-utils' +import { isFunction, isNullish } from './type-utils' if (!Array.from) { Array.from = (function () { @@ -9,8 +9,8 @@ if (!Array.from) { const C = Array const items = Object(arrayLike) - if (arrayLike == null) { - throw new TypeError('Array.from requires an array-like object - not null or undefined') + if (isNullish(arrayLike)) { + throw new TypeError('PostHog Array.from polyfill requires an array-like object - not null or undefined') } // Convert the length to a number and ensure it's finite and non-negative @@ -18,8 +18,15 @@ if (!Array.from) { // Truncate the length to avoid any floating-point errors (i.e., avoid fractional lengths) const finalLen = Math.min(Math.max(Math.trunc(len), 0), Number.MAX_SAFE_INTEGER) - if (!isFinite(finalLen) || finalLen < 0) { - throw new RangeError('Array length must be a finite positive integer - not "' + finalLen + '"') + if (isNaN(finalLen) || !isFinite(finalLen) || finalLen < 0) { + // eslint-disable-next-line no-console + console.warn( + 'PostHog Array.from polyfill - Invalid length property (' + + finalLen + + ') in array-like object, defaulting length to 0:', + items.length + ) + return [] // Return an empty array for invalid length } const result: (T | U)[] = isFunction(C) ? Object(new (C as any)(finalLen)) : new Array(finalLen) From 3b2a40dcb4494baae42f9f2efbcf706b501e4f1e Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Wed, 16 Oct 2024 16:47:52 +0100 Subject: [PATCH 10/22] what about a real polyfill --- package.json | 1 + pnpm-lock.yaml | 8 ++++++ src/entrypoints/array.full.ts | 2 -- src/entrypoints/array.ts | 4 +-- src/utils/array-polyfill.ts | 53 ----------------------------------- 5 files changed, 11 insertions(+), 57 deletions(-) delete mode 100644 src/utils/array-polyfill.ts diff --git a/package.json b/package.json index 680b1f437..559866ba0 100644 --- a/package.json +++ b/package.json @@ -70,6 +70,7 @@ "@typescript-eslint/parser": "^8.2.0", "babel-jest": "^26.6.3", "compare-versions": "^6.1.0", + "core-js": "^3.38.1", "cypress": "13.6.3", "cypress-localstorage-commands": "^2.2.6", "date-fns": "^3.6.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 789249fc9..f5e495d92 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -102,6 +102,9 @@ devDependencies: compare-versions: specifier: ^6.1.0 version: 6.1.0 + core-js: + specifier: ^3.38.1 + version: 3.38.1 cypress: specifier: 13.6.3 version: 13.6.3 @@ -4412,6 +4415,11 @@ packages: semver: 7.0.0 dev: true + /core-js@3.38.1: + resolution: {integrity: sha512-OP35aUorbU3Zvlx7pjsFdu1rGNnD4pgw/CWoYzRY3t2EzoVT7shKHY1dlAy3f41cGIO7ZDPQimhGFTlEYkG/Hw==} + requiresBuild: true + dev: true + /core-util-is@1.0.2: resolution: {integrity: sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==} dev: true diff --git a/src/entrypoints/array.full.ts b/src/entrypoints/array.full.ts index d51f273e6..507e0e4f1 100644 --- a/src/entrypoints/array.full.ts +++ b/src/entrypoints/array.full.ts @@ -1,5 +1,3 @@ -// for IE11 support we import this polyfill -import '../utils/array-polyfill' // Same as loader-globals.ts except includes all additional extension loaders import './all-external-dependencies' import './array' diff --git a/src/entrypoints/array.ts b/src/entrypoints/array.ts index fae775d47..f14c782ef 100644 --- a/src/entrypoints/array.ts +++ b/src/entrypoints/array.ts @@ -1,4 +1,4 @@ -// for IE11 support we import this polyfill -import '../utils/array-polyfill' +import 'core-js/features/array/from' + import './external-scripts-loader' import './array.no-external' diff --git a/src/utils/array-polyfill.ts b/src/utils/array-polyfill.ts deleted file mode 100644 index d50e5aadf..000000000 --- a/src/utils/array-polyfill.ts +++ /dev/null @@ -1,53 +0,0 @@ -// Polyfill for Array.from for IE11 -// thanks ChatGPT 🙈 -import { isFunction, isNullish } from './type-utils' - -if (!Array.from) { - Array.from = (function () { - return function from(arrayLike: ArrayLike, mapfn?: (v: T, k: number) => U, thisArg?: any): (T | U)[] { - // Use Array as the constructor without relying on `this` - const C = Array - const items = Object(arrayLike) - - if (isNullish(arrayLike)) { - throw new TypeError('PostHog Array.from polyfill requires an array-like object - not null or undefined') - } - - // Convert the length to a number and ensure it's finite and non-negative - const len = Number(items.length) - - // Truncate the length to avoid any floating-point errors (i.e., avoid fractional lengths) - const finalLen = Math.min(Math.max(Math.trunc(len), 0), Number.MAX_SAFE_INTEGER) - if (isNaN(finalLen) || !isFinite(finalLen) || finalLen < 0) { - // eslint-disable-next-line no-console - console.warn( - 'PostHog Array.from polyfill - Invalid length property (' + - finalLen + - ') in array-like object, defaulting length to 0:', - items.length - ) - return [] // Return an empty array for invalid length - } - - const result: (T | U)[] = isFunction(C) ? Object(new (C as any)(finalLen)) : new Array(finalLen) - - let k = 0 - - if (isFunction(mapfn)) { - while (k < finalLen) { - const kValue = items[k] - result[k] = mapfn.call(thisArg, kValue, k) - k++ - } - } else { - while (k < finalLen) { - result[k] = items[k] - k++ - } - } - - result.length = finalLen - return result - } - })() -} From fe3cdab40d6e22e8edad3865393a75d4f4b50702 Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Wed, 16 Oct 2024 16:48:05 +0100 Subject: [PATCH 11/22] what about a real polyfill --- src/entrypoints/array.full.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/entrypoints/array.full.ts b/src/entrypoints/array.full.ts index 507e0e4f1..da9d0dd00 100644 --- a/src/entrypoints/array.full.ts +++ b/src/entrypoints/array.full.ts @@ -1,3 +1,5 @@ +import 'core-js/features/array/from' + // Same as loader-globals.ts except includes all additional extension loaders import './all-external-dependencies' import './array' From fd6439d137851f0ddbc8d8eb79f81e30716f007d Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Wed, 16 Oct 2024 19:02:08 +0100 Subject: [PATCH 12/22] i too love ie11 --- package.json | 2 +- pnpm-lock.yaml | 8 ++++---- src/entrypoints/array.full.ts | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 559866ba0..5d84c3664 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "react/package.json" ], "dependencies": { + "core-js": "^3.38.1", "fflate": "^0.4.8", "preact": "^10.19.3", "web-vitals": "^4.0.1" @@ -70,7 +71,6 @@ "@typescript-eslint/parser": "^8.2.0", "babel-jest": "^26.6.3", "compare-versions": "^6.1.0", - "core-js": "^3.38.1", "cypress": "13.6.3", "cypress-localstorage-commands": "^2.2.6", "date-fns": "^3.6.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f5e495d92..7f62d6a0a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,6 +10,9 @@ patchedDependencies: path: patches/rrweb@2.0.0-alpha.13.patch dependencies: + core-js: + specifier: ^3.38.1 + version: 3.38.1 fflate: specifier: ^0.4.8 version: 0.4.8 @@ -102,9 +105,6 @@ devDependencies: compare-versions: specifier: ^6.1.0 version: 6.1.0 - core-js: - specifier: ^3.38.1 - version: 3.38.1 cypress: specifier: 13.6.3 version: 13.6.3 @@ -4418,7 +4418,7 @@ packages: /core-js@3.38.1: resolution: {integrity: sha512-OP35aUorbU3Zvlx7pjsFdu1rGNnD4pgw/CWoYzRY3t2EzoVT7shKHY1dlAy3f41cGIO7ZDPQimhGFTlEYkG/Hw==} requiresBuild: true - dev: true + dev: false /core-util-is@1.0.2: resolution: {integrity: sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==} diff --git a/src/entrypoints/array.full.ts b/src/entrypoints/array.full.ts index da9d0dd00..df968c4b9 100644 --- a/src/entrypoints/array.full.ts +++ b/src/entrypoints/array.full.ts @@ -1,4 +1,4 @@ -import 'core-js/features/array/from' +import 'core-js/actual/array/from' // Same as loader-globals.ts except includes all additional extension loaders import './all-external-dependencies' From 7722bc27df6597c96069939dea82f274b55c14d5 Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Wed, 16 Oct 2024 20:35:01 +0100 Subject: [PATCH 13/22] maybe like this --- .babelrc | 32 ++++-- package.json | 2 +- pnpm-lock.yaml | 181 ++++++++++++++++++++-------------- src/entrypoints/array.full.ts | 2 - src/entrypoints/array.ts | 2 - 5 files changed, 130 insertions(+), 89 deletions(-) diff --git a/.babelrc b/.babelrc index 48f19b72b..160f79eff 100644 --- a/.babelrc +++ b/.babelrc @@ -1,12 +1,26 @@ { - "presets": ["@babel/env", ["@babel/typescript", { "jsxPragma": "h" }]], - "plugins": [ - [ - "@babel/transform-react-jsx", - { - "runtime": "automatic", - "importSource": "preact" - } - ] + "presets": [ + [ + "@babel/env", + { + "useBuiltIns": "usage", + "corejs": 3 + } + ], + [ + "@babel/typescript", + { + "jsxPragma": "h" + } ] + ], + "plugins": [ + [ + "@babel/transform-react-jsx", + { + "runtime": "automatic", + "importSource": "preact" + } + ] + ] } diff --git a/package.json b/package.json index 5d84c3664..efd8af5e2 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,7 @@ "posthog-js": "link:", "preact-render-to-string": "^6.3.1", "prettier": "^2.7.1", - "rollup": "^4.9.6", + "rollup": "^4.24.0", "rollup-plugin-dts": "^6.1.0", "rollup-plugin-ts": "^3.4.5", "rollup-plugin-visualizer": "^5.12.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7f62d6a0a..59628aa67 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -47,19 +47,19 @@ devDependencies: version: 27.5.1 '@rollup/plugin-babel': specifier: ^6.0.4 - version: 6.0.4(@babel/core@7.18.9)(rollup@4.9.6) + version: 6.0.4(@babel/core@7.18.9)(rollup@4.24.0) '@rollup/plugin-json': specifier: ^6.1.0 - version: 6.1.0(rollup@4.9.6) + version: 6.1.0(rollup@4.24.0) '@rollup/plugin-node-resolve': specifier: ^15.2.3 - version: 15.2.3(rollup@4.9.6) + version: 15.2.3(rollup@4.24.0) '@rollup/plugin-terser': specifier: ^0.4.4 - version: 0.4.4(rollup@4.9.6) + version: 0.4.4(rollup@4.24.0) '@rollup/plugin-typescript': specifier: ^11.1.6 - version: 11.1.6(rollup@4.9.6)(tslib@2.5.0)(typescript@5.5.4) + version: 11.1.6(rollup@4.24.0)(tslib@2.5.0)(typescript@5.5.4) '@rrweb/types': specifier: 2.0.0-alpha.13 version: 2.0.0-alpha.13 @@ -187,17 +187,17 @@ devDependencies: specifier: ^2.7.1 version: 2.7.1 rollup: - specifier: ^4.9.6 - version: 4.9.6 + specifier: ^4.24.0 + version: 4.24.0 rollup-plugin-dts: specifier: ^6.1.0 - version: 6.1.0(rollup@4.9.6)(typescript@5.5.4) + version: 6.1.0(rollup@4.24.0)(typescript@5.5.4) rollup-plugin-ts: specifier: ^3.4.5 - version: 3.4.5(@babel/core@7.18.9)(@babel/preset-env@7.18.9)(@babel/preset-typescript@7.18.6)(rollup@4.9.6)(typescript@5.5.4) + version: 3.4.5(@babel/core@7.18.9)(@babel/preset-env@7.18.9)(@babel/preset-typescript@7.18.6)(rollup@4.24.0)(typescript@5.5.4) rollup-plugin-visualizer: specifier: ^5.12.0 - version: 5.12.0(rollup@4.9.6) + version: 5.12.0(rollup@4.24.0) rrweb: specifier: 2.0.0-alpha.13 version: 2.0.0-alpha.13(patch_hash=es276qklpcauxli22h726xp7fe) @@ -2506,7 +2506,7 @@ packages: resolution: {integrity: sha512-Aq58f5HiWdyDlFffbbSjAlv596h/cOnt2DO1w3DOC7OJ5EHs0hd/nycJfiu9RJbT6Yk6F1knnRRXNSpxoIVZ9Q==} dev: true - /@rollup/plugin-babel@6.0.4(@babel/core@7.18.9)(rollup@4.9.6): + /@rollup/plugin-babel@6.0.4(@babel/core@7.18.9)(rollup@4.24.0): resolution: {integrity: sha512-YF7Y52kFdFT/xVSuVdjkV5ZdX/3YtmX0QulG+x0taQOtJdHYzVU61aSSkAgVJ7NOv6qPkIYiJSgSWWN/DM5sGw==} engines: {node: '>=14.0.0'} peerDependencies: @@ -2521,11 +2521,11 @@ packages: dependencies: '@babel/core': 7.18.9 '@babel/helper-module-imports': 7.22.15 - '@rollup/pluginutils': 5.1.0(rollup@4.9.6) - rollup: 4.9.6 + '@rollup/pluginutils': 5.1.0(rollup@4.24.0) + rollup: 4.24.0 dev: true - /@rollup/plugin-json@6.1.0(rollup@4.9.6): + /@rollup/plugin-json@6.1.0(rollup@4.24.0): resolution: {integrity: sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA==} engines: {node: '>=14.0.0'} peerDependencies: @@ -2534,11 +2534,11 @@ packages: rollup: optional: true dependencies: - '@rollup/pluginutils': 5.1.0(rollup@4.9.6) - rollup: 4.9.6 + '@rollup/pluginutils': 5.1.0(rollup@4.24.0) + rollup: 4.24.0 dev: true - /@rollup/plugin-node-resolve@15.2.3(rollup@4.9.6): + /@rollup/plugin-node-resolve@15.2.3(rollup@4.24.0): resolution: {integrity: sha512-j/lym8nf5E21LwBT4Df1VD6hRO2L2iwUeUmP7litikRsVp1H6NWx20NEp0Y7su+7XGc476GnXXc4kFeZNGmaSQ==} engines: {node: '>=14.0.0'} peerDependencies: @@ -2547,16 +2547,16 @@ packages: rollup: optional: true dependencies: - '@rollup/pluginutils': 5.1.0(rollup@4.9.6) + '@rollup/pluginutils': 5.1.0(rollup@4.24.0) '@types/resolve': 1.20.2 deepmerge: 4.2.2 is-builtin-module: 3.2.1 is-module: 1.0.0 resolve: 1.22.8 - rollup: 4.9.6 + rollup: 4.24.0 dev: true - /@rollup/plugin-terser@0.4.4(rollup@4.9.6): + /@rollup/plugin-terser@0.4.4(rollup@4.24.0): resolution: {integrity: sha512-XHeJC5Bgvs8LfukDwWZp7yeqin6ns8RTl2B9avbejt6tZqsqvVoWI7ZTQrcNsfKEDWBTnTxM8nMDkO2IFFbd0A==} engines: {node: '>=14.0.0'} peerDependencies: @@ -2565,13 +2565,13 @@ packages: rollup: optional: true dependencies: - rollup: 4.9.6 + rollup: 4.24.0 serialize-javascript: 6.0.1 smob: 1.4.1 terser: 5.27.0 dev: true - /@rollup/plugin-typescript@11.1.6(rollup@4.9.6)(tslib@2.5.0)(typescript@5.5.4): + /@rollup/plugin-typescript@11.1.6(rollup@4.24.0)(tslib@2.5.0)(typescript@5.5.4): resolution: {integrity: sha512-R92yOmIACgYdJ7dJ97p4K69I8gg6IEHt8M7dUBxN3W6nrO8uUxX5ixl0yU/N3aZTi8WhPuICvOHXQvF6FaykAA==} engines: {node: '>=14.0.0'} peerDependencies: @@ -2584,14 +2584,14 @@ packages: tslib: optional: true dependencies: - '@rollup/pluginutils': 5.1.0(rollup@4.9.6) + '@rollup/pluginutils': 5.1.0(rollup@4.24.0) resolve: 1.22.8 - rollup: 4.9.6 + rollup: 4.24.0 tslib: 2.5.0 typescript: 5.5.4 dev: true - /@rollup/pluginutils@5.1.0(rollup@4.9.6): + /@rollup/pluginutils@5.1.0(rollup@4.24.0): resolution: {integrity: sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==} engines: {node: '>=14.0.0'} peerDependencies: @@ -2603,107 +2603,131 @@ packages: '@types/estree': 1.0.5 estree-walker: 2.0.2 picomatch: 2.3.1 - rollup: 4.9.6 + rollup: 4.24.0 dev: true - /@rollup/rollup-android-arm-eabi@4.9.6: - resolution: {integrity: sha512-MVNXSSYN6QXOulbHpLMKYi60ppyO13W9my1qogeiAqtjb2yR4LSmfU2+POvDkLzhjYLXz9Rf9+9a3zFHW1Lecg==} + /@rollup/rollup-android-arm-eabi@4.24.0: + resolution: {integrity: sha512-Q6HJd7Y6xdB48x8ZNVDOqsbh2uByBhgK8PiQgPhwkIw/HC/YX5Ghq2mQY5sRMZWHb3VsFkWooUVOZHKr7DmDIA==} cpu: [arm] os: [android] requiresBuild: true dev: true optional: true - /@rollup/rollup-android-arm64@4.9.6: - resolution: {integrity: sha512-T14aNLpqJ5wzKNf5jEDpv5zgyIqcpn1MlwCrUXLrwoADr2RkWA0vOWP4XxbO9aiO3dvMCQICZdKeDrFl7UMClw==} + /@rollup/rollup-android-arm64@4.24.0: + resolution: {integrity: sha512-ijLnS1qFId8xhKjT81uBHuuJp2lU4x2yxa4ctFPtG+MqEE6+C5f/+X/bStmxapgmwLwiL3ih122xv8kVARNAZA==} cpu: [arm64] os: [android] requiresBuild: true dev: true optional: true - /@rollup/rollup-darwin-arm64@4.9.6: - resolution: {integrity: sha512-CqNNAyhRkTbo8VVZ5R85X73H3R5NX9ONnKbXuHisGWC0qRbTTxnF1U4V9NafzJbgGM0sHZpdO83pLPzq8uOZFw==} + /@rollup/rollup-darwin-arm64@4.24.0: + resolution: {integrity: sha512-bIv+X9xeSs1XCk6DVvkO+S/z8/2AMt/2lMqdQbMrmVpgFvXlmde9mLcbQpztXm1tajC3raFDqegsH18HQPMYtA==} cpu: [arm64] os: [darwin] requiresBuild: true dev: true optional: true - /@rollup/rollup-darwin-x64@4.9.6: - resolution: {integrity: sha512-zRDtdJuRvA1dc9Mp6BWYqAsU5oeLixdfUvkTHuiYOHwqYuQ4YgSmi6+/lPvSsqc/I0Omw3DdICx4Tfacdzmhog==} + /@rollup/rollup-darwin-x64@4.24.0: + resolution: {integrity: sha512-X6/nOwoFN7RT2svEQWUsW/5C/fYMBe4fnLK9DQk4SX4mgVBiTA9h64kjUYPvGQ0F/9xwJ5U5UfTbl6BEjaQdBQ==} cpu: [x64] os: [darwin] requiresBuild: true dev: true optional: true - /@rollup/rollup-linux-arm-gnueabihf@4.9.6: - resolution: {integrity: sha512-oNk8YXDDnNyG4qlNb6is1ojTOGL/tRhbbKeE/YuccItzerEZT68Z9gHrY3ROh7axDc974+zYAPxK5SH0j/G+QQ==} + /@rollup/rollup-linux-arm-gnueabihf@4.24.0: + resolution: {integrity: sha512-0KXvIJQMOImLCVCz9uvvdPgfyWo93aHHp8ui3FrtOP57svqrF/roSSR5pjqL2hcMp0ljeGlU4q9o/rQaAQ3AYA==} cpu: [arm] os: [linux] requiresBuild: true dev: true optional: true - /@rollup/rollup-linux-arm64-gnu@4.9.6: - resolution: {integrity: sha512-Z3O60yxPtuCYobrtzjo0wlmvDdx2qZfeAWTyfOjEDqd08kthDKexLpV97KfAeUXPosENKd8uyJMRDfFMxcYkDQ==} + /@rollup/rollup-linux-arm-musleabihf@4.24.0: + resolution: {integrity: sha512-it2BW6kKFVh8xk/BnHfakEeoLPv8STIISekpoF+nBgWM4d55CZKc7T4Dx1pEbTnYm/xEKMgy1MNtYuoA8RFIWw==} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-arm64-gnu@4.24.0: + resolution: {integrity: sha512-i0xTLXjqap2eRfulFVlSnM5dEbTVque/3Pi4g2y7cxrs7+a9De42z4XxKLYJ7+OhE3IgxvfQM7vQc43bwTgPwA==} cpu: [arm64] os: [linux] requiresBuild: true dev: true optional: true - /@rollup/rollup-linux-arm64-musl@4.9.6: - resolution: {integrity: sha512-gpiG0qQJNdYEVad+1iAsGAbgAnZ8j07FapmnIAQgODKcOTjLEWM9sRb+MbQyVsYCnA0Im6M6QIq6ax7liws6eQ==} + /@rollup/rollup-linux-arm64-musl@4.24.0: + resolution: {integrity: sha512-9E6MKUJhDuDh604Qco5yP/3qn3y7SLXYuiC0Rpr89aMScS2UAmK1wHP2b7KAa1nSjWJc/f/Lc0Wl1L47qjiyQw==} cpu: [arm64] os: [linux] requiresBuild: true dev: true optional: true - /@rollup/rollup-linux-riscv64-gnu@4.9.6: - resolution: {integrity: sha512-+uCOcvVmFUYvVDr27aiyun9WgZk0tXe7ThuzoUTAukZJOwS5MrGbmSlNOhx1j80GdpqbOty05XqSl5w4dQvcOA==} + /@rollup/rollup-linux-powerpc64le-gnu@4.24.0: + resolution: {integrity: sha512-2XFFPJ2XMEiF5Zi2EBf4h73oR1V/lycirxZxHZNc93SqDN/IWhYYSYj8I9381ikUFXZrz2v7r2tOVk2NBwxrWw==} + cpu: [ppc64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-riscv64-gnu@4.24.0: + resolution: {integrity: sha512-M3Dg4hlwuntUCdzU7KjYqbbd+BLq3JMAOhCKdBE3TcMGMZbKkDdJ5ivNdehOssMCIokNHFOsv7DO4rlEOfyKpg==} cpu: [riscv64] os: [linux] requiresBuild: true dev: true optional: true - /@rollup/rollup-linux-x64-gnu@4.9.6: - resolution: {integrity: sha512-HUNqM32dGzfBKuaDUBqFB7tP6VMN74eLZ33Q9Y1TBqRDn+qDonkAUyKWwF9BR9unV7QUzffLnz9GrnKvMqC/fw==} + /@rollup/rollup-linux-s390x-gnu@4.24.0: + resolution: {integrity: sha512-mjBaoo4ocxJppTorZVKWFpy1bfFj9FeCMJqzlMQGjpNPY9JwQi7OuS1axzNIk0nMX6jSgy6ZURDZ2w0QW6D56g==} + cpu: [s390x] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-x64-gnu@4.24.0: + resolution: {integrity: sha512-ZXFk7M72R0YYFN5q13niV0B7G8/5dcQ9JDp8keJSfr3GoZeXEoMHP/HlvqROA3OMbMdfr19IjCeNAnPUG93b6A==} cpu: [x64] os: [linux] requiresBuild: true dev: true optional: true - /@rollup/rollup-linux-x64-musl@4.9.6: - resolution: {integrity: sha512-ch7M+9Tr5R4FK40FHQk8VnML0Szi2KRujUgHXd/HjuH9ifH72GUmw6lStZBo3c3GB82vHa0ZoUfjfcM7JiiMrQ==} + /@rollup/rollup-linux-x64-musl@4.24.0: + resolution: {integrity: sha512-w1i+L7kAXZNdYl+vFvzSZy8Y1arS7vMgIy8wusXJzRrPyof5LAb02KGr1PD2EkRcl73kHulIID0M501lN+vobQ==} cpu: [x64] os: [linux] requiresBuild: true dev: true optional: true - /@rollup/rollup-win32-arm64-msvc@4.9.6: - resolution: {integrity: sha512-VD6qnR99dhmTQ1mJhIzXsRcTBvTjbfbGGwKAHcu+52cVl15AC/kplkhxzW/uT0Xl62Y/meBKDZvoJSJN+vTeGA==} + /@rollup/rollup-win32-arm64-msvc@4.24.0: + resolution: {integrity: sha512-VXBrnPWgBpVDCVY6XF3LEW0pOU51KbaHhccHw6AS6vBWIC60eqsH19DAeeObl+g8nKAz04QFdl/Cefta0xQtUQ==} cpu: [arm64] os: [win32] requiresBuild: true dev: true optional: true - /@rollup/rollup-win32-ia32-msvc@4.9.6: - resolution: {integrity: sha512-J9AFDq/xiRI58eR2NIDfyVmTYGyIZmRcvcAoJ48oDld/NTR8wyiPUu2X/v1navJ+N/FGg68LEbX3Ejd6l8B7MQ==} + /@rollup/rollup-win32-ia32-msvc@4.24.0: + resolution: {integrity: sha512-xrNcGDU0OxVcPTH/8n/ShH4UevZxKIO6HJFK0e15XItZP2UcaiLFd5kiX7hJnqCbSztUF8Qot+JWBC/QXRPYWQ==} cpu: [ia32] os: [win32] requiresBuild: true dev: true optional: true - /@rollup/rollup-win32-x64-msvc@4.9.6: - resolution: {integrity: sha512-jqzNLhNDvIZOrt69Ce4UjGRpXJBzhUBzawMwnaDAwyHriki3XollsewxWzOzz+4yOFDkuJHtTsZFwMxhYJWmLQ==} + /@rollup/rollup-win32-x64-msvc@4.24.0: + resolution: {integrity: sha512-fbMkAF7fufku0N2dE5TBXcNlg0pt0cJue4xBRE2Qc5Vqikxr4VCgKj/ht6SMdFcOacVA9rqF70APJ8RN/4vMJw==} cpu: [x64] os: [win32] requiresBuild: true @@ -2904,6 +2928,10 @@ packages: resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} dev: true + /@types/estree@1.0.6: + resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==} + dev: true + /@types/glob@7.1.3: resolution: {integrity: sha512-SEYeGAIQIQX8NN6LDKprLjbrd5dARM5EXsd8GI/A5l0apYI1fGMWgPHSe4ZKL4eozlAyI+doUE9XbYS4xCkQ1w==} dependencies: @@ -9305,7 +9333,7 @@ packages: glob: 7.1.6 dev: true - /rollup-plugin-dts@6.1.0(rollup@4.9.6)(typescript@5.5.4): + /rollup-plugin-dts@6.1.0(rollup@4.24.0)(typescript@5.5.4): resolution: {integrity: sha512-ijSCPICkRMDKDLBK9torss07+8dl9UpY9z1N/zTeA1cIqdzMlpkV3MOOC7zukyvQfDyxa1s3Dl2+DeiP/G6DOw==} engines: {node: '>=16'} peerDependencies: @@ -9313,13 +9341,13 @@ packages: typescript: ^4.5 || ^5.0 dependencies: magic-string: 0.30.5 - rollup: 4.9.6 + rollup: 4.24.0 typescript: 5.5.4 optionalDependencies: '@babel/code-frame': 7.23.5 dev: true - /rollup-plugin-ts@3.4.5(@babel/core@7.18.9)(@babel/preset-env@7.18.9)(@babel/preset-typescript@7.18.6)(rollup@4.9.6)(typescript@5.5.4): + /rollup-plugin-ts@3.4.5(@babel/core@7.18.9)(@babel/preset-env@7.18.9)(@babel/preset-typescript@7.18.6)(rollup@4.24.0)(typescript@5.5.4): resolution: {integrity: sha512-9iCstRJpEZXSRQuXitlSZAzcGlrqTbJg1pE4CMbEi6xYldxVncdPyzA2I+j6vnh73wBymZckerS+Q/iEE/M3Ow==} engines: {node: '>=16.15.1', npm: '>=7.0.0', pnpm: '>=3.2.0', yarn: '>=1.13'} peerDependencies: @@ -9351,7 +9379,7 @@ packages: '@babel/core': 7.18.9 '@babel/preset-env': 7.18.9(@babel/core@7.18.9) '@babel/preset-typescript': 7.18.6(@babel/core@7.18.9) - '@rollup/pluginutils': 5.1.0(rollup@4.9.6) + '@rollup/pluginutils': 5.1.0(rollup@4.24.0) '@wessberg/stringutil': 1.0.19 ansi-colors: 4.1.3 browserslist: 4.23.3 @@ -9359,13 +9387,13 @@ packages: compatfactory: 3.0.0(typescript@5.5.4) crosspath: 2.0.0 magic-string: 0.30.5 - rollup: 4.9.6 + rollup: 4.24.0 ts-clone-node: 3.0.0(typescript@5.5.4) tslib: 2.7.0 typescript: 5.5.4 dev: true - /rollup-plugin-visualizer@5.12.0(rollup@4.9.6): + /rollup-plugin-visualizer@5.12.0(rollup@4.24.0): resolution: {integrity: sha512-8/NU9jXcHRs7Nnj07PF2o4gjxmm9lXIrZ8r175bT9dK8qoLlvKTwRMArRCMgpMGlq8CTLugRvEmyMeMXIU2pNQ==} engines: {node: '>=14'} hasBin: true @@ -9377,31 +9405,34 @@ packages: dependencies: open: 8.4.2 picomatch: 2.3.1 - rollup: 4.9.6 + rollup: 4.24.0 source-map: 0.7.4 yargs: 17.7.2 dev: true - /rollup@4.9.6: - resolution: {integrity: sha512-05lzkCS2uASX0CiLFybYfVkwNbKZG5NFQ6Go0VWyogFTXXbR039UVsegViTntkk4OglHBdF54ccApXRRuXRbsg==} + /rollup@4.24.0: + resolution: {integrity: sha512-DOmrlGSXNk1DM0ljiQA+i+o0rSLhtii1je5wgk60j49d1jHT5YYttBv1iWOnYSTG+fZZESUOSNiAl89SIet+Cg==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true dependencies: - '@types/estree': 1.0.5 + '@types/estree': 1.0.6 optionalDependencies: - '@rollup/rollup-android-arm-eabi': 4.9.6 - '@rollup/rollup-android-arm64': 4.9.6 - '@rollup/rollup-darwin-arm64': 4.9.6 - '@rollup/rollup-darwin-x64': 4.9.6 - '@rollup/rollup-linux-arm-gnueabihf': 4.9.6 - '@rollup/rollup-linux-arm64-gnu': 4.9.6 - '@rollup/rollup-linux-arm64-musl': 4.9.6 - '@rollup/rollup-linux-riscv64-gnu': 4.9.6 - '@rollup/rollup-linux-x64-gnu': 4.9.6 - '@rollup/rollup-linux-x64-musl': 4.9.6 - '@rollup/rollup-win32-arm64-msvc': 4.9.6 - '@rollup/rollup-win32-ia32-msvc': 4.9.6 - '@rollup/rollup-win32-x64-msvc': 4.9.6 + '@rollup/rollup-android-arm-eabi': 4.24.0 + '@rollup/rollup-android-arm64': 4.24.0 + '@rollup/rollup-darwin-arm64': 4.24.0 + '@rollup/rollup-darwin-x64': 4.24.0 + '@rollup/rollup-linux-arm-gnueabihf': 4.24.0 + '@rollup/rollup-linux-arm-musleabihf': 4.24.0 + '@rollup/rollup-linux-arm64-gnu': 4.24.0 + '@rollup/rollup-linux-arm64-musl': 4.24.0 + '@rollup/rollup-linux-powerpc64le-gnu': 4.24.0 + '@rollup/rollup-linux-riscv64-gnu': 4.24.0 + '@rollup/rollup-linux-s390x-gnu': 4.24.0 + '@rollup/rollup-linux-x64-gnu': 4.24.0 + '@rollup/rollup-linux-x64-musl': 4.24.0 + '@rollup/rollup-win32-arm64-msvc': 4.24.0 + '@rollup/rollup-win32-ia32-msvc': 4.24.0 + '@rollup/rollup-win32-x64-msvc': 4.24.0 fsevents: 2.3.3 dev: true diff --git a/src/entrypoints/array.full.ts b/src/entrypoints/array.full.ts index df968c4b9..507e0e4f1 100644 --- a/src/entrypoints/array.full.ts +++ b/src/entrypoints/array.full.ts @@ -1,5 +1,3 @@ -import 'core-js/actual/array/from' - // Same as loader-globals.ts except includes all additional extension loaders import './all-external-dependencies' import './array' diff --git a/src/entrypoints/array.ts b/src/entrypoints/array.ts index f14c782ef..c2e1b2ae7 100644 --- a/src/entrypoints/array.ts +++ b/src/entrypoints/array.ts @@ -1,4 +1,2 @@ -import 'core-js/features/array/from' - import './external-scripts-loader' import './array.no-external' From 4f663f9138a4dd9b3569d98892536bbe8fe6bd8b Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Wed, 16 Oct 2024 20:53:18 +0100 Subject: [PATCH 14/22] maybe like this --- .babelrc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.babelrc b/.babelrc index 160f79eff..7eb6edeaf 100644 --- a/.babelrc +++ b/.babelrc @@ -3,8 +3,10 @@ [ "@babel/env", { - "useBuiltIns": "usage", - "corejs": 3 + "corejs": 3, + "include": [ + "es.array.from" + ] } ], [ From 0b8e64b13d5d92ffe3a97e2f1c856035c45e0aaf Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Wed, 16 Oct 2024 20:55:55 +0100 Subject: [PATCH 15/22] maybe like this --- .babelrc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.babelrc b/.babelrc index 7eb6edeaf..0f7d624a5 100644 --- a/.babelrc +++ b/.babelrc @@ -4,9 +4,7 @@ "@babel/env", { "corejs": 3, - "include": [ - "es.array.from" - ] + "targets": "> 0.5%, last 2 versions, Firefox ESR, not dead, IE 11" } ], [ From c3e711a4da6bd1ad40bda856083829c35a5fbe3a Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Wed, 16 Oct 2024 21:23:39 +0100 Subject: [PATCH 16/22] maybe like this --- .babelrc | 6 ++- package.json | 6 +-- pnpm-lock.yaml | 107 +++++++++++++++++++++++++++-------------------- rollup.config.js | 12 +++++- 4 files changed, 80 insertions(+), 51 deletions(-) diff --git a/.babelrc b/.babelrc index 0f7d624a5..2ee9c73b7 100644 --- a/.babelrc +++ b/.babelrc @@ -3,8 +3,10 @@ [ "@babel/env", { - "corejs": 3, - "targets": "> 0.5%, last 2 versions, Firefox ESR, not dead, IE 11" + "debug": true, + "corejs": "3.38", + "include": ["es.array.from"], + "targets": ">0.5%, last 2 versions, Firefox ESR, not dead, IE 11" } ], [ diff --git a/package.json b/package.json index efd8af5e2..fec63350b 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "core-js": "^3.38.1", "fflate": "^0.4.8", "preact": "^10.19.3", - "web-vitals": "^4.0.1" + "web-vitals": "^4.2.0" }, "devDependencies": { "@babel/core": "7.18.9", @@ -62,7 +62,7 @@ "@testing-library/jest-dom": "^6.5.0", "@testing-library/preact": "^3.2.4", "@types/eslint": "^8.44.6", - "@types/jest": "^27.5.1", + "@types/jest": "^27.5.2", "@types/node": "^22.5.0", "@types/react-dom": "^18.0.10", "@types/sinon": "^17.0.1", @@ -121,7 +121,7 @@ ] }, "browserslist": [ - "> 0.5%, last 2 versions, Firefox ESR, not dead, IE 11" + ">0.5%, last 2 versions, Firefox ESR, not dead, IE 11" ], "pnpm": { "patchedDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 59628aa67..4fe27e29f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,7 +20,7 @@ dependencies: specifier: ^10.19.3 version: 10.19.3 web-vitals: - specifier: ^4.0.1 + specifier: ^4.2.0 version: 4.2.0 devDependencies: @@ -79,7 +79,7 @@ devDependencies: specifier: ^8.44.6 version: 8.44.6 '@types/jest': - specifier: ^27.5.1 + specifier: ^27.5.2 version: 27.5.2 '@types/node': specifier: ^22.5.0 @@ -209,7 +209,7 @@ devDependencies: version: 9.0.2 testcafe: specifier: 1.19.0 - version: 1.19.0(fp-ts@2.16.2) + version: 1.19.0(fp-ts@2.16.9) testcafe-browser-provider-browserstack: specifier: 1.14.0 version: 1.14.0 @@ -261,6 +261,14 @@ packages: chalk: 2.4.2 dev: true + /@babel/code-frame@7.25.7: + resolution: {integrity: sha512-0xZJFNE5XMpENsgfHYTw8FbX4kv53mFLn2i3XPoq69LyhYSCBJtitaHx9QnsVTrsogI4Z3+HtEfZ2/GFPOtf5g==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/highlight': 7.25.7 + picocolors: 1.1.1 + dev: true + /@babel/compat-data@7.18.8: resolution: {integrity: sha512-HSmX4WZPPK3FUxYp7g2T6EyO8j96HlZJlxmKPSh6KAcqwyDrfx7hKjXpAW/0FhFfTJsR0Yt4lAjLI2coMptIHQ==} engines: {node: '>=6.9.0'} @@ -520,6 +528,12 @@ packages: engines: {node: '>=6.9.0'} dev: true + /@babel/helper-validator-identifier@7.25.7: + resolution: {integrity: sha512-AM6TzwYqGChO45oiuPqwL2t20/HdMC1rTPAesnBCgPCSF1x3oN9MVUwQV2iyz4xqWrctwK5RNC8LV22kaQCNYg==} + engines: {node: '>=6.9.0'} + requiresBuild: true + dev: true + /@babel/helper-validator-option@7.18.6: resolution: {integrity: sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw==} engines: {node: '>=6.9.0'} @@ -567,6 +581,17 @@ packages: js-tokens: 4.0.0 dev: true + /@babel/highlight@7.25.7: + resolution: {integrity: sha512-iYyACpW3iW8Fw+ZybQK+drQre+ns/tKpXbNESfrhNnPLIklLbXr7MYJ6gPEd0iETGLOK+SxMjVvKb/ffmk+FEw==} + engines: {node: '>=6.9.0'} + requiresBuild: true + dependencies: + '@babel/helper-validator-identifier': 7.25.7 + chalk: 2.4.2 + js-tokens: 4.0.0 + picocolors: 1.1.1 + dev: true + /@babel/parser@7.23.0: resolution: {integrity: sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==} engines: {node: '>=6.0.0'} @@ -3956,7 +3981,7 @@ packages: '@types/semver': 7.5.8 '@types/ua-parser-js': 0.7.39 browserslist: 4.23.3 - caniuse-lite: 1.0.30001660 + caniuse-lite: 1.0.30001669 isbot: 3.8.0 object-path: 0.11.8 semver: 7.6.3 @@ -3968,7 +3993,7 @@ packages: engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001580 + caniuse-lite: 1.0.30001669 electron-to-chromium: 1.4.418 node-releases: 2.0.12 update-browserslist-db: 1.0.11(browserslist@4.21.7) @@ -3979,7 +4004,7 @@ packages: engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001660 + caniuse-lite: 1.0.30001669 electron-to-chromium: 1.5.19 node-releases: 2.0.18 update-browserslist-db: 1.1.0(browserslist@4.23.3) @@ -4096,12 +4121,8 @@ packages: engines: {node: '>=10'} dev: true - /caniuse-lite@1.0.30001580: - resolution: {integrity: sha512-mtj5ur2FFPZcCEpXFy8ADXbDACuNFXg6mxVDqp7tqooX6l3zwm+d8EPoeOSIFRDvHs8qu7/SLFOGniULkcH2iA==} - dev: true - - /caniuse-lite@1.0.30001660: - resolution: {integrity: sha512-GacvNTTuATm26qC74pt+ad1fW15mlQ/zuTzzY1ZoIzECTP8HURDfF43kNxPgf7H1jmelCBQTTbBNxdSXOA7Bqg==} + /caniuse-lite@1.0.30001669: + resolution: {integrity: sha512-DlWzFDJqstqtIVx1zeSpIMLjunf5SmwOw0N2Ck/QSQdS8PLS4+9HrLaYei4w8BIAL7IB/UEDu889d8vhCTPA0w==} dev: true /capture-exit@2.0.0: @@ -5092,7 +5113,7 @@ packages: '@tsconfig/node14': 1.0.3 ast-metadata-inferer: 0.8.0 browserslist: 4.21.7 - caniuse-lite: 1.0.30001580 + caniuse-lite: 1.0.30001669 eslint: 8.57.0 find-up: 5.0.0 lodash.memoize: 4.1.2 @@ -5730,8 +5751,8 @@ packages: engines: {node: '>= 0.6'} dev: true - /fp-ts@2.16.2: - resolution: {integrity: sha512-CkqAjnIKFqvo3sCyoBTqgJvF+bHrSik584S9nhTjtBESLx26cbtVMR/T9a6ApChOcSDAaM3JydDmWDUn4EEXng==} + /fp-ts@2.16.9: + resolution: {integrity: sha512-+I2+FnVB+tVaxcYyQkHUq7ZdKScaBlX53A41mxQtpIccsfyv8PzdzP7fzp2AY832T4aoK6UZ5WRX/ebGd8uZuQ==} dev: true /fragment-cache@0.2.1: @@ -6330,7 +6351,7 @@ packages: side-channel: 1.0.4 dev: true - /io-ts-types@0.5.16(fp-ts@2.16.2)(io-ts@2.2.16)(monocle-ts@2.3.13)(newtype-ts@0.3.5): + /io-ts-types@0.5.16(fp-ts@2.16.9)(io-ts@2.2.16)(monocle-ts@2.3.13)(newtype-ts@0.3.5): resolution: {integrity: sha512-h9noYVfY9rlbmKI902SJdnV/06jgiT2chxG6lYDxaYNp88HscPi+SBCtmcU+m0E7WT5QSwt7sIMj93+qu0FEwQ==} peerDependencies: fp-ts: ^2.0.0 @@ -6338,18 +6359,18 @@ packages: monocle-ts: ^2.0.0 newtype-ts: ^0.3.2 dependencies: - fp-ts: 2.16.2 - io-ts: 2.2.16(fp-ts@2.16.2) - monocle-ts: 2.3.13(fp-ts@2.16.2) - newtype-ts: 0.3.5(fp-ts@2.16.2)(monocle-ts@2.3.13) + fp-ts: 2.16.9 + io-ts: 2.2.16(fp-ts@2.16.9) + monocle-ts: 2.3.13(fp-ts@2.16.9) + newtype-ts: 0.3.5(fp-ts@2.16.9)(monocle-ts@2.3.13) dev: true - /io-ts@2.2.16(fp-ts@2.16.2): + /io-ts@2.2.16(fp-ts@2.16.9): resolution: {integrity: sha512-y5TTSa6VP6le0hhmIyN0dqEXkrZeJLeC5KApJq6VLci3UEKF80lZ+KuoUs02RhBxNWlrqSNxzfI7otLX1Euv8Q==} peerDependencies: fp-ts: ^2.5.0 dependencies: - fp-ts: 2.16.2 + fp-ts: 2.16.9 dev: true /ip@1.1.5: @@ -7153,7 +7174,7 @@ packages: resolution: {integrity: sha512-rMyFe1+jnyAAf+NHwTclDz0eAaLkVDdKVHHBFWsBWHnnh5YeJMNWWsv7AbFYXfK3oTqvL7VTWkhNLu1jX24D+g==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@babel/code-frame': 7.23.5 + '@babel/code-frame': 7.25.7 '@jest/types': 27.5.1 '@types/stack-utils': 2.0.1 chalk: 4.1.2 @@ -8152,12 +8173,12 @@ packages: resolution: {integrity: sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==} dev: true - /monocle-ts@2.3.13(fp-ts@2.16.2): + /monocle-ts@2.3.13(fp-ts@2.16.9): resolution: {integrity: sha512-D5Ygd3oulEoAm3KuGO0eeJIrhFf1jlQIoEVV2DYsZUMz42j4tGxgct97Aq68+F8w4w4geEnwFa8HayTS/7lpKQ==} peerDependencies: fp-ts: ^2.5.0 dependencies: - fp-ts: 2.16.2 + fp-ts: 2.16.9 dev: true /ms@2.0.0: @@ -8252,14 +8273,14 @@ packages: engines: {node: '>= 0.6'} dev: true - /newtype-ts@0.3.5(fp-ts@2.16.2)(monocle-ts@2.3.13): + /newtype-ts@0.3.5(fp-ts@2.16.9)(monocle-ts@2.3.13): resolution: {integrity: sha512-v83UEQMlVR75yf1OUdoSFssjitxzjZlqBAjiGQ4WJaML8Jdc68LJ+BaSAXUmKY4bNzp7hygkKLYTsDi14PxI2g==} peerDependencies: fp-ts: ^2.0.0 monocle-ts: ^2.0.0 dependencies: - fp-ts: 2.16.2 - monocle-ts: 2.3.13(fp-ts@2.16.2) + fp-ts: 2.16.9 + monocle-ts: 2.3.13(fp-ts@2.16.9) dev: true /nice-try@1.0.5: @@ -8627,7 +8648,7 @@ packages: resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} engines: {node: '>=8'} dependencies: - '@babel/code-frame': 7.23.5 + '@babel/code-frame': 7.25.7 error-ex: 1.3.2 json-parse-even-better-errors: 2.3.1 lines-and-columns: 1.1.6 @@ -8729,12 +8750,8 @@ packages: resolution: {integrity: sha512-CzFr90qM24ju5f88quFC/6qohjC144rehe5n6DH900lgXmUe86+xCKc10ev56gRKC4/BkHUoG4uSiQgBiIXwDA==} dev: true - /picocolors@1.0.0: - resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} - dev: true - - /picocolors@1.1.0: - resolution: {integrity: sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==} + /picocolors@1.1.1: + resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} dev: true /picomatch@2.3.1: @@ -9344,7 +9361,7 @@ packages: rollup: 4.24.0 typescript: 5.5.4 optionalDependencies: - '@babel/code-frame': 7.23.5 + '@babel/code-frame': 7.25.7 dev: true /rollup-plugin-ts@3.4.5(@babel/core@7.18.9)(@babel/preset-env@7.18.9)(@babel/preset-typescript@7.18.6)(rollup@4.24.0)(typescript@5.5.4): @@ -10172,16 +10189,16 @@ packages: - supports-color dev: true - /testcafe-reporter-dashboard@1.0.0-rc.1(fp-ts@2.16.2): + /testcafe-reporter-dashboard@1.0.0-rc.1(fp-ts@2.16.9): resolution: {integrity: sha512-VWFVo8kmG3OICD1RFdjvDCsEltGcHqTYN9X0aDyXg+0PqioYuAGUKQxqRA31dnG+2/RnaET4VJhhEvcbKzwhTw==} dependencies: es6-promise: 4.2.8 - io-ts: 2.2.16(fp-ts@2.16.2) - io-ts-types: 0.5.16(fp-ts@2.16.2)(io-ts@2.2.16)(monocle-ts@2.3.13)(newtype-ts@0.3.5) + io-ts: 2.2.16(fp-ts@2.16.9) + io-ts-types: 0.5.16(fp-ts@2.16.9)(io-ts@2.2.16)(monocle-ts@2.3.13)(newtype-ts@0.3.5) isomorphic-fetch: 3.0.0 jsonwebtoken: 8.5.1 - monocle-ts: 2.3.13(fp-ts@2.16.2) - newtype-ts: 0.3.5(fp-ts@2.16.2)(monocle-ts@2.3.13) + monocle-ts: 2.3.13(fp-ts@2.16.9) + newtype-ts: 0.3.5(fp-ts@2.16.9)(monocle-ts@2.3.13) semver: 5.7.1 uuid: 3.3.3 transitivePeerDependencies: @@ -10214,7 +10231,7 @@ packages: resolution: {integrity: sha512-6km7D26+KCQGeFlSQ9fVEU7tD8qdioSpqzxU8CCZkd2KzBS0jTFkqaJ54rPaLdd5+wdhgO3+as3LMm4F0EDeYA==} dev: true - /testcafe@1.19.0(fp-ts@2.16.2): + /testcafe@1.19.0(fp-ts@2.16.9): resolution: {integrity: sha512-HH6Z60N51SPw7WcNFhvbrcV1a6Dri1T0npFmE8BvxQEjsYog2whtdxj01yfaYrE87AZK/ep6lOwrqy0P6WmsfQ==} engines: {node: '>=14.0.0'} hasBin: true @@ -10299,7 +10316,7 @@ packages: testcafe-browser-tools: 2.0.23 testcafe-hammerhead: 24.5.19 testcafe-legacy-api: 5.1.4 - testcafe-reporter-dashboard: 1.0.0-rc.1(fp-ts@2.16.2) + testcafe-reporter-dashboard: 1.0.0-rc.1(fp-ts@2.16.9) testcafe-reporter-json: 2.2.0 testcafe-reporter-list: 2.1.0 testcafe-reporter-minimal: 2.1.0 @@ -10715,7 +10732,7 @@ packages: dependencies: browserslist: 4.21.7 escalade: 3.1.1 - picocolors: 1.0.0 + picocolors: 1.1.1 dev: true /update-browserslist-db@1.1.0(browserslist@4.23.3): @@ -10726,7 +10743,7 @@ packages: dependencies: browserslist: 4.23.3 escalade: 3.2.0 - picocolors: 1.1.0 + picocolors: 1.1.1 dev: true /uri-js@4.2.2: diff --git a/rollup.config.js b/rollup.config.js index 3bd5afe8c..e54869d0d 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -15,7 +15,17 @@ const plugins = [ babel({ extensions: ['.js', '.jsx', '.ts', '.tsx'], babelHelpers: 'bundled', - presets: ['@babel/preset-env'], + presets: [ + [ + '@babel/preset-env', + { + debug: true, + corejs: '3.38', + include: ['es.array.from'], + targets: '>0.5%, last 2 versions, Firefox ESR, not dead, IE 11', + }, + ], + ], }), terser({ toplevel: true }), ] From aa7e5b9e87c99f1792e18c2d70a30e2a44f4d857 Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Wed, 16 Oct 2024 22:21:18 +0100 Subject: [PATCH 17/22] maybe like this --- rollup.config.js | 64 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/rollup.config.js b/rollup.config.js index e54869d0d..f1a05eac3 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -21,7 +21,71 @@ const plugins = [ { debug: true, corejs: '3.38', + useBuiltIns: 'usage', include: ['es.array.from'], + exclude: [ + 'es.error.cause', + 'es.array.concat', + 'es.array.find', + 'es.array.find-index', + 'es.array.fill', + 'es.array.filter', + 'es.array.flat-map', + 'es.array.includes', + 'es.array.iterator', + 'es.array.join', + 'es.array.map', + 'es.array.slice', + 'es.array.splice', + 'es.array.sort', + 'es.array.unscopables.flat-map', + 'es.array-buffer.constructor', + 'es.function.name', + 'es.global-this', + 'es.json.stringify', + 'es.map', + 'es.number.constructor', + 'es.number.is-integer', + 'es.number.to-fixed', + 'es.object.assign', + 'es.object.entries', + 'es.object.get-own-property-descriptor', + 'es.object.get-own-property-names', + 'es.object.keys', + 'es.object.to-string', + 'es.object.values', + 'es.promise', + 'es.promise.finally', + 'es.reflect.get', + 'es.reflect.to-string-tag', + 'es.regexp.*', + 'es.set', + 'es.string.ends-with', + 'es.string.includes', + 'es.string.iterator', + 'es.string.link', + 'es.string.match', + 'es.string.match-all', + 'es.string.replace', + 'es.string.starts-with', + 'es.string.split', + 'es.string.sub', + 'es.string.trim', + 'es.symbol', + 'es.symbol.description', + 'es.typed-array.*', + 'es.weak-map', + 'es.weak-set', + 'esnext.typed-array.*', + 'web.atob', + 'web.dom-collections.for-each', + 'web.dom-collections.iterator', + 'web.dom-exception.constructor', + 'web.dom-exception.stack', + 'web.url', + 'web.url-search-params', + 'web.url.to-json', + ], targets: '>0.5%, last 2 versions, Firefox ESR, not dead, IE 11', }, ], From ae4b8348807ac4ad66b30ac6d6d4afbbdae75524 Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Wed, 16 Oct 2024 22:39:22 +0100 Subject: [PATCH 18/22] maybe like this --- rollup.config.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/rollup.config.js b/rollup.config.js index f1a05eac3..ad48c34e9 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -24,7 +24,7 @@ const plugins = [ useBuiltIns: 'usage', include: ['es.array.from'], exclude: [ - 'es.error.cause', + 'es.array.at', 'es.array.concat', 'es.array.find', 'es.array.find-index', @@ -40,12 +40,16 @@ const plugins = [ 'es.array.sort', 'es.array.unscopables.flat-map', 'es.array-buffer.constructor', + 'es.error.cause', 'es.function.name', 'es.global-this', 'es.json.stringify', + 'es.math.trunc', + 'es.math.sign', 'es.map', 'es.number.constructor', 'es.number.is-integer', + 'es.number.is-nan', 'es.number.to-fixed', 'es.object.assign', 'es.object.entries', @@ -66,7 +70,9 @@ const plugins = [ 'es.string.link', 'es.string.match', 'es.string.match-all', + 'es.string.repeat', 'es.string.replace', + 'es.string.search', 'es.string.starts-with', 'es.string.split', 'es.string.sub', @@ -76,12 +82,15 @@ const plugins = [ 'es.typed-array.*', 'es.weak-map', 'es.weak-set', + 'esnext.global-this', + 'esnext.string.match-all', 'esnext.typed-array.*', 'web.atob', 'web.dom-collections.for-each', 'web.dom-collections.iterator', 'web.dom-exception.constructor', 'web.dom-exception.stack', + 'web.dom-exception.to-string-tag', 'web.url', 'web.url-search-params', 'web.url.to-json', From 1a5d4562d3687365f0a5fd81b11fac6e0766d4ab Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Wed, 16 Oct 2024 22:56:54 +0100 Subject: [PATCH 19/22] maybe like this --- .babelrc | 79 ++++++++++++++++++++++++++++++++++++++++++++++-- package.json | 1 + pnpm-lock.yaml | 48 +++++++++++++++++++++++++++++ rollup.config.js | 2 ++ 4 files changed, 128 insertions(+), 2 deletions(-) diff --git a/.babelrc b/.babelrc index 2ee9c73b7..e2dc58a93 100644 --- a/.babelrc +++ b/.babelrc @@ -1,11 +1,86 @@ { "presets": [ [ - "@babel/env", + "@babel/preset-env", { "debug": true, "corejs": "3.38", - "include": ["es.array.from"], + "useBuiltIns": "usage", + "include": [ + "es.array.from" + ], + "exclude": [ + "es.array.at", + "es.array.concat", + "es.array.find", + "es.array.find-index", + "es.array.fill", + "es.array.filter", + "es.array.flat-map", + "es.array.includes", + "es.array.iterator", + "es.array.join", + "es.array.map", + "es.array.slice", + "es.array.splice", + "es.array.sort", + "es.array.unscopables.flat-map", + "es.array-buffer.constructor", + "es.error.cause", + "es.function.name", + "es.global-this", + "es.json.stringify", + "es.math.trunc", + "es.math.sign", + "es.map", + "es.number.constructor", + "es.number.is-integer", + "es.number.is-nan", + "es.number.to-fixed", + "es.object.assign", + "es.object.entries", + "es.object.get-own-property-descriptor", + "es.object.get-own-property-names", + "es.object.keys", + "es.object.to-string", + "es.object.values", + "es.promise", + "es.promise.finally", + "es.reflect.get", + "es.reflect.to-string-tag", + "es.regexp.*", + "es.set", + "es.string.ends-with", + "es.string.includes", + "es.string.iterator", + "es.string.link", + "es.string.match", + "es.string.match-all", + "es.string.repeat", + "es.string.replace", + "es.string.search", + "es.string.starts-with", + "es.string.split", + "es.string.sub", + "es.string.trim", + "es.symbol", + "es.symbol.description", + "es.typed-array.*", + "es.weak-map", + "es.weak-set", + "esnext.global-this", + "esnext.string.match-all", + "esnext.typed-array.*", + "web.atob", + "web.dom-collections.for-each", + "web.dom-collections.iterator", + "web.dom-exception.constructor", + "web.dom-exception.stack", + "web.dom-exception.to-string-tag", + "web.url", + "web.url-search-params", + "web.url.to-json" + ], "targets": ">0.5%, last 2 versions, Firefox ESR, not dead, IE 11" } ], diff --git a/package.json b/package.json index fec63350b..df196a3f9 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ "@cypress/skip-test": "^2.6.1", "@jest/globals": "^27.5.1", "@rollup/plugin-babel": "^6.0.4", + "@rollup/plugin-commonjs": "^28.0.1", "@rollup/plugin-json": "^6.1.0", "@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-terser": "^0.4.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4fe27e29f..aa8173210 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -48,6 +48,9 @@ devDependencies: '@rollup/plugin-babel': specifier: ^6.0.4 version: 6.0.4(@babel/core@7.18.9)(rollup@4.24.0) + '@rollup/plugin-commonjs': + specifier: ^28.0.1 + version: 28.0.1(rollup@4.24.0) '@rollup/plugin-json': specifier: ^6.1.0 version: 6.1.0(rollup@4.24.0) @@ -2550,6 +2553,25 @@ packages: rollup: 4.24.0 dev: true + /@rollup/plugin-commonjs@28.0.1(rollup@4.24.0): + resolution: {integrity: sha512-+tNWdlWKbpB3WgBN7ijjYkq9X5uhjmcvyjEght4NmH5fAU++zfQzAJ6wumLS+dNcvwEZhKx2Z+skY8m7v0wGSA==} + engines: {node: '>=16.0.0 || 14 >= 14.17'} + peerDependencies: + rollup: ^2.68.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + dependencies: + '@rollup/pluginutils': 5.1.0(rollup@4.24.0) + commondir: 1.0.1 + estree-walker: 2.0.2 + fdir: 6.4.2(picomatch@4.0.2) + is-reference: 1.2.1 + magic-string: 0.30.5 + picomatch: 4.0.2 + rollup: 4.24.0 + dev: true + /@rollup/plugin-json@6.1.0(rollup@4.24.0): resolution: {integrity: sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA==} engines: {node: '>=14.0.0'} @@ -4393,6 +4415,10 @@ packages: engines: {node: '>=4.0.0'} dev: true + /commondir@1.0.1: + resolution: {integrity: sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==} + dev: true + /compare-versions@6.1.0: resolution: {integrity: sha512-LNZQXhqUvqUTotpZ00qLSaify3b4VFD588aRr8MKFw4CMUr98ytzCW5wDH5qx/DEY5kCDXcbcRuCqL0szEf2tg==} dev: true @@ -5605,6 +5631,17 @@ packages: pend: 1.2.0 dev: true + /fdir@6.4.2(picomatch@4.0.2): + resolution: {integrity: sha512-KnhMXsKSPZlAhp7+IjUkRZKPb4fUyccpDrdFXbi4QL1qkmFh9kVY09Yox+n4MaOb3lHZ1Tv829C3oaaXoMYPDQ==} + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + dependencies: + picomatch: 4.0.2 + dev: true + /fflate@0.4.8: resolution: {integrity: sha512-FJqqoDBR00Mdj9ppamLa/Y7vxm+PRmNWA67N846RvsoYVMKB4q3y/de5PA7gUmRMYK/8CMz2GDZQmCRN1wBcWA==} @@ -6693,6 +6730,12 @@ packages: resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==} dev: true + /is-reference@1.2.1: + resolution: {integrity: sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==} + dependencies: + '@types/estree': 1.0.6 + dev: true + /is-regex@1.1.4: resolution: {integrity: sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==} engines: {node: '>= 0.4'} @@ -8759,6 +8802,11 @@ packages: engines: {node: '>=8.6'} dev: true + /picomatch@4.0.2: + resolution: {integrity: sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==} + engines: {node: '>=12'} + dev: true + /pify@2.3.0: resolution: {integrity: sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==} engines: {node: '>=0.10.0'} diff --git a/rollup.config.js b/rollup.config.js index ad48c34e9..ab1264bef 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -7,10 +7,12 @@ import terser from '@rollup/plugin-terser' import { visualizer } from 'rollup-plugin-visualizer' import fs from 'fs' import path from 'path' +import commonjs from '@rollup/plugin-commonjs' const plugins = [ json(), resolve({ browser: true }), + commonjs(), typescript({ sourceMap: true }), babel({ extensions: ['.js', '.jsx', '.ts', '.tsx'], From 5eaa5f14a205b94f8f1c2d3050f18d2ec81dabcc Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Thu, 17 Oct 2024 13:11:16 +0100 Subject: [PATCH 20/22] fix --- pnpm-lock.yaml | 243 +++++++++---------------------------------------- 1 file changed, 41 insertions(+), 202 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index aa8173210..fe1b50511 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -30,6 +30,9 @@ devDependencies: '@babel/plugin-syntax-decorators': specifier: ^7.23.3 version: 7.23.3(@babel/core@7.18.9) + '@babel/plugin-transform-nullish-coalescing-operator': + specifier: ^7.25.8 + version: 7.25.8(@babel/core@7.18.9) '@babel/plugin-transform-react-jsx': specifier: ^7.23.4 version: 7.23.4(@babel/core@7.18.9) @@ -55,14 +58,14 @@ devDependencies: specifier: ^6.1.0 version: 6.1.0(rollup@4.24.0) '@rollup/plugin-node-resolve': - specifier: ^15.2.3 - version: 15.2.3(rollup@4.24.0) + specifier: ^15.3.0 + version: 15.3.0(rollup@4.24.0) '@rollup/plugin-terser': specifier: ^0.4.4 version: 0.4.4(rollup@4.24.0) '@rollup/plugin-typescript': - specifier: ^11.1.6 - version: 11.1.6(rollup@4.24.0)(tslib@2.5.0)(typescript@5.5.4) + specifier: ^12.1.1 + version: 12.1.1(rollup@4.24.0)(tslib@2.5.0)(typescript@5.5.4) '@rrweb/types': specifier: 2.0.0-alpha.13 version: 2.0.0-alpha.13 @@ -193,11 +196,8 @@ devDependencies: specifier: ^4.24.0 version: 4.24.0 rollup-plugin-dts: - specifier: ^6.1.0 - version: 6.1.0(rollup@4.24.0)(typescript@5.5.4) - rollup-plugin-ts: - specifier: ^3.4.5 - version: 3.4.5(@babel/core@7.18.9)(@babel/preset-env@7.18.9)(@babel/preset-typescript@7.18.6)(rollup@4.24.0)(typescript@5.5.4) + specifier: ^6.1.1 + version: 6.1.1(rollup@4.24.0)(typescript@5.5.4) rollup-plugin-visualizer: specifier: ^5.12.0 version: 5.12.0(rollup@4.24.0) @@ -472,6 +472,11 @@ packages: engines: {node: '>=6.9.0'} dev: true + /@babel/helper-plugin-utils@7.25.7: + resolution: {integrity: sha512-eaPZai0PiqCi09pPs3pAFfl/zYgGaE6IdXtYvmf0qlcDTd3WCtO7JWCcRd64e0EQrcYgiHibEZnOGsSY4QSgaw==} + engines: {node: '>=6.9.0'} + dev: true + /@babel/helper-remap-async-to-generator@7.18.9(@babel/core@7.18.9): resolution: {integrity: sha512-dI7q50YKd8BAv3VEfgg7PS7yD3Rtbi2J1XMXaalXO0W0164hYLnh8zpjRS0mte9MfVp/tltvr/cfdXPvJr1opA==} engines: {node: '>=6.9.0'} @@ -1279,6 +1284,16 @@ packages: '@babel/helper-plugin-utils': 7.22.5 dev: true + /@babel/plugin-transform-nullish-coalescing-operator@7.25.8(@babel/core@7.18.9): + resolution: {integrity: sha512-Z7WJJWdQc8yCWgAmjI3hyC+5PXIubH9yRKzkl9ZEG647O9szl9zvmKLzpbItlijBnVhTUf1cpyWBsZ3+2wjWPQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + dependencies: + '@babel/core': 7.18.9 + '@babel/helper-plugin-utils': 7.25.7 + dev: true + /@babel/plugin-transform-object-super@7.18.6(@babel/core@7.18.9): resolution: {integrity: sha512-uvGz6zk+pZoS1aTZrOvrbj6Pp/kK2mp45t2B+bTDre2UgsZZ8EZLSJtUg7m/no0zOJUWgFONpB7Zv9W2tSaFlA==} engines: {node: '>=6.9.0'} @@ -2458,6 +2473,10 @@ packages: resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} dev: true + /@jridgewell/sourcemap-codec@1.5.0: + resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==} + dev: true + /@jridgewell/trace-mapping@0.3.20: resolution: {integrity: sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==} dependencies: @@ -2476,10 +2495,6 @@ packages: resolution: {integrity: sha512-jzPrheqEtrnUWWNUS8SFVbQAnoO6rOXetkjiJyzP92UM+BNcyExLD0Qikv9z6TU9D6A9rbXkh3pSmZ5G88d6ew==} dev: true - /@mdn/browser-compat-data@5.5.51: - resolution: {integrity: sha512-17L3+/oqX+sgSyucNKSipri1LkI/d8pwPQI4Vv2ejRVZLZr1WGxcEGBnglqFhdlislQBceJiHAdQnWEE+YJE3A==} - dev: true - /@miherlosev/esm@3.2.26: resolution: {integrity: sha512-TaW4jTGVE1/ln2VGFChnheMh589QCAZy1MVnLvjjSzZ4pEAa4WYAWPwFkDVZbSdPQdLfZy7LuTyZjWRkhX9/Gg==} engines: {node: '>=6'} @@ -2585,8 +2600,8 @@ packages: rollup: 4.24.0 dev: true - /@rollup/plugin-node-resolve@15.2.3(rollup@4.24.0): - resolution: {integrity: sha512-j/lym8nf5E21LwBT4Df1VD6hRO2L2iwUeUmP7litikRsVp1H6NWx20NEp0Y7su+7XGc476GnXXc4kFeZNGmaSQ==} + /@rollup/plugin-node-resolve@15.3.0(rollup@4.24.0): + resolution: {integrity: sha512-9eO5McEICxMzJpDW9OnMYSv4Sta3hmt7VtBFz5zR9273suNOydOyq/FrGeGy+KsTRFm8w0SLVhzig2ILFT63Ag==} engines: {node: '>=14.0.0'} peerDependencies: rollup: ^2.78.0||^3.0.0||^4.0.0 @@ -2597,7 +2612,6 @@ packages: '@rollup/pluginutils': 5.1.0(rollup@4.24.0) '@types/resolve': 1.20.2 deepmerge: 4.2.2 - is-builtin-module: 3.2.1 is-module: 1.0.0 resolve: 1.22.8 rollup: 4.24.0 @@ -2618,8 +2632,8 @@ packages: terser: 5.27.0 dev: true - /@rollup/plugin-typescript@11.1.6(rollup@4.24.0)(tslib@2.5.0)(typescript@5.5.4): - resolution: {integrity: sha512-R92yOmIACgYdJ7dJ97p4K69I8gg6IEHt8M7dUBxN3W6nrO8uUxX5ixl0yU/N3aZTi8WhPuICvOHXQvF6FaykAA==} + /@rollup/plugin-typescript@12.1.1(rollup@4.24.0)(tslib@2.5.0)(typescript@5.5.4): + resolution: {integrity: sha512-t7O653DpfB5MbFrqPe/VcKFFkvRuFNp9qId3xq4Eth5xlyymzxNpye2z8Hrl0RIMuXTSr5GGcFpkdlMeacUiFQ==} engines: {node: '>=14.0.0'} peerDependencies: rollup: ^2.14.0||^3.0.0||^4.0.0 @@ -3049,20 +3063,12 @@ packages: resolution: {integrity: sha512-i1KGxqcvJaLQali+WuypQnXwcplhtNtjs66eNsZpp2P2FL/trJJxx/VWsM0YCL2iMoIJrbXje48lvIQAQ4p2ZA==} dev: true - /@types/node@17.0.45: - resolution: {integrity: sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==} - dev: true - /@types/node@22.5.0: resolution: {integrity: sha512-DkFrJOe+rfdHTqqMg0bSNlGlQ85hSoh2TPzZyhHsXnMtligRWpxUySiyw8FY14ITt24HVCiQPWxS3KO/QlGmWg==} dependencies: undici-types: 6.19.8 dev: true - /@types/object-path@0.11.4: - resolution: {integrity: sha512-4tgJ1Z3elF/tOMpA8JLVuR9spt9Ynsf7+JjqsQ2IqtiPJtcLoHoXcT6qU4E10cPFqyXX5HDm9QwIzZhBSkLxsw==} - dev: true - /@types/parse-json@4.0.0: resolution: {integrity: sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==} dev: true @@ -3097,10 +3103,6 @@ packages: resolution: {integrity: sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==} dev: true - /@types/semver@7.5.8: - resolution: {integrity: sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==} - dev: true - /@types/set-cookie-parser@2.4.2: resolution: {integrity: sha512-fBZgytwhYAUkj/jC/FAV4RQ5EerRup1YQsXQCh8rZfiHkc4UahC192oH0smGwsXol3cL3A5oETuAHeQHmhXM4w==} dependencies: @@ -3129,10 +3131,6 @@ packages: resolution: {integrity: sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==} dev: true - /@types/ua-parser-js@0.7.39: - resolution: {integrity: sha512-P/oDfpofrdtF5xw433SPALpdSchtJmY7nsJItf8h3KXqOslkbySh8zq4dSWXH2oTjRvJ5PczVEoCZPow6GicLg==} - dev: true - /@types/web@0.0.154: resolution: {integrity: sha512-Tc10Nkpbb8AgM3iGnrvpKVb6x8pzrZpMCPqMJe8htXoEdNDKojEevNAkCjxkjCLZF2p1ZB+gknAwdbkypxwxKg==} dev: true @@ -3297,11 +3295,6 @@ packages: resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} dev: true - /@wessberg/stringutil@1.0.19: - resolution: {integrity: sha512-9AZHVXWlpN8Cn9k5BC/O0Dzb9E9xfEMXzYrNunwvkUTvuK7xgQPVRZpLo+jWCOZ5r8oBa8NIrHuPEu1hzbb6bg==} - engines: {node: '>=8.0.0'} - dev: true - /@xmldom/xmldom@0.8.7: resolution: {integrity: sha512-sI1Ly2cODlWStkINzqGrZ8K6n+MTSbAeQnAipGyL+KZCXuHaRlj2gyyy8B/9MvsFFqN7XHryQnB2QwhzvJXovg==} engines: {node: '>=10.0.0'} @@ -3416,11 +3409,6 @@ packages: engines: {node: '>=6'} dev: true - /ansi-colors@4.1.3: - resolution: {integrity: sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==} - engines: {node: '>=6'} - dev: true - /ansi-escapes@4.3.2: resolution: {integrity: sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==} engines: {node: '>=8'} @@ -3994,22 +3982,6 @@ packages: resolution: {integrity: sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==} dev: true - /browserslist-generator@2.3.0: - resolution: {integrity: sha512-NEvS2dNlBKfSL3qDUTM3NkJMfjMAPEjvEGnhMZKql6ZNzJ8asqFpmuTizwOpRQeYA0/VktmOXa+mFPv8nvcIGw==} - engines: {node: '>=16.15.1', npm: '>=7.0.0', pnpm: '>=3.2.0', yarn: '>=1.13'} - dependencies: - '@mdn/browser-compat-data': 5.5.51 - '@types/object-path': 0.11.4 - '@types/semver': 7.5.8 - '@types/ua-parser-js': 0.7.39 - browserslist: 4.23.3 - caniuse-lite: 1.0.30001669 - isbot: 3.8.0 - object-path: 0.11.8 - semver: 7.6.3 - ua-parser-js: 1.0.38 - dev: true - /browserslist@4.21.7: resolution: {integrity: sha512-BauCXrQ7I2ftSqd2mvKHGo85XR0u7Ru3C/Hxsy/0TkfCtjrmAbPdzLGasmoiBxplpDXlPvdjX9u7srIMfgasNA==} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} @@ -4021,17 +3993,6 @@ packages: update-browserslist-db: 1.0.11(browserslist@4.21.7) dev: true - /browserslist@4.23.3: - resolution: {integrity: sha512-btwCFJVjI4YWDNfau8RhZ+B1Q/VLoUITrm3RlP6y1tYGWIOa+InuYiRGXUBXo8nA1qKmHMyLB/iVQg5TT4eFoA==} - engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} - hasBin: true - dependencies: - caniuse-lite: 1.0.30001669 - electron-to-chromium: 1.5.19 - node-releases: 2.0.18 - update-browserslist-db: 1.1.0(browserslist@4.23.3) - dev: true - /browserstack-local@1.5.1: resolution: {integrity: sha512-T/wxyWDzvBHbDvl7fZKpFU7mYze6nrUkBhNy+d+8bXBqgQX10HTYvajIGO0wb49oGSLCPM0CMZTV/s7e6LF0sA==} dependencies: @@ -4074,11 +4035,6 @@ packages: ieee754: 1.2.1 dev: true - /builtin-modules@3.3.0: - resolution: {integrity: sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==} - engines: {node: '>=6'} - dev: true - /bytes@3.1.2: resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==} engines: {node: '>= 0.8'} @@ -4423,16 +4379,6 @@ packages: resolution: {integrity: sha512-LNZQXhqUvqUTotpZ00qLSaify3b4VFD588aRr8MKFw4CMUr98ytzCW5wDH5qx/DEY5kCDXcbcRuCqL0szEf2tg==} dev: true - /compatfactory@3.0.0(typescript@5.5.4): - resolution: {integrity: sha512-WD5kF7koPwVoyKL8p0LlrmIZtilrD46sQStyzzxzTFinMKN2Dxk1hN+sddLSQU1mGIZvQfU8c+ONSghvvM40jg==} - engines: {node: '>=14.9.0'} - peerDependencies: - typescript: '>=3.x || >= 4.x || >= 5.x' - dependencies: - helpertypes: 0.0.19 - typescript: 5.5.4 - dev: true - /component-emitter@1.3.0: resolution: {integrity: sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==} dev: true @@ -4534,13 +4480,6 @@ packages: which: 2.0.2 dev: true - /crosspath@2.0.0: - resolution: {integrity: sha512-ju88BYCQ2uvjO2bR+SsgLSTwTSctU+6Vp2ePbKPgSCZyy4MWZxYsT738DlKVRE5utUjobjPRm1MkTYKJxCmpTA==} - engines: {node: '>=14.9.0'} - dependencies: - '@types/node': 17.0.45 - dev: true - /crypto-md5@1.0.0: resolution: {integrity: sha512-65Mtei8+EkSIK+5Ie4gpWXoJ/5bgpqPXFknHHXAyhDqKsEAAzUslGd8mOeawbfcuQ8fADNKcF4xQA3fqlZJ8Ig==} engines: {iojs: '>=1.0.0', node: '>=0.5.2'} @@ -4951,10 +4890,6 @@ packages: resolution: {integrity: sha512-1KnpDTS9onwAfMzW50LcpNtyOkMyjd/OLoD2Kx/DDITZqgNYixY71XNszPHNxyQQ/Brh+FDcUnf4BaM041sdWg==} dev: true - /electron-to-chromium@1.5.19: - resolution: {integrity: sha512-kpLJJi3zxTR1U828P+LIUDZ5ohixyo68/IcYOHLqnbTPr/wdgn4i1ECvmALN9E16JPA6cvCG5UG79gVwVdEK5w==} - dev: true - /elegant-spinner@1.0.1: resolution: {integrity: sha512-B+ZM+RXvRqQaAmkMlO/oSe5nMUOaUnyfGYCEHoR8wrXsZR2mA0XVibsxV1bvTwxdRWah1PkQqso2EzhILGHtEQ==} engines: {node: '>=0.10.0'} @@ -5083,11 +5018,6 @@ packages: engines: {node: '>=6'} dev: true - /escalade@3.2.0: - resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} - engines: {node: '>=6'} - dev: true - /escape-html@1.0.3: resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==} dev: true @@ -6169,11 +6099,6 @@ packages: resolution: {integrity: sha512-tUCGvt191vNSQgttSyJoibR+VO+I6+iCHIUdhzEMJKE+EAL8BwCN7fUOZlY4ofOelNHsK+gEjxB/B+9N3EWtdA==} dev: true - /helpertypes@0.0.19: - resolution: {integrity: sha512-J00e55zffgi3yVnUp0UdbMztNkr2PnizEkOe9URNohnrNhW5X0QpegkuLpOmFQInpi93Nb8MCjQRHAiCDF42NQ==} - engines: {node: '>=10.0.0'} - dev: true - /highlight-es@1.0.3: resolution: {integrity: sha512-s/SIX6yp/5S1p8aC/NRDC1fwEb+myGIfp8/TzZz0rtAv8fzsdX7vGl3Q1TrXCsczFq8DI3CBFBCySPClfBSdbg==} dependencies: @@ -6480,13 +6405,6 @@ packages: resolution: {integrity: sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==} dev: true - /is-builtin-module@3.2.1: - resolution: {integrity: sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==} - engines: {node: '>=6'} - dependencies: - builtin-modules: 3.3.0 - dev: true - /is-callable@1.2.7: resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} engines: {node: '>= 0.4'} @@ -6852,11 +6770,6 @@ packages: resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==} dev: true - /isbot@3.8.0: - resolution: {integrity: sha512-vne1mzQUTR+qsMLeCBL9+/tgnDXRyc2pygLGl/WsgA+EZKIiB5Ehu0CiVTHIIk30zhJ24uGz4M5Ppse37aR0Hg==} - engines: {node: '>=12'} - dev: true - /isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} dev: true @@ -8024,6 +7937,12 @@ packages: hasBin: true dev: true + /magic-string@0.30.12: + resolution: {integrity: sha512-Ea8I3sQMVXr8JhN4z+H/d8zwo+tYDgHE9+5G4Wnrwhs0gaK9fXTKx0Tw5Xwsd/bCPTTZNRAdpyzvoeORe9LYpw==} + dependencies: + '@jridgewell/sourcemap-codec': 1.5.0 + dev: true + /magic-string@0.30.5: resolution: {integrity: sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==} engines: {node: '>=12'} @@ -8360,10 +8279,6 @@ packages: resolution: {integrity: sha512-QzsYKWhXTWx8h1kIvqfnC++o0pEmpRQA/aenALsL2F4pqNVr7YzcdMlDij5WBnwftRbJCNJL/O7zdKaxKPHqgQ==} dev: true - /node-releases@2.0.18: - resolution: {integrity: sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==} - dev: true - /normalize-path@2.1.1: resolution: {integrity: sha512-3pKJwH184Xo/lnH6oyP1q2pMd7HcypqqmRs91/6/i2CGtWwIKGCkOOMTm/zXbgTEWHw1uNpNi/igc3ePOYHb6w==} engines: {node: '>=0.10.0'} @@ -8429,11 +8344,6 @@ packages: engines: {node: '>= 0.4'} dev: true - /object-path@0.11.8: - resolution: {integrity: sha512-YJjNZrlXJFM42wTBn6zgOJVar9KFJvzx6sTWDte8sWZF//cnjl0BxHNpfZx+ZffXX63A9q0b1zsFiBX4g4X5KA==} - engines: {node: '>= 10.12.0'} - dev: true - /object-visit@1.0.1: resolution: {integrity: sha512-GBaMwwAVK9qbQN3Scdo0OyvgPW7l3lnaVMj84uTOZlswkX0KpF6fyDBJhtTthf7pymztoN36/KEr1DyhF96zEA==} engines: {node: '>=0.10.0'} @@ -9398,66 +9308,20 @@ packages: glob: 7.1.6 dev: true - /rollup-plugin-dts@6.1.0(rollup@4.24.0)(typescript@5.5.4): - resolution: {integrity: sha512-ijSCPICkRMDKDLBK9torss07+8dl9UpY9z1N/zTeA1cIqdzMlpkV3MOOC7zukyvQfDyxa1s3Dl2+DeiP/G6DOw==} + /rollup-plugin-dts@6.1.1(rollup@4.24.0)(typescript@5.5.4): + resolution: {integrity: sha512-aSHRcJ6KG2IHIioYlvAOcEq6U99sVtqDDKVhnwt70rW6tsz3tv5OSjEiWcgzfsHdLyGXZ/3b/7b/+Za3Y6r1XA==} engines: {node: '>=16'} peerDependencies: rollup: ^3.29.4 || ^4 typescript: ^4.5 || ^5.0 dependencies: - magic-string: 0.30.5 + magic-string: 0.30.12 rollup: 4.24.0 typescript: 5.5.4 optionalDependencies: '@babel/code-frame': 7.25.7 dev: true - /rollup-plugin-ts@3.4.5(@babel/core@7.18.9)(@babel/preset-env@7.18.9)(@babel/preset-typescript@7.18.6)(rollup@4.24.0)(typescript@5.5.4): - resolution: {integrity: sha512-9iCstRJpEZXSRQuXitlSZAzcGlrqTbJg1pE4CMbEi6xYldxVncdPyzA2I+j6vnh73wBymZckerS+Q/iEE/M3Ow==} - engines: {node: '>=16.15.1', npm: '>=7.0.0', pnpm: '>=3.2.0', yarn: '>=1.13'} - peerDependencies: - '@babel/core': '>=7.x' - '@babel/plugin-transform-runtime': '>=7.x' - '@babel/preset-env': '>=7.x' - '@babel/preset-typescript': '>=7.x' - '@babel/runtime': '>=7.x' - '@swc/core': '>=1.x' - '@swc/helpers': '>=0.2' - rollup: '>=1.x || >=2.x || >=3.x' - typescript: '>=3.2.x || >= 4.x || >= 5.x' - peerDependenciesMeta: - '@babel/core': - optional: true - '@babel/plugin-transform-runtime': - optional: true - '@babel/preset-env': - optional: true - '@babel/preset-typescript': - optional: true - '@babel/runtime': - optional: true - '@swc/core': - optional: true - '@swc/helpers': - optional: true - dependencies: - '@babel/core': 7.18.9 - '@babel/preset-env': 7.18.9(@babel/core@7.18.9) - '@babel/preset-typescript': 7.18.6(@babel/core@7.18.9) - '@rollup/pluginutils': 5.1.0(rollup@4.24.0) - '@wessberg/stringutil': 1.0.19 - ansi-colors: 4.1.3 - browserslist: 4.23.3 - browserslist-generator: 2.3.0 - compatfactory: 3.0.0(typescript@5.5.4) - crosspath: 2.0.0 - magic-string: 0.30.5 - rollup: 4.24.0 - ts-clone-node: 3.0.0(typescript@5.5.4) - tslib: 2.7.0 - typescript: 5.5.4 - dev: true - /rollup-plugin-visualizer@5.12.0(rollup@4.24.0): resolution: {integrity: sha512-8/NU9jXcHRs7Nnj07PF2o4gjxmm9lXIrZ8r175bT9dK8qoLlvKTwRMArRCMgpMGlq8CTLugRvEmyMeMXIU2pNQ==} engines: {node: '>=14'} @@ -10557,16 +10421,6 @@ packages: typescript: 5.5.4 dev: true - /ts-clone-node@3.0.0(typescript@5.5.4): - resolution: {integrity: sha512-egavvyHbIoelkgh1IC2agNB1uMNjB8VJgh0g/cn0bg2XXTcrtjrGMzEk4OD3Fi2hocICjP3vMa56nkzIzq0FRg==} - engines: {node: '>=14.9.0'} - peerDependencies: - typescript: ^3.x || ^4.x || ^5.x - dependencies: - compatfactory: 3.0.0(typescript@5.5.4) - typescript: 5.5.4 - dev: true - /ts-node@10.9.2(@types/node@22.5.0)(typescript@5.5.4): resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} hasBin: true @@ -10680,10 +10534,6 @@ packages: hasBin: true dev: true - /ua-parser-js@1.0.38: - resolution: {integrity: sha512-Aq5ppTOfvrCMgAPneW1HfWj66Xi7XL+/mIy996R1/CLS/rcyJQm6QZdsKrUeivDFQ+Oc9Wyuwor8Ze8peEoUoQ==} - dev: true - /unbox-primitive@1.0.2: resolution: {integrity: sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==} dependencies: @@ -10783,17 +10633,6 @@ packages: picocolors: 1.1.1 dev: true - /update-browserslist-db@1.1.0(browserslist@4.23.3): - resolution: {integrity: sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ==} - hasBin: true - peerDependencies: - browserslist: '>= 4.21.0' - dependencies: - browserslist: 4.23.3 - escalade: 3.2.0 - picocolors: 1.1.1 - dev: true - /uri-js@4.2.2: resolution: {integrity: sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==} dependencies: From 33dcc0e85986028a9f841bf3e72847047df7861b Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Thu, 17 Oct 2024 13:37:39 +0100 Subject: [PATCH 21/22] wat --- .babelrc | 33 +++++++++++++++++++++--------- src/__tests__/posthog-core.test.ts | 14 +++++++++---- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/.babelrc b/.babelrc index 7fe9a63a1..b61790df4 100644 --- a/.babelrc +++ b/.babelrc @@ -1,13 +1,26 @@ { - "presets": ["@babel/env", ["@babel/typescript", { "jsxPragma": "h" }]], - "plugins": [ - "@babel/plugin-transform-nullish-coalescing-operator", - [ - "@babel/transform-react-jsx", - { - "runtime": "automatic", - "importSource": "preact" - } - ] + "presets": [ + [ + "@babel/env", + { + "targets": ">0.5%, last 2 versions, Firefox ESR, not dead" + } + ], + [ + "@babel/typescript", + { + "jsxPragma": "h" + } ] + ], + "plugins": [ + "@babel/plugin-transform-nullish-coalescing-operator", + [ + "@babel/transform-react-jsx", + { + "runtime": "automatic", + "importSource": "preact" + } + ] + ] } diff --git a/src/__tests__/posthog-core.test.ts b/src/__tests__/posthog-core.test.ts index 7b8047c56..69f7154ec 100644 --- a/src/__tests__/posthog-core.test.ts +++ b/src/__tests__/posthog-core.test.ts @@ -1,9 +1,9 @@ -import { defaultPostHog } from './helpers/posthog-instance' +const mockReferrerGetter = jest.fn() +const mockURLGetter = jest.fn() + import type { PostHogConfig } from '../types' import { uuidv7 } from '../uuidv7' -const mockReferrerGetter = jest.fn() -const mockURLGetter = jest.fn() jest.mock('../utils/globals', () => { const orig = jest.requireActual('../utils/globals') return { @@ -29,7 +29,13 @@ jest.mock('../utils/globals', () => { }) describe('posthog core', () => { - beforeEach(() => { + let defaultPostHog: typeof import('./helpers/posthog-instance').defaultPostHog + beforeEach(async () => { + // delay the import to ensure the mocks are set up before being accessed + // @ts-expect-error - allow dynamic imports + const posthogModule = await import('./helpers/posthog-instance') + defaultPostHog = posthogModule.defaultPostHog + mockReferrerGetter.mockReturnValue('https://referrer.com') mockURLGetter.mockReturnValue('https://example.com') console.error = jest.fn() From f2f0f9f254359059419fcefde4b6d0d8e01425f0 Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Thu, 17 Oct 2024 14:34:02 +0100 Subject: [PATCH 22/22] arbitrary timeouts --- .github/workflows/testcafe.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/testcafe.yml b/.github/workflows/testcafe.yml index fb90e63c8..1e4ead8b1 100644 --- a/.github/workflows/testcafe.yml +++ b/.github/workflows/testcafe.yml @@ -54,6 +54,7 @@ jobs: run: pnpm build-rollup - name: Run ${{ matrix.name }} test + timeout-minutes: 30 env: BRANCH_NAME: ${{ github.head_ref || github.ref_name }} RUN_ID: ${{ github.run_id }} @@ -61,4 +62,5 @@ jobs: run: pnpm testcafe ${{ matrix.browser }} --stop-on-first-fail - name: Check ${{ matrix.name }} events + timeout-minutes: 15 run: pnpm check-testcafe-results