Skip to content

Commit 7ef5353

Browse files
committed
Remove a part of vendored functions
1 parent fea71ce commit 7ef5353

File tree

3 files changed

+5
-37
lines changed

3 files changed

+5
-37
lines changed

packages/remix/src/server/errors.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type {
66
LoaderFunction,
77
LoaderFunctionArgs,
88
} from '@remix-run/node';
9+
import { isRouteErrorResponse } from '@remix-run/router';
910
import type { RequestEventData, Span } from '@sentry/core';
1011
import {
1112
addExceptionMechanism,
@@ -19,7 +20,7 @@ import {
1920
import { DEBUG_BUILD } from '../utils/debug-build';
2021
import type { RemixOptions } from '../utils/remixOptions';
2122
import { storeFormDataKeys } from '../utils/utils';
22-
import { extractData, isResponse, isRouteErrorResponse } from '../utils/vendor/response';
23+
import { extractData, isResponse } from '../utils/vendor/response';
2324

2425
type DataFunction = LoaderFunction | ActionFunction;
2526

packages/remix/src/server/instrumentServer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* eslint-disable max-lines */
22
import type { AgnosticRouteObject } from '@remix-run/router';
3+
import { isDeferredData, isRouteErrorResponse } from '@remix-run/router';
34
import type {
45
ActionFunction,
56
ActionFunctionArgs,
@@ -35,7 +36,7 @@ import {
3536
} from '@sentry/core';
3637
import { DEBUG_BUILD } from '../utils/debug-build';
3738
import { createRoutes, getTransactionName } from '../utils/utils';
38-
import { extractData, isDeferredData, isResponse, isRouteErrorResponse, json } from '../utils/vendor/response';
39+
import { extractData, isResponse, json } from '../utils/vendor/response';
3940
import { captureRemixServerException, errorHandleDataFunction, errorHandleDocumentRequestFunction } from './errors';
4041

4142
type AppData = unknown;

packages/remix/src/utils/vendor/response.ts

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@
66
//
77
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
88

9-
import type {
10-
AgnosticRouteMatch,
11-
AgnosticRouteObject,
12-
ErrorResponse,
13-
UNSAFE_DeferredData as DeferredData,
14-
} from '@remix-run/router';
9+
import type { AgnosticRouteMatch, AgnosticRouteObject } from '@remix-run/router';
1510
import { matchRoutes } from '@remix-run/router';
1611
/**
1712
* Based on Remix Implementation
@@ -129,32 +124,3 @@ export function getRequestMatch(
129124

130125
return match;
131126
}
132-
133-
/**
134-
* https://github.com/remix-run/remix/blob/3e589152bc717d04e2054c31bea5a1056080d4b9/packages/remix-server-runtime/responses.ts#L75-L85
135-
*/
136-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
137-
export function isDeferredData(value: any): value is DeferredData {
138-
const deferred: DeferredData = value;
139-
return (
140-
deferred &&
141-
typeof deferred === 'object' &&
142-
typeof deferred.data === 'object' &&
143-
typeof deferred.subscribe === 'function' &&
144-
typeof deferred.cancel === 'function' &&
145-
typeof deferred.resolveData === 'function'
146-
);
147-
}
148-
149-
/**
150-
* https://github.com/remix-run/react-router/blob/f9b3dbd9cbf513366c456b33d95227f42f36da63/packages/router/utils.ts#L1574
151-
*
152-
* Check if the given error is an ErrorResponse generated from a 4xx/5xx
153-
* Response thrown from an action/loader
154-
*/
155-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
156-
export function isRouteErrorResponse(value: any): value is ErrorResponse {
157-
const error: ErrorResponse = value;
158-
159-
return error != null && typeof error.status === 'number' && typeof error.statusText === 'string' && 'data' in error;
160-
}

0 commit comments

Comments
 (0)