From fea14993ae469aaf5153d97f213aa694e9045990 Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Mon, 9 May 2022 17:48:32 +0300 Subject: [PATCH] Fully switch to ESM (scripts, tests, etc.) --- .eslintrc.yml | 7 +- .mocharc.yml | 6 +- integrationTests/integration-test.ts | 10 +-- integrationTests/webpack/test.js | 1 - package.json | 1 + resources/add-extension-to-import-paths.ts | 68 ---------------- resources/benchmark.ts | 37 ++++----- resources/build-deno.ts | 77 ++++++++++++++++-- resources/build-npm.ts | 19 +++-- resources/diff-npm-package.ts | 25 +++--- resources/gen-changelog.ts | 6 +- resources/gen-version.ts | 2 +- resources/inline-invariant.ts | 2 +- resources/utils.ts | 23 +++--- src/__testUtils__/__tests__/dedent-test.ts | 2 +- .../__tests__/genFuzzStrings-test.ts | 2 +- .../__tests__/inspectStr-test.ts | 2 +- .../__tests__/resolveOnNextTick-test.ts | 2 +- src/__testUtils__/expectJSON.ts | 4 +- src/__testUtils__/inspectStr.ts | 2 +- src/__tests__/starWarsIntrospection-test.ts | 4 +- src/__tests__/starWarsQuery-test.ts | 6 +- src/__tests__/starWarsSchema.ts | 8 +- src/__tests__/starWarsValidation-test.ts | 8 +- src/__tests__/version-test.ts | 2 +- src/error/GraphQLError.ts | 19 +++-- src/error/__tests__/GraphQLError-test.ts | 10 +-- src/error/__tests__/locatedError-test.ts | 4 +- src/error/index.ts | 8 +- src/error/locatedError.ts | 8 +- src/error/syntaxError.ts | 4 +- src/execution/__tests__/abstract-test.ts | 14 ++-- src/execution/__tests__/directives-test.ts | 10 +-- src/execution/__tests__/executor-test.ts | 20 +++-- src/execution/__tests__/lists-test.ts | 8 +- .../__tests__/mapAsyncIterator-test.ts | 2 +- src/execution/__tests__/mutations-test.ts | 14 ++-- src/execution/__tests__/nonnull-test.ts | 16 ++-- src/execution/__tests__/resolve-test.ts | 12 +-- src/execution/__tests__/schema-test.ts | 10 +-- src/execution/__tests__/simplePubSub-test.ts | 2 +- src/execution/__tests__/subscribe-test.ts | 22 ++--- src/execution/__tests__/sync-test.ts | 16 ++-- .../__tests__/union-interface-test.ts | 10 +-- src/execution/__tests__/variables-test.ts | 20 ++--- src/execution/collectFields.ts | 20 ++--- src/execution/execute.ts | 54 ++++++------- src/execution/index.ts | 10 +-- src/execution/mapAsyncIterator.ts | 2 +- src/execution/subscribe.ts | 28 +++---- src/execution/values.ts | 36 ++++----- src/graphql.ts | 22 ++--- src/index.ts | 30 +++---- src/jsutils/Path.ts | 2 +- src/jsutils/__tests__/AccumulatorMap-test.ts | 2 +- src/jsutils/__tests__/Path-test.ts | 2 +- src/jsutils/__tests__/capitalize-test.ts | 2 +- src/jsutils/__tests__/didYouMean-test.ts | 2 +- src/jsutils/__tests__/identityFunc-test.ts | 2 +- src/jsutils/__tests__/inspect-test.ts | 2 +- src/jsutils/__tests__/instanceOf-test.ts | 2 +- src/jsutils/__tests__/invariant-test.ts | 2 +- src/jsutils/__tests__/isAsyncIterable-test.ts | 4 +- .../__tests__/isIterableObject-test.ts | 4 +- src/jsutils/__tests__/isObjectLike-test.ts | 4 +- src/jsutils/__tests__/naturalCompare-test.ts | 2 +- src/jsutils/__tests__/suggestionList-test.ts | 2 +- src/jsutils/__tests__/toObjMap-test.ts | 4 +- src/jsutils/didYouMean.ts | 2 +- src/jsutils/formatList.ts | 2 +- src/jsutils/groupBy.ts | 2 +- src/jsutils/instanceOf.ts | 2 +- src/jsutils/keyMap.ts | 2 +- src/jsutils/keyValMap.ts | 2 +- src/jsutils/mapValue.ts | 2 +- src/jsutils/promiseForObject.ts | 2 +- src/jsutils/promiseReduce.ts | 4 +- src/jsutils/suggestionList.ts | 2 +- src/jsutils/toError.ts | 2 +- src/jsutils/toObjMap.ts | 4 +- src/language/__tests__/blockString-fuzz.ts | 12 +-- src/language/__tests__/blockString-test.ts | 2 +- src/language/__tests__/lexer-test.ts | 16 ++-- src/language/__tests__/parser-test.ts | 23 +++--- src/language/__tests__/predicates-test.ts | 8 +- src/language/__tests__/printLocation-test.ts | 6 +- src/language/__tests__/printString-test.ts | 2 +- src/language/__tests__/printer-test.ts | 10 +-- src/language/__tests__/schema-parser-test.ts | 13 +-- src/language/__tests__/schema-printer-test.ts | 10 +-- src/language/__tests__/source-test.ts | 2 +- src/language/__tests__/visitor-test.ts | 16 ++-- src/language/ast.ts | 6 +- src/language/blockString.ts | 2 +- src/language/index.ts | 37 +++++---- src/language/lexer.ts | 12 +-- src/language/location.ts | 4 +- src/language/parser.ts | 20 ++--- src/language/predicates.ts | 4 +- src/language/printLocation.ts | 8 +- src/language/printer.ts | 12 +-- src/language/source.ts | 6 +- src/language/visitor.ts | 10 +-- src/type/__tests__/assertName-test.ts | 2 +- src/type/__tests__/definition-test.ts | 10 +-- src/type/__tests__/directive-test.ts | 6 +- src/type/__tests__/enumType-test.ts | 12 +-- src/type/__tests__/extensions-test.ts | 6 +- src/type/__tests__/introspection-test.ts | 10 +-- src/type/__tests__/predicate-test.ts | 10 +-- src/type/__tests__/scalars-test.ts | 4 +- src/type/__tests__/schema-test.ts | 18 ++--- src/type/__tests__/validation-test.ts | 26 +++--- src/type/assertName.ts | 6 +- src/type/definition.ts | 46 +++++------ src/type/directives.ts | 24 +++--- src/type/index.ts | 22 ++--- src/type/introspection.ts | 20 ++--- src/type/scalars.ts | 14 ++-- src/type/schema.ts | 30 +++---- src/type/validate.ts | 30 +++---- src/utilities/TypeInfo.ts | 22 ++--- src/utilities/__tests__/TypeInfo-test.ts | 14 ++-- src/utilities/__tests__/astFromValue-test.ts | 6 +- .../__tests__/buildASTSchema-test.ts | 30 +++---- .../__tests__/buildClientSchema-test.ts | 18 ++--- .../__tests__/coerceInputValue-test.ts | 8 +- src/utilities/__tests__/concatAST-test.ts | 10 +-- src/utilities/__tests__/extendSchema-test.ts | 30 +++---- .../__tests__/findBreakingChanges-test.ts | 8 +- .../__tests__/getIntrospectionQuery-test.ts | 10 +-- .../__tests__/getOperationAST-test.ts | 4 +- .../__tests__/introspectionFromSchema-test.ts | 16 ++-- .../__tests__/lexicographicSortSchema-test.ts | 8 +- src/utilities/__tests__/printSchema-test.ts | 24 +++--- .../__tests__/separateOperations-test.ts | 10 +-- src/utilities/__tests__/sortValueNode-test.ts | 6 +- .../__tests__/stripIgnoredCharacters-fuzz.ts | 12 +-- .../__tests__/stripIgnoredCharacters-test.ts | 16 ++-- .../__tests__/typeComparators-test.ts | 10 +-- src/utilities/__tests__/valueFromAST-test.ts | 14 ++-- .../__tests__/valueFromASTUntyped-test.ts | 8 +- src/utilities/astFromValue.ts | 20 ++--- src/utilities/buildASTSchema.ts | 22 ++--- src/utilities/buildClientSchema.ts | 28 +++---- src/utilities/coerceInputValue.ts | 28 +++---- src/utilities/concatAST.ts | 4 +- src/utilities/extendSchema.ts | 44 +++++----- src/utilities/findBreakingChanges.ts | 20 ++--- src/utilities/getIntrospectionQuery.ts | 4 +- src/utilities/getOperationAST.ts | 6 +- src/utilities/index.ts | 46 +++++------ src/utilities/introspectionFromSchema.ts | 12 +-- src/utilities/lexicographicSortSchema.ts | 22 ++--- src/utilities/printSchema.ts | 28 +++---- src/utilities/separateOperations.ts | 8 +- src/utilities/sortValueNode.ts | 6 +- src/utilities/stripIgnoredCharacters.ts | 8 +- src/utilities/typeComparators.ts | 6 +- src/utilities/typeFromAST.ts | 10 +-- src/utilities/typedQueryDocumentNode.ts | 5 +- src/utilities/valueFromAST.ts | 18 ++--- src/utilities/valueFromASTUntyped.ts | 10 +-- src/validation/ValidationContext.ts | 22 ++--- .../ExecutableDefinitionsRule-test.ts | 4 +- .../__tests__/FieldsOnCorrectTypeRule-test.ts | 12 +-- .../FragmentsOnCompositeTypesRule-test.ts | 4 +- .../__tests__/KnownArgumentNamesRule-test.ts | 11 ++- .../__tests__/KnownDirectivesRule-test.ts | 8 +- .../__tests__/KnownFragmentNamesRule-test.ts | 4 +- .../__tests__/KnownTypeNamesRule-test.ts | 8 +- .../LoneAnonymousOperationRule-test.ts | 4 +- .../LoneSchemaDefinitionRule-test.ts | 8 +- .../__tests__/NoDeprecatedCustomRule-test.ts | 6 +- .../__tests__/NoFragmentCyclesRule-test.ts | 4 +- .../NoSchemaIntrospectionCustomRule-test.ts | 6 +- .../NoUndefinedVariablesRule-test.ts | 4 +- .../__tests__/NoUnusedFragmentsRule-test.ts | 4 +- .../__tests__/NoUnusedVariablesRule-test.ts | 4 +- .../OverlappingFieldsCanBeMergedRule-test.ts | 8 +- .../PossibleFragmentSpreadsRule-test.ts | 6 +- .../PossibleTypeExtensionsRule-test.ts | 8 +- .../ProvidedRequiredArgumentsRule-test.ts | 11 ++- .../__tests__/ScalarLeafsRule-test.ts | 4 +- .../SingleFieldSubscriptionsRule-test.ts | 6 +- .../UniqueArgumentDefinitionNamesRule-test.ts | 4 +- .../__tests__/UniqueArgumentNamesRule-test.ts | 4 +- .../UniqueDirectiveNamesRule-test.ts | 8 +- .../UniqueDirectivesPerLocationRule-test.ts | 10 +-- .../UniqueEnumValueNamesRule-test.ts | 8 +- .../UniqueFieldDefinitionNamesRule-test.ts | 8 +- .../__tests__/UniqueFragmentNamesRule-test.ts | 4 +- .../UniqueInputFieldNamesRule-test.ts | 4 +- .../UniqueOperationNamesRule-test.ts | 4 +- .../UniqueOperationTypesRule-test.ts | 8 +- .../__tests__/UniqueTypeNamesRule-test.ts | 8 +- .../__tests__/UniqueVariableNamesRule-test.ts | 4 +- .../__tests__/ValidationContext-test.ts | 10 +-- .../__tests__/ValuesOfCorrectTypeRule-test.ts | 18 ++--- .../VariablesAreInputTypesRule-test.ts | 4 +- .../VariablesInAllowedPositionRule-test.ts | 4 +- src/validation/__tests__/harness.ts | 17 ++-- src/validation/__tests__/validation-test.ts | 18 ++--- src/validation/index.ts | 80 +++++++++---------- .../rules/ExecutableDefinitionsRule.ts | 10 +-- .../rules/FieldsOnCorrectTypeRule.ts | 20 ++--- .../rules/FragmentsOnCompositeTypesRule.ts | 12 +-- .../rules/KnownArgumentNamesRule.ts | 14 ++-- src/validation/rules/KnownDirectivesRule.ts | 20 ++--- .../rules/KnownFragmentNamesRule.ts | 6 +- src/validation/rules/KnownTypeNamesRule.ts | 18 ++--- .../rules/LoneAnonymousOperationRule.ts | 8 +- .../rules/LoneSchemaDefinitionRule.ts | 6 +- src/validation/rules/NoFragmentCyclesRule.ts | 10 +-- .../rules/NoUndefinedVariablesRule.ts | 6 +- src/validation/rules/NoUnusedFragmentsRule.ts | 8 +- src/validation/rules/NoUnusedVariablesRule.ts | 8 +- .../rules/OverlappingFieldsCanBeMergedRule.ts | 26 +++--- .../rules/PossibleFragmentSpreadsRule.ts | 18 ++--- .../rules/PossibleTypeExtensionsRule.ts | 26 +++--- .../rules/ProvidedRequiredArgumentsRule.ts | 24 +++--- src/validation/rules/ScalarLeafsRule.ts | 12 +-- .../rules/SingleFieldSubscriptionsRule.ts | 14 ++-- .../UniqueArgumentDefinitionNamesRule.ts | 10 +-- .../rules/UniqueArgumentNamesRule.ts | 10 +-- .../rules/UniqueDirectiveNamesRule.ts | 6 +- .../rules/UniqueDirectivesPerLocationRule.ts | 12 +-- .../rules/UniqueEnumValueNamesRule.ts | 10 +-- .../rules/UniqueFieldDefinitionNamesRule.ts | 12 +-- .../rules/UniqueFragmentNamesRule.ts | 6 +- .../rules/UniqueInputFieldNamesRule.ts | 12 +-- .../rules/UniqueOperationNamesRule.ts | 6 +- .../rules/UniqueOperationTypesRule.ts | 8 +- src/validation/rules/UniqueTypeNamesRule.ts | 8 +- .../rules/UniqueVariableNamesRule.ts | 8 +- .../rules/ValuesOfCorrectTypeRule.ts | 20 ++--- .../rules/VariablesAreInputTypesRule.ts | 14 ++-- .../rules/VariablesInAllowedPositionRule.ts | 24 +++--- .../rules/custom/NoDeprecatedCustomRule.ts | 10 +-- .../custom/NoSchemaIntrospectionCustomRule.ts | 12 +-- src/validation/specifiedRules.ts | 70 ++++++++-------- src/validation/validate.ts | 25 +++--- tsconfig.json | 8 +- ...saurus.config.js => docusaurus.config.cjs} | 2 +- website/{sidebars.js => sidebars.cjs} | 0 245 files changed, 1492 insertions(+), 1447 deletions(-) delete mode 100644 resources/add-extension-to-import-paths.ts rename website/{docusaurus.config.js => docusaurus.config.cjs} (98%) rename website/{sidebars.js => sidebars.cjs} (100%) diff --git a/.eslintrc.yml b/.eslintrc.yml index 5550c5a53d..091f23d5aa 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -38,7 +38,7 @@ rules: node/no-exports-assign: error node/no-extraneous-import: error node/no-extraneous-require: error - node/no-missing-import: [error, { allowModules: ['graphql'] }] + node/no-missing-import: off # Blocked by https://github.com/mysticatea/eslint-plugin-node/issues/248 node/no-missing-require: error node/no-new-require: error node/no-path-concat: error @@ -84,7 +84,7 @@ rules: # Static analysis # https://github.com/benmosher/eslint-plugin-import#static-analysis - import/no-unresolved: [error, { ignore: ['graphql'] }] + import/no-unresolved: off # blocked by https://github.com/import-js/eslint-plugin-import/issues/2170 import/named: error import/default: error import/namespace: error @@ -130,7 +130,6 @@ rules: import/extensions: - error - ignorePackages - - ts: never # TODO: remove once TS supports extensions import/order: [error, { newlines-between: always-and-inside-groups }] import/newline-after-import: error import/prefer-default-export: off @@ -696,6 +695,7 @@ overrides: rules: node/no-sync: off import/no-unresolved: off + import/no-namespace: off import/no-nodejs-modules: off - files: 'resources/**' env: @@ -734,7 +734,6 @@ overrides: version: detect rules: node/no-unpublished-require: off - node/no-missing-import: off import/no-default-export: off import/no-commonjs: off import/no-nodejs-modules: off diff --git a/.mocharc.yml b/.mocharc.yml index 674de6b057..923173c1c4 100644 --- a/.mocharc.yml +++ b/.mocharc.yml @@ -1,7 +1,7 @@ fail-zero: true throw-deprecation: true check-leaks: true -require: - - 'ts-node/register/transpile-only' extension: - - 'ts' + - ts +node-option: + - 'loader=ts-node/esm/transpile-only' diff --git a/integrationTests/integration-test.ts b/integrationTests/integration-test.ts index 95e20a3bc7..9dbde01096 100644 --- a/integrationTests/integration-test.ts +++ b/integrationTests/integration-test.ts @@ -1,7 +1,7 @@ -import * as childProcess from 'node:child_process'; -import * as fs from 'node:fs'; -import * as os from 'node:os'; -import * as path from 'node:path'; +import childProcess from 'node:child_process'; +import fs from 'node:fs'; +import os from 'node:os'; +import path from 'node:path'; import { describe, it } from 'mocha'; @@ -26,7 +26,7 @@ describe('Integration Tests', () => { ); function testOnNodeProject(projectName: string) { - const projectPath = path.join(__dirname, projectName); + const projectPath = new URL(projectName, import.meta.url).pathname; const packageJSONPath = path.join(projectPath, 'package.json'); const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath, 'utf-8')); diff --git a/integrationTests/webpack/test.js b/integrationTests/webpack/test.js index b3b19410cf..848971d7b1 100644 --- a/integrationTests/webpack/test.js +++ b/integrationTests/webpack/test.js @@ -1,6 +1,5 @@ import assert from 'assert'; -// eslint-disable-next-line import/no-unresolved, node/no-missing-import import mainCJS from './dist/main.cjs'; assert.deepStrictEqual(mainCJS.result, { diff --git a/package.json b/package.json index f8c47a1535..ca01138c85 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "description": "A Query Language and Runtime which can target any service.", "license": "MIT", "private": true, + "type": "module", "typesVersions": { ">=4.4.0": { "*": [ diff --git a/resources/add-extension-to-import-paths.ts b/resources/add-extension-to-import-paths.ts deleted file mode 100644 index cb9150edc7..0000000000 --- a/resources/add-extension-to-import-paths.ts +++ /dev/null @@ -1,68 +0,0 @@ -import * as assert from 'node:assert'; -import * as util from 'node:util'; - -import * as ts from 'typescript'; - -/** - * Adds extension to all paths imported inside MJS files - * - * Transforms: - * - * ``` - * import { foo } from './bar'; - * export { foo } from './bar'; - * ``` - * - * to: - * - * ``` - * import { foo } from './bar.mjs'; - * export { foo } from './bar.mjs'; - * ``` - * - */ -export function addExtensionToImportPaths(config: { extension: string }) { - const { extension } = config; - return (context: ts.TransformationContext) => { - const { factory } = context; - - return visitSourceFile; - - function visitSourceFile(sourceFile: ts.SourceFile) { - return ts.visitNode(sourceFile, visitNode); - } - - function visitNode(node: ts.Node): ts.Node { - const source: string | undefined = (node as any).moduleSpecifier?.text; - if (source?.startsWith('./') || source?.startsWith('../')) { - if (ts.isImportDeclaration(node)) { - return factory.updateImportDeclaration( - node, - node.decorators, - node.modifiers, - node.importClause, - ts.createStringLiteral(source + extension), - node.assertClause, - ); - } - if (ts.isExportDeclaration(node)) { - return factory.updateExportDeclaration( - node, - node.decorators, - node.modifiers, - node.isTypeOnly, - node.exportClause, - ts.createStringLiteral(source + extension), - node.assertClause, - ); - } - - assert( - false, - 'Unexpected node with moduleSpecifier: ' + util.inspect(node), - ); - } - return ts.visitEachChild(node, visitNode, context); - } - }; -} diff --git a/resources/benchmark.ts b/resources/benchmark.ts index b40cf55fb6..7d5f301707 100644 --- a/resources/benchmark.ts +++ b/resources/benchmark.ts @@ -1,8 +1,10 @@ -import * as assert from 'node:assert'; -import * as cp from 'node:child_process'; -import * as fs from 'node:fs'; -import * as os from 'node:os'; -import * as path from 'node:path'; +import assert from 'node:assert'; +import cp from 'node:child_process'; +import fs from 'node:fs'; +import os from 'node:os'; +import path from 'node:path'; + +import { exec, execOutput, localRepoPath } from './utils.js'; const NS_PER_SEC = 1e9; const LOCAL = 'local'; @@ -22,19 +24,6 @@ function runBenchmarks() { } } -function localDir(...paths: ReadonlyArray) { - return path.join(__dirname, '..', ...paths); -} - -function exec(command: string, options = {}) { - const result = cp.execSync(command, { - encoding: 'utf-8', - stdio: ['inherit', 'pipe', 'inherit'], - ...options, - }); - return result?.trimEnd(); -} - interface BenchmarkProject { revision: string; projectPath: string; @@ -58,7 +47,7 @@ function prepareBenchmarkProjects( fs.rmSync(projectPath, { recursive: true, force: true }); fs.mkdirSync(projectPath); - fs.cpSync(localDir('benchmark'), path.join(projectPath, 'benchmark'), { + fs.cpSync(localRepoPath('benchmark'), path.join(projectPath, 'benchmark'), { recursive: true, }); @@ -80,14 +69,14 @@ function prepareBenchmarkProjects( function prepareNPMPackage(revision: string) { if (revision === LOCAL) { - const repoDir = localDir(); + const repoDir = localRepoPath(); const archivePath = path.join(tmpDir, 'graphql-local.tgz'); fs.renameSync(buildNPMArchive(repoDir), archivePath); return archivePath; } // Returns the complete git hash for a given git revision reference. - const hash = exec(`git rev-parse "${revision}"`); + const hash = execOutput(`git rev-parse "${revision}"`); const archivePath = path.join(tmpDir, `graphql-${hash}.tgz`); if (fs.existsSync(archivePath)) { @@ -108,7 +97,9 @@ function prepareBenchmarkProjects( exec('npm --quiet run build:npm', { cwd: repoDir }); const distDir = path.join(repoDir, 'npmDist'); - const archiveName = exec(`npm --quiet pack ${distDir}`, { cwd: repoDir }); + const archiveName = execOutput(`npm --quiet pack ${distDir}`, { + cwd: repoDir, + }); return path.join(repoDir, archiveName); } } @@ -334,7 +325,7 @@ function getArguments(argv: ReadonlyArray) { function findAllBenchmarks() { return fs - .readdirSync(localDir('benchmark'), { withFileTypes: true }) + .readdirSync(localRepoPath('benchmark'), { withFileTypes: true }) .filter((dirent) => dirent.isFile()) .map((dirent) => dirent.name) .filter((name) => name.endsWith('-benchmark.js')) diff --git a/resources/build-deno.ts b/resources/build-deno.ts index c0b3e895c4..886463da68 100644 --- a/resources/build-deno.ts +++ b/resources/build-deno.ts @@ -1,11 +1,12 @@ -import * as fs from 'node:fs'; -import * as path from 'node:path'; +import assert from 'node:assert'; +import fs from 'node:fs'; +import path from 'node:path'; +import util from 'node:util'; -import * as ts from 'typescript'; +import ts from 'typescript'; -import { addExtensionToImportPaths } from './add-extension-to-import-paths'; -import { inlineInvariant } from './inline-invariant'; -import { readdirRecursive, showDirStats, writeGeneratedFile } from './utils'; +import { inlineInvariant } from './inline-invariant.js'; +import { readdirRecursive, showDirStats, writeGeneratedFile } from './utils.js'; fs.rmSync('./denoDist', { recursive: true, force: true }); fs.mkdirSync('./denoDist'); @@ -22,8 +23,8 @@ for (const filepath of srcFiles) { ); const transformed = ts.transform(sourceFile, [ - addExtensionToImportPaths({ extension: '.ts' }), inlineInvariant, + addExtensionToImportPaths, ]); const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed }); const newContent = printer.printBundle( @@ -42,3 +43,65 @@ fs.copyFileSync('./LICENSE', './denoDist/LICENSE'); fs.copyFileSync('./README.md', './denoDist/README.md'); showDirStats('./denoDist'); + +/** + * Adds extension to all paths imported inside MJS files + * + * Transforms: + * + * ``` + * import { foo } from './bar.js'; + * export { foo } from './bar.js'; + * ``` + * + * to: + * + * ``` + * import { foo } from './bar.ts'; + * export { foo } from './bar.ts'; + * ``` + * + */ +export function addExtensionToImportPaths(context: ts.TransformationContext) { + const { factory } = context; + + return visitSourceFile; + + function visitSourceFile(sourceFile: ts.SourceFile) { + return ts.visitNode(sourceFile, visitNode); + } + + function visitNode(node: ts.Node): ts.Node { + const source: string | undefined = (node as any).moduleSpecifier?.text; + if (source?.startsWith('./') || source?.startsWith('../')) { + const tsSource = ts.createStringLiteral(source.replace(/\.js$/, '.ts')); + if (ts.isImportDeclaration(node)) { + return factory.updateImportDeclaration( + node, + node.decorators, + node.modifiers, + node.importClause, + tsSource, + node.assertClause, + ); + } + if (ts.isExportDeclaration(node)) { + return factory.updateExportDeclaration( + node, + node.decorators, + node.modifiers, + node.isTypeOnly, + node.exportClause, + tsSource, + node.assertClause, + ); + } + + assert( + false, + 'Unexpected node with moduleSpecifier: ' + util.inspect(node), + ); + } + return ts.visitEachChild(node, visitNode, context); + } +} diff --git a/resources/build-npm.ts b/resources/build-npm.ts index 42715a09de..6a98326de0 100644 --- a/resources/build-npm.ts +++ b/resources/build-npm.ts @@ -1,24 +1,24 @@ -import * as assert from 'node:assert'; -import * as fs from 'node:fs'; -import * as path from 'node:path'; +import assert from 'node:assert'; +import fs from 'node:fs'; +import path from 'node:path'; -import * as ts from 'typescript'; +import ts from 'typescript'; -import { addExtensionToImportPaths } from './add-extension-to-import-paths'; -import { inlineInvariant } from './inline-invariant'; +import { inlineInvariant } from './inline-invariant.js'; import { + localRepoPath, readdirRecursive, readPackageJSON, showDirStats, writeGeneratedFile, -} from './utils'; +} from './utils.js'; fs.rmSync('./npmDist', { recursive: true, force: true }); fs.mkdirSync('./npmDist'); // Based on https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#getting-the-dts-from-a-javascript-file const tsConfig = JSON.parse( - fs.readFileSync(require.resolve('../tsconfig.json'), 'utf-8'), + fs.readFileSync(localRepoPath('tsconfig.json'), 'utf-8'), ); assert( tsConfig.compilerOptions, @@ -51,7 +51,7 @@ tsHost.writeFile = (filepath, body) => { const tsProgram = ts.createProgram(['src/index.ts'], tsOptions, tsHost); const tsResult = tsProgram.emit(undefined, undefined, undefined, undefined, { - after: [addExtensionToImportPaths({ extension: '.js' }), inlineInvariant], + after: [inlineInvariant], }); assert( !tsResult.emitSkipped, @@ -95,7 +95,6 @@ function buildPackageJSON() { '*': { '*': [notSupportedTSVersionFile] }, }; - packageJSON.type = 'module'; packageJSON.exports = {}; for (const filepath of readdirRecursive('./src', { ignoreDir: /^__.*__$/ })) { diff --git a/resources/diff-npm-package.ts b/resources/diff-npm-package.ts index 2ad16e6988..1f973003dd 100644 --- a/resources/diff-npm-package.ts +++ b/resources/diff-npm-package.ts @@ -1,12 +1,16 @@ -import * as assert from 'node:assert'; -import * as fs from 'node:fs'; -import * as os from 'node:os'; -import * as path from 'node:path'; +import assert from 'node:assert'; +import fs from 'node:fs'; +import os from 'node:os'; +import path from 'node:path'; -import { exec, execOutput } from './utils'; +import { + exec, + execOutput, + localRepoPath, + writeGeneratedFile, +} from './utils.js'; const LOCAL = 'local'; -const localRepoDir = path.join(__dirname, '..'); const tmpDir = path.join(os.tmpdir(), 'graphql-js-npm-diff'); fs.rmSync(tmpDir, { recursive: true, force: true }); fs.mkdirSync(tmpDir); @@ -33,8 +37,8 @@ const diff = execOutput(`npm diff --diff=${fromPackage} --diff=${toPackage}`); if (diff === '') { console.log('No changes found!'); } else { - const reportPath = path.join(localRepoDir, 'npm-dist-diff.html'); - fs.writeFileSync(reportPath, generateReport(diff), 'utf-8'); + const reportPath = localRepoPath('npm-dist-diff.html'); + writeGeneratedFile(reportPath, generateReport(diff)); console.log('Report saved to: ', reportPath); } @@ -76,10 +80,11 @@ function generateReport(diffString: string): string { `; } + function prepareNPMPackage(revision: string): string { if (revision === LOCAL) { - exec('npm --quiet run build:npm', { cwd: localRepoDir }); - return path.join(localRepoDir, 'npmDist'); + exec('npm --quiet run build:npm', { cwd: localRepoPath() }); + return localRepoPath('npmDist'); } // Returns the complete git hash for a given git revision reference. diff --git a/resources/gen-changelog.ts b/resources/gen-changelog.ts index b2612ecbde..c13716e5e4 100644 --- a/resources/gen-changelog.ts +++ b/resources/gen-changelog.ts @@ -1,7 +1,7 @@ -import * as https from 'node:https'; -import * as util from 'node:util'; +import https from 'node:https'; +import util from 'node:util'; -import { execOutput, readPackageJSON } from './utils'; +import { execOutput, readPackageJSON } from './utils.js'; const packageJSON = readPackageJSON(); const graphqlRequest = util.promisify(graphqlRequestImpl); diff --git a/resources/gen-version.ts b/resources/gen-version.ts index beb4225741..9a6ed637af 100644 --- a/resources/gen-version.ts +++ b/resources/gen-version.ts @@ -1,4 +1,4 @@ -import { readPackageJSON, writeGeneratedFile } from './utils'; +import { readPackageJSON, writeGeneratedFile } from './utils.js'; const { version } = readPackageJSON(); const versionMatch = /^(\d+)\.(\d+)\.(\d+)-?(.*)?$/.exec(version); diff --git a/resources/inline-invariant.ts b/resources/inline-invariant.ts index 541d8ee131..6352b52b79 100644 --- a/resources/inline-invariant.ts +++ b/resources/inline-invariant.ts @@ -1,4 +1,4 @@ -import * as ts from 'typescript'; +import ts from 'typescript'; /** * Eliminates function call to `invariant` if the condition is met. diff --git a/resources/utils.ts b/resources/utils.ts index a1f9e3e620..d464866412 100644 --- a/resources/utils.ts +++ b/resources/utils.ts @@ -1,9 +1,14 @@ -import * as assert from 'node:assert'; -import * as childProcess from 'node:child_process'; -import * as fs from 'node:fs'; -import * as path from 'node:path'; +import assert from 'node:assert'; +import childProcess from 'node:child_process'; +import fs from 'node:fs'; +import path from 'node:path'; -import * as prettier from 'prettier'; +import prettier from 'prettier'; + +export function localRepoPath(...paths: ReadonlyArray): string { + const repoDir = new URL('..', import.meta.url).pathname; + return path.join(repoDir, ...paths); +} export function exec(command: string, options?: { cwd: string }): void { childProcess.execSync(command, options); @@ -40,6 +45,8 @@ export function readdirRecursive( ); result.push(...list); } + + result.sort((a, b) => a.localeCompare(b)); return result.map((filepath) => './' + filepath); } @@ -97,7 +104,7 @@ export function showDirStats(dirPath: string): void { } const prettierConfig = JSON.parse( - fs.readFileSync(require.resolve('../.prettierrc'), 'utf-8'), + fs.readFileSync(localRepoPath('.prettierrc'), 'utf-8'), ); export function writeGeneratedFile(filepath: string, body: string): void { @@ -119,7 +126,5 @@ interface PackageJSON { } export function readPackageJSON(): PackageJSON { - return JSON.parse( - fs.readFileSync(require.resolve('../package.json'), 'utf-8'), - ); + return JSON.parse(fs.readFileSync(localRepoPath('package.json'), 'utf-8')); } diff --git a/src/__testUtils__/__tests__/dedent-test.ts b/src/__testUtils__/__tests__/dedent-test.ts index dfaf28e979..0469d2b75e 100644 --- a/src/__testUtils__/__tests__/dedent-test.ts +++ b/src/__testUtils__/__tests__/dedent-test.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { dedent, dedentString } from '../dedent'; +import { dedent, dedentString } from '../dedent.js'; describe('dedentString', () => { it('removes indentation in typical usage', () => { diff --git a/src/__testUtils__/__tests__/genFuzzStrings-test.ts b/src/__testUtils__/__tests__/genFuzzStrings-test.ts index 516ed00fe7..d57a3746f5 100644 --- a/src/__testUtils__/__tests__/genFuzzStrings-test.ts +++ b/src/__testUtils__/__tests__/genFuzzStrings-test.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { genFuzzStrings } from '../genFuzzStrings'; +import { genFuzzStrings } from '../genFuzzStrings.js'; function expectFuzzStrings(options: { allowedChars: ReadonlyArray; diff --git a/src/__testUtils__/__tests__/inspectStr-test.ts b/src/__testUtils__/__tests__/inspectStr-test.ts index 9c3eba3a95..e601a87014 100644 --- a/src/__testUtils__/__tests__/inspectStr-test.ts +++ b/src/__testUtils__/__tests__/inspectStr-test.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { inspectStr } from '../inspectStr'; +import { inspectStr } from '../inspectStr.js'; describe('inspectStr', () => { it('handles null and undefined values', () => { diff --git a/src/__testUtils__/__tests__/resolveOnNextTick-test.ts b/src/__testUtils__/__tests__/resolveOnNextTick-test.ts index 0916b44a0c..96e618b2db 100644 --- a/src/__testUtils__/__tests__/resolveOnNextTick-test.ts +++ b/src/__testUtils__/__tests__/resolveOnNextTick-test.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { resolveOnNextTick } from '../resolveOnNextTick'; +import { resolveOnNextTick } from '../resolveOnNextTick.js'; describe('resolveOnNextTick', () => { it('resolves promise on the next tick', async () => { diff --git a/src/__testUtils__/expectJSON.ts b/src/__testUtils__/expectJSON.ts index 64e2ba5dea..6de15ccacf 100644 --- a/src/__testUtils__/expectJSON.ts +++ b/src/__testUtils__/expectJSON.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; -import { isObjectLike } from '../jsutils/isObjectLike'; -import { mapValue } from '../jsutils/mapValue'; +import { isObjectLike } from '../jsutils/isObjectLike.js'; +import { mapValue } from '../jsutils/mapValue.js'; /** * Deeply transforms an arbitrary value to a JSON-safe value by calling toJSON diff --git a/src/__testUtils__/inspectStr.ts b/src/__testUtils__/inspectStr.ts index 721d6e673a..74c40e3145 100644 --- a/src/__testUtils__/inspectStr.ts +++ b/src/__testUtils__/inspectStr.ts @@ -1,4 +1,4 @@ -import type { Maybe } from '../jsutils/Maybe'; +import type { Maybe } from '../jsutils/Maybe.js'; /** * Special inspect function to produce readable string literal for error messages in tests diff --git a/src/__tests__/starWarsIntrospection-test.ts b/src/__tests__/starWarsIntrospection-test.ts index d637787c4a..224c506c19 100644 --- a/src/__tests__/starWarsIntrospection-test.ts +++ b/src/__tests__/starWarsIntrospection-test.ts @@ -1,9 +1,9 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { graphqlSync } from '../graphql'; +import { graphqlSync } from '../graphql.js'; -import { StarWarsSchema } from './starWarsSchema'; +import { StarWarsSchema } from './starWarsSchema.js'; function queryStarWars(source: string) { const result = graphqlSync({ schema: StarWarsSchema, source }); diff --git a/src/__tests__/starWarsQuery-test.ts b/src/__tests__/starWarsQuery-test.ts index 2662079d01..ecc69b2b02 100644 --- a/src/__tests__/starWarsQuery-test.ts +++ b/src/__tests__/starWarsQuery-test.ts @@ -1,11 +1,11 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { expectJSON } from '../__testUtils__/expectJSON'; +import { expectJSON } from '../__testUtils__/expectJSON.js'; -import { graphql } from '../graphql'; +import { graphql } from '../graphql.js'; -import { StarWarsSchema as schema } from './starWarsSchema'; +import { StarWarsSchema as schema } from './starWarsSchema.js'; describe('Star Wars Query Tests', () => { describe('Basic Queries', () => { diff --git a/src/__tests__/starWarsSchema.ts b/src/__tests__/starWarsSchema.ts index c646c8aea3..f42203c37d 100644 --- a/src/__tests__/starWarsSchema.ts +++ b/src/__tests__/starWarsSchema.ts @@ -4,11 +4,11 @@ import { GraphQLList, GraphQLNonNull, GraphQLObjectType, -} from '../type/definition'; -import { GraphQLString } from '../type/scalars'; -import { GraphQLSchema } from '../type/schema'; +} from '../type/definition.js'; +import { GraphQLString } from '../type/scalars.js'; +import { GraphQLSchema } from '../type/schema.js'; -import { getDroid, getFriends, getHero, getHuman } from './starWarsData'; +import { getDroid, getFriends, getHero, getHuman } from './starWarsData.js'; /** * This is designed to be an end-to-end test, demonstrating diff --git a/src/__tests__/starWarsValidation-test.ts b/src/__tests__/starWarsValidation-test.ts index 65e6c7f666..afd2e7ee3d 100644 --- a/src/__tests__/starWarsValidation-test.ts +++ b/src/__tests__/starWarsValidation-test.ts @@ -1,12 +1,12 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { parse } from '../language/parser'; -import { Source } from '../language/source'; +import { parse } from '../language/parser.js'; +import { Source } from '../language/source.js'; -import { validate } from '../validation/validate'; +import { validate } from '../validation/validate.js'; -import { StarWarsSchema } from './starWarsSchema'; +import { StarWarsSchema } from './starWarsSchema.js'; /** * Helper function to test a query and the expected response. diff --git a/src/__tests__/version-test.ts b/src/__tests__/version-test.ts index 3680512de8..eee4250d1c 100644 --- a/src/__tests__/version-test.ts +++ b/src/__tests__/version-test.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { version, versionInfo } from '../version'; +import { version, versionInfo } from '../version.js'; describe('Version', () => { it('versionInfo', () => { diff --git a/src/error/GraphQLError.ts b/src/error/GraphQLError.ts index 7fec960883..d7effff840 100644 --- a/src/error/GraphQLError.ts +++ b/src/error/GraphQLError.ts @@ -1,11 +1,14 @@ -import { isObjectLike } from '../jsutils/isObjectLike'; -import type { Maybe } from '../jsutils/Maybe'; - -import type { ASTNode, Location } from '../language/ast'; -import type { SourceLocation } from '../language/location'; -import { getLocation } from '../language/location'; -import { printLocation, printSourceLocation } from '../language/printLocation'; -import type { Source } from '../language/source'; +import { isObjectLike } from '../jsutils/isObjectLike.js'; +import type { Maybe } from '../jsutils/Maybe.js'; + +import type { ASTNode, Location } from '../language/ast.js'; +import type { SourceLocation } from '../language/location.js'; +import { getLocation } from '../language/location.js'; +import { + printLocation, + printSourceLocation, +} from '../language/printLocation.js'; +import type { Source } from '../language/source.js'; /** * Custom extensions diff --git a/src/error/__tests__/GraphQLError-test.ts b/src/error/__tests__/GraphQLError-test.ts index 95fe196487..7cfda2a5a3 100644 --- a/src/error/__tests__/GraphQLError-test.ts +++ b/src/error/__tests__/GraphQLError-test.ts @@ -1,13 +1,13 @@ import { assert, expect } from 'chai'; import { describe, it } from 'mocha'; -import { dedent } from '../../__testUtils__/dedent'; +import { dedent } from '../../__testUtils__/dedent.js'; -import { Kind } from '../../language/kinds'; -import { parse } from '../../language/parser'; -import { Source } from '../../language/source'; +import { Kind } from '../../language/kinds.js'; +import { parse } from '../../language/parser.js'; +import { Source } from '../../language/source.js'; -import { GraphQLError } from '../GraphQLError'; +import { GraphQLError } from '../GraphQLError.js'; const source = new Source(dedent` { diff --git a/src/error/__tests__/locatedError-test.ts b/src/error/__tests__/locatedError-test.ts index e270d09a6d..c60e1c5873 100644 --- a/src/error/__tests__/locatedError-test.ts +++ b/src/error/__tests__/locatedError-test.ts @@ -1,8 +1,8 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { GraphQLError } from '../GraphQLError'; -import { locatedError } from '../locatedError'; +import { GraphQLError } from '../GraphQLError.js'; +import { locatedError } from '../locatedError.js'; describe('locatedError', () => { it('passes GraphQLError through', () => { diff --git a/src/error/index.ts b/src/error/index.ts index 0d51428ed3..ed9e24d241 100644 --- a/src/error/index.ts +++ b/src/error/index.ts @@ -1,10 +1,10 @@ -export { GraphQLError } from './GraphQLError'; +export { GraphQLError } from './GraphQLError.js'; export type { GraphQLErrorOptions, GraphQLFormattedError, GraphQLErrorExtensions, -} from './GraphQLError'; +} from './GraphQLError.js'; -export { syntaxError } from './syntaxError'; +export { syntaxError } from './syntaxError.js'; -export { locatedError } from './locatedError'; +export { locatedError } from './locatedError.js'; diff --git a/src/error/locatedError.ts b/src/error/locatedError.ts index bafb9da9b6..e21b86a1b1 100644 --- a/src/error/locatedError.ts +++ b/src/error/locatedError.ts @@ -1,9 +1,9 @@ -import type { Maybe } from '../jsutils/Maybe'; -import { toError } from '../jsutils/toError'; +import type { Maybe } from '../jsutils/Maybe.js'; +import { toError } from '../jsutils/toError.js'; -import type { ASTNode } from '../language/ast'; +import type { ASTNode } from '../language/ast.js'; -import { GraphQLError } from './GraphQLError'; +import { GraphQLError } from './GraphQLError.js'; /** * Given an arbitrary value, presumably thrown while attempting to execute a diff --git a/src/error/syntaxError.ts b/src/error/syntaxError.ts index 386ece72da..af8e626207 100644 --- a/src/error/syntaxError.ts +++ b/src/error/syntaxError.ts @@ -1,6 +1,6 @@ -import type { Source } from '../language/source'; +import type { Source } from '../language/source.js'; -import { GraphQLError } from './GraphQLError'; +import { GraphQLError } from './GraphQLError.js'; /** * Produces a GraphQLError representing a syntax error, containing useful diff --git a/src/execution/__tests__/abstract-test.ts b/src/execution/__tests__/abstract-test.ts index 5253d0d9e0..5e184880a4 100644 --- a/src/execution/__tests__/abstract-test.ts +++ b/src/execution/__tests__/abstract-test.ts @@ -1,9 +1,9 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { expectJSON } from '../../__testUtils__/expectJSON'; +import { expectJSON } from '../../__testUtils__/expectJSON.js'; -import { parse } from '../../language/parser'; +import { parse } from '../../language/parser.js'; import { assertInterfaceType, @@ -11,13 +11,13 @@ import { GraphQLList, GraphQLObjectType, GraphQLUnionType, -} from '../../type/definition'; -import { GraphQLBoolean, GraphQLString } from '../../type/scalars'; -import { GraphQLSchema } from '../../type/schema'; +} from '../../type/definition.js'; +import { GraphQLBoolean, GraphQLString } from '../../type/scalars.js'; +import { GraphQLSchema } from '../../type/schema.js'; -import { buildSchema } from '../../utilities/buildASTSchema'; +import { buildSchema } from '../../utilities/buildASTSchema.js'; -import { execute, executeSync } from '../execute'; +import { execute, executeSync } from '../execute.js'; async function executeQuery(args: { schema: GraphQLSchema; diff --git a/src/execution/__tests__/directives-test.ts b/src/execution/__tests__/directives-test.ts index d94c0f2b8a..2a89f07b6f 100644 --- a/src/execution/__tests__/directives-test.ts +++ b/src/execution/__tests__/directives-test.ts @@ -1,13 +1,13 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { parse } from '../../language/parser'; +import { parse } from '../../language/parser.js'; -import { GraphQLObjectType } from '../../type/definition'; -import { GraphQLString } from '../../type/scalars'; -import { GraphQLSchema } from '../../type/schema'; +import { GraphQLObjectType } from '../../type/definition.js'; +import { GraphQLString } from '../../type/scalars.js'; +import { GraphQLSchema } from '../../type/schema.js'; -import { executeSync } from '../execute'; +import { executeSync } from '../execute.js'; const schema = new GraphQLSchema({ query: new GraphQLObjectType({ diff --git a/src/execution/__tests__/executor-test.ts b/src/execution/__tests__/executor-test.ts index bb9bf60224..10b696b7ae 100644 --- a/src/execution/__tests__/executor-test.ts +++ b/src/execution/__tests__/executor-test.ts @@ -1,12 +1,12 @@ import { assert, expect } from 'chai'; import { describe, it } from 'mocha'; -import { expectJSON } from '../../__testUtils__/expectJSON'; +import { expectJSON } from '../../__testUtils__/expectJSON.js'; -import { inspect } from '../../jsutils/inspect'; +import { inspect } from '../../jsutils/inspect.js'; -import { Kind } from '../../language/kinds'; -import { parse } from '../../language/parser'; +import { Kind } from '../../language/kinds.js'; +import { parse } from '../../language/parser.js'; import { GraphQLInterfaceType, @@ -15,11 +15,15 @@ import { GraphQLObjectType, GraphQLScalarType, GraphQLUnionType, -} from '../../type/definition'; -import { GraphQLBoolean, GraphQLInt, GraphQLString } from '../../type/scalars'; -import { GraphQLSchema } from '../../type/schema'; +} from '../../type/definition.js'; +import { + GraphQLBoolean, + GraphQLInt, + GraphQLString, +} from '../../type/scalars.js'; +import { GraphQLSchema } from '../../type/schema.js'; -import { execute, executeSync } from '../execute'; +import { execute, executeSync } from '../execute.js'; describe('Execute: Handles basic execution tasks', () => { it('throws if no document is provided', () => { diff --git a/src/execution/__tests__/lists-test.ts b/src/execution/__tests__/lists-test.ts index ac6460d547..071322f4aa 100644 --- a/src/execution/__tests__/lists-test.ts +++ b/src/execution/__tests__/lists-test.ts @@ -1,13 +1,13 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { expectJSON } from '../../__testUtils__/expectJSON'; +import { expectJSON } from '../../__testUtils__/expectJSON.js'; -import { parse } from '../../language/parser'; +import { parse } from '../../language/parser.js'; -import { buildSchema } from '../../utilities/buildASTSchema'; +import { buildSchema } from '../../utilities/buildASTSchema.js'; -import { execute, executeSync } from '../execute'; +import { execute, executeSync } from '../execute.js'; describe('Execute: Accepts any iterable as list value', () => { function complete(rootValue: unknown) { diff --git a/src/execution/__tests__/mapAsyncIterator-test.ts b/src/execution/__tests__/mapAsyncIterator-test.ts index 8107075718..413175767e 100644 --- a/src/execution/__tests__/mapAsyncIterator-test.ts +++ b/src/execution/__tests__/mapAsyncIterator-test.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { mapAsyncIterator } from '../mapAsyncIterator'; +import { mapAsyncIterator } from '../mapAsyncIterator.js'; /* eslint-disable @typescript-eslint/require-await */ describe('mapAsyncIterator', () => { diff --git a/src/execution/__tests__/mutations-test.ts b/src/execution/__tests__/mutations-test.ts index 0f0ad1cbf8..c6fc12c285 100644 --- a/src/execution/__tests__/mutations-test.ts +++ b/src/execution/__tests__/mutations-test.ts @@ -1,16 +1,16 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { expectJSON } from '../../__testUtils__/expectJSON'; -import { resolveOnNextTick } from '../../__testUtils__/resolveOnNextTick'; +import { expectJSON } from '../../__testUtils__/expectJSON.js'; +import { resolveOnNextTick } from '../../__testUtils__/resolveOnNextTick.js'; -import { parse } from '../../language/parser'; +import { parse } from '../../language/parser.js'; -import { GraphQLObjectType } from '../../type/definition'; -import { GraphQLInt } from '../../type/scalars'; -import { GraphQLSchema } from '../../type/schema'; +import { GraphQLObjectType } from '../../type/definition.js'; +import { GraphQLInt } from '../../type/scalars.js'; +import { GraphQLSchema } from '../../type/schema.js'; -import { execute, executeSync } from '../execute'; +import { execute, executeSync } from '../execute.js'; class NumberHolder { theNumber: number; diff --git a/src/execution/__tests__/nonnull-test.ts b/src/execution/__tests__/nonnull-test.ts index 427f2a64d6..fadb89b454 100644 --- a/src/execution/__tests__/nonnull-test.ts +++ b/src/execution/__tests__/nonnull-test.ts @@ -1,18 +1,18 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { expectJSON } from '../../__testUtils__/expectJSON'; +import { expectJSON } from '../../__testUtils__/expectJSON.js'; -import { parse } from '../../language/parser'; +import { parse } from '../../language/parser.js'; -import { GraphQLNonNull, GraphQLObjectType } from '../../type/definition'; -import { GraphQLString } from '../../type/scalars'; -import { GraphQLSchema } from '../../type/schema'; +import { GraphQLNonNull, GraphQLObjectType } from '../../type/definition.js'; +import { GraphQLString } from '../../type/scalars.js'; +import { GraphQLSchema } from '../../type/schema.js'; -import { buildSchema } from '../../utilities/buildASTSchema'; +import { buildSchema } from '../../utilities/buildASTSchema.js'; -import type { ExecutionResult } from '../execute'; -import { execute, executeSync } from '../execute'; +import type { ExecutionResult } from '../execute.js'; +import { execute, executeSync } from '../execute.js'; const syncError = new Error('sync'); const syncNonNullError = new Error('syncNonNull'); diff --git a/src/execution/__tests__/resolve-test.ts b/src/execution/__tests__/resolve-test.ts index a34da196c6..b13a4266f0 100644 --- a/src/execution/__tests__/resolve-test.ts +++ b/src/execution/__tests__/resolve-test.ts @@ -1,14 +1,14 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { parse } from '../../language/parser'; +import { parse } from '../../language/parser.js'; -import type { GraphQLFieldConfig } from '../../type/definition'; -import { GraphQLObjectType } from '../../type/definition'; -import { GraphQLInt, GraphQLString } from '../../type/scalars'; -import { GraphQLSchema } from '../../type/schema'; +import type { GraphQLFieldConfig } from '../../type/definition.js'; +import { GraphQLObjectType } from '../../type/definition.js'; +import { GraphQLInt, GraphQLString } from '../../type/scalars.js'; +import { GraphQLSchema } from '../../type/schema.js'; -import { executeSync } from '../execute'; +import { executeSync } from '../execute.js'; describe('Execute: resolve function', () => { function testSchema(testField: GraphQLFieldConfig) { diff --git a/src/execution/__tests__/schema-test.ts b/src/execution/__tests__/schema-test.ts index f9b4e47439..3e94ecf59a 100644 --- a/src/execution/__tests__/schema-test.ts +++ b/src/execution/__tests__/schema-test.ts @@ -1,22 +1,22 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { parse } from '../../language/parser'; +import { parse } from '../../language/parser.js'; import { GraphQLList, GraphQLNonNull, GraphQLObjectType, -} from '../../type/definition'; +} from '../../type/definition.js'; import { GraphQLBoolean, GraphQLID, GraphQLInt, GraphQLString, -} from '../../type/scalars'; -import { GraphQLSchema } from '../../type/schema'; +} from '../../type/scalars.js'; +import { GraphQLSchema } from '../../type/schema.js'; -import { executeSync } from '../execute'; +import { executeSync } from '../execute.js'; describe('Execute: Handles execution with a complex schema', () => { it('executes using a schema', () => { diff --git a/src/execution/__tests__/simplePubSub-test.ts b/src/execution/__tests__/simplePubSub-test.ts index e919d770e3..48d45afbc0 100644 --- a/src/execution/__tests__/simplePubSub-test.ts +++ b/src/execution/__tests__/simplePubSub-test.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { SimplePubSub } from './simplePubSub'; +import { SimplePubSub } from './simplePubSub.js'; describe('SimplePubSub', () => { it('subscribe async-iterator mock', async () => { diff --git a/src/execution/__tests__/subscribe-test.ts b/src/execution/__tests__/subscribe-test.ts index b095f2b5bc..757f8a584f 100644 --- a/src/execution/__tests__/subscribe-test.ts +++ b/src/execution/__tests__/subscribe-test.ts @@ -1,20 +1,24 @@ import { assert, expect } from 'chai'; import { describe, it } from 'mocha'; -import { expectJSON } from '../../__testUtils__/expectJSON'; -import { resolveOnNextTick } from '../../__testUtils__/resolveOnNextTick'; +import { expectJSON } from '../../__testUtils__/expectJSON.js'; +import { resolveOnNextTick } from '../../__testUtils__/resolveOnNextTick.js'; -import { isAsyncIterable } from '../../jsutils/isAsyncIterable'; +import { isAsyncIterable } from '../../jsutils/isAsyncIterable.js'; -import { parse } from '../../language/parser'; +import { parse } from '../../language/parser.js'; -import { GraphQLList, GraphQLObjectType } from '../../type/definition'; -import { GraphQLBoolean, GraphQLInt, GraphQLString } from '../../type/scalars'; -import { GraphQLSchema } from '../../type/schema'; +import { GraphQLList, GraphQLObjectType } from '../../type/definition.js'; +import { + GraphQLBoolean, + GraphQLInt, + GraphQLString, +} from '../../type/scalars.js'; +import { GraphQLSchema } from '../../type/schema.js'; -import { createSourceEventStream, subscribe } from '../subscribe'; +import { createSourceEventStream, subscribe } from '../subscribe.js'; -import { SimplePubSub } from './simplePubSub'; +import { SimplePubSub } from './simplePubSub.js'; interface Email { from: string; diff --git a/src/execution/__tests__/sync-test.ts b/src/execution/__tests__/sync-test.ts index 021f09fa3c..3060bdb50c 100644 --- a/src/execution/__tests__/sync-test.ts +++ b/src/execution/__tests__/sync-test.ts @@ -1,19 +1,19 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { expectJSON } from '../../__testUtils__/expectJSON'; +import { expectJSON } from '../../__testUtils__/expectJSON.js'; -import { parse } from '../../language/parser'; +import { parse } from '../../language/parser.js'; -import { GraphQLObjectType } from '../../type/definition'; -import { GraphQLString } from '../../type/scalars'; -import { GraphQLSchema } from '../../type/schema'; +import { GraphQLObjectType } from '../../type/definition.js'; +import { GraphQLString } from '../../type/scalars.js'; +import { GraphQLSchema } from '../../type/schema.js'; -import { validate } from '../../validation/validate'; +import { validate } from '../../validation/validate.js'; -import { graphqlSync } from '../../graphql'; +import { graphqlSync } from '../../graphql.js'; -import { execute, executeSync } from '../execute'; +import { execute, executeSync } from '../execute.js'; describe('Execute: synchronously when possible', () => { const schema = new GraphQLSchema({ diff --git a/src/execution/__tests__/union-interface-test.ts b/src/execution/__tests__/union-interface-test.ts index 7ce9f8b3bc..1aa32e5764 100644 --- a/src/execution/__tests__/union-interface-test.ts +++ b/src/execution/__tests__/union-interface-test.ts @@ -1,18 +1,18 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { parse } from '../../language/parser'; +import { parse } from '../../language/parser.js'; import { GraphQLInterfaceType, GraphQLList, GraphQLObjectType, GraphQLUnionType, -} from '../../type/definition'; -import { GraphQLBoolean, GraphQLString } from '../../type/scalars'; -import { GraphQLSchema } from '../../type/schema'; +} from '../../type/definition.js'; +import { GraphQLBoolean, GraphQLString } from '../../type/scalars.js'; +import { GraphQLSchema } from '../../type/schema.js'; -import { executeSync } from '../execute'; +import { executeSync } from '../execute.js'; class Dog { name: string; diff --git a/src/execution/__tests__/variables-test.ts b/src/execution/__tests__/variables-test.ts index f21bb95032..7c74d8ee92 100644 --- a/src/execution/__tests__/variables-test.ts +++ b/src/execution/__tests__/variables-test.ts @@ -1,17 +1,17 @@ import { assert, expect } from 'chai'; import { describe, it } from 'mocha'; -import { expectJSON } from '../../__testUtils__/expectJSON'; +import { expectJSON } from '../../__testUtils__/expectJSON.js'; -import { inspect } from '../../jsutils/inspect'; +import { inspect } from '../../jsutils/inspect.js'; -import { Kind } from '../../language/kinds'; -import { parse } from '../../language/parser'; +import { Kind } from '../../language/kinds.js'; +import { parse } from '../../language/parser.js'; import type { GraphQLArgumentConfig, GraphQLFieldConfig, -} from '../../type/definition'; +} from '../../type/definition.js'; import { GraphQLEnumType, GraphQLInputObjectType, @@ -19,12 +19,12 @@ import { GraphQLNonNull, GraphQLObjectType, GraphQLScalarType, -} from '../../type/definition'; -import { GraphQLString } from '../../type/scalars'; -import { GraphQLSchema } from '../../type/schema'; +} from '../../type/definition.js'; +import { GraphQLString } from '../../type/scalars.js'; +import { GraphQLSchema } from '../../type/schema.js'; -import { executeSync } from '../execute'; -import { getVariableValues } from '../values'; +import { executeSync } from '../execute.js'; +import { getVariableValues } from '../values.js'; const TestComplexScalar = new GraphQLScalarType({ name: 'ComplexScalar', diff --git a/src/execution/collectFields.ts b/src/execution/collectFields.ts index 83a78051c5..1efd86c2bc 100644 --- a/src/execution/collectFields.ts +++ b/src/execution/collectFields.ts @@ -1,5 +1,5 @@ -import { AccumulatorMap } from '../jsutils/AccumulatorMap'; -import type { ObjMap } from '../jsutils/ObjMap'; +import { AccumulatorMap } from '../jsutils/AccumulatorMap.js'; +import type { ObjMap } from '../jsutils/ObjMap.js'; import type { FieldNode, @@ -7,20 +7,20 @@ import type { FragmentSpreadNode, InlineFragmentNode, SelectionSetNode, -} from '../language/ast'; -import { Kind } from '../language/kinds'; +} from '../language/ast.js'; +import { Kind } from '../language/kinds.js'; -import type { GraphQLObjectType } from '../type/definition'; -import { isAbstractType } from '../type/definition'; +import type { GraphQLObjectType } from '../type/definition.js'; +import { isAbstractType } from '../type/definition.js'; import { GraphQLIncludeDirective, GraphQLSkipDirective, -} from '../type/directives'; -import type { GraphQLSchema } from '../type/schema'; +} from '../type/directives.js'; +import type { GraphQLSchema } from '../type/schema.js'; -import { typeFromAST } from '../utilities/typeFromAST'; +import { typeFromAST } from '../utilities/typeFromAST.js'; -import { getDirectiveValues } from './values'; +import { getDirectiveValues } from './values.js'; /** * Given a selectionSet, collects all of the fields and returns them. diff --git a/src/execution/execute.ts b/src/execution/execute.ts index 6dc4246178..d74f040daf 100644 --- a/src/execution/execute.ts +++ b/src/execution/execute.ts @@ -1,30 +1,30 @@ -import { devAssert } from '../jsutils/devAssert'; -import { inspect } from '../jsutils/inspect'; -import { invariant } from '../jsutils/invariant'; -import { isIterableObject } from '../jsutils/isIterableObject'; -import { isObjectLike } from '../jsutils/isObjectLike'; -import { isPromise } from '../jsutils/isPromise'; -import type { Maybe } from '../jsutils/Maybe'; -import { memoize3 } from '../jsutils/memoize3'; -import type { ObjMap } from '../jsutils/ObjMap'; -import type { Path } from '../jsutils/Path'; -import { addPath, pathToArray } from '../jsutils/Path'; -import { promiseForObject } from '../jsutils/promiseForObject'; -import type { PromiseOrValue } from '../jsutils/PromiseOrValue'; -import { promiseReduce } from '../jsutils/promiseReduce'; - -import type { GraphQLFormattedError } from '../error/GraphQLError'; -import { GraphQLError } from '../error/GraphQLError'; -import { locatedError } from '../error/locatedError'; +import { devAssert } from '../jsutils/devAssert.js'; +import { inspect } from '../jsutils/inspect.js'; +import { invariant } from '../jsutils/invariant.js'; +import { isIterableObject } from '../jsutils/isIterableObject.js'; +import { isObjectLike } from '../jsutils/isObjectLike.js'; +import { isPromise } from '../jsutils/isPromise.js'; +import type { Maybe } from '../jsutils/Maybe.js'; +import { memoize3 } from '../jsutils/memoize3.js'; +import type { ObjMap } from '../jsutils/ObjMap.js'; +import type { Path } from '../jsutils/Path.js'; +import { addPath, pathToArray } from '../jsutils/Path.js'; +import { promiseForObject } from '../jsutils/promiseForObject.js'; +import type { PromiseOrValue } from '../jsutils/PromiseOrValue.js'; +import { promiseReduce } from '../jsutils/promiseReduce.js'; + +import type { GraphQLFormattedError } from '../error/GraphQLError.js'; +import { GraphQLError } from '../error/GraphQLError.js'; +import { locatedError } from '../error/locatedError.js'; import type { DocumentNode, FieldNode, FragmentDefinitionNode, OperationDefinitionNode, -} from '../language/ast'; -import { OperationTypeNode } from '../language/ast'; -import { Kind } from '../language/kinds'; +} from '../language/ast.js'; +import { OperationTypeNode } from '../language/ast.js'; +import { Kind } from '../language/kinds.js'; import type { GraphQLAbstractType, @@ -36,22 +36,22 @@ import type { GraphQLOutputType, GraphQLResolveInfo, GraphQLTypeResolver, -} from '../type/definition'; +} from '../type/definition.js'; import { isAbstractType, isLeafType, isListType, isNonNullType, isObjectType, -} from '../type/definition'; -import type { GraphQLSchema } from '../type/schema'; -import { assertValidSchema } from '../type/validate'; +} from '../type/definition.js'; +import type { GraphQLSchema } from '../type/schema.js'; +import { assertValidSchema } from '../type/validate.js'; import { collectFields, collectSubfields as _collectSubfields, -} from './collectFields'; -import { getArgumentValues, getVariableValues } from './values'; +} from './collectFields.js'; +import { getArgumentValues, getVariableValues } from './values.js'; /** * A memoized collection of relevant subfields with regard to the return diff --git a/src/execution/index.ts b/src/execution/index.ts index 7727e6d57c..b30946b0b6 100644 --- a/src/execution/index.ts +++ b/src/execution/index.ts @@ -1,22 +1,22 @@ -export { pathToArray as responsePathAsArray } from '../jsutils/Path'; +export { pathToArray as responsePathAsArray } from '../jsutils/Path.js'; export { execute, executeSync, defaultFieldResolver, defaultTypeResolver, -} from './execute'; +} from './execute.js'; export type { ExecutionArgs, ExecutionResult, FormattedExecutionResult, -} from './execute'; +} from './execute.js'; -export { subscribe, createSourceEventStream } from './subscribe'; +export { subscribe, createSourceEventStream } from './subscribe.js'; export { getArgumentValues, getVariableValues, getDirectiveValues, -} from './values'; +} from './values.js'; diff --git a/src/execution/mapAsyncIterator.ts b/src/execution/mapAsyncIterator.ts index 82e863c6c0..dc84a8767e 100644 --- a/src/execution/mapAsyncIterator.ts +++ b/src/execution/mapAsyncIterator.ts @@ -1,4 +1,4 @@ -import type { PromiseOrValue } from '../jsutils/PromiseOrValue'; +import type { PromiseOrValue } from '../jsutils/PromiseOrValue.js'; /** * Given an AsyncIterable and a callback function, return an AsyncIterator diff --git a/src/execution/subscribe.ts b/src/execution/subscribe.ts index 7a04480bf4..e56ef3a4b3 100644 --- a/src/execution/subscribe.ts +++ b/src/execution/subscribe.ts @@ -1,30 +1,30 @@ -import { inspect } from '../jsutils/inspect'; -import { isAsyncIterable } from '../jsutils/isAsyncIterable'; -import type { Maybe } from '../jsutils/Maybe'; -import { addPath, pathToArray } from '../jsutils/Path'; +import { inspect } from '../jsutils/inspect.js'; +import { isAsyncIterable } from '../jsutils/isAsyncIterable.js'; +import type { Maybe } from '../jsutils/Maybe.js'; +import { addPath, pathToArray } from '../jsutils/Path.js'; -import { GraphQLError } from '../error/GraphQLError'; -import { locatedError } from '../error/locatedError'; +import { GraphQLError } from '../error/GraphQLError.js'; +import { locatedError } from '../error/locatedError.js'; -import type { DocumentNode } from '../language/ast'; +import type { DocumentNode } from '../language/ast.js'; -import type { GraphQLFieldResolver } from '../type/definition'; -import type { GraphQLSchema } from '../type/schema'; +import type { GraphQLFieldResolver } from '../type/definition.js'; +import type { GraphQLSchema } from '../type/schema.js'; -import { collectFields } from './collectFields'; +import { collectFields } from './collectFields.js'; import type { ExecutionArgs, ExecutionContext, ExecutionResult, -} from './execute'; +} from './execute.js'; import { assertValidExecutionArguments, buildExecutionContext, buildResolveInfo, execute, -} from './execute'; -import { mapAsyncIterator } from './mapAsyncIterator'; -import { getArgumentValues } from './values'; +} from './execute.js'; +import { mapAsyncIterator } from './mapAsyncIterator.js'; +import { getArgumentValues } from './values.js'; /** * Implements the "Subscribe" algorithm described in the GraphQL specification. diff --git a/src/execution/values.ts b/src/execution/values.ts index 023e028109..97d27c5f04 100644 --- a/src/execution/values.ts +++ b/src/execution/values.ts @@ -1,27 +1,27 @@ -import { inspect } from '../jsutils/inspect'; -import { keyMap } from '../jsutils/keyMap'; -import type { Maybe } from '../jsutils/Maybe'; -import type { ObjMap } from '../jsutils/ObjMap'; -import { printPathArray } from '../jsutils/printPathArray'; +import { inspect } from '../jsutils/inspect.js'; +import { keyMap } from '../jsutils/keyMap.js'; +import type { Maybe } from '../jsutils/Maybe.js'; +import type { ObjMap } from '../jsutils/ObjMap.js'; +import { printPathArray } from '../jsutils/printPathArray.js'; -import { GraphQLError } from '../error/GraphQLError'; +import { GraphQLError } from '../error/GraphQLError.js'; import type { DirectiveNode, FieldNode, VariableDefinitionNode, -} from '../language/ast'; -import { Kind } from '../language/kinds'; -import { print } from '../language/printer'; - -import type { GraphQLField } from '../type/definition'; -import { isInputType, isNonNullType } from '../type/definition'; -import type { GraphQLDirective } from '../type/directives'; -import type { GraphQLSchema } from '../type/schema'; - -import { coerceInputValue } from '../utilities/coerceInputValue'; -import { typeFromAST } from '../utilities/typeFromAST'; -import { valueFromAST } from '../utilities/valueFromAST'; +} from '../language/ast.js'; +import { Kind } from '../language/kinds.js'; +import { print } from '../language/printer.js'; + +import type { GraphQLField } from '../type/definition.js'; +import { isInputType, isNonNullType } from '../type/definition.js'; +import type { GraphQLDirective } from '../type/directives.js'; +import type { GraphQLSchema } from '../type/schema.js'; + +import { coerceInputValue } from '../utilities/coerceInputValue.js'; +import { typeFromAST } from '../utilities/typeFromAST.js'; +import { valueFromAST } from '../utilities/valueFromAST.js'; type CoercedVariableValues = | { errors: ReadonlyArray; coerced?: never } diff --git a/src/graphql.ts b/src/graphql.ts index ffad9123c1..bde2c311ee 100644 --- a/src/graphql.ts +++ b/src/graphql.ts @@ -1,21 +1,21 @@ -import { isPromise } from './jsutils/isPromise'; -import type { Maybe } from './jsutils/Maybe'; -import type { PromiseOrValue } from './jsutils/PromiseOrValue'; +import { isPromise } from './jsutils/isPromise.js'; +import type { Maybe } from './jsutils/Maybe.js'; +import type { PromiseOrValue } from './jsutils/PromiseOrValue.js'; -import { parse } from './language/parser'; -import type { Source } from './language/source'; +import { parse } from './language/parser.js'; +import type { Source } from './language/source.js'; import type { GraphQLFieldResolver, GraphQLTypeResolver, -} from './type/definition'; -import type { GraphQLSchema } from './type/schema'; -import { validateSchema } from './type/validate'; +} from './type/definition.js'; +import type { GraphQLSchema } from './type/schema.js'; +import { validateSchema } from './type/validate.js'; -import { validate } from './validation/validate'; +import { validate } from './validation/validate.js'; -import type { ExecutionResult } from './execution/execute'; -import { execute } from './execution/execute'; +import type { ExecutionResult } from './execution/execute.js'; +import { execute } from './execution/execute.js'; /** * This is the primary entry point function for fulfilling GraphQL operations diff --git a/src/index.ts b/src/index.ts index bce254f808..e6594b2d6c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -27,11 +27,11 @@ */ // The GraphQL.js version info. -export { version, versionInfo } from './version'; +export { version, versionInfo } from './version.js'; // The primary entry point into fulfilling a GraphQL request. -export type { GraphQLArgs } from './graphql'; -export { graphql, graphqlSync } from './graphql'; +export type { GraphQLArgs } from './graphql.js'; +export { graphql, graphqlSync } from './graphql.js'; // Create and operate on GraphQL type definitions and schema. export { @@ -136,7 +136,7 @@ export { // Upholds the spec rules about naming. assertName, assertEnumValueName, -} from './type/index'; +} from './type/index.js'; export type { GraphQLType, @@ -196,7 +196,7 @@ export type { GraphQLScalarSerializer, GraphQLScalarValueParser, GraphQLScalarLiteralParser, -} from './type/index'; +} from './type/index.js'; // Parse and operate on GraphQL language source files. export { @@ -236,7 +236,7 @@ export { isTypeDefinitionNode, isTypeSystemExtensionNode, isTypeExtensionNode, -} from './language/index'; +} from './language/index.js'; export type { ParseOptions, @@ -307,7 +307,7 @@ export type { UnionTypeExtensionNode, EnumTypeExtensionNode, InputObjectTypeExtensionNode, -} from './language/index'; +} from './language/index.js'; // Execute GraphQL queries. export { @@ -321,13 +321,13 @@ export { getDirectiveValues, subscribe, createSourceEventStream, -} from './execution/index'; +} from './execution/index.js'; export type { ExecutionArgs, ExecutionResult, FormattedExecutionResult, -} from './execution/index'; +} from './execution/index.js'; // Validate GraphQL documents. export { @@ -374,18 +374,18 @@ export { // Custom validation rules NoDeprecatedCustomRule, NoSchemaIntrospectionCustomRule, -} from './validation/index'; +} from './validation/index.js'; -export type { ValidationRule } from './validation/index'; +export type { ValidationRule } from './validation/index.js'; // Create, format, and print GraphQL errors. -export { GraphQLError, syntaxError, locatedError } from './error/index'; +export { GraphQLError, syntaxError, locatedError } from './error/index.js'; export type { GraphQLErrorOptions, GraphQLFormattedError, GraphQLErrorExtensions, -} from './error/index'; +} from './error/index.js'; // Utilities for operating on GraphQL type schema and parsed sources. export { @@ -440,7 +440,7 @@ export { DangerousChangeType, findBreakingChanges, findDangerousChanges, -} from './utilities/index'; +} from './utilities/index.js'; export type { IntrospectionOptions, @@ -469,4 +469,4 @@ export type { BreakingChange, DangerousChange, TypedQueryDocumentNode, -} from './utilities/index'; +} from './utilities/index.js'; diff --git a/src/jsutils/Path.ts b/src/jsutils/Path.ts index 64f6c78358..d223b6e752 100644 --- a/src/jsutils/Path.ts +++ b/src/jsutils/Path.ts @@ -1,4 +1,4 @@ -import type { Maybe } from './Maybe'; +import type { Maybe } from './Maybe.js'; export interface Path { readonly prev: Path | undefined; diff --git a/src/jsutils/__tests__/AccumulatorMap-test.ts b/src/jsutils/__tests__/AccumulatorMap-test.ts index 0fb34c6499..c5e6ff458f 100644 --- a/src/jsutils/__tests__/AccumulatorMap-test.ts +++ b/src/jsutils/__tests__/AccumulatorMap-test.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { AccumulatorMap } from '../AccumulatorMap'; +import { AccumulatorMap } from '../AccumulatorMap.js'; function expectMap(map: Map) { return expect(Object.fromEntries(map.entries())); diff --git a/src/jsutils/__tests__/Path-test.ts b/src/jsutils/__tests__/Path-test.ts index 43bca192c0..0484377db9 100644 --- a/src/jsutils/__tests__/Path-test.ts +++ b/src/jsutils/__tests__/Path-test.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { addPath, pathToArray } from '../Path'; +import { addPath, pathToArray } from '../Path.js'; describe('Path', () => { it('can create a Path', () => { diff --git a/src/jsutils/__tests__/capitalize-test.ts b/src/jsutils/__tests__/capitalize-test.ts index 48ae886c11..c0d082acfc 100644 --- a/src/jsutils/__tests__/capitalize-test.ts +++ b/src/jsutils/__tests__/capitalize-test.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { capitalize } from '../capitalize'; +import { capitalize } from '../capitalize.js'; describe('capitalize', () => { it('Converts the first character of string to upper case and the remaining to lower case', () => { diff --git a/src/jsutils/__tests__/didYouMean-test.ts b/src/jsutils/__tests__/didYouMean-test.ts index bc01e18080..1cac761f7d 100644 --- a/src/jsutils/__tests__/didYouMean-test.ts +++ b/src/jsutils/__tests__/didYouMean-test.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { didYouMean } from '../didYouMean'; +import { didYouMean } from '../didYouMean.js'; describe('didYouMean', () => { it('Does accept an empty list', () => { diff --git a/src/jsutils/__tests__/identityFunc-test.ts b/src/jsutils/__tests__/identityFunc-test.ts index 97cc25eb2f..e49419dbcd 100644 --- a/src/jsutils/__tests__/identityFunc-test.ts +++ b/src/jsutils/__tests__/identityFunc-test.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { identityFunc } from '../identityFunc'; +import { identityFunc } from '../identityFunc.js'; describe('identityFunc', () => { it('returns the first argument it receives', () => { diff --git a/src/jsutils/__tests__/inspect-test.ts b/src/jsutils/__tests__/inspect-test.ts index d1ac17313a..de74beeb26 100644 --- a/src/jsutils/__tests__/inspect-test.ts +++ b/src/jsutils/__tests__/inspect-test.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { inspect } from '../inspect'; +import { inspect } from '../inspect.js'; describe('inspect', () => { it('undefined', () => { diff --git a/src/jsutils/__tests__/instanceOf-test.ts b/src/jsutils/__tests__/instanceOf-test.ts index cbd649bfa8..5a54a641e5 100644 --- a/src/jsutils/__tests__/instanceOf-test.ts +++ b/src/jsutils/__tests__/instanceOf-test.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { instanceOf } from '../instanceOf'; +import { instanceOf } from '../instanceOf.js'; describe('instanceOf', () => { it('do not throw on values without prototype', () => { diff --git a/src/jsutils/__tests__/invariant-test.ts b/src/jsutils/__tests__/invariant-test.ts index 2a438b69b3..830ebe0bb7 100644 --- a/src/jsutils/__tests__/invariant-test.ts +++ b/src/jsutils/__tests__/invariant-test.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { invariant } from '../invariant'; +import { invariant } from '../invariant.js'; describe('invariant', () => { it('throws on false conditions', () => { diff --git a/src/jsutils/__tests__/isAsyncIterable-test.ts b/src/jsutils/__tests__/isAsyncIterable-test.ts index e62bb53433..3188061043 100644 --- a/src/jsutils/__tests__/isAsyncIterable-test.ts +++ b/src/jsutils/__tests__/isAsyncIterable-test.ts @@ -1,8 +1,8 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { identityFunc } from '../identityFunc'; -import { isAsyncIterable } from '../isAsyncIterable'; +import { identityFunc } from '../identityFunc.js'; +import { isAsyncIterable } from '../isAsyncIterable.js'; describe('isAsyncIterable', () => { it('should return `true` for AsyncIterable', () => { diff --git a/src/jsutils/__tests__/isIterableObject-test.ts b/src/jsutils/__tests__/isIterableObject-test.ts index c631cb4b80..eedfd25a36 100644 --- a/src/jsutils/__tests__/isIterableObject-test.ts +++ b/src/jsutils/__tests__/isIterableObject-test.ts @@ -1,8 +1,8 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { identityFunc } from '../identityFunc'; -import { isIterableObject } from '../isIterableObject'; +import { identityFunc } from '../identityFunc.js'; +import { isIterableObject } from '../isIterableObject.js'; describe('isIterableObject', () => { it('should return `true` for collections', () => { diff --git a/src/jsutils/__tests__/isObjectLike-test.ts b/src/jsutils/__tests__/isObjectLike-test.ts index 536ecb5f88..6dffcc7655 100644 --- a/src/jsutils/__tests__/isObjectLike-test.ts +++ b/src/jsutils/__tests__/isObjectLike-test.ts @@ -1,8 +1,8 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { identityFunc } from '../identityFunc'; -import { isObjectLike } from '../isObjectLike'; +import { identityFunc } from '../identityFunc.js'; +import { isObjectLike } from '../isObjectLike.js'; describe('isObjectLike', () => { it('should return `true` for objects', () => { diff --git a/src/jsutils/__tests__/naturalCompare-test.ts b/src/jsutils/__tests__/naturalCompare-test.ts index 4c5291e579..482b99f4ff 100644 --- a/src/jsutils/__tests__/naturalCompare-test.ts +++ b/src/jsutils/__tests__/naturalCompare-test.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { naturalCompare } from '../naturalCompare'; +import { naturalCompare } from '../naturalCompare.js'; describe('naturalCompare', () => { it('Handles empty strings', () => { diff --git a/src/jsutils/__tests__/suggestionList-test.ts b/src/jsutils/__tests__/suggestionList-test.ts index 2b90524885..06719d8a1e 100644 --- a/src/jsutils/__tests__/suggestionList-test.ts +++ b/src/jsutils/__tests__/suggestionList-test.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { suggestionList } from '../suggestionList'; +import { suggestionList } from '../suggestionList.js'; function expectSuggestions(input: string, options: ReadonlyArray) { return expect(suggestionList(input, options)); diff --git a/src/jsutils/__tests__/toObjMap-test.ts b/src/jsutils/__tests__/toObjMap-test.ts index f9136b87b8..a6efb34e48 100644 --- a/src/jsutils/__tests__/toObjMap-test.ts +++ b/src/jsutils/__tests__/toObjMap-test.ts @@ -1,8 +1,8 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import type { ObjMapLike } from '../ObjMap'; -import { toObjMap } from '../toObjMap'; +import type { ObjMapLike } from '../ObjMap.js'; +import { toObjMap } from '../toObjMap.js'; // Workaround to make both ESLint happy const __proto__ = '__proto__'; diff --git a/src/jsutils/didYouMean.ts b/src/jsutils/didYouMean.ts index ef1931c7d7..15735bdb7e 100644 --- a/src/jsutils/didYouMean.ts +++ b/src/jsutils/didYouMean.ts @@ -1,4 +1,4 @@ -import { orList } from './formatList'; +import { orList } from './formatList.js'; const MAX_SUGGESTIONS = 5; diff --git a/src/jsutils/formatList.ts b/src/jsutils/formatList.ts index fe3afe53a6..b00dd6591a 100644 --- a/src/jsutils/formatList.ts +++ b/src/jsutils/formatList.ts @@ -1,4 +1,4 @@ -import { invariant } from './invariant'; +import { invariant } from './invariant.js'; /** * Given [ A, B, C ] return 'A, B, or C'. diff --git a/src/jsutils/groupBy.ts b/src/jsutils/groupBy.ts index 60e02ea304..15deeb4e6f 100644 --- a/src/jsutils/groupBy.ts +++ b/src/jsutils/groupBy.ts @@ -1,4 +1,4 @@ -import { AccumulatorMap } from './AccumulatorMap'; +import { AccumulatorMap } from './AccumulatorMap.js'; /** * Groups array items into a Map, given a function to produce grouping key. diff --git a/src/jsutils/instanceOf.ts b/src/jsutils/instanceOf.ts index b917cfc3bf..9c3f80f3ed 100644 --- a/src/jsutils/instanceOf.ts +++ b/src/jsutils/instanceOf.ts @@ -1,4 +1,4 @@ -import { inspect } from './inspect'; +import { inspect } from './inspect.js'; /** * A replacement for instanceof which includes an error warning when multi-realm diff --git a/src/jsutils/keyMap.ts b/src/jsutils/keyMap.ts index 592a98c83d..3b278dd8e9 100644 --- a/src/jsutils/keyMap.ts +++ b/src/jsutils/keyMap.ts @@ -1,4 +1,4 @@ -import type { ObjMap } from './ObjMap'; +import type { ObjMap } from './ObjMap.js'; /** * Creates a keyed JS object from an array, given a function to produce the keys diff --git a/src/jsutils/keyValMap.ts b/src/jsutils/keyValMap.ts index 94d688c2c1..4477df121b 100644 --- a/src/jsutils/keyValMap.ts +++ b/src/jsutils/keyValMap.ts @@ -1,4 +1,4 @@ -import type { ObjMap } from './ObjMap'; +import type { ObjMap } from './ObjMap.js'; /** * Creates a keyed JS object from an array, given a function to produce the keys diff --git a/src/jsutils/mapValue.ts b/src/jsutils/mapValue.ts index 32686a29c1..8f1299586e 100644 --- a/src/jsutils/mapValue.ts +++ b/src/jsutils/mapValue.ts @@ -1,4 +1,4 @@ -import type { ObjMap, ReadOnlyObjMap } from './ObjMap'; +import type { ObjMap, ReadOnlyObjMap } from './ObjMap.js'; /** * Creates an object map with the same keys as `map` and values generated by diff --git a/src/jsutils/promiseForObject.ts b/src/jsutils/promiseForObject.ts index 1074676030..f5cd0c017a 100644 --- a/src/jsutils/promiseForObject.ts +++ b/src/jsutils/promiseForObject.ts @@ -1,4 +1,4 @@ -import type { ObjMap } from './ObjMap'; +import type { ObjMap } from './ObjMap.js'; /** * This function transforms a JS object `ObjMap>` into diff --git a/src/jsutils/promiseReduce.ts b/src/jsutils/promiseReduce.ts index 58db2e85c8..871b9c3cf7 100644 --- a/src/jsutils/promiseReduce.ts +++ b/src/jsutils/promiseReduce.ts @@ -1,5 +1,5 @@ -import { isPromise } from './isPromise'; -import type { PromiseOrValue } from './PromiseOrValue'; +import { isPromise } from './isPromise.js'; +import type { PromiseOrValue } from './PromiseOrValue.js'; /** * Similar to Array.prototype.reduce(), however the reducing callback may return diff --git a/src/jsutils/suggestionList.ts b/src/jsutils/suggestionList.ts index 53ad685c8c..4114ddad39 100644 --- a/src/jsutils/suggestionList.ts +++ b/src/jsutils/suggestionList.ts @@ -1,4 +1,4 @@ -import { naturalCompare } from './naturalCompare'; +import { naturalCompare } from './naturalCompare.js'; /** * Given an invalid input string and a list of valid options, returns a filtered diff --git a/src/jsutils/toError.ts b/src/jsutils/toError.ts index 8d562273d6..d4cb42005d 100644 --- a/src/jsutils/toError.ts +++ b/src/jsutils/toError.ts @@ -1,4 +1,4 @@ -import { inspect } from './inspect'; +import { inspect } from './inspect.js'; /** * Sometimes a non-error is thrown, wrap it as an Error instance to ensure a consistent Error interface. diff --git a/src/jsutils/toObjMap.ts b/src/jsutils/toObjMap.ts index 6fe352db23..c7adab7b34 100644 --- a/src/jsutils/toObjMap.ts +++ b/src/jsutils/toObjMap.ts @@ -1,5 +1,5 @@ -import type { Maybe } from './Maybe'; -import type { ReadOnlyObjMap, ReadOnlyObjMapLike } from './ObjMap'; +import type { Maybe } from './Maybe.js'; +import type { ReadOnlyObjMap, ReadOnlyObjMapLike } from './ObjMap.js'; export function toObjMap( obj: Maybe>, diff --git a/src/language/__tests__/blockString-fuzz.ts b/src/language/__tests__/blockString-fuzz.ts index f4aea2cc6b..8707243a6f 100644 --- a/src/language/__tests__/blockString-fuzz.ts +++ b/src/language/__tests__/blockString-fuzz.ts @@ -1,13 +1,13 @@ import { assert } from 'chai'; import { describe, it } from 'mocha'; -import { dedent } from '../../__testUtils__/dedent'; -import { genFuzzStrings } from '../../__testUtils__/genFuzzStrings'; -import { inspectStr } from '../../__testUtils__/inspectStr'; +import { dedent } from '../../__testUtils__/dedent.js'; +import { genFuzzStrings } from '../../__testUtils__/genFuzzStrings.js'; +import { inspectStr } from '../../__testUtils__/inspectStr.js'; -import { isPrintableAsBlockString, printBlockString } from '../blockString'; -import { Lexer } from '../lexer'; -import { Source } from '../source'; +import { isPrintableAsBlockString, printBlockString } from '../blockString.js'; +import { Lexer } from '../lexer.js'; +import { Source } from '../source.js'; function lexValue(str: string): string { const lexer = new Lexer(new Source(str)); diff --git a/src/language/__tests__/blockString-test.ts b/src/language/__tests__/blockString-test.ts index 21fa49b00a..93c642b4b2 100644 --- a/src/language/__tests__/blockString-test.ts +++ b/src/language/__tests__/blockString-test.ts @@ -5,7 +5,7 @@ import { dedentBlockStringLines, isPrintableAsBlockString, printBlockString, -} from '../blockString'; +} from '../blockString.js'; function joinLines(...args: ReadonlyArray) { return args.join('\n'); diff --git a/src/language/__tests__/lexer-test.ts b/src/language/__tests__/lexer-test.ts index 46bf971d0a..788ce10f9a 100644 --- a/src/language/__tests__/lexer-test.ts +++ b/src/language/__tests__/lexer-test.ts @@ -1,17 +1,17 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { dedent } from '../../__testUtils__/dedent'; -import { expectToThrowJSON } from '../../__testUtils__/expectJSON'; +import { dedent } from '../../__testUtils__/dedent.js'; +import { expectToThrowJSON } from '../../__testUtils__/expectJSON.js'; -import { inspect } from '../../jsutils/inspect'; +import { inspect } from '../../jsutils/inspect.js'; -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; -import type { Token } from '../ast'; -import { isPunctuatorTokenKind, Lexer } from '../lexer'; -import { Source } from '../source'; -import { TokenKind } from '../tokenKind'; +import type { Token } from '../ast.js'; +import { isPunctuatorTokenKind, Lexer } from '../lexer.js'; +import { Source } from '../source.js'; +import { TokenKind } from '../tokenKind.js'; function lexOne(str: string) { const lexer = new Lexer(new Source(str)); diff --git a/src/language/__tests__/parser-test.ts b/src/language/__tests__/parser-test.ts index 3571b75700..c1f5f81972 100644 --- a/src/language/__tests__/parser-test.ts +++ b/src/language/__tests__/parser-test.ts @@ -1,16 +1,19 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { dedent } from '../../__testUtils__/dedent'; -import { expectJSON, expectToThrowJSON } from '../../__testUtils__/expectJSON'; -import { kitchenSinkQuery } from '../../__testUtils__/kitchenSinkQuery'; - -import { inspect } from '../../jsutils/inspect'; - -import { Kind } from '../kinds'; -import { parse, parseConstValue, parseType, parseValue } from '../parser'; -import { Source } from '../source'; -import { TokenKind } from '../tokenKind'; +import { dedent } from '../../__testUtils__/dedent.js'; +import { + expectJSON, + expectToThrowJSON, +} from '../../__testUtils__/expectJSON.js'; +import { kitchenSinkQuery } from '../../__testUtils__/kitchenSinkQuery.js'; + +import { inspect } from '../../jsutils/inspect.js'; + +import { Kind } from '../kinds.js'; +import { parse, parseConstValue, parseType, parseValue } from '../parser.js'; +import { Source } from '../source.js'; +import { TokenKind } from '../tokenKind.js'; function expectSyntaxError(text: string) { return expectToThrowJSON(() => parse(text)); diff --git a/src/language/__tests__/predicates-test.ts b/src/language/__tests__/predicates-test.ts index 13477f8de9..350e3f1a6b 100644 --- a/src/language/__tests__/predicates-test.ts +++ b/src/language/__tests__/predicates-test.ts @@ -1,9 +1,9 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import type { ASTNode } from '../ast'; -import { Kind } from '../kinds'; -import { parseValue } from '../parser'; +import type { ASTNode } from '../ast.js'; +import { Kind } from '../kinds.js'; +import { parseValue } from '../parser.js'; import { isConstValueNode, isDefinitionNode, @@ -15,7 +15,7 @@ import { isTypeSystemDefinitionNode, isTypeSystemExtensionNode, isValueNode, -} from '../predicates'; +} from '../predicates.js'; function filterNodes(predicate: (node: ASTNode) => boolean): Array { return Object.values(Kind).filter( diff --git a/src/language/__tests__/printLocation-test.ts b/src/language/__tests__/printLocation-test.ts index c5eac8cce5..58074fa59c 100644 --- a/src/language/__tests__/printLocation-test.ts +++ b/src/language/__tests__/printLocation-test.ts @@ -1,10 +1,10 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { dedent } from '../../__testUtils__/dedent'; +import { dedent } from '../../__testUtils__/dedent.js'; -import { printSourceLocation } from '../printLocation'; -import { Source } from '../source'; +import { printSourceLocation } from '../printLocation.js'; +import { Source } from '../source.js'; describe('printSourceLocation', () => { it('prints minified documents', () => { diff --git a/src/language/__tests__/printString-test.ts b/src/language/__tests__/printString-test.ts index fff1bfeec0..e59b624bd0 100644 --- a/src/language/__tests__/printString-test.ts +++ b/src/language/__tests__/printString-test.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { printString } from '../printString'; +import { printString } from '../printString.js'; describe('printString', () => { it('prints a simple string', () => { diff --git a/src/language/__tests__/printer-test.ts b/src/language/__tests__/printer-test.ts index 73e760d696..5b06088198 100644 --- a/src/language/__tests__/printer-test.ts +++ b/src/language/__tests__/printer-test.ts @@ -1,12 +1,12 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { dedent, dedentString } from '../../__testUtils__/dedent'; -import { kitchenSinkQuery } from '../../__testUtils__/kitchenSinkQuery'; +import { dedent, dedentString } from '../../__testUtils__/dedent.js'; +import { kitchenSinkQuery } from '../../__testUtils__/kitchenSinkQuery.js'; -import { Kind } from '../kinds'; -import { parse } from '../parser'; -import { print } from '../printer'; +import { Kind } from '../kinds.js'; +import { parse } from '../parser.js'; +import { print } from '../printer.js'; describe('Printer: Query document', () => { it('prints minimal ast', () => { diff --git a/src/language/__tests__/schema-parser-test.ts b/src/language/__tests__/schema-parser-test.ts index cbb337c337..27ac5c1bfb 100644 --- a/src/language/__tests__/schema-parser-test.ts +++ b/src/language/__tests__/schema-parser-test.ts @@ -1,11 +1,14 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { dedent } from '../../__testUtils__/dedent'; -import { expectJSON, expectToThrowJSON } from '../../__testUtils__/expectJSON'; -import { kitchenSinkSDL } from '../../__testUtils__/kitchenSinkSDL'; - -import { parse } from '../parser'; +import { dedent } from '../../__testUtils__/dedent.js'; +import { + expectJSON, + expectToThrowJSON, +} from '../../__testUtils__/expectJSON.js'; +import { kitchenSinkSDL } from '../../__testUtils__/kitchenSinkSDL.js'; + +import { parse } from '../parser.js'; function expectSyntaxError(text: string) { return expectToThrowJSON(() => parse(text)); diff --git a/src/language/__tests__/schema-printer-test.ts b/src/language/__tests__/schema-printer-test.ts index 7272b2f2b8..3de9865c2c 100644 --- a/src/language/__tests__/schema-printer-test.ts +++ b/src/language/__tests__/schema-printer-test.ts @@ -1,12 +1,12 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { dedent } from '../../__testUtils__/dedent'; -import { kitchenSinkSDL } from '../../__testUtils__/kitchenSinkSDL'; +import { dedent } from '../../__testUtils__/dedent.js'; +import { kitchenSinkSDL } from '../../__testUtils__/kitchenSinkSDL.js'; -import { Kind } from '../kinds'; -import { parse } from '../parser'; -import { print } from '../printer'; +import { Kind } from '../kinds.js'; +import { parse } from '../parser.js'; +import { print } from '../printer.js'; describe('Printer: SDL document', () => { it('prints minimal ast', () => { diff --git a/src/language/__tests__/source-test.ts b/src/language/__tests__/source-test.ts index 6bf8a93e6d..7e90fc28d2 100644 --- a/src/language/__tests__/source-test.ts +++ b/src/language/__tests__/source-test.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { Source } from '../source'; +import { Source } from '../source.js'; describe('Source', () => { it('asserts that a body was provided', () => { diff --git a/src/language/__tests__/visitor-test.ts b/src/language/__tests__/visitor-test.ts index 9149b103e3..681734b771 100644 --- a/src/language/__tests__/visitor-test.ts +++ b/src/language/__tests__/visitor-test.ts @@ -1,14 +1,14 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { kitchenSinkQuery } from '../../__testUtils__/kitchenSinkQuery'; - -import type { ASTNode, SelectionSetNode } from '../ast'; -import { isNode } from '../ast'; -import { Kind } from '../kinds'; -import { parse } from '../parser'; -import type { ASTVisitor, ASTVisitorKeyMap } from '../visitor'; -import { BREAK, visit, visitInParallel } from '../visitor'; +import { kitchenSinkQuery } from '../../__testUtils__/kitchenSinkQuery.js'; + +import type { ASTNode, SelectionSetNode } from '../ast.js'; +import { isNode } from '../ast.js'; +import { Kind } from '../kinds.js'; +import { parse } from '../parser.js'; +import type { ASTVisitor, ASTVisitorKeyMap } from '../visitor.js'; +import { BREAK, visit, visitInParallel } from '../visitor.js'; function checkVisitorFnArgs(ast: any, args: any, isEdited: boolean = false) { const [node, key, parent, path, ancestors] = args; diff --git a/src/language/ast.ts b/src/language/ast.ts index 0b30366df0..c3e2336db8 100644 --- a/src/language/ast.ts +++ b/src/language/ast.ts @@ -1,6 +1,6 @@ -import type { Kind } from './kinds'; -import type { Source } from './source'; -import type { TokenKind } from './tokenKind'; +import type { Kind } from './kinds.js'; +import type { Source } from './source.js'; +import type { TokenKind } from './tokenKind.js'; /** * Contains a range of UTF-8 character offsets and token references that diff --git a/src/language/blockString.ts b/src/language/blockString.ts index 1c200c183a..667f91831e 100644 --- a/src/language/blockString.ts +++ b/src/language/blockString.ts @@ -1,4 +1,4 @@ -import { isWhiteSpace } from './characterClasses'; +import { isWhiteSpace } from './characterClasses.js'; /** * Produces the value of a block string from its parsed raw value, similar to diff --git a/src/language/index.ts b/src/language/index.ts index ad8e082c6e..d9f5cd4cf3 100644 --- a/src/language/index.ts +++ b/src/language/index.ts @@ -1,25 +1,30 @@ -export { Source } from './source'; +export { Source } from './source.js'; -export { getLocation } from './location'; -export type { SourceLocation } from './location'; +export { getLocation } from './location.js'; +export type { SourceLocation } from './location.js'; -export { printLocation, printSourceLocation } from './printLocation'; +export { printLocation, printSourceLocation } from './printLocation.js'; -export { Kind } from './kinds'; +export { Kind } from './kinds.js'; -export { TokenKind } from './tokenKind'; +export { TokenKind } from './tokenKind.js'; -export { Lexer } from './lexer'; +export { Lexer } from './lexer.js'; -export { parse, parseValue, parseConstValue, parseType } from './parser'; -export type { ParseOptions } from './parser'; +export { parse, parseValue, parseConstValue, parseType } from './parser.js'; +export type { ParseOptions } from './parser.js'; -export { print } from './printer'; +export { print } from './printer.js'; -export { visit, visitInParallel, getEnterLeaveForKind, BREAK } from './visitor'; -export type { ASTVisitor, ASTVisitFn, ASTVisitorKeyMap } from './visitor'; +export { + visit, + visitInParallel, + getEnterLeaveForKind, + BREAK, +} from './visitor.js'; +export type { ASTVisitor, ASTVisitFn, ASTVisitorKeyMap } from './visitor.js'; -export { Location, Token, OperationTypeNode } from './ast'; +export { Location, Token, OperationTypeNode } from './ast.js'; export type { ASTNode, ASTKindToNode, @@ -82,7 +87,7 @@ export type { UnionTypeExtensionNode, EnumTypeExtensionNode, InputObjectTypeExtensionNode, -} from './ast'; +} from './ast.js'; export { isDefinitionNode, @@ -95,6 +100,6 @@ export { isTypeDefinitionNode, isTypeSystemExtensionNode, isTypeExtensionNode, -} from './predicates'; +} from './predicates.js'; -export { DirectiveLocation } from './directiveLocation'; +export { DirectiveLocation } from './directiveLocation.js'; diff --git a/src/language/lexer.ts b/src/language/lexer.ts index 818f81b286..e849578f22 100644 --- a/src/language/lexer.ts +++ b/src/language/lexer.ts @@ -1,10 +1,10 @@ -import { syntaxError } from '../error/syntaxError'; +import { syntaxError } from '../error/syntaxError.js'; -import { Token } from './ast'; -import { dedentBlockStringLines } from './blockString'; -import { isDigit, isNameContinue, isNameStart } from './characterClasses'; -import type { Source } from './source'; -import { TokenKind } from './tokenKind'; +import { Token } from './ast.js'; +import { dedentBlockStringLines } from './blockString.js'; +import { isDigit, isNameContinue, isNameStart } from './characterClasses.js'; +import type { Source } from './source.js'; +import { TokenKind } from './tokenKind.js'; /** * Given a Source object, creates a Lexer for that source. diff --git a/src/language/location.ts b/src/language/location.ts index 36d97f3cca..105137f8a3 100644 --- a/src/language/location.ts +++ b/src/language/location.ts @@ -1,6 +1,6 @@ -import { invariant } from '../jsutils/invariant'; +import { invariant } from '../jsutils/invariant.js'; -import type { Source } from './source'; +import type { Source } from './source.js'; const LineRegExp = /\r\n|[\n\r]/g; diff --git a/src/language/parser.ts b/src/language/parser.ts index 282ee16859..ef05c7825b 100644 --- a/src/language/parser.ts +++ b/src/language/parser.ts @@ -1,7 +1,7 @@ -import type { Maybe } from '../jsutils/Maybe'; +import type { Maybe } from '../jsutils/Maybe.js'; -import type { GraphQLError } from '../error/GraphQLError'; -import { syntaxError } from '../error/syntaxError'; +import type { GraphQLError } from '../error/GraphQLError.js'; +import { syntaxError } from '../error/syntaxError.js'; import type { ArgumentNode, @@ -59,13 +59,13 @@ import type { ValueNode, VariableDefinitionNode, VariableNode, -} from './ast'; -import { Location, OperationTypeNode } from './ast'; -import { DirectiveLocation } from './directiveLocation'; -import { Kind } from './kinds'; -import { isPunctuatorTokenKind, Lexer } from './lexer'; -import { isSource, Source } from './source'; -import { TokenKind } from './tokenKind'; +} from './ast.js'; +import { Location, OperationTypeNode } from './ast.js'; +import { DirectiveLocation } from './directiveLocation.js'; +import { Kind } from './kinds.js'; +import { isPunctuatorTokenKind, Lexer } from './lexer.js'; +import { isSource, Source } from './source.js'; +import { TokenKind } from './tokenKind.js'; /** * Configuration options to control parser behavior diff --git a/src/language/predicates.ts b/src/language/predicates.ts index a390f4ee55..8e36ab4862 100644 --- a/src/language/predicates.ts +++ b/src/language/predicates.ts @@ -10,8 +10,8 @@ import type { TypeSystemDefinitionNode, TypeSystemExtensionNode, ValueNode, -} from './ast'; -import { Kind } from './kinds'; +} from './ast.js'; +import { Kind } from './kinds.js'; export function isDefinitionNode(node: ASTNode): node is DefinitionNode { return ( diff --git a/src/language/printLocation.ts b/src/language/printLocation.ts index 3d44f5cea5..b6f9c78401 100644 --- a/src/language/printLocation.ts +++ b/src/language/printLocation.ts @@ -1,7 +1,7 @@ -import type { Location } from './ast'; -import type { SourceLocation } from './location'; -import { getLocation } from './location'; -import type { Source } from './source'; +import type { Location } from './ast.js'; +import type { SourceLocation } from './location.js'; +import { getLocation } from './location.js'; +import type { Source } from './source.js'; /** * Render a helpful description of the location in the GraphQL Source document. diff --git a/src/language/printer.ts b/src/language/printer.ts index 38cb25444b..51a05ee6d2 100644 --- a/src/language/printer.ts +++ b/src/language/printer.ts @@ -1,10 +1,10 @@ -import type { Maybe } from '../jsutils/Maybe'; +import type { Maybe } from '../jsutils/Maybe.js'; -import type { ASTNode } from './ast'; -import { printBlockString } from './blockString'; -import { printString } from './printString'; -import type { ASTReducer } from './visitor'; -import { visit } from './visitor'; +import type { ASTNode } from './ast.js'; +import { printBlockString } from './blockString.js'; +import { printString } from './printString.js'; +import type { ASTReducer } from './visitor.js'; +import { visit } from './visitor.js'; /** * Converts an AST into a string, using one set of reasonable diff --git a/src/language/source.ts b/src/language/source.ts index 15f65fceee..2263bb382e 100644 --- a/src/language/source.ts +++ b/src/language/source.ts @@ -1,6 +1,6 @@ -import { devAssert } from '../jsutils/devAssert'; -import { inspect } from '../jsutils/inspect'; -import { instanceOf } from '../jsutils/instanceOf'; +import { devAssert } from '../jsutils/devAssert.js'; +import { inspect } from '../jsutils/inspect.js'; +import { instanceOf } from '../jsutils/instanceOf.js'; interface Location { line: number; diff --git a/src/language/visitor.ts b/src/language/visitor.ts index 3b38c8a36c..5234107477 100644 --- a/src/language/visitor.ts +++ b/src/language/visitor.ts @@ -1,9 +1,9 @@ -import { devAssert } from '../jsutils/devAssert'; -import { inspect } from '../jsutils/inspect'; +import { devAssert } from '../jsutils/devAssert.js'; +import { inspect } from '../jsutils/inspect.js'; -import type { ASTNode } from './ast'; -import { isNode, QueryDocumentKeys } from './ast'; -import { Kind } from './kinds'; +import type { ASTNode } from './ast.js'; +import { isNode, QueryDocumentKeys } from './ast.js'; +import { Kind } from './kinds.js'; /** * A visitor is provided to visit, it contains the collection of diff --git a/src/type/__tests__/assertName-test.ts b/src/type/__tests__/assertName-test.ts index 268b1c6ecb..96ab8945bb 100644 --- a/src/type/__tests__/assertName-test.ts +++ b/src/type/__tests__/assertName-test.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { assertEnumValueName, assertName } from '../assertName'; +import { assertEnumValueName, assertName } from '../assertName.js'; describe('assertName', () => { it('passthrough valid name', () => { diff --git a/src/type/__tests__/definition-test.ts b/src/type/__tests__/definition-test.ts index 19d482915a..73f2a50437 100644 --- a/src/type/__tests__/definition-test.ts +++ b/src/type/__tests__/definition-test.ts @@ -1,12 +1,12 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { identityFunc } from '../../jsutils/identityFunc'; -import { inspect } from '../../jsutils/inspect'; +import { identityFunc } from '../../jsutils/identityFunc.js'; +import { inspect } from '../../jsutils/inspect.js'; -import { parseValue } from '../../language/parser'; +import { parseValue } from '../../language/parser.js'; -import type { GraphQLNullableType, GraphQLType } from '../definition'; +import type { GraphQLNullableType, GraphQLType } from '../definition.js'; import { GraphQLEnumType, GraphQLInputObjectType, @@ -16,7 +16,7 @@ import { GraphQLObjectType, GraphQLScalarType, GraphQLUnionType, -} from '../definition'; +} from '../definition.js'; const ScalarType = new GraphQLScalarType({ name: 'Scalar' }); const ObjectType = new GraphQLObjectType({ name: 'Object', fields: {} }); diff --git a/src/type/__tests__/directive-test.ts b/src/type/__tests__/directive-test.ts index 110a3cc940..34436f3268 100644 --- a/src/type/__tests__/directive-test.ts +++ b/src/type/__tests__/directive-test.ts @@ -1,10 +1,10 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { DirectiveLocation } from '../../language/directiveLocation'; +import { DirectiveLocation } from '../../language/directiveLocation.js'; -import { GraphQLDirective } from '../directives'; -import { GraphQLInt, GraphQLString } from '../scalars'; +import { GraphQLDirective } from '../directives.js'; +import { GraphQLInt, GraphQLString } from '../scalars.js'; describe('Type System: Directive', () => { it('defines a directive with no args', () => { diff --git a/src/type/__tests__/enumType-test.ts b/src/type/__tests__/enumType-test.ts index 35e9f94b00..77f36b4375 100644 --- a/src/type/__tests__/enumType-test.ts +++ b/src/type/__tests__/enumType-test.ts @@ -1,15 +1,15 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { expectJSON } from '../../__testUtils__/expectJSON'; +import { expectJSON } from '../../__testUtils__/expectJSON.js'; -import { introspectionFromSchema } from '../../utilities/introspectionFromSchema'; +import { introspectionFromSchema } from '../../utilities/introspectionFromSchema.js'; -import { graphqlSync } from '../../graphql'; +import { graphqlSync } from '../../graphql.js'; -import { GraphQLEnumType, GraphQLObjectType } from '../definition'; -import { GraphQLBoolean, GraphQLInt, GraphQLString } from '../scalars'; -import { GraphQLSchema } from '../schema'; +import { GraphQLEnumType, GraphQLObjectType } from '../definition.js'; +import { GraphQLBoolean, GraphQLInt, GraphQLString } from '../scalars.js'; +import { GraphQLSchema } from '../schema.js'; const ColorType = new GraphQLEnumType({ name: 'Color', diff --git a/src/type/__tests__/extensions-test.ts b/src/type/__tests__/extensions-test.ts index 156674dc8a..8bfdfb7b76 100644 --- a/src/type/__tests__/extensions-test.ts +++ b/src/type/__tests__/extensions-test.ts @@ -8,9 +8,9 @@ import { GraphQLObjectType, GraphQLScalarType, GraphQLUnionType, -} from '../definition'; -import { GraphQLDirective } from '../directives'; -import { GraphQLSchema } from '../schema'; +} from '../definition.js'; +import { GraphQLDirective } from '../directives.js'; +import { GraphQLSchema } from '../schema.js'; const dummyType = new GraphQLScalarType({ name: 'DummyScalar' }); diff --git a/src/type/__tests__/introspection-test.ts b/src/type/__tests__/introspection-test.ts index df431dafd3..1fa0518dd0 100644 --- a/src/type/__tests__/introspection-test.ts +++ b/src/type/__tests__/introspection-test.ts @@ -1,14 +1,14 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { expectJSON } from '../../__testUtils__/expectJSON'; +import { expectJSON } from '../../__testUtils__/expectJSON.js'; -import { buildSchema } from '../../utilities/buildASTSchema'; -import { getIntrospectionQuery } from '../../utilities/getIntrospectionQuery'; +import { buildSchema } from '../../utilities/buildASTSchema.js'; +import { getIntrospectionQuery } from '../../utilities/getIntrospectionQuery.js'; -import { graphqlSync } from '../../graphql'; +import { graphqlSync } from '../../graphql.js'; -import type { GraphQLResolveInfo } from '../definition'; +import type { GraphQLResolveInfo } from '../definition.js'; describe('Introspection', () => { it('executes an introspection query', () => { diff --git a/src/type/__tests__/predicate-test.ts b/src/type/__tests__/predicate-test.ts index 81e721e7df..f5918ac07c 100644 --- a/src/type/__tests__/predicate-test.ts +++ b/src/type/__tests__/predicate-test.ts @@ -1,13 +1,13 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { DirectiveLocation } from '../../language/directiveLocation'; +import { DirectiveLocation } from '../../language/directiveLocation.js'; import type { GraphQLArgument, GraphQLInputField, GraphQLInputType, -} from '../definition'; +} from '../definition.js'; import { assertAbstractType, assertCompositeType, @@ -55,7 +55,7 @@ import { isType, isUnionType, isWrappingType, -} from '../definition'; +} from '../definition.js'; import { assertDirective, GraphQLDeprecatedDirective, @@ -64,7 +64,7 @@ import { GraphQLSkipDirective, isDirective, isSpecifiedDirective, -} from '../directives'; +} from '../directives.js'; import { GraphQLBoolean, GraphQLFloat, @@ -72,7 +72,7 @@ import { GraphQLInt, GraphQLString, isSpecifiedScalarType, -} from '../scalars'; +} from '../scalars.js'; const ObjectType = new GraphQLObjectType({ name: 'Object', fields: {} }); const InterfaceType = new GraphQLInterfaceType({ diff --git a/src/type/__tests__/scalars-test.ts b/src/type/__tests__/scalars-test.ts index eda64afa42..45f77523dc 100644 --- a/src/type/__tests__/scalars-test.ts +++ b/src/type/__tests__/scalars-test.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { parseValue as parseValueToAST } from '../../language/parser'; +import { parseValue as parseValueToAST } from '../../language/parser.js'; import { GraphQLBoolean, @@ -9,7 +9,7 @@ import { GraphQLID, GraphQLInt, GraphQLString, -} from '../scalars'; +} from '../scalars.js'; describe('Type System: Specified scalar types', () => { describe('GraphQLInt', () => { diff --git a/src/type/__tests__/schema-test.ts b/src/type/__tests__/schema-test.ts index 652bfeeae6..7f7a9906cb 100644 --- a/src/type/__tests__/schema-test.ts +++ b/src/type/__tests__/schema-test.ts @@ -1,13 +1,13 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { dedent } from '../../__testUtils__/dedent'; +import { dedent } from '../../__testUtils__/dedent.js'; -import { DirectiveLocation } from '../../language/directiveLocation'; +import { DirectiveLocation } from '../../language/directiveLocation.js'; -import { printSchema } from '../../utilities/printSchema'; +import { printSchema } from '../../utilities/printSchema.js'; -import type { GraphQLCompositeType } from '../definition'; +import type { GraphQLCompositeType } from '../definition.js'; import { GraphQLInputObjectType, GraphQLInterfaceType, @@ -15,15 +15,15 @@ import { GraphQLObjectType, GraphQLScalarType, GraphQLUnionType, -} from '../definition'; -import { GraphQLDirective } from '../directives'; +} from '../definition.js'; +import { GraphQLDirective } from '../directives.js'; import { SchemaMetaFieldDef, TypeMetaFieldDef, TypeNameMetaFieldDef, -} from '../introspection'; -import { GraphQLBoolean, GraphQLInt, GraphQLString } from '../scalars'; -import { GraphQLSchema } from '../schema'; +} from '../introspection.js'; +import { GraphQLBoolean, GraphQLInt, GraphQLString } from '../scalars.js'; +import { GraphQLSchema } from '../schema.js'; describe('Type System: Schema', () => { it('Define sample schema', () => { diff --git a/src/type/__tests__/validation-test.ts b/src/type/__tests__/validation-test.ts index af82d30fbb..a147a7e80f 100644 --- a/src/type/__tests__/validation-test.ts +++ b/src/type/__tests__/validation-test.ts @@ -1,16 +1,16 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { dedent } from '../../__testUtils__/dedent'; -import { expectJSON } from '../../__testUtils__/expectJSON'; +import { dedent } from '../../__testUtils__/dedent.js'; +import { expectJSON } from '../../__testUtils__/expectJSON.js'; -import { inspect } from '../../jsutils/inspect'; +import { inspect } from '../../jsutils/inspect.js'; -import { DirectiveLocation } from '../../language/directiveLocation'; -import { parse } from '../../language/parser'; +import { DirectiveLocation } from '../../language/directiveLocation.js'; +import { parse } from '../../language/parser.js'; -import { buildSchema } from '../../utilities/buildASTSchema'; -import { extendSchema } from '../../utilities/extendSchema'; +import { buildSchema } from '../../utilities/buildASTSchema.js'; +import { extendSchema } from '../../utilities/extendSchema.js'; import type { GraphQLArgumentConfig, @@ -19,7 +19,7 @@ import type { GraphQLInputType, GraphQLNamedType, GraphQLOutputType, -} from '../definition'; +} from '../definition.js'; import { assertEnumType, assertInputObjectType, @@ -34,11 +34,11 @@ import { GraphQLNonNull, GraphQLObjectType, GraphQLUnionType, -} from '../definition'; -import { assertDirective, GraphQLDirective } from '../directives'; -import { GraphQLString } from '../scalars'; -import { GraphQLSchema } from '../schema'; -import { assertValidSchema, validateSchema } from '../validate'; +} from '../definition.js'; +import { assertDirective, GraphQLDirective } from '../directives.js'; +import { GraphQLString } from '../scalars.js'; +import { GraphQLSchema } from '../schema.js'; +import { assertValidSchema, validateSchema } from '../validate.js'; const SomeSchema = buildSchema(` scalar SomeScalar diff --git a/src/type/assertName.ts b/src/type/assertName.ts index f4f96fda4e..6465af00d0 100644 --- a/src/type/assertName.ts +++ b/src/type/assertName.ts @@ -1,8 +1,8 @@ -import { devAssert } from '../jsutils/devAssert'; +import { devAssert } from '../jsutils/devAssert.js'; -import { GraphQLError } from '../error/GraphQLError'; +import { GraphQLError } from '../error/GraphQLError.js'; -import { isNameContinue, isNameStart } from '../language/characterClasses'; +import { isNameContinue, isNameStart } from '../language/characterClasses.js'; /** * Upholds the spec rules about naming. diff --git a/src/type/definition.ts b/src/type/definition.ts index 9eea02e8ea..b9256455cf 100644 --- a/src/type/definition.ts +++ b/src/type/definition.ts @@ -1,20 +1,20 @@ -import { devAssert } from '../jsutils/devAssert'; -import { didYouMean } from '../jsutils/didYouMean'; -import { identityFunc } from '../jsutils/identityFunc'; -import { inspect } from '../jsutils/inspect'; -import { instanceOf } from '../jsutils/instanceOf'; -import { isObjectLike } from '../jsutils/isObjectLike'; -import { keyMap } from '../jsutils/keyMap'; -import { keyValMap } from '../jsutils/keyValMap'; -import { mapValue } from '../jsutils/mapValue'; -import type { Maybe } from '../jsutils/Maybe'; -import type { ObjMap } from '../jsutils/ObjMap'; -import type { Path } from '../jsutils/Path'; -import type { PromiseOrValue } from '../jsutils/PromiseOrValue'; -import { suggestionList } from '../jsutils/suggestionList'; -import { toObjMap } from '../jsutils/toObjMap'; - -import { GraphQLError } from '../error/GraphQLError'; +import { devAssert } from '../jsutils/devAssert.js'; +import { didYouMean } from '../jsutils/didYouMean.js'; +import { identityFunc } from '../jsutils/identityFunc.js'; +import { inspect } from '../jsutils/inspect.js'; +import { instanceOf } from '../jsutils/instanceOf.js'; +import { isObjectLike } from '../jsutils/isObjectLike.js'; +import { keyMap } from '../jsutils/keyMap.js'; +import { keyValMap } from '../jsutils/keyValMap.js'; +import { mapValue } from '../jsutils/mapValue.js'; +import type { Maybe } from '../jsutils/Maybe.js'; +import type { ObjMap } from '../jsutils/ObjMap.js'; +import type { Path } from '../jsutils/Path.js'; +import type { PromiseOrValue } from '../jsutils/PromiseOrValue.js'; +import { suggestionList } from '../jsutils/suggestionList.js'; +import { toObjMap } from '../jsutils/toObjMap.js'; + +import { GraphQLError } from '../error/GraphQLError.js'; import type { EnumTypeDefinitionNode, @@ -36,14 +36,14 @@ import type { UnionTypeDefinitionNode, UnionTypeExtensionNode, ValueNode, -} from '../language/ast'; -import { Kind } from '../language/kinds'; -import { print } from '../language/printer'; +} from '../language/ast.js'; +import { Kind } from '../language/kinds.js'; +import { print } from '../language/printer.js'; -import { valueFromASTUntyped } from '../utilities/valueFromASTUntyped'; +import { valueFromASTUntyped } from '../utilities/valueFromASTUntyped.js'; -import { assertEnumValueName, assertName } from './assertName'; -import type { GraphQLSchema } from './schema'; +import { assertEnumValueName, assertName } from './assertName.js'; +import type { GraphQLSchema } from './schema.js'; // Predicates & Assertions diff --git a/src/type/directives.ts b/src/type/directives.ts index bb3e441a43..4628a508ee 100644 --- a/src/type/directives.ts +++ b/src/type/directives.ts @@ -1,24 +1,24 @@ -import { devAssert } from '../jsutils/devAssert'; -import { inspect } from '../jsutils/inspect'; -import { instanceOf } from '../jsutils/instanceOf'; -import { isObjectLike } from '../jsutils/isObjectLike'; -import type { Maybe } from '../jsutils/Maybe'; -import { toObjMap } from '../jsutils/toObjMap'; +import { devAssert } from '../jsutils/devAssert.js'; +import { inspect } from '../jsutils/inspect.js'; +import { instanceOf } from '../jsutils/instanceOf.js'; +import { isObjectLike } from '../jsutils/isObjectLike.js'; +import type { Maybe } from '../jsutils/Maybe.js'; +import { toObjMap } from '../jsutils/toObjMap.js'; -import type { DirectiveDefinitionNode } from '../language/ast'; -import { DirectiveLocation } from '../language/directiveLocation'; +import type { DirectiveDefinitionNode } from '../language/ast.js'; +import { DirectiveLocation } from '../language/directiveLocation.js'; -import { assertName } from './assertName'; +import { assertName } from './assertName.js'; import type { GraphQLArgument, GraphQLFieldConfigArgumentMap, -} from './definition'; +} from './definition.js'; import { argsToArgsConfig, defineArguments, GraphQLNonNull, -} from './definition'; -import { GraphQLBoolean, GraphQLString } from './scalars'; +} from './definition.js'; +import { GraphQLBoolean, GraphQLString } from './scalars.js'; /** * Test if the given value is a GraphQL directive. diff --git a/src/type/index.ts b/src/type/index.ts index 43b867f999..be8d30e06f 100644 --- a/src/type/index.ts +++ b/src/type/index.ts @@ -1,4 +1,4 @@ -export type { Path as ResponsePath } from '../jsutils/Path'; +export type { Path as ResponsePath } from '../jsutils/Path.js'; export { // Predicate @@ -7,8 +7,8 @@ export { assertSchema, // GraphQL Schema definition GraphQLSchema, -} from './schema'; -export type { GraphQLSchemaConfig, GraphQLSchemaExtensions } from './schema'; +} from './schema.js'; +export type { GraphQLSchemaConfig, GraphQLSchemaExtensions } from './schema.js'; export { resolveObjMapThunk, @@ -64,7 +64,7 @@ export { // Type Wrappers GraphQLList, GraphQLNonNull, -} from './definition'; +} from './definition.js'; export type { GraphQLType, @@ -119,7 +119,7 @@ export type { GraphQLScalarSerializer, GraphQLScalarValueParser, GraphQLScalarLiteralParser, -} from './definition'; +} from './definition.js'; export { // Predicate @@ -137,12 +137,12 @@ export { GraphQLSpecifiedByDirective, // Constant Deprecation Reason DEFAULT_DEPRECATION_REASON, -} from './directives'; +} from './directives.js'; export type { GraphQLDirectiveConfig, GraphQLDirectiveExtensions, -} from './directives'; +} from './directives.js'; // Common built-in scalar instances. export { @@ -158,7 +158,7 @@ export { // Int boundaries constants GRAPHQL_MAX_INT, GRAPHQL_MIN_INT, -} from './scalars'; +} from './scalars.js'; export { // Predicate @@ -179,10 +179,10 @@ export { SchemaMetaFieldDef, TypeMetaFieldDef, TypeNameMetaFieldDef, -} from './introspection'; +} from './introspection.js'; // Validate GraphQL schema. -export { validateSchema, assertValidSchema } from './validate'; +export { validateSchema, assertValidSchema } from './validate.js'; // Upholds the spec rules about naming. -export { assertName, assertEnumValueName } from './assertName'; +export { assertName, assertEnumValueName } from './assertName.js'; diff --git a/src/type/introspection.ts b/src/type/introspection.ts index e5fce6f241..aedce3e6a8 100644 --- a/src/type/introspection.ts +++ b/src/type/introspection.ts @@ -1,10 +1,10 @@ -import { inspect } from '../jsutils/inspect'; -import { invariant } from '../jsutils/invariant'; +import { inspect } from '../jsutils/inspect.js'; +import { invariant } from '../jsutils/invariant.js'; -import { DirectiveLocation } from '../language/directiveLocation'; -import { print } from '../language/printer'; +import { DirectiveLocation } from '../language/directiveLocation.js'; +import { print } from '../language/printer.js'; -import { astFromValue } from '../utilities/astFromValue'; +import { astFromValue } from '../utilities/astFromValue.js'; import type { GraphQLEnumValue, @@ -13,7 +13,7 @@ import type { GraphQLInputField, GraphQLNamedType, GraphQLType, -} from './definition'; +} from './definition.js'; import { GraphQLEnumType, GraphQLList, @@ -28,10 +28,10 @@ import { isObjectType, isScalarType, isUnionType, -} from './definition'; -import type { GraphQLDirective } from './directives'; -import { GraphQLBoolean, GraphQLString } from './scalars'; -import type { GraphQLSchema } from './schema'; +} from './definition.js'; +import type { GraphQLDirective } from './directives.js'; +import { GraphQLBoolean, GraphQLString } from './scalars.js'; +import type { GraphQLSchema } from './schema.js'; export const __Schema: GraphQLObjectType = new GraphQLObjectType({ name: '__Schema', diff --git a/src/type/scalars.ts b/src/type/scalars.ts index 56e40bc98c..d2c9c9bee2 100644 --- a/src/type/scalars.ts +++ b/src/type/scalars.ts @@ -1,13 +1,13 @@ -import { inspect } from '../jsutils/inspect'; -import { isObjectLike } from '../jsutils/isObjectLike'; +import { inspect } from '../jsutils/inspect.js'; +import { isObjectLike } from '../jsutils/isObjectLike.js'; -import { GraphQLError } from '../error/GraphQLError'; +import { GraphQLError } from '../error/GraphQLError.js'; -import { Kind } from '../language/kinds'; -import { print } from '../language/printer'; +import { Kind } from '../language/kinds.js'; +import { print } from '../language/printer.js'; -import type { GraphQLNamedType } from './definition'; -import { GraphQLScalarType } from './definition'; +import type { GraphQLNamedType } from './definition.js'; +import { GraphQLScalarType } from './definition.js'; /** * Maximum possible Int value as per GraphQL Spec (32-bit signed integer). diff --git a/src/type/schema.ts b/src/type/schema.ts index 7cc576a18f..2ae594b864 100644 --- a/src/type/schema.ts +++ b/src/type/schema.ts @@ -1,18 +1,18 @@ -import { devAssert } from '../jsutils/devAssert'; -import { inspect } from '../jsutils/inspect'; -import { instanceOf } from '../jsutils/instanceOf'; -import { isObjectLike } from '../jsutils/isObjectLike'; -import type { Maybe } from '../jsutils/Maybe'; -import type { ObjMap } from '../jsutils/ObjMap'; -import { toObjMap } from '../jsutils/toObjMap'; +import { devAssert } from '../jsutils/devAssert.js'; +import { inspect } from '../jsutils/inspect.js'; +import { instanceOf } from '../jsutils/instanceOf.js'; +import { isObjectLike } from '../jsutils/isObjectLike.js'; +import type { Maybe } from '../jsutils/Maybe.js'; +import type { ObjMap } from '../jsutils/ObjMap.js'; +import { toObjMap } from '../jsutils/toObjMap.js'; -import type { GraphQLError } from '../error/GraphQLError'; +import type { GraphQLError } from '../error/GraphQLError.js'; import type { SchemaDefinitionNode, SchemaExtensionNode, -} from '../language/ast'; -import { OperationTypeNode } from '../language/ast'; +} from '../language/ast.js'; +import { OperationTypeNode } from '../language/ast.js'; import type { GraphQLAbstractType, @@ -22,22 +22,22 @@ import type { GraphQLNamedType, GraphQLObjectType, GraphQLType, -} from './definition'; +} from './definition.js'; import { getNamedType, isInputObjectType, isInterfaceType, isObjectType, isUnionType, -} from './definition'; -import type { GraphQLDirective } from './directives'; -import { isDirective, specifiedDirectives } from './directives'; +} from './definition.js'; +import type { GraphQLDirective } from './directives.js'; +import { isDirective, specifiedDirectives } from './directives.js'; import { __Schema, SchemaMetaFieldDef, TypeMetaFieldDef, TypeNameMetaFieldDef, -} from './introspection'; +} from './introspection.js'; /** * Test if the given value is a GraphQL schema. diff --git a/src/type/validate.ts b/src/type/validate.ts index c6385d27fb..b8540361db 100644 --- a/src/type/validate.ts +++ b/src/type/validate.ts @@ -1,10 +1,10 @@ -import { AccumulatorMap } from '../jsutils/AccumulatorMap'; -import { capitalize } from '../jsutils/capitalize'; -import { andList } from '../jsutils/formatList'; -import { inspect } from '../jsutils/inspect'; -import type { Maybe } from '../jsutils/Maybe'; +import { AccumulatorMap } from '../jsutils/AccumulatorMap.js'; +import { capitalize } from '../jsutils/capitalize.js'; +import { andList } from '../jsutils/formatList.js'; +import { inspect } from '../jsutils/inspect.js'; +import type { Maybe } from '../jsutils/Maybe.js'; -import { GraphQLError } from '../error/GraphQLError'; +import { GraphQLError } from '../error/GraphQLError.js'; import type { ASTNode, @@ -16,10 +16,10 @@ import type { ObjectTypeExtensionNode, UnionTypeDefinitionNode, UnionTypeExtensionNode, -} from '../language/ast'; -import { OperationTypeNode } from '../language/ast'; +} from '../language/ast.js'; +import { OperationTypeNode } from '../language/ast.js'; -import { isEqualType, isTypeSubTypeOf } from '../utilities/typeComparators'; +import { isEqualType, isTypeSubTypeOf } from '../utilities/typeComparators.js'; import type { GraphQLEnumType, @@ -28,7 +28,7 @@ import type { GraphQLInterfaceType, GraphQLObjectType, GraphQLUnionType, -} from './definition'; +} from './definition.js'; import { isEnumType, isInputObjectType, @@ -41,11 +41,11 @@ import { isRequiredArgument, isRequiredInputField, isUnionType, -} from './definition'; -import { GraphQLDeprecatedDirective, isDirective } from './directives'; -import { isIntrospectionType } from './introspection'; -import type { GraphQLSchema } from './schema'; -import { assertSchema } from './schema'; +} from './definition.js'; +import { GraphQLDeprecatedDirective, isDirective } from './directives.js'; +import { isIntrospectionType } from './introspection.js'; +import type { GraphQLSchema } from './schema.js'; +import { assertSchema } from './schema.js'; /** * Implements the "Type Validation" sub-sections of the specification's diff --git a/src/utilities/TypeInfo.ts b/src/utilities/TypeInfo.ts index aff849ff64..fe8ea1fbab 100644 --- a/src/utilities/TypeInfo.ts +++ b/src/utilities/TypeInfo.ts @@ -1,10 +1,10 @@ -import type { Maybe } from '../jsutils/Maybe'; +import type { Maybe } from '../jsutils/Maybe.js'; -import type { ASTNode, FieldNode } from '../language/ast'; -import { isNode } from '../language/ast'; -import { Kind } from '../language/kinds'; -import type { ASTVisitor } from '../language/visitor'; -import { getEnterLeaveForKind } from '../language/visitor'; +import type { ASTNode, FieldNode } from '../language/ast.js'; +import { isNode } from '../language/ast.js'; +import { Kind } from '../language/kinds.js'; +import type { ASTVisitor } from '../language/visitor.js'; +import { getEnterLeaveForKind } from '../language/visitor.js'; import type { GraphQLArgument, @@ -15,7 +15,7 @@ import type { GraphQLInputType, GraphQLOutputType, GraphQLType, -} from '../type/definition'; +} from '../type/definition.js'; import { getNamedType, getNullableType, @@ -26,11 +26,11 @@ import { isListType, isObjectType, isOutputType, -} from '../type/definition'; -import type { GraphQLDirective } from '../type/directives'; -import type { GraphQLSchema } from '../type/schema'; +} from '../type/definition.js'; +import type { GraphQLDirective } from '../type/directives.js'; +import type { GraphQLSchema } from '../type/schema.js'; -import { typeFromAST } from './typeFromAST'; +import { typeFromAST } from './typeFromAST.js'; /** * TypeInfo is a utility class which, given a GraphQL schema, can keep track diff --git a/src/utilities/__tests__/TypeInfo-test.ts b/src/utilities/__tests__/TypeInfo-test.ts index 154ee2516b..971316f8b4 100644 --- a/src/utilities/__tests__/TypeInfo-test.ts +++ b/src/utilities/__tests__/TypeInfo-test.ts @@ -1,15 +1,15 @@ import { assert, expect } from 'chai'; import { describe, it } from 'mocha'; -import { parse, parseValue } from '../../language/parser'; -import { print } from '../../language/printer'; -import { visit } from '../../language/visitor'; +import { parse, parseValue } from '../../language/parser.js'; +import { print } from '../../language/printer.js'; +import { visit } from '../../language/visitor.js'; -import { getNamedType, isCompositeType } from '../../type/definition'; -import { GraphQLSchema } from '../../type/schema'; +import { getNamedType, isCompositeType } from '../../type/definition.js'; +import { GraphQLSchema } from '../../type/schema.js'; -import { buildSchema } from '../buildASTSchema'; -import { TypeInfo, visitWithTypeInfo } from '../TypeInfo'; +import { buildSchema } from '../buildASTSchema.js'; +import { TypeInfo, visitWithTypeInfo } from '../TypeInfo.js'; const testSchema = buildSchema(` interface Pet { diff --git a/src/utilities/__tests__/astFromValue-test.ts b/src/utilities/__tests__/astFromValue-test.ts index b8f2361bd7..0f9d474256 100644 --- a/src/utilities/__tests__/astFromValue-test.ts +++ b/src/utilities/__tests__/astFromValue-test.ts @@ -7,16 +7,16 @@ import { GraphQLList, GraphQLNonNull, GraphQLScalarType, -} from '../../type/definition'; +} from '../../type/definition.js'; import { GraphQLBoolean, GraphQLFloat, GraphQLID, GraphQLInt, GraphQLString, -} from '../../type/scalars'; +} from '../../type/scalars.js'; -import { astFromValue } from '../astFromValue'; +import { astFromValue } from '../astFromValue.js'; describe('astFromValue', () => { it('converts boolean values to ASTs', () => { diff --git a/src/utilities/__tests__/buildASTSchema-test.ts b/src/utilities/__tests__/buildASTSchema-test.ts index 32658c13d6..4e7abdd395 100644 --- a/src/utilities/__tests__/buildASTSchema-test.ts +++ b/src/utilities/__tests__/buildASTSchema-test.ts @@ -1,14 +1,14 @@ import { assert, expect } from 'chai'; import { describe, it } from 'mocha'; -import { dedent } from '../../__testUtils__/dedent'; +import { dedent } from '../../__testUtils__/dedent.js'; -import type { Maybe } from '../../jsutils/Maybe'; +import type { Maybe } from '../../jsutils/Maybe.js'; -import type { ASTNode } from '../../language/ast'; -import { Kind } from '../../language/kinds'; -import { parse } from '../../language/parser'; -import { print } from '../../language/printer'; +import type { ASTNode } from '../../language/ast.js'; +import { Kind } from '../../language/kinds.js'; +import { parse } from '../../language/parser.js'; +import { print } from '../../language/printer.js'; import { assertEnumType, @@ -17,29 +17,29 @@ import { assertObjectType, assertScalarType, assertUnionType, -} from '../../type/definition'; +} from '../../type/definition.js'; import { assertDirective, GraphQLDeprecatedDirective, GraphQLIncludeDirective, GraphQLSkipDirective, GraphQLSpecifiedByDirective, -} from '../../type/directives'; -import { __EnumValue, __Schema } from '../../type/introspection'; +} from '../../type/directives.js'; +import { __EnumValue, __Schema } from '../../type/introspection.js'; import { GraphQLBoolean, GraphQLFloat, GraphQLID, GraphQLInt, GraphQLString, -} from '../../type/scalars'; -import { GraphQLSchema } from '../../type/schema'; -import { validateSchema } from '../../type/validate'; +} from '../../type/scalars.js'; +import { GraphQLSchema } from '../../type/schema.js'; +import { validateSchema } from '../../type/validate.js'; -import { graphqlSync } from '../../graphql'; +import { graphqlSync } from '../../graphql.js'; -import { buildASTSchema, buildSchema } from '../buildASTSchema'; -import { printSchema, printType } from '../printSchema'; +import { buildASTSchema, buildSchema } from '../buildASTSchema.js'; +import { printSchema, printType } from '../printSchema.js'; /** * This function does a full cycle of going from a string with the contents of diff --git a/src/utilities/__tests__/buildClientSchema-test.ts b/src/utilities/__tests__/buildClientSchema-test.ts index 8c043f0e77..99c9222607 100644 --- a/src/utilities/__tests__/buildClientSchema-test.ts +++ b/src/utilities/__tests__/buildClientSchema-test.ts @@ -1,28 +1,28 @@ import { assert, expect } from 'chai'; import { describe, it } from 'mocha'; -import { dedent } from '../../__testUtils__/dedent'; +import { dedent } from '../../__testUtils__/dedent.js'; import { assertEnumType, GraphQLEnumType, GraphQLObjectType, -} from '../../type/definition'; +} from '../../type/definition.js'; import { GraphQLBoolean, GraphQLFloat, GraphQLID, GraphQLInt, GraphQLString, -} from '../../type/scalars'; -import { GraphQLSchema } from '../../type/schema'; +} from '../../type/scalars.js'; +import { GraphQLSchema } from '../../type/schema.js'; -import { graphqlSync } from '../../graphql'; +import { graphqlSync } from '../../graphql.js'; -import { buildSchema } from '../buildASTSchema'; -import { buildClientSchema } from '../buildClientSchema'; -import { introspectionFromSchema } from '../introspectionFromSchema'; -import { printSchema } from '../printSchema'; +import { buildSchema } from '../buildASTSchema.js'; +import { buildClientSchema } from '../buildClientSchema.js'; +import { introspectionFromSchema } from '../introspectionFromSchema.js'; +import { printSchema } from '../printSchema.js'; /** * This function does a full cycle of going from a string with the contents of diff --git a/src/utilities/__tests__/coerceInputValue-test.ts b/src/utilities/__tests__/coerceInputValue-test.ts index a73cdc6116..1017737732 100644 --- a/src/utilities/__tests__/coerceInputValue-test.ts +++ b/src/utilities/__tests__/coerceInputValue-test.ts @@ -1,17 +1,17 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import type { GraphQLInputType } from '../../type/definition'; +import type { GraphQLInputType } from '../../type/definition.js'; import { GraphQLEnumType, GraphQLInputObjectType, GraphQLList, GraphQLNonNull, GraphQLScalarType, -} from '../../type/definition'; -import { GraphQLInt } from '../../type/scalars'; +} from '../../type/definition.js'; +import { GraphQLInt } from '../../type/scalars.js'; -import { coerceInputValue } from '../coerceInputValue'; +import { coerceInputValue } from '../coerceInputValue.js'; interface CoerceResult { value: unknown; diff --git a/src/utilities/__tests__/concatAST-test.ts b/src/utilities/__tests__/concatAST-test.ts index 622abd6b38..95d9a59e08 100644 --- a/src/utilities/__tests__/concatAST-test.ts +++ b/src/utilities/__tests__/concatAST-test.ts @@ -1,13 +1,13 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { dedent } from '../../__testUtils__/dedent'; +import { dedent } from '../../__testUtils__/dedent.js'; -import { parse } from '../../language/parser'; -import { print } from '../../language/printer'; -import { Source } from '../../language/source'; +import { parse } from '../../language/parser.js'; +import { print } from '../../language/printer.js'; +import { Source } from '../../language/source.js'; -import { concatAST } from '../concatAST'; +import { concatAST } from '../concatAST.js'; describe('concatAST', () => { it('concatenates two ASTs together', () => { diff --git a/src/utilities/__tests__/extendSchema-test.ts b/src/utilities/__tests__/extendSchema-test.ts index 2f4f80e6bc..fc1a28ce03 100644 --- a/src/utilities/__tests__/extendSchema-test.ts +++ b/src/utilities/__tests__/extendSchema-test.ts @@ -1,13 +1,13 @@ import { assert, expect } from 'chai'; import { describe, it } from 'mocha'; -import { dedent } from '../../__testUtils__/dedent'; +import { dedent } from '../../__testUtils__/dedent.js'; -import type { Maybe } from '../../jsutils/Maybe'; +import type { Maybe } from '../../jsutils/Maybe.js'; -import type { ASTNode } from '../../language/ast'; -import { parse } from '../../language/parser'; -import { print } from '../../language/printer'; +import type { ASTNode } from '../../language/ast.js'; +import { parse } from '../../language/parser.js'; +import { print } from '../../language/printer.js'; import { assertEnumType, @@ -16,24 +16,24 @@ import { assertObjectType, assertScalarType, assertUnionType, -} from '../../type/definition'; -import { assertDirective } from '../../type/directives'; +} from '../../type/definition.js'; +import { assertDirective } from '../../type/directives.js'; import { GraphQLBoolean, GraphQLFloat, GraphQLID, GraphQLInt, GraphQLString, -} from '../../type/scalars'; -import { GraphQLSchema } from '../../type/schema'; -import { validateSchema } from '../../type/validate'; +} from '../../type/scalars.js'; +import { GraphQLSchema } from '../../type/schema.js'; +import { validateSchema } from '../../type/validate.js'; -import { graphqlSync } from '../../graphql'; +import { graphqlSync } from '../../graphql.js'; -import { buildSchema } from '../buildASTSchema'; -import { concatAST } from '../concatAST'; -import { extendSchema } from '../extendSchema'; -import { printSchema } from '../printSchema'; +import { buildSchema } from '../buildASTSchema.js'; +import { concatAST } from '../concatAST.js'; +import { extendSchema } from '../extendSchema.js'; +import { printSchema } from '../printSchema.js'; function expectExtensionASTNodes(obj: { readonly extensionASTNodes: ReadonlyArray; diff --git a/src/utilities/__tests__/findBreakingChanges-test.ts b/src/utilities/__tests__/findBreakingChanges-test.ts index 6c26e24ad0..dbd19cb893 100644 --- a/src/utilities/__tests__/findBreakingChanges-test.ts +++ b/src/utilities/__tests__/findBreakingChanges-test.ts @@ -6,16 +6,16 @@ import { GraphQLIncludeDirective, GraphQLSkipDirective, GraphQLSpecifiedByDirective, -} from '../../type/directives'; -import { GraphQLSchema } from '../../type/schema'; +} from '../../type/directives.js'; +import { GraphQLSchema } from '../../type/schema.js'; -import { buildSchema } from '../buildASTSchema'; +import { buildSchema } from '../buildASTSchema.js'; import { BreakingChangeType, DangerousChangeType, findBreakingChanges, findDangerousChanges, -} from '../findBreakingChanges'; +} from '../findBreakingChanges.js'; describe('findBreakingChanges', () => { it('should detect if a type was removed or not', () => { diff --git a/src/utilities/__tests__/getIntrospectionQuery-test.ts b/src/utilities/__tests__/getIntrospectionQuery-test.ts index e2f5595b3c..62f64c968e 100644 --- a/src/utilities/__tests__/getIntrospectionQuery-test.ts +++ b/src/utilities/__tests__/getIntrospectionQuery-test.ts @@ -1,13 +1,13 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { parse } from '../../language/parser'; +import { parse } from '../../language/parser.js'; -import { validate } from '../../validation/validate'; +import { validate } from '../../validation/validate.js'; -import { buildSchema } from '../buildASTSchema'; -import type { IntrospectionOptions } from '../getIntrospectionQuery'; -import { getIntrospectionQuery } from '../getIntrospectionQuery'; +import { buildSchema } from '../buildASTSchema.js'; +import type { IntrospectionOptions } from '../getIntrospectionQuery.js'; +import { getIntrospectionQuery } from '../getIntrospectionQuery.js'; const dummySchema = buildSchema(` type Query { diff --git a/src/utilities/__tests__/getOperationAST-test.ts b/src/utilities/__tests__/getOperationAST-test.ts index 029dd7706e..69e9df96de 100644 --- a/src/utilities/__tests__/getOperationAST-test.ts +++ b/src/utilities/__tests__/getOperationAST-test.ts @@ -1,9 +1,9 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { parse } from '../../language/parser'; +import { parse } from '../../language/parser.js'; -import { getOperationAST } from '../getOperationAST'; +import { getOperationAST } from '../getOperationAST.js'; describe('getOperationAST', () => { it('Gets an operation from a simple document', () => { diff --git a/src/utilities/__tests__/introspectionFromSchema-test.ts b/src/utilities/__tests__/introspectionFromSchema-test.ts index 2ba66348d3..15ba9bdcb5 100644 --- a/src/utilities/__tests__/introspectionFromSchema-test.ts +++ b/src/utilities/__tests__/introspectionFromSchema-test.ts @@ -1,16 +1,16 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { dedent } from '../../__testUtils__/dedent'; +import { dedent } from '../../__testUtils__/dedent.js'; -import { GraphQLObjectType } from '../../type/definition'; -import { GraphQLString } from '../../type/scalars'; -import { GraphQLSchema } from '../../type/schema'; +import { GraphQLObjectType } from '../../type/definition.js'; +import { GraphQLString } from '../../type/scalars.js'; +import { GraphQLSchema } from '../../type/schema.js'; -import { buildClientSchema } from '../buildClientSchema'; -import type { IntrospectionQuery } from '../getIntrospectionQuery'; -import { introspectionFromSchema } from '../introspectionFromSchema'; -import { printSchema } from '../printSchema'; +import { buildClientSchema } from '../buildClientSchema.js'; +import type { IntrospectionQuery } from '../getIntrospectionQuery.js'; +import { introspectionFromSchema } from '../introspectionFromSchema.js'; +import { printSchema } from '../printSchema.js'; function introspectionToSDL(introspection: IntrospectionQuery): string { return printSchema(buildClientSchema(introspection)); diff --git a/src/utilities/__tests__/lexicographicSortSchema-test.ts b/src/utilities/__tests__/lexicographicSortSchema-test.ts index bce12e3ac5..d43d81f30c 100644 --- a/src/utilities/__tests__/lexicographicSortSchema-test.ts +++ b/src/utilities/__tests__/lexicographicSortSchema-test.ts @@ -1,11 +1,11 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { dedent } from '../../__testUtils__/dedent'; +import { dedent } from '../../__testUtils__/dedent.js'; -import { buildSchema } from '../buildASTSchema'; -import { lexicographicSortSchema } from '../lexicographicSortSchema'; -import { printSchema } from '../printSchema'; +import { buildSchema } from '../buildASTSchema.js'; +import { lexicographicSortSchema } from '../lexicographicSortSchema.js'; +import { printSchema } from '../printSchema.js'; function sortSDL(sdl: string): string { const schema = buildSchema(sdl); diff --git a/src/utilities/__tests__/printSchema-test.ts b/src/utilities/__tests__/printSchema-test.ts index d09153a2e6..1608cfc644 100644 --- a/src/utilities/__tests__/printSchema-test.ts +++ b/src/utilities/__tests__/printSchema-test.ts @@ -1,11 +1,11 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { dedent, dedentString } from '../../__testUtils__/dedent'; +import { dedent, dedentString } from '../../__testUtils__/dedent.js'; -import { DirectiveLocation } from '../../language/directiveLocation'; +import { DirectiveLocation } from '../../language/directiveLocation.js'; -import type { GraphQLFieldConfig } from '../../type/definition'; +import type { GraphQLFieldConfig } from '../../type/definition.js'; import { GraphQLEnumType, GraphQLInputObjectType, @@ -15,13 +15,17 @@ import { GraphQLObjectType, GraphQLScalarType, GraphQLUnionType, -} from '../../type/definition'; -import { GraphQLDirective } from '../../type/directives'; -import { GraphQLBoolean, GraphQLInt, GraphQLString } from '../../type/scalars'; -import { GraphQLSchema } from '../../type/schema'; - -import { buildSchema } from '../buildASTSchema'; -import { printIntrospectionSchema, printSchema } from '../printSchema'; +} from '../../type/definition.js'; +import { GraphQLDirective } from '../../type/directives.js'; +import { + GraphQLBoolean, + GraphQLInt, + GraphQLString, +} from '../../type/scalars.js'; +import { GraphQLSchema } from '../../type/schema.js'; + +import { buildSchema } from '../buildASTSchema.js'; +import { printIntrospectionSchema, printSchema } from '../printSchema.js'; function expectPrintedSchema(schema: GraphQLSchema) { const schemaText = printSchema(schema); diff --git a/src/utilities/__tests__/separateOperations-test.ts b/src/utilities/__tests__/separateOperations-test.ts index 2f14bae9ac..4604f005ee 100644 --- a/src/utilities/__tests__/separateOperations-test.ts +++ b/src/utilities/__tests__/separateOperations-test.ts @@ -1,14 +1,14 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { dedent } from '../../__testUtils__/dedent'; +import { dedent } from '../../__testUtils__/dedent.js'; -import { mapValue } from '../../jsutils/mapValue'; +import { mapValue } from '../../jsutils/mapValue.js'; -import { parse } from '../../language/parser'; -import { print } from '../../language/printer'; +import { parse } from '../../language/parser.js'; +import { print } from '../../language/printer.js'; -import { separateOperations } from '../separateOperations'; +import { separateOperations } from '../separateOperations.js'; describe('separateOperations', () => { it('separates one AST into multiple, maintaining document order', () => { diff --git a/src/utilities/__tests__/sortValueNode-test.ts b/src/utilities/__tests__/sortValueNode-test.ts index c55a9be912..91454bc6ac 100644 --- a/src/utilities/__tests__/sortValueNode-test.ts +++ b/src/utilities/__tests__/sortValueNode-test.ts @@ -1,10 +1,10 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { parseValue } from '../../language/parser'; -import { print } from '../../language/printer'; +import { parseValue } from '../../language/parser.js'; +import { print } from '../../language/printer.js'; -import { sortValueNode } from '../sortValueNode'; +import { sortValueNode } from '../sortValueNode.js'; describe('sortValueNode', () => { function expectSortedValue(source: string) { diff --git a/src/utilities/__tests__/stripIgnoredCharacters-fuzz.ts b/src/utilities/__tests__/stripIgnoredCharacters-fuzz.ts index 36ef6604d6..bc4f2a9f3d 100644 --- a/src/utilities/__tests__/stripIgnoredCharacters-fuzz.ts +++ b/src/utilities/__tests__/stripIgnoredCharacters-fuzz.ts @@ -1,14 +1,14 @@ import { assert } from 'chai'; import { describe, it } from 'mocha'; -import { dedent } from '../../__testUtils__/dedent'; -import { genFuzzStrings } from '../../__testUtils__/genFuzzStrings'; -import { inspectStr } from '../../__testUtils__/inspectStr'; +import { dedent } from '../../__testUtils__/dedent.js'; +import { genFuzzStrings } from '../../__testUtils__/genFuzzStrings.js'; +import { inspectStr } from '../../__testUtils__/inspectStr.js'; -import { Lexer } from '../../language/lexer'; -import { Source } from '../../language/source'; +import { Lexer } from '../../language/lexer.js'; +import { Source } from '../../language/source.js'; -import { stripIgnoredCharacters } from '../stripIgnoredCharacters'; +import { stripIgnoredCharacters } from '../stripIgnoredCharacters.js'; const ignoredTokens = [ // UnicodeBOM :: diff --git a/src/utilities/__tests__/stripIgnoredCharacters-test.ts b/src/utilities/__tests__/stripIgnoredCharacters-test.ts index caf6529bbf..f334810582 100644 --- a/src/utilities/__tests__/stripIgnoredCharacters-test.ts +++ b/src/utilities/__tests__/stripIgnoredCharacters-test.ts @@ -1,17 +1,17 @@ import { assert, expect } from 'chai'; import { describe, it } from 'mocha'; -import { dedent } from '../../__testUtils__/dedent'; -import { kitchenSinkQuery } from '../../__testUtils__/kitchenSinkQuery'; -import { kitchenSinkSDL } from '../../__testUtils__/kitchenSinkSDL'; +import { dedent } from '../../__testUtils__/dedent.js'; +import { kitchenSinkQuery } from '../../__testUtils__/kitchenSinkQuery.js'; +import { kitchenSinkSDL } from '../../__testUtils__/kitchenSinkSDL.js'; -import type { Maybe } from '../../jsutils/Maybe'; +import type { Maybe } from '../../jsutils/Maybe.js'; -import { Lexer } from '../../language/lexer'; -import { parse } from '../../language/parser'; -import { Source } from '../../language/source'; +import { Lexer } from '../../language/lexer.js'; +import { parse } from '../../language/parser.js'; +import { Source } from '../../language/source.js'; -import { stripIgnoredCharacters } from '../stripIgnoredCharacters'; +import { stripIgnoredCharacters } from '../stripIgnoredCharacters.js'; function lexValue(str: string): Maybe { const lexer = new Lexer(new Source(str)); diff --git a/src/utilities/__tests__/typeComparators-test.ts b/src/utilities/__tests__/typeComparators-test.ts index f2709bf740..571f5aa730 100644 --- a/src/utilities/__tests__/typeComparators-test.ts +++ b/src/utilities/__tests__/typeComparators-test.ts @@ -1,18 +1,18 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import type { GraphQLFieldConfigMap } from '../../type/definition'; +import type { GraphQLFieldConfigMap } from '../../type/definition.js'; import { GraphQLInterfaceType, GraphQLList, GraphQLNonNull, GraphQLObjectType, GraphQLUnionType, -} from '../../type/definition'; -import { GraphQLFloat, GraphQLInt, GraphQLString } from '../../type/scalars'; -import { GraphQLSchema } from '../../type/schema'; +} from '../../type/definition.js'; +import { GraphQLFloat, GraphQLInt, GraphQLString } from '../../type/scalars.js'; +import { GraphQLSchema } from '../../type/schema.js'; -import { isEqualType, isTypeSubTypeOf } from '../typeComparators'; +import { isEqualType, isTypeSubTypeOf } from '../typeComparators.js'; describe('typeComparators', () => { describe('isEqualType', () => { diff --git a/src/utilities/__tests__/valueFromAST-test.ts b/src/utilities/__tests__/valueFromAST-test.ts index 73d0be49d9..d0a8380d13 100644 --- a/src/utilities/__tests__/valueFromAST-test.ts +++ b/src/utilities/__tests__/valueFromAST-test.ts @@ -1,28 +1,28 @@ import { assert, expect } from 'chai'; import { describe, it } from 'mocha'; -import { identityFunc } from '../../jsutils/identityFunc'; -import type { ObjMap } from '../../jsutils/ObjMap'; +import { identityFunc } from '../../jsutils/identityFunc.js'; +import type { ObjMap } from '../../jsutils/ObjMap.js'; -import { parseValue } from '../../language/parser'; +import { parseValue } from '../../language/parser.js'; -import type { GraphQLInputType } from '../../type/definition'; +import type { GraphQLInputType } from '../../type/definition.js'; import { GraphQLEnumType, GraphQLInputObjectType, GraphQLList, GraphQLNonNull, GraphQLScalarType, -} from '../../type/definition'; +} from '../../type/definition.js'; import { GraphQLBoolean, GraphQLFloat, GraphQLID, GraphQLInt, GraphQLString, -} from '../../type/scalars'; +} from '../../type/scalars.js'; -import { valueFromAST } from '../valueFromAST'; +import { valueFromAST } from '../valueFromAST.js'; describe('valueFromAST', () => { function expectValueFrom( diff --git a/src/utilities/__tests__/valueFromASTUntyped-test.ts b/src/utilities/__tests__/valueFromASTUntyped-test.ts index 9ad004c42e..90b9260408 100644 --- a/src/utilities/__tests__/valueFromASTUntyped-test.ts +++ b/src/utilities/__tests__/valueFromASTUntyped-test.ts @@ -1,12 +1,12 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import type { Maybe } from '../../jsutils/Maybe'; -import type { ObjMap } from '../../jsutils/ObjMap'; +import type { Maybe } from '../../jsutils/Maybe.js'; +import type { ObjMap } from '../../jsutils/ObjMap.js'; -import { parseValue } from '../../language/parser'; +import { parseValue } from '../../language/parser.js'; -import { valueFromASTUntyped } from '../valueFromASTUntyped'; +import { valueFromASTUntyped } from '../valueFromASTUntyped.js'; describe('valueFromASTUntyped', () => { function expectValueFrom( diff --git a/src/utilities/astFromValue.ts b/src/utilities/astFromValue.ts index 1a880449c8..e1d994a8ee 100644 --- a/src/utilities/astFromValue.ts +++ b/src/utilities/astFromValue.ts @@ -1,21 +1,21 @@ -import { inspect } from '../jsutils/inspect'; -import { invariant } from '../jsutils/invariant'; -import { isIterableObject } from '../jsutils/isIterableObject'; -import { isObjectLike } from '../jsutils/isObjectLike'; -import type { Maybe } from '../jsutils/Maybe'; +import { inspect } from '../jsutils/inspect.js'; +import { invariant } from '../jsutils/invariant.js'; +import { isIterableObject } from '../jsutils/isIterableObject.js'; +import { isObjectLike } from '../jsutils/isObjectLike.js'; +import type { Maybe } from '../jsutils/Maybe.js'; -import type { ObjectFieldNode, ValueNode } from '../language/ast'; -import { Kind } from '../language/kinds'; +import type { ObjectFieldNode, ValueNode } from '../language/ast.js'; +import { Kind } from '../language/kinds.js'; -import type { GraphQLInputType } from '../type/definition'; +import type { GraphQLInputType } from '../type/definition.js'; import { isEnumType, isInputObjectType, isLeafType, isListType, isNonNullType, -} from '../type/definition'; -import { GraphQLID } from '../type/scalars'; +} from '../type/definition.js'; +import { GraphQLID } from '../type/scalars.js'; /** * Produces a GraphQL Value AST given a JavaScript object. diff --git a/src/utilities/buildASTSchema.ts b/src/utilities/buildASTSchema.ts index eeff08e6ed..d91d0e3ac6 100644 --- a/src/utilities/buildASTSchema.ts +++ b/src/utilities/buildASTSchema.ts @@ -1,18 +1,18 @@ -import { devAssert } from '../jsutils/devAssert'; +import { devAssert } from '../jsutils/devAssert.js'; -import type { DocumentNode } from '../language/ast'; -import { Kind } from '../language/kinds'; -import type { ParseOptions } from '../language/parser'; -import { parse } from '../language/parser'; -import type { Source } from '../language/source'; +import type { DocumentNode } from '../language/ast.js'; +import { Kind } from '../language/kinds.js'; +import type { ParseOptions } from '../language/parser.js'; +import { parse } from '../language/parser.js'; +import type { Source } from '../language/source.js'; -import { specifiedDirectives } from '../type/directives'; -import type { GraphQLSchemaValidationOptions } from '../type/schema'; -import { GraphQLSchema } from '../type/schema'; +import { specifiedDirectives } from '../type/directives.js'; +import type { GraphQLSchemaValidationOptions } from '../type/schema.js'; +import { GraphQLSchema } from '../type/schema.js'; -import { assertValidSDL } from '../validation/validate'; +import { assertValidSDL } from '../validation/validate.js'; -import { extendSchemaImpl } from './extendSchema'; +import { extendSchemaImpl } from './extendSchema.js'; export interface BuildSchemaOptions extends GraphQLSchemaValidationOptions { /** diff --git a/src/utilities/buildClientSchema.ts b/src/utilities/buildClientSchema.ts index 18e6110b2b..b226ae6b35 100644 --- a/src/utilities/buildClientSchema.ts +++ b/src/utilities/buildClientSchema.ts @@ -1,16 +1,16 @@ -import { devAssert } from '../jsutils/devAssert'; -import { inspect } from '../jsutils/inspect'; -import { isObjectLike } from '../jsutils/isObjectLike'; -import { keyValMap } from '../jsutils/keyValMap'; +import { devAssert } from '../jsutils/devAssert.js'; +import { inspect } from '../jsutils/inspect.js'; +import { isObjectLike } from '../jsutils/isObjectLike.js'; +import { keyValMap } from '../jsutils/keyValMap.js'; -import { parseValue } from '../language/parser'; +import { parseValue } from '../language/parser.js'; import type { GraphQLFieldConfig, GraphQLFieldConfigMap, GraphQLNamedType, GraphQLType, -} from '../type/definition'; +} from '../type/definition.js'; import { assertInterfaceType, assertNullableType, @@ -25,12 +25,12 @@ import { GraphQLUnionType, isInputType, isOutputType, -} from '../type/definition'; -import { GraphQLDirective } from '../type/directives'; -import { introspectionTypes, TypeKind } from '../type/introspection'; -import { specifiedScalarTypes } from '../type/scalars'; -import type { GraphQLSchemaValidationOptions } from '../type/schema'; -import { GraphQLSchema } from '../type/schema'; +} from '../type/definition.js'; +import { GraphQLDirective } from '../type/directives.js'; +import { introspectionTypes, TypeKind } from '../type/introspection.js'; +import { specifiedScalarTypes } from '../type/scalars.js'; +import type { GraphQLSchemaValidationOptions } from '../type/schema.js'; +import { GraphQLSchema } from '../type/schema.js'; import type { IntrospectionDirective, @@ -46,8 +46,8 @@ import type { IntrospectionType, IntrospectionTypeRef, IntrospectionUnionType, -} from './getIntrospectionQuery'; -import { valueFromAST } from './valueFromAST'; +} from './getIntrospectionQuery.js'; +import { valueFromAST } from './valueFromAST.js'; /** * Build a GraphQLSchema for use by client tools. diff --git a/src/utilities/coerceInputValue.ts b/src/utilities/coerceInputValue.ts index 136bee63c9..d46d3842aa 100644 --- a/src/utilities/coerceInputValue.ts +++ b/src/utilities/coerceInputValue.ts @@ -1,22 +1,22 @@ -import { didYouMean } from '../jsutils/didYouMean'; -import { inspect } from '../jsutils/inspect'; -import { invariant } from '../jsutils/invariant'; -import { isIterableObject } from '../jsutils/isIterableObject'; -import { isObjectLike } from '../jsutils/isObjectLike'; -import type { Path } from '../jsutils/Path'; -import { addPath, pathToArray } from '../jsutils/Path'; -import { printPathArray } from '../jsutils/printPathArray'; -import { suggestionList } from '../jsutils/suggestionList'; - -import { GraphQLError } from '../error/GraphQLError'; - -import type { GraphQLInputType } from '../type/definition'; +import { didYouMean } from '../jsutils/didYouMean.js'; +import { inspect } from '../jsutils/inspect.js'; +import { invariant } from '../jsutils/invariant.js'; +import { isIterableObject } from '../jsutils/isIterableObject.js'; +import { isObjectLike } from '../jsutils/isObjectLike.js'; +import type { Path } from '../jsutils/Path.js'; +import { addPath, pathToArray } from '../jsutils/Path.js'; +import { printPathArray } from '../jsutils/printPathArray.js'; +import { suggestionList } from '../jsutils/suggestionList.js'; + +import { GraphQLError } from '../error/GraphQLError.js'; + +import type { GraphQLInputType } from '../type/definition.js'; import { isInputObjectType, isLeafType, isListType, isNonNullType, -} from '../type/definition'; +} from '../type/definition.js'; type OnErrorCB = ( path: ReadonlyArray, diff --git a/src/utilities/concatAST.ts b/src/utilities/concatAST.ts index 33062f610e..843c1a9075 100644 --- a/src/utilities/concatAST.ts +++ b/src/utilities/concatAST.ts @@ -1,5 +1,5 @@ -import type { DefinitionNode, DocumentNode } from '../language/ast'; -import { Kind } from '../language/kinds'; +import type { DefinitionNode, DocumentNode } from '../language/ast.js'; +import { Kind } from '../language/kinds.js'; /** * Provided a collection of ASTs, presumably each from different files, diff --git a/src/utilities/extendSchema.ts b/src/utilities/extendSchema.ts index 998847e9f1..8460ea0f1b 100644 --- a/src/utilities/extendSchema.ts +++ b/src/utilities/extendSchema.ts @@ -1,9 +1,9 @@ -import { devAssert } from '../jsutils/devAssert'; -import { inspect } from '../jsutils/inspect'; -import { invariant } from '../jsutils/invariant'; -import { keyMap } from '../jsutils/keyMap'; -import { mapValue } from '../jsutils/mapValue'; -import type { Maybe } from '../jsutils/Maybe'; +import { devAssert } from '../jsutils/devAssert.js'; +import { inspect } from '../jsutils/inspect.js'; +import { invariant } from '../jsutils/invariant.js'; +import { keyMap } from '../jsutils/keyMap.js'; +import { mapValue } from '../jsutils/mapValue.js'; +import type { Maybe } from '../jsutils/Maybe.js'; import type { DirectiveDefinitionNode, @@ -28,12 +28,12 @@ import type { TypeNode, UnionTypeDefinitionNode, UnionTypeExtensionNode, -} from '../language/ast'; -import { Kind } from '../language/kinds'; +} from '../language/ast.js'; +import { Kind } from '../language/kinds.js'; import { isTypeDefinitionNode, isTypeExtensionNode, -} from '../language/predicates'; +} from '../language/predicates.js'; import type { GraphQLArgumentConfig, @@ -44,7 +44,7 @@ import type { GraphQLInputFieldConfigMap, GraphQLNamedType, GraphQLType, -} from '../type/definition'; +} from '../type/definition.js'; import { GraphQLEnumType, GraphQLInputObjectType, @@ -62,25 +62,31 @@ import { isObjectType, isScalarType, isUnionType, -} from '../type/definition'; +} from '../type/definition.js'; import { GraphQLDeprecatedDirective, GraphQLDirective, GraphQLSpecifiedByDirective, -} from '../type/directives'; -import { introspectionTypes, isIntrospectionType } from '../type/introspection'; -import { isSpecifiedScalarType, specifiedScalarTypes } from '../type/scalars'; +} from '../type/directives.js'; +import { + introspectionTypes, + isIntrospectionType, +} from '../type/introspection.js'; +import { + isSpecifiedScalarType, + specifiedScalarTypes, +} from '../type/scalars.js'; import type { GraphQLSchemaNormalizedConfig, GraphQLSchemaValidationOptions, -} from '../type/schema'; -import { assertSchema, GraphQLSchema } from '../type/schema'; +} from '../type/schema.js'; +import { assertSchema, GraphQLSchema } from '../type/schema.js'; -import { assertValidSDLExtension } from '../validation/validate'; +import { assertValidSDLExtension } from '../validation/validate.js'; -import { getDirectiveValues } from '../execution/values'; +import { getDirectiveValues } from '../execution/values.js'; -import { valueFromAST } from './valueFromAST'; +import { valueFromAST } from './valueFromAST.js'; interface Options extends GraphQLSchemaValidationOptions { /** diff --git a/src/utilities/findBreakingChanges.ts b/src/utilities/findBreakingChanges.ts index 0bf0d453b4..793d29bc83 100644 --- a/src/utilities/findBreakingChanges.ts +++ b/src/utilities/findBreakingChanges.ts @@ -1,8 +1,8 @@ -import { inspect } from '../jsutils/inspect'; -import { invariant } from '../jsutils/invariant'; -import { keyMap } from '../jsutils/keyMap'; +import { inspect } from '../jsutils/inspect.js'; +import { invariant } from '../jsutils/invariant.js'; +import { keyMap } from '../jsutils/keyMap.js'; -import { print } from '../language/printer'; +import { print } from '../language/printer.js'; import type { GraphQLEnumType, @@ -14,7 +14,7 @@ import type { GraphQLObjectType, GraphQLType, GraphQLUnionType, -} from '../type/definition'; +} from '../type/definition.js'; import { isEnumType, isInputObjectType, @@ -27,12 +27,12 @@ import { isRequiredInputField, isScalarType, isUnionType, -} from '../type/definition'; -import { isSpecifiedScalarType } from '../type/scalars'; -import type { GraphQLSchema } from '../type/schema'; +} from '../type/definition.js'; +import { isSpecifiedScalarType } from '../type/scalars.js'; +import type { GraphQLSchema } from '../type/schema.js'; -import { astFromValue } from './astFromValue'; -import { sortValueNode } from './sortValueNode'; +import { astFromValue } from './astFromValue.js'; +import { sortValueNode } from './sortValueNode.js'; export enum BreakingChangeType { TYPE_REMOVED = 'TYPE_REMOVED', diff --git a/src/utilities/getIntrospectionQuery.ts b/src/utilities/getIntrospectionQuery.ts index c21fe9a1bb..12c2aa6404 100644 --- a/src/utilities/getIntrospectionQuery.ts +++ b/src/utilities/getIntrospectionQuery.ts @@ -1,6 +1,6 @@ -import type { Maybe } from '../jsutils/Maybe'; +import type { Maybe } from '../jsutils/Maybe.js'; -import type { DirectiveLocation } from '../language/directiveLocation'; +import type { DirectiveLocation } from '../language/directiveLocation.js'; export interface IntrospectionOptions { /** diff --git a/src/utilities/getOperationAST.ts b/src/utilities/getOperationAST.ts index 8decf943f6..a8bb2a1984 100644 --- a/src/utilities/getOperationAST.ts +++ b/src/utilities/getOperationAST.ts @@ -1,7 +1,7 @@ -import type { Maybe } from '../jsutils/Maybe'; +import type { Maybe } from '../jsutils/Maybe.js'; -import type { DocumentNode, OperationDefinitionNode } from '../language/ast'; -import { Kind } from '../language/kinds'; +import type { DocumentNode, OperationDefinitionNode } from '../language/ast.js'; +import { Kind } from '../language/kinds.js'; /** * Returns an operation AST given a document AST and optionally an operation diff --git a/src/utilities/index.ts b/src/utilities/index.ts index d3ccffc917..a29f667671 100644 --- a/src/utilities/index.ts +++ b/src/utilities/index.ts @@ -1,5 +1,5 @@ // Produce the GraphQL query recommended for a full schema introspection. -export { getIntrospectionQuery } from './getIntrospectionQuery'; +export { getIntrospectionQuery } from './getIntrospectionQuery.js'; export type { IntrospectionOptions, @@ -24,67 +24,67 @@ export type { IntrospectionInputValue, IntrospectionEnumValue, IntrospectionDirective, -} from './getIntrospectionQuery'; +} from './getIntrospectionQuery.js'; // Gets the target Operation from a Document. -export { getOperationAST } from './getOperationAST'; +export { getOperationAST } from './getOperationAST.js'; // Convert a GraphQLSchema to an IntrospectionQuery. -export { introspectionFromSchema } from './introspectionFromSchema'; +export { introspectionFromSchema } from './introspectionFromSchema.js'; // Build a GraphQLSchema from an introspection result. -export { buildClientSchema } from './buildClientSchema'; +export { buildClientSchema } from './buildClientSchema.js'; // Build a GraphQLSchema from GraphQL Schema language. -export { buildASTSchema, buildSchema } from './buildASTSchema'; -export type { BuildSchemaOptions } from './buildASTSchema'; +export { buildASTSchema, buildSchema } from './buildASTSchema.js'; +export type { BuildSchemaOptions } from './buildASTSchema.js'; // Extends an existing GraphQLSchema from a parsed GraphQL Schema language AST. -export { extendSchema } from './extendSchema'; +export { extendSchema } from './extendSchema.js'; // Sort a GraphQLSchema. -export { lexicographicSortSchema } from './lexicographicSortSchema'; +export { lexicographicSortSchema } from './lexicographicSortSchema.js'; // Print a GraphQLSchema to GraphQL Schema language. export { printSchema, printType, printIntrospectionSchema, -} from './printSchema'; +} from './printSchema.js'; // Create a GraphQLType from a GraphQL language AST. -export { typeFromAST } from './typeFromAST'; +export { typeFromAST } from './typeFromAST.js'; // Create a JavaScript value from a GraphQL language AST with a type. -export { valueFromAST } from './valueFromAST'; +export { valueFromAST } from './valueFromAST.js'; // Create a JavaScript value from a GraphQL language AST without a type. -export { valueFromASTUntyped } from './valueFromASTUntyped'; +export { valueFromASTUntyped } from './valueFromASTUntyped.js'; // Create a GraphQL language AST from a JavaScript value. -export { astFromValue } from './astFromValue'; +export { astFromValue } from './astFromValue.js'; // A helper to use within recursive-descent visitors which need to be aware of the GraphQL type system. -export { TypeInfo, visitWithTypeInfo } from './TypeInfo'; +export { TypeInfo, visitWithTypeInfo } from './TypeInfo.js'; // Coerces a JavaScript value to a GraphQL type, or produces errors. -export { coerceInputValue } from './coerceInputValue'; +export { coerceInputValue } from './coerceInputValue.js'; // Concatenates multiple AST together. -export { concatAST } from './concatAST'; +export { concatAST } from './concatAST.js'; // Separates an AST into an AST per Operation. -export { separateOperations } from './separateOperations'; +export { separateOperations } from './separateOperations.js'; // Strips characters that are not significant to the validity or execution of a GraphQL document. -export { stripIgnoredCharacters } from './stripIgnoredCharacters'; +export { stripIgnoredCharacters } from './stripIgnoredCharacters.js'; // Comparators for types export { isEqualType, isTypeSubTypeOf, doTypesOverlap, -} from './typeComparators'; +} from './typeComparators.js'; // Compares two GraphQLSchemas and detects breaking changes. export { @@ -92,8 +92,8 @@ export { DangerousChangeType, findBreakingChanges, findDangerousChanges, -} from './findBreakingChanges'; -export type { BreakingChange, DangerousChange } from './findBreakingChanges'; +} from './findBreakingChanges.js'; +export type { BreakingChange, DangerousChange } from './findBreakingChanges.js'; // Wrapper type that contains DocumentNode and types that can be deduced from it. -export type { TypedQueryDocumentNode } from './typedQueryDocumentNode'; +export type { TypedQueryDocumentNode } from './typedQueryDocumentNode.js'; diff --git a/src/utilities/introspectionFromSchema.ts b/src/utilities/introspectionFromSchema.ts index 78c1b30244..041a0ce489 100644 --- a/src/utilities/introspectionFromSchema.ts +++ b/src/utilities/introspectionFromSchema.ts @@ -1,16 +1,16 @@ -import { invariant } from '../jsutils/invariant'; +import { invariant } from '../jsutils/invariant.js'; -import { parse } from '../language/parser'; +import { parse } from '../language/parser.js'; -import type { GraphQLSchema } from '../type/schema'; +import type { GraphQLSchema } from '../type/schema.js'; -import { executeSync } from '../execution/execute'; +import { executeSync } from '../execution/execute.js'; import type { IntrospectionOptions, IntrospectionQuery, -} from './getIntrospectionQuery'; -import { getIntrospectionQuery } from './getIntrospectionQuery'; +} from './getIntrospectionQuery.js'; +import { getIntrospectionQuery } from './getIntrospectionQuery.js'; /** * Build an IntrospectionQuery from a GraphQLSchema diff --git a/src/utilities/lexicographicSortSchema.ts b/src/utilities/lexicographicSortSchema.ts index 26b6908c9f..4675185a4e 100644 --- a/src/utilities/lexicographicSortSchema.ts +++ b/src/utilities/lexicographicSortSchema.ts @@ -1,9 +1,9 @@ -import { inspect } from '../jsutils/inspect'; -import { invariant } from '../jsutils/invariant'; -import { keyValMap } from '../jsutils/keyValMap'; -import type { Maybe } from '../jsutils/Maybe'; -import { naturalCompare } from '../jsutils/naturalCompare'; -import type { ObjMap } from '../jsutils/ObjMap'; +import { inspect } from '../jsutils/inspect.js'; +import { invariant } from '../jsutils/invariant.js'; +import { keyValMap } from '../jsutils/keyValMap.js'; +import type { Maybe } from '../jsutils/Maybe.js'; +import { naturalCompare } from '../jsutils/naturalCompare.js'; +import type { ObjMap } from '../jsutils/ObjMap.js'; import type { GraphQLFieldConfigArgumentMap, @@ -11,7 +11,7 @@ import type { GraphQLInputFieldConfigMap, GraphQLNamedType, GraphQLType, -} from '../type/definition'; +} from '../type/definition.js'; import { GraphQLEnumType, GraphQLInputObjectType, @@ -28,10 +28,10 @@ import { isObjectType, isScalarType, isUnionType, -} from '../type/definition'; -import { GraphQLDirective } from '../type/directives'; -import { isIntrospectionType } from '../type/introspection'; -import { GraphQLSchema } from '../type/schema'; +} from '../type/definition.js'; +import { GraphQLDirective } from '../type/directives.js'; +import { isIntrospectionType } from '../type/introspection.js'; +import { GraphQLSchema } from '../type/schema.js'; /** * Sort GraphQLSchema. diff --git a/src/utilities/printSchema.ts b/src/utilities/printSchema.ts index 83859feee8..527cf4be17 100644 --- a/src/utilities/printSchema.ts +++ b/src/utilities/printSchema.ts @@ -1,10 +1,10 @@ -import { inspect } from '../jsutils/inspect'; -import { invariant } from '../jsutils/invariant'; -import type { Maybe } from '../jsutils/Maybe'; +import { inspect } from '../jsutils/inspect.js'; +import { invariant } from '../jsutils/invariant.js'; +import type { Maybe } from '../jsutils/Maybe.js'; -import { isPrintableAsBlockString } from '../language/blockString'; -import { Kind } from '../language/kinds'; -import { print } from '../language/printer'; +import { isPrintableAsBlockString } from '../language/blockString.js'; +import { Kind } from '../language/kinds.js'; +import { print } from '../language/printer.js'; import type { GraphQLArgument, @@ -16,7 +16,7 @@ import type { GraphQLObjectType, GraphQLScalarType, GraphQLUnionType, -} from '../type/definition'; +} from '../type/definition.js'; import { isEnumType, isInputObjectType, @@ -24,17 +24,17 @@ import { isObjectType, isScalarType, isUnionType, -} from '../type/definition'; -import type { GraphQLDirective } from '../type/directives'; +} from '../type/definition.js'; +import type { GraphQLDirective } from '../type/directives.js'; import { DEFAULT_DEPRECATION_REASON, isSpecifiedDirective, -} from '../type/directives'; -import { isIntrospectionType } from '../type/introspection'; -import { isSpecifiedScalarType } from '../type/scalars'; -import type { GraphQLSchema } from '../type/schema'; +} from '../type/directives.js'; +import { isIntrospectionType } from '../type/introspection.js'; +import { isSpecifiedScalarType } from '../type/scalars.js'; +import type { GraphQLSchema } from '../type/schema.js'; -import { astFromValue } from './astFromValue'; +import { astFromValue } from './astFromValue.js'; export function printSchema(schema: GraphQLSchema): string { return printFilteredSchema( diff --git a/src/utilities/separateOperations.ts b/src/utilities/separateOperations.ts index 84a8b774f9..3a7f78bc07 100644 --- a/src/utilities/separateOperations.ts +++ b/src/utilities/separateOperations.ts @@ -1,12 +1,12 @@ -import type { ObjMap } from '../jsutils/ObjMap'; +import type { ObjMap } from '../jsutils/ObjMap.js'; import type { DocumentNode, OperationDefinitionNode, SelectionSetNode, -} from '../language/ast'; -import { Kind } from '../language/kinds'; -import { visit } from '../language/visitor'; +} from '../language/ast.js'; +import { Kind } from '../language/kinds.js'; +import { visit } from '../language/visitor.js'; /** * separateOperations accepts a single AST document which may contain many diff --git a/src/utilities/sortValueNode.ts b/src/utilities/sortValueNode.ts index 6050c9a907..e89a05f9e1 100644 --- a/src/utilities/sortValueNode.ts +++ b/src/utilities/sortValueNode.ts @@ -1,7 +1,7 @@ -import { naturalCompare } from '../jsutils/naturalCompare'; +import { naturalCompare } from '../jsutils/naturalCompare.js'; -import type { ObjectFieldNode, ValueNode } from '../language/ast'; -import { Kind } from '../language/kinds'; +import type { ObjectFieldNode, ValueNode } from '../language/ast.js'; +import { Kind } from '../language/kinds.js'; /** * Sort ValueNode. diff --git a/src/utilities/stripIgnoredCharacters.ts b/src/utilities/stripIgnoredCharacters.ts index 5eb5c9800c..8c0acf1522 100644 --- a/src/utilities/stripIgnoredCharacters.ts +++ b/src/utilities/stripIgnoredCharacters.ts @@ -1,7 +1,7 @@ -import { printBlockString } from '../language/blockString'; -import { isPunctuatorTokenKind, Lexer } from '../language/lexer'; -import { isSource, Source } from '../language/source'; -import { TokenKind } from '../language/tokenKind'; +import { printBlockString } from '../language/blockString.js'; +import { isPunctuatorTokenKind, Lexer } from '../language/lexer.js'; +import { isSource, Source } from '../language/source.js'; +import { TokenKind } from '../language/tokenKind.js'; /** * Strips characters that are not significant to the validity or execution diff --git a/src/utilities/typeComparators.ts b/src/utilities/typeComparators.ts index 287be40bfe..c0fd9ee6f0 100644 --- a/src/utilities/typeComparators.ts +++ b/src/utilities/typeComparators.ts @@ -1,12 +1,12 @@ -import type { GraphQLCompositeType, GraphQLType } from '../type/definition'; +import type { GraphQLCompositeType, GraphQLType } from '../type/definition.js'; import { isAbstractType, isInterfaceType, isListType, isNonNullType, isObjectType, -} from '../type/definition'; -import type { GraphQLSchema } from '../type/schema'; +} from '../type/definition.js'; +import type { GraphQLSchema } from '../type/schema.js'; /** * Provided two types, return true if the types are equal (invariant). diff --git a/src/utilities/typeFromAST.ts b/src/utilities/typeFromAST.ts index 7510df1046..c072301b39 100644 --- a/src/utilities/typeFromAST.ts +++ b/src/utilities/typeFromAST.ts @@ -3,12 +3,12 @@ import type { NamedTypeNode, NonNullTypeNode, TypeNode, -} from '../language/ast'; -import { Kind } from '../language/kinds'; +} from '../language/ast.js'; +import { Kind } from '../language/kinds.js'; -import type { GraphQLNamedType, GraphQLType } from '../type/definition'; -import { GraphQLList, GraphQLNonNull } from '../type/definition'; -import type { GraphQLSchema } from '../type/schema'; +import type { GraphQLNamedType, GraphQLType } from '../type/definition.js'; +import { GraphQLList, GraphQLNonNull } from '../type/definition.js'; +import type { GraphQLSchema } from '../type/schema.js'; /** * Given a Schema and an AST node describing a type, return a GraphQLType diff --git a/src/utilities/typedQueryDocumentNode.ts b/src/utilities/typedQueryDocumentNode.ts index 1bd5cf0825..8fd8cbe708 100644 --- a/src/utilities/typedQueryDocumentNode.ts +++ b/src/utilities/typedQueryDocumentNode.ts @@ -1,4 +1,7 @@ -import type { DocumentNode, ExecutableDefinitionNode } from '../language/ast'; +import type { + DocumentNode, + ExecutableDefinitionNode, +} from '../language/ast.js'; /** * Wrapper type that contains DocumentNode and types that can be deduced from it. */ diff --git a/src/utilities/valueFromAST.ts b/src/utilities/valueFromAST.ts index 4f0cee6b29..18981712f4 100644 --- a/src/utilities/valueFromAST.ts +++ b/src/utilities/valueFromAST.ts @@ -1,19 +1,19 @@ -import { inspect } from '../jsutils/inspect'; -import { invariant } from '../jsutils/invariant'; -import { keyMap } from '../jsutils/keyMap'; -import type { Maybe } from '../jsutils/Maybe'; -import type { ObjMap } from '../jsutils/ObjMap'; +import { inspect } from '../jsutils/inspect.js'; +import { invariant } from '../jsutils/invariant.js'; +import { keyMap } from '../jsutils/keyMap.js'; +import type { Maybe } from '../jsutils/Maybe.js'; +import type { ObjMap } from '../jsutils/ObjMap.js'; -import type { ValueNode } from '../language/ast'; -import { Kind } from '../language/kinds'; +import type { ValueNode } from '../language/ast.js'; +import { Kind } from '../language/kinds.js'; -import type { GraphQLInputType } from '../type/definition'; +import type { GraphQLInputType } from '../type/definition.js'; import { isInputObjectType, isLeafType, isListType, isNonNullType, -} from '../type/definition'; +} from '../type/definition.js'; /** * Produces a JavaScript value given a GraphQL Value AST. diff --git a/src/utilities/valueFromASTUntyped.ts b/src/utilities/valueFromASTUntyped.ts index 05540da3a4..87af11a9a3 100644 --- a/src/utilities/valueFromASTUntyped.ts +++ b/src/utilities/valueFromASTUntyped.ts @@ -1,9 +1,9 @@ -import { keyValMap } from '../jsutils/keyValMap'; -import type { Maybe } from '../jsutils/Maybe'; -import type { ObjMap } from '../jsutils/ObjMap'; +import { keyValMap } from '../jsutils/keyValMap.js'; +import type { Maybe } from '../jsutils/Maybe.js'; +import type { ObjMap } from '../jsutils/ObjMap.js'; -import type { ValueNode } from '../language/ast'; -import { Kind } from '../language/kinds'; +import type { ValueNode } from '../language/ast.js'; +import { Kind } from '../language/kinds.js'; /** * Produces a JavaScript value given a GraphQL Value AST. diff --git a/src/validation/ValidationContext.ts b/src/validation/ValidationContext.ts index f6944a6ebd..e5ff46ffb2 100644 --- a/src/validation/ValidationContext.ts +++ b/src/validation/ValidationContext.ts @@ -1,7 +1,7 @@ -import type { Maybe } from '../jsutils/Maybe'; -import type { ObjMap } from '../jsutils/ObjMap'; +import type { Maybe } from '../jsutils/Maybe.js'; +import type { ObjMap } from '../jsutils/ObjMap.js'; -import type { GraphQLError } from '../error/GraphQLError'; +import type { GraphQLError } from '../error/GraphQLError.js'; import type { DocumentNode, @@ -10,10 +10,10 @@ import type { OperationDefinitionNode, SelectionSetNode, VariableNode, -} from '../language/ast'; -import { Kind } from '../language/kinds'; -import type { ASTVisitor } from '../language/visitor'; -import { visit } from '../language/visitor'; +} from '../language/ast.js'; +import { Kind } from '../language/kinds.js'; +import type { ASTVisitor } from '../language/visitor.js'; +import { visit } from '../language/visitor.js'; import type { GraphQLArgument, @@ -22,11 +22,11 @@ import type { GraphQLField, GraphQLInputType, GraphQLOutputType, -} from '../type/definition'; -import type { GraphQLDirective } from '../type/directives'; -import type { GraphQLSchema } from '../type/schema'; +} from '../type/definition.js'; +import type { GraphQLDirective } from '../type/directives.js'; +import type { GraphQLSchema } from '../type/schema.js'; -import { TypeInfo, visitWithTypeInfo } from '../utilities/TypeInfo'; +import { TypeInfo, visitWithTypeInfo } from '../utilities/TypeInfo.js'; type NodeWithSelectionSet = OperationDefinitionNode | FragmentDefinitionNode; interface VariableUsage { diff --git a/src/validation/__tests__/ExecutableDefinitionsRule-test.ts b/src/validation/__tests__/ExecutableDefinitionsRule-test.ts index ec3a1afe25..88aaaefb70 100644 --- a/src/validation/__tests__/ExecutableDefinitionsRule-test.ts +++ b/src/validation/__tests__/ExecutableDefinitionsRule-test.ts @@ -1,8 +1,8 @@ import { describe, it } from 'mocha'; -import { ExecutableDefinitionsRule } from '../rules/ExecutableDefinitionsRule'; +import { ExecutableDefinitionsRule } from '../rules/ExecutableDefinitionsRule.js'; -import { expectValidationErrors } from './harness'; +import { expectValidationErrors } from './harness.js'; function expectErrors(queryStr: string) { return expectValidationErrors(ExecutableDefinitionsRule, queryStr); diff --git a/src/validation/__tests__/FieldsOnCorrectTypeRule-test.ts b/src/validation/__tests__/FieldsOnCorrectTypeRule-test.ts index 70473fa685..1c7fbc0351 100644 --- a/src/validation/__tests__/FieldsOnCorrectTypeRule-test.ts +++ b/src/validation/__tests__/FieldsOnCorrectTypeRule-test.ts @@ -1,16 +1,16 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { parse } from '../../language/parser'; +import { parse } from '../../language/parser.js'; -import type { GraphQLSchema } from '../../type/schema'; +import type { GraphQLSchema } from '../../type/schema.js'; -import { buildSchema } from '../../utilities/buildASTSchema'; +import { buildSchema } from '../../utilities/buildASTSchema.js'; -import { FieldsOnCorrectTypeRule } from '../rules/FieldsOnCorrectTypeRule'; -import { validate } from '../validate'; +import { FieldsOnCorrectTypeRule } from '../rules/FieldsOnCorrectTypeRule.js'; +import { validate } from '../validate.js'; -import { expectValidationErrorsWithSchema } from './harness'; +import { expectValidationErrorsWithSchema } from './harness.js'; function expectErrors(queryStr: string) { return expectValidationErrorsWithSchema( diff --git a/src/validation/__tests__/FragmentsOnCompositeTypesRule-test.ts b/src/validation/__tests__/FragmentsOnCompositeTypesRule-test.ts index dc1ed40796..849b662866 100644 --- a/src/validation/__tests__/FragmentsOnCompositeTypesRule-test.ts +++ b/src/validation/__tests__/FragmentsOnCompositeTypesRule-test.ts @@ -1,8 +1,8 @@ import { describe, it } from 'mocha'; -import { FragmentsOnCompositeTypesRule } from '../rules/FragmentsOnCompositeTypesRule'; +import { FragmentsOnCompositeTypesRule } from '../rules/FragmentsOnCompositeTypesRule.js'; -import { expectValidationErrors } from './harness'; +import { expectValidationErrors } from './harness.js'; function expectErrors(queryStr: string) { return expectValidationErrors(FragmentsOnCompositeTypesRule, queryStr); diff --git a/src/validation/__tests__/KnownArgumentNamesRule-test.ts b/src/validation/__tests__/KnownArgumentNamesRule-test.ts index 4ce5fd190f..0fcffeca2c 100644 --- a/src/validation/__tests__/KnownArgumentNamesRule-test.ts +++ b/src/validation/__tests__/KnownArgumentNamesRule-test.ts @@ -1,15 +1,18 @@ import { describe, it } from 'mocha'; -import type { GraphQLSchema } from '../../type/schema'; +import type { GraphQLSchema } from '../../type/schema.js'; -import { buildSchema } from '../../utilities/buildASTSchema'; +import { buildSchema } from '../../utilities/buildASTSchema.js'; import { KnownArgumentNamesOnDirectivesRule, KnownArgumentNamesRule, -} from '../rules/KnownArgumentNamesRule'; +} from '../rules/KnownArgumentNamesRule.js'; -import { expectSDLValidationErrors, expectValidationErrors } from './harness'; +import { + expectSDLValidationErrors, + expectValidationErrors, +} from './harness.js'; function expectErrors(queryStr: string) { return expectValidationErrors(KnownArgumentNamesRule, queryStr); diff --git a/src/validation/__tests__/KnownDirectivesRule-test.ts b/src/validation/__tests__/KnownDirectivesRule-test.ts index 4cb6e225c1..a3bbc198da 100644 --- a/src/validation/__tests__/KnownDirectivesRule-test.ts +++ b/src/validation/__tests__/KnownDirectivesRule-test.ts @@ -1,15 +1,15 @@ import { describe, it } from 'mocha'; -import type { GraphQLSchema } from '../../type/schema'; +import type { GraphQLSchema } from '../../type/schema.js'; -import { buildSchema } from '../../utilities/buildASTSchema'; +import { buildSchema } from '../../utilities/buildASTSchema.js'; -import { KnownDirectivesRule } from '../rules/KnownDirectivesRule'; +import { KnownDirectivesRule } from '../rules/KnownDirectivesRule.js'; import { expectSDLValidationErrors, expectValidationErrorsWithSchema, -} from './harness'; +} from './harness.js'; function expectErrors(queryStr: string) { return expectValidationErrorsWithSchema( diff --git a/src/validation/__tests__/KnownFragmentNamesRule-test.ts b/src/validation/__tests__/KnownFragmentNamesRule-test.ts index c425767806..ad0158bdda 100644 --- a/src/validation/__tests__/KnownFragmentNamesRule-test.ts +++ b/src/validation/__tests__/KnownFragmentNamesRule-test.ts @@ -1,8 +1,8 @@ import { describe, it } from 'mocha'; -import { KnownFragmentNamesRule } from '../rules/KnownFragmentNamesRule'; +import { KnownFragmentNamesRule } from '../rules/KnownFragmentNamesRule.js'; -import { expectValidationErrors } from './harness'; +import { expectValidationErrors } from './harness.js'; function expectErrors(queryStr: string) { return expectValidationErrors(KnownFragmentNamesRule, queryStr); diff --git a/src/validation/__tests__/KnownTypeNamesRule-test.ts b/src/validation/__tests__/KnownTypeNamesRule-test.ts index 34f0ca71e5..0440c094d0 100644 --- a/src/validation/__tests__/KnownTypeNamesRule-test.ts +++ b/src/validation/__tests__/KnownTypeNamesRule-test.ts @@ -1,16 +1,16 @@ import { describe, it } from 'mocha'; -import type { GraphQLSchema } from '../../type/schema'; +import type { GraphQLSchema } from '../../type/schema.js'; -import { buildSchema } from '../../utilities/buildASTSchema'; +import { buildSchema } from '../../utilities/buildASTSchema.js'; -import { KnownTypeNamesRule } from '../rules/KnownTypeNamesRule'; +import { KnownTypeNamesRule } from '../rules/KnownTypeNamesRule.js'; import { expectSDLValidationErrors, expectValidationErrors, expectValidationErrorsWithSchema, -} from './harness'; +} from './harness.js'; function expectErrors(queryStr: string) { return expectValidationErrors(KnownTypeNamesRule, queryStr); diff --git a/src/validation/__tests__/LoneAnonymousOperationRule-test.ts b/src/validation/__tests__/LoneAnonymousOperationRule-test.ts index a50ef1bdf0..f60750b534 100644 --- a/src/validation/__tests__/LoneAnonymousOperationRule-test.ts +++ b/src/validation/__tests__/LoneAnonymousOperationRule-test.ts @@ -1,8 +1,8 @@ import { describe, it } from 'mocha'; -import { LoneAnonymousOperationRule } from '../rules/LoneAnonymousOperationRule'; +import { LoneAnonymousOperationRule } from '../rules/LoneAnonymousOperationRule.js'; -import { expectValidationErrors } from './harness'; +import { expectValidationErrors } from './harness.js'; function expectErrors(queryStr: string) { return expectValidationErrors(LoneAnonymousOperationRule, queryStr); diff --git a/src/validation/__tests__/LoneSchemaDefinitionRule-test.ts b/src/validation/__tests__/LoneSchemaDefinitionRule-test.ts index 3f2ea895af..5cd815f24f 100644 --- a/src/validation/__tests__/LoneSchemaDefinitionRule-test.ts +++ b/src/validation/__tests__/LoneSchemaDefinitionRule-test.ts @@ -1,12 +1,12 @@ import { describe, it } from 'mocha'; -import type { GraphQLSchema } from '../../type/schema'; +import type { GraphQLSchema } from '../../type/schema.js'; -import { buildSchema } from '../../utilities/buildASTSchema'; +import { buildSchema } from '../../utilities/buildASTSchema.js'; -import { LoneSchemaDefinitionRule } from '../rules/LoneSchemaDefinitionRule'; +import { LoneSchemaDefinitionRule } from '../rules/LoneSchemaDefinitionRule.js'; -import { expectSDLValidationErrors } from './harness'; +import { expectSDLValidationErrors } from './harness.js'; function expectSDLErrors(sdlStr: string, schema?: GraphQLSchema) { return expectSDLValidationErrors(schema, LoneSchemaDefinitionRule, sdlStr); diff --git a/src/validation/__tests__/NoDeprecatedCustomRule-test.ts b/src/validation/__tests__/NoDeprecatedCustomRule-test.ts index 512edb27dd..96823684fc 100644 --- a/src/validation/__tests__/NoDeprecatedCustomRule-test.ts +++ b/src/validation/__tests__/NoDeprecatedCustomRule-test.ts @@ -1,10 +1,10 @@ import { describe, it } from 'mocha'; -import { buildSchema } from '../../utilities/buildASTSchema'; +import { buildSchema } from '../../utilities/buildASTSchema.js'; -import { NoDeprecatedCustomRule } from '../rules/custom/NoDeprecatedCustomRule'; +import { NoDeprecatedCustomRule } from '../rules/custom/NoDeprecatedCustomRule.js'; -import { expectValidationErrorsWithSchema } from './harness'; +import { expectValidationErrorsWithSchema } from './harness.js'; function buildAssertion(sdlStr: string) { const schema = buildSchema(sdlStr); diff --git a/src/validation/__tests__/NoFragmentCyclesRule-test.ts b/src/validation/__tests__/NoFragmentCyclesRule-test.ts index 08ac4cb4a9..69f951c572 100644 --- a/src/validation/__tests__/NoFragmentCyclesRule-test.ts +++ b/src/validation/__tests__/NoFragmentCyclesRule-test.ts @@ -1,8 +1,8 @@ import { describe, it } from 'mocha'; -import { NoFragmentCyclesRule } from '../rules/NoFragmentCyclesRule'; +import { NoFragmentCyclesRule } from '../rules/NoFragmentCyclesRule.js'; -import { expectValidationErrors } from './harness'; +import { expectValidationErrors } from './harness.js'; function expectErrors(queryStr: string) { return expectValidationErrors(NoFragmentCyclesRule, queryStr); diff --git a/src/validation/__tests__/NoSchemaIntrospectionCustomRule-test.ts b/src/validation/__tests__/NoSchemaIntrospectionCustomRule-test.ts index cd681a7e68..292aee27f3 100644 --- a/src/validation/__tests__/NoSchemaIntrospectionCustomRule-test.ts +++ b/src/validation/__tests__/NoSchemaIntrospectionCustomRule-test.ts @@ -1,10 +1,10 @@ import { describe, it } from 'mocha'; -import { buildSchema } from '../../utilities/buildASTSchema'; +import { buildSchema } from '../../utilities/buildASTSchema.js'; -import { NoSchemaIntrospectionCustomRule } from '../rules/custom/NoSchemaIntrospectionCustomRule'; +import { NoSchemaIntrospectionCustomRule } from '../rules/custom/NoSchemaIntrospectionCustomRule.js'; -import { expectValidationErrorsWithSchema } from './harness'; +import { expectValidationErrorsWithSchema } from './harness.js'; function expectErrors(queryStr: string) { return expectValidationErrorsWithSchema( diff --git a/src/validation/__tests__/NoUndefinedVariablesRule-test.ts b/src/validation/__tests__/NoUndefinedVariablesRule-test.ts index e027d4a49b..c6ed758cad 100644 --- a/src/validation/__tests__/NoUndefinedVariablesRule-test.ts +++ b/src/validation/__tests__/NoUndefinedVariablesRule-test.ts @@ -1,8 +1,8 @@ import { describe, it } from 'mocha'; -import { NoUndefinedVariablesRule } from '../rules/NoUndefinedVariablesRule'; +import { NoUndefinedVariablesRule } from '../rules/NoUndefinedVariablesRule.js'; -import { expectValidationErrors } from './harness'; +import { expectValidationErrors } from './harness.js'; function expectErrors(queryStr: string) { return expectValidationErrors(NoUndefinedVariablesRule, queryStr); diff --git a/src/validation/__tests__/NoUnusedFragmentsRule-test.ts b/src/validation/__tests__/NoUnusedFragmentsRule-test.ts index abeee19e9f..d20f99ea70 100644 --- a/src/validation/__tests__/NoUnusedFragmentsRule-test.ts +++ b/src/validation/__tests__/NoUnusedFragmentsRule-test.ts @@ -1,8 +1,8 @@ import { describe, it } from 'mocha'; -import { NoUnusedFragmentsRule } from '../rules/NoUnusedFragmentsRule'; +import { NoUnusedFragmentsRule } from '../rules/NoUnusedFragmentsRule.js'; -import { expectValidationErrors } from './harness'; +import { expectValidationErrors } from './harness.js'; function expectErrors(queryStr: string) { return expectValidationErrors(NoUnusedFragmentsRule, queryStr); diff --git a/src/validation/__tests__/NoUnusedVariablesRule-test.ts b/src/validation/__tests__/NoUnusedVariablesRule-test.ts index 6be63cd23d..47dac39c99 100644 --- a/src/validation/__tests__/NoUnusedVariablesRule-test.ts +++ b/src/validation/__tests__/NoUnusedVariablesRule-test.ts @@ -1,8 +1,8 @@ import { describe, it } from 'mocha'; -import { NoUnusedVariablesRule } from '../rules/NoUnusedVariablesRule'; +import { NoUnusedVariablesRule } from '../rules/NoUnusedVariablesRule.js'; -import { expectValidationErrors } from './harness'; +import { expectValidationErrors } from './harness.js'; function expectErrors(queryStr: string) { return expectValidationErrors(NoUnusedVariablesRule, queryStr); diff --git a/src/validation/__tests__/OverlappingFieldsCanBeMergedRule-test.ts b/src/validation/__tests__/OverlappingFieldsCanBeMergedRule-test.ts index 46cf014e46..aa921551bf 100644 --- a/src/validation/__tests__/OverlappingFieldsCanBeMergedRule-test.ts +++ b/src/validation/__tests__/OverlappingFieldsCanBeMergedRule-test.ts @@ -1,15 +1,15 @@ import { describe, it } from 'mocha'; -import type { GraphQLSchema } from '../../type/schema'; +import type { GraphQLSchema } from '../../type/schema.js'; -import { buildSchema } from '../../utilities/buildASTSchema'; +import { buildSchema } from '../../utilities/buildASTSchema.js'; -import { OverlappingFieldsCanBeMergedRule } from '../rules/OverlappingFieldsCanBeMergedRule'; +import { OverlappingFieldsCanBeMergedRule } from '../rules/OverlappingFieldsCanBeMergedRule.js'; import { expectValidationErrors, expectValidationErrorsWithSchema, -} from './harness'; +} from './harness.js'; function expectErrors(queryStr: string) { return expectValidationErrors(OverlappingFieldsCanBeMergedRule, queryStr); diff --git a/src/validation/__tests__/PossibleFragmentSpreadsRule-test.ts b/src/validation/__tests__/PossibleFragmentSpreadsRule-test.ts index 3e52f234b5..bd3bb63c61 100644 --- a/src/validation/__tests__/PossibleFragmentSpreadsRule-test.ts +++ b/src/validation/__tests__/PossibleFragmentSpreadsRule-test.ts @@ -1,10 +1,10 @@ import { describe, it } from 'mocha'; -import { buildSchema } from '../../utilities/buildASTSchema'; +import { buildSchema } from '../../utilities/buildASTSchema.js'; -import { PossibleFragmentSpreadsRule } from '../rules/PossibleFragmentSpreadsRule'; +import { PossibleFragmentSpreadsRule } from '../rules/PossibleFragmentSpreadsRule.js'; -import { expectValidationErrorsWithSchema } from './harness'; +import { expectValidationErrorsWithSchema } from './harness.js'; function expectErrors(queryStr: string) { return expectValidationErrorsWithSchema( diff --git a/src/validation/__tests__/PossibleTypeExtensionsRule-test.ts b/src/validation/__tests__/PossibleTypeExtensionsRule-test.ts index e29c097bdb..4ae21294ba 100644 --- a/src/validation/__tests__/PossibleTypeExtensionsRule-test.ts +++ b/src/validation/__tests__/PossibleTypeExtensionsRule-test.ts @@ -1,12 +1,12 @@ import { describe, it } from 'mocha'; -import type { GraphQLSchema } from '../../type/schema'; +import type { GraphQLSchema } from '../../type/schema.js'; -import { buildSchema } from '../../utilities/buildASTSchema'; +import { buildSchema } from '../../utilities/buildASTSchema.js'; -import { PossibleTypeExtensionsRule } from '../rules/PossibleTypeExtensionsRule'; +import { PossibleTypeExtensionsRule } from '../rules/PossibleTypeExtensionsRule.js'; -import { expectSDLValidationErrors } from './harness'; +import { expectSDLValidationErrors } from './harness.js'; function expectSDLErrors(sdlStr: string, schema?: GraphQLSchema) { return expectSDLValidationErrors(schema, PossibleTypeExtensionsRule, sdlStr); diff --git a/src/validation/__tests__/ProvidedRequiredArgumentsRule-test.ts b/src/validation/__tests__/ProvidedRequiredArgumentsRule-test.ts index 23a272572c..6f0d223c15 100644 --- a/src/validation/__tests__/ProvidedRequiredArgumentsRule-test.ts +++ b/src/validation/__tests__/ProvidedRequiredArgumentsRule-test.ts @@ -1,15 +1,18 @@ import { describe, it } from 'mocha'; -import type { GraphQLSchema } from '../../type/schema'; +import type { GraphQLSchema } from '../../type/schema.js'; -import { buildSchema } from '../../utilities/buildASTSchema'; +import { buildSchema } from '../../utilities/buildASTSchema.js'; import { ProvidedRequiredArgumentsOnDirectivesRule, ProvidedRequiredArgumentsRule, -} from '../rules/ProvidedRequiredArgumentsRule'; +} from '../rules/ProvidedRequiredArgumentsRule.js'; -import { expectSDLValidationErrors, expectValidationErrors } from './harness'; +import { + expectSDLValidationErrors, + expectValidationErrors, +} from './harness.js'; function expectErrors(queryStr: string) { return expectValidationErrors(ProvidedRequiredArgumentsRule, queryStr); diff --git a/src/validation/__tests__/ScalarLeafsRule-test.ts b/src/validation/__tests__/ScalarLeafsRule-test.ts index b10cf01e18..fd000b92c9 100644 --- a/src/validation/__tests__/ScalarLeafsRule-test.ts +++ b/src/validation/__tests__/ScalarLeafsRule-test.ts @@ -1,8 +1,8 @@ import { describe, it } from 'mocha'; -import { ScalarLeafsRule } from '../rules/ScalarLeafsRule'; +import { ScalarLeafsRule } from '../rules/ScalarLeafsRule.js'; -import { expectValidationErrors } from './harness'; +import { expectValidationErrors } from './harness.js'; function expectErrors(queryStr: string) { return expectValidationErrors(ScalarLeafsRule, queryStr); diff --git a/src/validation/__tests__/SingleFieldSubscriptionsRule-test.ts b/src/validation/__tests__/SingleFieldSubscriptionsRule-test.ts index e0d3789299..7e0a227d07 100644 --- a/src/validation/__tests__/SingleFieldSubscriptionsRule-test.ts +++ b/src/validation/__tests__/SingleFieldSubscriptionsRule-test.ts @@ -1,10 +1,10 @@ import { describe, it } from 'mocha'; -import { buildSchema } from '../../utilities/buildASTSchema'; +import { buildSchema } from '../../utilities/buildASTSchema.js'; -import { SingleFieldSubscriptionsRule } from '../rules/SingleFieldSubscriptionsRule'; +import { SingleFieldSubscriptionsRule } from '../rules/SingleFieldSubscriptionsRule.js'; -import { expectValidationErrorsWithSchema } from './harness'; +import { expectValidationErrorsWithSchema } from './harness.js'; function expectErrors(queryStr: string) { return expectValidationErrorsWithSchema( diff --git a/src/validation/__tests__/UniqueArgumentDefinitionNamesRule-test.ts b/src/validation/__tests__/UniqueArgumentDefinitionNamesRule-test.ts index cf63202b52..96855e268f 100644 --- a/src/validation/__tests__/UniqueArgumentDefinitionNamesRule-test.ts +++ b/src/validation/__tests__/UniqueArgumentDefinitionNamesRule-test.ts @@ -1,8 +1,8 @@ import { describe, it } from 'mocha'; -import { UniqueArgumentDefinitionNamesRule } from '../rules/UniqueArgumentDefinitionNamesRule'; +import { UniqueArgumentDefinitionNamesRule } from '../rules/UniqueArgumentDefinitionNamesRule.js'; -import { expectSDLValidationErrors } from './harness'; +import { expectSDLValidationErrors } from './harness.js'; function expectSDLErrors(sdlStr: string) { return expectSDLValidationErrors( diff --git a/src/validation/__tests__/UniqueArgumentNamesRule-test.ts b/src/validation/__tests__/UniqueArgumentNamesRule-test.ts index f5709e321a..8a08f98468 100644 --- a/src/validation/__tests__/UniqueArgumentNamesRule-test.ts +++ b/src/validation/__tests__/UniqueArgumentNamesRule-test.ts @@ -1,8 +1,8 @@ import { describe, it } from 'mocha'; -import { UniqueArgumentNamesRule } from '../rules/UniqueArgumentNamesRule'; +import { UniqueArgumentNamesRule } from '../rules/UniqueArgumentNamesRule.js'; -import { expectValidationErrors } from './harness'; +import { expectValidationErrors } from './harness.js'; function expectErrors(queryStr: string) { return expectValidationErrors(UniqueArgumentNamesRule, queryStr); diff --git a/src/validation/__tests__/UniqueDirectiveNamesRule-test.ts b/src/validation/__tests__/UniqueDirectiveNamesRule-test.ts index a632af286a..97cc1a1a6c 100644 --- a/src/validation/__tests__/UniqueDirectiveNamesRule-test.ts +++ b/src/validation/__tests__/UniqueDirectiveNamesRule-test.ts @@ -1,12 +1,12 @@ import { describe, it } from 'mocha'; -import type { GraphQLSchema } from '../../type/schema'; +import type { GraphQLSchema } from '../../type/schema.js'; -import { buildSchema } from '../../utilities/buildASTSchema'; +import { buildSchema } from '../../utilities/buildASTSchema.js'; -import { UniqueDirectiveNamesRule } from '../rules/UniqueDirectiveNamesRule'; +import { UniqueDirectiveNamesRule } from '../rules/UniqueDirectiveNamesRule.js'; -import { expectSDLValidationErrors } from './harness'; +import { expectSDLValidationErrors } from './harness.js'; function expectSDLErrors(sdlStr: string, schema?: GraphQLSchema) { return expectSDLValidationErrors(schema, UniqueDirectiveNamesRule, sdlStr); diff --git a/src/validation/__tests__/UniqueDirectivesPerLocationRule-test.ts b/src/validation/__tests__/UniqueDirectivesPerLocationRule-test.ts index d57a3df684..fd67ff8719 100644 --- a/src/validation/__tests__/UniqueDirectivesPerLocationRule-test.ts +++ b/src/validation/__tests__/UniqueDirectivesPerLocationRule-test.ts @@ -1,18 +1,18 @@ import { describe, it } from 'mocha'; -import { parse } from '../../language/parser'; +import { parse } from '../../language/parser.js'; -import type { GraphQLSchema } from '../../type/schema'; +import type { GraphQLSchema } from '../../type/schema.js'; -import { extendSchema } from '../../utilities/extendSchema'; +import { extendSchema } from '../../utilities/extendSchema.js'; -import { UniqueDirectivesPerLocationRule } from '../rules/UniqueDirectivesPerLocationRule'; +import { UniqueDirectivesPerLocationRule } from '../rules/UniqueDirectivesPerLocationRule.js'; import { expectSDLValidationErrors, expectValidationErrorsWithSchema, testSchema, -} from './harness'; +} from './harness.js'; const extensionSDL = ` directive @directive on FIELD | FRAGMENT_DEFINITION diff --git a/src/validation/__tests__/UniqueEnumValueNamesRule-test.ts b/src/validation/__tests__/UniqueEnumValueNamesRule-test.ts index 17a71a6e90..ebd31557c7 100644 --- a/src/validation/__tests__/UniqueEnumValueNamesRule-test.ts +++ b/src/validation/__tests__/UniqueEnumValueNamesRule-test.ts @@ -1,12 +1,12 @@ import { describe, it } from 'mocha'; -import type { GraphQLSchema } from '../../type/schema'; +import type { GraphQLSchema } from '../../type/schema.js'; -import { buildSchema } from '../../utilities/buildASTSchema'; +import { buildSchema } from '../../utilities/buildASTSchema.js'; -import { UniqueEnumValueNamesRule } from '../rules/UniqueEnumValueNamesRule'; +import { UniqueEnumValueNamesRule } from '../rules/UniqueEnumValueNamesRule.js'; -import { expectSDLValidationErrors } from './harness'; +import { expectSDLValidationErrors } from './harness.js'; function expectSDLErrors(sdlStr: string, schema?: GraphQLSchema) { return expectSDLValidationErrors(schema, UniqueEnumValueNamesRule, sdlStr); diff --git a/src/validation/__tests__/UniqueFieldDefinitionNamesRule-test.ts b/src/validation/__tests__/UniqueFieldDefinitionNamesRule-test.ts index 441e85d31a..2c80b4c5d6 100644 --- a/src/validation/__tests__/UniqueFieldDefinitionNamesRule-test.ts +++ b/src/validation/__tests__/UniqueFieldDefinitionNamesRule-test.ts @@ -1,12 +1,12 @@ import { describe, it } from 'mocha'; -import type { GraphQLSchema } from '../../type/schema'; +import type { GraphQLSchema } from '../../type/schema.js'; -import { buildSchema } from '../../utilities/buildASTSchema'; +import { buildSchema } from '../../utilities/buildASTSchema.js'; -import { UniqueFieldDefinitionNamesRule } from '../rules/UniqueFieldDefinitionNamesRule'; +import { UniqueFieldDefinitionNamesRule } from '../rules/UniqueFieldDefinitionNamesRule.js'; -import { expectSDLValidationErrors } from './harness'; +import { expectSDLValidationErrors } from './harness.js'; function expectSDLErrors(sdlStr: string, schema?: GraphQLSchema) { return expectSDLValidationErrors( diff --git a/src/validation/__tests__/UniqueFragmentNamesRule-test.ts b/src/validation/__tests__/UniqueFragmentNamesRule-test.ts index 2a693a6781..30b0f5f489 100644 --- a/src/validation/__tests__/UniqueFragmentNamesRule-test.ts +++ b/src/validation/__tests__/UniqueFragmentNamesRule-test.ts @@ -1,8 +1,8 @@ import { describe, it } from 'mocha'; -import { UniqueFragmentNamesRule } from '../rules/UniqueFragmentNamesRule'; +import { UniqueFragmentNamesRule } from '../rules/UniqueFragmentNamesRule.js'; -import { expectValidationErrors } from './harness'; +import { expectValidationErrors } from './harness.js'; function expectErrors(queryStr: string) { return expectValidationErrors(UniqueFragmentNamesRule, queryStr); diff --git a/src/validation/__tests__/UniqueInputFieldNamesRule-test.ts b/src/validation/__tests__/UniqueInputFieldNamesRule-test.ts index 33e4a2db01..3dc56fffee 100644 --- a/src/validation/__tests__/UniqueInputFieldNamesRule-test.ts +++ b/src/validation/__tests__/UniqueInputFieldNamesRule-test.ts @@ -1,8 +1,8 @@ import { describe, it } from 'mocha'; -import { UniqueInputFieldNamesRule } from '../rules/UniqueInputFieldNamesRule'; +import { UniqueInputFieldNamesRule } from '../rules/UniqueInputFieldNamesRule.js'; -import { expectValidationErrors } from './harness'; +import { expectValidationErrors } from './harness.js'; function expectErrors(queryStr: string) { return expectValidationErrors(UniqueInputFieldNamesRule, queryStr); diff --git a/src/validation/__tests__/UniqueOperationNamesRule-test.ts b/src/validation/__tests__/UniqueOperationNamesRule-test.ts index f84abda63e..ef24487a63 100644 --- a/src/validation/__tests__/UniqueOperationNamesRule-test.ts +++ b/src/validation/__tests__/UniqueOperationNamesRule-test.ts @@ -1,8 +1,8 @@ import { describe, it } from 'mocha'; -import { UniqueOperationNamesRule } from '../rules/UniqueOperationNamesRule'; +import { UniqueOperationNamesRule } from '../rules/UniqueOperationNamesRule.js'; -import { expectValidationErrors } from './harness'; +import { expectValidationErrors } from './harness.js'; function expectErrors(queryStr: string) { return expectValidationErrors(UniqueOperationNamesRule, queryStr); diff --git a/src/validation/__tests__/UniqueOperationTypesRule-test.ts b/src/validation/__tests__/UniqueOperationTypesRule-test.ts index 61e819b022..65265b92e1 100644 --- a/src/validation/__tests__/UniqueOperationTypesRule-test.ts +++ b/src/validation/__tests__/UniqueOperationTypesRule-test.ts @@ -1,12 +1,12 @@ import { describe, it } from 'mocha'; -import type { GraphQLSchema } from '../../type/schema'; +import type { GraphQLSchema } from '../../type/schema.js'; -import { buildSchema } from '../../utilities/buildASTSchema'; +import { buildSchema } from '../../utilities/buildASTSchema.js'; -import { UniqueOperationTypesRule } from '../rules/UniqueOperationTypesRule'; +import { UniqueOperationTypesRule } from '../rules/UniqueOperationTypesRule.js'; -import { expectSDLValidationErrors } from './harness'; +import { expectSDLValidationErrors } from './harness.js'; function expectSDLErrors(sdlStr: string, schema?: GraphQLSchema) { return expectSDLValidationErrors(schema, UniqueOperationTypesRule, sdlStr); diff --git a/src/validation/__tests__/UniqueTypeNamesRule-test.ts b/src/validation/__tests__/UniqueTypeNamesRule-test.ts index 5478467dec..b45b66bf2a 100644 --- a/src/validation/__tests__/UniqueTypeNamesRule-test.ts +++ b/src/validation/__tests__/UniqueTypeNamesRule-test.ts @@ -1,12 +1,12 @@ import { describe, it } from 'mocha'; -import type { GraphQLSchema } from '../../type/schema'; +import type { GraphQLSchema } from '../../type/schema.js'; -import { buildSchema } from '../../utilities/buildASTSchema'; +import { buildSchema } from '../../utilities/buildASTSchema.js'; -import { UniqueTypeNamesRule } from '../rules/UniqueTypeNamesRule'; +import { UniqueTypeNamesRule } from '../rules/UniqueTypeNamesRule.js'; -import { expectSDLValidationErrors } from './harness'; +import { expectSDLValidationErrors } from './harness.js'; function expectSDLErrors(sdlStr: string, schema?: GraphQLSchema) { return expectSDLValidationErrors(schema, UniqueTypeNamesRule, sdlStr); diff --git a/src/validation/__tests__/UniqueVariableNamesRule-test.ts b/src/validation/__tests__/UniqueVariableNamesRule-test.ts index 9d51b62170..f23c778320 100644 --- a/src/validation/__tests__/UniqueVariableNamesRule-test.ts +++ b/src/validation/__tests__/UniqueVariableNamesRule-test.ts @@ -1,8 +1,8 @@ import { describe, it } from 'mocha'; -import { UniqueVariableNamesRule } from '../rules/UniqueVariableNamesRule'; +import { UniqueVariableNamesRule } from '../rules/UniqueVariableNamesRule.js'; -import { expectValidationErrors } from './harness'; +import { expectValidationErrors } from './harness.js'; function expectErrors(queryStr: string) { return expectValidationErrors(UniqueVariableNamesRule, queryStr); diff --git a/src/validation/__tests__/ValidationContext-test.ts b/src/validation/__tests__/ValidationContext-test.ts index 159aa30549..ac1a5442b4 100644 --- a/src/validation/__tests__/ValidationContext-test.ts +++ b/src/validation/__tests__/ValidationContext-test.ts @@ -1,19 +1,19 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { identityFunc } from '../../jsutils/identityFunc'; +import { identityFunc } from '../../jsutils/identityFunc.js'; -import { parse } from '../../language/parser'; +import { parse } from '../../language/parser.js'; -import { GraphQLSchema } from '../../type/schema'; +import { GraphQLSchema } from '../../type/schema.js'; -import { TypeInfo } from '../../utilities/TypeInfo'; +import { TypeInfo } from '../../utilities/TypeInfo.js'; import { ASTValidationContext, SDLValidationContext, ValidationContext, -} from '../ValidationContext'; +} from '../ValidationContext.js'; describe('ValidationContext', () => { it('can be Object.toStringified', () => { diff --git a/src/validation/__tests__/ValuesOfCorrectTypeRule-test.ts b/src/validation/__tests__/ValuesOfCorrectTypeRule-test.ts index 76b03035da..f0b7dfa57e 100644 --- a/src/validation/__tests__/ValuesOfCorrectTypeRule-test.ts +++ b/src/validation/__tests__/ValuesOfCorrectTypeRule-test.ts @@ -1,23 +1,23 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { expectJSON } from '../../__testUtils__/expectJSON'; +import { expectJSON } from '../../__testUtils__/expectJSON.js'; -import { inspect } from '../../jsutils/inspect'; +import { inspect } from '../../jsutils/inspect.js'; -import { parse } from '../../language/parser'; +import { parse } from '../../language/parser.js'; -import { GraphQLObjectType, GraphQLScalarType } from '../../type/definition'; -import { GraphQLString } from '../../type/scalars'; -import { GraphQLSchema } from '../../type/schema'; +import { GraphQLObjectType, GraphQLScalarType } from '../../type/definition.js'; +import { GraphQLString } from '../../type/scalars.js'; +import { GraphQLSchema } from '../../type/schema.js'; -import { ValuesOfCorrectTypeRule } from '../rules/ValuesOfCorrectTypeRule'; -import { validate } from '../validate'; +import { ValuesOfCorrectTypeRule } from '../rules/ValuesOfCorrectTypeRule.js'; +import { validate } from '../validate.js'; import { expectValidationErrors, expectValidationErrorsWithSchema, -} from './harness'; +} from './harness.js'; function expectErrors(queryStr: string) { return expectValidationErrors(ValuesOfCorrectTypeRule, queryStr); diff --git a/src/validation/__tests__/VariablesAreInputTypesRule-test.ts b/src/validation/__tests__/VariablesAreInputTypesRule-test.ts index 7b754fd76f..8027a35826 100644 --- a/src/validation/__tests__/VariablesAreInputTypesRule-test.ts +++ b/src/validation/__tests__/VariablesAreInputTypesRule-test.ts @@ -1,8 +1,8 @@ import { describe, it } from 'mocha'; -import { VariablesAreInputTypesRule } from '../rules/VariablesAreInputTypesRule'; +import { VariablesAreInputTypesRule } from '../rules/VariablesAreInputTypesRule.js'; -import { expectValidationErrors } from './harness'; +import { expectValidationErrors } from './harness.js'; function expectErrors(queryStr: string) { return expectValidationErrors(VariablesAreInputTypesRule, queryStr); diff --git a/src/validation/__tests__/VariablesInAllowedPositionRule-test.ts b/src/validation/__tests__/VariablesInAllowedPositionRule-test.ts index 090f1680c4..16467741bb 100644 --- a/src/validation/__tests__/VariablesInAllowedPositionRule-test.ts +++ b/src/validation/__tests__/VariablesInAllowedPositionRule-test.ts @@ -1,8 +1,8 @@ import { describe, it } from 'mocha'; -import { VariablesInAllowedPositionRule } from '../rules/VariablesInAllowedPositionRule'; +import { VariablesInAllowedPositionRule } from '../rules/VariablesInAllowedPositionRule.js'; -import { expectValidationErrors } from './harness'; +import { expectValidationErrors } from './harness.js'; function expectErrors(queryStr: string) { return expectValidationErrors(VariablesInAllowedPositionRule, queryStr); diff --git a/src/validation/__tests__/harness.ts b/src/validation/__tests__/harness.ts index 661256c56d..17b44ba758 100644 --- a/src/validation/__tests__/harness.ts +++ b/src/validation/__tests__/harness.ts @@ -1,15 +1,18 @@ -import { expectJSON } from '../../__testUtils__/expectJSON'; +import { expectJSON } from '../../__testUtils__/expectJSON.js'; -import type { Maybe } from '../../jsutils/Maybe'; +import type { Maybe } from '../../jsutils/Maybe.js'; -import { parse } from '../../language/parser'; +import { parse } from '../../language/parser.js'; -import type { GraphQLSchema } from '../../type/schema'; +import type { GraphQLSchema } from '../../type/schema.js'; -import { buildSchema } from '../../utilities/buildASTSchema'; +import { buildSchema } from '../../utilities/buildASTSchema.js'; -import { validate, validateSDL } from '../validate'; -import type { SDLValidationRule, ValidationRule } from '../ValidationContext'; +import { validate, validateSDL } from '../validate.js'; +import type { + SDLValidationRule, + ValidationRule, +} from '../ValidationContext.js'; export const testSchema: GraphQLSchema = buildSchema(` interface Mammal { diff --git a/src/validation/__tests__/validation-test.ts b/src/validation/__tests__/validation-test.ts index 2d49f9335b..a4168e2f07 100644 --- a/src/validation/__tests__/validation-test.ts +++ b/src/validation/__tests__/validation-test.ts @@ -1,20 +1,20 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; -import { expectJSON } from '../../__testUtils__/expectJSON'; +import { expectJSON } from '../../__testUtils__/expectJSON.js'; -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; -import type { DirectiveNode } from '../../language/ast'; -import { parse } from '../../language/parser'; +import type { DirectiveNode } from '../../language/ast.js'; +import { parse } from '../../language/parser.js'; -import { buildSchema } from '../../utilities/buildASTSchema'; -import { TypeInfo } from '../../utilities/TypeInfo'; +import { buildSchema } from '../../utilities/buildASTSchema.js'; +import { TypeInfo } from '../../utilities/TypeInfo.js'; -import { validate } from '../validate'; -import type { ValidationContext } from '../ValidationContext'; +import { validate } from '../validate.js'; +import type { ValidationContext } from '../ValidationContext.js'; -import { testSchema } from './harness'; +import { testSchema } from './harness.js'; describe('Validate: Supports full validation', () => { it('rejects invalid documents', () => { diff --git a/src/validation/index.ts b/src/validation/index.ts index 58cc012ee8..4535893b8f 100644 --- a/src/validation/index.ts +++ b/src/validation/index.ts @@ -1,99 +1,99 @@ -export { validate } from './validate'; +export { validate } from './validate.js'; -export { ValidationContext } from './ValidationContext'; -export type { ValidationRule } from './ValidationContext'; +export { ValidationContext } from './ValidationContext.js'; +export type { ValidationRule } from './ValidationContext.js'; // All validation rules in the GraphQL Specification. -export { specifiedRules } from './specifiedRules'; +export { specifiedRules } from './specifiedRules.js'; // Spec Section: "Executable Definitions" -export { ExecutableDefinitionsRule } from './rules/ExecutableDefinitionsRule'; +export { ExecutableDefinitionsRule } from './rules/ExecutableDefinitionsRule.js'; // Spec Section: "Field Selections on Objects, Interfaces, and Unions Types" -export { FieldsOnCorrectTypeRule } from './rules/FieldsOnCorrectTypeRule'; +export { FieldsOnCorrectTypeRule } from './rules/FieldsOnCorrectTypeRule.js'; // Spec Section: "Fragments on Composite Types" -export { FragmentsOnCompositeTypesRule } from './rules/FragmentsOnCompositeTypesRule'; +export { FragmentsOnCompositeTypesRule } from './rules/FragmentsOnCompositeTypesRule.js'; // Spec Section: "Argument Names" -export { KnownArgumentNamesRule } from './rules/KnownArgumentNamesRule'; +export { KnownArgumentNamesRule } from './rules/KnownArgumentNamesRule.js'; // Spec Section: "Directives Are Defined" -export { KnownDirectivesRule } from './rules/KnownDirectivesRule'; +export { KnownDirectivesRule } from './rules/KnownDirectivesRule.js'; // Spec Section: "Fragment spread target defined" -export { KnownFragmentNamesRule } from './rules/KnownFragmentNamesRule'; +export { KnownFragmentNamesRule } from './rules/KnownFragmentNamesRule.js'; // Spec Section: "Fragment Spread Type Existence" -export { KnownTypeNamesRule } from './rules/KnownTypeNamesRule'; +export { KnownTypeNamesRule } from './rules/KnownTypeNamesRule.js'; // Spec Section: "Lone Anonymous Operation" -export { LoneAnonymousOperationRule } from './rules/LoneAnonymousOperationRule'; +export { LoneAnonymousOperationRule } from './rules/LoneAnonymousOperationRule.js'; // Spec Section: "Fragments must not form cycles" -export { NoFragmentCyclesRule } from './rules/NoFragmentCyclesRule'; +export { NoFragmentCyclesRule } from './rules/NoFragmentCyclesRule.js'; // Spec Section: "All Variable Used Defined" -export { NoUndefinedVariablesRule } from './rules/NoUndefinedVariablesRule'; +export { NoUndefinedVariablesRule } from './rules/NoUndefinedVariablesRule.js'; // Spec Section: "Fragments must be used" -export { NoUnusedFragmentsRule } from './rules/NoUnusedFragmentsRule'; +export { NoUnusedFragmentsRule } from './rules/NoUnusedFragmentsRule.js'; // Spec Section: "All Variables Used" -export { NoUnusedVariablesRule } from './rules/NoUnusedVariablesRule'; +export { NoUnusedVariablesRule } from './rules/NoUnusedVariablesRule.js'; // Spec Section: "Field Selection Merging" -export { OverlappingFieldsCanBeMergedRule } from './rules/OverlappingFieldsCanBeMergedRule'; +export { OverlappingFieldsCanBeMergedRule } from './rules/OverlappingFieldsCanBeMergedRule.js'; // Spec Section: "Fragment spread is possible" -export { PossibleFragmentSpreadsRule } from './rules/PossibleFragmentSpreadsRule'; +export { PossibleFragmentSpreadsRule } from './rules/PossibleFragmentSpreadsRule.js'; // Spec Section: "Argument Optionality" -export { ProvidedRequiredArgumentsRule } from './rules/ProvidedRequiredArgumentsRule'; +export { ProvidedRequiredArgumentsRule } from './rules/ProvidedRequiredArgumentsRule.js'; // Spec Section: "Leaf Field Selections" -export { ScalarLeafsRule } from './rules/ScalarLeafsRule'; +export { ScalarLeafsRule } from './rules/ScalarLeafsRule.js'; // Spec Section: "Subscriptions with Single Root Field" -export { SingleFieldSubscriptionsRule } from './rules/SingleFieldSubscriptionsRule'; +export { SingleFieldSubscriptionsRule } from './rules/SingleFieldSubscriptionsRule.js'; // Spec Section: "Argument Uniqueness" -export { UniqueArgumentNamesRule } from './rules/UniqueArgumentNamesRule'; +export { UniqueArgumentNamesRule } from './rules/UniqueArgumentNamesRule.js'; // Spec Section: "Directives Are Unique Per Location" -export { UniqueDirectivesPerLocationRule } from './rules/UniqueDirectivesPerLocationRule'; +export { UniqueDirectivesPerLocationRule } from './rules/UniqueDirectivesPerLocationRule.js'; // Spec Section: "Fragment Name Uniqueness" -export { UniqueFragmentNamesRule } from './rules/UniqueFragmentNamesRule'; +export { UniqueFragmentNamesRule } from './rules/UniqueFragmentNamesRule.js'; // Spec Section: "Input Object Field Uniqueness" -export { UniqueInputFieldNamesRule } from './rules/UniqueInputFieldNamesRule'; +export { UniqueInputFieldNamesRule } from './rules/UniqueInputFieldNamesRule.js'; // Spec Section: "Operation Name Uniqueness" -export { UniqueOperationNamesRule } from './rules/UniqueOperationNamesRule'; +export { UniqueOperationNamesRule } from './rules/UniqueOperationNamesRule.js'; // Spec Section: "Variable Uniqueness" -export { UniqueVariableNamesRule } from './rules/UniqueVariableNamesRule'; +export { UniqueVariableNamesRule } from './rules/UniqueVariableNamesRule.js'; // Spec Section: "Values Type Correctness" -export { ValuesOfCorrectTypeRule } from './rules/ValuesOfCorrectTypeRule'; +export { ValuesOfCorrectTypeRule } from './rules/ValuesOfCorrectTypeRule.js'; // Spec Section: "Variables are Input Types" -export { VariablesAreInputTypesRule } from './rules/VariablesAreInputTypesRule'; +export { VariablesAreInputTypesRule } from './rules/VariablesAreInputTypesRule.js'; // Spec Section: "All Variable Usages Are Allowed" -export { VariablesInAllowedPositionRule } from './rules/VariablesInAllowedPositionRule'; +export { VariablesInAllowedPositionRule } from './rules/VariablesInAllowedPositionRule.js'; // SDL-specific validation rules -export { LoneSchemaDefinitionRule } from './rules/LoneSchemaDefinitionRule'; -export { UniqueOperationTypesRule } from './rules/UniqueOperationTypesRule'; -export { UniqueTypeNamesRule } from './rules/UniqueTypeNamesRule'; -export { UniqueEnumValueNamesRule } from './rules/UniqueEnumValueNamesRule'; -export { UniqueFieldDefinitionNamesRule } from './rules/UniqueFieldDefinitionNamesRule'; -export { UniqueArgumentDefinitionNamesRule } from './rules/UniqueArgumentDefinitionNamesRule'; -export { UniqueDirectiveNamesRule } from './rules/UniqueDirectiveNamesRule'; -export { PossibleTypeExtensionsRule } from './rules/PossibleTypeExtensionsRule'; +export { LoneSchemaDefinitionRule } from './rules/LoneSchemaDefinitionRule.js'; +export { UniqueOperationTypesRule } from './rules/UniqueOperationTypesRule.js'; +export { UniqueTypeNamesRule } from './rules/UniqueTypeNamesRule.js'; +export { UniqueEnumValueNamesRule } from './rules/UniqueEnumValueNamesRule.js'; +export { UniqueFieldDefinitionNamesRule } from './rules/UniqueFieldDefinitionNamesRule.js'; +export { UniqueArgumentDefinitionNamesRule } from './rules/UniqueArgumentDefinitionNamesRule.js'; +export { UniqueDirectiveNamesRule } from './rules/UniqueDirectiveNamesRule.js'; +export { PossibleTypeExtensionsRule } from './rules/PossibleTypeExtensionsRule.js'; // Optional rules not defined by the GraphQL Specification -export { NoDeprecatedCustomRule } from './rules/custom/NoDeprecatedCustomRule'; -export { NoSchemaIntrospectionCustomRule } from './rules/custom/NoSchemaIntrospectionCustomRule'; +export { NoDeprecatedCustomRule } from './rules/custom/NoDeprecatedCustomRule.js'; +export { NoSchemaIntrospectionCustomRule } from './rules/custom/NoSchemaIntrospectionCustomRule.js'; diff --git a/src/validation/rules/ExecutableDefinitionsRule.ts b/src/validation/rules/ExecutableDefinitionsRule.ts index 8f82a6797b..ef246458bf 100644 --- a/src/validation/rules/ExecutableDefinitionsRule.ts +++ b/src/validation/rules/ExecutableDefinitionsRule.ts @@ -1,10 +1,10 @@ -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; -import { Kind } from '../../language/kinds'; -import { isExecutableDefinitionNode } from '../../language/predicates'; -import type { ASTVisitor } from '../../language/visitor'; +import { Kind } from '../../language/kinds.js'; +import { isExecutableDefinitionNode } from '../../language/predicates.js'; +import type { ASTVisitor } from '../../language/visitor.js'; -import type { ASTValidationContext } from '../ValidationContext'; +import type { ASTValidationContext } from '../ValidationContext.js'; /** * Executable definitions diff --git a/src/validation/rules/FieldsOnCorrectTypeRule.ts b/src/validation/rules/FieldsOnCorrectTypeRule.ts index 9182f9c4a1..c9c6f3ea4f 100644 --- a/src/validation/rules/FieldsOnCorrectTypeRule.ts +++ b/src/validation/rules/FieldsOnCorrectTypeRule.ts @@ -1,25 +1,25 @@ -import { didYouMean } from '../../jsutils/didYouMean'; -import { naturalCompare } from '../../jsutils/naturalCompare'; -import { suggestionList } from '../../jsutils/suggestionList'; +import { didYouMean } from '../../jsutils/didYouMean.js'; +import { naturalCompare } from '../../jsutils/naturalCompare.js'; +import { suggestionList } from '../../jsutils/suggestionList.js'; -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; -import type { FieldNode } from '../../language/ast'; -import type { ASTVisitor } from '../../language/visitor'; +import type { FieldNode } from '../../language/ast.js'; +import type { ASTVisitor } from '../../language/visitor.js'; import type { GraphQLInterfaceType, GraphQLObjectType, GraphQLOutputType, -} from '../../type/definition'; +} from '../../type/definition.js'; import { isAbstractType, isInterfaceType, isObjectType, -} from '../../type/definition'; -import type { GraphQLSchema } from '../../type/schema'; +} from '../../type/definition.js'; +import type { GraphQLSchema } from '../../type/schema.js'; -import type { ValidationContext } from '../ValidationContext'; +import type { ValidationContext } from '../ValidationContext.js'; /** * Fields on correct type diff --git a/src/validation/rules/FragmentsOnCompositeTypesRule.ts b/src/validation/rules/FragmentsOnCompositeTypesRule.ts index fb71f63836..b8b61877e4 100644 --- a/src/validation/rules/FragmentsOnCompositeTypesRule.ts +++ b/src/validation/rules/FragmentsOnCompositeTypesRule.ts @@ -1,13 +1,13 @@ -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; -import { print } from '../../language/printer'; -import type { ASTVisitor } from '../../language/visitor'; +import { print } from '../../language/printer.js'; +import type { ASTVisitor } from '../../language/visitor.js'; -import { isCompositeType } from '../../type/definition'; +import { isCompositeType } from '../../type/definition.js'; -import { typeFromAST } from '../../utilities/typeFromAST'; +import { typeFromAST } from '../../utilities/typeFromAST.js'; -import type { ValidationContext } from '../ValidationContext'; +import type { ValidationContext } from '../ValidationContext.js'; /** * Fragments on composite type diff --git a/src/validation/rules/KnownArgumentNamesRule.ts b/src/validation/rules/KnownArgumentNamesRule.ts index 332b21c1ca..d2668d40ef 100644 --- a/src/validation/rules/KnownArgumentNamesRule.ts +++ b/src/validation/rules/KnownArgumentNamesRule.ts @@ -1,17 +1,17 @@ -import { didYouMean } from '../../jsutils/didYouMean'; -import { suggestionList } from '../../jsutils/suggestionList'; +import { didYouMean } from '../../jsutils/didYouMean.js'; +import { suggestionList } from '../../jsutils/suggestionList.js'; -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; -import { Kind } from '../../language/kinds'; -import type { ASTVisitor } from '../../language/visitor'; +import { Kind } from '../../language/kinds.js'; +import type { ASTVisitor } from '../../language/visitor.js'; -import { specifiedDirectives } from '../../type/directives'; +import { specifiedDirectives } from '../../type/directives.js'; import type { SDLValidationContext, ValidationContext, -} from '../ValidationContext'; +} from '../ValidationContext.js'; /** * Known argument names diff --git a/src/validation/rules/KnownDirectivesRule.ts b/src/validation/rules/KnownDirectivesRule.ts index 1c7b822388..57641b91e7 100644 --- a/src/validation/rules/KnownDirectivesRule.ts +++ b/src/validation/rules/KnownDirectivesRule.ts @@ -1,20 +1,20 @@ -import { inspect } from '../../jsutils/inspect'; -import { invariant } from '../../jsutils/invariant'; +import { inspect } from '../../jsutils/inspect.js'; +import { invariant } from '../../jsutils/invariant.js'; -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; -import type { ASTNode } from '../../language/ast'; -import { OperationTypeNode } from '../../language/ast'; -import { DirectiveLocation } from '../../language/directiveLocation'; -import { Kind } from '../../language/kinds'; -import type { ASTVisitor } from '../../language/visitor'; +import type { ASTNode } from '../../language/ast.js'; +import { OperationTypeNode } from '../../language/ast.js'; +import { DirectiveLocation } from '../../language/directiveLocation.js'; +import { Kind } from '../../language/kinds.js'; +import type { ASTVisitor } from '../../language/visitor.js'; -import { specifiedDirectives } from '../../type/directives'; +import { specifiedDirectives } from '../../type/directives.js'; import type { SDLValidationContext, ValidationContext, -} from '../ValidationContext'; +} from '../ValidationContext.js'; /** * Known directives diff --git a/src/validation/rules/KnownFragmentNamesRule.ts b/src/validation/rules/KnownFragmentNamesRule.ts index c37403f752..91b30e7d2c 100644 --- a/src/validation/rules/KnownFragmentNamesRule.ts +++ b/src/validation/rules/KnownFragmentNamesRule.ts @@ -1,8 +1,8 @@ -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; -import type { ASTVisitor } from '../../language/visitor'; +import type { ASTVisitor } from '../../language/visitor.js'; -import type { ValidationContext } from '../ValidationContext'; +import type { ValidationContext } from '../ValidationContext.js'; /** * Known fragment names diff --git a/src/validation/rules/KnownTypeNamesRule.ts b/src/validation/rules/KnownTypeNamesRule.ts index fadc080c35..22352e4544 100644 --- a/src/validation/rules/KnownTypeNamesRule.ts +++ b/src/validation/rules/KnownTypeNamesRule.ts @@ -1,23 +1,23 @@ -import { didYouMean } from '../../jsutils/didYouMean'; -import { suggestionList } from '../../jsutils/suggestionList'; +import { didYouMean } from '../../jsutils/didYouMean.js'; +import { suggestionList } from '../../jsutils/suggestionList.js'; -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; -import type { ASTNode } from '../../language/ast'; +import type { ASTNode } from '../../language/ast.js'; import { isTypeDefinitionNode, isTypeSystemDefinitionNode, isTypeSystemExtensionNode, -} from '../../language/predicates'; -import type { ASTVisitor } from '../../language/visitor'; +} from '../../language/predicates.js'; +import type { ASTVisitor } from '../../language/visitor.js'; -import { introspectionTypes } from '../../type/introspection'; -import { specifiedScalarTypes } from '../../type/scalars'; +import { introspectionTypes } from '../../type/introspection.js'; +import { specifiedScalarTypes } from '../../type/scalars.js'; import type { SDLValidationContext, ValidationContext, -} from '../ValidationContext'; +} from '../ValidationContext.js'; /** * Known type names diff --git a/src/validation/rules/LoneAnonymousOperationRule.ts b/src/validation/rules/LoneAnonymousOperationRule.ts index 291a494c76..cd04a2968d 100644 --- a/src/validation/rules/LoneAnonymousOperationRule.ts +++ b/src/validation/rules/LoneAnonymousOperationRule.ts @@ -1,9 +1,9 @@ -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; -import { Kind } from '../../language/kinds'; -import type { ASTVisitor } from '../../language/visitor'; +import { Kind } from '../../language/kinds.js'; +import type { ASTVisitor } from '../../language/visitor.js'; -import type { ASTValidationContext } from '../ValidationContext'; +import type { ASTValidationContext } from '../ValidationContext.js'; /** * Lone anonymous operation diff --git a/src/validation/rules/LoneSchemaDefinitionRule.ts b/src/validation/rules/LoneSchemaDefinitionRule.ts index 4eeb8cdcba..8c0262ab39 100644 --- a/src/validation/rules/LoneSchemaDefinitionRule.ts +++ b/src/validation/rules/LoneSchemaDefinitionRule.ts @@ -1,8 +1,8 @@ -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; -import type { ASTVisitor } from '../../language/visitor'; +import type { ASTVisitor } from '../../language/visitor.js'; -import type { SDLValidationContext } from '../ValidationContext'; +import type { SDLValidationContext } from '../ValidationContext.js'; /** * Lone Schema definition diff --git a/src/validation/rules/NoFragmentCyclesRule.ts b/src/validation/rules/NoFragmentCyclesRule.ts index 448b1cf496..cdb3364553 100644 --- a/src/validation/rules/NoFragmentCyclesRule.ts +++ b/src/validation/rules/NoFragmentCyclesRule.ts @@ -1,14 +1,14 @@ -import type { ObjMap } from '../../jsutils/ObjMap'; +import type { ObjMap } from '../../jsutils/ObjMap.js'; -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; import type { FragmentDefinitionNode, FragmentSpreadNode, -} from '../../language/ast'; -import type { ASTVisitor } from '../../language/visitor'; +} from '../../language/ast.js'; +import type { ASTVisitor } from '../../language/visitor.js'; -import type { ASTValidationContext } from '../ValidationContext'; +import type { ASTValidationContext } from '../ValidationContext.js'; /** * No fragment cycles diff --git a/src/validation/rules/NoUndefinedVariablesRule.ts b/src/validation/rules/NoUndefinedVariablesRule.ts index 3d499b5dcc..06c561642d 100644 --- a/src/validation/rules/NoUndefinedVariablesRule.ts +++ b/src/validation/rules/NoUndefinedVariablesRule.ts @@ -1,8 +1,8 @@ -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; -import type { ASTVisitor } from '../../language/visitor'; +import type { ASTVisitor } from '../../language/visitor.js'; -import type { ValidationContext } from '../ValidationContext'; +import type { ValidationContext } from '../ValidationContext.js'; /** * No undefined variables diff --git a/src/validation/rules/NoUnusedFragmentsRule.ts b/src/validation/rules/NoUnusedFragmentsRule.ts index aebf34535d..fa024a0daa 100644 --- a/src/validation/rules/NoUnusedFragmentsRule.ts +++ b/src/validation/rules/NoUnusedFragmentsRule.ts @@ -1,12 +1,12 @@ -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; import type { FragmentDefinitionNode, OperationDefinitionNode, -} from '../../language/ast'; -import type { ASTVisitor } from '../../language/visitor'; +} from '../../language/ast.js'; +import type { ASTVisitor } from '../../language/visitor.js'; -import type { ASTValidationContext } from '../ValidationContext'; +import type { ASTValidationContext } from '../ValidationContext.js'; /** * No unused fragments diff --git a/src/validation/rules/NoUnusedVariablesRule.ts b/src/validation/rules/NoUnusedVariablesRule.ts index 5083af4f28..c6c46e6443 100644 --- a/src/validation/rules/NoUnusedVariablesRule.ts +++ b/src/validation/rules/NoUnusedVariablesRule.ts @@ -1,9 +1,9 @@ -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; -import type { VariableDefinitionNode } from '../../language/ast'; -import type { ASTVisitor } from '../../language/visitor'; +import type { VariableDefinitionNode } from '../../language/ast.js'; +import type { ASTVisitor } from '../../language/visitor.js'; -import type { ValidationContext } from '../ValidationContext'; +import type { ValidationContext } from '../ValidationContext.js'; /** * No unused variables diff --git a/src/validation/rules/OverlappingFieldsCanBeMergedRule.ts b/src/validation/rules/OverlappingFieldsCanBeMergedRule.ts index bdf6eb874e..de40a2c17e 100644 --- a/src/validation/rules/OverlappingFieldsCanBeMergedRule.ts +++ b/src/validation/rules/OverlappingFieldsCanBeMergedRule.ts @@ -1,24 +1,24 @@ -import { inspect } from '../../jsutils/inspect'; -import type { Maybe } from '../../jsutils/Maybe'; -import type { ObjMap } from '../../jsutils/ObjMap'; +import { inspect } from '../../jsutils/inspect.js'; +import type { Maybe } from '../../jsutils/Maybe.js'; +import type { ObjMap } from '../../jsutils/ObjMap.js'; -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; import type { FieldNode, FragmentDefinitionNode, ObjectValueNode, SelectionSetNode, -} from '../../language/ast'; -import { Kind } from '../../language/kinds'; -import { print } from '../../language/printer'; -import type { ASTVisitor } from '../../language/visitor'; +} from '../../language/ast.js'; +import { Kind } from '../../language/kinds.js'; +import { print } from '../../language/printer.js'; +import type { ASTVisitor } from '../../language/visitor.js'; import type { GraphQLField, GraphQLNamedType, GraphQLOutputType, -} from '../../type/definition'; +} from '../../type/definition.js'; import { getNamedType, isInterfaceType, @@ -26,12 +26,12 @@ import { isListType, isNonNullType, isObjectType, -} from '../../type/definition'; +} from '../../type/definition.js'; -import { sortValueNode } from '../../utilities/sortValueNode'; -import { typeFromAST } from '../../utilities/typeFromAST'; +import { sortValueNode } from '../../utilities/sortValueNode.js'; +import { typeFromAST } from '../../utilities/typeFromAST.js'; -import type { ValidationContext } from '../ValidationContext'; +import type { ValidationContext } from '../ValidationContext.js'; function reasonMessage(reason: ConflictReasonMessage): string { if (Array.isArray(reason)) { diff --git a/src/validation/rules/PossibleFragmentSpreadsRule.ts b/src/validation/rules/PossibleFragmentSpreadsRule.ts index fe738e5559..e486025984 100644 --- a/src/validation/rules/PossibleFragmentSpreadsRule.ts +++ b/src/validation/rules/PossibleFragmentSpreadsRule.ts @@ -1,17 +1,17 @@ -import { inspect } from '../../jsutils/inspect'; -import type { Maybe } from '../../jsutils/Maybe'; +import { inspect } from '../../jsutils/inspect.js'; +import type { Maybe } from '../../jsutils/Maybe.js'; -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; -import type { ASTVisitor } from '../../language/visitor'; +import type { ASTVisitor } from '../../language/visitor.js'; -import type { GraphQLCompositeType } from '../../type/definition'; -import { isCompositeType } from '../../type/definition'; +import type { GraphQLCompositeType } from '../../type/definition.js'; +import { isCompositeType } from '../../type/definition.js'; -import { doTypesOverlap } from '../../utilities/typeComparators'; -import { typeFromAST } from '../../utilities/typeFromAST'; +import { doTypesOverlap } from '../../utilities/typeComparators.js'; +import { typeFromAST } from '../../utilities/typeFromAST.js'; -import type { ValidationContext } from '../ValidationContext'; +import type { ValidationContext } from '../ValidationContext.js'; /** * Possible fragment spread diff --git a/src/validation/rules/PossibleTypeExtensionsRule.ts b/src/validation/rules/PossibleTypeExtensionsRule.ts index f14019bcb2..dfc7889895 100644 --- a/src/validation/rules/PossibleTypeExtensionsRule.ts +++ b/src/validation/rules/PossibleTypeExtensionsRule.ts @@ -1,17 +1,17 @@ -import { didYouMean } from '../../jsutils/didYouMean'; -import { inspect } from '../../jsutils/inspect'; -import { invariant } from '../../jsutils/invariant'; -import type { ObjMap } from '../../jsutils/ObjMap'; -import { suggestionList } from '../../jsutils/suggestionList'; +import { didYouMean } from '../../jsutils/didYouMean.js'; +import { inspect } from '../../jsutils/inspect.js'; +import { invariant } from '../../jsutils/invariant.js'; +import type { ObjMap } from '../../jsutils/ObjMap.js'; +import { suggestionList } from '../../jsutils/suggestionList.js'; -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; -import type { DefinitionNode, TypeExtensionNode } from '../../language/ast'; -import { Kind } from '../../language/kinds'; -import { isTypeDefinitionNode } from '../../language/predicates'; -import type { ASTVisitor } from '../../language/visitor'; +import type { DefinitionNode, TypeExtensionNode } from '../../language/ast.js'; +import { Kind } from '../../language/kinds.js'; +import { isTypeDefinitionNode } from '../../language/predicates.js'; +import type { ASTVisitor } from '../../language/visitor.js'; -import type { GraphQLNamedType } from '../../type/definition'; +import type { GraphQLNamedType } from '../../type/definition.js'; import { isEnumType, isInputObjectType, @@ -19,9 +19,9 @@ import { isObjectType, isScalarType, isUnionType, -} from '../../type/definition'; +} from '../../type/definition.js'; -import type { SDLValidationContext } from '../ValidationContext'; +import type { SDLValidationContext } from '../ValidationContext.js'; /** * Possible type extension diff --git a/src/validation/rules/ProvidedRequiredArgumentsRule.ts b/src/validation/rules/ProvidedRequiredArgumentsRule.ts index b111dcee1b..350264496f 100644 --- a/src/validation/rules/ProvidedRequiredArgumentsRule.ts +++ b/src/validation/rules/ProvidedRequiredArgumentsRule.ts @@ -1,22 +1,22 @@ -import { inspect } from '../../jsutils/inspect'; -import { keyMap } from '../../jsutils/keyMap'; -import type { ObjMap } from '../../jsutils/ObjMap'; +import { inspect } from '../../jsutils/inspect.js'; +import { keyMap } from '../../jsutils/keyMap.js'; +import type { ObjMap } from '../../jsutils/ObjMap.js'; -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; -import type { InputValueDefinitionNode } from '../../language/ast'; -import { Kind } from '../../language/kinds'; -import { print } from '../../language/printer'; -import type { ASTVisitor } from '../../language/visitor'; +import type { InputValueDefinitionNode } from '../../language/ast.js'; +import { Kind } from '../../language/kinds.js'; +import { print } from '../../language/printer.js'; +import type { ASTVisitor } from '../../language/visitor.js'; -import type { GraphQLArgument } from '../../type/definition'; -import { isRequiredArgument, isType } from '../../type/definition'; -import { specifiedDirectives } from '../../type/directives'; +import type { GraphQLArgument } from '../../type/definition.js'; +import { isRequiredArgument, isType } from '../../type/definition.js'; +import { specifiedDirectives } from '../../type/directives.js'; import type { SDLValidationContext, ValidationContext, -} from '../ValidationContext'; +} from '../ValidationContext.js'; /** * Provided required arguments diff --git a/src/validation/rules/ScalarLeafsRule.ts b/src/validation/rules/ScalarLeafsRule.ts index fb573d47e0..7e9014932c 100644 --- a/src/validation/rules/ScalarLeafsRule.ts +++ b/src/validation/rules/ScalarLeafsRule.ts @@ -1,13 +1,13 @@ -import { inspect } from '../../jsutils/inspect'; +import { inspect } from '../../jsutils/inspect.js'; -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; -import type { FieldNode } from '../../language/ast'; -import type { ASTVisitor } from '../../language/visitor'; +import type { FieldNode } from '../../language/ast.js'; +import type { ASTVisitor } from '../../language/visitor.js'; -import { getNamedType, isLeafType } from '../../type/definition'; +import { getNamedType, isLeafType } from '../../type/definition.js'; -import type { ValidationContext } from '../ValidationContext'; +import type { ValidationContext } from '../ValidationContext.js'; /** * Scalar leafs diff --git a/src/validation/rules/SingleFieldSubscriptionsRule.ts b/src/validation/rules/SingleFieldSubscriptionsRule.ts index 21cb1abaf6..914193df50 100644 --- a/src/validation/rules/SingleFieldSubscriptionsRule.ts +++ b/src/validation/rules/SingleFieldSubscriptionsRule.ts @@ -1,17 +1,17 @@ -import type { ObjMap } from '../../jsutils/ObjMap'; +import type { ObjMap } from '../../jsutils/ObjMap.js'; -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; import type { FragmentDefinitionNode, OperationDefinitionNode, -} from '../../language/ast'; -import { Kind } from '../../language/kinds'; -import type { ASTVisitor } from '../../language/visitor'; +} from '../../language/ast.js'; +import { Kind } from '../../language/kinds.js'; +import type { ASTVisitor } from '../../language/visitor.js'; -import { collectFields } from '../../execution/collectFields'; +import { collectFields } from '../../execution/collectFields.js'; -import type { ValidationContext } from '../ValidationContext'; +import type { ValidationContext } from '../ValidationContext.js'; /** * Subscriptions must only include a non-introspection field. diff --git a/src/validation/rules/UniqueArgumentDefinitionNamesRule.ts b/src/validation/rules/UniqueArgumentDefinitionNamesRule.ts index 2348276338..e7f0bb3ee2 100644 --- a/src/validation/rules/UniqueArgumentDefinitionNamesRule.ts +++ b/src/validation/rules/UniqueArgumentDefinitionNamesRule.ts @@ -1,15 +1,15 @@ -import { groupBy } from '../../jsutils/groupBy'; +import { groupBy } from '../../jsutils/groupBy.js'; -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; import type { FieldDefinitionNode, InputValueDefinitionNode, NameNode, -} from '../../language/ast'; -import type { ASTVisitor } from '../../language/visitor'; +} from '../../language/ast.js'; +import type { ASTVisitor } from '../../language/visitor.js'; -import type { SDLValidationContext } from '../ValidationContext'; +import type { SDLValidationContext } from '../ValidationContext.js'; /** * Unique argument definition names diff --git a/src/validation/rules/UniqueArgumentNamesRule.ts b/src/validation/rules/UniqueArgumentNamesRule.ts index 19667efaa7..ccc6064b0a 100644 --- a/src/validation/rules/UniqueArgumentNamesRule.ts +++ b/src/validation/rules/UniqueArgumentNamesRule.ts @@ -1,11 +1,11 @@ -import { groupBy } from '../../jsutils/groupBy'; +import { groupBy } from '../../jsutils/groupBy.js'; -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; -import type { ArgumentNode } from '../../language/ast'; -import type { ASTVisitor } from '../../language/visitor'; +import type { ArgumentNode } from '../../language/ast.js'; +import type { ASTVisitor } from '../../language/visitor.js'; -import type { ASTValidationContext } from '../ValidationContext'; +import type { ASTValidationContext } from '../ValidationContext.js'; /** * Unique argument names diff --git a/src/validation/rules/UniqueDirectiveNamesRule.ts b/src/validation/rules/UniqueDirectiveNamesRule.ts index ade517ddce..9c845ffe8e 100644 --- a/src/validation/rules/UniqueDirectiveNamesRule.ts +++ b/src/validation/rules/UniqueDirectiveNamesRule.ts @@ -1,8 +1,8 @@ -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; -import type { ASTVisitor } from '../../language/visitor'; +import type { ASTVisitor } from '../../language/visitor.js'; -import type { SDLValidationContext } from '../ValidationContext'; +import type { SDLValidationContext } from '../ValidationContext.js'; /** * Unique directive names diff --git a/src/validation/rules/UniqueDirectivesPerLocationRule.ts b/src/validation/rules/UniqueDirectivesPerLocationRule.ts index a4fc54690a..5b62c651c4 100644 --- a/src/validation/rules/UniqueDirectivesPerLocationRule.ts +++ b/src/validation/rules/UniqueDirectivesPerLocationRule.ts @@ -1,18 +1,18 @@ -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; -import { Kind } from '../../language/kinds'; +import { Kind } from '../../language/kinds.js'; import { isTypeDefinitionNode, isTypeExtensionNode, -} from '../../language/predicates'; -import type { ASTVisitor } from '../../language/visitor'; +} from '../../language/predicates.js'; +import type { ASTVisitor } from '../../language/visitor.js'; -import { specifiedDirectives } from '../../type/directives'; +import { specifiedDirectives } from '../../type/directives.js'; import type { SDLValidationContext, ValidationContext, -} from '../ValidationContext'; +} from '../ValidationContext.js'; /** * Unique directive names per location diff --git a/src/validation/rules/UniqueEnumValueNamesRule.ts b/src/validation/rules/UniqueEnumValueNamesRule.ts index 2bdf8749a2..00a1d6a63f 100644 --- a/src/validation/rules/UniqueEnumValueNamesRule.ts +++ b/src/validation/rules/UniqueEnumValueNamesRule.ts @@ -1,14 +1,14 @@ -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; import type { EnumTypeDefinitionNode, EnumTypeExtensionNode, -} from '../../language/ast'; -import type { ASTVisitor } from '../../language/visitor'; +} from '../../language/ast.js'; +import type { ASTVisitor } from '../../language/visitor.js'; -import { isEnumType } from '../../type/definition'; +import { isEnumType } from '../../type/definition.js'; -import type { SDLValidationContext } from '../ValidationContext'; +import type { SDLValidationContext } from '../ValidationContext.js'; /** * Unique enum value names diff --git a/src/validation/rules/UniqueFieldDefinitionNamesRule.ts b/src/validation/rules/UniqueFieldDefinitionNamesRule.ts index 52f6527d64..46e9db2d9e 100644 --- a/src/validation/rules/UniqueFieldDefinitionNamesRule.ts +++ b/src/validation/rules/UniqueFieldDefinitionNamesRule.ts @@ -1,20 +1,20 @@ -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; import type { FieldDefinitionNode, InputValueDefinitionNode, NameNode, -} from '../../language/ast'; -import type { ASTVisitor } from '../../language/visitor'; +} from '../../language/ast.js'; +import type { ASTVisitor } from '../../language/visitor.js'; -import type { GraphQLNamedType } from '../../type/definition'; +import type { GraphQLNamedType } from '../../type/definition.js'; import { isInputObjectType, isInterfaceType, isObjectType, -} from '../../type/definition'; +} from '../../type/definition.js'; -import type { SDLValidationContext } from '../ValidationContext'; +import type { SDLValidationContext } from '../ValidationContext.js'; /** * Unique field definition names diff --git a/src/validation/rules/UniqueFragmentNamesRule.ts b/src/validation/rules/UniqueFragmentNamesRule.ts index 3b4311e9c8..db59b47396 100644 --- a/src/validation/rules/UniqueFragmentNamesRule.ts +++ b/src/validation/rules/UniqueFragmentNamesRule.ts @@ -1,8 +1,8 @@ -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; -import type { ASTVisitor } from '../../language/visitor'; +import type { ASTVisitor } from '../../language/visitor.js'; -import type { ASTValidationContext } from '../ValidationContext'; +import type { ASTValidationContext } from '../ValidationContext.js'; /** * Unique fragment names diff --git a/src/validation/rules/UniqueInputFieldNamesRule.ts b/src/validation/rules/UniqueInputFieldNamesRule.ts index 9824deb53f..7344e9439b 100644 --- a/src/validation/rules/UniqueInputFieldNamesRule.ts +++ b/src/validation/rules/UniqueInputFieldNamesRule.ts @@ -1,12 +1,12 @@ -import { invariant } from '../../jsutils/invariant'; -import type { ObjMap } from '../../jsutils/ObjMap'; +import { invariant } from '../../jsutils/invariant.js'; +import type { ObjMap } from '../../jsutils/ObjMap.js'; -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; -import type { NameNode } from '../../language/ast'; -import type { ASTVisitor } from '../../language/visitor'; +import type { NameNode } from '../../language/ast.js'; +import type { ASTVisitor } from '../../language/visitor.js'; -import type { ASTValidationContext } from '../ValidationContext'; +import type { ASTValidationContext } from '../ValidationContext.js'; /** * Unique input field names diff --git a/src/validation/rules/UniqueOperationNamesRule.ts b/src/validation/rules/UniqueOperationNamesRule.ts index 6df98be8c7..eb1580423e 100644 --- a/src/validation/rules/UniqueOperationNamesRule.ts +++ b/src/validation/rules/UniqueOperationNamesRule.ts @@ -1,8 +1,8 @@ -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; -import type { ASTVisitor } from '../../language/visitor'; +import type { ASTVisitor } from '../../language/visitor.js'; -import type { ASTValidationContext } from '../ValidationContext'; +import type { ASTValidationContext } from '../ValidationContext.js'; /** * Unique operation names diff --git a/src/validation/rules/UniqueOperationTypesRule.ts b/src/validation/rules/UniqueOperationTypesRule.ts index f8ac6871ec..40fa71d11e 100644 --- a/src/validation/rules/UniqueOperationTypesRule.ts +++ b/src/validation/rules/UniqueOperationTypesRule.ts @@ -1,12 +1,12 @@ -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; import type { SchemaDefinitionNode, SchemaExtensionNode, -} from '../../language/ast'; -import type { ASTVisitor } from '../../language/visitor'; +} from '../../language/ast.js'; +import type { ASTVisitor } from '../../language/visitor.js'; -import type { SDLValidationContext } from '../ValidationContext'; +import type { SDLValidationContext } from '../ValidationContext.js'; /** * Unique operation types diff --git a/src/validation/rules/UniqueTypeNamesRule.ts b/src/validation/rules/UniqueTypeNamesRule.ts index a1f6588b11..272681835d 100644 --- a/src/validation/rules/UniqueTypeNamesRule.ts +++ b/src/validation/rules/UniqueTypeNamesRule.ts @@ -1,9 +1,9 @@ -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; -import type { TypeDefinitionNode } from '../../language/ast'; -import type { ASTVisitor } from '../../language/visitor'; +import type { TypeDefinitionNode } from '../../language/ast.js'; +import type { ASTVisitor } from '../../language/visitor.js'; -import type { SDLValidationContext } from '../ValidationContext'; +import type { SDLValidationContext } from '../ValidationContext.js'; /** * Unique type names diff --git a/src/validation/rules/UniqueVariableNamesRule.ts b/src/validation/rules/UniqueVariableNamesRule.ts index 3c9f76d885..8c067263fd 100644 --- a/src/validation/rules/UniqueVariableNamesRule.ts +++ b/src/validation/rules/UniqueVariableNamesRule.ts @@ -1,10 +1,10 @@ -import { groupBy } from '../../jsutils/groupBy'; +import { groupBy } from '../../jsutils/groupBy.js'; -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; -import type { ASTVisitor } from '../../language/visitor'; +import type { ASTVisitor } from '../../language/visitor.js'; -import type { ASTValidationContext } from '../ValidationContext'; +import type { ASTValidationContext } from '../ValidationContext.js'; /** * Unique variable names diff --git a/src/validation/rules/ValuesOfCorrectTypeRule.ts b/src/validation/rules/ValuesOfCorrectTypeRule.ts index 5d81a3833a..cddc5ed979 100644 --- a/src/validation/rules/ValuesOfCorrectTypeRule.ts +++ b/src/validation/rules/ValuesOfCorrectTypeRule.ts @@ -1,13 +1,13 @@ -import { didYouMean } from '../../jsutils/didYouMean'; -import { inspect } from '../../jsutils/inspect'; -import { keyMap } from '../../jsutils/keyMap'; -import { suggestionList } from '../../jsutils/suggestionList'; +import { didYouMean } from '../../jsutils/didYouMean.js'; +import { inspect } from '../../jsutils/inspect.js'; +import { keyMap } from '../../jsutils/keyMap.js'; +import { suggestionList } from '../../jsutils/suggestionList.js'; -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; -import type { ValueNode } from '../../language/ast'; -import { print } from '../../language/printer'; -import type { ASTVisitor } from '../../language/visitor'; +import type { ValueNode } from '../../language/ast.js'; +import { print } from '../../language/printer.js'; +import type { ASTVisitor } from '../../language/visitor.js'; import { getNamedType, @@ -17,9 +17,9 @@ import { isListType, isNonNullType, isRequiredInputField, -} from '../../type/definition'; +} from '../../type/definition.js'; -import type { ValidationContext } from '../ValidationContext'; +import type { ValidationContext } from '../ValidationContext.js'; /** * Value literals of correct type diff --git a/src/validation/rules/VariablesAreInputTypesRule.ts b/src/validation/rules/VariablesAreInputTypesRule.ts index 58d535ce81..019f3e762c 100644 --- a/src/validation/rules/VariablesAreInputTypesRule.ts +++ b/src/validation/rules/VariablesAreInputTypesRule.ts @@ -1,14 +1,14 @@ -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; -import type { VariableDefinitionNode } from '../../language/ast'; -import { print } from '../../language/printer'; -import type { ASTVisitor } from '../../language/visitor'; +import type { VariableDefinitionNode } from '../../language/ast.js'; +import { print } from '../../language/printer.js'; +import type { ASTVisitor } from '../../language/visitor.js'; -import { isInputType } from '../../type/definition'; +import { isInputType } from '../../type/definition.js'; -import { typeFromAST } from '../../utilities/typeFromAST'; +import { typeFromAST } from '../../utilities/typeFromAST.js'; -import type { ValidationContext } from '../ValidationContext'; +import type { ValidationContext } from '../ValidationContext.js'; /** * Variables are input types diff --git a/src/validation/rules/VariablesInAllowedPositionRule.ts b/src/validation/rules/VariablesInAllowedPositionRule.ts index a0b7e991a6..4039540eba 100644 --- a/src/validation/rules/VariablesInAllowedPositionRule.ts +++ b/src/validation/rules/VariablesInAllowedPositionRule.ts @@ -1,20 +1,20 @@ -import { inspect } from '../../jsutils/inspect'; -import type { Maybe } from '../../jsutils/Maybe'; +import { inspect } from '../../jsutils/inspect.js'; +import type { Maybe } from '../../jsutils/Maybe.js'; -import { GraphQLError } from '../../error/GraphQLError'; +import { GraphQLError } from '../../error/GraphQLError.js'; -import type { ValueNode } from '../../language/ast'; -import { Kind } from '../../language/kinds'; -import type { ASTVisitor } from '../../language/visitor'; +import type { ValueNode } from '../../language/ast.js'; +import { Kind } from '../../language/kinds.js'; +import type { ASTVisitor } from '../../language/visitor.js'; -import type { GraphQLType } from '../../type/definition'; -import { isNonNullType } from '../../type/definition'; -import type { GraphQLSchema } from '../../type/schema'; +import type { GraphQLType } from '../../type/definition.js'; +import { isNonNullType } from '../../type/definition.js'; +import type { GraphQLSchema } from '../../type/schema.js'; -import { isTypeSubTypeOf } from '../../utilities/typeComparators'; -import { typeFromAST } from '../../utilities/typeFromAST'; +import { isTypeSubTypeOf } from '../../utilities/typeComparators.js'; +import { typeFromAST } from '../../utilities/typeFromAST.js'; -import type { ValidationContext } from '../ValidationContext'; +import type { ValidationContext } from '../ValidationContext.js'; /** * Variables in allowed position diff --git a/src/validation/rules/custom/NoDeprecatedCustomRule.ts b/src/validation/rules/custom/NoDeprecatedCustomRule.ts index e06ac2e789..375373eb1d 100644 --- a/src/validation/rules/custom/NoDeprecatedCustomRule.ts +++ b/src/validation/rules/custom/NoDeprecatedCustomRule.ts @@ -1,12 +1,12 @@ -import { invariant } from '../../../jsutils/invariant'; +import { invariant } from '../../../jsutils/invariant.js'; -import { GraphQLError } from '../../../error/GraphQLError'; +import { GraphQLError } from '../../../error/GraphQLError.js'; -import type { ASTVisitor } from '../../../language/visitor'; +import type { ASTVisitor } from '../../../language/visitor.js'; -import { getNamedType, isInputObjectType } from '../../../type/definition'; +import { getNamedType, isInputObjectType } from '../../../type/definition.js'; -import type { ValidationContext } from '../../ValidationContext'; +import type { ValidationContext } from '../../ValidationContext.js'; /** * No deprecated diff --git a/src/validation/rules/custom/NoSchemaIntrospectionCustomRule.ts b/src/validation/rules/custom/NoSchemaIntrospectionCustomRule.ts index 257d58d723..6d2748b762 100644 --- a/src/validation/rules/custom/NoSchemaIntrospectionCustomRule.ts +++ b/src/validation/rules/custom/NoSchemaIntrospectionCustomRule.ts @@ -1,12 +1,12 @@ -import { GraphQLError } from '../../../error/GraphQLError'; +import { GraphQLError } from '../../../error/GraphQLError.js'; -import type { FieldNode } from '../../../language/ast'; -import type { ASTVisitor } from '../../../language/visitor'; +import type { FieldNode } from '../../../language/ast.js'; +import type { ASTVisitor } from '../../../language/visitor.js'; -import { getNamedType } from '../../../type/definition'; -import { isIntrospectionType } from '../../../type/introspection'; +import { getNamedType } from '../../../type/definition.js'; +import { isIntrospectionType } from '../../../type/introspection.js'; -import type { ValidationContext } from '../../ValidationContext'; +import type { ValidationContext } from '../../ValidationContext.js'; /** * Prohibit introspection queries diff --git a/src/validation/specifiedRules.ts b/src/validation/specifiedRules.ts index 16e555db8a..93a08669f6 100644 --- a/src/validation/specifiedRules.ts +++ b/src/validation/specifiedRules.ts @@ -1,71 +1,71 @@ // Spec Section: "Executable Definitions" -import { ExecutableDefinitionsRule } from './rules/ExecutableDefinitionsRule'; +import { ExecutableDefinitionsRule } from './rules/ExecutableDefinitionsRule.js'; // Spec Section: "Field Selections on Objects, Interfaces, and Unions Types" -import { FieldsOnCorrectTypeRule } from './rules/FieldsOnCorrectTypeRule'; +import { FieldsOnCorrectTypeRule } from './rules/FieldsOnCorrectTypeRule.js'; // Spec Section: "Fragments on Composite Types" -import { FragmentsOnCompositeTypesRule } from './rules/FragmentsOnCompositeTypesRule'; +import { FragmentsOnCompositeTypesRule } from './rules/FragmentsOnCompositeTypesRule.js'; // Spec Section: "Argument Names" import { KnownArgumentNamesOnDirectivesRule, KnownArgumentNamesRule, -} from './rules/KnownArgumentNamesRule'; +} from './rules/KnownArgumentNamesRule.js'; // Spec Section: "Directives Are Defined" -import { KnownDirectivesRule } from './rules/KnownDirectivesRule'; +import { KnownDirectivesRule } from './rules/KnownDirectivesRule.js'; // Spec Section: "Fragment spread target defined" -import { KnownFragmentNamesRule } from './rules/KnownFragmentNamesRule'; +import { KnownFragmentNamesRule } from './rules/KnownFragmentNamesRule.js'; // Spec Section: "Fragment Spread Type Existence" -import { KnownTypeNamesRule } from './rules/KnownTypeNamesRule'; +import { KnownTypeNamesRule } from './rules/KnownTypeNamesRule.js'; // Spec Section: "Lone Anonymous Operation" -import { LoneAnonymousOperationRule } from './rules/LoneAnonymousOperationRule'; +import { LoneAnonymousOperationRule } from './rules/LoneAnonymousOperationRule.js'; // SDL-specific validation rules -import { LoneSchemaDefinitionRule } from './rules/LoneSchemaDefinitionRule'; +import { LoneSchemaDefinitionRule } from './rules/LoneSchemaDefinitionRule.js'; // Spec Section: "Fragments must not form cycles" -import { NoFragmentCyclesRule } from './rules/NoFragmentCyclesRule'; +import { NoFragmentCyclesRule } from './rules/NoFragmentCyclesRule.js'; // Spec Section: "All Variable Used Defined" -import { NoUndefinedVariablesRule } from './rules/NoUndefinedVariablesRule'; +import { NoUndefinedVariablesRule } from './rules/NoUndefinedVariablesRule.js'; // Spec Section: "Fragments must be used" -import { NoUnusedFragmentsRule } from './rules/NoUnusedFragmentsRule'; +import { NoUnusedFragmentsRule } from './rules/NoUnusedFragmentsRule.js'; // Spec Section: "All Variables Used" -import { NoUnusedVariablesRule } from './rules/NoUnusedVariablesRule'; +import { NoUnusedVariablesRule } from './rules/NoUnusedVariablesRule.js'; // Spec Section: "Field Selection Merging" -import { OverlappingFieldsCanBeMergedRule } from './rules/OverlappingFieldsCanBeMergedRule'; +import { OverlappingFieldsCanBeMergedRule } from './rules/OverlappingFieldsCanBeMergedRule.js'; // Spec Section: "Fragment spread is possible" -import { PossibleFragmentSpreadsRule } from './rules/PossibleFragmentSpreadsRule'; -import { PossibleTypeExtensionsRule } from './rules/PossibleTypeExtensionsRule'; +import { PossibleFragmentSpreadsRule } from './rules/PossibleFragmentSpreadsRule.js'; +import { PossibleTypeExtensionsRule } from './rules/PossibleTypeExtensionsRule.js'; // Spec Section: "Argument Optionality" import { ProvidedRequiredArgumentsOnDirectivesRule, ProvidedRequiredArgumentsRule, -} from './rules/ProvidedRequiredArgumentsRule'; +} from './rules/ProvidedRequiredArgumentsRule.js'; // Spec Section: "Leaf Field Selections" -import { ScalarLeafsRule } from './rules/ScalarLeafsRule'; +import { ScalarLeafsRule } from './rules/ScalarLeafsRule.js'; // Spec Section: "Subscriptions with Single Root Field" -import { SingleFieldSubscriptionsRule } from './rules/SingleFieldSubscriptionsRule'; -import { UniqueArgumentDefinitionNamesRule } from './rules/UniqueArgumentDefinitionNamesRule'; +import { SingleFieldSubscriptionsRule } from './rules/SingleFieldSubscriptionsRule.js'; +import { UniqueArgumentDefinitionNamesRule } from './rules/UniqueArgumentDefinitionNamesRule.js'; // Spec Section: "Argument Uniqueness" -import { UniqueArgumentNamesRule } from './rules/UniqueArgumentNamesRule'; -import { UniqueDirectiveNamesRule } from './rules/UniqueDirectiveNamesRule'; +import { UniqueArgumentNamesRule } from './rules/UniqueArgumentNamesRule.js'; +import { UniqueDirectiveNamesRule } from './rules/UniqueDirectiveNamesRule.js'; // Spec Section: "Directives Are Unique Per Location" -import { UniqueDirectivesPerLocationRule } from './rules/UniqueDirectivesPerLocationRule'; -import { UniqueEnumValueNamesRule } from './rules/UniqueEnumValueNamesRule'; -import { UniqueFieldDefinitionNamesRule } from './rules/UniqueFieldDefinitionNamesRule'; +import { UniqueDirectivesPerLocationRule } from './rules/UniqueDirectivesPerLocationRule.js'; +import { UniqueEnumValueNamesRule } from './rules/UniqueEnumValueNamesRule.js'; +import { UniqueFieldDefinitionNamesRule } from './rules/UniqueFieldDefinitionNamesRule.js'; // Spec Section: "Fragment Name Uniqueness" -import { UniqueFragmentNamesRule } from './rules/UniqueFragmentNamesRule'; +import { UniqueFragmentNamesRule } from './rules/UniqueFragmentNamesRule.js'; // Spec Section: "Input Object Field Uniqueness" -import { UniqueInputFieldNamesRule } from './rules/UniqueInputFieldNamesRule'; +import { UniqueInputFieldNamesRule } from './rules/UniqueInputFieldNamesRule.js'; // Spec Section: "Operation Name Uniqueness" -import { UniqueOperationNamesRule } from './rules/UniqueOperationNamesRule'; -import { UniqueOperationTypesRule } from './rules/UniqueOperationTypesRule'; -import { UniqueTypeNamesRule } from './rules/UniqueTypeNamesRule'; +import { UniqueOperationNamesRule } from './rules/UniqueOperationNamesRule.js'; +import { UniqueOperationTypesRule } from './rules/UniqueOperationTypesRule.js'; +import { UniqueTypeNamesRule } from './rules/UniqueTypeNamesRule.js'; // Spec Section: "Variable Uniqueness" -import { UniqueVariableNamesRule } from './rules/UniqueVariableNamesRule'; +import { UniqueVariableNamesRule } from './rules/UniqueVariableNamesRule.js'; // Spec Section: "Value Type Correctness" -import { ValuesOfCorrectTypeRule } from './rules/ValuesOfCorrectTypeRule'; +import { ValuesOfCorrectTypeRule } from './rules/ValuesOfCorrectTypeRule.js'; // Spec Section: "Variables are Input Types" -import { VariablesAreInputTypesRule } from './rules/VariablesAreInputTypesRule'; +import { VariablesAreInputTypesRule } from './rules/VariablesAreInputTypesRule.js'; // Spec Section: "All Variable Usages Are Allowed" -import { VariablesInAllowedPositionRule } from './rules/VariablesInAllowedPositionRule'; -import type { SDLValidationRule, ValidationRule } from './ValidationContext'; +import { VariablesInAllowedPositionRule } from './rules/VariablesInAllowedPositionRule.js'; +import type { SDLValidationRule, ValidationRule } from './ValidationContext.js'; /** * This set includes all validation rules defined by the GraphQL spec. diff --git a/src/validation/validate.ts b/src/validation/validate.ts index 61ec1412a2..8639732076 100644 --- a/src/validation/validate.ts +++ b/src/validation/validate.ts @@ -1,19 +1,22 @@ -import { devAssert } from '../jsutils/devAssert'; -import type { Maybe } from '../jsutils/Maybe'; +import { devAssert } from '../jsutils/devAssert.js'; +import type { Maybe } from '../jsutils/Maybe.js'; -import { GraphQLError } from '../error/GraphQLError'; +import { GraphQLError } from '../error/GraphQLError.js'; -import type { DocumentNode } from '../language/ast'; -import { visit, visitInParallel } from '../language/visitor'; +import type { DocumentNode } from '../language/ast.js'; +import { visit, visitInParallel } from '../language/visitor.js'; -import type { GraphQLSchema } from '../type/schema'; -import { assertValidSchema } from '../type/validate'; +import type { GraphQLSchema } from '../type/schema.js'; +import { assertValidSchema } from '../type/validate.js'; -import { TypeInfo, visitWithTypeInfo } from '../utilities/TypeInfo'; +import { TypeInfo, visitWithTypeInfo } from '../utilities/TypeInfo.js'; -import { specifiedRules, specifiedSDLRules } from './specifiedRules'; -import type { SDLValidationRule, ValidationRule } from './ValidationContext'; -import { SDLValidationContext, ValidationContext } from './ValidationContext'; +import { specifiedRules, specifiedSDLRules } from './specifiedRules.js'; +import type { SDLValidationRule, ValidationRule } from './ValidationContext.js'; +import { + SDLValidationContext, + ValidationContext, +} from './ValidationContext.js'; /** * Implements the "Validation" section of the spec. diff --git a/tsconfig.json b/tsconfig.json index edb522f1d4..66586e27e0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,13 +8,17 @@ "compilerOptions": { "lib": ["es2020"], "target": "es2020", - "module": "commonjs", + "module": "es2022", "moduleResolution": "node", "strict": true, "useUnknownInCatchVariables": false, "noEmit": true, "isolatedModules": true, "importsNotUsedAsValues": "error", - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "allowSyntheticDefaultImports": true + }, + "ts-node": { + "esm": true } } diff --git a/website/docusaurus.config.js b/website/docusaurus.config.cjs similarity index 98% rename from website/docusaurus.config.js rename to website/docusaurus.config.cjs index bf3000c56a..44973c8ff1 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.cjs @@ -23,7 +23,7 @@ module.exports = { /** @type {import('@docusaurus/preset-classic').Options} */ ({ docs: { - sidebarPath: require.resolve('./sidebars.js'), + sidebarPath: require.resolve('./sidebars.cjs'), editUrl: 'https://github.com/graphql/graphql-js/edit/main/website/docs/', }, diff --git a/website/sidebars.js b/website/sidebars.cjs similarity index 100% rename from website/sidebars.js rename to website/sidebars.cjs