-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deploy full ESM with "type": "module" in "latest-esm" npm tag (#3361)
- Loading branch information
Showing
16 changed files
with
154 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
/node_modules | ||
/reports | ||
/npmDist | ||
/npmEsmDist | ||
/denoDist | ||
/websiteDist | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,5 +13,6 @@ | |
/node_modules | ||
/reports | ||
/npmDist | ||
/npmEsmDist | ||
/denoDist | ||
/websiteDist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,6 @@ | |
/node_modules | ||
/reports | ||
/npmDist | ||
/npmEsmDist | ||
/denoDist | ||
/websiteDist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import type { ExecutionResult } from 'graphql-esm/execution'; | ||
|
||
import { graphqlSync } from 'graphql-esm'; | ||
import { | ||
GraphQLString, | ||
GraphQLSchema, | ||
GraphQLObjectType, | ||
} from 'graphql-esm/type'; | ||
|
||
const queryType: GraphQLObjectType = new GraphQLObjectType({ | ||
name: 'Query', | ||
fields: () => ({ | ||
sayHi: { | ||
type: GraphQLString, | ||
args: { | ||
who: { | ||
type: GraphQLString, | ||
defaultValue: 'World', | ||
}, | ||
}, | ||
resolve(_root, args: { who: string }) { | ||
return 'Hello ' + args.who; | ||
}, | ||
}, | ||
}), | ||
}); | ||
|
||
const schema: GraphQLSchema = new GraphQLSchema({ query: queryType }); | ||
|
||
const result: ExecutionResult = graphqlSync({ | ||
schema, | ||
source: ` | ||
query helloWho($who: String){ | ||
test(who: $who) | ||
} | ||
`, | ||
variableValues: { who: 'Dolly' }, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
}, | ||
"dependencies": { | ||
"graphql": "file:../graphql.tgz", | ||
"graphql-esm": "file:../graphql-esm.tgz", | ||
"typescript-4.4": "npm:[email protected]", | ||
"typescript-4.5": "npm:[email protected]", | ||
"typescript-4.6": "npm:[email protected]", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// eslint-disable-next-line node/no-missing-import, import/no-unresolved | ||
import { graphqlSync } from 'graphql-esm'; | ||
|
||
// eslint-disable-next-line node/no-missing-import, import/no-unresolved | ||
import { buildSchema } from 'graphql-esm/utilities/buildASTSchema'; | ||
|
||
const schema = buildSchema('type Query { hello: String }'); | ||
|
||
export const result = graphqlSync({ | ||
schema, | ||
source: '{ hello }', | ||
rootValue: { hello: 'world' }, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,20 @@ | ||
import assert from 'assert'; | ||
|
||
import mainCJS from './dist/main.cjs'; | ||
import cjs from './dist/main-cjs.cjs'; | ||
import mjs from './dist/main-mjs.cjs'; | ||
|
||
assert.deepStrictEqual(mainCJS.result, { | ||
assert.deepStrictEqual(cjs.result, { | ||
data: { | ||
__proto__: null, | ||
hello: 'world', | ||
}, | ||
}); | ||
|
||
assert.deepStrictEqual(mjs.result, { | ||
data: { | ||
__proto__: null, | ||
hello: 'world', | ||
}, | ||
}); | ||
|
||
console.log('Test script: Got correct result from Webpack bundle!'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters