arcane-os 0.54.1 → 0.55.0

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.
@@ -20,6 +20,7 @@ import {
20
20
  applyPwaEntryReferences,
21
21
  inspectImportMapHtml,
22
22
  readWorkspaceAssetVersion,
23
+ removePwaEntryReferences,
23
24
  resolveAssetReference,
24
25
  rewriteAssetReferences,
25
26
  versionAssetUrl
@@ -920,6 +921,51 @@ async function packageWithContext(context,options={}){
920
921
  await copyBase();
921
922
  }
922
923
  let files=await listOutputFiles(stagingRoot,{signal});
924
+ const entryUrl=new URL(packageResourceUrl(entryPath),'http://arcane.invalid/');
925
+ const selectedFiles=new Set(files);
926
+ const explicitDocumentPaths=context.config.documents===undefined?null:new Set(
927
+ inspected.browserDocuments.map(function selectedDocumentPath(document){return document.packagePath;})
928
+ );
929
+ const pwaDocumentPaths=new Set(explicitDocumentPaths??[entryPath]);
930
+ for(const selected of explicitDocumentPaths===null?context.config.include:[]){
931
+ const selectedPath=appPackagePath(context,selected);
932
+ if(/\.html?$/iu.test(selected)&&selectedFiles.has(selectedPath))pwaDocumentPaths.add(selectedPath);
933
+ }
934
+ for(const document of inspected.browserDocuments){
935
+ const appDocument=context.config.include.some(function includesAppDocument(selected){
936
+ return sameOrDescendant(document.path,selected);
937
+ });
938
+ if(appDocument&&(appPath===''||document.managedMaps.length>0)&&selectedFiles.has(document.packagePath)){
939
+ pwaDocumentPaths.add(document.packagePath);
940
+ }
941
+ }
942
+ if (!pwaEnabled) {
943
+ // Remove source-generated registration before native processing can follow it.
944
+ const removals = await Promise.allSettled(
945
+ [...pwaDocumentPaths].map(
946
+ async function removeStagedPwaReferences(documentPath) {
947
+ throwIfAborted(signal);
948
+ const filePath = path.join(stagingRoot, ...documentPath.split('/'));
949
+ const source = await readFile(filePath, 'utf8');
950
+ const content = removePwaEntryReferences(
951
+ source,
952
+ {
953
+ documentUrl: new URL(packageResourceUrl(documentPath), entryUrl.origin),
954
+ manifestUrl: new URL(`/${PWA_MANIFEST_NAME}`, entryUrl.origin)
955
+ }
956
+ );
957
+ if (content !== source) await writeFile(filePath, content, 'utf8');
958
+ }
959
+ )
960
+ );
961
+ // Settle every stage write before a failure can trigger stage cleanup.
962
+ const errors = [];
963
+ for (const removal of removals) {
964
+ if (removal.status === 'rejected') errors.push(removal.reason);
965
+ }
966
+ if (errors.length === 1) throw errors[0];
967
+ if (errors.length > 1) throw new AggregateError(errors, 'Selected PWA reference removal failed.');
968
+ }
923
969
  if(moduleFormat==='native'){
924
970
  files=await materializeNativeModules({
925
971
  stagingRoot,
@@ -937,27 +983,10 @@ async function packageWithContext(context,options={}){
937
983
  const inventory=new Set(files);
938
984
  const offlineInventory=pwaEnabled?new Set(selectPwaFiles(files,context.config.pwa,appPath)):null;
939
985
  const offlineReferences=new Set();
940
- const entryUrl=new URL(packageResourceUrl(entryPath),'http://arcane.invalid/');
941
986
  const pwaDocumentSources=new Map();
942
- const explicitDocumentPaths=context.config.documents===undefined?null:new Set(
943
- inspected.browserDocuments.map(function selectedDocumentPath(document){return document.packagePath;})
944
- );
945
987
  if(pwaEnabled){
946
- const documentPaths=new Set(explicitDocumentPaths??[entryPath]);
947
- for(const selected of explicitDocumentPaths===null?context.config.include:[]){
948
- const selectedPath=appPackagePath(context,selected);
949
- if(/\.html?$/iu.test(selected)&&inventory.has(selectedPath))documentPaths.add(selectedPath);
950
- }
951
- for(const document of inspected.browserDocuments){
952
- const appDocument=context.config.include.some(function includesAppDocument(selected){
953
- return sameOrDescendant(document.path,selected);
954
- });
955
- if(appDocument&&(appPath===''||document.managedMaps.length>0)&&inventory.has(document.packagePath)){
956
- documentPaths.add(document.packagePath);
957
- }
958
- }
959
988
  await Promise.all(
960
- [...documentPaths].map(
989
+ [...pwaDocumentPaths].map(
961
990
  async function readPwaDocument(documentPath) {
962
991
  const source = await readFile(
963
992
  path.join(stagingRoot, ...documentPath.split('/')),
@@ -21,7 +21,7 @@ const DEFINITIONS=[
21
21
  id:'portable',displayName:'Portable native application',status:'pairing-required',
22
22
  platforms:['windows','linux'],architectures:['x64','arm64'],formats:['portable'],
23
23
  signingModes:['unsigned-local-test'],
24
- reason:'Portable output is available when paired to an Arcane OS native provider.'
24
+ reason:'Portable app payloads use the SDK package provider by default; explicit provider pairing remains available.'
25
25
  },
26
26
  {
27
27
  id:'windows-x64',displayName:'Windows x64 executable',status:'pairing-required',
@@ -226,6 +226,7 @@ export function createNativeTargetAdapter({targetId,nativeBuilder}={}){
226
226
  appReleaseRoot,
227
227
  release,
228
228
  appDescriptor,
229
+ selectedSdk,
229
230
  dependencyReleases,
230
231
  minimumCoreVersion,
231
232
  protectedRoots,
@@ -242,6 +243,7 @@ export function createNativeTargetAdapter({targetId,nativeBuilder}={}){
242
243
  appReleaseRoot,
243
244
  release,
244
245
  appDescriptor,
246
+ selectedSdk,
245
247
  dependencyReleases,
246
248
  minimumCoreVersion,
247
249
  protectedRoots,
package/src/toolchain.mjs CHANGED
@@ -836,8 +836,11 @@ function sameCanonicalPath(left,right){
836
836
  return normalize(left)===normalize(right);
837
837
  }
838
838
 
839
- export function assertIntegratedNativeToolchain({workspaceMode,workspaceRoot,toolchainRoot,target}={}){
839
+ export function assertIntegratedNativeToolchain({
840
+ workspaceMode,workspaceRoot,toolchainRoot,target,providerSource='arcane-checkout'
841
+ }={}){
840
842
  if(workspaceMode!=='integrated')return;
843
+ if(providerSource==='sdk-package'&&target==='portable')return;
841
844
  if(!is.string(toolchainRoot)||!sameCanonicalPath(workspaceRoot,toolchainRoot)){
842
845
  throw new ArcaneError(
843
846
  ERROR_CODES.policyDenied,
@@ -992,6 +995,7 @@ function pathsOverlap(left,right){
992
995
 
993
996
  async function packageNativeRelease(prepared,app,{
994
997
  workspaceOperationLease,
998
+ selectedSdk,
995
999
  signal,
996
1000
  onEvent
997
1001
  }={}){
@@ -1010,6 +1014,7 @@ async function packageNativeRelease(prepared,app,{
1010
1014
  release,
1011
1015
  nativeInput:{
1012
1016
  appDescriptor:app.descriptor,
1017
+ ...(selectedSdk===undefined?{}:{selectedSdk}),
1013
1018
  appReleaseRoot:release.outputRoot??path.resolve(prepared.workspaceRoot,release.output),
1014
1019
  release:{manifest:release.manifest,files:[...release.files]}
1015
1020
  }
@@ -1027,7 +1032,8 @@ async function executePairedNativeBuild(options,adapter,{
1027
1032
  target,
1028
1033
  workspaceMode:initialPrepared.workspaceMode,
1029
1034
  workspaceRoot:initialPrepared.workspaceRoot,
1030
- toolchainRoot:options.toolchainRoot
1035
+ toolchainRoot:options.toolchainRoot,
1036
+ providerSource:options.providerSource
1031
1037
  });
1032
1038
  if(options.dryRun){
1033
1039
  throw new ArcaneError(
@@ -1051,6 +1057,11 @@ async function executePairedNativeBuild(options,adapter,{
1051
1057
  }
1052
1058
  const dependencyApps=await nativeDependencyClosure(initialPrepared,{target,signal,onEvent});
1053
1059
  const prepared=initialPrepared;
1060
+ const installedSdk=await readInstalledSdkLayout(prepared.workspaceRoot,prepared.validation.config);
1061
+ const selectedSdk=installedSdk===null?undefined:{
1062
+ packageRoot:installedSdk.packageRoot,
1063
+ packageSource:installedSdk.packageSource
1064
+ };
1054
1065
  const packageOutputs=[];
1055
1066
  for(const app of [prepared.validation.app,...dependencyApps]){
1056
1067
  const releaseRoot=resolvePackageOutputRoot(
@@ -1073,13 +1084,13 @@ async function executePairedNativeBuild(options,adapter,{
1073
1084
  descriptorSource:prepared.validation.app.descriptorSource,
1074
1085
  descriptorPath:prepared.validation.app.descriptorPath,
1075
1086
  validation:prepared.validation
1076
- },{workspaceOperationLease,signal,onEvent});
1087
+ },{workspaceOperationLease,selectedSdk,signal,onEvent});
1077
1088
  const dependencyReleases=[];
1078
1089
  for(const dependency of dependencyApps){
1079
1090
  dependencyReleases.push(await packageNativeRelease(
1080
1091
  prepared,
1081
1092
  dependency,
1082
- {workspaceOperationLease,signal,onEvent}
1093
+ {workspaceOperationLease,selectedSdk,signal,onEvent}
1083
1094
  ));
1084
1095
  }
1085
1096
  const toolchain=await adapter.prepare({
@@ -1094,7 +1105,11 @@ async function executePairedNativeBuild(options,adapter,{
1094
1105
  toolchainRoot:options.toolchainRoot,
1095
1106
  toolchain,
1096
1107
  ...selectedRelease.nativeInput,
1097
- dependencyReleases:dependencyReleases.map(item=>item.nativeInput),
1108
+ dependencyReleases:dependencyReleases.map(item=>({
1109
+ appId:item.appId,
1110
+ releaseRoot:item.nativeInput.appReleaseRoot,
1111
+ release:item.nativeInput.release
1112
+ })),
1098
1113
  minimumCoreVersion:ARCANE_MACHINE_BUNDLE_VERSION,
1099
1114
  protectedRoots,
1100
1115
  outputRoot,