Skip to content

Commit

Permalink
enhance: improve cross-platform support (#3733)
Browse files Browse the repository at this point in the history
  • Loading branch information
ardatan authored Mar 21, 2022
1 parent 3a1d3bb commit 67fb117
Show file tree
Hide file tree
Showing 15 changed files with 29 additions and 19 deletions.
12 changes: 12 additions & 0 deletions .changeset/stale-lamps-rhyme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
'@graphql-mesh/cache-file': minor
'@graphql-mesh/cli': minor
'@graphql-mesh/config': minor
'@graphql-mesh/grpc': minor
'json-machete': minor
'@graphql-mesh/store': minor
'@graphql-mesh/transform-extend': minor
'@graphql-mesh/utils': minor
---

enhance: improve cross-platform support
1 change: 1 addition & 0 deletions packages/cache/file/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"dependencies": {
"@graphql-mesh/types": "0.68.1",
"@graphql-mesh/utils": "0.31.0",
"@graphql-mesh/cross-helpers": "0.1.0",
"dataloader": "2.0.0",
"lodash": "4.17.21",
"tslib": "^2.3.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/cache/file/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ImportFn, KeyValueCache } from '@graphql-mesh/types';
import pathModule from 'path';
import { path as pathModule } from '@graphql-mesh/cross-helpers';
import _ from 'lodash';
import DataLoader from 'dataloader';
import { writeJSON } from '@graphql-mesh/utils';
Expand Down
5 changes: 2 additions & 3 deletions packages/cli/src/commands/ts-artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ import { printSchemaWithDirectives, Source } from '@graphql-tools/utils';
import * as tsOperationsPlugin from '@graphql-codegen/typescript-operations';
import * as typescriptGenericSdk from '@graphql-codegen/typescript-generic-sdk';
import * as typedDocumentNodePlugin from '@graphql-codegen/typed-document-node';
import pathModule from 'path';
import { fs, path as pathModule } from '@graphql-mesh/cross-helpers';
import ts from 'typescript';
import { pathExists, writeFile, writeJSON } from '@graphql-mesh/utils';
import { fs } from '@graphql-mesh/cross-helpers';
import { generateOperations } from './generate-operations';
import { GraphQLMeshCLIParams } from '..';
import { stripJSONComments } from '../utils';
Expand Down Expand Up @@ -239,7 +238,7 @@ export async function generateTsArtifacts(
const importCodes = [
`import { getMesh } from '@graphql-mesh/runtime';`,
`import { MeshStore, FsStoreStorageAdapter } from '@graphql-mesh/store';`,
`import pathModule from 'path';`,
`import { path as pathModule } from '@graphql-mesh/cross-helpers';`,
`import { fileURLToPath } from '@graphql-mesh/utils';`,
];
const importedModulesCodes: string[] = [...importedModulesSet].map((importedModuleName, i) => {
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { findAndParseConfig } from './config';
import { getMesh, GetMeshOptions, ServeMeshOptions } from '@graphql-mesh/runtime';
import { generateTsArtifacts } from './commands/ts-artifacts';
import { serveMesh } from './commands/serve/serve';
import pathModule from 'path';
import { fs } from '@graphql-mesh/cross-helpers';
import { fs, path as pathModule } from '@graphql-mesh/cross-helpers';
import { FsStoreStorageAdapter, MeshStore } from '@graphql-mesh/store';
import {
writeFile,
Expand Down
2 changes: 1 addition & 1 deletion packages/config/src/process.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pathModule from 'path';
import { path as pathModule } from '@graphql-mesh/cross-helpers';
import { MeshResolvedSource } from '@graphql-mesh/runtime';
import {
ImportFn,
Expand Down
3 changes: 1 addition & 2 deletions packages/handlers/grpc/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { jsonFlatStringify } from '@graphql-mesh/utils';
import { ClientReadableStream, ClientUnaryCall, Metadata, MetadataValue } from '@grpc/grpc-js';
import { fs } from '@graphql-mesh/cross-helpers';
import { fs, path as pathModule } from '@graphql-mesh/cross-helpers';
import { SchemaComposer } from 'graphql-compose';
import _ from 'lodash';
import pathModule from 'path';
import { Root } from 'protobufjs';

import { getGraphQLScalar, isScalarType } from './scalars';
Expand Down
2 changes: 2 additions & 0 deletions packages/json-machete/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"cross-undici-fetch": "0.1.27",
"json-ptr": "3.1.0",
"@graphql-mesh/utils": "0.31.0",
"@graphql-mesh/cross-helpers": "0.1.0",
"@graphql-tools/utils": "8.6.3",
"url-join": "4.0.1",
"to-json-schema": "0.2.5",
"tslib": "^2.3.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/json-machete/src/dereferenceObject.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { JsonPointer } from 'json-ptr';
import pathModule from 'path';
import { path as pathModule } from '@graphql-mesh/cross-helpers';
import urlJoin from 'url-join';
import { fetch as crossUndiciFetch } from 'cross-undici-fetch';
import { readFileOrUrl } from '@graphql-mesh/utils';
Expand Down
4 changes: 2 additions & 2 deletions packages/json-machete/src/healJSONSchema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { inspect } from 'util';
import { inspect } from '@graphql-tools/utils';
import { JSONSchema } from './types';
import { OnCircularReference, visitJSONSchema } from './visitJSONSchema';
import toJsonSchema from 'to-json-schema';
Expand Down Expand Up @@ -30,7 +30,7 @@ function deduplicateJSONSchema(schema: JSONSchema, seenMap = new Map()) {
if (titleReserved) {
schema.title = undefined;
}
const stringified = inspect(schema, undefined, 3);
const stringified = inspect(schema);
if (titleReserved) {
schema.title = titleReserved;
}
Expand Down
3 changes: 1 addition & 2 deletions packages/store/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { fs } from '@graphql-mesh/cross-helpers';
import pathModule from 'path';
import { fs, path as pathModule } from '@graphql-mesh/cross-helpers';
import { flatString, writeFile, AggregateError } from '@graphql-mesh/utils';
import { CriticalityLevel, diff } from '@graphql-inspector/core';
import { printSchemaWithDirectives } from '@graphql-tools/utils';
Expand Down
1 change: 1 addition & 0 deletions packages/transforms/extend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"@graphql-tools/graphql-file-loader": "7.3.5",
"@graphql-tools/schema": "8.3.3",
"@graphql-tools/utils": "8.6.3",
"@graphql-mesh/cross-helpers": "0.1.0",
"tslib": "^2.3.1"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/transforms/extend/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pathModule from 'path';
import { path as pathModule } from '@graphql-mesh/cross-helpers';
import { ImportFn, MeshTransform, MeshTransformOptions, YamlConfig } from '@graphql-mesh/types';
import { loadFromModuleExportExpression } from '@graphql-mesh/utils';
import { CodeFileLoader } from '@graphql-tools/code-file-loader';
Expand Down
3 changes: 1 addition & 2 deletions packages/utils/src/fs-operations.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { fs } from '@graphql-mesh/cross-helpers';
import pathModule from 'path';
import { fs, path as pathModule } from '@graphql-mesh/cross-helpers';
import { jsonFlatStringify } from './flat-string';

export async function pathExists(path: string) {
Expand Down
3 changes: 1 addition & 2 deletions packages/utils/src/read-file-or-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { fetchFactory, KeyValueCache } from 'fetchache';
import { fetch as crossFetch, Request, Response } from 'cross-undici-fetch';
import isUrl from 'is-url';
import { DEFAULT_SCHEMA, load as loadYamlFromJsYaml, Schema, Type } from 'js-yaml';
import pathModule from 'path';
import { fs } from '@graphql-mesh/cross-helpers';
import { fs, path as pathModule } from '@graphql-mesh/cross-helpers';
import { ImportFn, Logger } from '@graphql-mesh/types';
import { defaultImportFn } from './defaultImportFn';
import { memoize1 } from '@graphql-tools/utils';
Expand Down

1 comment on commit 67fb117

@vercel
Copy link

@vercel vercel bot commented on 67fb117 Mar 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.