gatsby-codemods
Advanced tools
Comparing version 4.4.0-next.0 to 4.4.0-next.1
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
@@ -10,20 +9,11 @@ exports.jscodeshiftExecutable = void 0; | ||
exports.transformerDirectory = void 0; | ||
var _path = _interopRequireDefault(require("path")); | ||
var _execa = _interopRequireDefault(require("execa")); | ||
const codemods = [`gatsby-plugin-image`, `global-graphql-calls`, `import-link`, `navigate-calls`, `rename-bound-action-creators`, `sort-and-aggr-graphql`]; | ||
const transformerDirectory = _path.default.join(__dirname, `../`, `transforms`); | ||
exports.transformerDirectory = transformerDirectory; | ||
const jscodeshiftExecutable = require.resolve(`.bin/jscodeshift`); | ||
exports.jscodeshiftExecutable = jscodeshiftExecutable; | ||
function runTransform(transform, targetDir) { | ||
const transformerPath = _path.default.join(transformerDirectory, `${transform}.js`); | ||
let args = []; | ||
@@ -36,3 +26,2 @@ args.push(`--ignore-pattern=**/node_modules/**`); | ||
console.log(`Executing command: jscodeshift ${args.join(` `)}`); | ||
const result = _execa.default.node(jscodeshiftExecutable, args, { | ||
@@ -42,3 +31,2 @@ stdio: `inherit`, | ||
}); | ||
if (result.error) { | ||
@@ -48,6 +36,4 @@ throw result.error; | ||
} | ||
function run() { | ||
let [transform, targetDir] = process.argv.slice(2); | ||
if (!transform) { | ||
@@ -57,3 +43,2 @@ console.log(`Be sure to pass in the name of the codemod you're attempting to run.`); | ||
} | ||
if (!codemods.includes(transform)) { | ||
@@ -63,3 +48,2 @@ console.log(`You have passed in invalid codemod name: ${transform}. Please pass in one of the following: ${codemods.join(`, `)}.`); | ||
} | ||
if (!targetDir) { | ||
@@ -69,4 +53,3 @@ console.log(`You have not provided a target directory to run the codemod against, will default to root.`); | ||
} | ||
runTransform(transform, targetDir); | ||
} |
@@ -6,2 +6,8 @@ # Changelog: `gatsby-codemods` | ||
## [4.3.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-codemods@4.3.0/packages/gatsby-codemods) (2022-12-13) | ||
[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v5.3) | ||
**Note:** Version bump only for package gatsby-codemods | ||
## [4.2.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-codemods@4.2.0/packages/gatsby-codemods) (2022-11-25) | ||
@@ -8,0 +14,0 @@ |
{ | ||
"name": "gatsby-codemods", | ||
"version": "4.4.0-next.0", | ||
"version": "4.4.0-next.1", | ||
"description": "A collection of codemod scripts for use with JSCodeshift that help migrate to newer versions of Gatsby.", | ||
@@ -39,4 +39,4 @@ "main": "index.js", | ||
"@babel/cli": "^7.15.4", | ||
"@types/jscodeshift": "^0.11.5", | ||
"babel-preset-gatsby-package": "^3.4.0-next.0", | ||
"@types/jscodeshift": "^0.11.6", | ||
"babel-preset-gatsby-package": "^3.4.0-next.1", | ||
"cross-env": "^7.0.3" | ||
@@ -48,3 +48,3 @@ }, | ||
"bin": "./bin/gatsby-codemods.js", | ||
"gitHead": "7938eb07143c06953ae0197d26533ba34eecfc29" | ||
"gitHead": "5df8a99b7fd6de53a8f3088138cc574f55f4cfd5" | ||
} |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.query = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _gatsby = require("gatsby"); | ||
var _gatsbyImage = _interopRequireDefault(require("gatsby-image")); | ||
/*#__PURE__*/ | ||
_react.default.createElement(_gatsbyImage.default, { | ||
/*#__PURE__*/_react.default.createElement(_gatsbyImage.default, { | ||
fixed: data.file.childImageSharp.fixed, | ||
alt: "headshot" | ||
}); | ||
const query = (0, _gatsby.graphql)` | ||
@@ -21,0 +14,0 @@ { |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.query = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _gatsby = require("gatsby"); | ||
var _gatsbyPluginImage = require("gatsby-plugin-image"); | ||
/*#__PURE__*/ | ||
_react.default.createElement(_gatsbyPluginImage.GatsbyImage, { | ||
/*#__PURE__*/_react.default.createElement(_gatsbyPluginImage.GatsbyImage, { | ||
image: data.file.childImageSharp.gatsbyImageData, | ||
alt: "headshot" | ||
}); | ||
const query = (0, _gatsby.graphql)`{ | ||
@@ -21,0 +14,0 @@ file(relativePath: {eq: "headers/default.jpg"}) { |
"use strict"; | ||
var _compat = require("gatsby-plugin-image/compat"); | ||
// how do comments work? | ||
/*#__PURE__*/ | ||
React.createElement(_compat.GatsbyImage, { | ||
/*#__PURE__*/React.createElement(_compat.GatsbyImage, { | ||
fixed: data.file.childImageSharp.fixed, | ||
alt: "headshot" | ||
}); //still doing ok? | ||
}); | ||
//still doing ok? |
"use strict"; | ||
var _gatsbyPluginImage = require("gatsby-plugin-image"); | ||
// how do comments work? | ||
/*#__PURE__*/ | ||
React.createElement(_gatsbyPluginImage.GatsbyImage, { | ||
/*#__PURE__*/React.createElement(_gatsbyPluginImage.GatsbyImage, { | ||
image: data.file.childImageSharp.gatsbyImageData, | ||
alt: "headshot" | ||
}); //still doing ok? | ||
}); | ||
//still doing ok? |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.default = void 0; | ||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); | ||
var _react = _interopRequireDefault(require("react")); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _gatsbyImage = _interopRequireDefault(require("gatsby-image")); | ||
const svgAssetsContext = require.context(`!file-loader!svgo-loader?{"plugins":[{"removeViewBox":false}]}!../assets`, true, /^\.\/.*\.svg$/); | ||
class SVGGatsbyImage extends _gatsbyImage.default { | ||
@@ -25,3 +18,2 @@ render() { | ||
} = this.props; | ||
if (!this.state.isVisible) { | ||
@@ -32,3 +24,2 @@ return /*#__PURE__*/_react.default.createElement("div", { | ||
} | ||
return /*#__PURE__*/_react.default.createElement("img", (0, _extends2.default)({ | ||
@@ -40,5 +31,3 @@ src: svgAssetsContext(`./${fluid.src}`), | ||
} | ||
} | ||
SVGGatsbyImage.propTypes = { | ||
@@ -50,3 +39,2 @@ alt: _propTypes.default.string | ||
}; | ||
const LazySVGImg = ({ | ||
@@ -60,3 +48,2 @@ src, | ||
}, rest)); | ||
LazySVGImg.propTypes = { | ||
@@ -63,0 +50,0 @@ src: _propTypes.default.string |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.default = void 0; | ||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); | ||
var _react = _interopRequireDefault(require("react")); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _gatsbyPluginImage = require("gatsby-plugin-image"); | ||
const svgAssetsContext = require.context(`!file-loader!svgo-loader?{"plugins":[{"removeViewBox":false}]}!../assets`, true, /^\.\/.*\.svg$/); | ||
class SVGGatsbyImage extends _gatsbyPluginImage.GatsbyImage { | ||
@@ -25,3 +18,2 @@ render() { | ||
} = this.props; | ||
if (!this.state.isVisible) { | ||
@@ -32,3 +24,2 @@ return /*#__PURE__*/_react.default.createElement("div", { | ||
} | ||
return /*#__PURE__*/_react.default.createElement("img", (0, _extends2.default)({ | ||
@@ -40,5 +31,3 @@ src: svgAssetsContext(`./${fluid.src}`), | ||
} | ||
} | ||
SVGGatsbyImage.propTypes = { | ||
@@ -50,3 +39,2 @@ alt: _propTypes.default.string | ||
}; | ||
const LazySVGImg = ({ | ||
@@ -60,3 +48,2 @@ src, | ||
}, rest)); | ||
LazySVGImg.propTypes = { | ||
@@ -63,0 +50,0 @@ src: _propTypes.default.string |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.query = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _gatsby = require("gatsby"); | ||
var _gatsbyImage = _interopRequireDefault(require("gatsby-image")); | ||
/*#__PURE__*/ | ||
_react.default.createElement(_gatsbyImage.default, { | ||
/*#__PURE__*/_react.default.createElement(_gatsbyImage.default, { | ||
fixed: data.file.childImageSharp.fixed, | ||
alt: "headshot" | ||
}); | ||
const query = (0, _gatsby.graphql)` | ||
@@ -21,0 +14,0 @@ { |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.query = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _gatsby = require("gatsby"); | ||
var _gatsbyPluginImage = require("gatsby-plugin-image"); | ||
/*#__PURE__*/ | ||
_react.default.createElement(_gatsbyPluginImage.GatsbyImage, { | ||
/*#__PURE__*/_react.default.createElement(_gatsbyPluginImage.GatsbyImage, { | ||
image: data.file.childImageSharp.gatsbyImageData, | ||
alt: "headshot" | ||
}); | ||
const query = (0, _gatsby.graphql)`{ | ||
@@ -21,0 +14,0 @@ file(relativePath: {eq: "headers/default.jpg"}) { |
"use strict"; | ||
/*#__PURE__*/ | ||
React.createElement(GatsbyImage, { | ||
/*#__PURE__*/React.createElement(GatsbyImage, { | ||
image: getImage(data.fitInside), | ||
alt: "chameleon" | ||
}); |
"use strict"; | ||
/*#__PURE__*/ | ||
React.createElement(GatsbyImage, { | ||
/*#__PURE__*/React.createElement(GatsbyImage, { | ||
image: getImage(data.fitInside), | ||
alt: "chameleon" | ||
}); |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.query = void 0; | ||
var _gatsby = require("gatsby"); | ||
var _react = _interopRequireDefault(require("react")); | ||
var _img = _interopRequireDefault(require("../components/core/img")); | ||
const Profiles = ({ | ||
@@ -45,3 +40,2 @@ profiles | ||
})))); | ||
const query = (0, _gatsby.graphql)` | ||
@@ -48,0 +42,0 @@ fragment ProfilesFragment on ContentfulProfile { |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.query = void 0; | ||
var _gatsby = require("gatsby"); | ||
var _react = _interopRequireDefault(require("react")); | ||
var _img = _interopRequireDefault(require("../components/core/img")); | ||
const Profiles = ({ | ||
@@ -45,3 +40,2 @@ profiles | ||
})))); | ||
const query = (0, _gatsby.graphql)` | ||
@@ -48,0 +42,0 @@ fragment ProfilesFragment on ContentfulProfile { |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.query = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _gatsby = require("gatsby"); | ||
var _gatsbyImage = _interopRequireDefault(require("gatsby-image")); | ||
/*#__PURE__*/ | ||
_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_gatsbyImage.default, { | ||
/*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_gatsbyImage.default, { | ||
fixed: data.file.childImageSharp.fixed, | ||
@@ -22,3 +16,2 @@ alt: "headshot" | ||
})); | ||
const query = (0, _gatsby.graphql)` | ||
@@ -25,0 +18,0 @@ query { |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.query = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _gatsby = require("gatsby"); | ||
var _gatsbyPluginImage = require("gatsby-plugin-image"); | ||
/*#__PURE__*/ | ||
_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_gatsbyPluginImage.GatsbyImage, { | ||
/*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_gatsbyPluginImage.GatsbyImage, { | ||
image: data.file.childImageSharp.gatsbyImageData, | ||
@@ -22,3 +16,2 @@ alt: "headshot" | ||
})); | ||
const query = (0, _gatsby.graphql)`{ | ||
@@ -25,0 +18,0 @@ file(relativePath: {eq: "headers/headshot.jpg"}) { |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.CloudFeature = CloudFeature; | ||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); | ||
function CloudFeature({ | ||
@@ -31,7 +28,5 @@ content, | ||
let identyfier = componentName; | ||
if (componentName === `Heading`) { | ||
identyfier = content[idx - 1] && content[idx - 1].componentName === `Heading` ? `longHeading` : `shortHeading`; | ||
} | ||
return /*#__PURE__*/React.createElement(ContentItemRenderer, (0, _extends2.default)({ | ||
@@ -38,0 +33,0 @@ key: id, |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.CloudFeature = CloudFeature; | ||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); | ||
function CloudFeature({ | ||
@@ -31,7 +28,5 @@ content, | ||
let identyfier = componentName; | ||
if (componentName === `Heading`) { | ||
identyfier = content[idx - 1] && content[idx - 1].componentName === `Heading` ? `longHeading` : `shortHeading`; | ||
} | ||
return /*#__PURE__*/React.createElement(ContentItemRenderer, (0, _extends2.default)({ | ||
@@ -38,0 +33,0 @@ key: id, |
"use strict"; | ||
/*#__PURE__*/ | ||
React.createElement(Hero, { | ||
/*#__PURE__*/React.createElement(Hero, { | ||
test: data.banner.childImageSharp.fluid, | ||
@@ -6,0 +5,0 @@ title: "LAURIE BARTH", |
"use strict"; | ||
/*#__PURE__*/ | ||
React.createElement(Hero, { | ||
/*#__PURE__*/React.createElement(Hero, { | ||
test: data.banner.childImageSharp.gatsbyImageData, | ||
@@ -6,0 +5,0 @@ title: "LAURIE BARTH", |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var _withIEPolyfill = _interopRequireDefault(require("gatsby-image/withIEPolyfill")); | ||
const AssetBlock = ({ | ||
@@ -8,0 +6,0 @@ asset, |
"use strict"; | ||
var _gatsbyPluginImage = require("gatsby-plugin-image"); | ||
const AssetBlock = ({ | ||
@@ -6,0 +5,0 @@ asset, |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var _gatsbyImage = _interopRequireDefault(require("gatsby-image")); | ||
/*#__PURE__*/ | ||
React.createElement(_gatsbyImage.default, { | ||
/*#__PURE__*/React.createElement(_gatsbyImage.default, { | ||
fluid: pictures[activeItem], | ||
alt: "" | ||
}); |
"use strict"; | ||
var _gatsbyPluginImage = require("gatsby-plugin-image"); | ||
/*#__PURE__*/ | ||
React.createElement(_gatsbyPluginImage.GatsbyImage, { | ||
/*#__PURE__*/React.createElement(_gatsbyPluginImage.GatsbyImage, { | ||
image: pictures[activeItem], | ||
alt: "" | ||
}); |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.default = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _gatsbyImage = _interopRequireDefault(require("gatsby-image")); | ||
const Image = () => { | ||
var _data, _data$placeholderImag, _data$placeholderImag2, _data2, _data2$placeholderIma, _data2$placeholderIma2; | ||
if (!((_data = data) !== null && _data !== void 0 && (_data$placeholderImag = _data.placeholderImage) !== null && _data$placeholderImag !== void 0 && (_data$placeholderImag2 = _data$placeholderImag.childImageSharp) !== null && _data$placeholderImag2 !== void 0 && _data$placeholderImag2.fluid)) { | ||
return /*#__PURE__*/_react.default.createElement("div", null, "Picture not found"); | ||
} | ||
return /*#__PURE__*/_react.default.createElement(_gatsbyImage.default, { | ||
@@ -23,4 +17,3 @@ fluid: (_data2 = data) === null || _data2 === void 0 ? void 0 : (_data2$placeholderIma = _data2.placeholderImage) === null || _data2$placeholderIma === void 0 ? void 0 : (_data2$placeholderIma2 = _data2$placeholderIma.childImageSharp) === null || _data2$placeholderIma2 === void 0 ? void 0 : _data2$placeholderIma2.fluid | ||
}; | ||
var _default = Image; | ||
exports.default = _default; |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.default = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _gatsbyPluginImage = require("gatsby-plugin-image"); | ||
const Image = () => { | ||
var _data, _data$placeholderImag, _data$placeholderImag2, _data2, _data2$placeholderIma, _data2$placeholderIma2; | ||
if (!((_data = data) !== null && _data !== void 0 && (_data$placeholderImag = _data.placeholderImage) !== null && _data$placeholderImag !== void 0 && (_data$placeholderImag2 = _data$placeholderImag.childImageSharp) !== null && _data$placeholderImag2 !== void 0 && _data$placeholderImag2.gatsbyImageData)) { | ||
return /*#__PURE__*/_react.default.createElement("div", null, "Picture not found"); | ||
} | ||
return /*#__PURE__*/_react.default.createElement(_gatsbyPluginImage.GatsbyImage, { | ||
@@ -23,4 +17,3 @@ image: (_data2 = data) === null || _data2 === void 0 ? void 0 : (_data2$placeholderIma = _data2.placeholderImage) === null || _data2$placeholderIma === void 0 ? void 0 : (_data2$placeholderIma2 = _data2$placeholderIma.childImageSharp) === null || _data2$placeholderIma2 === void 0 ? void 0 : _data2$placeholderIma2.gatsbyImageData | ||
}; | ||
var _default = Image; | ||
exports.default = _default; |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.query = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _gatsby = require("gatsby"); | ||
var _gatsbyImage = _interopRequireDefault(require("gatsby-image")); | ||
/*#__PURE__*/ | ||
_react.default.createElement(_gatsbyImage.default, { | ||
/*#__PURE__*/_react.default.createElement(_gatsbyImage.default, { | ||
fluid: data.file.childImageSharp.fluid, | ||
alt: "headshot" | ||
}); | ||
const query = (0, _gatsby.graphql)`query { | ||
@@ -21,0 +14,0 @@ named: file(relativePath: {eq: "landscape.jpg"}) { |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.query = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _gatsby = require("gatsby"); | ||
var _gatsbyPluginImage = require("gatsby-plugin-image"); | ||
/*#__PURE__*/ | ||
_react.default.createElement(_gatsbyPluginImage.GatsbyImage, { | ||
/*#__PURE__*/_react.default.createElement(_gatsbyPluginImage.GatsbyImage, { | ||
image: data.file.childImageSharp.gatsbyImageData, | ||
alt: "headshot" | ||
}); | ||
const query = (0, _gatsby.graphql)`{ | ||
@@ -21,0 +14,0 @@ named: file(relativePath: {eq: "landscape.jpg"}) { |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var _gatsbyImage = _interopRequireDefault(require("gatsby-image")); | ||
/*#__PURE__*/ | ||
React.createElement(_gatsbyImage.default, { | ||
/*#__PURE__*/React.createElement(_gatsbyImage.default, { | ||
fluid: image.fluid, | ||
@@ -10,0 +7,0 @@ "aria-hidden": image.description ? undefined : true, |
"use strict"; | ||
var _gatsbyPluginImage = require("gatsby-plugin-image"); | ||
/*#__PURE__*/ | ||
React.createElement(_gatsbyPluginImage.GatsbyImage, { | ||
/*#__PURE__*/React.createElement(_gatsbyPluginImage.GatsbyImage, { | ||
image: image.gatsbyImageData, | ||
@@ -8,0 +6,0 @@ "aria-hidden": image.description ? undefined : true, |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var _react = _interopRequireDefault(require("react")); | ||
var _gatsbyImage = _interopRequireDefault(require("gatsby-image")); | ||
var _styled = _interopRequireDefault(require("@emotion/styled")); | ||
var _typography = require("../utils/typography"); | ||
var _presets = require("../utils/presets"); | ||
const Image = (0, _styled.default)(_gatsbyImage.default)` | ||
@@ -16,0 +10,0 @@ display: block; |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var _react = _interopRequireDefault(require("react")); | ||
var _gatsbyPluginImage = require("gatsby-plugin-image"); | ||
var _styled = _interopRequireDefault(require("@emotion/styled")); | ||
var _typography = require("../utils/typography"); | ||
var _presets = require("../utils/presets"); | ||
const Image = (0, _styled.default)(_gatsbyPluginImage.GatsbyImage)` | ||
@@ -16,0 +10,0 @@ display: block; |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.default = Home; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _gatsby = require("gatsby"); | ||
var _gatsbyImage = _interopRequireDefault(require("gatsby-image")); | ||
var _landscape = _interopRequireDefault(require("../img/landscape.jpg")); | ||
var _portrait = _interopRequireDefault(require("../img/portrait.jpg")); | ||
function Home() { | ||
@@ -19,0 +12,0 @@ return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h1", null, "Testing images"), "These landscape and portrait images are used in addition to pngs of varying dimensions. The chameleon images make it easier to see where images are getting cropped.", /*#__PURE__*/_react.default.createElement("div", { |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.default = Home; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _gatsby = require("gatsby"); | ||
var _gatsbyPluginImage = require("gatsby-plugin-image"); | ||
var _landscape = _interopRequireDefault(require("../img/landscape.jpg")); | ||
var _portrait = _interopRequireDefault(require("../img/portrait.jpg")); | ||
function Home() { | ||
@@ -19,0 +12,0 @@ return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h1", null, "Testing images"), "These landscape and portrait images are used in addition to pngs of varying dimensions. The chameleon images make it easier to see where images are getting cropped.", /*#__PURE__*/_react.default.createElement("div", { |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.query = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _gatsby = require("gatsby"); | ||
const query = (0, _gatsby.graphql)` | ||
@@ -13,0 +9,0 @@ { |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.query = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _gatsby = require("gatsby"); | ||
const query = (0, _gatsby.graphql)`{ | ||
@@ -13,0 +9,0 @@ file(relativePath: {eq: "icon.png"}) { |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.default = exports.Hero = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _gatsbyImage = _interopRequireDefault(require("gatsby-image")); | ||
var _gatsby = require("gatsby"); | ||
const Hero = ({ | ||
@@ -40,5 +35,4 @@ children | ||
}; | ||
exports.Hero = Hero; | ||
var _default = Hero; | ||
exports.default = _default; |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.default = exports.Hero = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _gatsbyPluginImage = require("gatsby-plugin-image"); | ||
var _gatsby = require("gatsby"); | ||
const Hero = ({ | ||
@@ -36,5 +31,4 @@ children | ||
}; | ||
exports.Hero = Hero; | ||
var _default = Hero; | ||
exports.default = _default; |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var _gatsbyImage = _interopRequireDefault(require("gatsby-image")); | ||
/*#__PURE__*/ | ||
React.createElement(_gatsbyImage.default, { | ||
/*#__PURE__*/React.createElement(_gatsbyImage.default, { | ||
key: nextSite.slug, | ||
@@ -10,0 +7,0 @@ sx: styles.prevNextImage, |
"use strict"; | ||
var _gatsbyPluginImage = require("gatsby-plugin-image"); | ||
/*#__PURE__*/ | ||
React.createElement(_gatsbyPluginImage.GatsbyImage, { | ||
/*#__PURE__*/React.createElement(_gatsbyPluginImage.GatsbyImage, { | ||
image: { | ||
@@ -8,0 +6,0 @@ srcSet: ``, |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var _gatsbyImage = _interopRequireDefault(require("gatsby-image")); | ||
const HomePage = ({ | ||
@@ -8,0 +6,0 @@ data |
"use strict"; | ||
var _gatsbyPluginImage = require("gatsby-plugin-image"); | ||
const HomePage = ({ | ||
@@ -6,0 +5,0 @@ data |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var _gatsbyImage = _interopRequireDefault(require("gatsby-image")); | ||
const HomePage = ({ | ||
@@ -8,0 +6,0 @@ data |
"use strict"; | ||
var _gatsbyPluginImage = require("gatsby-plugin-image"); | ||
const HomePage = ({ | ||
@@ -6,0 +5,0 @@ data |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.query = void 0; | ||
var _gatsby = _interopRequireDefault(require("gatsby")); | ||
/* eslint-disable */ | ||
/* eslint-disable */ | ||
const query = graphql` | ||
@@ -12,0 +10,0 @@ query { |
@@ -5,10 +5,7 @@ "use strict"; | ||
exports.query = void 0; | ||
var _gatsby = _interopRequireWildcard(require("gatsby")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
/* eslint-disable */ | ||
/* eslint-disable */ | ||
const query = (0, _gatsby.graphql)` | ||
@@ -15,0 +12,0 @@ query { |
@@ -5,6 +5,5 @@ "use strict"; | ||
exports.query = void 0; | ||
var _gatsby = require("gatsby"); | ||
/* eslint-disable */ | ||
/* eslint-disable */ | ||
const query = graphql` | ||
@@ -11,0 +10,0 @@ query { |
@@ -5,6 +5,5 @@ "use strict"; | ||
exports.query = void 0; | ||
var _gatsby = require("gatsby"); | ||
/* eslint-disable */ | ||
/* eslint-disable */ | ||
const query = (0, _gatsby.graphql)` | ||
@@ -11,0 +10,0 @@ query { |
@@ -5,10 +5,7 @@ "use strict"; | ||
exports.query = void 0; | ||
var Gatsby = _interopRequireWildcard(require("gatsby")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
/* eslint-disable */ | ||
/* eslint-disable */ | ||
const query = graphql` | ||
@@ -15,0 +12,0 @@ query { |
@@ -5,10 +5,7 @@ "use strict"; | ||
exports.query = void 0; | ||
var Gatsby = _interopRequireWildcard(require("gatsby")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
/* eslint-disable */ | ||
/* eslint-disable */ | ||
const query = Gatsby.graphql` | ||
@@ -15,0 +12,0 @@ query { |
@@ -5,3 +5,2 @@ "use strict"; | ||
exports.query = void 0; | ||
/* eslint-disable */ | ||
@@ -8,0 +7,0 @@ const query = graphql` |
@@ -5,6 +5,5 @@ "use strict"; | ||
exports.query = void 0; | ||
var _gatsby = require("gatsby"); | ||
/* eslint-disable */ | ||
/* eslint-disable */ | ||
const query = (0, _gatsby.graphql)` | ||
@@ -11,0 +10,0 @@ query { |
@@ -5,3 +5,2 @@ "use strict"; | ||
exports.query = void 0; | ||
/* eslint-disable */ | ||
@@ -11,3 +10,2 @@ const { | ||
} = require(`gatsby`); | ||
const query = graphql` | ||
@@ -14,0 +12,0 @@ query { |
@@ -5,3 +5,2 @@ "use strict"; | ||
exports.query = void 0; | ||
/* eslint-disable */ | ||
@@ -12,3 +11,2 @@ const { | ||
} = require(`gatsby`); | ||
const query = graphql` | ||
@@ -15,0 +13,0 @@ query { |
@@ -5,6 +5,4 @@ "use strict"; | ||
exports.query = void 0; | ||
/* eslint-disable */ | ||
const Gatsby = require(`gatsby`); | ||
const query = graphql` | ||
@@ -11,0 +9,0 @@ query { |
@@ -5,6 +5,4 @@ "use strict"; | ||
exports.query = void 0; | ||
/* eslint-disable */ | ||
const Gatsby = require(`gatsby`); | ||
const query = Gatsby.graphql` | ||
@@ -11,0 +9,0 @@ query { |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.default = void 0; | ||
var _gatsbyLink = _interopRequireDefault(require("gatsby-link")); | ||
var _react = _interopRequireDefault(require("react")); | ||
/* eslint-disable */ | ||
/* eslint-disable */ | ||
const IndexPage = () => /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h1", null, "Hi people"), /*#__PURE__*/_react.default.createElement("p", null, "Welcome to your new Gatsby site."), /*#__PURE__*/_react.default.createElement("p", null, "Now go build something great."), /*#__PURE__*/_react.default.createElement(_gatsbyLink.default, { | ||
to: "/page-2/" | ||
}, "Go to page 2")); | ||
var _default = IndexPage; | ||
exports.default = _default; |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.default = void 0; | ||
var _gatsby = require("gatsby"); | ||
var _react = _interopRequireDefault(require("react")); | ||
/* eslint-disable */ | ||
/* eslint-disable */ | ||
const IndexPage = () => /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h1", null, "Hi people"), /*#__PURE__*/_react.default.createElement("p", null, "Welcome to your new Gatsby site."), /*#__PURE__*/_react.default.createElement("p", null, "Now go build something great."), /*#__PURE__*/_react.default.createElement(_gatsby.Link, { | ||
to: "/page-2/" | ||
}, "Go to page 2")); | ||
var _default = IndexPage; | ||
exports.default = _default; |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.query = void 0; | ||
var _gatsby = require("gatsby"); | ||
var _gatsbyLink = _interopRequireDefault(require("gatsby-link")); | ||
/* eslint-disable */ | ||
/* eslint-disable */ | ||
const query = (0, _gatsby.graphql)` | ||
@@ -14,0 +11,0 @@ query { |
@@ -5,6 +5,5 @@ "use strict"; | ||
exports.query = void 0; | ||
var _gatsby = require("gatsby"); | ||
/* eslint-disable */ | ||
/* eslint-disable */ | ||
const query = (0, _gatsby.graphql)` | ||
@@ -11,0 +10,0 @@ query { |
"use strict"; | ||
var _gatsbyLink = _interopRequireWildcard(require("gatsby-link")); | ||
var _gatsby = require("gatsby"); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } |
"use strict"; | ||
var _gatsbyLink = require("gatsby-link"); | ||
var _gatsby = require("gatsby"); |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.default = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _gatsbyLink = _interopRequireDefault(require("gatsby-link")); | ||
var Gatsby = _interopRequireWildcard(require("gatsby")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
/* eslint-disable */ | ||
/* eslint-disable */ | ||
const IndexPage = () => /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h1", null, "Hi people"), /*#__PURE__*/_react.default.createElement("p", null, "Welcome to your new Gatsby site."), /*#__PURE__*/_react.default.createElement("p", null, "Now go build something great."), /*#__PURE__*/_react.default.createElement(_gatsbyLink.default, { | ||
to: "/page-2/" | ||
}, "Go to page 2")); | ||
var _default = IndexPage; | ||
exports.default = _default; |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.default = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var Gatsby = _interopRequireWildcard(require("gatsby")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
/* eslint-disable */ | ||
/* eslint-disable */ | ||
const IndexPage = () => /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h1", null, "Hi people"), /*#__PURE__*/_react.default.createElement("p", null, "Welcome to your new Gatsby site."), /*#__PURE__*/_react.default.createElement("p", null, "Now go build something great."), /*#__PURE__*/_react.default.createElement(Gatsby.Link, { | ||
to: "/page-2/" | ||
}, "Go to page 2")); | ||
var _default = IndexPage; | ||
exports.default = _default; |
@@ -5,3 +5,2 @@ "use strict"; | ||
exports.query = void 0; | ||
/* eslint-disable */ | ||
@@ -11,5 +10,3 @@ const { | ||
} = require(`gatsby`); | ||
const Link = require("gatsby-link"); | ||
const query = graphql` | ||
@@ -16,0 +13,0 @@ query { |
@@ -5,3 +5,2 @@ "use strict"; | ||
exports.query = void 0; | ||
/* eslint-disable */ | ||
@@ -12,3 +11,2 @@ const { | ||
} = require(`gatsby`); | ||
const query = graphql` | ||
@@ -15,0 +13,0 @@ query { |
@@ -5,13 +5,9 @@ "use strict"; | ||
exports.default = void 0; | ||
/* eslint-disable */ | ||
const Gatsby = require(`gatsby`); | ||
const Link = require(`gatsby-link`); | ||
const IndexPage = () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h1", null, "Hi people"), /*#__PURE__*/React.createElement("p", null, "Welcome to your new Gatsby site."), /*#__PURE__*/React.createElement("p", null, "Now go build something great."), /*#__PURE__*/React.createElement(Link, { | ||
to: "/page-2/" | ||
}, "Go to page 2")); | ||
var _default = IndexPage; | ||
exports.default = _default; |
@@ -5,11 +5,8 @@ "use strict"; | ||
exports.default = void 0; | ||
/* eslint-disable */ | ||
const Gatsby = require(`gatsby`); | ||
const IndexPage = () => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h1", null, "Hi people"), /*#__PURE__*/React.createElement("p", null, "Welcome to your new Gatsby site."), /*#__PURE__*/React.createElement("p", null, "Now go build something great."), /*#__PURE__*/React.createElement(Gatsby.Link, { | ||
to: "/page-2/" | ||
}, "Go to page 2")); | ||
var _default = IndexPage; | ||
exports.default = _default; |
@@ -5,10 +5,7 @@ "use strict"; | ||
exports.default = Example; | ||
/* eslint-disable */ | ||
const React = require('react'); | ||
const { | ||
navigateTo | ||
} = require('gatsby-link'); | ||
function Example() { | ||
@@ -15,0 +12,0 @@ return /*#__PURE__*/React.createElement("button", { |
@@ -5,10 +5,7 @@ "use strict"; | ||
exports.default = Example; | ||
/* eslint-disable */ | ||
const React = require('react'); | ||
const { | ||
navigate | ||
} = require('gatsby'); | ||
function Example() { | ||
@@ -15,0 +12,0 @@ return /*#__PURE__*/React.createElement("button", { |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.default = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _gatsbyLink = require("gatsby-link"); | ||
/* eslint-disable */ | ||
@@ -18,3 +14,2 @@ // Don't use navigate with an onClick btw :-) | ||
}, "Click to go to home"); | ||
exports.default = _default; |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.default = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _gatsby = require("gatsby"); | ||
/* eslint-disable */ | ||
@@ -18,3 +14,2 @@ // Don't use navigate with an onClick btw :-) | ||
}, "Click to go to home"); | ||
exports.default = _default; |
@@ -6,14 +6,9 @@ "use strict"; | ||
exports.pageQuery = void 0; | ||
var React = _interopRequireWildcard(require("react")); | ||
var _gatsby = require("gatsby"); | ||
var _gatsbyLink = require("gatsby-link"); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
/* eslint-disable */ | ||
/* eslint-disable */ | ||
function Example() { | ||
@@ -24,3 +19,2 @@ return /*#__PURE__*/React.createElement("button", { | ||
} | ||
const pageQuery = (0, _gatsby.graphql)` | ||
@@ -27,0 +21,0 @@ query { |
@@ -6,12 +6,8 @@ "use strict"; | ||
exports.pageQuery = void 0; | ||
var React = _interopRequireWildcard(require("react")); | ||
var _gatsby = require("gatsby"); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
/* eslint-disable */ | ||
/* eslint-disable */ | ||
function Example() { | ||
@@ -22,3 +18,2 @@ return /*#__PURE__*/React.createElement("button", { | ||
} | ||
const pageQuery = (0, _gatsby.graphql)` | ||
@@ -25,0 +20,0 @@ query { |
@@ -5,12 +5,9 @@ "use strict"; | ||
exports.default = Hello; | ||
var React = _interopRequireWildcard(require("react")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
/* eslint-disable */ | ||
/* eslint-disable */ | ||
function Hello() { | ||
return /*#__PURE__*/React.createElement("h1", null, "Oh hey"); | ||
} |
@@ -5,12 +5,9 @@ "use strict"; | ||
exports.default = Hello; | ||
var React = _interopRequireWildcard(require("react")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
/* eslint-disable */ | ||
/* eslint-disable */ | ||
function Hello() { | ||
return /*#__PURE__*/React.createElement("h1", null, "Oh hey"); | ||
} |
@@ -6,3 +6,2 @@ "use strict"; | ||
} = require(`gatsby-source-filesystem`); | ||
exports.onCreateNode = ({ | ||
@@ -16,3 +15,2 @@ node, | ||
} = boundActionCreators; | ||
if (node.internal.type === `MarkdownRemark`) { | ||
@@ -31,3 +29,2 @@ const slug = createFilePath({ | ||
}; | ||
exports.createPages = ({ | ||
@@ -34,0 +31,0 @@ graphql, |
@@ -6,3 +6,2 @@ "use strict"; | ||
} = require(`gatsby-source-filesystem`); | ||
exports.onCreateNode = ({ | ||
@@ -16,3 +15,2 @@ node, | ||
} = actions; | ||
if (node.internal.type === `MarkdownRemark`) { | ||
@@ -31,3 +29,2 @@ const slug = createFilePath({ | ||
}; | ||
exports.createPages = ({ | ||
@@ -34,0 +31,0 @@ graphql, |
@@ -6,3 +6,2 @@ "use strict"; | ||
} = require(`gatsby-source-filesystem`); | ||
exports.onCreateNode = arg => { | ||
@@ -13,3 +12,2 @@ const { | ||
} = arg; | ||
if (node.internal.type === `MarkdownRemark`) { | ||
@@ -16,0 +14,0 @@ const slug = createFilePath({ |
@@ -6,3 +6,2 @@ "use strict"; | ||
} = require(`gatsby-source-filesystem`); | ||
exports.onCreateNode = arg => { | ||
@@ -13,3 +12,2 @@ const { | ||
} = arg; | ||
if (node.internal.type === `MarkdownRemark`) { | ||
@@ -16,0 +14,0 @@ const slug = createFilePath({ |
@@ -7,13 +7,7 @@ "use strict"; | ||
exports.updateImport = updateImport; | ||
var graphql = _interopRequireWildcard(require("graphql")); | ||
var _recast = require("recast"); | ||
var _core = require("@babel/core"); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
const propNames = [`fixed`, `fluid`]; | ||
@@ -30,3 +24,2 @@ const legacyFragments = [`GatsbyImageSharpFixed`, `GatsbyImageSharpFixed_withWebp`, `GatsbyImageSharpFluid`, `GatsbyImageSharpFluid_withWebp`]; | ||
}; | ||
function jsCodeShift(file) { | ||
@@ -36,7 +29,5 @@ if (file.path.includes(`node_modules`) || file.path.includes(`.cache`) || file.path.includes(`public`)) { | ||
} | ||
const transformedSource = babelRecast(file.source, file.path); | ||
return transformedSource; | ||
} | ||
function babelRecast(code, filePath) { | ||
@@ -62,3 +53,2 @@ const transformedAst = (0, _recast.parse)(code, { | ||
} = (0, _core.transformFromAstSync)(transformedAst, code, options); | ||
if (changedTracker.hasChanged) { | ||
@@ -69,6 +59,4 @@ return (0, _recast.print)(ast, { | ||
} | ||
return code; | ||
} | ||
function runParseSync(source, filePath) { | ||
@@ -86,3 +74,2 @@ const ast = (0, _core.parseSync)(source, { | ||
tokens: true // recast uses this | ||
} | ||
@@ -94,6 +81,4 @@ }); | ||
} | ||
return ast; | ||
} | ||
function updateImport(babel) { | ||
@@ -108,11 +93,8 @@ const { | ||
var _path$node$specifiers, _path$node$specifiers2, _path$node$specifiers3, _path$scope$getBindin; | ||
const { | ||
node | ||
} = path; | ||
if (node.source.value !== `gatsby-image` && node.source.value !== `gatsby-plugin-image/compat` && node.source.value !== `gatsby-image/withIEPolyfill`) { | ||
return; | ||
} | ||
const localName = (_path$node$specifiers = path.node.specifiers) === null || _path$node$specifiers === void 0 ? void 0 : (_path$node$specifiers2 = _path$node$specifiers[0]) === null || _path$node$specifiers2 === void 0 ? void 0 : (_path$node$specifiers3 = _path$node$specifiers2.local) === null || _path$node$specifiers3 === void 0 ? void 0 : _path$node$specifiers3.name; | ||
@@ -128,6 +110,4 @@ const usages = (_path$scope$getBindin = path.scope.getBinding(localName)) === null || _path$scope$getBindin === void 0 ? void 0 : _path$scope$getBindin.referencePaths; | ||
}, | ||
MemberExpression(path, state) { | ||
var _path$node, _path$node$object, _path$node$object$pro; | ||
if (propNames.includes(path.node.property.name) && ((_path$node = path.node) === null || _path$node === void 0 ? void 0 : (_path$node$object = _path$node.object) === null || _path$node$object === void 0 ? void 0 : (_path$node$object$pro = _path$node$object.property) === null || _path$node$object$pro === void 0 ? void 0 : _path$node$object$pro.name) === `childImageSharp`) { | ||
@@ -137,3 +117,2 @@ if (t.isMemberExpression(path.parent) || t.isOptionalMemberExpression(path.parent)) { | ||
} | ||
const updatedExpression = t.memberExpression(path.node.object, t.identifier(`gatsbyImageData`)); | ||
@@ -144,6 +123,4 @@ path.replaceWith(updatedExpression); | ||
}, | ||
OptionalMemberExpression(path, state) { | ||
var _path$node2, _path$node2$object, _path$node2$object$pr; | ||
if (propNames.includes(path.node.property.name) && ((_path$node2 = path.node) === null || _path$node2 === void 0 ? void 0 : (_path$node2$object = _path$node2.object) === null || _path$node2$object === void 0 ? void 0 : (_path$node2$object$pr = _path$node2$object.property) === null || _path$node2$object$pr === void 0 ? void 0 : _path$node2$object$pr.name) === `childImageSharp`) { | ||
@@ -153,3 +130,2 @@ if (t.isMemberExpression(path.parent) || t.isOptionalMemberExpression(path.parent)) { | ||
} | ||
const updatedExpression = t.optionalMemberExpression(path.node.object, t.identifier(`gatsbyImageData`), false, true); | ||
@@ -160,3 +136,2 @@ path.replaceWith(updatedExpression); | ||
}, | ||
TaggedTemplateExpression({ | ||
@@ -166,9 +141,6 @@ node | ||
var _node$quasi, _node$quasi$quasis, _node$quasi$quasis$, _node$quasi$quasis$$v; | ||
if (node.tag.name !== `graphql`) { | ||
return; | ||
} | ||
const query = (_node$quasi = node.quasi) === null || _node$quasi === void 0 ? void 0 : (_node$quasi$quasis = _node$quasi.quasis) === null || _node$quasi$quasis === void 0 ? void 0 : (_node$quasi$quasis$ = _node$quasi$quasis[0]) === null || _node$quasi$quasis$ === void 0 ? void 0 : (_node$quasi$quasis$$v = _node$quasi$quasis$.value) === null || _node$quasi$quasis$$v === void 0 ? void 0 : _node$quasi$quasis$$v.raw; | ||
if (query) { | ||
@@ -179,3 +151,2 @@ const { | ||
} = processGraphQLQuery(query, state); | ||
if (hasChanged) { | ||
@@ -187,3 +158,2 @@ node.quasi.quasis[0].value.raw = graphql.print(transformedGraphQLQuery); | ||
}, | ||
CallExpression({ | ||
@@ -193,9 +163,6 @@ node | ||
var _node$arguments, _node$arguments$0$qua, _node$arguments$0$qua2, _node$arguments$0$qua3; | ||
if (node.callee.name !== `graphql`) { | ||
return; | ||
} | ||
const query = (_node$arguments = node.arguments) === null || _node$arguments === void 0 ? void 0 : (_node$arguments$0$qua = _node$arguments[0].quasis) === null || _node$arguments$0$qua === void 0 ? void 0 : (_node$arguments$0$qua2 = _node$arguments$0$qua[0]) === null || _node$arguments$0$qua2 === void 0 ? void 0 : (_node$arguments$0$qua3 = _node$arguments$0$qua2.value) === null || _node$arguments$0$qua3 === void 0 ? void 0 : _node$arguments$0$qua3.raw; | ||
if (query) { | ||
@@ -206,3 +173,2 @@ const { | ||
} = processGraphQLQuery(query, state); | ||
if (hasChanged) { | ||
@@ -214,17 +180,11 @@ node.arguments[0].quasis[0].value.raw = graphql.print(transformedGraphQLQuery); | ||
} | ||
} | ||
}; | ||
} | ||
function processImportUsage(path, t, template, state) { | ||
var _fixedOrFluid$, _fixedOrFluid$$value; | ||
const node = path.parent; | ||
if (!t.isJSXOpeningElement(node)) { | ||
var _node$superClass; | ||
path.node.name = `GatsbyImage`; | ||
if (((_node$superClass = node.superClass) === null || _node$superClass === void 0 ? void 0 : _node$superClass.name) === path.node.name) { | ||
@@ -234,7 +194,5 @@ console.log(`It appears you are extending the image component in some way. This is not supported in \`gatsby-plugin-image\`, please use composition in ${state.opts.filename} instead.`); | ||
} | ||
console.log(`It appears you are referencing the image component in some way. We've updated the reference, but you will want to verify ${state.opts.filename} manually.`); | ||
return; | ||
} | ||
const componentName = t.jsxIdentifier(`GatsbyImage`); | ||
@@ -247,3 +205,2 @@ const fixedOrFluid = node.attributes.filter(({ | ||
}) => !propNames.includes(name === null || name === void 0 ? void 0 : name.name)); | ||
if (!fixedOrFluid.length > 0) { | ||
@@ -253,12 +210,8 @@ path.parentPath.replaceWith(t.jsxOpeningElement(componentName, [...otherAttributes], true)); | ||
} | ||
const expressionValue = fixedOrFluid === null || fixedOrFluid === void 0 ? void 0 : (_fixedOrFluid$ = fixedOrFluid[0]) === null || _fixedOrFluid$ === void 0 ? void 0 : (_fixedOrFluid$$value = _fixedOrFluid$.value) === null || _fixedOrFluid$$value === void 0 ? void 0 : _fixedOrFluid$$value.expression; | ||
let newImageExpression = expressionValue; // by default, pass what they pass | ||
if (t.isMemberExpression(expressionValue) && propNames.includes(expressionValue === null || expressionValue === void 0 ? void 0 : expressionValue.property.name)) { | ||
var _expressionValue$obje; | ||
if (expressionValue !== null && expressionValue !== void 0 && (_expressionValue$obje = expressionValue.object) !== null && _expressionValue$obje !== void 0 && _expressionValue$obje.object) { | ||
var _expressionValue$obje2; | ||
newImageExpression = template.expression.ast`${expressionValue === null || expressionValue === void 0 ? void 0 : (_expressionValue$obje2 = expressionValue.object) === null || _expressionValue$obje2 === void 0 ? void 0 : _expressionValue$obje2.object}.childImageSharp.gatsbyImageData`; | ||
@@ -268,10 +221,7 @@ } else if (expressionValue !== null && expressionValue !== void 0 && expressionValue.object) { | ||
} | ||
newImageExpression.extra.parenthesized = false; // the template adds parens and we don't want it to | ||
} else if (t.isOptionalMemberExpression(expressionValue) && propNames.includes(expressionValue === null || expressionValue === void 0 ? void 0 : expressionValue.property.name)) { | ||
var _expressionValue$obje3; | ||
if (expressionValue !== null && expressionValue !== void 0 && (_expressionValue$obje3 = expressionValue.object) !== null && _expressionValue$obje3 !== void 0 && _expressionValue$obje3.object) { | ||
var _expressionValue$obje4; | ||
newImageExpression = template.expression.ast`${expressionValue === null || expressionValue === void 0 ? void 0 : (_expressionValue$obje4 = expressionValue.object) === null || _expressionValue$obje4 === void 0 ? void 0 : _expressionValue$obje4.object}?.childImageSharp?.gatsbyImageData`; | ||
@@ -281,3 +231,2 @@ } else if (expressionValue !== null && expressionValue !== void 0 && expressionValue.object) { | ||
} | ||
newImageExpression.extra.parenthesized = false; // the template adds parens and we don't want it to | ||
@@ -288,5 +237,5 @@ } else if (t.isObjectExpression(expressionValue)) { | ||
console.log(`It appears you're passing a variable to your image component. We haven't changed it, but we have updated it to use the new GatsbyImage component. Please check ${state.opts.filename} manually.`); | ||
} // // create new prop | ||
} | ||
// // create new prop | ||
const updatedAttribute = t.jsxAttribute(t.jsxIdentifier(`image`), t.jsxExpressionContainer(newImageExpression)); | ||
@@ -300,5 +249,3 @@ path.parentPath.replaceWith(t.jsxOpeningElement(componentName, [updatedAttribute, ...otherAttributes], true)); | ||
var _fragment$name, _fragment$name2; | ||
let placeholderEnum = `BLURRED`; // just in case these aren't the discrete cases we expect | ||
if (legacyFragmentsNoPlaceholder.includes((_fragment$name = fragment.name) === null || _fragment$name === void 0 ? void 0 : _fragment$name.value)) { | ||
@@ -309,3 +256,2 @@ placeholderEnum = `NONE`; | ||
} | ||
const placeholderArgument = { | ||
@@ -324,3 +270,2 @@ kind: `Argument`, | ||
} | ||
const transformOptionsToNest = []; | ||
@@ -331,3 +276,2 @@ let newLayout = layout; | ||
argument.name.value = `width`; | ||
if (layout === `fluid` && Number(argument.value.value) >= 1000) { | ||
@@ -337,3 +281,2 @@ delete queryArguments[index]; | ||
var _arg$name; | ||
return (arg === null || arg === void 0 ? void 0 : (_arg$name = arg.name) === null || _arg$name === void 0 ? void 0 : _arg$name.value) === `maxHeight`; | ||
@@ -357,3 +300,2 @@ }); | ||
}); | ||
if (transformOptionsToNest.length > 0) { | ||
@@ -373,10 +315,7 @@ const newOptions = { | ||
} | ||
return newLayout; | ||
} | ||
function processGraphQLQuery(query, state) { | ||
try { | ||
let hasChanged = false; // this is sort of a hack, but print changes formatting and we only want to use it when we have to | ||
const ast = graphql.parse(query); | ||
@@ -388,15 +327,11 @@ graphql.visit(ast, { | ||
}) => (name === null || name === void 0 ? void 0 : name.value) === `childImageSharp`); | ||
if (!sharpField) { | ||
return; | ||
} | ||
const [fixedOrFluidField] = sharpField.selectionSet.selections.filter(({ | ||
name | ||
}) => propNames.includes(name === null || name === void 0 ? void 0 : name.value)); | ||
if (!fixedOrFluidField) { | ||
return; | ||
} | ||
let layout = fixedOrFluidField.name.value; | ||
@@ -407,3 +342,2 @@ const fragments = fixedOrFluidField.selectionSet.selections; | ||
}) => name.value === `GatsbyImageSharpFluidLimitPresentationSize`); | ||
if (presentationSizeFragment) { | ||
@@ -413,3 +347,2 @@ layout = `constrained`; | ||
} | ||
layout = processArguments(fixedOrFluidField.arguments, fragments === null || fragments === void 0 ? void 0 : fragments[0], layout, state); | ||
@@ -432,3 +365,2 @@ const typeArgument = { | ||
} | ||
}); | ||
@@ -435,0 +367,0 @@ return { |
@@ -5,3 +5,2 @@ "use strict"; | ||
const IMPORT_NAME = `graphql`; | ||
function findGatsbyRequire(root, j) { | ||
@@ -22,4 +21,4 @@ const requires = root.find(j.VariableDeclarator, { | ||
}); | ||
if (string.length) return string; // require(`gatsby`) | ||
if (string.length) return string; | ||
// require(`gatsby`) | ||
return requires.filter(path => { | ||
@@ -30,3 +29,2 @@ const template = path.get(`init`, `arguments`, 0, `quasis`, 0).node; | ||
} | ||
function addEsmImport(j, root, tag) { | ||
@@ -52,5 +50,3 @@ const existingImport = root.find(j.ImportDeclaration, { | ||
} | ||
const namespace = existingImport.find(j.ImportNamespaceSpecifier); | ||
if (namespace.length) { | ||
@@ -72,3 +68,2 @@ const { | ||
} | ||
const { | ||
@@ -79,3 +74,2 @@ specifiers | ||
} | ||
function addRequire(j, root, tag) { | ||
@@ -91,5 +85,3 @@ const existingImport = findGatsbyRequire(root, j); | ||
} | ||
const pattern = existingImport.find(j.ObjectPattern); | ||
if (!pattern.length) { | ||
@@ -111,3 +103,2 @@ const { | ||
} | ||
const { | ||
@@ -120,3 +111,2 @@ properties | ||
} | ||
module.exports = (file, api, options) => { | ||
@@ -141,3 +131,2 @@ const j = api.jscodeshift; | ||
}).length === 0; | ||
if (useImportSyntax) { | ||
@@ -148,3 +137,2 @@ addEsmImport(j, root, tag); | ||
} | ||
return root.toSource({ | ||
@@ -151,0 +139,0 @@ quote: `single`, |
@@ -5,3 +5,2 @@ "use strict"; | ||
const IMPORT_NAME = `Link`; | ||
function findGatsbyRequire(root, j) { | ||
@@ -22,4 +21,4 @@ const requires = root.find(j.VariableDeclarator, { | ||
}); | ||
if (string.length) return string; // require(`gatsby`) | ||
if (string.length) return string; | ||
// require(`gatsby`) | ||
return requires.filter(path => { | ||
@@ -30,7 +29,5 @@ const template = path.get(`init`, `arguments`, 0, `quasis`, 0).node; | ||
} | ||
function getFirstNode(j, root) { | ||
return root.find(j.Program).get(`body`, 0).node; | ||
} | ||
function addEsmImport(j, root) { | ||
@@ -56,12 +53,8 @@ const existingImport = root.find(j.ImportDeclaration, { | ||
const newFirstNode = getFirstNode(j, root); | ||
if (newFirstNode !== firstNode) { | ||
newFirstNode.comments = comments; | ||
} | ||
return; | ||
} | ||
const namespace = existingImport.find(j.ImportNamespaceSpecifier); | ||
if (namespace.length) { | ||
@@ -81,3 +74,2 @@ const { | ||
} | ||
const { | ||
@@ -88,3 +80,2 @@ specifiers | ||
} | ||
function removeGatsbyLinkEsmImport(j, root) { | ||
@@ -101,3 +92,2 @@ root.find(j.ImportDeclaration).forEach(path => { | ||
} | ||
function removeGatsbyLinkRequire(j, root) { | ||
@@ -112,3 +102,2 @@ root.find(j.VariableDeclarator, { | ||
let template = path.get(`init`, `arguments`, 0, `value`); | ||
if (template.value === `gatsby-link`) { | ||
@@ -118,5 +107,3 @@ j(path).remove(); | ||
} | ||
template = path.get(`init`, `arguments`, 0, `quasis`, 0).node; | ||
if (template.value.raw === `gatsby-link`) { | ||
@@ -127,3 +114,2 @@ j(path).remove(); | ||
} | ||
function addRequire(j, root) { | ||
@@ -139,5 +125,3 @@ const existingImport = findGatsbyRequire(root, j); | ||
} | ||
const pattern = existingImport.find(j.ObjectPattern); | ||
if (!pattern.length) { | ||
@@ -157,3 +141,2 @@ const { | ||
} | ||
const { | ||
@@ -166,3 +149,2 @@ properties | ||
} | ||
module.exports = (file, api, options) => { | ||
@@ -178,3 +160,2 @@ const j = api.jscodeshift; | ||
}).length > 0; | ||
if (useImportSyntax) { | ||
@@ -187,3 +168,2 @@ addEsmImport(j, root); | ||
} | ||
return root.toSource({ | ||
@@ -190,0 +170,0 @@ lineTerminator: `\n` |
@@ -7,3 +7,2 @@ "use strict"; | ||
const MODULE_NAME = `gatsby`; | ||
const getFirstNode = (j, root) => { | ||
@@ -13,3 +12,2 @@ const first = root.find(j.Program).get(`body`, 0); | ||
}; | ||
const replaceEsm = (j, root) => { | ||
@@ -24,7 +22,5 @@ const importStatement = root.find(j.ImportDeclaration, { | ||
}).length > 0; | ||
if (!importStatement.length || !containsNavigateTo) { | ||
return; | ||
} | ||
addGatsbyImport(j, root); | ||
@@ -34,3 +30,2 @@ replaceGatsbyLinkImport(j, root, importStatement); | ||
}; | ||
const replaceCommonJs = (j, root) => { | ||
@@ -52,7 +47,5 @@ const requires = root.find(j.VariableDeclarator, { | ||
}); | ||
if (!gatsbyLink.length || !navigateTo.length) { | ||
return; | ||
} | ||
addGatsbyRequire(j, root, requires); | ||
@@ -62,3 +55,2 @@ replaceGatsbyLinkRequire(j, root, requires); | ||
}; | ||
const addGatsbyImport = (j, root) => { | ||
@@ -70,3 +62,2 @@ const gatsbyImport = root.find(j.ImportDeclaration, { | ||
}); | ||
if (!gatsbyImport.length) { | ||
@@ -78,3 +69,2 @@ const [first] = getFirstNode(j, root); | ||
} | ||
gatsbyImport.replaceWith(({ | ||
@@ -86,5 +76,5 @@ node | ||
}); | ||
}; // TODO: make work with existing gatsby requires (e.g. `const { StaticQuery } = require('gatsby');`) | ||
}; | ||
// TODO: make work with existing gatsby requires (e.g. `const { StaticQuery } = require('gatsby');`) | ||
const addGatsbyRequire = (j, root, requires) => { | ||
@@ -96,3 +86,2 @@ const gatsbyRequire = requires.find(j.CallExpression, { | ||
}); | ||
if (!gatsbyRequire.length) { | ||
@@ -105,7 +94,5 @@ const [first] = getFirstNode(j, root); | ||
}; | ||
const replaceGatsbyLinkImport = (j, root, importStatement) => { | ||
const imports = importStatement.find(j.Identifier); | ||
const allExistingMethods = imports.every(node => node.value.name === EXISTING_METHOD); | ||
if (allExistingMethods) { | ||
@@ -115,3 +102,2 @@ importStatement.remove(); | ||
}; | ||
const replaceGatsbyLinkRequire = (j, root, requires) => { | ||
@@ -128,3 +114,2 @@ const links = requires.filter(el => j(el).find(j.CallExpression, { | ||
}; | ||
const replaceCallExpressions = (j, root) => { | ||
@@ -136,7 +121,5 @@ const expressions = root.find(j.CallExpression, { | ||
}); | ||
if (!expressions.length) { | ||
return; | ||
} | ||
expressions.replaceWith(({ | ||
@@ -149,3 +132,2 @@ node | ||
}; | ||
module.exports = (file, api, options) => { | ||
@@ -155,3 +137,2 @@ const j = api.jscodeshift; | ||
const isEsm = root.find(j.ImportDeclaration).length > 0; | ||
if (isEsm) { | ||
@@ -162,3 +143,2 @@ replaceEsm(j, root); | ||
} | ||
return root.toSource({ | ||
@@ -165,0 +145,0 @@ quote: `single`, |
@@ -5,3 +5,2 @@ "use strict"; | ||
const NEW_NAME = `actions`; | ||
module.exports = (file, api, options) => { | ||
@@ -8,0 +7,0 @@ const j = api.jscodeshift; |
@@ -8,13 +8,7 @@ "use strict"; | ||
exports.updateSortAndAggrField = updateSortAndAggrField; | ||
var graphql = _interopRequireWildcard(require("graphql")); | ||
var _recast = require("recast"); | ||
var _core = require("@babel/core"); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function jsCodeShift(file) { | ||
@@ -24,7 +18,5 @@ if (file.path.includes(`node_modules`) || file.path.includes(`.cache`) || file.path.includes(`public`)) { | ||
} | ||
const transformedSource = babelRecast(file.source, file.path); | ||
return transformedSource; | ||
} | ||
function babelRecast(code, filePath) { | ||
@@ -48,3 +40,2 @@ const transformedAst = (0, _recast.parse)(code, { | ||
const result = (0, _core.transformFromAstSync)(transformedAst, code, options); | ||
if (result) { | ||
@@ -54,3 +45,2 @@ const { | ||
} = result; | ||
if (ast && changedTracker.hasChanged) { | ||
@@ -62,6 +52,4 @@ return (0, _recast.print)(ast, { | ||
} | ||
return code; | ||
} | ||
function runParseSync(source, filePath) { | ||
@@ -79,3 +67,2 @@ const ast = (0, _core.parseSync)(source, { | ||
tokens: true // recast uses this | ||
} | ||
@@ -87,6 +74,4 @@ }); | ||
} | ||
return ast; | ||
} | ||
function isValidGraphQLQuery(query) { | ||
@@ -100,3 +85,2 @@ try { | ||
} | ||
function updateSortAndAggrField() { | ||
@@ -109,13 +93,9 @@ return { | ||
var _node$tag, _node$quasi, _node$quasi$quasis, _node$quasi$quasis$, _node$quasi$quasis$$v; | ||
if (node.tag.type !== `Identifier`) { | ||
return; | ||
} | ||
if (((_node$tag = node.tag) === null || _node$tag === void 0 ? void 0 : _node$tag.name) !== `graphql`) { | ||
return; | ||
} | ||
const query = (_node$quasi = node.quasi) === null || _node$quasi === void 0 ? void 0 : (_node$quasi$quasis = _node$quasi.quasis) === null || _node$quasi$quasis === void 0 ? void 0 : (_node$quasi$quasis$ = _node$quasi$quasis[0]) === null || _node$quasi$quasis$ === void 0 ? void 0 : (_node$quasi$quasis$$v = _node$quasi$quasis$.value) === null || _node$quasi$quasis$$v === void 0 ? void 0 : _node$quasi$quasis$$v.raw; | ||
if (query) { | ||
@@ -126,3 +106,2 @@ const { | ||
} = processGraphQLQuery(query); | ||
if (hasChanged) { | ||
@@ -134,3 +113,2 @@ node.quasi.quasis[0].value.raw = graphql.print(transformedGraphQLQuery); | ||
}, | ||
TemplateLiteral({ | ||
@@ -140,5 +118,3 @@ node | ||
var _node$quasis, _node$quasis$, _node$quasis$$value; | ||
const query = (_node$quasis = node.quasis) === null || _node$quasis === void 0 ? void 0 : (_node$quasis$ = _node$quasis[0]) === null || _node$quasis$ === void 0 ? void 0 : (_node$quasis$$value = _node$quasis$.value) === null || _node$quasis$$value === void 0 ? void 0 : _node$quasis$$value.raw; | ||
if (isValidGraphQLQuery(query)) { | ||
@@ -149,3 +125,2 @@ const { | ||
} = processGraphQLQuery(query); | ||
if (hasChanged) { | ||
@@ -157,3 +132,2 @@ node.quasis[0].value.raw = graphql.print(transformedGraphQLQuery); | ||
}, | ||
CallExpression({ | ||
@@ -165,14 +139,10 @@ node | ||
} | ||
if (node.callee.name !== `graphql`) { | ||
return; | ||
} | ||
if (node.arguments.length < 1) { | ||
return; | ||
} | ||
const argument = node.arguments[0]; | ||
let query = undefined; | ||
if (argument.type === `TemplateLiteral`) { | ||
@@ -183,3 +153,2 @@ query = argument.quasis[0].value.raw; | ||
} | ||
if (query) { | ||
@@ -190,3 +159,2 @@ const { | ||
} = processGraphQLQuery(query); | ||
if (hasChanged) { | ||
@@ -208,10 +176,7 @@ node.arguments[0] = { | ||
} | ||
} | ||
}; | ||
} | ||
function extractEnumValues(value, acc = []) { | ||
let hasValue = false; | ||
if (value.kind === graphql.Kind.ENUM) { | ||
@@ -223,3 +188,2 @@ hasValue = true; | ||
hasValue = true; | ||
for (const listItem of value.values) { | ||
@@ -229,6 +193,4 @@ extractEnumValues(listItem, acc); | ||
} | ||
return hasValue ? acc : undefined; | ||
} | ||
function isOldSortObject(props) { | ||
@@ -238,5 +200,4 @@ if (!props || typeof props !== `object` || Array.isArray(props)) { | ||
} | ||
let hasFields = false; // skip if there any unexpected keys | ||
let hasFields = false; | ||
// skip if there any unexpected keys | ||
for (const [key, value] of Object.entries(props)) { | ||
@@ -251,6 +212,4 @@ if (key === `fields`) { | ||
} | ||
return hasFields; | ||
} | ||
function pathSegmentsToAst(path, value) { | ||
@@ -274,7 +233,5 @@ return path.split(`___`).reduceRight((previousNode, fieldPathSegment) => { | ||
} | ||
function processGraphQLQuery(query) { | ||
try { | ||
let hasChanged = false; // this is sort of a hack, but print changes formatting and we only want to use it when we have to | ||
const ast = typeof query === `string` ? graphql.parse(query) : query; | ||
@@ -286,21 +243,17 @@ graphql.visit(ast, { | ||
return; | ||
} // old style sort: `allX(sort: { fields: <something>, order?: </something> }) | ||
} | ||
// old style sort: `allX(sort: { fields: <something>, order?: </something> }) | ||
const props = {}; | ||
for (const field of node.value.fields) { | ||
props[field.name.value] = extractEnumValues(field.value); | ||
} | ||
if (!isOldSortObject(props)) { | ||
return; | ||
} // iterate over each pair of field and order and create new object style for each | ||
} | ||
// iterate over each pair of field and order and create new object style for each | ||
const newObjects = []; | ||
for (let i = 0; i < props.fields.length; i++) { | ||
var _props$order$i, _props$order; | ||
const field = props.fields[i]; | ||
@@ -310,8 +263,7 @@ const order = (_props$order$i = (_props$order = props.order) === null || _props$order === void 0 ? void 0 : _props$order[i]) !== null && _props$order$i !== void 0 ? _props$order$i : `ASC`; | ||
} | ||
if (newObjects.length === 0) { | ||
return; | ||
} // @ts-ignore node.value apparently is read-only ... | ||
} | ||
// @ts-ignore node.value apparently is read-only ... | ||
node.value = newObjects.length > 1 ? { | ||
@@ -325,5 +277,5 @@ kind: graphql.Kind.LIST, | ||
return; | ||
} // @ts-ignore read-only ... | ||
} | ||
// @ts-ignore read-only ... | ||
node.value = pathSegmentsToAst(node.value.value, `SELECT`); | ||
@@ -333,3 +285,2 @@ hasChanged = true; | ||
} | ||
}); | ||
@@ -336,0 +287,0 @@ return { |
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
143348
2667