@nativescript/windows 0.1.0-alpha.13 → 0.1.0-alpha.15

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.
@@ -1,4 +1,5 @@
1
1
  using System;
2
+ using System.Collections.Generic;
2
3
  using System.IO;
3
4
  using System.Linq;
4
5
  using System.Runtime.InteropServices;
@@ -137,16 +138,38 @@ namespace __PROJECT_NAME__
137
138
  throw new InvalidOperationException("Runtime must be initialized before running scripts.");
138
139
 
139
140
  var entryPath = ResolveEntryScriptPath();
140
- var script = File.ReadAllText(Path.GetFullPath(entryPath));
141
- try
141
+ if (entryPath == null)
142
142
  {
143
- runtime_runscript(_runtime, script, Path.GetFileName(entryPath));
143
+ System.Diagnostics.Debug.WriteLine("[NativeScript Runtime] No entry script found — bundle missing from app directory.");
144
+ return;
144
145
  }
145
- catch (Exception ex)
146
+
147
+ var dir = Path.GetDirectoryName(Path.GetFullPath(entryPath));
148
+ var chunks = new List<string>();
149
+ foreach (var chunkName in new[] { "runtime.js", "vendor.js" })
150
+ {
151
+ var chunkPath = Path.Combine(dir, chunkName);
152
+ if (File.Exists(chunkPath) &&
153
+ !string.Equals(chunkPath, Path.GetFullPath(entryPath), StringComparison.OrdinalIgnoreCase))
154
+ {
155
+ chunks.Add(chunkPath);
156
+ }
157
+ }
158
+ chunks.Add(entryPath);
159
+
160
+ foreach (var scriptPath in chunks)
146
161
  {
147
- CrashDiagnostics.WriteExceptionReport("RuntimeHost.RunMainScript", ex, "EntryScript=" + entryPath);
148
- System.Diagnostics.Debug.WriteLine($"[NativeScript Runtime] Script execution failed ({entryPath}): {ex}");
149
- throw;
162
+ var script = File.ReadAllText(Path.GetFullPath(scriptPath));
163
+ try
164
+ {
165
+ runtime_runscript(_runtime, script, Path.GetFileName(scriptPath));
166
+ }
167
+ catch (Exception ex)
168
+ {
169
+ CrashDiagnostics.WriteExceptionReport("RuntimeHost.RunMainScript", ex, "Script=" + scriptPath);
170
+ System.Diagnostics.Debug.WriteLine($"[NativeScript Runtime] Script execution failed ({scriptPath}): {ex}");
171
+ throw;
172
+ }
150
173
  }
151
174
  }
152
175
 
@@ -194,7 +217,9 @@ namespace __PROJECT_NAME__
194
217
  }
195
218
 
196
219
  string Fallback() =>
197
- appDirCandidates.Select(d => Path.Combine(d, "bundle.js")).FirstOrDefault(File.Exists);
220
+ appDirCandidates
221
+ .SelectMany(d => new[] { Path.Combine(d, "bundle.js"), Path.Combine(d, "bundle.mjs") })
222
+ .FirstOrDefault(File.Exists);
198
223
 
199
224
  if (packageJsonPath == null)
200
225
  return Fallback();
@@ -234,7 +259,7 @@ namespace __PROJECT_NAME__
234
259
  {
235
260
  if (string.IsNullOrWhiteSpace(scriptPath)) return null;
236
261
  var normalized = scriptPath.Replace('/', Path.DirectorySeparatorChar);
237
- foreach (var candidate in new[] { normalized, normalized + ".js" })
262
+ foreach (var candidate in new[] { normalized, normalized + ".js", normalized + ".mjs" })
238
263
  {
239
264
  var direct = Path.IsPathRooted(candidate) ? candidate : Path.Combine(baseDir, candidate);
240
265
  if (File.Exists(direct)) return direct;
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativescript/windows",
3
- "version": "0.1.0-alpha.13",
3
+ "version": "0.1.0-alpha.15",
4
4
  "description": "NativeScript for using Windows v8",
5
5
  "repository": {
6
6
  "type": "git",