@choochmeque/tauri-windows-bundle 0.1.8 → 0.1.10

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/README.md CHANGED
@@ -61,7 +61,9 @@ Edit `src-tauri/gen/windows/bundle.config.json`:
61
61
  {
62
62
  "publisher": "CN=YourCompany",
63
63
  "publisherDisplayName": "Your Company Name",
64
- "capabilities": ["internetClient"],
64
+ "capabilities": {
65
+ "general": ["internetClient"]
66
+ },
65
67
  "signing": {
66
68
  "pfx": null,
67
69
  "pfxPassword": null
@@ -69,6 +71,24 @@ Edit `src-tauri/gen/windows/bundle.config.json`:
69
71
  }
70
72
  ```
71
73
 
74
+ **Capabilities** are validated at build time. Three types are supported:
75
+
76
+ ```json
77
+ {
78
+ "capabilities": {
79
+ "general": ["internetClient", "internetClientServer", "privateNetworkClientServer"],
80
+ "device": ["webcam", "microphone", "location", "bluetooth"],
81
+ "restricted": ["broadFileSystemAccess", "allowElevation"]
82
+ }
83
+ }
84
+ ```
85
+
86
+ - `general` - Standard capabilities (`<Capability>`)
87
+ - `device` - Device access (`<DeviceCapability>`)
88
+ - `restricted` - Requires Store approval (`<rescap:Capability>`)
89
+
90
+ Note: `runFullTrust` is always auto-added (required for Tauri apps).
91
+
72
92
  **Auto-read from tauri.conf.json:**
73
93
  - `displayName` ← `productName`
74
94
  - `version` ← `version` (auto-converted to 4-part: `1.0.0` → `1.0.0.0`)
@@ -80,14 +100,14 @@ Edit `src-tauri/gen/windows/bundle.config.json`:
80
100
  ### Build
81
101
 
82
102
  ```bash
83
- # Build x64 only (default, uses cargo)
103
+ # Build x64 only (default, uses cargo, release mode)
84
104
  pnpm tauri:windows:build
85
105
 
86
106
  # Build multiarch bundle (x64 + arm64)
87
107
  pnpm tauri:windows:build --arch x64,arm64
88
108
 
89
- # Release build
90
- pnpm tauri:windows:build --release
109
+ # Debug build (release is default)
110
+ pnpm tauri:windows:build --debug
91
111
 
92
112
  # Use different build runner (pnpm, npm, yarn, bun, etc.)
93
113
  pnpm tauri:windows:build --runner pnpm
@@ -111,7 +131,7 @@ npx @choochmeque/tauri-windows-bundle init [options]
111
131
 
112
132
  npx @choochmeque/tauri-windows-bundle build [options]
113
133
  --arch <archs> Architectures (comma-separated: x64,arm64) [default: x64]
114
- --release Build in release mode
134
+ --debug Build in debug mode (release is default)
115
135
  --min-windows <ver> Minimum Windows version [default: 10.0.17763.0]
116
136
  --runner <runner> Build runner (cargo, pnpm, npm, yarn, bun) [default: cargo]
117
137
  --verbose Show full build output instead of spinner
package/dist/cli.js CHANGED
@@ -74,7 +74,80 @@ const MSIX_ASSETS = [
74
74
  { name: 'LargeTile.png', size: 310 },
75
75
  ];
76
76
  const DEFAULT_MIN_WINDOWS_VERSION = '10.0.17763.0';
77
- const DEFAULT_CAPABILITIES = ['internetClient'];
77
+ // Valid Windows capabilities by type
78
+ // Reference: https://learn.microsoft.com/en-us/windows/uwp/packaging/app-capability-declarations
79
+ const GENERAL_CAPABILITIES = [
80
+ 'internetClient',
81
+ 'internetClientServer',
82
+ 'privateNetworkClientServer',
83
+ 'allJoyn',
84
+ 'codeGeneration',
85
+ ];
86
+ const DEVICE_CAPABILITIES = [
87
+ 'webcam',
88
+ 'microphone',
89
+ 'location',
90
+ 'proximity',
91
+ 'bluetooth',
92
+ 'serialcommunication',
93
+ 'usb',
94
+ 'humaninterfacedevice',
95
+ 'pointOfService',
96
+ 'lowLevelDevices',
97
+ 'gazeInput',
98
+ 'radios',
99
+ ];
100
+ const RESTRICTED_CAPABILITIES = [
101
+ 'broadFileSystemAccess',
102
+ 'allowElevation',
103
+ 'appCaptureSettings',
104
+ 'appDiagnostics',
105
+ 'backgroundSpatialPerception',
106
+ 'deviceUnlock',
107
+ 'expandedResources',
108
+ 'extendedBackgroundTaskTime',
109
+ 'extendedExecutionBackgroundAudio',
110
+ 'extendedExecutionCritical',
111
+ 'extendedExecutionUnconstrained',
112
+ 'inputForegroundObservation',
113
+ 'locationHistory',
114
+ 'locationSystem',
115
+ 'networkingVpnProvider',
116
+ 'packageManagement',
117
+ 'packageQuery',
118
+ 'previewStore',
119
+ 'systemManagement',
120
+ 'unvirtualizedResources',
121
+ 'userSystemId',
122
+ ];
123
+ const DEFAULT_CAPABILITIES = {
124
+ general: ['internetClient'],
125
+ };
126
+ function validateCapabilities(config) {
127
+ const errors = [];
128
+ if (config.general) {
129
+ for (const cap of config.general) {
130
+ if (!GENERAL_CAPABILITIES.includes(cap)) {
131
+ errors.push(`Invalid general capability: "${cap}". Valid: ${GENERAL_CAPABILITIES.join(', ')}`);
132
+ }
133
+ }
134
+ }
135
+ if (config.device) {
136
+ for (const cap of config.device) {
137
+ if (!DEVICE_CAPABILITIES.includes(cap)) {
138
+ errors.push(`Invalid device capability: "${cap}". Valid: ${DEVICE_CAPABILITIES.join(', ')}`);
139
+ }
140
+ }
141
+ }
142
+ if (config.restricted) {
143
+ for (const cap of config.restricted) {
144
+ if (!RESTRICTED_CAPABILITIES.includes(cap)) {
145
+ errors.push(`Invalid restricted capability: "${cap}". Valid: ${RESTRICTED_CAPABILITIES.join(', ')}`);
146
+ }
147
+ }
148
+ }
149
+ return errors;
150
+ }
78
151
 
79
152
  function generateBundleConfig(windowsDir, _tauriConfig) {
80
153
  const config = {
@@ -318,7 +391,7 @@ function generateManifest(config, arch, minVersion) {
318
391
  EXECUTABLE: `${config.displayName.replace(/\s+/g, '')}.exe`,
319
392
  DESCRIPTION: config.description || config.displayName,
320
393
  EXTENSIONS: generateExtensions(config),
321
- CAPABILITIES: generateCapabilities(config.capabilities || []),
394
+ CAPABILITIES: generateCapabilities(config.capabilities || DEFAULT_CAPABILITIES),
322
395
  };
323
396
  return replaceTemplateVariables(getManifestTemplate(), variables);
324
397
  }
@@ -476,13 +549,27 @@ function generateExtensions(config) {
476
549
  }
477
550
  return ` <Extensions>\n${extensions.join('\n\n')}\n </Extensions>`;
478
551
  }
479
- function generateCapabilities(capabilities) {
552
+ function generateCapabilities(config) {
480
553
  const caps = [];
481
554
  // runFullTrust is always required for Tauri apps using Windows.FullTrustApplication
482
555
  caps.push(' <rescap:Capability Name="runFullTrust" />');
483
- // Add user-specified capabilities
484
- for (const cap of capabilities) {
485
- caps.push(` <Capability Name="${cap}" />`);
556
+ // Add general capabilities
557
+ if (config.general) {
558
+ for (const cap of config.general) {
559
+ caps.push(` <Capability Name="${cap}" />`);
560
+ }
561
+ }
562
+ // Add device capabilities
563
+ if (config.device) {
564
+ for (const cap of config.device) {
565
+ caps.push(` <DeviceCapability Name="${cap}" />`);
566
+ }
567
+ }
568
+ // Add restricted capabilities
569
+ if (config.restricted) {
570
+ for (const cap of config.restricted) {
571
+ caps.push(` <rescap:Capability Name="${cap}" />`);
572
+ }
486
573
  }
487
574
  return caps.join('\n');
488
575
  }
@@ -804,6 +891,17 @@ async function build(options) {
804
891
  // Read configs
805
892
  const tauriConfig = readTauriConfig(projectRoot);
806
893
  const bundleConfig = readBundleConfig$1(windowsDir);
894
+ // Validate capabilities
895
+ if (bundleConfig.capabilities) {
896
+ const errors = validateCapabilities(bundleConfig.capabilities);
897
+ if (errors.length > 0) {
898
+ console.error('Invalid capabilities in bundle.config.json:');
899
+ for (const error of errors) {
900
+ console.error(` - ${error}`);
901
+ }
902
+ process.exit(1);
903
+ }
904
+ }
807
905
  // Merge config
808
906
  const config = {
809
907
  displayName: tauriConfig.productName || 'App',
@@ -820,17 +918,18 @@ async function build(options) {
820
918
  for (const arch of architectures) {
821
919
  // Build Tauri app
822
920
  const target = arch === 'x64' ? 'x86_64-pc-windows-msvc' : 'aarch64-pc-windows-msvc';
823
- const releaseFlag = options.release ? '--release' : '';
921
+ // Tauri CLI defaults to release mode, use --debug for debug builds
922
+ const debugFlag = options.debug ? '--debug' : '';
824
923
  // Build command based on runner
825
924
  // --no-bundle skips MSI/NSIS bundling since we're creating MSIX
826
925
  let buildCommand;
827
926
  if (runner === 'npm') {
828
927
  // npm requires -- to pass args to the script
829
- buildCommand = `npm run tauri build -- --target ${target} --no-bundle ${releaseFlag}`.trim();
928
+ buildCommand = `npm run tauri build -- --target ${target} --no-bundle ${debugFlag}`.trim();
830
929
  }
831
930
  else {
832
931
  // cargo, pnpm, yarn, bun, etc.
833
- buildCommand = `${runner} tauri build --target ${target} --no-bundle ${releaseFlag}`.trim();
932
+ buildCommand = `${runner} tauri build --target ${target} --no-bundle ${debugFlag}`.trim();
834
933
  }
835
934
  try {
836
935
  if (options.verbose) {
@@ -1612,7 +1711,7 @@ program
1612
1711
  .command('build')
1613
1712
  .description('Build MSIX package')
1614
1713
  .option('--arch <architectures>', 'Architectures to build (comma-separated: x64,arm64)', 'x64')
1615
- .option('--release', 'Build in release mode')
1714
+ .option('--debug', 'Build in debug mode (release is default)')
1616
1715
  .option('--min-windows <version>', 'Minimum Windows version', '10.0.17763.0')
1617
1716
  .option('--runner <runner>', 'Build runner (cargo, pnpm, npm, yarn, etc.)', 'cargo')
1618
1717
  .option('--verbose', 'Show full build output instead of spinner')
package/dist/index.js CHANGED
@@ -16,7 +16,80 @@ const MSIX_ASSETS = [
16
16
  { name: 'LargeTile.png', size: 310 },
17
17
  ];
18
18
  const DEFAULT_MIN_WINDOWS_VERSION = '10.0.17763.0';
19
- const DEFAULT_CAPABILITIES = ['internetClient'];
19
+ // Valid Windows capabilities by type
20
+ // Reference: https://learn.microsoft.com/en-us/windows/uwp/packaging/app-capability-declarations
21
+ const GENERAL_CAPABILITIES = [
22
+ 'internetClient',
23
+ 'internetClientServer',
24
+ 'privateNetworkClientServer',
25
+ 'allJoyn',
26
+ 'codeGeneration',
27
+ ];
28
+ const DEVICE_CAPABILITIES = [
29
+ 'webcam',
30
+ 'microphone',
31
+ 'location',
32
+ 'proximity',
33
+ 'bluetooth',
34
+ 'serialcommunication',
35
+ 'usb',
36
+ 'humaninterfacedevice',
37
+ 'pointOfService',
38
+ 'lowLevelDevices',
39
+ 'gazeInput',
40
+ 'radios',
41
+ ];
42
+ const RESTRICTED_CAPABILITIES = [
43
+ 'broadFileSystemAccess',
44
+ 'allowElevation',
45
+ 'appCaptureSettings',
46
+ 'appDiagnostics',
47
+ 'backgroundSpatialPerception',
48
+ 'deviceUnlock',
49
+ 'expandedResources',
50
+ 'extendedBackgroundTaskTime',
51
+ 'extendedExecutionBackgroundAudio',
52
+ 'extendedExecutionCritical',
53
+ 'extendedExecutionUnconstrained',
54
+ 'inputForegroundObservation',
55
+ 'locationHistory',
56
+ 'locationSystem',
57
+ 'networkingVpnProvider',
58
+ 'packageManagement',
59
+ 'packageQuery',
60
+ 'previewStore',
61
+ 'systemManagement',
62
+ 'unvirtualizedResources',
63
+ 'userSystemId',
64
+ ];
65
+ const DEFAULT_CAPABILITIES = {
66
+ general: ['internetClient'],
67
+ };
68
+ function validateCapabilities(config) {
69
+ const errors = [];
70
+ if (config.general) {
71
+ for (const cap of config.general) {
72
+ if (!GENERAL_CAPABILITIES.includes(cap)) {
73
+ errors.push(`Invalid general capability: "${cap}". Valid: ${GENERAL_CAPABILITIES.join(', ')}`);
74
+ }
75
+ }
76
+ }
77
+ if (config.device) {
78
+ for (const cap of config.device) {
79
+ if (!DEVICE_CAPABILITIES.includes(cap)) {
80
+ errors.push(`Invalid device capability: "${cap}". Valid: ${DEVICE_CAPABILITIES.join(', ')}`);
81
+ }
82
+ }
83
+ }
84
+ if (config.restricted) {
85
+ for (const cap of config.restricted) {
86
+ if (!RESTRICTED_CAPABILITIES.includes(cap)) {
87
+ errors.push(`Invalid restricted capability: "${cap}". Valid: ${RESTRICTED_CAPABILITIES.join(', ')}`);
88
+ }
89
+ }
90
+ }
91
+ return errors;
92
+ }
20
93
 
21
94
  function findProjectRoot(startDir) {
22
95
  let dir = startDir || process.cwd();
@@ -316,7 +389,7 @@ function generateManifest(config, arch, minVersion) {
316
389
  EXECUTABLE: `${config.displayName.replace(/\s+/g, '')}.exe`,
317
390
  DESCRIPTION: config.description || config.displayName,
318
391
  EXTENSIONS: generateExtensions(config),
319
- CAPABILITIES: generateCapabilities(config.capabilities || []),
392
+ CAPABILITIES: generateCapabilities(config.capabilities || DEFAULT_CAPABILITIES),
320
393
  };
321
394
  return replaceTemplateVariables(getManifestTemplate(), variables);
322
395
  }
@@ -474,13 +547,27 @@ function generateExtensions(config) {
474
547
  }
475
548
  return ` <Extensions>\n${extensions.join('\n\n')}\n </Extensions>`;
476
549
  }
477
- function generateCapabilities(capabilities) {
550
+ function generateCapabilities(config) {
478
551
  const caps = [];
479
552
  // runFullTrust is always required for Tauri apps using Windows.FullTrustApplication
480
553
  caps.push(' <rescap:Capability Name="runFullTrust" />');
481
- // Add user-specified capabilities
482
- for (const cap of capabilities) {
483
- caps.push(` <Capability Name="${cap}" />`);
554
+ // Add general capabilities
555
+ if (config.general) {
556
+ for (const cap of config.general) {
557
+ caps.push(` <Capability Name="${cap}" />`);
558
+ }
559
+ }
560
+ // Add device capabilities
561
+ if (config.device) {
562
+ for (const cap of config.device) {
563
+ caps.push(` <DeviceCapability Name="${cap}" />`);
564
+ }
565
+ }
566
+ // Add restricted capabilities
567
+ if (config.restricted) {
568
+ for (const cap of config.restricted) {
569
+ caps.push(` <rescap:Capability Name="${cap}" />`);
570
+ }
484
571
  }
485
572
  return caps.join('\n');
486
573
  }
@@ -802,6 +889,17 @@ async function build(options) {
802
889
  // Read configs
803
890
  const tauriConfig = readTauriConfig(projectRoot);
804
891
  const bundleConfig = readBundleConfig$1(windowsDir);
892
+ // Validate capabilities
893
+ if (bundleConfig.capabilities) {
894
+ const errors = validateCapabilities(bundleConfig.capabilities);
895
+ if (errors.length > 0) {
896
+ console.error('Invalid capabilities in bundle.config.json:');
897
+ for (const error of errors) {
898
+ console.error(` - ${error}`);
899
+ }
900
+ process.exit(1);
901
+ }
902
+ }
805
903
  // Merge config
806
904
  const config = {
807
905
  displayName: tauriConfig.productName || 'App',
@@ -818,17 +916,18 @@ async function build(options) {
818
916
  for (const arch of architectures) {
819
917
  // Build Tauri app
820
918
  const target = arch === 'x64' ? 'x86_64-pc-windows-msvc' : 'aarch64-pc-windows-msvc';
821
- const releaseFlag = options.release ? '--release' : '';
919
+ // Tauri CLI defaults to release mode, use --debug for debug builds
920
+ const debugFlag = options.debug ? '--debug' : '';
822
921
  // Build command based on runner
823
922
  // --no-bundle skips MSI/NSIS bundling since we're creating MSIX
824
923
  let buildCommand;
825
924
  if (runner === 'npm') {
826
925
  // npm requires -- to pass args to the script
827
- buildCommand = `npm run tauri build -- --target ${target} --no-bundle ${releaseFlag}`.trim();
926
+ buildCommand = `npm run tauri build -- --target ${target} --no-bundle ${debugFlag}`.trim();
828
927
  }
829
928
  else {
830
929
  // cargo, pnpm, yarn, bun, etc.
831
- buildCommand = `${runner} tauri build --target ${target} --no-bundle ${releaseFlag}`.trim();
930
+ buildCommand = `${runner} tauri build --target ${target} --no-bundle ${debugFlag}`.trim();
832
931
  }
833
932
  try {
834
933
  if (options.verbose) {
@@ -1588,4 +1687,4 @@ async function extensionRemove(type, name, options) {
1588
1687
  }
1589
1688
  }
1590
1689
 
1591
- export { DEFAULT_CAPABILITIES, DEFAULT_MIN_WINDOWS_VERSION, DEFAULT_RUNNER, MSIX_ASSETS, build, extensionAddAppExecutionAlias, extensionAddAppService, extensionAddAutoplay, extensionAddBackgroundTask, extensionAddContextMenu, extensionAddFileAssociation, extensionAddPreviewHandler, extensionAddProtocol, extensionAddThumbnailHandler, extensionDisablePrintTaskSettings, extensionDisableShareTarget, extensionDisableStartupTask, extensionDisableToastActivation, extensionEnablePrintTaskSettings, extensionEnableShareTarget, extensionEnableStartupTask, extensionEnableToastActivation, extensionList, extensionRemove, findProjectRoot, generateManifest, generateManifestTemplate, getPackageVersion, getWindowsDir, init, prepareAppxContent, readBundleConfig$1 as readBundleConfig, readTauriConfig, toFourPartVersion };
1690
+ export { DEFAULT_CAPABILITIES, DEFAULT_MIN_WINDOWS_VERSION, DEFAULT_RUNNER, DEVICE_CAPABILITIES, GENERAL_CAPABILITIES, MSIX_ASSETS, RESTRICTED_CAPABILITIES, build, extensionAddAppExecutionAlias, extensionAddAppService, extensionAddAutoplay, extensionAddBackgroundTask, extensionAddContextMenu, extensionAddFileAssociation, extensionAddPreviewHandler, extensionAddProtocol, extensionAddThumbnailHandler, extensionDisablePrintTaskSettings, extensionDisableShareTarget, extensionDisableStartupTask, extensionDisableToastActivation, extensionEnablePrintTaskSettings, extensionEnableShareTarget, extensionEnableStartupTask, extensionEnableToastActivation, extensionList, extensionRemove, findProjectRoot, generateManifest, generateManifestTemplate, getPackageVersion, getWindowsDir, init, prepareAppxContent, readBundleConfig$1 as readBundleConfig, readTauriConfig, toFourPartVersion, validateCapabilities };
package/dist/types.d.ts CHANGED
@@ -15,10 +15,15 @@ export interface TauriConfig {
15
15
  };
16
16
  };
17
17
  }
18
+ export interface CapabilitiesConfig {
19
+ general?: string[];
20
+ device?: string[];
21
+ restricted?: string[];
22
+ }
18
23
  export interface BundleConfig {
19
24
  publisher: string;
20
25
  publisherDisplayName: string;
21
- capabilities?: string[];
26
+ capabilities?: CapabilitiesConfig;
22
27
  extensions?: {
23
28
  shareTarget?: boolean;
24
29
  fileAssociations?: FileAssociation[];
@@ -100,7 +105,7 @@ export interface InitOptions {
100
105
  }
101
106
  export interface BuildOptions {
102
107
  arch?: string;
103
- release?: boolean;
108
+ debug?: boolean;
104
109
  minWindows?: string;
105
110
  runner?: string;
106
111
  verbose?: boolean;
@@ -114,4 +119,8 @@ export interface MsixAsset {
114
119
  }
115
120
  export declare const MSIX_ASSETS: MsixAsset[];
116
121
  export declare const DEFAULT_MIN_WINDOWS_VERSION = "10.0.17763.0";
117
- export declare const DEFAULT_CAPABILITIES: string[];
122
+ export declare const GENERAL_CAPABILITIES: readonly ["internetClient", "internetClientServer", "privateNetworkClientServer", "allJoyn", "codeGeneration"];
123
+ export declare const DEVICE_CAPABILITIES: readonly ["webcam", "microphone", "location", "proximity", "bluetooth", "serialcommunication", "usb", "humaninterfacedevice", "pointOfService", "lowLevelDevices", "gazeInput", "radios"];
124
+ export declare const RESTRICTED_CAPABILITIES: readonly ["broadFileSystemAccess", "allowElevation", "appCaptureSettings", "appDiagnostics", "backgroundSpatialPerception", "deviceUnlock", "expandedResources", "extendedBackgroundTaskTime", "extendedExecutionBackgroundAudio", "extendedExecutionCritical", "extendedExecutionUnconstrained", "inputForegroundObservation", "locationHistory", "locationSystem", "networkingVpnProvider", "packageManagement", "packageQuery", "previewStore", "systemManagement", "unvirtualizedResources", "userSystemId"];
125
+ export declare const DEFAULT_CAPABILITIES: CapabilitiesConfig;
126
+ export declare function validateCapabilities(config: CapabilitiesConfig): string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@choochmeque/tauri-windows-bundle",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "MSIX packaging tool for Tauri apps - Windows Store ready bundles",
5
5
  "type": "module",
6
6
  "bin": {