win_webview2 1.1.8 → 1.1.10
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.md +13 -0
- package/dist/browser/ww2_browser.d.ts +32 -32
- package/dist/browser/ww2_browser.js +11 -11
- package/dist/node/builder/copyDll.d.ts +1 -0
- package/dist/node/builder/copyDll.js +57 -0
- package/dist/node/tsExport/dirnameTool.d.ts +8 -0
- package/dist/node/tsExport/dirnameTool.js +8 -0
- package/package.json +8 -6
- package/{srcBrowser → src/srcBrowser}/tsconfig.json +1 -1
- package/{buildtools → src/srcNode/builder}/copyDll.ts +23 -4
- package/{srcNode → src/srcNode}/tsExport/dirnameTool.ts +10 -0
- package/{srcNode → src/srcNode}/tsconfig.json +1 -1
- package/win_lib/Win32/exeOpenner.exe +0 -0
- package/win_lib/Win32/ww2_addon.node +0 -0
- package/win_lib/x64/exeOpenner.exe +0 -0
- package/win_lib/x64/ww2_addon.node +0 -0
- package/buildtools/tsconfig.json +0 -14
- /package/{srcBrowser → src/srcBrowser}/ww2_browser.ts +0 -0
- /package/{srcNode → src/srcNode}/builder/builder_init.ts +0 -0
- /package/{srcNode → src/srcNode}/builder/builder_promps.ts +0 -0
- /package/{srcNode → src/srcNode}/builder/userExec.ts +0 -0
- /package/{srcNode → src/srcNode}/tsExport/winwebview2.ts +0 -0
- /package/{srcNode → src/srcNode}/tsExport/ww2_config.ts +0 -0
- /package/{srcNode → src/srcNode}/tsExport/ww2_server.ts +0 -0
package/README.md
CHANGED
|
@@ -14,6 +14,7 @@ npm install win_webview2
|
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
|
|
17
|
+
|
|
17
18
|
## Interactive Project Management
|
|
18
19
|
The win_webview2 CLI is designed to be your single point of control for the entire development lifecycle.
|
|
19
20
|
## 1. Scaffolding (First time)
|
|
@@ -23,6 +24,12 @@ To download the boilerplate and set up your project, simply run:
|
|
|
23
24
|
npx win_webview2
|
|
24
25
|
```
|
|
25
26
|
|
|
27
|
+
or
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
npx wwv
|
|
31
|
+
```
|
|
32
|
+
|
|
26
33
|
## 2. Develop, Watch, and Build
|
|
27
34
|
After the initial setup, you don't need to remember complex commands. Just run the same command again:
|
|
28
35
|
|
|
@@ -32,6 +39,12 @@ After the initial setup, you don't need to remember complex commands. Just run t
|
|
|
32
39
|
npx win_webview2
|
|
33
40
|
```
|
|
34
41
|
|
|
42
|
+
or
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
npx wwv
|
|
46
|
+
```
|
|
47
|
+
|
|
35
48
|
What it does:
|
|
36
49
|
It opens an interactive menu where you can manage your project. You can simply use your arrow keys (↑/↓) to select common tasks:
|
|
37
50
|
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
interface WW2FileDialogArg {
|
|
2
|
-
filter: string;
|
|
3
|
-
ownerClassName: string;
|
|
4
|
-
}
|
|
5
|
-
interface WW2ControlWindowsArg {
|
|
6
|
-
wndClassName: string;
|
|
7
|
-
controlcmd: "close" | "move" | "maximize" | "minimize" | "resize" | "check";
|
|
8
|
-
left?: number;
|
|
9
|
-
top?: number;
|
|
10
|
-
height?: number;
|
|
11
|
-
width?: number;
|
|
12
|
-
}
|
|
13
|
-
export type PostData = {
|
|
14
|
-
openWeb?: {
|
|
15
|
-
wclassname: string;
|
|
16
|
-
url: string;
|
|
17
|
-
title: string;
|
|
18
|
-
width: number;
|
|
19
|
-
height: number;
|
|
20
|
-
isKiosk: boolean;
|
|
21
|
-
isMaximize: boolean;
|
|
22
|
-
isDebug: boolean;
|
|
23
|
-
};
|
|
24
|
-
openFileDialog?: WW2FileDialogArg;
|
|
25
|
-
openFolderDialog?: WW2FileDialogArg;
|
|
26
|
-
controlWindow?: WW2ControlWindowsArg;
|
|
27
|
-
};
|
|
28
|
-
export declare function callWw2(arg: PostData): Promise<{
|
|
29
|
-
err: string;
|
|
30
|
-
result: string;
|
|
31
|
-
}>;
|
|
32
|
-
export {};
|
|
1
|
+
interface WW2FileDialogArg {
|
|
2
|
+
filter: string;
|
|
3
|
+
ownerClassName: string;
|
|
4
|
+
}
|
|
5
|
+
interface WW2ControlWindowsArg {
|
|
6
|
+
wndClassName: string;
|
|
7
|
+
controlcmd: "close" | "move" | "maximize" | "minimize" | "resize" | "check";
|
|
8
|
+
left?: number;
|
|
9
|
+
top?: number;
|
|
10
|
+
height?: number;
|
|
11
|
+
width?: number;
|
|
12
|
+
}
|
|
13
|
+
export type PostData = {
|
|
14
|
+
openWeb?: {
|
|
15
|
+
wclassname: string;
|
|
16
|
+
url: string;
|
|
17
|
+
title: string;
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
isKiosk: boolean;
|
|
21
|
+
isMaximize: boolean;
|
|
22
|
+
isDebug: boolean;
|
|
23
|
+
};
|
|
24
|
+
openFileDialog?: WW2FileDialogArg;
|
|
25
|
+
openFolderDialog?: WW2FileDialogArg;
|
|
26
|
+
controlWindow?: WW2ControlWindowsArg;
|
|
27
|
+
};
|
|
28
|
+
export declare function callWw2(arg: PostData): Promise<{
|
|
29
|
+
err: string;
|
|
30
|
+
result: string;
|
|
31
|
+
}>;
|
|
32
|
+
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export async function callWw2(arg) {
|
|
2
|
-
let response = await fetch("/ww2_post", {
|
|
3
|
-
method: "POST",
|
|
4
|
-
body: JSON.stringify(arg),
|
|
5
|
-
headers: {
|
|
6
|
-
"Content-Type": "application/json"
|
|
7
|
-
},
|
|
8
|
-
});
|
|
9
|
-
let result = await response.json();
|
|
10
|
-
return result;
|
|
11
|
-
}
|
|
1
|
+
export async function callWw2(arg) {
|
|
2
|
+
let response = await fetch("/ww2_post", {
|
|
3
|
+
method: "POST",
|
|
4
|
+
body: JSON.stringify(arg),
|
|
5
|
+
headers: {
|
|
6
|
+
"Content-Type": "application/json"
|
|
7
|
+
},
|
|
8
|
+
});
|
|
9
|
+
let result = await response.json();
|
|
10
|
+
return result;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const node_child_process_1 = require("node:child_process");
|
|
7
|
+
const promises_1 = require("node:fs/promises");
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const dirnameTool_1 = require("../tsExport/dirnameTool");
|
|
10
|
+
function debugDir(dirPath) {
|
|
11
|
+
(0, node_child_process_1.exec)("cd " + dirPath + "&& dir", (s, o) => {
|
|
12
|
+
console.log(o);
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
(async () => {
|
|
16
|
+
let result = "\n";
|
|
17
|
+
let dirname = (0, dirnameTool_1.getWw2Dirname)();
|
|
18
|
+
let ww2ModulePath = dirname.ww2ModulePath;
|
|
19
|
+
let copyFromRoot = async (src, target) => {
|
|
20
|
+
try {
|
|
21
|
+
let rootPath = node_path_1.default.join(ww2ModulePath, "../");
|
|
22
|
+
console.log("ModulePath : ", ww2ModulePath);
|
|
23
|
+
console.log("rootPath : ", rootPath);
|
|
24
|
+
result += "\n" + target;
|
|
25
|
+
await (0, promises_1.copyFile)(node_path_1.default.join(rootPath, src), node_path_1.default.join(rootPath, target));
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
console.log(error);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
try {
|
|
32
|
+
await (0, promises_1.mkdir)(node_path_1.default.join(ww2ModulePath, "win_lib"));
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
await (0, promises_1.mkdir)(node_path_1.default.join(ww2ModulePath, "win_lib/Win32"));
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
await (0, promises_1.mkdir)(node_path_1.default.join(ww2ModulePath, "win_lib/x64"));
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
}
|
|
46
|
+
await copyFromRoot("exeOpener/build/x64/exeOpenner.exe", "win_webview2/win_lib/x64/exeOpenner.exe");
|
|
47
|
+
await copyFromRoot("exeOpener/build/x64/splash.png", "win_webview2/win_lib/x64/splash.png");
|
|
48
|
+
await copyFromRoot("exeOpener/build/x86/exeOpenner.exe", "win_webview2/win_lib/Win32/exeOpenner.exe");
|
|
49
|
+
await copyFromRoot("exeOpener/build/x86/splash.png", "win_webview2/win_lib/Win32/splash.png");
|
|
50
|
+
console.log("copy webview2 32");
|
|
51
|
+
await copyFromRoot("nodeAddOn/build/ia32/Release/ww2_addon.node", "win_webview2/win_lib/Win32/ww2_addon.node");
|
|
52
|
+
await copyFromRoot("nodeAddOn/build/ia32/Release/WebView2Loader.dll", "win_webview2/win_lib/Win32/WebView2Loader.dll");
|
|
53
|
+
console.log("copy webview2 64");
|
|
54
|
+
await copyFromRoot("nodeAddOn/build/x64/Release/ww2_addon.node", "win_webview2/win_lib/x64/ww2_addon.node");
|
|
55
|
+
await copyFromRoot("nodeAddOn/build/x64/Release/WebView2Loader.dll", "win_webview2/win_lib/x64/WebView2Loader.dll");
|
|
56
|
+
console.log("copy done :" + result);
|
|
57
|
+
})();
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Penting!! jangan pindah file ini ketempat lain,
|
|
4
|
+
* Sesuaikan ulang jika file ini dipindah karena ini menggunakan __dirname
|
|
5
|
+
* dan juga file ini akan ditranspile ke js ke folder Dist, posisi file ini terhadap root antara file ts dan
|
|
6
|
+
* file js harus sama,
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
1
9
|
export declare function getWw2Dirname(): {
|
|
2
10
|
_dirname: string;
|
|
3
11
|
_filename: string;
|
|
@@ -38,6 +38,14 @@ exports.findUserProjectRoot = findUserProjectRoot;
|
|
|
38
38
|
const node_url_1 = require("node:url");
|
|
39
39
|
const node_path_1 = __importStar(require("node:path"));
|
|
40
40
|
const node_fs_1 = require("node:fs");
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
* Penting!! jangan pindah file ini ketempat lain,
|
|
44
|
+
* Sesuaikan ulang jika file ini dipindah karena ini menggunakan __dirname
|
|
45
|
+
* dan juga file ini akan ditranspile ke js ke folder Dist, posisi file ini terhadap root antara file ts dan
|
|
46
|
+
* file js harus sama,
|
|
47
|
+
*
|
|
48
|
+
*/
|
|
41
49
|
function getWw2Dirname() {
|
|
42
50
|
// Trik deteksi lingkungan
|
|
43
51
|
const _filename = typeof __filename !== 'undefined'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "win_webview2",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.10",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/nnttoo/win_webview2"
|
|
@@ -19,15 +19,17 @@
|
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"bin": {
|
|
22
|
-
"win_webview2": "tsDistRun.js"
|
|
22
|
+
"win_webview2": "tsDistRun.js",
|
|
23
|
+
"wwv": "tsDistRun.js"
|
|
23
24
|
},
|
|
24
25
|
"type": "commonjs",
|
|
25
26
|
"scripts": {
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"build_browser": "tsc -p ./srcBrowser/tsconfig.json",
|
|
27
|
+
"build_node": "tsc -p ./src/srcNode/tsconfig.json",
|
|
28
|
+
"build_node_watch": "npm run build -- --watch",
|
|
29
|
+
"build_browser": "tsc -p ./src/srcBrowser/tsconfig.json",
|
|
29
30
|
"build_browser_watch": "npm run build_browser -- --watch",
|
|
30
|
-
"
|
|
31
|
+
"build_all" : "npm run build_node && npm run build_browser",
|
|
32
|
+
"copy_dll": "tsx ./src/srcNode/builder/copyDll.ts"
|
|
31
33
|
},
|
|
32
34
|
"author": "",
|
|
33
35
|
"license": "ISC",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { exec } from "node:child_process";
|
|
2
2
|
import { copyFile, mkdir } from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import { getWw2Dirname } from "../tsExport/dirnameTool";
|
|
4
5
|
|
|
5
6
|
function debugDir(dirPath: string) {
|
|
6
7
|
exec("cd " + dirPath + "&& dir", (s, o) => {
|
|
@@ -12,21 +13,39 @@ function debugDir(dirPath: string) {
|
|
|
12
13
|
|
|
13
14
|
let result = "\n";
|
|
14
15
|
|
|
15
|
-
let
|
|
16
|
+
let dirname = getWw2Dirname();
|
|
17
|
+
|
|
18
|
+
let ww2ModulePath = dirname.ww2ModulePath;
|
|
19
|
+
|
|
16
20
|
let copyFromRoot = async (src: string, target: string) => {
|
|
17
21
|
try {
|
|
18
22
|
|
|
23
|
+
let rootPath = path.join(ww2ModulePath,"../");
|
|
24
|
+
console.log("ModulePath : ", ww2ModulePath);
|
|
25
|
+
console.log("rootPath : ", rootPath);
|
|
19
26
|
result += "\n" + target;
|
|
20
27
|
await copyFile(path.join(rootPath, src), path.join(rootPath, target));
|
|
21
28
|
} catch (error) {
|
|
22
|
-
|
|
29
|
+
console.log(error);
|
|
23
30
|
}
|
|
24
31
|
}
|
|
32
|
+
|
|
33
|
+
try{
|
|
34
|
+
await mkdir(path.join(ww2ModulePath, "win_lib"));
|
|
35
|
+
|
|
36
|
+
} catch{
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
try{
|
|
40
|
+
await mkdir(path.join(ww2ModulePath, "win_lib/Win32"));
|
|
41
|
+
|
|
42
|
+
} catch{
|
|
43
|
+
|
|
44
|
+
}
|
|
25
45
|
|
|
26
46
|
try {
|
|
27
47
|
|
|
28
|
-
await mkdir(path.join(
|
|
29
|
-
await mkdir(path.join(rootPath, "win_webview2/win_lib/x64"));
|
|
48
|
+
await mkdir(path.join(ww2ModulePath, "win_lib/x64"));
|
|
30
49
|
} catch (error) {
|
|
31
50
|
|
|
32
51
|
}
|
|
@@ -3,6 +3,14 @@ import path, { dirname } from 'node:path';
|
|
|
3
3
|
import { existsSync } from 'node:fs';
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* Penting!! jangan pindah file ini ketempat lain,
|
|
9
|
+
* Sesuaikan ulang jika file ini dipindah karena ini menggunakan __dirname
|
|
10
|
+
* dan juga file ini akan ditranspile ke js ke folder Dist, posisi file ini terhadap root antara file ts dan
|
|
11
|
+
* file js harus sama,
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
6
14
|
export function getWw2Dirname() {
|
|
7
15
|
// Trik deteksi lingkungan
|
|
8
16
|
const _filename = typeof __filename !== 'undefined'
|
|
@@ -14,6 +22,8 @@ export function getWw2Dirname() {
|
|
|
14
22
|
? __dirname
|
|
15
23
|
: dirname(_filename);
|
|
16
24
|
|
|
25
|
+
|
|
26
|
+
|
|
17
27
|
let ww2ModulePath = path.join(_dirname,"../../../")
|
|
18
28
|
|
|
19
29
|
return { _dirname, _filename , ww2ModulePath};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/buildtools/tsconfig.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"module": "CommonJS",
|
|
5
|
-
"declaration": true,
|
|
6
|
-
"rootDir": "./",
|
|
7
|
-
"outDir": "./tsDist",
|
|
8
|
-
"strict": true,
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"types": ["node"]
|
|
12
|
-
},
|
|
13
|
-
"include": ["./"]
|
|
14
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|