gatsby 5.3.1 → 5.3.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.
- package/dist/bootstrap/get-config-file.js +1 -1
- package/dist/bootstrap/get-config-file.js.map +1 -1
- package/dist/bootstrap/resolve-js-file-path.d.ts +6 -0
- package/dist/bootstrap/resolve-js-file-path.js +12 -0
- package/dist/bootstrap/resolve-js-file-path.js.map +1 -1
- package/dist/bootstrap/resolve-module-exports.js +1 -1
- package/dist/bootstrap/resolve-module-exports.js.map +1 -1
- package/dist/schema/graphql-engine/standalone-regenerate.js +17 -2
- package/dist/schema/graphql-engine/standalone-regenerate.js.map +1 -1
- package/dist/utils/import-gatsby-plugin.js +1 -1
- package/dist/utils/import-gatsby-plugin.js.map +1 -1
- package/dist/utils/webpack/loaders/webpack-remove-exports-loader.js +4 -2
- package/dist/utils/webpack/loaders/webpack-remove-exports-loader.js.map +1 -1
- package/dist/utils/webpack-utils.js +16 -3
- package/dist/utils/webpack-utils.js.map +1 -1
- package/package.json +2 -2
|
@@ -45,7 +45,7 @@ async function attemptImport(siteDirectory, configPath) {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
const importedModule = await import(configFilePath);
|
|
48
|
+
const importedModule = await import((0, _resolveJsFilePath.maybeAddFileProtocol)(configFilePath));
|
|
49
49
|
const configModule = (0, _preferDefault.preferDefault)(importedModule);
|
|
50
50
|
return {
|
|
51
51
|
configFilePath,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-config-file.js","names":["getConfigFile","siteDirectory","configName","distance","compiledResult","attemptImportCompiled","configModule","configFilePath","uncompiledResult","attemptImportUncompiled","attemptImport","configPath","resolveJSFilepath","rootDir","filePath","undefined","importedModule","preferDefault","compiledConfigPath","path","join","COMPILED_CACHE_DIR","error","report","panic","id","context","message","uncompiledConfigPath","testImportError","Error","tsConfig","nearMatch","checkTsAndNearMatch","isTSX","endsWith","isInSrcDir","warn","files","fs","readdir","file","name","ext","parse","isNearMatch"],"sources":["../../src/bootstrap/get-config-file.ts"],"sourcesContent":["import fs from \"fs-extra\"\nimport { testImportError } from \"../utils/test-import-error\"\nimport report from \"gatsby-cli/lib/reporter\"\nimport path from \"path\"\nimport { COMPILED_CACHE_DIR } from \"../utils/parcel/compile-gatsby-files\"\nimport { isNearMatch } from \"../utils/is-near-match\"\nimport { resolveJSFilepath } from \"./resolve-js-file-path\"\nimport { preferDefault } from \"./prefer-default\"\n\nexport async function getConfigFile(\n siteDirectory: string,\n configName: string,\n distance: number = 3\n): Promise<{\n configModule: any\n configFilePath: string\n}> {\n const compiledResult = await attemptImportCompiled(siteDirectory, configName)\n\n if (compiledResult?.configModule && compiledResult?.configFilePath) {\n return compiledResult\n }\n\n const uncompiledResult = await attemptImportUncompiled(\n siteDirectory,\n configName,\n distance\n )\n\n return uncompiledResult || {}\n}\n\nasync function attemptImport(\n siteDirectory: string,\n configPath: string\n): Promise<{\n configModule: unknown\n configFilePath: string\n}> {\n const configFilePath = await resolveJSFilepath({\n rootDir: siteDirectory,\n filePath: configPath,\n })\n\n // The file does not exist, no sense trying to import it\n if (!configFilePath) {\n return { configFilePath: ``, configModule: undefined }\n }\n\n const importedModule = await import(configFilePath)\n const configModule = preferDefault(importedModule)\n\n return { configFilePath, configModule }\n}\n\nasync function attemptImportCompiled(\n siteDirectory: string,\n configName: string\n): Promise<{\n configModule: unknown\n configFilePath: string\n}> {\n let compiledResult\n\n try {\n const compiledConfigPath = path.join(\n `${siteDirectory}/${COMPILED_CACHE_DIR}`,\n configName\n )\n compiledResult = await attemptImport(siteDirectory, compiledConfigPath)\n } catch (error) {\n report.panic({\n id: `11902`,\n error: error,\n context: {\n configName,\n message: error.message,\n },\n })\n }\n\n return compiledResult\n}\n\nasync function attemptImportUncompiled(\n siteDirectory: string,\n configName: string,\n distance: number\n): Promise<{\n configModule: unknown\n configFilePath: string\n}> {\n let uncompiledResult\n\n const uncompiledConfigPath = path.join(siteDirectory, configName)\n\n try {\n uncompiledResult = await attemptImport(siteDirectory, uncompiledConfigPath)\n } catch (error) {\n if (!testImportError(uncompiledConfigPath, error)) {\n report.panic({\n id: `10123`,\n error,\n context: {\n configName,\n message: error.message,\n },\n })\n }\n }\n\n if (uncompiledResult?.configFilePath) {\n return uncompiledResult\n }\n\n const error = new Error(`Cannot find package '${uncompiledConfigPath}'`)\n\n const { tsConfig, nearMatch } = await checkTsAndNearMatch(\n siteDirectory,\n configName,\n distance\n )\n\n // gatsby-config.ts exists but compiled gatsby-config.js does not\n if (tsConfig) {\n report.panic({\n id: `10127`,\n error,\n context: {\n configName,\n },\n })\n }\n\n // gatsby-config is misnamed\n if (nearMatch) {\n const isTSX = nearMatch.endsWith(`.tsx`)\n report.panic({\n id: `10124`,\n error,\n context: {\n configName,\n nearMatch,\n isTSX,\n },\n })\n }\n\n // gatsby-config is incorrectly located in src directory\n const isInSrcDir = await resolveJSFilepath({\n rootDir: siteDirectory,\n filePath: path.join(siteDirectory, `src`, configName),\n warn: false,\n })\n\n if (isInSrcDir) {\n report.panic({\n id: `10125`,\n context: {\n configName,\n },\n })\n }\n\n return uncompiledResult\n}\n\nasync function checkTsAndNearMatch(\n siteDirectory: string,\n configName: string,\n distance: number\n): Promise<{\n tsConfig: boolean\n nearMatch: string\n}> {\n const files = await fs.readdir(siteDirectory)\n\n let tsConfig = false\n let nearMatch = ``\n\n for (const file of files) {\n if (tsConfig || nearMatch) {\n break\n }\n\n const { name, ext } = path.parse(file)\n\n if (name === configName && ext === `.ts`) {\n tsConfig = true\n break\n }\n\n if (isNearMatch(name, configName, distance)) {\n nearMatch = file\n }\n }\n\n return {\n tsConfig,\n nearMatch,\n }\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEO,eAAeA,aAAf,CACLC,aADK,EAELC,UAFK,EAGLC,QAAgB,GAAG,CAHd,EAOJ;EACD,MAAMC,cAAc,GAAG,MAAMC,qBAAqB,CAACJ,aAAD,EAAgBC,UAAhB,CAAlD;;EAEA,IAAIE,cAAc,SAAd,IAAAA,cAAc,WAAd,IAAAA,cAAc,CAAEE,YAAhB,IAAgCF,cAAhC,aAAgCA,cAAhC,eAAgCA,cAAc,CAAEG,cAApD,EAAoE;IAClE,OAAOH,cAAP;EACD;;EAED,MAAMI,gBAAgB,GAAG,MAAMC,uBAAuB,CACpDR,aADoD,EAEpDC,UAFoD,EAGpDC,QAHoD,CAAtD;EAMA,OAAOK,gBAAgB,IAAI,EAA3B;AACD;;AAED,eAAeE,aAAf,CACET,aADF,EAEEU,UAFF,EAMG;EACD,MAAMJ,cAAc,GAAG,MAAM,IAAAK,oCAAA,EAAkB;IAC7CC,OAAO,EAAEZ,aADoC;IAE7Ca,QAAQ,EAAEH;EAFmC,CAAlB,CAA7B,CADC,CAMD;;EACA,IAAI,CAACJ,cAAL,EAAqB;IACnB,OAAO;MAAEA,cAAc,EAAG,EAAnB;MAAsBD,YAAY,EAAES;IAApC,CAAP;EACD;;EAED,MAAMC,cAAc,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"get-config-file.js","names":["getConfigFile","siteDirectory","configName","distance","compiledResult","attemptImportCompiled","configModule","configFilePath","uncompiledResult","attemptImportUncompiled","attemptImport","configPath","resolveJSFilepath","rootDir","filePath","undefined","importedModule","maybeAddFileProtocol","preferDefault","compiledConfigPath","path","join","COMPILED_CACHE_DIR","error","report","panic","id","context","message","uncompiledConfigPath","testImportError","Error","tsConfig","nearMatch","checkTsAndNearMatch","isTSX","endsWith","isInSrcDir","warn","files","fs","readdir","file","name","ext","parse","isNearMatch"],"sources":["../../src/bootstrap/get-config-file.ts"],"sourcesContent":["import fs from \"fs-extra\"\nimport { testImportError } from \"../utils/test-import-error\"\nimport report from \"gatsby-cli/lib/reporter\"\nimport path from \"path\"\nimport { COMPILED_CACHE_DIR } from \"../utils/parcel/compile-gatsby-files\"\nimport { isNearMatch } from \"../utils/is-near-match\"\nimport { resolveJSFilepath, maybeAddFileProtocol } from \"./resolve-js-file-path\"\nimport { preferDefault } from \"./prefer-default\"\n\nexport async function getConfigFile(\n siteDirectory: string,\n configName: string,\n distance: number = 3\n): Promise<{\n configModule: any\n configFilePath: string\n}> {\n const compiledResult = await attemptImportCompiled(siteDirectory, configName)\n\n if (compiledResult?.configModule && compiledResult?.configFilePath) {\n return compiledResult\n }\n\n const uncompiledResult = await attemptImportUncompiled(\n siteDirectory,\n configName,\n distance\n )\n\n return uncompiledResult || {}\n}\n\nasync function attemptImport(\n siteDirectory: string,\n configPath: string\n): Promise<{\n configModule: unknown\n configFilePath: string\n}> {\n const configFilePath = await resolveJSFilepath({\n rootDir: siteDirectory,\n filePath: configPath,\n })\n\n // The file does not exist, no sense trying to import it\n if (!configFilePath) {\n return { configFilePath: ``, configModule: undefined }\n }\n\n const importedModule = await import(maybeAddFileProtocol(configFilePath))\n const configModule = preferDefault(importedModule)\n\n return { configFilePath, configModule }\n}\n\nasync function attemptImportCompiled(\n siteDirectory: string,\n configName: string\n): Promise<{\n configModule: unknown\n configFilePath: string\n}> {\n let compiledResult\n\n try {\n const compiledConfigPath = path.join(\n `${siteDirectory}/${COMPILED_CACHE_DIR}`,\n configName\n )\n compiledResult = await attemptImport(siteDirectory, compiledConfigPath)\n } catch (error) {\n report.panic({\n id: `11902`,\n error: error,\n context: {\n configName,\n message: error.message,\n },\n })\n }\n\n return compiledResult\n}\n\nasync function attemptImportUncompiled(\n siteDirectory: string,\n configName: string,\n distance: number\n): Promise<{\n configModule: unknown\n configFilePath: string\n}> {\n let uncompiledResult\n\n const uncompiledConfigPath = path.join(siteDirectory, configName)\n\n try {\n uncompiledResult = await attemptImport(siteDirectory, uncompiledConfigPath)\n } catch (error) {\n if (!testImportError(uncompiledConfigPath, error)) {\n report.panic({\n id: `10123`,\n error,\n context: {\n configName,\n message: error.message,\n },\n })\n }\n }\n\n if (uncompiledResult?.configFilePath) {\n return uncompiledResult\n }\n\n const error = new Error(`Cannot find package '${uncompiledConfigPath}'`)\n\n const { tsConfig, nearMatch } = await checkTsAndNearMatch(\n siteDirectory,\n configName,\n distance\n )\n\n // gatsby-config.ts exists but compiled gatsby-config.js does not\n if (tsConfig) {\n report.panic({\n id: `10127`,\n error,\n context: {\n configName,\n },\n })\n }\n\n // gatsby-config is misnamed\n if (nearMatch) {\n const isTSX = nearMatch.endsWith(`.tsx`)\n report.panic({\n id: `10124`,\n error,\n context: {\n configName,\n nearMatch,\n isTSX,\n },\n })\n }\n\n // gatsby-config is incorrectly located in src directory\n const isInSrcDir = await resolveJSFilepath({\n rootDir: siteDirectory,\n filePath: path.join(siteDirectory, `src`, configName),\n warn: false,\n })\n\n if (isInSrcDir) {\n report.panic({\n id: `10125`,\n context: {\n configName,\n },\n })\n }\n\n return uncompiledResult\n}\n\nasync function checkTsAndNearMatch(\n siteDirectory: string,\n configName: string,\n distance: number\n): Promise<{\n tsConfig: boolean\n nearMatch: string\n}> {\n const files = await fs.readdir(siteDirectory)\n\n let tsConfig = false\n let nearMatch = ``\n\n for (const file of files) {\n if (tsConfig || nearMatch) {\n break\n }\n\n const { name, ext } = path.parse(file)\n\n if (name === configName && ext === `.ts`) {\n tsConfig = true\n break\n }\n\n if (isNearMatch(name, configName, distance)) {\n nearMatch = file\n }\n }\n\n return {\n tsConfig,\n nearMatch,\n }\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEO,eAAeA,aAAf,CACLC,aADK,EAELC,UAFK,EAGLC,QAAgB,GAAG,CAHd,EAOJ;EACD,MAAMC,cAAc,GAAG,MAAMC,qBAAqB,CAACJ,aAAD,EAAgBC,UAAhB,CAAlD;;EAEA,IAAIE,cAAc,SAAd,IAAAA,cAAc,WAAd,IAAAA,cAAc,CAAEE,YAAhB,IAAgCF,cAAhC,aAAgCA,cAAhC,eAAgCA,cAAc,CAAEG,cAApD,EAAoE;IAClE,OAAOH,cAAP;EACD;;EAED,MAAMI,gBAAgB,GAA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EAA0B,KAA1B,EAAgCC,UAAhC,CAF+B;IAGzCoC,IAAI,EAAE;EAHmC,CAAlB,CAAzB;;EAMA,IAAID,UAAJ,EAAgB;IACdb,iBAAA,CAAOC,KAAP,CAAa;MACXC,EAAE,EAAG,OADM;MAEXC,OAAO,EAAE;QACPzB;MADO;IAFE,CAAb;EAMD;;EAED,OAAOM,gBAAP;AACD;;AAED,eAAe0B,mBAAf,CACEjC,aADF,EAEEC,UAFF,EAGEC,QAHF,EAOG;EACD,MAAMoC,KAAK,GAAG,MAAMC,gBAAA,CAAGC,OAAH,CAAWxC,aAAX,CAApB;EAEA,IAAI+B,QAAQ,GAAG,KAAf;EACA,IAAIC,SAAS,GAAI,EAAjB;;EAEA,KAAK,MAAMS,IAAX,IAAmBH,KAAnB,EAA0B;IACxB,IAAIP,QAAQ,IAAIC,SAAhB,EAA2B;MACzB;IACD;;IAED,MAAM;MAAEU,IAAF;MAAQC;IAAR,IAAgBxB,aAAA,CAAKyB,KAAL,CAAWH,IAAX,CAAtB;;IAEA,IAAIC,IAAI,KAAKzC,UAAT,IAAuB0C,GAAG,KAAM,KAApC,EAA0C;MACxCZ,QAAQ,GAAG,IAAX;MACA;IACD;;IAED,IAAI,IAAAc,wBAAA,EAAYH,IAAZ,EAAkBzC,UAAlB,EAA8BC,QAA9B,CAAJ,EAA6C;MAC3C8B,SAAS,GAAGS,IAAZ;IACD;EACF;;EAED,OAAO;IACLV,QADK;IAELC;EAFK,CAAP;AAID"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* On Windows, the file protocol is required for the path to be resolved correctly.
|
|
3
|
+
* On other platforms, the file protocol is not required, but supported, so we want to just always use it.
|
|
4
|
+
* Except jest doesn't work with that and in that environment we never add the file protocol.
|
|
5
|
+
*/
|
|
6
|
+
export declare const maybeAddFileProtocol: (module: string) => string;
|
|
1
7
|
/**
|
|
2
8
|
* Figure out if the file path is .js or .mjs without relying on the fs module, and return the file path if it exists.
|
|
3
9
|
*/
|
|
@@ -3,15 +3,27 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
5
|
exports.__esModule = true;
|
|
6
|
+
exports.maybeAddFileProtocol = void 0;
|
|
6
7
|
exports.resolveJSFilepath = resolveJSFilepath;
|
|
7
8
|
|
|
8
9
|
var _path = _interopRequireDefault(require("path"));
|
|
9
10
|
|
|
11
|
+
var _url = require("url");
|
|
12
|
+
|
|
10
13
|
var _reporter = _interopRequireDefault(require("gatsby-cli/lib/reporter"));
|
|
11
14
|
|
|
15
|
+
/**
|
|
16
|
+
* On Windows, the file protocol is required for the path to be resolved correctly.
|
|
17
|
+
* On other platforms, the file protocol is not required, but supported, so we want to just always use it.
|
|
18
|
+
* Except jest doesn't work with that and in that environment we never add the file protocol.
|
|
19
|
+
*/
|
|
20
|
+
const maybeAddFileProtocol = process.env.JEST_WORKER_ID ? module => module : module => (0, _url.pathToFileURL)(module).href;
|
|
12
21
|
/**
|
|
13
22
|
* Figure out if the file path is .js or .mjs without relying on the fs module, and return the file path if it exists.
|
|
14
23
|
*/
|
|
24
|
+
|
|
25
|
+
exports.maybeAddFileProtocol = maybeAddFileProtocol;
|
|
26
|
+
|
|
15
27
|
async function resolveJSFilepath({
|
|
16
28
|
rootDir,
|
|
17
29
|
filePath,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-js-file-path.js","names":["resolveJSFilepath","rootDir","filePath","warn","filePathWithJSExtension","endsWith","filePathWithMJSExtension","require","resolve","report","path","relative","_"],"sources":["../../src/bootstrap/resolve-js-file-path.ts"],"sourcesContent":["import path from \"path\"\nimport report from \"gatsby-cli/lib/reporter\"\n\n/**\n * Figure out if the file path is .js or .mjs without relying on the fs module, and return the file path if it exists.\n */\nexport async function resolveJSFilepath({\n rootDir,\n filePath,\n warn = true,\n}: {\n rootDir: string\n filePath: string\n warn?: boolean\n}): Promise<string> {\n const filePathWithJSExtension = filePath.endsWith(`.js`)\n ? filePath\n : `${filePath}.js`\n const filePathWithMJSExtension = filePath.endsWith(`.mjs`)\n ? filePath\n : `${filePath}.mjs`\n\n // Check if both variants exist\n try {\n if (\n require.resolve(filePathWithJSExtension) &&\n require.resolve(filePathWithMJSExtension)\n ) {\n if (warn) {\n report.warn(\n `The file '${path.relative(\n rootDir,\n filePath\n )}' has both .js and .mjs variants, please use one or the other. Using .js by default.`\n )\n }\n return filePathWithJSExtension\n }\n } catch (_) {\n // Do nothing\n }\n\n // Check if .js variant exists\n try {\n if (require.resolve(filePathWithJSExtension)) {\n return filePathWithJSExtension\n }\n } catch (_) {\n // Do nothing\n }\n\n try {\n if (require.resolve(filePathWithMJSExtension)) {\n return filePathWithMJSExtension\n }\n } catch (_) {\n // Do nothing\n }\n\n return ``\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolve-js-file-path.js","names":["maybeAddFileProtocol","process","env","JEST_WORKER_ID","module","pathToFileURL","href","resolveJSFilepath","rootDir","filePath","warn","filePathWithJSExtension","endsWith","filePathWithMJSExtension","require","resolve","report","path","relative","_"],"sources":["../../src/bootstrap/resolve-js-file-path.ts"],"sourcesContent":["import path from \"path\"\nimport { pathToFileURL } from \"url\"\nimport report from \"gatsby-cli/lib/reporter\"\n\n/**\n * On Windows, the file protocol is required for the path to be resolved correctly.\n * On other platforms, the file protocol is not required, but supported, so we want to just always use it.\n * Except jest doesn't work with that and in that environment we never add the file protocol.\n */\nexport const maybeAddFileProtocol = process.env.JEST_WORKER_ID\n ? (module: string): string => module\n : (module: string): string => pathToFileURL(module).href\n\n/**\n * Figure out if the file path is .js or .mjs without relying on the fs module, and return the file path if it exists.\n */\nexport async function resolveJSFilepath({\n rootDir,\n filePath,\n warn = true,\n}: {\n rootDir: string\n filePath: string\n warn?: boolean\n}): Promise<string> {\n const filePathWithJSExtension = filePath.endsWith(`.js`)\n ? filePath\n : `${filePath}.js`\n const filePathWithMJSExtension = filePath.endsWith(`.mjs`)\n ? filePath\n : `${filePath}.mjs`\n\n // Check if both variants exist\n try {\n if (\n require.resolve(filePathWithJSExtension) &&\n require.resolve(filePathWithMJSExtension)\n ) {\n if (warn) {\n report.warn(\n `The file '${path.relative(\n rootDir,\n filePath\n )}' has both .js and .mjs variants, please use one or the other. Using .js by default.`\n )\n }\n return filePathWithJSExtension\n }\n } catch (_) {\n // Do nothing\n }\n\n // Check if .js variant exists\n try {\n if (require.resolve(filePathWithJSExtension)) {\n return filePathWithJSExtension\n }\n } catch (_) {\n // Do nothing\n }\n\n try {\n if (require.resolve(filePathWithMJSExtension)) {\n return filePathWithMJSExtension\n }\n } catch (_) {\n // Do nothing\n }\n\n return ``\n}\n"],"mappings":";;;;;;;;AAAA;;AACA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO,MAAMA,oBAAoB,GAAGC,OAAO,CAACC,GAAR,CAAYC,cAAZ,GAC/BC,MAAD,IAA4BA,MADI,GAE/BA,MAAD,IAA4B,IAAAC,kBAAA,EAAcD,MAAd,EAAsBE,IAF/C;AAIP;AACA;AACA;;;;AACO,eAAeC,iBAAf,CAAiC;EACtCC,OADsC;EAEtCC,QAFsC;EAGtCC,IAAI,GAAG;AAH+B,CAAjC,EAQa;EAClB,MAAMC,uBAAuB,GAAGF,QAAQ,CAACG,QAAT,CAAmB,KAAnB,IAC5BH,QAD4B,GAE3B,GAAEA,QAAS,KAFhB;EAGA,MAAMI,wBAAwB,GAAGJ,QAAQ,CAACG,QAAT,CAAmB,MAAnB,IAC7BH,QAD6B,GAE5B,GAAEA,QAAS,MAFhB,CAJkB,CAQlB;;EACA,IAAI;IACF,IACEK,OAAO,CAACC,OAAR,CAAgBJ,uBAAhB,KACAG,OAAO,CAACC,OAAR,CAAgBF,wBAAhB,CAFF,EAGE;MACA,IAAIH,IAAJ,EAAU;QACRM,iBAAA,CAAON,IAAP,CACG,aAAYO,aAAA,CAAKC,QAAL,CACXV,OADW,EAEXC,QAFW,CAGX,sFAJJ;MAMD;;MACD,OAAOE,uBAAP;IACD;EACF,CAfD,CAeE,OAAOQ,CAAP,EAAU,CACV;EACD,CA1BiB,CA4BlB;;;EACA,IAAI;IACF,IAAIL,OAAO,CAACC,OAAR,CAAgBJ,uBAAhB,CAAJ,EAA8C;MAC5C,OAAOA,uBAAP;IACD;EACF,CAJD,CAIE,OAAOQ,CAAP,EAAU,CACV;EACD;;EAED,IAAI;IACF,IAAIL,OAAO,CAACC,OAAR,CAAgBF,wBAAhB,CAAJ,EAA+C;MAC7C,OAAOA,wBAAP;IACD;EACF,CAJD,CAIE,OAAOM,CAAP,EAAU,CACV;EACD;;EAED,OAAQ,EAAR;AACD"}
|
|
@@ -200,7 +200,7 @@ async function resolveModuleExports(modulePath, {
|
|
|
200
200
|
return [];
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
const rawImportedModule = await import(moduleFilePath); // If the module is cjs, the properties we care about are nested under a top-level `default` property
|
|
203
|
+
const rawImportedModule = await import((0, _resolveJsFilePath.maybeAddFileProtocol)(moduleFilePath)); // If the module is cjs, the properties we care about are nested under a top-level `default` property
|
|
204
204
|
|
|
205
205
|
const importedModule = (0, _preferDefault.preferDefault)(rawImportedModule);
|
|
206
206
|
return Object.keys(importedModule).filter(exportName => exportName !== `__esModule`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-module-exports.js","names":["staticallyAnalyzeExports","modulePath","resolver","resolveModule","absPath","exportNames","err","code","fs","readFileSync","ast","babelParseToAst","SyntaxError","codeFrame","codeFrameColumns","start","loc","highlightCode","report","panic","message","isCommonJS","isES6","traverse","ImportDeclaration","ExportNamedDeclaration","astPath","declaration","node","type","declarations","id","push","name","ExportSpecifier","exp","exported","exportName","ExportDefaultDeclaration","t","isIdentifier","isArrowFunctionExpression","isFunctionDeclaration","AssignmentExpression","nodeLeft","left","isMemberExpression","property","object","process","env","NODE_ENV","resolveModuleExports","mode","rootDir","cwd","moduleFilePath","resolveJSFilepath","filePath","rawImportedModule","importedModule","preferDefault","Object","keys","filter","error","testImportError"],"sources":["../../src/bootstrap/resolve-module-exports.ts"],"sourcesContent":["import * as fs from \"fs-extra\"\nimport * as t from \"@babel/types\"\nimport traverse from \"@babel/traverse\"\nimport { codeFrameColumns, SourceLocation } from \"@babel/code-frame\"\nimport report from \"gatsby-cli/lib/reporter\"\nimport { babelParseToAst } from \"../utils/babel-parse-to-ast\"\nimport { testImportError } from \"../utils/test-import-error\"\nimport { resolveModule, ModuleResolver } from \"../utils/module-resolver\"\nimport { resolveJSFilepath } from \"./resolve-js-file-path\"\nimport { preferDefault } from \"./prefer-default\"\n\nconst staticallyAnalyzeExports = (\n modulePath: string,\n resolver = resolveModule\n): Array<string> => {\n let absPath: string | undefined\n const exportNames: Array<string> = []\n\n try {\n absPath = resolver(modulePath) as string\n } catch (err) {\n return exportNames // doesn't exist\n }\n const code = fs.readFileSync(absPath, `utf8`) // get file contents\n\n let ast\n try {\n ast = babelParseToAst(code, absPath)\n } catch (err) {\n if (err instanceof SyntaxError) {\n // Pretty print syntax errors\n const codeFrame = codeFrameColumns(\n code,\n {\n start: (err as unknown as { loc: SourceLocation[\"start\"] }).loc,\n },\n {\n highlightCode: true,\n }\n )\n\n report.panic(\n `Syntax error in \"${absPath}\":\\n${err.message}\\n${codeFrame}`\n )\n } else {\n // if it's not syntax error, just throw it\n throw err\n }\n }\n\n let isCommonJS = false\n let isES6 = false\n\n // extract names of exports from file\n traverse(ast, {\n // Check if the file is using ES6 imports\n ImportDeclaration: function ImportDeclaration() {\n isES6 = true\n },\n\n ExportNamedDeclaration: function ExportNamedDeclaration(astPath) {\n const declaration = astPath.node.declaration\n\n // get foo from `export const foo = bar`\n if (\n declaration?.type === `VariableDeclaration` &&\n declaration.declarations[0]?.id.type === `Identifier`\n ) {\n isES6 = true\n exportNames.push(declaration.declarations[0].id.name)\n }\n\n // get foo from `export function foo()`\n if (\n declaration?.type === `FunctionDeclaration` &&\n declaration.id?.type === `Identifier`\n ) {\n isES6 = true\n exportNames.push(declaration.id.name)\n }\n },\n\n // get foo from `export { foo } from 'bar'`\n // get foo from `export { foo }`\n ExportSpecifier: function ExportSpecifier(astPath) {\n isES6 = true\n const exp = astPath?.node?.exported\n if (!exp) {\n return\n }\n if (exp.type === `Identifier`) {\n const exportName = exp.name\n if (exportName) {\n exportNames.push(exportName)\n }\n }\n },\n\n // export default () => {}\n // export default function() {}\n // export default function foo() {}\n // const foo = () => {}; export default foo\n ExportDefaultDeclaration: function ExportDefaultDeclaration(astPath) {\n const declaration = astPath.node.declaration\n if (\n !t.isIdentifier(declaration) &&\n !t.isArrowFunctionExpression(declaration) &&\n !t.isFunctionDeclaration(declaration)\n ) {\n return\n }\n\n let name = ``\n if (t.isIdentifier(declaration)) {\n name = declaration.name\n } else if (t.isFunctionDeclaration(declaration) && declaration.id) {\n name = declaration.id.name\n }\n\n const exportName = `export default${name ? ` ${name}` : ``}`\n isES6 = true\n exportNames.push(exportName)\n },\n\n AssignmentExpression: function AssignmentExpression(astPath) {\n const nodeLeft = astPath.node.left\n\n if (!t.isMemberExpression(nodeLeft)) {\n return\n }\n\n // ignore marker property `__esModule`\n if (\n t.isIdentifier(nodeLeft.property) &&\n nodeLeft.property.name === `__esModule`\n ) {\n return\n }\n\n // get foo from `exports.foo = bar`\n if (\n t.isIdentifier(nodeLeft.object) &&\n nodeLeft.object.name === `exports`\n ) {\n isCommonJS = true\n exportNames.push((nodeLeft.property as t.Identifier).name)\n }\n\n // get foo from `module.exports.foo = bar`\n if (t.isMemberExpression(nodeLeft.object)) {\n const exp: t.MemberExpression = nodeLeft.object\n\n if (\n t.isIdentifier(exp.object) &&\n t.isIdentifier(exp.property) &&\n exp.object.name === `module` &&\n exp.property.name === `exports`\n ) {\n isCommonJS = true\n exportNames.push((nodeLeft.property as t.Identifier).name)\n }\n }\n },\n })\n\n if (isES6 && isCommonJS && process.env.NODE_ENV !== `test`) {\n report.panic(\n `This plugin file is using both CommonJS and ES6 module systems together which we don't support.\nYou'll need to edit the file to use just one or the other.\n\nplugin: ${modulePath}.js\n\nThis didn't cause a problem in Gatsby v1 so you might want to review the migration doc for this:\nhttps://gatsby.dev/no-mixed-modules\n `\n )\n }\n return exportNames\n}\n\ninterface IResolveModuleExportsOptions {\n mode?: `analysis` | `import`\n resolver?: ModuleResolver\n rootDir?: string\n}\n\n/**\n * Given a path to a module, return an array of the module's exports.\n *\n * It can run in two modes:\n * 1. `analysis` mode gets exports via static analysis by traversing the file's AST with babel\n * 2. `import` mode gets exports by directly importing the module and accessing its properties\n *\n * At the time of writing, analysis mode is used for files that can be jsx (e.g. gatsby-browser, gatsby-ssr)\n * and import mode is used for files that can be js or mjs.\n *\n * Returns [] for invalid paths and modules without exports.\n */\nexport async function resolveModuleExports(\n modulePath: string,\n {\n mode = `analysis`,\n resolver = resolveModule,\n rootDir = process.cwd(),\n }: IResolveModuleExportsOptions = {}\n): Promise<Array<string>> {\n if (mode === `import`) {\n try {\n const moduleFilePath = await resolveJSFilepath({\n rootDir,\n filePath: modulePath,\n })\n\n if (!moduleFilePath) {\n return []\n }\n\n const rawImportedModule = await import(moduleFilePath)\n\n // If the module is cjs, the properties we care about are nested under a top-level `default` property\n const importedModule = preferDefault(rawImportedModule)\n\n return Object.keys(importedModule).filter(\n exportName => exportName !== `__esModule`\n )\n } catch (error) {\n if (!testImportError(modulePath, error)) {\n // if module exists, but requiring it cause errors,\n // show the error to the user and terminate build\n report.panic(`Error in \"${modulePath}\":`, error)\n }\n }\n } else {\n return staticallyAnalyzeExports(modulePath, resolver)\n }\n\n return []\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,MAAMA,wBAAwB,GAAG,CAC/BC,UAD+B,EAE/BC,QAAQ,GAAGC,6BAFoB,KAGb;EAClB,IAAIC,OAAJ;EACA,MAAMC,WAA0B,GAAG,EAAnC;;EAEA,IAAI;IACFD,OAAO,GAAGF,QAAQ,CAACD,UAAD,CAAlB;EACD,CAFD,CAEE,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lB,UAAW,IAArC,EAA0CgE,KAA1C;MACD;IACF;EACF,CA1BD,MA0BO;IACL,OAAOjE,wBAAwB,CAACC,UAAD,EAAaC,QAAb,CAA/B;EACD;;EAED,OAAO,EAAP;AACD"}
|
|
1
|
+
{"version":3,"file":"resolve-module-exports.js","names":["staticallyAnalyzeExports","modulePath","resolver","resolveModule","absPath","exportNames","err","code","fs","readFileSync","ast","babelParseToAst","SyntaxError","codeFrame","codeFrameColumns","start","loc","highlightCode","report","panic","message","isCommonJS","isES6","traverse","ImportDeclaration","ExportNamedDeclaration","astPath","declaration","node","type","declarations","id","push","name","ExportSpecifier","exp","exported","exportName","ExportDefaultDeclaration","t","isIdentifier","isArrowFunctionExpression","isFunctionDeclaration","AssignmentExpression","nodeLeft","left","isMemberExpression","property","object","process","env","NODE_ENV","resolveModuleExports","mode","rootDir","cwd","moduleFilePath","resolveJSFilepath","filePath","rawImportedModule","maybeAddFileProtocol","importedModule","preferDefault","Object","keys","filter","error","testImportError"],"sources":["../../src/bootstrap/resolve-module-exports.ts"],"sourcesContent":["import * as fs from \"fs-extra\"\nimport * as t from \"@babel/types\"\nimport traverse from \"@babel/traverse\"\nimport { codeFrameColumns, SourceLocation } from \"@babel/code-frame\"\nimport report from \"gatsby-cli/lib/reporter\"\nimport { babelParseToAst } from \"../utils/babel-parse-to-ast\"\nimport { testImportError } from \"../utils/test-import-error\"\nimport { resolveModule, ModuleResolver } from \"../utils/module-resolver\"\nimport { maybeAddFileProtocol, resolveJSFilepath } from \"./resolve-js-file-path\"\nimport { preferDefault } from \"./prefer-default\"\n\nconst staticallyAnalyzeExports = (\n modulePath: string,\n resolver = resolveModule\n): Array<string> => {\n let absPath: string | undefined\n const exportNames: Array<string> = []\n\n try {\n absPath = resolver(modulePath) as string\n } catch (err) {\n return exportNames // doesn't exist\n }\n const code = fs.readFileSync(absPath, `utf8`) // get file contents\n\n let ast\n try {\n ast = babelParseToAst(code, absPath)\n } catch (err) {\n if (err instanceof SyntaxError) {\n // Pretty print syntax errors\n const codeFrame = codeFrameColumns(\n code,\n {\n start: (err as unknown as { loc: SourceLocation[\"start\"] }).loc,\n },\n {\n highlightCode: true,\n }\n )\n\n report.panic(\n `Syntax error in \"${absPath}\":\\n${err.message}\\n${codeFrame}`\n )\n } else {\n // if it's not syntax error, just throw it\n throw err\n }\n }\n\n let isCommonJS = false\n let isES6 = false\n\n // extract names of exports from file\n traverse(ast, {\n // Check if the file is using ES6 imports\n ImportDeclaration: function ImportDeclaration() {\n isES6 = true\n },\n\n ExportNamedDeclaration: function ExportNamedDeclaration(astPath) {\n const declaration = astPath.node.declaration\n\n // get foo from `export const foo = bar`\n if (\n declaration?.type === `VariableDeclaration` &&\n declaration.declarations[0]?.id.type === `Identifier`\n ) {\n isES6 = true\n exportNames.push(declaration.declarations[0].id.name)\n }\n\n // get foo from `export function foo()`\n if (\n declaration?.type === `FunctionDeclaration` &&\n declaration.id?.type === `Identifier`\n ) {\n isES6 = true\n exportNames.push(declaration.id.name)\n }\n },\n\n // get foo from `export { foo } from 'bar'`\n // get foo from `export { foo }`\n ExportSpecifier: function ExportSpecifier(astPath) {\n isES6 = true\n const exp = astPath?.node?.exported\n if (!exp) {\n return\n }\n if (exp.type === `Identifier`) {\n const exportName = exp.name\n if (exportName) {\n exportNames.push(exportName)\n }\n }\n },\n\n // export default () => {}\n // export default function() {}\n // export default function foo() {}\n // const foo = () => {}; export default foo\n ExportDefaultDeclaration: function ExportDefaultDeclaration(astPath) {\n const declaration = astPath.node.declaration\n if (\n !t.isIdentifier(declaration) &&\n !t.isArrowFunctionExpression(declaration) &&\n !t.isFunctionDeclaration(declaration)\n ) {\n return\n }\n\n let name = ``\n if (t.isIdentifier(declaration)) {\n name = declaration.name\n } else if (t.isFunctionDeclaration(declaration) && declaration.id) {\n name = declaration.id.name\n }\n\n const exportName = `export default${name ? ` ${name}` : ``}`\n isES6 = true\n exportNames.push(exportName)\n },\n\n AssignmentExpression: function AssignmentExpression(astPath) {\n const nodeLeft = astPath.node.left\n\n if (!t.isMemberExpression(nodeLeft)) {\n return\n }\n\n // ignore marker property `__esModule`\n if (\n t.isIdentifier(nodeLeft.property) &&\n nodeLeft.property.name === `__esModule`\n ) {\n return\n }\n\n // get foo from `exports.foo = bar`\n if (\n t.isIdentifier(nodeLeft.object) &&\n nodeLeft.object.name === `exports`\n ) {\n isCommonJS = true\n exportNames.push((nodeLeft.property as t.Identifier).name)\n }\n\n // get foo from `module.exports.foo = bar`\n if (t.isMemberExpression(nodeLeft.object)) {\n const exp: t.MemberExpression = nodeLeft.object\n\n if (\n t.isIdentifier(exp.object) &&\n t.isIdentifier(exp.property) &&\n exp.object.name === `module` &&\n exp.property.name === `exports`\n ) {\n isCommonJS = true\n exportNames.push((nodeLeft.property as t.Identifier).name)\n }\n }\n },\n })\n\n if (isES6 && isCommonJS && process.env.NODE_ENV !== `test`) {\n report.panic(\n `This plugin file is using both CommonJS and ES6 module systems together which we don't support.\nYou'll need to edit the file to use just one or the other.\n\nplugin: ${modulePath}.js\n\nThis didn't cause a problem in Gatsby v1 so you might want to review the migration doc for this:\nhttps://gatsby.dev/no-mixed-modules\n `\n )\n }\n return exportNames\n}\n\ninterface IResolveModuleExportsOptions {\n mode?: `analysis` | `import`\n resolver?: ModuleResolver\n rootDir?: string\n}\n\n/**\n * Given a path to a module, return an array of the module's exports.\n *\n * It can run in two modes:\n * 1. `analysis` mode gets exports via static analysis by traversing the file's AST with babel\n * 2. `import` mode gets exports by directly importing the module and accessing its properties\n *\n * At the time of writing, analysis mode is used for files that can be jsx (e.g. gatsby-browser, gatsby-ssr)\n * and import mode is used for files that can be js or mjs.\n *\n * Returns [] for invalid paths and modules without exports.\n */\nexport async function resolveModuleExports(\n modulePath: string,\n {\n mode = `analysis`,\n resolver = resolveModule,\n rootDir = process.cwd(),\n }: IResolveModuleExportsOptions = {}\n): Promise<Array<string>> {\n if (mode === `import`) {\n try {\n const moduleFilePath = await resolveJSFilepath({\n rootDir,\n filePath: modulePath,\n })\n\n if (!moduleFilePath) {\n return []\n }\n\n const rawImportedModule = await import(\n maybeAddFileProtocol(moduleFilePath)\n )\n\n // If the module is cjs, the properties we care about are nested under a top-level `default` property\n const importedModule = preferDefault(rawImportedModule)\n\n return Object.keys(importedModule).filter(\n exportName => exportName !== `__esModule`\n )\n } catch (error) {\n if (!testImportError(modulePath, error)) {\n // if module exists, but requiring it cause errors,\n // show the error to the user and terminate build\n report.panic(`Error in \"${modulePath}\":`, error)\n }\n }\n } else {\n return staticallyAnalyzeExports(modulePath, resolver)\n }\n\n return []\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,MAAMA,wBAAwB,GAAG,CAC/BC,UAD+B,EAE/BC,QAAQ,GAAGC,6BAFoB,KAGb;EAClB,IAAIC,OAAJ;EACA,MAAMC,WAA0B,GAAG,EAAnC;;EAEA,IAAI;IACFD,OAAO,GAAGF,QAAQ,CAACD,UAAD,CAAlB;EACD,CAFD,CAEE,OAAOK,GAAP,EAAY;IACZ,OAAOD,WAAP,CADY,CACO;EACpB;;EACD,MAAME,IAAI,GAAGC,EAAE,CAACC,YAAH,CAAgBL,OAAhB,EAA0B,MAA1B,CAAb,CATkB,CAS4B;;EAE9C,IAAIM,GAAJ;;EACA,IAAI;IACFA,GAAG,GAAG,IAAAC,gCAAA,EAAgBJ,IAAhB,EAAsBH,OAAtB,CAAN;EACD,CAFD,CAEE,OAAOE,GAAP,EAAY;IACZ,IAAIA,GAAG,YAAYM,WAAnB,EAAgC;MAC9B;MACA,MAAMC,SAAS,GAAG,IAAAC,2BAAA,EAChBP,IADgB,EAEhB;QACEQ,KAAK,EAAGT,GAAD,CAAqDU;MAD9D,CAFgB,EAKhB;QACEC,aAAa,EAAE;MADjB,CALgB,CAAlB;;MAUAC,iBAAA,CAAOC,KAAP,CACG,oBAAmBf,OAAQ,OAAME,GAAG,CAACc,OAAQ,KAAIP,SAAU,EAD9D;IAGD,CAfD,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N7B,EAOmB;EACxB,IAAIF,IAAI,KAAM,QAAd,EAAuB;IACrB,IAAI;MACF,MAAMG,cAAc,GAAG,MAAM,IAAAC,oCAAA,EAAkB;QAC7CH,OAD6C;QAE7CI,QAAQ,EAAEzD;MAFmC,CAAlB,CAA7B;;MAKA,IAAI,CAACuD,cAAL,EAAqB;QACnB,OAAO,EAAP;MACD;;MAED,MAAMG,iBAAiB,GAAG,MAAM,OAC9B,IAAAC,uCAAA,EAAqBJ,cAArB,CAD8B,CAAhC,CAVE,CAcF;;MACA,MAAMK,cAAc,GAAG,IAAAC,4BAAA,EAAcH,iBAAd,CAAvB;MAEA,OAAOI,MAAM,CAACC,IAAP,CAAYH,cAAZ,EAA4BI,MAA5B,CACL5B,UAAU,IAAIA,UAAU,KAAM,YADzB,CAAP;IAGD,CApBD,CAoBE,OAAO6B,KAAP,EAAc;MACd,IAAI,CAAC,IAAAC,gCAAA,EAAgBlE,UAAhB,EAA4BiE,KAA5B,CAAL,EAAyC;QACvC;QACA;QACAhD,iBAAA,CAAOC,KAAP,CAAc,aAAYlB,UAAW,IAArC,EAA0CiE,KAA1C;MACD;IACF;EACF,CA5BD,MA4BO;IACL,OAAOlE,wBAAwB,CAACC,UAAD,EAAaC,QAAb,CAA/B;EACD;;EAED,OAAO,EAAP;AACD"}
|
|
@@ -22,12 +22,16 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
22
22
|
|
|
23
23
|
var _bundleWebpack = require("./bundle-webpack");
|
|
24
24
|
|
|
25
|
+
var _bundleWebpack2 = require("./../../utils/page-ssr-module/bundle-webpack");
|
|
26
|
+
|
|
25
27
|
var _reporter = _interopRequireDefault(require("gatsby-cli/lib/reporter"));
|
|
26
28
|
|
|
27
29
|
var _loadConfigAndPlugins = require("../../utils/worker/child/load-config-and-plugins");
|
|
28
30
|
|
|
29
31
|
var fs = _interopRequireWildcard(require("fs-extra"));
|
|
30
32
|
|
|
33
|
+
var _redux = require("../../redux");
|
|
34
|
+
|
|
31
35
|
var _validateEngines = require("../../utils/validate-engines");
|
|
32
36
|
|
|
33
37
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -45,15 +49,26 @@ async function run() {
|
|
|
45
49
|
console.log(`clearing webpack cache\n\n`); // get rid of cache if it exist
|
|
46
50
|
|
|
47
51
|
await fs.remove(process.cwd() + `/.cache/webpack/query-engine`);
|
|
52
|
+
await fs.remove(process.cwd() + `/.cache/webpack/page-ssr`);
|
|
48
53
|
} catch (e) {// eslint-disable no-empty
|
|
49
|
-
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const state = _redux.store.getState(); // recompile
|
|
50
57
|
|
|
51
58
|
|
|
52
59
|
const buildActivityTimer = _reporter.default.activityTimer(`Building Rendering Engines`);
|
|
53
60
|
|
|
54
61
|
try {
|
|
55
62
|
buildActivityTimer.start();
|
|
56
|
-
await (0, _bundleWebpack.createGraphqlEngineBundle)(process.cwd(), _reporter.default, true)
|
|
63
|
+
await Promise.all([(0, _bundleWebpack.createGraphqlEngineBundle)(process.cwd(), _reporter.default, true), (0, _bundleWebpack2.createPageSSRBundle)({
|
|
64
|
+
rootDir: process.cwd(),
|
|
65
|
+
components: _redux.store.getState().components,
|
|
66
|
+
staticQueriesByTemplate: state.staticQueriesByTemplate,
|
|
67
|
+
webpackCompilationHash: state.webpackCompilationHash,
|
|
68
|
+
// we set webpackCompilationHash above
|
|
69
|
+
reporter: _reporter.default,
|
|
70
|
+
isVerbose: state.program.verbose
|
|
71
|
+
})]);
|
|
57
72
|
} catch (err) {
|
|
58
73
|
buildActivityTimer.panic(err);
|
|
59
74
|
} finally {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standalone-regenerate.js","names":["run","console","log","loadConfigAndPlugins","siteDirectory","process","cwd","fs","remove","e","buildActivityTimer","reporter","activityTimer","start","createGraphqlEngineBundle","err","panic","end","validateEnginesActivity","validateEngines","error","id","context"],"sources":["../../../src/schema/graphql-engine/standalone-regenerate.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/*\nthis is used for development purposes only\nto be able to run `gatsby build` once to source data\nand print schema and then just rebundle graphql-engine\nwith source file changes and test re-built engine quickly\n\nUsage:\nThere need to be at least one successful `gatsby build`\nbefore starting to use this script (warm up datastore,\ngenerate \"page-ssr\" bundle). Once that's done you can\nrun following command in test site directory:\n\n```shell\nnode node_modules/gatsby/dist/schema/graphql-engine/standalone-regenerate.js\n```\n*/\n\nimport { createGraphqlEngineBundle } from \"./bundle-webpack\"\nimport reporter from \"gatsby-cli/lib/reporter\"\nimport { loadConfigAndPlugins } from \"../../utils/worker/child/load-config-and-plugins\"\nimport * as fs from \"fs-extra\"\nimport { validateEngines } from \"../../utils/validate-engines\"\n\nasync function run(): Promise<void> {\n // load config\n console.log(`loading config and plugins`)\n await loadConfigAndPlugins({\n siteDirectory: process.cwd(),\n })\n\n try {\n console.log(`clearing webpack cache\\n\\n`)\n // get rid of cache if it exist\n await fs.remove(process.cwd() + `/.cache/webpack/query-engine`)\n } catch (e) {\n // eslint-disable no-empty\n }\n\n // recompile\n const buildActivityTimer = reporter.activityTimer(\n `Building Rendering Engines`\n )\n try {\n buildActivityTimer.start()\n await createGraphqlEngineBundle(process.cwd(), reporter, true)\n } catch (err) {\n buildActivityTimer.panic(err)\n } finally {\n buildActivityTimer.end()\n }\n\n // validate\n const validateEnginesActivity = reporter.activityTimer(\n `Validating Rendering Engines`\n )\n validateEnginesActivity.start()\n try {\n await validateEngines(process.cwd())\n } catch (error) {\n validateEnginesActivity.panic({ id: `98001`, context: {}, error })\n } finally {\n validateEnginesActivity.end()\n }\n\n console.log(`DONE`)\n}\n\nrun()\n"],"mappings":"AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AAEA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,eAAeA,GAAf,GAAoC;EAClC;EACAC,OAAO,CAACC,GAAR,CAAa,4BAAb;EACA,MAAM,IAAAC,0CAAA,EAAqB;IACzBC,aAAa,EAAEC,OAAO,CAACC,GAAR;EADU,CAArB,CAAN;;EAIA,IAAI;IACFL,OAAO,CAACC,GAAR,CAAa,4BAAb,EADE,CAEF;;IACA,MAAMK,EAAE,CAACC,MAAH,CAAUH,OAAO,CAACC,GAAR,KAAiB,8BAA3B,CAAN;EACD,
|
|
1
|
+
{"version":3,"file":"standalone-regenerate.js","names":["run","console","log","loadConfigAndPlugins","siteDirectory","process","cwd","fs","remove","e","state","store","getState","buildActivityTimer","reporter","activityTimer","start","Promise","all","createGraphqlEngineBundle","createPageSSRBundle","rootDir","components","staticQueriesByTemplate","webpackCompilationHash","isVerbose","program","verbose","err","panic","end","validateEnginesActivity","validateEngines","error","id","context"],"sources":["../../../src/schema/graphql-engine/standalone-regenerate.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/*\nthis is used for development purposes only\nto be able to run `gatsby build` once to source data\nand print schema and then just rebundle graphql-engine\nwith source file changes and test re-built engine quickly\n\nUsage:\nThere need to be at least one successful `gatsby build`\nbefore starting to use this script (warm up datastore,\ngenerate \"page-ssr\" bundle). Once that's done you can\nrun following command in test site directory:\n\n```shell\nnode node_modules/gatsby/dist/schema/graphql-engine/standalone-regenerate.js\n```\n*/\n\nimport { createGraphqlEngineBundle } from \"./bundle-webpack\"\nimport { createPageSSRBundle } from \"./../../utils/page-ssr-module/bundle-webpack\"\nimport reporter from \"gatsby-cli/lib/reporter\"\nimport { loadConfigAndPlugins } from \"../../utils/worker/child/load-config-and-plugins\"\nimport * as fs from \"fs-extra\"\nimport { store } from \"../../redux\"\nimport { validateEngines } from \"../../utils/validate-engines\"\n\nasync function run(): Promise<void> {\n // load config\n console.log(`loading config and plugins`)\n await loadConfigAndPlugins({\n siteDirectory: process.cwd(),\n })\n\n try {\n console.log(`clearing webpack cache\\n\\n`)\n // get rid of cache if it exist\n await fs.remove(process.cwd() + `/.cache/webpack/query-engine`)\n await fs.remove(process.cwd() + `/.cache/webpack/page-ssr`)\n } catch (e) {\n // eslint-disable no-empty\n }\n\n const state = store.getState()\n\n // recompile\n const buildActivityTimer = reporter.activityTimer(\n `Building Rendering Engines`\n )\n try {\n buildActivityTimer.start()\n await Promise.all([\n createGraphqlEngineBundle(process.cwd(), reporter, true),\n createPageSSRBundle({\n rootDir: process.cwd(),\n components: store.getState().components,\n staticQueriesByTemplate: state.staticQueriesByTemplate,\n webpackCompilationHash: state.webpackCompilationHash, // we set webpackCompilationHash above\n reporter,\n isVerbose: state.program.verbose,\n }),\n ])\n } catch (err) {\n buildActivityTimer.panic(err)\n } finally {\n buildActivityTimer.end()\n }\n\n // validate\n const validateEnginesActivity = reporter.activityTimer(\n `Validating Rendering Engines`\n )\n validateEnginesActivity.start()\n try {\n await validateEngines(process.cwd())\n } catch (error) {\n validateEnginesActivity.panic({ id: `98001`, context: {}, error })\n } finally {\n validateEnginesActivity.end()\n }\n\n console.log(`DONE`)\n}\n\nrun()\n"],"mappings":"AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,eAAeA,GAAf,GAAoC;EAClC;EACAC,OAAO,CAACC,GAAR,CAAa,4BAAb;EACA,MAAM,IAAAC,0CAAA,EAAqB;IACzBC,aAAa,EAAEC,OAAO,CAACC,GAAR;EADU,CAArB,CAAN;;EAIA,IAAI;IACFL,OAAO,CAACC,GAAR,CAAa,4BAAb,EADE,CAEF;;IACA,MAAMK,EAAE,CAACC,MAAH,CAAUH,OAAO,CAACC,GAAR,KAAiB,8BAA3B,CAAN;IACA,MAAMC,EAAE,CAACC,MAAH,CAAUH,OAAO,CAAC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AAxB;EACD;;EAED7B,OAAO,CAACC,GAAR,CAAa,MAAb;AACD;;AAEDF,GAAG"}
|
|
@@ -32,7 +32,7 @@ async function importGatsbyPlugin(plugin, module) {
|
|
|
32
32
|
rootDir: process.cwd(),
|
|
33
33
|
filePath: importPluginModulePath
|
|
34
34
|
});
|
|
35
|
-
const rawPluginModule = await import(pluginFilePath); // If the module is cjs, the properties we care about are nested under a top-level `default` property
|
|
35
|
+
const rawPluginModule = await import((0, _resolveJsFilePath.maybeAddFileProtocol)(pluginFilePath)); // If the module is cjs, the properties we care about are nested under a top-level `default` property
|
|
36
36
|
|
|
37
37
|
pluginModule = (0, _preferDefault.preferDefault)(rawPluginModule);
|
|
38
38
|
pluginModuleCache.set(key, pluginModule);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-gatsby-plugin.js","names":["pluginModuleCache","Map","setGatsbyPluginCache","plugin","module","moduleObject","key","name","set","importGatsbyPlugin","pluginModule","get","importPluginModulePath","resolvedCompiledGatsbyNode","resolve","pluginFilePath","resolveJSFilepath","rootDir","process","cwd","filePath","rawPluginModule","preferDefault"],"sources":["../../src/utils/import-gatsby-plugin.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"import-gatsby-plugin.js","names":["pluginModuleCache","Map","setGatsbyPluginCache","plugin","module","moduleObject","key","name","set","importGatsbyPlugin","pluginModule","get","importPluginModulePath","resolvedCompiledGatsbyNode","resolve","pluginFilePath","resolveJSFilepath","rootDir","process","cwd","filePath","rawPluginModule","maybeAddFileProtocol","preferDefault"],"sources":["../../src/utils/import-gatsby-plugin.ts"],"sourcesContent":["import {\n resolveJSFilepath,\n maybeAddFileProtocol,\n} from \"../bootstrap/resolve-js-file-path\"\nimport { preferDefault } from \"../bootstrap/prefer-default\"\n\nconst pluginModuleCache = new Map<string, any>()\n\nexport function setGatsbyPluginCache(\n plugin: { name: string; resolve: string },\n module: string,\n moduleObject: any\n): void {\n const key = `${plugin.name}/${module}`\n pluginModuleCache.set(key, moduleObject)\n}\n\nexport async function importGatsbyPlugin(\n plugin: {\n name: string\n resolve: string\n resolvedCompiledGatsbyNode?: string\n },\n module: string\n): Promise<any> {\n const key = `${plugin.name}/${module}`\n\n let pluginModule = pluginModuleCache.get(key)\n\n if (!pluginModule) {\n let importPluginModulePath: string\n\n if (module === `gatsby-node` && plugin.resolvedCompiledGatsbyNode) {\n importPluginModulePath = plugin.resolvedCompiledGatsbyNode\n } else {\n importPluginModulePath = `${plugin.resolve}/${module}`\n }\n\n const pluginFilePath = await resolveJSFilepath({\n rootDir: process.cwd(),\n filePath: importPluginModulePath,\n })\n\n const rawPluginModule = await import(maybeAddFileProtocol(pluginFilePath))\n\n // If the module is cjs, the properties we care about are nested under a top-level `default` property\n pluginModule = preferDefault(rawPluginModule)\n\n pluginModuleCache.set(key, pluginModule)\n }\n\n return pluginModule\n}\n"],"mappings":";;;;;;AAAA;;AAIA;;AAEA,MAAMA,iBAAiB,GAAG,IAAIC,GAAJ,EAA1B;;AAEO,SAASC,oBAAT,CACLC,MADK,EAELC,MAFK,EAGLC,YAHK,EAIC;EACN,MAAMC,GAAG,GAAI,GAAEH,MAAM,CAACI,IAAK,IAAGH,MAAO,EAArC;EACAJ,iBAAiB,CAACQ,GAAlB,CAAsBF,GAAtB,EAA2BD,YAA3B;AACD;;AAEM,eAAeI,kBAAf,CACLN,MADK,EAMLC,MANK,EAOS;EACd,MAAME,GAAG,GAAI,GAAEH,MAAM,CAACI,IAAK,IAAGH,MAAO,EAArC;EAEA,IAAIM,YAAY,GAAGV,iBAAiB,CAACW,GAAlB,CAAsBL,GAAtB,CAAnB;;EAEA,IAAI,CAACI,YAAL,EAAmB;IACjB,IAAIE,sBAAJ;;IAEA,IAAIR,MAAM,KAAM,aAAZ,IAA4BD,MAAM,CAACU,0BAAvC,EAAmE;MACjED,sBAAsB,GAAGT,MAAM,CAACU,0BAAhC;IACD,CAFD,MAEO;MACLD,sBAAsB,GAAI,GAAET,MAAM,CAACW,OAAQ,IAAGV,MAAO,EAArD;IACD;;IAED,MAAMW,cAAc,GAAG,MAAM,IAAAC,oCAAA,EAAkB;MAC7CC,OAAO,EAAEC,OAAO,CAACC,GAAR,EADoC;MAE7CC,QAAQ,EAAER;IAFmC,CAAlB,CAA7B;IAKA,MAAMS,eAAe,GAAG,MAAM,OAAO,IAAAC,uCAAA,EAAqBP,cAArB,CAAP,CAA9B,CAdiB,CAgBjB;;IACAL,YAAY,GAAG,IAAAa,4BAAA,EAAcF,eAAd,CAAf;IAEArB,iBAAiB,CAACQ,GAAlB,CAAsBF,GAAtB,EAA2BI,YAA3B;EACD;;EAED,OAAOA,YAAP;AACD"}
|
|
@@ -29,8 +29,10 @@ const webpackRemoveExportsLoader = function webpackRemoveExportsLoader(source, s
|
|
|
29
29
|
}, (err, result) => {
|
|
30
30
|
if (err) {
|
|
31
31
|
callback(err);
|
|
32
|
-
} else if (result && result.code
|
|
33
|
-
|
|
32
|
+
} else if (result && result.code) {
|
|
33
|
+
var _result$map;
|
|
34
|
+
|
|
35
|
+
callback(null, result === null || result === void 0 ? void 0 : result.code, (_result$map = result === null || result === void 0 ? void 0 : result.map) !== null && _result$map !== void 0 ? _result$map : undefined);
|
|
34
36
|
} else {
|
|
35
37
|
callback(null, source, sourceMap);
|
|
36
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack-remove-exports-loader.js","names":["webpackRemoveExportsLoader","source","sourceMap","callback","async","options","getOptions","transform","babelrc","configFile","inputSourceMap","undefined","sourceFileName","resourcePath","sourceMaps","filename","presets","jsx","require","resolve","useBuiltIns","pragma","development","plugins","apis","remove","err","result","code","map","module","exports"],"sources":["../../../../src/utils/webpack/loaders/webpack-remove-exports-loader.ts"],"sourcesContent":["/* eslint-disable @babel/no-invalid-this */\n\nimport { LoaderDefinitionFunction } from \"webpack\"\nimport { transform } from \"@babel/core\"\n\ninterface IOptions {\n jsx?: boolean\n remove?: Array<string>\n}\n\nconst webpackRemoveExportsLoader: LoaderDefinitionFunction<IOptions> =\n function webpackRemoveExportsLoader(source, sourceMap): void {\n const callback = this.async()\n const options = this.getOptions()\n\n transform(\n source,\n {\n babelrc: false,\n configFile: false,\n // @ts-ignore inputSourceMap expect object or falsy, but webpack types suggest sourceMap can be a string,\n // which is not compatibile with babel's transform options\n inputSourceMap: this.sourceMap ? sourceMap || undefined : undefined,\n sourceFileName: this.resourcePath,\n sourceMaps: this.sourceMap,\n filename: this.resourcePath,\n presets: options?.jsx\n ? [\n [\n require.resolve(`babel-preset-gatsby/babel-preset-react`),\n {\n useBuiltIns: true,\n pragma: `React.createElement`,\n // jsx is used only in develop, so for now this is fine\n development: true,\n },\n ],\n ]\n : undefined,\n plugins: [\n [\n require.resolve(`../../babel/babel-plugin-remove-api`),\n {\n apis: options?.remove ?? [],\n },\n ],\n ],\n },\n (err, result) => {\n if (err) {\n callback(err)\n } else if (result && result.code
|
|
1
|
+
{"version":3,"file":"webpack-remove-exports-loader.js","names":["webpackRemoveExportsLoader","source","sourceMap","callback","async","options","getOptions","transform","babelrc","configFile","inputSourceMap","undefined","sourceFileName","resourcePath","sourceMaps","filename","presets","jsx","require","resolve","useBuiltIns","pragma","development","plugins","apis","remove","err","result","code","map","module","exports"],"sources":["../../../../src/utils/webpack/loaders/webpack-remove-exports-loader.ts"],"sourcesContent":["/* eslint-disable @babel/no-invalid-this */\n\nimport { LoaderDefinitionFunction } from \"webpack\"\nimport { transform } from \"@babel/core\"\n\ninterface IOptions {\n jsx?: boolean\n remove?: Array<string>\n}\n\nconst webpackRemoveExportsLoader: LoaderDefinitionFunction<IOptions> =\n function webpackRemoveExportsLoader(source, sourceMap): void {\n const callback = this.async()\n const options = this.getOptions()\n\n transform(\n source,\n {\n babelrc: false,\n configFile: false,\n // @ts-ignore inputSourceMap expect object or falsy, but webpack types suggest sourceMap can be a string,\n // which is not compatibile with babel's transform options\n inputSourceMap: this.sourceMap ? sourceMap || undefined : undefined,\n sourceFileName: this.resourcePath,\n sourceMaps: this.sourceMap,\n filename: this.resourcePath,\n presets: options?.jsx\n ? [\n [\n require.resolve(`babel-preset-gatsby/babel-preset-react`),\n {\n useBuiltIns: true,\n pragma: `React.createElement`,\n // jsx is used only in develop, so for now this is fine\n development: true,\n },\n ],\n ]\n : undefined,\n plugins: [\n [\n require.resolve(`../../babel/babel-plugin-remove-api`),\n {\n apis: options?.remove ?? [],\n },\n ],\n ],\n },\n (err, result) => {\n if (err) {\n callback(err)\n } else if (result && result.code) {\n callback(null, result?.code, result?.map ?? undefined)\n } else {\n callback(null, source, sourceMap)\n }\n }\n )\n }\n\nmodule.exports = webpackRemoveExportsLoader\n"],"mappings":";;AAGA;;AAHA;AAUA,MAAMA,0BAA8D,GAClE,SAASA,0BAAT,CAAoCC,MAApC,EAA4CC,SAA5C,EAA6D;EAAA;;EAC3D,MAAMC,QAAQ,GAAG,KAAKC,KAAL,EAAjB;EACA,MAAMC,OAAO,GAAG,KAAKC,UAAL,EAAhB;EAEA,IAAAC,eAAA,EACEN,MADF,EAEE;IACEO,OAAO,EAAE,KADX;IAEEC,UAAU,EAAE,KAFd;IAGE;IACA;IACAC,cAAc,EAAE,KAAKR,SAAL,GAAiBA,SAAS,IAAIS,SAA9B,GAA0CA,SAL5D;IAMEC,cAAc,EAAE,KAAKC,YANvB;IAOEC,UAAU,EAAE,KAAKZ,SAPnB;IAQEa,QAAQ,EAAE,KAAKF,YARjB;IASEG,OAAO,EAAEX,OAAO,SAAP,IAAAA,OAAO,WAAP,IAAAA,OAAO,CAAEY,GAAT,GACL,CACE,CACEC,OAAO,CAACC,OAAR,CAAiB,wCAAjB,CADF,EAEE;MACEC,WAAW,EAAE,IADf;MAEEC,MAAM,EAAG,qBAFX;MAGE;MACAC,WAAW,EAAE;IAJf,CAFF,CADF,CADK,GAYLX,SArBN;IAsBEY,OAAO,EAAE,CACP,CACEL,OAAO,CAACC,OAAR,CAAiB,qCAAjB,CADF,EAEE;MACEK,IAAI,qBAAEnB,OAAF,aAAEA,OAAF,uBAAEA,OAAO,CAAEoB,MAAX,6DAAqB;IAD3B,CAFF,CADO;EAtBX,CAFF,EAiCE,CAACC,GAAD,EAAMC,MAAN,KAAiB;IACf,IAAID,GAAJ,EAAS;MACPvB,QAAQ,CAACuB,GAAD,CAAR;IACD,CAFD,MAEO,IAAIC,MAAM,IAAIA,MAAM,CAACC,IAArB,EAA2B;MAAA;;MAChCzB,QAAQ,CAAC,IAAD,EAAOwB,MAAP,aAAOA,MAAP,uBAAOA,MAAM,CAAEC,IAAf,iBAAqBD,MAArB,aAAqBA,MAArB,uBAAqBA,MAAM,CAAEE,GAA7B,qDAAoClB,SAApC,CAAR;IACD,CAFM,MAEA;MACLR,QAAQ,CAAC,IAAD,EAAOF,MAAP,EAAeC,SAAf,CAAR;IACD;EACF,CAzCH;AA2CD,CAhDH;;AAkDA4B,MAAM,CAACC,OAAP,GAAiB/B,0BAAjB"}
|
|
@@ -37,6 +37,8 @@ var _eslintConfig = require("./eslint-config");
|
|
|
37
37
|
|
|
38
38
|
var _redux = require("../redux");
|
|
39
39
|
|
|
40
|
+
var _constants = require("../constants");
|
|
41
|
+
|
|
40
42
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
41
43
|
|
|
42
44
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -78,6 +80,18 @@ const createWebpackUtils = (stage, program) => {
|
|
|
78
80
|
return rule;
|
|
79
81
|
};
|
|
80
82
|
|
|
83
|
+
const fileLoaderCommonOptions = {
|
|
84
|
+
name: `${assetRelativeRoot}[name]-[hash].[ext]`
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
if (stage === `build-html` || stage === `develop-html`) {
|
|
88
|
+
// build-html and develop-html outputs to `.cache/page-ssr/routes/` (ROUTES_DIRECTORY)
|
|
89
|
+
// so this config is setting it to output assets to `public` (outputPath)
|
|
90
|
+
// while preserving "url" (publicPath)
|
|
91
|
+
fileLoaderCommonOptions.outputPath = path.relative(_constants.ROUTES_DIRECTORY, `public`);
|
|
92
|
+
fileLoaderCommonOptions.publicPath = `/`;
|
|
93
|
+
}
|
|
94
|
+
|
|
81
95
|
const loaders = {
|
|
82
96
|
json: (options = {}) => {
|
|
83
97
|
return {
|
|
@@ -209,8 +223,7 @@ const createWebpackUtils = (stage, program) => {
|
|
|
209
223
|
file: (options = {}) => {
|
|
210
224
|
return {
|
|
211
225
|
loader: require.resolve(`file-loader`),
|
|
212
|
-
options: {
|
|
213
|
-
name: `${assetRelativeRoot}[name]-[hash].[ext]`,
|
|
226
|
+
options: { ...fileLoaderCommonOptions,
|
|
214
227
|
...options
|
|
215
228
|
}
|
|
216
229
|
};
|
|
@@ -220,7 +233,7 @@ const createWebpackUtils = (stage, program) => {
|
|
|
220
233
|
loader: require.resolve(`url-loader`),
|
|
221
234
|
options: {
|
|
222
235
|
limit: 10000,
|
|
223
|
-
|
|
236
|
+
...fileLoaderCommonOptions,
|
|
224
237
|
fallback: require.resolve(`file-loader`),
|
|
225
238
|
...options
|
|
226
239
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack-utils.js","names":["vendorRegex","createWebpackUtils","stage","program","assetRelativeRoot","supportedBrowsers","getBrowsersList","directory","PRODUCTION","includes","isSSR","config","store","getState","assetPrefix","pathPrefix","publicPath","getPublicPath","makeExternalOnly","original","options","rule","include","makeInternalOnly","exclude","loaders","json","loader","require","resolve","yaml","null","raw","style","miniCssExtract","moduleOptions","undefined","modules","restOptions","namedExport","MiniCssExtractPlugin","css","modulesOptions","auto","localIdentName","exportLocalsConvention","exportOnlyLocals","url","startsWith","sourceMap","postcss","plugins","overrideBrowserslist","postcssOpts","execute","postcssOptions","loaderContext","postCSSPlugins","autoprefixerPlugin","autoprefixer","flexbox","find","plugin","postcssPlugin","unshift","flexbugs","file","name","limit","fallback","js","reactRuntime","jsxRuntime","reactImportSource","jsxImportSource","cacheDirectory","path","join","rootDir","dependencies","rules","modulesThatUseGatsby","test","modulePath","some","module","type","use","resourceQuery","issuer","configFile","compact","isPageTemplate","jsOptions","babelrc","presets","sourceMaps","cacheIdentifier","JSON","stringify","browsersList","gatsbyPreset","version","VENDORS_TO_NOT_POLYFILL","doNotPolyfillRegex","RegExp","fonts","images","media","miscAssets","browsers","importLoaders","filter","Boolean","internal","external","cssModules","builtinPlugins","minifyJs","terserOptions","TerserPlugin","ie8","mangle","safari10","parse","ecma","compress","output","parallel","Math","max","cpuCoreCount","minifyCss","minimizerOptions","preset","svgo","full","CssMinimizerPlugin","fastRefresh","regExpToHack","ReactRefreshWebpackPlugin","overlay","sockIntegration","__dirname","extractText","moment","ignore","resourceRegExp","contextRegExp","extractStats","GatsbyWebpackStatsExtractor","eslintGraphqlSchemaReload","virtualModules","GatsbyWebpackVirtualModules","eslint","extensions","VIRTUAL_MODULES_BASE_PATH","eslintConfig","ESLintPlugin","eslintRequired","eslintRequiredConfig"],"sources":["../../src/utils/webpack-utils.ts"],"sourcesContent":["import * as path from \"path\"\nimport { RuleSetRule, WebpackPluginInstance } from \"webpack\"\nimport { GraphQLSchema } from \"graphql\"\nimport { Plugin as PostCSSPlugin } from \"postcss\"\nimport autoprefixer from \"autoprefixer\"\nimport flexbugs from \"postcss-flexbugs-fixes\"\nimport TerserPlugin from \"terser-webpack-plugin\"\nimport type { MinifyOptions as TerserOptions } from \"terser\"\nimport MiniCssExtractPlugin from \"mini-css-extract-plugin\"\nimport CssMinimizerPlugin from \"css-minimizer-webpack-plugin\"\nimport ReactRefreshWebpackPlugin from \"@pmmmwh/react-refresh-webpack-plugin\"\nimport { getBrowsersList } from \"./browserslist\"\nimport ESLintPlugin from \"eslint-webpack-plugin\"\nimport { cpuCoreCount } from \"gatsby-core-utils\"\nimport { GatsbyWebpackStatsExtractor } from \"./gatsby-webpack-stats-extractor\"\nimport { getPublicPath } from \"./get-public-path\"\nimport {\n GatsbyWebpackVirtualModules,\n VIRTUAL_MODULES_BASE_PATH,\n} from \"./gatsby-webpack-virtual-modules\"\n\nimport { builtinPlugins } from \"./webpack-plugins\"\nimport { IProgram, Stage } from \"../commands/types\"\nimport { eslintConfig, eslintRequiredConfig } from \"./eslint-config\"\nimport { store } from \"../redux\"\nimport type { RuleSetUseItem } from \"webpack\"\n\ntype Loader = string | { loader: string; options?: { [name: string]: any } }\ntype LoaderResolver<T = Record<string, unknown>> = (options?: T) => Loader\n\ntype LoaderOptions = Record<string, any>\ntype RuleFactory<T = Record<string, unknown>> = (\n options?: T & LoaderOptions\n) => RuleSetRule\n\ntype ContextualRuleFactory<T = Record<string, unknown>> = RuleFactory<T> & {\n internal?: RuleFactory<T>\n external?: RuleFactory<T>\n}\n\ntype PluginFactory = (...args: any) => WebpackPluginInstance | null\n\ntype BuiltinPlugins = typeof builtinPlugins\n\ntype CSSModulesOptions =\n | boolean\n | string\n | {\n mode?:\n | \"local\"\n | \"global\"\n | \"pure\"\n | ((resourcePath: string) => \"local\" | \"global\" | \"pure\")\n auto?: boolean\n exportGlobals?: boolean\n localIdentName?: string\n localIdentContext?: string\n localIdentHashPrefix?: string\n namedExport?: boolean\n exportLocalsConvention?:\n | \"asIs\"\n | \"camelCaseOnly\"\n | \"camelCase\"\n | \"dashes\"\n | \"dashesOnly\"\n exportOnlyLocals?: boolean\n }\n\ntype MiniCSSExtractLoaderModuleOptions =\n | undefined\n | boolean\n | {\n namedExport?: boolean\n }\n/**\n * Utils that produce webpack `loader` objects\n */\ninterface ILoaderUtils {\n yaml: LoaderResolver\n style: LoaderResolver\n css: LoaderResolver<{\n url?: boolean | ((url: string, resourcePath: string) => boolean)\n import?:\n | boolean\n | ((url: string, media: string, resourcePath: string) => boolean)\n modules?: CSSModulesOptions\n sourceMap?: boolean\n importLoaders?: number\n esModule?: boolean\n }>\n postcss: LoaderResolver<{\n browsers?: Array<string>\n overrideBrowserslist?: Array<string>\n plugins?: Array<PostCSSPlugin> | ((loader: Loader) => Array<PostCSSPlugin>)\n }>\n\n file: LoaderResolver\n url: LoaderResolver\n js: LoaderResolver\n json: LoaderResolver\n null: LoaderResolver\n raw: LoaderResolver\n dependencies: LoaderResolver\n\n miniCssExtract: LoaderResolver\n imports?: LoaderResolver\n exports?: LoaderResolver\n}\n\ninterface IModuleThatUseGatsby {\n name: string\n path: string\n}\n\ntype CssLoaderModuleOption = boolean | Record<string, any> | string\n\n/**\n * Utils that produce webpack rule objects\n */\ninterface IRuleUtils {\n /**\n * Handles JavaScript compilation via babel\n */\n js: RuleFactory<{ modulesThatUseGatsby?: Array<IModuleThatUseGatsby> }>\n dependencies: RuleFactory<{\n modulesThatUseGatsby?: Array<IModuleThatUseGatsby>\n }>\n yaml: RuleFactory\n fonts: RuleFactory\n images: RuleFactory\n miscAssets: RuleFactory\n media: RuleFactory\n\n css: ContextualRuleFactory<{\n browsers?: Array<string>\n modules?: CssLoaderModuleOption\n }>\n cssModules: RuleFactory\n postcss: ContextualRuleFactory<{ overrideBrowserOptions: Array<string> }>\n\n eslint: (schema: GraphQLSchema) => RuleSetRule\n eslintRequired: () => RuleSetRule\n}\n\ntype PluginUtils = BuiltinPlugins & {\n extractText: PluginFactory\n uglify: PluginFactory\n moment: PluginFactory\n extractStats: PluginFactory\n minifyJs: PluginFactory\n minifyCss: PluginFactory\n fastRefresh: PluginFactory\n eslintGraphqlSchemaReload: PluginFactory\n virtualModules: PluginFactory\n eslint: PluginFactory\n eslintRequired: PluginFactory\n}\n\n/**\n * webpack atoms namespace\n */\ninterface IWebpackUtils {\n loaders: ILoaderUtils\n\n rules: IRuleUtils\n\n plugins: PluginUtils\n}\n\nconst vendorRegex = /(node_modules|bower_components)/\n\n/**\n * A factory method that produces an atoms namespace\n */\nexport const createWebpackUtils = (\n stage: Stage,\n program: IProgram\n): IWebpackUtils => {\n const assetRelativeRoot = `static/`\n const supportedBrowsers = getBrowsersList(program.directory)\n\n const PRODUCTION = !stage.includes(`develop`)\n\n const isSSR = stage.includes(`html`)\n const { config } = store.getState()\n const { assetPrefix, pathPrefix } = config\n\n const publicPath = getPublicPath({ assetPrefix, pathPrefix, ...program })\n\n const makeExternalOnly =\n (original: RuleFactory) =>\n (options = {}): RuleSetRule => {\n const rule = original(options)\n rule.include = vendorRegex\n return rule\n }\n\n const makeInternalOnly =\n (original: RuleFactory) =>\n (options = {}): RuleSetRule => {\n const rule = original(options)\n rule.exclude = vendorRegex\n return rule\n }\n\n const loaders: ILoaderUtils = {\n json: (options = {}) => {\n return {\n options,\n loader: require.resolve(`json-loader`),\n }\n },\n yaml: (options = {}) => {\n return {\n options,\n loader: require.resolve(`yaml-loader`),\n }\n },\n\n null: (options = {}) => {\n return {\n options,\n loader: require.resolve(`null-loader`),\n }\n },\n\n raw: (options = {}) => {\n return {\n options,\n loader: require.resolve(`raw-loader`),\n }\n },\n\n style: (options = {}) => {\n return {\n options,\n loader: require.resolve(`style-loader`),\n }\n },\n\n // TODO(v5): Re-Apply https://github.com/gatsbyjs/gatsby/pull/33979 with breaking change in inline loader syntax\n miniCssExtract: (\n options: {\n modules?: MiniCSSExtractLoaderModuleOptions\n } = {}\n ) => {\n let moduleOptions: MiniCSSExtractLoaderModuleOptions = undefined\n\n const { modules, ...restOptions } = options\n\n if (typeof modules === `boolean` && options.modules) {\n moduleOptions = {\n namedExport: true,\n }\n } else {\n moduleOptions = modules\n }\n\n return {\n loader: MiniCssExtractPlugin.loader,\n options: {\n modules: moduleOptions,\n ...restOptions,\n },\n }\n },\n\n css: (options = {}) => {\n let modulesOptions: CSSModulesOptions = false\n if (options.modules) {\n modulesOptions = {\n auto: undefined,\n namedExport: true,\n localIdentName: `[name]--[local]--[hash:hex:5]`,\n exportLocalsConvention: `dashesOnly`,\n exportOnlyLocals: isSSR,\n }\n\n if (typeof options.modules === `object`) {\n modulesOptions = {\n ...modulesOptions,\n ...options.modules,\n }\n }\n }\n\n return {\n loader: require.resolve(`css-loader`),\n options: {\n // Absolute urls (https or //) are not send to this function. Only resolvable paths absolute or relative ones.\n url: function (url: string): boolean {\n // When an url starts with /\n if (url.startsWith(`/`)) {\n return false\n }\n\n return true\n },\n sourceMap: !PRODUCTION,\n modules: modulesOptions,\n },\n }\n },\n\n postcss: (options = {}) => {\n const {\n plugins,\n overrideBrowserslist = supportedBrowsers,\n ...postcssOpts\n } = options\n\n return {\n loader: require.resolve(`postcss-loader`),\n options: {\n execute: false,\n sourceMap: !PRODUCTION,\n // eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n postcssOptions: (loaderContext: any) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let postCSSPlugins: Array<PostCSSPlugin> = []\n if (plugins) {\n postCSSPlugins =\n typeof plugins === `function` ? plugins(loaderContext) : plugins\n }\n\n const autoprefixerPlugin = autoprefixer({\n overrideBrowserslist,\n flexbox: `no-2009`,\n ...((\n postCSSPlugins.find(\n plugin => plugin.postcssPlugin === `autoprefixer`\n ) as unknown as autoprefixer.ExportedAPI\n )?.options ?? {}),\n })\n\n postCSSPlugins.unshift(autoprefixerPlugin)\n postCSSPlugins.unshift(flexbugs)\n\n return {\n plugins: postCSSPlugins,\n ...postcssOpts,\n }\n },\n },\n }\n },\n\n file: (options = {}) => {\n return {\n loader: require.resolve(`file-loader`),\n options: {\n name: `${assetRelativeRoot}[name]-[hash].[ext]`,\n ...options,\n },\n }\n },\n\n url: (options = {}) => {\n return {\n loader: require.resolve(`url-loader`),\n options: {\n limit: 10000,\n name: `${assetRelativeRoot}[name]-[hash].[ext]`,\n fallback: require.resolve(`file-loader`),\n ...options,\n },\n }\n },\n\n js: options => {\n return {\n options: {\n stage,\n reactRuntime: config.jsxRuntime,\n reactImportSource: config.jsxImportSource,\n cacheDirectory: path.join(\n program.directory,\n `.cache`,\n `webpack`,\n `babel`\n ),\n ...options,\n rootDir: program.directory,\n },\n loader: require.resolve(`./babel-loader`),\n }\n },\n\n dependencies: options => {\n return {\n options: {\n cacheDirectory: path.join(\n program.directory,\n `.cache`,\n `webpack`,\n `babel`\n ),\n ...options,\n },\n loader: require.resolve(`babel-loader`),\n }\n },\n }\n\n /**\n * Rules\n */\n const rules = {} as IRuleUtils\n\n /**\n * JavaScript loader via babel, includes userland code\n * and packages that depend on `gatsby`\n */\n {\n const js = ({\n modulesThatUseGatsby = [],\n ...options\n }: {\n modulesThatUseGatsby?: Array<IModuleThatUseGatsby>\n } = {}): RuleSetRule => {\n return {\n test: /\\.(js|mjs|jsx|ts|tsx)$/,\n include: (modulePath: string): boolean => {\n // when it's not coming from node_modules we treat it as a source file.\n if (!vendorRegex.test(modulePath)) {\n return true\n }\n\n // If the module uses Gatsby as a dependency\n // we want to treat it as src so we can extract queries\n return modulesThatUseGatsby.some(module =>\n modulePath.includes(module.path)\n )\n },\n type: `javascript/auto`,\n use: ({ resourceQuery, issuer }): Array<RuleSetUseItem> => [\n // If a JS import comes from async-requires, assume it is for a page component.\n // Using `issuer` allows us to avoid mutating async-requires for this case.\n //\n // If other imports are added to async-requires in the future, another option is to\n // append a query param to page components in the store and check against `resourceQuery` here.\n //\n // This would require we adjust `doesModuleMatchResourcePath` in `static-query-mapper`\n // to check against the module's `resourceResolveData.path` instead of resource to avoid\n // mismatches because of the added query param. Other adjustments may also be needed.\n loaders.js({\n ...options,\n configFile: true,\n compact: PRODUCTION,\n isPageTemplate: /async-requires/.test(issuer),\n resourceQuery,\n }),\n ],\n }\n }\n rules.js = js\n }\n\n /**\n * Node_modules JavaScript loader via babel\n * Excludes core-js & babel-runtime to speedup babel transpilation\n * Excludes modules that use Gatsby since the `rules.js` already transpiles those\n */\n {\n const dependencies = ({\n modulesThatUseGatsby = [],\n }: {\n modulesThatUseGatsby?: Array<IModuleThatUseGatsby>\n } = {}): RuleSetRule => {\n const jsOptions = {\n babelrc: false,\n configFile: false,\n compact: false,\n presets: [\n [\n require.resolve(`babel-preset-gatsby/dependencies`),\n {\n stage,\n },\n ],\n ],\n // If an error happens in a package, it's possible to be\n // because it was compiled. Thus, we don't want the browser\n // debugger to show the original code. Instead, the code\n // being evaluated would be much more helpful.\n sourceMaps: false,\n\n cacheIdentifier: JSON.stringify({\n browsersList: supportedBrowsers,\n gatsbyPreset: require(`babel-preset-gatsby/package.json`).version,\n }),\n }\n\n // TODO REMOVE IN V3\n // a list of vendors we know we shouldn't polyfill (we should have set core-js to entry but we didn't so we have to do this)\n const VENDORS_TO_NOT_POLYFILL = [\n `@babel[\\\\\\\\/]runtime`,\n `@mikaelkristiansson[\\\\\\\\/]domready`,\n `@reach[\\\\\\\\/]router`,\n `babel-preset-gatsby`,\n `core-js`,\n `dom-helpers`,\n `gatsby-legacy-polyfills`,\n `gatsby-link`,\n `gatsby-script`,\n `gatsby-react-router-scroll`,\n `invariant`,\n `lodash`,\n `mitt`,\n `prop-types`,\n `react-dom`,\n `react`,\n `regenerator-runtime`,\n `scheduler`,\n `scroll-behavior`,\n `shallow-compare`,\n `warning`,\n `webpack`,\n ]\n const doNotPolyfillRegex = new RegExp(\n `[\\\\\\\\/]node_modules[\\\\\\\\/](${VENDORS_TO_NOT_POLYFILL.join(\n `|`\n )})[\\\\\\\\/]`\n )\n\n return {\n test: /\\.(js|mjs)$/,\n exclude: (modulePath: string): boolean => {\n // If dep is user land code, exclude\n if (!vendorRegex.test(modulePath)) {\n return true\n }\n\n // If dep uses Gatsby, exclude\n if (\n modulesThatUseGatsby.some(module =>\n modulePath.includes(module.path)\n )\n ) {\n return true\n }\n\n return doNotPolyfillRegex.test(modulePath)\n },\n type: `javascript/auto`,\n use: [loaders.dependencies(jsOptions)],\n }\n }\n rules.dependencies = dependencies\n }\n\n rules.yaml = (): RuleSetRule => {\n return {\n test: /\\.ya?ml$/,\n type: `json`,\n use: [loaders.yaml()],\n }\n }\n\n /**\n * Font loader\n */\n rules.fonts = (): RuleSetRule => {\n return {\n use: [loaders.url()],\n test: /\\.(eot|otf|ttf|woff(2)?)(\\?.*)?$/,\n }\n }\n\n /**\n * Loads image assets, inlines images via a data URI if they are below\n * the size threshold\n */\n rules.images = (): RuleSetRule => {\n return {\n use: [loaders.url()],\n test: /\\.(ico|svg|jpg|jpeg|png|gif|webp|avif)(\\?.*)?$/,\n }\n }\n\n /**\n * Loads audio and video and inlines them via a data URI if they are below\n * the size threshold\n */\n rules.media = (): RuleSetRule => {\n return {\n use: [loaders.url()],\n test: /\\.(mp4|webm|ogv|wav|mp3|m4a|aac|oga|flac)$/,\n }\n }\n\n /**\n * Loads assets without inlining\n */\n rules.miscAssets = (): RuleSetRule => {\n return {\n use: [loaders.file()],\n test: /\\.pdf$/,\n }\n }\n\n /**\n * CSS style loader.\n */\n {\n const css: IRuleUtils[\"css\"] = (options = {}): RuleSetRule => {\n const { browsers, ...restOptions } = options\n const use = [\n !isSSR && loaders.miniCssExtract(restOptions),\n loaders.css({ ...restOptions, importLoaders: 1 }),\n loaders.postcss({ browsers }),\n ].filter(Boolean) as RuleSetRule[\"use\"]\n\n return {\n use,\n test: /\\.css$/,\n }\n }\n\n /**\n * CSS style loader, _excludes_ node_modules.\n */\n css.internal = makeInternalOnly(css)\n css.external = makeExternalOnly(css)\n\n const cssModules: IRuleUtils[\"cssModules\"] = (options): RuleSetRule => {\n const rule = css({ ...options, modules: true })\n delete rule.exclude\n rule.test = /\\.module\\.css$/\n return rule\n }\n\n rules.css = css\n rules.cssModules = cssModules\n }\n\n /**\n * PostCSS loader.\n */\n {\n const postcss: ContextualRuleFactory = (options): RuleSetRule => {\n return {\n test: /\\.css$/,\n use: [loaders.css({ importLoaders: 1 }), loaders.postcss(options)],\n }\n }\n\n /**\n * PostCSS loader, _excludes_ node_modules.\n */\n postcss.internal = makeInternalOnly(postcss)\n postcss.external = makeExternalOnly(postcss)\n rules.postcss = postcss\n }\n /**\n * cast rules to IRuleUtils\n */\n /**\n * Plugins\n */\n const plugins = { ...builtinPlugins } as PluginUtils\n\n plugins.minifyJs = ({\n terserOptions,\n ...options\n }: {\n terserOptions?: TerserOptions\n } = {}): WebpackPluginInstance =>\n new TerserPlugin({\n exclude: /\\.min\\.js/,\n terserOptions: {\n ie8: false,\n mangle: {\n safari10: true,\n },\n parse: {\n ecma: 5,\n },\n compress: {\n ecma: 5,\n },\n output: {\n ecma: 5,\n },\n ...terserOptions,\n },\n parallel: Math.max(1, cpuCoreCount() - 1),\n ...options,\n })\n\n plugins.minifyCss = (\n options = {\n minimizerOptions: {\n preset: [\n `default`,\n {\n svgo: {\n full: true,\n plugins: [\n // potentially destructive plugins removed - see https://github.com/gatsbyjs/gatsby/issues/15629\n // use correct config format and remove plugins requiring specific params - see https://github.com/gatsbyjs/gatsby/issues/31619\n // List of default plugins and their defaults: https://github.com/svg/svgo#built-in-plugins\n // Last update 2021-08-17\n `cleanupAttrs`,\n `cleanupEnableBackground`,\n `cleanupIDs`,\n `cleanupListOfValues`, // Default: disabled\n `cleanupNumericValues`,\n `collapseGroups`,\n `convertColors`,\n `convertPathData`,\n `convertStyleToAttrs`, // Default: disabled\n `convertTransform`,\n `inlineStyles`,\n `mergePaths`,\n `minifyStyles`,\n `moveElemsAttrsToGroup`,\n `moveGroupAttrsToElems`,\n `prefixIds`, // Default: disabled\n `removeComments`,\n `removeDesc`,\n `removeDoctype`,\n `removeEditorsNSData`,\n `removeEmptyAttrs`,\n `removeEmptyContainers`,\n `removeEmptyText`,\n `removeHiddenElems`,\n `removeMetadata`,\n `removeNonInheritableGroupAttrs`,\n `removeRasterImages`, // Default: disabled\n `removeScriptElement`, // Default: disabled\n `removeStyleElement`, // Default: disabled\n `removeTitle`,\n `removeUnknownsAndDefaults`,\n `removeUnusedNS`,\n `removeUselessDefs`,\n `removeUselessStrokeAndFill`,\n `removeXMLProcInst`,\n `reusePaths`, // Default: disabled\n `sortAttrs`, // Default: disabled\n ],\n },\n },\n ],\n },\n }\n ): CssMinimizerPlugin =>\n new CssMinimizerPlugin({\n parallel: Math.max(1, cpuCoreCount() - 1),\n ...options,\n })\n\n plugins.fastRefresh = ({ modulesThatUseGatsby }): WebpackPluginInstance => {\n const regExpToHack = /node_modules/\n regExpToHack.test = (modulePath: string): boolean => {\n // when it's not coming from node_modules we treat it as a source file.\n if (!vendorRegex.test(modulePath)) {\n return false\n }\n\n // If the module uses Gatsby as a dependency\n // we want to treat it as src because of shadowing\n return !modulesThatUseGatsby.some(module =>\n modulePath.includes(module.path)\n )\n }\n\n return new ReactRefreshWebpackPlugin({\n overlay: {\n sockIntegration: `whm`,\n module: path.join(__dirname, `fast-refresh-module`),\n },\n // this is a bit hacky - exclude expect string or regexp or array of those\n // so this is tricking ReactRefreshWebpackPlugin with providing regexp with\n // overwritten .test method\n exclude: regExpToHack,\n })\n }\n\n plugins.extractText = (options: any): WebpackPluginInstance =>\n new MiniCssExtractPlugin({\n ...options,\n })\n\n plugins.moment = (): WebpackPluginInstance =>\n plugins.ignore({ resourceRegExp: /^\\.\\/locale$/, contextRegExp: /moment$/ })\n\n plugins.extractStats = (): GatsbyWebpackStatsExtractor =>\n new GatsbyWebpackStatsExtractor(publicPath)\n\n // TODO: remove this in v5\n plugins.eslintGraphqlSchemaReload = (): null => null\n\n plugins.virtualModules = (): GatsbyWebpackVirtualModules =>\n new GatsbyWebpackVirtualModules()\n\n plugins.eslint = (): WebpackPluginInstance => {\n const options = {\n extensions: [`js`, `jsx`],\n exclude: [\n `/node_modules/`,\n `/bower_components/`,\n VIRTUAL_MODULES_BASE_PATH,\n ],\n ...eslintConfig(config.jsxRuntime === `automatic`),\n }\n // @ts-ignore\n return new ESLintPlugin(options)\n }\n\n plugins.eslintRequired = (): WebpackPluginInstance => {\n const options = {\n extensions: [`js`, `jsx`],\n exclude: [\n `/node_modules/`,\n `/bower_components/`,\n VIRTUAL_MODULES_BASE_PATH,\n ],\n ...eslintRequiredConfig,\n }\n // @ts-ignore\n return new ESLintPlugin(options)\n }\n\n return {\n loaders,\n rules,\n plugins,\n }\n}\n"],"mappings":";;;;;;;AAAA;;AAIA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAEA;;AACA;;;;;;AAiJA,MAAMA,WAAW,GAAG,iCAApB;AAEA;AACA;AACA;;AACO,MAAMC,kBAAkB,GAAG,CAChCC,KADgC,EAEhCC,OAFgC,KAGd;EAClB,MAAMC,iBAAiB,GAAI,SAA3B;EACA,MAAMC,iBAAiB,GAAG,IAAAC,6BAAA,EAAgBH,OAAO,CAACI,SAAxB,CAA1B;EAEA,MAAMC,UAAU,GAAG,CAACN,KAAK,CAACO,QAAN,CAAgB,SAAhB,CAApB;EAEA,MAAMC,KAAK,GAAGR,KAAK,CAACO,QAAN,CAAgB,MAAhB,CAAd;;EACA,MAAM;IAAEE;EAAF,IAAaC,YAAA,CAAMC,QAAN,EAAnB;;EACA,MAAM;IAAEC,WAAF;IAAeC;EAAf,IAA8BJ,MAApC;EAEA,MAAMK,UAAU,GAAG,IAAAC,4BAAA,EAAc;IAAEH,WAAF;IAAeC,UAAf;IAA2B,GAAGZ;EAA9B,CAAd,CAAnB;;EAEA,MAAMe,gBAAgB,GACnBC,QAAD,IACA,CAACC,OAAO,GAAG,EAAX,KAA+B;IAC7B,MAAMC,IAAI,GAAGF,QAAQ,CAACC,OAAD,CAArB;IACAC,IAAI,CAACC,OAAL,GAAetB,WAAf;IACA,OAAOqB,IAAP;EACD,CANH;;EAQA,MAAME,gBAAgB,GACnBJ,QAAD,IACA,CAACC,O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O,EAAE,CACN,gBADM,EAEN,oBAFM,EAGPoI,sDAHO,CAFK;MAOd,GAAGI;IAPW,CAAhB,CADoD,CAUpD;;IACA,OAAO,IAAIF,4BAAJ,CAAiB1I,OAAjB,CAAP;EACD,CAZD;;EAcA,OAAO;IACLK,OADK;IAELuD,KAFK;IAGL7B;EAHK,CAAP;AAKD,CA/oBM"}
|
|
1
|
+
{"version":3,"file":"webpack-utils.js","names":["vendorRegex","createWebpackUtils","stage","program","assetRelativeRoot","supportedBrowsers","getBrowsersList","directory","PRODUCTION","includes","isSSR","config","store","getState","assetPrefix","pathPrefix","publicPath","getPublicPath","makeExternalOnly","original","options","rule","include","makeInternalOnly","exclude","fileLoaderCommonOptions","name","outputPath","path","relative","ROUTES_DIRECTORY","loaders","json","loader","require","resolve","yaml","null","raw","style","miniCssExtract","moduleOptions","undefined","modules","restOptions","namedExport","MiniCssExtractPlugin","css","modulesOptions","auto","localIdentName","exportLocalsConvention","exportOnlyLocals","url","startsWith","sourceMap","postcss","plugins","overrideBrowserslist","postcssOpts","execute","postcssOptions","loaderContext","postCSSPlugins","autoprefixerPlugin","autoprefixer","flexbox","find","plugin","postcssPlugin","unshift","flexbugs","file","limit","fallback","js","reactRuntime","jsxRuntime","reactImportSource","jsxImportSource","cacheDirectory","join","rootDir","dependencies","rules","modulesThatUseGatsby","test","modulePath","some","module","type","use","resourceQuery","issuer","configFile","compact","isPageTemplate","jsOptions","babelrc","presets","sourceMaps","cacheIdentifier","JSON","stringify","browsersList","gatsbyPreset","version","VENDORS_TO_NOT_POLYFILL","doNotPolyfillRegex","RegExp","fonts","images","media","miscAssets","browsers","importLoaders","filter","Boolean","internal","external","cssModules","builtinPlugins","minifyJs","terserOptions","TerserPlugin","ie8","mangle","safari10","parse","ecma","compress","output","parallel","Math","max","cpuCoreCount","minifyCss","minimizerOptions","preset","svgo","full","CssMinimizerPlugin","fastRefresh","regExpToHack","ReactRefreshWebpackPlugin","overlay","sockIntegration","__dirname","extractText","moment","ignore","resourceRegExp","contextRegExp","extractStats","GatsbyWebpackStatsExtractor","eslintGraphqlSchemaReload","virtualModules","GatsbyWebpackVirtualModules","eslint","extensions","VIRTUAL_MODULES_BASE_PATH","eslintConfig","ESLintPlugin","eslintRequired","eslintRequiredConfig"],"sources":["../../src/utils/webpack-utils.ts"],"sourcesContent":["import * as path from \"path\"\nimport { RuleSetRule, WebpackPluginInstance } from \"webpack\"\nimport { GraphQLSchema } from \"graphql\"\nimport { Plugin as PostCSSPlugin } from \"postcss\"\nimport autoprefixer from \"autoprefixer\"\nimport flexbugs from \"postcss-flexbugs-fixes\"\nimport TerserPlugin from \"terser-webpack-plugin\"\nimport type { MinifyOptions as TerserOptions } from \"terser\"\nimport MiniCssExtractPlugin from \"mini-css-extract-plugin\"\nimport CssMinimizerPlugin from \"css-minimizer-webpack-plugin\"\nimport ReactRefreshWebpackPlugin from \"@pmmmwh/react-refresh-webpack-plugin\"\nimport { getBrowsersList } from \"./browserslist\"\nimport ESLintPlugin from \"eslint-webpack-plugin\"\nimport { cpuCoreCount } from \"gatsby-core-utils\"\nimport { GatsbyWebpackStatsExtractor } from \"./gatsby-webpack-stats-extractor\"\nimport { getPublicPath } from \"./get-public-path\"\nimport {\n GatsbyWebpackVirtualModules,\n VIRTUAL_MODULES_BASE_PATH,\n} from \"./gatsby-webpack-virtual-modules\"\n\nimport { builtinPlugins } from \"./webpack-plugins\"\nimport { IProgram, Stage } from \"../commands/types\"\nimport { eslintConfig, eslintRequiredConfig } from \"./eslint-config\"\nimport { store } from \"../redux\"\nimport type { RuleSetUseItem } from \"webpack\"\nimport { ROUTES_DIRECTORY } from \"../constants\"\n\ntype Loader = string | { loader: string; options?: { [name: string]: any } }\ntype LoaderResolver<T = Record<string, unknown>> = (options?: T) => Loader\n\ntype LoaderOptions = Record<string, any>\ntype RuleFactory<T = Record<string, unknown>> = (\n options?: T & LoaderOptions\n) => RuleSetRule\n\ntype ContextualRuleFactory<T = Record<string, unknown>> = RuleFactory<T> & {\n internal?: RuleFactory<T>\n external?: RuleFactory<T>\n}\n\ntype PluginFactory = (...args: any) => WebpackPluginInstance | null\n\ntype BuiltinPlugins = typeof builtinPlugins\n\ntype CSSModulesOptions =\n | boolean\n | string\n | {\n mode?:\n | \"local\"\n | \"global\"\n | \"pure\"\n | ((resourcePath: string) => \"local\" | \"global\" | \"pure\")\n auto?: boolean\n exportGlobals?: boolean\n localIdentName?: string\n localIdentContext?: string\n localIdentHashPrefix?: string\n namedExport?: boolean\n exportLocalsConvention?:\n | \"asIs\"\n | \"camelCaseOnly\"\n | \"camelCase\"\n | \"dashes\"\n | \"dashesOnly\"\n exportOnlyLocals?: boolean\n }\n\ntype MiniCSSExtractLoaderModuleOptions =\n | undefined\n | boolean\n | {\n namedExport?: boolean\n }\n/**\n * Utils that produce webpack `loader` objects\n */\ninterface ILoaderUtils {\n yaml: LoaderResolver\n style: LoaderResolver\n css: LoaderResolver<{\n url?: boolean | ((url: string, resourcePath: string) => boolean)\n import?:\n | boolean\n | ((url: string, media: string, resourcePath: string) => boolean)\n modules?: CSSModulesOptions\n sourceMap?: boolean\n importLoaders?: number\n esModule?: boolean\n }>\n postcss: LoaderResolver<{\n browsers?: Array<string>\n overrideBrowserslist?: Array<string>\n plugins?: Array<PostCSSPlugin> | ((loader: Loader) => Array<PostCSSPlugin>)\n }>\n\n file: LoaderResolver\n url: LoaderResolver\n js: LoaderResolver\n json: LoaderResolver\n null: LoaderResolver\n raw: LoaderResolver\n dependencies: LoaderResolver\n\n miniCssExtract: LoaderResolver\n imports?: LoaderResolver\n exports?: LoaderResolver\n}\n\ninterface IModuleThatUseGatsby {\n name: string\n path: string\n}\n\ntype CssLoaderModuleOption = boolean | Record<string, any> | string\n\n/**\n * Utils that produce webpack rule objects\n */\ninterface IRuleUtils {\n /**\n * Handles JavaScript compilation via babel\n */\n js: RuleFactory<{ modulesThatUseGatsby?: Array<IModuleThatUseGatsby> }>\n dependencies: RuleFactory<{\n modulesThatUseGatsby?: Array<IModuleThatUseGatsby>\n }>\n yaml: RuleFactory\n fonts: RuleFactory\n images: RuleFactory\n miscAssets: RuleFactory\n media: RuleFactory\n\n css: ContextualRuleFactory<{\n browsers?: Array<string>\n modules?: CssLoaderModuleOption\n }>\n cssModules: RuleFactory\n postcss: ContextualRuleFactory<{ overrideBrowserOptions: Array<string> }>\n\n eslint: (schema: GraphQLSchema) => RuleSetRule\n eslintRequired: () => RuleSetRule\n}\n\ntype PluginUtils = BuiltinPlugins & {\n extractText: PluginFactory\n uglify: PluginFactory\n moment: PluginFactory\n extractStats: PluginFactory\n minifyJs: PluginFactory\n minifyCss: PluginFactory\n fastRefresh: PluginFactory\n eslintGraphqlSchemaReload: PluginFactory\n virtualModules: PluginFactory\n eslint: PluginFactory\n eslintRequired: PluginFactory\n}\n\n/**\n * webpack atoms namespace\n */\ninterface IWebpackUtils {\n loaders: ILoaderUtils\n\n rules: IRuleUtils\n\n plugins: PluginUtils\n}\n\nconst vendorRegex = /(node_modules|bower_components)/\n\n/**\n * A factory method that produces an atoms namespace\n */\nexport const createWebpackUtils = (\n stage: Stage,\n program: IProgram\n): IWebpackUtils => {\n const assetRelativeRoot = `static/`\n const supportedBrowsers = getBrowsersList(program.directory)\n\n const PRODUCTION = !stage.includes(`develop`)\n\n const isSSR = stage.includes(`html`)\n const { config } = store.getState()\n const { assetPrefix, pathPrefix } = config\n\n const publicPath = getPublicPath({ assetPrefix, pathPrefix, ...program })\n\n const makeExternalOnly =\n (original: RuleFactory) =>\n (options = {}): RuleSetRule => {\n const rule = original(options)\n rule.include = vendorRegex\n return rule\n }\n\n const makeInternalOnly =\n (original: RuleFactory) =>\n (options = {}): RuleSetRule => {\n const rule = original(options)\n rule.exclude = vendorRegex\n return rule\n }\n\n const fileLoaderCommonOptions: {\n name: string\n publicPath?: string\n outputPath?: string\n } = {\n name: `${assetRelativeRoot}[name]-[hash].[ext]`,\n }\n\n if (stage === `build-html` || stage === `develop-html`) {\n // build-html and develop-html outputs to `.cache/page-ssr/routes/` (ROUTES_DIRECTORY)\n // so this config is setting it to output assets to `public` (outputPath)\n // while preserving \"url\" (publicPath)\n fileLoaderCommonOptions.outputPath = path.relative(\n ROUTES_DIRECTORY,\n `public`\n )\n fileLoaderCommonOptions.publicPath = `/`\n }\n\n const loaders: ILoaderUtils = {\n json: (options = {}) => {\n return {\n options,\n loader: require.resolve(`json-loader`),\n }\n },\n yaml: (options = {}) => {\n return {\n options,\n loader: require.resolve(`yaml-loader`),\n }\n },\n\n null: (options = {}) => {\n return {\n options,\n loader: require.resolve(`null-loader`),\n }\n },\n\n raw: (options = {}) => {\n return {\n options,\n loader: require.resolve(`raw-loader`),\n }\n },\n\n style: (options = {}) => {\n return {\n options,\n loader: require.resolve(`style-loader`),\n }\n },\n\n // TODO(v5): Re-Apply https://github.com/gatsbyjs/gatsby/pull/33979 with breaking change in inline loader syntax\n miniCssExtract: (\n options: {\n modules?: MiniCSSExtractLoaderModuleOptions\n } = {}\n ) => {\n let moduleOptions: MiniCSSExtractLoaderModuleOptions = undefined\n\n const { modules, ...restOptions } = options\n\n if (typeof modules === `boolean` && options.modules) {\n moduleOptions = {\n namedExport: true,\n }\n } else {\n moduleOptions = modules\n }\n\n return {\n loader: MiniCssExtractPlugin.loader,\n options: {\n modules: moduleOptions,\n ...restOptions,\n },\n }\n },\n\n css: (options = {}) => {\n let modulesOptions: CSSModulesOptions = false\n if (options.modules) {\n modulesOptions = {\n auto: undefined,\n namedExport: true,\n localIdentName: `[name]--[local]--[hash:hex:5]`,\n exportLocalsConvention: `dashesOnly`,\n exportOnlyLocals: isSSR,\n }\n\n if (typeof options.modules === `object`) {\n modulesOptions = {\n ...modulesOptions,\n ...options.modules,\n }\n }\n }\n\n return {\n loader: require.resolve(`css-loader`),\n options: {\n // Absolute urls (https or //) are not send to this function. Only resolvable paths absolute or relative ones.\n url: function (url: string): boolean {\n // When an url starts with /\n if (url.startsWith(`/`)) {\n return false\n }\n\n return true\n },\n sourceMap: !PRODUCTION,\n modules: modulesOptions,\n },\n }\n },\n\n postcss: (options = {}) => {\n const {\n plugins,\n overrideBrowserslist = supportedBrowsers,\n ...postcssOpts\n } = options\n\n return {\n loader: require.resolve(`postcss-loader`),\n options: {\n execute: false,\n sourceMap: !PRODUCTION,\n // eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n postcssOptions: (loaderContext: any) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let postCSSPlugins: Array<PostCSSPlugin> = []\n if (plugins) {\n postCSSPlugins =\n typeof plugins === `function` ? plugins(loaderContext) : plugins\n }\n\n const autoprefixerPlugin = autoprefixer({\n overrideBrowserslist,\n flexbox: `no-2009`,\n ...((\n postCSSPlugins.find(\n plugin => plugin.postcssPlugin === `autoprefixer`\n ) as unknown as autoprefixer.ExportedAPI\n )?.options ?? {}),\n })\n\n postCSSPlugins.unshift(autoprefixerPlugin)\n postCSSPlugins.unshift(flexbugs)\n\n return {\n plugins: postCSSPlugins,\n ...postcssOpts,\n }\n },\n },\n }\n },\n\n file: (options = {}) => {\n return {\n loader: require.resolve(`file-loader`),\n options: {\n ...fileLoaderCommonOptions,\n ...options,\n },\n }\n },\n\n url: (options = {}) => {\n return {\n loader: require.resolve(`url-loader`),\n options: {\n limit: 10000,\n ...fileLoaderCommonOptions,\n fallback: require.resolve(`file-loader`),\n ...options,\n },\n }\n },\n\n js: options => {\n return {\n options: {\n stage,\n reactRuntime: config.jsxRuntime,\n reactImportSource: config.jsxImportSource,\n cacheDirectory: path.join(\n program.directory,\n `.cache`,\n `webpack`,\n `babel`\n ),\n ...options,\n rootDir: program.directory,\n },\n loader: require.resolve(`./babel-loader`),\n }\n },\n\n dependencies: options => {\n return {\n options: {\n cacheDirectory: path.join(\n program.directory,\n `.cache`,\n `webpack`,\n `babel`\n ),\n ...options,\n },\n loader: require.resolve(`babel-loader`),\n }\n },\n }\n\n /**\n * Rules\n */\n const rules = {} as IRuleUtils\n\n /**\n * JavaScript loader via babel, includes userland code\n * and packages that depend on `gatsby`\n */\n {\n const js = ({\n modulesThatUseGatsby = [],\n ...options\n }: {\n modulesThatUseGatsby?: Array<IModuleThatUseGatsby>\n } = {}): RuleSetRule => {\n return {\n test: /\\.(js|mjs|jsx|ts|tsx)$/,\n include: (modulePath: string): boolean => {\n // when it's not coming from node_modules we treat it as a source file.\n if (!vendorRegex.test(modulePath)) {\n return true\n }\n\n // If the module uses Gatsby as a dependency\n // we want to treat it as src so we can extract queries\n return modulesThatUseGatsby.some(module =>\n modulePath.includes(module.path)\n )\n },\n type: `javascript/auto`,\n use: ({ resourceQuery, issuer }): Array<RuleSetUseItem> => [\n // If a JS import comes from async-requires, assume it is for a page component.\n // Using `issuer` allows us to avoid mutating async-requires for this case.\n //\n // If other imports are added to async-requires in the future, another option is to\n // append a query param to page components in the store and check against `resourceQuery` here.\n //\n // This would require we adjust `doesModuleMatchResourcePath` in `static-query-mapper`\n // to check against the module's `resourceResolveData.path` instead of resource to avoid\n // mismatches because of the added query param. Other adjustments may also be needed.\n loaders.js({\n ...options,\n configFile: true,\n compact: PRODUCTION,\n isPageTemplate: /async-requires/.test(issuer),\n resourceQuery,\n }),\n ],\n }\n }\n rules.js = js\n }\n\n /**\n * Node_modules JavaScript loader via babel\n * Excludes core-js & babel-runtime to speedup babel transpilation\n * Excludes modules that use Gatsby since the `rules.js` already transpiles those\n */\n {\n const dependencies = ({\n modulesThatUseGatsby = [],\n }: {\n modulesThatUseGatsby?: Array<IModuleThatUseGatsby>\n } = {}): RuleSetRule => {\n const jsOptions = {\n babelrc: false,\n configFile: false,\n compact: false,\n presets: [\n [\n require.resolve(`babel-preset-gatsby/dependencies`),\n {\n stage,\n },\n ],\n ],\n // If an error happens in a package, it's possible to be\n // because it was compiled. Thus, we don't want the browser\n // debugger to show the original code. Instead, the code\n // being evaluated would be much more helpful.\n sourceMaps: false,\n\n cacheIdentifier: JSON.stringify({\n browsersList: supportedBrowsers,\n gatsbyPreset: require(`babel-preset-gatsby/package.json`).version,\n }),\n }\n\n // TODO REMOVE IN V3\n // a list of vendors we know we shouldn't polyfill (we should have set core-js to entry but we didn't so we have to do this)\n const VENDORS_TO_NOT_POLYFILL = [\n `@babel[\\\\\\\\/]runtime`,\n `@mikaelkristiansson[\\\\\\\\/]domready`,\n `@reach[\\\\\\\\/]router`,\n `babel-preset-gatsby`,\n `core-js`,\n `dom-helpers`,\n `gatsby-legacy-polyfills`,\n `gatsby-link`,\n `gatsby-script`,\n `gatsby-react-router-scroll`,\n `invariant`,\n `lodash`,\n `mitt`,\n `prop-types`,\n `react-dom`,\n `react`,\n `regenerator-runtime`,\n `scheduler`,\n `scroll-behavior`,\n `shallow-compare`,\n `warning`,\n `webpack`,\n ]\n const doNotPolyfillRegex = new RegExp(\n `[\\\\\\\\/]node_modules[\\\\\\\\/](${VENDORS_TO_NOT_POLYFILL.join(\n `|`\n )})[\\\\\\\\/]`\n )\n\n return {\n test: /\\.(js|mjs)$/,\n exclude: (modulePath: string): boolean => {\n // If dep is user land code, exclude\n if (!vendorRegex.test(modulePath)) {\n return true\n }\n\n // If dep uses Gatsby, exclude\n if (\n modulesThatUseGatsby.some(module =>\n modulePath.includes(module.path)\n )\n ) {\n return true\n }\n\n return doNotPolyfillRegex.test(modulePath)\n },\n type: `javascript/auto`,\n use: [loaders.dependencies(jsOptions)],\n }\n }\n rules.dependencies = dependencies\n }\n\n rules.yaml = (): RuleSetRule => {\n return {\n test: /\\.ya?ml$/,\n type: `json`,\n use: [loaders.yaml()],\n }\n }\n\n /**\n * Font loader\n */\n rules.fonts = (): RuleSetRule => {\n return {\n use: [loaders.url()],\n test: /\\.(eot|otf|ttf|woff(2)?)(\\?.*)?$/,\n }\n }\n\n /**\n * Loads image assets, inlines images via a data URI if they are below\n * the size threshold\n */\n rules.images = (): RuleSetRule => {\n return {\n use: [loaders.url()],\n test: /\\.(ico|svg|jpg|jpeg|png|gif|webp|avif)(\\?.*)?$/,\n }\n }\n\n /**\n * Loads audio and video and inlines them via a data URI if they are below\n * the size threshold\n */\n rules.media = (): RuleSetRule => {\n return {\n use: [loaders.url()],\n test: /\\.(mp4|webm|ogv|wav|mp3|m4a|aac|oga|flac)$/,\n }\n }\n\n /**\n * Loads assets without inlining\n */\n rules.miscAssets = (): RuleSetRule => {\n return {\n use: [loaders.file()],\n test: /\\.pdf$/,\n }\n }\n\n /**\n * CSS style loader.\n */\n {\n const css: IRuleUtils[\"css\"] = (options = {}): RuleSetRule => {\n const { browsers, ...restOptions } = options\n const use = [\n !isSSR && loaders.miniCssExtract(restOptions),\n loaders.css({ ...restOptions, importLoaders: 1 }),\n loaders.postcss({ browsers }),\n ].filter(Boolean) as RuleSetRule[\"use\"]\n\n return {\n use,\n test: /\\.css$/,\n }\n }\n\n /**\n * CSS style loader, _excludes_ node_modules.\n */\n css.internal = makeInternalOnly(css)\n css.external = makeExternalOnly(css)\n\n const cssModules: IRuleUtils[\"cssModules\"] = (options): RuleSetRule => {\n const rule = css({ ...options, modules: true })\n delete rule.exclude\n rule.test = /\\.module\\.css$/\n return rule\n }\n\n rules.css = css\n rules.cssModules = cssModules\n }\n\n /**\n * PostCSS loader.\n */\n {\n const postcss: ContextualRuleFactory = (options): RuleSetRule => {\n return {\n test: /\\.css$/,\n use: [loaders.css({ importLoaders: 1 }), loaders.postcss(options)],\n }\n }\n\n /**\n * PostCSS loader, _excludes_ node_modules.\n */\n postcss.internal = makeInternalOnly(postcss)\n postcss.external = makeExternalOnly(postcss)\n rules.postcss = postcss\n }\n /**\n * cast rules to IRuleUtils\n */\n /**\n * Plugins\n */\n const plugins = { ...builtinPlugins } as PluginUtils\n\n plugins.minifyJs = ({\n terserOptions,\n ...options\n }: {\n terserOptions?: TerserOptions\n } = {}): WebpackPluginInstance =>\n new TerserPlugin({\n exclude: /\\.min\\.js/,\n terserOptions: {\n ie8: false,\n mangle: {\n safari10: true,\n },\n parse: {\n ecma: 5,\n },\n compress: {\n ecma: 5,\n },\n output: {\n ecma: 5,\n },\n ...terserOptions,\n },\n parallel: Math.max(1, cpuCoreCount() - 1),\n ...options,\n })\n\n plugins.minifyCss = (\n options = {\n minimizerOptions: {\n preset: [\n `default`,\n {\n svgo: {\n full: true,\n plugins: [\n // potentially destructive plugins removed - see https://github.com/gatsbyjs/gatsby/issues/15629\n // use correct config format and remove plugins requiring specific params - see https://github.com/gatsbyjs/gatsby/issues/31619\n // List of default plugins and their defaults: https://github.com/svg/svgo#built-in-plugins\n // Last update 2021-08-17\n `cleanupAttrs`,\n `cleanupEnableBackground`,\n `cleanupIDs`,\n `cleanupListOfValues`, // Default: disabled\n `cleanupNumericValues`,\n `collapseGroups`,\n `convertColors`,\n `convertPathData`,\n `convertStyleToAttrs`, // Default: disabled\n `convertTransform`,\n `inlineStyles`,\n `mergePaths`,\n `minifyStyles`,\n `moveElemsAttrsToGroup`,\n `moveGroupAttrsToElems`,\n `prefixIds`, // Default: disabled\n `removeComments`,\n `removeDesc`,\n `removeDoctype`,\n `removeEditorsNSData`,\n `removeEmptyAttrs`,\n `removeEmptyContainers`,\n `removeEmptyText`,\n `removeHiddenElems`,\n `removeMetadata`,\n `removeNonInheritableGroupAttrs`,\n `removeRasterImages`, // Default: disabled\n `removeScriptElement`, // Default: disabled\n `removeStyleElement`, // Default: disabled\n `removeTitle`,\n `removeUnknownsAndDefaults`,\n `removeUnusedNS`,\n `removeUselessDefs`,\n `removeUselessStrokeAndFill`,\n `removeXMLProcInst`,\n `reusePaths`, // Default: disabled\n `sortAttrs`, // Default: disabled\n ],\n },\n },\n ],\n },\n }\n ): CssMinimizerPlugin =>\n new CssMinimizerPlugin({\n parallel: Math.max(1, cpuCoreCount() - 1),\n ...options,\n })\n\n plugins.fastRefresh = ({ modulesThatUseGatsby }): WebpackPluginInstance => {\n const regExpToHack = /node_modules/\n regExpToHack.test = (modulePath: string): boolean => {\n // when it's not coming from node_modules we treat it as a source file.\n if (!vendorRegex.test(modulePath)) {\n return false\n }\n\n // If the module uses Gatsby as a dependency\n // we want to treat it as src because of shadowing\n return !modulesThatUseGatsby.some(module =>\n modulePath.includes(module.path)\n )\n }\n\n return new ReactRefreshWebpackPlugin({\n overlay: {\n sockIntegration: `whm`,\n module: path.join(__dirname, `fast-refresh-module`),\n },\n // this is a bit hacky - exclude expect string or regexp or array of those\n // so this is tricking ReactRefreshWebpackPlugin with providing regexp with\n // overwritten .test method\n exclude: regExpToHack,\n })\n }\n\n plugins.extractText = (options: any): WebpackPluginInstance =>\n new MiniCssExtractPlugin({\n ...options,\n })\n\n plugins.moment = (): WebpackPluginInstance =>\n plugins.ignore({ resourceRegExp: /^\\.\\/locale$/, contextRegExp: /moment$/ })\n\n plugins.extractStats = (): GatsbyWebpackStatsExtractor =>\n new GatsbyWebpackStatsExtractor(publicPath)\n\n // TODO: remove this in v5\n plugins.eslintGraphqlSchemaReload = (): null => null\n\n plugins.virtualModules = (): GatsbyWebpackVirtualModules =>\n new GatsbyWebpackVirtualModules()\n\n plugins.eslint = (): WebpackPluginInstance => {\n const options = {\n extensions: [`js`, `jsx`],\n exclude: [\n `/node_modules/`,\n `/bower_components/`,\n VIRTUAL_MODULES_BASE_PATH,\n ],\n ...eslintConfig(config.jsxRuntime === `automatic`),\n }\n // @ts-ignore\n return new ESLintPlugin(options)\n }\n\n plugins.eslintRequired = (): WebpackPluginInstance => {\n const options = {\n extensions: [`js`, `jsx`],\n exclude: [\n `/node_modules/`,\n `/bower_components/`,\n VIRTUAL_MODULES_BASE_PATH,\n ],\n ...eslintRequiredConfig,\n }\n // @ts-ignore\n return new ESLintPlugin(options)\n }\n\n return {\n loaders,\n rules,\n plugins,\n }\n}\n"],"mappings":";;;;;;;AAAA;;AAIA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAEA;;AACA;;AAEA;;;;;;AAgJA,MAAMA,WAAW,GAAG,iCAApB;AAEA;AACA;AACA;;AACO,MAAMC,kBAAkB,GAAG,CAChCC,KADgC,EAEhCC,OAFgC,KAGd;EAClB,MAAMC,iBAAiB,GAAI,SAA3B;EACA,MAAMC,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"gatsby",
|
|
3
3
|
"description": "Blazing fast modern site generator for React",
|
|
4
|
-
"version": "5.3.
|
|
4
|
+
"version": "5.3.3",
|
|
5
5
|
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
|
|
6
6
|
"bin": {
|
|
7
7
|
"gatsby": "./cli.js"
|
|
@@ -277,5 +277,5 @@
|
|
|
277
277
|
"yargs": {
|
|
278
278
|
"boolean-negation": false
|
|
279
279
|
},
|
|
280
|
-
"gitHead": "
|
|
280
|
+
"gitHead": "da692c77a711bccec2866d863c0f221f81a7dc2c"
|
|
281
281
|
}
|