fix(core): remove ses lockdown (#5350)

This commit is contained in:
LongYinan 2023-12-20 04:11:34 +00:00
parent e3882f9648
commit 800ea0abf1
No known key found for this signature in database
GPG Key ID: 30B1140CE1C07C99
7 changed files with 17 additions and 70 deletions

View File

@ -78,7 +78,7 @@
"react-is": "18.2.0", "react-is": "18.2.0",
"react-router-dom": "^6.16.0", "react-router-dom": "^6.16.0",
"rxjs": "^7.8.1", "rxjs": "^7.8.1",
"ses": "0.18.8", "ses": "^1.0.0",
"swr": "2.2.4", "swr": "2.2.4",
"uuid": "^9.0.1", "uuid": "^9.0.1",
"valtio": "^1.11.2", "valtio": "^1.11.2",

View File

@ -1,4 +1,3 @@
import '../polyfill/ses-lockdown';
import '../polyfill/intl-segmenter'; import '../polyfill/intl-segmenter';
import { assertExists } from '@blocksuite/global/utils'; import { assertExists } from '@blocksuite/global/utils';
@ -19,7 +18,7 @@ async function main() {
const { setup } = await import('../bootstrap/setup'); const { setup } = await import('../bootstrap/setup');
const rootStore = getCurrentStore(); const rootStore = getCurrentStore();
setup(); setup();
const { _pluginNestedImportsMap } = createSetup(rootStore); createSetup(rootStore);
const pluginRegisterPromise = bootstrapPluginSystem(rootStore); const pluginRegisterPromise = bootstrapPluginSystem(rootStore);
const root = document.getElementById('app'); const root = document.getElementById('app');
assertExists(root); assertExists(root);
@ -27,11 +26,6 @@ async function main() {
const App = () => { const App = () => {
use(pluginRegisterPromise); use(pluginRegisterPromise);
const plugins = useAtomValue(loadedPluginNameAtom); const plugins = useAtomValue(loadedPluginNameAtom);
_pluginNestedImportsMap.forEach(value => {
const exports = value.get('index.js');
assertExists(exports);
assertExists(exports?.get('entry'));
});
return ( return (
<div> <div>
<div data-plugins-load-status="success"> <div data-plugins-load-status="success">

View File

@ -1,4 +1,4 @@
import './polyfill/ses-lockdown'; import 'ses';
import './polyfill/intl-segmenter'; import './polyfill/intl-segmenter';
import './polyfill/request-idle-callback'; import './polyfill/request-idle-callback';

View File

@ -1,19 +0,0 @@
import 'ses';
if (!process.env.COVERAGE) {
lockdown({
evalTaming: 'unsafeEval',
overrideTaming: 'severe',
consoleTaming: 'unsafe',
errorTaming: 'unsafe',
errorTrapping: 'platform',
unhandledRejectionTrapping: 'report',
});
console.log('SES lockdown complete');
} else {
Object.defineProperty(globalThis, 'harden', {
value: (x: any) => Object.freeze(x),
writable: false,
});
}

View File

@ -26,7 +26,6 @@
"jest-mock": "^29.7.0", "jest-mock": "^29.7.0",
"nanoid": "^5.0.3", "nanoid": "^5.0.3",
"serve": "^14.2.1", "serve": "^14.2.1",
"ses": "0.18.8",
"storybook": "^7.5.3", "storybook": "^7.5.3",
"storybook-dark-mode": "^3.0.1", "storybook-dark-mode": "^3.0.1",
"wait-on": "^7.2.0" "wait-on": "^7.2.0"

View File

@ -10,7 +10,6 @@
"tsconfig.json" "tsconfig.json"
], ],
"dependencies": { "dependencies": {
"@endo/static-module-record": "0.8.2",
"@plugxjs/vite-plugin": "0.1.0", "@plugxjs/vite-plugin": "0.1.0",
"@swc/core": "^1.3.93", "@swc/core": "^1.3.93",
"@toeverything/infra": "workspace:^", "@toeverything/infra": "workspace:^",

View File

@ -424,7 +424,7 @@ __metadata:
react-is: "npm:18.2.0" react-is: "npm:18.2.0"
react-router-dom: "npm:^6.16.0" react-router-dom: "npm:^6.16.0"
rxjs: "npm:^7.8.1" rxjs: "npm:^7.8.1"
ses: "npm:0.18.8" ses: "npm:^1.0.0"
source-map-loader: "npm:^4.0.1" source-map-loader: "npm:^4.0.1"
style-loader: "npm:^3.3.3" style-loader: "npm:^3.3.3"
swc-loader: "npm:^0.2.3" swc-loader: "npm:^0.2.3"
@ -693,7 +693,6 @@ __metadata:
version: 0.0.0-use.local version: 0.0.0-use.local
resolution: "@affine/plugin-cli@workspace:tools/plugin-cli" resolution: "@affine/plugin-cli@workspace:tools/plugin-cli"
dependencies: dependencies:
"@endo/static-module-record": "npm:0.8.2"
"@plugxjs/vite-plugin": "npm:0.1.0" "@plugxjs/vite-plugin": "npm:0.1.0"
"@swc/core": "npm:^1.3.93" "@swc/core": "npm:^1.3.93"
"@toeverything/infra": "workspace:^" "@toeverything/infra": "workspace:^"
@ -874,7 +873,6 @@ __metadata:
react-dom: "npm:18.2.0" react-dom: "npm:18.2.0"
react-router-dom: "npm:^6.19.0" react-router-dom: "npm:^6.19.0"
serve: "npm:^14.2.1" serve: "npm:^14.2.1"
ses: "npm:0.18.8"
storybook: "npm:^7.5.3" storybook: "npm:^7.5.3"
storybook-addon-react-router-v6: "npm:^2.0.10" storybook-addon-react-router-v6: "npm:^2.0.10"
storybook-dark-mode: "npm:^3.0.1" storybook-dark-mode: "npm:^3.0.1"
@ -956,17 +954,6 @@ __metadata:
languageName: unknown languageName: unknown
linkType: soft linkType: soft
"@agoric/babel-generator@npm:^7.17.6":
version: 7.17.6
resolution: "@agoric/babel-generator@npm:7.17.6"
dependencies:
"@babel/types": "npm:^7.17.0"
jsesc: "npm:^2.5.1"
source-map: "npm:^0.5.0"
checksum: 12cd14851369eeb8c3892c8a81a7100bc468758c4c464b088d46b3e365cdb6572896aeef5dc9e76f243613c7373231cb1de2e21de8fc5cbf85b4178653b2de8a
languageName: node
linkType: hard
"@ampproject/remapping@npm:^2.2.0": "@ampproject/remapping@npm:^2.2.0":
version: 2.2.1 version: 2.2.1
resolution: "@ampproject/remapping@npm:2.2.1" resolution: "@ampproject/remapping@npm:2.2.1"
@ -2779,7 +2766,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.13.16, @babel/parser@npm:^7.14.0, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.16.8, @babel/parser@npm:^7.17.3, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.22.15, @babel/parser@npm:^7.22.7, @babel/parser@npm:^7.23.0, @babel/parser@npm:^7.23.3, @babel/parser@npm:^7.23.6": "@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.13.16, @babel/parser@npm:^7.14.0, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.16.8, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.22.15, @babel/parser@npm:^7.22.7, @babel/parser@npm:^7.23.0, @babel/parser@npm:^7.23.3, @babel/parser@npm:^7.23.6":
version: 7.23.6 version: 7.23.6
resolution: "@babel/parser@npm:7.23.6" resolution: "@babel/parser@npm:7.23.6"
bin: bin:
@ -4047,7 +4034,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@babel/traverse@npm:^7.14.0, @babel/traverse@npm:^7.16.0, @babel/traverse@npm:^7.16.8, @babel/traverse@npm:^7.17.3, @babel/traverse@npm:^7.18.9, @babel/traverse@npm:^7.22.8, @babel/traverse@npm:^7.23.3, @babel/traverse@npm:^7.23.4": "@babel/traverse@npm:^7.14.0, @babel/traverse@npm:^7.16.0, @babel/traverse@npm:^7.16.8, @babel/traverse@npm:^7.18.9, @babel/traverse@npm:^7.22.8, @babel/traverse@npm:^7.23.3, @babel/traverse@npm:^7.23.4":
version: 7.23.6 version: 7.23.6
resolution: "@babel/traverse@npm:7.23.6" resolution: "@babel/traverse@npm:7.23.6"
dependencies: dependencies:
@ -4065,7 +4052,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@babel/types@npm:^7.0.0, @babel/types@npm:^7.16.8, @babel/types@npm:^7.17.0, @babel/types@npm:^7.18.13, @babel/types@npm:^7.18.9, @babel/types@npm:^7.20.7, @babel/types@npm:^7.21.3, @babel/types@npm:^7.22.15, @babel/types@npm:^7.22.19, @babel/types@npm:^7.22.5, @babel/types@npm:^7.23.0, @babel/types@npm:^7.23.3, @babel/types@npm:^7.23.4, @babel/types@npm:^7.23.6, @babel/types@npm:^7.3.3, @babel/types@npm:^7.4.4, @babel/types@npm:^7.8.3": "@babel/types@npm:^7.0.0, @babel/types@npm:^7.16.8, @babel/types@npm:^7.18.13, @babel/types@npm:^7.18.9, @babel/types@npm:^7.20.7, @babel/types@npm:^7.21.3, @babel/types@npm:^7.22.15, @babel/types@npm:^7.22.19, @babel/types@npm:^7.22.5, @babel/types@npm:^7.23.0, @babel/types@npm:^7.23.3, @babel/types@npm:^7.23.4, @babel/types@npm:^7.23.6, @babel/types@npm:^7.3.3, @babel/types@npm:^7.4.4, @babel/types@npm:^7.8.3":
version: 7.23.6 version: 7.23.6
resolution: "@babel/types@npm:7.23.6" resolution: "@babel/types@npm:7.23.6"
dependencies: dependencies:
@ -5197,23 +5184,10 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@endo/env-options@npm:^0.1.4": "@endo/env-options@npm:^1.0.0":
version: 0.1.4 version: 1.0.0
resolution: "@endo/env-options@npm:0.1.4" resolution: "@endo/env-options@npm:1.0.0"
checksum: 0d6b82bdf07602dfc373a475234a206b61e9d0ab6ea886fdcbd111a37d9ce4e55ead5dbc1c7af52cf67a11a7185b40e7b30c3367da3928897082502d7e1274f1 checksum: 3f1f8fe2966ca26388d49fdae12a940564a96f185b43e2a59cade126b00b1894970fe1da4c8a7d042929f598a923bbc800ed7841adf11a6f4d7c6460e522cb2a
languageName: node
linkType: hard
"@endo/static-module-record@npm:0.8.2":
version: 0.8.2
resolution: "@endo/static-module-record@npm:0.8.2"
dependencies:
"@agoric/babel-generator": "npm:^7.17.6"
"@babel/parser": "npm:^7.17.3"
"@babel/traverse": "npm:^7.17.3"
"@babel/types": "npm:^7.17.0"
ses: "npm:^0.18.8"
checksum: 49585fede4edcf3e5f4e578142c902a440d4176434b9213b7d1aaca7d496784eaaac11355f3c8fd2eff7a351d1a8f17c479949f69828ece7f66c4ef9153c29e9
languageName: node languageName: node
linkType: hard linkType: hard
@ -33052,12 +33026,12 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"ses@npm:0.18.8, ses@npm:^0.18.8": "ses@npm:^1.0.0":
version: 0.18.8 version: 1.0.0
resolution: "ses@npm:0.18.8" resolution: "ses@npm:1.0.0"
dependencies: dependencies:
"@endo/env-options": "npm:^0.1.4" "@endo/env-options": "npm:^1.0.0"
checksum: 243b8d546ca2f0ad68cda1178689c4a4bfab8ac25fd03daccaf6c4b94ee0c10b07eb10b8d477c73ceef9ba10a2205d2bef0bd3c64b8c98130c01adfd9c873103 checksum: 27430e2fbe6440189e8d7b105716ef11da78d642861815f9a3513bc20fd5e0a00a314fa0d57b46bc7e458a68e9a878e7466cdffc3efdd92f57bbbbbb4f021e10
languageName: node languageName: node
linkType: hard linkType: hard
@ -33499,7 +33473,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"source-map@npm:^0.5.0, source-map@npm:^0.5.7": "source-map@npm:^0.5.7":
version: 0.5.7 version: 0.5.7
resolution: "source-map@npm:0.5.7" resolution: "source-map@npm:0.5.7"
checksum: 9b4ac749ec5b5831cad1f8cc4c19c4298ebc7474b24a0acf293e2f040f03f8eeccb3d01f12aa0f90cf46d555c887e03912b83a042c627f419bda5152d89c5269 checksum: 9b4ac749ec5b5831cad1f8cc4c19c4298ebc7474b24a0acf293e2f040f03f8eeccb3d01f12aa0f90cf46d555c887e03912b83a042c627f419bda5152d89c5269