File tree Expand file tree Collapse file tree 2 files changed +21
-14
lines changed
packages/babel-plugin-remove-graphql-queries Expand file tree Collapse file tree 2 files changed +21
-14
lines changed Original file line number Diff line number Diff line change 1212 "@babel/cli" : " ^7.12.1" ,
1313 "@babel/core" : " ^7.12.3" ,
1414 "babel-preset-gatsby-package" : " ^0.12.0-next.0" ,
15- "cross-env" : " ^7.0.3"
15+ "cross-env" : " ^7.0.3" ,
16+ "gatsby-core-utils" : " ^1.10.0-next.0"
1617 },
1718 "peerDependencies" : {
18- "gatsby" : " ^2.0.0"
19+ "gatsby" : " ^2.0.0" ,
20+ "@babel/core" : " ^7.0.0"
1921 },
2022 "license" : " MIT" ,
2123 "main" : " index.js" ,
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import graphql from "gatsby/graphql"
44import { murmurhash } from "./murmur"
55import nodePath from "path"
66import { NodePath , PluginObj } from "@babel/core"
7+ import { slash } from "gatsby-core-utils"
78import { Binding } from "babel__traverse"
89import {
910 CallExpression ,
@@ -300,12 +301,14 @@ export default function ({ types: t }): PluginObj {
300301 const importDeclaration = t . importDeclaration (
301302 [ importDefaultSpecifier ] ,
302303 t . stringLiteral (
303- filename
304- ? nodePath . relative (
305- nodePath . parse ( filename ) . dir ,
306- resultPath
307- )
308- : shortResultPath
304+ slash (
305+ filename
306+ ? nodePath . relative (
307+ nodePath . dirname ( filename ) ,
308+ resultPath
309+ )
310+ : shortResultPath
311+ )
309312 )
310313 )
311314 path . node . body . unshift ( importDeclaration )
@@ -361,12 +364,14 @@ export default function ({ types: t }): PluginObj {
361364 const importDeclaration = t . importDeclaration (
362365 [ importDefaultSpecifier ] ,
363366 t . stringLiteral (
364- filename
365- ? nodePath . relative (
366- nodePath . parse ( filename ) . dir ,
367- resultPath
368- )
369- : shortResultPath
367+ slash (
368+ filename
369+ ? nodePath . relative (
370+ nodePath . dirname ( filename ) ,
371+ resultPath
372+ )
373+ : shortResultPath
374+ )
370375 )
371376 )
372377 path . node . body . unshift ( importDeclaration )
You can’t perform that action at this time.
0 commit comments