gatsby 2.32.11 → 2.32.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/redux/actions/public.js +16 -6
- package/dist/redux/actions/public.js.map +1 -1
- package/dist/redux/nodes.js +5 -1
- package/dist/redux/nodes.js.map +1 -1
- package/dist/redux/reducers/status.d.ts +1 -0
- package/dist/redux/reducers/status.js +5 -0
- package/dist/redux/reducers/status.js.map +1 -1
- package/dist/redux/types.d.ts +1 -0
- package/dist/redux/types.js.map +1 -1
- package/gatsby-admin-public/chunk-map.json +1 -1
- package/gatsby-admin-public/index.html +1 -1
- package/gatsby-admin-public/page-data/app-data.json +1 -1
- package/gatsby-admin-public/pages/index.html +1 -1
- package/gatsby-admin-public/plugins/index.html +1 -1
- package/gatsby-admin-public/{polyfill-bb3950ad41cd96a6ba64.js → polyfill-dce23570cfd77335f976.js} +2 -2
- package/gatsby-admin-public/polyfill-dce23570cfd77335f976.js.map +1 -0
- package/gatsby-admin-public/recipe/index.html +1 -1
- package/gatsby-admin-public/recipes/index.html +1 -1
- package/gatsby-admin-public/webpack.stats.json +1 -1
- package/package.json +4 -4
- package/gatsby-admin-public/polyfill-bb3950ad41cd96a6ba64.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.32.12](https://github.com/gatsbyjs/gatsby/compare/gatsby@2.32.11...gatsby@2.32.12) (2021-04-07)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **gatsby:** fix incorrect intersection of filtered results ([#30594](https://github.com/gatsbyjs/gatsby/issues/30594)) ([#30619](https://github.com/gatsbyjs/gatsby/issues/30619)) ([0eac672](https://github.com/gatsbyjs/gatsby/commit/0eac672696997784c4e565447b719d6bf9fca7c6))
|
|
11
|
+
|
|
6
12
|
## [2.32.11](https://github.com/gatsbyjs/gatsby/compare/gatsby@2.32.10...gatsby@2.32.11) (2021-03-09)
|
|
7
13
|
|
|
8
14
|
### Bug Fixes
|
|
@@ -484,11 +484,22 @@ actions.deleteNodes = (nodes, plugin) => {
|
|
|
484
484
|
fullNodes: nodeIds.map(getNode)
|
|
485
485
|
};
|
|
486
486
|
return deleteNodesAction;
|
|
487
|
-
}; // We add a counter to internal
|
|
488
|
-
//
|
|
487
|
+
}; // We add a counter to node.internal for fast comparisons/intersections
|
|
488
|
+
// of various node slices. The counter must increase even across builds.
|
|
489
489
|
|
|
490
490
|
|
|
491
|
-
|
|
491
|
+
function getNextNodeCounter() {
|
|
492
|
+
var _store$getState$statu;
|
|
493
|
+
|
|
494
|
+
const lastNodeCounter = (_store$getState$statu = store.getState().status.LAST_NODE_COUNTER) !== null && _store$getState$statu !== void 0 ? _store$getState$statu : 0;
|
|
495
|
+
|
|
496
|
+
if (lastNodeCounter >= Number.MAX_SAFE_INTEGER) {
|
|
497
|
+
throw new Error(`Could not create more nodes. Maximum node count is reached: ${lastNodeCounter}`);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
return lastNodeCounter + 1;
|
|
501
|
+
}
|
|
502
|
+
|
|
492
503
|
const typeOwners = {}; // memberof notation is added so this code can be referenced instead of the wrapper.
|
|
493
504
|
|
|
494
505
|
/**
|
|
@@ -577,10 +588,8 @@ const createNode = (node, plugin, actionOptions = {}) => {
|
|
|
577
588
|
|
|
578
589
|
if (!node.internal) {
|
|
579
590
|
node.internal = {};
|
|
580
|
-
}
|
|
591
|
+
} // Ensure the new node has a children array.
|
|
581
592
|
|
|
582
|
-
NODE_COUNTER++;
|
|
583
|
-
node.internal.counter = NODE_COUNTER; // Ensure the new node has a children array.
|
|
584
593
|
|
|
585
594
|
if (!node.array && !_.isArray(node.children)) {
|
|
586
595
|
node.children = [];
|
|
@@ -723,6 +732,7 @@ const createNode = (node, plugin, actionOptions = {}) => {
|
|
|
723
732
|
deleteActions = findChildren(oldNode.children).map(getNode).map(createDeleteAction);
|
|
724
733
|
}
|
|
725
734
|
|
|
735
|
+
node.internal.counter = getNextNodeCounter();
|
|
726
736
|
updateNodeAction = { ...actionOptions,
|
|
727
737
|
type: `CREATE_NODE`,
|
|
728
738
|
plugin,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/redux/actions/public.js"],"names":["Joi","require","chalk","_","stripIndent","report","platform","path","trueCasePathSync","url","slash","hasNodeChanged","getNode","sanitizeNode","store","validatePageComponent","generateComponentChunkName","getCommonDir","truncatePath","tooLongSegmentsInPath","apiRunnerNode","trackCli","getNonGatsbyCodeFrame","shadowCreatePagePath","memoize","enqueueJob","createInternalJob","removeInProgressJob","getInProcessJobPromise","actions","isWindows","ensureWindowsDriveIsUppercase","filePath","segments","split","filter","s","length","shift","toUpperCase","join","findChildren","initialChildren","children","queue","traversedNodes","Set","currentChild","pop","has","id","add","newChildren","isArray","push","deletePage","page","type","payload","pascalCase","flow","camelCase","upperFirst","hasWarnedForPageComponentInvalidContext","hasWarnedForPageComponentInvalidCasing","hasErroredBecauseOfNodeValidation","pageComponentCache","reservedFields","createPage","plugin","actionOptions","name","message","process","env","NODE_ENV","panic","context","pluginName","pageObject","invalidFields","field","error","map","f","JSON","stringify","some","component","warn","pageComponentPath","panicOnBuild","getState","program","directory","originalPageComponent","trueComponentPath","e","commonDir","relativePath","win32","relative","markers","letter","index","internalComponentName","invalidPathSegments","truncatedPath","internalPage","matchPath","componentChunkName","isCreatedByStatefulCreatePages","traceId","updatedAt","Date","now","oldPage","pages","get","contextModified","isEqual","alternateSlashPath","endsWith","slice","bold","yellow","deleteNode","options","args","msg","node","typeOwners","internal","Error","createDeleteAction","deleteAction","deleteDescendantsActions","deleteNodes","nodes","descendantNodes","flatten","n","nodeIds","deleteNodesAction","fullNodes","NODE_COUNTER","createNode","isObject","console","log","red","counter","array","parent","owner","trackParams","version","debounce","result","validate","nodeSchema","errorObj","validationErrorMessage","possiblyCodeFrame","codeFrame","fileName","location","start","line","column","fields","oldNode","parentSpan","setTag","deleteActions","updateNodeAction","contentDigest","dispatch","createNodeAction","Array","find","action","undefined","traceTags","nodeId","nodeType","touchNode","createNodeField","value","fieldName","fieldValue","fieldOwners","schemaFieldName","includes","fieldOwner","addedField","createParentChildLink","child","setWebpackConfig","config","replaceWebpackConfig","setBabelOptions","exit","setBabelPlugin","setBabelPreset","createJob","job","createJobV2","currentState","internalJob","jobContentDigest","jobsV2","complete","Promise","resolve","inProgressJobPromise","enqueuedJobPromise","then","setJob","endJob","setPluginStatus","status","maybeAddPathPrefix","pathPrefix","parsed","parse","isRelativeProtocol","startsWith","protocol","createRedirect","fromPath","isPermanent","redirectInBrowser","toPath","ignoreCase","rest","prefixPaths","createPageDependency","connection","setPageData","pageData","removePageData","createServerVisitedPage","chunkName","visitedPages","module","exports"],"mappings":";;AAeA;;AAdA,MAAMA,GAAG,GAAGC,OAAO,CAAE,WAAF,CAAnB;;AACA,MAAMC,KAAK,GAAGD,OAAO,CAAE,OAAF,CAArB;;AACA,MAAME,CAAC,GAAGF,OAAO,CAAE,QAAF,CAAjB;;AACA,MAAM;AAAEG,EAAAA;AAAF,IAAkBH,OAAO,CAAE,aAAF,CAA/B;;AACA,MAAMI,MAAM,GAAGJ,OAAO,CAAE,yBAAF,CAAtB;;AACA,MAAM;AAAEK,EAAAA;AAAF,IAAeL,OAAO,CAAE,IAAF,CAA5B;;AACA,MAAMM,IAAI,GAAGN,OAAO,CAAE,MAAF,CAApB;;AACA,MAAM;AAAEO,EAAAA;AAAF,IAAuBP,OAAO,CAAE,gBAAF,CAApC;;AACA,MAAMQ,GAAG,GAAGR,OAAO,CAAE,KAAF,CAAnB;;AACA,MAAM;AAAES,EAAAA;AAAF,IAAYT,OAAO,CAAE,mBAAF,CAAzB;;AACA,MAAM;AAAEU,EAAAA,cAAF;AAAkBC,EAAAA;AAAlB,IAA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AACA;AACA;AACA;AACA;AACA;;;AACAjN,OAAO,CAACkN,WAAR,GAAuBC,QAAD,IAAwB;AAC5C,SAAO;AACLvL,IAAAA,IAAI,EAAG,eADF;AAELC,IAAAA,OAAO,EAAEsL;AAFJ,GAAP;AAID,CALD;AAOA;AACA;AACA;AACA;AACA;AACA;;;AACAnN,OAAO,CAACoN,cAAR,GAA0B/L,EAAD,IAAwB;AAC/C,SAAO;AACLO,IAAAA,IAAI,EAAG,kBADF;AAELC,IAAAA,OAAO,EAAER;AAFJ,GAAP;AAID,CALD;AAOA;AACA;AACA;AACA;AACA;AACA;;;AACArB,OAAO,CAACqN,uBAAR,GAAmCC,SAAD,IAAuB;AAAA;;AACvD,+BAAIrO,KAAK,CAAC8E,QAAN,GAAiBwJ,YAAjB,CAA8B9H,GAA9B,CAAmC,QAAnC,CAAJ,0DAAI,sBAA6CrE,GAA7C,CAAiDkM,SAAjD,CAAJ,EAAiE;AAC/D;AACA;AACA,WAAO,EAAP;AACD;;AAED,SAAO;AACL1L,IAAAA,IAAI,EAAG,4BADF;AAELC,IAAAA,OAAO,EAAE;AAAEoD,MAAAA,kBAAkB,EAAEqI;AAAtB;AAFJ,GAAP;AAID,CAXD;;AAaAE,MAAM,CAACC,OAAP,GAAiB;AAAEzN,EAAAA;AAAF,CAAjB","sourcesContent":["// @flow\nconst Joi = require(`@hapi/joi`)\nconst chalk = require(`chalk`)\nconst _ = require(`lodash`)\nconst { stripIndent } = require(`common-tags`)\nconst report = require(`gatsby-cli/lib/reporter`)\nconst { platform } = require(`os`)\nconst path = require(`path`)\nconst { trueCasePathSync } = require(`true-case-path`)\nconst url = require(`url`)\nconst { slash } = require(`gatsby-core-utils`)\nconst { hasNodeChanged, getNode } = require(`../../redux/nodes`)\nconst sanitizeNode = require(`../../db/sanitize-node`)\nconst { store } = require(`..`)\nconst { validatePageComponent } = require(`../../utils/validate-page-component`)\nimport { nodeSchema } from \"../../joi-schemas/joi\"\nconst { generateComponentChunkName } = require(`../../utils/js-chunk-names`)\nconst {\n getCommonDir,\n truncatePath,\n tooLongSegmentsInPath,\n} = require(`../../utils/path`)\nconst apiRunnerNode = require(`../../utils/api-runner-node`)\nconst { trackCli } = require(`gatsby-telemetry`)\nconst { getNonGatsbyCodeFrame } = require(`../../utils/stack-trace-utils`)\n\n/**\n * Memoize function used to pick shadowed page components to avoid expensive I/O.\n * Ideally, we should invalidate memoized values if there are any FS operations\n * on files that are in shadowing chain, but webpack currently doesn't handle\n * shadowing changes during develop session, so no invalidation is not a deal breaker.\n */\nconst shadowCreatePagePath = _.memoize(\n require(`../../internal-plugins/webpack-theme-component-shadowing/create-page`)\n)\nconst {\n enqueueJob,\n createInternalJob,\n removeInProgressJob,\n getInProcessJobPromise,\n} = require(`../../utils/jobs-manager`)\n\nconst actions = {}\nconst isWindows = platform() === `win32`\n\nconst ensureWindowsDriveIsUppercase = filePath => {\n const segments = filePath.split(`:`).filter(s => s !== ``)\n return segments.length > 0\n ? segments.shift().toUpperCase() + `:` + segments.join(`:`)\n : filePath\n}\n\nconst findChildren = initialChildren => {\n const children = [...initialChildren]\n const queue = [...initialChildren]\n const traversedNodes = new Set()\n\n while (queue.length > 0) {\n const currentChild = getNode(queue.pop())\n if (!currentChild || traversedNodes.has(currentChild.id)) {\n continue\n }\n traversedNodes.add(currentChild.id)\n const newChildren = currentChild.children\n if (_.isArray(newChildren) && newChildren.length > 0) {\n children.push(...newChildren)\n queue.push(...newChildren)\n }\n }\n return children\n}\n\nimport type { Plugin } from \"./types\"\n\ntype Job = {\n id: string,\n}\n\ntype JobV2 = {\n name: string,\n inputPaths: string[],\n outputDir: string,\n args: Object,\n}\n\ntype PageInput = {\n path: string,\n component: string,\n context?: Object,\n}\n\ntype Page = {\n path: string,\n matchPath: ?string,\n component: string,\n context: Object,\n internalComponentName: string,\n componentChunkName: string,\n updatedAt: number,\n}\n\ntype ActionOptions = {\n traceId: ?string,\n parentSpan: ?Object,\n followsSpan: ?Object,\n}\n\ntype PageData = {\n id: string,\n resultHash: string,\n}\n\ntype PageDataRemove = {\n id: string,\n}\n\n/**\n * Delete a page\n * @param {Object} page a page object\n * @param {string} page.path The path of the page\n * @param {string} page.component The absolute path to the page component\n * @example\n * deletePage(page)\n */\nactions.deletePage = (page: PageInput) => {\n return {\n type: `DELETE_PAGE`,\n payload: page,\n }\n}\n\nconst pascalCase = _.flow(_.camelCase, _.upperFirst)\nconst hasWarnedForPageComponentInvalidContext = new Set()\nconst hasWarnedForPageComponentInvalidCasing = new Set()\nconst hasErroredBecauseOfNodeValidation = new Set()\nconst pageComponentCache = {}\nconst reservedFields = [\n `path`,\n `matchPath`,\n `component`,\n `componentChunkName`,\n `pluginCreator___NODE`,\n `pluginCreatorId`,\n]\n/**\n * Create a page. See [the guide on creating and modifying pages](/docs/creating-and-modifying-pages/)\n * for detailed documentation about creating pages.\n * @param {Object} page a page object\n * @param {string} page.path Any valid URL. Must start with a forward slash\n * @param {string} page.matchPath Path that Reach Router uses to match the page on the client side.\n * Also see docs on [matchPath](/docs/gatsby-internals-terminology/#matchpath)\n * @param {string} page.component The absolute path to the component for this page\n * @param {Object} page.context Context data for this page. Passed as props\n * to the component `this.props.pageContext` as well as to the graphql query\n * as graphql arguments.\n * @example\n * createPage({\n * path: `/my-sweet-new-page/`,\n * component: path.resolve(`./src/templates/my-sweet-new-page.js`),\n * // The context is passed as props to the component as well\n * // as into the component's GraphQL query.\n * context: {\n * id: `123456`,\n * },\n * })\n */\nactions.createPage = (\n page: PageInput,\n plugin?: Plugin,\n actionOptions?: ActionOptions\n) => {\n let name = `The plugin \"${plugin.name}\"`\n if (plugin.name === `default-site-plugin`) {\n name = `Your site's \"gatsby-node.js\"`\n }\n if (!page.path) {\n const message = `${name} must set the page path when creating a page`\n // Don't log out when testing\n if (process.env.NODE_ENV !== `test`) {\n report.panic({\n id: `11323`,\n context: {\n pluginName: name,\n pageObject: page,\n message,\n },\n })\n } else {\n return message\n }\n }\n\n // Validate that the context object doesn't overlap with any core page fields\n // as this will cause trouble when running graphql queries.\n if (page.context && typeof page.context === `object`) {\n const invalidFields = reservedFields.filter(field => field in page.context)\n\n if (invalidFields.length > 0) {\n const error = `${\n invalidFields.length === 1\n ? `${name} used a reserved field name in the context object when creating a page:`\n : `${name} used reserved field names in the context object when creating a page:`\n }\n\n${invalidFields.map(f => ` * \"${f}\"`).join(`\\n`)}\n\n${JSON.stringify(page, null, 4)}\n\nData in \"context\" is passed to GraphQL as potential arguments when running the\npage query.\n\nWhen arguments for GraphQL are constructed, the context object is combined with\nthe page object so *both* page object and context data are available as\narguments. So you don't need to add the page \"path\" to the context as it's\nalready available in GraphQL. If a context field duplicates a field already\nused by the page object, this can break functionality within Gatsby so must be\navoided.\n\nPlease choose another name for the conflicting fields.\n\nThe following fields are used by the page object and should be avoided.\n\n${reservedFields.map(f => ` * \"${f}\"`).join(`\\n`)}\n\n `\n if (process.env.NODE_ENV === `test`) {\n return error\n // Only error if the context version is different than the page\n // version. People in v1 often thought that they needed to also pass\n // the path to context for it to be available in GraphQL\n } else if (invalidFields.some(f => page.context[f] !== page[f])) {\n report.panic({\n id: `11324`,\n context: {\n message: error,\n },\n })\n } else {\n if (!hasWarnedForPageComponentInvalidContext.has(page.component)) {\n report.warn(error)\n hasWarnedForPageComponentInvalidContext.add(page.component)\n }\n }\n }\n }\n\n // Check if a component is set.\n if (!page.component) {\n if (process.env.NODE_ENV !== `test`) {\n report.panic({\n id: `11322`,\n context: {\n pluginName: name,\n pageObject: page,\n },\n })\n } else {\n // For test\n return `A component must be set when creating a page`\n }\n }\n\n const pageComponentPath = shadowCreatePagePath(page.component)\n if (pageComponentPath) {\n page.component = pageComponentPath\n }\n\n const { error, message, panicOnBuild } = validatePageComponent(\n page,\n store.getState().program.directory,\n name\n )\n\n if (error) {\n if (process.env.NODE_ENV !== `test`) {\n if (panicOnBuild) {\n report.panicOnBuild(error)\n } else {\n report.panic(error)\n }\n }\n return message\n }\n\n // check if we've processed this component path\n // before, before running the expensive \"trueCasePath\"\n // operation\n //\n // Skip during testing as the paths don't exist on disk.\n if (process.env.NODE_ENV !== `test`) {\n if (pageComponentCache[page.component]) {\n page.component = pageComponentCache[page.component]\n } else {\n const originalPageComponent = page.component\n\n // normalize component path\n page.component = slash(page.component)\n // check if path uses correct casing - incorrect casing will\n // cause issues in query compiler and inconsistencies when\n // developing on Mac or Windows and trying to deploy from\n // linux CI/CD pipeline\n let trueComponentPath\n try {\n // most systems\n trueComponentPath = slash(trueCasePathSync(page.component))\n } catch (e) {\n // systems where user doesn't have access to /\n const commonDir = getCommonDir(\n store.getState().program.directory,\n page.component\n )\n\n // using `path.win32` to force case insensitive relative path\n const relativePath = slash(\n path.win32.relative(commonDir, page.component)\n )\n\n trueComponentPath = slash(trueCasePathSync(relativePath, commonDir))\n }\n\n if (isWindows) {\n page.component = ensureWindowsDriveIsUppercase(page.component)\n }\n\n if (trueComponentPath !== page.component) {\n if (!hasWarnedForPageComponentInvalidCasing.has(page.component)) {\n const markers = page.component\n .split(``)\n .map((letter, index) => {\n if (letter !== trueComponentPath[index]) {\n return `^`\n }\n return ` `\n })\n .join(``)\n\n report.warn(\n stripIndent`\n ${name} created a page with a component path that doesn't match the casing of the actual file. This may work locally, but will break on systems which are case-sensitive, e.g. most CI/CD pipelines.\n\n page.component: \"${page.component}\"\n path in filesystem: \"${trueComponentPath}\"\n ${markers}\n `\n )\n hasWarnedForPageComponentInvalidCasing.add(page.component)\n }\n\n page.component = trueComponentPath\n }\n\n pageComponentCache[originalPageComponent] = page.component\n }\n }\n\n let internalComponentName\n if (page.path === `/`) {\n internalComponentName = `ComponentIndex`\n } else {\n internalComponentName = `Component${pascalCase(page.path)}`\n }\n\n const invalidPathSegments = tooLongSegmentsInPath(page.path)\n\n if (invalidPathSegments.length > 0) {\n const truncatedPath = truncatePath(page.path)\n report.warn(\n report.stripIndent(`\n The path to the following page is longer than the supported limit on most\n operating systems and will cause an ENAMETOOLONG error. The path has been\n truncated to prevent this.\n\n Original Path: ${page.path}\n\n Truncated Path: ${truncatedPath}\n `)\n )\n page.path = truncatedPath\n }\n\n const internalPage: Page = {\n internalComponentName,\n path: page.path,\n matchPath: page.matchPath,\n component: page.component,\n componentChunkName: generateComponentChunkName(page.component),\n isCreatedByStatefulCreatePages:\n actionOptions?.traceId === `initial-createPagesStatefully`,\n // Ensure the page has a context object\n context: page.context || {},\n updatedAt: Date.now(),\n }\n\n // If the path doesn't have an initial forward slash, add it.\n if (internalPage.path[0] !== `/`) {\n internalPage.path = `/${internalPage.path}`\n }\n\n const oldPage: Page = store.getState().pages.get(internalPage.path)\n const contextModified =\n !!oldPage && !_.isEqual(oldPage.context, internalPage.context)\n\n const alternateSlashPath = page.path.endsWith(`/`)\n ? page.path.slice(0, -1)\n : page.path + `/`\n\n if (store.getState().pages.has(alternateSlashPath)) {\n report.warn(\n chalk.bold.yellow(`Non-deterministic routing danger: `) +\n `Attempting to create page: \"${page.path}\", but page \"${alternateSlashPath}\" already exists\\n` +\n chalk.bold.yellow(\n `This could lead to non-deterministic routing behavior`\n )\n )\n }\n\n return {\n ...actionOptions,\n type: `CREATE_PAGE`,\n contextModified,\n plugin,\n payload: internalPage,\n }\n}\n\n/**\n * Delete a node\n * @param {object} $0\n * @param {object} $0.node the node object\n * @example\n * deleteNode({node: node})\n */\nactions.deleteNode = (options: any, plugin: Plugin, args: any) => {\n let id\n\n // Check if using old method signature. Warn about incorrect usage but get\n // node from nodeID anyway.\n if (typeof options === `string`) {\n let msg =\n `Calling \"deleteNode\" with a nodeId is deprecated. Please pass an ` +\n `object containing a full node instead: deleteNode({ node }).`\n if (args && args.name) {\n // `plugin` used to be the third argument\n plugin = args\n msg = msg + ` \"deleteNode\" was called by ${plugin.name}`\n }\n report.warn(msg)\n\n id = options\n } else {\n id = options && options.node && options.node.id\n }\n\n // Always get node from the store, as the node we get as an arg\n // might already have been deleted.\n const node = getNode(id)\n if (plugin) {\n const pluginName = plugin.name\n\n if (node && typeOwners[node.internal.type] !== pluginName)\n throw new Error(stripIndent`\n The plugin \"${pluginName}\" deleted a node of a type owned by another plugin.\n\n The node type \"${node.internal.type}\" is owned by \"${\n typeOwners[node.internal.type]\n }\".\n\n The node object passed to \"deleteNode\":\n\n ${JSON.stringify(node, null, 4)}\n\n The plugin deleting the node:\n\n ${JSON.stringify(plugin, null, 4)}\n `)\n }\n\n const createDeleteAction = node => {\n return {\n type: `DELETE_NODE`,\n plugin,\n payload: node,\n }\n }\n\n const deleteAction = createDeleteAction(node)\n\n // It's possible the file node was never created as sometimes tools will\n // write and then immediately delete temporary files to the file system.\n const deleteDescendantsActions =\n node && findChildren(node.children).map(getNode).map(createDeleteAction)\n\n if (deleteDescendantsActions && deleteDescendantsActions.length) {\n return [...deleteDescendantsActions, deleteAction]\n } else {\n return deleteAction\n }\n}\n\n// Marked private here because it was suppressed in documentation pages.\n/**\n * Batch delete nodes\n * @private\n * @param {Array} nodes an array of node ids\n * @example\n * deleteNodes([`node1`, `node2`])\n */\nactions.deleteNodes = (nodes: any[], plugin: Plugin) => {\n let msg =\n `The \"deleteNodes\" action is now deprecated and will be removed in ` +\n `Gatsby v3. Please use \"deleteNode\" instead.`\n if (plugin && plugin.name) {\n msg = msg + ` \"deleteNodes\" was called by ${plugin.name}`\n }\n report.warn(msg)\n\n // Also delete any nodes transformed from these.\n const descendantNodes = _.flatten(\n nodes.map(n => findChildren(getNode(n).children))\n )\n\n const nodeIds = [...nodes, ...descendantNodes]\n\n const deleteNodesAction = {\n type: `DELETE_NODES`,\n plugin,\n // Payload contains node IDs but inference-metadata requires full node instances\n payload: nodeIds,\n fullNodes: nodeIds.map(getNode),\n }\n return deleteNodesAction\n}\n\n// We add a counter to internal to make sure we maintain insertion order for\n// backends that don't do that out of the box\nlet NODE_COUNTER = 0\n\nconst typeOwners = {}\n\n// memberof notation is added so this code can be referenced instead of the wrapper.\n/**\n * Create a new node.\n * @memberof actions\n * @param {Object} node a node object\n * @param {string} node.id The node's ID. Must be globally unique.\n * @param {string} node.parent The ID of the parent's node. If the node is\n * derived from another node, set that node as the parent. Otherwise it can\n * just be `null`.\n * @param {Array} node.children An array of children node IDs. If you're\n * creating the children nodes while creating the parent node, add the\n * children node IDs here directly. If you're adding a child node to a\n * parent node created by a plugin, you can't mutate this value directly\n * to add your node id, instead use the action creator `createParentChildLink`.\n * @param {Object} node.internal node fields that aren't generally\n * interesting to consumers of node data but are very useful for plugin writers\n * and Gatsby core. Only fields described below are allowed in `internal` object.\n * Using any type of custom fields will result in validation errors.\n * @param {string} node.internal.mediaType An optional field to indicate to\n * transformer plugins that your node has raw content they can transform.\n * Use either an official media type (we use mime-db as our source\n * (https://www.npmjs.com/package/mime-db) or a made-up one if your data\n * doesn't fit in any existing bucket. Transformer plugins use node media types\n * for deciding if they should transform a node into a new one. E.g.\n * markdown transformers look for media types of\n * `text/markdown`.\n * @param {string} node.internal.type An arbitrary globally unique type\n * chosen by the plugin creating the node. Should be descriptive of the\n * node as the type is used in forming GraphQL types so users will query\n * for nodes based on the type chosen here. Nodes of a given type can\n * only be created by one plugin.\n * @param {string} node.internal.content An optional field. This is rarely\n * used. It is used when a source plugin sources data it doesn't know how\n * to transform e.g. a markdown string pulled from an API. The source plugin\n * can defer the transformation to a specialized transformer plugin like\n * gatsby-transformer-remark. This `content` field holds the raw content\n * (so for the markdown case, the markdown string).\n *\n * Data that's already structured should be added to the top-level of the node\n * object and _not_ added here. You should not `JSON.stringify` your node's\n * data here.\n *\n * If the content is very large and can be lazy-loaded, e.g. a file on disk,\n * you can define a `loadNodeContent` function for this node and the node\n * content will be lazy loaded when it's needed.\n * @param {string} node.internal.contentDigest the digest for the content\n * of this node. Helps Gatsby avoid doing extra work on data that hasn't\n * changed.\n * @param {string} node.internal.description An optional field. Human\n * readable description of what this node represent / its source. It will\n * be displayed when type conflicts are found, making it easier to find\n * and correct type conflicts.\n * @returns {Promise} The returned Promise resolves when all cascading\n * `onCreateNode` API calls triggered by `createNode` have finished.\n * @example\n * createNode({\n * // Data for the node.\n * field1: `a string`,\n * field2: 10,\n * field3: true,\n * ...arbitraryOtherData,\n *\n * // Required fields.\n * id: `a-node-id`,\n * parent: `the-id-of-the-parent-node`, // or null if it's a source node without a parent\n * children: [],\n * internal: {\n * type: `CoolServiceMarkdownField`,\n * contentDigest: crypto\n * .createHash(`md5`)\n * .update(JSON.stringify(fieldData))\n * .digest(`hex`),\n * mediaType: `text/markdown`, // optional\n * content: JSON.stringify(fieldData), // optional\n * description: `Cool Service: \"Title of entry\"`, // optional\n * }\n * })\n */\nconst createNode = (\n node: any,\n plugin?: Plugin,\n actionOptions?: ActionOptions = {}\n) => {\n if (!_.isObject(node)) {\n return console.log(\n chalk.bold.red(\n `The node passed to the \"createNode\" action creator must be an object`\n )\n )\n }\n\n // Ensure the new node has an internals object.\n if (!node.internal) {\n node.internal = {}\n }\n\n NODE_COUNTER++\n node.internal.counter = NODE_COUNTER\n\n // Ensure the new node has a children array.\n if (!node.array && !_.isArray(node.children)) {\n node.children = []\n }\n\n // Ensure the new node has a parent field\n if (!node.parent) {\n node.parent = null\n }\n\n // Tell user not to set the owner name themself.\n if (node.internal.owner) {\n report.error(JSON.stringify(node, null, 4))\n report.panic(\n chalk.bold.red(\n `The node internal.owner field is set automatically by Gatsby and not by plugins`\n )\n )\n }\n\n const trackParams = {}\n // Add the plugin name to the internal object.\n if (plugin) {\n node.internal.owner = plugin.name\n trackParams[`pluginName`] = `${plugin.name}@${plugin.version}`\n }\n\n trackCli(`CREATE_NODE`, trackParams, { debounce: true })\n\n const result = Joi.validate(node, nodeSchema)\n if (result.error) {\n if (!hasErroredBecauseOfNodeValidation.has(result.error.message)) {\n const errorObj = {\n id: `11467`,\n context: {\n validationErrorMessage: result.error.message,\n node,\n },\n }\n\n const possiblyCodeFrame = getNonGatsbyCodeFrame()\n if (possiblyCodeFrame) {\n errorObj.context.codeFrame = possiblyCodeFrame.codeFrame\n errorObj.filePath = possiblyCodeFrame.fileName\n errorObj.location = {\n start: {\n line: possiblyCodeFrame.line,\n column: possiblyCodeFrame.column,\n },\n }\n }\n\n report.error(errorObj)\n hasErroredBecauseOfNodeValidation.add(result.error.message)\n }\n\n return { type: `VALIDATION_ERROR`, error: true }\n }\n\n // Ensure node isn't directly setting fields.\n if (node.fields) {\n throw new Error(\n stripIndent`\n Plugins creating nodes can not set data on the reserved field \"fields\"\n as this is reserved for plugins which wish to extend your nodes.\n\n If your plugin didn't add \"fields\" you're probably seeing this\n error because you're reusing an old node object.\n\n Node:\n\n ${JSON.stringify(node, null, 4)}\n\n Plugin that created the node:\n\n ${JSON.stringify(plugin, null, 4)}\n `\n )\n }\n\n node = sanitizeNode(node)\n\n const oldNode = getNode(node.id)\n\n // Ensure the plugin isn't creating a node type owned by another\n // plugin. Type \"ownership\" is first come first served.\n if (plugin) {\n const pluginName = plugin.name\n\n if (!typeOwners[node.internal.type])\n typeOwners[node.internal.type] = pluginName\n else if (typeOwners[node.internal.type] !== pluginName)\n throw new Error(stripIndent`\n The plugin \"${pluginName}\" created a node of a type owned by another plugin.\n\n The node type \"${node.internal.type}\" is owned by \"${\n typeOwners[node.internal.type]\n }\".\n\n If you copy and pasted code from elsewhere, you'll need to pick a new type name\n for your new node(s).\n\n The node object passed to \"createNode\":\n\n ${JSON.stringify(node, null, 4)}\n\n The plugin creating the node:\n\n ${JSON.stringify(plugin, null, 4)}\n `)\n\n // If the node has been created in the past, check that\n // the current plugin is the same as the previous.\n if (oldNode && oldNode.internal.owner !== pluginName) {\n throw new Error(\n stripIndent`\n Nodes can only be updated by their owner. Node \"${node.id}\" is\n owned by \"${oldNode.internal.owner}\" and another plugin \"${pluginName}\"\n tried to update it.\n\n `\n )\n }\n }\n\n if (actionOptions.parentSpan) {\n actionOptions.parentSpan.setTag(`nodeId`, node.id)\n actionOptions.parentSpan.setTag(`nodeType`, node.id)\n }\n\n let deleteActions\n let updateNodeAction\n // Check if the node has already been processed.\n if (oldNode && !hasNodeChanged(node.id, node.internal.contentDigest)) {\n updateNodeAction = {\n ...actionOptions,\n plugin,\n type: `TOUCH_NODE`,\n payload: node.id,\n }\n } else {\n // Remove any previously created descendant nodes as they're all due\n // to be recreated.\n if (oldNode) {\n const createDeleteAction = node => {\n return {\n ...actionOptions,\n type: `DELETE_NODE`,\n plugin,\n payload: node,\n }\n }\n deleteActions = findChildren(oldNode.children)\n .map(getNode)\n .map(createDeleteAction)\n }\n\n updateNodeAction = {\n ...actionOptions,\n type: `CREATE_NODE`,\n plugin,\n oldNode,\n payload: node,\n }\n }\n\n if (deleteActions && deleteActions.length) {\n return [...deleteActions, updateNodeAction]\n } else {\n return updateNodeAction\n }\n}\n\nactions.createNode = (...args) => dispatch => {\n const actions = createNode(...args)\n\n dispatch(actions)\n const createNodeAction = (Array.isArray(actions) ? actions : [actions]).find(\n action => action.type === `CREATE_NODE`\n )\n\n if (!createNodeAction) {\n return undefined\n }\n\n const { payload: node, traceId, parentSpan } = createNodeAction\n return apiRunnerNode(`onCreateNode`, {\n node,\n traceId,\n parentSpan,\n traceTags: { nodeId: node.id, nodeType: node.internal.type },\n })\n}\n\n/**\n * \"Touch\" a node. Tells Gatsby a node still exists and shouldn't\n * be garbage collected. Primarily useful for source plugins fetching\n * nodes from a remote system that can return only nodes that have\n * updated. The source plugin then touches all the nodes that haven't\n * updated but still exist so Gatsby knows to keep them.\n * @param {Object} $0\n * @param {string} $0.nodeId The id of a node\n * @example\n * touchNode({ nodeId: `a-node-id` })\n */\nactions.touchNode = (options: any, plugin?: Plugin) => {\n let nodeId = _.get(options, `nodeId`)\n\n // Check if using old method signature. Warn about incorrect usage\n if (typeof options === `string`) {\n console.warn(\n `Calling \"touchNode\" with a nodeId is deprecated. Please pass an object containing a nodeId instead: touchNode({ nodeId: 'a-node-id' })`\n )\n\n if (plugin && plugin.name) {\n console.log(`\"touchNode\" was called by ${plugin.name}`)\n }\n\n nodeId = options\n }\n\n const node = getNode(nodeId)\n if (node && !typeOwners[node.internal.type]) {\n typeOwners[node.internal.type] = node.internal.owner\n }\n\n return {\n type: `TOUCH_NODE`,\n plugin,\n payload: nodeId,\n }\n}\n\ntype CreateNodeInput = {\n node: Object,\n fieldName?: string,\n fieldValue?: string,\n name?: string,\n value: any,\n}\n/**\n * Extend another node. The new node field is placed under the `fields`\n * key on the extended node object.\n *\n * Once a plugin has claimed a field name the field name can't be used by\n * other plugins. Also since nodes are immutable, you can't mutate the node\n * directly. So to extend another node, use this.\n * @param {Object} $0\n * @param {Object} $0.node the target node object\n * @param {string} $0.fieldName [deprecated] the name for the field\n * @param {string} $0.fieldValue [deprecated] the value for the field\n * @param {string} $0.name the name for the field\n * @param {any} $0.value the value for the field\n * @example\n * createNodeField({\n * node,\n * name: `happiness`,\n * value: `is sweet graphql queries`\n * })\n *\n * // The field value is now accessible at node.fields.happiness\n */\nactions.createNodeField = (\n { node, name, value, fieldName, fieldValue }: CreateNodeInput,\n plugin: Plugin,\n actionOptions?: ActionOptions\n) => {\n if (fieldName) {\n console.warn(\n `Calling \"createNodeField\" with \"fieldName\" is deprecated. Use \"name\" instead`\n )\n if (!name) {\n name = fieldName\n }\n }\n if (fieldValue) {\n console.warn(\n `Calling \"createNodeField\" with \"fieldValue\" is deprecated. Use \"value\" instead`\n )\n if (!value) {\n value = fieldValue\n }\n }\n // Ensure required fields are set.\n if (!node.internal.fieldOwners) {\n node.internal.fieldOwners = {}\n }\n if (!node.fields) {\n node.fields = {}\n }\n\n // Normalized name of the field that will be used in schema\n const schemaFieldName = _.includes(name, `___NODE`)\n ? name.split(`___`)[0]\n : name\n\n // Check that this field isn't owned by another plugin.\n const fieldOwner = node.internal.fieldOwners[schemaFieldName]\n if (fieldOwner && fieldOwner !== plugin.name) {\n throw new Error(\n stripIndent`\n A plugin tried to update a node field that it doesn't own:\n\n Node id: ${node.id}\n Plugin: ${plugin.name}\n name: ${name}\n value: ${value}\n `\n )\n }\n\n // Update node\n node.fields[name] = value\n node.internal.fieldOwners[schemaFieldName] = plugin.name\n node = sanitizeNode(node)\n\n return {\n ...actionOptions,\n type: `ADD_FIELD_TO_NODE`,\n plugin,\n payload: node,\n addedField: name,\n }\n}\n\n/**\n * Creates a link between a parent and child node. This is used when you\n * transform content from a node creating a new child node. You need to add\n * this new child node to the `children` array of the parent but since you\n * don't have direct access to the immutable parent node, use this action\n * instead.\n * @param {Object} $0\n * @param {Object} $0.parent the parent node object\n * @param {Object} $0.child the child node object\n * @example\n * createParentChildLink({ parent: parentNode, child: childNode })\n */\nactions.createParentChildLink = (\n { parent, child }: { parent: any, child: any },\n plugin?: Plugin\n) => {\n if (!parent.children.includes(child.id)) {\n parent.children.push(child.id)\n }\n\n return {\n type: `ADD_CHILD_NODE_TO_PARENT_NODE`,\n plugin,\n payload: parent,\n }\n}\n\n/**\n * Merge additional configuration into the current webpack config. A few\n * configurations options will be ignored if set, in order to try prevent accidental breakage.\n * Specifically, any change to `entry`, `output`, `target`, or `resolveLoaders` will be ignored.\n *\n * For full control over the webpack config, use `replaceWebpackConfig()`.\n *\n * @param {Object} config partial webpack config, to be merged into the current one\n */\nactions.setWebpackConfig = (config: Object, plugin?: ?Plugin = null) => {\n return {\n type: `SET_WEBPACK_CONFIG`,\n plugin,\n payload: config,\n }\n}\n\n/**\n * Completely replace the webpack config for the current stage. This can be\n * dangerous and break Gatsby if certain configuration options are changed.\n *\n * Generally only useful for cases where you need to handle config merging logic\n * yourself, in which case consider using `webpack-merge`.\n *\n * @param {Object} config complete webpack config\n */\nactions.replaceWebpackConfig = (config: Object, plugin?: ?Plugin = null) => {\n return {\n type: `REPLACE_WEBPACK_CONFIG`,\n plugin,\n payload: config,\n }\n}\n\n/**\n * Set top-level Babel options. Plugins and presets will be ignored. Use\n * setBabelPlugin and setBabelPreset for this.\n * @param {Object} config An options object in the shape of a normal babelrc JavaScript object\n * @example\n * setBabelOptions({\n * options: {\n * sourceMaps: `inline`,\n * }\n * })\n */\nactions.setBabelOptions = (options: Object, plugin?: ?Plugin = null) => {\n // Validate\n let name = `The plugin \"${plugin.name}\"`\n if (plugin.name === `default-site-plugin`) {\n name = `Your site's \"gatsby-node.js\"`\n }\n if (!_.isObject(options)) {\n console.log(`${name} must pass an object to \"setBabelOptions\"`)\n console.log(JSON.stringify(options, null, 4))\n if (process.env.NODE_ENV !== `test`) {\n process.exit(1)\n }\n }\n\n if (!_.isObject(options.options)) {\n console.log(`${name} must pass options to \"setBabelOptions\"`)\n console.log(JSON.stringify(options, null, 4))\n if (process.env.NODE_ENV !== `test`) {\n process.exit(1)\n }\n }\n\n return {\n type: `SET_BABEL_OPTIONS`,\n plugin,\n payload: options,\n }\n}\n\n/**\n * Add new plugins or merge options into existing Babel plugins.\n * @param {Object} config A config object describing the Babel plugin to be added.\n * @param {string} config.name The name of the Babel plugin\n * @param {Object} config.options Options to pass to the Babel plugin.\n * @example\n * setBabelPlugin({\n * name: `@emotion/babel-plugin`,\n * options: {\n * sourceMap: true,\n * },\n * })\n */\nactions.setBabelPlugin = (config: Object, plugin?: ?Plugin = null) => {\n // Validate\n let name = `The plugin \"${plugin.name}\"`\n if (plugin.name === `default-site-plugin`) {\n name = `Your site's \"gatsby-node.js\"`\n }\n if (!config.name) {\n console.log(`${name} must set the name of the Babel plugin`)\n console.log(JSON.stringify(config, null, 4))\n if (process.env.NODE_ENV !== `test`) {\n process.exit(1)\n }\n }\n if (!config.options) {\n config.options = {}\n }\n return {\n type: `SET_BABEL_PLUGIN`,\n plugin,\n payload: config,\n }\n}\n\n/**\n * Add new presets or merge options into existing Babel presets.\n * @param {Object} config A config object describing the Babel plugin to be added.\n * @param {string} config.name The name of the Babel preset.\n * @param {Object} config.options Options to pass to the Babel preset.\n * @example\n * setBabelPreset({\n * name: `@babel/preset-react`,\n * options: {\n * pragma: `Glamor.createElement`,\n * },\n * })\n */\nactions.setBabelPreset = (config: Object, plugin?: ?Plugin = null) => {\n // Validate\n let name = `The plugin \"${plugin.name}\"`\n if (plugin.name === `default-site-plugin`) {\n name = `Your site's \"gatsby-node.js\"`\n }\n if (!config.name) {\n console.log(`${name} must set the name of the Babel preset`)\n console.log(JSON.stringify(config, null, 4))\n if (process.env.NODE_ENV !== `test`) {\n process.exit(1)\n }\n }\n if (!config.options) {\n config.options = {}\n }\n return {\n type: `SET_BABEL_PRESET`,\n plugin,\n payload: config,\n }\n}\n\n/**\n * Create a \"job\". This is a long-running process that is generally\n * started as a side-effect to a GraphQL query.\n * [`gatsby-plugin-sharp`](/plugins/gatsby-plugin-sharp/) uses this for\n * example.\n *\n * Gatsby doesn't finish its process until all jobs are ended.\n * @param {Object} job A job object with at least an id set\n * @param {id} job.id The id of the job\n * @example\n * createJob({ id: `write file id: 123`, fileName: `something.jpeg` })\n */\nactions.createJob = (job: Job, plugin?: ?Plugin = null) => {\n return {\n type: `CREATE_JOB`,\n plugin,\n payload: job,\n }\n}\n\n/**\n * Create a \"job\". This is a long-running process that is generally\n * started as a side-effect to a GraphQL query.\n * [`gatsby-plugin-sharp`](/plugins/gatsby-plugin-sharp/) uses this for\n * example.\n *\n * Gatsby doesn't finish its process until all jobs are ended.\n * @param {Object} job A job object with name, inputPaths, outputDir and args\n * @param {string} job.name The name of the job you want to execute\n * @param {string[]} job.inputPaths The inputPaths that are needed to run\n * @param {string} job.outputDir The directory where all files are being saved to\n * @param {Object} job.args The arguments the job needs to execute\n * @returns {Promise<object>} Promise to see if the job is done executing\n * @example\n * createJobV2({ name: `IMAGE_PROCESSING`, inputPaths: [`something.jpeg`], outputDir: `public/static`, args: { width: 100, height: 100 } })\n */\nactions.createJobV2 = (job: JobV2, plugin: Plugin) => (dispatch, getState) => {\n const currentState = getState()\n const internalJob = createInternalJob(job, plugin)\n const jobContentDigest = internalJob.contentDigest\n\n // Check if we already ran this job before, if yes we return the result\n // We have an inflight (in progress) queue inside the jobs manager to make sure\n // we don't waste resources twice during the process\n if (\n currentState.jobsV2 &&\n currentState.jobsV2.complete.has(jobContentDigest)\n ) {\n return Promise.resolve(\n currentState.jobsV2.complete.get(jobContentDigest).result\n )\n }\n\n const inProgressJobPromise = getInProcessJobPromise(jobContentDigest)\n if (inProgressJobPromise) {\n return inProgressJobPromise\n }\n\n dispatch({\n type: `CREATE_JOB_V2`,\n plugin,\n payload: {\n job: internalJob,\n plugin,\n },\n })\n\n const enqueuedJobPromise = enqueueJob(internalJob)\n return enqueuedJobPromise.then(result => {\n // store the result in redux so we have it for the next run\n dispatch({\n type: `END_JOB_V2`,\n plugin,\n payload: {\n jobContentDigest,\n result,\n },\n })\n\n // remove the job from our inProgressJobQueue as it's available in our done state.\n // this is a perf optimisations so we don't grow our memory too much when using gatsby preview\n removeInProgressJob(jobContentDigest)\n\n return result\n })\n}\n\n/**\n * Set (update) a \"job\". Sometimes on really long running jobs you want\n * to update the job as it continues.\n *\n * @param {Object} job A job object with at least an id set\n * @param {id} job.id The id of the job\n * @example\n * setJob({ id: `write file id: 123`, progress: 50 })\n */\nactions.setJob = (job: Job, plugin?: ?Plugin = null) => {\n return {\n type: `SET_JOB`,\n plugin,\n payload: job,\n }\n}\n\n/**\n * End a \"job\".\n *\n * Gatsby doesn't finish its process until all jobs are ended.\n * @param {Object} job A job object with at least an id set\n * @param {id} job.id The id of the job\n * @example\n * endJob({ id: `write file id: 123` })\n */\nactions.endJob = (job: Job, plugin?: ?Plugin = null) => {\n return {\n type: `END_JOB`,\n plugin,\n payload: job,\n }\n}\n\n/**\n * Set plugin status. A plugin can use this to save status keys e.g. the last\n * it fetched something. These values are persisted between runs of Gatsby.\n *\n * @param {Object} status An object with arbitrary values set\n * @example\n * setPluginStatus({ lastFetched: Date.now() })\n */\nactions.setPluginStatus = (\n status: { [key: string]: mixed },\n plugin: Plugin\n) => {\n return {\n type: `SET_PLUGIN_STATUS`,\n plugin,\n payload: status,\n }\n}\n\n// Check if path is absolute and add pathPrefix in front if it's not\nconst maybeAddPathPrefix = (path, pathPrefix) => {\n const parsed = url.parse(path)\n const isRelativeProtocol = path.startsWith(`//`)\n return `${\n parsed.protocol != null || isRelativeProtocol ? `` : pathPrefix\n }${path}`\n}\n\n/**\n * Create a redirect from one page to another. Server redirects don't work out\n * of the box. You must have a plugin setup to integrate the redirect data with\n * your hosting technology e.g. the [Netlify\n * plugin](/plugins/gatsby-plugin-netlify/), or the [Amazon S3\n * plugin](/plugins/gatsby-plugin-s3/). Alternatively, you can use\n * [this plugin](/plugins/gatsby-plugin-meta-redirect/) to generate meta redirect\n * html files for redirecting on any static file host.\n *\n * @param {Object} redirect Redirect data\n * @param {string} redirect.fromPath Any valid URL. Must start with a forward slash\n * @param {boolean} redirect.isPermanent This is a permanent redirect; defaults to temporary\n * @param {string} redirect.toPath URL of a created page (see `createPage`)\n * @param {boolean} redirect.redirectInBrowser Redirects are generally for redirecting legacy URLs to their new configuration. If you can't update your UI for some reason, set `redirectInBrowser` to true and Gatsby will handle redirecting in the client as well.\n * @param {boolean} redirect.force (Plugin-specific) Will trigger the redirect even if the `fromPath` matches a piece of content. This is not part of the Gatsby API, but implemented by (some) plugins that configure hosting provider redirects\n * @param {number} redirect.statusCode (Plugin-specific) Manually set the HTTP status code. This allows you to create a rewrite (status code 200) or custom error page (status code 404). Note that this will override the `isPermanent` option which also sets the status code. This is not part of the Gatsby API, but implemented by (some) plugins that configure hosting provider redirects\n * @param {boolean} redirect.ignoreCase (Plugin-specific) Ignore case when looking for redirects\n * @example\n * // Generally you create redirects while creating pages.\n * exports.createPages = ({ graphql, actions }) => {\n * const { createRedirect } = actions\n * createRedirect({ fromPath: '/old-url', toPath: '/new-url', isPermanent: true })\n * createRedirect({ fromPath: '/url', toPath: '/zn-CH/url', Language: 'zn' })\n * createRedirect({ fromPath: '/not_so-pretty_url', toPath: '/pretty/url', statusCode: 200 })\n * // Create pages here\n * }\n */\nactions.createRedirect = ({\n fromPath,\n isPermanent = false,\n redirectInBrowser = false,\n toPath,\n ignoreCase = false,\n ...rest\n}) => {\n let pathPrefix = ``\n if (store.getState().program.prefixPaths) {\n pathPrefix = store.getState().config.pathPrefix\n }\n\n return {\n type: `CREATE_REDIRECT`,\n payload: {\n fromPath: maybeAddPathPrefix(fromPath, pathPrefix),\n isPermanent,\n ignoreCase,\n redirectInBrowser,\n toPath: maybeAddPathPrefix(toPath, pathPrefix),\n ...rest,\n },\n }\n}\n\n/**\n * Create a dependency between a page and data.\n *\n * @param {Object} $0\n * @param {string} $0.path the path to the page\n * @param {string} $0.nodeId A node ID\n * @param {string} $0.connection A connection type\n * @private\n */\nactions.createPageDependency = (\n {\n path,\n nodeId,\n connection,\n }: { path: string, nodeId: string, connection: string },\n plugin: string = ``\n) => {\n console.warn(\n `Calling \"createPageDependency\" directly from actions in deprecated. Use \"createPageDependency\" from \"gatsby/dist/redux/actions/add-page-dependency\".`\n )\n return {\n type: `CREATE_COMPONENT_DEPENDENCY`,\n plugin,\n payload: {\n path,\n nodeId,\n connection,\n },\n }\n}\n\n/**\n * Set page data in the store, saving the pages content data and context.\n *\n * @param {Object} $0\n * @param {string} $0.id the path to the page.\n * @param {string} $0.resultHash pages content hash.\n */\nactions.setPageData = (pageData: PageData) => {\n return {\n type: `SET_PAGE_DATA`,\n payload: pageData,\n }\n}\n\n/**\n * Remove page data from the store.\n *\n * @param {Object} $0\n * @param {string} $0.id the path to the page.\n */\nactions.removePageData = (id: PageDataRemove) => {\n return {\n type: `REMOVE_PAGE_DATA`,\n payload: id,\n }\n}\n\n/**\n * Record that a page was visited on the server..\n *\n * @param {Object} $0\n * @param {string} $0.id the chunkName for the page component.\n */\nactions.createServerVisitedPage = (chunkName: string) => {\n if (store.getState().visitedPages.get(`server`)?.has(chunkName)) {\n // we already have given chunk tracked, let's not emit `CREATE_SERVER_VISITED_PAGE`\n // action to not cause any additional work\n return []\n }\n\n return {\n type: `CREATE_SERVER_VISITED_PAGE`,\n payload: { componentChunkName: chunkName },\n }\n}\n\nmodule.exports = { actions }\n"],"file":"public.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/redux/actions/public.js"],"names":["Joi","require","chalk","_","stripIndent","report","platform","path","trueCasePathSync","url","slash","hasNodeChanged","getNode","sanitizeNode","store","validatePageComponent","generateComponentChunkName","getCommonDir","truncatePath","tooLongSegmentsInPath","apiRunnerNode","trackCli","getNonGatsbyCodeFrame","shadowCreatePagePath","memoize","enqueueJob","createInternalJob","removeInProgressJob","getInProcessJobPromise","actions","isWindows","ensureWindowsDriveIsUppercase","filePath","segments","split","filter","s","length","shift","toUpperCase","join","findChildren","initialChildren","children","queue","traversedNodes","Set","currentChild","pop","has","id","add","newChildren","isArray","push","deletePage","page","type","payload","pascalCase","flow","camelCase","upperFirst","hasWarnedForPageComponentInvalidContext","hasWarnedForPageComponentInvalidCasing","hasErroredBecauseOfNodeValidation","pageComponentCache","reservedFields","createPage","plugin","actionOptions","name","message","process","env","NODE_ENV","panic","context","pluginName","pageObject","invalidFields","field","error","map","f","JSON","stringify","some","component","warn","pageComponentPath","panicOnBuild","getState","program","directory","originalPageComponent","trueComponentPath","e","commonDir","relativePath","win32","relative","markers","letter","index","internalComponentName","invalidPathSegments","truncatedPath","internalPage","matchPath","componentChunkName","isCreatedByStatefulCreatePages","traceId","updatedAt","Date","now","oldPage","pages","get","contextModified","isEqual","alternateSlashPath","endsWith","slice","bold","yellow","deleteNode","options","args","msg","node","typeOwners","internal","Error","createDeleteAction","deleteAction","deleteDescendantsActions","deleteNodes","nodes","descendantNodes","flatten","n","nodeIds","deleteNodesAction","fullNodes","getNextNodeCounter","lastNodeCounter","status","LAST_NODE_COUNTER","Number","MAX_SAFE_INTEGER","createNode","isObject","console","log","red","array","parent","owner","trackParams","version","debounce","result","validate","nodeSchema","errorObj","validationErrorMessage","possiblyCodeFrame","codeFrame","fileName","location","start","line","column","fields","oldNode","parentSpan","setTag","deleteActions","updateNodeAction","contentDigest","counter","dispatch","createNodeAction","Array","find","action","undefined","traceTags","nodeId","nodeType","touchNode","createNodeField","value","fieldName","fieldValue","fieldOwners","schemaFieldName","includes","fieldOwner","addedField","createParentChildLink","child","setWebpackConfig","config","replaceWebpackConfig","setBabelOptions","exit","setBabelPlugin","setBabelPreset","createJob","job","createJobV2","currentState","internalJob","jobContentDigest","jobsV2","complete","Promise","resolve","inProgressJobPromise","enqueuedJobPromise","then","setJob","endJob","setPluginStatus","maybeAddPathPrefix","pathPrefix","parsed","parse","isRelativeProtocol","startsWith","protocol","createRedirect","fromPath","isPermanent","redirectInBrowser","toPath","ignoreCase","rest","prefixPaths","createPageDependency","connection","setPageData","pageData","removePageData","createServerVisitedPage","chunkName","visitedPages","module","exports"],"mappings":";;AAeA;;AAdA,MAAMA,GAAG,GAAGC,OAAO,CAAE,WAAF,CAAnB;;AACA,MAAMC,KAAK,GAAGD,OAAO,CAAE,OAAF,CAArB;;AACA,MAAME,CAAC,GAAGF,OAAO,CAAE,QAAF,CAAjB;;AACA,MAAM;AAAEG,EAAAA;AAAF,IAAkBH,OAAO,CAAE,aAAF,CAA/B;;AACA,MAAMI,MAAM,GAAGJ,OAAO,CAAE,yBAAF,CAAtB;;AACA,MAAM;AAAEK,EAAAA;AAAF,IAAeL,OAAO,CAAE,IAAF,CAA5B;;AACA,MAAMM,IAAI,GAAGN,OAAO,CAAE,MAAF,CAApB;;AACA,MAAM;AAAEO,EAAAA;AAAF,IAAuBP,OAAO,CAAE,gBAAF,CAApC;;AACA,MAAMQ,GAAG,GAAGR,OAAO,CAAE,KAAF,CAAnB;;AACA,MAAM;AAAES,EAAAA;AAAF,IAAYT,OAAO,CAAE,mBAAF,CAAzB;;AACA,MAAM;AAAEU,EAAAA,cAAF;AAAkBC,EAAAA;AAAlB,IAA8BX,OAAO,CAAE,mBAAF,CAA3C;;AACA,MAAMY,YAAY,GAAGZ,OAAO,CAAE,wBAAF,CAA5B;;AACA,MAAM;AAAEa,EAAAA;AAAF,IAAYb,OAAO,CAAE,IAAF,CAAzB;;AACA,MAAM;AAAEc,EAAAA;AAAF,IAA4Bd,OAAO,CAAE,qCAAF,CAAzC;;AAEA,MAAM;AAAEe,EAAAA;AAAF,IAAiCf,OAAO,CAAE,4BAAF,CAA9C;;AACA,MAAM;AACJgB,EAAAA,YADI;AAEJC,EAAAA,YAFI;AAGJC,EAAAA;AAHI,IAIFlB,OAAO,CAAE,kBAAF,CAJX;;AAKA,M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AC8E,QAAN,GAAiBuD,MAAjB,CAAwBC,iBAA3B,yEAAgD,CAArE;;AACA,MAAIF,eAAe,IAAIG,MAAM,CAACC,gBAA9B,EAAgD;AAC9C,UAAM,IAAIjB,KAAJ,CACH,+DAA8Da,eAAgB,EAD3E,CAAN;AAGD;;AACD,SAAOA,eAAe,GAAG,CAAzB;AACD;;AAED,MAAMf,UAAU,GAAG,EAAnB,C,CAEA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMoB,UAAU,GAAG,CACjBrB,IADiB,EAEjB7D,MAFiB,EAGjBC,aAA6B,GAAG,EAHf,KAId;AACH,MAAI,CAACnE,CAAC,CAACqJ,QAAF,CAAWtB,IAAX,CAAL,EAAuB;AACrB,WAAOuB,OAAO,CAACC,GAAR,CACLxJ,KAAK,CAAC0H,IAAN,CAAW+B,GAAX,CACG,sEADH,CADK,CAAP;AAKD,GAPE,CASH;;;AACA,MAAI,CAACzB,IAAI,CAACE,QAAV,EAAoB;AAClBF,IAAAA,IAAI,CAACE,QAAL,GAAgB,EAAhB;AACD,GAZE,CAcH;;;AACA,MAAI,CAACF,IAAI,CAAC0B,KAAN,IAAe,CAACzJ,CAAC,CAACkD,OAAF,CAAU6E,IAAI,CAACvF,QAAf,CAApB,EAA8C;AAC5CuF,IAAAA,IAAI,CAACvF,QAAL,GAAgB,EAAhB;AACD,GAjBE,CAmBH;;;AACA,MAAI,CAACuF,IAAI,CAAC2B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L;AAFJ,GAAP;AAID,CALD;AAOA;AACA;AACA;AACA;AACA;AACA;;;AACAvN,OAAO,CAACwN,cAAR,GAA0BnM,EAAD,IAAwB;AAC/C,SAAO;AACLO,IAAAA,IAAI,EAAG,kBADF;AAELC,IAAAA,OAAO,EAAER;AAFJ,GAAP;AAID,CALD;AAOA;AACA;AACA;AACA;AACA;AACA;;;AACArB,OAAO,CAACyN,uBAAR,GAAmCC,SAAD,IAAuB;AAAA;;AACvD,+BAAIzO,KAAK,CAAC8E,QAAN,GAAiB4J,YAAjB,CAA8BlI,GAA9B,CAAmC,QAAnC,CAAJ,0DAAI,sBAA6CrE,GAA7C,CAAiDsM,SAAjD,CAAJ,EAAiE;AAC/D;AACA;AACA,WAAO,EAAP;AACD;;AAED,SAAO;AACL9L,IAAAA,IAAI,EAAG,4BADF;AAELC,IAAAA,OAAO,EAAE;AAAEoD,MAAAA,kBAAkB,EAAEyI;AAAtB;AAFJ,GAAP;AAID,CAXD;;AAaAE,MAAM,CAACC,OAAP,GAAiB;AAAE7N,EAAAA;AAAF,CAAjB","sourcesContent":["// @flow\nconst Joi = require(`@hapi/joi`)\nconst chalk = require(`chalk`)\nconst _ = require(`lodash`)\nconst { stripIndent } = require(`common-tags`)\nconst report = require(`gatsby-cli/lib/reporter`)\nconst { platform } = require(`os`)\nconst path = require(`path`)\nconst { trueCasePathSync } = require(`true-case-path`)\nconst url = require(`url`)\nconst { slash } = require(`gatsby-core-utils`)\nconst { hasNodeChanged, getNode } = require(`../../redux/nodes`)\nconst sanitizeNode = require(`../../db/sanitize-node`)\nconst { store } = require(`..`)\nconst { validatePageComponent } = require(`../../utils/validate-page-component`)\nimport { nodeSchema } from \"../../joi-schemas/joi\"\nconst { generateComponentChunkName } = require(`../../utils/js-chunk-names`)\nconst {\n getCommonDir,\n truncatePath,\n tooLongSegmentsInPath,\n} = require(`../../utils/path`)\nconst apiRunnerNode = require(`../../utils/api-runner-node`)\nconst { trackCli } = require(`gatsby-telemetry`)\nconst { getNonGatsbyCodeFrame } = require(`../../utils/stack-trace-utils`)\n\n/**\n * Memoize function used to pick shadowed page components to avoid expensive I/O.\n * Ideally, we should invalidate memoized values if there are any FS operations\n * on files that are in shadowing chain, but webpack currently doesn't handle\n * shadowing changes during develop session, so no invalidation is not a deal breaker.\n */\nconst shadowCreatePagePath = _.memoize(\n require(`../../internal-plugins/webpack-theme-component-shadowing/create-page`)\n)\nconst {\n enqueueJob,\n createInternalJob,\n removeInProgressJob,\n getInProcessJobPromise,\n} = require(`../../utils/jobs-manager`)\n\nconst actions = {}\nconst isWindows = platform() === `win32`\n\nconst ensureWindowsDriveIsUppercase = filePath => {\n const segments = filePath.split(`:`).filter(s => s !== ``)\n return segments.length > 0\n ? segments.shift().toUpperCase() + `:` + segments.join(`:`)\n : filePath\n}\n\nconst findChildren = initialChildren => {\n const children = [...initialChildren]\n const queue = [...initialChildren]\n const traversedNodes = new Set()\n\n while (queue.length > 0) {\n const currentChild = getNode(queue.pop())\n if (!currentChild || traversedNodes.has(currentChild.id)) {\n continue\n }\n traversedNodes.add(currentChild.id)\n const newChildren = currentChild.children\n if (_.isArray(newChildren) && newChildren.length > 0) {\n children.push(...newChildren)\n queue.push(...newChildren)\n }\n }\n return children\n}\n\nimport type { Plugin } from \"./types\"\n\ntype Job = {\n id: string,\n}\n\ntype JobV2 = {\n name: string,\n inputPaths: string[],\n outputDir: string,\n args: Object,\n}\n\ntype PageInput = {\n path: string,\n component: string,\n context?: Object,\n}\n\ntype Page = {\n path: string,\n matchPath: ?string,\n component: string,\n context: Object,\n internalComponentName: string,\n componentChunkName: string,\n updatedAt: number,\n}\n\ntype ActionOptions = {\n traceId: ?string,\n parentSpan: ?Object,\n followsSpan: ?Object,\n}\n\ntype PageData = {\n id: string,\n resultHash: string,\n}\n\ntype PageDataRemove = {\n id: string,\n}\n\n/**\n * Delete a page\n * @param {Object} page a page object\n * @param {string} page.path The path of the page\n * @param {string} page.component The absolute path to the page component\n * @example\n * deletePage(page)\n */\nactions.deletePage = (page: PageInput) => {\n return {\n type: `DELETE_PAGE`,\n payload: page,\n }\n}\n\nconst pascalCase = _.flow(_.camelCase, _.upperFirst)\nconst hasWarnedForPageComponentInvalidContext = new Set()\nconst hasWarnedForPageComponentInvalidCasing = new Set()\nconst hasErroredBecauseOfNodeValidation = new Set()\nconst pageComponentCache = {}\nconst reservedFields = [\n `path`,\n `matchPath`,\n `component`,\n `componentChunkName`,\n `pluginCreator___NODE`,\n `pluginCreatorId`,\n]\n/**\n * Create a page. See [the guide on creating and modifying pages](/docs/creating-and-modifying-pages/)\n * for detailed documentation about creating pages.\n * @param {Object} page a page object\n * @param {string} page.path Any valid URL. Must start with a forward slash\n * @param {string} page.matchPath Path that Reach Router uses to match the page on the client side.\n * Also see docs on [matchPath](/docs/gatsby-internals-terminology/#matchpath)\n * @param {string} page.component The absolute path to the component for this page\n * @param {Object} page.context Context data for this page. Passed as props\n * to the component `this.props.pageContext` as well as to the graphql query\n * as graphql arguments.\n * @example\n * createPage({\n * path: `/my-sweet-new-page/`,\n * component: path.resolve(`./src/templates/my-sweet-new-page.js`),\n * // The context is passed as props to the component as well\n * // as into the component's GraphQL query.\n * context: {\n * id: `123456`,\n * },\n * })\n */\nactions.createPage = (\n page: PageInput,\n plugin?: Plugin,\n actionOptions?: ActionOptions\n) => {\n let name = `The plugin \"${plugin.name}\"`\n if (plugin.name === `default-site-plugin`) {\n name = `Your site's \"gatsby-node.js\"`\n }\n if (!page.path) {\n const message = `${name} must set the page path when creating a page`\n // Don't log out when testing\n if (process.env.NODE_ENV !== `test`) {\n report.panic({\n id: `11323`,\n context: {\n pluginName: name,\n pageObject: page,\n message,\n },\n })\n } else {\n return message\n }\n }\n\n // Validate that the context object doesn't overlap with any core page fields\n // as this will cause trouble when running graphql queries.\n if (page.context && typeof page.context === `object`) {\n const invalidFields = reservedFields.filter(field => field in page.context)\n\n if (invalidFields.length > 0) {\n const error = `${\n invalidFields.length === 1\n ? `${name} used a reserved field name in the context object when creating a page:`\n : `${name} used reserved field names in the context object when creating a page:`\n }\n\n${invalidFields.map(f => ` * \"${f}\"`).join(`\\n`)}\n\n${JSON.stringify(page, null, 4)}\n\nData in \"context\" is passed to GraphQL as potential arguments when running the\npage query.\n\nWhen arguments for GraphQL are constructed, the context object is combined with\nthe page object so *both* page object and context data are available as\narguments. So you don't need to add the page \"path\" to the context as it's\nalready available in GraphQL. If a context field duplicates a field already\nused by the page object, this can break functionality within Gatsby so must be\navoided.\n\nPlease choose another name for the conflicting fields.\n\nThe following fields are used by the page object and should be avoided.\n\n${reservedFields.map(f => ` * \"${f}\"`).join(`\\n`)}\n\n `\n if (process.env.NODE_ENV === `test`) {\n return error\n // Only error if the context version is different than the page\n // version. People in v1 often thought that they needed to also pass\n // the path to context for it to be available in GraphQL\n } else if (invalidFields.some(f => page.context[f] !== page[f])) {\n report.panic({\n id: `11324`,\n context: {\n message: error,\n },\n })\n } else {\n if (!hasWarnedForPageComponentInvalidContext.has(page.component)) {\n report.warn(error)\n hasWarnedForPageComponentInvalidContext.add(page.component)\n }\n }\n }\n }\n\n // Check if a component is set.\n if (!page.component) {\n if (process.env.NODE_ENV !== `test`) {\n report.panic({\n id: `11322`,\n context: {\n pluginName: name,\n pageObject: page,\n },\n })\n } else {\n // For test\n return `A component must be set when creating a page`\n }\n }\n\n const pageComponentPath = shadowCreatePagePath(page.component)\n if (pageComponentPath) {\n page.component = pageComponentPath\n }\n\n const { error, message, panicOnBuild } = validatePageComponent(\n page,\n store.getState().program.directory,\n name\n )\n\n if (error) {\n if (process.env.NODE_ENV !== `test`) {\n if (panicOnBuild) {\n report.panicOnBuild(error)\n } else {\n report.panic(error)\n }\n }\n return message\n }\n\n // check if we've processed this component path\n // before, before running the expensive \"trueCasePath\"\n // operation\n //\n // Skip during testing as the paths don't exist on disk.\n if (process.env.NODE_ENV !== `test`) {\n if (pageComponentCache[page.component]) {\n page.component = pageComponentCache[page.component]\n } else {\n const originalPageComponent = page.component\n\n // normalize component path\n page.component = slash(page.component)\n // check if path uses correct casing - incorrect casing will\n // cause issues in query compiler and inconsistencies when\n // developing on Mac or Windows and trying to deploy from\n // linux CI/CD pipeline\n let trueComponentPath\n try {\n // most systems\n trueComponentPath = slash(trueCasePathSync(page.component))\n } catch (e) {\n // systems where user doesn't have access to /\n const commonDir = getCommonDir(\n store.getState().program.directory,\n page.component\n )\n\n // using `path.win32` to force case insensitive relative path\n const relativePath = slash(\n path.win32.relative(commonDir, page.component)\n )\n\n trueComponentPath = slash(trueCasePathSync(relativePath, commonDir))\n }\n\n if (isWindows) {\n page.component = ensureWindowsDriveIsUppercase(page.component)\n }\n\n if (trueComponentPath !== page.component) {\n if (!hasWarnedForPageComponentInvalidCasing.has(page.component)) {\n const markers = page.component\n .split(``)\n .map((letter, index) => {\n if (letter !== trueComponentPath[index]) {\n return `^`\n }\n return ` `\n })\n .join(``)\n\n report.warn(\n stripIndent`\n ${name} created a page with a component path that doesn't match the casing of the actual file. This may work locally, but will break on systems which are case-sensitive, e.g. most CI/CD pipelines.\n\n page.component: \"${page.component}\"\n path in filesystem: \"${trueComponentPath}\"\n ${markers}\n `\n )\n hasWarnedForPageComponentInvalidCasing.add(page.component)\n }\n\n page.component = trueComponentPath\n }\n\n pageComponentCache[originalPageComponent] = page.component\n }\n }\n\n let internalComponentName\n if (page.path === `/`) {\n internalComponentName = `ComponentIndex`\n } else {\n internalComponentName = `Component${pascalCase(page.path)}`\n }\n\n const invalidPathSegments = tooLongSegmentsInPath(page.path)\n\n if (invalidPathSegments.length > 0) {\n const truncatedPath = truncatePath(page.path)\n report.warn(\n report.stripIndent(`\n The path to the following page is longer than the supported limit on most\n operating systems and will cause an ENAMETOOLONG error. The path has been\n truncated to prevent this.\n\n Original Path: ${page.path}\n\n Truncated Path: ${truncatedPath}\n `)\n )\n page.path = truncatedPath\n }\n\n const internalPage: Page = {\n internalComponentName,\n path: page.path,\n matchPath: page.matchPath,\n component: page.component,\n componentChunkName: generateComponentChunkName(page.component),\n isCreatedByStatefulCreatePages:\n actionOptions?.traceId === `initial-createPagesStatefully`,\n // Ensure the page has a context object\n context: page.context || {},\n updatedAt: Date.now(),\n }\n\n // If the path doesn't have an initial forward slash, add it.\n if (internalPage.path[0] !== `/`) {\n internalPage.path = `/${internalPage.path}`\n }\n\n const oldPage: Page = store.getState().pages.get(internalPage.path)\n const contextModified =\n !!oldPage && !_.isEqual(oldPage.context, internalPage.context)\n\n const alternateSlashPath = page.path.endsWith(`/`)\n ? page.path.slice(0, -1)\n : page.path + `/`\n\n if (store.getState().pages.has(alternateSlashPath)) {\n report.warn(\n chalk.bold.yellow(`Non-deterministic routing danger: `) +\n `Attempting to create page: \"${page.path}\", but page \"${alternateSlashPath}\" already exists\\n` +\n chalk.bold.yellow(\n `This could lead to non-deterministic routing behavior`\n )\n )\n }\n\n return {\n ...actionOptions,\n type: `CREATE_PAGE`,\n contextModified,\n plugin,\n payload: internalPage,\n }\n}\n\n/**\n * Delete a node\n * @param {object} $0\n * @param {object} $0.node the node object\n * @example\n * deleteNode({node: node})\n */\nactions.deleteNode = (options: any, plugin: Plugin, args: any) => {\n let id\n\n // Check if using old method signature. Warn about incorrect usage but get\n // node from nodeID anyway.\n if (typeof options === `string`) {\n let msg =\n `Calling \"deleteNode\" with a nodeId is deprecated. Please pass an ` +\n `object containing a full node instead: deleteNode({ node }).`\n if (args && args.name) {\n // `plugin` used to be the third argument\n plugin = args\n msg = msg + ` \"deleteNode\" was called by ${plugin.name}`\n }\n report.warn(msg)\n\n id = options\n } else {\n id = options && options.node && options.node.id\n }\n\n // Always get node from the store, as the node we get as an arg\n // might already have been deleted.\n const node = getNode(id)\n if (plugin) {\n const pluginName = plugin.name\n\n if (node && typeOwners[node.internal.type] !== pluginName)\n throw new Error(stripIndent`\n The plugin \"${pluginName}\" deleted a node of a type owned by another plugin.\n\n The node type \"${node.internal.type}\" is owned by \"${\n typeOwners[node.internal.type]\n }\".\n\n The node object passed to \"deleteNode\":\n\n ${JSON.stringify(node, null, 4)}\n\n The plugin deleting the node:\n\n ${JSON.stringify(plugin, null, 4)}\n `)\n }\n\n const createDeleteAction = node => {\n return {\n type: `DELETE_NODE`,\n plugin,\n payload: node,\n }\n }\n\n const deleteAction = createDeleteAction(node)\n\n // It's possible the file node was never created as sometimes tools will\n // write and then immediately delete temporary files to the file system.\n const deleteDescendantsActions =\n node && findChildren(node.children).map(getNode).map(createDeleteAction)\n\n if (deleteDescendantsActions && deleteDescendantsActions.length) {\n return [...deleteDescendantsActions, deleteAction]\n } else {\n return deleteAction\n }\n}\n\n// Marked private here because it was suppressed in documentation pages.\n/**\n * Batch delete nodes\n * @private\n * @param {Array} nodes an array of node ids\n * @example\n * deleteNodes([`node1`, `node2`])\n */\nactions.deleteNodes = (nodes: any[], plugin: Plugin) => {\n let msg =\n `The \"deleteNodes\" action is now deprecated and will be removed in ` +\n `Gatsby v3. Please use \"deleteNode\" instead.`\n if (plugin && plugin.name) {\n msg = msg + ` \"deleteNodes\" was called by ${plugin.name}`\n }\n report.warn(msg)\n\n // Also delete any nodes transformed from these.\n const descendantNodes = _.flatten(\n nodes.map(n => findChildren(getNode(n).children))\n )\n\n const nodeIds = [...nodes, ...descendantNodes]\n\n const deleteNodesAction = {\n type: `DELETE_NODES`,\n plugin,\n // Payload contains node IDs but inference-metadata requires full node instances\n payload: nodeIds,\n fullNodes: nodeIds.map(getNode),\n }\n return deleteNodesAction\n}\n\n// We add a counter to node.internal for fast comparisons/intersections\n// of various node slices. The counter must increase even across builds.\nfunction getNextNodeCounter() {\n const lastNodeCounter = store.getState().status.LAST_NODE_COUNTER ?? 0\n if (lastNodeCounter >= Number.MAX_SAFE_INTEGER) {\n throw new Error(\n `Could not create more nodes. Maximum node count is reached: ${lastNodeCounter}`\n )\n }\n return lastNodeCounter + 1\n}\n\nconst typeOwners = {}\n\n// memberof notation is added so this code can be referenced instead of the wrapper.\n/**\n * Create a new node.\n * @memberof actions\n * @param {Object} node a node object\n * @param {string} node.id The node's ID. Must be globally unique.\n * @param {string} node.parent The ID of the parent's node. If the node is\n * derived from another node, set that node as the parent. Otherwise it can\n * just be `null`.\n * @param {Array} node.children An array of children node IDs. If you're\n * creating the children nodes while creating the parent node, add the\n * children node IDs here directly. If you're adding a child node to a\n * parent node created by a plugin, you can't mutate this value directly\n * to add your node id, instead use the action creator `createParentChildLink`.\n * @param {Object} node.internal node fields that aren't generally\n * interesting to consumers of node data but are very useful for plugin writers\n * and Gatsby core. Only fields described below are allowed in `internal` object.\n * Using any type of custom fields will result in validation errors.\n * @param {string} node.internal.mediaType An optional field to indicate to\n * transformer plugins that your node has raw content they can transform.\n * Use either an official media type (we use mime-db as our source\n * (https://www.npmjs.com/package/mime-db) or a made-up one if your data\n * doesn't fit in any existing bucket. Transformer plugins use node media types\n * for deciding if they should transform a node into a new one. E.g.\n * markdown transformers look for media types of\n * `text/markdown`.\n * @param {string} node.internal.type An arbitrary globally unique type\n * chosen by the plugin creating the node. Should be descriptive of the\n * node as the type is used in forming GraphQL types so users will query\n * for nodes based on the type chosen here. Nodes of a given type can\n * only be created by one plugin.\n * @param {string} node.internal.content An optional field. This is rarely\n * used. It is used when a source plugin sources data it doesn't know how\n * to transform e.g. a markdown string pulled from an API. The source plugin\n * can defer the transformation to a specialized transformer plugin like\n * gatsby-transformer-remark. This `content` field holds the raw content\n * (so for the markdown case, the markdown string).\n *\n * Data that's already structured should be added to the top-level of the node\n * object and _not_ added here. You should not `JSON.stringify` your node's\n * data here.\n *\n * If the content is very large and can be lazy-loaded, e.g. a file on disk,\n * you can define a `loadNodeContent` function for this node and the node\n * content will be lazy loaded when it's needed.\n * @param {string} node.internal.contentDigest the digest for the content\n * of this node. Helps Gatsby avoid doing extra work on data that hasn't\n * changed.\n * @param {string} node.internal.description An optional field. Human\n * readable description of what this node represent / its source. It will\n * be displayed when type conflicts are found, making it easier to find\n * and correct type conflicts.\n * @returns {Promise} The returned Promise resolves when all cascading\n * `onCreateNode` API calls triggered by `createNode` have finished.\n * @example\n * createNode({\n * // Data for the node.\n * field1: `a string`,\n * field2: 10,\n * field3: true,\n * ...arbitraryOtherData,\n *\n * // Required fields.\n * id: `a-node-id`,\n * parent: `the-id-of-the-parent-node`, // or null if it's a source node without a parent\n * children: [],\n * internal: {\n * type: `CoolServiceMarkdownField`,\n * contentDigest: crypto\n * .createHash(`md5`)\n * .update(JSON.stringify(fieldData))\n * .digest(`hex`),\n * mediaType: `text/markdown`, // optional\n * content: JSON.stringify(fieldData), // optional\n * description: `Cool Service: \"Title of entry\"`, // optional\n * }\n * })\n */\nconst createNode = (\n node: any,\n plugin?: Plugin,\n actionOptions?: ActionOptions = {}\n) => {\n if (!_.isObject(node)) {\n return console.log(\n chalk.bold.red(\n `The node passed to the \"createNode\" action creator must be an object`\n )\n )\n }\n\n // Ensure the new node has an internals object.\n if (!node.internal) {\n node.internal = {}\n }\n\n // Ensure the new node has a children array.\n if (!node.array && !_.isArray(node.children)) {\n node.children = []\n }\n\n // Ensure the new node has a parent field\n if (!node.parent) {\n node.parent = null\n }\n\n // Tell user not to set the owner name themself.\n if (node.internal.owner) {\n report.error(JSON.stringify(node, null, 4))\n report.panic(\n chalk.bold.red(\n `The node internal.owner field is set automatically by Gatsby and not by plugins`\n )\n )\n }\n\n const trackParams = {}\n // Add the plugin name to the internal object.\n if (plugin) {\n node.internal.owner = plugin.name\n trackParams[`pluginName`] = `${plugin.name}@${plugin.version}`\n }\n\n trackCli(`CREATE_NODE`, trackParams, { debounce: true })\n\n const result = Joi.validate(node, nodeSchema)\n if (result.error) {\n if (!hasErroredBecauseOfNodeValidation.has(result.error.message)) {\n const errorObj = {\n id: `11467`,\n context: {\n validationErrorMessage: result.error.message,\n node,\n },\n }\n\n const possiblyCodeFrame = getNonGatsbyCodeFrame()\n if (possiblyCodeFrame) {\n errorObj.context.codeFrame = possiblyCodeFrame.codeFrame\n errorObj.filePath = possiblyCodeFrame.fileName\n errorObj.location = {\n start: {\n line: possiblyCodeFrame.line,\n column: possiblyCodeFrame.column,\n },\n }\n }\n\n report.error(errorObj)\n hasErroredBecauseOfNodeValidation.add(result.error.message)\n }\n\n return { type: `VALIDATION_ERROR`, error: true }\n }\n\n // Ensure node isn't directly setting fields.\n if (node.fields) {\n throw new Error(\n stripIndent`\n Plugins creating nodes can not set data on the reserved field \"fields\"\n as this is reserved for plugins which wish to extend your nodes.\n\n If your plugin didn't add \"fields\" you're probably seeing this\n error because you're reusing an old node object.\n\n Node:\n\n ${JSON.stringify(node, null, 4)}\n\n Plugin that created the node:\n\n ${JSON.stringify(plugin, null, 4)}\n `\n )\n }\n\n node = sanitizeNode(node)\n\n const oldNode = getNode(node.id)\n\n // Ensure the plugin isn't creating a node type owned by another\n // plugin. Type \"ownership\" is first come first served.\n if (plugin) {\n const pluginName = plugin.name\n\n if (!typeOwners[node.internal.type])\n typeOwners[node.internal.type] = pluginName\n else if (typeOwners[node.internal.type] !== pluginName)\n throw new Error(stripIndent`\n The plugin \"${pluginName}\" created a node of a type owned by another plugin.\n\n The node type \"${node.internal.type}\" is owned by \"${\n typeOwners[node.internal.type]\n }\".\n\n If you copy and pasted code from elsewhere, you'll need to pick a new type name\n for your new node(s).\n\n The node object passed to \"createNode\":\n\n ${JSON.stringify(node, null, 4)}\n\n The plugin creating the node:\n\n ${JSON.stringify(plugin, null, 4)}\n `)\n\n // If the node has been created in the past, check that\n // the current plugin is the same as the previous.\n if (oldNode && oldNode.internal.owner !== pluginName) {\n throw new Error(\n stripIndent`\n Nodes can only be updated by their owner. Node \"${node.id}\" is\n owned by \"${oldNode.internal.owner}\" and another plugin \"${pluginName}\"\n tried to update it.\n\n `\n )\n }\n }\n\n if (actionOptions.parentSpan) {\n actionOptions.parentSpan.setTag(`nodeId`, node.id)\n actionOptions.parentSpan.setTag(`nodeType`, node.id)\n }\n\n let deleteActions\n let updateNodeAction\n // Check if the node has already been processed.\n if (oldNode && !hasNodeChanged(node.id, node.internal.contentDigest)) {\n updateNodeAction = {\n ...actionOptions,\n plugin,\n type: `TOUCH_NODE`,\n payload: node.id,\n }\n } else {\n // Remove any previously created descendant nodes as they're all due\n // to be recreated.\n if (oldNode) {\n const createDeleteAction = node => {\n return {\n ...actionOptions,\n type: `DELETE_NODE`,\n plugin,\n payload: node,\n }\n }\n deleteActions = findChildren(oldNode.children)\n .map(getNode)\n .map(createDeleteAction)\n }\n\n node.internal.counter = getNextNodeCounter()\n\n updateNodeAction = {\n ...actionOptions,\n type: `CREATE_NODE`,\n plugin,\n oldNode,\n payload: node,\n }\n }\n\n if (deleteActions && deleteActions.length) {\n return [...deleteActions, updateNodeAction]\n } else {\n return updateNodeAction\n }\n}\n\nactions.createNode = (...args) => dispatch => {\n const actions = createNode(...args)\n\n dispatch(actions)\n const createNodeAction = (Array.isArray(actions) ? actions : [actions]).find(\n action => action.type === `CREATE_NODE`\n )\n\n if (!createNodeAction) {\n return undefined\n }\n\n const { payload: node, traceId, parentSpan } = createNodeAction\n return apiRunnerNode(`onCreateNode`, {\n node,\n traceId,\n parentSpan,\n traceTags: { nodeId: node.id, nodeType: node.internal.type },\n })\n}\n\n/**\n * \"Touch\" a node. Tells Gatsby a node still exists and shouldn't\n * be garbage collected. Primarily useful for source plugins fetching\n * nodes from a remote system that can return only nodes that have\n * updated. The source plugin then touches all the nodes that haven't\n * updated but still exist so Gatsby knows to keep them.\n * @param {Object} $0\n * @param {string} $0.nodeId The id of a node\n * @example\n * touchNode({ nodeId: `a-node-id` })\n */\nactions.touchNode = (options: any, plugin?: Plugin) => {\n let nodeId = _.get(options, `nodeId`)\n\n // Check if using old method signature. Warn about incorrect usage\n if (typeof options === `string`) {\n console.warn(\n `Calling \"touchNode\" with a nodeId is deprecated. Please pass an object containing a nodeId instead: touchNode({ nodeId: 'a-node-id' })`\n )\n\n if (plugin && plugin.name) {\n console.log(`\"touchNode\" was called by ${plugin.name}`)\n }\n\n nodeId = options\n }\n\n const node = getNode(nodeId)\n if (node && !typeOwners[node.internal.type]) {\n typeOwners[node.internal.type] = node.internal.owner\n }\n\n return {\n type: `TOUCH_NODE`,\n plugin,\n payload: nodeId,\n }\n}\n\ntype CreateNodeInput = {\n node: Object,\n fieldName?: string,\n fieldValue?: string,\n name?: string,\n value: any,\n}\n/**\n * Extend another node. The new node field is placed under the `fields`\n * key on the extended node object.\n *\n * Once a plugin has claimed a field name the field name can't be used by\n * other plugins. Also since nodes are immutable, you can't mutate the node\n * directly. So to extend another node, use this.\n * @param {Object} $0\n * @param {Object} $0.node the target node object\n * @param {string} $0.fieldName [deprecated] the name for the field\n * @param {string} $0.fieldValue [deprecated] the value for the field\n * @param {string} $0.name the name for the field\n * @param {any} $0.value the value for the field\n * @example\n * createNodeField({\n * node,\n * name: `happiness`,\n * value: `is sweet graphql queries`\n * })\n *\n * // The field value is now accessible at node.fields.happiness\n */\nactions.createNodeField = (\n { node, name, value, fieldName, fieldValue }: CreateNodeInput,\n plugin: Plugin,\n actionOptions?: ActionOptions\n) => {\n if (fieldName) {\n console.warn(\n `Calling \"createNodeField\" with \"fieldName\" is deprecated. Use \"name\" instead`\n )\n if (!name) {\n name = fieldName\n }\n }\n if (fieldValue) {\n console.warn(\n `Calling \"createNodeField\" with \"fieldValue\" is deprecated. Use \"value\" instead`\n )\n if (!value) {\n value = fieldValue\n }\n }\n // Ensure required fields are set.\n if (!node.internal.fieldOwners) {\n node.internal.fieldOwners = {}\n }\n if (!node.fields) {\n node.fields = {}\n }\n\n // Normalized name of the field that will be used in schema\n const schemaFieldName = _.includes(name, `___NODE`)\n ? name.split(`___`)[0]\n : name\n\n // Check that this field isn't owned by another plugin.\n const fieldOwner = node.internal.fieldOwners[schemaFieldName]\n if (fieldOwner && fieldOwner !== plugin.name) {\n throw new Error(\n stripIndent`\n A plugin tried to update a node field that it doesn't own:\n\n Node id: ${node.id}\n Plugin: ${plugin.name}\n name: ${name}\n value: ${value}\n `\n )\n }\n\n // Update node\n node.fields[name] = value\n node.internal.fieldOwners[schemaFieldName] = plugin.name\n node = sanitizeNode(node)\n\n return {\n ...actionOptions,\n type: `ADD_FIELD_TO_NODE`,\n plugin,\n payload: node,\n addedField: name,\n }\n}\n\n/**\n * Creates a link between a parent and child node. This is used when you\n * transform content from a node creating a new child node. You need to add\n * this new child node to the `children` array of the parent but since you\n * don't have direct access to the immutable parent node, use this action\n * instead.\n * @param {Object} $0\n * @param {Object} $0.parent the parent node object\n * @param {Object} $0.child the child node object\n * @example\n * createParentChildLink({ parent: parentNode, child: childNode })\n */\nactions.createParentChildLink = (\n { parent, child }: { parent: any, child: any },\n plugin?: Plugin\n) => {\n if (!parent.children.includes(child.id)) {\n parent.children.push(child.id)\n }\n\n return {\n type: `ADD_CHILD_NODE_TO_PARENT_NODE`,\n plugin,\n payload: parent,\n }\n}\n\n/**\n * Merge additional configuration into the current webpack config. A few\n * configurations options will be ignored if set, in order to try prevent accidental breakage.\n * Specifically, any change to `entry`, `output`, `target`, or `resolveLoaders` will be ignored.\n *\n * For full control over the webpack config, use `replaceWebpackConfig()`.\n *\n * @param {Object} config partial webpack config, to be merged into the current one\n */\nactions.setWebpackConfig = (config: Object, plugin?: ?Plugin = null) => {\n return {\n type: `SET_WEBPACK_CONFIG`,\n plugin,\n payload: config,\n }\n}\n\n/**\n * Completely replace the webpack config for the current stage. This can be\n * dangerous and break Gatsby if certain configuration options are changed.\n *\n * Generally only useful for cases where you need to handle config merging logic\n * yourself, in which case consider using `webpack-merge`.\n *\n * @param {Object} config complete webpack config\n */\nactions.replaceWebpackConfig = (config: Object, plugin?: ?Plugin = null) => {\n return {\n type: `REPLACE_WEBPACK_CONFIG`,\n plugin,\n payload: config,\n }\n}\n\n/**\n * Set top-level Babel options. Plugins and presets will be ignored. Use\n * setBabelPlugin and setBabelPreset for this.\n * @param {Object} config An options object in the shape of a normal babelrc JavaScript object\n * @example\n * setBabelOptions({\n * options: {\n * sourceMaps: `inline`,\n * }\n * })\n */\nactions.setBabelOptions = (options: Object, plugin?: ?Plugin = null) => {\n // Validate\n let name = `The plugin \"${plugin.name}\"`\n if (plugin.name === `default-site-plugin`) {\n name = `Your site's \"gatsby-node.js\"`\n }\n if (!_.isObject(options)) {\n console.log(`${name} must pass an object to \"setBabelOptions\"`)\n console.log(JSON.stringify(options, null, 4))\n if (process.env.NODE_ENV !== `test`) {\n process.exit(1)\n }\n }\n\n if (!_.isObject(options.options)) {\n console.log(`${name} must pass options to \"setBabelOptions\"`)\n console.log(JSON.stringify(options, null, 4))\n if (process.env.NODE_ENV !== `test`) {\n process.exit(1)\n }\n }\n\n return {\n type: `SET_BABEL_OPTIONS`,\n plugin,\n payload: options,\n }\n}\n\n/**\n * Add new plugins or merge options into existing Babel plugins.\n * @param {Object} config A config object describing the Babel plugin to be added.\n * @param {string} config.name The name of the Babel plugin\n * @param {Object} config.options Options to pass to the Babel plugin.\n * @example\n * setBabelPlugin({\n * name: `@emotion/babel-plugin`,\n * options: {\n * sourceMap: true,\n * },\n * })\n */\nactions.setBabelPlugin = (config: Object, plugin?: ?Plugin = null) => {\n // Validate\n let name = `The plugin \"${plugin.name}\"`\n if (plugin.name === `default-site-plugin`) {\n name = `Your site's \"gatsby-node.js\"`\n }\n if (!config.name) {\n console.log(`${name} must set the name of the Babel plugin`)\n console.log(JSON.stringify(config, null, 4))\n if (process.env.NODE_ENV !== `test`) {\n process.exit(1)\n }\n }\n if (!config.options) {\n config.options = {}\n }\n return {\n type: `SET_BABEL_PLUGIN`,\n plugin,\n payload: config,\n }\n}\n\n/**\n * Add new presets or merge options into existing Babel presets.\n * @param {Object} config A config object describing the Babel plugin to be added.\n * @param {string} config.name The name of the Babel preset.\n * @param {Object} config.options Options to pass to the Babel preset.\n * @example\n * setBabelPreset({\n * name: `@babel/preset-react`,\n * options: {\n * pragma: `Glamor.createElement`,\n * },\n * })\n */\nactions.setBabelPreset = (config: Object, plugin?: ?Plugin = null) => {\n // Validate\n let name = `The plugin \"${plugin.name}\"`\n if (plugin.name === `default-site-plugin`) {\n name = `Your site's \"gatsby-node.js\"`\n }\n if (!config.name) {\n console.log(`${name} must set the name of the Babel preset`)\n console.log(JSON.stringify(config, null, 4))\n if (process.env.NODE_ENV !== `test`) {\n process.exit(1)\n }\n }\n if (!config.options) {\n config.options = {}\n }\n return {\n type: `SET_BABEL_PRESET`,\n plugin,\n payload: config,\n }\n}\n\n/**\n * Create a \"job\". This is a long-running process that is generally\n * started as a side-effect to a GraphQL query.\n * [`gatsby-plugin-sharp`](/plugins/gatsby-plugin-sharp/) uses this for\n * example.\n *\n * Gatsby doesn't finish its process until all jobs are ended.\n * @param {Object} job A job object with at least an id set\n * @param {id} job.id The id of the job\n * @example\n * createJob({ id: `write file id: 123`, fileName: `something.jpeg` })\n */\nactions.createJob = (job: Job, plugin?: ?Plugin = null) => {\n return {\n type: `CREATE_JOB`,\n plugin,\n payload: job,\n }\n}\n\n/**\n * Create a \"job\". This is a long-running process that is generally\n * started as a side-effect to a GraphQL query.\n * [`gatsby-plugin-sharp`](/plugins/gatsby-plugin-sharp/) uses this for\n * example.\n *\n * Gatsby doesn't finish its process until all jobs are ended.\n * @param {Object} job A job object with name, inputPaths, outputDir and args\n * @param {string} job.name The name of the job you want to execute\n * @param {string[]} job.inputPaths The inputPaths that are needed to run\n * @param {string} job.outputDir The directory where all files are being saved to\n * @param {Object} job.args The arguments the job needs to execute\n * @returns {Promise<object>} Promise to see if the job is done executing\n * @example\n * createJobV2({ name: `IMAGE_PROCESSING`, inputPaths: [`something.jpeg`], outputDir: `public/static`, args: { width: 100, height: 100 } })\n */\nactions.createJobV2 = (job: JobV2, plugin: Plugin) => (dispatch, getState) => {\n const currentState = getState()\n const internalJob = createInternalJob(job, plugin)\n const jobContentDigest = internalJob.contentDigest\n\n // Check if we already ran this job before, if yes we return the result\n // We have an inflight (in progress) queue inside the jobs manager to make sure\n // we don't waste resources twice during the process\n if (\n currentState.jobsV2 &&\n currentState.jobsV2.complete.has(jobContentDigest)\n ) {\n return Promise.resolve(\n currentState.jobsV2.complete.get(jobContentDigest).result\n )\n }\n\n const inProgressJobPromise = getInProcessJobPromise(jobContentDigest)\n if (inProgressJobPromise) {\n return inProgressJobPromise\n }\n\n dispatch({\n type: `CREATE_JOB_V2`,\n plugin,\n payload: {\n job: internalJob,\n plugin,\n },\n })\n\n const enqueuedJobPromise = enqueueJob(internalJob)\n return enqueuedJobPromise.then(result => {\n // store the result in redux so we have it for the next run\n dispatch({\n type: `END_JOB_V2`,\n plugin,\n payload: {\n jobContentDigest,\n result,\n },\n })\n\n // remove the job from our inProgressJobQueue as it's available in our done state.\n // this is a perf optimisations so we don't grow our memory too much when using gatsby preview\n removeInProgressJob(jobContentDigest)\n\n return result\n })\n}\n\n/**\n * Set (update) a \"job\". Sometimes on really long running jobs you want\n * to update the job as it continues.\n *\n * @param {Object} job A job object with at least an id set\n * @param {id} job.id The id of the job\n * @example\n * setJob({ id: `write file id: 123`, progress: 50 })\n */\nactions.setJob = (job: Job, plugin?: ?Plugin = null) => {\n return {\n type: `SET_JOB`,\n plugin,\n payload: job,\n }\n}\n\n/**\n * End a \"job\".\n *\n * Gatsby doesn't finish its process until all jobs are ended.\n * @param {Object} job A job object with at least an id set\n * @param {id} job.id The id of the job\n * @example\n * endJob({ id: `write file id: 123` })\n */\nactions.endJob = (job: Job, plugin?: ?Plugin = null) => {\n return {\n type: `END_JOB`,\n plugin,\n payload: job,\n }\n}\n\n/**\n * Set plugin status. A plugin can use this to save status keys e.g. the last\n * it fetched something. These values are persisted between runs of Gatsby.\n *\n * @param {Object} status An object with arbitrary values set\n * @example\n * setPluginStatus({ lastFetched: Date.now() })\n */\nactions.setPluginStatus = (\n status: { [key: string]: mixed },\n plugin: Plugin\n) => {\n return {\n type: `SET_PLUGIN_STATUS`,\n plugin,\n payload: status,\n }\n}\n\n// Check if path is absolute and add pathPrefix in front if it's not\nconst maybeAddPathPrefix = (path, pathPrefix) => {\n const parsed = url.parse(path)\n const isRelativeProtocol = path.startsWith(`//`)\n return `${\n parsed.protocol != null || isRelativeProtocol ? `` : pathPrefix\n }${path}`\n}\n\n/**\n * Create a redirect from one page to another. Server redirects don't work out\n * of the box. You must have a plugin setup to integrate the redirect data with\n * your hosting technology e.g. the [Netlify\n * plugin](/plugins/gatsby-plugin-netlify/), or the [Amazon S3\n * plugin](/plugins/gatsby-plugin-s3/). Alternatively, you can use\n * [this plugin](/plugins/gatsby-plugin-meta-redirect/) to generate meta redirect\n * html files for redirecting on any static file host.\n *\n * @param {Object} redirect Redirect data\n * @param {string} redirect.fromPath Any valid URL. Must start with a forward slash\n * @param {boolean} redirect.isPermanent This is a permanent redirect; defaults to temporary\n * @param {string} redirect.toPath URL of a created page (see `createPage`)\n * @param {boolean} redirect.redirectInBrowser Redirects are generally for redirecting legacy URLs to their new configuration. If you can't update your UI for some reason, set `redirectInBrowser` to true and Gatsby will handle redirecting in the client as well.\n * @param {boolean} redirect.force (Plugin-specific) Will trigger the redirect even if the `fromPath` matches a piece of content. This is not part of the Gatsby API, but implemented by (some) plugins that configure hosting provider redirects\n * @param {number} redirect.statusCode (Plugin-specific) Manually set the HTTP status code. This allows you to create a rewrite (status code 200) or custom error page (status code 404). Note that this will override the `isPermanent` option which also sets the status code. This is not part of the Gatsby API, but implemented by (some) plugins that configure hosting provider redirects\n * @param {boolean} redirect.ignoreCase (Plugin-specific) Ignore case when looking for redirects\n * @example\n * // Generally you create redirects while creating pages.\n * exports.createPages = ({ graphql, actions }) => {\n * const { createRedirect } = actions\n * createRedirect({ fromPath: '/old-url', toPath: '/new-url', isPermanent: true })\n * createRedirect({ fromPath: '/url', toPath: '/zn-CH/url', Language: 'zn' })\n * createRedirect({ fromPath: '/not_so-pretty_url', toPath: '/pretty/url', statusCode: 200 })\n * // Create pages here\n * }\n */\nactions.createRedirect = ({\n fromPath,\n isPermanent = false,\n redirectInBrowser = false,\n toPath,\n ignoreCase = false,\n ...rest\n}) => {\n let pathPrefix = ``\n if (store.getState().program.prefixPaths) {\n pathPrefix = store.getState().config.pathPrefix\n }\n\n return {\n type: `CREATE_REDIRECT`,\n payload: {\n fromPath: maybeAddPathPrefix(fromPath, pathPrefix),\n isPermanent,\n ignoreCase,\n redirectInBrowser,\n toPath: maybeAddPathPrefix(toPath, pathPrefix),\n ...rest,\n },\n }\n}\n\n/**\n * Create a dependency between a page and data.\n *\n * @param {Object} $0\n * @param {string} $0.path the path to the page\n * @param {string} $0.nodeId A node ID\n * @param {string} $0.connection A connection type\n * @private\n */\nactions.createPageDependency = (\n {\n path,\n nodeId,\n connection,\n }: { path: string, nodeId: string, connection: string },\n plugin: string = ``\n) => {\n console.warn(\n `Calling \"createPageDependency\" directly from actions in deprecated. Use \"createPageDependency\" from \"gatsby/dist/redux/actions/add-page-dependency\".`\n )\n return {\n type: `CREATE_COMPONENT_DEPENDENCY`,\n plugin,\n payload: {\n path,\n nodeId,\n connection,\n },\n }\n}\n\n/**\n * Set page data in the store, saving the pages content data and context.\n *\n * @param {Object} $0\n * @param {string} $0.id the path to the page.\n * @param {string} $0.resultHash pages content hash.\n */\nactions.setPageData = (pageData: PageData) => {\n return {\n type: `SET_PAGE_DATA`,\n payload: pageData,\n }\n}\n\n/**\n * Remove page data from the store.\n *\n * @param {Object} $0\n * @param {string} $0.id the path to the page.\n */\nactions.removePageData = (id: PageDataRemove) => {\n return {\n type: `REMOVE_PAGE_DATA`,\n payload: id,\n }\n}\n\n/**\n * Record that a page was visited on the server..\n *\n * @param {Object} $0\n * @param {string} $0.id the chunkName for the page component.\n */\nactions.createServerVisitedPage = (chunkName: string) => {\n if (store.getState().visitedPages.get(`server`)?.has(chunkName)) {\n // we already have given chunk tracked, let's not emit `CREATE_SERVER_VISITED_PAGE`\n // action to not cause any additional work\n return []\n }\n\n return {\n type: `CREATE_SERVER_VISITED_PAGE`,\n payload: { componentChunkName: chunkName },\n }\n}\n\nmodule.exports = { actions }\n"],"file":"public.js"}
|
package/dist/redux/nodes.js
CHANGED
|
@@ -983,10 +983,14 @@ function intersectNodesByCounter(a, b) {
|
|
|
983
983
|
} else if (counterA > counterB) {
|
|
984
984
|
pointerB++;
|
|
985
985
|
} else {
|
|
986
|
-
|
|
986
|
+
if (nodeA !== nodeB) {
|
|
987
|
+
throw new Error(`Invariant violation: inconsistent node counters detected`);
|
|
988
|
+
} // nodeA===nodeB. Make sure we didn't just add this node already.
|
|
987
989
|
// Since input arrays are sorted, the same node should be grouped
|
|
988
990
|
// back to back, so even if both input arrays contained the same node
|
|
989
991
|
// twice, this check would prevent the result from getting duplicate nodes
|
|
992
|
+
|
|
993
|
+
|
|
990
994
|
if (lastAdded !== nodeA) {
|
|
991
995
|
result.push(nodeA);
|
|
992
996
|
lastAdded = nodeA;
|