gatsby 5.12.2 → 5.12.3

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.
@@ -2,10 +2,11 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports.default = void 0;
5
+ var _gatsbyCoreUtils = require("gatsby-core-utils");
5
6
  const APIFunctionLoader = async function () {
6
7
  const params = new URLSearchParams(this.resourceQuery);
7
8
  const matchPath = params.get(`matchPath`);
8
- const modulePath = this.resourcePath;
9
+ const modulePath = (0, _gatsbyCoreUtils.slash)(this.resourcePath);
9
10
  return (/* javascript */`
10
11
  const preferDefault = m => (m && m.default) || m
11
12
 
@@ -1 +1 @@
1
- {"version":3,"file":"api-function-webpack-loader.js","names":["APIFunctionLoader","params","URLSearchParams","resourceQuery","matchPath","get","modulePath","resourcePath"],"sources":["../../../src/internal-plugins/functions/api-function-webpack-loader.ts"],"sourcesContent":["import type { LoaderDefinition } from \"webpack\"\n\nconst APIFunctionLoader: LoaderDefinition = async function () {\n const params = new URLSearchParams(this.resourceQuery)\n const matchPath = params.get(`matchPath`)\n\n const modulePath = this.resourcePath\n\n return /* javascript */ `\n const preferDefault = m => (m && m.default) || m\n\n const functionModule = require('${modulePath}');\n const functionToExecute = preferDefault(functionModule);\n const matchPath = '${matchPath}';\n const { match: reachMatch } = require('@gatsbyjs/reach-router');\n const { urlencoded, text, json, raw } = require('body-parser')\n const multer = require('multer')\n const { createConfig } = require('gatsby/dist/internal-plugins/functions/config')\n\n function functionWrapper(req, res) {\n if (matchPath) {\n let functionPath = req.originalUrl\n\n functionPath = functionPath.replace(new RegExp('^/*' + PREFIX_TO_STRIP), '')\n functionPath = functionPath.replace(new RegExp('^/*api/?'), '')\n\n const matchResult = reachMatch(matchPath, functionPath)\n if (matchResult) {\n req.params = matchResult.params\n if (req.params['*']) {\n // TODO(v6): Remove this backwards compatability for v3\n req.params['0'] = req.params['*']\n }\n }\n }\n\n // handle body parsing if request stream was not yet consumed\n const { config } = createConfig(functionModule?.config)\n const middlewares = \n req.readableEnded \n ? [] \n : [\n multer().any(),\n raw(config?.bodyParser?.raw ?? { limit: '100kb' }),\n text(config?.bodyParser?.text ?? { limit: '100kb' }),\n urlencoded(config?.bodyParser?.urlencoded ?? { limit: '100kb', extended: true }),\n json(config?.bodyParser?.json ?? { limit: '100kb' })\n ]\n\n let i = 0\n function runMiddlewareOrFunction() {\n if (i >= middlewares.length) {\n functionToExecute(req, res);\n } else {\n middlewares[i++](req, res, runMiddlewareOrFunction)\n }\n }\n\n\n runMiddlewareOrFunction() \n }\n\n module.exports = typeof functionToExecute === 'function' \n ? {\n default: functionWrapper,\n config: functionModule?.config\n } : functionModule\n `\n}\n\nexport default APIFunctionLoader\n"],"mappings":";;;;AAEA,MAAMA,iBAAmC,GAAG,kBAAkB;EAC5D,MAAMC,MAAM,GAAG,IAAIC,eAAe,CAAC,IAAI,CAACC,aAAa,CAAC;EACtD,MAAMC,SAAS,GAAGH,MAAM,CAACI,GAAG,CAAE,WAAU,CAAC;EAEzC,MAAMC,UAAU,GAAG,IAAI,CAACC,YAAY;EAEpC,OAAO,iBAAkB;AAC3B;AACA;AACA,oCAAoCD,UAAW;AAC/C;AACA,uBAAuBF,SAAU;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EAAG;AACH,CAAC;AAAA,eAEcJ,iBAAiB;AAAA"}
1
+ {"version":3,"file":"api-function-webpack-loader.js","names":["APIFunctionLoader","params","URLSearchParams","resourceQuery","matchPath","get","modulePath","slash","resourcePath"],"sources":["../../../src/internal-plugins/functions/api-function-webpack-loader.ts"],"sourcesContent":["import { slash } from \"gatsby-core-utils\"\nimport type { LoaderDefinition } from \"webpack\"\n\nconst APIFunctionLoader: LoaderDefinition = async function () {\n const params = new URLSearchParams(this.resourceQuery)\n const matchPath = params.get(`matchPath`)\n\n const modulePath = slash(this.resourcePath)\n\n return /* javascript */ `\n const preferDefault = m => (m && m.default) || m\n\n const functionModule = require('${modulePath}');\n const functionToExecute = preferDefault(functionModule);\n const matchPath = '${matchPath}';\n const { match: reachMatch } = require('@gatsbyjs/reach-router');\n const { urlencoded, text, json, raw } = require('body-parser')\n const multer = require('multer')\n const { createConfig } = require('gatsby/dist/internal-plugins/functions/config')\n\n function functionWrapper(req, res) {\n if (matchPath) {\n let functionPath = req.originalUrl\n\n functionPath = functionPath.replace(new RegExp('^/*' + PREFIX_TO_STRIP), '')\n functionPath = functionPath.replace(new RegExp('^/*api/?'), '')\n\n const matchResult = reachMatch(matchPath, functionPath)\n if (matchResult) {\n req.params = matchResult.params\n if (req.params['*']) {\n // TODO(v6): Remove this backwards compatability for v3\n req.params['0'] = req.params['*']\n }\n }\n }\n\n // handle body parsing if request stream was not yet consumed\n const { config } = createConfig(functionModule?.config)\n const middlewares = \n req.readableEnded \n ? [] \n : [\n multer().any(),\n raw(config?.bodyParser?.raw ?? { limit: '100kb' }),\n text(config?.bodyParser?.text ?? { limit: '100kb' }),\n urlencoded(config?.bodyParser?.urlencoded ?? { limit: '100kb', extended: true }),\n json(config?.bodyParser?.json ?? { limit: '100kb' })\n ]\n\n let i = 0\n function runMiddlewareOrFunction() {\n if (i >= middlewares.length) {\n functionToExecute(req, res);\n } else {\n middlewares[i++](req, res, runMiddlewareOrFunction)\n }\n }\n\n\n runMiddlewareOrFunction() \n }\n\n module.exports = typeof functionToExecute === 'function' \n ? {\n default: functionWrapper,\n config: functionModule?.config\n } : functionModule\n `\n}\n\nexport default APIFunctionLoader\n"],"mappings":";;;;AAAA;AAGA,MAAMA,iBAAmC,GAAG,kBAAkB;EAC5D,MAAMC,MAAM,GAAG,IAAIC,eAAe,CAAC,IAAI,CAACC,aAAa,CAAC;EACtD,MAAMC,SAAS,GAAGH,MAAM,CAACI,GAAG,CAAE,WAAU,CAAC;EAEzC,MAAMC,UAAU,GAAG,IAAAC,sBAAK,EAAC,IAAI,CAACC,YAAY,CAAC;EAE3C,OAAO,iBAAkB;AAC3B;AACA;AACA,oCAAoCF,UAAW;AAC/C;AACA,uBAAuBF,SAAU;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EAAG;AACH,CAAC;AAAA,eAEcJ,iBAAiB;AAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gatsby",
3
3
  "description": "Blazing fast modern site generator for React",
4
- "version": "5.12.2",
4
+ "version": "5.12.3",
5
5
  "author": "Kyle Mathews <mathews.kyle@gmail.com>",
6
6
  "bin": {
7
7
  "gatsby": "./cli.js"
@@ -278,5 +278,5 @@
278
278
  "yargs": {
279
279
  "boolean-negation": false
280
280
  },
281
- "gitHead": "b6f1a108ee87920528145217fa6e3567816047dd"
281
+ "gitHead": "4b082d36d6129d583370e743ac3022be7574bc83"
282
282
  }