0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-21 13:39:22 +01:00

Automatically add polyfills based on browser requirements (#5086)

* Latest browser’s versions and statistics

* Browserlists - Use "defaults" browser support

* Enable Babel polyfills based on usage

* Revert "Polyfill Object.fromEntries (for Safari <= 12) (#4999)"

This reverts commit ad63386a69.

* Different browser support for dev/prod for build performance
This commit is contained in:
Lleo Harress 2021-07-13 09:01:04 +01:00 committed by GitHub
parent ca21d6a32d
commit 3b21790027
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 26 deletions

View File

@ -6,5 +6,14 @@ module.exports = {
'@babel/plugin-proposal-class-properties',
['babel-plugin-kea', { path: './frontend/src' }],
],
presets: ['@babel/preset-env', '@babel/typescript'],
presets: [
[
'@babel/preset-env',
{
useBuiltIns: 'usage',
corejs: 3,
},
],
'@babel/typescript',
],
}

View File

@ -1,12 +1,10 @@
import React, { useEffect, useRef } from 'react'
import { responsiveMap } from 'antd/lib/_util/responsiveObserve'
import { ANTD_EXPAND_BUTTON_WIDTH } from '../components/ResizableTable'
import fromEntries from 'object.fromentries'
const BREAKPOINT_MAP = fromEntries(
const BREAKPOINT_MAP = Object.fromEntries(
Object.entries(responsiveMap).map(([key, cssStatement]) => [key, parsePixelValue(cssStatement)])
)
const BREAKPOINT_VALUES = Object.values(BREAKPOINT_MAP).sort((a, b) => a - b)
export function getMinColumnWidth(breakpoint: number): number {

View File

@ -7,7 +7,6 @@ import { sessionsTableLogicType } from './sessionsTableLogicType'
import { EventType, PropertyFilter, SessionsPropertyFilter, SessionType } from '~/types'
import { router } from 'kea-router'
import { sessionsFiltersLogic } from 'scenes/sessions/filters/sessionsFiltersLogic'
import fromEntries from 'object.fromentries'
type SessionRecordingId = string
@ -163,7 +162,7 @@ export const sessionsTableLogic = kea<sessionsTableLogicType<SessionRecordingId>
return loadedSessionEvents
}
return fromEntries(
return Object.fromEntries(
sessions.map((session) => {
const events = loadedSessionEvents[session.global_session_id]
const matchingEvents = new Set(session.matching_events)

View File

@ -70,7 +70,6 @@
"kea-router": "^1.0.0",
"kea-window-values": "^0.0.1",
"md5": "^2.3.0",
"object.fromentries": "^2.0.4",
"posthog-js": "1.11.4",
"posthog-js-lite": "^0.0.3",
"prop-types": "^15.7.2",
@ -104,7 +103,6 @@
"@hot-loader/react-dom": "^16.13.0",
"@types/chart.js": "^2.9.32",
"@types/jest": "^26.0.15",
"@types/object.fromentries": "^2.0.0",
"@types/react": "^16.14.2",
"@types/react-dom": "^16.9.8",
"@types/react-grid-layout": "^1.1.1",
@ -164,5 +162,15 @@
"black",
"isort"
]
},
"browserslist": {
"development": [
"last 2 chrome versions",
"last 2 firefox versions",
"last 2 edge versions"
],
"production": [
"defaults"
]
}
}

View File

@ -1718,11 +1718,6 @@
resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e"
integrity sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA==
"@types/object.fromentries@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@types/object.fromentries/-/object.fromentries-2.0.0.tgz#8349ec6c51011a729da61e0c86ed433609a9f9a6"
integrity sha512-y/4Jx68CzO0Uh+SIbINo1gk+k8H1WVphZTHjMOpLdV3p5NqajFCMNKjg78c7YyCedmeIHyRRFhfcMuVZcWRE6g==
"@types/parse-json@^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0"
@ -2999,9 +2994,9 @@ caniuse-api@^3.0.0:
lodash.uniq "^4.5.0"
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001219:
version "1.0.30001230"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001230.tgz#8135c57459854b2240b57a4a6786044bdc5a9f71"
integrity sha512-5yBd5nWCBS+jWKTcHOzXwo5xzcj4ePE/yjtkZyUV1BTUmrBaA9MRGC+e7mxnqXSA90CmCA8L3eKLaSUkt099IQ==
version "1.0.30001243"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001243.tgz"
integrity sha512-vNxw9mkTBtkmLFnJRv/2rhs1yufpDfCkBZexG3Y0xdOH2Z/eE/85E4Dl5j1YUN34nZVsSp6vVRFQRrez9wJMRA==
capture-exit@^2.0.0:
version "2.0.0"
@ -7822,16 +7817,6 @@ object.fromentries@^2.0.2:
function-bind "^1.1.1"
has "^1.0.3"
object.fromentries@^2.0.4:
version "2.0.4"
resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.4.tgz#26e1ba5c4571c5c6f0890cef4473066456a120b8"
integrity sha512-EsFBshs5RUUpQEY1D4q/m59kMfz4YJvxuNCJcv/jWwOJr34EaVnG11ZrZa0UHB3wnzV1wx8m58T4hQL8IuNXlQ==
dependencies:
call-bind "^1.0.2"
define-properties "^1.1.3"
es-abstract "^1.18.0-next.2"
has "^1.0.3"
object.getownpropertydescriptors@^2.0.3, object.getownpropertydescriptors@^2.1.0:
version "2.1.2"
resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.2.tgz#1bd63aeacf0d5d2d2f31b5e393b03a7c601a23f7"