Skip to content

Commit eb6396b

Browse files
committed
..
1 parent 9f50d92 commit eb6396b

File tree

3 files changed

+24
-119
lines changed

3 files changed

+24
-119
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 & 102 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"
@@ -8465,90 +8456,17 @@ __metadata:
84658456
languageName: node
84668457
linkType: hard
84678458

8468-
"@graphql-tools/utils@npm:10.6.1":
8469-
version: 10.6.1
8470-
resolution: "@graphql-tools/utils@npm:10.6.1"
8471-
dependencies:
8472-
"@graphql-typed-document-node/core": "npm:^3.1.1"
8473-
cross-inspect: "npm:1.0.1"
8474-
dset: "npm:^3.1.2"
8475-
tslib: "npm:^2.4.0"
8476-
peerDependencies:
8477-
graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0
8478-
checksum: 10c0/00cd131e34e0adf85c4b879fc301fcf0b51709d8b802efe0349d0207dbc64990b018f3588d8bc122de805c0759f96e145ec1f80083a2f95a37f4ea83ce0329ed
8479-
languageName: node
8480-
linkType: hard
8481-
8482-
"@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":
8483-
version: 10.7.2
8484-
resolution: "@graphql-tools/utils@npm:10.7.2"
8459+
"@graphql-tools/utils@npm:10.8.0-alpha-20250124175511-cf926757b2731edb762be661f8671ed41d778b2f":
8460+
version: 10.8.0-alpha-20250124175511-cf926757b2731edb762be661f8671ed41d778b2f
8461+
resolution: "@graphql-tools/utils@npm:10.8.0-alpha-20250124175511-cf926757b2731edb762be661f8671ed41d778b2f"
84858462
dependencies:
84868463
"@graphql-typed-document-node/core": "npm:^3.1.1"
84878464
cross-inspect: "npm:1.0.1"
84888465
dset: "npm:^3.1.4"
84898466
tslib: "npm:^2.4.0"
84908467
peerDependencies:
84918468
graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0
8492-
checksum: 10c0/1e73eaf482437e2d20c1241d3fd422587a7cba93bc67d1572974053788fda22cca745f2e3048150a0af5b0cd9132b7ee49b661ada7a4a0e40e4732afcb53c549
8493-
languageName: node
8494-
linkType: hard
8495-
8496-
"@graphql-tools/utils@npm:6.1.0":
8497-
version: 6.1.0
8498-
resolution: "@graphql-tools/utils@npm:6.1.0"
8499-
dependencies:
8500-
"@ardatan/aggregate-error": "npm:0.0.1"
8501-
camel-case: "npm:4.1.1"
8502-
peerDependencies:
8503-
graphql: ^14.0.0 || ^15.0.0
8504-
checksum: 10c0/e86b307a30698962834b249d52d2a1df3aaba1360e64b8a36e09c32b6101c2e26bfacf23370cc5fa21297c1d03e23afc81e4686770567df4d1b5b693f35d6cc0
8505-
languageName: node
8506-
linkType: hard
8507-
8508-
"@graphql-tools/utils@npm:8.9.0":
8509-
version: 8.9.0
8510-
resolution: "@graphql-tools/utils@npm:8.9.0"
8511-
dependencies:
8512-
tslib: "npm:^2.4.0"
8513-
peerDependencies:
8514-
graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0
8515-
checksum: 10c0/dd589d970fee9ce093a545c69d6306b61af0f38358361295af1274164a87db2985a51d05ca0e0dd08a4e709f0b5c7c201e69ab0b30480fe2fa0c7a7b8310da0a
8516-
languageName: node
8517-
linkType: hard
8518-
8519-
"@graphql-tools/utils@npm:^7.6.0":
8520-
version: 7.10.0
8521-
resolution: "@graphql-tools/utils@npm:7.10.0"
8522-
dependencies:
8523-
"@ardatan/aggregate-error": "npm:0.0.6"
8524-
camel-case: "npm:4.1.2"
8525-
tslib: "npm:~2.2.0"
8526-
peerDependencies:
8527-
graphql: ^14.0.0 || ^15.0.0
8528-
checksum: 10c0/e8b29bf3ff63c9ca123daa3785422189177ec0273331bb739a422d3055b5b3d0e956d357988e46b4b06e74d727c1ff228fe467d4e956a72ca8b6e292d0ce0f02
8529-
languageName: node
8530-
linkType: hard
8531-
8532-
"@graphql-tools/utils@npm:^8.5.2, @graphql-tools/utils@npm:^8.8.0":
8533-
version: 8.13.1
8534-
resolution: "@graphql-tools/utils@npm:8.13.1"
8535-
dependencies:
8536-
tslib: "npm:^2.4.0"
8537-
peerDependencies:
8538-
graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0
8539-
checksum: 10c0/f9bab1370aa91e706abec4c8ea980e15293cb78bd4effba53ad2365dc39d81148db7667b3ef89b35f0a0b0ad58081ffdac4264b7125c69fa8393590ae5025745
8540-
languageName: node
8541-
linkType: hard
8542-
8543-
"@graphql-tools/utils@npm:^9.0.0, @graphql-tools/utils@npm:^9.2.1":
8544-
version: 9.2.1
8545-
resolution: "@graphql-tools/utils@npm:9.2.1"
8546-
dependencies:
8547-
"@graphql-typed-document-node/core": "npm:^3.1.1"
8548-
tslib: "npm:^2.4.0"
8549-
peerDependencies:
8550-
graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0
8551-
checksum: 10c0/37a7bd7e14d28ff1bacc007dca84bc6cef2d7d7af9a547b5dbe52fcd134afddd6d4a7b2148cfbaff5ddba91a868453d597da77bd0457fb0be15928f916901606
8469+
checksum: 10c0/e4f4405b19379614dcaf027a6dd86c8bda6a6e2b61053f595a6b53ab02319b1d5272cf9419b1f95e193016bc22e763b6ed673caf3a73f0cc013d61fc018bdd68
85528470
languageName: node
85538471
linkType: hard
85548472

