win_webview2 1.1.11 → 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.
@@ -13,7 +13,8 @@ karena package json mungkin gak ada
13
13
  async function getWWvVersion() {
14
14
  let result = "";
15
15
  try {
16
- let jsonPath = node_path_1.default.join((0, dirnameTool_1.getWw2Dirname)().ww2ModulePath, "package.json");
16
+ let wwvModulePath = (0, dirnameTool_1.getWWVNodeModuleFolder)();
17
+ let jsonPath = node_path_1.default.join(wwvModulePath, "package.json");
17
18
  let jsontxt = await (0, promises_1.readFile)(jsonPath, "utf-8");
18
19
  let jsonObj = JSON.parse(jsontxt);
19
20
  result = jsonObj.version;
@@ -9,6 +9,6 @@
9
9
  export declare function getWw2Dirname(): {
10
10
  _dirname: string;
11
11
  _filename: string;
12
- ww2ModulePath: string;
13
12
  };
14
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,8 +56,7 @@ function getWw2Dirname() {
55
56
  const _dirname = typeof __dirname !== 'undefined'
56
57
  ? __dirname
57
58
  : (0, node_path_1.dirname)(_filename);
58
- let ww2ModulePath = node_path_1.default.join(_dirname, "../../../");
59
- return { _dirname, _filename, ww2ModulePath };
59
+ return { _dirname, _filename };
60
60
  }
61
61
  function findUserProjectRootRecrusive(currentDir = process.cwd()) {
62
62
  const packagePath = node_path_1.default.join(currentDir, 'package.json');
@@ -77,3 +77,10 @@ function findUserProjectRoot() {
77
77
  }
78
78
  return findUserProjectRootRecrusive(process.cwd());
79
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;
86
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "win_webview2",
3
- "version": "1.1.11",
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 ./src/srcNode/builder/copyDll.ts"
32
+ "copy_dll": "tsx ./srcInternal/copyDll.ts"
33
33
  },
34
34
  "author": "",
35
35
  "license": "ISC",
@@ -1,5 +1,5 @@
1
1
  import path from "node:path";
2
- import { getWw2Dirname } from "../tsExport/dirnameTool";
2
+ import { getWw2Dirname, getWWVNodeModuleFolder } from "../tsExport/dirnameTool";
3
3
  import { readFile } from "node:fs/promises";
4
4
 
5
5
 
@@ -10,7 +10,8 @@ export async function getWWvVersion(){
10
10
  let result = "";
11
11
 
12
12
  try {
13
- let jsonPath = path.join(getWw2Dirname().ww2ModulePath,"package.json");
13
+ let wwvModulePath = getWWVNodeModuleFolder();
14
+ let jsonPath = path.join(wwvModulePath,"package.json");
14
15
  let jsontxt = await readFile(jsonPath,"utf-8");
15
16
  let jsonObj = JSON.parse(jsontxt) as { version : string};
16
17
 
@@ -21,12 +21,9 @@ 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()) {
@@ -51,3 +48,11 @@ export function findUserProjectRoot() {
51
48
  }
52
49
  return findUserProjectRootRecrusive(process.cwd());
53
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
+ }
@@ -9,5 +9,5 @@
9
9
  "esModuleInterop": true,
10
10
  "skipLibCheck": true
11
11
  },
12
- "include": ["./**/*"]
12
+ "include": ["./**/*" ]
13
13
  }
@@ -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 dirname = getWw2Dirname();
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(ww2ModulePath,"../");
24
- console.log("ModulePath : ", ww2ModulePath);
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(ww2ModulePath, "win_lib"));
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(ww2ModulePath, "win_lib/Win32"));
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(ww2ModulePath, "win_lib/x64"));
45
+ await mkdir(path.join(ww2SourcePath, "win_lib/x64"));
49
46
  } catch (error) {
50
47
 
51
48
  }
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "nodenext",
5
+ "declaration": true,
6
+ "rootDir": "./",
7
+ "strict": true,
8
+ "esModuleInterop": true,
9
+ "skipLibCheck": true,
10
+ "types": ["node"]
11
+ },
12
+ "include": ["./**/*"]
13
+ }