@nativescript/windows 0.1.0-alpha.12 → 0.1.0-alpha.14
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/framework/__PROJECT_NAME__/RuntimeHost.cs +42 -16
- package/framework/libs/arm64/nativescript.dll +0 -0
- package/framework/libs/devtools/arm64/nativescript.dll +0 -0
- package/framework/libs/devtools/x64/nativescript.dll +0 -0
- package/framework/libs/x64/nativescript.dll +0 -0
- package/package.json +1 -1
|
@@ -36,6 +36,9 @@ namespace __PROJECT_NAME__
|
|
|
36
36
|
[DllImport(NativeScriptLibrary, EntryPoint = nameof(runtime_free_js_error))]
|
|
37
37
|
private static extern void runtime_free_js_error(IntPtr ptr);
|
|
38
38
|
|
|
39
|
+
[DllImport(NativeScriptLibrary, EntryPoint = nameof(runtime_has_devtools))]
|
|
40
|
+
private static extern bool runtime_has_devtools();
|
|
41
|
+
|
|
39
42
|
#if DEBUG
|
|
40
43
|
[DllImport(NativeScriptLibrary, EntryPoint = nameof(runtime_devtools_start))]
|
|
41
44
|
private static extern IntPtr runtime_devtools_start(long runtime, ushort port);
|
|
@@ -48,17 +51,12 @@ namespace __PROJECT_NAME__
|
|
|
48
51
|
|
|
49
52
|
public string DevtoolsFrontendUrl { get; private set; }
|
|
50
53
|
|
|
51
|
-
private bool
|
|
54
|
+
private bool _devtoolsAvailable;
|
|
52
55
|
|
|
53
56
|
public void PumpDevtools()
|
|
54
57
|
{
|
|
55
|
-
if (!_initialized || !
|
|
58
|
+
if (!_initialized || !_devtoolsAvailable) return;
|
|
56
59
|
try { runtime_devtools_pump(_runtime); }
|
|
57
|
-
catch (System.EntryPointNotFoundException)
|
|
58
|
-
{
|
|
59
|
-
// DLL built without devtools feature — stop trying.
|
|
60
|
-
_devtoolsPumpAvailable = false;
|
|
61
|
-
}
|
|
62
60
|
catch (Exception ex)
|
|
63
61
|
{
|
|
64
62
|
System.Diagnostics.Debug.WriteLine($"[NativeScript DevTools] Pump failed: {ex.Message}");
|
|
@@ -67,6 +65,7 @@ namespace __PROJECT_NAME__
|
|
|
67
65
|
|
|
68
66
|
private void StartDevtoolsSafely()
|
|
69
67
|
{
|
|
68
|
+
if (!runtime_has_devtools()) return;
|
|
70
69
|
IntPtr urlPtr = IntPtr.Zero;
|
|
71
70
|
try
|
|
72
71
|
{
|
|
@@ -77,7 +76,10 @@ namespace __PROJECT_NAME__
|
|
|
77
76
|
? $"devtools://devtools/bundled/inspector.html?ws={wsUrl.Replace("ws://", "")}"
|
|
78
77
|
: null;
|
|
79
78
|
if (DevtoolsFrontendUrl != null)
|
|
79
|
+
{
|
|
80
|
+
_devtoolsAvailable = true;
|
|
80
81
|
System.Diagnostics.Debug.WriteLine($"[NativeScript DevTools] {DevtoolsFrontendUrl}");
|
|
82
|
+
}
|
|
81
83
|
}
|
|
82
84
|
catch (Exception ex)
|
|
83
85
|
{
|
|
@@ -135,16 +137,38 @@ namespace __PROJECT_NAME__
|
|
|
135
137
|
throw new InvalidOperationException("Runtime must be initialized before running scripts.");
|
|
136
138
|
|
|
137
139
|
var entryPath = ResolveEntryScriptPath();
|
|
138
|
-
|
|
139
|
-
try
|
|
140
|
+
if (entryPath == null)
|
|
140
141
|
{
|
|
141
|
-
|
|
142
|
+
System.Diagnostics.Debug.WriteLine("[NativeScript Runtime] No entry script found — bundle missing from app directory.");
|
|
143
|
+
return;
|
|
142
144
|
}
|
|
143
|
-
|
|
145
|
+
|
|
146
|
+
var dir = Path.GetDirectoryName(Path.GetFullPath(entryPath));
|
|
147
|
+
var chunks = new List<string>();
|
|
148
|
+
foreach (var chunkName in new[] { "runtime.js", "vendor.js" })
|
|
144
149
|
{
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
150
|
+
var chunkPath = Path.Combine(dir, chunkName);
|
|
151
|
+
if (File.Exists(chunkPath) &&
|
|
152
|
+
!string.Equals(chunkPath, Path.GetFullPath(entryPath), StringComparison.OrdinalIgnoreCase))
|
|
153
|
+
{
|
|
154
|
+
chunks.Add(chunkPath);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
chunks.Add(entryPath);
|
|
158
|
+
|
|
159
|
+
foreach (var scriptPath in chunks)
|
|
160
|
+
{
|
|
161
|
+
var script = File.ReadAllText(Path.GetFullPath(scriptPath));
|
|
162
|
+
try
|
|
163
|
+
{
|
|
164
|
+
runtime_runscript(_runtime, script, Path.GetFileName(scriptPath));
|
|
165
|
+
}
|
|
166
|
+
catch (Exception ex)
|
|
167
|
+
{
|
|
168
|
+
CrashDiagnostics.WriteExceptionReport("RuntimeHost.RunMainScript", ex, "Script=" + scriptPath);
|
|
169
|
+
System.Diagnostics.Debug.WriteLine($"[NativeScript Runtime] Script execution failed ({scriptPath}): {ex}");
|
|
170
|
+
throw;
|
|
171
|
+
}
|
|
148
172
|
}
|
|
149
173
|
}
|
|
150
174
|
|
|
@@ -192,7 +216,9 @@ namespace __PROJECT_NAME__
|
|
|
192
216
|
}
|
|
193
217
|
|
|
194
218
|
string Fallback() =>
|
|
195
|
-
appDirCandidates
|
|
219
|
+
appDirCandidates
|
|
220
|
+
.SelectMany(d => new[] { Path.Combine(d, "bundle.js"), Path.Combine(d, "bundle.mjs") })
|
|
221
|
+
.FirstOrDefault(File.Exists);
|
|
196
222
|
|
|
197
223
|
if (packageJsonPath == null)
|
|
198
224
|
return Fallback();
|
|
@@ -232,7 +258,7 @@ namespace __PROJECT_NAME__
|
|
|
232
258
|
{
|
|
233
259
|
if (string.IsNullOrWhiteSpace(scriptPath)) return null;
|
|
234
260
|
var normalized = scriptPath.Replace('/', Path.DirectorySeparatorChar);
|
|
235
|
-
foreach (var candidate in new[] { normalized, normalized + ".js" })
|
|
261
|
+
foreach (var candidate in new[] { normalized, normalized + ".js", normalized + ".mjs" })
|
|
236
262
|
{
|
|
237
263
|
var direct = Path.IsPathRooted(candidate) ? candidate : Path.Combine(baseDir, candidate);
|
|
238
264
|
if (File.Exists(direct)) return direct;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|