gatsby 4.9.2 → 4.9.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.
@@ -68,7 +68,7 @@ async function createGraphqlEngineBundle(rootDir, reporter, isVerbose) {
68
68
  }, {})],
69
69
  module: {
70
70
  rules: [{
71
- test: require.resolve(`lmdb`),
71
+ test: /node_modules[/\\]lmdb[/\\].*\.[cm]?js/,
72
72
  parser: {
73
73
  amd: false
74
74
  },
@@ -101,7 +101,7 @@ async function createGraphqlEngineBundle(rootDir, reporter, isVerbose) {
101
101
  }
102
102
  }, {
103
103
  // For node binary relocations, include ".node" files as well here
104
- test: /\.(m?js|node)$/,
104
+ test: /\.([cm]?js|node)$/,
105
105
  // it is recommended for Node builds to turn off AMD support
106
106
  parser: {
107
107
  amd: false
@@ -122,7 +122,9 @@ async function createGraphqlEngineBundle(rootDir, reporter, isVerbose) {
122
122
  alias: {
123
123
  ".cache": process.cwd() + `/.cache/`,
124
124
  [require.resolve(`gatsby-cli/lib/reporter/loggers/ink/index.js`)]: false,
125
- inquirer: false
125
+ inquirer: false,
126
+ // only load one version of lmdb
127
+ lmdb: require.resolve(`lmdb`)
126
128
  }
127
129
  },
128
130
  plugins: [new _webpack.default.DefinePlugin({
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/schema/graphql-engine/bundle-webpack.ts"],"names":["extensions","outputDir","path","join","process","cwd","cacheLocation","createGraphqlEngineBundle","rootDir","reporter","isVerbose","schemaSnapshotString","fs","readFile","compiler","name","mode","entry","__dirname","output","filename","libraryTarget","target","externalsPresets","node","cache","type","buildDependencies","config","__filename","externals","mod","builtinModules","reduce","acc","builtinModule","module","rules","test","require","resolve","parser","amd","use","loader","options","outputAssetBase","byDependency","esm","fullySpecified","exclude","presets","alias","inquirer","plugins","webpack","DefinePlugin","SCHEMA_SNAPSHOT","JSON","stringify","env","GATSBY_WEBPACK_LOGGING","includes","WebpackLoggingPlugin","filter","Boolean","Promise","reject","run","err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AT,CAAa,CAACC,GAAD,EAAMC,KAAN,KAAgB;AAC3BxD,MAAAA,QAAQ,CAACyD,KAAT,CAAeC,QAAQ,IAAI;AACzB,YAAIH,GAAJ,EAAS;AACP,iBAAOF,MAAM,CAACE,GAAD,CAAb;AACD;;AACD,YAAIG,QAAJ,EAAc;AACZ,iBAAOL,MAAM,CAACK,QAAD,CAAb;AACD;;AACD,eAAOhC,OAAO,CAAC8B,KAAD,aAACA,KAAD,uBAACA,KAAK,CAAEG,WAAR,CAAd;AACD,OARD;AASD,KAVD;AAWD,GAZM,CAAP;AAaD","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\n\nimport * as path from \"path\"\nimport * as fs from \"fs-extra\"\nimport webpack from \"webpack\"\nimport { printQueryEnginePlugins } from \"./print-plugins\"\nimport mod from \"module\"\nimport { WebpackLoggingPlugin } from \"../../utils/webpack/plugins/webpack-logging\"\nimport reporter from \"gatsby-cli/lib/reporter\"\n\ntype Reporter = typeof reporter\n\nconst extensions = [`.mjs`, `.js`, `.json`, `.node`, `.ts`, `.tsx`]\n\nconst outputDir = path.join(process.cwd(), `.cache`, `query-engine`)\nconst cacheLocation = path.join(\n process.cwd(),\n `.cache`,\n `webpack`,\n `query-engine`\n)\n\nexport async function createGraphqlEngineBundle(\n rootDir: string,\n reporter: Reporter,\n isVerbose?: boolean\n): Promise<webpack.Compilation | undefined> {\n const schemaSnapshotString = await fs.readFile(\n path.join(rootDir, `.cache`, `schema.gql`),\n `utf-8`\n )\n await printQueryEnginePlugins()\n\n const compiler = webpack({\n name: `Query Engine`,\n // mode: `production`,\n mode: `none`,\n entry: path.join(__dirname, `entry.js`),\n output: {\n path: outputDir,\n filename: `index.js`,\n libraryTarget: `commonjs`,\n },\n target: `node`,\n externalsPresets: {\n node: false,\n },\n cache: {\n type: `filesystem`,\n name: `graphql-engine`,\n cacheLocation,\n buildDependencies: {\n config: [__filename],\n },\n },\n // those are required in some runtime paths, but we don't need them\n externals: [\n `cbor-x`, // optional dep of lmdb-store, but we are using `msgpack` (default) encoding, so we don't need it\n `babel-runtime/helpers/asyncToGenerator`, // undeclared dep of yurnalist (but used in code path we don't use)\n `electron`, // :shrug: `got` seems to have electron specific code path\n mod.builtinModules.reduce((acc, builtinModule) => {\n if (builtinModule === `fs`) {\n acc[builtinModule] = `global _actualFsWrapper`\n } else {\n acc[builtinModule] = `commonjs ${builtinModule}`\n }\n\n return acc\n }, {}),\n ],\n module: {\n rules: [\n {\n test: require.resolve(`lmdb`),\n parser: { amd: false },\n use: [\n {\n loader: require.resolve(`@vercel/webpack-asset-relocator-loader`),\n options: {\n outputAssetBase: `assets`,\n },\n },\n {\n loader: require.resolve(`./lmdb-bundling-patch`),\n },\n ],\n },\n {\n test: /\\.m?js$/,\n type: `javascript/auto`,\n resolve: {\n byDependency: {\n esm: {\n fullySpecified: false,\n },\n },\n },\n },\n {\n test: /\\.ts$/,\n exclude: /node_modules/,\n use: {\n loader: `babel-loader`,\n options: {\n presets: [`@babel/preset-typescript`],\n },\n },\n },\n {\n // For node binary relocations, include \".node\" files as well here\n test: /\\.(m?js|node)$/,\n // it is recommended for Node builds to turn off AMD support\n parser: { amd: false },\n use: {\n loader: require.resolve(`@vercel/webpack-asset-relocator-loader`),\n options: {\n outputAssetBase: `assets`,\n },\n },\n },\n {\n test: /\\.txt/,\n type: `asset/resource`,\n },\n ],\n },\n resolve: {\n extensions,\n alias: {\n \".cache\": process.cwd() + `/.cache/`,\n\n [require.resolve(`gatsby-cli/lib/reporter/loggers/ink/index.js`)]:\n false,\n inquirer: false,\n },\n },\n plugins: [\n new webpack.DefinePlugin({\n // \"process.env.GATSBY_LOGGER\": JSON.stringify(`yurnalist`),\n \"process.env.GATSBY_EXPERIMENTAL_LMDB_STORE\": `true`,\n \"process.env.GATSBY_SKIP_WRITING_SCHEMA_TO_FILE\": `true`,\n SCHEMA_SNAPSHOT: JSON.stringify(schemaSnapshotString),\n \"process.env.GATSBY_LOGGER\": JSON.stringify(`yurnalist`),\n }),\n process.env.GATSBY_WEBPACK_LOGGING?.includes(`query-engine`) &&\n new WebpackLoggingPlugin(rootDir, reporter, isVerbose),\n ].filter(Boolean) as Array<webpack.WebpackPluginInstance>,\n })\n\n return new Promise((resolve, reject) => {\n compiler.run((err, stats) => {\n compiler.close(closeErr => {\n if (err) {\n return reject(err)\n }\n if (closeErr) {\n return reject(closeErr)\n }\n return resolve(stats?.compilation)\n })\n })\n })\n}\n"],"file":"bundle-webpack.js"}
1
+ {"version":3,"sources":["../../../src/schema/graphql-engine/bundle-webpack.ts"],"names":["extensions","outputDir","path","join","process","cwd","cacheLocation","createGraphqlEngineBundle","rootDir","reporter","isVerbose","schemaSnapshotString","fs","readFile","compiler","name","mode","entry","__dirname","output","filename","libraryTarget","target","externalsPresets","node","cache","type","buildDependencies","config","__filename","externals","mod","builtinModules","reduce","acc","builtinModule","module","rules","test","parser","amd","use","loader","require","resolve","options","outputAssetBase","byDependency","esm","fullySpecified","exclude","presets","alias","inquirer","lmdb","plugins","webpack","DefinePlugin","SCHEMA_SNAPSHOT","JSON","stringify","env","GATSBY_WEBPACK_LOGGING","includes","WebpackLoggingPlugin","filter","Boolean","Promise","reject","run","err","stats","close","closeErr","compilation"],"mappings":";;;;;;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAPA;AAYA,MAAMA,UAAU,GAAG,CAAE,MAAF,EAAU,KAAV,EAAiB,OAAjB,EAA0B,OAA1B,EAAmC,KAAnC,EAA0C,MAA1C,CAAnB;AAEA,MAAMC,SAAS,GAAGC,IAAI,CAACC,IAAL,CAAUC,OAAO,CAACC,GAAR,EAAV,EAA0B,QAA1B,EAAoC,cAApC,CAAlB;AACA,MAAMC,aAAa,GAAGJ,IAAI,CAACC,IAAL,CACpBC,OAAO,CAACC,GAAR,EADoB,EAEnB,QAFmB,EAGnB,SAHmB,EAInB,cAJmB,CAAtB;;AAOO,eAAeE,yBAAf,CACLC,OADK,EAELC,QAFK,EAGLC,SAHK,EAIqC;AAAA;;AA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,OAAO,CAACC,GAAR,KAAiB,UADtB;AAGL,SAACsC,OAAO,CAACC,OAAR,CAAiB,8CAAjB,CAAD,GACE,KAJG;AAKLS,QAAAA,QAAQ,EAAE,KALL;AAML;AACAC,QAAAA,IAAI,EAAEX,OAAO,CAACC,OAAR,CAAiB,MAAjB;AAPD;AAFA,KA7Fc;AAyGvBW,IAAAA,OAAO,EAAE,CACP,IAAIC,iBAAQC,YAAZ,CAAyB;AACvB;AACA,oDAA+C,MAFxB;AAGvB,wDAAmD,MAH5B;AAIvBC,MAAAA,eAAe,EAAEC,IAAI,CAACC,SAAL,CAAejD,oBAAf,CAJM;AAKvB,mCAA6BgD,IAAI,CAACC,SAAL,CAAgB,WAAhB;AALN,KAAzB,CADO,EAQP,0BAAAxD,OAAO,CAACyD,GAAR,CAAYC,sBAAZ,gFAAoCC,QAApC,CAA8C,cAA9C,MACE,IAAIC,oCAAJ,CAAyBxD,OAAzB,EAAkCC,QAAlC,EAA4CC,SAA5C,CATK,EAUPuD,MAVO,CAUAC,OAVA;AAzGc,GAAR,CAAjB;AAsHA,SAAO,IAAIC,OAAJ,CAAY,CAACvB,OAAD,EAAUwB,MAAV,KAAqB;AACtCtD,IAAAA,QAAQ,CAACuD,GAAT,CAAa,CAACC,GAAD,EAAMC,KAAN,KAAgB;AAC3BzD,MAAAA,QAAQ,CAAC0D,KAAT,CAAeC,QAAQ,IAAI;AACzB,YAAIH,GAAJ,EAAS;AACP,iBAAOF,MAAM,CAACE,GAAD,CAAb;AACD;;AACD,YAAIG,QAAJ,EAAc;AACZ,iBAAOL,MAAM,CAACK,QAAD,CAAb;AACD;;AACD,eAAO7B,OAAO,CAAC2B,KAAD,aAACA,KAAD,uBAACA,KAAK,CAAEG,WAAR,CAAd;AACD,OARD;AASD,KAVD;AAWD,GAZM,CAAP;AAaD","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\n\nimport * as path from \"path\"\nimport * as fs from \"fs-extra\"\nimport webpack from \"webpack\"\nimport { printQueryEnginePlugins } from \"./print-plugins\"\nimport mod from \"module\"\nimport { WebpackLoggingPlugin } from \"../../utils/webpack/plugins/webpack-logging\"\nimport reporter from \"gatsby-cli/lib/reporter\"\n\ntype Reporter = typeof reporter\n\nconst extensions = [`.mjs`, `.js`, `.json`, `.node`, `.ts`, `.tsx`]\n\nconst outputDir = path.join(process.cwd(), `.cache`, `query-engine`)\nconst cacheLocation = path.join(\n process.cwd(),\n `.cache`,\n `webpack`,\n `query-engine`\n)\n\nexport async function createGraphqlEngineBundle(\n rootDir: string,\n reporter: Reporter,\n isVerbose?: boolean\n): Promise<webpack.Compilation | undefined> {\n const schemaSnapshotString = await fs.readFile(\n path.join(rootDir, `.cache`, `schema.gql`),\n `utf-8`\n )\n await printQueryEnginePlugins()\n\n const compiler = webpack({\n name: `Query Engine`,\n // mode: `production`,\n mode: `none`,\n entry: path.join(__dirname, `entry.js`),\n output: {\n path: outputDir,\n filename: `index.js`,\n libraryTarget: `commonjs`,\n },\n target: `node`,\n externalsPresets: {\n node: false,\n },\n cache: {\n type: `filesystem`,\n name: `graphql-engine`,\n cacheLocation,\n buildDependencies: {\n config: [__filename],\n },\n },\n // those are required in some runtime paths, but we don't need them\n externals: [\n `cbor-x`, // optional dep of lmdb-store, but we are using `msgpack` (default) encoding, so we don't need it\n `babel-runtime/helpers/asyncToGenerator`, // undeclared dep of yurnalist (but used in code path we don't use)\n `electron`, // :shrug: `got` seems to have electron specific code path\n mod.builtinModules.reduce((acc, builtinModule) => {\n if (builtinModule === `fs`) {\n acc[builtinModule] = `global _actualFsWrapper`\n } else {\n acc[builtinModule] = `commonjs ${builtinModule}`\n }\n\n return acc\n }, {}),\n ],\n module: {\n rules: [\n {\n test: /node_modules[/\\\\]lmdb[/\\\\].*\\.[cm]?js/,\n parser: { amd: false },\n use: [\n {\n loader: require.resolve(`@vercel/webpack-asset-relocator-loader`),\n options: {\n outputAssetBase: `assets`,\n },\n },\n {\n loader: require.resolve(`./lmdb-bundling-patch`),\n },\n ],\n },\n {\n test: /\\.m?js$/,\n type: `javascript/auto`,\n resolve: {\n byDependency: {\n esm: {\n fullySpecified: false,\n },\n },\n },\n },\n {\n test: /\\.ts$/,\n exclude: /node_modules/,\n use: {\n loader: `babel-loader`,\n options: {\n presets: [`@babel/preset-typescript`],\n },\n },\n },\n {\n // For node binary relocations, include \".node\" files as well here\n test: /\\.([cm]?js|node)$/,\n // it is recommended for Node builds to turn off AMD support\n parser: { amd: false },\n use: {\n loader: require.resolve(`@vercel/webpack-asset-relocator-loader`),\n options: {\n outputAssetBase: `assets`,\n },\n },\n },\n {\n test: /\\.txt/,\n type: `asset/resource`,\n },\n ],\n },\n resolve: {\n extensions,\n alias: {\n \".cache\": process.cwd() + `/.cache/`,\n\n [require.resolve(`gatsby-cli/lib/reporter/loggers/ink/index.js`)]:\n false,\n inquirer: false,\n // only load one version of lmdb\n lmdb: require.resolve(`lmdb`),\n },\n },\n plugins: [\n new webpack.DefinePlugin({\n // \"process.env.GATSBY_LOGGER\": JSON.stringify(`yurnalist`),\n \"process.env.GATSBY_EXPERIMENTAL_LMDB_STORE\": `true`,\n \"process.env.GATSBY_SKIP_WRITING_SCHEMA_TO_FILE\": `true`,\n SCHEMA_SNAPSHOT: JSON.stringify(schemaSnapshotString),\n \"process.env.GATSBY_LOGGER\": JSON.stringify(`yurnalist`),\n }),\n process.env.GATSBY_WEBPACK_LOGGING?.includes(`query-engine`) &&\n new WebpackLoggingPlugin(rootDir, reporter, isVerbose),\n ].filter(Boolean) as Array<webpack.WebpackPluginInstance>,\n })\n\n return new Promise((resolve, reject) => {\n compiler.run((err, stats) => {\n compiler.close(closeErr => {\n if (err) {\n return reject(err)\n }\n if (closeErr) {\n return reject(closeErr)\n }\n return resolve(stats?.compilation)\n })\n })\n })\n}\n"],"file":"bundle-webpack.js"}
@@ -1 +1 @@
1
- export default function (source: string): string;
1
+ export default function (this: any, source: string): string;
@@ -1,11 +1,21 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  exports.__esModule = true;
4
6
  exports.default = _default;
5
7
 
6
- var _gatsbyCoreUtils = require("gatsby-core-utils");
8
+ var _path = require("gatsby-core-utils/path");
9
+
10
+ var _path2 = _interopRequireDefault(require("path"));
7
11
 
8
- // This is hacky webpack loader that does string replacements to
12
+ /* eslint-disable @babel/no-invalid-this */
13
+
14
+ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
15
+ // we need to require this module, we can't use import here
16
+ const {
17
+ createRequire
18
+ } = require(`module`); // This is hacky webpack loader that does string replacements to
9
19
  // allow lmdb@2 to be bundled by webpack for engines.
10
20
  // Currently `@vercel/webpack-asset-relocator-loader doesn't handle
11
21
  // the way lmdb is loading binaries and dictionary file
@@ -20,16 +30,20 @@ var _gatsbyCoreUtils = require("gatsby-core-utils");
20
30
  // - https://github.com/DoctorEvidence/lmdb-js/blob/544b3fda402f24a70a0e946921e4c9134c5adf85/node-index.js#L14-L16
21
31
  // - https://github.com/DoctorEvidence/lmdb-js/blob/544b3fda402f24a70a0e946921e4c9134c5adf85/open.js#L77
22
32
  // Reliance on `import.meta.url` + usage of `.replace` is what seems to cause problems currently.
33
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
+
35
+
23
36
  function _default(source) {
24
37
  let lmdbBinaryLocation;
25
38
 
26
39
  try {
27
- const lmdbRequire = (0, _gatsbyCoreUtils.createRequireFromPath)(require.resolve(`lmdb`));
28
- const nodeGypBuild = lmdbRequire(`node-gyp-build`);
40
+ var _this$_module$resourc;
29
41
 
30
- const path = require(`path`);
42
+ const lmdbRoot = (this === null || this === void 0 ? void 0 : (_this$_module$resourc = this._module.resourceResolveData) === null || _this$_module$resourc === void 0 ? void 0 : _this$_module$resourc.descriptionFileRoot) || _path2.default.dirname(this.resourcePath).replace(`/dist`, ``);
31
43
 
32
- lmdbBinaryLocation = nodeGypBuild.path(path.dirname(require.resolve(`lmdb`)).replace(`/dist`, ``));
44
+ const lmdbRequire = createRequire(this.resourcePath);
45
+ const nodeGypBuild = lmdbRequire(`node-gyp-build`);
46
+ lmdbBinaryLocation = (0, _path.slash)(_path2.default.relative(_path2.default.dirname(this.resourcePath), nodeGypBuild.path(lmdbRoot)));
33
47
  } catch (e) {
34
48
  return source;
35
49
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/schema/graphql-engine/lmdb-bundling-patch.ts"],"names":["source","lmdbBinaryLocation","lmdbRequire","require","resolve","nodeGypBuild","path","dirname","replace","e","JSON","stringify"],"mappings":";;;;;AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEe,kBAAUA,MAAV,EAAkC;AAC/C,MAAIC,kBAAJ;;AACA,MAAI;AACF,UAAMC,WAAW,GAAG,4CAAsBC,OAAO,CAACC,OAAR,CAAiB,MAAjB,CAAtB,CAApB;AACA,UAAMC,YAAY,GAAGH,WAAW,CAAE,gBAAF,CAAhC;;AACA,UAAMI,IAAI,GAAGH,OAAO,CAAE,MAAF,CAApB;;AAEAF,IAAAA,kBAAkB,GAAGI,YAAY,CAACC,IAAb,CACnBA,IAAI,CAACC,OAAL,CAAaJ,OAAO,CAACC,OAAR,CAAiB,MAAjB,CAAb,EAAsCI,OAAtC,CAA+C,OAA/C,EAAwD,EAAxD,CADmB,CAArB;AAGD,GARD,CAQE,OAAOC,CAAP,EAAU;AACV,WAAOT,MAAP;AACD;;AAED,SAAOA,MAAM,CACVQ,OADI,CAEF,sCAFE,EAGF,WAAUE,IAAI,CAACC,SAAL,CAAeV,kBAAf,CAAmC,GAH3C,EAKJO,OALI,CAMF,sCANE,EAOF,qCAPE,EASJA,OATI,CAUH,+WAVG,EAWF,sDAXE,CAAP;AAaD","sourcesContent":["import { createRequireFromPath } from \"gatsby-core-utils\"\n\n// This is hacky webpack loader that does string replacements to\n// allow lmdb@2 to be bundled by webpack for engines.\n// Currently `@vercel/webpack-asset-relocator-loader doesn't handle\n// the way lmdb is loading binaries and dictionary file\n// (can't statically analyze it). So we perform few localized changes\n// and we replace dynamic values with hardcoded ones to allow\n// asset-relocator to pick those assets up and handle them.\n//\n// Because lmdb code can diverge, we also pin version in gatsby\n// dependencies and will have manually bump it (with renovate most likely).\n//\n// To solve this upstream few things would need to change:\n// - https://github.com/DoctorEvidence/lmdb-js/blob/544b3fda402f24a70a0e946921e4c9134c5adf85/node-index.js#L14-L16\n// - https://github.com/DoctorEvidence/lmdb-js/blob/544b3fda402f24a70a0e946921e4c9134c5adf85/open.js#L77\n// Reliance on `import.meta.url` + usage of `.replace` is what seems to cause problems currently.\n\nexport default function (source: string): string {\n let lmdbBinaryLocation\n try {\n const lmdbRequire = createRequireFromPath(require.resolve(`lmdb`))\n const nodeGypBuild = lmdbRequire(`node-gyp-build`)\n const path = require(`path`)\n\n lmdbBinaryLocation = nodeGypBuild.path(\n path.dirname(require.resolve(`lmdb`)).replace(`/dist`, ``)\n )\n } catch (e) {\n return source\n }\n\n return source\n .replace(\n `require$1('node-gyp-build')(dirName)`,\n `require(${JSON.stringify(lmdbBinaryLocation)})`\n )\n .replace(\n `require$2.resolve('./dict/dict.txt')`,\n `require.resolve('../dict/dict.txt')`\n )\n .replace(\n /fs\\.readFileSync\\(new URL\\('\\.\\/dict\\/dict\\.txt',\\s*\\(typeof\\s*document\\s*===\\s*'undefined'\\s*\\?\\s*new\\s*\\(require\\('u'\\s*\\+\\s*'rl'\\)\\.URL\\)\\s*\\('file:'\\s*\\+\\s*__filename\\).href\\s*:\\s*\\(document\\.currentScript\\s*&&\\s*document\\.currentScript\\.src\\s*\\|\\|\\s*new URL\\('index\\.cjs',\\s*document\\.baseURI\\)\\.href\\)\\)\\.replace\\(\\/dist\\[\\\\\\\\\\\\\\/\\]index\\.cjs\\$\\/,\\s*''\\)\\)\\)/g,\n `fs.readFileSync(require.resolve('../dict/dict.txt'))`\n )\n}\n"],"file":"lmdb-bundling-patch.js"}
1
+ {"version":3,"sources":["../../../src/schema/graphql-engine/lmdb-bundling-patch.ts"],"names":["createRequire","require","source","lmdbBinaryLocation","lmdbRoot","_module","resourceResolveData","descriptionFileRoot","path","dirname","resourcePath","replace","lmdbRequire","nodeGypBuild","relative","e","JSON","stringify"],"mappings":";;;;;;;AAEA;;AACA;;AAHA;;AACA;AAIA;AACA,MAAM;AAAEA,EAAAA;AAAF,IAAoBC,OAAO,CAAE,QAAF,CAAjC,C,CAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;AACe,kBAAqBC,MAArB,EAA6C;AAC1D,MAAIC,kBAAJ;;AACA,MAAI;AAAA;;AACF,UAAMC,QAAQ,GACZ,2EAAMC,OAAN,CAAcC,mBAAd,gFAAmCC,mBAAnC,KACAC,eAAKC,OAAL,CAAa,KAAKC,YAAlB,EAAgCC,OAAhC,CAAyC,OAAzC,EAAkD,EAAlD,CAFF;;AAIA,UAAMC,WAAW,GAAGZ,aAAa,CAAC,KAAKU,YAAN,CAAjC;AACA,UAAMG,YAAY,GAAGD,WAAW,CAAE,gBAAF,CAAhC;AAEAT,IAAAA,kBAAkB,GAAG,iBACnBK,eAAKM,QAAL,CACEN,eAAKC,OAAL,CAAa,KAAKC,YAAlB,CADF,EAEEG,YAAY,CAACL,IAAb,CAAkBJ,QAAlB,CAFF,CADmB,CAArB;AAMD,GAdD,CAcE,OAAOW,CAAP,EAAU;AACV,WAAOb,MAAP;AACD;;AACD,SAAOA,MAAM,CACVS,OADI,CAEF,sCAFE,EAGF,WAAUK,IAAI,CAACC,SAAL,CAAed,kBAAf,CAAmC,GAH3C,EAKJQ,OALI,CAMF,sCANE,EAOF,qCAPE,EASJA,OATI,CAUH,+WAVG,EAWF,sDAXE,CAAP;AAaD","sourcesContent":["/* eslint-disable @babel/no-invalid-this */\n/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\nimport { slash } from \"gatsby-core-utils/path\"\nimport path from \"path\"\n\n// we need to require this module, we can't use import here\nconst { createRequire } = require(`module`)\n\n// This is hacky webpack loader that does string replacements to\n// allow lmdb@2 to be bundled by webpack for engines.\n// Currently `@vercel/webpack-asset-relocator-loader doesn't handle\n// the way lmdb is loading binaries and dictionary file\n// (can't statically analyze it). So we perform few localized changes\n// and we replace dynamic values with hardcoded ones to allow\n// asset-relocator to pick those assets up and handle them.\n//\n// Because lmdb code can diverge, we also pin version in gatsby\n// dependencies and will have manually bump it (with renovate most likely).\n//\n// To solve this upstream few things would need to change:\n// - https://github.com/DoctorEvidence/lmdb-js/blob/544b3fda402f24a70a0e946921e4c9134c5adf85/node-index.js#L14-L16\n// - https://github.com/DoctorEvidence/lmdb-js/blob/544b3fda402f24a70a0e946921e4c9134c5adf85/open.js#L77\n// Reliance on `import.meta.url` + usage of `.replace` is what seems to cause problems currently.\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport default function (this: any, source: string): string {\n let lmdbBinaryLocation: string | undefined\n try {\n const lmdbRoot =\n this?._module.resourceResolveData?.descriptionFileRoot ||\n path.dirname(this.resourcePath).replace(`/dist`, ``)\n\n const lmdbRequire = createRequire(this.resourcePath)\n const nodeGypBuild = lmdbRequire(`node-gyp-build`)\n\n lmdbBinaryLocation = slash(\n path.relative(\n path.dirname(this.resourcePath),\n nodeGypBuild.path(lmdbRoot)\n )\n )\n } catch (e) {\n return source\n }\n return source\n .replace(\n `require$1('node-gyp-build')(dirName)`,\n `require(${JSON.stringify(lmdbBinaryLocation)})`\n )\n .replace(\n `require$2.resolve('./dict/dict.txt')`,\n `require.resolve('../dict/dict.txt')`\n )\n .replace(\n /fs\\.readFileSync\\(new URL\\('\\.\\/dict\\/dict\\.txt',\\s*\\(typeof\\s*document\\s*===\\s*'undefined'\\s*\\?\\s*new\\s*\\(require\\('u'\\s*\\+\\s*'rl'\\)\\.URL\\)\\s*\\('file:'\\s*\\+\\s*__filename\\).href\\s*:\\s*\\(document\\.currentScript\\s*&&\\s*document\\.currentScript\\.src\\s*\\|\\|\\s*new URL\\('index\\.cjs',\\s*document\\.baseURI\\)\\.href\\)\\)\\.replace\\(\\/dist\\[\\\\\\\\\\\\\\/\\]index\\.cjs\\$\\/,\\s*''\\)\\)\\)/g,\n `fs.readFileSync(require.resolve('../dict/dict.txt'))`\n )\n}\n"],"file":"lmdb-bundling-patch.js"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gatsby",
3
3
  "description": "Blazing fast modern site generator for React",
4
- "version": "4.9.2",
4
+ "version": "4.9.3",
5
5
  "author": "Kyle Mathews <mathews.kyle@gmail.com>",
6
6
  "bin": {
7
7
  "gatsby": "./cli.js"
@@ -35,8 +35,8 @@
35
35
  "babel-plugin-add-module-exports": "^1.0.4",
36
36
  "babel-plugin-dynamic-import-node": "^2.3.3",
37
37
  "babel-plugin-lodash": "^3.3.4",
38
- "babel-plugin-remove-graphql-queries": "^4.9.0",
39
- "babel-preset-gatsby": "^2.9.0",
38
+ "babel-plugin-remove-graphql-queries": "^4.9.1",
39
+ "babel-preset-gatsby": "^2.9.1",
40
40
  "better-opn": "^2.1.1",
41
41
  "bluebird": "^3.7.2",
42
42
  "body-parser": "^1.19.0",
@@ -79,18 +79,18 @@
79
79
  "find-cache-dir": "^3.3.2",
80
80
  "fs-exists-cached": "1.0.0",
81
81
  "fs-extra": "^10.0.0",
82
- "gatsby-cli": "^4.9.0",
83
- "gatsby-core-utils": "^3.9.0",
82
+ "gatsby-cli": "^4.9.1",
83
+ "gatsby-core-utils": "^3.9.1",
84
84
  "gatsby-graphiql-explorer": "^2.9.0",
85
85
  "gatsby-legacy-polyfills": "^2.9.0",
86
- "gatsby-link": "^4.9.0",
87
- "gatsby-page-utils": "^2.9.0",
86
+ "gatsby-link": "^4.9.1",
87
+ "gatsby-page-utils": "^2.9.1",
88
88
  "gatsby-parcel-config": "^0.0.1",
89
- "gatsby-plugin-page-creator": "^4.9.0",
90
- "gatsby-plugin-typescript": "^4.9.0",
89
+ "gatsby-plugin-page-creator": "^4.9.1",
90
+ "gatsby-plugin-typescript": "^4.9.1",
91
91
  "gatsby-plugin-utils": "^3.3.0",
92
92
  "gatsby-react-router-scroll": "^5.9.0",
93
- "gatsby-telemetry": "^3.9.0",
93
+ "gatsby-telemetry": "^3.9.1",
94
94
  "gatsby-worker": "^1.9.0",
95
95
  "glob": "^7.2.0",
96
96
  "got": "^11.8.2",
@@ -264,5 +264,5 @@
264
264
  "yargs": {
265
265
  "boolean-negation": false
266
266
  },
267
- "gitHead": "2cf91b5e25134a7d260d8baaa62d6545a1dd9d72"
267
+ "gitHead": "59e7e0eadfea90ef844b53c0b53d098ad3d51c7a"
268
268
  }