plusui-native 0.2.70 → 0.2.73

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plusui-native",
3
- "version": "0.2.70",
3
+ "version": "0.2.73",
4
4
  "description": "PlusUI CLI - Build C++ desktop apps modern UI ",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -27,11 +27,11 @@
27
27
  "semver": "^7.6.0",
28
28
  "which": "^4.0.0",
29
29
  "execa": "^8.0.1",
30
- "plusui-native-builder": "^0.1.69",
31
- "plusui-native-connect": "^0.1.69"
30
+ "plusui-native-builder": "^0.1.72",
31
+ "plusui-native-connect": "^0.1.72"
32
32
  },
33
33
  "peerDependencies": {
34
- "plusui-native-connect": "^0.1.69"
34
+ "plusui-native-connect": "^0.1.72"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"
package/src/index.js CHANGED
@@ -250,14 +250,57 @@ function findVcvarsall() {
250
250
  return null;
251
251
  }
252
252
 
253
+ // Capture the full environment from vcvarsall.bat (cached per session)
254
+ let _vcEnvCache = undefined;
255
+ function getVcEnvironment() {
256
+ if (_vcEnvCache !== undefined) return _vcEnvCache;
257
+
258
+ if (process.platform !== 'win32') {
259
+ _vcEnvCache = null;
260
+ return null;
261
+ }
262
+
263
+ const vcvarsall = findVcvarsall();
264
+ if (!vcvarsall) {
265
+ _vcEnvCache = null;
266
+ return null;
267
+ }
268
+
269
+ try {
270
+ // Run vcvarsall and dump all environment variables
271
+ const output = execSync(
272
+ `cmd /c ""${vcvarsall}" x64 >nul 2>&1 && set"`,
273
+ { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'], timeout: 30000, shell: true }
274
+ );
275
+
276
+ // Parse "KEY=VALUE" lines into an env object
277
+ const env = {};
278
+ for (const line of output.split(/\r?\n/)) {
279
+ const idx = line.indexOf('=');
280
+ if (idx > 0) {
281
+ env[line.substring(0, idx)] = line.substring(idx + 1);
282
+ }
283
+ }
284
+
285
+ // Sanity check: we should have PATH and INCLUDE set
286
+ if (env.PATH && env.INCLUDE) {
287
+ _vcEnvCache = env;
288
+ return env;
289
+ }
290
+ } catch { }
291
+
292
+ _vcEnvCache = null;
293
+ return null;
294
+ }
295
+
253
296
  function runCMake(args, options = {}) {
254
297
  const cmake = getCMakePath();
255
298
 
256
- // On Windows, wrap cmake in vcvarsall to ensure cl.exe is in PATH (needed for Ninja)
299
+ // On Windows, use the captured vcvarsall environment so cl.exe + ninja are in PATH
257
300
  if (process.platform === 'win32') {
258
- const vcvarsall = findVcvarsall();
259
- if (vcvarsall) {
260
- return execSync(`cmd /c ""${vcvarsall}" x64 >nul 2>&1 && "${cmake}" ${args}"`, { stdio: 'inherit', shell: true, ...options });
301
+ const vcEnv = getVcEnvironment();
302
+ if (vcEnv) {
303
+ return execSync(`"${cmake}" ${args}`, { stdio: 'inherit', env: vcEnv, ...options });
261
304
  }
262
305
  }
263
306
 
@@ -648,7 +691,8 @@ function buildBackend(platform = null, devMode = false) {
648
691
  cmakeArgs += ` -G "${platformConfig.generator}"`;
649
692
  } else if (process.platform === 'win32') {
650
693
  // Use Ninja on Windows to avoid VS generator compatibility issues
651
- cmakeArgs += ' -G Ninja';
694
+ // Use embedded debug info (/Z7) to avoid VS 2026 PDB creation bug (C1041)
695
+ cmakeArgs += ' -G Ninja -DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded';
652
696
  }
653
697
 
654
698
  log(`Configuring CMake...`, 'blue');
@@ -841,9 +885,25 @@ async function startBackend() {
841
885
  const buildDir = getDevBuildDir();
842
886
 
843
887
  // On Windows, use Ninja generator to avoid VS generator compatibility issues
888
+ // Also use embedded debug info (/Z7) to avoid VS 2026 PDB creation bug (C1041)
844
889
  let generatorArgs = '';
845
890
  if (process.platform === 'win32') {
846
- generatorArgs = ' -G Ninja';
891
+ generatorArgs = ' -G Ninja -DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded';
892
+ }
893
+
894
+ // Auto-clean build dir if generator changed (e.g. VS → Ninja)
895
+ const cacheFile = join(buildDir, 'CMakeCache.txt');
896
+ if (existsSync(cacheFile)) {
897
+ try {
898
+ const cacheContent = execSync(`type "${cacheFile}"`, { encoding: 'utf8', shell: true, stdio: ['pipe', 'pipe', 'ignore'] });
899
+ const generatorMatch = cacheContent.match(/CMAKE_GENERATOR:INTERNAL=(.*)/);
900
+ const cachedGenerator = generatorMatch ? generatorMatch[1].trim() : '';
901
+ const wantNinja = generatorArgs.includes('Ninja');
902
+ if ((wantNinja && cachedGenerator !== 'Ninja') || (!wantNinja && cachedGenerator === 'Ninja')) {
903
+ log(`Generator changed (${cachedGenerator} → ${wantNinja ? 'Ninja' : 'default'}), cleaning build dir...`, 'yellow');
904
+ execSync(process.platform === 'win32' ? `rmdir /s /q "${buildDir}"` : `rm -rf "${buildDir}"`, { stdio: 'ignore', shell: true });
905
+ }
906
+ } catch { }
847
907
  }
848
908
 
849
909
  // Always configure with dev mode to ensure PLUSUI_DEV_MODE is set correctly
@@ -1,4 +1,10 @@
1
1
  cmake_minimum_required(VERSION 3.16)
2
+
3
+ # Enable modern MSVC debug information format (needed for /Z7 embedded debug)
4
+ if(POLICY CMP0141)
5
+ cmake_policy(SET CMP0141 NEW)
6
+ endif()
7
+
2
8
  project({{PROJECT_NAME}} VERSION {{PROJECT_VERSION}} LANGUAGES CXX)
3
9
 
4
10
  set(CMAKE_CXX_STANDARD 20)
@@ -1,4 +1,10 @@
1
1
  cmake_minimum_required(VERSION 3.16)
2
+
3
+ # Enable modern MSVC debug information format (needed for /Z7 embedded debug)
4
+ if(POLICY CMP0141)
5
+ cmake_policy(SET CMP0141 NEW)
6
+ endif()
7
+
2
8
  project({{PROJECT_NAME}} VERSION {{PROJECT_VERSION}} LANGUAGES CXX)
3
9
 
4
10
  set(CMAKE_CXX_STANDARD 20)