From c42dadd2f27362349b3a1942a486590db2a0cdf7 Mon Sep 17 00:00:00 2001 From: pieh Date: Thu, 20 Oct 2022 11:06:57 +0200 Subject: [PATCH] Normalize renderedByLocation casing Co-authored-by: Lennart --- packages/gatsby/cache-dir/slice.js | 2 +- ...abel-plugin-add-slice-placeholder-location.ts | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/gatsby/cache-dir/slice.js b/packages/gatsby/cache-dir/slice.js index aa3670938761e..952fc2f9c2ff5 100644 --- a/packages/gatsby/cache-dir/slice.js +++ b/packages/gatsby/cache-dir/slice.js @@ -21,7 +21,7 @@ export function Slice(props) { slicesContext.renderEnvironment === `browser`, internalProps.sliceName, propErrors, - props.__renderedBylocation + props.__renderedByLocation ) } diff --git a/packages/gatsby/src/utils/babel/babel-plugin-add-slice-placeholder-location.ts b/packages/gatsby/src/utils/babel/babel-plugin-add-slice-placeholder-location.ts index fe8c0cfe6804d..53bd6539836f9 100644 --- a/packages/gatsby/src/utils/babel/babel-plugin-add-slice-placeholder-location.ts +++ b/packages/gatsby/src/utils/babel/babel-plugin-add-slice-placeholder-location.ts @@ -4,7 +4,7 @@ import { ObjectProperty } from "@babel/types" import { store } from "../../redux" /** - * This is a plugin that finds placeholder components and injects the __renderedBylocation prop + * This is a plugin that finds placeholder components and injects the __renderedByLocation prop * with filename and location in the file where the placeholder was found. This is later used to provide * more useful error messages when the user props are invalid showing codeframe where user tries to render it * instead of codeframe of the Slice component itself (internals of gatsby) that is not useful for the user. @@ -27,7 +27,7 @@ export default function addSlicePlaceholderLocation( } if (this.file.opts.filename) { - const __renderedBylocationProperties: Array = [ + const __renderedByLocationProperties: Array = [ t.objectProperty( t.identifier(`fileName`), t.stringLiteral( @@ -40,7 +40,7 @@ export default function addSlicePlaceholderLocation( ] if (nodePath.node.loc?.start.line) { - __renderedBylocationProperties.push( + __renderedByLocationProperties.push( t.objectProperty( t.identifier(`lineNumber`), t.numericLiteral(nodePath.node.loc.start.line) @@ -48,7 +48,7 @@ export default function addSlicePlaceholderLocation( ) if (nodePath.node.loc?.start.column) { - __renderedBylocationProperties.push( + __renderedByLocationProperties.push( t.objectProperty( t.identifier(`columnNumber`), t.numericLiteral(nodePath.node.loc.start.column + 1) @@ -57,7 +57,7 @@ export default function addSlicePlaceholderLocation( } if (nodePath.node.loc?.end.line) { - __renderedBylocationProperties.push( + __renderedByLocationProperties.push( t.objectProperty( t.identifier(`endLineNumber`), t.numericLiteral(nodePath.node.loc.end.line) @@ -65,7 +65,7 @@ export default function addSlicePlaceholderLocation( ) if (nodePath.node.loc?.end.column) { - __renderedBylocationProperties.push( + __renderedByLocationProperties.push( t.objectProperty( t.identifier(`endColumnNumber`), t.numericLiteral(nodePath.node.loc.end.column + 1) @@ -76,9 +76,9 @@ export default function addSlicePlaceholderLocation( } const newProp = t.jsxAttribute( - t.jsxIdentifier(`__renderedBylocation`), + t.jsxIdentifier(`__renderedByLocation`), t.jsxExpressionContainer( - t.objectExpression(__renderedBylocationProperties) + t.objectExpression(__renderedByLocationProperties) ) )