gatsby 2.19.45 → 2.19.49
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 +21 -0
- package/dist/bootstrap/index.js +3 -1
- package/dist/bootstrap/index.js.map +1 -1
- package/dist/commands/build-utils.js +25 -21
- package/dist/commands/build-utils.js.map +1 -1
- package/dist/commands/build.js +10 -17
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/develop.js +2 -2
- package/dist/commands/develop.js.map +1 -1
- package/dist/redux/actions/public.js +3 -1
- package/dist/redux/actions/public.js.map +1 -1
- package/dist/schema/types/built-in-types.js +6 -7
- package/dist/schema/types/built-in-types.js.map +1 -1
- package/dist/utils/api-browser-docs.js +1 -1
- package/dist/utils/api-browser-docs.js.map +1 -1
- package/dist/utils/create-schema-customization.js +12 -7
- package/dist/utils/create-schema-customization.js.map +1 -1
- package/dist/utils/feedback.js +17 -9
- package/dist/utils/feedback.js.map +1 -1
- package/dist/utils/tracer/index.js +18 -16
- package/dist/utils/tracer/index.js.map +1 -1
- package/dist/utils/webpack-error-utils.js +9 -2
- package/dist/utils/webpack-error-utils.js.map +1 -1
- package/dist/utils/webpack-plugins.js +10 -5
- package/dist/utils/webpack-plugins.js.map +1 -1
- package/dist/utils/webpack-utils.js +8 -8
- package/dist/utils/webpack-utils.js.map +1 -1
- package/index.d.ts +1 -1
- package/package.json +11 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/develop.ts"],"names":["REGEX_IP","setTimeout","telemetry","trackCli","startServer","program","indexHTMLActivity","report","phantomActivity","start","directory","directoryPath","workerPool","WorkerPool","create","createIndexHtml","activity","stage","BuildHTMLStage","DevelopHTML","pagePaths","err","name","panic","stripIndent","end","webpackActivity","activityTimer","id","devConfig","port","parentSpan","span","compiler","app","use","expressMiddleware","log","path","heartbeat","graphqlEndpoint","process","env","GATSBY_GRAPHQL_IDE","get","endpoint","schema","schemaCustomization","store","getState","graphiql","context","schemaComposer","composer","customContext","customFormatErrorFn","stack","split","REFRESH_ENDPOINT","refresh","req","webhookBody","body","express","json","post","res","enableRefresh","ENABLE_GATSBY_REFRESH_ENDPOINT","refreshToken","GATSBY_REFRESH_TOKEN","authorizedRefresh","headers","authorization","query","fileName","lineNumber","index","logLevel","publicPath","output","watchOptions","devServer","stats","developMiddleware","config","proxy","forEach","prefix","url","proxiedUrl","originalUrl","method","pipe","got","stream","decompress","on","response","writeHead","statusCode","_","message","error","sendStatus","status","sendFile","server","ssl","https","createServer","http","Server","websocketManager","init","socket","getSocket","listener","listen","host","watchGlobs","map","chokidar","watch","to","emit","module","exports","exit","GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES","chalk","yellow","cyan","openTracingConfigFile","pendingActivity","startBackgroundUpdate","parseInt","e","sslHost","test","certFile","keyFile","graphqlRunner","queryUtil","initialProcessQueries","require","boundActionCreators","setProgramStatus","db","saveState","requiresWriter","startListener","startAutosave","startListeningToDevelopQueue","queryWatcher","startWatchDeletePage","prepareUrls","protocol","formatUrl","hostname","format","pathname","prettyPrintUrl","bold","String","isUnspecifiedHost","prettyHost","lanUrlForConfig","lanUrlForTerminal","address","ip","undefined","_e","localUrlForTerminal","localUrlForBrowser","printInstructions","appName","urls","console","printDeprecationWarnings","deprecatedApis","fixMap","newName","docsLink","pathContext","deprecatedLocations","glob","sync","nodir","file","fileText","fs","readFileSync","matchingApis","filter","api","includes","push","length","hooks","watchRun","tapAsync","done","isFirstCompile","messages","toJson","isSuccessful","errors","sitePackageJson","open","Promise","resolve","catch","compilation","panicOnBuild"],"mappings":";;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;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AMgL,YAAY,GAAG,CAACF,QAAQ,CAACG,MAAT,CAAgBT,MAAtC;;AAEA,QAAIQ,YAAY,IAAIH,cAApB,EAAoC;AAClC5B,MAAAA,iBAAiB,CACf1K,OAAO,CAAC2M,eAAR,CAAwB1L,IAAxB,IAAiC,mBADlB,EAEf2J,IAFe,CAAjB;AAIAE,MAAAA,wBAAwB;;AACxB,UAAI9K,OAAO,CAAC4M,IAAZ,EAAkB;AAChBC,QAAAA,OAAO,CAACC,OAAR,CAAgB,wBAAQlC,IAAI,CAACH,kBAAb,CAAhB,EAAkDsC,KAAlD,CAAwD,MACtDlC,OAAO,CAAC7I,GAAR,CACG,GAAE6F,eAAMC,MAAN,CACA,MADA,CAED,kDAHJ,CADF;AAOD;AACF;;AAEDwE,IAAAA,cAAc,GAAG,KAAjB;;AAEA,QAAIjL,eAAJ,EAAqB;AACnB,oDAAsByD,KAAtB;;AAEA,UAAI,CAAC2H,YAAL,EAAmB;AACjB,cAAMC,MAAM,GAAG,+CACZ,SADY,EAEb5H,KAAK,CAACkI,WAAN,CAAkBN,MAFL,CAAf;AAIArL,QAAAA,eAAe,CAAC4L,YAAhB,CAA6BP,MAA7B;AACD;;AACDrL,MAAAA,eAAe,CAACD,GAAhB;AACAC,MAAAA,eAAe,GAAG,IAAlB;AACD;;AAEDgL,IAAAA,IAAI;AACL,GAjDD;AAkDD,CA3UD","sourcesContent":["import url from \"url\"\nimport fs from \"fs\"\nimport openurl from \"better-opn\"\nimport chokidar from \"chokidar\"\n\nimport webpackHotMiddleware from \"webpack-hot-middleware\"\nimport webpackDevMiddleware from \"webpack-dev-middleware\"\nimport glob from \"glob\"\nimport express from \"express\"\nimport got from \"got\"\nimport webpack from \"webpack\"\nimport graphqlHTTP from \"express-graphql\"\nimport graphqlPlayground from \"graphql-playground-middleware-express\"\nimport graphiqlExplorer from \"gatsby-graphiql-explorer\"\nimport { formatError } from \"graphql\"\n\nimport webpackConfig from \"../utils/webpack.config\"\nimport bootstrap from \"../bootstrap\"\nimport { store } from \"../redux\"\nimport { syncStaticDir } from \"../utils/get-static-dir\"\nimport { buildHTML } from \"./build-html\"\nimport { withBasePath } from \"../utils/path\"\nimport report from \"gatsby-cli/lib/reporter\"\nimport launchEditor from \"react-dev-utils/launchEditor\"\nimport formatWebpackMessages from \"react-dev-utils/formatWebpackMessages\"\nimport chalk from \"chalk\"\nimport address from \"address\"\nimport cors from \"cors\"\nimport telemetry from \"gatsby-telemetry\"\nimport * as WorkerPool from \"../utils/worker/pool\"\nimport http from \"http\"\nimport https from \"https\"\n\nimport bootstrapSchemaHotReloader from \"../bootstrap/schema-hot-reloader\"\nimport bootstrapPageHotReloader from \"../bootstrap/page-hot-reloader\"\nimport { developStatic } from \"./develop-static\"\nimport withResolverContext from \"../schema/context\"\nimport sourceNodes from \"../utils/source-nodes\"\nimport createSchemaCustomization from \"../utils/create-schema-customization\"\nimport websocketManager from \"../utils/websocket-manager\"\nimport getSslCert from \"../utils/get-ssl-cert\"\nimport { slash } from \"gatsby-core-utils\"\nimport { initTracer } from \"../utils/tracer\"\nimport apiRunnerNode from \"../utils/api-runner-node\"\nimport db from \"../db\"\nimport { detectPortInUseAndPrompt } from \"../utils/detect-port-in-use-and-prompt\"\nimport onExit from \"signal-exit\"\nimport queryUtil from \"../query\"\nimport queryWatcher from \"../query/query-watcher\"\nimport requiresWriter from \"../bootstrap/requires-writer\"\nimport {\n reportWebpackWarnings,\n structureWebpackErrors,\n} from \"../utils/webpack-error-utils\"\nimport { waitUntilAllJobsComplete } from \"../utils/wait-until-jobs-complete\"\nimport {\n userPassesFeedbackRequestHeuristic,\n showFeedbackRequest,\n} from \"../utils/feedback\"\n\nimport { BuildHTMLStage, IProgram } from \"./types\"\n\n// checks if a string is a valid ip\nconst REGEX_IP = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])$/\n\n// const isInteractive = process.stdout.isTTY\n\n// Watch the static directory and copy files to public as they're added or\n// changed. Wait 10 seconds so copying doesn't interfere with the regular\n// bootstrap.\nsetTimeout(() => {\n syncStaticDir()\n}, 10000)\n\nonExit(() => {\n telemetry.trackCli(`DEVELOP_STOP`)\n})\n\ntype ActivityTracker = any // TODO: Replace this with proper type once reporter is typed\n\ninterface IServer {\n compiler: webpack.Compiler\n listener: http.Server | https.Server\n webpackActivity: ActivityTracker\n}\n\nasync function startServer(program: IProgram): Promise<IServer> {\n const indexHTMLActivity = report.phantomActivity(`building index.html`, {})\n indexHTMLActivity.start()\n const directory = program.directory\n const directoryPath = withBasePath(directory)\n const workerPool = WorkerPool.create()\n const createIndexHtml = async (activity: ActivityTracker): Promise<void> => {\n try {\n await buildHTML({\n program,\n stage: BuildHTMLStage.DevelopHTML,\n pagePaths: [`/`],\n workerPool,\n activity,\n })\n } catch (err) {\n if (err.name !== `WebpackError`) {\n report.panic(err)\n return\n }\n report.panic(\n report.stripIndent`\n There was an error compiling the html.js component for the development server.\n\n See our docs page on debugging HTML builds for help https://gatsby.dev/debug-html\n `,\n err\n )\n }\n }\n\n await createIndexHtml(indexHTMLActivity)\n\n indexHTMLActivity.end()\n\n // report.stateUpdate(`webpack`, `IN_PROGRESS`)\n\n const webpackActivity = report.activityTimer(`Building development bundle`, {\n id: `webpack-develop`,\n })\n webpackActivity.start()\n\n const devConfig = await webpackConfig(\n program,\n directory,\n `develop`,\n program.port,\n { parentSpan: webpackActivity.span }\n )\n\n const compiler = webpack(devConfig)\n\n /**\n * Set up the express app.\n **/\n const app = express()\n app.use(telemetry.expressMiddleware(`DEVELOP`))\n app.use(\n webpackHotMiddleware(compiler, {\n log: false,\n path: `/__webpack_hmr`,\n heartbeat: 10 * 1000,\n })\n )\n\n app.use(cors())\n\n /**\n * Pattern matching all endpoints with graphql or graphiql with 1 or more leading underscores\n */\n const graphqlEndpoint = `/_+graphi?ql`\n\n if (process.env.GATSBY_GRAPHQL_IDE === `playground`) {\n app.get(\n graphqlEndpoint,\n graphqlPlayground({\n endpoint: `/___graphql`,\n }),\n () => {}\n )\n } else {\n graphiqlExplorer(app, {\n graphqlEndpoint,\n })\n }\n\n app.use(\n graphqlEndpoint,\n graphqlHTTP(\n (): graphqlHTTP.OptionsData => {\n const { schema, schemaCustomization } = store.getState()\n\n return {\n schema,\n graphiql: false,\n context: withResolverContext({\n schema,\n schemaComposer: schemaCustomization.composer,\n context: {},\n customContext: schemaCustomization.context,\n }),\n customFormatErrorFn(err): unknown {\n return {\n ...formatError(err),\n stack: err.stack ? err.stack.split(`\\n`) : [],\n }\n },\n }\n }\n )\n )\n\n /**\n * Refresh external data sources.\n * This behavior is disabled by default, but the ENABLE_REFRESH_ENDPOINT env var enables it\n * If no GATSBY_REFRESH_TOKEN env var is available, then no Authorization header is required\n **/\n const REFRESH_ENDPOINT = `/__refresh`\n const refresh = async (req: express.Request): Promise<void> => {\n let activity = report.activityTimer(`createSchemaCustomization`, {})\n activity.start()\n await createSchemaCustomization({\n refresh: true,\n })\n activity.end()\n activity = report.activityTimer(`Refreshing source data`, {})\n activity.start()\n await sourceNodes({\n webhookBody: req.body,\n })\n activity.end()\n }\n app.use(REFRESH_ENDPOINT, express.json())\n app.post(REFRESH_ENDPOINT, (req, res) => {\n const enableRefresh = process.env.ENABLE_GATSBY_REFRESH_ENDPOINT\n const refreshToken = process.env.GATSBY_REFRESH_TOKEN\n const authorizedRefresh =\n !refreshToken || req.headers.authorization === refreshToken\n\n if (enableRefresh && authorizedRefresh) {\n refresh(req)\n }\n res.end()\n })\n\n app.get(`/__open-stack-frame-in-editor`, (req, res) => {\n launchEditor(req.query.fileName, req.query.lineNumber)\n res.end()\n })\n\n // Disable directory indexing i.e. serving index.html from a directory.\n // This can lead to serving stale html files during development.\n //\n // We serve by default an empty index.html that sets up the dev environment.\n app.use(developStatic(`public`, { index: false }))\n\n app.use(\n webpackDevMiddleware(compiler, {\n logLevel: `silent`,\n publicPath: devConfig.output.publicPath,\n watchOptions: devConfig.devServer\n ? devConfig.devServer.watchOptions\n : null,\n stats: `errors-only`,\n })\n )\n\n // Expose access to app for advanced use cases\n const { developMiddleware } = store.getState().config\n\n if (developMiddleware) {\n developMiddleware(app, program)\n }\n\n // Set up API proxy.\n const { proxy } = store.getState().config\n if (proxy) {\n proxy.forEach(({ prefix, url }) => {\n app.use(`${prefix}/*`, (req, res) => {\n const proxiedUrl = url + req.originalUrl\n const {\n // remove `host` from copied headers\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n headers: { host, ...headers },\n method,\n } = req\n req\n .pipe(\n got\n .stream(proxiedUrl, { headers, method, decompress: false })\n .on(`response`, response =>\n res.writeHead(response.statusCode || 200, response.headers)\n )\n .on(`error`, (err, _, response) => {\n if (response) {\n res.writeHead(response.statusCode || 400, response.headers)\n } else {\n const message = `Error when trying to proxy request \"${req.originalUrl}\" to \"${proxiedUrl}\"`\n\n report.error(message, err)\n res.sendStatus(500)\n }\n })\n )\n .pipe(res)\n })\n })\n }\n\n await apiRunnerNode(`onCreateDevServer`, { app })\n\n // In case nothing before handled hot-update - send 404.\n // This fixes \"Unexpected token < in JSON at position 0\" runtime\n // errors after restarting development server and\n // cause automatic hard refresh in the browser.\n app.use(/.*\\.hot-update\\.json$/i, (_, res) => {\n res.status(404).end()\n })\n\n // Render an HTML page and serve it.\n app.use((_, res) => {\n res.sendFile(directoryPath(`public/index.html`), err => {\n if (err) {\n res.status(500).end()\n }\n })\n })\n\n /**\n * Set up the HTTP server and socket.io.\n * If a SSL cert exists in program, use it with `createServer`.\n **/\n const server = program.ssl\n ? https.createServer(program.ssl, app)\n : new http.Server(app)\n\n websocketManager.init({ server, directory: program.directory })\n const socket = websocketManager.getSocket()\n\n const listener = server.listen(program.port, program.host)\n\n // Register watcher that rebuilds index.html every time html.js changes.\n const watchGlobs = [`src/html.js`, `plugins/**/gatsby-ssr.js`].map(path =>\n slash(directoryPath(path))\n )\n\n chokidar.watch(watchGlobs).on(`change`, async () => {\n await createIndexHtml(indexHTMLActivity)\n socket.to(`clients`).emit(`reload`)\n })\n\n return { compiler, listener, webpackActivity }\n}\n\nmodule.exports = async (program: IProgram): Promise<void> => {\n // We want to prompt the feedback request when users quit develop\n // assuming they pass the heuristic check to know they are a user\n // we want to request feedback from, and we're not annoying them.\n process.on(\n `SIGINT`,\n async (): Promise<void> => {\n if (await userPassesFeedbackRequestHeuristic()) {\n showFeedbackRequest()\n }\n process.exit(0)\n }\n )\n\n if (process.env.GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES) {\n report.panic(\n `The flag ${chalk.yellow(\n `GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES`\n )} is not available with ${chalk.cyan(\n `gatsby develop`\n )}, please retry using ${chalk.cyan(`gatsby build`)}`\n )\n }\n initTracer(program.openTracingConfigFile)\n report.pendingActivity({ id: `webpack-develop` })\n telemetry.trackCli(`DEVELOP_START`)\n telemetry.startBackgroundUpdate()\n\n const port =\n typeof program.port === `string` ? parseInt(program.port, 10) : program.port\n\n // In order to enable custom ssl, --cert-file --key-file and -https flags must all be\n // used together\n if ((program[`cert-file`] || program[`key-file`]) && !program.https) {\n report.panic(\n `for custom ssl --https, --cert-file, and --key-file must be used together`\n )\n }\n\n try {\n program.port = await detectPortInUseAndPrompt(port)\n } catch (e) {\n if (e.message === `USER_REJECTED`) {\n process.exit(0)\n }\n\n throw e\n }\n\n // Check if https is enabled, then create or get SSL cert.\n // Certs are named 'devcert' and issued to the host.\n if (program.https) {\n const sslHost =\n program.host === `0.0.0.0` || program.host === `::`\n ? `localhost`\n : program.host\n\n if (REGEX_IP.test(sslHost)) {\n report.panic(\n `You're trying to generate a ssl certificate for an IP (${sslHost}). Please use a hostname instead.`\n )\n }\n\n program.ssl = await getSslCert({\n name: sslHost,\n certFile: program[`cert-file`],\n keyFile: program[`key-file`],\n directory: program.directory,\n })\n }\n\n // Start bootstrap process.\n const { graphqlRunner } = await bootstrap(program)\n\n // Start the createPages hot reloader.\n bootstrapPageHotReloader(graphqlRunner)\n\n // Start the schema hot reloader.\n bootstrapSchemaHotReloader()\n\n await queryUtil.initialProcessQueries()\n\n require(`../redux/actions`).boundActionCreators.setProgramStatus(\n `BOOTSTRAP_QUERY_RUNNING_FINISHED`\n )\n await db.saveState()\n\n await waitUntilAllJobsComplete()\n requiresWriter.startListener()\n db.startAutosave()\n queryUtil.startListeningToDevelopQueue()\n queryWatcher.startWatchDeletePage()\n\n let { compiler, webpackActivity } = await startServer(program)\n\n interface IPreparedUrls {\n lanUrlForConfig: string\n lanUrlForTerminal: string\n localUrlForTerminal: string\n localUrlForBrowser: string\n }\n\n function prepareUrls(\n protocol: `http` | `https`,\n host: string,\n port: number\n ): IPreparedUrls {\n const formatUrl = (hostname: string): string =>\n url.format({\n protocol,\n hostname,\n port,\n pathname: `/`,\n })\n const prettyPrintUrl = (hostname: string): string =>\n url.format({\n protocol,\n hostname,\n port: chalk.bold(String(port)),\n pathname: `/`,\n })\n\n const isUnspecifiedHost = host === `0.0.0.0` || host === `::`\n let prettyHost = host\n let lanUrlForConfig\n let lanUrlForTerminal\n if (isUnspecifiedHost) {\n prettyHost = `localhost`\n\n try {\n // This can only return an IPv4 address\n lanUrlForConfig = address.ip()\n if (lanUrlForConfig) {\n // Check if the address is a private ip\n // https://en.wikipedia.org/wiki/Private_network#Private_IPv4_address_spaces\n if (\n /^10[.]|^172[.](1[6-9]|2[0-9]|3[0-1])[.]|^192[.]168[.]/.test(\n lanUrlForConfig\n )\n ) {\n // Address is private, format it for later use\n lanUrlForTerminal = prettyPrintUrl(lanUrlForConfig)\n } else {\n // Address is not private, so we will discard it\n lanUrlForConfig = undefined\n }\n }\n } catch (_e) {\n // ignored\n }\n }\n // TODO collect errors (GraphQL + Webpack) in Redux so we\n // can clear terminal and print them out on every compile.\n // Borrow pretty printing code from webpack plugin.\n const localUrlForTerminal = prettyPrintUrl(prettyHost)\n const localUrlForBrowser = formatUrl(prettyHost)\n return {\n lanUrlForConfig,\n lanUrlForTerminal,\n localUrlForTerminal,\n localUrlForBrowser,\n }\n }\n\n function printInstructions(appName: string, urls: IPreparedUrls): void {\n console.log()\n console.log(`You can now view ${chalk.bold(appName)} in the browser.`)\n console.log()\n\n if (urls.lanUrlForTerminal) {\n console.log(\n ` ${chalk.bold(`Local:`)} ${urls.localUrlForTerminal}`\n )\n console.log(\n ` ${chalk.bold(`On Your Network:`)} ${urls.lanUrlForTerminal}`\n )\n } else {\n console.log(` ${urls.localUrlForTerminal}`)\n }\n\n console.log()\n console.log(\n `View ${\n process.env.GATSBY_GRAPHQL_IDE === `playground`\n ? `the GraphQL Playground`\n : `GraphiQL`\n }, an in-browser IDE, to explore your site's data and schema`\n )\n console.log()\n\n if (urls.lanUrlForTerminal) {\n console.log(\n ` ${chalk.bold(`Local:`)} ${\n urls.localUrlForTerminal\n }___graphql`\n )\n console.log(\n ` ${chalk.bold(`On Your Network:`)} ${\n urls.lanUrlForTerminal\n }___graphql`\n )\n } else {\n console.log(` ${urls.localUrlForTerminal}___graphql`)\n }\n\n console.log()\n console.log(`Note that the development build is not optimized.`)\n console.log(\n `To create a production build, use ` + `${chalk.cyan(`gatsby build`)}`\n )\n console.log()\n }\n\n function printDeprecationWarnings(): void {\n type DeprecatedAPIList = [\"boundActionCreators\", \"pathContext\"] // eslint-disable-line\n const deprecatedApis: DeprecatedAPIList = [\n `boundActionCreators`,\n `pathContext`,\n ]\n const fixMap = {\n boundActionCreators: {\n newName: `actions`,\n docsLink: `https://gatsby.dev/boundActionCreators`,\n },\n pathContext: {\n newName: `pageContext`,\n docsLink: `https://gatsby.dev/pathContext`,\n },\n }\n const deprecatedLocations = {\n boundActionCreators: [] as string[],\n pathContext: [] as string[],\n }\n\n glob\n .sync(`{,!(node_modules|public)/**/}*.js`, { nodir: true })\n .forEach(file => {\n const fileText = fs.readFileSync(file)\n const matchingApis = deprecatedApis.filter(api =>\n fileText.includes(api)\n )\n matchingApis.forEach(api => deprecatedLocations[api].push(file))\n })\n\n deprecatedApis.forEach(api => {\n if (deprecatedLocations[api].length) {\n console.log(\n `%s %s %s %s`,\n chalk.cyan(api),\n chalk.yellow(`is deprecated. Please use`),\n chalk.cyan(fixMap[api].newName),\n chalk.yellow(\n `instead. For migration instructions, see ${fixMap[api].docsLink}\\nCheck the following files:`\n )\n )\n console.log()\n deprecatedLocations[api].forEach(file => console.log(file))\n console.log()\n }\n })\n }\n\n // compiler.hooks.invalid.tap(`log compiling`, function(...args) {\n // console.log(`set invalid`, args, this)\n // })\n\n compiler.hooks.watchRun.tapAsync(`log compiling`, function(_, done) {\n if (webpackActivity) {\n webpackActivity.end()\n }\n webpackActivity = report.activityTimer(`Re-building development bundle`, {\n id: `webpack-develop`,\n })\n webpackActivity.start()\n\n done()\n })\n\n let isFirstCompile = true\n // \"done\" event fires when Webpack has finished recompiling the bundle.\n // Whether or not you have warnings or errors, you will get this event.\n compiler.hooks.done.tapAsync(`print gatsby instructions`, function(\n stats,\n done\n ) {\n // We have switched off the default Webpack output in WebpackDevServer\n // options so we are going to \"massage\" the warnings and errors and present\n // them in a readable focused way.\n const messages = formatWebpackMessages(stats.toJson({}, true))\n const urls = prepareUrls(\n program.ssl ? `https` : `http`,\n program.host,\n program.port\n )\n const isSuccessful = !messages.errors.length\n\n if (isSuccessful && isFirstCompile) {\n printInstructions(\n program.sitePackageJson.name || `(Unnamed package)`,\n urls\n )\n printDeprecationWarnings()\n if (program.open) {\n Promise.resolve(openurl(urls.localUrlForBrowser)).catch(() =>\n console.log(\n `${chalk.yellow(\n `warn`\n )} Browser not opened because no browser was found`\n )\n )\n }\n }\n\n isFirstCompile = false\n\n if (webpackActivity) {\n reportWebpackWarnings(stats)\n\n if (!isSuccessful) {\n const errors = structureWebpackErrors(\n `develop`,\n stats.compilation.errors\n )\n webpackActivity.panicOnBuild(errors)\n }\n webpackActivity.end()\n webpackActivity = null\n }\n\n done()\n })\n}\n"],"file":"develop.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/commands/develop.ts"],"names":["REGEX_IP","setTimeout","telemetry","trackCli","startServer","program","indexHTMLActivity","report","phantomActivity","start","directory","directoryPath","workerPool","WorkerPool","create","createIndexHtml","activity","stage","BuildHTMLStage","DevelopHTML","pagePaths","err","name","panic","stripIndent","end","webpackActivity","activityTimer","id","devConfig","port","parentSpan","span","compiler","app","use","expressMiddleware","log","path","heartbeat","graphqlEndpoint","process","env","GATSBY_GRAPHQL_IDE","get","endpoint","schema","schemaCustomization","store","getState","graphiql","context","schemaComposer","composer","customContext","customFormatErrorFn","stack","split","REFRESH_ENDPOINT","refresh","req","webhookBody","body","express","json","post","res","enableRefresh","ENABLE_GATSBY_REFRESH_ENDPOINT","refreshToken","GATSBY_REFRESH_TOKEN","authorizedRefresh","headers","authorization","query","fileName","lineNumber","index","logLevel","publicPath","output","watchOptions","devServer","stats","developMiddleware","config","proxy","forEach","prefix","url","proxiedUrl","originalUrl","method","pipe","got","stream","decompress","on","response","writeHead","statusCode","_","message","error","sendStatus","status","sendFile","server","ssl","https","createServer","http","Server","websocketManager","init","socket","getSocket","listener","listen","host","watchGlobs","map","chokidar","watch","to","emit","module","exports","exit","GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES","chalk","yellow","cyan","openTracingConfigFile","pendingActivity","startBackgroundUpdate","parseInt","e","sslHost","test","certFile","keyFile","graphqlRunner","queryUtil","initialProcessQueries","require","boundActionCreators","setProgramStatus","db","saveState","requiresWriter","startListener","startAutosave","startListeningToDevelopQueue","queryWatcher","startWatchDeletePage","prepareUrls","protocol","formatUrl","hostname","format","pathname","prettyPrintUrl","bold","String","isUnspecifiedHost","prettyHost","lanUrlForConfig","lanUrlForTerminal","address","ip","undefined","_e","localUrlForTerminal","localUrlForBrowser","printInstructions","appName","urls","console","printDeprecationWarnings","deprecatedApis","fixMap","newName","docsLink","pathContext","deprecatedLocations","glob","sync","nodir","file","fileText","fs","readFileSync","matchingApis","filter","api","includes","push","length","hooks","watchRun","tapAsync","done","isFirstCompile","messages","toJson","isSuccessful","errors","sitePackageJson","open","Promise","resolve","catch","compilation","panicOnBuild"],"mappings":";;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AAKA;;AAEA;AACA,MAAMA,QAAQ,GAAG,2GAAjB,C,CAEA;AAEA;AACA;AACA;;AACAC,UAAU,CAAC,MAAM;AACf;AACD,CAFS,EAEP,KAFO,CAAV;AAIA,yBAAO,MAAM;AACXC,2BAAUC,QAAV,CAAoB,cAApB;AACD,CAFD;;AAYA,eAAeC,WAAf,CAA2BC,OAA3B,EAAgE;AAC9D,QAAMC,iBAAiB,GAAGC,kBAAOC,eAAP,CAAwB,qBAAxB,EAA8C,EAA9C,CAA1B;;AACAF,EAAAA,iBAAiB,CAACG,KAAlB;AACA,QAAMC,SAAS,GAAGL,OAAO,CAACK,SAA1B;AACA,QAAMC,aAAa,GAAG,wBAAaD,SAAb,CAAtB;AACA,QAAME,UAAU,GAAGC,UAAU,CAACC,MAAX,EAAnB;;AACA,QAAMC,eAAe,GAAG,MAAOC,QAAP,IAAoD;AAC1E,QAAI;AACF,YAAM,0BAAU;AACdX,QAAAA,OADc;AAEdY,QAAAA,KAAK,EAAEC,sBAAeC,WAFR;AAGdC,QAAAA,SAAS,EAAE,CAAE,GAAF,CAHG;AAIdR,QAAAA,UAJc;AAKdI,QAAAA;AALc,OAAV,CAAN;AAOD,KARD,CAQE,OAAOK,GAAP,EAAY;AACZ,UAAIA,GAAG,CAACC,IAAJ,KAAc,cAAlB,EAAiC;AAC/Bf,0BAAOgB,KAAP,CAAaF,GAAb;;AACA;AACD;;AACDd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D;AACA;AACA;AACA;AACA,UAAME,QAAQ,GAAG,oCAAsBzH,KAAK,CAAC0H,MAAN,CAAa,EAAb,EAAiB,IAAjB,CAAtB,CAAjB;AACA,UAAM5B,IAAI,GAAGrB,WAAW,CACtBvJ,OAAO,CAACuG,GAAR,GAAe,OAAf,GAAyB,MADH,EAEtBvG,OAAO,CAACkH,IAFc,EAGtBlH,OAAO,CAACyB,IAHc,CAAxB;AAKA,UAAMgL,YAAY,GAAG,CAACF,QAAQ,CAACG,MAAT,CAAgBT,MAAtC;;AAEA,QAAIQ,YAAY,IAAIH,cAApB,EAAoC;AAClC5B,MAAAA,iBAAiB,CACf1K,OAAO,CAAC2M,eAAR,CAAwB1L,IAAxB,IAAiC,mBADlB,EAEf2J,IAFe,CAAjB;AAIAE,MAAAA,wBAAwB;;AACxB,UAAI9K,OAAO,CAAC4M,IAAZ,EAAkB;AAChBC,QAAAA,OAAO,CAACC,OAAR,CAAgB,wBAAQlC,IAAI,CAACH,kBAAb,CAAhB,EAAkDsC,KAAlD,CAAwD,MACtDlC,OAAO,CAAC7I,GAAR,CACG,GAAE6F,eAAMC,MAAN,CACA,MADA,CAED,kDAHJ,CADF;AAOD;AACF;;AAEDwE,IAAAA,cAAc,GAAG,KAAjB;;AAEA,QAAIjL,eAAJ,EAAqB;AACnB,oDAAsByD,KAAtB;;AAEA,UAAI,CAAC2H,YAAL,EAAmB;AACjB,cAAMC,MAAM,GAAG,+CACZ,SADY,EAEb5H,KAAK,CAACkI,WAAN,CAAkBN,MAFL,CAAf;AAIArL,QAAAA,eAAe,CAAC4L,YAAhB,CAA6BP,MAA7B;AACD;;AACDrL,MAAAA,eAAe,CAACD,GAAhB;AACAC,MAAAA,eAAe,GAAG,IAAlB;AACD;;AAEDgL,IAAAA,IAAI;AACL,GAjDD;AAkDD,CA3UD","sourcesContent":["import url from \"url\"\nimport fs from \"fs\"\nimport openurl from \"better-opn\"\nimport chokidar from \"chokidar\"\n\nimport webpackHotMiddleware from \"webpack-hot-middleware\"\nimport webpackDevMiddleware from \"webpack-dev-middleware\"\nimport glob from \"glob\"\nimport express from \"express\"\nimport got from \"got\"\nimport webpack from \"webpack\"\nimport graphqlHTTP from \"express-graphql\"\nimport graphqlPlayground from \"graphql-playground-middleware-express\"\nimport graphiqlExplorer from \"gatsby-graphiql-explorer\"\nimport { formatError } from \"graphql\"\n\nimport webpackConfig from \"../utils/webpack.config\"\nimport bootstrap from \"../bootstrap\"\nimport { store } from \"../redux\"\nimport { syncStaticDir } from \"../utils/get-static-dir\"\nimport { buildHTML } from \"./build-html\"\nimport { withBasePath } from \"../utils/path\"\nimport report from \"gatsby-cli/lib/reporter\"\nimport launchEditor from \"react-dev-utils/launchEditor\"\nimport formatWebpackMessages from \"react-dev-utils/formatWebpackMessages\"\nimport chalk from \"chalk\"\nimport address from \"address\"\nimport cors from \"cors\"\nimport telemetry from \"gatsby-telemetry\"\nimport * as WorkerPool from \"../utils/worker/pool\"\nimport http from \"http\"\nimport https from \"https\"\n\nimport bootstrapSchemaHotReloader from \"../bootstrap/schema-hot-reloader\"\nimport bootstrapPageHotReloader from \"../bootstrap/page-hot-reloader\"\nimport { developStatic } from \"./develop-static\"\nimport withResolverContext from \"../schema/context\"\nimport sourceNodes from \"../utils/source-nodes\"\nimport { createSchemaCustomization } from \"../utils/create-schema-customization\"\nimport websocketManager from \"../utils/websocket-manager\"\nimport getSslCert from \"../utils/get-ssl-cert\"\nimport { slash } from \"gatsby-core-utils\"\nimport { initTracer } from \"../utils/tracer\"\nimport apiRunnerNode from \"../utils/api-runner-node\"\nimport db from \"../db\"\nimport { detectPortInUseAndPrompt } from \"../utils/detect-port-in-use-and-prompt\"\nimport onExit from \"signal-exit\"\nimport queryUtil from \"../query\"\nimport queryWatcher from \"../query/query-watcher\"\nimport requiresWriter from \"../bootstrap/requires-writer\"\nimport {\n reportWebpackWarnings,\n structureWebpackErrors,\n} from \"../utils/webpack-error-utils\"\nimport { waitUntilAllJobsComplete } from \"../utils/wait-until-jobs-complete\"\nimport {\n userPassesFeedbackRequestHeuristic,\n showFeedbackRequest,\n} from \"../utils/feedback\"\n\nimport { BuildHTMLStage, IProgram } from \"./types\"\n\n// checks if a string is a valid ip\nconst REGEX_IP = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])$/\n\n// const isInteractive = process.stdout.isTTY\n\n// Watch the static directory and copy files to public as they're added or\n// changed. Wait 10 seconds so copying doesn't interfere with the regular\n// bootstrap.\nsetTimeout(() => {\n syncStaticDir()\n}, 10000)\n\nonExit(() => {\n telemetry.trackCli(`DEVELOP_STOP`)\n})\n\ntype ActivityTracker = any // TODO: Replace this with proper type once reporter is typed\n\ninterface IServer {\n compiler: webpack.Compiler\n listener: http.Server | https.Server\n webpackActivity: ActivityTracker\n}\n\nasync function startServer(program: IProgram): Promise<IServer> {\n const indexHTMLActivity = report.phantomActivity(`building index.html`, {})\n indexHTMLActivity.start()\n const directory = program.directory\n const directoryPath = withBasePath(directory)\n const workerPool = WorkerPool.create()\n const createIndexHtml = async (activity: ActivityTracker): Promise<void> => {\n try {\n await buildHTML({\n program,\n stage: BuildHTMLStage.DevelopHTML,\n pagePaths: [`/`],\n workerPool,\n activity,\n })\n } catch (err) {\n if (err.name !== `WebpackError`) {\n report.panic(err)\n return\n }\n report.panic(\n report.stripIndent`\n There was an error compiling the html.js component for the development server.\n\n See our docs page on debugging HTML builds for help https://gatsby.dev/debug-html\n `,\n err\n )\n }\n }\n\n await createIndexHtml(indexHTMLActivity)\n\n indexHTMLActivity.end()\n\n // report.stateUpdate(`webpack`, `IN_PROGRESS`)\n\n const webpackActivity = report.activityTimer(`Building development bundle`, {\n id: `webpack-develop`,\n })\n webpackActivity.start()\n\n const devConfig = await webpackConfig(\n program,\n directory,\n `develop`,\n program.port,\n { parentSpan: webpackActivity.span }\n )\n\n const compiler = webpack(devConfig)\n\n /**\n * Set up the express app.\n **/\n const app = express()\n app.use(telemetry.expressMiddleware(`DEVELOP`))\n app.use(\n webpackHotMiddleware(compiler, {\n log: false,\n path: `/__webpack_hmr`,\n heartbeat: 10 * 1000,\n })\n )\n\n app.use(cors())\n\n /**\n * Pattern matching all endpoints with graphql or graphiql with 1 or more leading underscores\n */\n const graphqlEndpoint = `/_+graphi?ql`\n\n if (process.env.GATSBY_GRAPHQL_IDE === `playground`) {\n app.get(\n graphqlEndpoint,\n graphqlPlayground({\n endpoint: `/___graphql`,\n }),\n () => {}\n )\n } else {\n graphiqlExplorer(app, {\n graphqlEndpoint,\n })\n }\n\n app.use(\n graphqlEndpoint,\n graphqlHTTP(\n (): graphqlHTTP.OptionsData => {\n const { schema, schemaCustomization } = store.getState()\n\n return {\n schema,\n graphiql: false,\n context: withResolverContext({\n schema,\n schemaComposer: schemaCustomization.composer,\n context: {},\n customContext: schemaCustomization.context,\n }),\n customFormatErrorFn(err): unknown {\n return {\n ...formatError(err),\n stack: err.stack ? err.stack.split(`\\n`) : [],\n }\n },\n }\n }\n )\n )\n\n /**\n * Refresh external data sources.\n * This behavior is disabled by default, but the ENABLE_REFRESH_ENDPOINT env var enables it\n * If no GATSBY_REFRESH_TOKEN env var is available, then no Authorization header is required\n **/\n const REFRESH_ENDPOINT = `/__refresh`\n const refresh = async (req: express.Request): Promise<void> => {\n let activity = report.activityTimer(`createSchemaCustomization`, {})\n activity.start()\n await createSchemaCustomization({\n refresh: true,\n })\n activity.end()\n activity = report.activityTimer(`Refreshing source data`, {})\n activity.start()\n await sourceNodes({\n webhookBody: req.body,\n })\n activity.end()\n }\n app.use(REFRESH_ENDPOINT, express.json())\n app.post(REFRESH_ENDPOINT, (req, res) => {\n const enableRefresh = process.env.ENABLE_GATSBY_REFRESH_ENDPOINT\n const refreshToken = process.env.GATSBY_REFRESH_TOKEN\n const authorizedRefresh =\n !refreshToken || req.headers.authorization === refreshToken\n\n if (enableRefresh && authorizedRefresh) {\n refresh(req)\n }\n res.end()\n })\n\n app.get(`/__open-stack-frame-in-editor`, (req, res) => {\n launchEditor(req.query.fileName, req.query.lineNumber)\n res.end()\n })\n\n // Disable directory indexing i.e. serving index.html from a directory.\n // This can lead to serving stale html files during development.\n //\n // We serve by default an empty index.html that sets up the dev environment.\n app.use(developStatic(`public`, { index: false }))\n\n app.use(\n webpackDevMiddleware(compiler, {\n logLevel: `silent`,\n publicPath: devConfig.output.publicPath,\n watchOptions: devConfig.devServer\n ? devConfig.devServer.watchOptions\n : null,\n stats: `errors-only`,\n })\n )\n\n // Expose access to app for advanced use cases\n const { developMiddleware } = store.getState().config\n\n if (developMiddleware) {\n developMiddleware(app, program)\n }\n\n // Set up API proxy.\n const { proxy } = store.getState().config\n if (proxy) {\n proxy.forEach(({ prefix, url }) => {\n app.use(`${prefix}/*`, (req, res) => {\n const proxiedUrl = url + req.originalUrl\n const {\n // remove `host` from copied headers\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n headers: { host, ...headers },\n method,\n } = req\n req\n .pipe(\n got\n .stream(proxiedUrl, { headers, method, decompress: false })\n .on(`response`, response =>\n res.writeHead(response.statusCode || 200, response.headers)\n )\n .on(`error`, (err, _, response) => {\n if (response) {\n res.writeHead(response.statusCode || 400, response.headers)\n } else {\n const message = `Error when trying to proxy request \"${req.originalUrl}\" to \"${proxiedUrl}\"`\n\n report.error(message, err)\n res.sendStatus(500)\n }\n })\n )\n .pipe(res)\n })\n })\n }\n\n await apiRunnerNode(`onCreateDevServer`, { app })\n\n // In case nothing before handled hot-update - send 404.\n // This fixes \"Unexpected token < in JSON at position 0\" runtime\n // errors after restarting development server and\n // cause automatic hard refresh in the browser.\n app.use(/.*\\.hot-update\\.json$/i, (_, res) => {\n res.status(404).end()\n })\n\n // Render an HTML page and serve it.\n app.use((_, res) => {\n res.sendFile(directoryPath(`public/index.html`), err => {\n if (err) {\n res.status(500).end()\n }\n })\n })\n\n /**\n * Set up the HTTP server and socket.io.\n * If a SSL cert exists in program, use it with `createServer`.\n **/\n const server = program.ssl\n ? https.createServer(program.ssl, app)\n : new http.Server(app)\n\n websocketManager.init({ server, directory: program.directory })\n const socket = websocketManager.getSocket()\n\n const listener = server.listen(program.port, program.host)\n\n // Register watcher that rebuilds index.html every time html.js changes.\n const watchGlobs = [`src/html.js`, `plugins/**/gatsby-ssr.js`].map(path =>\n slash(directoryPath(path))\n )\n\n chokidar.watch(watchGlobs).on(`change`, async () => {\n await createIndexHtml(indexHTMLActivity)\n socket.to(`clients`).emit(`reload`)\n })\n\n return { compiler, listener, webpackActivity }\n}\n\nmodule.exports = async (program: IProgram): Promise<void> => {\n // We want to prompt the feedback request when users quit develop\n // assuming they pass the heuristic check to know they are a user\n // we want to request feedback from, and we're not annoying them.\n process.on(\n `SIGINT`,\n async (): Promise<void> => {\n if (await userPassesFeedbackRequestHeuristic()) {\n showFeedbackRequest()\n }\n process.exit(0)\n }\n )\n\n if (process.env.GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES) {\n report.panic(\n `The flag ${chalk.yellow(\n `GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES`\n )} is not available with ${chalk.cyan(\n `gatsby develop`\n )}, please retry using ${chalk.cyan(`gatsby build`)}`\n )\n }\n initTracer(program.openTracingConfigFile)\n report.pendingActivity({ id: `webpack-develop` })\n telemetry.trackCli(`DEVELOP_START`)\n telemetry.startBackgroundUpdate()\n\n const port =\n typeof program.port === `string` ? parseInt(program.port, 10) : program.port\n\n // In order to enable custom ssl, --cert-file --key-file and -https flags must all be\n // used together\n if ((program[`cert-file`] || program[`key-file`]) && !program.https) {\n report.panic(\n `for custom ssl --https, --cert-file, and --key-file must be used together`\n )\n }\n\n try {\n program.port = await detectPortInUseAndPrompt(port)\n } catch (e) {\n if (e.message === `USER_REJECTED`) {\n process.exit(0)\n }\n\n throw e\n }\n\n // Check if https is enabled, then create or get SSL cert.\n // Certs are named 'devcert' and issued to the host.\n if (program.https) {\n const sslHost =\n program.host === `0.0.0.0` || program.host === `::`\n ? `localhost`\n : program.host\n\n if (REGEX_IP.test(sslHost)) {\n report.panic(\n `You're trying to generate a ssl certificate for an IP (${sslHost}). Please use a hostname instead.`\n )\n }\n\n program.ssl = await getSslCert({\n name: sslHost,\n certFile: program[`cert-file`],\n keyFile: program[`key-file`],\n directory: program.directory,\n })\n }\n\n // Start bootstrap process.\n const { graphqlRunner } = await bootstrap(program)\n\n // Start the createPages hot reloader.\n bootstrapPageHotReloader(graphqlRunner)\n\n // Start the schema hot reloader.\n bootstrapSchemaHotReloader()\n\n await queryUtil.initialProcessQueries()\n\n require(`../redux/actions`).boundActionCreators.setProgramStatus(\n `BOOTSTRAP_QUERY_RUNNING_FINISHED`\n )\n await db.saveState()\n\n await waitUntilAllJobsComplete()\n requiresWriter.startListener()\n db.startAutosave()\n queryUtil.startListeningToDevelopQueue()\n queryWatcher.startWatchDeletePage()\n\n let { compiler, webpackActivity } = await startServer(program)\n\n interface IPreparedUrls {\n lanUrlForConfig: string\n lanUrlForTerminal: string\n localUrlForTerminal: string\n localUrlForBrowser: string\n }\n\n function prepareUrls(\n protocol: `http` | `https`,\n host: string,\n port: number\n ): IPreparedUrls {\n const formatUrl = (hostname: string): string =>\n url.format({\n protocol,\n hostname,\n port,\n pathname: `/`,\n })\n const prettyPrintUrl = (hostname: string): string =>\n url.format({\n protocol,\n hostname,\n port: chalk.bold(String(port)),\n pathname: `/`,\n })\n\n const isUnspecifiedHost = host === `0.0.0.0` || host === `::`\n let prettyHost = host\n let lanUrlForConfig\n let lanUrlForTerminal\n if (isUnspecifiedHost) {\n prettyHost = `localhost`\n\n try {\n // This can only return an IPv4 address\n lanUrlForConfig = address.ip()\n if (lanUrlForConfig) {\n // Check if the address is a private ip\n // https://en.wikipedia.org/wiki/Private_network#Private_IPv4_address_spaces\n if (\n /^10[.]|^172[.](1[6-9]|2[0-9]|3[0-1])[.]|^192[.]168[.]/.test(\n lanUrlForConfig\n )\n ) {\n // Address is private, format it for later use\n lanUrlForTerminal = prettyPrintUrl(lanUrlForConfig)\n } else {\n // Address is not private, so we will discard it\n lanUrlForConfig = undefined\n }\n }\n } catch (_e) {\n // ignored\n }\n }\n // TODO collect errors (GraphQL + Webpack) in Redux so we\n // can clear terminal and print them out on every compile.\n // Borrow pretty printing code from webpack plugin.\n const localUrlForTerminal = prettyPrintUrl(prettyHost)\n const localUrlForBrowser = formatUrl(prettyHost)\n return {\n lanUrlForConfig,\n lanUrlForTerminal,\n localUrlForTerminal,\n localUrlForBrowser,\n }\n }\n\n function printInstructions(appName: string, urls: IPreparedUrls): void {\n console.log()\n console.log(`You can now view ${chalk.bold(appName)} in the browser.`)\n console.log()\n\n if (urls.lanUrlForTerminal) {\n console.log(\n ` ${chalk.bold(`Local:`)} ${urls.localUrlForTerminal}`\n )\n console.log(\n ` ${chalk.bold(`On Your Network:`)} ${urls.lanUrlForTerminal}`\n )\n } else {\n console.log(` ${urls.localUrlForTerminal}`)\n }\n\n console.log()\n console.log(\n `View ${\n process.env.GATSBY_GRAPHQL_IDE === `playground`\n ? `the GraphQL Playground`\n : `GraphiQL`\n }, an in-browser IDE, to explore your site's data and schema`\n )\n console.log()\n\n if (urls.lanUrlForTerminal) {\n console.log(\n ` ${chalk.bold(`Local:`)} ${\n urls.localUrlForTerminal\n }___graphql`\n )\n console.log(\n ` ${chalk.bold(`On Your Network:`)} ${\n urls.lanUrlForTerminal\n }___graphql`\n )\n } else {\n console.log(` ${urls.localUrlForTerminal}___graphql`)\n }\n\n console.log()\n console.log(`Note that the development build is not optimized.`)\n console.log(\n `To create a production build, use ` + `${chalk.cyan(`gatsby build`)}`\n )\n console.log()\n }\n\n function printDeprecationWarnings(): void {\n type DeprecatedAPIList = [\"boundActionCreators\", \"pathContext\"] // eslint-disable-line\n const deprecatedApis: DeprecatedAPIList = [\n `boundActionCreators`,\n `pathContext`,\n ]\n const fixMap = {\n boundActionCreators: {\n newName: `actions`,\n docsLink: `https://gatsby.dev/boundActionCreators`,\n },\n pathContext: {\n newName: `pageContext`,\n docsLink: `https://gatsby.dev/pathContext`,\n },\n }\n const deprecatedLocations = {\n boundActionCreators: [] as string[],\n pathContext: [] as string[],\n }\n\n glob\n .sync(`{,!(node_modules|public)/**/}*.js`, { nodir: true })\n .forEach(file => {\n const fileText = fs.readFileSync(file)\n const matchingApis = deprecatedApis.filter(api =>\n fileText.includes(api)\n )\n matchingApis.forEach(api => deprecatedLocations[api].push(file))\n })\n\n deprecatedApis.forEach(api => {\n if (deprecatedLocations[api].length) {\n console.log(\n `%s %s %s %s`,\n chalk.cyan(api),\n chalk.yellow(`is deprecated. Please use`),\n chalk.cyan(fixMap[api].newName),\n chalk.yellow(\n `instead. For migration instructions, see ${fixMap[api].docsLink}\\nCheck the following files:`\n )\n )\n console.log()\n deprecatedLocations[api].forEach(file => console.log(file))\n console.log()\n }\n })\n }\n\n // compiler.hooks.invalid.tap(`log compiling`, function(...args) {\n // console.log(`set invalid`, args, this)\n // })\n\n compiler.hooks.watchRun.tapAsync(`log compiling`, function(_, done) {\n if (webpackActivity) {\n webpackActivity.end()\n }\n webpackActivity = report.activityTimer(`Re-building development bundle`, {\n id: `webpack-develop`,\n })\n webpackActivity.start()\n\n done()\n })\n\n let isFirstCompile = true\n // \"done\" event fires when Webpack has finished recompiling the bundle.\n // Whether or not you have warnings or errors, you will get this event.\n compiler.hooks.done.tapAsync(`print gatsby instructions`, function(\n stats,\n done\n ) {\n // We have switched off the default Webpack output in WebpackDevServer\n // options so we are going to \"massage\" the warnings and errors and present\n // them in a readable focused way.\n const messages = formatWebpackMessages(stats.toJson({}, true))\n const urls = prepareUrls(\n program.ssl ? `https` : `http`,\n program.host,\n program.port\n )\n const isSuccessful = !messages.errors.length\n\n if (isSuccessful && isFirstCompile) {\n printInstructions(\n program.sitePackageJson.name || `(Unnamed package)`,\n urls\n )\n printDeprecationWarnings()\n if (program.open) {\n Promise.resolve(openurl(urls.localUrlForBrowser)).catch(() =>\n console.log(\n `${chalk.yellow(\n `warn`\n )} Browser not opened because no browser was found`\n )\n )\n }\n }\n\n isFirstCompile = false\n\n if (webpackActivity) {\n reportWebpackWarnings(stats)\n\n if (!isSuccessful) {\n const errors = structureWebpackErrors(\n `develop`,\n stats.compilation.errors\n )\n webpackActivity.panicOnBuild(errors)\n }\n webpackActivity.end()\n webpackActivity = null\n }\n\n done()\n })\n}\n"],"file":"develop.js"}
|
|
@@ -1289,7 +1289,9 @@ const maybeAddPathPrefix = (path, pathPrefix) => {
|
|
|
1289
1289
|
* of the box. You must have a plugin setup to integrate the redirect data with
|
|
1290
1290
|
* your hosting technology e.g. the [Netlify
|
|
1291
1291
|
* plugin](/packages/gatsby-plugin-netlify/), or the [Amazon S3
|
|
1292
|
-
* plugin](/packages/gatsby-plugin-s3/).
|
|
1292
|
+
* plugin](/packages/gatsby-plugin-s3/). Alternatively, you can use
|
|
1293
|
+
* [this plugin](/packages/gatsby-plugin-meta-redirect/) to generate meta redirect
|
|
1294
|
+
* html files for redirecting on any static file host.
|
|
1293
1295
|
*
|
|
1294
1296
|
* @param {Object} redirect Redirect data
|
|
1295
1297
|
* @param {string} redirect.fromPath Any valid URL. Must start with a forward slash
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/redux/actions/public.js"],"names":["Joi","require","chalk","_","stripIndent","report","platform","path","fs","trueCasePathSync","url","slash","hasNodeChanged","getNode","sanitizeNode","store","fileExistsSync","sync","joiSchemas","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","fileOkCache","createPage","plugin","actionOptions","name","message","process","env","NODE_ENV","panic","context","pluginName","pageObject","isObject","reservedFields","invalidFields","Object","keys","pick","singularMessage","pluralMessage","error","map","f","JSON","stringify","some","component","warn","pageComponentPath","isAbsolute","originalPageComponent","trueComponentPath","e","commonDir","getState","program","directory","relativePath","win32","relative","markers","letter","index","internalComponentName","invalidPathSegments","truncatedPath","panicOnBuild","isProduction","internalPage","matchPath","componentChunkName","isCreatedByStatefulCreatePages","traceId","updatedAt","Date","now","includes","fileName","fileContent","readFileSync","notEmpty","includesDefaultExport","match","test","extname","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","console","log","red","counter","array","parent","owner","trackParams","version","debounce","result","validate","nodeSchema","errorObj","validationErrorMessage","possiblyCodeFrame","codeFrame","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","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","rest","prefixPaths","createPageDependency","connection","setPageData","pageData","removePageData","module","exports"],"mappings":";;;;;;AACA,MAAMA,GAAG,GAAGC,OAAO,CAAE,WAAF,CAAnB;;AACA,MAAMC,KAAK,GAAGD,OAAO,CAAE,OAAF,CA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,GAAuBC,QAAD,IAAwB;AAC5C,SAAO;AACLpM,IAAAA,IAAI,EAAG,eADF;AAELC,IAAAA,OAAO,EAAEmM;AAFJ,GAAP;AAID,CALD;AAOA;;;;;;;;AAMAhO,OAAO,CAACiO,cAAR,GAA0B5M,EAAD,IAAwB;AAC/C,SAAO;AACLO,IAAAA,IAAI,EAAG,kBADF;AAELC,IAAAA,OAAO,EAAER;AAFJ,GAAP;AAID,CALD;;AAOA6M,MAAM,CAACC,OAAP,GAAiB;AAAEnO,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 fs = require(`fs`)\nconst { trueCasePathSync } = require(`true-case-path`)\nconst url = require(`url`)\nconst { slash } = require(`gatsby-core-utils`)\nconst { hasNodeChanged, getNode } = require(`../../db/nodes`)\nconst sanitizeNode = require(`../../db/sanitize-node`)\nconst { store } = require(`..`)\nconst fileExistsSync = require(`fs-exists-cached`).sync\nconst joiSchemas = require(`../../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 fileOkCache = {}\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 (_.isObject(page.context)) {\n const reservedFields = [\n `path`,\n `matchPath`,\n `component`,\n `componentChunkName`,\n `pluginCreator___NODE`,\n `pluginCreatorId`,\n ]\n const invalidFields = Object.keys(_.pick(page.context, reservedFields))\n\n const singularMessage = `${name} used a reserved field name in the context object when creating a page:`\n const pluralMessage = `${name} used reserved field names in the context object when creating a page:`\n if (invalidFields.length > 0) {\n const error = `${\n invalidFields.length === 1 ? singularMessage : pluralMessage\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 // Don't check if the component exists during tests as we use a lot of fake\n // component paths.\n if (process.env.NODE_ENV !== `test`) {\n if (!fileExistsSync(page.component)) {\n report.panic({\n id: `11325`,\n context: {\n pluginName: name,\n pageObject: page,\n component: page.component,\n },\n })\n }\n }\n if (!path.isAbsolute(page.component)) {\n // Don't log out when testing\n if (process.env.NODE_ENV !== `test`) {\n report.panic({\n id: `11326`,\n context: {\n pluginName: name,\n pageObject: page,\n component: page.component,\n },\n })\n } else {\n const message = `${name} must set the absolute path to the page component when create creating a page`\n return message\n }\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.panicOnBuild({\n id: `11331`,\n context: {\n path: page.path,\n invalidPathSegments,\n\n // we will only show truncatedPath in non-production scenario\n isProduction: process.env.NODE_ENV === `production`,\n 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 &&\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 // Validate that the page component imports React and exports something\n // (hopefully a component).\n //\n // Only run validation once during builds.\n if (\n !internalPage.component.includes(`/.cache/`) &&\n process.env.NODE_ENV === `production` &&\n !fileOkCache[internalPage.component]\n ) {\n const fileName = internalPage.component\n const fileContent = fs.readFileSync(fileName, `utf-8`)\n let notEmpty = true\n let includesDefaultExport = true\n\n if (fileContent === ``) {\n notEmpty = false\n }\n\n if (\n !fileContent.includes(`export default`) &&\n !fileContent.includes(`module.exports`) &&\n !fileContent.includes(`exports.default`) &&\n !fileContent.includes(`exports[\"default\"]`) &&\n !fileContent.match(/export \\{.* as default.*\\}/s) &&\n // this check only applies to js and ts, not mdx\n /\\.(jsx?|tsx?)/.test(path.extname(fileName))\n ) {\n includesDefaultExport = false\n }\n if (!notEmpty || !includesDefaultExport) {\n const relativePath = path.relative(\n store.getState().program.directory,\n fileName\n )\n\n if (!notEmpty) {\n report.panicOnBuild({\n id: `11327`,\n context: {\n relativePath,\n },\n })\n }\n\n if (!includesDefaultExport) {\n report.panicOnBuild({\n id: `11328`,\n context: {\n fileName,\n },\n })\n }\n }\n\n fileOkCache[internalPage.component] = true\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 &&\n findChildren(node.children)\n .map(getNode)\n .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 and loki reducers require\n // 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, joiSchemas.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 {string} $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: `babel-plugin-emotion`,\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 are generally\n * started as side-effects to GraphQL queries.\n * [`gatsby-plugin-sharp`](/packages/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 are generally\n * started as side-effects to GraphQL queries.\n * [`gatsby-plugin-sharp`](/packages/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](/packages/gatsby-plugin-netlify/), or the [Amazon S3\n * plugin](/packages/gatsby-plugin-s3/).\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 * @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 ...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 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\nmodule.exports = { actions }\n"],"file":"public.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/redux/actions/public.js"],"names":["Joi","require","chalk","_","stripIndent","report","platform","path","fs","trueCasePathSync","url","slash","hasNodeChanged","getNode","sanitizeNode","store","fileExistsSync","sync","joiSchemas","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","fileOkCache","createPage","plugin","actionOptions","name","message","process","env","NODE_ENV","panic","context","pluginName","pageObject","isObject","reservedFields","invalidFields","Object","keys","pick","singularMessage","pluralMessage","error","map","f","JSON","stringify","some","component","warn","pageComponentPath","isAbsolute","originalPageComponent","trueComponentPath","e","commonDir","getState","program","directory","relativePath","win32","relative","markers","letter","index","internalComponentName","invalidPathSegments","truncatedPath","panicOnBuild","isProduction","internalPage","matchPath","componentChunkName","isCreatedByStatefulCreatePages","traceId","updatedAt","Date","now","includes","fileName","fileContent","readFileSync","notEmpty","includesDefaultExport","match","test","extname","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","console","log","red","counter","array","parent","owner","trackParams","version","debounce","result","validate","nodeSchema","errorObj","validationErrorMessage","possiblyCodeFrame","codeFrame","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","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","rest","prefixPaths","createPageDependency","connection","setPageData","pageData","removePageData","module","exports"],"mappings":";;;;;;AACA,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,MAAMO,EAAE,GAAGP,OAAO,CAAE,IAAF,CAAlB;;AACA,MAAM;AAAEQ,EAAAA;AAAF,IAAuBR,OAAO,CAAE,gBAAF,CAApC;;AACA,MAAMS,GAAG,GAAGT,OAAO,CAAE,KAAF,CAAnB;;AACA,MAAM;AAAEU,EAAAA;AAAF,IAAYV,OAAO,CAAE,mBAAF,CAAzB;;AACA,MAAM;AAAEW,EAAAA,cAAF;AAAkBC,EAAAA;AAAlB,IAA8BZ,OAAO,CAAE,gBAAF,CAA3C;;AACA,MAAMa,YAAY,GAAGb,OAAO,CAAE,wBAAF,CAA5B;;AACA,MAAM;AAAEc,EAAAA;AAAF,IAAYd,OAAO,CAAE,IAAF,CAAzB;;AACA,MAAMe,cAAc,GAAGf,OAAO,CAAE,kBAAF,CAAP,CAA4BgB,IAAnD;;AACA,MAAMC,UAAU,GAAGjB,OAAO,CAAE,uBAAF,CAA1B;;A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7B;AACEtP,EAAAA,IADF;AAEEmM,EAAAA,MAFF;AAGEoD,EAAAA;AAHF,CAD6B,EAM7BtL,MAAc,GAAI,EANW,KAO1B;AACH+F,EAAAA,OAAO,CAACrE,IAAR,CACG,sJADH;AAGA,SAAO;AACLtC,IAAAA,IAAI,EAAG,6BADF;AAELY,IAAAA,MAFK;AAGLX,IAAAA,OAAO,EAAE;AACPtD,MAAAA,IADO;AAEPmM,MAAAA,MAFO;AAGPoD,MAAAA;AAHO;AAHJ,GAAP;AASD,CApBD;AAsBA;;;;;;;;;AAOA9N,OAAO,CAAC+N,WAAR,GAAuBC,QAAD,IAAwB;AAC5C,SAAO;AACLpM,IAAAA,IAAI,EAAG,eADF;AAELC,IAAAA,OAAO,EAAEmM;AAFJ,GAAP;AAID,CALD;AAOA;;;;;;;;AAMAhO,OAAO,CAACiO,cAAR,GAA0B5M,EAAD,IAAwB;AAC/C,SAAO;AACLO,IAAAA,IAAI,EAAG,kBADF;AAELC,IAAAA,OAAO,EAAER;AAFJ,GAAP;AAID,CALD;;AAOA6M,MAAM,CAACC,OAAP,GAAiB;AAAEnO,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 fs = require(`fs`)\nconst { trueCasePathSync } = require(`true-case-path`)\nconst url = require(`url`)\nconst { slash } = require(`gatsby-core-utils`)\nconst { hasNodeChanged, getNode } = require(`../../db/nodes`)\nconst sanitizeNode = require(`../../db/sanitize-node`)\nconst { store } = require(`..`)\nconst fileExistsSync = require(`fs-exists-cached`).sync\nconst joiSchemas = require(`../../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 fileOkCache = {}\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 (_.isObject(page.context)) {\n const reservedFields = [\n `path`,\n `matchPath`,\n `component`,\n `componentChunkName`,\n `pluginCreator___NODE`,\n `pluginCreatorId`,\n ]\n const invalidFields = Object.keys(_.pick(page.context, reservedFields))\n\n const singularMessage = `${name} used a reserved field name in the context object when creating a page:`\n const pluralMessage = `${name} used reserved field names in the context object when creating a page:`\n if (invalidFields.length > 0) {\n const error = `${\n invalidFields.length === 1 ? singularMessage : pluralMessage\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 // Don't check if the component exists during tests as we use a lot of fake\n // component paths.\n if (process.env.NODE_ENV !== `test`) {\n if (!fileExistsSync(page.component)) {\n report.panic({\n id: `11325`,\n context: {\n pluginName: name,\n pageObject: page,\n component: page.component,\n },\n })\n }\n }\n if (!path.isAbsolute(page.component)) {\n // Don't log out when testing\n if (process.env.NODE_ENV !== `test`) {\n report.panic({\n id: `11326`,\n context: {\n pluginName: name,\n pageObject: page,\n component: page.component,\n },\n })\n } else {\n const message = `${name} must set the absolute path to the page component when create creating a page`\n return message\n }\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.panicOnBuild({\n id: `11331`,\n context: {\n path: page.path,\n invalidPathSegments,\n\n // we will only show truncatedPath in non-production scenario\n isProduction: process.env.NODE_ENV === `production`,\n 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 &&\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 // Validate that the page component imports React and exports something\n // (hopefully a component).\n //\n // Only run validation once during builds.\n if (\n !internalPage.component.includes(`/.cache/`) &&\n process.env.NODE_ENV === `production` &&\n !fileOkCache[internalPage.component]\n ) {\n const fileName = internalPage.component\n const fileContent = fs.readFileSync(fileName, `utf-8`)\n let notEmpty = true\n let includesDefaultExport = true\n\n if (fileContent === ``) {\n notEmpty = false\n }\n\n if (\n !fileContent.includes(`export default`) &&\n !fileContent.includes(`module.exports`) &&\n !fileContent.includes(`exports.default`) &&\n !fileContent.includes(`exports[\"default\"]`) &&\n !fileContent.match(/export \\{.* as default.*\\}/s) &&\n // this check only applies to js and ts, not mdx\n /\\.(jsx?|tsx?)/.test(path.extname(fileName))\n ) {\n includesDefaultExport = false\n }\n if (!notEmpty || !includesDefaultExport) {\n const relativePath = path.relative(\n store.getState().program.directory,\n fileName\n )\n\n if (!notEmpty) {\n report.panicOnBuild({\n id: `11327`,\n context: {\n relativePath,\n },\n })\n }\n\n if (!includesDefaultExport) {\n report.panicOnBuild({\n id: `11328`,\n context: {\n fileName,\n },\n })\n }\n }\n\n fileOkCache[internalPage.component] = true\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 &&\n findChildren(node.children)\n .map(getNode)\n .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 and loki reducers require\n // 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, joiSchemas.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 {string} $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: `babel-plugin-emotion`,\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 are generally\n * started as side-effects to GraphQL queries.\n * [`gatsby-plugin-sharp`](/packages/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 are generally\n * started as side-effects to GraphQL queries.\n * [`gatsby-plugin-sharp`](/packages/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](/packages/gatsby-plugin-netlify/), or the [Amazon S3\n * plugin](/packages/gatsby-plugin-s3/). Alternatively, you can use\n * [this plugin](/packages/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 * @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 ...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 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\nmodule.exports = { actions }\n"],"file":"public.js"}
|