@choochmeque/tauri-windows-bundle 0.1.7 → 0.1.9

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`)
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
  }
@@ -695,7 +782,7 @@ function isVersionSufficient(version, minVersion) {
695
782
  return false;
696
783
  return patch >= minPatch;
697
784
  }
698
- const MIN_MSIXBUNDLE_CLI_VERSION = '1.0.0';
785
+ const MIN_MSIXBUNDLE_CLI_VERSION = '1.0.2';
699
786
  async function promptInstall(message) {
700
787
  const rl = readline.createInterface({
701
788
  input: process.stdin,
@@ -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',
@@ -856,6 +954,7 @@ async function build(options) {
856
954
  console.log('\nCreating MSIX package...');
857
955
  const outDir = path.join(projectRoot, 'src-tauri', 'target', 'msix');
858
956
  const args = [
957
+ '--force',
859
958
  '--out-dir',
860
959
  outDir,
861
960
  ...appxDirs.flatMap(({ arch, dir }) => [`--dir-${arch}`, dir]),
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
  }
@@ -693,7 +780,7 @@ function isVersionSufficient(version, minVersion) {
693
780
  return false;
694
781
  return patch >= minPatch;
695
782
  }
696
- const MIN_MSIXBUNDLE_CLI_VERSION = '1.0.0';
783
+ const MIN_MSIXBUNDLE_CLI_VERSION = '1.0.2';
697
784
  async function promptInstall(message) {
698
785
  const rl = readline.createInterface({
699
786
  input: process.stdin,
@@ -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',
@@ -854,6 +952,7 @@ async function build(options) {
854
952
  console.log('\nCreating MSIX package...');
855
953
  const outDir = path.join(projectRoot, 'src-tauri', 'target', 'msix');
856
954
  const args = [
955
+ '--force',
857
956
  '--out-dir',
858
957
  outDir,
859
958
  ...appxDirs.flatMap(({ arch, dir }) => [`--dir-${arch}`, dir]),
@@ -1587,4 +1686,4 @@ async function extensionRemove(type, name, options) {
1587
1686
  }
1588
1687
  }
1589
1688
 
1590
- 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 };
1689
+ 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[];
@@ -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[];
@@ -16,7 +16,7 @@ export declare function execAsync(command: string, options?: {
16
16
  export declare function isMsixbundleCliInstalled(): Promise<boolean>;
17
17
  export declare function getMsixbundleCliVersion(): Promise<string | null>;
18
18
  export declare function isVersionSufficient(version: string, minVersion: string): boolean;
19
- export declare const MIN_MSIXBUNDLE_CLI_VERSION = "1.0.0";
19
+ export declare const MIN_MSIXBUNDLE_CLI_VERSION = "1.0.2";
20
20
  export declare function promptInstall(message: string): Promise<boolean>;
21
21
  export interface ExecWithProgressOptions {
22
22
  cwd?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@choochmeque/tauri-windows-bundle",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "MSIX packaging tool for Tauri apps - Windows Store ready bundles",
5
5
  "type": "module",
6
6
  "bin": {