-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat(windows): capabilities #9437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mmaietta
merged 29 commits into
electron-userland:master
from
sitewaerts:feat/windows-capabilities
Jan 31, 2026
Merged
Changes from 11 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
c616694
feat(windows): add support for windows uwp/appx capabilities
regnete 34a5131
Merge remote-tracking branch 'electron-userland/master' into feat/win…
regnete 53e4933
Merge branch 'electron-userland:master' into feat/windows-capabilities
regnete e0b77de
Merge branch 'master' into feat/windows-capabilities
regnete 61dde96
Merge branch 'master' into feat/windows-capabilities
regnete e47eae4
Merge branch 'feat/windows-capabilities' of https://github.com/sitewa…
regnete bb7762e
optimization suggested by mmaietta
regnete b6aaaec
optimization suggested by mmaietta
regnete a44f0ca
removed unused namespaces
regnete 377689c
updated
regnete 6e8f22b
Create serious-doors-retire.md
regnete 13caa27
code layout
regnete 2ec9711
avoid double space in generated xml fragment
regnete 8c1fa66
Merge branch 'electron-userland:master' into feat/windows-capabilities
regnete 3fbebf3
validate capability names (https://github.com/electron-userland/elect…
regnete 372e00b
tests for capability feature (https://github.com/electron-userland/el…
regnete 83c0a75
fixed typo
regnete 0ed5d58
fixed order of capabilities
regnete 84d9613
fixed capability related test
regnete f65eb81
fixed compile errors
regnete f0c27b1
Merge branch 'electron-userland:master' into feat/windows-capabilities
regnete 653db19
prettier
regnete 7a8217d
Merge remote-tracking branch 'origin/feat/windows-capabilities' into …
regnete 4849551
fixed appx capabilities order, removed uap11 namespace as not support…
regnete dca9e38
removed uap11 namespace as not supported by MakeAppx.exe
regnete 5654d24
removed uap11 namespace as not supported by MakeAppx.exe
regnete 2f9a5fb
fixed code style
regnete 92b748c
Merge branch 'master' into feat/windows-capabilities
regnete 2ca7e45
Merge branch 'master' into feat/windows-capabilities
regnete File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "app-builder-lib": minor | ||
| --- | ||
|
|
||
| adding optional config property `capabilities` to AppxOptions (#9436) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
276 changes: 276 additions & 0 deletions
276
packages/app-builder-lib/src/targets/AppxCapabilities.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,276 @@ | ||
| export interface Capability { | ||
| readonly nsAlias: string | null | ||
| readonly nsURI: string | null | ||
| readonly name: string | ||
|
|
||
| toXMLString(): string | ||
| } | ||
|
|
||
| type CapabilityConfig = { | ||
| nsAlias: string | null | ||
| nsURI: string | null | ||
| declareNS: boolean | ||
| elementName: string | ||
| } | ||
|
|
||
| class AppxCapability implements Capability { | ||
| constructor( | ||
| public readonly nsAlias: string | null, | ||
| public readonly nsURI: string | null, | ||
| private readonly declareNS: boolean, | ||
| private readonly elementName: string, | ||
| public readonly name: string | ||
| ) { | ||
| if (!this.nsAlias && this.declareNS) throw new Error("local declaration of namespace without prefix is not supported") | ||
|
Check failure on line 24 in packages/app-builder-lib/src/targets/AppxCapabilities.ts
|
||
| } | ||
|
|
||
| toXMLString(): string { | ||
| const tagName = this.nsAlias ? `${this.nsAlias}:${this.elementName}` : this.elementName | ||
| const ns = this.declareNS ? `xmlns:${this.nsAlias}="${this.nsURI}"` : "" | ||
| return `<${tagName} ${ns} Name="${this.name}"/>` | ||
| } | ||
| } | ||
|
|
||
| // Capability type configurations | ||
| const CAPABILITY_TYPES: Record<string, CapabilityConfig> = { | ||
| common: { | ||
| nsAlias: null, | ||
| nsURI: "http://schemas.microsoft.com/appx/manifest/foundation/windows10", | ||
| declareNS: false, | ||
| elementName: "Capability", | ||
| }, | ||
| device: { | ||
| nsAlias: null, | ||
| nsURI: "http://schemas.microsoft.com/appx/manifest/foundation/windows10", | ||
| declareNS: false, | ||
| elementName: "DeviceCapability", | ||
| }, | ||
| uap: { | ||
| nsAlias: "uap", | ||
| nsURI: "http://schemas.microsoft.com/appx/manifest/uap/windows10", | ||
| declareNS: false, // ns already declared in template | ||
| elementName: "Capability", | ||
| }, | ||
| uap6: { | ||
| nsAlias: "uap6", | ||
| nsURI: "http://schemas.microsoft.com/appx/manifest/uap/windows10/6", | ||
| declareNS: true, | ||
| elementName: "Capability", | ||
| }, | ||
| uap7: { | ||
| nsAlias: "uap7", | ||
| nsURI: "http://schemas.microsoft.com/appx/manifest/uap/windows10/7", | ||
| declareNS: true, | ||
| elementName: "Capability", | ||
| }, | ||
| uap11: { | ||
| nsAlias: "uap11", | ||
| nsURI: "http://schemas.microsoft.com/appx/manifest/uap/windows10/11", | ||
| declareNS: true, | ||
| elementName: "Capability", | ||
| }, | ||
| mobile: { | ||
| nsAlias: "mobile", | ||
| nsURI: "http://schemas.microsoft.com/appx/manifest/mobile/windows10", | ||
| declareNS: true, | ||
| elementName: "Capability", | ||
| }, | ||
| rescap: { | ||
| nsAlias: "rescap", | ||
| nsURI: "http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities", | ||
| declareNS: false, // ns already declared in template | ||
| elementName: "Capability", | ||
| }, | ||
| } as const | ||
|
|
||
| type CapabilityType = keyof typeof CAPABILITY_TYPES | ||
|
|
||
| // Map of capability types to their capability names (grouped by type) | ||
| const CAPABILITY_MAP = new Map<CapabilityType, string[]>([ | ||
| // Common capabilities | ||
| [ | ||
| "common", | ||
| [ | ||
| "internetClient", | ||
| "internetClientServer", | ||
| "privateNetworkClientServer", | ||
| "codeGeneration", | ||
| "allJoyn", | ||
| "backgroundMediaPlayback", | ||
| "remoteSystem", | ||
| "spatialPerception", | ||
| "userDataTasks", | ||
| "userNotificationListener", | ||
| ], | ||
| ], | ||
|
|
||
| // UAP capabilities | ||
| [ | ||
| "uap", | ||
| [ | ||
| "musicLibrary", | ||
| "picturesLibrary", | ||
| "videosLibrary", | ||
| "removableStorage", | ||
| "appointments", | ||
| "contacts", | ||
| "phoneCall", | ||
| "phoneCallHistoryPublic", | ||
| "userAccountInformation", | ||
| "voipCall", | ||
| "objects3D", | ||
| "chat", | ||
| "blockedChatMessages", | ||
| "enterpriseAuthentication", | ||
| "sharedUserCertificates", | ||
| "documentsLibrary", | ||
| ], | ||
| ], | ||
|
|
||
| // Device capabilities | ||
| [ | ||
| "device", | ||
| [ | ||
| "location", | ||
| "microphone", | ||
| "webcam", | ||
| "proximity", | ||
| "pointOfService", | ||
| "wiFiControl", | ||
| "radios", | ||
| "optical", | ||
| "activity", | ||
| "humanPresence", | ||
| "serialcommunication", | ||
| "gazeInput", | ||
| "lowLevel", | ||
| "packageQuery", | ||
| ], | ||
| ], | ||
|
|
||
| // Mobile capabilities | ||
| ["mobile", ["recordedCallsFolder"]], | ||
|
|
||
| // Restricted capabilities | ||
| [ | ||
| "rescap", | ||
| [ | ||
| "enterpriseDataPolicy", | ||
| "appCaptureSettings", | ||
| "cellularDeviceControl", | ||
| "cellularDeviceIdentity", | ||
| "cellularMessaging", | ||
| "deviceUnlock", | ||
| "dualSimTiles", | ||
| "enterpriseDeviceLockdown", | ||
| "inputInjectionBrokered", | ||
| "inputObservation", | ||
| "inputSuppression", | ||
| "networkingVpnProvider", | ||
| "packageManagement", | ||
| "screenDuplication", | ||
| "userPrincipalName", | ||
| "walletSystem", | ||
| "locationHistory", | ||
| "confirmAppClose", | ||
| "phoneCallHistory", | ||
| "appointmentsSystem", | ||
| "chatSystem", | ||
| "contactsSystem", | ||
| "email", | ||
| "emailSystem", | ||
| "phoneCallHistorySystem", | ||
| "smsSend", | ||
| "userDataSystem", | ||
| "previewStore", | ||
| "firstSignInSettings", | ||
| "teamEditionExperience", | ||
| "remotePassportAuthentication", | ||
| "previewUiComposition", | ||
| "secureAssessment", | ||
| "networkConnectionManagerProvisioning", | ||
| "networkDataPlanProvisioning", | ||
| "slapiQueryLicenseValue", | ||
| "extendedBackgroundTaskTime", | ||
| "extendedExecutionBackgroundAudio", | ||
| "extendedExecutionCritical", | ||
| "extendedExecutionUnconstrained", | ||
| "deviceManagementDmAccount", | ||
| "deviceManagementFoundation", | ||
| "deviceManagementWapSecurityPolicies", | ||
| "deviceManagementEmailAccount", | ||
| "packagePolicySystem", | ||
| "gameList", | ||
| "xboxAccessoryManagement", | ||
| "cortanaSpeechAccessory", | ||
| "accessoryManager", | ||
| "interopServices", | ||
| "inputForegroundObservation", | ||
| "oemDeployment", | ||
| "oemPublicDirectory", | ||
| "appLicensing", | ||
| "locationSystem", | ||
| "userDataAccountsProvider", | ||
| "previewPenWorkspace", | ||
| "secondaryAuthenticationFactor", | ||
| "storeLicenseManagement", | ||
| "userSystemId", | ||
| "targetedContent", | ||
| "uiAutomation", | ||
| "gameBarServices", | ||
| "appCaptureServices", | ||
| "appBroadcastServices", | ||
| "audioDeviceConfiguration", | ||
| "backgroundMediaRecording", | ||
| "previewInkWorkspace", | ||
| "startScreenManagement", | ||
| "cortanaPermissions", | ||
| "allAppMods", | ||
| "expandedResources", | ||
| "protectedApp", | ||
| "gameMonitor", | ||
| "appDiagnostics", | ||
| "devicePortalProvider", | ||
| "enterpriseCloudSSO", | ||
| "backgroundVoIP", | ||
| "oneProcessVoIP", | ||
| "developmentModeNetwork", | ||
| "broadFileSystemAccess", | ||
| "smbios", | ||
| "runFullTrust", | ||
| "allowElevation", | ||
| "teamEditionDeviceCredential", | ||
| "teamEditionView", | ||
| "cameraProcessingExtension", | ||
| "networkDataUsageManagement", | ||
| "phoneLineTransportManagement", | ||
| "unvirtualizedResources", | ||
| "modifiableApp", | ||
| "packageWriteRedirectionCompatibilityShim", | ||
| "customInstallActions", | ||
| "packagedServices", | ||
| "localSystemServices", | ||
| "backgroundSpatialPerception", | ||
| "uiAccess", | ||
| ], | ||
| ], | ||
|
|
||
| // UAP6 capabilities | ||
| ["uap6", ["graphicsCapture"]], | ||
|
|
||
| // UAP7 capabilities | ||
| ["uap7", ["globalMediaControl"]], | ||
|
|
||
| // UAP11 capabilities | ||
| ["uap11", ["graphicsCaptureWithoutBorder", "graphicsCaptureProgrammatic"]], | ||
| ]) | ||
|
|
||
| // Factory function to create capabilities | ||
| function createCapability(type: CapabilityType, name: string): Capability { | ||
| const config = CAPABILITY_TYPES[type] | ||
| if (!config) throw new Error(`unknown capability type '${type}'`) | ||
|
Check failure on line 271 in packages/app-builder-lib/src/targets/AppxCapabilities.ts
|
||
| return new AppxCapability(config.nsAlias, config.nsURI, config.declareNS, config.elementName, name) | ||
| } | ||
|
|
||
| // Export ordered list of all capabilities (order matters per Microsoft docs) | ||
| export const CAPABILITIES: Capability[] = Array.from(CAPABILITY_MAP.entries()).flatMap(([type, names]) => names.map(name => createCapability(type, name))) | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.