@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/server.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
|
}
|
|
@@ -2848,6 +2848,278 @@ var setCurrentIslandManifest = (manifest) => {
|
|
|
2848
2848
|
|
|
2849
2849
|
// src/svelte/pageHandler.ts
|
|
2850
2850
|
init_devRouteRegistrationCallsite();
|
|
2851
|
+
|
|
2852
|
+
// src/core/requestContext.ts
|
|
2853
|
+
import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
|
|
2854
|
+
import { Elysia as Elysia2 } from "elysia";
|
|
2855
|
+
var REQUEST_STORAGE_KEY = Symbol.for("absolutejs.requestAsyncLocalStorage");
|
|
2856
|
+
var isAbsoluteRequestStorage = (value) => typeof value === "object" && value !== null && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
|
|
2857
|
+
var getRequestStorage = () => {
|
|
2858
|
+
const value = Reflect.get(globalThis, REQUEST_STORAGE_KEY);
|
|
2859
|
+
return isAbsoluteRequestStorage(value) ? value : undefined;
|
|
2860
|
+
};
|
|
2861
|
+
var ensureRequestStorage = () => {
|
|
2862
|
+
const existing = getRequestStorage();
|
|
2863
|
+
if (existing)
|
|
2864
|
+
return existing;
|
|
2865
|
+
const storage = new AsyncLocalStorage2;
|
|
2866
|
+
Reflect.set(globalThis, REQUEST_STORAGE_KEY, storage);
|
|
2867
|
+
return storage;
|
|
2868
|
+
};
|
|
2869
|
+
var absoluteRequestContext = new Elysia2({
|
|
2870
|
+
name: "absolutejs-request-context"
|
|
2871
|
+
}).request(({ request }) => {
|
|
2872
|
+
ensureRequestStorage().enterWith({ request });
|
|
2873
|
+
}).as("global");
|
|
2874
|
+
var getCurrentAbsoluteRequest = () => getRequestStorage()?.getStore()?.request;
|
|
2875
|
+
var runWithAbsoluteRequest = (request, callback) => ensureRequestStorage().run({ request }, callback);
|
|
2876
|
+
|
|
2877
|
+
// src/mobile/producerContextState.ts
|
|
2878
|
+
var ABSOLUTE_MOBILE_PRODUCER_STORAGE_KEY = Symbol.for("absolutejs.mobileProducerAsyncLocalStorage");
|
|
2879
|
+
var frameworks = new Set([
|
|
2880
|
+
"angular",
|
|
2881
|
+
"ember",
|
|
2882
|
+
"html",
|
|
2883
|
+
"htmx",
|
|
2884
|
+
"react",
|
|
2885
|
+
"svelte",
|
|
2886
|
+
"vue"
|
|
2887
|
+
]);
|
|
2888
|
+
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";
|
|
2889
|
+
var getCurrentAbsoluteMobileProducerContext = () => {
|
|
2890
|
+
const value = Reflect.get(globalThis, ABSOLUTE_MOBILE_PRODUCER_STORAGE_KEY);
|
|
2891
|
+
if (typeof value !== "object" || value === null || !("getStore" in value) || typeof value.getStore !== "function") {
|
|
2892
|
+
return;
|
|
2893
|
+
}
|
|
2894
|
+
const context = value.getStore();
|
|
2895
|
+
if (typeof context !== "object" || context === null || !("page" in context) || !isCompatibilityPage(context.page) || !("releaseId" in context) || typeof context.releaseId !== "string") {
|
|
2896
|
+
return;
|
|
2897
|
+
}
|
|
2898
|
+
return { page: context.page, releaseId: context.releaseId };
|
|
2899
|
+
};
|
|
2900
|
+
|
|
2901
|
+
// src/mobile/pageProtocol.ts
|
|
2902
|
+
var ABSOLUTE_MOBILE_PAGE_MEDIA_TYPE = "application/vnd.absolute.page+json";
|
|
2903
|
+
var ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION = 1;
|
|
2904
|
+
var BAD_REQUEST_STATUS = 400;
|
|
2905
|
+
var OK_STATUS = 200;
|
|
2906
|
+
var SERVER_ERROR_STATUS = 500;
|
|
2907
|
+
var UPGRADE_REQUIRED_STATUS = 426;
|
|
2908
|
+
var MOBILE_PAGE_REQUEST_HEADERS = {
|
|
2909
|
+
appBuild: "x-absolute-mobile-app-build",
|
|
2910
|
+
pageBundle: "x-absolute-mobile-page-bundle",
|
|
2911
|
+
pageContracts: "x-absolute-mobile-page-contracts",
|
|
2912
|
+
pageId: "x-absolute-mobile-page-id",
|
|
2913
|
+
protocol: "x-absolute-mobile-protocol",
|
|
2914
|
+
runtime: "x-absolute-mobile-runtime"
|
|
2915
|
+
};
|
|
2916
|
+
var parseMediaType = (value) => value.split(";", 1)[0]?.trim().toLowerCase();
|
|
2917
|
+
var acceptsAbsoluteMobilePage = (request) => {
|
|
2918
|
+
if (!request)
|
|
2919
|
+
return false;
|
|
2920
|
+
return (request.headers.get("accept") ?? "").split(",").some((value) => parseMediaType(value) === ABSOLUTE_MOBILE_PAGE_MEDIA_TYPE);
|
|
2921
|
+
};
|
|
2922
|
+
var readRequiredHeader = (request, name) => {
|
|
2923
|
+
const value = request.headers.get(name)?.trim();
|
|
2924
|
+
return value ? value : undefined;
|
|
2925
|
+
};
|
|
2926
|
+
var parseAbsoluteMobilePageRequest = (request) => {
|
|
2927
|
+
if (!request || !acceptsAbsoluteMobilePage(request)) {
|
|
2928
|
+
return { kind: "not-mobile" };
|
|
2929
|
+
}
|
|
2930
|
+
const protocolValue = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.protocol);
|
|
2931
|
+
const runtime = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.runtime);
|
|
2932
|
+
const appBuild = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.appBuild);
|
|
2933
|
+
const pageBundle = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.pageBundle);
|
|
2934
|
+
const pageContractsValue = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.pageContracts);
|
|
2935
|
+
const pageId = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.pageId);
|
|
2936
|
+
if (!protocolValue || !/^\d+$/.test(protocolValue)) {
|
|
2937
|
+
return {
|
|
2938
|
+
kind: "invalid",
|
|
2939
|
+
message: `Missing or invalid ${MOBILE_PAGE_REQUEST_HEADERS.protocol} header.`
|
|
2940
|
+
};
|
|
2941
|
+
}
|
|
2942
|
+
if (!runtime) {
|
|
2943
|
+
return {
|
|
2944
|
+
kind: "invalid",
|
|
2945
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.runtime} header.`
|
|
2946
|
+
};
|
|
2947
|
+
}
|
|
2948
|
+
if (!appBuild) {
|
|
2949
|
+
return {
|
|
2950
|
+
kind: "invalid",
|
|
2951
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.appBuild} header.`
|
|
2952
|
+
};
|
|
2953
|
+
}
|
|
2954
|
+
if (!pageBundle) {
|
|
2955
|
+
return {
|
|
2956
|
+
kind: "invalid",
|
|
2957
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.pageBundle} header.`
|
|
2958
|
+
};
|
|
2959
|
+
}
|
|
2960
|
+
if (!pageContractsValue) {
|
|
2961
|
+
return {
|
|
2962
|
+
kind: "invalid",
|
|
2963
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.pageContracts} header.`
|
|
2964
|
+
};
|
|
2965
|
+
}
|
|
2966
|
+
if (!pageId) {
|
|
2967
|
+
return {
|
|
2968
|
+
kind: "invalid",
|
|
2969
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.pageId} header.`
|
|
2970
|
+
};
|
|
2971
|
+
}
|
|
2972
|
+
const pageContracts = [
|
|
2973
|
+
...new Set(pageContractsValue.split(",").map((value) => value.trim()).filter(Boolean))
|
|
2974
|
+
];
|
|
2975
|
+
if (pageContracts.length === 0) {
|
|
2976
|
+
return {
|
|
2977
|
+
kind: "invalid",
|
|
2978
|
+
message: `${MOBILE_PAGE_REQUEST_HEADERS.pageContracts} must contain at least one contract.`
|
|
2979
|
+
};
|
|
2980
|
+
}
|
|
2981
|
+
return {
|
|
2982
|
+
client: {
|
|
2983
|
+
appBuild,
|
|
2984
|
+
pageBundle,
|
|
2985
|
+
pageContracts,
|
|
2986
|
+
pageId,
|
|
2987
|
+
protocol: Number(protocolValue),
|
|
2988
|
+
runtime
|
|
2989
|
+
},
|
|
2990
|
+
kind: "mobile"
|
|
2991
|
+
};
|
|
2992
|
+
};
|
|
2993
|
+
var responseHeaders = () => {
|
|
2994
|
+
const headers = new Headers({
|
|
2995
|
+
"cache-control": "no-store",
|
|
2996
|
+
"content-type": `${ABSOLUTE_MOBILE_PAGE_MEDIA_TYPE}; version=${ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION}`
|
|
2997
|
+
});
|
|
2998
|
+
headerVaryValues.forEach((value) => headers.append("vary", value));
|
|
2999
|
+
return headers;
|
|
3000
|
+
};
|
|
3001
|
+
var headerVaryValues = [
|
|
3002
|
+
"Accept",
|
|
3003
|
+
MOBILE_PAGE_REQUEST_HEADERS.protocol,
|
|
3004
|
+
MOBILE_PAGE_REQUEST_HEADERS.runtime,
|
|
3005
|
+
MOBILE_PAGE_REQUEST_HEADERS.appBuild,
|
|
3006
|
+
MOBILE_PAGE_REQUEST_HEADERS.pageBundle,
|
|
3007
|
+
MOBILE_PAGE_REQUEST_HEADERS.pageContracts,
|
|
3008
|
+
MOBILE_PAGE_REQUEST_HEADERS.pageId
|
|
3009
|
+
];
|
|
3010
|
+
var envelopeResponse = (response, status) => new Response(JSON.stringify({
|
|
3011
|
+
protocol: ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION,
|
|
3012
|
+
response
|
|
3013
|
+
}), { headers: responseHeaders(), status });
|
|
3014
|
+
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3015
|
+
var normalizeJsonValue = (value) => {
|
|
3016
|
+
const serialized = JSON.stringify(value);
|
|
3017
|
+
if (serialized === undefined) {
|
|
3018
|
+
throw new TypeError("Mobile page props must be JSON-serializable.");
|
|
3019
|
+
}
|
|
3020
|
+
const parsed = JSON.parse(serialized);
|
|
3021
|
+
if (!isRecord(parsed)) {
|
|
3022
|
+
throw new TypeError("Mobile page props must serialize to an object.");
|
|
3023
|
+
}
|
|
3024
|
+
return parsed;
|
|
3025
|
+
};
|
|
3026
|
+
var finalizeArchivedMobilePage = (context, input) => {
|
|
3027
|
+
const { page } = context;
|
|
3028
|
+
if (page.pageId !== input.compatibility.pageId || page.framework !== input.compatibility.framework) {
|
|
3029
|
+
return envelopeResponse({
|
|
3030
|
+
kind: "invalid-request",
|
|
3031
|
+
message: "Archived producer page identity does not match its release artifact."
|
|
3032
|
+
}, BAD_REQUEST_STATUS);
|
|
3033
|
+
}
|
|
3034
|
+
try {
|
|
3035
|
+
const [currentRepresentation] = input.compatibility.representations;
|
|
3036
|
+
if (!currentRepresentation) {
|
|
3037
|
+
throw new TypeError("Mobile page has no current representation.");
|
|
3038
|
+
}
|
|
3039
|
+
return envelopeResponse({
|
|
3040
|
+
contract: page.contract,
|
|
3041
|
+
framework: page.framework,
|
|
3042
|
+
kind: "page",
|
|
3043
|
+
pageId: page.pageId,
|
|
3044
|
+
props: normalizeJsonValue(currentRepresentation.mapProps(input.props)),
|
|
3045
|
+
status: input.status ?? OK_STATUS
|
|
3046
|
+
}, input.status ?? OK_STATUS);
|
|
3047
|
+
} catch (error) {
|
|
3048
|
+
console.error(`[Mobile] Archived producer ${context.releaseId} failed for ${page.pageId}:`, error);
|
|
3049
|
+
return createAbsoluteMobilePageErrorResponse(page.pageId);
|
|
3050
|
+
}
|
|
3051
|
+
};
|
|
3052
|
+
var createAbsoluteMobileInvalidRequestResponse = (message) => envelopeResponse({ kind: "invalid-request", message }, BAD_REQUEST_STATUS);
|
|
3053
|
+
var createAbsoluteMobilePageErrorResponse = (pageId) => envelopeResponse({
|
|
3054
|
+
code: "representation-failed",
|
|
3055
|
+
kind: "error",
|
|
3056
|
+
pageId,
|
|
3057
|
+
status: SERVER_ERROR_STATUS
|
|
3058
|
+
}, SERVER_ERROR_STATUS);
|
|
3059
|
+
var createAbsoluteMobileUpgradeResponse = (result) => envelopeResponse(result, UPGRADE_REQUIRED_STATUS);
|
|
3060
|
+
var finalizeAbsoluteMobilePage = (input) => {
|
|
3061
|
+
const parsed = parseAbsoluteMobilePageRequest(input.request);
|
|
3062
|
+
if (parsed.kind === "not-mobile")
|
|
3063
|
+
return;
|
|
3064
|
+
if (parsed.kind === "invalid") {
|
|
3065
|
+
return envelopeResponse({ kind: "invalid-request", message: parsed.message }, BAD_REQUEST_STATUS);
|
|
3066
|
+
}
|
|
3067
|
+
const { client } = parsed;
|
|
3068
|
+
if (client.pageId !== input.compatibility.pageId) {
|
|
3069
|
+
return envelopeResponse({
|
|
3070
|
+
kind: "invalid-request",
|
|
3071
|
+
message: `Requested mobile page ${client.pageId} does not match ${input.compatibility.pageId}.`
|
|
3072
|
+
}, BAD_REQUEST_STATUS);
|
|
3073
|
+
}
|
|
3074
|
+
const producerContext = getCurrentAbsoluteMobileProducerContext();
|
|
3075
|
+
if (producerContext)
|
|
3076
|
+
return finalizeArchivedMobilePage(producerContext, input);
|
|
3077
|
+
if (client.protocol !== ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION) {
|
|
3078
|
+
return envelopeResponse({
|
|
3079
|
+
kind: "upgrade-required",
|
|
3080
|
+
pageId: input.compatibility.pageId,
|
|
3081
|
+
reason: "protocol"
|
|
3082
|
+
}, UPGRADE_REQUIRED_STATUS);
|
|
3083
|
+
}
|
|
3084
|
+
if (!input.compatibility.runtimes.includes(client.runtime)) {
|
|
3085
|
+
return envelopeResponse({
|
|
3086
|
+
kind: "upgrade-required",
|
|
3087
|
+
pageId: input.compatibility.pageId,
|
|
3088
|
+
reason: "runtime",
|
|
3089
|
+
supportedRuntimes: [...input.compatibility.runtimes]
|
|
3090
|
+
}, UPGRADE_REQUIRED_STATUS);
|
|
3091
|
+
}
|
|
3092
|
+
const clientContracts = new Set(client.pageContracts);
|
|
3093
|
+
const representation = input.compatibility.representations.find(({ contract }) => clientContracts.has(contract));
|
|
3094
|
+
if (!representation) {
|
|
3095
|
+
return envelopeResponse({
|
|
3096
|
+
kind: "upgrade-required",
|
|
3097
|
+
pageId: input.compatibility.pageId,
|
|
3098
|
+
reason: "page-contract",
|
|
3099
|
+
supportedContracts: input.compatibility.representations.map(({ contract }) => contract)
|
|
3100
|
+
}, UPGRADE_REQUIRED_STATUS);
|
|
3101
|
+
}
|
|
3102
|
+
try {
|
|
3103
|
+
return envelopeResponse({
|
|
3104
|
+
contract: representation.contract,
|
|
3105
|
+
framework: input.compatibility.framework,
|
|
3106
|
+
kind: "page",
|
|
3107
|
+
pageId: input.compatibility.pageId,
|
|
3108
|
+
props: normalizeJsonValue(representation.mapProps(input.props)),
|
|
3109
|
+
status: input.status ?? OK_STATUS
|
|
3110
|
+
}, input.status ?? OK_STATUS);
|
|
3111
|
+
} catch (error) {
|
|
3112
|
+
console.error(`[Mobile] Failed to produce ${input.compatibility.pageId} representation ${representation.contract}:`, error);
|
|
3113
|
+
return envelopeResponse({
|
|
3114
|
+
code: "representation-failed",
|
|
3115
|
+
kind: "error",
|
|
3116
|
+
pageId: input.compatibility.pageId,
|
|
3117
|
+
status: SERVER_ERROR_STATUS
|
|
3118
|
+
}, SERVER_ERROR_STATUS);
|
|
3119
|
+
}
|
|
3120
|
+
};
|
|
3121
|
+
|
|
3122
|
+
// src/svelte/pageHandler.ts
|
|
2851
3123
|
init_pageResponseCache();
|
|
2852
3124
|
|
|
2853
3125
|
// src/core/responseEnhancers.ts
|
|
@@ -2904,7 +3176,7 @@ var withRegisteredStreamingSlots = async (renderResponse, options = {}) => {
|
|
|
2904
3176
|
|
|
2905
3177
|
// src/core/streamingSlotWarningScope.ts
|
|
2906
3178
|
init_logger();
|
|
2907
|
-
import { AsyncLocalStorage as
|
|
3179
|
+
import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
|
|
2908
3180
|
var STREAMING_SLOT_WARNING_STORAGE_KEY2 = Symbol.for("absolutejs.streamingSlotWarningAsyncLocalStorage");
|
|
2909
3181
|
var isObjectRecord4 = (value) => Boolean(value) && typeof value === "object";
|
|
2910
3182
|
var isAsyncLocalStorage3 = (value) => isObjectRecord4(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
|
|
@@ -2920,7 +3192,7 @@ var ensureWarningStorage = () => {
|
|
|
2920
3192
|
if (existing) {
|
|
2921
3193
|
return existing;
|
|
2922
3194
|
}
|
|
2923
|
-
const storage = new
|
|
3195
|
+
const storage = new AsyncLocalStorage3;
|
|
2924
3196
|
Reflect.set(globalThis, STREAMING_SLOT_WARNING_STORAGE_KEY2, storage);
|
|
2925
3197
|
return storage;
|
|
2926
3198
|
};
|
|
@@ -2964,15 +3236,15 @@ var runWithStreamingSlotWarningScope = (task, metadata) => ensureWarningStorage(
|
|
|
2964
3236
|
init_inlinePageCss();
|
|
2965
3237
|
init_spaRouteManifest();
|
|
2966
3238
|
init_resolveConvention();
|
|
2967
|
-
var
|
|
2968
|
-
var isGenericSvelteComponent = (value) => typeof value === "function" ||
|
|
3239
|
+
var isRecord3 = (value) => typeof value === "object" && value !== null;
|
|
3240
|
+
var isGenericSvelteComponent = (value) => typeof value === "function" || isRecord3(value);
|
|
2969
3241
|
var readHasIslands = (value) => {
|
|
2970
|
-
if (!
|
|
3242
|
+
if (!isRecord3(value))
|
|
2971
3243
|
return false;
|
|
2972
3244
|
const hasIslands = value["__ABSOLUTE_PAGE_HAS_ISLANDS__"];
|
|
2973
3245
|
return typeof hasIslands === "boolean" ? hasIslands : false;
|
|
2974
3246
|
};
|
|
2975
|
-
var readDefaultExport = (value) =>
|
|
3247
|
+
var readDefaultExport = (value) => isRecord3(value) ? value.default : undefined;
|
|
2976
3248
|
var primeSvelteStream = async (stream) => {
|
|
2977
3249
|
const reader = stream.getReader();
|
|
2978
3250
|
const firstChunk = await reader.read();
|
|
@@ -3007,15 +3279,32 @@ var handleSveltePageRequest = async (input) => {
|
|
|
3007
3279
|
const resolvedOptions = input;
|
|
3008
3280
|
const resolvedPagePath = input.pagePath;
|
|
3009
3281
|
const userProps = input.props;
|
|
3010
|
-
const
|
|
3011
|
-
const
|
|
3282
|
+
const request = input.request ?? getCurrentAbsoluteRequest();
|
|
3283
|
+
const requestPathname = resolveRequestPathname(request);
|
|
3284
|
+
const resolvedProps = requestPathname !== undefined && (!isRecord3(userProps) || !("url" in userProps)) ? {
|
|
3012
3285
|
...userProps ?? {},
|
|
3013
3286
|
url: requestPathname
|
|
3014
3287
|
} : userProps;
|
|
3288
|
+
const pageId = input.__absoluteMobile?.pageId ?? derivePageName(resolvedPagePath);
|
|
3289
|
+
const currentContract = input.__absoluteMobile?.contract ?? `svelte:${pageId}:${ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION}`;
|
|
3290
|
+
const mobileResponse = finalizeAbsoluteMobilePage({
|
|
3291
|
+
compatibility: {
|
|
3292
|
+
framework: "svelte",
|
|
3293
|
+
pageId,
|
|
3294
|
+
representations: [
|
|
3295
|
+
{ contract: currentContract, mapProps: (props) => props }
|
|
3296
|
+
],
|
|
3297
|
+
runtimes: [String(ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION)]
|
|
3298
|
+
},
|
|
3299
|
+
props: resolvedProps ?? Object.create(null),
|
|
3300
|
+
request
|
|
3301
|
+
});
|
|
3302
|
+
if (mobileResponse)
|
|
3303
|
+
return mobileResponse;
|
|
3015
3304
|
try {
|
|
3016
|
-
const spaNotFound = await renderSpaNotFound("svelte", derivePageName(resolvedPagePath),
|
|
3305
|
+
const spaNotFound = await renderSpaNotFound("svelte", derivePageName(resolvedPagePath), request);
|
|
3017
3306
|
if (spaNotFound)
|
|
3018
|
-
return withPageCacheHeaders(spaNotFound,
|
|
3307
|
+
return withPageCacheHeaders(spaNotFound, request);
|
|
3019
3308
|
const handlerCallsite = resolvedOptions?.collectStreamingSlots === true ? undefined : getCurrentRouteRegistrationCallsite() ?? captureStreamingSlotWarningCallsite();
|
|
3020
3309
|
const renderPageResponse = async () => {
|
|
3021
3310
|
const resolvePageComponent = async () => {
|
|
@@ -3066,7 +3355,7 @@ var handleSveltePageRequest = async (input) => {
|
|
|
3066
3355
|
...resolvedOptions,
|
|
3067
3356
|
runtimePlacement: resolvedOptions.runtimePlacement ?? "body"
|
|
3068
3357
|
}) : renderPageResponse(), { handlerCallsite });
|
|
3069
|
-
return withPageCacheHeaders(pageResponse,
|
|
3358
|
+
return withPageCacheHeaders(pageResponse, request, {
|
|
3070
3359
|
bufferStreamForEtag: input.bufferStreamForEtag
|
|
3071
3360
|
});
|
|
3072
3361
|
} catch (error) {
|
|
@@ -3074,17 +3363,17 @@ var handleSveltePageRequest = async (input) => {
|
|
|
3074
3363
|
const pageName = derivePageName(resolvedPagePath);
|
|
3075
3364
|
const conventionResponse = await renderConventionError("svelte", pageName, error);
|
|
3076
3365
|
if (conventionResponse) {
|
|
3077
|
-
return withPageCacheHeaders(conventionResponse,
|
|
3366
|
+
return withPageCacheHeaders(conventionResponse, request);
|
|
3078
3367
|
}
|
|
3079
3368
|
return withPageCacheHeaders(new Response(ssrErrorPage("svelte", error), {
|
|
3080
3369
|
headers: { "Content-Type": "text/html" },
|
|
3081
3370
|
status: 500
|
|
3082
|
-
}),
|
|
3371
|
+
}), request);
|
|
3083
3372
|
}
|
|
3084
3373
|
};
|
|
3085
3374
|
export {
|
|
3086
3375
|
handleSveltePageRequest
|
|
3087
3376
|
};
|
|
3088
3377
|
|
|
3089
|
-
//# debugId=
|
|
3378
|
+
//# debugId=11B3526360898D0764756E2164756E21
|
|
3090
3379
|
//# sourceMappingURL=server.js.map
|