diff --git a/.changeset/two-kiwis-accept.md b/.changeset/two-kiwis-accept.md new file mode 100644 index 0000000000..444432391c --- /dev/null +++ b/.changeset/two-kiwis-accept.md @@ -0,0 +1,25 @@ +--- +'@envelop/core': minor +'@envelop/apollo-tracing': minor +'@envelop/auth0': minor +'@envelop/dataloader': minor +'@envelop/depth-limit': minor +'@envelop/disable-introspection': minor +'@envelop/extended-validation': minor +'@envelop/filter-operation-type': minor +'@envelop/generic-auth': minor +'@envelop/graphql-jit': minor +'@envelop/graphql-middleware': minor +'@envelop/graphql-modules': minor +'@envelop/opentelemetry': minor +'@envelop/parser-cache': minor +'@envelop/persisted-operations': minor +'@envelop/preload-assets': minor +'@envelop/rate-limiter': minor +'@envelop/sentry': minor +'@envelop/validation-cache': minor +'@envelop/testing': minor +'@envelop/types': minor +--- + +ESM Support for all plugins and envelop core diff --git a/benchmark/k6.js b/benchmark/k6.js index 7c7501075a..0bfa57b77f 100644 --- a/benchmark/k6.js +++ b/benchmark/k6.js @@ -18,7 +18,7 @@ export const options = { thresholds: { no_errors: ['rate=1.0'], expected_result: ['rate=1.0'], - http_req_duration: ['p(95)<=12'], + http_req_duration: ['p(95)<=15'], graphql_execute: ['p(95)<=1'], graphql_context: ['p(95)<=1'], graphql_validate: ['p(95)<=1'], diff --git a/examples/with-esm/README.md b/examples/with-esm/README.md new file mode 100644 index 0000000000..ee5e02e258 --- /dev/null +++ b/examples/with-esm/README.md @@ -0,0 +1,14 @@ +## Envelop with ESM + +If you are using ESM in your project, you can consume Envelop's core and plugins using ESM. + +All bundles produced from this repo has `mjs` in addition to CommonJS. + +### Running this example + +To run this example: + +1. Make sure to install deps on the root of the repo. +2. Run `yarn build`. +3. Run `yarn dev` in this directory. + diff --git a/examples/with-esm/package.json b/examples/with-esm/package.json new file mode 100644 index 0000000000..4bafbc36e8 --- /dev/null +++ b/examples/with-esm/package.json @@ -0,0 +1,19 @@ +{ + "name": "@envelop-examples/with-esm", + "version": "0.0.1", + "scripts": { + "dev": "tsup-node src/index.ts --format esm --watch src --onSuccess \"node dist/index.mjs\"", + "start": "tsup-node src/index.ts --format esm --onSuccess \"node dist/index.mjs\"" + }, + "dependencies": { + "@envelop/core": "*", + "@graphql-tools/schema": "7.1.5", + "fastify": "3.14.0", + "graphql-helix": "1.6.1" + }, + "devDependencies": { + "@types/node": "15.12.2", + "tsup": "4.11.2", + "typescript": "4.3.2" + } +} diff --git a/examples/with-esm/src/index.ts b/examples/with-esm/src/index.ts new file mode 100644 index 0000000000..1f55adb81c --- /dev/null +++ b/examples/with-esm/src/index.ts @@ -0,0 +1,68 @@ +/* eslint-disable no-console */ +import fastify from 'fastify'; +import { getGraphQLParameters, processRequest, renderGraphiQL, shouldRenderGraphiQL } from 'graphql-helix'; +import { envelop, useLogger, useSchema, useTiming } from '@envelop/core'; +import { makeExecutableSchema } from '@graphql-tools/schema'; + +const schema = makeExecutableSchema({ + typeDefs: /* GraphQL */ ` + type Query { + hello: String! + } + `, + resolvers: { + Query: { + hello: () => 'World', + }, + }, +}); + +const getEnveloped = envelop({ + plugins: [useSchema(schema), useLogger(), useTiming()], +}); +const app = fastify(); + +app.route({ + method: ['GET', 'POST'], + url: '/graphql', + async handler(req, res) { + const { parse, validate, contextFactory, execute, schema } = getEnveloped({ req }); + const request = { + body: req.body, + headers: req.headers, + method: req.method, + query: req.query, + }; + + if (shouldRenderGraphiQL(request)) { + res.type('text/html'); + res.send(renderGraphiQL({})); + } else { + const { operationName, query, variables } = getGraphQLParameters(request); + const result = await processRequest({ + operationName, + query, + variables, + request, + schema, + parse, + validate, + execute, + contextFactory, + }); + + if (result.type === 'RESPONSE') { + res.status(result.status); + res.send(result.payload); + } else { + // You can find a complete example with GraphQL Subscriptions and stream/defer here: + // https://github.com/contrawork/graphql-helix/blob/master/examples/fastify/server.ts + res.send({ errors: [{ message: 'Not Supported in this demo' }] }); + } + } + }, +}); + +app.listen(3000, () => { + console.log(`GraphQL server is running in http://127.0.0.1:3000/graphql.`); +}); diff --git a/examples/with-esm/tsconfig.json b/examples/with-esm/tsconfig.json new file mode 100644 index 0000000000..009e993000 --- /dev/null +++ b/examples/with-esm/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "target": "es2019", + "module": "esnext", + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedIndexedAccess": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noEmit": true, + "moduleResolution": "node", + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true + } +} diff --git a/package.json b/package.json index f72db84fd8..fd70844929 100644 --- a/package.json +++ b/package.json @@ -13,14 +13,15 @@ "./examples/lambda-aws", "./examples/azure-functions", "./examples/google-cloud-functions", - "./examples/cloudflare-workers" + "./examples/cloudflare-workers", + "./examples/with-esm" ], "scripts": { "prepare": "husky install", "benchmark": "NODE_ENV=production ts-node --project tsconfig.benchmark.json benchmark/execute.case.ts", "postinstall": "patch-package", "lint": "eslint --config .eslintrc.json --ext .ts .", - "prebuild": "rimraf packages/*/dist", + "prebuild": "rimraf packages/*/dist packages/plugins/*/dist", "build": "tsc --project tsconfig.json && bob build", "test": "jest", "test:ci": "jest --coverage", @@ -48,7 +49,7 @@ "husky": "6.0.0", "lint-staged": "11.0.0", "@types/node": "15.6.1", - "bob-the-bundler": "1.2.1", + "bob-the-bundler": "1.4.1", "eslint-config-standard": "16.0.3", "eslint-plugin-import": "2.23.4", "eslint-plugin-node": "11.1.0", diff --git a/packages/core/package.json b/packages/core/package.json index 59f20d91fd..e862944cf6 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -18,8 +18,18 @@ "nodejs", "typescript" ], - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", + "main": "dist/index.js", + "module": "dist/index.mjs", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs" + }, + "./*": { + "require": "./dist/*.js", + "import": "./dist/*.mjs" + } + }, "typings": "dist/index.d.ts", "typescript": { "definition": "dist/index.d.ts" @@ -34,7 +44,7 @@ "devDependencies": { "@graphql-tools/utils": "7.10.0", "@graphql-tools/schema": "7.1.5", - "bob-the-bundler": "1.2.1", + "bob-the-bundler": "1.4.1", "graphql": "15.5.0", "typescript": "4.3.2" }, diff --git a/packages/plugins/apollo-tracing/package.json b/packages/plugins/apollo-tracing/package.json index 5e75c4e148..d704fab28c 100644 --- a/packages/plugins/apollo-tracing/package.json +++ b/packages/plugins/apollo-tracing/package.json @@ -9,8 +9,18 @@ "directory": "packages/plugins/apollo-tracing" }, "sideEffects": false, - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", + "main": "dist/index.js", + "module": "dist/index.mjs", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs" + }, + "./*": { + "require": "./dist/*.js", + "import": "./dist/*.mjs" + } + }, "typings": "dist/index.d.ts", "typescript": { "definition": "dist/index.d.ts" @@ -24,7 +34,7 @@ }, "devDependencies": { "@graphql-tools/schema": "7.1.5", - "bob-the-bundler": "1.2.1", + "bob-the-bundler": "1.4.1", "graphql": "15.5.0", "typescript": "4.3.2" }, diff --git a/packages/plugins/auth0/package.json b/packages/plugins/auth0/package.json index 75ae20b43b..f9c98b2e3b 100644 --- a/packages/plugins/auth0/package.json +++ b/packages/plugins/auth0/package.json @@ -9,8 +9,18 @@ "url": "https://github.com/dotansimha/envelop.git", "directory": "packages/plugins/auth0" }, - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", + "main": "dist/index.js", + "module": "dist/index.mjs", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs" + }, + "./*": { + "require": "./dist/*.js", + "import": "./dist/*.mjs" + } + }, "typings": "dist/index.d.ts", "typescript": { "definition": "dist/index.d.ts" @@ -25,7 +35,7 @@ }, "devDependencies": { "@types/jsonwebtoken": "8.5.1", - "bob-the-bundler": "1.2.1", + "bob-the-bundler": "1.4.1", "graphql": "15.5.0", "typescript": "4.3.2" }, diff --git a/packages/plugins/dataloader/package.json b/packages/plugins/dataloader/package.json index a40927f112..30edfb89de 100644 --- a/packages/plugins/dataloader/package.json +++ b/packages/plugins/dataloader/package.json @@ -9,8 +9,18 @@ "url": "https://github.com/dotansimha/envelop.git", "directory": "packages/plugins/dataloader" }, - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", + "main": "dist/index.js", + "module": "dist/index.mjs", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs" + }, + "./*": { + "require": "./dist/*.js", + "import": "./dist/*.mjs" + } + }, "typings": "dist/index.d.ts", "typescript": { "definition": "dist/index.d.ts" @@ -23,7 +33,7 @@ "devDependencies": { "dataloader": "2.0.0", "reflect-metadata": "0.1.13", - "bob-the-bundler": "1.2.1", + "bob-the-bundler": "1.4.1", "graphql": "15.5.0", "typescript": "4.3.2" }, diff --git a/packages/plugins/depth-limit/package.json b/packages/plugins/depth-limit/package.json index bc582839bd..9e09ddfbd5 100644 --- a/packages/plugins/depth-limit/package.json +++ b/packages/plugins/depth-limit/package.json @@ -9,8 +9,18 @@ "url": "https://github.com/dotansimha/envelop.git", "directory": "packages/plugins/depth-limit" }, - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", + "main": "dist/index.js", + "module": "dist/index.mjs", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs" + }, + "./*": { + "require": "./dist/*.js", + "import": "./dist/*.mjs" + } + }, "typings": "dist/index.d.ts", "typescript": { "definition": "dist/index.d.ts" @@ -24,7 +34,7 @@ }, "devDependencies": { "@types/graphql-depth-limit": "1.1.2", - "bob-the-bundler": "1.2.1", + "bob-the-bundler": "1.4.1", "graphql": "15.5.0", "typescript": "4.3.2" }, diff --git a/packages/plugins/disable-introspection/package.json b/packages/plugins/disable-introspection/package.json index 68bd56e8a6..ca2bb93b3d 100644 --- a/packages/plugins/disable-introspection/package.json +++ b/packages/plugins/disable-introspection/package.json @@ -9,8 +9,18 @@ "url": "https://github.com/dotansimha/envelop.git", "directory": "packages/plugins/disable-introspection" }, - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", + "main": "dist/index.js", + "module": "dist/index.mjs", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs" + }, + "./*": { + "require": "./dist/*.js", + "import": "./dist/*.mjs" + } + }, "typings": "dist/index.d.ts", "typescript": { "definition": "dist/index.d.ts" @@ -21,7 +31,7 @@ }, "dependencies": {}, "devDependencies": { - "bob-the-bundler": "1.2.1", + "bob-the-bundler": "1.4.1", "graphql": "15.5.0", "typescript": "4.3.2" }, diff --git a/packages/plugins/extended-validation/package.json b/packages/plugins/extended-validation/package.json index f999b9efdc..1098d86041 100644 --- a/packages/plugins/extended-validation/package.json +++ b/packages/plugins/extended-validation/package.json @@ -9,8 +9,18 @@ "url": "https://github.com/dotansimha/envelop.git", "directory": "packages/plugins/extended-validation" }, - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", + "main": "dist/index.js", + "module": "dist/index.mjs", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs" + }, + "./*": { + "require": "./dist/*.js", + "import": "./dist/*.mjs" + } + }, "typings": "dist/index.d.ts", "typescript": { "definition": "dist/index.d.ts" @@ -21,7 +31,7 @@ }, "dependencies": {}, "devDependencies": { - "bob-the-bundler": "1.2.1", + "bob-the-bundler": "1.4.1", "graphql": "15.5.0", "typescript": "4.3.2" }, diff --git a/packages/plugins/filter-operation-type/package.json b/packages/plugins/filter-operation-type/package.json index 2ae86bc4f7..c462d89152 100644 --- a/packages/plugins/filter-operation-type/package.json +++ b/packages/plugins/filter-operation-type/package.json @@ -9,8 +9,18 @@ "url": "https://github.com/dotansimha/envelop.git", "directory": "packages/plugins/filter-operation-type" }, - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", + "main": "dist/index.js", + "module": "dist/index.mjs", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs" + }, + "./*": { + "require": "./dist/*.js", + "import": "./dist/*.mjs" + } + }, "typings": "dist/index.d.ts", "typescript": { "definition": "dist/index.d.ts" @@ -21,7 +31,7 @@ }, "dependencies": {}, "devDependencies": { - "bob-the-bundler": "1.2.1", + "bob-the-bundler": "1.4.1", "graphql": "15.5.0", "typescript": "4.3.2" }, diff --git a/packages/plugins/generic-auth/package.json b/packages/plugins/generic-auth/package.json index 7eafc27e56..82f4267f4f 100644 --- a/packages/plugins/generic-auth/package.json +++ b/packages/plugins/generic-auth/package.json @@ -9,8 +9,18 @@ "url": "https://github.com/dotansimha/envelop.git", "directory": "packages/plugins/generic-auth" }, - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", + "main": "dist/index.js", + "module": "dist/index.mjs", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs" + }, + "./*": { + "require": "./dist/*.js", + "import": "./dist/*.mjs" + } + }, "typings": "dist/index.d.ts", "typescript": { "definition": "dist/index.d.ts" @@ -21,7 +31,7 @@ }, "dependencies": {}, "devDependencies": { - "bob-the-bundler": "1.2.1", + "bob-the-bundler": "1.4.1", "graphql": "15.5.0", "typescript": "4.3.2" }, diff --git a/packages/plugins/graphql-jit/package.json b/packages/plugins/graphql-jit/package.json index 33a2c1d2c2..ce8d92b371 100644 --- a/packages/plugins/graphql-jit/package.json +++ b/packages/plugins/graphql-jit/package.json @@ -9,8 +9,18 @@ "url": "https://github.com/dotansimha/envelop.git", "directory": "packages/plugins/graphql-jit" }, - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", + "main": "dist/index.js", + "module": "dist/index.mjs", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs" + }, + "./*": { + "require": "./dist/*.js", + "import": "./dist/*.mjs" + } + }, "typings": "dist/index.d.ts", "typescript": { "definition": "dist/index.d.ts" @@ -26,7 +36,7 @@ "devDependencies": { "graphql-jit": "0.5.1", "reflect-metadata": "0.1.13", - "bob-the-bundler": "1.2.1", + "bob-the-bundler": "1.4.1", "graphql": "15.5.0", "typescript": "4.3.2" }, diff --git a/packages/plugins/graphql-middleware/package.json b/packages/plugins/graphql-middleware/package.json index 1243c51d1f..47afcb6484 100644 --- a/packages/plugins/graphql-middleware/package.json +++ b/packages/plugins/graphql-middleware/package.json @@ -9,8 +9,18 @@ "url": "https://github.com/dotansimha/envelop.git", "directory": "packages/plugins/graphql-middleware" }, - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", + "main": "dist/index.js", + "module": "dist/index.mjs", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs" + }, + "./*": { + "require": "./dist/*.js", + "import": "./dist/*.mjs" + } + }, "typings": "dist/index.d.ts", "typescript": { "definition": "dist/index.d.ts" @@ -22,7 +32,7 @@ "dependencies": {}, "devDependencies": { "graphql-middleware": "6.0.10", - "bob-the-bundler": "1.2.1", + "bob-the-bundler": "1.4.1", "graphql": "15.5.0", "typescript": "4.3.2" }, diff --git a/packages/plugins/graphql-modules/package.json b/packages/plugins/graphql-modules/package.json index 6364b04336..9c0a51069a 100644 --- a/packages/plugins/graphql-modules/package.json +++ b/packages/plugins/graphql-modules/package.json @@ -9,8 +9,18 @@ "url": "https://github.com/dotansimha/envelop.git", "directory": "packages/plugins/graphql-modules" }, - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", + "main": "dist/index.js", + "module": "dist/index.mjs", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs" + }, + "./*": { + "require": "./dist/*.js", + "import": "./dist/*.mjs" + } + }, "typings": "dist/index.d.ts", "typescript": { "definition": "dist/index.d.ts" @@ -23,7 +33,7 @@ "devDependencies": { "reflect-metadata": "0.1.13", "graphql-modules": "1.4.2", - "bob-the-bundler": "1.2.1", + "bob-the-bundler": "1.4.1", "graphql": "15.5.0", "typescript": "4.3.2" }, diff --git a/packages/plugins/opentelemetry/package.json b/packages/plugins/opentelemetry/package.json index 8d23d9b036..26b805249d 100644 --- a/packages/plugins/opentelemetry/package.json +++ b/packages/plugins/opentelemetry/package.json @@ -9,8 +9,18 @@ "url": "https://github.com/dotansimha/envelop.git", "directory": "packages/plugins/opentelemetry" }, - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", + "main": "dist/index.js", + "module": "dist/index.mjs", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs" + }, + "./*": { + "require": "./dist/*.js", + "import": "./dist/*.mjs" + } + }, "typings": "dist/index.d.ts", "typescript": { "definition": "dist/index.d.ts" @@ -24,7 +34,7 @@ "@opentelemetry/tracing": "^0.20.0" }, "devDependencies": { - "bob-the-bundler": "1.2.1", + "bob-the-bundler": "1.4.1", "graphql": "15.5.0", "typescript": "4.3.2" }, diff --git a/packages/plugins/parser-cache/package.json b/packages/plugins/parser-cache/package.json index e202f451de..fca716bda7 100644 --- a/packages/plugins/parser-cache/package.json +++ b/packages/plugins/parser-cache/package.json @@ -9,8 +9,18 @@ "url": "https://github.com/dotansimha/envelop.git", "directory": "packages/plugins/parser-cache" }, - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", + "main": "dist/index.js", + "module": "dist/index.mjs", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs" + }, + "./*": { + "require": "./dist/*.js", + "import": "./dist/*.mjs" + } + }, "typings": "dist/index.d.ts", "typescript": { "definition": "dist/index.d.ts" @@ -23,7 +33,7 @@ "tiny-lru": "7.0.6" }, "devDependencies": { - "bob-the-bundler": "1.2.1", + "bob-the-bundler": "1.4.1", "graphql": "15.5.0", "typescript": "4.3.2" }, diff --git a/packages/plugins/persisted-operations/package.json b/packages/plugins/persisted-operations/package.json index d962b5ec11..801c1803a4 100644 --- a/packages/plugins/persisted-operations/package.json +++ b/packages/plugins/persisted-operations/package.json @@ -9,8 +9,18 @@ "directory": "packages/plugins/persisted-operations" }, "sideEffects": false, - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", + "main": "dist/index.js", + "module": "dist/index.mjs", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs" + }, + "./*": { + "require": "./dist/*.js", + "import": "./dist/*.mjs" + } + }, "typings": "dist/index.d.ts", "typescript": { "definition": "dist/index.d.ts" @@ -21,7 +31,7 @@ }, "devDependencies": { "@graphql-tools/schema": "7.1.5", - "bob-the-bundler": "1.2.1", + "bob-the-bundler": "1.4.1", "graphql": "15.5.0", "typescript": "4.3.2" }, diff --git a/packages/plugins/preload-assets/package.json b/packages/plugins/preload-assets/package.json index eaa9dc31b8..99313d34c0 100644 --- a/packages/plugins/preload-assets/package.json +++ b/packages/plugins/preload-assets/package.json @@ -9,8 +9,18 @@ "url": "https://github.com/dotansimha/envelop.git", "directory": "packages/plugins/preload-assets" }, - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", + "main": "dist/index.js", + "module": "dist/index.mjs", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs" + }, + "./*": { + "require": "./dist/*.js", + "import": "./dist/*.mjs" + } + }, "typings": "dist/index.d.ts", "typescript": { "definition": "dist/index.d.ts" @@ -21,7 +31,7 @@ }, "dependencies": {}, "devDependencies": { - "bob-the-bundler": "1.2.1", + "bob-the-bundler": "1.4.1", "graphql": "15.5.0", "typescript": "4.3.2" }, diff --git a/packages/plugins/rate-limiter/package.json b/packages/plugins/rate-limiter/package.json index f6b2071518..5f29f8ed44 100644 --- a/packages/plugins/rate-limiter/package.json +++ b/packages/plugins/rate-limiter/package.json @@ -9,8 +9,18 @@ "url": "https://github.com/dotansimha/envelop.git", "directory": "packages/plugins/rate-limiter" }, - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", + "main": "dist/index.js", + "module": "dist/index.mjs", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs" + }, + "./*": { + "require": "./dist/*.js", + "import": "./dist/*.mjs" + } + }, "typings": "dist/index.d.ts", "typescript": { "definition": "dist/index.d.ts" @@ -23,7 +33,7 @@ "graphql-rate-limit": "3.1.0" }, "devDependencies": { - "bob-the-bundler": "1.2.1", + "bob-the-bundler": "1.4.1", "graphql": "15.5.0", "typescript": "4.3.2" }, diff --git a/packages/plugins/sentry/package.json b/packages/plugins/sentry/package.json index 5cfb6969cb..5cf29f7253 100644 --- a/packages/plugins/sentry/package.json +++ b/packages/plugins/sentry/package.json @@ -9,8 +9,18 @@ "url": "https://github.com/dotansimha/envelop.git", "directory": "packages/plugins/sentry" }, - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", + "main": "dist/index.js", + "module": "dist/index.mjs", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs" + }, + "./*": { + "require": "./dist/*.js", + "import": "./dist/*.mjs" + } + }, "typings": "dist/index.d.ts", "typescript": { "definition": "dist/index.d.ts" @@ -23,7 +33,7 @@ "devDependencies": { "@sentry/node": "6.7.0", "@sentry/tracing": "6.7.0", - "bob-the-bundler": "1.2.1", + "bob-the-bundler": "1.4.1", "graphql": "15.5.0", "typescript": "4.3.2" }, diff --git a/packages/plugins/validation-cache/package.json b/packages/plugins/validation-cache/package.json index 6a776001d6..55b423e399 100644 --- a/packages/plugins/validation-cache/package.json +++ b/packages/plugins/validation-cache/package.json @@ -9,8 +9,18 @@ "url": "https://github.com/dotansimha/envelop.git", "directory": "packages/plugins/validation-cache" }, - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", + "main": "dist/index.js", + "module": "dist/index.mjs", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs" + }, + "./*": { + "require": "./dist/*.js", + "import": "./dist/*.mjs" + } + }, "typings": "dist/index.d.ts", "typescript": { "definition": "dist/index.d.ts" @@ -23,7 +33,7 @@ "tiny-lru": "7.0.6" }, "devDependencies": { - "bob-the-bundler": "1.2.1", + "bob-the-bundler": "1.4.1", "graphql": "15.5.0", "typescript": "4.3.2" }, diff --git a/packages/testing/package.json b/packages/testing/package.json index 04a546114a..c1e67778be 100644 --- a/packages/testing/package.json +++ b/packages/testing/package.json @@ -5,8 +5,18 @@ "author": "Dotan Simha ", "license": "MIT", "sideEffects": false, - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", + "main": "dist/index.js", + "module": "dist/index.mjs", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs" + }, + "./*": { + "require": "./dist/*.js", + "import": "./dist/*.mjs" + } + }, "typings": "dist/index.d.ts", "typescript": { "definition": "dist/index.d.ts" diff --git a/packages/types/package.json b/packages/types/package.json index 102d66d970..ef7ad5670f 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -9,8 +9,18 @@ "directory": "packages/types" }, "sideEffects": false, - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", + "main": "dist/index.js", + "module": "dist/index.mjs", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs" + }, + "./*": { + "require": "./dist/*.js", + "import": "./dist/*.mjs" + } + }, "typings": "dist/index.d.ts", "typescript": { "definition": "dist/index.d.ts" @@ -21,7 +31,7 @@ }, "dependencies": {}, "devDependencies": { - "bob-the-bundler": "1.2.1", + "bob-the-bundler": "1.4.1", "graphql": "15.5.0", "typescript": "4.3.2" }, diff --git a/yarn.lock b/yarn.lock index 1d241c8388..0bdc65f087 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2808,6 +2808,11 @@ "@typescript-eslint/types" "4.27.0" eslint-visitor-keys "^2.0.0" +"@vercel/ncc@0.28.3": + version "0.28.3" + resolved "https://registry.yarnpkg.com/@vercel/ncc/-/ncc-0.28.3.tgz#9461bdbf334d616759b0e7e5415e2f480b9aa30f" + integrity sha512-g3gk4D9itbhUQa5MtN7TOdeoQnNLkPDCox5SBaQ/H3Or5lo59TOaZWrLb+x47StiAJ+8DXZS/9MJ67cIBWSsRw== + "@wry/equality@^0.1.2": version "0.1.11" resolved "https://registry.npmjs.org/@wry/equality/-/equality-0.1.11.tgz#35cb156e4a96695aa81a9ecc4d03787bc17f1790" @@ -3527,12 +3532,13 @@ bn.js@^5.0.0, bn.js@^5.1.1: resolved "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz#358860674396c6997771a9d051fcc1b57d4ae002" integrity sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw== -bob-the-bundler@1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/bob-the-bundler/-/bob-the-bundler-1.2.1.tgz#ed759de2ac59f5bda71cb625d17f1cd787984e4e" - integrity sha512-mrmiqX10ghyMB6v4T/VXjmhQie8xrqoOCWZ0b3N8JmTqnzYpOZbSw9UaAygxGzg4V2hjwTz0Wl7H1GlXQnawVA== +bob-the-bundler@1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/bob-the-bundler/-/bob-the-bundler-1.4.1.tgz#794382f60f0d2a68c57d85a41d06caf4a45cb1b4" + integrity sha512-Ho7JLV8ePKjWgV1USjoZK7w0rJ64RXv8WTBjP/J+l3wILem+TekcBPjKvpYvAqmWBZIliaKVyZhGHgTOaqjabw== dependencies: "@rollup/plugin-node-resolve" "7.1.1" + "@vercel/ncc" "0.28.3" builtins "4.0.0" consola "2.11.3" cosmiconfig "6.0.0"