@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var __require = import.meta.require;
|
|
3
3
|
|
|
4
|
-
// .angular-partial-tmp-
|
|
4
|
+
// .angular-partial-tmp-qJaIt9/src/core/streamingSlotRegistrar.ts
|
|
5
5
|
var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
|
|
6
6
|
var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
|
|
7
7
|
var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var __require = import.meta.require;
|
|
3
3
|
|
|
4
|
-
// .angular-partial-tmp-
|
|
4
|
+
// .angular-partial-tmp-qJaIt9/src/core/streamingSlotRegistrar.ts
|
|
5
5
|
var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
|
|
6
6
|
var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
|
|
7
7
|
var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
|
|
@@ -48,7 +48,7 @@ var warnMissingStreamingSlotCollector = (primitiveName) => {
|
|
|
48
48
|
getWarningController()?.maybeWarn(primitiveName);
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
// .angular-partial-tmp-
|
|
51
|
+
// .angular-partial-tmp-qJaIt9/src/core/streamingSlotRegistry.ts
|
|
52
52
|
var STREAMING_SLOT_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotAsyncLocalStorage");
|
|
53
53
|
var isObjectRecord2 = (value) => Boolean(value) && typeof value === "object";
|
|
54
54
|
var isAsyncLocalStorage = (value) => isObjectRecord2(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
|
package/dist/angular/index.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;
|
|
@@ -14949,7 +14980,7 @@ var provideDeterministicEnv = (options = {}) => {
|
|
|
14949
14980
|
};
|
|
14950
14981
|
// src/angular/pageHandler.ts
|
|
14951
14982
|
init_constants();
|
|
14952
|
-
import { AsyncLocalStorage as
|
|
14983
|
+
import { AsyncLocalStorage as AsyncLocalStorage4 } from "async_hooks";
|
|
14953
14984
|
import { lstat, mkdir as mkdir4, readlink, symlink } from "fs/promises";
|
|
14954
14985
|
import { basename as basename5, dirname as dirname6, join as join10, resolve as resolve8 } from "path";
|
|
14955
14986
|
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
@@ -15342,6 +15373,276 @@ var lowerAngularServerIslands = async (html) => {
|
|
|
15342
15373
|
// src/angular/pageHandler.ts
|
|
15343
15374
|
init_devRouteRegistrationCallsite();
|
|
15344
15375
|
|
|
15376
|
+
// src/core/requestContext.ts
|
|
15377
|
+
import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
|
|
15378
|
+
import { Elysia as Elysia2 } from "elysia";
|
|
15379
|
+
var REQUEST_STORAGE_KEY = Symbol.for("absolutejs.requestAsyncLocalStorage");
|
|
15380
|
+
var isAbsoluteRequestStorage = (value) => typeof value === "object" && value !== null && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
|
|
15381
|
+
var getRequestStorage = () => {
|
|
15382
|
+
const value = Reflect.get(globalThis, REQUEST_STORAGE_KEY);
|
|
15383
|
+
return isAbsoluteRequestStorage(value) ? value : undefined;
|
|
15384
|
+
};
|
|
15385
|
+
var ensureRequestStorage = () => {
|
|
15386
|
+
const existing = getRequestStorage();
|
|
15387
|
+
if (existing)
|
|
15388
|
+
return existing;
|
|
15389
|
+
const storage = new AsyncLocalStorage2;
|
|
15390
|
+
Reflect.set(globalThis, REQUEST_STORAGE_KEY, storage);
|
|
15391
|
+
return storage;
|
|
15392
|
+
};
|
|
15393
|
+
var absoluteRequestContext = new Elysia2({
|
|
15394
|
+
name: "absolutejs-request-context"
|
|
15395
|
+
}).request(({ request }) => {
|
|
15396
|
+
ensureRequestStorage().enterWith({ request });
|
|
15397
|
+
}).as("global");
|
|
15398
|
+
var getCurrentAbsoluteRequest = () => getRequestStorage()?.getStore()?.request;
|
|
15399
|
+
var runWithAbsoluteRequest = (request, callback) => ensureRequestStorage().run({ request }, callback);
|
|
15400
|
+
|
|
15401
|
+
// src/mobile/producerContextState.ts
|
|
15402
|
+
var ABSOLUTE_MOBILE_PRODUCER_STORAGE_KEY = Symbol.for("absolutejs.mobileProducerAsyncLocalStorage");
|
|
15403
|
+
var frameworks = new Set([
|
|
15404
|
+
"angular",
|
|
15405
|
+
"ember",
|
|
15406
|
+
"html",
|
|
15407
|
+
"htmx",
|
|
15408
|
+
"react",
|
|
15409
|
+
"svelte",
|
|
15410
|
+
"vue"
|
|
15411
|
+
]);
|
|
15412
|
+
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";
|
|
15413
|
+
var getCurrentAbsoluteMobileProducerContext = () => {
|
|
15414
|
+
const value = Reflect.get(globalThis, ABSOLUTE_MOBILE_PRODUCER_STORAGE_KEY);
|
|
15415
|
+
if (typeof value !== "object" || value === null || !("getStore" in value) || typeof value.getStore !== "function") {
|
|
15416
|
+
return;
|
|
15417
|
+
}
|
|
15418
|
+
const context = value.getStore();
|
|
15419
|
+
if (typeof context !== "object" || context === null || !("page" in context) || !isCompatibilityPage(context.page) || !("releaseId" in context) || typeof context.releaseId !== "string") {
|
|
15420
|
+
return;
|
|
15421
|
+
}
|
|
15422
|
+
return { page: context.page, releaseId: context.releaseId };
|
|
15423
|
+
};
|
|
15424
|
+
|
|
15425
|
+
// src/mobile/pageProtocol.ts
|
|
15426
|
+
var ABSOLUTE_MOBILE_PAGE_MEDIA_TYPE = "application/vnd.absolute.page+json";
|
|
15427
|
+
var ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION = 1;
|
|
15428
|
+
var BAD_REQUEST_STATUS = 400;
|
|
15429
|
+
var OK_STATUS = 200;
|
|
15430
|
+
var SERVER_ERROR_STATUS = 500;
|
|
15431
|
+
var UPGRADE_REQUIRED_STATUS = 426;
|
|
15432
|
+
var MOBILE_PAGE_REQUEST_HEADERS = {
|
|
15433
|
+
appBuild: "x-absolute-mobile-app-build",
|
|
15434
|
+
pageBundle: "x-absolute-mobile-page-bundle",
|
|
15435
|
+
pageContracts: "x-absolute-mobile-page-contracts",
|
|
15436
|
+
pageId: "x-absolute-mobile-page-id",
|
|
15437
|
+
protocol: "x-absolute-mobile-protocol",
|
|
15438
|
+
runtime: "x-absolute-mobile-runtime"
|
|
15439
|
+
};
|
|
15440
|
+
var parseMediaType = (value) => value.split(";", 1)[0]?.trim().toLowerCase();
|
|
15441
|
+
var acceptsAbsoluteMobilePage = (request) => {
|
|
15442
|
+
if (!request)
|
|
15443
|
+
return false;
|
|
15444
|
+
return (request.headers.get("accept") ?? "").split(",").some((value) => parseMediaType(value) === ABSOLUTE_MOBILE_PAGE_MEDIA_TYPE);
|
|
15445
|
+
};
|
|
15446
|
+
var readRequiredHeader = (request, name) => {
|
|
15447
|
+
const value = request.headers.get(name)?.trim();
|
|
15448
|
+
return value ? value : undefined;
|
|
15449
|
+
};
|
|
15450
|
+
var parseAbsoluteMobilePageRequest = (request) => {
|
|
15451
|
+
if (!request || !acceptsAbsoluteMobilePage(request)) {
|
|
15452
|
+
return { kind: "not-mobile" };
|
|
15453
|
+
}
|
|
15454
|
+
const protocolValue = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.protocol);
|
|
15455
|
+
const runtime = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.runtime);
|
|
15456
|
+
const appBuild = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.appBuild);
|
|
15457
|
+
const pageBundle = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.pageBundle);
|
|
15458
|
+
const pageContractsValue = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.pageContracts);
|
|
15459
|
+
const pageId = readRequiredHeader(request, MOBILE_PAGE_REQUEST_HEADERS.pageId);
|
|
15460
|
+
if (!protocolValue || !/^\d+$/.test(protocolValue)) {
|
|
15461
|
+
return {
|
|
15462
|
+
kind: "invalid",
|
|
15463
|
+
message: `Missing or invalid ${MOBILE_PAGE_REQUEST_HEADERS.protocol} header.`
|
|
15464
|
+
};
|
|
15465
|
+
}
|
|
15466
|
+
if (!runtime) {
|
|
15467
|
+
return {
|
|
15468
|
+
kind: "invalid",
|
|
15469
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.runtime} header.`
|
|
15470
|
+
};
|
|
15471
|
+
}
|
|
15472
|
+
if (!appBuild) {
|
|
15473
|
+
return {
|
|
15474
|
+
kind: "invalid",
|
|
15475
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.appBuild} header.`
|
|
15476
|
+
};
|
|
15477
|
+
}
|
|
15478
|
+
if (!pageBundle) {
|
|
15479
|
+
return {
|
|
15480
|
+
kind: "invalid",
|
|
15481
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.pageBundle} header.`
|
|
15482
|
+
};
|
|
15483
|
+
}
|
|
15484
|
+
if (!pageContractsValue) {
|
|
15485
|
+
return {
|
|
15486
|
+
kind: "invalid",
|
|
15487
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.pageContracts} header.`
|
|
15488
|
+
};
|
|
15489
|
+
}
|
|
15490
|
+
if (!pageId) {
|
|
15491
|
+
return {
|
|
15492
|
+
kind: "invalid",
|
|
15493
|
+
message: `Missing ${MOBILE_PAGE_REQUEST_HEADERS.pageId} header.`
|
|
15494
|
+
};
|
|
15495
|
+
}
|
|
15496
|
+
const pageContracts = [
|
|
15497
|
+
...new Set(pageContractsValue.split(",").map((value) => value.trim()).filter(Boolean))
|
|
15498
|
+
];
|
|
15499
|
+
if (pageContracts.length === 0) {
|
|
15500
|
+
return {
|
|
15501
|
+
kind: "invalid",
|
|
15502
|
+
message: `${MOBILE_PAGE_REQUEST_HEADERS.pageContracts} must contain at least one contract.`
|
|
15503
|
+
};
|
|
15504
|
+
}
|
|
15505
|
+
return {
|
|
15506
|
+
client: {
|
|
15507
|
+
appBuild,
|
|
15508
|
+
pageBundle,
|
|
15509
|
+
pageContracts,
|
|
15510
|
+
pageId,
|
|
15511
|
+
protocol: Number(protocolValue),
|
|
15512
|
+
runtime
|
|
15513
|
+
},
|
|
15514
|
+
kind: "mobile"
|
|
15515
|
+
};
|
|
15516
|
+
};
|
|
15517
|
+
var responseHeaders = () => {
|
|
15518
|
+
const headers = new Headers({
|
|
15519
|
+
"cache-control": "no-store",
|
|
15520
|
+
"content-type": `${ABSOLUTE_MOBILE_PAGE_MEDIA_TYPE}; version=${ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION}`
|
|
15521
|
+
});
|
|
15522
|
+
headerVaryValues.forEach((value) => headers.append("vary", value));
|
|
15523
|
+
return headers;
|
|
15524
|
+
};
|
|
15525
|
+
var headerVaryValues = [
|
|
15526
|
+
"Accept",
|
|
15527
|
+
MOBILE_PAGE_REQUEST_HEADERS.protocol,
|
|
15528
|
+
MOBILE_PAGE_REQUEST_HEADERS.runtime,
|
|
15529
|
+
MOBILE_PAGE_REQUEST_HEADERS.appBuild,
|
|
15530
|
+
MOBILE_PAGE_REQUEST_HEADERS.pageBundle,
|
|
15531
|
+
MOBILE_PAGE_REQUEST_HEADERS.pageContracts,
|
|
15532
|
+
MOBILE_PAGE_REQUEST_HEADERS.pageId
|
|
15533
|
+
];
|
|
15534
|
+
var envelopeResponse = (response, status) => new Response(JSON.stringify({
|
|
15535
|
+
protocol: ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION,
|
|
15536
|
+
response
|
|
15537
|
+
}), { headers: responseHeaders(), status });
|
|
15538
|
+
var isRecord4 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
15539
|
+
var normalizeJsonValue = (value) => {
|
|
15540
|
+
const serialized = JSON.stringify(value);
|
|
15541
|
+
if (serialized === undefined) {
|
|
15542
|
+
throw new TypeError("Mobile page props must be JSON-serializable.");
|
|
15543
|
+
}
|
|
15544
|
+
const parsed = JSON.parse(serialized);
|
|
15545
|
+
if (!isRecord4(parsed)) {
|
|
15546
|
+
throw new TypeError("Mobile page props must serialize to an object.");
|
|
15547
|
+
}
|
|
15548
|
+
return parsed;
|
|
15549
|
+
};
|
|
15550
|
+
var finalizeArchivedMobilePage = (context, input) => {
|
|
15551
|
+
const { page } = context;
|
|
15552
|
+
if (page.pageId !== input.compatibility.pageId || page.framework !== input.compatibility.framework) {
|
|
15553
|
+
return envelopeResponse({
|
|
15554
|
+
kind: "invalid-request",
|
|
15555
|
+
message: "Archived producer page identity does not match its release artifact."
|
|
15556
|
+
}, BAD_REQUEST_STATUS);
|
|
15557
|
+
}
|
|
15558
|
+
try {
|
|
15559
|
+
const [currentRepresentation] = input.compatibility.representations;
|
|
15560
|
+
if (!currentRepresentation) {
|
|
15561
|
+
throw new TypeError("Mobile page has no current representation.");
|
|
15562
|
+
}
|
|
15563
|
+
return envelopeResponse({
|
|
15564
|
+
contract: page.contract,
|
|
15565
|
+
framework: page.framework,
|
|
15566
|
+
kind: "page",
|
|
15567
|
+
pageId: page.pageId,
|
|
15568
|
+
props: normalizeJsonValue(currentRepresentation.mapProps(input.props)),
|
|
15569
|
+
status: input.status ?? OK_STATUS
|
|
15570
|
+
}, input.status ?? OK_STATUS);
|
|
15571
|
+
} catch (error) {
|
|
15572
|
+
console.error(`[Mobile] Archived producer ${context.releaseId} failed for ${page.pageId}:`, error);
|
|
15573
|
+
return createAbsoluteMobilePageErrorResponse(page.pageId);
|
|
15574
|
+
}
|
|
15575
|
+
};
|
|
15576
|
+
var createAbsoluteMobileInvalidRequestResponse = (message) => envelopeResponse({ kind: "invalid-request", message }, BAD_REQUEST_STATUS);
|
|
15577
|
+
var createAbsoluteMobilePageErrorResponse = (pageId) => envelopeResponse({
|
|
15578
|
+
code: "representation-failed",
|
|
15579
|
+
kind: "error",
|
|
15580
|
+
pageId,
|
|
15581
|
+
status: SERVER_ERROR_STATUS
|
|
15582
|
+
}, SERVER_ERROR_STATUS);
|
|
15583
|
+
var createAbsoluteMobileUpgradeResponse = (result) => envelopeResponse(result, UPGRADE_REQUIRED_STATUS);
|
|
15584
|
+
var finalizeAbsoluteMobilePage = (input) => {
|
|
15585
|
+
const parsed = parseAbsoluteMobilePageRequest(input.request);
|
|
15586
|
+
if (parsed.kind === "not-mobile")
|
|
15587
|
+
return;
|
|
15588
|
+
if (parsed.kind === "invalid") {
|
|
15589
|
+
return envelopeResponse({ kind: "invalid-request", message: parsed.message }, BAD_REQUEST_STATUS);
|
|
15590
|
+
}
|
|
15591
|
+
const { client } = parsed;
|
|
15592
|
+
if (client.pageId !== input.compatibility.pageId) {
|
|
15593
|
+
return envelopeResponse({
|
|
15594
|
+
kind: "invalid-request",
|
|
15595
|
+
message: `Requested mobile page ${client.pageId} does not match ${input.compatibility.pageId}.`
|
|
15596
|
+
}, BAD_REQUEST_STATUS);
|
|
15597
|
+
}
|
|
15598
|
+
const producerContext = getCurrentAbsoluteMobileProducerContext();
|
|
15599
|
+
if (producerContext)
|
|
15600
|
+
return finalizeArchivedMobilePage(producerContext, input);
|
|
15601
|
+
if (client.protocol !== ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION) {
|
|
15602
|
+
return envelopeResponse({
|
|
15603
|
+
kind: "upgrade-required",
|
|
15604
|
+
pageId: input.compatibility.pageId,
|
|
15605
|
+
reason: "protocol"
|
|
15606
|
+
}, UPGRADE_REQUIRED_STATUS);
|
|
15607
|
+
}
|
|
15608
|
+
if (!input.compatibility.runtimes.includes(client.runtime)) {
|
|
15609
|
+
return envelopeResponse({
|
|
15610
|
+
kind: "upgrade-required",
|
|
15611
|
+
pageId: input.compatibility.pageId,
|
|
15612
|
+
reason: "runtime",
|
|
15613
|
+
supportedRuntimes: [...input.compatibility.runtimes]
|
|
15614
|
+
}, UPGRADE_REQUIRED_STATUS);
|
|
15615
|
+
}
|
|
15616
|
+
const clientContracts = new Set(client.pageContracts);
|
|
15617
|
+
const representation = input.compatibility.representations.find(({ contract }) => clientContracts.has(contract));
|
|
15618
|
+
if (!representation) {
|
|
15619
|
+
return envelopeResponse({
|
|
15620
|
+
kind: "upgrade-required",
|
|
15621
|
+
pageId: input.compatibility.pageId,
|
|
15622
|
+
reason: "page-contract",
|
|
15623
|
+
supportedContracts: input.compatibility.representations.map(({ contract }) => contract)
|
|
15624
|
+
}, UPGRADE_REQUIRED_STATUS);
|
|
15625
|
+
}
|
|
15626
|
+
try {
|
|
15627
|
+
return envelopeResponse({
|
|
15628
|
+
contract: representation.contract,
|
|
15629
|
+
framework: input.compatibility.framework,
|
|
15630
|
+
kind: "page",
|
|
15631
|
+
pageId: input.compatibility.pageId,
|
|
15632
|
+
props: normalizeJsonValue(representation.mapProps(input.props)),
|
|
15633
|
+
status: input.status ?? OK_STATUS
|
|
15634
|
+
}, input.status ?? OK_STATUS);
|
|
15635
|
+
} catch (error) {
|
|
15636
|
+
console.error(`[Mobile] Failed to produce ${input.compatibility.pageId} representation ${representation.contract}:`, error);
|
|
15637
|
+
return envelopeResponse({
|
|
15638
|
+
code: "representation-failed",
|
|
15639
|
+
kind: "error",
|
|
15640
|
+
pageId: input.compatibility.pageId,
|
|
15641
|
+
status: SERVER_ERROR_STATUS
|
|
15642
|
+
}, SERVER_ERROR_STATUS);
|
|
15643
|
+
}
|
|
15644
|
+
};
|
|
15645
|
+
|
|
15345
15646
|
// src/angular/ssrSanitizer.ts
|
|
15346
15647
|
var escapeHtml2 = (str) => String(str).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
15347
15648
|
var bypassValue = (value) => ({
|
|
@@ -15453,7 +15754,7 @@ var withRegisteredStreamingSlots = async (renderResponse, options = {}) => {
|
|
|
15453
15754
|
|
|
15454
15755
|
// src/core/streamingSlotWarningScope.ts
|
|
15455
15756
|
init_logger();
|
|
15456
|
-
import { AsyncLocalStorage as
|
|
15757
|
+
import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
|
|
15457
15758
|
var STREAMING_SLOT_WARNING_STORAGE_KEY2 = Symbol.for("absolutejs.streamingSlotWarningAsyncLocalStorage");
|
|
15458
15759
|
var isObjectRecord4 = (value) => Boolean(value) && typeof value === "object";
|
|
15459
15760
|
var isAsyncLocalStorage3 = (value) => isObjectRecord4(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
|
|
@@ -15469,7 +15770,7 @@ var ensureWarningStorage = () => {
|
|
|
15469
15770
|
if (existing) {
|
|
15470
15771
|
return existing;
|
|
15471
15772
|
}
|
|
15472
|
-
const storage = new
|
|
15773
|
+
const storage = new AsyncLocalStorage3;
|
|
15473
15774
|
Reflect.set(globalThis, STREAMING_SLOT_WARNING_STORAGE_KEY2, storage);
|
|
15474
15775
|
return storage;
|
|
15475
15776
|
};
|
|
@@ -15511,11 +15812,11 @@ var runWithStreamingSlotWarningScope = (task, metadata) => ensureWarningStorage(
|
|
|
15511
15812
|
|
|
15512
15813
|
// src/angular/pageHandler.ts
|
|
15513
15814
|
init_ssrRender();
|
|
15514
|
-
var
|
|
15815
|
+
var isRecord6 = (value) => typeof value === "object" && value !== null;
|
|
15515
15816
|
var isAngularComponent2 = (value) => typeof value === "function";
|
|
15516
15817
|
var componentHostsRouterOutlet = (component) => {
|
|
15517
15818
|
const componentDef = Reflect.get(component, "\u0275cmp");
|
|
15518
|
-
if (!
|
|
15819
|
+
if (!isRecord6(componentDef))
|
|
15519
15820
|
return false;
|
|
15520
15821
|
const rawDependencies = componentDef.dependencies;
|
|
15521
15822
|
const dependencies = typeof rawDependencies === "function" ? Reflect.apply(rawDependencies, undefined, []) : rawDependencies;
|
|
@@ -15525,7 +15826,7 @@ var componentHostsRouterOutlet = (component) => {
|
|
|
15525
15826
|
if (dependency === null || typeof dependency !== "object" && typeof dependency !== "function")
|
|
15526
15827
|
return false;
|
|
15527
15828
|
const directiveDef = Reflect.get(dependency, "\u0275dir") ?? dependency;
|
|
15528
|
-
if (!
|
|
15829
|
+
if (!isRecord6(directiveDef))
|
|
15529
15830
|
return false;
|
|
15530
15831
|
const { selectors } = directiveDef;
|
|
15531
15832
|
return Array.isArray(selectors) && JSON.stringify(selectors).includes("router-outlet");
|
|
@@ -15555,7 +15856,7 @@ var ensureAngularCompiler = () => {
|
|
|
15555
15856
|
}
|
|
15556
15857
|
return compilerImportPromise;
|
|
15557
15858
|
};
|
|
15558
|
-
var readAngularPageModule = (value) =>
|
|
15859
|
+
var readAngularPageModule = (value) => isRecord6(value) ? value : null;
|
|
15559
15860
|
var resolveAngularSsrOutDir = (projectRoot = process.cwd(), configuredOutDir = process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR) => configuredOutDir ?? join10(projectRoot, ".absolutejs", "runtime", "angular-ssr");
|
|
15560
15861
|
var createAngularRuntimeCacheBuster = () => `${Date.now().toString(BASE_36_RADIX)}.${Math.random().toString(BASE_36_RADIX).substring(2, RANDOM_ID_END_INDEX)}`;
|
|
15561
15862
|
var existingNodeModulesLinkMatches = async (nodeModulesLink, expectedTarget) => {
|
|
@@ -15656,14 +15957,32 @@ var resolveRequestRenderUrl = (request) => {
|
|
|
15656
15957
|
return "/";
|
|
15657
15958
|
}
|
|
15658
15959
|
};
|
|
15659
|
-
var angularSsrContext = new
|
|
15960
|
+
var angularSsrContext = new AsyncLocalStorage4;
|
|
15660
15961
|
setSsrContextGetter(() => angularSsrContext.getStore());
|
|
15661
15962
|
var handleAngularPageRequest = async (input) => {
|
|
15662
15963
|
const requestId = `angular_${Date.now()}_${Math.random().toString(BASE_36_RADIX).substring(2, RANDOM_ID_END_INDEX)}`;
|
|
15964
|
+
const request = input.request ?? getCurrentAbsoluteRequest();
|
|
15965
|
+
const pageId = input.__absoluteMobile?.pageId ?? derivePageName(input.pagePath);
|
|
15966
|
+
const currentContract = input.__absoluteMobile?.contract ?? `angular:${pageId}:${ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION}`;
|
|
15967
|
+
const mobileResponse = finalizeAbsoluteMobilePage({
|
|
15968
|
+
compatibility: {
|
|
15969
|
+
framework: "angular",
|
|
15970
|
+
pageId,
|
|
15971
|
+
representations: [
|
|
15972
|
+
{ contract: currentContract, mapProps: (props) => props }
|
|
15973
|
+
],
|
|
15974
|
+
runtimes: [String(ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION)]
|
|
15975
|
+
},
|
|
15976
|
+
props: isRecord6(input.requestContext) ? input.requestContext : Object.create(null),
|
|
15977
|
+
request,
|
|
15978
|
+
status: input.responseInit?.status
|
|
15979
|
+
});
|
|
15980
|
+
if (mobileResponse)
|
|
15981
|
+
return mobileResponse;
|
|
15663
15982
|
return angularSsrContext.run(requestId, async () => {
|
|
15664
|
-
const spaNotFound = await renderSpaNotFound("angular", derivePageName(input.pagePath),
|
|
15983
|
+
const spaNotFound = await renderSpaNotFound("angular", derivePageName(input.pagePath), request);
|
|
15665
15984
|
if (spaNotFound)
|
|
15666
|
-
return withPageCacheHeaders(spaNotFound,
|
|
15985
|
+
return withPageCacheHeaders(spaNotFound, request);
|
|
15667
15986
|
await ensureAngularCompiler();
|
|
15668
15987
|
const userHeadTag = input.headTag ?? "<head></head>";
|
|
15669
15988
|
const resolvedIndexPath = input.indexPath;
|
|
@@ -15671,7 +15990,7 @@ var handleAngularPageRequest = async (input) => {
|
|
|
15671
15990
|
const resolvedPagePath = input.pagePath;
|
|
15672
15991
|
const maybeRequestContext = input.requestContext;
|
|
15673
15992
|
const responseInit = input.responseInit ?? {};
|
|
15674
|
-
const resolvedUrl = resolveRequestRenderUrl(
|
|
15993
|
+
const resolvedUrl = resolveRequestRenderUrl(request);
|
|
15675
15994
|
const siblingCss = await readSiblingCss(resolvedPagePath);
|
|
15676
15995
|
const resolvedHeadTag = injectInlineCss(userHeadTag, siblingCss);
|
|
15677
15996
|
cacheRouteData(resolvedPagePath, {
|
|
@@ -15708,7 +16027,7 @@ var handleAngularPageRequest = async (input) => {
|
|
|
15708
16027
|
...handlerCallProviders,
|
|
15709
16028
|
...await buildServerAnimationProviders(usesLegacyAnimations)
|
|
15710
16029
|
];
|
|
15711
|
-
const providers = buildProviders(deps, sanitizer,
|
|
16030
|
+
const providers = buildProviders(deps, sanitizer, request, maybeRequestContext, responseInit, combinedProviders);
|
|
15712
16031
|
const rawHtml = await renderAngularApp(deps, PageComponent, providers, htmlString, resolvedUrl);
|
|
15713
16032
|
const shouldProcessIslands = hasIslands || rawHtml.includes("<absolute-island");
|
|
15714
16033
|
const htmlWithLoweredIslands = shouldProcessIslands ? await lowerAngularServerIslands(rawHtml) : rawHtml;
|
|
@@ -15716,18 +16035,18 @@ var handleAngularPageRequest = async (input) => {
|
|
|
15716
16035
|
return new Response(html, withHtmlContentType(responseInit));
|
|
15717
16036
|
};
|
|
15718
16037
|
const pageResponse = await runWithStreamingSlotWarningScope(() => options?.collectStreamingSlots === true ? withRegisteredStreamingSlots(renderPageResponse, options) : renderPageResponse(), { handlerCallsite });
|
|
15719
|
-
return withPageCacheHeaders(pageResponse,
|
|
16038
|
+
return withPageCacheHeaders(pageResponse, request);
|
|
15720
16039
|
} catch (error) {
|
|
15721
16040
|
console.error("[SSR] Angular render error:", error);
|
|
15722
16041
|
const pageName = derivePageName(resolvedPagePath);
|
|
15723
16042
|
const conventionResponse = await renderConventionError("angular", pageName, error);
|
|
15724
16043
|
if (conventionResponse) {
|
|
15725
|
-
return withPageCacheHeaders(conventionResponse,
|
|
16044
|
+
return withPageCacheHeaders(conventionResponse, request);
|
|
15726
16045
|
}
|
|
15727
16046
|
return withPageCacheHeaders(new Response(ssrErrorPage("angular", error), {
|
|
15728
16047
|
headers: { "Content-Type": "text/html" },
|
|
15729
16048
|
status: 500
|
|
15730
|
-
}),
|
|
16049
|
+
}), request);
|
|
15731
16050
|
}
|
|
15732
16051
|
});
|
|
15733
16052
|
};
|
|
@@ -16271,5 +16590,5 @@ export {
|
|
|
16271
16590
|
ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER
|
|
16272
16591
|
};
|
|
16273
16592
|
|
|
16274
|
-
//# debugId=
|
|
16593
|
+
//# debugId=7ED2C1B48F6EF28964756E2164756E21
|
|
16275
16594
|
//# sourceMappingURL=index.js.map
|