From 3cc8eb671770091837b0f756706c978df64c4ac8 Mon Sep 17 00:00:00 2001 From: s1gr1d Date: Wed, 6 Mar 2024 09:39:55 +0100 Subject: [PATCH 1/3] use es20217 (no es5/es6) --- .eslintrc.js | 2 +- .github/workflows/build.yml | 28 ++-- .size-limit.js | 27 ++-- CONTRIBUTING.md | 2 +- MIGRATION.md | 2 +- .../browser-integration-tests/README.md | 2 +- .../browser-integration-tests/package.json | 21 +-- .../suites/transport/offline/queued/test.ts | 2 +- .../utils/generatePlugin.ts | 40 +++-- .../utils/wasmHelpers.ts | 4 +- .../create-next-app/tsconfig.json | 2 +- .../create-react-app/tsconfig.json | 2 +- .../generic-ts3.8/tsconfig.json | 4 +- .../test-applications/nextjs-14/tsconfig.json | 2 +- .../nextjs-app-dir/tsconfig.json | 2 +- .../node-exports-test-app/tsconfig.json | 2 +- .../node-express-app/tsconfig.json | 2 +- .../react-create-hash-router/tsconfig.json | 2 +- .../react-router-6-use-routes/tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../standard-frontend-react/tsconfig.json | 2 +- dev-packages/overhead-metrics/.eslintrc.cjs | 1 - dev-packages/rollup-utils/bundleHelpers.mjs | 15 +- .../rollup-utils/plugins/bundlePlugins.mjs | 48 ------ dev-packages/rollup-utils/polyfills/es5.js | 41 ------ docs/new-sdk-release-checklist.md | 3 - package.json | 1 - packages/angular-ivy/tsconfig.ngc.json | 2 +- packages/angular/tsconfig.ngc.json | 4 +- packages/browser/package.json | 9 +- packages/browser/rollup.bundle.config.mjs | 137 ++++++++---------- .../browser/test/integration/debugging.md | 3 - packages/bun/.eslintrc.js | 1 - packages/deno/.eslintrc.js | 1 - packages/eslint-config-sdk/src/base.js | 3 - packages/eslint-plugin-sdk/src/index.js | 1 - .../src/rules/no-unsupported-es6-methods.js | 35 ----- packages/feedback/rollup.bundle.config.mjs | 1 - packages/node-experimental/.eslintrc.js | 1 - .../rollup.anr-worker.config.mjs | 1 - .../node-experimental/test/helpers/error.ts | 3 + .../test/integrations/contextlines.test.ts | 9 +- packages/node-experimental/tsconfig.json | 2 +- packages/node/.eslintrc.js | 1 - packages/node/rollup.anr-worker.config.mjs | 1 - packages/node/tsconfig.json | 2 +- packages/profiling-node/.eslintrc.js | 1 - packages/profiling-node/tsconfig.json | 2 +- packages/replay-canvas/.eslintrc.js | 3 - .../replay-canvas/rollup.bundle.config.mjs | 1 - packages/replay-worker/tsconfig.json | 2 +- packages/replay/.eslintrc.js | 3 - packages/replay/rollup.bundle.config.mjs | 1 - packages/serverless/rollup.aws.config.mjs | 1 - packages/svelte/.eslintrc.js | 3 - packages/types/tsconfig.json | 2 +- packages/typescript/tsconfig.json | 4 +- packages/vercel-edge/.eslintrc.js | 1 - packages/vue/src/vendor/components.ts | 4 +- packages/wasm/rollup.bundle.config.mjs | 1 - 60 files changed, 143 insertions(+), 366 deletions(-) delete mode 100644 dev-packages/rollup-utils/polyfills/es5.js delete mode 100644 packages/eslint-plugin-sdk/src/rules/no-unsupported-es6-methods.js create mode 100644 packages/node-experimental/test/helpers/error.ts diff --git a/.eslintrc.js b/.eslintrc.js index 150c7e8efd2f..90f474319c7d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -6,7 +6,7 @@ module.exports = { root: true, env: { - es6: true, + es2017: true, }, parserOptions: { ecmaVersion: 2018, diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 954734ad0ba0..a1104619db12 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -336,8 +336,6 @@ jobs: run: yarn lint:lerna - name: Lint C++ files run: yarn lint:clang - - name: Validate ES5 builds - run: yarn validate:es5 job_check_format: name: Check file formatting @@ -627,28 +625,24 @@ jobs: matrix: bundle: - esm - - bundle_es5 - - bundle_es5_min - - bundle_es6 - - bundle_es6_min - - bundle_replay_es6 - - bundle_replay_es6_min - - bundle_tracing_es5 - - bundle_tracing_es5_min - - bundle_tracing_es6 - - bundle_tracing_es6_min - - bundle_tracing_replay_es6 - - bundle_tracing_replay_es6_min + - bundle + - bundle_min + - bundle_replay + - bundle_replay_min + - bundle_tracing + - bundle_tracing_min + - bundle_tracing_replay + - bundle_tracing_replay_min project: - chromium include: # Only check all projects for esm & full bundle # We also shard the tests as they take the longest - - bundle: bundle_tracing_replay_es6_min + - bundle: bundle_tracing_replay_min project: '' shard: 1 shards: 2 - - bundle: bundle_tracing_replay_es6_min + - bundle: bundle_tracing_replay_min project: '' shard: 2 shards: 2 @@ -665,7 +659,7 @@ jobs: shards: 3 exclude: # Do not run the default chromium-only tests - - bundle: bundle_tracing_replay_es6_min + - bundle: bundle_tracing_replay_min project: 'chromium' - bundle: esm project: 'chromium' diff --git a/.size-limit.js b/.size-limit.js index f2d883a3b0cb..a9f5501c4635 100644 --- a/.size-limit.js +++ b/.size-limit.js @@ -76,64 +76,55 @@ module.exports = [ limit: '28 KB', }, - // Browser CDN bundles (ES6) + // Browser CDN bundles { - name: '@sentry/browser (incl. Tracing, Replay, Feedback) - ES6 CDN Bundle (gzipped)', + name: '@sentry/browser (incl. Tracing, Replay, Feedback) - CDN Bundle (gzipped)', path: 'packages/browser/build/bundles/bundle.tracing.replay.feedback.min.js', gzip: true, limit: '90 KB', }, { - name: '@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (gzipped)', + name: '@sentry/browser (incl. Tracing, Replay) - CDN Bundle (gzipped)', path: 'packages/browser/build/bundles/bundle.tracing.replay.min.js', gzip: true, limit: '75 KB', }, { - name: '@sentry/browser (incl. Tracing) - ES6 CDN Bundle (gzipped)', + name: '@sentry/browser (incl. Tracing) - CDN Bundle (gzipped)', path: 'packages/browser/build/bundles/bundle.tracing.min.js', gzip: true, limit: '37 KB', }, { - name: '@sentry/browser - ES6 CDN Bundle (gzipped)', + name: '@sentry/browser - CDN Bundle (gzipped)', path: 'packages/browser/build/bundles/bundle.min.js', gzip: true, limit: '28 KB', }, - // browser CDN bundles (ES6 + non-gzipped) + // browser CDN bundles (non-gzipped) { - name: '@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (minified & uncompressed)', + name: '@sentry/browser (incl. Tracing, Replay) - CDN Bundle (minified & uncompressed)', path: 'packages/browser/build/bundles/bundle.tracing.replay.min.js', gzip: false, brotli: false, limit: '260 KB', }, { - name: '@sentry/browser (incl. Tracing) - ES6 CDN Bundle (minified & uncompressed)', + name: '@sentry/browser (incl. Tracing) - CDN Bundle (minified & uncompressed)', path: 'packages/browser/build/bundles/bundle.tracing.min.js', gzip: false, brotli: false, limit: '105 KB', }, { - name: '@sentry/browser - ES6 CDN Bundle (minified & uncompressed)', + name: '@sentry/browser - CDN Bundle (minified & uncompressed)', path: 'packages/browser/build/bundles/bundle.min.js', gzip: false, brotli: false, limit: '80 KB', }, - // Browser CDN bundles (ES5) - // Replay is not supported in ES5 mode - { - name: '@sentry/browser (incl. Tracing) - ES5 CDN Bundle (gzipped)', - path: 'packages/browser/build/bundles/bundle.tracing.es5.min.js', - gzip: true, - limit: '40 KB', - }, - // React { name: '@sentry/react (incl. Tracing, Replay) - Webpack (gzipped)', diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 812aaa870df5..d424a69e1967 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,7 +31,7 @@ With that, the repo is fully set up and you are ready to run all commands. Since we are using [`TypeScript`](https://www.typescriptlang.org/), you need to transpile the code to JavaScript to be able to use it. From the top level of the repo, there are three commands available: -- `yarn build:dev`, which runs a one-time build of ES5 and ES6 versions of every package +- `yarn build:dev`, which runs a one-time build of every package - `yarn build:dev:filter `, which runs `yarn build:dev` only in projects relevant to the given package (so, for example, running `yarn build:dev:filter @sentry/react` will build the `react` package, all of its dependencies (`utils`, `core`, `browser`, etc), and all packages which depend on it (currently `gatsby` and `nextjs`)) diff --git a/MIGRATION.md b/MIGRATION.md index 0d09fa68c0c1..ad036f346760 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -24,7 +24,7 @@ stable release of `8.x` comes out). `@sentry/node` and all of our node-based server-side sdks (`@sentry/nextjs`, `@sentry/serverless`, etc.). We no longer test against Node 8, 10, or 12 and cannot guarantee that the SDK will work as expected on these versions. -**Browser**: Our browser SDKs (`@sentry/browser`, `@sentry/react`, `@sentry/vue`, etc.) now require ES6+ compatible +**Browser**: Our browser SDKs (`@sentry/browser`, `@sentry/react`, `@sentry/vue`, etc.) now require ES2017+ compatible browsers. This means that we no longer support IE11 (end of an era). This also means that the Browser SDK requires the fetch API to be available in the environment. diff --git a/dev-packages/browser-integration-tests/README.md b/dev-packages/browser-integration-tests/README.md index 6024b98a8085..0c57f7c1ca45 100644 --- a/dev-packages/browser-integration-tests/README.md +++ b/dev-packages/browser-integration-tests/README.md @@ -61,7 +61,7 @@ To filter tests by their title: You can refer to [Playwright documentation](https://playwright.dev/docs/test-cli) for other CLI options. You can set env variable `PW_BUNDLE` to set specific build or bundle to test against. -Available options: `esm`, `cjs`, `bundle_es5`, `bundle_es5_min`, `bundle_es6`, `bundle_es6_min` +Available options: `esm`, `cjs`, `bundle`, `bundle_min` ### Troubleshooting diff --git a/dev-packages/browser-integration-tests/package.json b/dev-packages/browser-integration-tests/package.json index 55697825c3a1..62e4e420e173 100644 --- a/dev-packages/browser-integration-tests/package.json +++ b/dev-packages/browser-integration-tests/package.json @@ -17,18 +17,12 @@ "pretest": "yarn clean && yarn type-check", "test": "yarn test:all --project='chromium'", "test:all": "npx playwright test -c playwright.browser.config.ts", - "test:bundle:es5": "PW_BUNDLE=bundle_es5 yarn test", - "test:bundle:es5:min": "PW_BUNDLE=bundle_es5_min yarn test", - "test:bundle:es6": "PW_BUNDLE=bundle_es6 yarn test", - "test:bundle:es6:min": "PW_BUNDLE=bundle_es6_min yarn test", - "test:bundle:replay:es6": "PW_BUNDLE=bundle_replay_es6 yarn test", - "test:bundle:replay:es6:min": "PW_BUNDLE=bundle_replay_es6_min yarn test", - "test:bundle:tracing:es5": "PW_BUNDLE=bundle_tracing_es5 yarn test", - "test:bundle:tracing:es5:min": "PW_BUNDLE=bundle_tracing_es5_min yarn test", - "test:bundle:tracing:es6": "PW_BUNDLE=bundle_tracing_es6 yarn test", - "test:bundle:tracing:es6:min": "PW_BUNDLE=bundle_tracing_es6_min yarn test", - "test:bundle:tracing:replay:es6": "PW_BUNDLE=bundle_tracing_replay_es6 yarn test", - "test:bundle:tracing:replay:es6:min": "PW_BUNDLE=bundle_tracing_replay_es6_min yarn test", + "test:bundle": "PW_BUNDLE=bundle yarn test", + "test:bundle:min": "PW_BUNDLE=bundle_min yarn test", + "test:bundle:replay": "PW_BUNDLE=bundle_replay yarn test", + "test:bundle:replay:min": "PW_BUNDLE=bundle_replay_min yarn test", + "test:bundle:tracing": "PW_BUNDLE=bundle_tracing yarn test", + "test:bundle:tracing:min": "PW_BUNDLE=bundle_tracing_min yarn test", "test:cjs": "PW_BUNDLE=cjs yarn test", "test:esm": "PW_BUNDLE=esm yarn test", "test:loader": "npx playwright test -c playwright.loader.config.ts --project='chromium'", @@ -40,8 +34,7 @@ "test:loader:debug": "PW_BUNDLE=loader_debug yarn test:loader", "test:ci": "yarn test:all --reporter='line'", "test:update-snapshots": "yarn test:all --update-snapshots", - "test:detect-flaky": "ts-node scripts/detectFlakyTests.ts", - "validate:es5": "es-check es5 'fixtures/loader.js'" + "test:detect-flaky": "ts-node scripts/detectFlakyTests.ts" }, "dependencies": { "@babel/preset-typescript": "^7.16.7", diff --git a/dev-packages/browser-integration-tests/suites/transport/offline/queued/test.ts b/dev-packages/browser-integration-tests/suites/transport/offline/queued/test.ts index 61020eceb79b..2ca225ee069a 100644 --- a/dev-packages/browser-integration-tests/suites/transport/offline/queued/test.ts +++ b/dev-packages/browser-integration-tests/suites/transport/offline/queued/test.ts @@ -10,7 +10,7 @@ function delay(ms: number) { sentryTest('should queue and retry events when they fail to send', async ({ getLocalTestPath, page }) => { // makeBrowserOfflineTransport is not included in any CDN bundles - if (process.env.PW_BUNDLE && process.env.PW_BUNDLE.startsWith('bundle_')) { + if (process.env.PW_BUNDLE && process.env.PW_BUNDLE.startsWith('bundle')) { sentryTest.skip(); } diff --git a/dev-packages/browser-integration-tests/utils/generatePlugin.ts b/dev-packages/browser-integration-tests/utils/generatePlugin.ts index 738771aedced..f3875c561e74 100644 --- a/dev-packages/browser-integration-tests/utils/generatePlugin.ts +++ b/dev-packages/browser-integration-tests/utils/generatePlugin.ts @@ -47,38 +47,32 @@ const BUNDLE_PATHS: Record> = { browser: { cjs: 'build/npm/cjs/index.js', esm: 'build/npm/esm/index.js', - bundle_es5: 'build/bundles/bundle.es5.js', - bundle_es5_min: 'build/bundles/bundle.es5.min.js', - bundle_es6: 'build/bundles/bundle.js', - bundle_es6_min: 'build/bundles/bundle.min.js', - bundle_replay_es6: 'build/bundles/bundle.replay.js', - bundle_replay_es6_min: 'build/bundles/bundle.replay.min.js', - bundle_tracing_es5: 'build/bundles/bundle.tracing.es5.js', - bundle_tracing_es5_min: 'build/bundles/bundle.tracing.es5.min.js', - bundle_tracing_es6: 'build/bundles/bundle.tracing.js', - bundle_tracing_es6_min: 'build/bundles/bundle.tracing.min.js', - bundle_tracing_replay_es6: 'build/bundles/bundle.tracing.replay.js', - bundle_tracing_replay_es6_min: 'build/bundles/bundle.tracing.replay.min.js', - loader_base: 'build/bundles/bundle.es5.min.js', - loader_eager: 'build/bundles/bundle.es5.min.js', - loader_debug: 'build/bundles/bundle.es5.debug.min.js', - loader_tracing: 'build/bundles/bundle.tracing.es5.min.js', + bundle: 'build/bundles/bundle.js', + bundle_min: 'build/bundles/bundle.min.js', + bundle_replay: 'build/bundles/bundle.replay.js', + bundle_replay_min: 'build/bundles/bundle.replay.min.js', + bundle_tracing: 'build/bundles/bundle.tracing.js', + bundle_tracing_min: 'build/bundles/bundle.tracing.min.js', + bundle_tracing_replay: 'build/bundles/bundle.tracing.replay.js', + bundle_tracing_replay_min: 'build/bundles/bundle.tracing.replay.min.js', + loader_base: 'build/bundles/bundle.min.js', + loader_eager: 'build/bundles/bundle.min.js', + loader_debug: 'build/bundles/bundle.debug.min.js', + loader_tracing: 'build/bundles/bundle.tracing.min.js', loader_replay: 'build/bundles/bundle.replay.min.js', loader_tracing_replay: 'build/bundles/bundle.tracing.replay.debug.min.js', }, integrations: { cjs: 'build/npm/cjs/index.js', esm: 'build/npm/esm/index.js', - bundle_es5: 'build/bundles/[INTEGRATION_NAME].es5.js', - bundle_es5_min: 'build/bundles/[INTEGRATION_NAME].es5.min.js', - bundle_es6: 'build/bundles/[INTEGRATION_NAME].js', - bundle_es6_min: 'build/bundles/[INTEGRATION_NAME].min.js', + bundle: 'build/bundles/[INTEGRATION_NAME].js', + bundle_min: 'build/bundles/[INTEGRATION_NAME].min.js', }, wasm: { cjs: 'build/npm/cjs/index.js', esm: 'build/npm/esm/index.js', - bundle_es6: 'build/bundles/wasm.js', - bundle_es6_min: 'build/bundles/wasm.min.js', + bundle: 'build/bundles/wasm.js', + bundle_min: 'build/bundles/wasm.min.js', }, }; @@ -229,7 +223,7 @@ class SentryScenarioGenerationPlugin { }); } - // Convert e.g. bundle_tracing_es5_min to bundle_es5_min + // Convert e.g. bundle_tracing_min to bundle_min const integrationBundleKey = bundleKey .replace('loader_', 'bundle_') .replace('_replay', '') diff --git a/dev-packages/browser-integration-tests/utils/wasmHelpers.ts b/dev-packages/browser-integration-tests/utils/wasmHelpers.ts index ca93148e690c..cb8cf1bcb4b3 100644 --- a/dev-packages/browser-integration-tests/utils/wasmHelpers.ts +++ b/dev-packages/browser-integration-tests/utils/wasmHelpers.ts @@ -1,7 +1,7 @@ /** * We can only test WASM tests in certain bundles/packages: * - NPM (ESM, CJS) - * - ES6 CDN bundles + * - CDN bundles * - On browsers other than WebKit * * @returns `true` if we should skip the replay test @@ -11,5 +11,5 @@ export function shouldSkipWASMTests(browser: string): boolean { return true; } const bundle = process.env.PW_BUNDLE as string | undefined; - return bundle != null && bundle.includes('es5'); + return bundle != null; } diff --git a/dev-packages/e2e-tests/test-applications/create-next-app/tsconfig.json b/dev-packages/e2e-tests/test-applications/create-next-app/tsconfig.json index 3ff0501fdb85..1fd2e9a8d510 100644 --- a/dev-packages/e2e-tests/test-applications/create-next-app/tsconfig.json +++ b/dev-packages/e2e-tests/test-applications/create-next-app/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "es5", + "target": "es2017", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, diff --git a/dev-packages/e2e-tests/test-applications/create-react-app/tsconfig.json b/dev-packages/e2e-tests/test-applications/create-react-app/tsconfig.json index 4bd4dd6a0417..bd19e4f07fc7 100644 --- a/dev-packages/e2e-tests/test-applications/create-react-app/tsconfig.json +++ b/dev-packages/e2e-tests/test-applications/create-react-app/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "es5", + "target": "es2017", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, diff --git a/dev-packages/e2e-tests/test-applications/generic-ts3.8/tsconfig.json b/dev-packages/e2e-tests/test-applications/generic-ts3.8/tsconfig.json index 932aa58e0c9a..ef27756e97d9 100644 --- a/dev-packages/e2e-tests/test-applications/generic-ts3.8/tsconfig.json +++ b/dev-packages/e2e-tests/test-applications/generic-ts3.8/tsconfig.json @@ -1,11 +1,11 @@ { "include": ["index.ts"], "compilerOptions": { - "lib": ["es6", "DOM"], + "lib": ["es2017", "DOM"], "skipLibCheck": false, "noEmit": true, "types": [], - "target": "es6", + "target": "es2017", "moduleResolution": "node" } } diff --git a/dev-packages/e2e-tests/test-applications/nextjs-14/tsconfig.json b/dev-packages/e2e-tests/test-applications/nextjs-14/tsconfig.json index 60825545944d..6b81123d463c 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-14/tsconfig.json +++ b/dev-packages/e2e-tests/test-applications/nextjs-14/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "es5", + "target": "es2017", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tsconfig.json b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tsconfig.json index 60825545944d..6b81123d463c 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tsconfig.json +++ b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "es5", + "target": "es2017", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, diff --git a/dev-packages/e2e-tests/test-applications/node-exports-test-app/tsconfig.json b/dev-packages/e2e-tests/test-applications/node-exports-test-app/tsconfig.json index fc22710d69dc..6f37f0817c4a 100644 --- a/dev-packages/e2e-tests/test-applications/node-exports-test-app/tsconfig.json +++ b/dev-packages/e2e-tests/test-applications/node-exports-test-app/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "types": ["node"], "esModuleInterop": true, - "lib": ["ES6"], + "lib": ["es2017"], "strict": true, "outDir": "dist", "target": "ESNext", diff --git a/dev-packages/e2e-tests/test-applications/node-express-app/tsconfig.json b/dev-packages/e2e-tests/test-applications/node-express-app/tsconfig.json index decfcf7a0879..d46ae8103211 100644 --- a/dev-packages/e2e-tests/test-applications/node-express-app/tsconfig.json +++ b/dev-packages/e2e-tests/test-applications/node-express-app/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "types": ["node"], "esModuleInterop": true, - "lib": ["ES6"], + "lib": ["es2017"], "strict": true, "outDir": "dist" }, diff --git a/dev-packages/e2e-tests/test-applications/react-create-hash-router/tsconfig.json b/dev-packages/e2e-tests/test-applications/react-create-hash-router/tsconfig.json index c8df41dcf4b5..75ae036f46b0 100644 --- a/dev-packages/e2e-tests/test-applications/react-create-hash-router/tsconfig.json +++ b/dev-packages/e2e-tests/test-applications/react-create-hash-router/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "es5", + "target": "es2017", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, diff --git a/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/tsconfig.json b/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/tsconfig.json index c8df41dcf4b5..75ae036f46b0 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/tsconfig.json +++ b/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "es5", + "target": "es2017", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, diff --git a/dev-packages/e2e-tests/test-applications/standard-frontend-react-tracing-import/tsconfig.json b/dev-packages/e2e-tests/test-applications/standard-frontend-react-tracing-import/tsconfig.json index c8df41dcf4b5..75ae036f46b0 100644 --- a/dev-packages/e2e-tests/test-applications/standard-frontend-react-tracing-import/tsconfig.json +++ b/dev-packages/e2e-tests/test-applications/standard-frontend-react-tracing-import/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "es5", + "target": "es2017", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, diff --git a/dev-packages/e2e-tests/test-applications/standard-frontend-react/tsconfig.json b/dev-packages/e2e-tests/test-applications/standard-frontend-react/tsconfig.json index c8df41dcf4b5..75ae036f46b0 100644 --- a/dev-packages/e2e-tests/test-applications/standard-frontend-react/tsconfig.json +++ b/dev-packages/e2e-tests/test-applications/standard-frontend-react/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "es5", + "target": "es2017", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, diff --git a/dev-packages/overhead-metrics/.eslintrc.cjs b/dev-packages/overhead-metrics/.eslintrc.cjs index a4f2d4fdd936..3eed32128e5c 100644 --- a/dev-packages/overhead-metrics/.eslintrc.cjs +++ b/dev-packages/overhead-metrics/.eslintrc.cjs @@ -9,7 +9,6 @@ module.exports = { '@typescript-eslint/no-non-null-assertion': 'off', '@sentry-internal/sdk/no-optional-chaining': 'off', '@sentry-internal/sdk/no-nullish-coalescing': 'off', - '@sentry-internal/sdk/no-unsupported-es6-methods': 'off', '@sentry-internal/sdk/no-class-field-initializers': 'off', 'jsdoc/require-jsdoc': 'off', }, diff --git a/dev-packages/rollup-utils/bundleHelpers.mjs b/dev-packages/rollup-utils/bundleHelpers.mjs index 6043207ee97c..ec3f886abe67 100644 --- a/dev-packages/rollup-utils/bundleHelpers.mjs +++ b/dev-packages/rollup-utils/bundleHelpers.mjs @@ -7,7 +7,6 @@ import { builtinModules } from 'module'; import deepMerge from 'deepmerge'; import { - getEs5Polyfills, makeBrowserBuildPlugin, makeCleanupPlugin, makeCommonJSPlugin, @@ -17,7 +16,6 @@ import { makeRrwebBuildPlugin, makeSetSDKSourcePlugin, makeSucrasePlugin, - makeTSPlugin, makeTerserPlugin, } from './plugins/index.mjs'; import { mergePlugins } from './utils.mjs'; @@ -25,16 +23,13 @@ import { mergePlugins } from './utils.mjs'; const BUNDLE_VARIANTS = ['.js', '.min.js', '.debug.min.js']; export function makeBaseBundleConfig(options) { - const { bundleType, entrypoints, jsVersion, licenseTitle, outputFileBase, packageSpecificConfig } = options; - - const isEs5 = jsVersion.toLowerCase() === 'es5'; + const { bundleType, entrypoints, licenseTitle, outputFileBase, packageSpecificConfig } = options; const nodeResolvePlugin = makeNodeResolvePlugin(); const sucrasePlugin = makeSucrasePlugin(); const cleanupPlugin = makeCleanupPlugin(); const markAsBrowserBuildPlugin = makeBrowserBuildPlugin(true); const licensePlugin = makeLicensePlugin(licenseTitle); - const tsPlugin = makeTSPlugin('es5'); const rrwebBuildPlugin = makeRrwebBuildPlugin({ excludeIframe: false, excludeShadowDom: false, @@ -50,10 +45,6 @@ export function makeBaseBundleConfig(options) { output: { format: 'iife', name: 'Sentry', - outro: () => { - // Add polyfills for ES6 array/string methods at the end of the bundle - return isEs5 ? getEs5Polyfills() : ''; - }, }, context: 'window', plugins: [rrwebBuildPlugin, markAsBrowserBuildPlugin], @@ -123,9 +114,7 @@ export function makeBaseBundleConfig(options) { strict: false, esModule: false, }, - plugins: isEs5 - ? [tsPlugin, nodeResolvePlugin, cleanupPlugin, licensePlugin] - : [sucrasePlugin, nodeResolvePlugin, cleanupPlugin, licensePlugin], + plugins: [sucrasePlugin, nodeResolvePlugin, cleanupPlugin, licensePlugin], treeshake: 'smallest', }; diff --git a/dev-packages/rollup-utils/plugins/bundlePlugins.mjs b/dev-packages/rollup-utils/plugins/bundlePlugins.mjs index 1df1e2ac917d..8dac000fd0b1 100644 --- a/dev-packages/rollup-utils/plugins/bundlePlugins.mjs +++ b/dev-packages/rollup-utils/plugins/bundlePlugins.mjs @@ -9,15 +9,10 @@ */ import * as childProcess from 'child_process'; -import * as fs from 'fs'; -import * as path from 'path'; -import { fileURLToPath } from 'url'; import commonjs from '@rollup/plugin-commonjs'; import { nodeResolve } from '@rollup/plugin-node-resolve'; import replace from '@rollup/plugin-replace'; -import typescript from '@rollup/plugin-typescript'; -import deepMerge from 'deepmerge'; import license from 'rollup-plugin-license'; import { terser } from 'rollup-plugin-terser'; @@ -43,10 +38,6 @@ export function makeLicensePlugin(title) { return plugin; } -export function getEs5Polyfills() { - return fs.readFileSync(path.join(path.dirname(fileURLToPath(import.meta.url)), '../polyfills/es5.js'), 'utf-8'); -} - /** * Create a plugin to set the value of the `__SENTRY_DEBUG__` magic string. * @@ -142,45 +133,6 @@ export function makeTerserPlugin() { }); } -/** - * Create a TypeScript plugin, which will down-compile if necessary, based on the given JS version. - * - * @param jsVersion Either `es5` or `es6` - * @returns An instance of the `typescript` plugin - */ -export function makeTSPlugin(jsVersion) { - const baseTSPluginOptions = { - tsconfig: 'tsconfig.json', - compilerOptions: { - declaration: false, - declarationMap: false, - paths: { - '@sentry/browser': ['../browser/src'], - '@sentry/core': ['../core/src'], - '@sentry/types': ['../types/src'], - '@sentry/utils': ['../utils/src'], - '@sentry-internal/integration-shims': ['../integration-shims/src'], - '@sentry-internal/tracing': ['../tracing-internal/src'], - }, - baseUrl: '.', - }, - include: ['*.ts+(|x)', '**/*.ts+(|x)', '../**/*.ts+(|x)'], - }; - - const plugin = typescript( - deepMerge(baseTSPluginOptions, { - compilerOptions: { - target: jsVersion, - }, - }), - ); - - // give it a nicer name for later, when we'll need to sort the plugins - plugin.name = 'typescript'; - - return plugin; -} - // We don't pass these plugins any options which need to be calculated or changed by us, so no need to wrap them in // another factory function, as they are themselves already factory functions. diff --git a/dev-packages/rollup-utils/polyfills/es5.js b/dev-packages/rollup-utils/polyfills/es5.js deleted file mode 100644 index 54bd46e62cff..000000000000 --- a/dev-packages/rollup-utils/polyfills/es5.js +++ /dev/null @@ -1,41 +0,0 @@ -// Sentry ES5 polyfills -if (!('includes' in Array.prototype)) { - Array.prototype.includes = function (searchElement) { - return this.indexOf(searchElement) > -1; - }; -} -if (!('find' in Array.prototype)) { - Array.prototype.find = function (callback) { - for (var i = 0; i < this.length; i++) { - if (callback(this[i])) { - return this[i]; - } - } - }; -} -if (!('findIndex' in Array.prototype)) { - Array.prototype.findIndex = function (callback) { - for (var i = 0; i < this.length; i++) { - if (callback(this[i])) { - return i; - } - } - return -1; - }; -} -if (!('includes' in String.prototype)) { - String.prototype.includes = function (searchElement) { - return this.indexOf(searchElement) > -1; - }; -} -if (!('startsWith' in String.prototype)) { - String.prototype.startsWith = function (searchElement) { - return this.indexOf(searchElement) === 0; - }; -} -if (!('endsWith' in String.prototype)) { - String.prototype.endsWith = function (searchElement) { - var i = this.indexOf(searchElement); - return i > -1 && i === this.length - searchElement.length; - }; -} diff --git a/docs/new-sdk-release-checklist.md b/docs/new-sdk-release-checklist.md index 99c952631f01..a6e0f60e8235 100644 --- a/docs/new-sdk-release-checklist.md +++ b/docs/new-sdk-release-checklist.md @@ -59,9 +59,6 @@ differ slightly for other SDKs depending on how they are structured and how they - **This is especially important, if you're adding new CDN bundles!** - Tarballs (\*.tgz archives) should work OOTB -- [ ] Make sure it is added to `bundlePlugins.ts:makeTSPlugin` as `paths`, otherwise it will not be ES5 transpiled - correctly for CDN builds. - - [ ] Make sure it is added to the [Verdaccio config](https://github.com/getsentry/sentry-javascript/blob/develop/dev-packages/e2e-tests/verdaccio-config/config.yaml) for the E2E tests diff --git a/package.json b/package.json index 0c39a0033abb..4d7ca71125de 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,6 @@ "lint:lerna": "lerna run lint", "lint:biome": "biome check .", "lint:prettier": "prettier **/*.md *.md **/*.css --check", - "validate:es5": "lerna run validate:es5", "postpublish": "lerna run --stream --concurrency 1 postpublish", "test": "lerna run --ignore \"@sentry-internal/{browser-integration-tests,e2e-tests,integration-shims,node-integration-tests,overhead-metrics}\" test", "test:unit": "lerna run --ignore \"@sentry-internal/{browser-integration-tests,e2e-tests,integration-shims,node-integration-tests,overhead-metrics}\" test:unit", diff --git a/packages/angular-ivy/tsconfig.ngc.json b/packages/angular-ivy/tsconfig.ngc.json index eb826fa42ff9..8a1d95d7a256 100644 --- a/packages/angular-ivy/tsconfig.ngc.json +++ b/packages/angular-ivy/tsconfig.ngc.json @@ -5,7 +5,7 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "target": "es2015", + "target": "es2017", "lib": ["dom", "es2018"], "baseUrl": "./" }, diff --git a/packages/angular/tsconfig.ngc.json b/packages/angular/tsconfig.ngc.json index 9dd04ce14239..a7449189e22b 100644 --- a/packages/angular/tsconfig.ngc.json +++ b/packages/angular/tsconfig.ngc.json @@ -5,8 +5,8 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "target": "es2015", - "lib": ["dom", "es2015"], + "target": "es2017", + "lib": ["dom", "es2017"], "baseUrl": "./" }, "angularCompilerOptions": { diff --git a/packages/browser/package.json b/packages/browser/package.json index 876e3c45889d..5e919cfab545 100644 --- a/packages/browser/package.json +++ b/packages/browser/package.json @@ -64,9 +64,7 @@ "scripts": { "build": "run-p build:transpile build:bundle build:types", "build:dev": "yarn build", - "build:bundle": "run-p build:bundle:es5 build:bundle:es6", - "build:bundle:es5": "JS_VERSION=es5 rollup -c rollup.bundle.config.mjs", - "build:bundle:es6": "JS_VERSION=es6 rollup -c rollup.bundle.config.mjs", + "build:bundle": "rollup -c rollup.bundle.config.mjs", "build:transpile": "rollup -c rollup.npm.config.mjs", "build:types": "run-s build:types:core build:types:downlevel", "build:types:core": "tsc -p tsconfig.types.json", @@ -81,10 +79,7 @@ "clean": "rimraf build coverage .rpt2_cache sentry-browser-*.tgz", "fix": "eslint . --format stylish --fix", "lint": "eslint . --format stylish", - "validate:es5": "es-check es5 'build/bundles/*.es5*.js'", - "size:check": "run-p size:check:es5 size:check:es6", - "size:check:es5": "cat build/bundles/bundle.min.js | gzip -9 | wc -c | awk '{$1=$1/1024; print \"ES5: \",$1,\"kB\";}'", - "size:check:es6": "cat build/bundles/bundle.es6.min.js | gzip -9 | wc -c | awk '{$1=$1/1024; print \"ES6: \",$1,\"kB\";}'", + "size:check": "cat build/bundles/bundle.min.js | gzip -9 | wc -c | awk '{$1=$1/1024; print \"ES2017: \",$1,\"kB\";}'", "test": "yarn test:unit", "test:unit": "jest", "test:integration": "test/integration/run.js", diff --git a/packages/browser/rollup.bundle.config.mjs b/packages/browser/rollup.bundle.config.mjs index d262f1a1bc51..7ebddd4e2f04 100644 --- a/packages/browser/rollup.bundle.config.mjs +++ b/packages/browser/rollup.bundle.config.mjs @@ -2,12 +2,6 @@ import { makeBaseBundleConfig, makeBundleConfigVariants } from '@sentry-internal const builds = []; -const targets = process.env.JS_VERSION ? [process.env.JS_VERSION] : ['es5', 'es6']; - -if (targets.some(target => target !== 'es5' && target !== 'es6')) { - throw new Error('JS_VERSION must be either "es5" or "es6"'); -} - const browserPluggableIntegrationFiles = ['contextlines', 'httpclient', 'reportingobserver']; const corePluggableIntegrationFiles = [ @@ -19,90 +13,77 @@ const corePluggableIntegrationFiles = [ 'sessiontiming', ]; -targets.forEach(jsVersion => { - const baseBundleConfig = makeBaseBundleConfig({ - bundleType: 'standalone', - entrypoints: ['src/index.bundle.ts'], - jsVersion, - licenseTitle: '@sentry/browser', - outputFileBase: () => `bundles/bundle${jsVersion === 'es5' ? '.es5' : ''}`, - }); - - const tracingBaseBundleConfig = makeBaseBundleConfig({ - bundleType: 'standalone', - entrypoints: ['src/index.bundle.tracing.ts'], - jsVersion, - licenseTitle: '@sentry/browser (Performance Monitoring)', - outputFileBase: () => `bundles/bundle.tracing${jsVersion === 'es5' ? '.es5' : ''}`, +browserPluggableIntegrationFiles.forEach(integrationName => { + const integrationsBundleConfig = makeBaseBundleConfig({ + bundleType: 'addon', + entrypoints: [`src/integrations/${integrationName}.ts`], + licenseTitle: `@sentry/browser - ${integrationName}`, + outputFileBase: () => `bundles/${integrationName}`, }); - browserPluggableIntegrationFiles.forEach(integrationName => { - const integrationsBundleConfig = makeBaseBundleConfig({ - bundleType: 'addon', - entrypoints: [`src/integrations/${integrationName}.ts`], - jsVersion, - licenseTitle: `@sentry/browser - ${integrationName}`, - outputFileBase: () => `bundles/${integrationName}${jsVersion === 'es5' ? '.es5' : ''}`, - }); + builds.push(...makeBundleConfigVariants(integrationsBundleConfig)); +}); - builds.push(...makeBundleConfigVariants(integrationsBundleConfig)); +corePluggableIntegrationFiles.forEach(integrationName => { + const integrationsBundleConfig = makeBaseBundleConfig({ + bundleType: 'addon', + entrypoints: [`src/integrations-bundle/index.${integrationName}.ts`], + licenseTitle: `@sentry/browser - ${integrationName}`, + outputFileBase: () => `bundles/${integrationName}`, }); - corePluggableIntegrationFiles.forEach(integrationName => { - const integrationsBundleConfig = makeBaseBundleConfig({ - bundleType: 'addon', - entrypoints: [`src/integrations-bundle/index.${integrationName}.ts`], - jsVersion, - licenseTitle: `@sentry/browser - ${integrationName}`, - outputFileBase: () => `bundles/${integrationName}${jsVersion === 'es5' ? '.es5' : ''}`, - }); + builds.push(...makeBundleConfigVariants(integrationsBundleConfig)); +}); - builds.push(...makeBundleConfigVariants(integrationsBundleConfig)); - }); +const baseBundleConfig = makeBaseBundleConfig({ + bundleType: 'standalone', + entrypoints: ['src/index.bundle.ts'], + licenseTitle: '@sentry/browser', + outputFileBase: () => 'bundles/bundle', +}); - builds.push(...makeBundleConfigVariants(baseBundleConfig), ...makeBundleConfigVariants(tracingBaseBundleConfig)); +const tracingBaseBundleConfig = makeBaseBundleConfig({ + bundleType: 'standalone', + entrypoints: ['src/index.bundle.tracing.ts'], + licenseTitle: '@sentry/browser (Performance Monitoring)', + outputFileBase: () => 'bundles/bundle.tracing', }); -if (targets.includes('es6')) { - // Replay/Feedback bundles only available for es6 - const replayBaseBundleConfig = makeBaseBundleConfig({ - bundleType: 'standalone', - entrypoints: ['src/index.bundle.replay.ts'], - jsVersion: 'es6', - licenseTitle: '@sentry/browser & @sentry/replay', - outputFileBase: () => 'bundles/bundle.replay', - }); +const replayBaseBundleConfig = makeBaseBundleConfig({ + bundleType: 'standalone', + entrypoints: ['src/index.bundle.replay.ts'], + licenseTitle: '@sentry/browser & @sentry/replay', + outputFileBase: () => 'bundles/bundle.replay', +}); - const feedbackBaseBundleConfig = makeBaseBundleConfig({ - bundleType: 'standalone', - entrypoints: ['src/index.bundle.feedback.ts'], - jsVersion: 'es6', - licenseTitle: '@sentry/browser & @sentry/feedback', - outputFileBase: () => 'bundles/bundle.feedback', - }); +const feedbackBaseBundleConfig = makeBaseBundleConfig({ + bundleType: 'standalone', + entrypoints: ['src/index.bundle.feedback.ts'], + licenseTitle: '@sentry/browser & @sentry/feedback', + outputFileBase: () => 'bundles/bundle.feedback', +}); - const tracingReplayBaseBundleConfig = makeBaseBundleConfig({ - bundleType: 'standalone', - entrypoints: ['src/index.bundle.tracing.replay.ts'], - jsVersion: 'es6', - licenseTitle: '@sentry/browser (Performance Monitoring and Replay)', - outputFileBase: () => 'bundles/bundle.tracing.replay', - }); +const tracingReplayBaseBundleConfig = makeBaseBundleConfig({ + bundleType: 'standalone', + entrypoints: ['src/index.bundle.tracing.replay.ts'], + licenseTitle: '@sentry/browser (Performance Monitoring and Replay)', + outputFileBase: () => 'bundles/bundle.tracing.replay', +}); - const tracingReplayFeedbackBaseBundleConfig = makeBaseBundleConfig({ - bundleType: 'standalone', - entrypoints: ['src/index.bundle.tracing.replay.feedback.ts'], - jsVersion: 'es6', - licenseTitle: '@sentry/browser (Performance Monitoring, Replay, and Feedback)', - outputFileBase: () => 'bundles/bundle.tracing.replay.feedback', - }); +const tracingReplayFeedbackBaseBundleConfig = makeBaseBundleConfig({ + bundleType: 'standalone', + entrypoints: ['src/index.bundle.tracing.replay.feedback.ts'], + licenseTitle: '@sentry/browser (Performance Monitoring, Replay, and Feedback)', + outputFileBase: () => 'bundles/bundle.tracing.replay.feedback', +}); - builds.push( - ...makeBundleConfigVariants(replayBaseBundleConfig), - ...makeBundleConfigVariants(feedbackBaseBundleConfig), - ...makeBundleConfigVariants(tracingReplayBaseBundleConfig), - ...makeBundleConfigVariants(tracingReplayFeedbackBaseBundleConfig), - ); -} +builds.push( + ...makeBundleConfigVariants(baseBundleConfig), + ...makeBundleConfigVariants(tracingBaseBundleConfig), + ...makeBundleConfigVariants(replayBaseBundleConfig), + ...makeBundleConfigVariants(feedbackBaseBundleConfig), + ...makeBundleConfigVariants(tracingReplayBaseBundleConfig), + ...makeBundleConfigVariants(tracingReplayFeedbackBaseBundleConfig), +); export default builds; diff --git a/packages/browser/test/integration/debugging.md b/packages/browser/test/integration/debugging.md index f25d70d788ae..d5fec3818115 100644 --- a/packages/browser/test/integration/debugging.md +++ b/packages/browser/test/integration/debugging.md @@ -15,9 +15,6 @@ These tests are hard to debug, because the testing system is somewhat complex, s - Repo-level `rollup/bundleHelpers.js`: - Comment out all bundle variants except whichever one `run.js` is turning into `artifacts/sdk.js`. -- Browser-package-level `rollup.bundle.config.mjs`: - - Build only one of `es5` and `es6`. - - Run `build:bundle:watch` in a separate terminal tab, so that when you add `console.log`s to the SDK, they get picked up. - Don't bother trying to copy one of our standard VSCode debug profiles, because it won't work, except to debug the testing system itself. (It will pause the node process running the tests, not the headless browser in which the tests themselves run.) diff --git a/packages/bun/.eslintrc.js b/packages/bun/.eslintrc.js index bec6469d0e28..9d915d4f4c3b 100644 --- a/packages/bun/.eslintrc.js +++ b/packages/bun/.eslintrc.js @@ -6,7 +6,6 @@ module.exports = { rules: { '@sentry-internal/sdk/no-optional-chaining': 'off', '@sentry-internal/sdk/no-nullish-coalescing': 'off', - '@sentry-internal/sdk/no-unsupported-es6-methods': 'off', '@sentry-internal/sdk/no-class-field-initializers': 'off', }, }; diff --git a/packages/deno/.eslintrc.js b/packages/deno/.eslintrc.js index 0dabc2227a0d..0c539a61b1b2 100644 --- a/packages/deno/.eslintrc.js +++ b/packages/deno/.eslintrc.js @@ -4,7 +4,6 @@ module.exports = { rules: { '@sentry-internal/sdk/no-optional-chaining': 'off', '@sentry-internal/sdk/no-nullish-coalescing': 'off', - '@sentry-internal/sdk/no-unsupported-es6-methods': 'off', '@sentry-internal/sdk/no-class-field-initializers': 'off', }, }; diff --git a/packages/eslint-config-sdk/src/base.js b/packages/eslint-config-sdk/src/base.js index 2b98cb6038dd..aa179260dc2c 100644 --- a/packages/eslint-config-sdk/src/base.js +++ b/packages/eslint-config-sdk/src/base.js @@ -151,9 +151,6 @@ module.exports = { }, ], - // Do not allow usage of functions we do not polyfill for ES5 - '@sentry-internal/sdk/no-unsupported-es6-methods': 'error', - // Do not allow usage of class field initializers '@sentry-internal/sdk/no-class-field-initializers': 'error', }, diff --git a/packages/eslint-plugin-sdk/src/index.js b/packages/eslint-plugin-sdk/src/index.js index c03a042ca836..4390af285609 100644 --- a/packages/eslint-plugin-sdk/src/index.js +++ b/packages/eslint-plugin-sdk/src/index.js @@ -13,7 +13,6 @@ module.exports = { 'no-optional-chaining': require('./rules/no-optional-chaining'), 'no-nullish-coalescing': require('./rules/no-nullish-coalescing'), 'no-eq-empty': require('./rules/no-eq-empty'), - 'no-unsupported-es6-methods': require('./rules/no-unsupported-es6-methods'), 'no-class-field-initializers': require('./rules/no-class-field-initializers'), 'no-regexp-constructor': require('./rules/no-regexp-constructor'), }, diff --git a/packages/eslint-plugin-sdk/src/rules/no-unsupported-es6-methods.js b/packages/eslint-plugin-sdk/src/rules/no-unsupported-es6-methods.js deleted file mode 100644 index 85d32fb20e66..000000000000 --- a/packages/eslint-plugin-sdk/src/rules/no-unsupported-es6-methods.js +++ /dev/null @@ -1,35 +0,0 @@ -'use strict'; - -/** - * Taken and adapted from https://github.com/nkt/eslint-plugin-es5/blob/master/src/rules/no-es6-methods.js - */ - -module.exports = { - meta: { - docs: { - description: 'Forbid methods added in ES6 which are not polyfilled by Sentry.', - }, - schema: [], - }, - create(context) { - return { - CallExpression(node) { - if (!node.callee || !node.callee.property) { - return; - } - const functionName = node.callee.property.name; - - const es6ArrayFunctions = ['copyWithin', 'values', 'fill']; - const es6StringFunctions = ['repeat']; - - const es6Functions = [].concat(es6ArrayFunctions, es6StringFunctions); - if (es6Functions.indexOf(functionName) > -1) { - context.report({ - node: node.callee.property, - message: `ES6 methods not allowed: ${functionName}`, - }); - } - }, - }; - }, -}; diff --git a/packages/feedback/rollup.bundle.config.mjs b/packages/feedback/rollup.bundle.config.mjs index 3a9404947667..d35b834711c6 100644 --- a/packages/feedback/rollup.bundle.config.mjs +++ b/packages/feedback/rollup.bundle.config.mjs @@ -3,7 +3,6 @@ import { makeBaseBundleConfig, makeBundleConfigVariants } from '@sentry-internal const baseBundleConfig = makeBaseBundleConfig({ bundleType: 'addon', entrypoints: ['src/index.ts'], - jsVersion: 'es6', licenseTitle: '@sentry-internal/feedback', outputFileBase: () => 'bundles/feedback', }); diff --git a/packages/node-experimental/.eslintrc.js b/packages/node-experimental/.eslintrc.js index bec6469d0e28..9d915d4f4c3b 100644 --- a/packages/node-experimental/.eslintrc.js +++ b/packages/node-experimental/.eslintrc.js @@ -6,7 +6,6 @@ module.exports = { rules: { '@sentry-internal/sdk/no-optional-chaining': 'off', '@sentry-internal/sdk/no-nullish-coalescing': 'off', - '@sentry-internal/sdk/no-unsupported-es6-methods': 'off', '@sentry-internal/sdk/no-class-field-initializers': 'off', }, }; diff --git a/packages/node-experimental/rollup.anr-worker.config.mjs b/packages/node-experimental/rollup.anr-worker.config.mjs index 9887342c63fd..48463d5763ee 100644 --- a/packages/node-experimental/rollup.anr-worker.config.mjs +++ b/packages/node-experimental/rollup.anr-worker.config.mjs @@ -4,7 +4,6 @@ function createAnrWorkerConfig(destDir, esm) { return makeBaseBundleConfig({ bundleType: 'node-worker', entrypoints: ['src/integrations/anr/worker.ts'], - jsVersion: 'es6', licenseTitle: '@sentry/node', outputFileBase: () => 'worker-script.js', packageSpecificConfig: { diff --git a/packages/node-experimental/test/helpers/error.ts b/packages/node-experimental/test/helpers/error.ts new file mode 100644 index 000000000000..0228338f036b --- /dev/null +++ b/packages/node-experimental/test/helpers/error.ts @@ -0,0 +1,3 @@ +export function getError(): Error { + return new Error('mock error'); +} diff --git a/packages/node-experimental/test/integrations/contextlines.test.ts b/packages/node-experimental/test/integrations/contextlines.test.ts index ba3fa8575e79..c4ef1efaa292 100644 --- a/packages/node-experimental/test/integrations/contextlines.test.ts +++ b/packages/node-experimental/test/integrations/contextlines.test.ts @@ -1,9 +1,10 @@ -import * as fs from 'fs'; +import { promises } from 'fs'; import type { StackFrame } from '@sentry/types'; import { parseStackFrames } from '@sentry/utils'; import { _contextLinesIntegration, resetFileContentCache } from '../../src/integrations/contextlines'; import { defaultStackParser } from '../../src/sdk/api'; +import { getError } from '../helpers/error'; jest.mock('fs', () => { const actual = jest.requireActual('fs'); @@ -17,7 +18,7 @@ jest.mock('fs', () => { }); describe('ContextLines', () => { - const readFileSpy = fs.promises.readFile as unknown as jest.SpyInstance; + const readFileSpy = promises.readFile as unknown as jest.SpyInstance; let contextLines: ReturnType; async function addContext(frames: StackFrame[]): Promise { @@ -144,7 +145,3 @@ describe('ContextLines', () => { expect(readFileSpy).toHaveBeenCalledTimes(1); }); }); - -function getError(): Error { - return new Error('mock error'); -} diff --git a/packages/node-experimental/tsconfig.json b/packages/node-experimental/tsconfig.json index 5fc0658105eb..d38a5701a2bf 100644 --- a/packages/node-experimental/tsconfig.json +++ b/packages/node-experimental/tsconfig.json @@ -4,6 +4,6 @@ "include": ["src/**/*"], "compilerOptions": { - "lib": ["es6"] + "lib": ["es2017"] } } diff --git a/packages/node/.eslintrc.js b/packages/node/.eslintrc.js index bec6469d0e28..9d915d4f4c3b 100644 --- a/packages/node/.eslintrc.js +++ b/packages/node/.eslintrc.js @@ -6,7 +6,6 @@ module.exports = { rules: { '@sentry-internal/sdk/no-optional-chaining': 'off', '@sentry-internal/sdk/no-nullish-coalescing': 'off', - '@sentry-internal/sdk/no-unsupported-es6-methods': 'off', '@sentry-internal/sdk/no-class-field-initializers': 'off', }, }; diff --git a/packages/node/rollup.anr-worker.config.mjs b/packages/node/rollup.anr-worker.config.mjs index 9887342c63fd..48463d5763ee 100644 --- a/packages/node/rollup.anr-worker.config.mjs +++ b/packages/node/rollup.anr-worker.config.mjs @@ -4,7 +4,6 @@ function createAnrWorkerConfig(destDir, esm) { return makeBaseBundleConfig({ bundleType: 'node-worker', entrypoints: ['src/integrations/anr/worker.ts'], - jsVersion: 'es6', licenseTitle: '@sentry/node', outputFileBase: () => 'worker-script.js', packageSpecificConfig: { diff --git a/packages/node/tsconfig.json b/packages/node/tsconfig.json index 5fc0658105eb..d38a5701a2bf 100644 --- a/packages/node/tsconfig.json +++ b/packages/node/tsconfig.json @@ -4,6 +4,6 @@ "include": ["src/**/*"], "compilerOptions": { - "lib": ["es6"] + "lib": ["es2017"] } } diff --git a/packages/profiling-node/.eslintrc.js b/packages/profiling-node/.eslintrc.js index 84ad1f9e91b7..02a39c9cf562 100644 --- a/packages/profiling-node/.eslintrc.js +++ b/packages/profiling-node/.eslintrc.js @@ -8,7 +8,6 @@ module.exports = { rules: { '@sentry-internal/sdk/no-optional-chaining': 'off', '@sentry-internal/sdk/no-nullish-coalescing': 'off', - '@sentry-internal/sdk/no-unsupported-es6-methods': 'off', '@sentry-internal/sdk/no-class-field-initializers': 'off', }, }; diff --git a/packages/profiling-node/tsconfig.json b/packages/profiling-node/tsconfig.json index 0c4404d8d70c..03da9a484924 100644 --- a/packages/profiling-node/tsconfig.json +++ b/packages/profiling-node/tsconfig.json @@ -2,7 +2,7 @@ "extends": "../../tsconfig.json", "compilerOptions": { "module": "esnext", - "lib": ["es6"], + "lib": ["es2017"], "outDir": "lib", "types": ["node"] }, diff --git a/packages/replay-canvas/.eslintrc.js b/packages/replay-canvas/.eslintrc.js index eaa6b88347ca..216184b75e47 100644 --- a/packages/replay-canvas/.eslintrc.js +++ b/packages/replay-canvas/.eslintrc.js @@ -8,9 +8,6 @@ module.exports = { overrides: [ { files: ['src/**/*.ts'], - rules: { - '@sentry-internal/sdk/no-unsupported-es6-methods': 'off', - }, }, { files: ['jest.setup.ts', 'jest.config.ts'], diff --git a/packages/replay-canvas/rollup.bundle.config.mjs b/packages/replay-canvas/rollup.bundle.config.mjs index 1575b8114594..557b0da35bb0 100644 --- a/packages/replay-canvas/rollup.bundle.config.mjs +++ b/packages/replay-canvas/rollup.bundle.config.mjs @@ -3,7 +3,6 @@ import { makeBaseBundleConfig, makeBundleConfigVariants } from '@sentry-internal const baseBundleConfig = makeBaseBundleConfig({ bundleType: 'addon', entrypoints: ['src/index.ts'], - jsVersion: 'es6', licenseTitle: '@sentry-internal/replay-canvas', outputFileBase: () => 'bundles/replay-canvas', }); diff --git a/packages/replay-worker/tsconfig.json b/packages/replay-worker/tsconfig.json index 38cb52869a42..dbacce80e01c 100644 --- a/packages/replay-worker/tsconfig.json +++ b/packages/replay-worker/tsconfig.json @@ -4,7 +4,7 @@ "module": "esnext", "lib": ["webworker", "scripthost"], "esModuleInterop": true, - "target": "es6", + "target": "es2017", "strictPropertyInitialization": false }, "include": ["src/**/*.ts"] diff --git a/packages/replay/.eslintrc.js b/packages/replay/.eslintrc.js index 4f69827ac50b..6af926975df0 100644 --- a/packages/replay/.eslintrc.js +++ b/packages/replay/.eslintrc.js @@ -8,9 +8,6 @@ module.exports = { overrides: [ { files: ['src/**/*.ts'], - rules: { - '@sentry-internal/sdk/no-unsupported-es6-methods': 'off', - }, }, { files: ['jest.setup.ts', 'jest.config.ts'], diff --git a/packages/replay/rollup.bundle.config.mjs b/packages/replay/rollup.bundle.config.mjs index a209b8d41af4..8bdc41f8001c 100644 --- a/packages/replay/rollup.bundle.config.mjs +++ b/packages/replay/rollup.bundle.config.mjs @@ -3,7 +3,6 @@ import { makeBaseBundleConfig, makeBundleConfigVariants } from '@sentry-internal const baseBundleConfig = makeBaseBundleConfig({ bundleType: 'addon', entrypoints: ['src/index.ts'], - jsVersion: 'es6', licenseTitle: '@sentry/replay', outputFileBase: () => 'bundles/replay', }); diff --git a/packages/serverless/rollup.aws.config.mjs b/packages/serverless/rollup.aws.config.mjs index 5d9883a3f9f7..f50694404dee 100644 --- a/packages/serverless/rollup.aws.config.mjs +++ b/packages/serverless/rollup.aws.config.mjs @@ -7,7 +7,6 @@ export default [ // this automatically sets it to be CJS bundleType: 'node', entrypoints: ['src/index.awslambda.ts'], - jsVersion: 'es6', licenseTitle: '@sentry/serverless', outputFileBase: () => 'index', packageSpecificConfig: { diff --git a/packages/svelte/.eslintrc.js b/packages/svelte/.eslintrc.js index b6d4608e8e7b..8afbbfe212c6 100644 --- a/packages/svelte/.eslintrc.js +++ b/packages/svelte/.eslintrc.js @@ -11,7 +11,4 @@ module.exports = { }, ], extends: ['../../.eslintrc.js'], - rules: { - '@sentry-internal/sdk/no-unsupported-es6-methods': 'off', - }, }; diff --git a/packages/types/tsconfig.json b/packages/types/tsconfig.json index 9cbd605aef9a..d38a5701a2bf 100644 --- a/packages/types/tsconfig.json +++ b/packages/types/tsconfig.json @@ -4,6 +4,6 @@ "include": ["src/**/*"], "compilerOptions": { - "lib": ["ES6"] + "lib": ["es2017"] } } diff --git a/packages/typescript/tsconfig.json b/packages/typescript/tsconfig.json index 107a5888e432..8f773bca55e3 100644 --- a/packages/typescript/tsconfig.json +++ b/packages/typescript/tsconfig.json @@ -7,7 +7,7 @@ "importHelpers": true, "inlineSources": true, "isolatedModules": true, - "lib": ["es6", "dom"], + "lib": ["es2017", "dom"], "moduleResolution": "node", "noErrorTruncation": true, "noFallthroughCasesInSwitch": true, @@ -19,6 +19,6 @@ "sourceMap": true, "strict": true, "strictBindCallApply": false, - "target": "es6" + "target": "es2017" } } diff --git a/packages/vercel-edge/.eslintrc.js b/packages/vercel-edge/.eslintrc.js index bec6469d0e28..9d915d4f4c3b 100644 --- a/packages/vercel-edge/.eslintrc.js +++ b/packages/vercel-edge/.eslintrc.js @@ -6,7 +6,6 @@ module.exports = { rules: { '@sentry-internal/sdk/no-optional-chaining': 'off', '@sentry-internal/sdk/no-nullish-coalescing': 'off', - '@sentry-internal/sdk/no-unsupported-es6-methods': 'off', '@sentry-internal/sdk/no-class-field-initializers': 'off', }, }; diff --git a/packages/vue/src/vendor/components.ts b/packages/vue/src/vendor/components.ts index d6bb5b113590..a19dab78d99f 100644 --- a/packages/vue/src/vendor/components.ts +++ b/packages/vue/src/vendor/components.ts @@ -32,9 +32,7 @@ const ROOT_COMPONENT_NAME = ''; const ANONYMOUS_COMPONENT_NAME = ''; const repeat = (str: string, n: number): string => { - // string.repeat() is not supported by IE11, we fall back to just using the string in that case - // eslint-disable-next-line @sentry-internal/sdk/no-unsupported-es6-methods - return str.repeat ? str.repeat(n) : str; + return str.repeat(n); }; export const formatComponentName = (vm?: ViewModel, includeFile?: boolean): string => { diff --git a/packages/wasm/rollup.bundle.config.mjs b/packages/wasm/rollup.bundle.config.mjs index b149d75d6244..e172565bd76f 100644 --- a/packages/wasm/rollup.bundle.config.mjs +++ b/packages/wasm/rollup.bundle.config.mjs @@ -3,7 +3,6 @@ import { makeBaseBundleConfig, makeBundleConfigVariants } from '@sentry-internal const baseBundleConfig = makeBaseBundleConfig({ bundleType: 'addon', entrypoints: ['src/index.ts'], - jsVersion: 'es6', licenseTitle: '@sentry/wasm', outputFileBase: () => 'bundles/wasm', }); From 9405d716e90e5c07993785078dfe91e73714d49d Mon Sep 17 00:00:00 2001 From: s1gr1d Date: Wed, 6 Mar 2024 11:24:00 +0100 Subject: [PATCH 2/3] add clarifying comment --- packages/node-experimental/test/helpers/error.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/node-experimental/test/helpers/error.ts b/packages/node-experimental/test/helpers/error.ts index 0228338f036b..03d4150c3f11 100644 --- a/packages/node-experimental/test/helpers/error.ts +++ b/packages/node-experimental/test/helpers/error.ts @@ -1,3 +1,4 @@ +/* this method is exported from an external file to be able to test contextlines when adding an external file */ export function getError(): Error { return new Error('mock error'); } From a8793be1d943589c1f78ef852259ab79b63a9521 Mon Sep 17 00:00:00 2001 From: s1gr1d Date: Thu, 7 Mar 2024 09:17:13 +0100 Subject: [PATCH 3/3] update min browser versions --- MIGRATION.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MIGRATION.md b/MIGRATION.md index ad036f346760..1d36b7060abe 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -30,12 +30,12 @@ fetch API to be available in the environment. New minimum supported browsers: -- Chrome 51 +- Chrome 58 - Edge 15 -- Safari/iOS Safari 10 +- Safari/iOS Safari 11 - Firefox 54 -- Opera 38 -- Samnsung Internet 5 +- Opera 45 +- Samsung Internet 7.2 For IE11 support please transpile your code to ES5 using babel or similar and add required polyfills.