1
1
// https://www.netlify.com/docs/headers-and-basic-auth/
2
-
3
- import { promises as fs } from 'fs'
4
2
import { join } from 'path'
5
3
4
+ import { writeFile } from 'fs-extra'
6
5
import { generatePageDataPath } from 'gatsby-core-utils'
7
6
import WebpackAssetsManifest from 'webpack-assets-manifest'
8
7
@@ -14,9 +13,7 @@ import makePluginData from './plugin-data'
14
13
const assetsManifest = { }
15
14
16
15
/** @type {import("gatsby").GatsbyNode["pluginOptionsSchema"] } */
17
- export const pluginOptionsSchema = ( {
18
- Joi
19
- } : any ) => {
16
+ export const pluginOptionsSchema = ( { Joi } : any ) => {
20
17
const MATCH_ALL_KEYS = / ^ /
21
18
22
19
// headers is a specific type used by Netlify: https://www.gatsbyjs.com/plugins/gatsby-plugin-netlify/#headers
@@ -44,10 +41,7 @@ export const pluginOptionsSchema = ({
44
41
// Inject a webpack plugin to get the file manifests so we can translate all link headers
45
42
/** @type {import("gatsby").GatsbyNode["onCreateWebpackConfig"] } */
46
43
47
- export const onCreateWebpackConfig = ( {
48
- actions,
49
- stage
50
- } : any ) => {
44
+ export const onCreateWebpackConfig = ( { actions, stage } : any ) => {
51
45
if ( stage !== BUILD_HTML_STAGE && stage !== BUILD_CSS_STAGE ) {
52
46
return
53
47
}
@@ -63,11 +57,7 @@ export const onCreateWebpackConfig = ({
63
57
}
64
58
65
59
/** @type {import("gatsby").GatsbyNode["onPostBuild"] } */
66
- export const onPostBuild = async ( {
67
- store,
68
- pathPrefix,
69
- reporter
70
- } : any , userPluginOptions : any ) => {
60
+ export const onPostBuild = async ( { store, pathPrefix, reporter } : any , userPluginOptions : any ) => {
71
61
const pluginData = makePluginData ( store , assetsManifest , pathPrefix )
72
62
const pluginOptions = { ...DEFAULT_OPTIONS , ...userPluginOptions }
73
63
@@ -113,7 +103,7 @@ export const onPostBuild = async ({
113
103
114
104
if ( ! needsFunctions ) {
115
105
reporter . info ( `[gatsby-plugin-netlify] No Netlify functions needed. Skipping...` )
116
- await fs . writeFile ( join ( program . directory , `.cache` , `.nf-skip-gatsby-functions` ) , `` )
106
+ await writeFile ( join ( program . directory , `.cache` , `.nf-skip-gatsby-functions` ) , `` )
117
107
}
118
108
119
109
await Promise . all ( [
0 commit comments