json-machete 0.5.9 → 0.5.11-alpha-a31c6edfd.0
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/index.js +11 -11
- package/index.mjs +5 -5
- package/package.json +3 -2
package/index.js
CHANGED
|
@@ -6,7 +6,7 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
|
|
6
6
|
|
|
7
7
|
const jsonPtr = require('json-ptr');
|
|
8
8
|
const utils = require('@graphql-mesh/utils');
|
|
9
|
-
const
|
|
9
|
+
const pathModule = _interopDefault(require('path'));
|
|
10
10
|
const urlJoin = _interopDefault(require('url-join'));
|
|
11
11
|
const crossUndiciFetch = require('cross-undici-fetch');
|
|
12
12
|
const util = require('util');
|
|
@@ -322,7 +322,7 @@ function isURL(str) {
|
|
|
322
322
|
const getAbsolute$Ref = (given$ref, baseFilePath) => {
|
|
323
323
|
const [givenExternalFileRelativePath, givenRefPath] = given$ref.split('#');
|
|
324
324
|
if (givenExternalFileRelativePath) {
|
|
325
|
-
const cwd = isURL(baseFilePath) ? getCwdForUrl(baseFilePath) :
|
|
325
|
+
const cwd = isURL(baseFilePath) ? getCwdForUrl(baseFilePath) : pathModule.dirname(baseFilePath);
|
|
326
326
|
const givenExternalFilePath = getAbsolutePath(givenExternalFileRelativePath, cwd);
|
|
327
327
|
if (givenRefPath) {
|
|
328
328
|
return `${givenExternalFilePath}#${givenRefPath}`;
|
|
@@ -339,20 +339,20 @@ function getCwdForUrl(url) {
|
|
|
339
339
|
function normalizeUrl(url) {
|
|
340
340
|
return new URL(url).toString();
|
|
341
341
|
}
|
|
342
|
-
function getAbsolutePath(path
|
|
343
|
-
if (isURL(path
|
|
344
|
-
return path
|
|
342
|
+
function getAbsolutePath(path, cwd) {
|
|
343
|
+
if (isURL(path)) {
|
|
344
|
+
return path;
|
|
345
345
|
}
|
|
346
346
|
if (isURL(cwd)) {
|
|
347
|
-
return normalizeUrl(urlJoin(cwd, path
|
|
347
|
+
return normalizeUrl(urlJoin(cwd, path));
|
|
348
348
|
}
|
|
349
|
-
if (
|
|
350
|
-
return path
|
|
349
|
+
if (pathModule.isAbsolute(path)) {
|
|
350
|
+
return path;
|
|
351
351
|
}
|
|
352
|
-
return
|
|
352
|
+
return pathModule.join(cwd, path);
|
|
353
353
|
}
|
|
354
|
-
function getCwd(path
|
|
355
|
-
return isURL(path
|
|
354
|
+
function getCwd(path) {
|
|
355
|
+
return isURL(path) ? getCwdForUrl(path) : pathModule.dirname(path);
|
|
356
356
|
}
|
|
357
357
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
358
358
|
async function dereferenceObject(obj, { cwd = process.cwd(), externalFileCache = new Map(), refMap = new Map(), root = obj, fetch = crossUndiciFetch.fetch, headers, } = {}) {
|
package/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JsonPointer } from 'json-ptr';
|
|
2
2
|
import { AggregateError, readFileOrUrl } from '@graphql-mesh/utils';
|
|
3
|
-
import
|
|
3
|
+
import pathModule from 'path';
|
|
4
4
|
import urlJoin from 'url-join';
|
|
5
5
|
import { fetch } from 'cross-undici-fetch';
|
|
6
6
|
import { inspect } from 'util';
|
|
@@ -317,7 +317,7 @@ function isURL(str) {
|
|
|
317
317
|
const getAbsolute$Ref = (given$ref, baseFilePath) => {
|
|
318
318
|
const [givenExternalFileRelativePath, givenRefPath] = given$ref.split('#');
|
|
319
319
|
if (givenExternalFileRelativePath) {
|
|
320
|
-
const cwd = isURL(baseFilePath) ? getCwdForUrl(baseFilePath) : dirname(baseFilePath);
|
|
320
|
+
const cwd = isURL(baseFilePath) ? getCwdForUrl(baseFilePath) : pathModule.dirname(baseFilePath);
|
|
321
321
|
const givenExternalFilePath = getAbsolutePath(givenExternalFileRelativePath, cwd);
|
|
322
322
|
if (givenRefPath) {
|
|
323
323
|
return `${givenExternalFilePath}#${givenRefPath}`;
|
|
@@ -341,13 +341,13 @@ function getAbsolutePath(path, cwd) {
|
|
|
341
341
|
if (isURL(cwd)) {
|
|
342
342
|
return normalizeUrl(urlJoin(cwd, path));
|
|
343
343
|
}
|
|
344
|
-
if (isAbsolute(path)) {
|
|
344
|
+
if (pathModule.isAbsolute(path)) {
|
|
345
345
|
return path;
|
|
346
346
|
}
|
|
347
|
-
return join(cwd, path);
|
|
347
|
+
return pathModule.join(cwd, path);
|
|
348
348
|
}
|
|
349
349
|
function getCwd(path) {
|
|
350
|
-
return isURL(path) ? getCwdForUrl(path) : dirname(path);
|
|
350
|
+
return isURL(path) ? getCwdForUrl(path) : pathModule.dirname(path);
|
|
351
351
|
}
|
|
352
352
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
353
353
|
async function dereferenceObject(obj, { cwd = process.cwd(), externalFileCache = new Map(), refMap = new Map(), root = obj, fetch: fetch$1 = fetch, headers, } = {}) {
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "json-machete",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.11-alpha-a31c6edfd.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@graphql-mesh/utils": "0.
|
|
6
|
+
"@graphql-mesh/utils": "0.28.0-alpha-a31c6edfd.0",
|
|
7
7
|
"@json-schema-tools/meta-schema": "1.6.19",
|
|
8
8
|
"cross-undici-fetch": "0.1.25",
|
|
9
9
|
"json-ptr": "3.1.0",
|
|
10
10
|
"to-json-schema": "0.2.5",
|
|
11
|
+
"tslib": "^2.3.1",
|
|
11
12
|
"url-join": "4.0.1"
|
|
12
13
|
},
|
|
13
14
|
"license": "MIT",
|