@nativescript/windows-quickjs 0.1.0-alpha.0 → 0.1.0-alpha.138
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 +3 -27
- package/framework/__PROJECT_NAME__/App.xaml +13 -13
- package/framework/__PROJECT_NAME__/Package.appxmanifest +35 -35
- package/framework/__PROJECT_NAME__/Program.cs +34 -34
- package/framework/__PROJECT_NAME__/Properties/Default.rd.xml +9 -9
- package/framework/__PROJECT_NAME__/RuntimeHost.cs +54 -11
- package/framework/__PROJECT_NAME__/__PROJECT_NAME__.csproj +6 -1
- package/framework/dotnet-bridge/BinaryProtocol.cs +161 -161
- package/framework/dotnet-bridge/Bridge.JsDelegate.cs +244 -244
- package/framework/dotnet-bridge/Bridge.TaskHelper.cs +207 -207
- package/framework/dotnet-bridge/DispatchTypes.cs +333 -333
- package/framework/dotnet-bridge/DotNetBridge.csproj +30 -30
- package/framework/libs/x64/nativescript.dll +0 -0
- package/framework/tools/ManifestMerger/ManifestMerger.dll +0 -0
- package/framework/tools/ManifestMerger/ManifestMerger.pdb +0 -0
- package/framework/tools/dotnet-tool-arm64.exe +0 -0
- package/framework/tools/dotnet-tool-x64.exe +0 -0
- package/framework/tools/dotnet-tool.exe +0 -0
- package/framework/tools/dotnet-typings-gen/dotnet-typings-gen.dll +0 -0
- package/framework/tools/dotnet-typings-gen/dotnet-typings-gen.exe +0 -0
- package/framework/tools/dotnet-typings-gen/dotnet-typings-gen.pdb +0 -0
- package/framework/tools/nsbundle_pack-x64.exe +0 -0
- package/framework/tools/nsbundle_pack.exe +0 -0
- package/framework/tools/sbg-arm64.exe +0 -0
- package/framework/tools/sbg-x64.exe +0 -0
- package/framework/tools/sbg.exe +0 -0
- package/framework/tools/typings-generator-arm64.exe +0 -0
- package/framework/tools/typings-generator-x64.exe +0 -0
- package/framework/tools/typings-generator.exe +0 -0
- package/package.json +43 -43
package/README.md
CHANGED
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
# @nativescript/windows-quickjs
|
|
2
|
-
|
|
3
|
-
NativeScript Windows runtime on **embedded QuickJS**
|
|
4
|
-
with no Node/Bun/Deno host. The engine-neutral `runtime::napi_engine` WinRT interop runs unchanged
|
|
5
|
-
over the shim's `napi_env`.
|
|
6
|
-
|
|
7
|
-
## As an app runtime (drop-in for `@nativescript/windows`)
|
|
8
|
-
Publishes as `@nativescript/windows-quickjs`, the **same** WinUI 3 framework as
|
|
9
|
-
`@nativescript/windows` with the QuickJS runtime DLL — swap the dependency and an app runs
|
|
10
|
-
unchanged. Build the framework with the engine flag:
|
|
11
|
-
```sh
|
|
12
|
-
pwsh -File ../../template/build.ps1 -Engine quickjs # or: npm run build
|
|
13
|
-
```
|
|
14
|
-
`src/abi.rs` (the `host_dll` feature) is the reference implementation of the engine → runtime-DLL
|
|
15
|
-
adapter (the C ABI the WinUI 3 host P/Invokes). See `../README.md` for the full contract.
|
|
16
|
-
|
|
17
|
-
## Standalone host (dev/bench)
|
|
18
|
-
```sh
|
|
19
|
-
cargo build --release --manifest-path packages/windows-quickjs/Cargo.toml
|
|
20
|
-
target/release/nativescript-windows.exe # runs the WinRT demo, exit 0
|
|
21
|
-
```
|
|
22
|
-
`--no-default-features` builds only the engine smoke lib (no napi/v8).
|
|
23
|
-
|
|
24
|
-
## Notes
|
|
25
|
-
- The engine is compiled from `vendor/` (quickjs-ng fork + shim); see `vendor` sources.
|
|
26
|
-
- Carries a fix for a double-free in the shim's finalizer (`quickjs-api.c`
|
|
27
|
-
`JSFinalizeValueCallback`) — worth upstreaming to napi-android.
|
|
1
|
+
# @nativescript/windows-quickjs
|
|
2
|
+
|
|
3
|
+
NativeScript Windows runtime on **embedded QuickJS**
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
<Application
|
|
2
|
-
x:Class="__PROJECT_NAME__.App"
|
|
3
|
-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
4
|
-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
5
|
-
xmlns:local="using:__PROJECT_NAME__">
|
|
6
|
-
<Application.Resources>
|
|
7
|
-
<ResourceDictionary>
|
|
8
|
-
<ResourceDictionary.MergedDictionaries>
|
|
9
|
-
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
|
|
10
|
-
</ResourceDictionary.MergedDictionaries>
|
|
11
|
-
</ResourceDictionary>
|
|
12
|
-
</Application.Resources>
|
|
13
|
-
</Application>
|
|
1
|
+
<Application
|
|
2
|
+
x:Class="__PROJECT_NAME__.App"
|
|
3
|
+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
4
|
+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
5
|
+
xmlns:local="using:__PROJECT_NAME__">
|
|
6
|
+
<Application.Resources>
|
|
7
|
+
<ResourceDictionary>
|
|
8
|
+
<ResourceDictionary.MergedDictionaries>
|
|
9
|
+
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
|
|
10
|
+
</ResourceDictionary.MergedDictionaries>
|
|
11
|
+
</ResourceDictionary>
|
|
12
|
+
</Application.Resources>
|
|
13
|
+
</Application>
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<Package
|
|
3
|
-
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
|
|
4
|
-
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
|
|
5
|
-
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
|
|
6
|
-
IgnorableNamespaces="uap rescap">
|
|
7
|
-
<Identity Name="__APP_IDENTIFIER__" Publisher="CN=__PROJECT_NAME__" Version="1.0.0.0" />
|
|
8
|
-
<Properties>
|
|
9
|
-
<DisplayName>__PROJECT_NAME__</DisplayName>
|
|
10
|
-
<PublisherDisplayName>__PROJECT_NAME__</PublisherDisplayName>
|
|
11
|
-
<Logo>Assets\StoreLogo.png</Logo>
|
|
12
|
-
</Properties>
|
|
13
|
-
<Dependencies>
|
|
14
|
-
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.26100.0" />
|
|
15
|
-
<!-- WinUI3 / Windows App SDK 1.6 framework package (framework-dependent). Required so the
|
|
16
|
-
registered app can activate Microsoft.UI.Xaml.* (else REGDB_E_CLASSNOTREG at startup). -->
|
|
17
|
-
<PackageDependency Name="Microsoft.WindowsAppRuntime.1.6" MinVersion="6000.0.0.0" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />
|
|
18
|
-
</Dependencies>
|
|
19
|
-
<Resources>
|
|
20
|
-
<Resource Language="en-US" />
|
|
21
|
-
</Resources>
|
|
22
|
-
<Applications>
|
|
23
|
-
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="Windows.FullTrustApplication">
|
|
24
|
-
<uap:VisualElements DisplayName="__PROJECT_NAME__" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="A NativeScript Windows application" BackgroundColor="#65ADF1">
|
|
25
|
-
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" />
|
|
26
|
-
<uap:SplashScreen Image="Assets\SplashScreen.png" />
|
|
27
|
-
</uap:VisualElements>
|
|
28
|
-
</Application>
|
|
29
|
-
</Applications>
|
|
30
|
-
<Capabilities>
|
|
31
|
-
<rescap:Capability Name="runFullTrust" />
|
|
32
|
-
<Capability Name="internetClient" />
|
|
33
|
-
<Capability Name="privateNetworkClientServer" />
|
|
34
|
-
</Capabilities>
|
|
35
|
-
</Package>
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<Package
|
|
3
|
+
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
|
|
4
|
+
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
|
|
5
|
+
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
|
|
6
|
+
IgnorableNamespaces="uap rescap">
|
|
7
|
+
<Identity Name="__APP_IDENTIFIER__" Publisher="CN=__PROJECT_NAME__" Version="1.0.0.0" />
|
|
8
|
+
<Properties>
|
|
9
|
+
<DisplayName>__PROJECT_NAME__</DisplayName>
|
|
10
|
+
<PublisherDisplayName>__PROJECT_NAME__</PublisherDisplayName>
|
|
11
|
+
<Logo>Assets\StoreLogo.png</Logo>
|
|
12
|
+
</Properties>
|
|
13
|
+
<Dependencies>
|
|
14
|
+
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.26100.0" />
|
|
15
|
+
<!-- WinUI3 / Windows App SDK 1.6 framework package (framework-dependent). Required so the
|
|
16
|
+
registered app can activate Microsoft.UI.Xaml.* (else REGDB_E_CLASSNOTREG at startup). -->
|
|
17
|
+
<PackageDependency Name="Microsoft.WindowsAppRuntime.1.6" MinVersion="6000.0.0.0" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />
|
|
18
|
+
</Dependencies>
|
|
19
|
+
<Resources>
|
|
20
|
+
<Resource Language="en-US" />
|
|
21
|
+
</Resources>
|
|
22
|
+
<Applications>
|
|
23
|
+
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="Windows.FullTrustApplication">
|
|
24
|
+
<uap:VisualElements DisplayName="__PROJECT_NAME__" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="A NativeScript Windows application" BackgroundColor="#65ADF1">
|
|
25
|
+
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" />
|
|
26
|
+
<uap:SplashScreen Image="Assets\SplashScreen.png" />
|
|
27
|
+
</uap:VisualElements>
|
|
28
|
+
</Application>
|
|
29
|
+
</Applications>
|
|
30
|
+
<Capabilities>
|
|
31
|
+
<rescap:Capability Name="runFullTrust" />
|
|
32
|
+
<Capability Name="internetClient" />
|
|
33
|
+
<Capability Name="privateNetworkClientServer" />
|
|
34
|
+
</Capabilities>
|
|
35
|
+
</Package>
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
using System;
|
|
2
|
-
using System.Threading;
|
|
3
|
-
using Microsoft.UI.Dispatching;
|
|
4
|
-
using Microsoft.UI.Xaml;
|
|
5
|
-
using WinRT;
|
|
6
|
-
|
|
7
|
-
// Windows-only WinUI desktop app. The custom entry point (DISABLE_XAML_GENERATED_MAIN)
|
|
8
|
-
// has no platform attribute, so CA1416 treats every Windows API call site as "reachable
|
|
9
|
-
// on all platforms." Declaring the assembly's supported platform once tells the analyzer
|
|
10
|
-
// the whole assembly only runs on Windows >= 17763, silencing those false positives.
|
|
11
|
-
[assembly: System.Runtime.Versioning.SupportedOSPlatform("windows10.0.17763.0")]
|
|
12
|
-
|
|
13
|
-
namespace __PROJECT_NAME__
|
|
14
|
-
{
|
|
15
|
-
public static class Program
|
|
16
|
-
{
|
|
17
|
-
[System.STAThread]
|
|
18
|
-
public static void Main(string[] args)
|
|
19
|
-
{
|
|
20
|
-
ComWrappersSupport.InitializeComWrappers();
|
|
21
|
-
|
|
22
|
-
Application.Start((_callbackParams) =>
|
|
23
|
-
{
|
|
24
|
-
var dispatcherQueue = DispatcherQueue.GetForCurrentThread();
|
|
25
|
-
if (dispatcherQueue != null)
|
|
26
|
-
{
|
|
27
|
-
SynchronizationContext.SetSynchronizationContext(new DispatcherQueueSynchronizationContext(dispatcherQueue));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
new App();
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
1
|
+
using System;
|
|
2
|
+
using System.Threading;
|
|
3
|
+
using Microsoft.UI.Dispatching;
|
|
4
|
+
using Microsoft.UI.Xaml;
|
|
5
|
+
using WinRT;
|
|
6
|
+
|
|
7
|
+
// Windows-only WinUI desktop app. The custom entry point (DISABLE_XAML_GENERATED_MAIN)
|
|
8
|
+
// has no platform attribute, so CA1416 treats every Windows API call site as "reachable
|
|
9
|
+
// on all platforms." Declaring the assembly's supported platform once tells the analyzer
|
|
10
|
+
// the whole assembly only runs on Windows >= 17763, silencing those false positives.
|
|
11
|
+
[assembly: System.Runtime.Versioning.SupportedOSPlatform("windows10.0.17763.0")]
|
|
12
|
+
|
|
13
|
+
namespace __PROJECT_NAME__
|
|
14
|
+
{
|
|
15
|
+
public static class Program
|
|
16
|
+
{
|
|
17
|
+
[System.STAThread]
|
|
18
|
+
public static void Main(string[] args)
|
|
19
|
+
{
|
|
20
|
+
ComWrappersSupport.InitializeComWrappers();
|
|
21
|
+
|
|
22
|
+
Application.Start((_callbackParams) =>
|
|
23
|
+
{
|
|
24
|
+
var dispatcherQueue = DispatcherQueue.GetForCurrentThread();
|
|
25
|
+
if (dispatcherQueue != null)
|
|
26
|
+
{
|
|
27
|
+
SynchronizationContext.SetSynchronizationContext(new DispatcherQueueSynchronizationContext(dispatcherQueue));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
new App();
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
Runtime Directives for .NET Native.
|
|
3
|
-
See https://go.microsoft.com/fwlink/?LinkID=391919
|
|
4
|
-
-->
|
|
5
|
-
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
|
|
6
|
-
<Application>
|
|
7
|
-
<Assembly Name="*Application*" Dynamic="Required All" />
|
|
8
|
-
</Application>
|
|
9
|
-
</Directives>
|
|
1
|
+
<!--
|
|
2
|
+
Runtime Directives for .NET Native.
|
|
3
|
+
See https://go.microsoft.com/fwlink/?LinkID=391919
|
|
4
|
+
-->
|
|
5
|
+
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
|
|
6
|
+
<Application>
|
|
7
|
+
<Assembly Name="*Application*" Dynamic="Required All" />
|
|
8
|
+
</Application>
|
|
9
|
+
</Directives>
|
|
@@ -32,6 +32,20 @@ namespace __PROJECT_NAME__
|
|
|
32
32
|
[DllImport(NativeScriptLibrary, EntryPoint = nameof(runtime_set_local_folder))]
|
|
33
33
|
private static extern void runtime_set_local_folder([MarshalAs(UnmanagedType.LPUTF8Str)] string localFolder);
|
|
34
34
|
|
|
35
|
+
// Escape hatch for apps packed with `nsbundle_pack --key-hex <hex>` (custom-key
|
|
36
|
+
// app.nsbundle containers). Must be called before runtime_init if used at all — apps
|
|
37
|
+
// packed with the default pepper (no --key-hex) never need to call this. Not wired to a
|
|
38
|
+
// default call site here; an app author supplies their own key material and calls this
|
|
39
|
+
// from Initialize() before runtime_init(...).
|
|
40
|
+
[DllImport(NativeScriptLibrary, EntryPoint = nameof(runtime_set_bundle_key))]
|
|
41
|
+
private static extern int runtime_set_bundle_key([MarshalAs(UnmanagedType.LPUTF8Str)] string keyHex);
|
|
42
|
+
|
|
43
|
+
[DllImport(NativeScriptLibrary, EntryPoint = nameof(runtime_read_protected_file))]
|
|
44
|
+
private static extern IntPtr runtime_read_protected_file([MarshalAs(UnmanagedType.LPUTF8Str)] string virtualPath);
|
|
45
|
+
|
|
46
|
+
[DllImport(NativeScriptLibrary, EntryPoint = nameof(runtime_free_protected_string))]
|
|
47
|
+
private static extern void runtime_free_protected_string(IntPtr ptr);
|
|
48
|
+
|
|
35
49
|
[DllImport(NativeScriptLibrary, EntryPoint = nameof(runtime_get_last_js_error))]
|
|
36
50
|
private static extern IntPtr runtime_get_last_js_error();
|
|
37
51
|
|
|
@@ -191,6 +205,27 @@ namespace __PROJECT_NAME__
|
|
|
191
205
|
}
|
|
192
206
|
#endif
|
|
193
207
|
|
|
208
|
+
/// Reads a file that may live inside a sealed app.nsbundle instead of on disk: tries the
|
|
209
|
+
/// protected-VFS native call first (cheap no-op when no bundle is loaded), falls back to
|
|
210
|
+
/// the real filesystem. `path` is whatever candidate the caller already built for
|
|
211
|
+
/// `File.Exists`/`File.ReadAllText` — the native side strips it down to the bundle's
|
|
212
|
+
/// virtual (app/App-relative) path itself, so no extra bookkeeping is needed here.
|
|
213
|
+
private static string TryReadVirtual(string path)
|
|
214
|
+
{
|
|
215
|
+
IntPtr ptr = IntPtr.Zero;
|
|
216
|
+
try
|
|
217
|
+
{
|
|
218
|
+
ptr = runtime_read_protected_file(path);
|
|
219
|
+
return ptr == IntPtr.Zero ? null : Marshal.PtrToStringUTF8(ptr);
|
|
220
|
+
}
|
|
221
|
+
catch { return null; }
|
|
222
|
+
finally { if (ptr != IntPtr.Zero) runtime_free_protected_string(ptr); }
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
private static bool VExists(string path) => TryReadVirtual(path) != null || File.Exists(path);
|
|
226
|
+
|
|
227
|
+
private static string VReadAllText(string path) => TryReadVirtual(path) ?? File.ReadAllText(path);
|
|
228
|
+
|
|
194
229
|
public void RunMainScript()
|
|
195
230
|
{
|
|
196
231
|
if (!_initialized)
|
|
@@ -205,10 +240,14 @@ namespace __PROJECT_NAME__
|
|
|
205
240
|
|
|
206
241
|
var dir = Path.GetDirectoryName(Path.GetFullPath(entryPath));
|
|
207
242
|
var chunks = new List<string>();
|
|
208
|
-
|
|
243
|
+
// An ES-module entry (Vite's bundle.mjs) imports its own chunks; webpack's classic
|
|
244
|
+
// runtime.js/vendor.js prelude must not run in front of it (a stale pair can be left
|
|
245
|
+
// in app/ after switching bundlers).
|
|
246
|
+
var isModuleEntry = entryPath.EndsWith(".mjs", StringComparison.OrdinalIgnoreCase);
|
|
247
|
+
foreach (var chunkName in isModuleEntry ? Array.Empty<string>() : new[] { "runtime.js", "vendor.js" })
|
|
209
248
|
{
|
|
210
249
|
var chunkPath = Path.Combine(dir, chunkName);
|
|
211
|
-
if (
|
|
250
|
+
if (VExists(chunkPath) &&
|
|
212
251
|
!string.Equals(chunkPath, Path.GetFullPath(entryPath), StringComparison.OrdinalIgnoreCase))
|
|
213
252
|
{
|
|
214
253
|
chunks.Add(chunkPath);
|
|
@@ -218,10 +257,14 @@ namespace __PROJECT_NAME__
|
|
|
218
257
|
|
|
219
258
|
foreach (var scriptPath in chunks)
|
|
220
259
|
{
|
|
221
|
-
var script =
|
|
260
|
+
var script = VReadAllText(Path.GetFullPath(scriptPath));
|
|
222
261
|
try
|
|
223
262
|
{
|
|
224
|
-
|
|
263
|
+
// Modules resolve their imports (chunks, ~/ paths) relative to their own
|
|
264
|
+
// location, so they need the full path; classic scripts keep the short name
|
|
265
|
+
// their stack traces and code-cache keys have always used.
|
|
266
|
+
var name = isModuleEntry ? Path.GetFullPath(scriptPath) : Path.GetFileName(scriptPath);
|
|
267
|
+
runtime_runscript(_runtime, script, name);
|
|
225
268
|
}
|
|
226
269
|
catch (Exception ex)
|
|
227
270
|
{
|
|
@@ -260,7 +303,7 @@ namespace __PROJECT_NAME__
|
|
|
260
303
|
foreach (var dir in appDirCandidates)
|
|
261
304
|
{
|
|
262
305
|
var candidate = Path.Combine(dir, "package.json");
|
|
263
|
-
if (
|
|
306
|
+
if (VExists(candidate))
|
|
264
307
|
{
|
|
265
308
|
packageJsonPath = candidate;
|
|
266
309
|
resolvedBaseDir = dir;
|
|
@@ -269,7 +312,7 @@ namespace __PROJECT_NAME__
|
|
|
269
312
|
}
|
|
270
313
|
|
|
271
314
|
// Also accept package.json at the project root (parent of bin/).
|
|
272
|
-
if (packageJsonPath == null &&
|
|
315
|
+
if (packageJsonPath == null && VExists(Path.Combine(parentDir, "package.json")))
|
|
273
316
|
{
|
|
274
317
|
packageJsonPath = Path.Combine(parentDir, "package.json");
|
|
275
318
|
resolvedBaseDir = parentDir;
|
|
@@ -278,7 +321,7 @@ namespace __PROJECT_NAME__
|
|
|
278
321
|
string Fallback() =>
|
|
279
322
|
appDirCandidates
|
|
280
323
|
.SelectMany(d => new[] { Path.Combine(d, "bundle.js"), Path.Combine(d, "bundle.mjs") })
|
|
281
|
-
.FirstOrDefault(
|
|
324
|
+
.FirstOrDefault(VExists);
|
|
282
325
|
|
|
283
326
|
if (packageJsonPath == null)
|
|
284
327
|
return Fallback();
|
|
@@ -304,7 +347,7 @@ namespace __PROJECT_NAME__
|
|
|
304
347
|
|
|
305
348
|
private static RuntimePackageConfig ParsePackageConfig(string packageJsonPath)
|
|
306
349
|
{
|
|
307
|
-
using var doc = JsonDocument.Parse(
|
|
350
|
+
using var doc = JsonDocument.Parse(VReadAllText(packageJsonPath));
|
|
308
351
|
var config = new RuntimePackageConfig();
|
|
309
352
|
if (doc.RootElement.TryGetProperty("main", out var main) && main.ValueKind == JsonValueKind.String)
|
|
310
353
|
config.Main = main.GetString();
|
|
@@ -321,11 +364,11 @@ namespace __PROJECT_NAME__
|
|
|
321
364
|
foreach (var candidate in new[] { normalized, normalized + ".js", normalized + ".mjs" })
|
|
322
365
|
{
|
|
323
366
|
var direct = Path.IsPathRooted(candidate) ? candidate : Path.Combine(baseDir, candidate);
|
|
324
|
-
if (
|
|
367
|
+
if (VExists(direct)) return direct;
|
|
325
368
|
var appLower = Path.Combine(baseDir, "app", candidate);
|
|
326
|
-
if (
|
|
369
|
+
if (VExists(appLower)) return appLower;
|
|
327
370
|
var appUpper = Path.Combine(baseDir, "App", candidate);
|
|
328
|
-
if (
|
|
371
|
+
if (VExists(appUpper)) return appUpper;
|
|
329
372
|
}
|
|
330
373
|
return null;
|
|
331
374
|
}
|
|
@@ -87,7 +87,12 @@
|
|
|
87
87
|
<Content Include="Properties\Default.rd.xml" />
|
|
88
88
|
|
|
89
89
|
<!-- App JS/resource files — copied to the output directory on every build -->
|
|
90
|
-
|
|
90
|
+
<!-- Sealed source-protected bundle when present, takes
|
|
91
|
+
priority over the plaintext app\ tree; produced by the nsbundle_pack packer tool. -->
|
|
92
|
+
<Content Include="app.nsbundle" Condition="Exists('app.nsbundle')">
|
|
93
|
+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
94
|
+
</Content>
|
|
95
|
+
<Content Include="app\**\*" Condition="!Exists('app.nsbundle')">
|
|
91
96
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
92
97
|
</Content>
|
|
93
98
|
|