Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernise browser packages #2224

Draft
wants to merge 95 commits into
base: next
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
c9e06d0
chore: :construction_worker: install rollup
gingerbenw Oct 15, 2024
c27732a
refactor: :recycle: convert plugin-window-onerror to typescript
gingerbenw Oct 15, 2024
2678ffa
update rollup configuration
gingerbenw Oct 15, 2024
90fbe0b
install additional rollup plugins
gingerbenw Oct 15, 2024
051d4d5
remove optional chaining
gingerbenw Oct 15, 2024
ce08563
update eslint rules
gingerbenw Oct 15, 2024
f1a7836
copy rollup config
gingerbenw Oct 15, 2024
c63b6f2
update main and browser fields
gingerbenw Oct 15, 2024
8358eec
update main entry
gingerbenw Oct 15, 2024
688e156
update test import
gingerbenw Oct 15, 2024
dbba564
copy rollup config
gingerbenw Oct 15, 2024
84d7c4b
move types before module exports
gingerbenw Oct 15, 2024
d087afc
exclude built js files from type check
gingerbenw Oct 15, 2024
47cfa56
build all packages for electron
gingerbenw Oct 15, 2024
e712f1b
chore: :label: add type definition for isError
gingerbenw Oct 16, 2024
d3e9814
refactor: :recycle: convert plugin-window-unhandled-rejection to type…
gingerbenw Oct 16, 2024
261940c
fix: :building_construction: fix rollup configuration
gingerbenw Oct 16, 2024
174db24
refactor: :recycle: refactor plugin-app-duration to typescript es module
gingerbenw Oct 16, 2024
d4b9423
refactor: :recycle: simplify rollup config
gingerbenw Oct 16, 2024
85d28ca
refactor: :recycle: convert plugin-browser-device to typescript es mo…
gingerbenw Oct 16, 2024
2a93404
fix rollup config
gingerbenw Oct 16, 2024
6c55ca5
fix main entry point
gingerbenw Oct 16, 2024
127e52d
update rollup config and ts test
gingerbenw Oct 17, 2024
344a1dc
add missing @ts-expect-error comment
gingerbenw Oct 24, 2024
2b386b5
Convert @bugsnag/plugin-browser-request to TypeScript (#2236)
AnastasiiaSvietlova Oct 28, 2024
42ca600
Convert @bugsnag/plugin-browser-context to TypeScript (#2240)
AnastasiiaSvietlova Oct 28, 2024
a42bd37
Convert plugin-console-breadcrumbs to TypeScript
AnastasiiaSvietlova Oct 28, 2024
6dbb7fb
fix: process TS error
AnastasiiaSvietlova Oct 28, 2024
ce6ebf5
fix: console methods type
AnastasiiaSvietlova Oct 28, 2024
033abb5
chore: :label: fix rollup build by updating types
gingerbenw Oct 29, 2024
4b0da6a
chore: :label: fix types and remove usage of ts-expect-error
gingerbenw Oct 30, 2024
75dcb02
fix: :adhesive_bandage: update types and exports
gingerbenw Oct 30, 2024
de732b6
Convert plugin-network-breadcrumbs to TypeScript
AnastasiiaSvietlova Oct 29, 2024
8a086c7
fix: types
AnastasiiaSvietlova Oct 29, 2024
08ed57c
update types and exports
gingerbenw Oct 30, 2024
eade9df
chore: :adhesive_bandage: simplify types
gingerbenw Nov 5, 2024
97819cb
Convert @bugsnag/plugin-simple-throttle to TypeScript (#2242)
AnastasiiaSvietlova Nov 15, 2024
5d0aab7
refactor: :recycle: refactor delivery-x-domain-request to TypeScript …
gingerbenw Nov 20, 2024
24cafcd
chore: :label: update type definition
gingerbenw Nov 20, 2024
c0208be
update json-payload declaraiton
gingerbenw Nov 21, 2024
9ee5726
Fix NoSuchMethodError in ReactNative tests
gingerbenw Nov 21, 2024
799e766
refactor: :recycle: refactor @bugsnag/delivery-xml-http-request
gingerbenw Nov 20, 2024
60c1586
remove delivery-xml-http-request from root tsconfig
gingerbenw Nov 21, 2024
bf033a0
update files list to include 'dist'
gingerbenw Nov 21, 2024
fb59b53
update files list
gingerbenw Nov 21, 2024
46873ef
Merge pull request #2255 from bugsnag/PLAT-13092/delivery-x-domain-re…
gingerbenw Nov 22, 2024
15622fb
Merge pull request #2256 from bugsnag/PLAT-13093/delivery-xml-http-re…
gingerbenw Nov 22, 2024
0fea542
chore: :construction_worker: install rollup
gingerbenw Oct 15, 2024
69a24a8
refactor: :recycle: convert plugin-window-onerror to typescript
gingerbenw Oct 15, 2024
224ee1a
update rollup configuration
gingerbenw Oct 15, 2024
a917320
install additional rollup plugins
gingerbenw Oct 15, 2024
0ec2023
remove optional chaining
gingerbenw Oct 15, 2024
e2e66f9
update eslint rules
gingerbenw Oct 15, 2024
3a47c30
copy rollup config
gingerbenw Oct 15, 2024
72946b9
update main and browser fields
gingerbenw Oct 15, 2024
2fba538
update main entry
gingerbenw Oct 15, 2024
6759528
update test import
gingerbenw Oct 15, 2024
ec485dd
copy rollup config
gingerbenw Oct 15, 2024
775a380
move types before module exports
gingerbenw Oct 15, 2024
eb2cdd3
exclude built js files from type check
gingerbenw Oct 15, 2024
5b66522
build all packages for electron
gingerbenw Oct 15, 2024
05414d7
chore: :label: add type definition for isError
gingerbenw Oct 16, 2024
17c9cb2
refactor: :recycle: convert plugin-window-unhandled-rejection to type…
gingerbenw Oct 16, 2024
830814d
fix: :building_construction: fix rollup configuration
gingerbenw Oct 16, 2024
1b62926
refactor: :recycle: refactor plugin-app-duration to typescript es module
gingerbenw Oct 16, 2024
fd951ce
refactor: :recycle: simplify rollup config
gingerbenw Oct 16, 2024
2bd91b6
refactor: :recycle: convert plugin-browser-device to typescript es mo…
gingerbenw Oct 16, 2024
c1b78ee
fix rollup config
gingerbenw Oct 16, 2024
081d827
fix main entry point
gingerbenw Oct 16, 2024
fdad689
update rollup config and ts test
gingerbenw Oct 17, 2024
d58a471
add missing @ts-expect-error comment
gingerbenw Oct 24, 2024
b513a37
Convert @bugsnag/plugin-browser-request to TypeScript (#2236)
AnastasiiaSvietlova Oct 28, 2024
93d05ec
Convert @bugsnag/plugin-browser-context to TypeScript (#2240)
AnastasiiaSvietlova Oct 28, 2024
af39cc2
Convert plugin-console-breadcrumbs to TypeScript
AnastasiiaSvietlova Oct 28, 2024
58f21cc
fix: process TS error
AnastasiiaSvietlova Oct 28, 2024
75dd156
fix: console methods type
AnastasiiaSvietlova Oct 28, 2024
d6d6694
chore: :label: fix rollup build by updating types
gingerbenw Oct 29, 2024
13aaae9
chore: :label: fix types and remove usage of ts-expect-error
gingerbenw Oct 30, 2024
500a600
fix: :adhesive_bandage: update types and exports
gingerbenw Oct 30, 2024
d55ed32
Convert plugin-network-breadcrumbs to TypeScript
AnastasiiaSvietlova Oct 29, 2024
258c27e
fix: types
AnastasiiaSvietlova Oct 29, 2024
a46e2c2
update types and exports
gingerbenw Oct 30, 2024
020790e
chore: :adhesive_bandage: simplify types
gingerbenw Nov 5, 2024
2eb67a5
Convert @bugsnag/plugin-simple-throttle to TypeScript (#2242)
AnastasiiaSvietlova Nov 15, 2024
334eb40
refactor: :recycle: refactor delivery-x-domain-request to TypeScript …
gingerbenw Nov 20, 2024
09f0d07
chore: :label: update type definition
gingerbenw Nov 20, 2024
30783a0
update json-payload declaraiton
gingerbenw Nov 21, 2024
f30a045
update files list to include 'dist'
gingerbenw Nov 21, 2024
73f545d
refactor: :recycle: refactor @bugsnag/delivery-xml-http-request
gingerbenw Nov 20, 2024
8bee669
remove delivery-xml-http-request from root tsconfig
gingerbenw Nov 21, 2024
f66cf12
update files list
gingerbenw Nov 21, 2024
4605afc
Merge pull request #2261 from bugsnag/gingerbenw/rebase-integration-ts
gingerbenw Nov 25, 2024
af49fb0
Refactor @bugsnag/plugin-client-ip (#2260)
AnastasiiaSvietlova Nov 26, 2024
b3677d9
refactor: :recycle: refactor plugin-strip-query-string to TypeScript …
gingerbenw Nov 27, 2024
9a4591e
Merge pull request #2266 from bugsnag/PLAT-13091/plugin-strip-query-s…
gingerbenw Nov 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .buildkite/basic/electron-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ steps:
- echo "Running on Node `node -v`"
- npm install electron@${ELECTRON_VERSION} --no-audit --progress=false --no-save
- npm ci --no-audit --progress=false
- npm run build:electron
- npm run build
- defaults write com.apple.CrashReporter DialogType none
- npm run test:unit:electron-runner
- npm run test:electron
9 changes: 8 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ const ruleOverrides = {
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'off',
'@typescript-eslint/prefer-includes': 'off',
'@typescript-eslint/no-for-in-array': 'off',

// Optional chaining compiles to a lot more code
'@typescript-eslint/prefer-optional-chain': 'off',

// Support TypeScript 3.8 by disallowing import { type Module } from 'module'
'import/consistent-type-specifier-style': ['warn', 'prefer-top-level']
}

module.exports = {
Expand All @@ -44,7 +50,8 @@ module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
jsx: true,
ecmaVersion: 2018
ecmaVersion: 2018,
sourceType: 'module'
},
overrides: [
// linting for js files
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-electron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- run: npm ci --no-audit --progress=false
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npm run build:electron
- run: npm run build
shell: bash
- run: sudo apt-get install cppcheck --assume-yes
name: Install cppcheck
Expand Down
67 changes: 67 additions & 0 deletions .rollup/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import typescript from '@rollup/plugin-typescript'
import replace from '@rollup/plugin-replace'
import fs from 'fs'

const defaultOptions = () => ({
// additional variables to define with '@rollup/plugin-replace'
// e.g. '{ ABC: 123 }' is equivalent to running 'globalThis.ABC = 123'
additionalReplacements: {},
// additional external dependencies, such as '@bugsnag/browser'
external: [],
// the entry point for the bundle
input: undefined,
// output directory for the bundle
output: undefined
})

const sharedOutput = {
dir: 'dist',
generatedCode: {
preset: 'es2015',
}
}

function createRollupConfig (options = defaultOptions()) {
const packageJson = JSON.parse(fs.readFileSync(`${process.cwd()}/package.json`))

return {
input: options.input || 'src/index.ts',
output: options.output || [
{
...sharedOutput,
entryFileNames: '[name].js',
format: 'cjs'
},
{
...sharedOutput,
preserveModules: true,
entryFileNames: '[name].mjs',
format: 'esm'
}
],
external: ['@bugsnag/core'].concat(options.external),
plugins: [
replace({
preventAssignment: true,
values: {
__VERSION__: packageJson.version,
...options.additionalReplacements,
}
}),
typescript({
removeComments: true,
// don't output anything if there's a TS error
noEmitOnError: true,
// turn on declaration files and declaration maps
compilerOptions: {
declaration: true,
declarationMap: true,
emitDeclarationOnly: true,
declarationDir: 'dist/types',
}
})
]
}
}

export default createRollupConfig
1 change: 1 addition & 0 deletions dockerfiles/Dockerfile.browser
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ WORKDIR /app
COPY package*.json ./
COPY babel.config.js lerna.json .eslintignore .eslintrc.js jest.config.js tsconfig.json ./
ADD min_packages.tar .
COPY .rollup ./.rollup
COPY bin ./bin
COPY packages ./packages

Expand Down
1 change: 1 addition & 0 deletions dockerfiles/Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ WORKDIR /app
COPY package*.json ./
COPY babel.config.js lerna.json .eslintignore .eslintrc.js jest.config.js tsconfig.json ./
ADD min_packages.tar .
COPY .rollup ./.rollup
COPY bin ./bin
COPY scripts ./scripts
COPY test ./test
Expand Down
1 change: 1 addition & 0 deletions dockerfiles/Dockerfile.node
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ WORKDIR /app
COPY package*.json ./
COPY babel.config.js lerna.json .eslintignore .eslintrc.js jest.config.js tsconfig.json ./
ADD min_packages.tar .
COPY .rollup ./.rollup
COPY bin ./bin
COPY packages ./packages

Expand Down
Loading
Loading