@netlify/build 18.21.5 → 18.21.6

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.5",
3
+ "version": "18.21.6",
4
4
  "description": "Netlify build module",
5
5
  "main": "src/core/main.js",
6
6
  "types": "types/index.d.ts",
package/types/index.d.ts CHANGED
@@ -1 +1,6 @@
1
1
  export { NetlifyPlugin } from './netlify_plugin'
2
+ export { NetlifyPluginOptions } from './netlify_plugin_options'
3
+ export { OnBuild, OnEnd, OnError, OnPostBuild, OnPreBuild, OnSuccess } from './netlify_event_handler'
4
+ export { NetlifyConfig } from './config/netlify_config'
5
+ export { NetlifyPluginUtils } from './options'
6
+ export { NetlifyPluginConstants } from './netlify_plugin_constants'
@@ -0,0 +1,19 @@
1
+ import { PluginInputs } from './config/inputs'
2
+ import { NetlifyPluginOptions } from './netlify_plugin_options'
3
+
4
+ interface NetlifyEventHandler<PluginOptions extends NetlifyPluginOptions = NetlifyPluginOptions> {
5
+ (options: PluginOptions): void | Promise<void>
6
+ }
7
+
8
+ export type OnPreBuild<TInputs extends PluginInputs = PluginInputs> = NetlifyEventHandler<NetlifyPluginOptions<TInputs>>
9
+ export type OnBuild<TInputs extends PluginInputs = PluginInputs> = NetlifyEventHandler<NetlifyPluginOptions<TInputs>>
10
+ export type OnPostBuild<TInputs extends PluginInputs = PluginInputs> = NetlifyEventHandler<
11
+ NetlifyPluginOptions<TInputs>
12
+ >
13
+ export type OnError<TInputs extends PluginInputs = PluginInputs> = NetlifyEventHandler<
14
+ NetlifyPluginOptions<TInputs> & { error: Error }
15
+ >
16
+ export type OnSuccess<TInputs extends PluginInputs = PluginInputs> = NetlifyEventHandler<NetlifyPluginOptions<TInputs>>
17
+ export type OnEnd<TInputs extends PluginInputs = PluginInputs> = NetlifyEventHandler<
18
+ NetlifyPluginOptions<TInputs> & { error?: Error }
19
+ >
@@ -1,30 +1,29 @@
1
1
  import { PluginInputs } from './config/inputs'
2
- import { NetlifyEvent } from './netlify_event'
3
- import { NetlifyPluginOptions } from './netlify_plugin_options'
2
+ import { OnBuild, OnEnd, OnError, OnPostBuild, OnPreBuild, OnSuccess } from './netlify_event_handler'
4
3
 
5
4
  export interface NetlifyPlugin<TInputs extends PluginInputs = PluginInputs> {
6
5
  /**
7
6
  * Runs before the build command is executed.
8
7
  */
9
- onPreBuild?: NetlifyEvent<NetlifyPluginOptions<TInputs>>
8
+ onPreBuild?: OnPreBuild<TInputs>
10
9
  /**
11
10
  * runs directly after the build command is executed and before Functions? bundling and Edge Handlers bundling.
12
11
  */
13
- onBuild?: NetlifyEvent<NetlifyPluginOptions<TInputs>>
12
+ onBuild?: OnBuild<TInputs>
14
13
  /**
15
14
  * runs after the build command completes; after onBuild? tasks, Functions? bundling, and Edge Handlers bundling are executed; and before the deploy stage. Can be used to prevent a build from being deployed.
16
15
  */
17
- onPostBuild?: NetlifyEvent<NetlifyPluginOptions<TInputs>>
16
+ onPostBuild?: OnPostBuild<TInputs>
18
17
  /**
19
18
  * runs when an error occurs in the build or deploy stage, failing the build. Can’t be used to prevent a build from being deployed.
20
19
  */
21
- onError?: NetlifyEvent<NetlifyPluginOptions<TInputs> & { error: Error }>
20
+ onError?: OnError<TInputs>
22
21
  /**
23
22
  * runs when the deploy succeeds. Can’t be used to prevent a build from being deployed.
24
23
  */
25
- onSuccess?: NetlifyEvent<NetlifyPluginOptions<TInputs>>
24
+ onSuccess?: OnSuccess<TInputs>
26
25
  /**
27
26
  * runs after completion of the deploy stage, regardless of build error or success; is useful for resources cleanup. Can’t be used to prevent a build from being deployed.
28
27
  */
29
- onEnd?: NetlifyEvent<NetlifyPluginOptions<TInputs> & { error?: Error }>
28
+ onEnd?: OnEnd<TInputs>
30
29
  }
