mirror of
https://github.com/vale981/apollo-server
synced 2025-03-05 09:41:40 -05:00
Re-enable Typescript esModuleInterop
(#1699)
`esModuleInterop` was enabled in
e4164c8892
to help with importing from packages that use default exports.
Those changes were reverted in
https://github.com/apollographql/apollo-server/pull/1210
to work around a few reported issues. Those issues are no longer
relevant, so this commit re-enables `esModuleInterop`, and
updates all default imports to use the more common (standard)
import syntax.
This commit is contained in:
parent
a88166887b
commit
dd86fa8a29
31 changed files with 104 additions and 59 deletions
|
@ -154,9 +154,9 @@ import express from 'express'
|
||||||
import { ApolloServer } from 'apollo-server-express'
|
import { ApolloServer } from 'apollo-server-express'
|
||||||
import typeDefs from './graphql/schema'
|
import typeDefs from './graphql/schema'
|
||||||
import resolvers from './graphql/resolvers'
|
import resolvers from './graphql/resolvers'
|
||||||
import * as fs from 'fs'
|
import fs from 'fs'
|
||||||
import * as https from 'https'
|
import https from 'https'
|
||||||
import * as http from 'http'
|
import http from 'http'
|
||||||
|
|
||||||
const configurations = {
|
const configurations = {
|
||||||
// Note: You may need sudo to run on port 443
|
// Note: You may need sudo to run on port 443
|
||||||
|
|
43
package-lock.json
generated
43
package-lock.json
generated
|
@ -7944,6 +7944,49 @@
|
||||||
"integrity": "sha512-77XF9iTllATmG9lSlIv0qdQ2BQ/h9t0bJllHlbvsQ0zUWfU7Yi0S8L5JXzPZgkefIiajLmBJJ4BsMJmqcf7oxQ==",
|
"integrity": "sha512-77XF9iTllATmG9lSlIv0qdQ2BQ/h9t0bJllHlbvsQ0zUWfU7Yi0S8L5JXzPZgkefIiajLmBJJ4BsMJmqcf7oxQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"koa": {
|
||||||
|
"version": "2.5.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/koa/-/koa-2.5.3.tgz",
|
||||||
|
"integrity": "sha512-U6rgy2kwlfO+3P1phAidDrRZpGfwcpHCxl33wFe+fHXalpzEshHGnMaSU7I/ZeDFpGRQkbQOYsXkXfUjn+AtdQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"accepts": "^1.3.5",
|
||||||
|
"cache-content-type": "^1.0.0",
|
||||||
|
"content-disposition": "~0.5.2",
|
||||||
|
"content-type": "^1.0.4",
|
||||||
|
"cookies": "~0.7.1",
|
||||||
|
"debug": "~3.1.0",
|
||||||
|
"delegates": "^1.0.0",
|
||||||
|
"depd": "^1.1.2",
|
||||||
|
"destroy": "^1.0.4",
|
||||||
|
"error-inject": "^1.0.0",
|
||||||
|
"escape-html": "^1.0.3",
|
||||||
|
"fresh": "~0.5.2",
|
||||||
|
"http-assert": "^1.3.0",
|
||||||
|
"http-errors": "^1.6.3",
|
||||||
|
"is-generator-function": "^1.0.7",
|
||||||
|
"koa-compose": "^4.1.0",
|
||||||
|
"koa-convert": "^1.2.0",
|
||||||
|
"koa-is-json": "^1.0.0",
|
||||||
|
"on-finished": "^2.3.0",
|
||||||
|
"only": "~0.0.2",
|
||||||
|
"parseurl": "^1.3.2",
|
||||||
|
"statuses": "^1.5.0",
|
||||||
|
"type-is": "^1.6.16",
|
||||||
|
"vary": "^1.1.2"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"debug": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"ms": "2.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"koa-bodyparser": {
|
"koa-bodyparser": {
|
||||||
"version": "3.2.0",
|
"version": "3.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/koa-bodyparser/-/koa-bodyparser-3.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/koa-bodyparser/-/koa-bodyparser-3.2.0.tgz",
|
||||||
|
|
|
@ -94,6 +94,7 @@
|
||||||
"jest": "23.6.0",
|
"jest": "23.6.0",
|
||||||
"jest-matcher-utils": "23.6.0",
|
"jest-matcher-utils": "23.6.0",
|
||||||
"js-sha256": "0.9.0",
|
"js-sha256": "0.9.0",
|
||||||
|
"koa": "^2.5.3",
|
||||||
"koa-multer": "1.0.2",
|
"koa-multer": "1.0.2",
|
||||||
"lerna": "3.4.0",
|
"lerna": "3.4.0",
|
||||||
"lint-staged": "7.2.2",
|
"lint-staged": "7.2.2",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import * as os from 'os';
|
import os from 'os';
|
||||||
import { gzip } from 'zlib';
|
import { gzip } from 'zlib';
|
||||||
import { DocumentNode } from 'graphql';
|
import { DocumentNode } from 'graphql';
|
||||||
import {
|
import {
|
||||||
|
@ -9,7 +9,7 @@ import {
|
||||||
} from 'apollo-engine-reporting-protobuf';
|
} from 'apollo-engine-reporting-protobuf';
|
||||||
|
|
||||||
import { fetch, Response } from 'apollo-server-env';
|
import { fetch, Response } from 'apollo-server-env';
|
||||||
import * as retry from 'async-retry';
|
import retry from 'async-retry';
|
||||||
|
|
||||||
import { EngineReportingExtension } from './extension';
|
import { EngineReportingExtension } from './extension';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { KeyValueCache } from 'apollo-server-caching';
|
import { KeyValueCache } from 'apollo-server-caching';
|
||||||
import * as Memcached from 'memcached';
|
import Memcached from 'memcached';
|
||||||
import { promisify } from 'util';
|
import { promisify } from 'util';
|
||||||
|
|
||||||
export class MemcachedCache implements KeyValueCache {
|
export class MemcachedCache implements KeyValueCache {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { KeyValueCache } from 'apollo-server-caching';
|
import { KeyValueCache } from 'apollo-server-caching';
|
||||||
import * as Redis from 'redis';
|
import Redis from 'redis';
|
||||||
import { promisify } from 'util';
|
import { promisify } from 'util';
|
||||||
import * as DataLoader from 'dataloader';
|
import DataLoader from 'dataloader';
|
||||||
|
|
||||||
export class RedisCache implements KeyValueCache {
|
export class RedisCache implements KeyValueCache {
|
||||||
// FIXME: Replace any with proper promisified type
|
// FIXME: Replace any with proper promisified type
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import * as LRU from 'lru-cache';
|
import LRU from 'lru-cache';
|
||||||
import { KeyValueCache } from './KeyValueCache';
|
import { KeyValueCache } from './KeyValueCache';
|
||||||
|
|
||||||
export class InMemoryLRUCache implements KeyValueCache {
|
export class InMemoryLRUCache implements KeyValueCache {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { GraphQLSchema, DocumentNode } from 'graphql';
|
import { GraphQLSchema, DocumentNode } from 'graphql';
|
||||||
import { SchemaDirectiveVisitor, IResolvers, IMocks } from 'graphql-tools';
|
import { SchemaDirectiveVisitor, IResolvers, IMocks } from 'graphql-tools';
|
||||||
import { ConnectionContext } from 'subscriptions-transport-ws';
|
import { ConnectionContext } from 'subscriptions-transport-ws';
|
||||||
import * as WebSocket from 'ws';
|
import WebSocket from 'ws';
|
||||||
import { GraphQLExtension } from 'graphql-extensions';
|
import { GraphQLExtension } from 'graphql-extensions';
|
||||||
export { GraphQLExtension } from 'graphql-extensions';
|
export { GraphQLExtension } from 'graphql-extensions';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import * as express from 'express';
|
import express from 'express';
|
||||||
import * as corsMiddleware from 'cors';
|
import corsMiddleware from 'cors';
|
||||||
import { json, OptionsJson } from 'body-parser';
|
import { json, OptionsJson } from 'body-parser';
|
||||||
import {
|
import {
|
||||||
renderPlaygroundPage,
|
renderPlaygroundPage,
|
||||||
|
@ -11,8 +11,8 @@ import {
|
||||||
ApolloServerBase,
|
ApolloServerBase,
|
||||||
formatApolloErrors,
|
formatApolloErrors,
|
||||||
} from 'apollo-server-core';
|
} from 'apollo-server-core';
|
||||||
import * as accepts from 'accepts';
|
import accepts from 'accepts';
|
||||||
import * as typeis from 'type-is';
|
import typeis from 'type-is';
|
||||||
|
|
||||||
import { graphqlExpress } from './expressApollo';
|
import { graphqlExpress } from './expressApollo';
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import * as express from 'express';
|
import express from 'express';
|
||||||
|
|
||||||
import * as http from 'http';
|
import http from 'http';
|
||||||
|
|
||||||
import * as request from 'request';
|
import request from 'request';
|
||||||
import * as FormData from 'form-data';
|
import FormData from 'form-data';
|
||||||
import * as fs from 'fs';
|
import fs from 'fs';
|
||||||
import { createApolloFetch } from 'apollo-fetch';
|
import { createApolloFetch } from 'apollo-fetch';
|
||||||
|
|
||||||
import { gql, AuthenticationError, Config } from 'apollo-server-core';
|
import { gql, AuthenticationError, Config } from 'apollo-server-core';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import * as connect from 'connect';
|
import connect from 'connect';
|
||||||
import * as query from 'qs-middleware';
|
import query from 'qs-middleware';
|
||||||
import { ApolloServer } from '../ApolloServer';
|
import { ApolloServer } from '../ApolloServer';
|
||||||
import { Config } from 'apollo-server-core';
|
import { Config } from 'apollo-server-core';
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import * as express from 'express';
|
import express from 'express';
|
||||||
|
|
||||||
import * as http from 'http';
|
import http from 'http';
|
||||||
|
|
||||||
import { RESTDataSource } from 'apollo-datasource-rest';
|
import { RESTDataSource } from 'apollo-datasource-rest';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import * as express from 'express';
|
import express from 'express';
|
||||||
import { ApolloServer } from '../ApolloServer';
|
import { ApolloServer } from '../ApolloServer';
|
||||||
import testSuite, {
|
import testSuite, {
|
||||||
schema as Schema,
|
schema as Schema,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import * as express from 'express';
|
import express from 'express';
|
||||||
import {
|
import {
|
||||||
GraphQLOptions,
|
GraphQLOptions,
|
||||||
HttpQueryError,
|
HttpQueryError,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import * as hapi from 'hapi';
|
import hapi from 'hapi';
|
||||||
import { parseAll } from 'accept';
|
import { parseAll } from 'accept';
|
||||||
import {
|
import {
|
||||||
renderPlaygroundPage,
|
renderPlaygroundPage,
|
||||||
|
|
|
@ -7,7 +7,7 @@ if (NODE_MAJOR_VERSION < 8) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
import * as hapi from 'hapi';
|
import hapi from 'hapi';
|
||||||
import { ApolloServer } from '../ApolloServer';
|
import { ApolloServer } from '../ApolloServer';
|
||||||
import { Config } from 'apollo-server-core';
|
import { Config } from 'apollo-server-core';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import * as Boom from 'boom';
|
import Boom from 'boom';
|
||||||
import { Server, Request, RouteOptions } from 'hapi';
|
import { Server, Request, RouteOptions } from 'hapi';
|
||||||
import {
|
import {
|
||||||
GraphQLOptions,
|
GraphQLOptions,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* tslint:disable:no-unused-expression */
|
/* tslint:disable:no-unused-expression */
|
||||||
import * as http from 'http';
|
import http from 'http';
|
||||||
import * as net from 'net';
|
import net from 'net';
|
||||||
import { sha256 } from 'js-sha256';
|
import { sha256 } from 'js-sha256';
|
||||||
import express = require('express');
|
import express = require('express');
|
||||||
import bodyParser = require('body-parser');
|
import bodyParser = require('body-parser');
|
||||||
|
@ -19,7 +19,7 @@ import {
|
||||||
|
|
||||||
import { PubSub } from 'graphql-subscriptions';
|
import { PubSub } from 'graphql-subscriptions';
|
||||||
import { SubscriptionClient } from 'subscriptions-transport-ws';
|
import { SubscriptionClient } from 'subscriptions-transport-ws';
|
||||||
import * as WebSocket from 'ws';
|
import WebSocket from 'ws';
|
||||||
|
|
||||||
import { execute } from 'apollo-link';
|
import { execute } from 'apollo-link';
|
||||||
import { createHttpLink } from 'apollo-link-http';
|
import { createHttpLink } from 'apollo-link-http';
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import * as Koa from 'koa';
|
import Koa from 'koa';
|
||||||
import * as corsMiddleware from '@koa/cors';
|
import corsMiddleware from '@koa/cors';
|
||||||
import * as bodyParser from 'koa-bodyparser';
|
import bodyParser from 'koa-bodyparser';
|
||||||
import * as compose from 'koa-compose';
|
import compose from 'koa-compose';
|
||||||
import {
|
import {
|
||||||
renderPlaygroundPage,
|
renderPlaygroundPage,
|
||||||
RenderPageOptions as PlaygroundRenderPageOptions,
|
RenderPageOptions as PlaygroundRenderPageOptions,
|
||||||
} from '@apollographql/graphql-playground-html';
|
} from '@apollographql/graphql-playground-html';
|
||||||
import { ApolloServerBase, formatApolloErrors } from 'apollo-server-core';
|
import { ApolloServerBase, formatApolloErrors } from 'apollo-server-core';
|
||||||
import * as accepts from 'accepts';
|
import accepts from 'accepts';
|
||||||
import * as typeis from 'type-is';
|
import typeis from 'type-is';
|
||||||
|
|
||||||
import { graphqlKoa } from './koaApollo';
|
import { graphqlKoa } from './koaApollo';
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import * as Koa from 'koa';
|
import Koa from 'koa';
|
||||||
|
|
||||||
import * as http from 'http';
|
import http from 'http';
|
||||||
|
|
||||||
import * as request from 'request';
|
import request from 'request';
|
||||||
import * as FormData from 'form-data';
|
import FormData from 'form-data';
|
||||||
import * as fs from 'fs';
|
import fs from 'fs';
|
||||||
import { createApolloFetch } from 'apollo-fetch';
|
import { createApolloFetch } from 'apollo-fetch';
|
||||||
|
|
||||||
import { gql, AuthenticationError, Config } from 'apollo-server-core';
|
import { gql, AuthenticationError, Config } from 'apollo-server-core';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import * as Koa from 'koa';
|
import Koa from 'koa';
|
||||||
import * as KoaRouter from 'koa-router';
|
import KoaRouter from 'koa-router';
|
||||||
|
|
||||||
import * as http from 'http';
|
import http from 'http';
|
||||||
|
|
||||||
import { RESTDataSource } from 'apollo-datasource-rest';
|
import { RESTDataSource } from 'apollo-datasource-rest';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import * as Koa from 'koa';
|
import Koa from 'koa';
|
||||||
import { ApolloServer } from '../ApolloServer';
|
import { ApolloServer } from '../ApolloServer';
|
||||||
import testSuite, {
|
import testSuite, {
|
||||||
schema as Schema,
|
schema as Schema,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import * as Koa from 'koa';
|
import Koa from 'koa';
|
||||||
import {
|
import {
|
||||||
GraphQLOptions,
|
GraphQLOptions,
|
||||||
HttpQueryError,
|
HttpQueryError,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import * as lambda from 'aws-lambda';
|
import lambda from 'aws-lambda';
|
||||||
import { ApolloServerBase } from 'apollo-server-core';
|
import { ApolloServerBase } from 'apollo-server-core';
|
||||||
import { GraphQLOptions, Config } from 'apollo-server-core';
|
import { GraphQLOptions, Config } from 'apollo-server-core';
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import testSuite, {
|
||||||
CreateAppOptions,
|
CreateAppOptions,
|
||||||
} from 'apollo-server-integration-testsuite';
|
} from 'apollo-server-integration-testsuite';
|
||||||
import { Config } from 'apollo-server-core';
|
import { Config } from 'apollo-server-core';
|
||||||
import * as url from 'url';
|
import url from 'url';
|
||||||
import { IncomingMessage, ServerResponse } from 'http';
|
import { IncomingMessage, ServerResponse } from 'http';
|
||||||
|
|
||||||
const createLambda = (options: CreateAppOptions = {}) => {
|
const createLambda = (options: CreateAppOptions = {}) => {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import * as lambda from 'aws-lambda';
|
import lambda from 'aws-lambda';
|
||||||
import {
|
import {
|
||||||
GraphQLOptions,
|
GraphQLOptions,
|
||||||
HttpQueryError,
|
HttpQueryError,
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import micro from 'micro';
|
import micro from 'micro';
|
||||||
import * as listen from 'test-listen';
|
import listen from 'test-listen';
|
||||||
import { createApolloFetch } from 'apollo-fetch';
|
import { createApolloFetch } from 'apollo-fetch';
|
||||||
import { gql } from 'apollo-server-core';
|
import { gql } from 'apollo-server-core';
|
||||||
import * as FormData from 'form-data';
|
import FormData from 'form-data';
|
||||||
import * as fs from 'fs';
|
import fs from 'fs';
|
||||||
import * as rp from 'request-promise';
|
import rp from 'request-promise';
|
||||||
|
|
||||||
import { ApolloServer } from '../ApolloServer';
|
import { ApolloServer } from '../ApolloServer';
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import {
|
||||||
convertNodeHttpToRequest,
|
convertNodeHttpToRequest,
|
||||||
} from 'apollo-server-core';
|
} from 'apollo-server-core';
|
||||||
import { send, json, RequestHandler } from 'micro';
|
import { send, json, RequestHandler } from 'micro';
|
||||||
import * as url from 'url';
|
import url from 'url';
|
||||||
import { IncomingMessage, ServerResponse } from 'http';
|
import { IncomingMessage, ServerResponse } from 'http';
|
||||||
|
|
||||||
import { MicroRequest } from './types';
|
import { MicroRequest } from './types';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import * as request from 'request';
|
import request from 'request';
|
||||||
import { createApolloFetch } from 'apollo-fetch';
|
import { createApolloFetch } from 'apollo-fetch';
|
||||||
|
|
||||||
import { gql, ApolloServer } from '../index';
|
import { gql, ApolloServer } from '../index';
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
// an express app for you instead of applyMiddleware (which you might not even
|
// an express app for you instead of applyMiddleware (which you might not even
|
||||||
// use with express). The dependency is unused otherwise, so don't worry if
|
// use with express). The dependency is unused otherwise, so don't worry if
|
||||||
// you're not using express or your version doesn't quite match up.
|
// you're not using express or your version doesn't quite match up.
|
||||||
import * as express from 'express';
|
import express from 'express';
|
||||||
import * as http from 'http';
|
import http from 'http';
|
||||||
import * as net from 'net';
|
import net from 'net';
|
||||||
import {
|
import {
|
||||||
ApolloServer as ApolloServerBase,
|
ApolloServer as ApolloServerBase,
|
||||||
CorsOptions,
|
CorsOptions,
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
"target": "es2016",
|
"target": "es2016",
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
|
"esModuleInterop": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"declarationMap": true,
|
"declarationMap": true,
|
||||||
|
|
Loading…
Add table
Reference in a new issue