Skip to content

Commit f4e8caf

Browse files
committed
..
1 parent 623973c commit f4e8caf

File tree

3 files changed

+24
-105
lines changed

3 files changed

+24
-105
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,9 @@
108108
},
109109
"resolutions": {
110110
"@changesets/assemble-release-plan": "patch:@changesets/assemble-release-plan@npm%3A5.2.3#~/.yarn/patches/@changesets-assemble-release-plan-npm-5.2.3-296454a28f.patch",
111+
"@graphql-tools/utils": "10.8.0-alpha-20250124175511-cf926757b2731edb762be661f8671ed41d778b2f",
111112
"@whatwg-node/fetch": "0.10.3",
112-
"@whatwg-node/node-fetch": "0.7.7",
113+
"@whatwg-node/node-fetch": "0.7.8-alpha-20250124174946-bf76ab63fc7e7c5ee6898f3bf12f95ef0ac79a63",
113114
"@whatwg-node/server": "0.9.65",
114115
"axios": "^1.0.0",
115116
"cross-fetch": "^4.0.0",

packages/legacy/utils/src/read-file-or-url.ts

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import type { Schema } from 'js-yaml';
33
import { DEFAULT_SCHEMA, load as loadYamlFromJsYaml, Type } from 'js-yaml';
44
import { fs, path as pathModule } from '@graphql-mesh/cross-helpers';
55
import type { ImportFn, Logger, MeshFetch, MeshFetchRequestInit } from '@graphql-mesh/types';
6-
import { isValidPath, mapMaybePromise } from '@graphql-tools/utils';
7-
import { fetch, URL } from '@whatwg-node/fetch';
6+
import { isUrl, isValidPath, mapMaybePromise } from '@graphql-tools/utils';
7+
import { fetch as defaultFetch } from '@whatwg-node/fetch';
88
import { loadFromModuleExportExpression } from './load-from-module-export-expression.js';
99

1010
export interface ReadFileOrUrlOptions extends MeshFetchRequestInit {
@@ -16,18 +16,7 @@ export interface ReadFileOrUrlOptions extends MeshFetchRequestInit {
1616
logger: Logger;
1717
}
1818

19-
export function isUrl(str: string): boolean {
20-
if (URL.canParse) {
21-
return URL.canParse(str);
22-
}
23-
try {
24-
// eslint-disable-next-line no-new
25-
new URL(str);
26-
return true;
27-
} catch (e) {
28-
return false;
29-
}
30-
}
19+
export { isUrl };
3120

3221
export async function readFileOrUrl<T>(
3322
filePathOrUrl: string,
@@ -103,7 +92,14 @@ function isAbsolute(path: string): boolean {
10392

10493
export function readFile<T>(
10594
fileExpression: string,
106-
{ allowUnknownExtensions, cwd, fallbackFormat, importFn, logger, fetch }: ReadFileOrUrlOptions,
95+
{
96+
allowUnknownExtensions,
97+
cwd,
98+
fallbackFormat,
99+
importFn,
100+
logger,
101+
fetch = defaultFetch,
102+
}: ReadFileOrUrlOptions,
107103
): Promise<T> {
108104
const [filePath] = fileExpression.split('#');
109105
if (/js$/.test(filePath) || /ts$/.test(filePath) || /json$/.test(filePath)) {
@@ -160,7 +156,7 @@ export function readFile<T>(
160156
export async function readUrl<T>(path: string, config: ReadFileOrUrlOptions): Promise<T> {
161157
const { allowUnknownExtensions, fallbackFormat } = config || {};
162158
config.headers ||= {};
163-
config.fetch ||= fetch;
159+
config.fetch ||= defaultFetch;
164160
const response = await config.fetch(path, config);
165161
const contentType = response.headers?.get('content-type') || '';
166162
const responseText = await response.text();

yarn.lock

Lines changed: 10 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -533,15 +533,6 @@ __metadata:
533533
languageName: node
534534
linkType: hard
535535

536-
"@ardatan/aggregate-error@npm:0.0.6":
537-
version: 0.0.6
538-
resolution: "@ardatan/aggregate-error@npm:0.0.6"
539-
dependencies:
540-
tslib: "npm:~2.0.1"
541-
checksum: 10c0/e374247b506baf753b21fdb32bd8eda12c3b3bf2bd7cc8954e2761ae3eb10e5033ab9cde6a0f279fbdb09e263358b29d40c05e79eb50a1eab08fbf8916a0253c
542-
languageName: node
543-
linkType: hard
544-
545536
"@ardatan/graphql-to-config-schema@npm:0.1.25":
546537
version: 0.1.25
547538
resolution: "@ardatan/graphql-to-config-schema@npm:0.1.25"
@@ -8264,76 +8255,17 @@ __metadata:
82648255
languageName: node
82658256
linkType: hard
82668257

8267-
"@graphql-tools/utils@npm:10.7.2, @graphql-tools/utils@npm:^10.0.0, @graphql-tools/utils@npm:^10.0.3, @graphql-tools/utils@npm:^10.3.2, @graphql-tools/utils@npm:^10.5.1, @graphql-tools/utils@npm:^10.5.4, @graphql-tools/utils@npm:^10.5.6, @graphql-tools/utils@npm:^10.6.0, @graphql-tools/utils@npm:^10.6.1, @graphql-tools/utils@npm:^10.6.2, @graphql-tools/utils@npm:^10.6.4, @graphql-tools/utils@npm:^10.7.0, @graphql-tools/utils@npm:^10.7.2":
8268-
version: 10.7.2
8269-
resolution: "@graphql-tools/utils@npm:10.7.2"
8258+
"@graphql-tools/utils@npm:10.8.0-alpha-20250124175511-cf926757b2731edb762be661f8671ed41d778b2f":
8259+
version: 10.8.0-alpha-20250124175511-cf926757b2731edb762be661f8671ed41d778b2f
8260+
resolution: "@graphql-tools/utils@npm:10.8.0-alpha-20250124175511-cf926757b2731edb762be661f8671ed41d778b2f"
82708261
dependencies:
82718262
"@graphql-typed-document-node/core": "npm:^3.1.1"
82728263
cross-inspect: "npm:1.0.1"
82738264
dset: "npm:^3.1.4"
82748265
tslib: "npm:^2.4.0"
82758266
peerDependencies:
82768267
graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0
8277-
checksum: 10c0/1e73eaf482437e2d20c1241d3fd422587a7cba93bc67d1572974053788fda22cca745f2e3048150a0af5b0cd9132b7ee49b661ada7a4a0e40e4732afcb53c549
8278-
languageName: node
8279-
linkType: hard
8280-
8281-
"@graphql-tools/utils@npm:6.1.0":
8282-
version: 6.1.0
8283-
resolution: "@graphql-tools/utils@npm:6.1.0"
8284-
dependencies:
8285-
"@ardatan/aggregate-error": "npm:0.0.1"
8286-
camel-case: "npm:4.1.1"
8287-
peerDependencies:
8288-
graphql: ^14.0.0 || ^15.0.0
8289-
checksum: 10c0/e86b307a30698962834b249d52d2a1df3aaba1360e64b8a36e09c32b6101c2e26bfacf23370cc5fa21297c1d03e23afc81e4686770567df4d1b5b693f35d6cc0
8290-
languageName: node
8291-
linkType: hard
8292-
8293-
"@graphql-tools/utils@npm:8.9.0":
8294-
version: 8.9.0
8295-
resolution: "@graphql-tools/utils@npm:8.9.0"
8296-
dependencies:
8297-
tslib: "npm:^2.4.0"
8298-
peerDependencies:
8299-
graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0
8300-
checksum: 10c0/dd589d970fee9ce093a545c69d6306b61af0f38358361295af1274164a87db2985a51d05ca0e0dd08a4e709f0b5c7c201e69ab0b30480fe2fa0c7a7b8310da0a
8301-
languageName: node
8302-
linkType: hard
8303-
8304-
"@graphql-tools/utils@npm:^7.6.0":
8305-
version: 7.10.0
8306-
resolution: "@graphql-tools/utils@npm:7.10.0"
8307-
dependencies:
8308-
"@ardatan/aggregate-error": "npm:0.0.6"
8309-
camel-case: "npm:4.1.2"
8310-
tslib: "npm:~2.2.0"
8311-
peerDependencies:
8312-
graphql: ^14.0.0 || ^15.0.0
8313-
checksum: 10c0/e8b29bf3ff63c9ca123daa3785422189177ec0273331bb739a422d3055b5b3d0e956d357988e46b4b06e74d727c1ff228fe467d4e956a72ca8b6e292d0ce0f02
8314-
languageName: node
8315-
linkType: hard
8316-
8317-
"@graphql-tools/utils@npm:^8.5.2, @graphql-tools/utils@npm:^8.8.0":
8318-
version: 8.13.1
8319-
resolution: "@graphql-tools/utils@npm:8.13.1"
8320-
dependencies:
8321-
tslib: "npm:^2.4.0"
8322-
peerDependencies:
8323-
graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0
8324-
checksum: 10c0/f9bab1370aa91e706abec4c8ea980e15293cb78bd4effba53ad2365dc39d81148db7667b3ef89b35f0a0b0ad58081ffdac4264b7125c69fa8393590ae5025745
8325-
languageName: node
8326-
linkType: hard
8327-
8328-
"@graphql-tools/utils@npm:^9.0.0, @graphql-tools/utils@npm:^9.2.1":
8329-
version: 9.2.1
8330-
resolution: "@graphql-tools/utils@npm:9.2.1"
8331-
dependencies:
8332-
"@graphql-typed-document-node/core": "npm:^3.1.1"
8333-
tslib: "npm:^2.4.0"
8334-
peerDependencies:
8335-
graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0
8336-
checksum: 10c0/37a7bd7e14d28ff1bacc007dca84bc6cef2d7d7af9a547b5dbe52fcd134afddd6d4a7b2148cfbaff5ddba91a868453d597da77bd0457fb0be15928f916901606
8268+
checksum: 10c0/e4f4405b19379614dcaf027a6dd86c8bda6a6e2b61053f595a6b53ab02319b1d5272cf9419b1f95e193016bc22e763b6ed673caf3a73f0cc013d61fc018bdd68
83378269
languageName: node
83388270
linkType: hard
83398271

@@ -14355,14 +14287,14 @@ __metadata:
1435514287
languageName: node
1435614288
linkType: hard
1435714289

14358-
"@whatwg-node/node-fetch@npm:0.7.7":
14359-
version: 0.7.7
14360-
resolution: "@whatwg-node/node-fetch@npm:0.7.7"
14290+
"@whatwg-node/node-fetch@npm:0.7.8-alpha-20250124174946-bf76ab63fc7e7c5ee6898f3bf12f95ef0ac79a63":
14291+
version: 0.7.8-alpha-20250124174946-bf76ab63fc7e7c5ee6898f3bf12f95ef0ac79a63
14292+
resolution: "@whatwg-node/node-fetch@npm:0.7.8-alpha-20250124174946-bf76ab63fc7e7c5ee6898f3bf12f95ef0ac79a63"
1436114293
dependencies:
1436214294
"@whatwg-node/disposablestack": "npm:^0.0.5"
1436314295
busboy: "npm:^1.6.0"
1436414296
tslib: "npm:^2.6.3"
14365-
checksum: 10c0/f61c45f256363f1c98ddcbcfc9265c8a98a64d09461a19ce32bcf76ab38619c7d7ee52ee7abfe80e49ddc7d6336e85ee481552294146ae934fca453feb970d23
14297+
checksum: 10c0/ae9424227481eb4c8abfee0da52cd5272043b0d9312a57c7710fc108250f89de4948af0d785a65578476a6682179fc78c010e851e71468973185deb5ae0fc3fc
1436614298
languageName: node
1436714299
linkType: hard
1436814300

@@ -16084,17 +16016,7 @@ __metadata:
1608416016
languageName: node
1608516017
linkType: hard
1608616018

16087-
"camel-case@npm:4.1.1":
16088-
version: 4.1.1
16089-
resolution: "camel-case@npm:4.1.1"
16090-
dependencies:
16091-
pascal-case: "npm:^3.1.1"
16092-
tslib: "npm:^1.10.0"
16093-
checksum: 10c0/d8113f24a3ac764a81a6ec7a5de5d339bcc749da741e6a088c8f1dc8768845ef5299ce37d94449a0608727ac0a7c33e9c47fecfa820a1ab2b4145c0f5129c584
16094-
languageName: node
16095-
linkType: hard
16096-
16097-
"camel-case@npm:4.1.2, camel-case@npm:^4.1.2":
16019+
"camel-case@npm:^4.1.2":
1609816020
version: 4.1.2
1609916021
resolution: "camel-case@npm:4.1.2"
1610016022
dependencies:
@@ -29288,7 +29210,7 @@ __metadata:
2928829210
languageName: node
2928929211
linkType: hard
2929029212

29291-
"pascal-case@npm:3.1.2, pascal-case@npm:^3.1.1, pascal-case@npm:^3.1.2":
29213+
"pascal-case@npm:3.1.2, pascal-case@npm:^3.1.2":
2929229214
version: 3.1.2
2929329215
resolution: "pascal-case@npm:3.1.2"
2929429216
dependencies:

0 commit comments

Comments
 (0)