@netlify/build 26.1.0 → 26.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/build",
3
- "version": "26.1.0",
3
+ "version": "26.1.1",
4
4
  "description": "Netlify build module",
5
5
  "type": "module",
6
6
  "exports": "./src/core/main.js",
@@ -60,8 +60,8 @@
60
60
  "@netlify/config": "^17.0.0",
61
61
  "@netlify/functions-utils": "^4.0.0",
62
62
  "@netlify/git-utils": "^4.0.0",
63
- "@netlify/plugin-edge-handlers": "^3.0.0",
64
- "@netlify/plugins-list": "^6.2.0",
63
+ "@netlify/plugin-edge-handlers": "^3.0.2",
64
+ "@netlify/plugins-list": "^6.2.1",
65
65
  "@netlify/run-utils": "^4.0.0",
66
66
  "@netlify/zip-it-and-ship-it": "^5.4.0",
67
67
  "@sindresorhus/slugify": "^1.1.0",
@@ -78,7 +78,6 @@
78
78
  "keep-func-props": "^3.0.0",
79
79
  "locate-path": "^6.0.0",
80
80
  "log-process-errors": "^6.0.0",
81
- "make-dir": "^3.0.2",
82
81
  "map-obj": "^4.0.0",
83
82
  "memoize-one": "^6.0.0",
84
83
  "os-name": "^4.0.1",
@@ -51,7 +51,7 @@ const isCancelCrash = async function (error) {
51
51
  const cwd = getCwd()
52
52
  return !(await pathExists(cwd))
53
53
  // `process.cwd()` fails when the current directory does not exist
54
- } catch (error_) {
54
+ } catch {
55
55
  return true
56
56
  }
57
57
  }