@@ -0,0 +1,42 @@
1
+ export interface NetlifyPluginConstants {
2
+ /**
3
+ * path to the Netlify configuration file.
4
+ * `undefined` if none was used.
5
+ */
6
+ CONFIG_PATH?: string
7
+ /**
8
+ * directory that contains the deploy-ready HTML files and assets generated by the build. Its value is always defined, but the target might not have been created yet.
9
+ */
10
+ PUBLISH_DIR: string
11
+ /**
12
+ * the directory where function source code lives.
13
+ * `undefined` if no `netlify/functions` directory exists in the base directory and if not specified by the user.
14
+ */
15
+ FUNCTIONS_SRC?: string
16
+ /**
17
+ * the directory where internal function source code lives. This is where build plugins should place auto-generated functions.
18
+ * `undefined` if the version of @netlify/build does not support internal functions
19
+ */
20
+ INTERNAL_FUNCTIONS_SRC?: string
21
+ /**
22
+ * the directory where built serverless functions are placed before deployment. Its value is always defined, but the target might not have been created yet.
23
+ */
24
+ FUNCTIONS_DIST: string
25
+ /**
26
+ * the directory where Edge Handlers source code lives.
27
+ * `undefined` if no `netlify/edge-handlers` directory exists in the base directory and if not specified in `netlify.toml`.
28
+ */
29
+ EDGE_HANDLERS_SRC?: string
30
+ /**
31
+ * boolean indicating whether the build was [run locally](https://docs.netlify.com/cli/get-started/#run-builds-locally) or on Netlify
32
+ */
33
+ IS_LOCAL: boolean
34
+ /**
35
+ * version of Netlify Build as a `major.minor.patch` string
36
+ */
37
+ NETLIFY_BUILD_VERSION: string
38
+ /**
39
+ * the Netlify site ID
40
+ */
41
+ SITE_ID: string
42
+ }
@@ -1,51 +1,10 @@
1
1
  import { PluginInputs } from './config/inputs'
2
2
  import { NetlifyConfig } from './config/netlify_config'
3
+ import { NetlifyPluginConstants } from './netlify_plugin_constants'
3
4
  import { NetlifyPluginUtils } from './options/netlify_plugin_utils'
4
5
  import { JSONValue } from './utils/json_value'
5
6
 
6
7
  export interface NetlifyPluginOptions<TInputs extends PluginInputs = PluginInputs> {
7
- constants: {
8
- /**
9
- * path to the Netlify configuration file.
10
- * `undefined` if none was used.
11
- */
12
- CONFIG_PATH?: string
13
- /**
14
- * directory that contains the deploy-ready HTML files and assets generated by the build. Its value is always defined, but the target might not have been created yet.
15
- */
16
- PUBLISH_DIR: string
17
- /**
18
- * the directory where function source code lives.
19
- * `undefined` if no `netlify/functions` directory exists in the base directory and if not specified by the user.
20
- */
21
- FUNCTIONS_SRC?: string
22
- /**
23
- * the directory where internal function source code lives. This is where build plugins should place auto-generated functions.
24
- * `undefined` if the version of @netlify/build does not support internal functions
25
- */
26
- INTERNAL_FUNCTIONS_SRC?: string
27
- /**
28
- * the directory where built serverless functions are placed before deployment. Its value is always defined, but the target might not have been created yet.
29
- */
30
- FUNCTIONS_DIST: string
31
- /**
32
- * the directory where Edge Handlers source code lives.
33
- * `undefined` if no `netlify/edge-handlers` directory exists in the base directory and if not specified in `netlify.toml`.
34
- */
35
- EDGE_HANDLERS_SRC?: string
36
- /**
37
- * boolean indicating whether the build was [run locally](https://docs.netlify.com/cli/get-started/#run-builds-locally) or on Netlify
38
- */
39
- IS_LOCAL: boolean
40
- /**
41
- * version of Netlify Build as a `major.minor.patch` string
42
- */
43
- NETLIFY_BUILD_VERSION: string
44
- /**
45
- * the Netlify site ID
46
- */
47
- SITE_ID: string
48
- }
49
8
  /**
50
9
  * If your plugin requires additional values from the user, you can specify these requirements in an `inputs` array in the plugin’s [`manifest.yml` file](https://docs.netlify.com/configure-builds/build-plugins/create-plugins/#anatomy-of-a-plugin).
51
10
  */
@@ -59,5 +18,6 @@ export interface NetlifyPluginOptions<TInputs extends PluginInputs = PluginInput
59
18
  * The data fields are normalized to prevent plugin errors. If the site has no `package.json`, the argument is an empty object.
60
19
  */
61
20
  packageJson: Partial<Record<string, JSONValue>>
21
+ constants: NetlifyPluginConstants
62
22
  utils: NetlifyPluginUtils
63
23
  }
@@ -1 +1 @@
1
- export * from './netlify_plugin_utils'
1
+ export { NetlifyPluginUtils } from './netlify_plugin_utils'
@@ -1,5 +0,0 @@
1
- import { NetlifyPluginOptions } from './netlify_plugin_options'
2
-
3
- export interface NetlifyEvent<PluginOptions extends NetlifyPluginOptions = NetlifyPluginOptions> {
4
- (options: PluginOptions): void | Promise<void>
5
- }