@ts-gql/babel-plugin
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -5,7 +5,9 @@ 'use strict'; | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var nodePath = _interopDefault(require('path')); | ||
var nodePath = require('path'); | ||
var helperModuleImports = require('@babel/helper-module-imports'); | ||
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; } | ||
var nodePath__default = /*#__PURE__*/_interopDefault(nodePath); | ||
function plugin() { | ||
@@ -16,10 +18,8 @@ return { | ||
let expressionPath = asExpressionPath.get("expression"); | ||
if (expressionPath.node.type === "TaggedTemplateExpression" && expressionPath.node.tag.type === "Identifier" && expressionPath.node.tag.name === "gql" && asExpressionPath.node.type === "TSAsExpression" && asExpressionPath.node.typeAnnotation.type === "TSImportType") { | ||
expressionPath.replaceWith(helperModuleImports.addNamed(expressionPath, "document", asExpressionPath.node.typeAnnotation.argument.value, { | ||
nameHint: nodePath.basename(asExpressionPath.node.typeAnnotation.argument.value) | ||
nameHint: nodePath__default["default"].basename(asExpressionPath.node.typeAnnotation.argument.value) | ||
})); | ||
} | ||
} | ||
} | ||
@@ -29,2 +29,2 @@ }; | ||
exports.default = plugin; | ||
exports["default"] = plugin; |
@@ -1,13 +0,12 @@ | ||
"use strict"; | ||
'use strict'; | ||
function _interopDefault(ex) { | ||
return ex && "object" == typeof ex && "default" in ex ? ex.default : ex; | ||
} | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: !0 | ||
}); | ||
var nodePath = require('path'); | ||
var helperModuleImports = require('@babel/helper-module-imports'); | ||
var nodePath = _interopDefault(require("path")), helperModuleImports = require("@babel/helper-module-imports"); | ||
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; } | ||
var nodePath__default = /*#__PURE__*/_interopDefault(nodePath); | ||
function plugin() { | ||
@@ -18,5 +17,7 @@ return { | ||
let expressionPath = asExpressionPath.get("expression"); | ||
"TaggedTemplateExpression" === expressionPath.node.type && "Identifier" === expressionPath.node.tag.type && "gql" === expressionPath.node.tag.name && "TSAsExpression" === asExpressionPath.node.type && "TSImportType" === asExpressionPath.node.typeAnnotation.type && expressionPath.replaceWith(helperModuleImports.addNamed(expressionPath, "document", asExpressionPath.node.typeAnnotation.argument.value, { | ||
nameHint: nodePath.basename(asExpressionPath.node.typeAnnotation.argument.value) | ||
})); | ||
if (expressionPath.node.type === "TaggedTemplateExpression" && expressionPath.node.tag.type === "Identifier" && expressionPath.node.tag.name === "gql" && asExpressionPath.node.type === "TSAsExpression" && asExpressionPath.node.typeAnnotation.type === "TSImportType") { | ||
expressionPath.replaceWith(helperModuleImports.addNamed(expressionPath, "document", asExpressionPath.node.typeAnnotation.argument.value, { | ||
nameHint: nodePath__default["default"].basename(asExpressionPath.node.typeAnnotation.argument.value) | ||
})); | ||
} | ||
} | ||
@@ -27,2 +28,2 @@ } | ||
exports.default = plugin; | ||
exports["default"] = plugin; |
@@ -9,3 +9,2 @@ import nodePath from 'path'; | ||
let expressionPath = asExpressionPath.get("expression"); | ||
if (expressionPath.node.type === "TaggedTemplateExpression" && expressionPath.node.tag.type === "Identifier" && expressionPath.node.tag.name === "gql" && asExpressionPath.node.type === "TSAsExpression" && asExpressionPath.node.typeAnnotation.type === "TSImportType") { | ||
@@ -17,3 +16,2 @@ expressionPath.replaceWith(addNamed(expressionPath, "document", asExpressionPath.node.typeAnnotation.argument.value, { | ||
} | ||
} | ||
@@ -23,2 +21,2 @@ }; | ||
export default plugin; | ||
export { plugin as default }; |
{ | ||
"name": "@ts-gql/babel-plugin", | ||
"version": "0.1.0", | ||
"main": "dist/babel-plugin.cjs.js", | ||
"module": "dist/babel-plugin.esm.js", | ||
"files": [ | ||
"dist", | ||
"!**/*.d.ts" | ||
], | ||
"license": "MIT", | ||
"dependencies": { | ||
"@babel/helper-module-imports": "^7.8.3", | ||
"@babel/runtime": "^7.9.2" | ||
}, | ||
"devDependencies": { | ||
"@types/babel__core": "^7.1.7" | ||
}, | ||
"repository": "https://github.com/Thinkmill/ts-gql/tree/master/packages/babel-plugin" | ||
} | ||
"name": "@ts-gql/babel-plugin", | ||
"version": "0.1.1", | ||
"main": "dist/babel-plugin.cjs.js", | ||
"module": "dist/babel-plugin.esm.js", | ||
"exports": { | ||
".": { | ||
"module": "./dist/babel-plugin.esm.js", | ||
"default": "./dist/babel-plugin.cjs.js" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"files": [ | ||
"dist", | ||
"!**/*.d.ts" | ||
], | ||
"license": "MIT", | ||
"dependencies": { | ||
"@babel/helper-module-imports": "^7.8.3", | ||
"@babel/runtime": "^7.9.2" | ||
}, | ||
"devDependencies": { | ||
"@types/babel__core": "^7.1.9" | ||
}, | ||
"repository": "https://github.com/Thinkmill/ts-gql/tree/main/packages/babel-plugin" | ||
} |
Sorry, the diff of this file is not supported yet
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
4887
6