@@ -102,7 +102,7 @@ const reportError = async function ({ errorMonitor, error, logs, testOpts, event
102
102
  try {
103
103
  await promisify(errorMonitor.notify)(error, (event) => onError(event, eventProps))
104
104
  // Failsafe
105
- } catch (error_) {
105
+ } catch {
106
106
  log(logs, `Error monitor could not notify\n${error.stack}`)
107
107
  }
108
108
  }
@@ -51,7 +51,7 @@ const cleanStackLine = function (lines, line) {
51
51
  const getCwd = function () {
52
52
  try {
53
53
  return cwd()
54
- } catch (error) {
54
+ } catch {
55
55
  return ''
56
56
  }
57
57
  }
@@ -1,8 +1,6 @@
1
- import { writeFile, unlink } from 'fs'
1
+ import { promises as fs } from 'fs'
2
2
  import { normalize } from 'path'
3
- import { promisify } from 'util'
4
3
 
5
- import makeDir from 'make-dir'
6
4
  import pathExists from 'path-exists'
7
5
  import { isFile } from 'path-type'
8
6
 
@@ -10,9 +8,6 @@ import { logInstallMissingPlugins } from '../log/messages/install.js'
10
8
 
11
9
  import { addExactDependencies } from './main.js'
12
10
 
13
- const pWriteFile = promisify(writeFile)
14
- const pUnlink = promisify(unlink)
15
-
16
11
  // Automatically install plugins if not already installed.
17
12
  // Since this is done under the hood, we always use `npm` with specific `npm`
18
13
  // options. We do not allow configure the package manager nor its options.
@@ -45,10 +40,10 @@ const ensureDir = async function (logs, autoPluginsDir) {
45
40
  // If `.netlify` exists but is not a directory, we remove it first
46
41
  const autoPluginsParent = normalize(`${autoPluginsDir}/..`)
47
42
  if (await isFile(autoPluginsParent)) {
48
- await pUnlink(autoPluginsParent)
43
+ await fs.unlink(autoPluginsParent)
49
44
  }
50
45
 
51
- await makeDir(autoPluginsDir)
46
+ await fs.mkdir(autoPluginsDir, { recursive: true })
52
47
  }
53
48
 
54
49
  // Create a dummy `package.json` so we can run `npm install` and get a lock file
@@ -59,7 +54,7 @@ const createPackageJson = async function (autoPluginsDir) {
59
54
  }
60
55
 
61
56
  const packageJsonContent = JSON.stringify(AUTO_PLUGINS_PACKAGE_JSON, null, 2)
62
- await pWriteFile(packageJsonPath, packageJsonContent)
57
+ await fs.writeFile(packageJsonPath, packageJsonContent)
63
58
  }
64
59
 
65
60
  const AUTO_PLUGINS_PACKAGE_JSON = {
package/src/log/logger.js CHANGED
@@ -45,7 +45,7 @@ const serializeIndentedArray = function (array) {
45
45
  }
46
46
 
47
47
  const serializeIndentedItem = function (item) {
48
- return indentString(item, INDENT_SIZE + 1).trimLeft()
48
+ return indentString(item, INDENT_SIZE + 1).trimStart()
49
49
  }
50
50
 
51
51
  export const logError = function (logs, string, opts) {
@@ -21,7 +21,7 @@ export const logBundleResults = ({ logs, results = [] }) => {
21
21
  ({ bundler, bundlerWarnings }) => bundler === 'esbuild' && bundlerWarnings && bundlerWarnings.length !== 0,
22
22
  )
23
23
  const modulesWithDynamicImports = [
24
- ...new Set(results.map((result) => result.nodeModulesWithDynamicImports || []).flat()),
24
+ ...new Set(results.flatMap((result) => result.nodeModulesWithDynamicImports || [])),
25
25
  ]
26
26
 
27
27
  if (resultsWithErrors.length !== 0) {
@@ -1,12 +1,10 @@
1
- import { readFile } from 'fs'
2
- import { inspect, promisify } from 'util'
1
+ import { promises as fs } from 'fs'
2
+ import { inspect } from 'util'
3
3
 
4
4
  import pathExists from 'path-exists'
5
5
 
6
6
  import { log, logMessage, logSubHeader } from '../logger.js'
7
7
 
8
- const pReadFile = promisify(readFile)
9
-
10
8
  export const logConfigMutations = function (logs, newConfigMutations, debug) {
11
9
  const configMutationsToLog = debug ? newConfigMutations : newConfigMutations.filter(shouldLogConfigMutation)
12
10
  configMutationsToLog.forEach(({ keysString, value }) => {
@@ -47,7 +45,7 @@ export const logConfigOnUpload = async function ({ logs, configPath, debug }) {
47
45
  return
48
46
  }
49
47
 
50
- const configContents = await pReadFile(configPath, 'utf8')
48
+ const configContents = await fs.readFile(configPath, 'utf8')
51
49
  logMessage(logs, configContents.trim())
52
50
  }
53
51
 
@@ -63,7 +61,7 @@ export const logHeadersOnUpload = async function ({ logs, headersPath, debug })
63
61
  return
64
62
  }
65
63
 
66
- const headersContents = await pReadFile(headersPath, 'utf8')
64
+ const headersContents = await fs.readFile(headersPath, 'utf8')
67
65
  logMessage(logs, headersContents.trim())
68
66
  }
69
67
 
@@ -79,6 +77,6 @@ export const logRedirectsOnUpload = async function ({ logs, redirectsPath, debug
79
77
  return
80
78
  }
81
79
 
82
- const redirectsContents = await pReadFile(redirectsPath, 'utf8')
80
+ const redirectsContents = await fs.readFile(redirectsPath, 'utf8')
83
81
  logMessage(logs, `${redirectsContents.trim()}\n`)
84
82
  }
@@ -1,7 +1,7 @@
1
1
  import { dump } from 'js-yaml'
2
2
 
3
3
  export const serializeObject = function (object) {
4
- return dump(object, { noRefs: true, sortKeys: true, lineWidth: Number.POSITIVE_INFINITY }).trimRight()
4
+ return dump(object, { noRefs: true, sortKeys: true, lineWidth: Number.POSITIVE_INFINITY }).trimEnd()
5
5
  }
6
6
 
7
7
  export const serializeArray = function (array) {
package/src/log/stream.js CHANGED
@@ -76,7 +76,7 @@ const pushOutputToLogs = function (childProcess, logs) {
76
76
  }
77
77
 
78
78
  const logsListener = function (logs, chunk) {
79
- logs.push(chunk.toString().trimRight())
79
+ logs.push(chunk.toString().trimEnd())
80
80
  }
81
81
 
82
82
  const unpushOutputToLogs = function (childProcess, logs, { stdoutListener, stderrListener }) {
@@ -109,7 +109,7 @@ const siteDependencyTest = async function ({ dependencyName, allowedVersion, sit
109
109
  const packageJsonPath = await resolvePath(`${dependencyName}/package.json`, buildDir)
110
110
  const { version } = await importJsonFile(packageJsonPath)
111
111
  return semver.satisfies(version, allowedVersion)
112
- } catch (error) {
112
+ } catch {
113
113
  return false
114
114
  }
115
115
  }
@@ -1,5 +1,4 @@
1
- import { readFile } from 'fs'
2
- import { promisify } from 'util'
1
+ import { promises as fs } from 'fs'
3
2
 
4
3
  import { load as loadYaml, JSON_SCHEMA } from 'js-yaml'
5
4
 
@@ -7,8 +6,6 @@ import { addErrorInfo } from '../../error/info.js'
7
6
 
8
7
  import { validateManifest } from './validate.js'
9
8
 
10
- const pReadFile = promisify(readFile)
11
-
12
9
  // Load "manifest.yml" using its file path
13
10
  export const loadManifest = async function ({ manifestPath, packageName, pluginPackageJson, loadedFrom, origin }) {
14
11
  try {
@@ -28,7 +25,7 @@ export const loadManifest = async function ({ manifestPath, packageName, pluginP
28
25
 
29
26
  const loadRawManifest = async function (manifestPath) {
30
27
  try {
31
- return await pReadFile(manifestPath, 'utf8')
28
+ return await fs.readFile(manifestPath, 'utf8')
32
29
  } catch (error) {
33
30
  error.message = `Could not load plugin's "manifest.yml"\n${error.message}`
34
31
  throw error
package/src/utils/json.js CHANGED
@@ -6,7 +6,7 @@ const ROOT_PACKAGE_JSON_PATH = fileURLToPath(new URL('../../package.json', impor
6
6
  // TODO: Replace with dynamic `import()` once it is supported without
7
7
  // experimental flags
8
8
  export const importJsonFile = async function (filePath) {
9
- const fileContents = await fs.readFile(filePath, 'utf8')
9
+ const fileContents = await fs.readFile(filePath)
10
10
  return JSON.parse(fileContents)
11
11
  }
12
12
 
@@ -19,5 +19,5 @@ const getPackageObj = async function ({ cwd, normalize = true }) {
19
19
  return await readPkgUp({ cwd, normalize })
20
20
  // If the `package.json` is invalid and `normalize` is `true`, an error is
21
21
  // thrown. We return `undefined` then.
22
- } catch (error) {}
22
+ } catch {}
23
23
  }
@@ -23,7 +23,7 @@ export const resolvePath = async function (path, basedir) {
23
23
  // Fallback.
24
24
  // `resolve` sometimes gives unhelpful error messages.
25
25
  // https://github.com/browserify/resolve/issues/223
26
- } catch (error) {
26
+ } catch {
27
27
  return require.resolve(path, { paths: [basedir] })
28
28
  }
29
29
  }