win_webview2 1.1.10 → 1.1.12
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/node/builder/builder_promps.js +3 -0
- package/dist/node/builder/versiontool.d.ts +4 -0
- package/dist/node/builder/versiontool.js +25 -0
- package/dist/node/tsExport/dirnameTool.d.ts +2 -2
- package/dist/node/tsExport/dirnameTool.js +19 -4
- package/dist/node/tsExport/ww2_config.d.ts +1 -1
- package/dist/node/tsExport/ww2_config.js +4 -8
- package/package.json +2 -2
- package/src/srcNode/builder/builder_promps.ts +4 -0
- package/src/srcNode/builder/versiontool.ts +26 -0
- package/src/srcNode/tsExport/dirnameTool.ts +22 -8
- package/src/srcNode/tsExport/ww2_config.ts +5 -9
- package/src/srcNode/tsconfig.json +1 -1
- package/{src/srcNode/builder → srcInternal}/copyDll.ts +7 -10
- package/srcInternal/tsconfig.json +13 -0
|
@@ -7,6 +7,7 @@ exports.buildForServer = buildForServer;
|
|
|
7
7
|
const prompts_1 = __importDefault(require("prompts"));
|
|
8
8
|
const builder_init_1 = require("./builder_init");
|
|
9
9
|
const userExec_1 = require("./userExec");
|
|
10
|
+
const versiontool_1 = require("./versiontool");
|
|
10
11
|
let ww2Choise = {
|
|
11
12
|
"init_win_webview2": {
|
|
12
13
|
description: "init win_webview2",
|
|
@@ -16,6 +17,8 @@ let ww2Choise = {
|
|
|
16
17
|
}
|
|
17
18
|
};
|
|
18
19
|
async function buildForServer() {
|
|
20
|
+
let version = await (0, versiontool_1.getWWvVersion)();
|
|
21
|
+
console.log("win_webview2 : " + version);
|
|
19
22
|
let userChoise = await (0, userExec_1.readUserScripts)();
|
|
20
23
|
if (userChoise != null) {
|
|
21
24
|
ww2Choise = {
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
exports.getWWvVersion = getWWvVersion;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const dirnameTool_1 = require("../tsExport/dirnameTool");
|
|
9
|
+
const promises_1 = require("node:fs/promises");
|
|
10
|
+
/** Ini hanya bisa dipakai dengan cara tidak bundle
|
|
11
|
+
karena package json mungkin gak ada
|
|
12
|
+
*/
|
|
13
|
+
async function getWWvVersion() {
|
|
14
|
+
let result = "";
|
|
15
|
+
try {
|
|
16
|
+
let wwvModulePath = (0, dirnameTool_1.getWWVNodeModuleFolder)();
|
|
17
|
+
let jsonPath = node_path_1.default.join(wwvModulePath, "package.json");
|
|
18
|
+
let jsontxt = await (0, promises_1.readFile)(jsonPath, "utf-8");
|
|
19
|
+
let jsonObj = JSON.parse(jsontxt);
|
|
20
|
+
result = jsonObj.version;
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
}
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
@@ -9,6 +9,6 @@
|
|
|
9
9
|
export declare function getWw2Dirname(): {
|
|
10
10
|
_dirname: string;
|
|
11
11
|
_filename: string;
|
|
12
|
-
ww2ModulePath: string;
|
|
13
12
|
};
|
|
14
|
-
export declare function findUserProjectRoot(
|
|
13
|
+
export declare function findUserProjectRoot(): string | null;
|
|
14
|
+
export declare function getWWVNodeModuleFolder(): string;
|
|
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.getWw2Dirname = getWw2Dirname;
|
|
37
37
|
exports.findUserProjectRoot = findUserProjectRoot;
|
|
38
|
+
exports.getWWVNodeModuleFolder = getWWVNodeModuleFolder;
|
|
38
39
|
const node_url_1 = require("node:url");
|
|
39
40
|
const node_path_1 = __importStar(require("node:path"));
|
|
40
41
|
const node_fs_1 = require("node:fs");
|
|
@@ -55,10 +56,9 @@ function getWw2Dirname() {
|
|
|
55
56
|
const _dirname = typeof __dirname !== 'undefined'
|
|
56
57
|
? __dirname
|
|
57
58
|
: (0, node_path_1.dirname)(_filename);
|
|
58
|
-
|
|
59
|
-
return { _dirname, _filename, ww2ModulePath };
|
|
59
|
+
return { _dirname, _filename };
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function findUserProjectRootRecrusive(currentDir = process.cwd()) {
|
|
62
62
|
const packagePath = node_path_1.default.join(currentDir, 'package.json');
|
|
63
63
|
if ((0, node_fs_1.existsSync)(packagePath)) {
|
|
64
64
|
return currentDir;
|
|
@@ -67,5 +67,20 @@ function findUserProjectRoot(currentDir = process.cwd()) {
|
|
|
67
67
|
if (parentDir === currentDir) {
|
|
68
68
|
return null;
|
|
69
69
|
}
|
|
70
|
-
return
|
|
70
|
+
return findUserProjectRootRecrusive(parentDir);
|
|
71
|
+
}
|
|
72
|
+
function findUserProjectRoot() {
|
|
73
|
+
// - Deployed Condition
|
|
74
|
+
const packagePath = node_path_1.default.join(node_path_1.default.dirname(process.execPath), 'package.json');
|
|
75
|
+
if ((0, node_fs_1.existsSync)(packagePath)) {
|
|
76
|
+
return node_path_1.default.dirname(packagePath);
|
|
77
|
+
}
|
|
78
|
+
return findUserProjectRootRecrusive(process.cwd());
|
|
79
|
+
}
|
|
80
|
+
function getWWVNodeModuleFolder() {
|
|
81
|
+
let userRootProject = findUserProjectRoot();
|
|
82
|
+
if (userRootProject == null)
|
|
83
|
+
throw "root project user not found";
|
|
84
|
+
let nodeModuleFolder = node_path_1.default.join(userRootProject, "node_modules/win_webview2");
|
|
85
|
+
return nodeModuleFolder;
|
|
71
86
|
}
|
|
@@ -7,16 +7,12 @@ exports.readConfig = readConfig;
|
|
|
7
7
|
const promises_1 = require("node:fs/promises");
|
|
8
8
|
const dirnameTool_1 = require("./dirnameTool");
|
|
9
9
|
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
-
const node_fs_1 = require("node:fs");
|
|
11
10
|
const jsonConfigFilePath = "./win_webview2.json";
|
|
12
11
|
async function readConfig() {
|
|
13
|
-
let
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return null;
|
|
18
|
-
jsonPath = node_path_1.default.join(userDir, jsonConfigFilePath);
|
|
19
|
-
}
|
|
12
|
+
let userDir = (0, dirnameTool_1.findUserProjectRoot)();
|
|
13
|
+
if (userDir == null)
|
|
14
|
+
throw "readConfig() => findProjectUser failed";
|
|
15
|
+
let jsonPath = node_path_1.default.join(userDir, jsonConfigFilePath);
|
|
20
16
|
let str = await (0, promises_1.readFile)(jsonPath);
|
|
21
17
|
let jsonObj = JSON.parse(str.toString());
|
|
22
18
|
return jsonObj;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "win_webview2",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.12",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/nnttoo/win_webview2"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"build_browser": "tsc -p ./src/srcBrowser/tsconfig.json",
|
|
30
30
|
"build_browser_watch": "npm run build_browser -- --watch",
|
|
31
31
|
"build_all" : "npm run build_node && npm run build_browser",
|
|
32
|
-
"copy_dll": "tsx ./
|
|
32
|
+
"copy_dll": "tsx ./srcInternal/copyDll.ts"
|
|
33
33
|
},
|
|
34
34
|
"author": "",
|
|
35
35
|
"license": "ISC",
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import prompts from 'prompts';
|
|
3
3
|
import { ww2Init } from './builder_init';
|
|
4
4
|
import { readUserScripts } from './userExec';
|
|
5
|
+
import { getWWvVersion } from './versiontool';
|
|
5
6
|
|
|
6
7
|
interface ChoiseItem {
|
|
7
8
|
fun: () => any;
|
|
@@ -28,6 +29,9 @@ type promChoise = {
|
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
export async function buildForServer() {
|
|
32
|
+
let version = await getWWvVersion();
|
|
33
|
+
console.log("win_webview2 : " + version);
|
|
34
|
+
|
|
31
35
|
let userChoise = await readUserScripts();
|
|
32
36
|
if(userChoise != null){
|
|
33
37
|
ww2Choise = {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { getWw2Dirname, getWWVNodeModuleFolder } from "../tsExport/dirnameTool";
|
|
3
|
+
import { readFile } from "node:fs/promises";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/** Ini hanya bisa dipakai dengan cara tidak bundle
|
|
7
|
+
karena package json mungkin gak ada
|
|
8
|
+
*/
|
|
9
|
+
export async function getWWvVersion(){
|
|
10
|
+
let result = "";
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
let wwvModulePath = getWWVNodeModuleFolder();
|
|
14
|
+
let jsonPath = path.join(wwvModulePath,"package.json");
|
|
15
|
+
let jsontxt = await readFile(jsonPath,"utf-8");
|
|
16
|
+
let jsonObj = JSON.parse(jsontxt) as { version : string};
|
|
17
|
+
|
|
18
|
+
result = jsonObj.version;
|
|
19
|
+
|
|
20
|
+
} catch (error) {
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
|
|
@@ -21,15 +21,12 @@ export function getWw2Dirname() {
|
|
|
21
21
|
const _dirname = typeof __dirname !== 'undefined'
|
|
22
22
|
? __dirname
|
|
23
23
|
: dirname(_filename);
|
|
24
|
+
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
let ww2ModulePath = path.join(_dirname,"../../../")
|
|
28
|
-
|
|
29
|
-
return { _dirname, _filename , ww2ModulePath};
|
|
26
|
+
return { _dirname, _filename };
|
|
30
27
|
}
|
|
31
28
|
|
|
32
|
-
|
|
29
|
+
function findUserProjectRootRecrusive(currentDir : string = process.cwd()) {
|
|
33
30
|
|
|
34
31
|
const packagePath = path.join(currentDir, 'package.json');
|
|
35
32
|
if (existsSync(packagePath)) {
|
|
@@ -39,6 +36,23 @@ export function findUserProjectRoot(currentDir : string = process.cwd()) {
|
|
|
39
36
|
if (parentDir === currentDir) {
|
|
40
37
|
return null;
|
|
41
38
|
}
|
|
42
|
-
return
|
|
39
|
+
return findUserProjectRootRecrusive(parentDir);
|
|
43
40
|
}
|
|
44
|
-
|
|
41
|
+
|
|
42
|
+
export function findUserProjectRoot() {
|
|
43
|
+
|
|
44
|
+
// - Deployed Condition
|
|
45
|
+
const packagePath = path.join(path.dirname(process.execPath), 'package.json');
|
|
46
|
+
if (existsSync(packagePath)) {
|
|
47
|
+
return path.dirname(packagePath);
|
|
48
|
+
}
|
|
49
|
+
return findUserProjectRootRecrusive(process.cwd());
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function getWWVNodeModuleFolder(){
|
|
53
|
+
let userRootProject = findUserProjectRoot();
|
|
54
|
+
if(userRootProject == null) throw "root project user not found";
|
|
55
|
+
|
|
56
|
+
let nodeModuleFolder = path.join(userRootProject,"node_modules/win_webview2");
|
|
57
|
+
return nodeModuleFolder;
|
|
58
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { findUserProjectRoot } from "./dirnameTool";
|
|
2
|
+
import { findUserProjectRoot, getWw2Dirname } from "./dirnameTool";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
5
5
|
|
|
@@ -13,15 +13,11 @@ export type ConfigWW2 = {
|
|
|
13
13
|
|
|
14
14
|
const jsonConfigFilePath = "./win_webview2.json";
|
|
15
15
|
export async function readConfig() {
|
|
16
|
-
let
|
|
17
|
-
if (
|
|
18
|
-
let userDir = findUserProjectRoot();
|
|
19
|
-
if (userDir == null) return null;
|
|
20
|
-
jsonPath = path.join(userDir, jsonConfigFilePath);
|
|
21
|
-
}
|
|
22
|
-
|
|
16
|
+
let userDir = findUserProjectRoot();
|
|
17
|
+
if (userDir == null) throw "readConfig() => findProjectUser failed"
|
|
23
18
|
|
|
19
|
+
let jsonPath = path.join(userDir, jsonConfigFilePath);
|
|
24
20
|
let str = await readFile(jsonPath);
|
|
25
|
-
let jsonObj = JSON.parse(str.toString());
|
|
21
|
+
let jsonObj = JSON.parse(str.toString());
|
|
26
22
|
return jsonObj as ConfigWW2;
|
|
27
23
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { exec } from "node:child_process";
|
|
2
2
|
import { copyFile, mkdir } from "node:fs/promises";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import { getWw2Dirname } from "../tsExport/dirnameTool";
|
|
3
|
+
import path from "node:path";
|
|
5
4
|
|
|
6
5
|
function debugDir(dirPath: string) {
|
|
7
6
|
exec("cd " + dirPath + "&& dir", (s, o) => {
|
|
@@ -13,15 +12,13 @@ function debugDir(dirPath: string) {
|
|
|
13
12
|
|
|
14
13
|
let result = "\n";
|
|
15
14
|
|
|
16
|
-
let
|
|
17
|
-
|
|
18
|
-
let ww2ModulePath = dirname.ww2ModulePath;
|
|
15
|
+
let ww2SourcePath = path.join(__dirname,"../");
|
|
19
16
|
|
|
20
17
|
let copyFromRoot = async (src: string, target: string) => {
|
|
21
18
|
try {
|
|
22
19
|
|
|
23
|
-
let rootPath = path.join(
|
|
24
|
-
console.log("ModulePath : ",
|
|
20
|
+
let rootPath = path.join(ww2SourcePath,"../");
|
|
21
|
+
console.log("ModulePath : ", ww2SourcePath);
|
|
25
22
|
console.log("rootPath : ", rootPath);
|
|
26
23
|
result += "\n" + target;
|
|
27
24
|
await copyFile(path.join(rootPath, src), path.join(rootPath, target));
|
|
@@ -31,13 +28,13 @@ function debugDir(dirPath: string) {
|
|
|
31
28
|
}
|
|
32
29
|
|
|
33
30
|
try{
|
|
34
|
-
await mkdir(path.join(
|
|
31
|
+
await mkdir(path.join(ww2SourcePath, "win_lib"));
|
|
35
32
|
|
|
36
33
|
} catch{
|
|
37
34
|
|
|
38
35
|
}
|
|
39
36
|
try{
|
|
40
|
-
await mkdir(path.join(
|
|
37
|
+
await mkdir(path.join(ww2SourcePath, "win_lib/Win32"));
|
|
41
38
|
|
|
42
39
|
} catch{
|
|
43
40
|
|
|
@@ -45,7 +42,7 @@ function debugDir(dirPath: string) {
|
|
|
45
42
|
|
|
46
43
|
try {
|
|
47
44
|
|
|
48
|
-
await mkdir(path.join(
|
|
45
|
+
await mkdir(path.join(ww2SourcePath, "win_lib/x64"));
|
|
49
46
|
} catch (error) {
|
|
50
47
|
|
|
51
48
|
}
|