@absolutejs/absolute 0.20.0-beta.4 → 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 +9 -9
- package/dist/cli/index.js +986 -557
- 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 +17 -17
- package/dist/mobile/browser.js +14 -1
- package/dist/mobile/browser.js.map +3 -3
- package/dist/mobile/index.js +588 -99
- package/dist/mobile/index.js.map +15 -13
- package/dist/mobile/remoteMacAgentEntry.js +8 -8
- 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 +1 -0
- package/dist/src/mobile/nativeAuth.d.ts +17 -0
- package/dist/src/mobile/releaseArtifact.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/vue/index.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(),
|
|
@@ -1721,8 +1721,8 @@ var toIslandFrameworkSegment = (framework) => framework[0]?.toUpperCase() + fram
|
|
|
1721
1721
|
return found ? entries : undefined;
|
|
1722
1722
|
}, getIslandManifestEntries = (manifest) => {
|
|
1723
1723
|
const islands = {};
|
|
1724
|
-
const
|
|
1725
|
-
for (const framework of
|
|
1724
|
+
const frameworks2 = ["react", "svelte", "vue", "angular"];
|
|
1725
|
+
for (const framework of frameworks2) {
|
|
1726
1726
|
const prefix = `Island${toIslandFrameworkSegment(framework)}`;
|
|
1727
1727
|
const entries = collectFrameworkIslands(manifest, prefix);
|
|
1728
1728
|
if (entries)
|
|
@@ -1742,14 +1742,14 @@ var defineIslandComponent = (component, options) => ({
|
|
|
1742
1742
|
component,
|
|
1743
1743
|
export: options.export,
|
|
1744
1744
|
source: options.source
|
|
1745
|
-
}), defineIslandRegistry = (registry) => registry,
|
|
1745
|
+
}), defineIslandRegistry = (registry) => registry, isRecord4 = (value) => typeof value === "object" && value !== null, getIslandBuildReference = (component) => {
|
|
1746
1746
|
if (!isIslandComponentDefinition(component))
|
|
1747
1747
|
return null;
|
|
1748
1748
|
return {
|
|
1749
1749
|
export: component.export,
|
|
1750
1750
|
source: component.source
|
|
1751
1751
|
};
|
|
1752
|
-
}, isIslandComponentDefinition = (value) =>
|
|
1752
|
+
}, isIslandComponentDefinition = (value) => isRecord4(value) && ("component" in value) && ("source" in value) && typeof value.source === "string", parseIslandProps = (rawProps) => {
|
|
1753
1753
|
if (!rawProps)
|
|
1754
1754
|
return {};
|
|
1755
1755
|
return JSON.parse(rawProps);
|
|
@@ -4037,7 +4037,7 @@ var init_vueServerModule = __esm(() => {
|
|
|
4037
4037
|
var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildComponentCache, nextIslandId = () => {
|
|
4038
4038
|
islandSequence += 1;
|
|
4039
4039
|
return `island-${islandSequence}`;
|
|
4040
|
-
},
|
|
4040
|
+
}, 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) => {
|
|
4041
4041
|
if (source.startsWith("file://"))
|
|
4042
4042
|
return new URL(source).pathname;
|
|
4043
4043
|
if (source.startsWith("."))
|
|
@@ -4937,6 +4937,278 @@ var setCurrentIslandManifest = (manifest) => {
|
|
|
4937
4937
|
|
|
4938
4938
|
// src/vue/pageHandler.ts
|
|
4939
4939
|
init_devRouteRegistrationCallsite();
|
|
4940
|
+
|
|
4941
|
+
// src/core/requestContext.ts
|
|
4942
|
+
import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
|
|
4943
|
+
import { Elysia as Elysia2 } from "elysia";
|
|
4944
|
+
var REQUEST_STORAGE_KEY = Symbol.for("absolutejs.requestAsyncLocalStorage");
|
|
4945
|
+
var isAbsoluteRequestStorage = (value) => typeof value === "object" && value !== null && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
|
|
4946
|
+
var getRequestStorage = () => {
|
|
4947
|
+
const value = Reflect.get(globalThis, REQUEST_STORAGE_KEY);
|
|
4948
|
+
return isAbsoluteRequestStorage(value) ? value : undefined;
|
|
4949
|
+
};
|
|
4950
|
+
var ensureRequestStorage = () => {
|
|
4951
|
+
const existing = getRequestStorage();
|
|
4952
|
+
if (existing)
|
|
4953
|
+
return existing;
|
|
4954
|
+
const storage = new AsyncLocalStorage2;
|
|
4955
|
+
Reflect.set(globalThis, REQUEST_STORAGE_KEY, storage);
|
|
4956
|
+
return storage;
|
|
4957
|
+
};
|
|
4958
|
+
var absoluteRequestContext = new Elysia2({
|
|
4959
|
+
name: "absolutejs-request-context"
|
|
4960
|
+
}).request(({ request }) => {
|
|
4961
|
+
ensureRequestStorage().enterWith({ request });
|
|
4962
|
+
}).as("global");
|
|
4963
|
+
var getCurrentAbsoluteRequest = () => getRequestStorage()?.getStore()?.request;
|
|
4964
|
+
var runWithAbsoluteRequest = (request, callback) => ensureRequestStorage().run({ request }, callback);
|
|
4965
|
+
|
|
4966
|
+
// src/mobile/producerContextState.ts
|
|
4967
|
+
var ABSOLUTE_MOBILE_PRODUCER_STORAGE_KEY = Symbol.for("absolutejs.mobileProducerAsyncLocalStorage");
|
|
4968
|
+
var frameworks = new Set([
|
|
4969
|
+
"angular",
|
|
4970
|
+
"ember",
|
|
4971
|
+
"html",
|
|
4972
|
+
"htmx",
|
|
4973
|
+
"react",
|
|
4974
|
+
"svelte",
|
|
4975
|
+
"vue"
|
|
4976
|
+
]);
|
|
4977
|
+
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";
|
|
4978
|
+
var getCurrentAbsoluteMobileProducerContext = () => {
|
|
4979
|
+
const value = Reflect.get(globalThis, ABSOLUTE_MOBILE_PRODUCER_STORAGE_KEY);
|
|
4980
|
+
if (typeof value !== "object" || value === null || !("getStore" in value) || typeof value.getStore !== "function") {
|
|
4981
|
+
return;
|
|
4982
|
+
}
|
|
4983
|
+
const context = value.getStore();
|
|
4984
|
+
if (typeof context !== "object" || context === null || !("page" in context) || !isCompatibilityPage(context.page) || !("releaseId" in context) || typeof context.releaseId !== "string") {
|
|
4985
|
+
return;
|
|
4986
|
+
}
|
|
4987
|
+
return { page: context.page, releaseId: context.releaseId };
|
|
4988
|
+
};
|
|
4989
|
+
|
|
4990
|
+
// src/mobile/pageProtocol.ts
|
|
4991
|
+
var ABSOLUTE_MOBILE_PAGE_MEDIA_TYPE = "application/vnd.absolute.page+json";
|
|
4992
|
+
var ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION = 1;
|
|
4993
|
+
var BAD_REQUEST_STATUS = 400;
|
|
4994
|
+
var OK_STATUS = 200;
|
|
4995
|
+
var SERVER_ERROR_STATUS = 500;
|
|
4996
|
+
var UPGRADE_REQUIRED_STATUS = 426;
|
|
4997
|
+
var MOBILE_PAGE_REQUEST_HEADERS = {
|
|
4998
|
+
appBuild: "x-absolute-mobile-app-build",
|
|
4999
|
+
pageBundle: "x-absolute-mobile-page-bundle",
|
|
5000
|
+
pageContracts: "x-absolute-mobile-page-contracts",
|
|
5001
|
+
pageId: "x-absolute-mobile-page-id",
|
|
5002
|
+
protocol: "x-absolute-mobile-protocol",
|
|
5003
|
+
runtime: "x-absolute-mobile-runtime"
|
|
5004
|
+
};
|
|
5005
|
+
var parseMediaType = (value) => value.split(";", 1)[0]?.trim().toLowerCase();
|
|
5006
|
+
var acceptsAbsoluteMobilePage = (request) => {
|
|
5007
|
+
if (!request)
|
|
5008
|
+
return false;
|
|
5009
|
+
return (request.headers.get("accept") ?? "").split(",").some((value) => parseMediaType(value) === ABSOLUTE_MOBILE_PAGE_MEDIA_TYPE);
|
|
5010
|
+
};
|
|
5011
|
+
var readRequiredHeader = (request, name) => {
|
|
5012
|
+
const value = request.headers.get(name)?.trim();
|
|
5013
|
+
return value ? value : undefined;
|
|
5014
|
+
};
|
|
5015
|
+
var parseAbsoluteMobilePageRequest = (request) => {
|
|
5016
|
+
if (!request || !acceptsAbsoluteMobilePage(request)) {
|
|
5017
|
+
return { kind: "not-mobile" };
|
|
5018
|
+
}
|
|
5019
|
+
const protocolValue = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.protocol);
|
|
5020
|
+
const runtime = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.runtime);
|
|
5021
|
+
const appBuild = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.appBuild);
|
|
5022
|
+
const pageBundle = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.pageBundle);
|
|
5023
|
+
const pageContractsValue = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.pageContracts);
|
|
5024
|
+
const pageId = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.pageId);
|
|
5025
|
+
if (!protocolValue || !/^\d+$/.test(protocolValue)) {
|
|
5026
|
+
return {
|
|
5027
|
+
kind: "invalid",
|
|
5028
|
+
message: `Missing or invalid ${MOBILE_PAGE_REQUEST_HEADERS.protocol} header.`
|
|
5029
|
+
};
|
|
5030
|
+
}
|
|
5031
|
+
if (!runtime) {
|
|
5032
|
+
return {
|
|
5033
|
+
kind: "invalid",
|
|
5034
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.runtime} header.`
|
|
5035
|
+
};
|
|
5036
|
+
}
|
|
5037
|
+
if (!appBuild) {
|
|
5038
|
+
return {
|
|
5039
|
+
kind: "invalid",
|
|
5040
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.appBuild} header.`
|
|
5041
|
+
};
|
|
5042
|
+
}
|
|
5043
|
+
if (!pageBundle) {
|
|
5044
|
+
return {
|
|
5045
|
+
kind: "invalid",
|
|
5046
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.pageBundle} header.`
|
|
5047
|
+
};
|
|
5048
|
+
}
|
|
5049
|
+
if (!pageContractsValue) {
|
|
5050
|
+
return {
|
|
5051
|
+
kind: "invalid",
|
|
5052
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.pageContracts} header.`
|
|
5053
|
+
};
|
|
5054
|
+
}
|
|
5055
|
+
if (!pageId) {
|
|
5056
|
+
return {
|
|
5057
|
+
kind: "invalid",
|
|
5058
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.pageId} header.`
|
|
5059
|
+
};
|
|
5060
|
+
}
|
|
5061
|
+
const pageContracts = [
|
|
5062
|
+
...new Set(pageContractsValue.split(",").map((value) => value.trim()).filter(Boolean))
|
|
5063
|
+
];
|
|
5064
|
+
if (pageContracts.length === 0) {
|
|
5065
|
+
return {
|
|
5066
|
+
kind: "invalid",
|
|
5067
|
+
message: `${MOBILE_PAGE_REQUEST_HEADERS.pageContracts} must contain at least one contract.`
|
|
5068
|
+
};
|
|
5069
|
+
}
|
|
5070
|
+
return {
|
|
5071
|
+
client: {
|
|
5072
|
+
appBuild,
|
|
5073
|
+
pageBundle,
|
|
5074
|
+
pageContracts,
|
|
5075
|
+
pageId,
|
|
5076
|
+
protocol: Number(protocolValue),
|
|
5077
|
+
runtime
|
|
5078
|
+
},
|
|
5079
|
+
kind: "mobile"
|
|
5080
|
+
};
|
|
5081
|
+
};
|
|
5082
|
+
var responseHeaders = () => {
|
|
5083
|
+
const headers = new Headers({
|
|
5084
|
+
"cache-control": "no-store",
|
|
5085
|
+
"content-type": `${ABSOLUTE_MOBILE_PAGE_MEDIA_TYPE}; version=${ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION}`
|
|
5086
|
+
});
|
|
5087
|
+
headerVaryValues.forEach((value) => headers.append("vary", value));
|
|
5088
|
+
return headers;
|
|
5089
|
+
};
|
|
5090
|
+
var headerVaryValues = [
|
|
5091
|
+
"Accept",
|
|
5092
|
+
MOBILE_PAGE_REQUEST_HEADERS.protocol,
|
|
5093
|
+
MOBILE_PAGE_REQUEST_HEADERS.runtime,
|
|
5094
|
+
MOBILE_PAGE_REQUEST_HEADERS.appBuild,
|
|
5095
|
+
MOBILE_PAGE_REQUEST_HEADERS.pageBundle,
|
|
5096
|
+
MOBILE_PAGE_REQUEST_HEADERS.pageContracts,
|
|
5097
|
+
MOBILE_PAGE_REQUEST_HEADERS.pageId
|
|
5098
|
+
];
|
|
5099
|
+
var envelopeResponse = (response, status) => new Response(JSON.stringify({
|
|
5100
|
+
protocol: ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION,
|
|
5101
|
+
response
|
|
5102
|
+
}), { headers: responseHeaders(), status });
|
|
5103
|
+
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5104
|
+
var normalizeJsonValue = (value) => {
|
|
5105
|
+
const serialized = JSON.stringify(value);
|
|
5106
|
+
if (serialized === undefined) {
|
|
5107
|
+
throw new TypeError("Mobile page props must be JSON-serializable.");
|
|
5108
|
+
}
|
|
5109
|
+
const parsed = JSON.parse(serialized);
|
|
5110
|
+
if (!isRecord(parsed)) {
|
|
5111
|
+
throw new TypeError("Mobile page props must serialize to an object.");
|
|
5112
|
+
}
|
|
5113
|
+
return parsed;
|
|
5114
|
+
};
|
|
5115
|
+
var finalizeArchivedMobilePage = (context, input) => {
|
|
5116
|
+
const { page } = context;
|
|
5117
|
+
if (page.pageId !== input.compatibility.pageId || page.framework !== input.compatibility.framework) {
|
|
5118
|
+
return envelopeResponse({
|
|
5119
|
+
kind: "invalid-request",
|
|
5120
|
+
message: "Archived producer page identity does not match its release artifact."
|
|
5121
|
+
}, BAD_REQUEST_STATUS);
|
|
5122
|
+
}
|
|
5123
|
+
try {
|
|
5124
|
+
const [currentRepresentation] = input.compatibility.representations;
|
|
5125
|
+
if (!currentRepresentation) {
|
|
5126
|
+
throw new TypeError("Mobile page has no current representation.");
|
|
5127
|
+
}
|
|
5128
|
+
return envelopeResponse({
|
|
5129
|
+
contract: page.contract,
|
|
5130
|
+
framework: page.framework,
|
|
5131
|
+
kind: "page",
|
|
5132
|
+
pageId: page.pageId,
|
|
5133
|
+
props: normalizeJsonValue(currentRepresentation.mapProps(input.props)),
|
|
5134
|
+
status: input.status ?? OK_STATUS
|
|
5135
|
+
}, input.status ?? OK_STATUS);
|
|
5136
|
+
} catch (error) {
|
|
5137
|
+
console.error(`[Mobile] Archived producer ${context.releaseId} failed for ${page.pageId}:`, error);
|
|
5138
|
+
return createAbsoluteMobilePageErrorResponse(page.pageId);
|
|
5139
|
+
}
|
|
5140
|
+
};
|
|
5141
|
+
var createAbsoluteMobileInvalidRequestResponse = (message) => envelopeResponse({ kind: "invalid-request", message }, BAD_REQUEST_STATUS);
|
|
5142
|
+
var createAbsoluteMobilePageErrorResponse = (pageId) => envelopeResponse({
|
|
5143
|
+
code: "representation-failed",
|
|
5144
|
+
kind: "error",
|
|
5145
|
+
pageId,
|
|
5146
|
+
status: SERVER_ERROR_STATUS
|
|
5147
|
+
}, SERVER_ERROR_STATUS);
|
|
5148
|
+
var createAbsoluteMobileUpgradeResponse = (result) => envelopeResponse(result, UPGRADE_REQUIRED_STATUS);
|
|
5149
|
+
var finalizeAbsoluteMobilePage = (input) => {
|
|
5150
|
+
const parsed = parseAbsoluteMobilePageRequest(input.request);
|
|
5151
|
+
if (parsed.kind === "not-mobile")
|
|
5152
|
+
return;
|
|
5153
|
+
if (parsed.kind === "invalid") {
|
|
5154
|
+
return envelopeResponse({ kind: "invalid-request", message: parsed.message }, BAD_REQUEST_STATUS);
|
|
5155
|
+
}
|
|
5156
|
+
const { client } = parsed;
|
|
5157
|
+
if (client.pageId !== input.compatibility.pageId) {
|
|
5158
|
+
return envelopeResponse({
|
|
5159
|
+
kind: "invalid-request",
|
|
5160
|
+
message: `Requested mobile page ${client.pageId} does not match ${input.compatibility.pageId}.`
|
|
5161
|
+
}, BAD_REQUEST_STATUS);
|
|
5162
|
+
}
|
|
5163
|
+
const producerContext = getCurrentAbsoluteMobileProducerContext();
|
|
5164
|
+
if (producerContext)
|
|
5165
|
+
return finalizeArchivedMobilePage(producerContext, input);
|
|
5166
|
+
if (client.protocol !== ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION) {
|
|
5167
|
+
return envelopeResponse({
|
|
5168
|
+
kind: "upgrade-required",
|
|
5169
|
+
pageId: input.compatibility.pageId,
|
|
5170
|
+
reason: "protocol"
|
|
5171
|
+
}, UPGRADE_REQUIRED_STATUS);
|
|
5172
|
+
}
|
|
5173
|
+
if (!input.compatibility.runtimes.includes(client.runtime)) {
|
|
5174
|
+
return envelopeResponse({
|
|
5175
|
+
kind: "upgrade-required",
|
|
5176
|
+
pageId: input.compatibility.pageId,
|
|
5177
|
+
reason: "runtime",
|
|
5178
|
+
supportedRuntimes: [...input.compatibility.runtimes]
|
|
5179
|
+
}, UPGRADE_REQUIRED_STATUS);
|
|
5180
|
+
}
|
|
5181
|
+
const clientContracts = new Set(client.pageContracts);
|
|
5182
|
+
const representation = input.compatibility.representations.find(({ contract }) => clientContracts.has(contract));
|
|
5183
|
+
if (!representation) {
|
|
5184
|
+
return envelopeResponse({
|
|
5185
|
+
kind: "upgrade-required",
|
|
5186
|
+
pageId: input.compatibility.pageId,
|
|
5187
|
+
reason: "page-contract",
|
|
5188
|
+
supportedContracts: input.compatibility.representations.map(({ contract }) => contract)
|
|
5189
|
+
}, UPGRADE_REQUIRED_STATUS);
|
|
5190
|
+
}
|
|
5191
|
+
try {
|
|
5192
|
+
return envelopeResponse({
|
|
5193
|
+
contract: representation.contract,
|
|
5194
|
+
framework: input.compatibility.framework,
|
|
5195
|
+
kind: "page",
|
|
5196
|
+
pageId: input.compatibility.pageId,
|
|
5197
|
+
props: normalizeJsonValue(representation.mapProps(input.props)),
|
|
5198
|
+
status: input.status ?? OK_STATUS
|
|
5199
|
+
}, input.status ?? OK_STATUS);
|
|
5200
|
+
} catch (error) {
|
|
5201
|
+
console.error(`[Mobile] Failed to produce ${input.compatibility.pageId} representation ${representation.contract}:`, error);
|
|
5202
|
+
return envelopeResponse({
|
|
5203
|
+
code: "representation-failed",
|
|
5204
|
+
kind: "error",
|
|
5205
|
+
pageId: input.compatibility.pageId,
|
|
5206
|
+
status: SERVER_ERROR_STATUS
|
|
5207
|
+
}, SERVER_ERROR_STATUS);
|
|
5208
|
+
}
|
|
5209
|
+
};
|
|
5210
|
+
|
|
5211
|
+
// src/vue/pageHandler.ts
|
|
4940
5212
|
init_pageResponseCache();
|
|
4941
5213
|
|
|
4942
5214
|
// src/core/responseEnhancers.ts
|
|
@@ -4993,7 +5265,7 @@ var withRegisteredStreamingSlots = async (renderResponse, options = {}) => {
|
|
|
4993
5265
|
|
|
4994
5266
|
// src/core/streamingSlotWarningScope.ts
|
|
4995
5267
|
init_logger();
|
|
4996
|
-
import { AsyncLocalStorage as
|
|
5268
|
+
import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
|
|
4997
5269
|
var STREAMING_SLOT_WARNING_STORAGE_KEY2 = Symbol.for("absolutejs.streamingSlotWarningAsyncLocalStorage");
|
|
4998
5270
|
var isObjectRecord5 = (value) => Boolean(value) && typeof value === "object";
|
|
4999
5271
|
var isAsyncLocalStorage3 = (value) => isObjectRecord5(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
|
|
@@ -5009,7 +5281,7 @@ var ensureWarningStorage = () => {
|
|
|
5009
5281
|
if (existing) {
|
|
5010
5282
|
return existing;
|
|
5011
5283
|
}
|
|
5012
|
-
const storage = new
|
|
5284
|
+
const storage = new AsyncLocalStorage3;
|
|
5013
5285
|
Reflect.set(globalThis, STREAMING_SLOT_WARNING_STORAGE_KEY2, storage);
|
|
5014
5286
|
return storage;
|
|
5015
5287
|
};
|
|
@@ -5091,23 +5363,23 @@ var ABSOLUTE_TELEPORT_TARGET_ID = "absolute-teleports";
|
|
|
5091
5363
|
var ABSOLUTE_TELEPORT_TARGET = `#${ABSOLUTE_TELEPORT_TARGET_ID}`;
|
|
5092
5364
|
|
|
5093
5365
|
// src/vue/pageHandler.ts
|
|
5094
|
-
var
|
|
5095
|
-
var isGenericVueComponent = (value) => typeof value === "function" ||
|
|
5366
|
+
var isRecord3 = (value) => typeof value === "object" && value !== null;
|
|
5367
|
+
var isGenericVueComponent = (value) => typeof value === "function" || isRecord3(value);
|
|
5096
5368
|
var readHasIslands = (value) => {
|
|
5097
|
-
if (!
|
|
5369
|
+
if (!isRecord3(value))
|
|
5098
5370
|
return false;
|
|
5099
5371
|
const hasIslands = value["__ABSOLUTE_PAGE_HAS_ISLANDS__"];
|
|
5100
5372
|
return typeof hasIslands === "boolean" ? hasIslands : false;
|
|
5101
5373
|
};
|
|
5102
5374
|
var isVueSetupApp = (value) => typeof value === "function";
|
|
5103
5375
|
var readSetupAppHook = (value) => {
|
|
5104
|
-
if (!
|
|
5376
|
+
if (!isRecord3(value))
|
|
5105
5377
|
return null;
|
|
5106
5378
|
const { setupApp } = value;
|
|
5107
5379
|
return isVueSetupApp(setupApp) ? setupApp : null;
|
|
5108
5380
|
};
|
|
5109
|
-
var readHasSpaRoutes = (value) =>
|
|
5110
|
-
var readDefaultExport = (value) =>
|
|
5381
|
+
var readHasSpaRoutes = (value) => isRecord3(value) && Array.isArray(value["routes"]);
|
|
5382
|
+
var readDefaultExport = (value) => isRecord3(value) ? value.default : undefined;
|
|
5111
5383
|
var resolveRequestRenderUrl = (request) => {
|
|
5112
5384
|
if (!request)
|
|
5113
5385
|
return "/";
|
|
@@ -5137,12 +5409,29 @@ var getSsrOnlyHmrShim = () => {
|
|
|
5137
5409
|
};
|
|
5138
5410
|
var handleVuePageRequest = async (input) => {
|
|
5139
5411
|
const passedPageComponent = input.Page;
|
|
5412
|
+
const request = input.request ?? getCurrentAbsoluteRequest();
|
|
5413
|
+
const pageId = input.__absoluteMobile?.pageId ?? derivePageName(input.pagePath);
|
|
5414
|
+
const currentContract = input.__absoluteMobile?.contract ?? `vue:${pageId}:${ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION}`;
|
|
5415
|
+
const mobileResponse = finalizeAbsoluteMobilePage({
|
|
5416
|
+
compatibility: {
|
|
5417
|
+
framework: "vue",
|
|
5418
|
+
pageId,
|
|
5419
|
+
representations: [
|
|
5420
|
+
{ contract: currentContract, mapProps: (props) => props }
|
|
5421
|
+
],
|
|
5422
|
+
runtimes: [String(ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION)]
|
|
5423
|
+
},
|
|
5424
|
+
props: input.props ?? Object.create(null),
|
|
5425
|
+
request
|
|
5426
|
+
});
|
|
5427
|
+
if (mobileResponse)
|
|
5428
|
+
return mobileResponse;
|
|
5140
5429
|
const userHeadTag = input.headTag ?? "<head></head>";
|
|
5141
5430
|
const resolvedOptions = input;
|
|
5142
5431
|
const resolvedPagePath = input.pagePath;
|
|
5143
5432
|
const [siblingCss, spaChildCss] = await Promise.all([
|
|
5144
5433
|
readSiblingCss(resolvedPagePath),
|
|
5145
|
-
resolveSpaChildCss(resolvedPagePath,
|
|
5434
|
+
resolveSpaChildCss(resolvedPagePath, request?.url)
|
|
5146
5435
|
]);
|
|
5147
5436
|
const resolvedHeadTag = injectInlineCss(injectInlineCss(userHeadTag, siblingCss), spaChildCss);
|
|
5148
5437
|
const maybeProps = input.props;
|
|
@@ -5155,9 +5444,9 @@ var handleVuePageRequest = async (input) => {
|
|
|
5155
5444
|
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.');
|
|
5156
5445
|
}
|
|
5157
5446
|
try {
|
|
5158
|
-
const spaNotFound = await renderSpaNotFound("vue", derivePageName(resolvedPagePath),
|
|
5447
|
+
const spaNotFound = await renderSpaNotFound("vue", derivePageName(resolvedPagePath), request);
|
|
5159
5448
|
if (spaNotFound)
|
|
5160
|
-
return withPageCacheHeaders(spaNotFound,
|
|
5449
|
+
return withPageCacheHeaders(spaNotFound, request);
|
|
5161
5450
|
const handlerCallsite = resolvedOptions?.collectStreamingSlots === true ? undefined : getCurrentRouteRegistrationCallsite() ?? captureStreamingSlotWarningCallsite();
|
|
5162
5451
|
const renderPageResponse = async () => {
|
|
5163
5452
|
const resolvePageComponent = async () => {
|
|
@@ -5190,7 +5479,7 @@ var handleVuePageRequest = async (input) => {
|
|
|
5190
5479
|
let pendingRedirect = null;
|
|
5191
5480
|
let pendingNotFound = false;
|
|
5192
5481
|
if (resolvedPage.setupApp) {
|
|
5193
|
-
const url = resolveRequestRenderUrl(
|
|
5482
|
+
const url = resolveRequestRenderUrl(request);
|
|
5194
5483
|
await resolvedPage.setupApp(app, {
|
|
5195
5484
|
isServer: true,
|
|
5196
5485
|
router: null,
|
|
@@ -5271,7 +5560,7 @@ var handleVuePageRequest = async (input) => {
|
|
|
5271
5560
|
});
|
|
5272
5561
|
};
|
|
5273
5562
|
const pageResponse = await runWithStreamingSlotWarningScope(() => resolvedOptions?.collectStreamingSlots === true ? withRegisteredStreamingSlots(renderPageResponse, resolvedOptions) : renderPageResponse(), { handlerCallsite });
|
|
5274
|
-
return withPageCacheHeaders(pageResponse,
|
|
5563
|
+
return withPageCacheHeaders(pageResponse, request, {
|
|
5275
5564
|
bufferStreamForEtag: input.bufferStreamForEtag
|
|
5276
5565
|
});
|
|
5277
5566
|
} catch (error) {
|
|
@@ -5279,12 +5568,12 @@ var handleVuePageRequest = async (input) => {
|
|
|
5279
5568
|
const pageName = derivePageName(resolvedPagePath);
|
|
5280
5569
|
const conventionResponse = await renderConventionError("vue", pageName, error);
|
|
5281
5570
|
if (conventionResponse) {
|
|
5282
|
-
return withPageCacheHeaders(conventionResponse,
|
|
5571
|
+
return withPageCacheHeaders(conventionResponse, request);
|
|
5283
5572
|
}
|
|
5284
5573
|
return withPageCacheHeaders(new Response(ssrErrorPage("vue", error), {
|
|
5285
5574
|
headers: { "Content-Type": "text/html" },
|
|
5286
5575
|
status: 500
|
|
5287
|
-
}),
|
|
5576
|
+
}), request);
|
|
5288
5577
|
}
|
|
5289
5578
|
};
|
|
5290
5579
|
// src/vue/routerRedirectProviders.ts
|
|
@@ -5747,5 +6036,5 @@ export {
|
|
|
5747
6036
|
ABSOLUTE_TELEPORT_TARGET
|
|
5748
6037
|
};
|
|
5749
6038
|
|
|
5750
|
-
//# debugId=
|
|
6039
|
+
//# debugId=296101957B993E2D64756E2164756E21
|
|
5751
6040
|
//# sourceMappingURL=index.js.map
|