-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
re-introduce query exec as separate extension (#2665)
- Loading branch information
Showing
21 changed files
with
1,663 additions
and
140 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'vscode-graphql-execution': patch | ||
'vscode-graphql': patch | ||
--- | ||
|
||
Port the inline query execution capability from the original `vscode-graphql` repository as promised. More improvements to come! |
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
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 GraphQL Contributors | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,63 @@ | ||
## `graphql.vscode-graphql-execution` | ||
|
||
This extension provides standalone support for executing graphql operations inline in your code for: | ||
|
||
- .ts/.tsx | ||
- .js/.jsx | ||
- .graphql, .gql or .graphqls files | ||
|
||
## How it works | ||
|
||
1. A codelens will appear above all operations - clicking will begin executing the operation. | ||
2. (If variables are specified in the operation), a dialog will prompt for these variables | ||
3. Then, the results or network error should appear, voila! | ||
4. If no endpoints are configured, it will exit early and tell you to define them. | ||
|
||
## Configuring the extension | ||
|
||
### `graphql-config` | ||
|
||
Your graphql config file will need to contain either a schema-as-url OR an endpoints configuration. Either of the following are valid: | ||
|
||
```yaml | ||
schema: https://localhost:3000/graphql | ||
``` | ||
```yaml | ||
schema: schema.graphql | ||
extensions: | ||
endpoints: | ||
default: | ||
url: 'https://localhost:3000/graphql' | ||
``` | ||
```yaml | ||
projects: | ||
app: | ||
schema: schema.graphql | ||
extensions: | ||
endpoints: | ||
default: | ||
url: 'https://localhost:3000/graphql' | ||
``` | ||
### Disable codelens | ||
To disable the codelens, please specify this setting in `settings.json` or `user.json`: | ||
|
||
```json | ||
{ | ||
... | ||
"vscode-graphql-execution.showExecCodelens": false | ||
} | ||
``` | ||
|
||
### Self Signed Certificates | ||
|
||
Enable this (`false` by default) to allow node to use non-authorized SSL certificates. | ||
|
||
```json | ||
{ | ||
"vscode-graphql-execution.rejectUnauthorized": true | ||
} | ||
``` |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ | ||
const { build } = require('esbuild'); | ||
const [, , arg] = process.argv; | ||
|
||
const logger = console; | ||
|
||
const isWatchMode = arg === '--watch'; | ||
|
||
build({ | ||
entryPoints: ['src/extension.ts'], | ||
bundle: true, | ||
minify: arg === '--minify', | ||
platform: 'node', | ||
outdir: 'out/', | ||
external: ['vscode', 'ts-node', 'tslib'], | ||
format: 'cjs', | ||
sourcemap: true, | ||
watch: isWatchMode, | ||
}) | ||
.then(({ errors, warnings }) => { | ||
if (warnings.length) { | ||
logger.warn(...warnings); | ||
} | ||
if (errors.length) { | ||
logger.error(...errors); | ||
} | ||
|
||
logger.log('successfully bundled vscode-graphql-execution 🚀'); | ||
|
||
if (isWatchMode) { | ||
logger.log('watching... 🕰'); | ||
} else { | ||
process.exit(); | ||
} | ||
}) | ||
.catch(err => { | ||
logger.error(err); | ||
process.exit(1); | ||
}); |
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,124 @@ | ||
{ | ||
"name": "vscode-graphql-execution", | ||
"version": "0.1.0", | ||
"displayName": "GraphQL: Inline Operation Execution", | ||
"description": "Execute graphql operations from your code (revived!)", | ||
"publisher": "GraphQL", | ||
"license": "MIT", | ||
"private": true, | ||
"engines": { | ||
"vscode": "^1.63.0" | ||
}, | ||
"main": "./dist/extension", | ||
"icon": "assets/images/logo.png", | ||
"contributors": [ | ||
{ | ||
"name": "Divyendu Singh", | ||
"url": "https://www.divyendusingh.com/" | ||
} | ||
], | ||
"galleryBanner": { | ||
"color": "#032539", | ||
"theme": "dark" | ||
}, | ||
"categories": [ | ||
"Programming Languages" | ||
], | ||
"activationEvents": [ | ||
"workspaceContains:**/.graphqlrc", | ||
"workspaceContains:**/.graphqlconfig", | ||
"workspaceContains:**/.graphqlrc.{json,yaml,yml,js,ts,toml}", | ||
"workspaceContains:**/graphql.config.{json,yaml,yml,js,ts,toml}", | ||
"workspaceContains:**/package.json", | ||
"onCommand:vscode-graphql-execution.isDebugging", | ||
"onCommand:vscode-graphql-execution.contentProvider", | ||
"onLanguage:graphql" | ||
], | ||
"contributes": { | ||
"commands": [ | ||
{ | ||
"command": "vscode-graphql-execution.isDebugging", | ||
"title": "GraphQL Exec: Is Debugging?" | ||
}, | ||
{ | ||
"command": "vscode-graphql-execution.showOutputChannel", | ||
"title": "GraphQL Exec: Show output channel" | ||
}, | ||
{ | ||
"command": "vscode-graphql-execution.contentProvider", | ||
"title": "GraphQL Exec: Execute GraphQL Operations" | ||
} | ||
], | ||
"configuration": { | ||
"title": "VSCode GraphQL: Inline Operation Execution", | ||
"properties": { | ||
"vscode-graphql-execution.debug": { | ||
"type": [ | ||
"boolean", | ||
"null" | ||
], | ||
"default": false, | ||
"description": "Enable debug logs" | ||
}, | ||
"vscode-graphql-execution.showExecCodelens": { | ||
"type": [ | ||
"boolean" | ||
], | ||
"description": "Show codelens to execute operations inline", | ||
"default": true | ||
}, | ||
"vscode-graphql-execution.rejectUnauthorized": { | ||
"type": [ | ||
"boolean" | ||
], | ||
"description": "Fail the request on invalid certificate", | ||
"default": true | ||
} | ||
} | ||
} | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/graphql/graphiql", | ||
"directory": "packages/vscode-graphql-execution" | ||
}, | ||
"homepage": "https://github.com/graphql/graphiql/blob/main/packages/vscode-graphql-inline-exec/README.md", | ||
"scripts": { | ||
"compile": "yarn tsc", | ||
"vsce:package": "vsce package --yarn", | ||
"vsce:prepublish": "npm run vsce:package", | ||
"vsce:publish": "vsce publish --yarn", | ||
"open-vsx:publish": "ovsx publish", | ||
"release": "npm run vsce:publish && npm run open-vsx:publish" | ||
}, | ||
"devDependencies": { | ||
"@types/capitalize": "2.0.0", | ||
"@types/dotenv": "8.2.0", | ||
"@types/mocha": "5.2.7", | ||
"@types/node": "16.11.26", | ||
"@types/node-fetch": "3.0.3", | ||
"@types/vscode": "1.62.0", | ||
"@types/escape-html": "^1.0.2", | ||
"@types/ws": "8.2.2", | ||
"esbuild": "0.15.1", | ||
"ovsx": "0.3.0", | ||
"vsce": "2.6.7" | ||
}, | ||
"dependencies": { | ||
"@urql/core": "2.6.1", | ||
"babel-polyfill": "6.26.0", | ||
"capitalize": "2.0.4", | ||
"dotenv": "10.0.0", | ||
"escape-html": "1.0.3", | ||
"graphql-config": "4.3.0", | ||
"graphql-tag": "2.12.6", | ||
"graphql-ws": "5.10.0", | ||
"@whatwg-node/fetch": "0.2.8", | ||
"ws": "8.8.1", | ||
"graphql": "^16.4.0", | ||
"nullthrows": "^1.1.1" | ||
}, | ||
"resolutions": { | ||
"cosmiconfig": "^5.0.1" | ||
} | ||
} |
Oops, something went wrong.