gatsby 4.1.2 → 4.1.6

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.
@@ -236,10 +236,30 @@ async function processNodeManifest(inputManifest) {
236
236
  pageDataDigest
237
237
  };
238
238
 
239
- const gatsbySiteDirectory = _redux.store.getState().program.directory; // write out the manifest file
240
-
241
-
242
- const manifestFilePath = _path.default.join(gatsbySiteDirectory, `public`, `__node-manifests`, inputManifest.pluginName, `${inputManifest.manifestId}.json`);
239
+ const gatsbySiteDirectory = _redux.store.getState().program.directory;
240
+
241
+ let fileNameBase = inputManifest.manifestId;
242
+ /**
243
+ * Windows has a handful of special/reserved characters that are not valid in a file path
244
+ * @reference https://superuser.com/questions/358855/what-characters-are-safe-in-cross-platform-file-names-for-linux-windows-and-os
245
+ *
246
+ * The two exceptions to the list linked above are
247
+ * - the colon that is part of the hard disk partition name at the beginning of a file path (i.e. C:)
248
+ * - backslashes. We don't want to replace backslashes because those are used to delineate what the actual file path is
249
+ *
250
+ * During local development, node manifests can be written to disk but are generally unused as they are only used
251
+ * for Content Sync which runs in Gatsby Cloud. Gatsby cloud is a Linux environment in which these special chars are valid in
252
+ * filepaths. To avoid errors on Windows, we replace all instances of the special chars in the filepath (with the exception of the
253
+ * hard disk partition name) with "-" to ensure that local Windows development setups do not break when attempting
254
+ * to write one of these manifests to disk.
255
+ */
256
+
257
+ if (process.platform === `win32`) {
258
+ fileNameBase = fileNameBase.replace(/:|\/|\*|\?|"|<|>|\||\\/g, `-`);
259
+ } // write out the manifest file
260
+
261
+
262
+ const manifestFilePath = _path.default.join(gatsbySiteDirectory, `public`, `__node-manifests`, inputManifest.pluginName, `${fileNameBase}.json`);
243
263
 
244
264
  const manifestFileDir = _path.default.dirname(manifestFilePath);
245
265
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/node-manifest.ts"],"names":["findPageOwnedByNodeId","nodeId","state","store","getState","pages","nodes","byNode","queries","usingPagesMap","process","env","NODE_ENV","pagePathSetOrMap","get","pagePath","values","next","value","foundPageBy","ownerPagePath","foundOwnerNodeId","pathOrPageObject","path","fullPage","ownerNodeId","foundPageIdInContext","context","id","pageCreatedByPluginName","pluginCreatorId","name","pageCreatedByFilesystemPlugin","page","foundPageByToLogIds","none","queryTracking","warnAboutNodeManifestMappingProblems","inputManifest","logId","reporter","error","Error","getPageDataDigestForPagePath","directory","publicDirectory","join","program","pageData","pageDataDigest","e","warn","processNodeManifest","node","fullNode","pluginName","nodeManifestPage","finalManifest","gatsbySiteDirectory","manifestFilePath","manifestId","manifestFileDir","dirname","fs","ensureDir","writeJSON","processNodeManifests","nodeManifests","totalManifests","length","processedManifests","Promise","all","map","manifest","totalProcessedManifests","totalFailedManifests","forEach","pluralize","info","dispatch","internalActions","deleteNodeManifests"],"mappings":";;;;;;;;;;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA0BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeA,qBAAf,CAAqC;AAAEC,EAAAA;AAAF,CAArC,EAGG;AAAA;;AACD,QAAMC,KAAK,GAAGC,aAAMC,QAAN,EAAd;;AACA,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAmBJ,KAAzB;AACA,QAAM;AAAEK,IAAAA;AAAF,MAAaL,KAAK,CAACM,OAAzB,CAHC,CAKD;AACA;AACA;AACA;AACA;;AACA,QAAMC,aAAsB,GAAI,aAAD,KAAkBC,OAAO,CAACC,GAAR,CAAYC,QAA7D;AAEA,QAAMC,gBAAgB,GAAGJ,aAAa,GAClC;AACAJ,EAAAA,KAFkC,GAGlC;AACAE,EAAAA,MAJkC,aAIlCA,MAJkC,uBAIlCA,MAAM,CAAEO,GAAR,CAAYb,MAAZ,CAJJ,CAZC,CAkBD;AACA;;AACA,MAAIc,QAAQ,GAAGR,MAAH,aAAGA,MAAH,sCAAGA,MAAM,CAAEO,GAAR,CAAYb,MAAZ,CAAH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CAAzB,GAA8B,GAA9B,GAAoC,EADtC;;AAGA7B,oBAASuC,IAAT,CACG,aAAYJ,uBAAwB,2BAA0BG,SAAS,CACtEH,uBADsE,CAEtE,GACAC,oBAAoB,GAAG,CAAvB,GACK,KAAIA,oBAAqB,YAAWE,SAAS,CAC5CF,oBAD4C,CAE5C,yBAHN,GAIK,EACN,EATH,EA3B0D,CAuC1D;;;AACAzE,eAAM6E,QAAN,CAAeC,yBAAgBC,mBAAhB,EAAf;AACD","sourcesContent":["import type { ErrorId } from \"gatsby-cli/lib/structured-errors/error-map\"\nimport { getNode } from \"./../datastore\"\nimport { IGatsbyPage, INodeManifest } from \"./../redux/types\"\nimport reporter from \"gatsby-cli/lib/reporter\"\nimport { store } from \"../redux/\"\nimport { internalActions } from \"../redux/actions\"\nimport path from \"path\"\nimport fs from \"fs-extra\"\nimport { readPageData } from \"./page-data\"\nimport { createContentDigest } from \"gatsby-core-utils\"\n\ninterface INodeManifestPage {\n path?: string\n}\n\n/**\n * This it the output after processing calls to the public unstable_createNodeManifest action\n */\ninterface INodeManifestOut {\n page: INodeManifestPage\n node: {\n id: string\n }\n foundPageBy: FoundPageBy\n pageDataDigest: string | null\n}\n\ntype FoundPageBy =\n | `ownerNodeId`\n | `filesystem-route-api`\n // for these three we warn to use ownerNodeId instead\n | `context.id`\n | `queryTracking`\n | `none`\n\n/**\n * Finds a final built page by nodeId\n *\n * Note that this function wont work properly in `gatsby develop`\n * since develop no longer runs all page queries when creating pages.\n * We use the node id to query mapping to find the right page but\n * this mapping only exists once you've visited a page in your browser.\n * When this fn is being used for routing to previews the user wont necessarily have\n * visited the page in the browser yet.\n */\nasync function findPageOwnedByNodeId({ nodeId }: { nodeId: string }): Promise<{\n page: INodeManifestPage\n foundPageBy: FoundPageBy\n}> {\n const state = store.getState()\n const { pages, nodes } = state\n const { byNode } = state.queries\n\n // in development queries are run on demand so we wont have an accurate nodeId->pages map until those pages are visited in the browser. We want this mapping before the page is visited in the browser so we can route to the right page in the browser.\n // So in development we can just use the Map of all pages (pagePath -> pageNode)\n // but for builds (preview inc builds or regular builds) we will have a full map\n // of all nodeId's to pages they're queried on and we can use that instead since it\n // will be a much smaller list of pages, resulting in better performance for large sites\n const usingPagesMap: boolean = `development` === process.env.NODE_ENV\n\n const pagePathSetOrMap = usingPagesMap\n ? // this is a Map of page path to page node\n pages\n : // this is a Set of page paths\n byNode?.get(nodeId)\n\n // the default page path is the first page found in\n // node id to page query tracking\n let pagePath = byNode?.get(nodeId)?.values()?.next()?.value\n\n let foundPageBy: FoundPageBy = pagePath ? `queryTracking` : `none`\n\n if (pagePathSetOrMap) {\n let ownerPagePath: string | undefined\n let foundOwnerNodeId = false\n\n // for each page this nodeId is queried in\n for (const pathOrPageObject of pagePathSetOrMap.values()) {\n // if we haven't found a page with this nodeId\n // set as page.ownerNodeId then run this logic.\n // this condition is on foundOwnerNodeId instead of ownerPagePath\n // in case we find a page with the nodeId in page.context.id\n // and then later in the loop there's a page with this nodeId\n // set on page.ownerNodeId.\n // We always want to prefer ownerPagePath over context.id\n if (foundOwnerNodeId) {\n break\n }\n\n const path = (\n usingPagesMap\n ? // in development we're using a Map, so the value here is a page object\n (pathOrPageObject as IGatsbyPage).path\n : // in builds we're using a Set so the page path is the value\n pathOrPageObject\n ) as string\n\n const fullPage: IGatsbyPage | undefined = pages.get(path)\n\n foundOwnerNodeId = fullPage?.ownerNodeId === nodeId\n\n const foundPageIdInContext = fullPage?.context.id === nodeId\n\n if (foundOwnerNodeId) {\n foundPageBy = `ownerNodeId`\n } else if (foundPageIdInContext && fullPage) {\n const pageCreatedByPluginName = nodes.get(\n fullPage.pluginCreatorId\n )?.name\n\n const pageCreatedByFilesystemPlugin =\n pageCreatedByPluginName === `gatsby-plugin-page-creator`\n\n foundPageBy = pageCreatedByFilesystemPlugin\n ? `filesystem-route-api`\n : `context.id`\n }\n\n if (\n fullPage &&\n // first check for the ownerNodeId on the page. this is\n // the defacto owner. Can't get more specific than this\n (foundOwnerNodeId ||\n // if there's no specified owner look to see if\n // pageContext has an `id` variable which matches our\n // nodeId. Using an \"id\" as a variable in queries is common\n // and if we don't have an owner this is a better guess\n // of an owner than grabbing the first page query we find\n // that's mapped to this node id.\n // this also makes this work with the filesystem Route API without\n // changing that API.\n foundPageIdInContext)\n ) {\n // save this path to use in our manifest!\n ownerPagePath = fullPage.path\n }\n }\n\n if (ownerPagePath) {\n pagePath = ownerPagePath\n }\n }\n\n return {\n page: {\n path: pagePath || null,\n },\n foundPageBy,\n }\n}\n\n// these id's correspond to error id's in\n// packages/gatsby-cli/src/structured-errors/error-map.ts\nexport const foundPageByToLogIds = {\n none: `11801`,\n [`context.id`]: `11802`,\n queryTracking: `11803`,\n [`filesystem-route-api`]: `success`,\n ownerNodeId: `success`,\n}\n\n/**\n * Takes in some info about a node manifest and the page we did or didn't find for it, then warns and returns the warning string\n */\nexport function warnAboutNodeManifestMappingProblems({\n inputManifest,\n pagePath,\n foundPageBy,\n}: {\n inputManifest: INodeManifest\n pagePath?: string\n foundPageBy: FoundPageBy\n}): { logId: string } {\n let logId: ErrorId | `success`\n\n switch (foundPageBy) {\n case `none`:\n case `context.id`:\n case `queryTracking`: {\n logId = foundPageByToLogIds[foundPageBy]\n reporter.error({\n id: logId,\n context: {\n inputManifest,\n pagePath,\n },\n })\n break\n }\n\n case `filesystem-route-api`:\n case `ownerNodeId`:\n logId = `success`\n break\n\n default: {\n throw Error(`Node Manifest mapping is in an impossible state`)\n }\n }\n\n return {\n logId,\n }\n}\n\n/**\n * Retrieves the content digest of a page-data.json file for use in creating node manifest files.\n */\nexport async function getPageDataDigestForPagePath(\n pagePath?: string,\n directory?: string\n): Promise<string | null> {\n if (\n // if no page was created for the node we're creating a manifest for, there wont be a page path.\n !pagePath ||\n // we only add page data digests to node manifests in production because page-data.json may not exist in development.\n (process.env.NODE_ENV !== `production` && process.env.NODE_ENV !== `test`)\n ) {\n return null\n }\n\n try {\n const publicDirectory = path.join(\n directory || store.getState().program.directory,\n `public`\n )\n const pageData = await readPageData(publicDirectory, pagePath)\n\n const pageDataDigest = createContentDigest(pageData)\n\n return pageDataDigest\n } catch (e) {\n reporter.warn(\n `No page-data.json found for ${pagePath} while processing node manifests.`\n )\n\n return null\n }\n}\n\n/**\n * Prepares and then writes out an individual node manifest file to be used for routing to previews. Manifest files are added via the public unstable_createNodeManifest action\n */\nexport async function processNodeManifest(\n inputManifest: INodeManifest\n): Promise<null | INodeManifestOut> {\n const nodeId = inputManifest.node.id\n const fullNode = getNode(nodeId)\n\n if (!fullNode) {\n reporter.warn(\n `Plugin ${inputManifest.pluginName} called unstable_createNodeManifest for a node which doesn't exist with an id of ${nodeId}.`\n )\n return null\n }\n\n // map the node to a page that was created\n const { page: nodeManifestPage, foundPageBy } = await findPageOwnedByNodeId({\n nodeId,\n })\n\n warnAboutNodeManifestMappingProblems({\n inputManifest,\n pagePath: nodeManifestPage.path,\n foundPageBy,\n })\n\n const pageDataDigest = await getPageDataDigestForPagePath(\n nodeManifestPage.path\n )\n\n const finalManifest: INodeManifestOut = {\n node: inputManifest.node,\n page: nodeManifestPage,\n foundPageBy,\n pageDataDigest,\n }\n\n const gatsbySiteDirectory = store.getState().program.directory\n\n // write out the manifest file\n const manifestFilePath = path.join(\n gatsbySiteDirectory,\n `public`,\n `__node-manifests`,\n inputManifest.pluginName,\n `${inputManifest.manifestId}.json`\n )\n\n const manifestFileDir = path.dirname(manifestFilePath)\n\n await fs.ensureDir(manifestFileDir)\n await fs.writeJSON(manifestFilePath, finalManifest)\n\n return finalManifest\n}\n\n/**\n * Grabs all pending node manifests, processes them, writes them to disk,\n * and then removes them from the store.\n * Manifest files are added via the public unstable_createNodeManifest action in sourceNodes\n */\nexport async function processNodeManifests(): Promise<void> {\n const { nodeManifests } = store.getState()\n\n const totalManifests = nodeManifests.length\n\n if (totalManifests === 0) {\n return\n }\n\n const processedManifests = await Promise.all(\n nodeManifests.map(manifest => processNodeManifest(manifest))\n )\n\n let totalProcessedManifests = 0\n let totalFailedManifests = 0\n\n processedManifests.forEach(manifest => {\n if (manifest) {\n totalProcessedManifests++\n } else {\n totalFailedManifests++\n }\n })\n\n const pluralize = (length: number): string =>\n length > 1 || length === 0 ? `s` : ``\n\n reporter.info(\n `Wrote out ${totalProcessedManifests} node page manifest file${pluralize(\n totalProcessedManifests\n )}${\n totalFailedManifests > 0\n ? `. ${totalFailedManifests} manifest${pluralize(\n totalFailedManifests\n )} couldn't be processed.`\n : ``\n }`\n )\n\n // clean up all pending manifests from the store\n store.dispatch(internalActions.deleteNodeManifests())\n}\n"],"file":"node-manifest.js"}
1
+ {"version":3,"sources":["../../src/utils/node-manifest.ts"],"names":["findPageOwnedByNodeId","nodeId","state","store","getState","pages","nodes","byNode","queries","usingPagesMap","process","env","NODE_ENV","pagePathSetOrMap","get","pagePath","values","next","value","foundPageBy","ownerPagePath","foundOwnerNodeId","pathOrPageObject","path","fullPage","ownerNodeId","foundPageIdInContext","context","id","pageCreatedByPluginName","pluginCreatorId","name","pageCreatedByFilesystemPlugin","page","foundPageByToLogIds","none","queryTracking","warnAboutNodeManifestMappingProblems","inputManifest","logId","reporter","error","Error","getPageDataDigestForPagePath","directory","publicDirectory","join","program","pageData","pageDataDigest","e","warn","processNodeManifest","node","fullNode","pluginName","nodeManifestPage","finalManifest","gatsbySiteDirectory","fileNameBase","manifestId","platform","replace","manifestFilePath","manifestFileDir","dirname","fs","ensureDir","writeJSON","processNodeManifests","nodeManifests","totalManifests","length","processedManifests","Promise","all","map","manifest","totalProcessedManifests","totalFailedManifests","forEach","pluralize","info","dispatch","internalActions","deleteNodeManifests"],"mappings":";;;;;;;;;;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA0BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeA,qBAAf,CAAqC;AAAEC,EAAAA;AAAF,CAArC,EAGG;AAAA;;AACD,QAAMC,KAAK,GAAGC,aAAMC,QAAN,EAAd;;AACA,QAAM;AAAEC,IAAAA,K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BAAb,EAA+BN,aAA/B,CAAN;AAEA,SAAOA,aAAP;AACD;AAED;AACA;AACA;AACA;AACA;;;AACO,eAAeY,oBAAf,GAAqD;AAC1D,QAAM;AAAEC,IAAAA;AAAF,MAAoBnE,aAAMC,QAAN,EAA1B;;AAEA,QAAMmE,cAAc,GAAGD,aAAa,CAACE,MAArC;;AAEA,MAAID,cAAc,KAAK,CAAvB,EAA0B;AACxB;AACD;;AAED,QAAME,kBAAkB,GAAG,MAAMC,OAAO,CAACC,GAAR,CAC/BL,aAAa,CAACM,GAAd,CAAkBC,QAAQ,IAAIzB,mBAAmB,CAACyB,QAAD,CAAjD,CAD+B,CAAjC;AAIA,MAAIC,uBAAuB,GAAG,CAA9B;AACA,MAAIC,oBAAoB,GAAG,CAA3B;AAEAN,EAAAA,kBAAkB,CAACO,OAAnB,CAA2BH,QAAQ,IAAI;AACrC,QAAIA,QAAJ,EAAc;AACZC,MAAAA,uBAAuB;AACxB,KAFD,MAEO;AACLC,MAAAA,oBAAoB;AACrB;AACF,GAND;;AAQA,QAAME,SAAS,GAAIT,MAAD,IAChBA,MAAM,GAAG,CAAT,IAAcA,MAAM,KAAK,CAAzB,GAA8B,GAA9B,GAAoC,EADtC;;AAGAhC,oBAAS0C,IAAT,CACG,aAAYJ,uBAAwB,2BAA0BG,SAAS,CACtEH,uBADsE,CAEtE,GACAC,oBAAoB,GAAG,CAAvB,GACK,KAAIA,oBAAqB,YAAWE,SAAS,CAC5CF,oBAD4C,CAE5C,yBAHN,GAIK,EACN,EATH,EA3B0D,CAuC1D;;;AACA5E,eAAMgF,QAAN,CAAeC,yBAAgBC,mBAAhB,EAAf;AACD","sourcesContent":["import type { ErrorId } from \"gatsby-cli/lib/structured-errors/error-map\"\nimport { getNode } from \"./../datastore\"\nimport { IGatsbyPage, INodeManifest } from \"./../redux/types\"\nimport reporter from \"gatsby-cli/lib/reporter\"\nimport { store } from \"../redux/\"\nimport { internalActions } from \"../redux/actions\"\nimport path from \"path\"\nimport fs from \"fs-extra\"\nimport { readPageData } from \"./page-data\"\nimport { createContentDigest } from \"gatsby-core-utils\"\n\ninterface INodeManifestPage {\n path?: string\n}\n\n/**\n * This it the output after processing calls to the public unstable_createNodeManifest action\n */\ninterface INodeManifestOut {\n page: INodeManifestPage\n node: {\n id: string\n }\n foundPageBy: FoundPageBy\n pageDataDigest: string | null\n}\n\ntype FoundPageBy =\n | `ownerNodeId`\n | `filesystem-route-api`\n // for these three we warn to use ownerNodeId instead\n | `context.id`\n | `queryTracking`\n | `none`\n\n/**\n * Finds a final built page by nodeId\n *\n * Note that this function wont work properly in `gatsby develop`\n * since develop no longer runs all page queries when creating pages.\n * We use the node id to query mapping to find the right page but\n * this mapping only exists once you've visited a page in your browser.\n * When this fn is being used for routing to previews the user wont necessarily have\n * visited the page in the browser yet.\n */\nasync function findPageOwnedByNodeId({ nodeId }: { nodeId: string }): Promise<{\n page: INodeManifestPage\n foundPageBy: FoundPageBy\n}> {\n const state = store.getState()\n const { pages, nodes } = state\n const { byNode } = state.queries\n\n // in development queries are run on demand so we wont have an accurate nodeId->pages map until those pages are visited in the browser. We want this mapping before the page is visited in the browser so we can route to the right page in the browser.\n // So in development we can just use the Map of all pages (pagePath -> pageNode)\n // but for builds (preview inc builds or regular builds) we will have a full map\n // of all nodeId's to pages they're queried on and we can use that instead since it\n // will be a much smaller list of pages, resulting in better performance for large sites\n const usingPagesMap: boolean = `development` === process.env.NODE_ENV\n\n const pagePathSetOrMap = usingPagesMap\n ? // this is a Map of page path to page node\n pages\n : // this is a Set of page paths\n byNode?.get(nodeId)\n\n // the default page path is the first page found in\n // node id to page query tracking\n let pagePath = byNode?.get(nodeId)?.values()?.next()?.value\n\n let foundPageBy: FoundPageBy = pagePath ? `queryTracking` : `none`\n\n if (pagePathSetOrMap) {\n let ownerPagePath: string | undefined\n let foundOwnerNodeId = false\n\n // for each page this nodeId is queried in\n for (const pathOrPageObject of pagePathSetOrMap.values()) {\n // if we haven't found a page with this nodeId\n // set as page.ownerNodeId then run this logic.\n // this condition is on foundOwnerNodeId instead of ownerPagePath\n // in case we find a page with the nodeId in page.context.id\n // and then later in the loop there's a page with this nodeId\n // set on page.ownerNodeId.\n // We always want to prefer ownerPagePath over context.id\n if (foundOwnerNodeId) {\n break\n }\n\n const path = (\n usingPagesMap\n ? // in development we're using a Map, so the value here is a page object\n (pathOrPageObject as IGatsbyPage).path\n : // in builds we're using a Set so the page path is the value\n pathOrPageObject\n ) as string\n\n const fullPage: IGatsbyPage | undefined = pages.get(path)\n\n foundOwnerNodeId = fullPage?.ownerNodeId === nodeId\n\n const foundPageIdInContext = fullPage?.context.id === nodeId\n\n if (foundOwnerNodeId) {\n foundPageBy = `ownerNodeId`\n } else if (foundPageIdInContext && fullPage) {\n const pageCreatedByPluginName = nodes.get(\n fullPage.pluginCreatorId\n )?.name\n\n const pageCreatedByFilesystemPlugin =\n pageCreatedByPluginName === `gatsby-plugin-page-creator`\n\n foundPageBy = pageCreatedByFilesystemPlugin\n ? `filesystem-route-api`\n : `context.id`\n }\n\n if (\n fullPage &&\n // first check for the ownerNodeId on the page. this is\n // the defacto owner. Can't get more specific than this\n (foundOwnerNodeId ||\n // if there's no specified owner look to see if\n // pageContext has an `id` variable which matches our\n // nodeId. Using an \"id\" as a variable in queries is common\n // and if we don't have an owner this is a better guess\n // of an owner than grabbing the first page query we find\n // that's mapped to this node id.\n // this also makes this work with the filesystem Route API without\n // changing that API.\n foundPageIdInContext)\n ) {\n // save this path to use in our manifest!\n ownerPagePath = fullPage.path\n }\n }\n\n if (ownerPagePath) {\n pagePath = ownerPagePath\n }\n }\n\n return {\n page: {\n path: pagePath || null,\n },\n foundPageBy,\n }\n}\n\n// these id's correspond to error id's in\n// packages/gatsby-cli/src/structured-errors/error-map.ts\nexport const foundPageByToLogIds = {\n none: `11801`,\n [`context.id`]: `11802`,\n queryTracking: `11803`,\n [`filesystem-route-api`]: `success`,\n ownerNodeId: `success`,\n}\n\n/**\n * Takes in some info about a node manifest and the page we did or didn't find for it, then warns and returns the warning string\n */\nexport function warnAboutNodeManifestMappingProblems({\n inputManifest,\n pagePath,\n foundPageBy,\n}: {\n inputManifest: INodeManifest\n pagePath?: string\n foundPageBy: FoundPageBy\n}): { logId: string } {\n let logId: ErrorId | `success`\n\n switch (foundPageBy) {\n case `none`:\n case `context.id`:\n case `queryTracking`: {\n logId = foundPageByToLogIds[foundPageBy]\n reporter.error({\n id: logId,\n context: {\n inputManifest,\n pagePath,\n },\n })\n break\n }\n\n case `filesystem-route-api`:\n case `ownerNodeId`:\n logId = `success`\n break\n\n default: {\n throw Error(`Node Manifest mapping is in an impossible state`)\n }\n }\n\n return {\n logId,\n }\n}\n\n/**\n * Retrieves the content digest of a page-data.json file for use in creating node manifest files.\n */\nexport async function getPageDataDigestForPagePath(\n pagePath?: string,\n directory?: string\n): Promise<string | null> {\n if (\n // if no page was created for the node we're creating a manifest for, there wont be a page path.\n !pagePath ||\n // we only add page data digests to node manifests in production because page-data.json may not exist in development.\n (process.env.NODE_ENV !== `production` && process.env.NODE_ENV !== `test`)\n ) {\n return null\n }\n\n try {\n const publicDirectory = path.join(\n directory || store.getState().program.directory,\n `public`\n )\n const pageData = await readPageData(publicDirectory, pagePath)\n\n const pageDataDigest = createContentDigest(pageData)\n\n return pageDataDigest\n } catch (e) {\n reporter.warn(\n `No page-data.json found for ${pagePath} while processing node manifests.`\n )\n\n return null\n }\n}\n\n/**\n * Prepares and then writes out an individual node manifest file to be used for routing to previews. Manifest files are added via the public unstable_createNodeManifest action\n */\nexport async function processNodeManifest(\n inputManifest: INodeManifest\n): Promise<null | INodeManifestOut> {\n const nodeId = inputManifest.node.id\n const fullNode = getNode(nodeId)\n\n if (!fullNode) {\n reporter.warn(\n `Plugin ${inputManifest.pluginName} called unstable_createNodeManifest for a node which doesn't exist with an id of ${nodeId}.`\n )\n return null\n }\n\n // map the node to a page that was created\n const { page: nodeManifestPage, foundPageBy } = await findPageOwnedByNodeId({\n nodeId,\n })\n\n warnAboutNodeManifestMappingProblems({\n inputManifest,\n pagePath: nodeManifestPage.path,\n foundPageBy,\n })\n\n const pageDataDigest = await getPageDataDigestForPagePath(\n nodeManifestPage.path\n )\n\n const finalManifest: INodeManifestOut = {\n node: inputManifest.node,\n page: nodeManifestPage,\n foundPageBy,\n pageDataDigest,\n }\n\n const gatsbySiteDirectory = store.getState().program.directory\n\n let fileNameBase = inputManifest.manifestId\n\n /**\n * Windows has a handful of special/reserved characters that are not valid in a file path\n * @reference https://superuser.com/questions/358855/what-characters-are-safe-in-cross-platform-file-names-for-linux-windows-and-os\n *\n * The two exceptions to the list linked above are\n * - the colon that is part of the hard disk partition name at the beginning of a file path (i.e. C:)\n * - backslashes. We don't want to replace backslashes because those are used to delineate what the actual file path is\n *\n * During local development, node manifests can be written to disk but are generally unused as they are only used\n * for Content Sync which runs in Gatsby Cloud. Gatsby cloud is a Linux environment in which these special chars are valid in\n * filepaths. To avoid errors on Windows, we replace all instances of the special chars in the filepath (with the exception of the\n * hard disk partition name) with \"-\" to ensure that local Windows development setups do not break when attempting\n * to write one of these manifests to disk.\n */\n if (process.platform === `win32`) {\n fileNameBase = fileNameBase.replace(/:|\\/|\\*|\\?|\"|<|>|\\||\\\\/g, `-`)\n }\n\n // write out the manifest file\n const manifestFilePath = path.join(\n gatsbySiteDirectory,\n `public`,\n `__node-manifests`,\n inputManifest.pluginName,\n `${fileNameBase}.json`\n )\n\n const manifestFileDir = path.dirname(manifestFilePath)\n\n await fs.ensureDir(manifestFileDir)\n await fs.writeJSON(manifestFilePath, finalManifest)\n\n return finalManifest\n}\n\n/**\n * Grabs all pending node manifests, processes them, writes them to disk,\n * and then removes them from the store.\n * Manifest files are added via the public unstable_createNodeManifest action in sourceNodes\n */\nexport async function processNodeManifests(): Promise<void> {\n const { nodeManifests } = store.getState()\n\n const totalManifests = nodeManifests.length\n\n if (totalManifests === 0) {\n return\n }\n\n const processedManifests = await Promise.all(\n nodeManifests.map(manifest => processNodeManifest(manifest))\n )\n\n let totalProcessedManifests = 0\n let totalFailedManifests = 0\n\n processedManifests.forEach(manifest => {\n if (manifest) {\n totalProcessedManifests++\n } else {\n totalFailedManifests++\n }\n })\n\n const pluralize = (length: number): string =>\n length > 1 || length === 0 ? `s` : ``\n\n reporter.info(\n `Wrote out ${totalProcessedManifests} node page manifest file${pluralize(\n totalProcessedManifests\n )}${\n totalFailedManifests > 0\n ? `. ${totalFailedManifests} manifest${pluralize(\n totalFailedManifests\n )} couldn't be processed.`\n : ``\n }`\n )\n\n // clean up all pending manifests from the store\n store.dispatch(internalActions.deleteNodeManifests())\n}\n"],"file":"node-manifest.js"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gatsby",
3
3
  "description": "Blazing fast modern site generator for React",
4
- "version": "4.1.2",
4
+ "version": "4.1.6",
5
5
  "author": "Kyle Mathews <mathews.kyle@gmail.com>",
6
6
  "bin": {
7
7
  "gatsby": "./cli.js"
@@ -34,8 +34,8 @@
34
34
  "babel-plugin-add-module-exports": "^1.0.4",
35
35
  "babel-plugin-dynamic-import-node": "^2.3.3",
36
36
  "babel-plugin-lodash": "^3.3.4",
37
- "babel-plugin-remove-graphql-queries": "^4.1.0",
38
- "babel-preset-gatsby": "^2.1.0",
37
+ "babel-plugin-remove-graphql-queries": "^4.1.3",
38
+ "babel-preset-gatsby": "^2.1.3",
39
39
  "better-opn": "^2.1.1",
40
40
  "bluebird": "^3.7.2",
41
41
  "body-parser": "^1.19.0",
@@ -77,16 +77,16 @@
77
77
  "find-cache-dir": "^3.3.2",
78
78
  "fs-exists-cached": "1.0.0",
79
79
  "fs-extra": "^10.0.0",
80
- "gatsby-cli": "^4.1.1",
81
- "gatsby-core-utils": "^3.1.0",
80
+ "gatsby-cli": "^4.1.4",
81
+ "gatsby-core-utils": "^3.1.3",
82
82
  "gatsby-graphiql-explorer": "^2.1.0",
83
83
  "gatsby-legacy-polyfills": "^2.1.0",
84
84
  "gatsby-link": "^4.1.0",
85
- "gatsby-plugin-page-creator": "^4.1.1",
86
- "gatsby-plugin-typescript": "^4.1.0",
85
+ "gatsby-plugin-page-creator": "^4.1.4",
86
+ "gatsby-plugin-typescript": "^4.1.3",
87
87
  "gatsby-plugin-utils": "^2.1.1",
88
88
  "gatsby-react-router-scroll": "^5.1.0",
89
- "gatsby-telemetry": "^3.1.0",
89
+ "gatsby-telemetry": "^3.1.3",
90
90
  "gatsby-worker": "^1.1.0",
91
91
  "glob": "^7.2.0",
92
92
  "got": "^11.8.2",
@@ -258,5 +258,5 @@
258
258
  "yargs": {
259
259
  "boolean-negation": false
260
260
  },
261
- "gitHead": "3b06677ed9e402042bd565b1c142e6016baa9a55"
261
+ "gitHead": "87ca0dfe7590b533dfbdf4bc28068e8125b8a7fa"
262
262
  }