arcane-os 0.51.2 → 0.52.1
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/CHANGELOG.md +34 -0
- package/README.md +1 -1
- package/docs/architecture.md +26 -3
- package/docs/reference/cli.md +54 -20
- package/docs/reference/protocols.md +71 -14
- package/docs/reference/pwa.md +74 -9
- package/docs/reference/sdk-api.md +32 -10
- package/package.json +1 -1
- package/schemas/arcane-app.schema.json +5 -0
- package/schemas/arcane-package.schema.json +10 -0
- package/src/app-descriptor.mjs +6 -1
- package/src/dev-server.mjs +204 -43
- package/src/packager/core.mjs +53 -11
- package/src/pwa-worker.mjs +4 -2
- package/src/templates/workspace-template.mjs +14 -4
- package/src/toolchain.mjs +24 -6
package/src/toolchain.mjs
CHANGED
|
@@ -299,6 +299,7 @@ async function refreshPreparedImportMap(prepared,{signal,onEvent,workspaceOperat
|
|
|
299
299
|
signal
|
|
300
300
|
});
|
|
301
301
|
if(inspected.entry!==manifest.entry
|
|
302
|
+
||JSON.stringify(inspected.documents)!==JSON.stringify(manifest.documents)
|
|
302
303
|
||JSON.stringify(inspected.include)!==JSON.stringify(manifest.include)
|
|
303
304
|
||JSON.stringify(inspected.exclude)!==JSON.stringify(manifest.exclude)){
|
|
304
305
|
throw new ArcaneError(
|
|
@@ -329,24 +330,41 @@ async function refreshRootApplicationFiles(prepared,inspected,importMap,{signal,
|
|
|
329
330
|
const manifest=prepared.validation.app.manifest;
|
|
330
331
|
const installed=await readInstalledSdkLayout(workspaceRoot,prepared.validation.config);
|
|
331
332
|
const entry=`/${manifest.entry.split('/').map(encodeURIComponent).join('/')}`;
|
|
332
|
-
const
|
|
333
|
-
|
|
334
|
-
|
|
333
|
+
const pwaEnabled = installed?.direct && manifest.pwa?.enabled;
|
|
334
|
+
let authoredRoot = false;
|
|
335
|
+
if (pwaEnabled) {
|
|
336
|
+
try {
|
|
337
|
+
authoredRoot = (await lstat(path.join(workspaceRoot, 'index.html'))).isFile();
|
|
338
|
+
} catch (error) {
|
|
339
|
+
if (error.code !== 'ENOENT') throw error;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
// A host homepage need not belong to the selected application or its cache.
|
|
343
|
+
const navigationAliases = authoredRoot ? {} : {'/': entry};
|
|
344
|
+
function rootIndexPath(relative) {
|
|
345
|
+
return (process.platform === 'win32' ? relative.toLowerCase() : relative) === 'index.html';
|
|
346
|
+
}
|
|
347
|
+
const selectedRootIndex = authoredRoot && manifest.include.some(rootIndexPath)
|
|
348
|
+
&& !manifest.exclude.some(rootIndexPath);
|
|
335
349
|
// The source host serves the installed files in place. There is no runtime projection.
|
|
336
350
|
const files=[...new Set([
|
|
337
|
-
...inspected.files.filter(
|
|
351
|
+
...inspected.files.filter(
|
|
352
|
+
function selectedSourceFile(file) {
|
|
353
|
+
return file !== 'index.html' || selectedRootIndex;
|
|
354
|
+
}
|
|
355
|
+
),
|
|
338
356
|
importMap.artifactRelativePath
|
|
339
357
|
])];
|
|
340
358
|
const sourceOrigin='http://arcane.invalid';
|
|
341
359
|
const selectedPaths=new Set(files.map(function selectedStaticPath(file){
|
|
342
360
|
return new URL(`/${file.split('/').map(encodeURIComponent).join('/')}`,sourceOrigin).pathname;
|
|
343
361
|
}));
|
|
344
|
-
const assets=
|
|
362
|
+
const assets=pwaEnabled
|
|
345
363
|
?(await collectSourcePwaAssets({workspaceRoot,appId,signal,onEvent})).filter(function selectedStaticVariant(value){
|
|
346
364
|
const url=new URL(value,sourceOrigin);
|
|
347
365
|
return url.origin===sourceOrigin&&selectedPaths.has(url.pathname);
|
|
348
366
|
}):[];
|
|
349
|
-
const pwa=
|
|
367
|
+
const pwa=pwaEnabled?createPwaArtifacts({
|
|
350
368
|
app:{id:appId,displayName:manifest.displayName,version:manifest.version,entry},
|
|
351
369
|
sdkVersion:installed.version,
|
|
352
370
|
pwa:manifest.pwa,
|