@absolutejs/absolute 0.20.0-beta.4 → 0.20.0-beta.41
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 +203 -0
- package/dist/angular/browser.js +15 -1
- package/dist/angular/browser.js.map +3 -3
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +361 -30
- package/dist/angular/index.js.map +9 -6
- package/dist/angular/server.js +361 -30
- package/dist/angular/server.js.map +9 -6
- package/dist/build.js +2097 -1114
- package/dist/build.js.map +20 -16
- package/dist/cli/config/server.js +4 -0
- package/dist/cli/index.js +6986 -1561
- package/dist/dev/client/cssUtils.ts +16 -2
- package/dist/dev/client/handlers/rebuild.ts +11 -1
- package/dist/dev/client/hmrClient.ts +35 -3
- package/dist/dev/client/hmrTiming.ts +20 -7
- package/dist/dev/client/syncDevtools.ts +237 -0
- package/dist/dev/serverBootstrap.js +28 -0
- package/dist/index.js +2947 -1670
- package/dist/index.js.map +37 -31
- package/dist/mobile/browser.js +123 -1
- package/dist/mobile/browser.js.map +6 -4
- package/dist/mobile/index.js +4579 -375
- package/dist/mobile/index.js.map +39 -18
- package/dist/mobile/remoteMacAgentEntry.js +14 -14
- package/dist/mobile/shellAuth.js +36 -0
- package/dist/mobile/shellBootstrap.js +837 -0
- package/dist/mobile/shellExpoDevices.js +99 -0
- package/dist/mobile/shellSync.js +173 -0
- package/dist/react/index.js +5 -1
- package/dist/react/index.js.map +3 -3
- package/dist/react/server.js +5 -1
- package/dist/react/server.js.map +3 -3
- package/dist/src/angular/pageHandler.d.ts +3 -0
- package/dist/src/build/pwa.d.ts +16 -0
- package/dist/src/cli/config/server.d.ts +1 -1
- package/dist/src/cli/instanceStatus.d.ts +1 -0
- package/dist/src/cli/scripts/dev.d.ts +2 -0
- package/dist/src/core/devBuild.d.ts +1 -0
- package/dist/src/core/pageHandlers.d.ts +11 -2
- package/dist/src/core/prepare.d.ts +376 -0
- package/dist/src/dev/clientManager.d.ts +1 -0
- package/dist/src/dev/devCert.d.ts +6 -4
- package/dist/src/dev/serverEntryCopies.d.ts +3 -0
- package/dist/src/mobile/androidEmulatorController.d.ts +14 -2
- package/dist/src/mobile/androidRelease.d.ts +6 -0
- package/dist/src/mobile/androidTestReport.d.ts +14 -0
- package/dist/src/mobile/androidUpgradeConformance.d.ts +47 -0
- package/dist/src/mobile/androidWebView.d.ts +1 -0
- package/dist/src/mobile/browser.d.ts +1 -0
- package/dist/src/mobile/buildPipeline.d.ts +1 -0
- package/dist/src/mobile/capacitorBundle.d.ts +22 -1
- package/dist/src/mobile/ciWorkflow.d.ts +26 -0
- package/dist/src/mobile/client.d.ts +4 -0
- package/dist/src/mobile/config.d.ts +4 -1
- package/dist/src/mobile/devDeviceAdapter.d.ts +3 -0
- package/dist/src/mobile/deviceCapabilities.d.ts +46 -0
- package/dist/src/mobile/expoBridge.d.ts +91 -0
- package/dist/src/mobile/expoDevController.d.ts +49 -0
- package/dist/src/mobile/expoProject.d.ts +16 -0
- package/dist/src/mobile/index.d.ts +14 -0
- package/dist/src/mobile/iosDeviceAcceptance.d.ts +32 -0
- package/dist/src/mobile/iosPhysicalDeviceTransport.d.ts +16 -0
- package/dist/src/mobile/iosRelease.d.ts +4 -1
- package/dist/src/mobile/iosSimulatorController.d.ts +20 -2
- package/dist/src/mobile/iosTestReport.d.ts +24 -0
- package/dist/src/mobile/mobileBundleInspection.d.ts +55 -0
- package/dist/src/mobile/mobileInspect.d.ts +136 -0
- package/dist/src/mobile/mobilePreview.d.ts +174 -0
- package/dist/src/mobile/mobilePreviewClient.d.ts +1 -0
- package/dist/src/mobile/nativeAuth.d.ts +17 -0
- package/dist/src/mobile/nativeBackgroundSync.d.ts +4 -0
- package/dist/src/mobile/nativeDeviceCapabilities.d.ts +6 -0
- package/dist/src/mobile/nativeTestReport.d.ts +91 -0
- package/dist/src/mobile/releaseArtifact.d.ts +2 -0
- package/dist/src/mobile/releaseDoctor.d.ts +23 -1
- package/dist/src/mobile/remoteMacProtocol.d.ts +11 -0
- package/dist/src/mobile/shellAuth.d.ts +15 -0
- package/dist/src/mobile/shellBootstrap.d.ts +23 -1
- package/dist/src/mobile/shellExpoDevices.d.ts +3 -0
- package/dist/src/mobile/shellHttp.d.ts +2 -0
- package/dist/src/mobile/shellPush.d.ts +11 -0
- package/dist/src/mobile/shellSync.d.ts +47 -0
- package/dist/src/mobile/staticDocument.d.ts +5 -0
- package/dist/src/mobile/syncRemediation.d.ts +10 -0
- package/dist/src/mobile/syncSchema.d.ts +9 -0
- package/dist/src/mobile/transport.d.ts +16 -1
- 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/svelte/pageHandler.d.ts +3 -0
- package/dist/src/utils/imageProcessing.d.ts +3 -0
- package/dist/src/utils/loadConfig.d.ts +1 -0
- package/dist/src/utils/logger.d.ts +1 -0
- package/dist/src/utils/startupBanner.d.ts +1 -0
- package/dist/src/utils/userAgentFunctions.d.ts +1 -1
- package/dist/src/vue/pageHandler.d.ts +3 -0
- package/dist/svelte/index.js +316 -23
- package/dist/svelte/index.js.map +8 -5
- package/dist/svelte/server.js +311 -18
- package/dist/svelte/server.js.map +8 -5
- package/dist/types/build.d.ts +50 -3
- package/dist/types/cli.d.ts +1 -0
- package/dist/types/messages.d.ts +1 -1
- package/dist/vue/index.js +316 -23
- package/dist/vue/index.js.map +8 -5
- package/dist/vue/server.js +311 -18
- package/dist/vue/server.js.map +8 -5
- package/package.json +41 -11
package/dist/vue/server.js
CHANGED
|
@@ -829,7 +829,7 @@ var SLOT_ID_PREFIX = "abs-slot-", CLOSING_BODY_TAG = "</body>", CLOSING_HEAD_TAG
|
|
|
829
829
|
getStreamingSlotsRuntimeScript()
|
|
830
830
|
].filter(Boolean).join(";");
|
|
831
831
|
return `<script${createNonceAttr(nonce)}>${escapeScriptContent(runtimeBody)}</script>`;
|
|
832
|
-
}, toUint8 = (value, encoder) => encoder.encode(value),
|
|
832
|
+
}, toUint8 = (value, encoder) => encoder.encode(value), isRecord2 = (value) => Boolean(value) && typeof value === "object", isSafeHtmlLike = (value) => isRecord2(value) && typeof value.changingThisBreaksApplicationSecurity === "string", normalizeSafeHtml = (value) => {
|
|
833
833
|
if (isSafeHtmlLike(value)) {
|
|
834
834
|
return value.changingThisBreaksApplicationSecurity;
|
|
835
835
|
}
|
|
@@ -890,7 +890,7 @@ var SLOT_ID_PREFIX = "abs-slot-", CLOSING_BODY_TAG = "</body>", CLOSING_HEAD_TAG
|
|
|
890
890
|
}, createTimeoutError = (slot, timeoutMs) => {
|
|
891
891
|
const error = Object.assign(new Error(`Streaming slot "${slot.id}" timed out after ${timeoutMs}ms`), { __absTimeout: true });
|
|
892
892
|
return error;
|
|
893
|
-
}, isSlotPatchPayloadObject = (value) =>
|
|
893
|
+
}, isSlotPatchPayloadObject = (value) => isRecord2(value) && ("html" in value), isTimeoutError = (error) => isRecord2(error) && error.__absTimeout === true, toStreamingSlot = (slot, policy) => ({
|
|
894
894
|
errorHtml: slot.errorHtml === undefined ? policy.errorHtml : slot.errorHtml,
|
|
895
895
|
fallbackHtml: normalizeSlotText(slot.fallbackHtml, policy.fallbackHtml),
|
|
896
896
|
id: slot.id ?? createStreamingSlotId(),
|
|
@@ -1402,6 +1402,7 @@ var colors, MONTHS, formatTimestamp = () => {
|
|
|
1402
1402
|
port,
|
|
1403
1403
|
host,
|
|
1404
1404
|
networkUrl,
|
|
1405
|
+
mobilePreviewUrl,
|
|
1405
1406
|
protocol = "http"
|
|
1406
1407
|
} = options;
|
|
1407
1408
|
const name = `${colors.cyan}${colors.bold}ABSOLUTEJS${colors.reset}`;
|
|
@@ -1415,6 +1416,9 @@ var colors, MONTHS, formatTimestamp = () => {
|
|
|
1415
1416
|
if (networkUrl) {
|
|
1416
1417
|
console.log(` ${colors.green}\u279C${colors.reset} ${colors.bold}Network:${colors.reset} ${networkUrl}`);
|
|
1417
1418
|
}
|
|
1419
|
+
if (mobilePreviewUrl) {
|
|
1420
|
+
console.log(` ${colors.green}\u279C${colors.reset} ${colors.bold}Mobile:${colors.reset} ${mobilePreviewUrl}`);
|
|
1421
|
+
}
|
|
1418
1422
|
console.log("");
|
|
1419
1423
|
};
|
|
1420
1424
|
var init_startupBanner = __esm(() => {
|
|
@@ -2039,6 +2043,278 @@ var setCurrentIslandManifest = (manifest) => {
|
|
|
2039
2043
|
|
|
2040
2044
|
// src/vue/pageHandler.ts
|
|
2041
2045
|
init_devRouteRegistrationCallsite();
|
|
2046
|
+
|
|
2047
|
+
// src/core/requestContext.ts
|
|
2048
|
+
import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
|
|
2049
|
+
import { Elysia as Elysia2 } from "elysia";
|
|
2050
|
+
var REQUEST_STORAGE_KEY = Symbol.for("absolutejs.requestAsyncLocalStorage");
|
|
2051
|
+
var isAbsoluteRequestStorage = (value) => typeof value === "object" && value !== null && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
|
|
2052
|
+
var getRequestStorage = () => {
|
|
2053
|
+
const value = Reflect.get(globalThis, REQUEST_STORAGE_KEY);
|
|
2054
|
+
return isAbsoluteRequestStorage(value) ? value : undefined;
|
|
2055
|
+
};
|
|
2056
|
+
var ensureRequestStorage = () => {
|
|
2057
|
+
const existing = getRequestStorage();
|
|
2058
|
+
if (existing)
|
|
2059
|
+
return existing;
|
|
2060
|
+
const storage = new AsyncLocalStorage2;
|
|
2061
|
+
Reflect.set(globalThis, REQUEST_STORAGE_KEY, storage);
|
|
2062
|
+
return storage;
|
|
2063
|
+
};
|
|
2064
|
+
var absoluteRequestContext = new Elysia2({
|
|
2065
|
+
name: "absolutejs-request-context"
|
|
2066
|
+
}).request(({ request }) => {
|
|
2067
|
+
ensureRequestStorage().enterWith({ request });
|
|
2068
|
+
}).as("global");
|
|
2069
|
+
var getCurrentAbsoluteRequest = () => getRequestStorage()?.getStore()?.request;
|
|
2070
|
+
var runWithAbsoluteRequest = (request, callback) => ensureRequestStorage().run({ request }, callback);
|
|
2071
|
+
|
|
2072
|
+
// src/mobile/producerContextState.ts
|
|
2073
|
+
var ABSOLUTE_MOBILE_PRODUCER_STORAGE_KEY = Symbol.for("absolutejs.mobileProducerAsyncLocalStorage");
|
|
2074
|
+
var frameworks = new Set([
|
|
2075
|
+
"angular",
|
|
2076
|
+
"ember",
|
|
2077
|
+
"html",
|
|
2078
|
+
"htmx",
|
|
2079
|
+
"react",
|
|
2080
|
+
"svelte",
|
|
2081
|
+
"vue"
|
|
2082
|
+
]);
|
|
2083
|
+
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";
|
|
2084
|
+
var getCurrentAbsoluteMobileProducerContext = () => {
|
|
2085
|
+
const value = Reflect.get(globalThis, ABSOLUTE_MOBILE_PRODUCER_STORAGE_KEY);
|
|
2086
|
+
if (typeof value !== "object" || value === null || !("getStore" in value) || typeof value.getStore !== "function") {
|
|
2087
|
+
return;
|
|
2088
|
+
}
|
|
2089
|
+
const context = value.getStore();
|
|
2090
|
+
if (typeof context !== "object" || context === null || !("page" in context) || !isCompatibilityPage(context.page) || !("releaseId" in context) || typeof context.releaseId !== "string") {
|
|
2091
|
+
return;
|
|
2092
|
+
}
|
|
2093
|
+
return { page: context.page, releaseId: context.releaseId };
|
|
2094
|
+
};
|
|
2095
|
+
|
|
2096
|
+
// src/mobile/pageProtocol.ts
|
|
2097
|
+
var ABSOLUTE_MOBILE_PAGE_MEDIA_TYPE = "application/vnd.absolute.page+json";
|
|
2098
|
+
var ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION = 1;
|
|
2099
|
+
var BAD_REQUEST_STATUS = 400;
|
|
2100
|
+
var OK_STATUS = 200;
|
|
2101
|
+
var SERVER_ERROR_STATUS = 500;
|
|
2102
|
+
var UPGRADE_REQUIRED_STATUS = 426;
|
|
2103
|
+
var MOBILE_PAGE_REQUEST_HEADERS = {
|
|
2104
|
+
appBuild: "x-absolute-mobile-app-build",
|
|
2105
|
+
pageBundle: "x-absolute-mobile-page-bundle",
|
|
2106
|
+
pageContracts: "x-absolute-mobile-page-contracts",
|
|
2107
|
+
pageId: "x-absolute-mobile-page-id",
|
|
2108
|
+
protocol: "x-absolute-mobile-protocol",
|
|
2109
|
+
runtime: "x-absolute-mobile-runtime"
|
|
2110
|
+
};
|
|
2111
|
+
var parseMediaType = (value) => value.split(";", 1)[0]?.trim().toLowerCase();
|
|
2112
|
+
var acceptsAbsoluteMobilePage = (request) => {
|
|
2113
|
+
if (!request)
|
|
2114
|
+
return false;
|
|
2115
|
+
return (request.headers.get("accept") ?? "").split(",").some((value) => parseMediaType(value) === ABSOLUTE_MOBILE_PAGE_MEDIA_TYPE);
|
|
2116
|
+
};
|
|
2117
|
+
var readRequiredHeader = (request, name) => {
|
|
2118
|
+
const value = request.headers.get(name)?.trim();
|
|
2119
|
+
return value ? value : undefined;
|
|
2120
|
+
};
|
|
2121
|
+
var parseAbsoluteMobilePageRequest = (request) => {
|
|
2122
|
+
if (!request || !acceptsAbsoluteMobilePage(request)) {
|
|
2123
|
+
return { kind: "not-mobile" };
|
|
2124
|
+
}
|
|
2125
|
+
const protocolValue = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.protocol);
|
|
2126
|
+
const runtime = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.runtime);
|
|
2127
|
+
const appBuild = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.appBuild);
|
|
2128
|
+
const pageBundle = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.pageBundle);
|
|
2129
|
+
const pageContractsValue = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.pageContracts);
|
|
2130
|
+
const pageId = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.pageId);
|
|
2131
|
+
if (!protocolValue || !/^\d+$/.test(protocolValue)) {
|
|
2132
|
+
return {
|
|
2133
|
+
kind: "invalid",
|
|
2134
|
+
message: `Missing or invalid ${MOBILE_PAGE_REQUEST_HEADERS.protocol} header.`
|
|
2135
|
+
};
|
|
2136
|
+
}
|
|
2137
|
+
if (!runtime) {
|
|
2138
|
+
return {
|
|
2139
|
+
kind: "invalid",
|
|
2140
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.runtime} header.`
|
|
2141
|
+
};
|
|
2142
|
+
}
|
|
2143
|
+
if (!appBuild) {
|
|
2144
|
+
return {
|
|
2145
|
+
kind: "invalid",
|
|
2146
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.appBuild} header.`
|
|
2147
|
+
};
|
|
2148
|
+
}
|
|
2149
|
+
if (!pageBundle) {
|
|
2150
|
+
return {
|
|
2151
|
+
kind: "invalid",
|
|
2152
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.pageBundle} header.`
|
|
2153
|
+
};
|
|
2154
|
+
}
|
|
2155
|
+
if (!pageContractsValue) {
|
|
2156
|
+
return {
|
|
2157
|
+
kind: "invalid",
|
|
2158
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.pageContracts} header.`
|
|
2159
|
+
};
|
|
2160
|
+
}
|
|
2161
|
+
if (!pageId) {
|
|
2162
|
+
return {
|
|
2163
|
+
kind: "invalid",
|
|
2164
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.pageId} header.`
|
|
2165
|
+
};
|
|
2166
|
+
}
|
|
2167
|
+
const pageContracts = [
|
|
2168
|
+
...new Set(pageContractsValue.split(",").map((value) => value.trim()).filter(Boolean))
|
|
2169
|
+
];
|
|
2170
|
+
if (pageContracts.length === 0) {
|
|
2171
|
+
return {
|
|
2172
|
+
kind: "invalid",
|
|
2173
|
+
message: `${MOBILE_PAGE_REQUEST_HEADERS.pageContracts} must contain at least one contract.`
|
|
2174
|
+
};
|
|
2175
|
+
}
|
|
2176
|
+
return {
|
|
2177
|
+
client: {
|
|
2178
|
+
appBuild,
|
|
2179
|
+
pageBundle,
|
|
2180
|
+
pageContracts,
|
|
2181
|
+
pageId,
|
|
2182
|
+
protocol: Number(protocolValue),
|
|
2183
|
+
runtime
|
|
2184
|
+
},
|
|
2185
|
+
kind: "mobile"
|
|
2186
|
+
};
|
|
2187
|
+
};
|
|
2188
|
+
var responseHeaders = () => {
|
|
2189
|
+
const headers = new Headers({
|
|
2190
|
+
"cache-control": "no-store",
|
|
2191
|
+
"content-type": `${ABSOLUTE_MOBILE_PAGE_MEDIA_TYPE}; version=${ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION}`
|
|
2192
|
+
});
|
|
2193
|
+
headerVaryValues.forEach((value) => headers.append("vary", value));
|
|
2194
|
+
return headers;
|
|
2195
|
+
};
|
|
2196
|
+
var headerVaryValues = [
|
|
2197
|
+
"Accept",
|
|
2198
|
+
MOBILE_PAGE_REQUEST_HEADERS.protocol,
|
|
2199
|
+
MOBILE_PAGE_REQUEST_HEADERS.runtime,
|
|
2200
|
+
MOBILE_PAGE_REQUEST_HEADERS.appBuild,
|
|
2201
|
+
MOBILE_PAGE_REQUEST_HEADERS.pageBundle,
|
|
2202
|
+
MOBILE_PAGE_REQUEST_HEADERS.pageContracts,
|
|
2203
|
+
MOBILE_PAGE_REQUEST_HEADERS.pageId
|
|
2204
|
+
];
|
|
2205
|
+
var envelopeResponse = (response, status) => new Response(JSON.stringify({
|
|
2206
|
+
protocol: ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION,
|
|
2207
|
+
response
|
|
2208
|
+
}), { headers: responseHeaders(), status });
|
|
2209
|
+
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2210
|
+
var normalizeJsonValue = (value) => {
|
|
2211
|
+
const serialized = JSON.stringify(value);
|
|
2212
|
+
if (serialized === undefined) {
|
|
2213
|
+
throw new TypeError("Mobile page props must be JSON-serializable.");
|
|
2214
|
+
}
|
|
2215
|
+
const parsed = JSON.parse(serialized);
|
|
2216
|
+
if (!isRecord(parsed)) {
|
|
2217
|
+
throw new TypeError("Mobile page props must serialize to an object.");
|
|
2218
|
+
}
|
|
2219
|
+
return parsed;
|
|
2220
|
+
};
|
|
2221
|
+
var finalizeArchivedMobilePage = (context, input) => {
|
|
2222
|
+
const { page } = context;
|
|
2223
|
+
if (page.pageId !== input.compatibility.pageId || page.framework !== input.compatibility.framework) {
|
|
2224
|
+
return envelopeResponse({
|
|
2225
|
+
kind: "invalid-request",
|
|
2226
|
+
message: "Archived producer page identity does not match its release artifact."
|
|
2227
|
+
}, BAD_REQUEST_STATUS);
|
|
2228
|
+
}
|
|
2229
|
+
try {
|
|
2230
|
+
const [currentRepresentation] = input.compatibility.representations;
|
|
2231
|
+
if (!currentRepresentation) {
|
|
2232
|
+
throw new TypeError("Mobile page has no current representation.");
|
|
2233
|
+
}
|
|
2234
|
+
return envelopeResponse({
|
|
2235
|
+
contract: page.contract,
|
|
2236
|
+
framework: page.framework,
|
|
2237
|
+
kind: "page",
|
|
2238
|
+
pageId: page.pageId,
|
|
2239
|
+
props: normalizeJsonValue(currentRepresentation.mapProps(input.props)),
|
|
2240
|
+
status: input.status ?? OK_STATUS
|
|
2241
|
+
}, input.status ?? OK_STATUS);
|
|
2242
|
+
} catch (error) {
|
|
2243
|
+
console.error(`[Mobile] Archived producer ${context.releaseId} failed for ${page.pageId}:`, error);
|
|
2244
|
+
return createAbsoluteMobilePageErrorResponse(page.pageId);
|
|
2245
|
+
}
|
|
2246
|
+
};
|
|
2247
|
+
var createAbsoluteMobileInvalidRequestResponse = (message) => envelopeResponse({ kind: "invalid-request", message }, BAD_REQUEST_STATUS);
|
|
2248
|
+
var createAbsoluteMobilePageErrorResponse = (pageId) => envelopeResponse({
|
|
2249
|
+
code: "representation-failed",
|
|
2250
|
+
kind: "error",
|
|
2251
|
+
pageId,
|
|
2252
|
+
status: SERVER_ERROR_STATUS
|
|
2253
|
+
}, SERVER_ERROR_STATUS);
|
|
2254
|
+
var createAbsoluteMobileUpgradeResponse = (result) => envelopeResponse(result, UPGRADE_REQUIRED_STATUS);
|
|
2255
|
+
var finalizeAbsoluteMobilePage = (input) => {
|
|
2256
|
+
const parsed = parseAbsoluteMobilePageRequest(input.request);
|
|
2257
|
+
if (parsed.kind === "not-mobile")
|
|
2258
|
+
return;
|
|
2259
|
+
if (parsed.kind === "invalid") {
|
|
2260
|
+
return envelopeResponse({ kind: "invalid-request", message: parsed.message }, BAD_REQUEST_STATUS);
|
|
2261
|
+
}
|
|
2262
|
+
const { client } = parsed;
|
|
2263
|
+
if (client.pageId !== input.compatibility.pageId) {
|
|
2264
|
+
return envelopeResponse({
|
|
2265
|
+
kind: "invalid-request",
|
|
2266
|
+
message: `Requested mobile page ${client.pageId} does not match ${input.compatibility.pageId}.`
|
|
2267
|
+
}, BAD_REQUEST_STATUS);
|
|
2268
|
+
}
|
|
2269
|
+
const producerContext = getCurrentAbsoluteMobileProducerContext();
|
|
2270
|
+
if (producerContext)
|
|
2271
|
+
return finalizeArchivedMobilePage(producerContext, input);
|
|
2272
|
+
if (client.protocol !== ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION) {
|
|
2273
|
+
return envelopeResponse({
|
|
2274
|
+
kind: "upgrade-required",
|
|
2275
|
+
pageId: input.compatibility.pageId,
|
|
2276
|
+
reason: "protocol"
|
|
2277
|
+
}, UPGRADE_REQUIRED_STATUS);
|
|
2278
|
+
}
|
|
2279
|
+
if (!input.compatibility.runtimes.includes(client.runtime)) {
|
|
2280
|
+
return envelopeResponse({
|
|
2281
|
+
kind: "upgrade-required",
|
|
2282
|
+
pageId: input.compatibility.pageId,
|
|
2283
|
+
reason: "runtime",
|
|
2284
|
+
supportedRuntimes: [...input.compatibility.runtimes]
|
|
2285
|
+
}, UPGRADE_REQUIRED_STATUS);
|
|
2286
|
+
}
|
|
2287
|
+
const clientContracts = new Set(client.pageContracts);
|
|
2288
|
+
const representation = input.compatibility.representations.find(({ contract }) => clientContracts.has(contract));
|
|
2289
|
+
if (!representation) {
|
|
2290
|
+
return envelopeResponse({
|
|
2291
|
+
kind: "upgrade-required",
|
|
2292
|
+
pageId: input.compatibility.pageId,
|
|
2293
|
+
reason: "page-contract",
|
|
2294
|
+
supportedContracts: input.compatibility.representations.map(({ contract }) => contract)
|
|
2295
|
+
}, UPGRADE_REQUIRED_STATUS);
|
|
2296
|
+
}
|
|
2297
|
+
try {
|
|
2298
|
+
return envelopeResponse({
|
|
2299
|
+
contract: representation.contract,
|
|
2300
|
+
framework: input.compatibility.framework,
|
|
2301
|
+
kind: "page",
|
|
2302
|
+
pageId: input.compatibility.pageId,
|
|
2303
|
+
props: normalizeJsonValue(representation.mapProps(input.props)),
|
|
2304
|
+
status: input.status ?? OK_STATUS
|
|
2305
|
+
}, input.status ?? OK_STATUS);
|
|
2306
|
+
} catch (error) {
|
|
2307
|
+
console.error(`[Mobile] Failed to produce ${input.compatibility.pageId} representation ${representation.contract}:`, error);
|
|
2308
|
+
return envelopeResponse({
|
|
2309
|
+
code: "representation-failed",
|
|
2310
|
+
kind: "error",
|
|
2311
|
+
pageId: input.compatibility.pageId,
|
|
2312
|
+
status: SERVER_ERROR_STATUS
|
|
2313
|
+
}, SERVER_ERROR_STATUS);
|
|
2314
|
+
}
|
|
2315
|
+
};
|
|
2316
|
+
|
|
2317
|
+
// src/vue/pageHandler.ts
|
|
2042
2318
|
init_pageResponseCache();
|
|
2043
2319
|
|
|
2044
2320
|
// src/core/responseEnhancers.ts
|
|
@@ -2095,7 +2371,7 @@ var withRegisteredStreamingSlots = async (renderResponse, options = {}) => {
|
|
|
2095
2371
|
|
|
2096
2372
|
// src/core/streamingSlotWarningScope.ts
|
|
2097
2373
|
init_logger();
|
|
2098
|
-
import { AsyncLocalStorage as
|
|
2374
|
+
import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
|
|
2099
2375
|
var STREAMING_SLOT_WARNING_STORAGE_KEY2 = Symbol.for("absolutejs.streamingSlotWarningAsyncLocalStorage");
|
|
2100
2376
|
var isObjectRecord4 = (value) => Boolean(value) && typeof value === "object";
|
|
2101
2377
|
var isAsyncLocalStorage3 = (value) => isObjectRecord4(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
|
|
@@ -2111,7 +2387,7 @@ var ensureWarningStorage = () => {
|
|
|
2111
2387
|
if (existing) {
|
|
2112
2388
|
return existing;
|
|
2113
2389
|
}
|
|
2114
|
-
const storage = new
|
|
2390
|
+
const storage = new AsyncLocalStorage3;
|
|
2115
2391
|
Reflect.set(globalThis, STREAMING_SLOT_WARNING_STORAGE_KEY2, storage);
|
|
2116
2392
|
return storage;
|
|
2117
2393
|
};
|
|
@@ -2193,23 +2469,23 @@ var ABSOLUTE_TELEPORT_TARGET_ID = "absolute-teleports";
|
|
|
2193
2469
|
var ABSOLUTE_TELEPORT_TARGET = `#${ABSOLUTE_TELEPORT_TARGET_ID}`;
|
|
2194
2470
|
|
|
2195
2471
|
// src/vue/pageHandler.ts
|
|
2196
|
-
var
|
|
2197
|
-
var isGenericVueComponent = (value) => typeof value === "function" ||
|
|
2472
|
+
var isRecord3 = (value) => typeof value === "object" && value !== null;
|
|
2473
|
+
var isGenericVueComponent = (value) => typeof value === "function" || isRecord3(value);
|
|
2198
2474
|
var readHasIslands = (value) => {
|
|
2199
|
-
if (!
|
|
2475
|
+
if (!isRecord3(value))
|
|
2200
2476
|
return false;
|
|
2201
2477
|
const hasIslands = value["__ABSOLUTE_PAGE_HAS_ISLANDS__"];
|
|
2202
2478
|
return typeof hasIslands === "boolean" ? hasIslands : false;
|
|
2203
2479
|
};
|
|
2204
2480
|
var isVueSetupApp = (value) => typeof value === "function";
|
|
2205
2481
|
var readSetupAppHook = (value) => {
|
|
2206
|
-
if (!
|
|
2482
|
+
if (!isRecord3(value))
|
|
2207
2483
|
return null;
|
|
2208
2484
|
const { setupApp } = value;
|
|
2209
2485
|
return isVueSetupApp(setupApp) ? setupApp : null;
|
|
2210
2486
|
};
|
|
2211
|
-
var readHasSpaRoutes = (value) =>
|
|
2212
|
-
var readDefaultExport = (value) =>
|
|
2487
|
+
var readHasSpaRoutes = (value) => isRecord3(value) && Array.isArray(value["routes"]);
|
|
2488
|
+
var readDefaultExport = (value) => isRecord3(value) ? value.default : undefined;
|
|
2213
2489
|
var resolveRequestRenderUrl = (request) => {
|
|
2214
2490
|
if (!request)
|
|
2215
2491
|
return "/";
|
|
@@ -2239,12 +2515,29 @@ var getSsrOnlyHmrShim = () => {
|
|
|
2239
2515
|
};
|
|
2240
2516
|
var handleVuePageRequest = async (input) => {
|
|
2241
2517
|
const passedPageComponent = input.Page;
|
|
2518
|
+
const request = input.request ?? getCurrentAbsoluteRequest();
|
|
2519
|
+
const pageId = input.__absoluteMobile?.pageId ?? derivePageName(input.pagePath);
|
|
2520
|
+
const currentContract = input.__absoluteMobile?.contract ?? `vue:${pageId}:${ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION}`;
|
|
2521
|
+
const mobileResponse = finalizeAbsoluteMobilePage({
|
|
2522
|
+
compatibility: {
|
|
2523
|
+
framework: "vue",
|
|
2524
|
+
pageId,
|
|
2525
|
+
representations: [
|
|
2526
|
+
{ contract: currentContract, mapProps: (props) => props }
|
|
2527
|
+
],
|
|
2528
|
+
runtimes: [String(ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION)]
|
|
2529
|
+
},
|
|
2530
|
+
props: input.props ?? Object.create(null),
|
|
2531
|
+
request
|
|
2532
|
+
});
|
|
2533
|
+
if (mobileResponse)
|
|
2534
|
+
return mobileResponse;
|
|
2242
2535
|
const userHeadTag = input.headTag ?? "<head></head>";
|
|
2243
2536
|
const resolvedOptions = input;
|
|
2244
2537
|
const resolvedPagePath = input.pagePath;
|
|
2245
2538
|
const [siblingCss, spaChildCss] = await Promise.all([
|
|
2246
2539
|
readSiblingCss(resolvedPagePath),
|
|
2247
|
-
resolveSpaChildCss(resolvedPagePath,
|
|
2540
|
+
resolveSpaChildCss(resolvedPagePath, request?.url)
|
|
2248
2541
|
]);
|
|
2249
2542
|
const resolvedHeadTag = injectInlineCss(injectInlineCss(userHeadTag, siblingCss), spaChildCss);
|
|
2250
2543
|
const maybeProps = input.props;
|
|
@@ -2257,9 +2550,9 @@ var handleVuePageRequest = async (input) => {
|
|
|
2257
2550
|
throw new Error('handleVuePageRequest: `indexPath` is required when `client` is `"auto"` (the default). Pass `client: "none"` to ship a SSR-only page with no client bundle.');
|
|
2258
2551
|
}
|
|
2259
2552
|
try {
|
|
2260
|
-
const spaNotFound = await renderSpaNotFound("vue", derivePageName(resolvedPagePath),
|
|
2553
|
+
const spaNotFound = await renderSpaNotFound("vue", derivePageName(resolvedPagePath), request);
|
|
2261
2554
|
if (spaNotFound)
|
|
2262
|
-
return withPageCacheHeaders(spaNotFound,
|
|
2555
|
+
return withPageCacheHeaders(spaNotFound, request);
|
|
2263
2556
|
const handlerCallsite = resolvedOptions?.collectStreamingSlots === true ? undefined : getCurrentRouteRegistrationCallsite() ?? captureStreamingSlotWarningCallsite();
|
|
2264
2557
|
const renderPageResponse = async () => {
|
|
2265
2558
|
const resolvePageComponent = async () => {
|
|
@@ -2292,7 +2585,7 @@ var handleVuePageRequest = async (input) => {
|
|
|
2292
2585
|
let pendingRedirect = null;
|
|
2293
2586
|
let pendingNotFound = false;
|
|
2294
2587
|
if (resolvedPage.setupApp) {
|
|
2295
|
-
const url = resolveRequestRenderUrl(
|
|
2588
|
+
const url = resolveRequestRenderUrl(request);
|
|
2296
2589
|
await resolvedPage.setupApp(app, {
|
|
2297
2590
|
isServer: true,
|
|
2298
2591
|
router: null,
|
|
@@ -2373,7 +2666,7 @@ var handleVuePageRequest = async (input) => {
|
|
|
2373
2666
|
});
|
|
2374
2667
|
};
|
|
2375
2668
|
const pageResponse = await runWithStreamingSlotWarningScope(() => resolvedOptions?.collectStreamingSlots === true ? withRegisteredStreamingSlots(renderPageResponse, resolvedOptions) : renderPageResponse(), { handlerCallsite });
|
|
2376
|
-
return withPageCacheHeaders(pageResponse,
|
|
2669
|
+
return withPageCacheHeaders(pageResponse, request, {
|
|
2377
2670
|
bufferStreamForEtag: input.bufferStreamForEtag
|
|
2378
2671
|
});
|
|
2379
2672
|
} catch (error) {
|
|
@@ -2381,12 +2674,12 @@ var handleVuePageRequest = async (input) => {
|
|
|
2381
2674
|
const pageName = derivePageName(resolvedPagePath);
|
|
2382
2675
|
const conventionResponse = await renderConventionError("vue", pageName, error);
|
|
2383
2676
|
if (conventionResponse) {
|
|
2384
|
-
return withPageCacheHeaders(conventionResponse,
|
|
2677
|
+
return withPageCacheHeaders(conventionResponse, request);
|
|
2385
2678
|
}
|
|
2386
2679
|
return withPageCacheHeaders(new Response(ssrErrorPage("vue", error), {
|
|
2387
2680
|
headers: { "Content-Type": "text/html" },
|
|
2388
2681
|
status: 500
|
|
2389
|
-
}),
|
|
2682
|
+
}), request);
|
|
2390
2683
|
}
|
|
2391
2684
|
};
|
|
2392
2685
|
// src/vue/routerRedirectProviders.ts
|
|
@@ -2411,5 +2704,5 @@ export {
|
|
|
2411
2704
|
applyVueRouterRedirect
|
|
2412
2705
|
};
|
|
2413
2706
|
|
|
2414
|
-
//# debugId=
|
|
2707
|
+
//# debugId=91AD96587D4ADBF264756E2164756E21
|
|
2415
2708
|
//# sourceMappingURL=server.js.map
|