quickwin 1.1.3 → 1.2.0
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/README.en.md +7 -3
- package/README.md +7 -3
- package/examples/exec_server.js +3535 -34
- package/examples/exec_server.ts +71 -26
- package/examples/exec_server_worker.js +45 -0
- package/examples/exec_server_worker.ts +39 -0
- package/examples/setres.js +104 -0
- package/examples/setres.ts +120 -0
- package/package.json +1 -1
- package/quickwin.d.ts +3 -3
- package/qwin-nowasm-x86.exe +0 -0
- package/qwin-nowasm.exe +0 -0
- package/qwin-x86.exe +0 -0
- package/qwin.exe +0 -0
- package/test/run.js +3 -1
- package/test/run.ts +3 -1
- package/test/test_ffi.js +23 -8
- package/test/test_ffi.ts +24 -8
- package/test/test_worker_concurrent.js +45 -0
- package/test/test_worker_concurrent.ts +56 -0
- package/test/test_worker_data_url.js +46 -0
- package/test/test_worker_data_url.ts +51 -0
package/README.en.md
CHANGED
|
@@ -71,7 +71,7 @@ You can embed a JS script directly into the `qwin.exe` binary — no recompilati
|
|
|
71
71
|
|
|
72
72
|
```bash
|
|
73
73
|
# Embed a script
|
|
74
|
-
|
|
74
|
+
node scripts/embed-js.mjs --exe _build/qwin.exe --js script.js
|
|
75
75
|
|
|
76
76
|
# Or via make
|
|
77
77
|
make embed-js JS_EMBED=script.js
|
|
@@ -79,8 +79,11 @@ make embed-js JS_EMBED=script.js
|
|
|
79
79
|
# Embed a script brotli-compressed (smaller exe, decompressed at runtime)
|
|
80
80
|
make embed-js-br JS_EMBED=script.js
|
|
81
81
|
|
|
82
|
+
# Bundle examples/exec_server.ts and brotli-embed into exec_server.exe
|
|
83
|
+
make exec_server
|
|
84
|
+
|
|
82
85
|
# Run it (no file argument needed)
|
|
83
|
-
|
|
86
|
+
_build/exec_server.exe
|
|
84
87
|
```
|
|
85
88
|
|
|
86
89
|
When run without a script file argument, `qwin.exe` checks for embedded JS at the end of itself. If found, it executes the embedded code. If not, it falls back to `main.js`. Both raw (`QWJS`) and brotli-compressed (`QWBR`) embedded payloads are supported; the compressed form is decompressed at startup.
|
|
@@ -144,7 +147,7 @@ parent.onmessage = (e) => {
|
|
|
144
147
|
|
|
145
148
|
| API | Description |
|
|
146
149
|
|-----|-------------|
|
|
147
|
-
| `new os.Worker(specifier)` | Create worker. `specifier` is a file path or URL (supports `https://`
|
|
150
|
+
| `new os.Worker(specifier)` | Create worker. `specifier` is a file path or URL (supports `https://` and `data:text/javascript;base64,`) |
|
|
148
151
|
| `worker.postMessage(data)` | Send message (JSON-serializable) to worker |
|
|
149
152
|
| `worker.onmessage = fn` | Set callback for messages from worker. Set to `null` when done to release the message port |
|
|
150
153
|
| `os.Worker.parent` | (Worker side) reference to the parent thread |
|
|
@@ -204,6 +207,7 @@ cd quickwin
|
|
|
204
207
|
| `make wamr` | rebuild WAMR library |
|
|
205
208
|
| `make embed-js` | embed `embed.js` into exe (use `JS_EMBED=file.js`) |
|
|
206
209
|
| `make embed-js-br` | embed brotli-compressed JS into exe |
|
|
210
|
+
| `make exec_server` | Bundle `examples/exec_server.ts` and brotli-embed into `_build/exec_server.exe` |
|
|
207
211
|
| `make npm-pkg` | package into `dist/quickwin/` |
|
|
208
212
|
| `make clean` | clean build artifacts |
|
|
209
213
|
|
package/README.md
CHANGED
|
@@ -70,7 +70,7 @@ quickwin -- script.js --flag # -- 停止选项解析
|
|
|
70
70
|
|
|
71
71
|
```bash
|
|
72
72
|
# 内嵌一个脚本
|
|
73
|
-
|
|
73
|
+
node scripts/embed-js.mjs --exe _build/qwin.exe --js script.js
|
|
74
74
|
|
|
75
75
|
# 或通过 make
|
|
76
76
|
make embed-js JS_EMBED=script.js
|
|
@@ -78,8 +78,11 @@ make embed-js JS_EMBED=script.js
|
|
|
78
78
|
# 内嵌 Brotli 压缩的脚本(exe 更小,运行时解压)
|
|
79
79
|
make embed-js-br JS_EMBED=script.js
|
|
80
80
|
|
|
81
|
+
# 打包 examples/exec_server.ts 并 brotli 内嵌进 exec_server.exe
|
|
82
|
+
make exec_server
|
|
83
|
+
|
|
81
84
|
# 运行它(不需要文件参数)
|
|
82
|
-
|
|
85
|
+
_build/exec_server.exe
|
|
83
86
|
```
|
|
84
87
|
|
|
85
88
|
不带脚本文件参数运行时,`qwin.exe` 会检查自身末尾是否有内嵌 JS:找到则执行内嵌代码,否则回退到 `main.js`。同时支持原始(`QWJS`)与 Brotli 压缩(`QWBR`)两种内嵌格式;压缩格式在启动时解压。
|
|
@@ -143,7 +146,7 @@ parent.onmessage = (e) => {
|
|
|
143
146
|
|
|
144
147
|
| API | Description |
|
|
145
148
|
|-----|-------------|
|
|
146
|
-
| `new os.Worker(specifier)` | 创建 worker。`specifier` 是文件路径或 URL(支持 `https://`
|
|
149
|
+
| `new os.Worker(specifier)` | 创建 worker。`specifier` 是文件路径或 URL(支持 `https://` 与 `data:text/javascript;base64,`) |
|
|
147
150
|
| `worker.postMessage(data)` | 向 worker 发送消息(JSON 可序列化) |
|
|
148
151
|
| `worker.onmessage = fn` | 设置来自 worker 的消息回调。完成后设为 `null` 以释放消息端口 |
|
|
149
152
|
| `os.Worker.parent` | (Worker 侧)父线程的引用 |
|
|
@@ -203,6 +206,7 @@ cd quickwin
|
|
|
203
206
|
| `make wamr` | 重建 WAMR 库 |
|
|
204
207
|
| `make embed-js` | 把 `embed.js` 内嵌进 exe(用 `JS_EMBED=file.js`) |
|
|
205
208
|
| `make embed-js-br` | 把 Brotli 压缩的 JS 内嵌进 exe |
|
|
209
|
+
| `make exec_server` | 打包 `examples/exec_server.ts` 并 Brotli 内嵌进 `_build/exec_server.exe` |
|
|
206
210
|
| `make npm-pkg` | 打包到 `dist/quickwin/` |
|
|
207
211
|
| `make clean` | 清理构建产物 |
|
|
208
212
|
|