pake-cli 2.3.7 → 2.4.0-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +27 -15
- package/dist/dev.js +644 -639
- package/dist/dev.js.map +1 -1
- package/package.json +4 -3
- package/src-tauri/.pake/pake.json +29 -0
- package/src-tauri/.pake/tauri.conf.json +75 -0
- package/src-tauri/.pake/tauri.macos.conf.json +29 -0
- package/src-tauri/Cargo.lock +193 -143
- package/src-tauri/Cargo.toml +5 -5
- package/src-tauri/pake.json +4 -1
- package/src-tauri/rust_proxy.toml +1 -5
- package/src-tauri/src/app/config.rs +7 -4
- package/src-tauri/src/app/menu.rs +1 -1
- package/src-tauri/src/app/window.rs +7 -6
- package/src-tauri/src/inject/event.js +11 -9
- package/src-tauri/src/inject/style.js +1 -1
- package/src-tauri/src/main.rs +26 -4
- package/src-tauri/src/util.rs +3 -0
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
import { InvalidArgumentError, program } from 'commander';
|
|
2
|
+
import { InvalidArgumentError, program, Option } from 'commander';
|
|
3
3
|
import log from 'loglevel';
|
|
4
4
|
import path from 'path';
|
|
5
5
|
import fsExtra from 'fs-extra';
|
|
@@ -20,7 +20,7 @@ import psl from 'psl';
|
|
|
20
20
|
import isUrl from 'is-url';
|
|
21
21
|
|
|
22
22
|
var name = "pake-cli";
|
|
23
|
-
var version = "2.
|
|
23
|
+
var version = "2.4.0-beta";
|
|
24
24
|
var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。";
|
|
25
25
|
var engines = {
|
|
26
26
|
node: ">=16.0.0"
|
|
@@ -68,7 +68,7 @@ var exports = "./dist/pake.js";
|
|
|
68
68
|
var license = "MIT";
|
|
69
69
|
var dependencies = {
|
|
70
70
|
"@tauri-apps/api": "^1.5.4",
|
|
71
|
-
"@tauri-apps/cli": "^1.5.
|
|
71
|
+
"@tauri-apps/cli": "^1.5.13",
|
|
72
72
|
axios: "^1.6.8",
|
|
73
73
|
chalk: "^5.3.0",
|
|
74
74
|
commander: "^11.1.0",
|
|
@@ -91,6 +91,7 @@ var devDependencies = {
|
|
|
91
91
|
"@rollup/plugin-terser": "^0.4.4",
|
|
92
92
|
"@types/fs-extra": "^11.0.4",
|
|
93
93
|
"@types/is-url": "^1.2.32",
|
|
94
|
+
"@types/node": "^20.12.10",
|
|
94
95
|
"@types/page-icon": "^0.3.6",
|
|
95
96
|
"@types/prompts": "^2.4.9",
|
|
96
97
|
"@types/psl": "^1.1.3",
|
|
@@ -99,7 +100,7 @@ var devDependencies = {
|
|
|
99
100
|
"@types/update-notifier": "^6.0.8",
|
|
100
101
|
"app-root-path": "^3.1.0",
|
|
101
102
|
"cross-env": "^7.0.3",
|
|
102
|
-
rollup: "^4.17.
|
|
103
|
+
rollup: "^4.17.2",
|
|
103
104
|
"rollup-plugin-typescript2": "^0.36.0",
|
|
104
105
|
tslib: "^2.6.2",
|
|
105
106
|
typescript: "^5.4.5"
|
|
@@ -125,12 +126,15 @@ var packageJson = {
|
|
|
125
126
|
var windows = [
|
|
126
127
|
{
|
|
127
128
|
url: "https://weread.qq.com",
|
|
129
|
+
url_type: "web",
|
|
128
130
|
transparent: true,
|
|
129
131
|
fullscreen: false,
|
|
130
132
|
width: 1200,
|
|
131
133
|
height: 780,
|
|
132
134
|
resizable: true,
|
|
133
|
-
|
|
135
|
+
always_on_top: false,
|
|
136
|
+
activation_shortcut: "",
|
|
137
|
+
disabled_web_shortcuts: false
|
|
134
138
|
}
|
|
135
139
|
];
|
|
136
140
|
var user_agent = {
|
|
@@ -427,7 +431,7 @@ async function isChinaIP(ip, domain) {
|
|
|
427
431
|
try {
|
|
428
432
|
const delay = await ping(ip);
|
|
429
433
|
logger.debug(`${domain} latency is ${delay} ms`);
|
|
430
|
-
return delay >
|
|
434
|
+
return delay > 500;
|
|
431
435
|
}
|
|
432
436
|
catch (error) {
|
|
433
437
|
logger.debug(`ping ${domain} failed!`);
|
|
@@ -470,7 +474,7 @@ async function combineFiles(files, output) {
|
|
|
470
474
|
}
|
|
471
475
|
|
|
472
476
|
async function mergeConfig(url, options, tauriConf) {
|
|
473
|
-
const { width, height, fullscreen, transparent, userAgent, showSystemTray, systemTrayIcon, iterCopyFile, identifier, name, resizable = true, inject, safeDomain, } = options;
|
|
477
|
+
const { width, height, fullscreen, transparent, alwaysOnTop, disabledWebShortcuts, userAgent, showSystemTray, systemTrayIcon, iterCopyFile, identifier, name, resizable = true, inject, safeDomain, } = options;
|
|
474
478
|
const { platform } = process;
|
|
475
479
|
// Set Windows parameters.
|
|
476
480
|
const tauriConfWindowOptions = {
|
|
@@ -478,6 +482,8 @@ async function mergeConfig(url, options, tauriConf) {
|
|
|
478
482
|
height,
|
|
479
483
|
fullscreen,
|
|
480
484
|
transparent,
|
|
485
|
+
alwaysOnTop,
|
|
486
|
+
disabledWebShortcuts,
|
|
481
487
|
resizable,
|
|
482
488
|
};
|
|
483
489
|
Object.assign(tauriConf.pake.windows[0], { url, ...tauriConfWindowOptions });
|
|
@@ -681,7 +687,7 @@ class BaseBuilder {
|
|
|
681
687
|
const isChina = await isChinaDomain('www.npmjs.com');
|
|
682
688
|
const spinner = getSpinner('Installing package...');
|
|
683
689
|
const rustProjectDir = path.join(tauriSrcPath, '.cargo');
|
|
684
|
-
const projectConf = path.join(rustProjectDir, 'config');
|
|
690
|
+
const projectConf = path.join(rustProjectDir, 'config.toml');
|
|
685
691
|
await fsExtra.ensureDir(rustProjectDir);
|
|
686
692
|
if (isChina) {
|
|
687
693
|
logger.info('✺ Located in China, using npm/rsProxy CN mirror.');
|
|
@@ -823,6 +829,9 @@ const DEFAULT_PAKE_OPTIONS = {
|
|
|
823
829
|
fullscreen: false,
|
|
824
830
|
resizable: true,
|
|
825
831
|
transparent: false,
|
|
832
|
+
alwaysOnTop: false,
|
|
833
|
+
disabledWebShortcuts: false,
|
|
834
|
+
activationShortcut: '',
|
|
826
835
|
userAgent: '',
|
|
827
836
|
showSystemTray: false,
|
|
828
837
|
multiArch: false,
|
|
@@ -1013,17 +1022,20 @@ program
|
|
|
1013
1022
|
.option('--icon <string>', 'Application icon', DEFAULT_PAKE_OPTIONS.icon)
|
|
1014
1023
|
.option('--width <number>', 'Window width', validateNumberInput, DEFAULT_PAKE_OPTIONS.width)
|
|
1015
1024
|
.option('--height <number>', 'Window height', validateNumberInput, DEFAULT_PAKE_OPTIONS.height)
|
|
1016
|
-
.option('--transparent', 'Only for Mac, hide title bar', DEFAULT_PAKE_OPTIONS.transparent)
|
|
1017
1025
|
.option('--fullscreen', 'Start in full screen', DEFAULT_PAKE_OPTIONS.fullscreen)
|
|
1018
|
-
.option('--
|
|
1019
|
-
.option('--
|
|
1020
|
-
.option('--system-tray-icon <string>', 'Custom system tray icon', DEFAULT_PAKE_OPTIONS.systemTrayIcon)
|
|
1021
|
-
.option('--iter-copy-file', 'Copy files when URL is a local file', DEFAULT_PAKE_OPTIONS.iterCopyFile)
|
|
1026
|
+
.option('--hide-title-bar', 'Only for Mac, hide title bar', DEFAULT_PAKE_OPTIONS.transparent)
|
|
1027
|
+
.option('--activation-shortcut <string>', 'Shortcut key to active App', DEFAULT_PAKE_OPTIONS.activationShortcut)
|
|
1022
1028
|
.option('--multi-arch', 'Only for Mac, supports both Intel and M1', DEFAULT_PAKE_OPTIONS.multiArch)
|
|
1023
|
-
.option('--targets <string>', 'Only for Linux, option "deb" or "appimage"', DEFAULT_PAKE_OPTIONS.targets)
|
|
1024
1029
|
.option('--inject [injects...]', 'Injection of .js or .css Files', DEFAULT_PAKE_OPTIONS.inject)
|
|
1025
1030
|
.option('--safe-domain [domains...]', 'Domains that Require Security Configuration"', DEFAULT_PAKE_OPTIONS.safeDomain)
|
|
1026
|
-
.option('--debug', 'Debug
|
|
1031
|
+
.option('--debug', 'Debug build and more output', DEFAULT_PAKE_OPTIONS.debug)
|
|
1032
|
+
.addOption(new Option('--user-agent <string>', 'Custom user agent').default(DEFAULT_PAKE_OPTIONS.userAgent).hideHelp())
|
|
1033
|
+
.addOption(new Option('--targets <string>', 'Only for Linux, option "deb" or "appimage"').default(DEFAULT_PAKE_OPTIONS.targets).hideHelp())
|
|
1034
|
+
.addOption(new Option('--always-on-top', 'Always on the top level').default(DEFAULT_PAKE_OPTIONS.alwaysOnTop).hideHelp())
|
|
1035
|
+
.addOption(new Option('--disabled-web-shortcuts', 'Disabled webPage shortcuts').default(DEFAULT_PAKE_OPTIONS.disabledWebShortcuts).hideHelp())
|
|
1036
|
+
.addOption(new Option('--show-system-tray', 'Show system tray in app').default(DEFAULT_PAKE_OPTIONS.showSystemTray).hideHelp())
|
|
1037
|
+
.addOption(new Option('--system-tray-icon <string>', 'Custom system tray icon').default(DEFAULT_PAKE_OPTIONS.systemTrayIcon).hideHelp())
|
|
1038
|
+
.addOption(new Option('--transparent', 'Only for Mac, hide title bar').default(DEFAULT_PAKE_OPTIONS.transparent).hideHelp())
|
|
1027
1039
|
.version(packageJson.version, '-v, --version', 'Output the current version')
|
|
1028
1040
|
.action(async (url, options) => {
|
|
1029
1041
|
await checkUpdateTips();
|