babel-plugin-import-graphql
Advanced tools
Comparing version 2.5.0 to 2.5.1
@@ -46,6 +46,8 @@ "use strict"; | ||
var thisPlugin = plugins.find(function (p) { | ||
return p.key.indexOf('babel-plugin-import-graphql') !== -1; | ||
var key = p.key || p[0].key; | ||
return key.indexOf('babel-plugin-import-graphql') !== -1; | ||
}); | ||
var options = thisPlugin.options || thisPlugin[1]; | ||
if (thisPlugin.options.runtime) { | ||
if (options.runtime) { | ||
try { | ||
@@ -96,3 +98,5 @@ require('graphql-tag'); | ||
if (opts.runtime && !seenJSFiles.has(jsFilename)) { | ||
replacements = _toConsumableArray(replacements).concat([template(`import gql from 'graphql-tag'`)()]); | ||
replacements = _toConsumableArray(replacements).concat([template(`import gql from 'graphql-tag'`, { | ||
sourceType: 'module' | ||
})()]); | ||
} | ||
@@ -125,3 +129,5 @@ | ||
function buildSrcVarNode(graphqlSrc, importName) { | ||
var buildNode = template('var IMPORT_NAME = SOURCE;'); | ||
var buildNode = template('var IMPORT_NAME = SOURCE;', { | ||
sourceType: 'module' | ||
}); | ||
return buildNode({ | ||
@@ -144,3 +150,5 @@ IMPORT_NAME: t.identifier(importName), | ||
}); | ||
return template('var IMPORT_NAME = SOURCE')({ | ||
return template('var IMPORT_NAME = SOURCE', { | ||
sourceType: 'module' | ||
})({ | ||
IMPORT_NAME: t.identifier(importName), | ||
@@ -151,3 +159,5 @@ SOURCE: t.objectExpression(properties) | ||
var buildNode = template('var IMPORT_NAME = gql(SOURCE);'); | ||
var buildNode = template('var IMPORT_NAME = gql(SOURCE);', { | ||
sourceType: 'module' | ||
}); | ||
return buildNode({ | ||
@@ -161,3 +171,5 @@ IMPORT_NAME: t.identifier(importName), | ||
function buildASTVarNode(graphqlAST, importName) { | ||
var buildNode = template('var IMPORT_NAME = AST;'); | ||
var buildNode = template('var IMPORT_NAME = AST;', { | ||
sourceType: 'module' | ||
}); | ||
var astNode = t.valueToNode(JSON.parse(JSON.stringify(graphqlAST))); | ||
@@ -164,0 +176,0 @@ astNode._compact = true; |
112
CHANGELOG.md
# ChangeLog | ||
## v.2.5.1 (June 8, 2018) | ||
### Fixes | ||
- Fix compatibility issue with Babel 6 | ||
## v2.5.0 (June 7, 2018) | ||
@@ -7,9 +13,9 @@ | ||
* Reduce output size of AST ({ runtime: false }) by 30%+ :fire: (:clap: @loganfsmyth and @supukarmin) | ||
* Add new 'runtime' option for even smaller output :mag: (if enabled, 'graphql-tag' is a peerDependency) | ||
- Reduce output size of AST ({ runtime: false }) by 30%+ :fire: (:clap: @loganfsmyth and @supukarmin) | ||
- Add new 'runtime' option for even smaller output :mag: (if enabled, 'graphql-tag' is a peerDependency) | ||
### Maintenance | ||
* Update all devDependencies :arrows_counterclockwise: | ||
* Improve the README :tada: | ||
- Update all devDependencies :arrows_counterclockwise: | ||
- Improve the README :tada: | ||
@@ -20,5 +26,5 @@ ## v2.4.4 (May 27, 2018) | ||
* Update copyright in LICENSE | ||
* Update deprecation/migration info in README.md | ||
* Update package name, author, and repository in package.json | ||
- Update copyright in LICENSE | ||
- Update deprecation/migration info in README.md | ||
- Update package name, author, and repository in package.json | ||
@@ -29,3 +35,3 @@ ## v2.4.2, v2.4.3 (May 27, 2018) \*\* Don't use these \*\* | ||
* Temporarily created a new repo on GitHub and published from that, but have now removed that repo and renamed the original repo instead. | ||
- Temporarily created a new repo on GitHub and published from that, but have now removed that repo and renamed the original repo instead. | ||
@@ -36,3 +42,3 @@ ## v2.4.1 (May 27, 2018) | ||
* Deprecate this package in favor of `babel-plugin-import-graphql` (see README) | ||
- Deprecate this package in favor of `babel-plugin-import-graphql` (see README) | ||
@@ -43,4 +49,4 @@ ## v2.4.0 (May 18, 2018) | ||
* Add support for fragment-only files with multiple fragments | ||
* Add support for importing fragments from mixed files (containing fragments and operations) | ||
- Add support for fragment-only files with multiple fragments | ||
- Add support for importing fragments from mixed files (containing fragments and operations) | ||
@@ -51,10 +57,10 @@ ## v2.3.8 (May 15, 2018) | ||
* Refactor plugin to not have direct dependency on @babel/core (hopefully fixing #30) | ||
* Update package-lock.json that was not updated for version 2.3.7 | ||
- Refactor plugin to not have direct dependency on @babel/core (hopefully fixing #30) | ||
- Update package-lock.json that was not updated for version 2.3.7 | ||
### Maintenance | ||
* Automate updating of package-lock.json and yarn.lock | ||
* Remove undocumented `requireGql` export | ||
* Update all dependencies | ||
- Automate updating of package-lock.json and yarn.lock | ||
- Remove undocumented `requireGql` export | ||
- Update all dependencies | ||
@@ -65,3 +71,3 @@ ## v2.3.7 (April 26, 2018) | ||
* Update dependencies | ||
- Update dependencies | ||
@@ -72,7 +78,7 @@ ## v2.3.6 (March 30, 2018) | ||
* Fix operation files with top level indentation being mistaken for schema files | ||
- Fix operation files with top level indentation being mistaken for schema files | ||
### Maintenance | ||
* Add regression tests for above fix | ||
- Add regression tests for above fix | ||
@@ -83,5 +89,5 @@ ## v2.3.5 (March 15, 2018) | ||
* Adjust code to conform to relevant breaking change in @babel/core@7.0.0-beta.41 (more forward-compatible solution to "bug" from [#24](https://github.com/detrohutt/babel-plugin-inline-import-graphql-ast/issues/24)) | ||
* Upgrade @babel/core dependency to 7.0.0-beta.42 | ||
* Improve tests code | ||
- Adjust code to conform to relevant breaking change in @babel/core@7.0.0-beta.41 (more forward-compatible solution to "bug" from [#24](https://github.com/detrohutt/babel-plugin-inline-import-graphql-ast/issues/24)) | ||
- Upgrade @babel/core dependency to 7.0.0-beta.42 | ||
- Improve tests code | ||
@@ -92,7 +98,7 @@ ## v2.3.4 (March 14, 2018) | ||
* Pin versions of babel packages which were causing issue [#24](https://github.com/detrohutt/babel-plugin-inline-import-graphql-ast/issues/24) | ||
- Pin versions of babel packages which were causing issue [#24](https://github.com/detrohutt/babel-plugin-inline-import-graphql-ast/issues/24) | ||
### Maintenance | ||
* Begin including package-lock.json file for users of NPM | ||
- Begin including package-lock.json file for users of NPM | ||
@@ -103,7 +109,7 @@ ## v2.3.3 (March 9, 2018) | ||
* Fix fragments inlining as raw text | ||
- Fix fragments inlining as raw text | ||
### Maintenance | ||
* Add regression test for above fix | ||
- Add regression test for above fix | ||
@@ -114,7 +120,7 @@ ## v2.3.2 (March 9, 2018) | ||
* Fix operations with fragments inlining as raw text | ||
- Fix operations with fragments inlining as raw text | ||
### Maintenance | ||
* Add initial test for fragments | ||
- Add initial test for fragments | ||
@@ -125,3 +131,3 @@ ## v2.3.1 (March 8, 2018) | ||
* Update all dependencies/devDependencies | ||
- Update all dependencies/devDependencies | ||
@@ -132,7 +138,7 @@ ## v2.3.0 (March 8, 2018) | ||
* Initial support for schema-like files | ||
- Initial support for schema-like files | ||
### Maintenance | ||
* Fix typos in README | ||
- Fix typos in README | ||
@@ -143,15 +149,15 @@ ## v2.2.0 (February 17, 2018) | ||
* Multiple operations in a single GraphQL file | ||
- Multiple operations in a single GraphQL file | ||
* Named and namespace imports (can be mixed with default imports) | ||
- Named and namespace imports (can be mixed with default imports) | ||
### Maintenance | ||
* Update README.md | ||
- Update README.md | ||
* Upgrade all dependencies (including upgrading to Babel 7) | ||
- Upgrade all dependencies (including upgrading to Babel 7) | ||
* Add Jest and write initial tests covering import types | ||
- Add Jest and write initial tests covering import types | ||
* Improve, expand, and reconfigure toolchain (babel, eslint, prettier, lint-staged) | ||
- Improve, expand, and reconfigure toolchain (babel, eslint, prettier, lint-staged) | ||
@@ -162,3 +168,3 @@ ## v2.1.2 (January 26, 2018) | ||
* Add "Known Issues" section to README.md | ||
- Add "Known Issues" section to README.md | ||
@@ -169,3 +175,3 @@ ## v2.1.1 (January 25, 2018) | ||
* Revert changes to babel settings and babel dependencies | ||
- Revert changes to babel settings and babel dependencies | ||
@@ -176,11 +182,11 @@ ## v2.1.0 (January 25, 2018) | ||
* Add `nodePath` option | ||
- Add `nodePath` option | ||
### Fixes | ||
* Respect `NODE_PATH` environment variable | ||
- Respect `NODE_PATH` environment variable | ||
### Maintenance | ||
* Remove leftover files and dependencies from `babel-plugin-inline-import` | ||
- Remove leftover files and dependencies from `babel-plugin-inline-import` | ||
@@ -191,3 +197,3 @@ ## v2.0.4 (December 7, 2017) | ||
* Improve .gql file parsing to address issues with Windows and/or IDE settings (@OisinOKeeffe | ||
- Improve .gql file parsing to address issues with Windows and/or IDE settings (@OisinOKeeffe | ||
@Tzelon) | ||
@@ -199,3 +205,3 @@ | ||
* Utilize regex for more robust statement splitting (@Tzelon) | ||
- Utilize regex for more robust statement splitting (@Tzelon) | ||
@@ -206,3 +212,3 @@ ## v2.0.2 (October 9, 2017) | ||
* Change graphql to a peer dependency and allow newer versions | ||
- Change graphql to a peer dependency and allow newer versions | ||
@@ -215,9 +221,9 @@ ## v2.0.1 (September 23, 2017) | ||
* Added support for nested fragments | ||
- Added support for nested fragments | ||
* Added support for Babel's resolveModuleSource option (@real34) | ||
- Added support for Babel's resolveModuleSource option (@real34) | ||
### Fixes | ||
* Deduplicate fragments | ||
- Deduplicate fragments | ||
@@ -228,6 +234,6 @@ ## v2.0.0 (July 22, 2017) | ||
* Potentially removed Meteor support. Not sure it worked anyway and there's an alternative solution | ||
- Potentially removed Meteor support. Not sure it worked anyway and there's an alternative solution | ||
for .graphql files in Meteor. | ||
* Removed support for customizable extensions. This was undocumented and left over from the project | ||
- Removed support for customizable extensions. This was undocumented and left over from the project | ||
I forked. | ||
@@ -237,9 +243,9 @@ | ||
* `<query>.loc.source` is now available on the inlined query | ||
- `<query>.loc.source` is now available on the inlined query | ||
### Maintenance | ||
* Major rewrite. Code is now much smaller and more readable. (1 file, ~60 LOC) | ||
- Major rewrite. Code is now much smaller and more readable. (1 file, ~60 LOC) | ||
* Removed dependence on `resolve` package. | ||
- Removed dependence on `resolve` package. | ||
@@ -246,0 +252,0 @@ ## v1.3.3 |
{ | ||
"name": "babel-plugin-import-graphql", | ||
"version": "2.5.0", | ||
"version": "2.5.1", | ||
"description": "Babel plugin to make .gql/.graphql files importable", | ||
@@ -5,0 +5,0 @@ "author": "A.J. Roberts <detrohutt@gmail.com>", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33372
8
390