@absolutejs/absolute 0.20.0-beta.3 → 0.20.0-beta.5
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/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +341 -22
- package/dist/angular/index.js.map +8 -5
- package/dist/angular/server.js +341 -22
- package/dist/angular/server.js.map +8 -5
- package/dist/build.js +94 -22
- package/dist/build.js.map +10 -10
- package/dist/cli/index.js +1750 -655
- package/dist/dev/client/cssUtils.ts +16 -2
- package/dist/dev/client/handlers/rebuild.ts +11 -1
- package/dist/dev/client/hmrTiming.ts +14 -7
- package/dist/index.js +364 -191
- package/dist/index.js.map +18 -18
- package/dist/mobile/browser.js +14 -1
- package/dist/mobile/browser.js.map +3 -3
- package/dist/mobile/index.js +1233 -160
- package/dist/mobile/index.js.map +17 -13
- package/dist/mobile/remoteMacAgentEntry.js +29 -0
- package/dist/src/angular/pageHandler.d.ts +3 -0
- package/dist/src/cli/config/server.d.ts +1 -1
- package/dist/src/core/pageHandlers.d.ts +11 -2
- package/dist/src/mobile/androidEmulatorController.d.ts +6 -1
- package/dist/src/mobile/buildPipeline.d.ts +1 -0
- package/dist/src/mobile/capacitorBundle.d.ts +11 -1
- package/dist/src/mobile/client.d.ts +4 -0
- package/dist/src/mobile/index.d.ts +2 -0
- package/dist/src/mobile/nativeAuth.d.ts +17 -0
- package/dist/src/mobile/releaseArtifact.d.ts +2 -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/shellAuth.d.ts +8 -0
- package/dist/src/mobile/shellBootstrap.d.ts +11 -1
- package/dist/src/mobile/shellSync.d.ts +2 -0
- package/dist/src/mobile/staticDocument.d.ts +5 -0
- package/dist/src/mobile/transport.d.ts +9 -1
- package/dist/src/plugins/imageOptimizer.d.ts +1 -1
- package/dist/src/svelte/pageHandler.d.ts +3 -0
- package/dist/src/vue/pageHandler.d.ts +3 -0
- package/dist/svelte/index.js +312 -23
- package/dist/svelte/index.js.map +7 -4
- package/dist/svelte/server.js +307 -18
- package/dist/svelte/server.js.map +7 -4
- package/dist/vue/index.js +312 -23
- package/dist/vue/index.js.map +7 -4
- package/dist/vue/server.js +307 -18
- package/dist/vue/server.js.map +7 -4
- package/package.json +20 -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(),
|
|
@@ -2349,8 +2349,8 @@ var CONVENTIONS_KEY = "__absoluteConventions", isConventionsMap = (value) => Boo
|
|
|
2349
2349
|
}
|
|
2350
2350
|
return null;
|
|
2351
2351
|
}, NOT_FOUND_PRIORITY, renderFirstNotFound = async () => {
|
|
2352
|
-
const renderNext = async (
|
|
2353
|
-
const [framework, ...remaining] =
|
|
2352
|
+
const renderNext = async (frameworks2) => {
|
|
2353
|
+
const [framework, ...remaining] = frameworks2;
|
|
2354
2354
|
if (!framework) {
|
|
2355
2355
|
return null;
|
|
2356
2356
|
}
|
|
@@ -3820,8 +3820,8 @@ var toIslandFrameworkSegment = (framework) => framework[0]?.toUpperCase() + fram
|
|
|
3820
3820
|
return found ? entries : undefined;
|
|
3821
3821
|
}, getIslandManifestEntries = (manifest) => {
|
|
3822
3822
|
const islands = {};
|
|
3823
|
-
const
|
|
3824
|
-
for (const framework of
|
|
3823
|
+
const frameworks2 = ["react", "svelte", "vue", "angular"];
|
|
3824
|
+
for (const framework of frameworks2) {
|
|
3825
3825
|
const prefix = `Island${toIslandFrameworkSegment(framework)}`;
|
|
3826
3826
|
const entries = collectFrameworkIslands(manifest, prefix);
|
|
3827
3827
|
if (entries)
|
|
@@ -3841,14 +3841,14 @@ var defineIslandComponent = (component, options) => ({
|
|
|
3841
3841
|
component,
|
|
3842
3842
|
export: options.export,
|
|
3843
3843
|
source: options.source
|
|
3844
|
-
}), defineIslandRegistry = (registry) => registry,
|
|
3844
|
+
}), defineIslandRegistry = (registry) => registry, isRecord4 = (value) => typeof value === "object" && value !== null, getIslandBuildReference = (component) => {
|
|
3845
3845
|
if (!isIslandComponentDefinition(component))
|
|
3846
3846
|
return null;
|
|
3847
3847
|
return {
|
|
3848
3848
|
export: component.export,
|
|
3849
3849
|
source: component.source
|
|
3850
3850
|
};
|
|
3851
|
-
}, isIslandComponentDefinition = (value) =>
|
|
3851
|
+
}, isIslandComponentDefinition = (value) => isRecord4(value) && ("component" in value) && ("source" in value) && typeof value.source === "string", parseIslandProps = (rawProps) => {
|
|
3852
3852
|
if (!rawProps)
|
|
3853
3853
|
return {};
|
|
3854
3854
|
return JSON.parse(rawProps);
|
|
@@ -3872,7 +3872,7 @@ var init_islandMarkupAttributes = __esm(() => {
|
|
|
3872
3872
|
var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildComponentCache, nextIslandId = () => {
|
|
3873
3873
|
islandSequence += 1;
|
|
3874
3874
|
return `island-${islandSequence}`;
|
|
3875
|
-
},
|
|
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) => {
|
|
3876
3876
|
if (source.startsWith("file://"))
|
|
3877
3877
|
return new URL(source).pathname;
|
|
3878
3878
|
if (source.startsWith("."))
|
|
@@ -4364,6 +4364,278 @@ var setCurrentIslandManifest = (manifest) => {
|
|
|
4364
4364
|
|
|
4365
4365
|
// src/svelte/pageHandler.ts
|
|
4366
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
|
|
4367
4639
|
init_pageResponseCache();
|
|
4368
4640
|
|
|
4369
4641
|
// src/core/responseEnhancers.ts
|
|
@@ -4420,7 +4692,7 @@ var withRegisteredStreamingSlots = async (renderResponse, options = {}) => {
|
|
|
4420
4692
|
|
|
4421
4693
|
// src/core/streamingSlotWarningScope.ts
|
|
4422
4694
|
init_logger();
|
|
4423
|
-
import { AsyncLocalStorage as
|
|
4695
|
+
import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
|
|
4424
4696
|
var STREAMING_SLOT_WARNING_STORAGE_KEY2 = Symbol.for("absolutejs.streamingSlotWarningAsyncLocalStorage");
|
|
4425
4697
|
var isObjectRecord4 = (value) => Boolean(value) && typeof value === "object";
|
|
4426
4698
|
var isAsyncLocalStorage3 = (value) => isObjectRecord4(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
|
|
@@ -4436,7 +4708,7 @@ var ensureWarningStorage = () => {
|
|
|
4436
4708
|
if (existing) {
|
|
4437
4709
|
return existing;
|
|
4438
4710
|
}
|
|
4439
|
-
const storage = new
|
|
4711
|
+
const storage = new AsyncLocalStorage3;
|
|
4440
4712
|
Reflect.set(globalThis, STREAMING_SLOT_WARNING_STORAGE_KEY2, storage);
|
|
4441
4713
|
return storage;
|
|
4442
4714
|
};
|
|
@@ -4480,15 +4752,15 @@ var runWithStreamingSlotWarningScope = (task, metadata) => ensureWarningStorage(
|
|
|
4480
4752
|
init_inlinePageCss();
|
|
4481
4753
|
init_spaRouteManifest();
|
|
4482
4754
|
init_resolveConvention();
|
|
4483
|
-
var
|
|
4484
|
-
var isGenericSvelteComponent = (value) => typeof value === "function" ||
|
|
4755
|
+
var isRecord3 = (value) => typeof value === "object" && value !== null;
|
|
4756
|
+
var isGenericSvelteComponent = (value) => typeof value === "function" || isRecord3(value);
|
|
4485
4757
|
var readHasIslands = (value) => {
|
|
4486
|
-
if (!
|
|
4758
|
+
if (!isRecord3(value))
|
|
4487
4759
|
return false;
|
|
4488
4760
|
const hasIslands = value["__ABSOLUTE_PAGE_HAS_ISLANDS__"];
|
|
4489
4761
|
return typeof hasIslands === "boolean" ? hasIslands : false;
|
|
4490
4762
|
};
|
|
4491
|
-
var readDefaultExport = (value) =>
|
|
4763
|
+
var readDefaultExport = (value) => isRecord3(value) ? value.default : undefined;
|
|
4492
4764
|
var primeSvelteStream = async (stream) => {
|
|
4493
4765
|
const reader = stream.getReader();
|
|
4494
4766
|
const firstChunk = await reader.read();
|
|
@@ -4523,15 +4795,32 @@ var handleSveltePageRequest = async (input) => {
|
|
|
4523
4795
|
const resolvedOptions = input;
|
|
4524
4796
|
const resolvedPagePath = input.pagePath;
|
|
4525
4797
|
const userProps = input.props;
|
|
4526
|
-
const
|
|
4527
|
-
const
|
|
4798
|
+
const request = input.request ?? getCurrentAbsoluteRequest();
|
|
4799
|
+
const requestPathname = resolveRequestPathname(request);
|
|
4800
|
+
const resolvedProps = requestPathname !== undefined && (!isRecord3(userProps) || !("url" in userProps)) ? {
|
|
4528
4801
|
...userProps ?? {},
|
|
4529
4802
|
url: requestPathname
|
|
4530
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;
|
|
4531
4820
|
try {
|
|
4532
|
-
const spaNotFound = await renderSpaNotFound("svelte", derivePageName(resolvedPagePath),
|
|
4821
|
+
const spaNotFound = await renderSpaNotFound("svelte", derivePageName(resolvedPagePath), request);
|
|
4533
4822
|
if (spaNotFound)
|
|
4534
|
-
return withPageCacheHeaders(spaNotFound,
|
|
4823
|
+
return withPageCacheHeaders(spaNotFound, request);
|
|
4535
4824
|
const handlerCallsite = resolvedOptions?.collectStreamingSlots === true ? undefined : getCurrentRouteRegistrationCallsite() ?? captureStreamingSlotWarningCallsite();
|
|
4536
4825
|
const renderPageResponse = async () => {
|
|
4537
4826
|
const resolvePageComponent = async () => {
|
|
@@ -4582,7 +4871,7 @@ var handleSveltePageRequest = async (input) => {
|
|
|
4582
4871
|
...resolvedOptions,
|
|
4583
4872
|
runtimePlacement: resolvedOptions.runtimePlacement ?? "body"
|
|
4584
4873
|
}) : renderPageResponse(), { handlerCallsite });
|
|
4585
|
-
return withPageCacheHeaders(pageResponse,
|
|
4874
|
+
return withPageCacheHeaders(pageResponse, request, {
|
|
4586
4875
|
bufferStreamForEtag: input.bufferStreamForEtag
|
|
4587
4876
|
});
|
|
4588
4877
|
} catch (error) {
|
|
@@ -4590,12 +4879,12 @@ var handleSveltePageRequest = async (input) => {
|
|
|
4590
4879
|
const pageName = derivePageName(resolvedPagePath);
|
|
4591
4880
|
const conventionResponse = await renderConventionError("svelte", pageName, error);
|
|
4592
4881
|
if (conventionResponse) {
|
|
4593
|
-
return withPageCacheHeaders(conventionResponse,
|
|
4882
|
+
return withPageCacheHeaders(conventionResponse, request);
|
|
4594
4883
|
}
|
|
4595
4884
|
return withPageCacheHeaders(new Response(ssrErrorPage("svelte", error), {
|
|
4596
4885
|
headers: { "Content-Type": "text/html" },
|
|
4597
4886
|
status: 500
|
|
4598
|
-
}),
|
|
4887
|
+
}), request);
|
|
4599
4888
|
}
|
|
4600
4889
|
};
|
|
4601
4890
|
// src/svelte/createIsland.ts
|
|
@@ -4739,5 +5028,5 @@ export {
|
|
|
4739
5028
|
createTypedIsland
|
|
4740
5029
|
};
|
|
4741
5030
|
|
|
4742
|
-
//# debugId=
|
|
5031
|
+
//# debugId=505E54839FC4D87364756E2164756E21
|
|
4743
5032
|
//# sourceMappingURL=index.js.map
|