Skip to content

Commit

Permalink
feat: support back to chrome 115 (#11754)
Browse files Browse the repository at this point in the history
* feat: support back to chrome 115

* feat: support back to chrome 115

* feat: support back to chrome 115
  • Loading branch information
Jack-Works authored Aug 21, 2024
1 parent adeddde commit eecd475
Show file tree
Hide file tree
Showing 14 changed files with 328 additions and 172 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
"@masknet/config": "workspace:^",
"@masknet/eslint-plugin": "^0.3.0",
"@nice-labs/git-rev": "^3.5.1",
"@swc-node/register": "^1.10.0",
"@swc/core": "1.6.6",
"@swc-node/register": "^1.10.9",
"@swc/core": "1.7.14",
"@tanstack/eslint-plugin-query": "^5.51.15",
"@types/lodash-es": "^4.17.12",
"@vitest/ui": "^1.6.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/config/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
// Language and Environment
"jsx": "react-jsx",
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"target": "ES2022",
"target": "ES2023",
"useDefineForClassFields": true,

// Projects
Expand Down
2 changes: 1 addition & 1 deletion packages/injected-script/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default defineConfig({
},
plugins: [
//
swc({ tsconfig: '../../tsconfig.json' }),
swc({ tsconfig: '../../tsconfig.json', jsc: { target: 'es2022' } }),
minify({ mangle: false, compress: false }),
],
})
2 changes: 1 addition & 1 deletion packages/mask-sdk/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default defineConfig({
plugins: [
//
nodeResolve(),
swc({ tsconfig: '../../tsconfig.json' }),
swc({ tsconfig: '../../tsconfig.json', jsc: { target: 'es2022' } }),
minify({ mangle: false, compress: false }),
image(),
],
Expand Down
2 changes: 1 addition & 1 deletion packages/mask/.webpack/manifest/manifest-mv3.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"use_dynamic_url": false
}
],
"minimum_chrome_version": "102",
"minimum_chrome_version": "115",
"browser_specific_settings": {
"gecko": {
"id": "{0e57e2ae-3e13-4d5d-9243-6159219852a6}"
Expand Down
4 changes: 2 additions & 2 deletions packages/mask/.webpack/plugins/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ function prepareAllManifest(flags: NormalizedFlags, computedFlags: ComputedFlags

const manifestFlags: Record<NormalizedFlags['manifestFile'], ManifestPresets> = {
'chromium-beta-mv3': [{ ...flags, channel: 'beta' }, mv3Base],
'chromium-mv2': [flags, mv2Base],
'chromium-mv3': [flags, mv3Base],
'chromium-mv2': [flags, mv2Base, (manifest: ManifestV2) => (manifest.browser_specific_settings = undefined)],
'chromium-mv3': [flags, mv3Base, (manifest: ManifestV3) => (manifest.browser_specific_settings = undefined)],
'firefox-mv2': [flags, mv2Base, (manifest: ManifestV2) => manifest.permissions!.push('tabs')],
'firefox-mv3': [
flags,
Expand Down
2 changes: 1 addition & 1 deletion packages/mask/public/jsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"lib": ["ESNext", "DOM"],
"target": "ES2022"
"target": "ES2023"
},
"include": ["./"]
}
2 changes: 1 addition & 1 deletion packages/mask/web-workers/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"rootDir": "./",
"outDir": "../dist/web-workers/",
"tsBuildInfoFile": "../dist/web-worker.tsbuildinfo",
"lib": ["WebWorker", "ES2020"]
"lib": ["WebWorker", "ES2023"]
},
"include": ["./"],
"references": []
Expand Down
13 changes: 4 additions & 9 deletions packages/polyfills/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,15 @@

## Supporting browsers

- Chrome Last 2 versions (about 3 months)
- Firefox Last 2 versions (about 3 months)
- Chrome 115 (about 1 year)
- Firefox latest (not releasing)
- Safari latest (not releasing)

## Targeting ES Syntax and APIs

- Syntax: ES2022
- Syntax: ES2023
- Library: ESNext (with [core-js](https://github.com/zloirock/core-js)).

### Caution

Those features are not easy to polyfill.

- ES2017: SharedArrayBuffer and Atomics

## Web APIs and Intl APIs

Check and polyfill before using.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { swc, minify } from 'rollup-plugin-swc3'
const require = createRequire(import.meta.url)
const compat = require('core-js-compat/compat')
const { list } = compat({
targets: ['last 3 Chrome versions', 'last 3 Firefox versions', 'Safari 17'],
targets: ['Chrome 115', 'last 1 Firefox versions', 'last 1 Safari versions'],
modules: ['core-js/stable'],
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ if (built) process.exit(0)
await mkdir(new URL('./dist/', import.meta.url)).catch(() => '')
await writeFile(versionFilePath, polyfillVersion)

export default (await import('./config.js')).default
export default (await import('./config.mjs')).default
3 changes: 2 additions & 1 deletion packages/scripts/src/extension/init.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import 'webpack/bin/webpack.js'
import { createRequire } from 'module'
createRequire(import.meta.url)('webpack/bin/webpack.js')
3 changes: 1 addition & 2 deletions packages/sentry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
"devDependencies": {
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.7",
"rollup": "^4.18.0",
"rollup-plugin-swc3": "^0.11.2"
"rollup": "^4.18.0"
},
"scripts": {
"start": "rollup -c -w",
Expand Down
Loading

0 comments on commit eecd475

Please sign in to comment.