ewvjs 1.0.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/LICENSE +21 -0
- package/README.md +168 -0
- package/bin/ewvjs-cli.js +318 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +76 -0
- package/dist/js/api.js +256 -0
- package/dist/platforms/windows.d.ts +5 -0
- package/dist/platforms/windows.d.ts.map +1 -0
- package/dist/platforms/windows.js +143 -0
- package/dist/types.d.ts +42 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/utils.d.ts +9 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +22 -0
- package/dist/webview.d.ts +20 -0
- package/dist/webview.d.ts.map +1 -0
- package/dist/webview.js +92 -0
- package/dist/window.d.ts +55 -0
- package/dist/window.d.ts.map +1 -0
- package/dist/window.js +307 -0
- package/lib/assets.js +129 -0
- package/lib/icon.js +150 -0
- package/lib/packager.js +347 -0
- package/native/Microsoft.Web.WebView2.Core.dll +0 -0
- package/native/Microsoft.Web.WebView2.WinForms.dll +0 -0
- package/native/Microsoft.Web.WebView2.Wpf.dll +0 -0
- package/native/WebView.cjs +26 -0
- package/native/WebView.d.ts +8 -0
- package/native/WebView.deps.json +260 -0
- package/native/WebView.dll +0 -0
- package/native/WebView.mjs +31 -0
- package/native/import.cjs +3 -0
- package/native/node_modules/node-api-dotnet/README.md +80 -0
- package/native/node_modules/node-api-dotnet/index.d.ts +98 -0
- package/native/node_modules/node-api-dotnet/index.js +2 -0
- package/native/node_modules/node-api-dotnet/init.js +80 -0
- package/native/node_modules/node-api-dotnet/linux-arm64/Microsoft.JavaScript.NodeApi.node +0 -0
- package/native/node_modules/node-api-dotnet/linux-x64/Microsoft.JavaScript.NodeApi.node +0 -0
- package/native/node_modules/node-api-dotnet/net10.0/Microsoft.JavaScript.NodeApi.DotNetHost.dll +0 -0
- package/native/node_modules/node-api-dotnet/net10.0/Microsoft.JavaScript.NodeApi.dll +0 -0
- package/native/node_modules/node-api-dotnet/net10.0/Microsoft.JavaScript.NodeApi.runtimeconfig.json +14 -0
- package/native/node_modules/node-api-dotnet/net10.0.js +2 -0
- package/native/node_modules/node-api-dotnet/net472/Microsoft.Bcl.AsyncInterfaces.dll +0 -0
- package/native/node_modules/node-api-dotnet/net472/Microsoft.JavaScript.NodeApi.DotNetHost.dll +0 -0
- package/native/node_modules/node-api-dotnet/net472/Microsoft.JavaScript.NodeApi.dll +0 -0
- package/native/node_modules/node-api-dotnet/net472/Microsoft.JavaScript.NodeApi.runtimeconfig.json +9 -0
- package/native/node_modules/node-api-dotnet/net472/System.Memory.dll +0 -0
- package/native/node_modules/node-api-dotnet/net472/System.Runtime.CompilerServices.Unsafe.dll +0 -0
- package/native/node_modules/node-api-dotnet/net472/System.Threading.Tasks.Extensions.dll +0 -0
- package/native/node_modules/node-api-dotnet/net472.d.ts +2 -0
- package/native/node_modules/node-api-dotnet/net472.js +2 -0
- package/native/node_modules/node-api-dotnet/net8.0/Microsoft.JavaScript.NodeApi.DotNetHost.dll +0 -0
- package/native/node_modules/node-api-dotnet/net8.0/Microsoft.JavaScript.NodeApi.dll +0 -0
- package/native/node_modules/node-api-dotnet/net8.0/Microsoft.JavaScript.NodeApi.runtimeconfig.json +14 -0
- package/native/node_modules/node-api-dotnet/net8.0.d.ts +2 -0
- package/native/node_modules/node-api-dotnet/net8.0.js +2 -0
- package/native/node_modules/node-api-dotnet/net9.0/Microsoft.JavaScript.NodeApi.DotNetHost.dll +0 -0
- package/native/node_modules/node-api-dotnet/net9.0/Microsoft.JavaScript.NodeApi.dll +0 -0
- package/native/node_modules/node-api-dotnet/net9.0/Microsoft.JavaScript.NodeApi.runtimeconfig.json +14 -0
- package/native/node_modules/node-api-dotnet/net9.0.d.ts +2 -0
- package/native/node_modules/node-api-dotnet/net9.0.js +2 -0
- package/native/node_modules/node-api-dotnet/osx-arm64/Microsoft.JavaScript.NodeApi.node +0 -0
- package/native/node_modules/node-api-dotnet/osx-x64/Microsoft.JavaScript.NodeApi.node +0 -0
- package/native/node_modules/node-api-dotnet/package.json +27 -0
- package/native/node_modules/node-api-dotnet/win-arm64/Microsoft.JavaScript.NodeApi.node +0 -0
- package/native/node_modules/node-api-dotnet/win-x64/Microsoft.JavaScript.NodeApi.node +0 -0
- package/native/runtimes/win-arm64/native/WebView2Loader.dll +0 -0
- package/native/runtimes/win-x64/native/WebView2Loader.dll +0 -0
- package/native/runtimes/win-x86/native/WebView2Loader.dll +0 -0
- package/package.json +57 -0
- package/src/README.md +125 -0
- package/src/csharp/bin/Release/net10.0-windows/Microsoft.Web.WebView2.Core.dll +0 -0
- package/src/csharp/bin/Release/net10.0-windows/Microsoft.Web.WebView2.Core.xml +6817 -0
- package/src/csharp/bin/Release/net10.0-windows/Microsoft.Web.WebView2.WinForms.dll +0 -0
- package/src/csharp/bin/Release/net10.0-windows/Microsoft.Web.WebView2.WinForms.xml +510 -0
- package/src/csharp/bin/Release/net10.0-windows/Microsoft.Web.WebView2.Wpf.dll +0 -0
- package/src/csharp/bin/Release/net10.0-windows/Microsoft.Web.WebView2.Wpf.xml +1902 -0
- package/src/csharp/bin/Release/net10.0-windows/WebView.cjs +26 -0
- package/src/csharp/bin/Release/net10.0-windows/WebView.d.ts +8 -0
- package/src/csharp/bin/Release/net10.0-windows/WebView.deps.json +260 -0
- package/src/csharp/bin/Release/net10.0-windows/WebView.dll +0 -0
- package/src/csharp/bin/Release/net10.0-windows/WebView.mjs +31 -0
- package/src/csharp/bin/Release/net10.0-windows/WebView.pdb +0 -0
- package/src/csharp/bin/Release/net10.0-windows/import.cjs +3 -0
- package/src/csharp/bin/Release/net10.0-windows/runtimes/win-arm64/native/WebView2Loader.dll +0 -0
- package/src/csharp/bin/Release/net10.0-windows/runtimes/win-x64/native/WebView2Loader.dll +0 -0
- package/src/csharp/bin/Release/net10.0-windows/runtimes/win-x86/native/WebView2Loader.dll +0 -0
package/lib/packager.js
ADDED
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
const { spawn } = require('child_process');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const { bundleAssets } = require('./assets');
|
|
5
|
+
const { setIcon } = require('./icon');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Convert console application to GUI application (hide console window)
|
|
9
|
+
* @param {string} exePath - Path to the executable
|
|
10
|
+
*/
|
|
11
|
+
function convertToGuiApp(exePath) {
|
|
12
|
+
try {
|
|
13
|
+
// Read the executable as a buffer
|
|
14
|
+
const exeBuffer = fs.readFileSync(exePath);
|
|
15
|
+
|
|
16
|
+
// Get PE signature offset (at 0x3C in DOS header)
|
|
17
|
+
const peOffset = exeBuffer.readUInt32LE(0x3C);
|
|
18
|
+
|
|
19
|
+
// PE signature is 4 bytes ("PE\0\0")
|
|
20
|
+
// COFF header is 20 bytes
|
|
21
|
+
// Optional header starts at peOffset + 24
|
|
22
|
+
// Subsystem is at offset 68 (0x44) in optional header
|
|
23
|
+
const subsystemOffset = peOffset + 24 + 68;
|
|
24
|
+
|
|
25
|
+
// Read current subsystem value
|
|
26
|
+
const currentSubsystem = exeBuffer.readUInt16LE(subsystemOffset);
|
|
27
|
+
console.log(` Current subsystem: ${currentSubsystem} (3=CONSOLE, 2=GUI)`);
|
|
28
|
+
|
|
29
|
+
// Set to IMAGE_SUBSYSTEM_WINDOWS_GUI (2) instead of CONSOLE (3)
|
|
30
|
+
if (currentSubsystem === 3) {
|
|
31
|
+
exeBuffer.writeUInt16LE(2, subsystemOffset);
|
|
32
|
+
console.log(` Changed subsystem to GUI (2)`);
|
|
33
|
+
|
|
34
|
+
// Write the modified executable
|
|
35
|
+
fs.writeFileSync(exePath, exeBuffer);
|
|
36
|
+
}
|
|
37
|
+
} catch (error) {
|
|
38
|
+
console.warn(` ⚠ Warning: Could not convert to GUI app: ${error.message}`);
|
|
39
|
+
console.warn(' The executable will show a console window.');
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Run pkg command using spawn
|
|
45
|
+
* @param {string[]} args - Arguments for pkg
|
|
46
|
+
* @returns {Promise<void>}
|
|
47
|
+
*/
|
|
48
|
+
function runPkg(args) {
|
|
49
|
+
return new Promise((resolve, reject) => {
|
|
50
|
+
// Try to find pkg binary in node_modules
|
|
51
|
+
let pkgBin;
|
|
52
|
+
try {
|
|
53
|
+
const pkgPackageJson = require.resolve('@yao-pkg/pkg/package.json');
|
|
54
|
+
const pkgDir = path.dirname(pkgPackageJson);
|
|
55
|
+
|
|
56
|
+
// Check for different possible bin locations
|
|
57
|
+
const possibleBins = [
|
|
58
|
+
path.join(pkgDir, 'lib-es5', 'bin.js'),
|
|
59
|
+
path.join(pkgDir, 'lib', 'bin.js'),
|
|
60
|
+
path.join(pkgDir, 'bin', 'pkg.js')
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
for (const bin of possibleBins) {
|
|
64
|
+
if (fs.existsSync(bin)) {
|
|
65
|
+
pkgBin = bin;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (!pkgBin) {
|
|
71
|
+
throw new Error('pkg binary not found');
|
|
72
|
+
}
|
|
73
|
+
} catch (error) {
|
|
74
|
+
reject(new Error(`Cannot find @yao-pkg/pkg installation: ${error.message}`));
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
console.log(` Running: node ${pkgBin} ${args.join(' ')}`);
|
|
79
|
+
|
|
80
|
+
// Spawn pkg process
|
|
81
|
+
let stdout = '';
|
|
82
|
+
let stderr = '';
|
|
83
|
+
|
|
84
|
+
const pkgProcess = spawn(process.execPath, [pkgBin, ...args], {
|
|
85
|
+
stdio: ['inherit', 'pipe', 'pipe'],
|
|
86
|
+
shell: false
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
pkgProcess.stdout.on('data', (data) => {
|
|
90
|
+
const output = data.toString();
|
|
91
|
+
stdout += output;
|
|
92
|
+
process.stdout.write(output);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
pkgProcess.stderr.on('data', (data) => {
|
|
96
|
+
const output = data.toString();
|
|
97
|
+
stderr += output;
|
|
98
|
+
process.stderr.write(output);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
pkgProcess.on('close', (code) => {
|
|
102
|
+
if (code === 0) {
|
|
103
|
+
resolve();
|
|
104
|
+
} else {
|
|
105
|
+
const errorMsg = stderr || stdout || `pkg exited with code ${code}`;
|
|
106
|
+
reject(new Error(errorMsg));
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
pkgProcess.on('error', (error) => {
|
|
111
|
+
reject(error);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Package an ewvjs application into a standalone executable
|
|
118
|
+
* @param {Object} config - Packaging configuration
|
|
119
|
+
* @param {string} config.entry - Entry point file path
|
|
120
|
+
* @param {string} config.output - Output executable name (without .exe)
|
|
121
|
+
* @param {string} config.assets - Assets directory path
|
|
122
|
+
* @param {string} config.icon - Icon file path (.ico)
|
|
123
|
+
* @param {string} config.name - Application name
|
|
124
|
+
* @param {string} config.target - Target platform (e.g., node18-win-x64)
|
|
125
|
+
* @param {boolean} config.compress - Whether to compress with UPX
|
|
126
|
+
* @param {boolean} config.includeNative - Whether to include native DLLs
|
|
127
|
+
* @param {string[]} config.additionalModules - Additional node modules to bundle
|
|
128
|
+
*/
|
|
129
|
+
async function packageApp(config) {
|
|
130
|
+
const {
|
|
131
|
+
entry,
|
|
132
|
+
output,
|
|
133
|
+
assets,
|
|
134
|
+
icon,
|
|
135
|
+
name,
|
|
136
|
+
target,
|
|
137
|
+
compress,
|
|
138
|
+
includeNative = true,
|
|
139
|
+
additionalModules = []
|
|
140
|
+
} = config;
|
|
141
|
+
|
|
142
|
+
const outputDir = path.join(process.cwd(), 'dist');
|
|
143
|
+
const outputPath = path.join(outputDir, `${output}.exe`);
|
|
144
|
+
|
|
145
|
+
// Create output directory
|
|
146
|
+
if (!fs.existsSync(outputDir)) {
|
|
147
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
console.log('📝 Configuration:');
|
|
151
|
+
console.log(` Entry: ${entry}`);
|
|
152
|
+
console.log(` Output: ${outputPath}`);
|
|
153
|
+
console.log(` Target: ${target}`);
|
|
154
|
+
console.log(` Compress: ${compress ? 'Yes' : 'No'}`);
|
|
155
|
+
if (assets && fs.existsSync(assets)) {
|
|
156
|
+
console.log(` Assets: ${assets}`);
|
|
157
|
+
}
|
|
158
|
+
if (icon) {
|
|
159
|
+
console.log(` Icon: ${icon}`);
|
|
160
|
+
}
|
|
161
|
+
if (additionalModules.length > 0) {
|
|
162
|
+
console.log(` Additional Modules: ${additionalModules.join(', ')}`);
|
|
163
|
+
}
|
|
164
|
+
console.log('');
|
|
165
|
+
|
|
166
|
+
// Step 1: Package with @yao-pkg/pkg
|
|
167
|
+
console.log('🔨 Step 1: Creating executable with pkg...');
|
|
168
|
+
|
|
169
|
+
const pkgArgs = [
|
|
170
|
+
entry,
|
|
171
|
+
'--target', target,
|
|
172
|
+
'--output', outputPath,
|
|
173
|
+
'--public', // Faster, includes sources
|
|
174
|
+
'--no-bytecode' // Skip bytecode generation for faster packaging
|
|
175
|
+
];
|
|
176
|
+
|
|
177
|
+
if (compress) {
|
|
178
|
+
pkgArgs.push('--compress', 'GZip');
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Add pkg configuration for native modules
|
|
182
|
+
const pkgConfig = {
|
|
183
|
+
assets: []
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
// Include native DLLs if requested
|
|
187
|
+
if (includeNative) {
|
|
188
|
+
const ewvjsPath = require.resolve('ewvjs');
|
|
189
|
+
const ewvjsRoot = path.dirname(path.dirname(ewvjsPath));
|
|
190
|
+
const nativePath = path.join(ewvjsRoot, 'native');
|
|
191
|
+
|
|
192
|
+
if (fs.existsSync(nativePath)) {
|
|
193
|
+
console.log(' Including native DLLs from ewvjs...');
|
|
194
|
+
pkgConfig.assets.push(`${nativePath}/**/*`);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Write temporary pkg config
|
|
199
|
+
const pkgConfigPath = path.join(process.cwd(), '.pkg-config.json');
|
|
200
|
+
fs.writeFileSync(pkgConfigPath, JSON.stringify(pkgConfig, null, 2));
|
|
201
|
+
|
|
202
|
+
try {
|
|
203
|
+
// Execute pkg using spawn
|
|
204
|
+
await runPkg(pkgArgs);
|
|
205
|
+
console.log(' ✓ Executable created');
|
|
206
|
+
|
|
207
|
+
// Convert to GUI application (hide console window)
|
|
208
|
+
console.log(' Converting to GUI application...');
|
|
209
|
+
convertToGuiApp(outputPath);
|
|
210
|
+
console.log(' ✓ Converted to GUI app (no console window)');
|
|
211
|
+
|
|
212
|
+
// Clean up temp config
|
|
213
|
+
if (fs.existsSync(pkgConfigPath)) {
|
|
214
|
+
fs.unlinkSync(pkgConfigPath);
|
|
215
|
+
}
|
|
216
|
+
} catch (error) {
|
|
217
|
+
// Clean up temp config on error
|
|
218
|
+
if (fs.existsSync(pkgConfigPath)) {
|
|
219
|
+
fs.unlinkSync(pkgConfigPath);
|
|
220
|
+
}
|
|
221
|
+
throw new Error(`pkg failed: ${error.message}`);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// Step 2: Copy native DLLs next to executable
|
|
225
|
+
if (includeNative) {
|
|
226
|
+
console.log('\n🔧 Step 2: Copying native dependencies...');
|
|
227
|
+
const ewvjsPath = require.resolve('ewvjs');
|
|
228
|
+
const ewvjsRoot = path.dirname(path.dirname(ewvjsPath));
|
|
229
|
+
const nativePath = path.join(ewvjsRoot, 'native');
|
|
230
|
+
|
|
231
|
+
if (fs.existsSync(nativePath)) {
|
|
232
|
+
const targetNativePath = path.join(outputDir, 'native');
|
|
233
|
+
|
|
234
|
+
// Copy directory recursively
|
|
235
|
+
copyRecursive(nativePath, targetNativePath);
|
|
236
|
+
console.log(` ✓ Native DLLs copied to ${targetNativePath}`);
|
|
237
|
+
|
|
238
|
+
// Copy additional node modules if specified
|
|
239
|
+
if (additionalModules.length > 0) {
|
|
240
|
+
console.log('\n 📦 Copying additional node modules...');
|
|
241
|
+
const targetNodeModulesPath = path.join(targetNativePath, 'node_modules');
|
|
242
|
+
const copiedModules = new Set();
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Recursively copy module and its dependencies
|
|
246
|
+
*/
|
|
247
|
+
function copyModuleWithDependencies(moduleName, depth = 0) {
|
|
248
|
+
const indent = ' ' + ' '.repeat(depth);
|
|
249
|
+
|
|
250
|
+
// Avoid copying the same module twice
|
|
251
|
+
if (copiedModules.has(moduleName)) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
try {
|
|
256
|
+
// Try to resolve the module from the current project
|
|
257
|
+
const modulePath = require.resolve(moduleName + '/package.json', {
|
|
258
|
+
paths: [process.cwd()]
|
|
259
|
+
});
|
|
260
|
+
const moduleRoot = path.dirname(modulePath);
|
|
261
|
+
const moduleDestPath = path.join(targetNodeModulesPath, moduleName);
|
|
262
|
+
|
|
263
|
+
// Mark as copied before processing to avoid circular dependencies
|
|
264
|
+
copiedModules.add(moduleName);
|
|
265
|
+
|
|
266
|
+
// Copy the module
|
|
267
|
+
copyRecursive(moduleRoot, moduleDestPath);
|
|
268
|
+
console.log(`${indent}✓ Copied ${moduleName}`);
|
|
269
|
+
|
|
270
|
+
// Read package.json to get dependencies
|
|
271
|
+
const packageJsonPath = path.join(moduleRoot, 'package.json');
|
|
272
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
273
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
274
|
+
const dependencies = {
|
|
275
|
+
...packageJson.dependencies,
|
|
276
|
+
...packageJson.optionalDependencies
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
// Recursively copy dependencies
|
|
280
|
+
if (dependencies && Object.keys(dependencies).length > 0) {
|
|
281
|
+
for (const depName of Object.keys(dependencies)) {
|
|
282
|
+
copyModuleWithDependencies(depName, depth + 1);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
} catch (error) {
|
|
287
|
+
if (depth === 0) {
|
|
288
|
+
// Only warn for top-level modules
|
|
289
|
+
console.warn(`${indent}⚠ Warning: Could not find module "${moduleName}": ${error.message}`);
|
|
290
|
+
}
|
|
291
|
+
// Skip missing optional dependencies silently
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// Copy each requested module with its dependencies
|
|
296
|
+
for (const moduleName of additionalModules) {
|
|
297
|
+
copyModuleWithDependencies(moduleName, 0);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
console.log(` Total modules copied: ${copiedModules.size}`);
|
|
301
|
+
}
|
|
302
|
+
} else {
|
|
303
|
+
console.warn(' ⚠ Warning: Native DLLs not found in ewvjs installation');
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// Step 3: Bundle assets if provided
|
|
308
|
+
if (assets && fs.existsSync(assets)) {
|
|
309
|
+
console.log('\n📦 Step 3: Bundling assets...');
|
|
310
|
+
const assetsOutput = path.join(outputDir, 'assets');
|
|
311
|
+
await bundleAssets(assets, assetsOutput);
|
|
312
|
+
console.log(` ✓ Assets bundled to ${assetsOutput}`);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// Step 4: Set icon if provided
|
|
316
|
+
if (icon && fs.existsSync(icon)) {
|
|
317
|
+
console.log('\n🎨 Step 4: Setting application icon...');
|
|
318
|
+
await setIcon(outputPath, icon, name);
|
|
319
|
+
console.log(' ✓ Icon applied');
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
return outputPath;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Copy directory recursively
|
|
327
|
+
*/
|
|
328
|
+
function copyRecursive(src, dest) {
|
|
329
|
+
if (!fs.existsSync(dest)) {
|
|
330
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
334
|
+
|
|
335
|
+
for (const entry of entries) {
|
|
336
|
+
const srcPath = path.join(src, entry.name);
|
|
337
|
+
const destPath = path.join(dest, entry.name);
|
|
338
|
+
|
|
339
|
+
if (entry.isDirectory()) {
|
|
340
|
+
copyRecursive(srcPath, destPath);
|
|
341
|
+
} else {
|
|
342
|
+
fs.copyFileSync(srcPath, destPath);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
module.exports = packageApp;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Generated for: WebView 1.0.0.0
|
|
2
|
+
// Generated by: Microsoft.JavaScript.NodeApi.Generator 0.9.0.0
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
|
|
5
|
+
const dotnet = require('node-api-dotnet/net10.0');
|
|
6
|
+
const path = require('node:path');
|
|
7
|
+
// @ts-ignore - https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/65252
|
|
8
|
+
const { dlopen, platform, arch } = require('node:process');
|
|
9
|
+
|
|
10
|
+
const moduleName = path.basename(__filename, __filename.match(/(\.[cm]?js)?$/)[0]);
|
|
11
|
+
module.exports = dotnet ? importDotnetModule(moduleName) : importAotModule(moduleName);
|
|
12
|
+
|
|
13
|
+
function importDotnetModule(moduleName) {
|
|
14
|
+
const moduleFilePath = path.join(__dirname, moduleName + '.dll');
|
|
15
|
+
return dotnet.require(moduleFilePath);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function importAotModule(moduleName) {
|
|
19
|
+
const ridPlatform = platform === 'win32' ? 'win' : platform === 'darwin' ? 'osx' : platform;
|
|
20
|
+
const ridArch = arch === 'ia32' ? 'x86' : arch;
|
|
21
|
+
const rid = `${ridPlatform}-${ridArch}`;
|
|
22
|
+
const moduleFilePath = path.join(__dirname, rid, moduleName + '.node');
|
|
23
|
+
const module = { exports: {} };
|
|
24
|
+
dlopen(module, moduleFilePath);
|
|
25
|
+
return module.exports;
|
|
26
|
+
}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
{
|
|
2
|
+
"runtimeTarget": {
|
|
3
|
+
"name": ".NETCoreApp,Version=v10.0",
|
|
4
|
+
"signature": ""
|
|
5
|
+
},
|
|
6
|
+
"compilationOptions": {},
|
|
7
|
+
"targets": {
|
|
8
|
+
".NETCoreApp,Version=v10.0": {
|
|
9
|
+
"WebView/1.0.0": {
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"Microsoft.JavaScript.NodeApi": "0.9.19",
|
|
12
|
+
"Microsoft.JavaScript.NodeApi.Generator": "0.9.19",
|
|
13
|
+
"Microsoft.Web.WebView2": "1.0.3719.77",
|
|
14
|
+
"Microsoft.Web.WebView2.Core": "1.0.3719.77",
|
|
15
|
+
"Microsoft.Web.WebView2.WinForms": "1.0.3719.77",
|
|
16
|
+
"Microsoft.Web.WebView2.Wpf": "1.0.3719.77"
|
|
17
|
+
},
|
|
18
|
+
"runtime": {
|
|
19
|
+
"WebView.dll": {}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"Microsoft.CodeAnalysis.Common/4.1.0": {
|
|
23
|
+
"runtime": {
|
|
24
|
+
"lib/netcoreapp3.1/Microsoft.CodeAnalysis.dll": {
|
|
25
|
+
"assemblyVersion": "4.1.0.0",
|
|
26
|
+
"fileVersion": "4.100.22.11411"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"resources": {
|
|
30
|
+
"lib/netcoreapp3.1/cs/Microsoft.CodeAnalysis.resources.dll": {
|
|
31
|
+
"locale": "cs"
|
|
32
|
+
},
|
|
33
|
+
"lib/netcoreapp3.1/de/Microsoft.CodeAnalysis.resources.dll": {
|
|
34
|
+
"locale": "de"
|
|
35
|
+
},
|
|
36
|
+
"lib/netcoreapp3.1/es/Microsoft.CodeAnalysis.resources.dll": {
|
|
37
|
+
"locale": "es"
|
|
38
|
+
},
|
|
39
|
+
"lib/netcoreapp3.1/fr/Microsoft.CodeAnalysis.resources.dll": {
|
|
40
|
+
"locale": "fr"
|
|
41
|
+
},
|
|
42
|
+
"lib/netcoreapp3.1/it/Microsoft.CodeAnalysis.resources.dll": {
|
|
43
|
+
"locale": "it"
|
|
44
|
+
},
|
|
45
|
+
"lib/netcoreapp3.1/ja/Microsoft.CodeAnalysis.resources.dll": {
|
|
46
|
+
"locale": "ja"
|
|
47
|
+
},
|
|
48
|
+
"lib/netcoreapp3.1/ko/Microsoft.CodeAnalysis.resources.dll": {
|
|
49
|
+
"locale": "ko"
|
|
50
|
+
},
|
|
51
|
+
"lib/netcoreapp3.1/pl/Microsoft.CodeAnalysis.resources.dll": {
|
|
52
|
+
"locale": "pl"
|
|
53
|
+
},
|
|
54
|
+
"lib/netcoreapp3.1/pt-BR/Microsoft.CodeAnalysis.resources.dll": {
|
|
55
|
+
"locale": "pt-BR"
|
|
56
|
+
},
|
|
57
|
+
"lib/netcoreapp3.1/ru/Microsoft.CodeAnalysis.resources.dll": {
|
|
58
|
+
"locale": "ru"
|
|
59
|
+
},
|
|
60
|
+
"lib/netcoreapp3.1/tr/Microsoft.CodeAnalysis.resources.dll": {
|
|
61
|
+
"locale": "tr"
|
|
62
|
+
},
|
|
63
|
+
"lib/netcoreapp3.1/zh-Hans/Microsoft.CodeAnalysis.resources.dll": {
|
|
64
|
+
"locale": "zh-Hans"
|
|
65
|
+
},
|
|
66
|
+
"lib/netcoreapp3.1/zh-Hant/Microsoft.CodeAnalysis.resources.dll": {
|
|
67
|
+
"locale": "zh-Hant"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"Microsoft.CodeAnalysis.CSharp/4.1.0": {
|
|
72
|
+
"dependencies": {
|
|
73
|
+
"Microsoft.CodeAnalysis.Common": "4.1.0"
|
|
74
|
+
},
|
|
75
|
+
"runtime": {
|
|
76
|
+
"lib/netcoreapp3.1/Microsoft.CodeAnalysis.CSharp.dll": {
|
|
77
|
+
"assemblyVersion": "4.1.0.0",
|
|
78
|
+
"fileVersion": "4.100.22.11411"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"resources": {
|
|
82
|
+
"lib/netcoreapp3.1/cs/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
|
83
|
+
"locale": "cs"
|
|
84
|
+
},
|
|
85
|
+
"lib/netcoreapp3.1/de/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
|
86
|
+
"locale": "de"
|
|
87
|
+
},
|
|
88
|
+
"lib/netcoreapp3.1/es/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
|
89
|
+
"locale": "es"
|
|
90
|
+
},
|
|
91
|
+
"lib/netcoreapp3.1/fr/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
|
92
|
+
"locale": "fr"
|
|
93
|
+
},
|
|
94
|
+
"lib/netcoreapp3.1/it/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
|
95
|
+
"locale": "it"
|
|
96
|
+
},
|
|
97
|
+
"lib/netcoreapp3.1/ja/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
|
98
|
+
"locale": "ja"
|
|
99
|
+
},
|
|
100
|
+
"lib/netcoreapp3.1/ko/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
|
101
|
+
"locale": "ko"
|
|
102
|
+
},
|
|
103
|
+
"lib/netcoreapp3.1/pl/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
|
104
|
+
"locale": "pl"
|
|
105
|
+
},
|
|
106
|
+
"lib/netcoreapp3.1/pt-BR/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
|
107
|
+
"locale": "pt-BR"
|
|
108
|
+
},
|
|
109
|
+
"lib/netcoreapp3.1/ru/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
|
110
|
+
"locale": "ru"
|
|
111
|
+
},
|
|
112
|
+
"lib/netcoreapp3.1/tr/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
|
113
|
+
"locale": "tr"
|
|
114
|
+
},
|
|
115
|
+
"lib/netcoreapp3.1/zh-Hans/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
|
116
|
+
"locale": "zh-Hans"
|
|
117
|
+
},
|
|
118
|
+
"lib/netcoreapp3.1/zh-Hant/Microsoft.CodeAnalysis.CSharp.resources.dll": {
|
|
119
|
+
"locale": "zh-Hant"
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
"Microsoft.JavaScript.NodeApi/0.9.19": {
|
|
124
|
+
"runtime": {
|
|
125
|
+
"lib/net9.0/Microsoft.JavaScript.NodeApi.dll": {
|
|
126
|
+
"assemblyVersion": "0.9.0.0",
|
|
127
|
+
"fileVersion": "0.9.19.35779"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
"Microsoft.JavaScript.NodeApi.Generator/0.9.19": {
|
|
132
|
+
"dependencies": {
|
|
133
|
+
"Microsoft.CodeAnalysis.CSharp": "4.1.0",
|
|
134
|
+
"System.Reflection.MetadataLoadContext": "6.0.0"
|
|
135
|
+
},
|
|
136
|
+
"runtime": {
|
|
137
|
+
"lib/net9.0/Microsoft.JavaScript.NodeApi.Generator.dll": {
|
|
138
|
+
"assemblyVersion": "0.9.0.0",
|
|
139
|
+
"fileVersion": "0.9.19.35779"
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
"Microsoft.Web.WebView2/1.0.3719.77": {
|
|
144
|
+
"runtimeTargets": {
|
|
145
|
+
"runtimes/win-arm64/native/WebView2Loader.dll": {
|
|
146
|
+
"rid": "win-arm64",
|
|
147
|
+
"assetType": "native",
|
|
148
|
+
"fileVersion": "1.0.3719.77"
|
|
149
|
+
},
|
|
150
|
+
"runtimes/win-x64/native/WebView2Loader.dll": {
|
|
151
|
+
"rid": "win-x64",
|
|
152
|
+
"assetType": "native",
|
|
153
|
+
"fileVersion": "1.0.3719.77"
|
|
154
|
+
},
|
|
155
|
+
"runtimes/win-x86/native/WebView2Loader.dll": {
|
|
156
|
+
"rid": "win-x86",
|
|
157
|
+
"assetType": "native",
|
|
158
|
+
"fileVersion": "1.0.3719.77"
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
"System.Reflection.MetadataLoadContext/6.0.0": {
|
|
163
|
+
"runtime": {
|
|
164
|
+
"lib/net6.0/System.Reflection.MetadataLoadContext.dll": {
|
|
165
|
+
"assemblyVersion": "6.0.0.0",
|
|
166
|
+
"fileVersion": "6.0.21.52210"
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
"Microsoft.Web.WebView2.Core/1.0.3719.77": {
|
|
171
|
+
"runtime": {
|
|
172
|
+
"Microsoft.Web.WebView2.Core.dll": {
|
|
173
|
+
"assemblyVersion": "1.0.3719.77",
|
|
174
|
+
"fileVersion": "1.0.3719.77"
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
"Microsoft.Web.WebView2.WinForms/1.0.3719.77": {
|
|
179
|
+
"runtime": {
|
|
180
|
+
"Microsoft.Web.WebView2.WinForms.dll": {
|
|
181
|
+
"assemblyVersion": "1.0.3719.77",
|
|
182
|
+
"fileVersion": "1.0.3719.77"
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
"Microsoft.Web.WebView2.Wpf/1.0.3719.77": {
|
|
187
|
+
"runtime": {
|
|
188
|
+
"Microsoft.Web.WebView2.Wpf.dll": {
|
|
189
|
+
"assemblyVersion": "1.0.3719.77",
|
|
190
|
+
"fileVersion": "1.0.3719.77"
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
"libraries": {
|
|
197
|
+
"WebView/1.0.0": {
|
|
198
|
+
"type": "project",
|
|
199
|
+
"serviceable": false,
|
|
200
|
+
"sha512": ""
|
|
201
|
+
},
|
|
202
|
+
"Microsoft.CodeAnalysis.Common/4.1.0": {
|
|
203
|
+
"type": "package",
|
|
204
|
+
"serviceable": true,
|
|
205
|
+
"sha512": "sha512-bNzTyxP3iD5FPFHfVDl15Y6/wSoI7e3MeV0lOaj9igbIKTjgrmuw6LoVJ06jUNFA7+KaDC/OIsStWl/FQJz6sQ==",
|
|
206
|
+
"path": "microsoft.codeanalysis.common/4.1.0",
|
|
207
|
+
"hashPath": "microsoft.codeanalysis.common.4.1.0.nupkg.sha512"
|
|
208
|
+
},
|
|
209
|
+
"Microsoft.CodeAnalysis.CSharp/4.1.0": {
|
|
210
|
+
"type": "package",
|
|
211
|
+
"serviceable": true,
|
|
212
|
+
"sha512": "sha512-sbu6kDGzo9bfQxuqWpeEE7I9P30bSuZEnpDz9/qz20OU6pm79Z63+/BsAzO2e/R/Q97kBrpj647wokZnEVr97w==",
|
|
213
|
+
"path": "microsoft.codeanalysis.csharp/4.1.0",
|
|
214
|
+
"hashPath": "microsoft.codeanalysis.csharp.4.1.0.nupkg.sha512"
|
|
215
|
+
},
|
|
216
|
+
"Microsoft.JavaScript.NodeApi/0.9.19": {
|
|
217
|
+
"type": "package",
|
|
218
|
+
"serviceable": true,
|
|
219
|
+
"sha512": "sha512-sqPwVW/vIf04S9HhEfKah9fSyszbGxfJhRomACLDivlhMrZl7gni6MCtZ+FcoZGNTzjhLCrvBaEP2bNHQ1movA==",
|
|
220
|
+
"path": "microsoft.javascript.nodeapi/0.9.19",
|
|
221
|
+
"hashPath": "microsoft.javascript.nodeapi.0.9.19.nupkg.sha512"
|
|
222
|
+
},
|
|
223
|
+
"Microsoft.JavaScript.NodeApi.Generator/0.9.19": {
|
|
224
|
+
"type": "package",
|
|
225
|
+
"serviceable": true,
|
|
226
|
+
"sha512": "sha512-S+pnFx/TpO1njVK3cHE+uIx19QSNXZA6ceAaSLSOjOiIq8p0RoyxxVX5ISRJH2ZDQdHpQzMhJ952vcMQDHjh1g==",
|
|
227
|
+
"path": "microsoft.javascript.nodeapi.generator/0.9.19",
|
|
228
|
+
"hashPath": "microsoft.javascript.nodeapi.generator.0.9.19.nupkg.sha512"
|
|
229
|
+
},
|
|
230
|
+
"Microsoft.Web.WebView2/1.0.3719.77": {
|
|
231
|
+
"type": "package",
|
|
232
|
+
"serviceable": true,
|
|
233
|
+
"sha512": "sha512-t+ucyKw5NTwMjsUrDF6R9Lk40lpcKQD1/HgyGFxl49tdA4h9dKlsj6FYGEmDRpFNfnTpENuTypMcdbrlkqBdDA==",
|
|
234
|
+
"path": "microsoft.web.webview2/1.0.3719.77",
|
|
235
|
+
"hashPath": "microsoft.web.webview2.1.0.3719.77.nupkg.sha512"
|
|
236
|
+
},
|
|
237
|
+
"System.Reflection.MetadataLoadContext/6.0.0": {
|
|
238
|
+
"type": "package",
|
|
239
|
+
"serviceable": true,
|
|
240
|
+
"sha512": "sha512-SuK8qTHbmG3PToLo1TEq8YSfY31FiKhASBmjozUTAleDgiX4H2X4jm0VPFb+K2soSSmYPyHTpHp35TctfNtDzQ==",
|
|
241
|
+
"path": "system.reflection.metadataloadcontext/6.0.0",
|
|
242
|
+
"hashPath": "system.reflection.metadataloadcontext.6.0.0.nupkg.sha512"
|
|
243
|
+
},
|
|
244
|
+
"Microsoft.Web.WebView2.Core/1.0.3719.77": {
|
|
245
|
+
"type": "reference",
|
|
246
|
+
"serviceable": false,
|
|
247
|
+
"sha512": ""
|
|
248
|
+
},
|
|
249
|
+
"Microsoft.Web.WebView2.WinForms/1.0.3719.77": {
|
|
250
|
+
"type": "reference",
|
|
251
|
+
"serviceable": false,
|
|
252
|
+
"sha512": ""
|
|
253
|
+
},
|
|
254
|
+
"Microsoft.Web.WebView2.Wpf/1.0.3719.77": {
|
|
255
|
+
"type": "reference",
|
|
256
|
+
"serviceable": false,
|
|
257
|
+
"sha512": ""
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Generated for: WebView 1.0.0.0
|
|
2
|
+
// Generated by: Microsoft.JavaScript.NodeApi.Generator 0.9.0.0
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
|
|
5
|
+
import dotnet from 'node-api-dotnet/net10.0';
|
|
6
|
+
import * as path from 'node:path';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
// @ts-ignore - https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/65252
|
|
9
|
+
import { dlopen, platform, arch } from 'node:process';
|
|
10
|
+
|
|
11
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
12
|
+
const __dirname = path.dirname(__filename);
|
|
13
|
+
const moduleName = path.basename(__filename, __filename.match(/(\.[cm]?js)?$/)[0]);
|
|
14
|
+
const exports = dotnet ? importDotnetModule(moduleName) : importAotModule(moduleName);
|
|
15
|
+
|
|
16
|
+
function importDotnetModule(moduleName) {
|
|
17
|
+
const moduleFilePath = path.join(__dirname, moduleName + '.dll');
|
|
18
|
+
return dotnet.require(moduleFilePath);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function importAotModule(moduleName) {
|
|
22
|
+
const ridPlatform = platform === 'win32' ? 'win' : platform === 'darwin' ? 'osx' : platform;
|
|
23
|
+
const ridArch = arch === 'ia32' ? 'x86' : arch;
|
|
24
|
+
const rid = `${ridPlatform}-${ridArch}`;
|
|
25
|
+
const moduleFilePath = path.join(__dirname, rid, moduleName + '.node');
|
|
26
|
+
const module = { exports: {} };
|
|
27
|
+
dlopen(module, moduleFilePath);
|
|
28
|
+
return module.exports;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const EwvjsInterop = exports.EwvjsInterop;
|