✨ Parameters support web wasm scenarios
This commit is contained in:
13
bin/README.md
vendored
13
bin/README.md
vendored
@@ -271,6 +271,19 @@ Launch the application in incognito/private browsing mode. Default is `false`. W
|
||||
--incognito
|
||||
```
|
||||
|
||||
#### [wasm]
|
||||
|
||||
Enable WebAssembly support with cross-origin isolation headers. Required for Flutter Web applications and other web applications that use WebAssembly modules like `sqlite3.wasm`, `canvaskit.wasm`. Default is `false`.
|
||||
|
||||
This option adds necessary HTTP headers (`Cross-Origin-Opener-Policy: same-origin` and `Cross-Origin-Embedder-Policy: require-corp`) and browser flags to enable SharedArrayBuffer and WebAssembly features.
|
||||
|
||||
```shell
|
||||
--wasm
|
||||
|
||||
# Example: Package a Flutter Web app with WASM support
|
||||
pake https://flutter.dev --name FlutterApp --wasm
|
||||
```
|
||||
|
||||
#### [installer-language]
|
||||
|
||||
Set the Windows Installer language. Options include `zh-CN`, `ja-JP`, More at [Tauri Document](https://tauri.app/distribute/windows-installer/#internationalization). Default is `en-US`.
|
||||
|
||||
13
bin/README_CN.md
vendored
13
bin/README_CN.md
vendored
@@ -259,6 +259,19 @@ pake [url] [options]
|
||||
--incognito
|
||||
```
|
||||
|
||||
#### [wasm]
|
||||
|
||||
启用 WebAssembly 支持,添加跨域隔离头部,适用于 Flutter Web 应用以及其他使用 WebAssembly 模块(如 `sqlite3.wasm`、`canvaskit.wasm`)的 Web 应用,默认为 `false`。
|
||||
|
||||
此选项会添加必要的 HTTP 头部(`Cross-Origin-Opener-Policy: same-origin` 和 `Cross-Origin-Embedder-Policy: require-corp`)以及浏览器标志,以启用 SharedArrayBuffer 和 WebAssembly 功能。
|
||||
|
||||
```shell
|
||||
--wasm
|
||||
|
||||
# 示例:打包支持 WASM 的 Flutter Web 应用
|
||||
pake https://flutter.dev --name FlutterApp --wasm
|
||||
```
|
||||
|
||||
#### [title]
|
||||
|
||||
设置窗口标题栏文本。如果未指定,窗口标题将为空。
|
||||
|
||||
16
bin/cli.ts
vendored
16
bin/cli.ts
vendored
@@ -135,6 +135,11 @@ program
|
||||
.default(DEFAULT.incognito)
|
||||
.hideHelp(),
|
||||
)
|
||||
.addOption(
|
||||
new Option('--wasm', 'Enable WebAssembly support (Flutter Web, etc.)')
|
||||
.default(DEFAULT.wasm)
|
||||
.hideHelp(),
|
||||
)
|
||||
.addOption(
|
||||
new Option('--installer-language <string>', 'Installer language')
|
||||
.default(DEFAULT.installerLanguage)
|
||||
@@ -145,15 +150,10 @@ program
|
||||
await checkUpdateTips();
|
||||
|
||||
if (!url) {
|
||||
program.outputHelp((str) => {
|
||||
return str
|
||||
.split('\n')
|
||||
.filter(
|
||||
(line) => !/((-h,|--help)|((-v|-V),|--version))\s+.+$/.test(line),
|
||||
)
|
||||
.join('\n');
|
||||
program.help({
|
||||
error: false
|
||||
});
|
||||
process.exit(0);
|
||||
return;
|
||||
}
|
||||
|
||||
log.setDefaultLevel('info');
|
||||
|
||||
1
bin/defaults.ts
vendored
1
bin/defaults.ts
vendored
@@ -24,6 +24,7 @@ export const DEFAULT_PAKE_OPTIONS: PakeCliOptions = {
|
||||
installerLanguage: 'en-US',
|
||||
hideOnClose: true,
|
||||
incognito: false,
|
||||
wasm: false,
|
||||
};
|
||||
|
||||
// Just for cli development
|
||||
|
||||
12
bin/helpers/merge.ts
vendored
12
bin/helpers/merge.ts
vendored
@@ -60,6 +60,7 @@ export async function mergeConfig(
|
||||
hideOnClose,
|
||||
incognito,
|
||||
title,
|
||||
wasm,
|
||||
} = options;
|
||||
|
||||
const { platform } = process;
|
||||
@@ -78,6 +79,7 @@ export async function mergeConfig(
|
||||
hide_on_close: hideOnClose,
|
||||
incognito: incognito,
|
||||
title: title || null,
|
||||
enable_wasm: wasm,
|
||||
};
|
||||
Object.assign(tauriConf.pake.windows[0], { url, ...tauriConfWindowOptions });
|
||||
|
||||
@@ -312,6 +314,16 @@ StartupNotify=true
|
||||
}
|
||||
tauriConf.pake.proxy_url = proxyUrl || '';
|
||||
|
||||
// Configure WASM support with required HTTP headers
|
||||
if (wasm) {
|
||||
tauriConf.app.security = {
|
||||
headers: {
|
||||
'Cross-Origin-Opener-Policy': 'same-origin',
|
||||
'Cross-Origin-Embedder-Policy': 'require-corp'
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Save config file.
|
||||
const platformConfigPaths: PlatformMap = {
|
||||
win32: 'tauri.windows.conf.json',
|
||||
|
||||
3
bin/types.ts
vendored
3
bin/types.ts
vendored
@@ -78,6 +78,9 @@ export interface PakeCliOptions {
|
||||
|
||||
// Launch app in incognito/private mode, default false
|
||||
incognito: boolean;
|
||||
|
||||
// Enable WebAssembly support (Flutter Web, etc.), default false
|
||||
wasm: boolean;
|
||||
}
|
||||
|
||||
export interface PakeAppOptions extends PakeCliOptions {
|
||||
|
||||
Reference in New Issue
Block a user