@netlify/build 18.21.1 → 18.21.5

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": "18.21.1",
3
+ "version": "18.21.5",
4
4
  "description": "Netlify build module",
5
5
  "main": "src/core/main.js",
6
6
  "types": "types/index.d.ts",
@@ -61,7 +61,7 @@
61
61
  "@netlify/plugin-edge-handlers": "^1.11.22",
62
62
  "@netlify/plugins-list": "^4.1.0",
63
63
  "@netlify/run-utils": "^2.0.0",
64
- "@netlify/zip-it-and-ship-it": "^4.28.2",
64
+ "@netlify/zip-it-and-ship-it": "^4.29.0",
65
65
  "@sindresorhus/slugify": "^1.1.0",
66
66
  "@ungap/from-entries": "^0.2.1",
67
67
  "ansi-escapes": "^4.3.2",
@@ -1,16 +1,26 @@
1
1
  'use strict'
2
2
 
3
- // Ensure error is an `Error` instance
3
+ // Ensure error is an `Error` instance.
4
+ // If is an `Error` instance but is missing usual `Error` properties, we make
5
+ // sure its static properties are preserved.
4
6
  const normalizeError = function (error) {
5
7
  if (Array.isArray(error)) {
6
8
  return normalizeArray(error)
7
9
  }
8
10
 
9
- if (error instanceof Error && typeof error.message === 'string' && typeof error.stack === 'string') {
10
- return error
11
+ if (!(error instanceof Error)) {
12
+ return new Error(String(error))
11
13
  }
12
14
 
13
- return new Error(String(error))
15
+ if (typeof error.message !== 'string') {
16
+ error.message = String(error)
17
+ }
18
+
19
+ if (typeof error.stack !== 'string') {
20
+ Error.captureStackTrace(error, normalizeError)
21
+ }
22
+
23
+ return error
14
24
  }
15
25
 
16
26
  // Some libraries throw arrays of Errors
@@ -3,36 +3,34 @@ type GlobPattern = string
3
3
  /* eslint-disable camelcase -- some properties are named in snake case in this API */
4
4
  type FunctionsObject = {
5
5
  /**
6
- * string that includes the path to a site's [functions directory](https://docs.netlify.com/functions/configure-and-deploy/#configure-the-functions-folder)
6
+ * a list of additional paths to include in the function bundle. Although our build system includes statically referenced files (like `require("./some-file.js")`) by default, `included_files` lets you specify additional files or directories and reference them dynamically in function code. You can use `*` to match any character or prefix an entry with `!` to exclude files. Paths are relative to the [base directory](https://docs.netlify.com/configure-builds/get-started/#definitions-1).
7
7
  */
8
- directory: string
8
+ included_files?: string[]
9
9
  } & (
10
10
  | {
11
11
  /**
12
12
  * the function bundling method used in [`@netlify/zip-it-and-ship-it`](https://github.com/netlify/zip-it-and-ship-it).
13
13
  */
14
- node_bundler: 'zisi'
14
+ node_bundler?: 'zisi' | 'nft'
15
15
  }
16
16
  | {
17
17
  /**
18
18
  * the function bundling method used in [`@netlify/zip-it-and-ship-it`](https://github.com/netlify/zip-it-and-ship-it).
19
19
  */
20
- node_bundler: 'esbuild'
20
+ node_bundler?: 'esbuild'
21
21
 
22
22
  /**
23
23
  * a list of Node.js modules that are copied to the bundled artifact without adjusting their source or references during the bundling process.
24
24
  * This property helps handle dependencies that can’t be inlined, such as modules with native add-ons.
25
25
  */
26
- external_node_modules: string[]
26
+ external_node_modules?: string[]
27
27
 
28
- /**
29
- * a list of additional paths to include in the function bundle. Although our build system includes statically referenced files (like `require("./some-file.js")`) by default, `included_files` lets you specify additional files or directories and reference them dynamically in function code. You can use `*` to match any character or prefix an entry with `!` to exclude files. Paths are relative to the [base directory](https://docs.netlify.com/configure-builds/get-started/#definitions-1).
30
- */
31
- included_files: string[]
32
-
33
- ignored_node_modules: string[]
28
+ ignored_node_modules?: string[]
34
29
  }
35
30
  )
36
31
  /* eslint-enable camelcase */
37
32
 
38
- export type Functions = Record<GlobPattern, FunctionsObject>
33
+ export type Functions = {
34
+ '*': FunctionsObject
35
+ [pattern: GlobPattern]: FunctionsObject
36
+ }
@@ -3,5 +3,5 @@
3
3
  */
4
4
  export type NetlifyPluginBuildUtil = Record<
5
5
  'failBuild' | 'failPlugin' | 'cancelBuild',
6
- (message: string, options?: { error?: Error }) => void
6
+ (message: string, options?: { error?: Error }) => never
7
7
  >