@flight-framework/core 0.2.4 → 0.2.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/chunk-FSJNOPYE.js +197 -0
- package/dist/chunk-FSJNOPYE.js.map +1 -0
- package/dist/{chunk-VOBQDQKX.js → chunk-LBYDTULN.js} +3 -3
- package/dist/{chunk-VOBQDQKX.js.map → chunk-LBYDTULN.js.map} +1 -1
- package/dist/chunk-PL37KFRJ.js +3 -0
- package/dist/chunk-PL37KFRJ.js.map +1 -0
- package/dist/chunk-YHEVHRLH.js +46 -0
- package/dist/chunk-YHEVHRLH.js.map +1 -0
- package/dist/errors/index.d.ts +267 -0
- package/dist/errors/index.js +4 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index.d.ts +3 -308
- package/dist/index.js +15 -247
- package/dist/index.js.map +1 -1
- package/dist/react/index.d.ts +73 -0
- package/dist/react/index.js +52 -0
- package/dist/react/index.js.map +1 -0
- package/dist/rsc/adapters/index.js +1 -1
- package/dist/rsc/index.js +4 -4
- package/dist/server/index.js +2 -2
- package/dist/utils/index.d.ts +42 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,33 +1,36 @@
|
|
|
1
|
-
export { createIslandRegistry, createPreactIslandAdapter, createReactIslandAdapter, createSolidIslandAdapter, createVueIslandAdapter, defineIsland, hydrateIslands, registerFlightIslandElement, registerIsland, renderIsland, renderIslands, setIslandAdapter } from './chunk-WFAWAHJH.js';
|
|
2
|
-
export { DEFAULT_STREAMING_HINTS, createStreamingController, generateCacheKey, getStreamingCacheHeaders, hasStreamingConfig, isValidStreamingHints, loadRouteWithStreaming, resolveStreamingConfig, shouldStream } from './chunk-XSY5AAXT.js';
|
|
3
|
-
export { streamWithPriority, validateDependencies } from './chunk-WOEIJWGJ.js';
|
|
4
1
|
export { MetricsAggregator, createHttpObserver, createInstrumentedStream, createLoggerObserver } from './chunk-6BDCTUQY.js';
|
|
5
2
|
export { DEFAULT_BOT_PATTERNS, addStreamingHeaders, createConditionalStreamer, createStreamingResponse as createConditionalStreamingResponse, createStaticResponse, isBot, isSlowConnection, prefersNoStream, streamIf, supportsStreaming } from './chunk-XOIYNY4I.js';
|
|
6
3
|
export { createHTMXStreamAdapter, createReactStreamAdapter, createSolidStreamAdapter, createStreamAdapter, createSvelteStreamAdapter, createVueStreamAdapter } from './chunk-MQQLYWZZ.js';
|
|
4
|
+
export { createIslandRegistry, createPreactIslandAdapter, createReactIslandAdapter, createSolidIslandAdapter, createVueIslandAdapter, defineIsland, hydrateIslands, registerFlightIslandElement, registerIsland, renderIsland, renderIslands, setIslandAdapter } from './chunk-WFAWAHJH.js';
|
|
5
|
+
export { DEFAULT_STREAMING_HINTS, createStreamingController, generateCacheKey, getStreamingCacheHeaders, hasStreamingConfig, isValidStreamingHints, loadRouteWithStreaming, resolveStreamingConfig, shouldStream } from './chunk-XSY5AAXT.js';
|
|
6
|
+
export { streamWithPriority, validateDependencies } from './chunk-WOEIJWGJ.js';
|
|
7
|
+
import './chunk-SUILH4ID.js';
|
|
8
|
+
export { createServer } from './chunk-LBYDTULN.js';
|
|
9
|
+
export { defineConfig } from './chunk-IXMD5QH2.js';
|
|
7
10
|
export { createFileRouter, loadRoutes, scanRoutes } from './chunk-54HPVE7N.js';
|
|
8
11
|
export { RedirectError, redirect as actionRedirect, cookies, executeAction, executeFormAction, getAction, handleActionRequest, isRedirectError, parseFormData, registerAction } from './chunk-3QP3E7HS.js';
|
|
9
12
|
export { createRouteContext, error, json, parseBody, redirect } from './chunk-W6D62JCI.js';
|
|
10
13
|
export { createLazyContent, createStreamingResponse, createStreamingSSR, renderWithStreaming, streamParallel, streamSequential } from './chunk-RSVA2EYO.js';
|
|
11
14
|
import './chunk-63SCEXD7.js';
|
|
15
|
+
export { createServerContext, isNotFoundError, isRedirectError as isRscRedirectError, notFound, redirect as rscRedirect } from './chunk-62C7LX2E.js';
|
|
12
16
|
import './chunk-PVUMB632.js';
|
|
13
17
|
import './chunk-P6WSBVDT.js';
|
|
18
|
+
import './chunk-K2CQZPCG.js';
|
|
14
19
|
export { composeComponents, createAsyncComponent, createClientBoundary, createRenderContext, deserializeProps, executeServerComponent, revalidatePath as rscRevalidatePath, revalidateTag as rscRevalidateTag, serializeProps, serverFetch, withErrorBoundary } from './chunk-3ZSSRE6M.js';
|
|
15
20
|
import './chunk-ZIE56LCA.js';
|
|
21
|
+
export { detectBoundaryType, hasUseClientDirective, hasUseServerDirective } from './chunk-PDW5WCMW.js';
|
|
16
22
|
import './chunk-Y22AMGTM.js';
|
|
17
|
-
import './chunk-MDQNNIHH.js';
|
|
18
23
|
import './chunk-TASAT7KB.js';
|
|
19
24
|
import './chunk-2F2QU6RC.js';
|
|
20
25
|
import './chunk-VPFMHGEV.js';
|
|
21
|
-
import './chunk-
|
|
22
|
-
export {
|
|
23
|
-
|
|
26
|
+
import './chunk-MDQNNIHH.js';
|
|
27
|
+
export { BadRequestError, FlightError, ForbiddenError, InternalError, NotFoundError, UnauthorizedError, clearError, createError, createErrorResponse, forbidden as createForbidden, notFound as createNotFound, unauthorized as createUnauthorized, getError, getErrorStatusCode, isFlightError, isForbiddenError as isForbidden, isNotFoundError as isNotFound, isUnauthorizedError as isUnauthorized, showError, wrapWithDigest } from './chunk-FSJNOPYE.js';
|
|
28
|
+
import './chunk-PL37KFRJ.js';
|
|
29
|
+
export { getEnvironment, isBrowser, isDevelopment, isProduction, isServer, isTest } from './chunk-YHEVHRLH.js';
|
|
30
|
+
export { createRouter } from './chunk-GCQZ4FHI.js';
|
|
24
31
|
import './chunk-ZVC3ZWLM.js';
|
|
25
32
|
export { cacheKey, cached, createCache, dedupe, jsonSerializer, memory } from './chunk-R7SQAREQ.js';
|
|
26
|
-
import './chunk-SUILH4ID.js';
|
|
27
|
-
export { createServer } from './chunk-VOBQDQKX.js';
|
|
28
|
-
export { createRouter } from './chunk-GCQZ4FHI.js';
|
|
29
33
|
export { createMiddlewareChain } from './chunk-KWFX6WHG.js';
|
|
30
|
-
export { defineConfig } from './chunk-IXMD5QH2.js';
|
|
31
34
|
import { promises } from 'fs';
|
|
32
35
|
import { dirname, join } from 'path';
|
|
33
36
|
|
|
@@ -875,244 +878,9 @@ function createDevToolsData(startTime, options = {}) {
|
|
|
875
878
|
};
|
|
876
879
|
}
|
|
877
880
|
|
|
878
|
-
// src/utils/env.ts
|
|
879
|
-
function isProduction() {
|
|
880
|
-
if (typeof globalThis !== "undefined" && "process" in globalThis) {
|
|
881
|
-
const proc = globalThis.process;
|
|
882
|
-
return proc?.env?.NODE_ENV === "production";
|
|
883
|
-
}
|
|
884
|
-
if (typeof import.meta !== "undefined" && "env" in import.meta) {
|
|
885
|
-
const env = import.meta.env;
|
|
886
|
-
return env?.MODE === "production" || env?.PROD === true;
|
|
887
|
-
}
|
|
888
|
-
return false;
|
|
889
|
-
}
|
|
890
|
-
function isDevelopment() {
|
|
891
|
-
if (typeof globalThis !== "undefined" && "process" in globalThis) {
|
|
892
|
-
const proc = globalThis.process;
|
|
893
|
-
return proc?.env?.NODE_ENV === "development";
|
|
894
|
-
}
|
|
895
|
-
if (typeof import.meta !== "undefined" && "env" in import.meta) {
|
|
896
|
-
const env = import.meta.env;
|
|
897
|
-
return env?.MODE === "development" || env?.DEV === true;
|
|
898
|
-
}
|
|
899
|
-
return true;
|
|
900
|
-
}
|
|
901
|
-
function isTest() {
|
|
902
|
-
if (typeof globalThis !== "undefined" && "process" in globalThis) {
|
|
903
|
-
const proc = globalThis.process;
|
|
904
|
-
return proc?.env?.NODE_ENV === "test";
|
|
905
|
-
}
|
|
906
|
-
return false;
|
|
907
|
-
}
|
|
908
|
-
function isServer() {
|
|
909
|
-
return typeof window === "undefined";
|
|
910
|
-
}
|
|
911
|
-
function isBrowser() {
|
|
912
|
-
return typeof window !== "undefined";
|
|
913
|
-
}
|
|
914
|
-
function getEnvironment() {
|
|
915
|
-
if (isProduction()) return "production";
|
|
916
|
-
if (isDevelopment()) return "development";
|
|
917
|
-
if (isTest()) return "test";
|
|
918
|
-
return "unknown";
|
|
919
|
-
}
|
|
920
|
-
|
|
921
|
-
// src/errors/index.ts
|
|
922
|
-
var FlightError = class extends Error {
|
|
923
|
-
/** HTTP status code */
|
|
924
|
-
statusCode;
|
|
925
|
-
/** Short status message */
|
|
926
|
-
statusMessage;
|
|
927
|
-
/** Additional error data */
|
|
928
|
-
data;
|
|
929
|
-
/** Whether this is a fatal error (shows full-screen) */
|
|
930
|
-
fatal;
|
|
931
|
-
/** Unique digest for production error correlation */
|
|
932
|
-
digest;
|
|
933
|
-
constructor(options) {
|
|
934
|
-
super(options.message || options.statusMessage || "An error occurred");
|
|
935
|
-
this.name = "FlightError";
|
|
936
|
-
this.statusCode = options.statusCode;
|
|
937
|
-
this.statusMessage = options.statusMessage || getDefaultStatusMessage(options.statusCode);
|
|
938
|
-
this.data = options.data;
|
|
939
|
-
this.fatal = options.fatal ?? false;
|
|
940
|
-
if (isProduction()) {
|
|
941
|
-
this.digest = generateDigest();
|
|
942
|
-
}
|
|
943
|
-
if (options.cause) {
|
|
944
|
-
this.cause = options.cause;
|
|
945
|
-
if (options.cause.stack) {
|
|
946
|
-
this.stack = `${this.stack}
|
|
947
|
-
Caused by: ${options.cause.stack}`;
|
|
948
|
-
}
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
/**
|
|
952
|
-
* Convert to plain object for serialization
|
|
953
|
-
*/
|
|
954
|
-
toJSON() {
|
|
955
|
-
return {
|
|
956
|
-
name: this.name,
|
|
957
|
-
message: this.message,
|
|
958
|
-
statusCode: this.statusCode,
|
|
959
|
-
statusMessage: this.statusMessage,
|
|
960
|
-
data: this.data,
|
|
961
|
-
fatal: this.fatal,
|
|
962
|
-
digest: this.digest
|
|
963
|
-
};
|
|
964
|
-
}
|
|
965
|
-
};
|
|
966
|
-
var BadRequestError = class extends FlightError {
|
|
967
|
-
constructor(message, data) {
|
|
968
|
-
super({ statusCode: 400, message, data });
|
|
969
|
-
this.name = "BadRequestError";
|
|
970
|
-
}
|
|
971
|
-
};
|
|
972
|
-
var UnauthorizedError = class extends FlightError {
|
|
973
|
-
constructor(message, data) {
|
|
974
|
-
super({ statusCode: 401, message: message || "Unauthorized", data });
|
|
975
|
-
this.name = "UnauthorizedError";
|
|
976
|
-
}
|
|
977
|
-
};
|
|
978
|
-
var ForbiddenError = class extends FlightError {
|
|
979
|
-
constructor(message, data) {
|
|
980
|
-
super({ statusCode: 403, message: message || "Forbidden", data });
|
|
981
|
-
this.name = "ForbiddenError";
|
|
982
|
-
}
|
|
983
|
-
};
|
|
984
|
-
var NotFoundError = class extends FlightError {
|
|
985
|
-
constructor(message, data) {
|
|
986
|
-
super({ statusCode: 404, message: message || "Not Found", data });
|
|
987
|
-
this.name = "NotFoundError";
|
|
988
|
-
}
|
|
989
|
-
};
|
|
990
|
-
var InternalError = class extends FlightError {
|
|
991
|
-
constructor(message, data) {
|
|
992
|
-
super({ statusCode: 500, message: message || "Internal Server Error", data });
|
|
993
|
-
this.name = "InternalError";
|
|
994
|
-
}
|
|
995
|
-
};
|
|
996
|
-
function createError(options) {
|
|
997
|
-
if (typeof options === "string") {
|
|
998
|
-
return new FlightError({ statusCode: 500, message: options });
|
|
999
|
-
}
|
|
1000
|
-
return new FlightError(options);
|
|
1001
|
-
}
|
|
1002
|
-
function notFound2(message, data) {
|
|
1003
|
-
throw new NotFoundError(message, data);
|
|
1004
|
-
}
|
|
1005
|
-
function forbidden(message, data) {
|
|
1006
|
-
throw new ForbiddenError(message, data);
|
|
1007
|
-
}
|
|
1008
|
-
function unauthorized(message, data) {
|
|
1009
|
-
throw new UnauthorizedError(message, data);
|
|
1010
|
-
}
|
|
1011
|
-
function showError(error2) {
|
|
1012
|
-
let flightError;
|
|
1013
|
-
if (typeof error2 === "string") {
|
|
1014
|
-
flightError = new FlightError({ statusCode: 500, message: error2 });
|
|
1015
|
-
} else if (error2 instanceof FlightError) {
|
|
1016
|
-
flightError = error2;
|
|
1017
|
-
} else {
|
|
1018
|
-
flightError = new FlightError(error2);
|
|
1019
|
-
}
|
|
1020
|
-
if (typeof window !== "undefined") {
|
|
1021
|
-
window.__FLIGHT_ERROR__ = flightError;
|
|
1022
|
-
window.dispatchEvent(new CustomEvent("flight:error", {
|
|
1023
|
-
detail: flightError,
|
|
1024
|
-
bubbles: true
|
|
1025
|
-
}));
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
function clearError(options) {
|
|
1029
|
-
if (typeof window !== "undefined") {
|
|
1030
|
-
window.__FLIGHT_ERROR__ = null;
|
|
1031
|
-
window.dispatchEvent(new CustomEvent("flight:error-clear", { bubbles: true }));
|
|
1032
|
-
if (options?.redirect) {
|
|
1033
|
-
window.location.href = options.redirect;
|
|
1034
|
-
}
|
|
1035
|
-
}
|
|
1036
|
-
}
|
|
1037
|
-
function getError() {
|
|
1038
|
-
if (typeof window !== "undefined") {
|
|
1039
|
-
return window.__FLIGHT_ERROR__ ?? null;
|
|
1040
|
-
}
|
|
1041
|
-
return null;
|
|
1042
|
-
}
|
|
1043
|
-
function isFlightError(error2) {
|
|
1044
|
-
return error2 instanceof FlightError;
|
|
1045
|
-
}
|
|
1046
|
-
function isNotFoundError2(error2) {
|
|
1047
|
-
return error2 instanceof NotFoundError || isFlightError(error2) && error2.statusCode === 404;
|
|
1048
|
-
}
|
|
1049
|
-
function isForbiddenError(error2) {
|
|
1050
|
-
return error2 instanceof ForbiddenError || isFlightError(error2) && error2.statusCode === 403;
|
|
1051
|
-
}
|
|
1052
|
-
function isUnauthorizedError(error2) {
|
|
1053
|
-
return error2 instanceof UnauthorizedError || isFlightError(error2) && error2.statusCode === 401;
|
|
1054
|
-
}
|
|
1055
|
-
function getErrorStatusCode(error2) {
|
|
1056
|
-
if (isFlightError(error2)) {
|
|
1057
|
-
return error2.statusCode;
|
|
1058
|
-
}
|
|
1059
|
-
return 500;
|
|
1060
|
-
}
|
|
1061
|
-
function createErrorResponse(error2) {
|
|
1062
|
-
const flightError = isFlightError(error2) ? error2 : new InternalError(error2 instanceof Error ? error2.message : "Unknown error");
|
|
1063
|
-
return new Response(
|
|
1064
|
-
JSON.stringify({
|
|
1065
|
-
error: flightError.statusMessage,
|
|
1066
|
-
message: flightError.message,
|
|
1067
|
-
statusCode: flightError.statusCode,
|
|
1068
|
-
digest: flightError.digest,
|
|
1069
|
-
...isDevelopment() && flightError.data ? { data: flightError.data } : {}
|
|
1070
|
-
}),
|
|
1071
|
-
{
|
|
1072
|
-
status: flightError.statusCode,
|
|
1073
|
-
headers: {
|
|
1074
|
-
"Content-Type": "application/json"
|
|
1075
|
-
}
|
|
1076
|
-
}
|
|
1077
|
-
);
|
|
1078
|
-
}
|
|
1079
|
-
function getDefaultStatusMessage(statusCode) {
|
|
1080
|
-
const messages = {
|
|
1081
|
-
400: "Bad Request",
|
|
1082
|
-
401: "Unauthorized",
|
|
1083
|
-
403: "Forbidden",
|
|
1084
|
-
404: "Not Found",
|
|
1085
|
-
405: "Method Not Allowed",
|
|
1086
|
-
408: "Request Timeout",
|
|
1087
|
-
409: "Conflict",
|
|
1088
|
-
410: "Gone",
|
|
1089
|
-
422: "Unprocessable Entity",
|
|
1090
|
-
429: "Too Many Requests",
|
|
1091
|
-
500: "Internal Server Error",
|
|
1092
|
-
501: "Not Implemented",
|
|
1093
|
-
502: "Bad Gateway",
|
|
1094
|
-
503: "Service Unavailable",
|
|
1095
|
-
504: "Gateway Timeout"
|
|
1096
|
-
};
|
|
1097
|
-
return messages[statusCode] || "Error";
|
|
1098
|
-
}
|
|
1099
|
-
function generateDigest() {
|
|
1100
|
-
if (typeof crypto !== "undefined" && crypto.randomUUID) {
|
|
1101
|
-
return crypto.randomUUID().slice(0, 8);
|
|
1102
|
-
}
|
|
1103
|
-
return Math.random().toString(36).slice(2, 10);
|
|
1104
|
-
}
|
|
1105
|
-
function wrapWithDigest(error2) {
|
|
1106
|
-
const wrapped = error2;
|
|
1107
|
-
if (!wrapped.digest) {
|
|
1108
|
-
wrapped.digest = generateDigest();
|
|
1109
|
-
}
|
|
1110
|
-
return wrapped;
|
|
1111
|
-
}
|
|
1112
|
-
|
|
1113
881
|
// src/index.ts
|
|
1114
882
|
var VERSION = "0.0.1";
|
|
1115
883
|
|
|
1116
|
-
export {
|
|
884
|
+
export { VERSION, buildCacheControlHeader, createDefaultRouteRules, createDevToolsData, createHtmlStream, createISRCacheFromFlightCache, createMemoryISRCache, createRevalidateHandler, createStreamingResponse3 as createStaticStreamingResponse, expandDynamicRoutes, extractLinks, generateAllStaticPaths, getCacheOptionsFromRule, getISRCache, getOrGeneratePage, getRenderModeFromRule, getRevalidateTime, injectDevTools, isDevToolsEnabled, matchRouteRule, mergeMetadata, mergeRouteRules, prerenderRoutes, purgeAllPages, purgePage, renderMetadataToHead, resolveMetadata, revalidatePath2 as revalidatePath, revalidatePaths, revalidateTag2 as revalidateTag, setISRCache, shouldDynamicallyRender };
|
|
1117
885
|
//# sourceMappingURL=index.js.map
|
|
1118
886
|
//# sourceMappingURL=index.js.map
|