arcane-os 0.11.3 → 0.12.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.
- package/CHANGELOG.md +18 -0
- package/NOTICE +1 -0
- package/README.md +24 -13
- package/browser-runtime/pwa.mjs +129 -0
- package/docs/architecture.md +28 -12
- package/docs/reference/cli.md +42 -16
- package/docs/reference/inventory/package-api.json +1 -1
- package/docs/reference/pwa.md +87 -22
- package/docs/reference/sdk-api.md +61 -27
- package/package.json +2 -1
- package/src/app-descriptor.mjs +43 -1
- package/src/cli/main.mjs +29 -13
- package/src/dev-server.mjs +387 -136
- package/src/pwa-worker.mjs +362 -136
- package/src/pwa.mjs +4 -1
- package/src/targets/index.mjs +5 -1
- package/src/toolchain.mjs +62 -12
package/src/toolchain.mjs
CHANGED
|
@@ -13,7 +13,9 @@ import {loadArcaneIntegratedProvider} from './integrated-provider-loader.mjs';
|
|
|
13
13
|
import {startDevServer} from './dev-server.mjs';
|
|
14
14
|
import {generateImportMap,readApplicationTestImportMapContext} from './import-map.mjs';
|
|
15
15
|
import {withWorkspaceOperationLock} from './workspace-operation-lock.mjs';
|
|
16
|
+
import {refreshAppPackageProjection} from './app-descriptor.mjs';
|
|
16
17
|
import {
|
|
18
|
+
discoverApps as discoverPackagerApps,
|
|
17
19
|
inspectApp as inspectPackagedApp,
|
|
18
20
|
packageApp,
|
|
19
21
|
verifyApp
|
|
@@ -444,18 +446,65 @@ export async function checkApplication(options={}){
|
|
|
444
446
|
};
|
|
445
447
|
}
|
|
446
448
|
|
|
447
|
-
export async function developApplication(options={}){
|
|
448
|
-
assertApplicationScope(options,'Development serving');
|
|
449
|
-
|
|
450
|
-
await
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
449
|
+
export async function developApplication(options = {}) {
|
|
450
|
+
assertApplicationScope(options, 'Development serving');
|
|
451
|
+
throwIfAborted(options.signal);
|
|
452
|
+
const profile = await inspectWorkspaceProfile(options.workspaceRoot);
|
|
453
|
+
const appIds = await discoverPackagerApps(
|
|
454
|
+
{workspaceRoot: profile.workspaceRoot}
|
|
455
|
+
);
|
|
456
|
+
let appId = options.appId;
|
|
457
|
+
if (appId !== undefined && (!is.string(appId) || !/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(appId))) {
|
|
458
|
+
throw new ArcaneError(ERROR_CODES.usage, `Invalid app id: ${String(appId)}.`);
|
|
459
|
+
}
|
|
460
|
+
if (appId) {
|
|
461
|
+
if (!appIds.includes(appId)) {
|
|
462
|
+
throw new ArcaneError(
|
|
463
|
+
ERROR_CODES.workspaceInvalid,
|
|
464
|
+
`Unknown app "${appId}". Available apps: ${appIds.join(', ') || '[none]'}.`
|
|
465
|
+
);
|
|
466
|
+
}
|
|
467
|
+
} else if (appIds.length === 1) {
|
|
468
|
+
[appId] = appIds;
|
|
469
|
+
} else if (appIds.length === 0) {
|
|
470
|
+
throw new ArcaneError(ERROR_CODES.workspaceInvalid, 'No Arcane applications were found under apps/.');
|
|
471
|
+
} else {
|
|
472
|
+
throw new ArcaneError(
|
|
473
|
+
ERROR_CODES.usage,
|
|
474
|
+
`This workspace contains multiple apps; select one explicitly: ${appIds.join(', ')}.`
|
|
475
|
+
);
|
|
476
|
+
}
|
|
477
|
+
const prepared = await withWorkspaceOperationLock(
|
|
478
|
+
{
|
|
479
|
+
workspaceRoot: profile.workspaceRoot,
|
|
480
|
+
operation: 'dev-refresh',
|
|
481
|
+
signal: options.signal,
|
|
482
|
+
onEvent: options.onEvent
|
|
483
|
+
},
|
|
484
|
+
async function refreshDevelopmentWorkspace(workspaceOperationLease) {
|
|
485
|
+
await refreshAppPackageProjection(
|
|
486
|
+
{
|
|
487
|
+
workspaceRoot: profile.workspaceRoot,
|
|
488
|
+
appId,
|
|
489
|
+
signal: options.signal,
|
|
490
|
+
onEvent: options.onEvent
|
|
491
|
+
}
|
|
492
|
+
);
|
|
493
|
+
const current = await preparedWorkspace(
|
|
494
|
+
{
|
|
495
|
+
...options,
|
|
496
|
+
workspaceRoot: profile.workspaceRoot,
|
|
497
|
+
appId,
|
|
498
|
+
allowMissingManagedImportMap: true
|
|
499
|
+
}
|
|
500
|
+
);
|
|
501
|
+
await refreshPreparedImportMap(
|
|
502
|
+
current,
|
|
503
|
+
{...options, workspaceOperationLease}
|
|
504
|
+
);
|
|
505
|
+
return current;
|
|
506
|
+
}
|
|
507
|
+
);
|
|
459
508
|
const server=await startDevServer({
|
|
460
509
|
workspaceRoot:prepared.workspaceRoot,
|
|
461
510
|
appId:prepared.appId,
|
|
@@ -466,6 +515,7 @@ export async function developApplication(options={}){
|
|
|
466
515
|
}),
|
|
467
516
|
host:options.host,
|
|
468
517
|
port:options.port,
|
|
518
|
+
httpPort:options.httpPort,
|
|
469
519
|
https:options.https,
|
|
470
520
|
tls:options.tls,
|
|
471
521
|
certPath:options.certPath,
|