@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/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(),
|
|
@@ -1472,6 +1472,19 @@ var colors2, frameworkColors, formatPath = (filePath) => {
|
|
|
1472
1472
|
const errorMsg = error instanceof Error ? error.message : error;
|
|
1473
1473
|
const fullMessage = `${colors2.red}error${colors2.reset} ${message}${errorMsg ? `: ${errorMsg}` : ""}`;
|
|
1474
1474
|
console.error(`${timestamp} ${tag} ${fullMessage}`);
|
|
1475
|
+
}, logHmrClientUpdate = (path, framework, duration, target, serverMs, clientMs, outcome = "applied", kind) => {
|
|
1476
|
+
const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
|
|
1477
|
+
const targetLabel = target.startsWith("capacitor-") ? target.slice("capacitor-".length) : target;
|
|
1478
|
+
const tag = `${colors2.cyan}[hmr:${targetLabel}]${colors2.reset}`;
|
|
1479
|
+
const pathColor = framework ? getFrameworkColor(framework) : colors2.white;
|
|
1480
|
+
const breakdown = serverMs === undefined || clientMs === undefined ? "" : `; server ${serverMs}ms, client ${clientMs}ms`;
|
|
1481
|
+
let action = "failed after";
|
|
1482
|
+
if (outcome === "applied")
|
|
1483
|
+
action = "applied in";
|
|
1484
|
+
else if (outcome === "reloaded")
|
|
1485
|
+
action = "falling back to reload after";
|
|
1486
|
+
const kindLabel = kind ? `${kind} ` : "";
|
|
1487
|
+
console.log(`${timestamp} ${tag} ${framework ?? "update"} ${kindLabel}${pathColor}${formatPath(path)}${colors2.reset} ${colors2.dim}${action} ${duration}ms${breakdown}${colors2.reset}`);
|
|
1475
1488
|
}, logHmrUpdate = (path, framework, duration) => {
|
|
1476
1489
|
log("hmr update", { duration, framework, path });
|
|
1477
1490
|
}, logInfo = (message) => {
|
|
@@ -2026,6 +2039,278 @@ var setCurrentIslandManifest = (manifest) => {
|
|
|
2026
2039
|
|
|
2027
2040
|
// src/vue/pageHandler.ts
|
|
2028
2041
|
init_devRouteRegistrationCallsite();
|
|
2042
|
+
|
|
2043
|
+
// src/core/requestContext.ts
|
|
2044
|
+
import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
|
|
2045
|
+
import { Elysia as Elysia2 } from "elysia";
|
|
2046
|
+
var REQUEST_STORAGE_KEY = Symbol.for("absolutejs.requestAsyncLocalStorage");
|
|
2047
|
+
var isAbsoluteRequestStorage = (value) => typeof value === "object" && value !== null && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
|
|
2048
|
+
var getRequestStorage = () => {
|
|
2049
|
+
const value = Reflect.get(globalThis, REQUEST_STORAGE_KEY);
|
|
2050
|
+
return isAbsoluteRequestStorage(value) ? value : undefined;
|
|
2051
|
+
};
|
|
2052
|
+
var ensureRequestStorage = () => {
|
|
2053
|
+
const existing = getRequestStorage();
|
|
2054
|
+
if (existing)
|
|
2055
|
+
return existing;
|
|
2056
|
+
const storage = new AsyncLocalStorage2;
|
|
2057
|
+
Reflect.set(globalThis, REQUEST_STORAGE_KEY, storage);
|
|
2058
|
+
return storage;
|
|
2059
|
+
};
|
|
2060
|
+
var absoluteRequestContext = new Elysia2({
|
|
2061
|
+
name: "absolutejs-request-context"
|
|
2062
|
+
}).request(({ request }) => {
|
|
2063
|
+
ensureRequestStorage().enterWith({ request });
|
|
2064
|
+
}).as("global");
|
|
2065
|
+
var getCurrentAbsoluteRequest = () => getRequestStorage()?.getStore()?.request;
|
|
2066
|
+
var runWithAbsoluteRequest = (request, callback) => ensureRequestStorage().run({ request }, callback);
|
|
2067
|
+
|
|
2068
|
+
// src/mobile/producerContextState.ts
|
|
2069
|
+
var ABSOLUTE_MOBILE_PRODUCER_STORAGE_KEY = Symbol.for("absolutejs.mobileProducerAsyncLocalStorage");
|
|
2070
|
+
var frameworks = new Set([
|
|
2071
|
+
"angular",
|
|
2072
|
+
"ember",
|
|
2073
|
+
"html",
|
|
2074
|
+
"htmx",
|
|
2075
|
+
"react",
|
|
2076
|
+
"svelte",
|
|
2077
|
+
"vue"
|
|
2078
|
+
]);
|
|
2079
|
+
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";
|
|
2080
|
+
var getCurrentAbsoluteMobileProducerContext = () => {
|
|
2081
|
+
const value = Reflect.get(globalThis, ABSOLUTE_MOBILE_PRODUCER_STORAGE_KEY);
|
|
2082
|
+
if (typeof value !== "object" || value === null || !("getStore" in value) || typeof value.getStore !== "function") {
|
|
2083
|
+
return;
|
|
2084
|
+
}
|
|
2085
|
+
const context = value.getStore();
|
|
2086
|
+
if (typeof context !== "object" || context === null || !("page" in context) || !isCompatibilityPage(context.page) || !("releaseId" in context) || typeof context.releaseId !== "string") {
|
|
2087
|
+
return;
|
|
2088
|
+
}
|
|
2089
|
+
return { page: context.page, releaseId: context.releaseId };
|
|
2090
|
+
};
|
|
2091
|
+
|
|
2092
|
+
// src/mobile/pageProtocol.ts
|
|
2093
|
+
var ABSOLUTE_MOBILE_PAGE_MEDIA_TYPE = "application/vnd.absolute.page+json";
|
|
2094
|
+
var ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION = 1;
|
|
2095
|
+
var BAD_REQUEST_STATUS = 400;
|
|
2096
|
+
var OK_STATUS = 200;
|
|
2097
|
+
var SERVER_ERROR_STATUS = 500;
|
|
2098
|
+
var UPGRADE_REQUIRED_STATUS = 426;
|
|
2099
|
+
var MOBILE_PAGE_REQUEST_HEADERS = {
|
|
2100
|
+
appBuild: "x-absolute-mobile-app-build",
|
|
2101
|
+
pageBundle: "x-absolute-mobile-page-bundle",
|
|
2102
|
+
pageContracts: "x-absolute-mobile-page-contracts",
|
|
2103
|
+
pageId: "x-absolute-mobile-page-id",
|
|
2104
|
+
protocol: "x-absolute-mobile-protocol",
|
|
2105
|
+
runtime: "x-absolute-mobile-runtime"
|
|
2106
|
+
};
|
|
2107
|
+
var parseMediaType = (value) => value.split(";", 1)[0]?.trim().toLowerCase();
|
|
2108
|
+
var acceptsAbsoluteMobilePage = (request) => {
|
|
2109
|
+
if (!request)
|
|
2110
|
+
return false;
|
|
2111
|
+
return (request.headers.get("accept") ?? "").split(",").some((value) => parseMediaType(value) === ABSOLUTE_MOBILE_PAGE_MEDIA_TYPE);
|
|
2112
|
+
};
|
|
2113
|
+
var readRequiredHeader = (request, name) => {
|
|
2114
|
+
const value = request.headers.get(name)?.trim();
|
|
2115
|
+
return value ? value : undefined;
|
|
2116
|
+
};
|
|
2117
|
+
var parseAbsoluteMobilePageRequest = (request) => {
|
|
2118
|
+
if (!request || !acceptsAbsoluteMobilePage(request)) {
|
|
2119
|
+
return { kind: "not-mobile" };
|
|
2120
|
+
}
|
|
2121
|
+
const protocolValue = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.protocol);
|
|
2122
|
+
const runtime = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.runtime);
|
|
2123
|
+
const appBuild = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.appBuild);
|
|
2124
|
+
const pageBundle = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.pageBundle);
|
|
2125
|
+
const pageContractsValue = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.pageContracts);
|
|
2126
|
+
const pageId = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.pageId);
|
|
2127
|
+
if (!protocolValue || !/^\d+$/.test(protocolValue)) {
|
|
2128
|
+
return {
|
|
2129
|
+
kind: "invalid",
|
|
2130
|
+
message: `Missing or invalid ${MOBILE_PAGE_REQUEST_HEADERS.protocol} header.`
|
|
2131
|
+
};
|
|
2132
|
+
}
|
|
2133
|
+
if (!runtime) {
|
|
2134
|
+
return {
|
|
2135
|
+
kind: "invalid",
|
|
2136
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.runtime} header.`
|
|
2137
|
+
};
|
|
2138
|
+
}
|
|
2139
|
+
if (!appBuild) {
|
|
2140
|
+
return {
|
|
2141
|
+
kind: "invalid",
|
|
2142
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.appBuild} header.`
|
|
2143
|
+
};
|
|
2144
|
+
}
|
|
2145
|
+
if (!pageBundle) {
|
|
2146
|
+
return {
|
|
2147
|
+
kind: "invalid",
|
|
2148
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.pageBundle} header.`
|
|
2149
|
+
};
|
|
2150
|
+
}
|
|
2151
|
+
if (!pageContractsValue) {
|
|
2152
|
+
return {
|
|
2153
|
+
kind: "invalid",
|
|
2154
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.pageContracts} header.`
|
|
2155
|
+
};
|
|
2156
|
+
}
|
|
2157
|
+
if (!pageId) {
|
|
2158
|
+
return {
|
|
2159
|
+
kind: "invalid",
|
|
2160
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.pageId} header.`
|
|
2161
|
+
};
|
|
2162
|
+
}
|
|
2163
|
+
const pageContracts = [
|
|
2164
|
+
...new Set(pageContractsValue.split(",").map((value) => value.trim()).filter(Boolean))
|
|
2165
|
+
];
|
|
2166
|
+
if (pageContracts.length === 0) {
|
|
2167
|
+
return {
|
|
2168
|
+
kind: "invalid",
|
|
2169
|
+
message: `${MOBILE_PAGE_REQUEST_HEADERS.pageContracts} must contain at least one contract.`
|
|
2170
|
+
};
|
|
2171
|
+
}
|
|
2172
|
+
return {
|
|
2173
|
+
client: {
|
|
2174
|
+
appBuild,
|
|
2175
|
+
pageBundle,
|
|
2176
|
+
pageContracts,
|
|
2177
|
+
pageId,
|
|
2178
|
+
protocol: Number(protocolValue),
|
|
2179
|
+
runtime
|
|
2180
|
+
},
|
|
2181
|
+
kind: "mobile"
|
|
2182
|
+
};
|
|
2183
|
+
};
|
|
2184
|
+
var responseHeaders = () => {
|
|
2185
|
+
const headers = new Headers({
|
|
2186
|
+
"cache-control": "no-store",
|
|
2187
|
+
"content-type": `${ABSOLUTE_MOBILE_PAGE_MEDIA_TYPE}; version=${ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION}`
|
|
2188
|
+
});
|
|
2189
|
+
headerVaryValues.forEach((value) => headers.append("vary", value));
|
|
2190
|
+
return headers;
|
|
2191
|
+
};
|
|
2192
|
+
var headerVaryValues = [
|
|
2193
|
+
"Accept",
|
|
2194
|
+
MOBILE_PAGE_REQUEST_HEADERS.protocol,
|
|
2195
|
+
MOBILE_PAGE_REQUEST_HEADERS.runtime,
|
|
2196
|
+
MOBILE_PAGE_REQUEST_HEADERS.appBuild,
|
|
2197
|
+
MOBILE_PAGE_REQUEST_HEADERS.pageBundle,
|
|
2198
|
+
MOBILE_PAGE_REQUEST_HEADERS.pageContracts,
|
|
2199
|
+
MOBILE_PAGE_REQUEST_HEADERS.pageId
|
|
2200
|
+
];
|
|
2201
|
+
var envelopeResponse = (response, status) => new Response(JSON.stringify({
|
|
2202
|
+
protocol: ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION,
|
|
2203
|
+
response
|
|
2204
|
+
}), { headers: responseHeaders(), status });
|
|
2205
|
+
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2206
|
+
var normalizeJsonValue = (value) => {
|
|
2207
|
+
const serialized = JSON.stringify(value);
|
|
2208
|
+
if (serialized === undefined) {
|
|
2209
|
+
throw new TypeError("Mobile page props must be JSON-serializable.");
|
|
2210
|
+
}
|
|
2211
|
+
const parsed = JSON.parse(serialized);
|
|
2212
|
+
if (!isRecord(parsed)) {
|
|
2213
|
+
throw new TypeError("Mobile page props must serialize to an object.");
|
|
2214
|
+
}
|
|
2215
|
+
return parsed;
|
|
2216
|
+
};
|
|
2217
|
+
var finalizeArchivedMobilePage = (context, input) => {
|
|
2218
|
+
const { page } = context;
|
|
2219
|
+
if (page.pageId !== input.compatibility.pageId || page.framework !== input.compatibility.framework) {
|
|
2220
|
+
return envelopeResponse({
|
|
2221
|
+
kind: "invalid-request",
|
|
2222
|
+
message: "Archived producer page identity does not match its release artifact."
|
|
2223
|
+
}, BAD_REQUEST_STATUS);
|
|
2224
|
+
}
|
|
2225
|
+
try {
|
|
2226
|
+
const [currentRepresentation] = input.compatibility.representations;
|
|
2227
|
+
if (!currentRepresentation) {
|
|
2228
|
+
throw new TypeError("Mobile page has no current representation.");
|
|
2229
|
+
}
|
|
2230
|
+
return envelopeResponse({
|
|
2231
|
+
contract: page.contract,
|
|
2232
|
+
framework: page.framework,
|
|
2233
|
+
kind: "page",
|
|
2234
|
+
pageId: page.pageId,
|
|
2235
|
+
props: normalizeJsonValue(currentRepresentation.mapProps(input.props)),
|
|
2236
|
+
status: input.status ?? OK_STATUS
|
|
2237
|
+
}, input.status ?? OK_STATUS);
|
|
2238
|
+
} catch (error) {
|
|
2239
|
+
console.error(`[Mobile] Archived producer ${context.releaseId} failed for ${page.pageId}:`, error);
|
|
2240
|
+
return createAbsoluteMobilePageErrorResponse(page.pageId);
|
|
2241
|
+
}
|
|
2242
|
+
};
|
|
2243
|
+
var createAbsoluteMobileInvalidRequestResponse = (message) => envelopeResponse({ kind: "invalid-request", message }, BAD_REQUEST_STATUS);
|
|
2244
|
+
var createAbsoluteMobilePageErrorResponse = (pageId) => envelopeResponse({
|
|
2245
|
+
code: "representation-failed",
|
|
2246
|
+
kind: "error",
|
|
2247
|
+
pageId,
|
|
2248
|
+
status: SERVER_ERROR_STATUS
|
|
2249
|
+
}, SERVER_ERROR_STATUS);
|
|
2250
|
+
var createAbsoluteMobileUpgradeResponse = (result) => envelopeResponse(result, UPGRADE_REQUIRED_STATUS);
|
|
2251
|
+
var finalizeAbsoluteMobilePage = (input) => {
|
|
2252
|
+
const parsed = parseAbsoluteMobilePageRequest(input.request);
|
|
2253
|
+
if (parsed.kind === "not-mobile")
|
|
2254
|
+
return;
|
|
2255
|
+
if (parsed.kind === "invalid") {
|
|
2256
|
+
return envelopeResponse({ kind: "invalid-request", message: parsed.message }, BAD_REQUEST_STATUS);
|
|
2257
|
+
}
|
|
2258
|
+
const { client } = parsed;
|
|
2259
|
+
if (client.pageId !== input.compatibility.pageId) {
|
|
2260
|
+
return envelopeResponse({
|
|
2261
|
+
kind: "invalid-request",
|
|
2262
|
+
message: `Requested mobile page ${client.pageId} does not match ${input.compatibility.pageId}.`
|
|
2263
|
+
}, BAD_REQUEST_STATUS);
|
|
2264
|
+
}
|
|
2265
|
+
const producerContext = getCurrentAbsoluteMobileProducerContext();
|
|
2266
|
+
if (producerContext)
|
|
2267
|
+
return finalizeArchivedMobilePage(producerContext, input);
|
|
2268
|
+
if (client.protocol !== ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION) {
|
|
2269
|
+
return envelopeResponse({
|
|
2270
|
+
kind: "upgrade-required",
|
|
2271
|
+
pageId: input.compatibility.pageId,
|
|
2272
|
+
reason: "protocol"
|
|
2273
|
+
}, UPGRADE_REQUIRED_STATUS);
|
|
2274
|
+
}
|
|
2275
|
+
if (!input.compatibility.runtimes.includes(client.runtime)) {
|
|
2276
|
+
return envelopeResponse({
|
|
2277
|
+
kind: "upgrade-required",
|
|
2278
|
+
pageId: input.compatibility.pageId,
|
|
2279
|
+
reason: "runtime",
|
|
2280
|
+
supportedRuntimes: [...input.compatibility.runtimes]
|
|
2281
|
+
}, UPGRADE_REQUIRED_STATUS);
|
|
2282
|
+
}
|
|
2283
|
+
const clientContracts = new Set(client.pageContracts);
|
|
2284
|
+
const representation = input.compatibility.representations.find(({ contract }) => clientContracts.has(contract));
|
|
2285
|
+
if (!representation) {
|
|
2286
|
+
return envelopeResponse({
|
|
2287
|
+
kind: "upgrade-required",
|
|
2288
|
+
pageId: input.compatibility.pageId,
|
|
2289
|
+
reason: "page-contract",
|
|
2290
|
+
supportedContracts: input.compatibility.representations.map(({ contract }) => contract)
|
|
2291
|
+
}, UPGRADE_REQUIRED_STATUS);
|
|
2292
|
+
}
|
|
2293
|
+
try {
|
|
2294
|
+
return envelopeResponse({
|
|
2295
|
+
contract: representation.contract,
|
|
2296
|
+
framework: input.compatibility.framework,
|
|
2297
|
+
kind: "page",
|
|
2298
|
+
pageId: input.compatibility.pageId,
|
|
2299
|
+
props: normalizeJsonValue(representation.mapProps(input.props)),
|
|
2300
|
+
status: input.status ?? OK_STATUS
|
|
2301
|
+
}, input.status ?? OK_STATUS);
|
|
2302
|
+
} catch (error) {
|
|
2303
|
+
console.error(`[Mobile] Failed to produce ${input.compatibility.pageId} representation ${representation.contract}:`, error);
|
|
2304
|
+
return envelopeResponse({
|
|
2305
|
+
code: "representation-failed",
|
|
2306
|
+
kind: "error",
|
|
2307
|
+
pageId: input.compatibility.pageId,
|
|
2308
|
+
status: SERVER_ERROR_STATUS
|
|
2309
|
+
}, SERVER_ERROR_STATUS);
|
|
2310
|
+
}
|
|
2311
|
+
};
|
|
2312
|
+
|
|
2313
|
+
// src/vue/pageHandler.ts
|
|
2029
2314
|
init_pageResponseCache();
|
|
2030
2315
|
|
|
2031
2316
|
// src/core/responseEnhancers.ts
|
|
@@ -2082,7 +2367,7 @@ var withRegisteredStreamingSlots = async (renderResponse, options = {}) => {
|
|
|
2082
2367
|
|
|
2083
2368
|
// src/core/streamingSlotWarningScope.ts
|
|
2084
2369
|
init_logger();
|
|
2085
|
-
import { AsyncLocalStorage as
|
|
2370
|
+
import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
|
|
2086
2371
|
var STREAMING_SLOT_WARNING_STORAGE_KEY2 = Symbol.for("absolutejs.streamingSlotWarningAsyncLocalStorage");
|
|
2087
2372
|
var isObjectRecord4 = (value) => Boolean(value) && typeof value === "object";
|
|
2088
2373
|
var isAsyncLocalStorage3 = (value) => isObjectRecord4(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
|
|
@@ -2098,7 +2383,7 @@ var ensureWarningStorage = () => {
|
|
|
2098
2383
|
if (existing) {
|
|
2099
2384
|
return existing;
|
|
2100
2385
|
}
|
|
2101
|
-
const storage = new
|
|
2386
|
+
const storage = new AsyncLocalStorage3;
|
|
2102
2387
|
Reflect.set(globalThis, STREAMING_SLOT_WARNING_STORAGE_KEY2, storage);
|
|
2103
2388
|
return storage;
|
|
2104
2389
|
};
|
|
@@ -2180,23 +2465,23 @@ var ABSOLUTE_TELEPORT_TARGET_ID = "absolute-teleports";
|
|
|
2180
2465
|
var ABSOLUTE_TELEPORT_TARGET = `#${ABSOLUTE_TELEPORT_TARGET_ID}`;
|
|
2181
2466
|
|
|
2182
2467
|
// src/vue/pageHandler.ts
|
|
2183
|
-
var
|
|
2184
|
-
var isGenericVueComponent = (value) => typeof value === "function" ||
|
|
2468
|
+
var isRecord3 = (value) => typeof value === "object" && value !== null;
|
|
2469
|
+
var isGenericVueComponent = (value) => typeof value === "function" || isRecord3(value);
|
|
2185
2470
|
var readHasIslands = (value) => {
|
|
2186
|
-
if (!
|
|
2471
|
+
if (!isRecord3(value))
|
|
2187
2472
|
return false;
|
|
2188
2473
|
const hasIslands = value["__ABSOLUTE_PAGE_HAS_ISLANDS__"];
|
|
2189
2474
|
return typeof hasIslands === "boolean" ? hasIslands : false;
|
|
2190
2475
|
};
|
|
2191
2476
|
var isVueSetupApp = (value) => typeof value === "function";
|
|
2192
2477
|
var readSetupAppHook = (value) => {
|
|
2193
|
-
if (!
|
|
2478
|
+
if (!isRecord3(value))
|
|
2194
2479
|
return null;
|
|
2195
2480
|
const { setupApp } = value;
|
|
2196
2481
|
return isVueSetupApp(setupApp) ? setupApp : null;
|
|
2197
2482
|
};
|
|
2198
|
-
var readHasSpaRoutes = (value) =>
|
|
2199
|
-
var readDefaultExport = (value) =>
|
|
2483
|
+
var readHasSpaRoutes = (value) => isRecord3(value) && Array.isArray(value["routes"]);
|
|
2484
|
+
var readDefaultExport = (value) => isRecord3(value) ? value.default : undefined;
|
|
2200
2485
|
var resolveRequestRenderUrl = (request) => {
|
|
2201
2486
|
if (!request)
|
|
2202
2487
|
return "/";
|
|
@@ -2226,12 +2511,29 @@ var getSsrOnlyHmrShim = () => {
|
|
|
2226
2511
|
};
|
|
2227
2512
|
var handleVuePageRequest = async (input) => {
|
|
2228
2513
|
const passedPageComponent = input.Page;
|
|
2514
|
+
const request = input.request ?? getCurrentAbsoluteRequest();
|
|
2515
|
+
const pageId = input.__absoluteMobile?.pageId ?? derivePageName(input.pagePath);
|
|
2516
|
+
const currentContract = input.__absoluteMobile?.contract ?? `vue:${pageId}:${ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION}`;
|
|
2517
|
+
const mobileResponse = finalizeAbsoluteMobilePage({
|
|
2518
|
+
compatibility: {
|
|
2519
|
+
framework: "vue",
|
|
2520
|
+
pageId,
|
|
2521
|
+
representations: [
|
|
2522
|
+
{ contract: currentContract, mapProps: (props) => props }
|
|
2523
|
+
],
|
|
2524
|
+
runtimes: [String(ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION)]
|
|
2525
|
+
},
|
|
2526
|
+
props: input.props ?? Object.create(null),
|
|
2527
|
+
request
|
|
2528
|
+
});
|
|
2529
|
+
if (mobileResponse)
|
|
2530
|
+
return mobileResponse;
|
|
2229
2531
|
const userHeadTag = input.headTag ?? "<head></head>";
|
|
2230
2532
|
const resolvedOptions = input;
|
|
2231
2533
|
const resolvedPagePath = input.pagePath;
|
|
2232
2534
|
const [siblingCss, spaChildCss] = await Promise.all([
|
|
2233
2535
|
readSiblingCss(resolvedPagePath),
|
|
2234
|
-
resolveSpaChildCss(resolvedPagePath,
|
|
2536
|
+
resolveSpaChildCss(resolvedPagePath, request?.url)
|
|
2235
2537
|
]);
|
|
2236
2538
|
const resolvedHeadTag = injectInlineCss(injectInlineCss(userHeadTag, siblingCss), spaChildCss);
|
|
2237
2539
|
const maybeProps = input.props;
|
|
@@ -2244,9 +2546,9 @@ var handleVuePageRequest = async (input) => {
|
|
|
2244
2546
|
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.');
|
|
2245
2547
|
}
|
|
2246
2548
|
try {
|
|
2247
|
-
const spaNotFound = await renderSpaNotFound("vue", derivePageName(resolvedPagePath),
|
|
2549
|
+
const spaNotFound = await renderSpaNotFound("vue", derivePageName(resolvedPagePath), request);
|
|
2248
2550
|
if (spaNotFound)
|
|
2249
|
-
return withPageCacheHeaders(spaNotFound,
|
|
2551
|
+
return withPageCacheHeaders(spaNotFound, request);
|
|
2250
2552
|
const handlerCallsite = resolvedOptions?.collectStreamingSlots === true ? undefined : getCurrentRouteRegistrationCallsite() ?? captureStreamingSlotWarningCallsite();
|
|
2251
2553
|
const renderPageResponse = async () => {
|
|
2252
2554
|
const resolvePageComponent = async () => {
|
|
@@ -2279,7 +2581,7 @@ var handleVuePageRequest = async (input) => {
|
|
|
2279
2581
|
let pendingRedirect = null;
|
|
2280
2582
|
let pendingNotFound = false;
|
|
2281
2583
|
if (resolvedPage.setupApp) {
|
|
2282
|
-
const url = resolveRequestRenderUrl(
|
|
2584
|
+
const url = resolveRequestRenderUrl(request);
|
|
2283
2585
|
await resolvedPage.setupApp(app, {
|
|
2284
2586
|
isServer: true,
|
|
2285
2587
|
router: null,
|
|
@@ -2360,7 +2662,7 @@ var handleVuePageRequest = async (input) => {
|
|
|
2360
2662
|
});
|
|
2361
2663
|
};
|
|
2362
2664
|
const pageResponse = await runWithStreamingSlotWarningScope(() => resolvedOptions?.collectStreamingSlots === true ? withRegisteredStreamingSlots(renderPageResponse, resolvedOptions) : renderPageResponse(), { handlerCallsite });
|
|
2363
|
-
return withPageCacheHeaders(pageResponse,
|
|
2665
|
+
return withPageCacheHeaders(pageResponse, request, {
|
|
2364
2666
|
bufferStreamForEtag: input.bufferStreamForEtag
|
|
2365
2667
|
});
|
|
2366
2668
|
} catch (error) {
|
|
@@ -2368,12 +2670,12 @@ var handleVuePageRequest = async (input) => {
|
|
|
2368
2670
|
const pageName = derivePageName(resolvedPagePath);
|
|
2369
2671
|
const conventionResponse = await renderConventionError("vue", pageName, error);
|
|
2370
2672
|
if (conventionResponse) {
|
|
2371
|
-
return withPageCacheHeaders(conventionResponse,
|
|
2673
|
+
return withPageCacheHeaders(conventionResponse, request);
|
|
2372
2674
|
}
|
|
2373
2675
|
return withPageCacheHeaders(new Response(ssrErrorPage("vue", error), {
|
|
2374
2676
|
headers: { "Content-Type": "text/html" },
|
|
2375
2677
|
status: 500
|
|
2376
|
-
}),
|
|
2678
|
+
}), request);
|
|
2377
2679
|
}
|
|
2378
2680
|
};
|
|
2379
2681
|
// src/vue/routerRedirectProviders.ts
|
|
@@ -2398,5 +2700,5 @@ export {
|
|
|
2398
2700
|
applyVueRouterRedirect
|
|
2399
2701
|
};
|
|
2400
2702
|
|
|
2401
|
-
//# debugId=
|
|
2703
|
+
//# debugId=1586E98D5BE5EE5B64756E2164756E21
|
|
2402
2704
|
//# sourceMappingURL=server.js.map
|