gatsby 4.17.0 → 4.17.1
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.
|
@@ -11,7 +11,7 @@ export declare function constructParcel(siteRoot: string): Parcel;
|
|
|
11
11
|
* Compile known gatsby-* files (e.g. `gatsby-config`, `gatsby-node`)
|
|
12
12
|
* and output in `<SITE_ROOT>/.cache/compiled`.
|
|
13
13
|
*/
|
|
14
|
-
export declare function compileGatsbyFiles(siteRoot: string): Promise<void>;
|
|
14
|
+
export declare function compileGatsbyFiles(siteRoot: string, retry?: number): Promise<void>;
|
|
15
15
|
export declare function getResolvedFieldsForPlugin(rootDir: string, pluginName: string): {
|
|
16
16
|
resolvedCompiledGatsbyNode?: string;
|
|
17
17
|
};
|
|
@@ -23,12 +23,26 @@ exports.COMPILED_CACHE_DIR = COMPILED_CACHE_DIR;
|
|
|
23
23
|
const PARCEL_CACHE_DIR = `.cache/.parcel-cache`;
|
|
24
24
|
exports.PARCEL_CACHE_DIR = PARCEL_CACHE_DIR;
|
|
25
25
|
const gatsbyFileRegex = `gatsby-+(node|config).ts`;
|
|
26
|
+
exports.gatsbyFileRegex = gatsbyFileRegex;
|
|
27
|
+
const RETRY_COUNT = 5;
|
|
28
|
+
|
|
29
|
+
function getCacheDir(siteRoot) {
|
|
30
|
+
return `${siteRoot}/${PARCEL_CACHE_DIR}`;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function exponentialBackoff(retry) {
|
|
34
|
+
if (retry === 0) {
|
|
35
|
+
return Promise.resolve();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const timeout = 50 * Math.pow(2, retry);
|
|
39
|
+
return new Promise(resolve => setTimeout(resolve, timeout));
|
|
40
|
+
}
|
|
26
41
|
/**
|
|
27
42
|
* Construct Parcel with config.
|
|
28
43
|
* @see {@link https://parceljs.org/features/targets/}
|
|
29
44
|
*/
|
|
30
45
|
|
|
31
|
-
exports.gatsbyFileRegex = gatsbyFileRegex;
|
|
32
46
|
|
|
33
47
|
function constructParcel(siteRoot) {
|
|
34
48
|
return new _core.Parcel({
|
|
@@ -46,7 +60,7 @@ function constructParcel(siteRoot) {
|
|
|
46
60
|
distDir: `${siteRoot}/${COMPILED_CACHE_DIR}`
|
|
47
61
|
}
|
|
48
62
|
},
|
|
49
|
-
cacheDir:
|
|
63
|
+
cacheDir: getCacheDir(siteRoot)
|
|
50
64
|
});
|
|
51
65
|
}
|
|
52
66
|
/**
|
|
@@ -55,29 +69,64 @@ function constructParcel(siteRoot) {
|
|
|
55
69
|
*/
|
|
56
70
|
|
|
57
71
|
|
|
58
|
-
async function compileGatsbyFiles(siteRoot) {
|
|
72
|
+
async function compileGatsbyFiles(siteRoot, retry = 0) {
|
|
59
73
|
try {
|
|
60
|
-
const parcel = constructParcel(siteRoot);
|
|
61
74
|
const distDir = `${siteRoot}/${COMPILED_CACHE_DIR}`;
|
|
62
75
|
await (0, _fsExtra.ensureDir)(distDir);
|
|
63
76
|
await (0, _fsExtra.emptyDir)(distDir);
|
|
77
|
+
await exponentialBackoff(retry);
|
|
78
|
+
const parcel = constructParcel(siteRoot);
|
|
64
79
|
const {
|
|
65
80
|
bundleGraph
|
|
66
81
|
} = await parcel.run();
|
|
82
|
+
await exponentialBackoff(retry);
|
|
83
|
+
const bundles = bundleGraph.getBundles();
|
|
84
|
+
if (bundles.length === 0) return;
|
|
85
|
+
let compiledTSFilesCount = 0;
|
|
86
|
+
|
|
87
|
+
for (const bundle of bundles) {
|
|
88
|
+
var _bundle$getMainEntry2;
|
|
89
|
+
|
|
90
|
+
// validate that output exists and is valid
|
|
91
|
+
try {
|
|
92
|
+
delete require.cache[bundle.filePath];
|
|
93
|
+
|
|
94
|
+
require(bundle.filePath);
|
|
95
|
+
} catch (e) {
|
|
96
|
+
if (retry >= RETRY_COUNT) {
|
|
97
|
+
var _bundle$getMainEntry;
|
|
98
|
+
|
|
99
|
+
_reporter.default.panic({
|
|
100
|
+
id: `11904`,
|
|
101
|
+
context: {
|
|
102
|
+
siteRoot,
|
|
103
|
+
retries: RETRY_COUNT,
|
|
104
|
+
compiledFileLocation: bundle.filePath,
|
|
105
|
+
sourceFileLocation: (_bundle$getMainEntry = bundle.getMainEntry()) === null || _bundle$getMainEntry === void 0 ? void 0 : _bundle$getMainEntry.filePath
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
} else if (retry > 0) {
|
|
109
|
+
// first retry is most flaky and it seems it always get in good state
|
|
110
|
+
// after that - most likely cache clearing is the trick that fixes the problem
|
|
111
|
+
_reporter.default.verbose(`Failed to import compiled file "${bundle.filePath}" after retry, attempting another retry (#${retry + 1} of ${RETRY_COUNT}) - "${e.message}"`);
|
|
112
|
+
} // sometimes parcel cache gets in weird state
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
await (0, _fsExtra.remove)(getCacheDir(siteRoot));
|
|
116
|
+
await compileGatsbyFiles(siteRoot, retry + 1);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
67
119
|
|
|
68
|
-
|
|
69
|
-
const bundles = bundleGraph.getBundles();
|
|
70
|
-
if (bundles.length === 0) return;
|
|
71
|
-
let compiledTSFilesCount = 0;
|
|
72
|
-
|
|
73
|
-
for (const bundle of bundles) {
|
|
74
|
-
var _bundle$getMainEntry, _bundle$getMainEntry$;
|
|
120
|
+
const mainEntry = (_bundle$getMainEntry2 = bundle.getMainEntry()) === null || _bundle$getMainEntry2 === void 0 ? void 0 : _bundle$getMainEntry2.filePath; // mainEntry won't exist for shared chunks
|
|
75
121
|
|
|
76
|
-
|
|
122
|
+
if (mainEntry) {
|
|
123
|
+
if (mainEntry.endsWith(`.ts`)) {
|
|
77
124
|
compiledTSFilesCount = compiledTSFilesCount + 1;
|
|
78
125
|
}
|
|
79
126
|
}
|
|
127
|
+
}
|
|
80
128
|
|
|
129
|
+
if (_gatsbyTelemetry.default.isTrackingEnabled()) {
|
|
81
130
|
_gatsbyTelemetry.default.trackCli(`PARCEL_COMPILATION_END`, {
|
|
82
131
|
valueInteger: compiledTSFilesCount,
|
|
83
132
|
name: `count of compiled ts files`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile-gatsby-files.js","names":["COMPILED_CACHE_DIR","PARCEL_CACHE_DIR","gatsbyFileRegex","constructParcel","siteRoot","Parcel","entries","defaultConfig","require","resolve","mode","targets","root","outputFormat","includeNodeModules","sourceMap","engines","node","distDir","cacheDir","compileGatsbyFiles","parcel","ensureDir","emptyDir","bundleGraph","run","telemetry","isTrackingEnabled","bundles","getBundles","length","compiledTSFilesCount","bundle","getMainEntry","filePath","endsWith","trackCli","valueInteger","name","error","diagnostics","handleErrors","reporter","panic","id","context","sourceMessage","message","forEach","err","codeFrames","c","codeHighlightsMessage","codeHighlights","specificMessage","undefined","generalMessage","origin","hints","getResolvedFieldsForPlugin","rootDir","pluginName","resolvedCompiledGatsbyNode","findCompiledLocalPluginModule","moduleName","compiledPathForPlugin","compiledPathForModule","isCompiled","existsSync"],"sources":["../../../src/utils/parcel/compile-gatsby-files.ts"],"sourcesContent":["import { Parcel } from \"@parcel/core\"\nimport type { Diagnostic } from \"@parcel/diagnostic\"\nimport reporter from \"gatsby-cli/lib/reporter\"\nimport { ensureDir, emptyDir, existsSync } from \"fs-extra\"\nimport telemetry from \"gatsby-telemetry\"\n\nexport const COMPILED_CACHE_DIR = `.cache/compiled`\nexport const PARCEL_CACHE_DIR = `.cache/.parcel-cache`\nexport const gatsbyFileRegex = `gatsby-+(node|config).ts`\n\n/**\n * Construct Parcel with config.\n * @see {@link https://parceljs.org/features/targets/}\n */\nexport function constructParcel(siteRoot: string): Parcel {\n return new Parcel({\n entries: [\n `${siteRoot}/${gatsbyFileRegex}`,\n `${siteRoot}/plugins/**/${gatsbyFileRegex}`,\n ],\n defaultConfig: require.resolve(`gatsby-parcel-config`),\n mode: `production`,\n targets: {\n root: {\n outputFormat: `commonjs`,\n includeNodeModules: false,\n sourceMap: false,\n engines: {\n node: `>= 14.15.0`,\n },\n distDir: `${siteRoot}/${COMPILED_CACHE_DIR}`,\n },\n },\n cacheDir: `${siteRoot}/${PARCEL_CACHE_DIR}`,\n })\n}\n\n/**\n * Compile known gatsby-* files (e.g. `gatsby-config`, `gatsby-node`)\n * and output in `<SITE_ROOT>/.cache/compiled`.\n */\nexport async function compileGatsbyFiles(siteRoot: string): Promise<void> {\n try {\n const parcel = constructParcel(siteRoot)\n const distDir = `${siteRoot}/${COMPILED_CACHE_DIR}`\n await ensureDir(distDir)\n await emptyDir(distDir)\n const { bundleGraph } = await parcel.run()\n\n if (telemetry.isTrackingEnabled()) {\n const bundles = bundleGraph.getBundles()\n\n if (bundles.length === 0) return\n\n let compiledTSFilesCount = 0\n for (const bundle of bundles) {\n if (bundle?.getMainEntry()?.filePath?.endsWith(`.ts`)) {\n compiledTSFilesCount = compiledTSFilesCount + 1\n }\n }\n telemetry.trackCli(`PARCEL_COMPILATION_END`, {\n valueInteger: compiledTSFilesCount,\n name: `count of compiled ts files`,\n })\n }\n } catch (error) {\n if (error.diagnostics) {\n handleErrors(error.diagnostics)\n } else {\n reporter.panic({\n id: `11903`,\n error,\n context: {\n siteRoot,\n sourceMessage: error.message,\n },\n })\n }\n }\n}\n\nfunction handleErrors(diagnostics: Array<Diagnostic>): void {\n diagnostics.forEach(err => {\n if (err.codeFrames) {\n err.codeFrames.forEach(c => {\n // Assuming that codeHighlights only ever has one entry in the array. Local tests only ever showed one\n const codeHighlightsMessage = c?.codeHighlights[0]?.message\n // If both messages are the same don't print the specific, otherwise they would be duplicate\n const specificMessage =\n codeHighlightsMessage === err.message\n ? undefined\n : codeHighlightsMessage\n reporter.panic({\n id: `11901`,\n context: {\n filePath: c?.filePath,\n generalMessage: err.message,\n specificMessage,\n origin: err?.origin,\n hints: err?.hints,\n },\n })\n })\n } else {\n reporter.panic({\n id: `11901`,\n context: {\n generalMessage: err.message,\n origin: err?.origin,\n hints: err?.hints,\n },\n })\n }\n })\n}\n\nexport function getResolvedFieldsForPlugin(\n rootDir: string,\n pluginName: string\n): {\n resolvedCompiledGatsbyNode?: string\n} {\n return {\n resolvedCompiledGatsbyNode: findCompiledLocalPluginModule(\n rootDir,\n pluginName,\n `gatsby-node`\n ),\n }\n}\n\nexport function findCompiledLocalPluginModule(\n rootDir: string,\n pluginName: string,\n moduleName: \"gatsby-config\" | \"gatsby-node\"\n): string | undefined {\n const compiledPathForPlugin =\n pluginName === `default-site-plugin`\n ? `${rootDir}/${COMPILED_CACHE_DIR}`\n : `${rootDir}/${COMPILED_CACHE_DIR}/plugins/${pluginName}`\n\n const compiledPathForModule = `${compiledPathForPlugin}/${moduleName}.js`\n\n const isCompiled = existsSync(compiledPathForModule)\n if (isCompiled) {\n return compiledPathForModule\n }\n\n return undefined\n}\n"],"mappings":";;;;;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AAEO,MAAMA,kBAAkB,GAAI,iBAA5B;;AACA,MAAMC,gBAAgB,GAAI,sBAA1B;;AACA,MAAMC,eAAe,GAAI,0BAAzB;AAEP;AACA;AACA;AACA;;;;AACO,SAASC,eAAT,CAAyBC,QAAzB,EAAmD;EACxD,OAAO,IAAIC,YAAJ,CAAW;IAChBC,OAAO,EAAE,CACN,GAAEF,QAAS,IAAGF,eAAgB,EADxB,EAEN,GAAEE,QAAS,eAAcF,eAAgB,EAFnC,CADO;IAKhBK,aAAa,EAAEC,OAAO,CAACC,OAAR,CAAiB,sBAAjB,CALC;IAMhBC,IAAI,EAAG,YANS;IAOhBC,OAAO,EAAE;MACPC,IAAI,EAAE;QACJC,YAAY,EAAG,UADX;QAEJC,kBAAkB,EAAE,KAFhB;QAGJC,SAAS,EAAE,KAHP;QAIJC,OAAO,EAAE;UACPC,IAAI,EAAG;QADA,CAJL;QAOJC,OAAO,EAAG,GAAEd,QAAS,IAAGJ,kBAAmB;MAPvC;IADC,CAPO;IAkBhBmB,QAAQ,EAAG,GAAEf,QAAS,IAAGH,gBAAiB;EAlB1B,CAAX,CAAP;AAoBD;AAED;AACA;AACA;AACA;;;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ELC,UAFK,EAGLG,UAHK,EAIe;EACpB,MAAMC,qBAAqB,GACzBJ,UAAU,KAAM,qBAAhB,GACK,GAAED,OAAQ,IAAG5D,kBAAmB,EADrC,GAEK,GAAE4D,OAAQ,IAAG5D,kBAAmB,YAAW6D,UAAW,EAH7D;EAKA,MAAMK,qBAAqB,GAAI,GAAED,qBAAsB,IAAGD,UAAW,KAArE;EAEA,MAAMG,UAAU,GAAG,IAAAC,mBAAA,EAAWF,qBAAX,CAAnB;;EACA,IAAIC,UAAJ,EAAgB;IACd,OAAOD,qBAAP;EACD;;EAED,OAAOX,SAAP;AACD"}
|
|
1
|
+
{"version":3,"file":"compile-gatsby-files.js","names":["COMPILED_CACHE_DIR","PARCEL_CACHE_DIR","gatsbyFileRegex","RETRY_COUNT","getCacheDir","siteRoot","exponentialBackoff","retry","Promise","resolve","timeout","Math","pow","setTimeout","constructParcel","Parcel","entries","defaultConfig","require","mode","targets","root","outputFormat","includeNodeModules","sourceMap","engines","node","distDir","cacheDir","compileGatsbyFiles","ensureDir","emptyDir","parcel","bundleGraph","run","bundles","getBundles","length","compiledTSFilesCount","bundle","cache","filePath","e","reporter","panic","id","context","retries","compiledFileLocation","sourceFileLocation","getMainEntry","verbose","message","remove","mainEntry","endsWith","telemetry","isTrackingEnabled","trackCli","valueInteger","name","error","diagnostics","handleErrors","sourceMessage","forEach","err","codeFrames","c","codeHighlightsMessage","codeHighlights","specificMessage","undefined","generalMessage","origin","hints","getResolvedFieldsForPlugin","rootDir","pluginName","resolvedCompiledGatsbyNode","findCompiledLocalPluginModule","moduleName","compiledPathForPlugin","compiledPathForModule","isCompiled","existsSync"],"sources":["../../../src/utils/parcel/compile-gatsby-files.ts"],"sourcesContent":["import { Parcel } from \"@parcel/core\"\nimport type { Diagnostic } from \"@parcel/diagnostic\"\nimport reporter from \"gatsby-cli/lib/reporter\"\nimport { ensureDir, emptyDir, existsSync, remove } from \"fs-extra\"\nimport telemetry from \"gatsby-telemetry\"\n\nexport const COMPILED_CACHE_DIR = `.cache/compiled`\nexport const PARCEL_CACHE_DIR = `.cache/.parcel-cache`\nexport const gatsbyFileRegex = `gatsby-+(node|config).ts`\nconst RETRY_COUNT = 5\n\nfunction getCacheDir(siteRoot: string): string {\n return `${siteRoot}/${PARCEL_CACHE_DIR}`\n}\n\nfunction exponentialBackoff(retry: number): Promise<void> {\n if (retry === 0) {\n return Promise.resolve()\n }\n const timeout = 50 * Math.pow(2, retry)\n return new Promise(resolve => setTimeout(resolve, timeout))\n}\n\n/**\n * Construct Parcel with config.\n * @see {@link https://parceljs.org/features/targets/}\n */\nexport function constructParcel(siteRoot: string): Parcel {\n return new Parcel({\n entries: [\n `${siteRoot}/${gatsbyFileRegex}`,\n `${siteRoot}/plugins/**/${gatsbyFileRegex}`,\n ],\n defaultConfig: require.resolve(`gatsby-parcel-config`),\n mode: `production`,\n targets: {\n root: {\n outputFormat: `commonjs`,\n includeNodeModules: false,\n sourceMap: false,\n engines: {\n node: `>= 14.15.0`,\n },\n distDir: `${siteRoot}/${COMPILED_CACHE_DIR}`,\n },\n },\n cacheDir: getCacheDir(siteRoot),\n })\n}\n\n/**\n * Compile known gatsby-* files (e.g. `gatsby-config`, `gatsby-node`)\n * and output in `<SITE_ROOT>/.cache/compiled`.\n */\nexport async function compileGatsbyFiles(\n siteRoot: string,\n retry: number = 0\n): Promise<void> {\n try {\n const distDir = `${siteRoot}/${COMPILED_CACHE_DIR}`\n await ensureDir(distDir)\n await emptyDir(distDir)\n\n await exponentialBackoff(retry)\n\n const parcel = constructParcel(siteRoot)\n const { bundleGraph } = await parcel.run()\n\n await exponentialBackoff(retry)\n\n const bundles = bundleGraph.getBundles()\n\n if (bundles.length === 0) return\n\n let compiledTSFilesCount = 0\n for (const bundle of bundles) {\n // validate that output exists and is valid\n try {\n delete require.cache[bundle.filePath]\n require(bundle.filePath)\n } catch (e) {\n if (retry >= RETRY_COUNT) {\n reporter.panic({\n id: `11904`,\n context: {\n siteRoot,\n retries: RETRY_COUNT,\n compiledFileLocation: bundle.filePath,\n sourceFileLocation: bundle.getMainEntry()?.filePath,\n },\n })\n } else if (retry > 0) {\n // first retry is most flaky and it seems it always get in good state\n // after that - most likely cache clearing is the trick that fixes the problem\n reporter.verbose(\n `Failed to import compiled file \"${\n bundle.filePath\n }\" after retry, attempting another retry (#${\n retry + 1\n } of ${RETRY_COUNT}) - \"${e.message}\"`\n )\n }\n\n // sometimes parcel cache gets in weird state\n await remove(getCacheDir(siteRoot))\n\n await compileGatsbyFiles(siteRoot, retry + 1)\n return\n }\n\n const mainEntry = bundle.getMainEntry()?.filePath\n // mainEntry won't exist for shared chunks\n if (mainEntry) {\n if (mainEntry.endsWith(`.ts`)) {\n compiledTSFilesCount = compiledTSFilesCount + 1\n }\n }\n }\n\n if (telemetry.isTrackingEnabled()) {\n telemetry.trackCli(`PARCEL_COMPILATION_END`, {\n valueInteger: compiledTSFilesCount,\n name: `count of compiled ts files`,\n })\n }\n } catch (error) {\n if (error.diagnostics) {\n handleErrors(error.diagnostics)\n } else {\n reporter.panic({\n id: `11903`,\n error,\n context: {\n siteRoot,\n sourceMessage: error.message,\n },\n })\n }\n }\n}\n\nfunction handleErrors(diagnostics: Array<Diagnostic>): void {\n diagnostics.forEach(err => {\n if (err.codeFrames) {\n err.codeFrames.forEach(c => {\n // Assuming that codeHighlights only ever has one entry in the array. Local tests only ever showed one\n const codeHighlightsMessage = c?.codeHighlights[0]?.message\n // If both messages are the same don't print the specific, otherwise they would be duplicate\n const specificMessage =\n codeHighlightsMessage === err.message\n ? undefined\n : codeHighlightsMessage\n reporter.panic({\n id: `11901`,\n context: {\n filePath: c?.filePath,\n generalMessage: err.message,\n specificMessage,\n origin: err?.origin,\n hints: err?.hints,\n },\n })\n })\n } else {\n reporter.panic({\n id: `11901`,\n context: {\n generalMessage: err.message,\n origin: err?.origin,\n hints: err?.hints,\n },\n })\n }\n })\n}\n\nexport function getResolvedFieldsForPlugin(\n rootDir: string,\n pluginName: string\n): {\n resolvedCompiledGatsbyNode?: string\n} {\n return {\n resolvedCompiledGatsbyNode: findCompiledLocalPluginModule(\n rootDir,\n pluginName,\n `gatsby-node`\n ),\n }\n}\n\nexport function findCompiledLocalPluginModule(\n rootDir: string,\n pluginName: string,\n moduleName: \"gatsby-config\" | \"gatsby-node\"\n): string | undefined {\n const compiledPathForPlugin =\n pluginName === `default-site-plugin`\n ? `${rootDir}/${COMPILED_CACHE_DIR}`\n : `${rootDir}/${COMPILED_CACHE_DIR}/plugins/${pluginName}`\n\n const compiledPathForModule = `${compiledPathForPlugin}/${moduleName}.js`\n\n const isCompiled = existsSync(compiledPathForModule)\n if (isCompiled) {\n return compiledPathForModule\n }\n\n return undefined\n}\n"],"mappings":";;;;;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AAEO,MAAMA,kBAAkB,GAAI,iBAA5B;;AACA,MAAMC,gBAAgB,GAAI,sBAA1B;;AACA,MAAMC,eAAe,GAAI,0BAAzB;;AACP,MAAMC,WAAW,GAAG,CAApB;;AAEA,SAASC,WAAT,CAAqBC,QAArB,EAA+C;EAC7C,OAAQ,GAAEA,QAAS,IAAGJ,gBAAiB,EAAvC;AACD;;AAED,SAASK,kBAAT,CAA4BC,KAA5B,EAA0D;EACxD,IAAIA,KAAK,KAAK,CAAd,EAAiB;IACf,OAAOC,OAAO,CAACC,OAAR,EAAP;EACD;;EACD,MAAMC,OAAO,GAAG,KAAKC,IAAI,CAACC,GAAL,CAAS,CAAT,EAAYL,KAAZ,CAArB;EACA,OAAO,IAAIC,OAAJ,CAAYC,OAAO,IAAII,UAAU,CAACJ,OAAD,EAAUC,OAAV,CAAjC,CAAP;AACD;AAED;AACA;AACA;AACA;;;AACO,SAASI,eAAT,CAAyBT,QAAzB,EAAmD;EACxD,OAAO,IAAIU,YAAJ,CAAW;IAChBC,OAAO,EAAE,CACN,GAAEX,QAAS,IAAGH,eAAgB,EADxB,EAEN,GAAEG,QAAS,eAAcH,eAAgB,EAFnC,CADO;IAKhBe,aAAa,EAAEC,OA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0B,EAAEC,6BAA6B,CACvDH,OADuD,EAEvDC,UAFuD,EAGtD,aAHsD;EADpD,CAAP;AAOD;;AAEM,SAASE,6BAAT,CACLH,OADK,EAELC,UAFK,EAGLG,UAHK,EAIe;EACpB,MAAMC,qBAAqB,GACzBJ,UAAU,KAAM,qBAAhB,GACK,GAAED,OAAQ,IAAG7E,kBAAmB,EADrC,GAEK,GAAE6E,OAAQ,IAAG7E,kBAAmB,YAAW8E,UAAW,EAH7D;EAKA,MAAMK,qBAAqB,GAAI,GAAED,qBAAsB,IAAGD,UAAW,KAArE;EAEA,MAAMG,UAAU,GAAG,IAAAC,mBAAA,EAAWF,qBAAX,CAAnB;;EACA,IAAIC,UAAJ,EAAgB;IACd,OAAOD,qBAAP;EACD;;EAED,OAAOX,SAAP;AACD"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gatsby",
|
|
3
3
|
"description": "Blazing fast modern site generator for React",
|
|
4
|
-
"version": "4.17.
|
|
4
|
+
"version": "4.17.1",
|
|
5
5
|
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
|
|
6
6
|
"bin": {
|
|
7
7
|
"gatsby": "./cli.js"
|
|
@@ -88,13 +88,13 @@
|
|
|
88
88
|
"find-cache-dir": "^3.3.2",
|
|
89
89
|
"fs-exists-cached": "1.0.0",
|
|
90
90
|
"fs-extra": "^10.1.0",
|
|
91
|
-
"gatsby-cli": "^4.17.
|
|
91
|
+
"gatsby-cli": "^4.17.1",
|
|
92
92
|
"gatsby-core-utils": "^3.17.0",
|
|
93
93
|
"gatsby-graphiql-explorer": "^2.17.0",
|
|
94
94
|
"gatsby-legacy-polyfills": "^2.17.0",
|
|
95
95
|
"gatsby-link": "^4.17.0",
|
|
96
96
|
"gatsby-page-utils": "^2.17.0",
|
|
97
|
-
"gatsby-parcel-config": "
|
|
97
|
+
"gatsby-parcel-config": "0.8.0",
|
|
98
98
|
"gatsby-plugin-page-creator": "^4.17.0",
|
|
99
99
|
"gatsby-plugin-typescript": "^4.17.0",
|
|
100
100
|
"gatsby-plugin-utils": "^3.11.0",
|
|
@@ -277,5 +277,5 @@
|
|
|
277
277
|
"yargs": {
|
|
278
278
|
"boolean-negation": false
|
|
279
279
|
},
|
|
280
|
-
"gitHead": "
|
|
280
|
+
"gitHead": "680b526156b0b22b6a6cd229612359e59874a526"
|
|
281
281
|
}
|