@absolutejs/absolute 0.20.0-beta.0 → 0.20.0-beta.10
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 +45 -0
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +354 -22
- package/dist/angular/index.js.map +9 -6
- package/dist/angular/server.js +354 -22
- package/dist/angular/server.js.map +9 -6
- package/dist/build.js +742 -359
- package/dist/build.js.map +26 -24
- package/dist/cli/config/server.js +2 -2
- package/dist/cli/index.js +16105 -8429
- package/dist/dev/client/cssUtils.ts +112 -41
- package/dist/dev/client/handlers/html.ts +75 -15
- package/dist/dev/client/handlers/htmx.ts +43 -8
- package/dist/dev/client/handlers/react.ts +114 -32
- package/dist/dev/client/handlers/rebuild.ts +38 -8
- package/dist/dev/client/handlers/svelte.ts +33 -50
- package/dist/dev/client/handlers/vue.ts +36 -45
- package/dist/dev/client/hmrClient.ts +38 -6
- package/dist/dev/client/hmrTiming.ts +148 -0
- package/dist/dev/serverBootstrap.js +20 -11
- package/dist/index.js +1728 -864
- package/dist/index.js.map +38 -33
- package/dist/mobile/browser.js +14 -1
- package/dist/mobile/browser.js.map +3 -3
- package/dist/mobile/index.js +4853 -279
- package/dist/mobile/index.js.map +34 -7
- package/dist/mobile/remoteMacAgentEntry.js +29 -0
- package/dist/mobile/shellAuth.js +43 -0
- package/dist/mobile/shellBootstrap.js +581 -0
- package/dist/mobile/shellSync.js +74 -0
- package/dist/react/index.js +16 -3
- package/dist/react/index.js.map +4 -4
- package/dist/react/jsxDevRuntimeCompat.js +22 -2
- package/dist/react/jsxDevRuntimeCompat.js.map +5 -4
- package/dist/react/jsxRuntimeCompat.js +90 -0
- package/dist/react/jsxRuntimeCompat.js.map +10 -0
- package/dist/react/server.js +16 -3
- package/dist/react/server.js.map +4 -4
- package/dist/src/angular/pageHandler.d.ts +3 -0
- package/dist/src/build/compileVue.d.ts +1 -1
- package/dist/src/build/pwa.d.ts +15 -0
- package/dist/src/build/resolveBuildMode.d.ts +7 -0
- package/dist/src/cli/config/server.d.ts +1 -1
- package/dist/src/cli/scripts/dev.d.ts +4 -1
- package/dist/src/cli/scripts/mobile.d.ts +1 -0
- package/dist/src/cli/utils.d.ts +2 -2
- package/dist/src/core/build.d.ts +1 -1
- package/dist/src/core/pageHandlers.d.ts +11 -2
- package/dist/src/core/prepare.d.ts +6 -0
- package/dist/src/dev/clientManager.d.ts +9 -0
- package/dist/src/dev/configResolver.d.ts +2 -0
- package/dist/src/dev/moduleMapper.d.ts +1 -1
- package/dist/src/dev/moduleServer.d.ts +2 -1
- package/dist/src/dev/pathUtils.d.ts +1 -1
- package/dist/src/dev/reactComponentClassifier.d.ts +1 -1
- package/dist/src/mobile/androidConformance.d.ts +42 -0
- package/dist/src/mobile/androidEmulatorController.d.ts +105 -0
- package/dist/src/mobile/androidNativeWatcher.d.ts +19 -0
- package/dist/src/mobile/androidRelease.d.ts +51 -0
- package/dist/src/mobile/androidWebView.d.ts +46 -0
- package/dist/src/mobile/associationFiles.d.ts +49 -0
- package/dist/src/mobile/buildMetadata.d.ts +10 -0
- package/dist/src/mobile/buildPipeline.d.ts +9 -0
- package/dist/src/mobile/buildRelease.d.ts +24 -0
- package/dist/src/mobile/capacitorBundle.d.ts +42 -0
- package/dist/src/mobile/capacitorProject.d.ts +9 -0
- package/dist/src/mobile/client.d.ts +5 -1
- package/dist/src/mobile/config.d.ts +17 -0
- package/dist/src/mobile/emulatorDoctor.d.ts +25 -0
- package/dist/src/mobile/emulatorInstaller.d.ts +41 -0
- package/dist/src/mobile/index.d.ts +19 -0
- package/dist/src/mobile/iosConformance.d.ts +15 -0
- package/dist/src/mobile/iosNativeWatcher.d.ts +19 -0
- package/dist/src/mobile/iosRelease.d.ts +61 -0
- package/dist/src/mobile/iosSimulatorController.d.ts +89 -0
- package/dist/src/mobile/materializedBundle.d.ts +14 -0
- package/dist/src/mobile/nativeAuth.d.ts +17 -0
- package/dist/src/mobile/nativeBackgroundSync.d.ts +4 -0
- package/dist/src/mobile/nativeDeepLinks.d.ts +5 -0
- package/dist/src/mobile/releaseArtifact.d.ts +3 -0
- package/dist/src/mobile/releaseDoctor.d.ts +13 -0
- package/dist/src/mobile/releasePublisher.d.ts +130 -0
- package/dist/src/mobile/remoteMacAgent.d.ts +2 -0
- package/dist/src/mobile/remoteMacAgentEntry.d.ts +1 -0
- package/dist/src/mobile/remoteMacProtocol.d.ts +114 -0
- package/dist/src/mobile/remoteMacWire.d.ts +2 -0
- package/dist/src/mobile/routeMatcher.d.ts +3 -0
- package/dist/src/mobile/routeMetadataTransform.d.ts +13 -0
- package/dist/src/mobile/shellAuth.d.ts +13 -0
- package/dist/src/mobile/shellBootstrap.d.ts +18 -0
- package/dist/src/mobile/shellSync.d.ts +19 -0
- package/dist/src/mobile/staticDocument.d.ts +5 -0
- package/dist/src/mobile/transport.d.ts +43 -0
- package/dist/src/plugins/hmr.d.ts +3 -0
- package/dist/src/plugins/imageOptimizer.d.ts +1 -1
- package/dist/src/react/hooks/useMediaQuery.d.ts +1 -1
- package/dist/src/react/jsxDevRuntimeCompat.d.ts +1 -1
- package/dist/src/react/jsxRuntimeCompat.d.ts +7 -0
- package/dist/src/react/pageHandler.d.ts +3 -0
- package/dist/src/svelte/pageHandler.d.ts +3 -0
- package/dist/src/utils/loadConfig.d.ts +2 -0
- package/dist/src/utils/logger.d.ts +2 -0
- package/dist/src/utils/userAgentFunctions.d.ts +1 -1
- package/dist/src/vue/pageHandler.d.ts +3 -0
- package/dist/svelte/index.js +325 -23
- package/dist/svelte/index.js.map +8 -5
- package/dist/svelte/server.js +320 -18
- package/dist/svelte/server.js.map +8 -5
- package/dist/types/build.d.ts +59 -0
- package/dist/types/cli.d.ts +2 -0
- package/dist/types/globals.d.ts +14 -0
- package/dist/types/messages.d.ts +12 -0
- package/dist/vue/index.js +325 -23
- package/dist/vue/index.js.map +8 -5
- package/dist/vue/server.js +320 -18
- package/dist/vue/server.js.map +8 -5
- package/package.json +52 -8
package/dist/svelte/index.js
CHANGED
|
@@ -1333,7 +1333,7 @@ var SLOT_ID_PREFIX = "abs-slot-", CLOSING_BODY_TAG = "</body>", CLOSING_HEAD_TAG
|
|
|
1333
1333
|
getStreamingSlotsRuntimeScript()
|
|
1334
1334
|
].filter(Boolean).join(";");
|
|
1335
1335
|
return `<script${createNonceAttr(nonce)}>${escapeScriptContent(runtimeBody)}</script>`;
|
|
1336
|
-
}, toUint8 = (value, encoder) => encoder.encode(value),
|
|
1336
|
+
}, toUint8 = (value, encoder) => encoder.encode(value), isRecord2 = (value) => Boolean(value) && typeof value === "object", isSafeHtmlLike = (value) => isRecord2(value) && typeof value.changingThisBreaksApplicationSecurity === "string", normalizeSafeHtml = (value) => {
|
|
1337
1337
|
if (isSafeHtmlLike(value)) {
|
|
1338
1338
|
return value.changingThisBreaksApplicationSecurity;
|
|
1339
1339
|
}
|
|
@@ -1394,7 +1394,7 @@ var SLOT_ID_PREFIX = "abs-slot-", CLOSING_BODY_TAG = "</body>", CLOSING_HEAD_TAG
|
|
|
1394
1394
|
}, createTimeoutError = (slot, timeoutMs) => {
|
|
1395
1395
|
const error = Object.assign(new Error(`Streaming slot "${slot.id}" timed out after ${timeoutMs}ms`), { __absTimeout: true });
|
|
1396
1396
|
return error;
|
|
1397
|
-
}, isSlotPatchPayloadObject = (value) =>
|
|
1397
|
+
}, isSlotPatchPayloadObject = (value) => isRecord2(value) && ("html" in value), isTimeoutError = (error) => isRecord2(error) && error.__absTimeout === true, toStreamingSlot = (slot, policy) => ({
|
|
1398
1398
|
errorHtml: slot.errorHtml === undefined ? policy.errorHtml : slot.errorHtml,
|
|
1399
1399
|
fallbackHtml: normalizeSlotText(slot.fallbackHtml, policy.fallbackHtml),
|
|
1400
1400
|
id: slot.id ?? createStreamingSlotId(),
|
|
@@ -1976,6 +1976,19 @@ var colors2, frameworkColors, formatPath = (filePath) => {
|
|
|
1976
1976
|
const errorMsg = error instanceof Error ? error.message : error;
|
|
1977
1977
|
const fullMessage = `${colors2.red}error${colors2.reset} ${message}${errorMsg ? `: ${errorMsg}` : ""}`;
|
|
1978
1978
|
console.error(`${timestamp} ${tag} ${fullMessage}`);
|
|
1979
|
+
}, logHmrClientUpdate = (path, framework, duration, target, serverMs, clientMs, outcome = "applied", kind) => {
|
|
1980
|
+
const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
|
|
1981
|
+
const targetLabel = target.startsWith("capacitor-") ? target.slice("capacitor-".length) : target;
|
|
1982
|
+
const tag = `${colors2.cyan}[hmr:${targetLabel}]${colors2.reset}`;
|
|
1983
|
+
const pathColor = framework ? getFrameworkColor(framework) : colors2.white;
|
|
1984
|
+
const breakdown = serverMs === undefined || clientMs === undefined ? "" : `; server ${serverMs}ms, client ${clientMs}ms`;
|
|
1985
|
+
let action = "failed after";
|
|
1986
|
+
if (outcome === "applied")
|
|
1987
|
+
action = "applied in";
|
|
1988
|
+
else if (outcome === "reloaded")
|
|
1989
|
+
action = "falling back to reload after";
|
|
1990
|
+
const kindLabel = kind ? `${kind} ` : "";
|
|
1991
|
+
console.log(`${timestamp} ${tag} ${framework ?? "update"} ${kindLabel}${pathColor}${formatPath(path)}${colors2.reset} ${colors2.dim}${action} ${duration}ms${breakdown}${colors2.reset}`);
|
|
1979
1992
|
}, logHmrUpdate = (path, framework, duration) => {
|
|
1980
1993
|
log("hmr update", { duration, framework, path });
|
|
1981
1994
|
}, logInfo = (message) => {
|
|
@@ -2336,8 +2349,8 @@ var CONVENTIONS_KEY = "__absoluteConventions", isConventionsMap = (value) => Boo
|
|
|
2336
2349
|
}
|
|
2337
2350
|
return null;
|
|
2338
2351
|
}, NOT_FOUND_PRIORITY, renderFirstNotFound = async () => {
|
|
2339
|
-
const renderNext = async (
|
|
2340
|
-
const [framework, ...remaining] =
|
|
2352
|
+
const renderNext = async (frameworks2) => {
|
|
2353
|
+
const [framework, ...remaining] = frameworks2;
|
|
2341
2354
|
if (!framework) {
|
|
2342
2355
|
return null;
|
|
2343
2356
|
}
|
|
@@ -3807,8 +3820,8 @@ var toIslandFrameworkSegment = (framework) => framework[0]?.toUpperCase() + fram
|
|
|
3807
3820
|
return found ? entries : undefined;
|
|
3808
3821
|
}, getIslandManifestEntries = (manifest) => {
|
|
3809
3822
|
const islands = {};
|
|
3810
|
-
const
|
|
3811
|
-
for (const framework of
|
|
3823
|
+
const frameworks2 = ["react", "svelte", "vue", "angular"];
|
|
3824
|
+
for (const framework of frameworks2) {
|
|
3812
3825
|
const prefix = `Island${toIslandFrameworkSegment(framework)}`;
|
|
3813
3826
|
const entries = collectFrameworkIslands(manifest, prefix);
|
|
3814
3827
|
if (entries)
|
|
@@ -3828,14 +3841,14 @@ var defineIslandComponent = (component, options) => ({
|
|
|
3828
3841
|
component,
|
|
3829
3842
|
export: options.export,
|
|
3830
3843
|
source: options.source
|
|
3831
|
-
}), defineIslandRegistry = (registry) => registry,
|
|
3844
|
+
}), defineIslandRegistry = (registry) => registry, isRecord4 = (value) => typeof value === "object" && value !== null, getIslandBuildReference = (component) => {
|
|
3832
3845
|
if (!isIslandComponentDefinition(component))
|
|
3833
3846
|
return null;
|
|
3834
3847
|
return {
|
|
3835
3848
|
export: component.export,
|
|
3836
3849
|
source: component.source
|
|
3837
3850
|
};
|
|
3838
|
-
}, isIslandComponentDefinition = (value) =>
|
|
3851
|
+
}, isIslandComponentDefinition = (value) => isRecord4(value) && ("component" in value) && ("source" in value) && typeof value.source === "string", parseIslandProps = (rawProps) => {
|
|
3839
3852
|
if (!rawProps)
|
|
3840
3853
|
return {};
|
|
3841
3854
|
return JSON.parse(rawProps);
|
|
@@ -3859,7 +3872,7 @@ var init_islandMarkupAttributes = __esm(() => {
|
|
|
3859
3872
|
var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildComponentCache, nextIslandId = () => {
|
|
3860
3873
|
islandSequence += 1;
|
|
3861
3874
|
return `island-${islandSequence}`;
|
|
3862
|
-
},
|
|
3875
|
+
}, isRecord5 = (value) => typeof value === "object" && value !== null, isReactServerIslandComponent = (value) => typeof value === "function", isSvelteServerIslandComponent = (value) => typeof value === "function", isVueServerIslandComponent = (value) => typeof value === "function" || isRecord5(value), isAngularServerIslandComponent = (value) => typeof value === "function", resolveBuildReferencePath = (source, registryPath) => {
|
|
3863
3876
|
if (source.startsWith("file://"))
|
|
3864
3877
|
return new URL(source).pathname;
|
|
3865
3878
|
if (source.startsWith("."))
|
|
@@ -4351,6 +4364,278 @@ var setCurrentIslandManifest = (manifest) => {
|
|
|
4351
4364
|
|
|
4352
4365
|
// src/svelte/pageHandler.ts
|
|
4353
4366
|
init_devRouteRegistrationCallsite();
|
|
4367
|
+
|
|
4368
|
+
// src/core/requestContext.ts
|
|
4369
|
+
import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
|
|
4370
|
+
import { Elysia as Elysia2 } from "elysia";
|
|
4371
|
+
var REQUEST_STORAGE_KEY = Symbol.for("absolutejs.requestAsyncLocalStorage");
|
|
4372
|
+
var isAbsoluteRequestStorage = (value) => typeof value === "object" && value !== null && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
|
|
4373
|
+
var getRequestStorage = () => {
|
|
4374
|
+
const value = Reflect.get(globalThis, REQUEST_STORAGE_KEY);
|
|
4375
|
+
return isAbsoluteRequestStorage(value) ? value : undefined;
|
|
4376
|
+
};
|
|
4377
|
+
var ensureRequestStorage = () => {
|
|
4378
|
+
const existing = getRequestStorage();
|
|
4379
|
+
if (existing)
|
|
4380
|
+
return existing;
|
|
4381
|
+
const storage = new AsyncLocalStorage2;
|
|
4382
|
+
Reflect.set(globalThis, REQUEST_STORAGE_KEY, storage);
|
|
4383
|
+
return storage;
|
|
4384
|
+
};
|
|
4385
|
+
var absoluteRequestContext = new Elysia2({
|
|
4386
|
+
name: "absolutejs-request-context"
|
|
4387
|
+
}).request(({ request }) => {
|
|
4388
|
+
ensureRequestStorage().enterWith({ request });
|
|
4389
|
+
}).as("global");
|
|
4390
|
+
var getCurrentAbsoluteRequest = () => getRequestStorage()?.getStore()?.request;
|
|
4391
|
+
var runWithAbsoluteRequest = (request, callback) => ensureRequestStorage().run({ request }, callback);
|
|
4392
|
+
|
|
4393
|
+
// src/mobile/producerContextState.ts
|
|
4394
|
+
var ABSOLUTE_MOBILE_PRODUCER_STORAGE_KEY = Symbol.for("absolutejs.mobileProducerAsyncLocalStorage");
|
|
4395
|
+
var frameworks = new Set([
|
|
4396
|
+
"angular",
|
|
4397
|
+
"ember",
|
|
4398
|
+
"html",
|
|
4399
|
+
"htmx",
|
|
4400
|
+
"react",
|
|
4401
|
+
"svelte",
|
|
4402
|
+
"vue"
|
|
4403
|
+
]);
|
|
4404
|
+
var isCompatibilityPage = (value) => typeof value === "object" && value !== null && ("bundleHash" in value) && typeof value.bundleHash === "string" && ("contract" in value) && typeof value.contract === "string" && ("framework" in value) && typeof value.framework === "string" && frameworks.has(value.framework) && ("pageId" in value) && typeof value.pageId === "string" && ("propsSchemaHash" in value) && typeof value.propsSchemaHash === "string";
|
|
4405
|
+
var getCurrentAbsoluteMobileProducerContext = () => {
|
|
4406
|
+
const value = Reflect.get(globalThis, ABSOLUTE_MOBILE_PRODUCER_STORAGE_KEY);
|
|
4407
|
+
if (typeof value !== "object" || value === null || !("getStore" in value) || typeof value.getStore !== "function") {
|
|
4408
|
+
return;
|
|
4409
|
+
}
|
|
4410
|
+
const context = value.getStore();
|
|
4411
|
+
if (typeof context !== "object" || context === null || !("page" in context) || !isCompatibilityPage(context.page) || !("releaseId" in context) || typeof context.releaseId !== "string") {
|
|
4412
|
+
return;
|
|
4413
|
+
}
|
|
4414
|
+
return { page: context.page, releaseId: context.releaseId };
|
|
4415
|
+
};
|
|
4416
|
+
|
|
4417
|
+
// src/mobile/pageProtocol.ts
|
|
4418
|
+
var ABSOLUTE_MOBILE_PAGE_MEDIA_TYPE = "application/vnd.absolute.page+json";
|
|
4419
|
+
var ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION = 1;
|
|
4420
|
+
var BAD_REQUEST_STATUS = 400;
|
|
4421
|
+
var OK_STATUS = 200;
|
|
4422
|
+
var SERVER_ERROR_STATUS = 500;
|
|
4423
|
+
var UPGRADE_REQUIRED_STATUS = 426;
|
|
4424
|
+
var MOBILE_PAGE_REQUEST_HEADERS = {
|
|
4425
|
+
appBuild: "x-absolute-mobile-app-build",
|
|
4426
|
+
pageBundle: "x-absolute-mobile-page-bundle",
|
|
4427
|
+
pageContracts: "x-absolute-mobile-page-contracts",
|
|
4428
|
+
pageId: "x-absolute-mobile-page-id",
|
|
4429
|
+
protocol: "x-absolute-mobile-protocol",
|
|
4430
|
+
runtime: "x-absolute-mobile-runtime"
|
|
4431
|
+
};
|
|
4432
|
+
var parseMediaType = (value) => value.split(";", 1)[0]?.trim().toLowerCase();
|
|
4433
|
+
var acceptsAbsoluteMobilePage = (request) => {
|
|
4434
|
+
if (!request)
|
|
4435
|
+
return false;
|
|
4436
|
+
return (request.headers.get("accept") ?? "").split(",").some((value) => parseMediaType(value) === ABSOLUTE_MOBILE_PAGE_MEDIA_TYPE);
|
|
4437
|
+
};
|
|
4438
|
+
var readRequiredHeader = (request, name) => {
|
|
4439
|
+
const value = request.headers.get(name)?.trim();
|
|
4440
|
+
return value ? value : undefined;
|
|
4441
|
+
};
|
|
4442
|
+
var parseAbsoluteMobilePageRequest = (request) => {
|
|
4443
|
+
if (!request || !acceptsAbsoluteMobilePage(request)) {
|
|
4444
|
+
return { kind: "not-mobile" };
|
|
4445
|
+
}
|
|
4446
|
+
const protocolValue = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.protocol);
|
|
4447
|
+
const runtime = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.runtime);
|
|
4448
|
+
const appBuild = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.appBuild);
|
|
4449
|
+
const pageBundle = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.pageBundle);
|
|
4450
|
+
const pageContractsValue = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.pageContracts);
|
|
4451
|
+
const pageId = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.pageId);
|
|
4452
|
+
if (!protocolValue || !/^\d+$/.test(protocolValue)) {
|
|
4453
|
+
return {
|
|
4454
|
+
kind: "invalid",
|
|
4455
|
+
message: `Missing or invalid ${MOBILE_PAGE_REQUEST_HEADERS.protocol} header.`
|
|
4456
|
+
};
|
|
4457
|
+
}
|
|
4458
|
+
if (!runtime) {
|
|
4459
|
+
return {
|
|
4460
|
+
kind: "invalid",
|
|
4461
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.runtime} header.`
|
|
4462
|
+
};
|
|
4463
|
+
}
|
|
4464
|
+
if (!appBuild) {
|
|
4465
|
+
return {
|
|
4466
|
+
kind: "invalid",
|
|
4467
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.appBuild} header.`
|
|
4468
|
+
};
|
|
4469
|
+
}
|
|
4470
|
+
if (!pageBundle) {
|
|
4471
|
+
return {
|
|
4472
|
+
kind: "invalid",
|
|
4473
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.pageBundle} header.`
|
|
4474
|
+
};
|
|
4475
|
+
}
|
|
4476
|
+
if (!pageContractsValue) {
|
|
4477
|
+
return {
|
|
4478
|
+
kind: "invalid",
|
|
4479
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.pageContracts} header.`
|
|
4480
|
+
};
|
|
4481
|
+
}
|
|
4482
|
+
if (!pageId) {
|
|
4483
|
+
return {
|
|
4484
|
+
kind: "invalid",
|
|
4485
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.pageId} header.`
|
|
4486
|
+
};
|
|
4487
|
+
}
|
|
4488
|
+
const pageContracts = [
|
|
4489
|
+
...new Set(pageContractsValue.split(",").map((value) => value.trim()).filter(Boolean))
|
|
4490
|
+
];
|
|
4491
|
+
if (pageContracts.length === 0) {
|
|
4492
|
+
return {
|
|
4493
|
+
kind: "invalid",
|
|
4494
|
+
message: `${MOBILE_PAGE_REQUEST_HEADERS.pageContracts} must contain at least one contract.`
|
|
4495
|
+
};
|
|
4496
|
+
}
|
|
4497
|
+
return {
|
|
4498
|
+
client: {
|
|
4499
|
+
appBuild,
|
|
4500
|
+
pageBundle,
|
|
4501
|
+
pageContracts,
|
|
4502
|
+
pageId,
|
|
4503
|
+
protocol: Number(protocolValue),
|
|
4504
|
+
runtime
|
|
4505
|
+
},
|
|
4506
|
+
kind: "mobile"
|
|
4507
|
+
};
|
|
4508
|
+
};
|
|
4509
|
+
var responseHeaders = () => {
|
|
4510
|
+
const headers = new Headers({
|
|
4511
|
+
"cache-control": "no-store",
|
|
4512
|
+
"content-type": `${ABSOLUTE_MOBILE_PAGE_MEDIA_TYPE}; version=${ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION}`
|
|
4513
|
+
});
|
|
4514
|
+
headerVaryValues.forEach((value) => headers.append("vary", value));
|
|
4515
|
+
return headers;
|
|
4516
|
+
};
|
|
4517
|
+
var headerVaryValues = [
|
|
4518
|
+
"Accept",
|
|
4519
|
+
MOBILE_PAGE_REQUEST_HEADERS.protocol,
|
|
4520
|
+
MOBILE_PAGE_REQUEST_HEADERS.runtime,
|
|
4521
|
+
MOBILE_PAGE_REQUEST_HEADERS.appBuild,
|
|
4522
|
+
MOBILE_PAGE_REQUEST_HEADERS.pageBundle,
|
|
4523
|
+
MOBILE_PAGE_REQUEST_HEADERS.pageContracts,
|
|
4524
|
+
MOBILE_PAGE_REQUEST_HEADERS.pageId
|
|
4525
|
+
];
|
|
4526
|
+
var envelopeResponse = (response, status) => new Response(JSON.stringify({
|
|
4527
|
+
protocol: ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION,
|
|
4528
|
+
response
|
|
4529
|
+
}), { headers: responseHeaders(), status });
|
|
4530
|
+
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4531
|
+
var normalizeJsonValue = (value) => {
|
|
4532
|
+
const serialized = JSON.stringify(value);
|
|
4533
|
+
if (serialized === undefined) {
|
|
4534
|
+
throw new TypeError("Mobile page props must be JSON-serializable.");
|
|
4535
|
+
}
|
|
4536
|
+
const parsed = JSON.parse(serialized);
|
|
4537
|
+
if (!isRecord(parsed)) {
|
|
4538
|
+
throw new TypeError("Mobile page props must serialize to an object.");
|
|
4539
|
+
}
|
|
4540
|
+
return parsed;
|
|
4541
|
+
};
|
|
4542
|
+
var finalizeArchivedMobilePage = (context, input) => {
|
|
4543
|
+
const { page } = context;
|
|
4544
|
+
if (page.pageId !== input.compatibility.pageId || page.framework !== input.compatibility.framework) {
|
|
4545
|
+
return envelopeResponse({
|
|
4546
|
+
kind: "invalid-request",
|
|
4547
|
+
message: "Archived producer page identity does not match its release artifact."
|
|
4548
|
+
}, BAD_REQUEST_STATUS);
|
|
4549
|
+
}
|
|
4550
|
+
try {
|
|
4551
|
+
const [currentRepresentation] = input.compatibility.representations;
|
|
4552
|
+
if (!currentRepresentation) {
|
|
4553
|
+
throw new TypeError("Mobile page has no current representation.");
|
|
4554
|
+
}
|
|
4555
|
+
return envelopeResponse({
|
|
4556
|
+
contract: page.contract,
|
|
4557
|
+
framework: page.framework,
|
|
4558
|
+
kind: "page",
|
|
4559
|
+
pageId: page.pageId,
|
|
4560
|
+
props: normalizeJsonValue(currentRepresentation.mapProps(input.props)),
|
|
4561
|
+
status: input.status ?? OK_STATUS
|
|
4562
|
+
}, input.status ?? OK_STATUS);
|
|
4563
|
+
} catch (error) {
|
|
4564
|
+
console.error(`[Mobile] Archived producer ${context.releaseId} failed for ${page.pageId}:`, error);
|
|
4565
|
+
return createAbsoluteMobilePageErrorResponse(page.pageId);
|
|
4566
|
+
}
|
|
4567
|
+
};
|
|
4568
|
+
var createAbsoluteMobileInvalidRequestResponse = (message) => envelopeResponse({ kind: "invalid-request", message }, BAD_REQUEST_STATUS);
|
|
4569
|
+
var createAbsoluteMobilePageErrorResponse = (pageId) => envelopeResponse({
|
|
4570
|
+
code: "representation-failed",
|
|
4571
|
+
kind: "error",
|
|
4572
|
+
pageId,
|
|
4573
|
+
status: SERVER_ERROR_STATUS
|
|
4574
|
+
}, SERVER_ERROR_STATUS);
|
|
4575
|
+
var createAbsoluteMobileUpgradeResponse = (result) => envelopeResponse(result, UPGRADE_REQUIRED_STATUS);
|
|
4576
|
+
var finalizeAbsoluteMobilePage = (input) => {
|
|
4577
|
+
const parsed = parseAbsoluteMobilePageRequest(input.request);
|
|
4578
|
+
if (parsed.kind === "not-mobile")
|
|
4579
|
+
return;
|
|
4580
|
+
if (parsed.kind === "invalid") {
|
|
4581
|
+
return envelopeResponse({ kind: "invalid-request", message: parsed.message }, BAD_REQUEST_STATUS);
|
|
4582
|
+
}
|
|
4583
|
+
const { client } = parsed;
|
|
4584
|
+
if (client.pageId !== input.compatibility.pageId) {
|
|
4585
|
+
return envelopeResponse({
|
|
4586
|
+
kind: "invalid-request",
|
|
4587
|
+
message: `Requested mobile page ${client.pageId} does not match ${input.compatibility.pageId}.`
|
|
4588
|
+
}, BAD_REQUEST_STATUS);
|
|
4589
|
+
}
|
|
4590
|
+
const producerContext = getCurrentAbsoluteMobileProducerContext();
|
|
4591
|
+
if (producerContext)
|
|
4592
|
+
return finalizeArchivedMobilePage(producerContext, input);
|
|
4593
|
+
if (client.protocol !== ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION) {
|
|
4594
|
+
return envelopeResponse({
|
|
4595
|
+
kind: "upgrade-required",
|
|
4596
|
+
pageId: input.compatibility.pageId,
|
|
4597
|
+
reason: "protocol"
|
|
4598
|
+
}, UPGRADE_REQUIRED_STATUS);
|
|
4599
|
+
}
|
|
4600
|
+
if (!input.compatibility.runtimes.includes(client.runtime)) {
|
|
4601
|
+
return envelopeResponse({
|
|
4602
|
+
kind: "upgrade-required",
|
|
4603
|
+
pageId: input.compatibility.pageId,
|
|
4604
|
+
reason: "runtime",
|
|
4605
|
+
supportedRuntimes: [...input.compatibility.runtimes]
|
|
4606
|
+
}, UPGRADE_REQUIRED_STATUS);
|
|
4607
|
+
}
|
|
4608
|
+
const clientContracts = new Set(client.pageContracts);
|
|
4609
|
+
const representation = input.compatibility.representations.find(({ contract }) => clientContracts.has(contract));
|
|
4610
|
+
if (!representation) {
|
|
4611
|
+
return envelopeResponse({
|
|
4612
|
+
kind: "upgrade-required",
|
|
4613
|
+
pageId: input.compatibility.pageId,
|
|
4614
|
+
reason: "page-contract",
|
|
4615
|
+
supportedContracts: input.compatibility.representations.map(({ contract }) => contract)
|
|
4616
|
+
}, UPGRADE_REQUIRED_STATUS);
|
|
4617
|
+
}
|
|
4618
|
+
try {
|
|
4619
|
+
return envelopeResponse({
|
|
4620
|
+
contract: representation.contract,
|
|
4621
|
+
framework: input.compatibility.framework,
|
|
4622
|
+
kind: "page",
|
|
4623
|
+
pageId: input.compatibility.pageId,
|
|
4624
|
+
props: normalizeJsonValue(representation.mapProps(input.props)),
|
|
4625
|
+
status: input.status ?? OK_STATUS
|
|
4626
|
+
}, input.status ?? OK_STATUS);
|
|
4627
|
+
} catch (error) {
|
|
4628
|
+
console.error(`[Mobile] Failed to produce ${input.compatibility.pageId} representation ${representation.contract}:`, error);
|
|
4629
|
+
return envelopeResponse({
|
|
4630
|
+
code: "representation-failed",
|
|
4631
|
+
kind: "error",
|
|
4632
|
+
pageId: input.compatibility.pageId,
|
|
4633
|
+
status: SERVER_ERROR_STATUS
|
|
4634
|
+
}, SERVER_ERROR_STATUS);
|
|
4635
|
+
}
|
|
4636
|
+
};
|
|
4637
|
+
|
|
4638
|
+
// src/svelte/pageHandler.ts
|
|
4354
4639
|
init_pageResponseCache();
|
|
4355
4640
|
|
|
4356
4641
|
// src/core/responseEnhancers.ts
|
|
@@ -4407,7 +4692,7 @@ var withRegisteredStreamingSlots = async (renderResponse, options = {}) => {
|
|
|
4407
4692
|
|
|
4408
4693
|
// src/core/streamingSlotWarningScope.ts
|
|
4409
4694
|
init_logger();
|
|
4410
|
-
import { AsyncLocalStorage as
|
|
4695
|
+
import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
|
|
4411
4696
|
var STREAMING_SLOT_WARNING_STORAGE_KEY2 = Symbol.for("absolutejs.streamingSlotWarningAsyncLocalStorage");
|
|
4412
4697
|
var isObjectRecord4 = (value) => Boolean(value) && typeof value === "object";
|
|
4413
4698
|
var isAsyncLocalStorage3 = (value) => isObjectRecord4(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
|
|
@@ -4423,7 +4708,7 @@ var ensureWarningStorage = () => {
|
|
|
4423
4708
|
if (existing) {
|
|
4424
4709
|
return existing;
|
|
4425
4710
|
}
|
|
4426
|
-
const storage = new
|
|
4711
|
+
const storage = new AsyncLocalStorage3;
|
|
4427
4712
|
Reflect.set(globalThis, STREAMING_SLOT_WARNING_STORAGE_KEY2, storage);
|
|
4428
4713
|
return storage;
|
|
4429
4714
|
};
|
|
@@ -4467,15 +4752,15 @@ var runWithStreamingSlotWarningScope = (task, metadata) => ensureWarningStorage(
|
|
|
4467
4752
|
init_inlinePageCss();
|
|
4468
4753
|
init_spaRouteManifest();
|
|
4469
4754
|
init_resolveConvention();
|
|
4470
|
-
var
|
|
4471
|
-
var isGenericSvelteComponent = (value) => typeof value === "function" ||
|
|
4755
|
+
var isRecord3 = (value) => typeof value === "object" && value !== null;
|
|
4756
|
+
var isGenericSvelteComponent = (value) => typeof value === "function" || isRecord3(value);
|
|
4472
4757
|
var readHasIslands = (value) => {
|
|
4473
|
-
if (!
|
|
4758
|
+
if (!isRecord3(value))
|
|
4474
4759
|
return false;
|
|
4475
4760
|
const hasIslands = value["__ABSOLUTE_PAGE_HAS_ISLANDS__"];
|
|
4476
4761
|
return typeof hasIslands === "boolean" ? hasIslands : false;
|
|
4477
4762
|
};
|
|
4478
|
-
var readDefaultExport = (value) =>
|
|
4763
|
+
var readDefaultExport = (value) => isRecord3(value) ? value.default : undefined;
|
|
4479
4764
|
var primeSvelteStream = async (stream) => {
|
|
4480
4765
|
const reader = stream.getReader();
|
|
4481
4766
|
const firstChunk = await reader.read();
|
|
@@ -4510,15 +4795,32 @@ var handleSveltePageRequest = async (input) => {
|
|
|
4510
4795
|
const resolvedOptions = input;
|
|
4511
4796
|
const resolvedPagePath = input.pagePath;
|
|
4512
4797
|
const userProps = input.props;
|
|
4513
|
-
const
|
|
4514
|
-
const
|
|
4798
|
+
const request = input.request ?? getCurrentAbsoluteRequest();
|
|
4799
|
+
const requestPathname = resolveRequestPathname(request);
|
|
4800
|
+
const resolvedProps = requestPathname !== undefined && (!isRecord3(userProps) || !("url" in userProps)) ? {
|
|
4515
4801
|
...userProps ?? {},
|
|
4516
4802
|
url: requestPathname
|
|
4517
4803
|
} : userProps;
|
|
4804
|
+
const pageId = input.__absoluteMobile?.pageId ?? derivePageName(resolvedPagePath);
|
|
4805
|
+
const currentContract = input.__absoluteMobile?.contract ?? `svelte:${pageId}:${ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION}`;
|
|
4806
|
+
const mobileResponse = finalizeAbsoluteMobilePage({
|
|
4807
|
+
compatibility: {
|
|
4808
|
+
framework: "svelte",
|
|
4809
|
+
pageId,
|
|
4810
|
+
representations: [
|
|
4811
|
+
{ contract: currentContract, mapProps: (props) => props }
|
|
4812
|
+
],
|
|
4813
|
+
runtimes: [String(ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION)]
|
|
4814
|
+
},
|
|
4815
|
+
props: resolvedProps ?? Object.create(null),
|
|
4816
|
+
request
|
|
4817
|
+
});
|
|
4818
|
+
if (mobileResponse)
|
|
4819
|
+
return mobileResponse;
|
|
4518
4820
|
try {
|
|
4519
|
-
const spaNotFound = await renderSpaNotFound("svelte", derivePageName(resolvedPagePath),
|
|
4821
|
+
const spaNotFound = await renderSpaNotFound("svelte", derivePageName(resolvedPagePath), request);
|
|
4520
4822
|
if (spaNotFound)
|
|
4521
|
-
return withPageCacheHeaders(spaNotFound,
|
|
4823
|
+
return withPageCacheHeaders(spaNotFound, request);
|
|
4522
4824
|
const handlerCallsite = resolvedOptions?.collectStreamingSlots === true ? undefined : getCurrentRouteRegistrationCallsite() ?? captureStreamingSlotWarningCallsite();
|
|
4523
4825
|
const renderPageResponse = async () => {
|
|
4524
4826
|
const resolvePageComponent = async () => {
|
|
@@ -4569,7 +4871,7 @@ var handleSveltePageRequest = async (input) => {
|
|
|
4569
4871
|
...resolvedOptions,
|
|
4570
4872
|
runtimePlacement: resolvedOptions.runtimePlacement ?? "body"
|
|
4571
4873
|
}) : renderPageResponse(), { handlerCallsite });
|
|
4572
|
-
return withPageCacheHeaders(pageResponse,
|
|
4874
|
+
return withPageCacheHeaders(pageResponse, request, {
|
|
4573
4875
|
bufferStreamForEtag: input.bufferStreamForEtag
|
|
4574
4876
|
});
|
|
4575
4877
|
} catch (error) {
|
|
@@ -4577,12 +4879,12 @@ var handleSveltePageRequest = async (input) => {
|
|
|
4577
4879
|
const pageName = derivePageName(resolvedPagePath);
|
|
4578
4880
|
const conventionResponse = await renderConventionError("svelte", pageName, error);
|
|
4579
4881
|
if (conventionResponse) {
|
|
4580
|
-
return withPageCacheHeaders(conventionResponse,
|
|
4882
|
+
return withPageCacheHeaders(conventionResponse, request);
|
|
4581
4883
|
}
|
|
4582
4884
|
return withPageCacheHeaders(new Response(ssrErrorPage("svelte", error), {
|
|
4583
4885
|
headers: { "Content-Type": "text/html" },
|
|
4584
4886
|
status: 500
|
|
4585
|
-
}),
|
|
4887
|
+
}), request);
|
|
4586
4888
|
}
|
|
4587
4889
|
};
|
|
4588
4890
|
// src/svelte/createIsland.ts
|
|
@@ -4726,5 +5028,5 @@ export {
|
|
|
4726
5028
|
createTypedIsland
|
|
4727
5029
|
};
|
|
4728
5030
|
|
|
4729
|
-
//# debugId=
|
|
5031
|
+
//# debugId=505E54839FC4D87364756E2164756E21
|
|
4730
5032
|
//# sourceMappingURL=index.js.map
|