@nativescript/windows 0.1.0-alpha.13 → 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.
|
@@ -137,16 +137,38 @@ namespace __PROJECT_NAME__
|
|
|
137
137
|
throw new InvalidOperationException("Runtime must be initialized before running scripts.");
|
|
138
138
|
|
|
139
139
|
var entryPath = ResolveEntryScriptPath();
|
|
140
|
-
|
|
141
|
-
try
|
|
140
|
+
if (entryPath == null)
|
|
142
141
|
{
|
|
143
|
-
|
|
142
|
+
System.Diagnostics.Debug.WriteLine("[NativeScript Runtime] No entry script found — bundle missing from app directory.");
|
|
143
|
+
return;
|
|
144
144
|
}
|
|
145
|
-
|
|
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" })
|
|
149
|
+
{
|
|
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)
|
|
146
160
|
{
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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
|
+
}
|
|
150
172
|
}
|
|
151
173
|
}
|
|
152
174
|
|
|
@@ -194,7 +216,9 @@ namespace __PROJECT_NAME__
|
|
|
194
216
|
}
|
|
195
217
|
|
|
196
218
|
string Fallback() =>
|
|
197
|
-
appDirCandidates
|
|
219
|
+
appDirCandidates
|
|
220
|
+
.SelectMany(d => new[] { Path.Combine(d, "bundle.js"), Path.Combine(d, "bundle.mjs") })
|
|
221
|
+
.FirstOrDefault(File.Exists);
|
|
198
222
|
|
|
199
223
|
if (packageJsonPath == null)
|
|
200
224
|
return Fallback();
|
|
@@ -234,7 +258,7 @@ namespace __PROJECT_NAME__
|
|
|
234
258
|
{
|
|
235
259
|
if (string.IsNullOrWhiteSpace(scriptPath)) return null;
|
|
236
260
|
var normalized = scriptPath.Replace('/', Path.DirectorySeparatorChar);
|
|
237
|
-
foreach (var candidate in new[] { normalized, normalized + ".js" })
|
|
261
|
+
foreach (var candidate in new[] { normalized, normalized + ".js", normalized + ".mjs" })
|
|
238
262
|
{
|
|
239
263
|
var direct = Path.IsPathRooted(candidate) ? candidate : Path.Combine(baseDir, candidate);
|
|
240
264
|
if (File.Exists(direct)) return direct;
|