Skip to content

Commit ee10d72

Browse files
committed
add --sab to enable SharedArrayBuffer
1 parent e3f1e84 commit ee10d72

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

bin/serve.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ const getHelp = () => chalk`
8787
8888
-C, --cors Enable CORS, sets \`Access-Control-Allow-Origin\` to \`*\`
8989
90+
--sab Enable SharedArrayBuffer, sets \`Cross-Origin-Opener-Policy\` to
91+
\`same-origin\` and \`Cross-Origin-Embedder-Policy\` to \`require-corp\`
92+
9093
-n, --no-clipboard Do not copy the local address to the clipboard
9194
9295
-u, --no-compression Do not compress files
@@ -195,6 +198,10 @@ const startEndpoint = (endpoint, config, args, previous) => {
195198
if (args['--cors']) {
196199
response.setHeader('Access-Control-Allow-Origin', '*');
197200
}
201+
if (args['--sab']) {
202+
response.setHeader('Cross-Origin-Opener-Policy', 'same-origin');
203+
response.setHeader('Cross-Origin-Embedder-Policy', 'require-corp');
204+
}
198205
if (compress) {
199206
await compressionHandler(request, response);
200207
}
@@ -381,6 +388,7 @@ const loadConfig = async (cwd, entry, args) => {
381388
'--no-etag': Boolean,
382389
'--symlinks': Boolean,
383390
'--cors': Boolean,
391+
'--sab': Boolean,
384392
'--no-port-switching': Boolean,
385393
'--ssl-cert': String,
386394
'--ssl-key': String,

0 commit comments

Comments
 (0)