@bleedingdev/modern-js-plugin-data-loader 3.2.0-ultramodern.0 → 3.2.0-ultramodern.2

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/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "modern",
18
18
  "modern.js"
19
19
  ],
20
- "version": "3.2.0-ultramodern.0",
20
+ "version": "3.2.0-ultramodern.2",
21
21
  "engines": {
22
22
  "node": ">=20"
23
23
  },
@@ -46,8 +46,8 @@
46
46
  "dependencies": {
47
47
  "@swc/helpers": "^0.5.21",
48
48
  "path-to-regexp": "^8.4.2",
49
- "@modern-js/runtime-utils": "npm:@bleedingdev/modern-js-runtime-utils@3.2.0-ultramodern.0",
50
- "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.2.0-ultramodern.0"
49
+ "@modern-js/runtime-utils": "npm:@bleedingdev/modern-js-runtime-utils@3.2.0-ultramodern.2",
50
+ "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.2.0-ultramodern.2"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@rsbuild/core": "2.0.6",
@@ -59,9 +59,9 @@
59
59
  "react": "^19.2.6",
60
60
  "react-dom": "^19.2.6",
61
61
  "supertest": "^7.2.2",
62
- "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.2.0-ultramodern.0",
63
- "@scripts/rstest-config": "2.66.0",
64
- "@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.2.0-ultramodern.0"
62
+ "@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.2.0-ultramodern.2",
63
+ "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.2.0-ultramodern.2",
64
+ "@scripts/rstest-config": "2.66.0"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "react": "^19.2.6"
@@ -1,13 +0,0 @@
1
- export declare const getRequestUrl: ({ params, request, routeId, }: {
2
- params: Record<string, string>;
3
- request: Request;
4
- routeId: string;
5
- }) => URL;
6
- export declare const createRequest: (routeId: string, method?: string) => ({ params, request, }: {
7
- params: Record<string, string>;
8
- request: Request;
9
- }) => Promise<Record<string, unknown> | Response>;
10
- export declare const createActionRequest: (routeId: string) => ({ params, request, }: {
11
- params: Record<string, string>;
12
- request: Request;
13
- }) => Promise<Response>;
@@ -1,11 +0,0 @@
1
- /**
2
- * The following code is modified based on
3
- * https://github.com/remix-run/remix/blob/2b5e1a72fc628d0408e27cf4d72e537762f1dc5b/packages/remix-react/data.ts
4
- *
5
- * MIT Licensed
6
- * Author Michael Jackson
7
- * Copyright 2021 Remix Software Inc.
8
- * https://github.com/remix-run/remix/blob/2b5e1a72fc628d0408e27cf4d72e537762f1dc5b/LICENSE.md
9
- */
10
- import { DeferredData } from '@modern-js/runtime-utils/browser';
11
- export declare function parseDeferredReadableStream(stream: ReadableStream<Uint8Array>): Promise<DeferredData>;
@@ -1,5 +0,0 @@
1
- export declare const generateClient: ({ inline, action, routeId, }: {
2
- inline: boolean;
3
- action?: boolean;
4
- routeId: string;
5
- }) => string;
@@ -1,12 +0,0 @@
1
- import type { Rspack } from '@rsbuild/core';
2
- type Context = {
3
- mapFile: string;
4
- loaderId: string;
5
- clientData?: boolean;
6
- action: boolean;
7
- inline: boolean;
8
- routeId: string;
9
- retain: boolean;
10
- };
11
- export default function loader(this: Rspack.LoaderContext<Context>, source: string): Promise<any>;
12
- export {};
@@ -1,3 +0,0 @@
1
- export declare const LOADER_ID_PARAM = "__loader";
2
- export declare const DIRECT_PARAM = "__ssrDirect";
3
- export declare const CONTENT_TYPE_DEFERRED = "text/modernjs-deferred";
@@ -1,60 +0,0 @@
1
- /**
2
- * The following code is modified based on
3
- * https://github.com/remix-run/remix/blob/main/packages/remix-server-runtime/errors.ts
4
- *
5
- * MIT Licensed
6
- * Author Michael Jackson
7
- * Copyright 2021 Remix Software Inc.
8
- * https://github.com/remix-run/remix/blob/main/LICENSE.md
9
- */
10
- import type { ErrorResponse, StaticHandlerContext } from '@modern-js/runtime-utils/router';
11
- /**
12
- * This thing probably warrants some explanation.
13
- *
14
- * The whole point here is to emulate componentDidCatch for server rendering and
15
- * data loading. It can get tricky. React can do this on component boundaries
16
- * but doesn't support it for server rendering or data loading. We know enough
17
- * with nested routes to be able to emulate the behavior (because we know them
18
- * statically before rendering.)
19
- *
20
- * Each route can export an `ErrorBoundary`.
21
- *
22
- * - When rendering throws an error, the nearest error boundary will render
23
- * (normal react componentDidCatch). This will be the route's own boundary, but
24
- * if none is provided, it will bubble up to the parents.
25
- * - When data loading throws an error, the nearest error boundary will render
26
- * - When performing an action, the nearest error boundary for the action's
27
- * route tree will render (no redirect happens)
28
- *
29
- * During normal react rendering, we do nothing special, just normal
30
- * componentDidCatch.
31
- *
32
- * For server rendering, we mutate `renderBoundaryRouteId` to know the last
33
- * layout that has an error boundary that tried to render. This emulates which
34
- * layout would catch a thrown error. If the rendering fails, we catch the error
35
- * on the server, and go again a second time with the emulator holding on to the
36
- * information it needs to render the same error boundary as a dynamically
37
- * thrown render error.
38
- *
39
- * When data loading, server or client side, we use the emulator to likewise
40
- * hang on to the error and re-render at the appropriate layout (where a thrown
41
- * error would have been caught by cDC).
42
- *
43
- * When actions throw, it all works the same. There's an edge case to be aware
44
- * of though. Actions normally are required to redirect, but in the case of
45
- * errors, we render the action's route with the emulator holding on to the
46
- * error. If during this render a parent route/loader throws we ignore that new
47
- * error and render the action's original error as deeply as possible. In other
48
- * words, we simply ignore the new error and use the action's error in place
49
- * because it came first, and that just wouldn't be fair to let errors cut in
50
- * line.
51
- */
52
- export declare function sanitizeError<T = unknown>(error: T): Error | T;
53
- export declare function sanitizeErrors(errors: NonNullable<StaticHandlerContext['errors']>): {};
54
- export type SerializedError = {
55
- message: string;
56
- stack?: string;
57
- };
58
- export declare function serializeError(error: Error): SerializedError;
59
- export declare function serializeErrors(errors: StaticHandlerContext['errors']): StaticHandlerContext['errors'];
60
- export declare function errorResponseToJson(errorResponse: ErrorResponse): Response;
@@ -1,5 +0,0 @@
1
- import type { ServerLoaderBundle } from '@modern-js/server-core';
2
- export declare function isRedirectResponse(status: number): boolean;
3
- export declare function isResponse(value: any): value is Response;
4
- export declare function hasFileExtension(pathname: string): boolean;
5
- export declare const handleRequest: ServerLoaderBundle['handleRequest'];
@@ -1,11 +0,0 @@
1
- /**
2
- * The following code is modified based on
3
- * https://github.com/remix-run/remix/blob/2b5e1a72fc628d0408e27cf4d72e537762f1dc5b/packages/remix-server-runtime/responses.ts
4
- *
5
- * MIT Licensed
6
- * Author Michael Jackson
7
- * Copyright 2021 Remix Software Inc.
8
- * https://github.com/remix-run/remix/blob/2b5e1a72fc628d0408e27cf4d72e537762f1dc5b/LICENSE.md
9
- */
10
- import type { DeferredData } from '@modern-js/runtime-utils/browser';
11
- export declare function createDeferredReadableStream(deferredData: DeferredData, signal: AbortSignal): any;