@@ -14570,14 +14488,14 @@ __metadata:
1457014488
languageName: node
1457114489
linkType: hard
1457214490

14573-
"@whatwg-node/node-fetch@npm:0.7.7":
14574-
version: 0.7.7
14575-
resolution: "@whatwg-node/node-fetch@npm:0.7.7"
14491+
"@whatwg-node/node-fetch@npm:0.7.8-alpha-20250124174946-bf76ab63fc7e7c5ee6898f3bf12f95ef0ac79a63":
14492+
version: 0.7.8-alpha-20250124174946-bf76ab63fc7e7c5ee6898f3bf12f95ef0ac79a63
14493+
resolution: "@whatwg-node/node-fetch@npm:0.7.8-alpha-20250124174946-bf76ab63fc7e7c5ee6898f3bf12f95ef0ac79a63"
1457614494
dependencies:
1457714495
"@whatwg-node/disposablestack": "npm:^0.0.5"
1457814496
busboy: "npm:^1.6.0"
1457914497
tslib: "npm:^2.6.3"
14580-
checksum: 10c0/f61c45f256363f1c98ddcbcfc9265c8a98a64d09461a19ce32bcf76ab38619c7d7ee52ee7abfe80e49ddc7d6336e85ee481552294146ae934fca453feb970d23
14498+
checksum: 10c0/ae9424227481eb4c8abfee0da52cd5272043b0d9312a57c7710fc108250f89de4948af0d785a65578476a6682179fc78c010e851e71468973185deb5ae0fc3fc
1458114499
languageName: node
1458214500
linkType: hard
1458314501

@@ -16299,17 +16217,7 @@ __metadata:
1629916217
languageName: node
1630016218
linkType: hard
1630116219

16302-
"camel-case@npm:4.1.1":
16303-
version: 4.1.1
16304-
resolution: "camel-case@npm:4.1.1"
16305-
dependencies:
16306-
pascal-case: "npm:^3.1.1"
16307-
tslib: "npm:^1.10.0"
16308-
checksum: 10c0/d8113f24a3ac764a81a6ec7a5de5d339bcc749da741e6a088c8f1dc8768845ef5299ce37d94449a0608727ac0a7c33e9c47fecfa820a1ab2b4145c0f5129c584
16309-
languageName: node
16310-
linkType: hard
16311-
16312-
"camel-case@npm:4.1.2, camel-case@npm:^4.1.2":
16220+
"camel-case@npm:^4.1.2":
1631316221
version: 4.1.2
1631416222
resolution: "camel-case@npm:4.1.2"
1631516223
dependencies:
@@ -29503,7 +29411,7 @@ __metadata:
2950329411
languageName: node
2950429412
linkType: hard
2950529413

29506-
"pascal-case@npm:3.1.2, pascal-case@npm:^3.1.1, pascal-case@npm:^3.1.2":
29414+
"pascal-case@npm:3.1.2, pascal-case@npm:^3.1.2":
2950729415
version: 3.1.2
2950829416
resolution: "pascal-case@npm:3.1.2"
2950929417
dependencies:

0 commit comments

Comments
 (0)