@absolutejs/absolute 0.20.0-beta.4 → 0.20.0-beta.6
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 +21 -9
package/dist/angular/server.js
CHANGED
|
@@ -3281,7 +3281,7 @@ var SLOT_ID_PREFIX = "abs-slot-", CLOSING_BODY_TAG = "</body>", CLOSING_HEAD_TAG
|
|
|
3281
3281
|
getStreamingSlotsRuntimeScript()
|
|
3282
3282
|
].filter(Boolean).join(";");
|
|
3283
3283
|
return `<script${createNonceAttr(nonce)}>${escapeScriptContent(runtimeBody)}</script>`;
|
|
3284
|
-
}, toUint8 = (value, encoder) => encoder.encode(value),
|
|
3284
|
+
}, toUint8 = (value, encoder) => encoder.encode(value), isRecord5 = (value) => Boolean(value) && typeof value === "object", isSafeHtmlLike = (value) => isRecord5(value) && typeof value.changingThisBreaksApplicationSecurity === "string", normalizeSafeHtml = (value) => {
|
|
3285
3285
|
if (isSafeHtmlLike(value)) {
|
|
3286
3286
|
return value.changingThisBreaksApplicationSecurity;
|
|
3287
3287
|
}
|
|
@@ -3342,7 +3342,7 @@ var SLOT_ID_PREFIX = "abs-slot-", CLOSING_BODY_TAG = "</body>", CLOSING_HEAD_TAG
|
|
|
3342
3342
|
}, createTimeoutError = (slot, timeoutMs) => {
|
|
3343
3343
|
const error = Object.assign(new Error(`Streaming slot "${slot.id}" timed out after ${timeoutMs}ms`), { __absTimeout: true });
|
|
3344
3344
|
return error;
|
|
3345
|
-
}, isSlotPatchPayloadObject = (value) =>
|
|
3345
|
+
}, isSlotPatchPayloadObject = (value) => isRecord5(value) && ("html" in value), isTimeoutError = (error) => isRecord5(error) && error.__absTimeout === true, toStreamingSlot = (slot, policy) => ({
|
|
3346
3346
|
errorHtml: slot.errorHtml === undefined ? policy.errorHtml : slot.errorHtml,
|
|
3347
3347
|
fallbackHtml: normalizeSlotText(slot.fallbackHtml, policy.fallbackHtml),
|
|
3348
3348
|
id: slot.id ?? createStreamingSlotId(),
|
|
@@ -5667,6 +5667,7 @@ var requestContext = Object.prototype.hasOwnProperty.call(window, '__ABS_ANGULAR
|
|
|
5667
5667
|
var pageHasIslands = Boolean(pageModule.__ABSOLUTE_PAGE_HAS_ISLANDS__) || Boolean(document.querySelector('[data-island="true"]'));
|
|
5668
5668
|
var pageHasRawStreamingSlots = Boolean(document.querySelector('[data-absolute-raw-slot="true"]'));
|
|
5669
5669
|
var pageHasStreamingSlots = Boolean(document.querySelector('[data-absolute-slot="true"]'));
|
|
5670
|
+
var isClientRender = window.__ABSOLUTE_PAGE_RENDER_MODE__ === 'client';
|
|
5670
5671
|
var contextProviders = [{ provide: REQUEST_CONTEXT, useValue: requestContext }];
|
|
5671
5672
|
// Page-level providers are injected directly into the page module's
|
|
5672
5673
|
// server output by \`compileAngular\`'s providers-injection step
|
|
@@ -5717,13 +5718,14 @@ if (!document.querySelector(_sel)) {
|
|
|
5717
5718
|
}
|
|
5718
5719
|
|
|
5719
5720
|
var providers = [provideZonelessChangeDetection()];
|
|
5720
|
-
if (!window.__HMR_SKIP_HYDRATION__ && !pageHasIslands) {
|
|
5721
|
+
if (!isClientRender && !window.__HMR_SKIP_HYDRATION__ && !pageHasIslands) {
|
|
5721
5722
|
providers.push(provideClientHydration(withHttpTransferCacheOptions(absoluteHttpTransferCacheOptions)));
|
|
5722
5723
|
}
|
|
5723
5724
|
delete window.__HMR_SKIP_HYDRATION__;
|
|
5724
5725
|
providers.push.apply(providers, pageProviders);
|
|
5725
5726
|
providers.push.apply(providers, contextProviders);
|
|
5726
5727
|
window.__ABS_SLOT_HYDRATION_PENDING__ = pageHasRawStreamingSlots;
|
|
5728
|
+
var absolutePageReady = Promise.resolve();
|
|
5727
5729
|
|
|
5728
5730
|
if (pageHasRawStreamingSlots) {
|
|
5729
5731
|
window.__ABS_SLOT_HYDRATION_PENDING__ = false;
|
|
@@ -5733,7 +5735,7 @@ if (pageHasRawStreamingSlots) {
|
|
|
5733
5735
|
});
|
|
5734
5736
|
}
|
|
5735
5737
|
} else {
|
|
5736
|
-
bootstrapApplication(${componentClassName}, {
|
|
5738
|
+
absolutePageReady = bootstrapApplication(${componentClassName}, {
|
|
5737
5739
|
providers: providers
|
|
5738
5740
|
}).then(function (appRef) {
|
|
5739
5741
|
window.__ANGULAR_APP__ = appRef;
|
|
@@ -5743,8 +5745,17 @@ if (pageHasRawStreamingSlots) {
|
|
|
5743
5745
|
window.__ABS_SLOT_FLUSH__();
|
|
5744
5746
|
});
|
|
5745
5747
|
}
|
|
5748
|
+
return appRef;
|
|
5746
5749
|
});
|
|
5747
5750
|
}
|
|
5751
|
+
window.__ABSOLUTE_PAGE_READY__ = absolutePageReady;
|
|
5752
|
+
window.__ABSOLUTE_PAGE_DISPOSE__ = async function() {
|
|
5753
|
+
await absolutePageReady;
|
|
5754
|
+
if (window.__ANGULAR_APP__) {
|
|
5755
|
+
window.__ANGULAR_APP__.destroy();
|
|
5756
|
+
window.__ANGULAR_APP__ = null;
|
|
5757
|
+
}
|
|
5758
|
+
};
|
|
5748
5759
|
`.trim() : `
|
|
5749
5760
|
import '@angular/compiler';
|
|
5750
5761
|
import { bootstrapApplication } from '@angular/platform-browser';
|
|
@@ -5763,6 +5774,7 @@ var requestContext = Object.prototype.hasOwnProperty.call(window, '__ABS_ANGULAR
|
|
|
5763
5774
|
var pageHasIslands = Boolean(pageModule.__ABSOLUTE_PAGE_HAS_ISLANDS__) || Boolean(document.querySelector('[data-island="true"]'));
|
|
5764
5775
|
var pageHasRawStreamingSlots = Boolean(document.querySelector('[data-absolute-raw-slot="true"]'));
|
|
5765
5776
|
var pageHasStreamingSlots = Boolean(document.querySelector('[data-absolute-slot="true"]'));
|
|
5777
|
+
var isClientRender = window.__ABSOLUTE_PAGE_RENDER_MODE__ === 'client';
|
|
5766
5778
|
var contextProviders = [{ provide: REQUEST_CONTEXT, useValue: requestContext }];
|
|
5767
5779
|
// Page-level providers are injected directly into the page module's
|
|
5768
5780
|
// server output by \`compileAngular\`'s providers-injection step
|
|
@@ -5782,11 +5794,21 @@ var absoluteHttpTransferCacheOptions = {
|
|
|
5782
5794
|
|
|
5783
5795
|
enableProdMode();
|
|
5784
5796
|
|
|
5797
|
+
// Production mobile/client-only activation starts from AbsoluteJS's empty
|
|
5798
|
+
// #root shell rather than server-rendered Angular markup. Create the page's
|
|
5799
|
+
// actual Angular host from its compiled selector so application authors do
|
|
5800
|
+
// not need framework-specific mobile configuration.
|
|
5801
|
+
var _sel = ${componentClassName}.\u0275cmp?.selectors?.[0]?.[0] || 'ng-app';
|
|
5802
|
+
if (!document.querySelector(_sel)) {
|
|
5803
|
+
(document.getElementById('root') || document.body).appendChild(document.createElement(_sel));
|
|
5804
|
+
}
|
|
5805
|
+
|
|
5785
5806
|
var providers = [provideZonelessChangeDetection()].concat(pageProviders).concat(contextProviders);
|
|
5786
|
-
if (!pageHasIslands) {
|
|
5807
|
+
if (!isClientRender && !pageHasIslands) {
|
|
5787
5808
|
providers.unshift(provideClientHydration(withHttpTransferCacheOptions(absoluteHttpTransferCacheOptions)));
|
|
5788
5809
|
}
|
|
5789
5810
|
window.__ABS_SLOT_HYDRATION_PENDING__ = pageHasRawStreamingSlots;
|
|
5811
|
+
var absolutePageReady = Promise.resolve();
|
|
5790
5812
|
|
|
5791
5813
|
if (pageHasRawStreamingSlots) {
|
|
5792
5814
|
window.__ABS_SLOT_HYDRATION_PENDING__ = false;
|
|
@@ -5796,7 +5818,7 @@ if (pageHasRawStreamingSlots) {
|
|
|
5796
5818
|
});
|
|
5797
5819
|
}
|
|
5798
5820
|
} else {
|
|
5799
|
-
bootstrapApplication(${componentClassName}, {
|
|
5821
|
+
absolutePageReady = bootstrapApplication(${componentClassName}, {
|
|
5800
5822
|
providers: providers
|
|
5801
5823
|
}).then(function (appRef) {
|
|
5802
5824
|
window.__ANGULAR_APP__ = appRef;
|
|
@@ -5806,8 +5828,17 @@ if (pageHasRawStreamingSlots) {
|
|
|
5806
5828
|
window.__ABS_SLOT_FLUSH__();
|
|
5807
5829
|
});
|
|
5808
5830
|
}
|
|
5831
|
+
return appRef;
|
|
5809
5832
|
});
|
|
5810
5833
|
}
|
|
5834
|
+
window.__ABSOLUTE_PAGE_READY__ = absolutePageReady;
|
|
5835
|
+
window.__ABSOLUTE_PAGE_DISPOSE__ = async function() {
|
|
5836
|
+
await absolutePageReady;
|
|
5837
|
+
if (window.__ANGULAR_APP__) {
|
|
5838
|
+
window.__ANGULAR_APP__.destroy();
|
|
5839
|
+
window.__ANGULAR_APP__ = null;
|
|
5840
|
+
}
|
|
5841
|
+
};
|
|
5811
5842
|
`.trim();
|
|
5812
5843
|
const indexHash = Bun.hash(hydration).toString(BASE_36_RADIX);
|
|
5813
5844
|
const indexUnchanged = cachedWrapper?.indexHash === indexHash;
|
|
@@ -6008,7 +6039,7 @@ var provideDeterministicEnv = (options = {}) => {
|
|
|
6008
6039
|
};
|
|
6009
6040
|
// src/angular/pageHandler.ts
|
|
6010
6041
|
init_constants();
|
|
6011
|
-
import { AsyncLocalStorage as
|
|
6042
|
+
import { AsyncLocalStorage as AsyncLocalStorage4 } from "async_hooks";
|
|
6012
6043
|
import { lstat, mkdir as mkdir4, readlink, symlink } from "fs/promises";
|
|
6013
6044
|
import { basename as basename5, dirname as dirname6, join as join10, resolve as resolve8 } from "path";
|
|
6014
6045
|
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
@@ -6401,6 +6432,276 @@ var lowerAngularServerIslands = async (html) => {
|
|
|
6401
6432
|
// src/angular/pageHandler.ts
|
|
6402
6433
|
init_devRouteRegistrationCallsite();
|
|
6403
6434
|
|
|
6435
|
+
// src/core/requestContext.ts
|
|
6436
|
+
import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
|
|
6437
|
+
import { Elysia as Elysia2 } from "elysia";
|
|
6438
|
+
var REQUEST_STORAGE_KEY = Symbol.for("absolutejs.requestAsyncLocalStorage");
|
|
6439
|
+
var isAbsoluteRequestStorage = (value) => typeof value === "object" && value !== null && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
|
|
6440
|
+
var getRequestStorage = () => {
|
|
6441
|
+
const value = Reflect.get(globalThis, REQUEST_STORAGE_KEY);
|
|
6442
|
+
return isAbsoluteRequestStorage(value) ? value : undefined;
|
|
6443
|
+
};
|
|
6444
|
+
var ensureRequestStorage = () => {
|
|
6445
|
+
const existing = getRequestStorage();
|
|
6446
|
+
if (existing)
|
|
6447
|
+
return existing;
|
|
6448
|
+
const storage = new AsyncLocalStorage2;
|
|
6449
|
+
Reflect.set(globalThis, REQUEST_STORAGE_KEY, storage);
|
|
6450
|
+
return storage;
|
|
6451
|
+
};
|
|
6452
|
+
var absoluteRequestContext = new Elysia2({
|
|
6453
|
+
name: "absolutejs-request-context"
|
|
6454
|
+
}).request(({ request }) => {
|
|
6455
|
+
ensureRequestStorage().enterWith({ request });
|
|
6456
|
+
}).as("global");
|
|
6457
|
+
var getCurrentAbsoluteRequest = () => getRequestStorage()?.getStore()?.request;
|
|
6458
|
+
var runWithAbsoluteRequest = (request, callback) => ensureRequestStorage().run({ request }, callback);
|
|
6459
|
+
|
|
6460
|
+
// src/mobile/producerContextState.ts
|
|
6461
|
+
var ABSOLUTE_MOBILE_PRODUCER_STORAGE_KEY = Symbol.for("absolutejs.mobileProducerAsyncLocalStorage");
|
|
6462
|
+
var frameworks = new Set([
|
|
6463
|
+
"angular",
|
|
6464
|
+
"ember",
|
|
6465
|
+
"html",
|
|
6466
|
+
"htmx",
|
|
6467
|
+
"react",
|
|
6468
|
+
"svelte",
|
|
6469
|
+
"vue"
|
|
6470
|
+
]);
|
|
6471
|
+
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";
|
|
6472
|
+
var getCurrentAbsoluteMobileProducerContext = () => {
|
|
6473
|
+
const value = Reflect.get(globalThis, ABSOLUTE_MOBILE_PRODUCER_STORAGE_KEY);
|
|
6474
|
+
if (typeof value !== "object" || value === null || !("getStore" in value) || typeof value.getStore !== "function") {
|
|
6475
|
+
return;
|
|
6476
|
+
}
|
|
6477
|
+
const context = value.getStore();
|
|
6478
|
+
if (typeof context !== "object" || context === null || !("page" in context) || !isCompatibilityPage(context.page) || !("releaseId" in context) || typeof context.releaseId !== "string") {
|
|
6479
|
+
return;
|
|
6480
|
+
}
|
|
6481
|
+
return { page: context.page, releaseId: context.releaseId };
|
|
6482
|
+
};
|
|
6483
|
+
|
|
6484
|
+
// src/mobile/pageProtocol.ts
|
|
6485
|
+
var ABSOLUTE_MOBILE_PAGE_MEDIA_TYPE = "application/vnd.absolute.page+json";
|
|
6486
|
+
var ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION = 1;
|
|
6487
|
+
var BAD_REQUEST_STATUS = 400;
|
|
6488
|
+
var OK_STATUS = 200;
|
|
6489
|
+
var SERVER_ERROR_STATUS = 500;
|
|
6490
|
+
var UPGRADE_REQUIRED_STATUS = 426;
|
|
6491
|
+
var MOBILE_PAGE_REQUEST_HEADERS = {
|
|
6492
|
+
appBuild: "x-absolute-mobile-app-build",
|
|
6493
|
+
pageBundle: "x-absolute-mobile-page-bundle",
|
|
6494
|
+
pageContracts: "x-absolute-mobile-page-contracts",
|
|
6495
|
+
pageId: "x-absolute-mobile-page-id",
|
|
6496
|
+
protocol: "x-absolute-mobile-protocol",
|
|
6497
|
+
runtime: "x-absolute-mobile-runtime"
|
|
6498
|
+
};
|
|
6499
|
+
var parseMediaType = (value) => value.split(";", 1)[0]?.trim().toLowerCase();
|
|
6500
|
+
var acceptsAbsoluteMobilePage = (request) => {
|
|
6501
|
+
if (!request)
|
|
6502
|
+
return false;
|
|
6503
|
+
return (request.headers.get("accept") ?? "").split(",").some((value) => parseMediaType(value) === ABSOLUTE_MOBILE_PAGE_MEDIA_TYPE);
|
|
6504
|
+
};
|
|
6505
|
+
var readRequiredHeader = (request, name) => {
|
|
6506
|
+
const value = request.headers.get(name)?.trim();
|
|
6507
|
+
return value ? value : undefined;
|
|
6508
|
+
};
|
|
6509
|
+
var parseAbsoluteMobilePageRequest = (request) => {
|
|
6510
|
+
if (!request || !acceptsAbsoluteMobilePage(request)) {
|
|
6511
|
+
return { kind: "not-mobile" };
|
|
6512
|
+
}
|
|
6513
|
+
const protocolValue = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.protocol);
|
|
6514
|
+
const runtime = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.runtime);
|
|
6515
|
+
const appBuild = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.appBuild);
|
|
6516
|
+
const pageBundle = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.pageBundle);
|
|
6517
|
+
const pageContractsValue = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.pageContracts);
|
|
6518
|
+
const pageId = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.pageId);
|
|
6519
|
+
if (!protocolValue || !/^\d+$/.test(protocolValue)) {
|
|
6520
|
+
return {
|
|
6521
|
+
kind: "invalid",
|
|
6522
|
+
message: `Missing or invalid ${MOBILE_PAGE_REQUEST_HEADERS.protocol} header.`
|
|
6523
|
+
};
|
|
6524
|
+
}
|
|
6525
|
+
if (!runtime) {
|
|
6526
|
+
return {
|
|
6527
|
+
kind: "invalid",
|
|
6528
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.runtime} header.`
|
|
6529
|
+
};
|
|
6530
|
+
}
|
|
6531
|
+
if (!appBuild) {
|
|
6532
|
+
return {
|
|
6533
|
+
kind: "invalid",
|
|
6534
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.appBuild} header.`
|
|
6535
|
+
};
|
|
6536
|
+
}
|
|
6537
|
+
if (!pageBundle) {
|
|
6538
|
+
return {
|
|
6539
|
+
kind: "invalid",
|
|
6540
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.pageBundle} header.`
|
|
6541
|
+
};
|
|
6542
|
+
}
|
|
6543
|
+
if (!pageContractsValue) {
|
|
6544
|
+
return {
|
|
6545
|
+
kind: "invalid",
|
|
6546
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.pageContracts} header.`
|
|
6547
|
+
};
|
|
6548
|
+
}
|
|
6549
|
+
if (!pageId) {
|
|
6550
|
+
return {
|
|
6551
|
+
kind: "invalid",
|
|
6552
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.pageId} header.`
|
|
6553
|
+
};
|
|
6554
|
+
}
|
|
6555
|
+
const pageContracts = [
|
|
6556
|
+
...new Set(pageContractsValue.split(",").map((value) => value.trim()).filter(Boolean))
|
|
6557
|
+
];
|
|
6558
|
+
if (pageContracts.length === 0) {
|
|
6559
|
+
return {
|
|
6560
|
+
kind: "invalid",
|
|
6561
|
+
message: `${MOBILE_PAGE_REQUEST_HEADERS.pageContracts} must contain at least one contract.`
|
|
6562
|
+
};
|
|
6563
|
+
}
|
|
6564
|
+
return {
|
|
6565
|
+
client: {
|
|
6566
|
+
appBuild,
|
|
6567
|
+
pageBundle,
|
|
6568
|
+
pageContracts,
|
|
6569
|
+
pageId,
|
|
6570
|
+
protocol: Number(protocolValue),
|
|
6571
|
+
runtime
|
|
6572
|
+
},
|
|
6573
|
+
kind: "mobile"
|
|
6574
|
+
};
|
|
6575
|
+
};
|
|
6576
|
+
var responseHeaders = () => {
|
|
6577
|
+
const headers = new Headers({
|
|
6578
|
+
"cache-control": "no-store",
|
|
6579
|
+
"content-type": `${ABSOLUTE_MOBILE_PAGE_MEDIA_TYPE}; version=${ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION}`
|
|
6580
|
+
});
|
|
6581
|
+
headerVaryValues.forEach((value) => headers.append("vary", value));
|
|
6582
|
+
return headers;
|
|
6583
|
+
};
|
|
6584
|
+
var headerVaryValues = [
|
|
6585
|
+
"Accept",
|
|
6586
|
+
MOBILE_PAGE_REQUEST_HEADERS.protocol,
|
|
6587
|
+
MOBILE_PAGE_REQUEST_HEADERS.runtime,
|
|
6588
|
+
MOBILE_PAGE_REQUEST_HEADERS.appBuild,
|
|
6589
|
+
MOBILE_PAGE_REQUEST_HEADERS.pageBundle,
|
|
6590
|
+
MOBILE_PAGE_REQUEST_HEADERS.pageContracts,
|
|
6591
|
+
MOBILE_PAGE_REQUEST_HEADERS.pageId
|
|
6592
|
+
];
|
|
6593
|
+
var envelopeResponse = (response, status) => new Response(JSON.stringify({
|
|
6594
|
+
protocol: ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION,
|
|
6595
|
+
response
|
|
6596
|
+
}), { headers: responseHeaders(), status });
|
|
6597
|
+
var isRecord4 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6598
|
+
var normalizeJsonValue = (value) => {
|
|
6599
|
+
const serialized = JSON.stringify(value);
|
|
6600
|
+
if (serialized === undefined) {
|
|
6601
|
+
throw new TypeError("Mobile page props must be JSON-serializable.");
|
|
6602
|
+
}
|
|
6603
|
+
const parsed = JSON.parse(serialized);
|
|
6604
|
+
if (!isRecord4(parsed)) {
|
|
6605
|
+
throw new TypeError("Mobile page props must serialize to an object.");
|
|
6606
|
+
}
|
|
6607
|
+
return parsed;
|
|
6608
|
+
};
|
|
6609
|
+
var finalizeArchivedMobilePage = (context, input) => {
|
|
6610
|
+
const { page } = context;
|
|
6611
|
+
if (page.pageId !== input.compatibility.pageId || page.framework !== input.compatibility.framework) {
|
|
6612
|
+
return envelopeResponse({
|
|
6613
|
+
kind: "invalid-request",
|
|
6614
|
+
message: "Archived producer page identity does not match its release artifact."
|
|
6615
|
+
}, BAD_REQUEST_STATUS);
|
|
6616
|
+
}
|
|
6617
|
+
try {
|
|
6618
|
+
const [currentRepresentation] = input.compatibility.representations;
|
|
6619
|
+
if (!currentRepresentation) {
|
|
6620
|
+
throw new TypeError("Mobile page has no current representation.");
|
|
6621
|
+
}
|
|
6622
|
+
return envelopeResponse({
|
|
6623
|
+
contract: page.contract,
|
|
6624
|
+
framework: page.framework,
|
|
6625
|
+
kind: "page",
|
|
6626
|
+
pageId: page.pageId,
|
|
6627
|
+
props: normalizeJsonValue(currentRepresentation.mapProps(input.props)),
|
|
6628
|
+
status: input.status ?? OK_STATUS
|
|
6629
|
+
}, input.status ?? OK_STATUS);
|
|
6630
|
+
} catch (error) {
|
|
6631
|
+
console.error(`[Mobile] Archived producer ${context.releaseId} failed for ${page.pageId}:`, error);
|
|
6632
|
+
return createAbsoluteMobilePageErrorResponse(page.pageId);
|
|
6633
|
+
}
|
|
6634
|
+
};
|
|
6635
|
+
var createAbsoluteMobileInvalidRequestResponse = (message) => envelopeResponse({ kind: "invalid-request", message }, BAD_REQUEST_STATUS);
|
|
6636
|
+
var createAbsoluteMobilePageErrorResponse = (pageId) => envelopeResponse({
|
|
6637
|
+
code: "representation-failed",
|
|
6638
|
+
kind: "error",
|
|
6639
|
+
pageId,
|
|
6640
|
+
status: SERVER_ERROR_STATUS
|
|
6641
|
+
}, SERVER_ERROR_STATUS);
|
|
6642
|
+
var createAbsoluteMobileUpgradeResponse = (result) => envelopeResponse(result, UPGRADE_REQUIRED_STATUS);
|
|
6643
|
+
var finalizeAbsoluteMobilePage = (input) => {
|
|
6644
|
+
const parsed = parseAbsoluteMobilePageRequest(input.request);
|
|
6645
|
+
if (parsed.kind === "not-mobile")
|
|
6646
|
+
return;
|
|
6647
|
+
if (parsed.kind === "invalid") {
|
|
6648
|
+
return envelopeResponse({ kind: "invalid-request", message: parsed.message }, BAD_REQUEST_STATUS);
|
|
6649
|
+
}
|
|
6650
|
+
const { client } = parsed;
|
|
6651
|
+
if (client.pageId !== input.compatibility.pageId) {
|
|
6652
|
+
return envelopeResponse({
|
|
6653
|
+
kind: "invalid-request",
|
|
6654
|
+
message: `Requested mobile page ${client.pageId} does not match ${input.compatibility.pageId}.`
|
|
6655
|
+
}, BAD_REQUEST_STATUS);
|
|
6656
|
+
}
|
|
6657
|
+
const producerContext = getCurrentAbsoluteMobileProducerContext();
|
|
6658
|
+
if (producerContext)
|
|
6659
|
+
return finalizeArchivedMobilePage(producerContext, input);
|
|
6660
|
+
if (client.protocol !== ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION) {
|
|
6661
|
+
return envelopeResponse({
|
|
6662
|
+
kind: "upgrade-required",
|
|
6663
|
+
pageId: input.compatibility.pageId,
|
|
6664
|
+
reason: "protocol"
|
|
6665
|
+
}, UPGRADE_REQUIRED_STATUS);
|
|
6666
|
+
}
|
|
6667
|
+
if (!input.compatibility.runtimes.includes(client.runtime)) {
|
|
6668
|
+
return envelopeResponse({
|
|
6669
|
+
kind: "upgrade-required",
|
|
6670
|
+
pageId: input.compatibility.pageId,
|
|
6671
|
+
reason: "runtime",
|
|
6672
|
+
supportedRuntimes: [...input.compatibility.runtimes]
|
|
6673
|
+
}, UPGRADE_REQUIRED_STATUS);
|
|
6674
|
+
}
|
|
6675
|
+
const clientContracts = new Set(client.pageContracts);
|
|
6676
|
+
const representation = input.compatibility.representations.find(({ contract }) => clientContracts.has(contract));
|
|
6677
|
+
if (!representation) {
|
|
6678
|
+
return envelopeResponse({
|
|
6679
|
+
kind: "upgrade-required",
|
|
6680
|
+
pageId: input.compatibility.pageId,
|
|
6681
|
+
reason: "page-contract",
|
|
6682
|
+
supportedContracts: input.compatibility.representations.map(({ contract }) => contract)
|
|
6683
|
+
}, UPGRADE_REQUIRED_STATUS);
|
|
6684
|
+
}
|
|
6685
|
+
try {
|
|
6686
|
+
return envelopeResponse({
|
|
6687
|
+
contract: representation.contract,
|
|
6688
|
+
framework: input.compatibility.framework,
|
|
6689
|
+
kind: "page",
|
|
6690
|
+
pageId: input.compatibility.pageId,
|
|
6691
|
+
props: normalizeJsonValue(representation.mapProps(input.props)),
|
|
6692
|
+
status: input.status ?? OK_STATUS
|
|
6693
|
+
}, input.status ?? OK_STATUS);
|
|
6694
|
+
} catch (error) {
|
|
6695
|
+
console.error(`[Mobile] Failed to produce ${input.compatibility.pageId} representation ${representation.contract}:`, error);
|
|
6696
|
+
return envelopeResponse({
|
|
6697
|
+
code: "representation-failed",
|
|
6698
|
+
kind: "error",
|
|
6699
|
+
pageId: input.compatibility.pageId,
|
|
6700
|
+
status: SERVER_ERROR_STATUS
|
|
6701
|
+
}, SERVER_ERROR_STATUS);
|
|
6702
|
+
}
|
|
6703
|
+
};
|
|
6704
|
+
|
|
6404
6705
|
// src/angular/ssrSanitizer.ts
|
|
6405
6706
|
var escapeHtml2 = (str) => String(str).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
6406
6707
|
var bypassValue = (value) => ({
|
|
@@ -6512,7 +6813,7 @@ var withRegisteredStreamingSlots = async (renderResponse, options = {}) => {
|
|
|
6512
6813
|
|
|
6513
6814
|
// src/core/streamingSlotWarningScope.ts
|
|
6514
6815
|
init_logger();
|
|
6515
|
-
import { AsyncLocalStorage as
|
|
6816
|
+
import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
|
|
6516
6817
|
var STREAMING_SLOT_WARNING_STORAGE_KEY2 = Symbol.for("absolutejs.streamingSlotWarningAsyncLocalStorage");
|
|
6517
6818
|
var isObjectRecord4 = (value) => Boolean(value) && typeof value === "object";
|
|
6518
6819
|
var isAsyncLocalStorage3 = (value) => isObjectRecord4(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
|
|
@@ -6528,7 +6829,7 @@ var ensureWarningStorage = () => {
|
|
|
6528
6829
|
if (existing) {
|
|
6529
6830
|
return existing;
|
|
6530
6831
|
}
|
|
6531
|
-
const storage = new
|
|
6832
|
+
const storage = new AsyncLocalStorage3;
|
|
6532
6833
|
Reflect.set(globalThis, STREAMING_SLOT_WARNING_STORAGE_KEY2, storage);
|
|
6533
6834
|
return storage;
|
|
6534
6835
|
};
|
|
@@ -6570,11 +6871,11 @@ var runWithStreamingSlotWarningScope = (task, metadata) => ensureWarningStorage(
|
|
|
6570
6871
|
|
|
6571
6872
|
// src/angular/pageHandler.ts
|
|
6572
6873
|
init_ssrRender();
|
|
6573
|
-
var
|
|
6874
|
+
var isRecord6 = (value) => typeof value === "object" && value !== null;
|
|
6574
6875
|
var isAngularComponent2 = (value) => typeof value === "function";
|
|
6575
6876
|
var componentHostsRouterOutlet = (component) => {
|
|
6576
6877
|
const componentDef = Reflect.get(component, "\u0275cmp");
|
|
6577
|
-
if (!
|
|
6878
|
+
if (!isRecord6(componentDef))
|
|
6578
6879
|
return false;
|
|
6579
6880
|
const rawDependencies = componentDef.dependencies;
|
|
6580
6881
|
const dependencies = typeof rawDependencies === "function" ? Reflect.apply(rawDependencies, undefined, []) : rawDependencies;
|
|
@@ -6584,7 +6885,7 @@ var componentHostsRouterOutlet = (component) => {
|
|
|
6584
6885
|
if (dependency === null || typeof dependency !== "object" && typeof dependency !== "function")
|
|
6585
6886
|
return false;
|
|
6586
6887
|
const directiveDef = Reflect.get(dependency, "\u0275dir") ?? dependency;
|
|
6587
|
-
if (!
|
|
6888
|
+
if (!isRecord6(directiveDef))
|
|
6588
6889
|
return false;
|
|
6589
6890
|
const { selectors } = directiveDef;
|
|
6590
6891
|
return Array.isArray(selectors) && JSON.stringify(selectors).includes("router-outlet");
|
|
@@ -6614,7 +6915,7 @@ var ensureAngularCompiler = () => {
|
|
|
6614
6915
|
}
|
|
6615
6916
|
return compilerImportPromise;
|
|
6616
6917
|
};
|
|
6617
|
-
var readAngularPageModule = (value) =>
|
|
6918
|
+
var readAngularPageModule = (value) => isRecord6(value) ? value : null;
|
|
6618
6919
|
var resolveAngularSsrOutDir = (projectRoot = process.cwd(), configuredOutDir = process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR) => configuredOutDir ?? join10(projectRoot, ".absolutejs", "runtime", "angular-ssr");
|
|
6619
6920
|
var createAngularRuntimeCacheBuster = () => `${Date.now().toString(BASE_36_RADIX)}.${Math.random().toString(BASE_36_RADIX).substring(2, RANDOM_ID_END_INDEX)}`;
|
|
6620
6921
|
var existingNodeModulesLinkMatches = async (nodeModulesLink, expectedTarget) => {
|
|
@@ -6715,14 +7016,32 @@ var resolveRequestRenderUrl = (request) => {
|
|
|
6715
7016
|
return "/";
|
|
6716
7017
|
}
|
|
6717
7018
|
};
|
|
6718
|
-
var angularSsrContext = new
|
|
7019
|
+
var angularSsrContext = new AsyncLocalStorage4;
|
|
6719
7020
|
setSsrContextGetter(() => angularSsrContext.getStore());
|
|
6720
7021
|
var handleAngularPageRequest = async (input) => {
|
|
6721
7022
|
const requestId = `angular_${Date.now()}_${Math.random().toString(BASE_36_RADIX).substring(2, RANDOM_ID_END_INDEX)}`;
|
|
7023
|
+
const request = input.request ?? getCurrentAbsoluteRequest();
|
|
7024
|
+
const pageId = input.__absoluteMobile?.pageId ?? derivePageName(input.pagePath);
|
|
7025
|
+
const currentContract = input.__absoluteMobile?.contract ?? `angular:${pageId}:${ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION}`;
|
|
7026
|
+
const mobileResponse = finalizeAbsoluteMobilePage({
|
|
7027
|
+
compatibility: {
|
|
7028
|
+
framework: "angular",
|
|
7029
|
+
pageId,
|
|
7030
|
+
representations: [
|
|
7031
|
+
{ contract: currentContract, mapProps: (props) => props }
|
|
7032
|
+
],
|
|
7033
|
+
runtimes: [String(ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION)]
|
|
7034
|
+
},
|
|
7035
|
+
props: isRecord6(input.requestContext) ? input.requestContext : Object.create(null),
|
|
7036
|
+
request,
|
|
7037
|
+
status: input.responseInit?.status
|
|
7038
|
+
});
|
|
7039
|
+
if (mobileResponse)
|
|
7040
|
+
return mobileResponse;
|
|
6722
7041
|
return angularSsrContext.run(requestId, async () => {
|
|
6723
|
-
const spaNotFound = await renderSpaNotFound("angular", derivePageName(input.pagePath),
|
|
7042
|
+
const spaNotFound = await renderSpaNotFound("angular", derivePageName(input.pagePath), request);
|
|
6724
7043
|
if (spaNotFound)
|
|
6725
|
-
return withPageCacheHeaders(spaNotFound,
|
|
7044
|
+
return withPageCacheHeaders(spaNotFound, request);
|
|
6726
7045
|
await ensureAngularCompiler();
|
|
6727
7046
|
const userHeadTag = input.headTag ?? "<head></head>";
|
|
6728
7047
|
const resolvedIndexPath = input.indexPath;
|
|
@@ -6730,7 +7049,7 @@ var handleAngularPageRequest = async (input) => {
|
|
|
6730
7049
|
const resolvedPagePath = input.pagePath;
|
|
6731
7050
|
const maybeRequestContext = input.requestContext;
|
|
6732
7051
|
const responseInit = input.responseInit ?? {};
|
|
6733
|
-
const resolvedUrl = resolveRequestRenderUrl(
|
|
7052
|
+
const resolvedUrl = resolveRequestRenderUrl(request);
|
|
6734
7053
|
const siblingCss = await readSiblingCss(resolvedPagePath);
|
|
6735
7054
|
const resolvedHeadTag = injectInlineCss(userHeadTag, siblingCss);
|
|
6736
7055
|
cacheRouteData(resolvedPagePath, {
|
|
@@ -6767,7 +7086,7 @@ var handleAngularPageRequest = async (input) => {
|
|
|
6767
7086
|
...handlerCallProviders,
|
|
6768
7087
|
...await buildServerAnimationProviders(usesLegacyAnimations)
|
|
6769
7088
|
];
|
|
6770
|
-
const providers = buildProviders(deps, sanitizer,
|
|
7089
|
+
const providers = buildProviders(deps, sanitizer, request, maybeRequestContext, responseInit, combinedProviders);
|
|
6771
7090
|
const rawHtml = await renderAngularApp(deps, PageComponent, providers, htmlString, resolvedUrl);
|
|
6772
7091
|
const shouldProcessIslands = hasIslands || rawHtml.includes("<absolute-island");
|
|
6773
7092
|
const htmlWithLoweredIslands = shouldProcessIslands ? await lowerAngularServerIslands(rawHtml) : rawHtml;
|
|
@@ -6775,18 +7094,18 @@ var handleAngularPageRequest = async (input) => {
|
|
|
6775
7094
|
return new Response(html, withHtmlContentType(responseInit));
|
|
6776
7095
|
};
|
|
6777
7096
|
const pageResponse = await runWithStreamingSlotWarningScope(() => options?.collectStreamingSlots === true ? withRegisteredStreamingSlots(renderPageResponse, options) : renderPageResponse(), { handlerCallsite });
|
|
6778
|
-
return withPageCacheHeaders(pageResponse,
|
|
7097
|
+
return withPageCacheHeaders(pageResponse, request);
|
|
6779
7098
|
} catch (error) {
|
|
6780
7099
|
console.error("[SSR] Angular render error:", error);
|
|
6781
7100
|
const pageName = derivePageName(resolvedPagePath);
|
|
6782
7101
|
const conventionResponse = await renderConventionError("angular", pageName, error);
|
|
6783
7102
|
if (conventionResponse) {
|
|
6784
|
-
return withPageCacheHeaders(conventionResponse,
|
|
7103
|
+
return withPageCacheHeaders(conventionResponse, request);
|
|
6785
7104
|
}
|
|
6786
7105
|
return withPageCacheHeaders(new Response(ssrErrorPage("angular", error), {
|
|
6787
7106
|
headers: { "Content-Type": "text/html" },
|
|
6788
7107
|
status: 500
|
|
6789
|
-
}),
|
|
7108
|
+
}), request);
|
|
6790
7109
|
}
|
|
6791
7110
|
});
|
|
6792
7111
|
};
|
|
@@ -6812,5 +7131,5 @@ export {
|
|
|
6812
7131
|
ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER
|
|
6813
7132
|
};
|
|
6814
7133
|
|
|
6815
|
-
//# debugId=
|
|
7134
|
+
//# debugId=4F398A37606C42FD64756E2164756E21
|
|
6816
7135
|
//# sourceMappingURL=server.js.map
|