apollo-fragment-utils
Advanced tools
Comparing version
@@ -14,3 +14,3 @@ (function (global, factory) { | ||
function getFragmentInfo(fragment) { | ||
var fragmentAST = gql(fragment); | ||
var fragmentAST = typeof fragment === "string" ? gql(fragment) : fragment; | ||
var fragmentDefinitions = fragmentAST.definitions && fragmentAST.definitions[0]; | ||
@@ -17,0 +17,0 @@ var fragmentName = fragmentDefinitions && fragmentDefinitions.name.value; |
import { DocumentNode } from 'graphql'; | ||
export declare function getFragmentInfo(fragment: string): { | ||
export declare function getFragmentInfo(fragment: string | DocumentNode): { | ||
fragmentName: any; | ||
@@ -7,5 +7,5 @@ fragmentTypeName: any; | ||
export declare type buildFragmentQueryType = { | ||
fragment: string; | ||
fragment: string | DocumentNode; | ||
fragmentName: string; | ||
}; | ||
export declare function buildFragmentQuery({ fragment, fragmentName, }: buildFragmentQueryType): DocumentNode; |
@@ -7,3 +7,3 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { | ||
export function getFragmentInfo(fragment) { | ||
var fragmentAST = gql(fragment); | ||
var fragmentAST = typeof fragment === "string" ? gql(fragment) : fragment; | ||
var fragmentDefinitions = fragmentAST.definitions && fragmentAST.definitions[0]; | ||
@@ -10,0 +10,0 @@ var fragmentName = fragmentDefinitions && fragmentDefinitions.name.value; |
{ | ||
"name": "apollo-fragment-utils", | ||
"version": "0.1.3", | ||
"version": "0.2.0", | ||
"description": "A set of utils to help components to GraphQL fragments", | ||
@@ -20,4 +20,3 @@ "author": "Abhi Aiyer <abhiaiyer91@gmail.com>", | ||
"scripts": { | ||
"build:browser": | ||
"browserify ./lib/bundle.umd.js -o=./lib/bundle.js --i apollo-link --i apollo-utilities --i graphql-anywhere && npm run minify:browser", | ||
"build:browser": "browserify ./lib/bundle.umd.js -o=./lib/bundle.js --i apollo-link --i apollo-utilities --i graphql-anywhere && npm run minify:browser", | ||
"build": "tsc -p .", | ||
@@ -28,8 +27,6 @@ "bundle": "rollup -c", | ||
"prelint": "npm run lint-fix", | ||
"lint-fix": | ||
"prettier --trailing-comma all --single-quote --write \"src/**/*.{j,t}s*\"", | ||
"lint-fix": "prettier --trailing-comma all --single-quote --write \"src/**/*.{j,t}s*\"", | ||
"lint": "tslint --type-check -p tsconfig.json -c tslint.json src/*.ts", | ||
"lint-staged": "lint-staged", | ||
"minify:browser": | ||
"uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js", | ||
"minify:browser": "uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js", | ||
"postbuild": "npm run bundle", | ||
@@ -61,2 +58,3 @@ "prebuild": "npm run clean", | ||
"graphql-tag": "2.5.0", | ||
"jest": "21.2.1", | ||
"lint-staged": "4.3.0", | ||
@@ -77,2 +75,15 @@ "pre-commit": "1.2.2", | ||
}, | ||
"jest": { | ||
"mapCoverage": true, | ||
"transform": { | ||
".(ts|tsx)": "<rootDir>/node_modules/ts-jest/preprocessor.js" | ||
}, | ||
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$", | ||
"moduleFileExtensions": [ | ||
"ts", | ||
"tsx", | ||
"js", | ||
"json" | ||
] | ||
}, | ||
"lint-staged": { | ||
@@ -87,5 +98,8 @@ "*.ts*": [ | ||
], | ||
"*.json*": ["prettier --write", "git add"] | ||
"*.json*": [ | ||
"prettier --write", | ||
"git add" | ||
] | ||
}, | ||
"pre-commit": "lint-staged" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
9566
-93.99%23
4.55%7
-22.22%1
Infinity%