@nativescript/vite 0.0.1-alpha.2 → 0.0.1-alpha.3

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.
@@ -234,7 +234,7 @@ export const baseConfig = ({ mode }) => {
234
234
  nsConfigAsJsonPlugin(),
235
235
  NativeScriptPlugin({ platform }),
236
236
  // Ensure globals and Android activity are included early via virtual entry
237
- mainEntryPlugin(cliFlags, debug, platform),
237
+ mainEntryPlugin(platform, verboseLogs, hmrActive),
238
238
  dynamicImportPlugin(),
239
239
  // Transform Vite worker URLs to NativeScript format AFTER bundling
240
240
  workerUrlPlugin(),
@@ -1,4 +1,4 @@
1
- export declare function mainEntryPlugin(cliFlags: any, debug?: boolean, platform?: "ios" | "android" | "visionos"): {
1
+ export declare function mainEntryPlugin(platform: "ios" | "android" | "visionos", verboseLogs: boolean, hmrActive: boolean): {
2
2
  name: string;
3
3
  resolveId(id: string): string;
4
4
  load(id: string): string;
@@ -13,8 +13,7 @@ const polyfillsPath = getProjectFilePath("src/polyfills.ts");
13
13
  const polyfillsExists = fs.existsSync(polyfillsPath);
14
14
  const VIRTUAL_ID = "virtual:entry-with-polyfills";
15
15
  const RESOLVED = "\0" + VIRTUAL_ID;
16
- export function mainEntryPlugin(cliFlags, debug, platform) {
17
- const HMR_ACTIVE = debug && !!cliFlags.hmr;
16
+ export function mainEntryPlugin(platform, verboseLogs, hmrActive) {
18
17
  return {
19
18
  name: "main-entry",
20
19
  resolveId(id) {
@@ -42,12 +41,13 @@ export function mainEntryPlugin(cliFlags, debug, platform) {
42
41
  }
43
42
  if (polyfillsExists) {
44
43
  imports += `import '${polyfillsPath}';\n`;
45
- imports += `if (__NS_ENV_VERBOSE__) console.info('[ns-entry] polyfills imported from', ${polyfillsPath});\n`;
44
+ // Ensure path is emitted as a proper JS string literal
45
+ imports += `if (__NS_ENV_VERBOSE__) console.info('[ns-entry] polyfills imported from', ${JSON.stringify(polyfillsPath)});\n`;
46
46
  }
47
47
  else {
48
48
  imports += "if (__NS_ENV_VERBOSE__) console.info('[ns-entry] no polyfills file found');\n";
49
49
  }
50
- if (HMR_ACTIVE) {
50
+ if (hmrActive) {
51
51
  // Ensure WebSocket polyfill is loaded early for device runtime
52
52
  imports += "import '@valor/nativescript-websockets';\n";
53
53
  imports += "if (__NS_ENV_VERBOSE__) console.info('[ns-entry] websockets polyfill imported');\n";
@@ -67,12 +67,12 @@ if (appCssContent) {
67
67
  // Import the main entry file
68
68
  imports += `if (__NS_ENV_VERBOSE__) console.info('[ns-entry] Importing main entry', '${mainEntry}');\n`;
69
69
  imports += `import '${mainEntry}';\n`;
70
- if (HMR_ACTIVE) {
70
+ if (hmrActive) {
71
71
  // Start HMR client after app boots
72
72
  imports += embedMainEntryHMRForFlavor(flavor);
73
73
  }
74
74
  // Import inspector modules for debugging in development
75
- if (debug) {
75
+ if (verboseLogs) {
76
76
  imports += "import '@nativescript/core/inspector_modules';\n";
77
77
  imports += "if (__NS_ENV_VERBOSE__) console.info('[ns-entry] inspector modules imported');\n";
78
78
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativescript/vite",
3
- "version": "0.0.1-alpha.2",
3
+ "version": "0.0.1-alpha.3",
4
4
  "description": "Vite for NativeScript",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",