@netlify/build 29.30.0 → 29.31.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/lib/core/constants.d.ts +93 -4
- package/lib/core/constants.js +5 -4
- package/lib/core/types.d.ts +1 -1
- package/lib/index.d.ts +7 -1
- package/lib/plugins/child/systemLog.d.ts +1 -1
- package/lib/plugins/child/systemLog.js +4 -2
- package/lib/plugins_core/blobs_upload/index.d.ts +2 -26
- package/lib/plugins_core/blobs_upload/index.js +10 -6
- package/lib/plugins_core/pre_cleanup/index.d.ts +2 -18
- package/lib/plugins_core/pre_cleanup/index.js +3 -5
- package/lib/plugins_core/pre_dev_cleanup/index.d.ts +2 -14
- package/lib/plugins_core/pre_dev_cleanup/index.js +5 -5
- package/lib/plugins_core/secrets_scanning/index.d.ts +2 -16
- package/lib/plugins_core/secrets_scanning/index.js +2 -2
- package/lib/plugins_core/types.d.ts +40 -0
- package/lib/plugins_core/types.js +1 -0
- package/lib/steps/get.d.ts +4 -4
- package/lib/types/config/build.d.ts +45 -0
- package/lib/types/config/build.js +1 -0
- package/lib/types/config/functions.d.ts +30 -0
- package/lib/types/config/functions.js +1 -0
- package/lib/types/config/inputs.d.ts +3 -0
- package/lib/types/config/inputs.js +1 -0
- package/lib/types/config/netlify_config.d.ts +55 -0
- package/lib/types/config/netlify_config.js +1 -0
- package/lib/types/netlify_event_handler.d.ts +16 -0
- package/lib/types/netlify_event_handler.js +1 -0
- package/lib/types/netlify_plugin.d.ts +28 -0
- package/lib/types/netlify_plugin.js +1 -0
- package/lib/types/netlify_plugin_options.d.ts +24 -0
- package/lib/types/netlify_plugin_options.js +1 -0
- package/lib/types/options/netlify_plugin_build_util.d.ts +6 -0
- package/lib/types/options/netlify_plugin_build_util.js +1 -0
- package/lib/types/options/netlify_plugin_cache_util.d.ts +29 -0
- package/lib/types/options/netlify_plugin_cache_util.js +1 -0
- package/lib/types/options/netlify_plugin_functions_util.d.ts +28 -0
- package/lib/types/options/netlify_plugin_functions_util.js +1 -0
- package/lib/types/options/netlify_plugin_git_util.d.ts +41 -0
- package/lib/types/options/netlify_plugin_git_util.js +1 -0
- package/lib/types/options/netlify_plugin_run_util.d.ts +17 -0
- package/lib/types/options/netlify_plugin_run_util.js +1 -0
- package/lib/types/options/netlify_plugin_status_util.d.ts +24 -0
- package/lib/types/options/netlify_plugin_status_util.js +1 -0
- package/{types → lib/types}/options/netlify_plugin_utils.d.ts +12 -13
- package/lib/types/options/netlify_plugin_utils.js +1 -0
- package/lib/types/utils/json_value.d.ts +3 -0
- package/lib/types/utils/json_value.js +1 -0
- package/{types → lib/types}/utils/many.d.ts +5 -5
- package/lib/types/utils/many.js +1 -0
- package/lib/utils/blobs.d.ts +9 -8
- package/lib/utils/blobs.js +11 -6
- package/package.json +5 -5
- package/types/config/build.d.ts +0 -52
- package/types/config/functions.d.ts +0 -36
- package/types/config/inputs.d.ts +0 -7
- package/types/config/netlify_config.d.ts +0 -66
- package/types/index.d.ts +0 -7
- package/types/netlify_event_handler.d.ts +0 -29
- package/types/netlify_plugin.d.ts +0 -29
- package/types/netlify_plugin_constants.d.ts +0 -66
- package/types/netlify_plugin_options.d.ts +0 -25
- package/types/options/netlify_plugin_build_util.d.ts +0 -7
- package/types/options/netlify_plugin_cache_util.d.ts +0 -39
- package/types/options/netlify_plugin_functions_util.d.ts +0 -32
- package/types/options/netlify_plugin_git_util.d.ts +0 -41
- package/types/options/netlify_plugin_run_util.d.ts +0 -24
- package/types/options/netlify_plugin_status_util.d.ts +0 -24
- package/types/utils/json_value.d.ts +0 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { NetlifyPluginConstants } from '../core/constants.js';
|
|
2
|
+
import type { PluginInputs, StringKeys } from './config/inputs.js';
|
|
3
|
+
import type { NetlifyConfig } from './config/netlify_config.js';
|
|
4
|
+
import type { NetlifyPluginUtils } from './options/netlify_plugin_utils.js';
|
|
5
|
+
import type { JSONValue } from './utils/json_value.js';
|
|
6
|
+
export interface NetlifyPluginOptions<TInputs extends PluginInputs<StringKeys<TInputs>> = PluginInputs> {
|
|
7
|
+
/**
|
|
8
|
+
* 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).
|
|
9
|
+
*/
|
|
10
|
+
inputs: TInputs;
|
|
11
|
+
/**
|
|
12
|
+
* @see https://docs.netlify.com/configure-builds/build-plugins/create-plugins/#netlifyconfig
|
|
13
|
+
*/
|
|
14
|
+
netlifyConfig: NetlifyConfig;
|
|
15
|
+
/**
|
|
16
|
+
* When an event handler executes, the contents of the `package.json` in a site's base directory get passed to a plugin.
|
|
17
|
+
* The data fields are normalized to prevent plugin errors. If the site has no `package.json`, the argument is an empty object.
|
|
18
|
+
*/
|
|
19
|
+
packageJson: Partial<Record<string, JSONValue>>;
|
|
20
|
+
constants: NetlifyPluginConstants;
|
|
21
|
+
utils: NetlifyPluginUtils;
|
|
22
|
+
featureFlags?: Record<string, unknown>;
|
|
23
|
+
systemLog?(message: string): void;
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Many } from '../utils/many.js';
|
|
2
|
+
/**
|
|
3
|
+
* Cache files between builds
|
|
4
|
+
*/
|
|
5
|
+
export type NetlifyPluginCacheUtil = {
|
|
6
|
+
save(path: Many<string>, options?: {
|
|
7
|
+
ttl?: number;
|
|
8
|
+
digests?: string[];
|
|
9
|
+
/**
|
|
10
|
+
* @default `process.cwd()`
|
|
11
|
+
*/
|
|
12
|
+
cwd?: string;
|
|
13
|
+
}): Promise<boolean>;
|
|
14
|
+
list(options?: {
|
|
15
|
+
/**
|
|
16
|
+
* @default `process.cwd()`
|
|
17
|
+
*/
|
|
18
|
+
cwd?: string;
|
|
19
|
+
/**
|
|
20
|
+
* @default 1
|
|
21
|
+
*/
|
|
22
|
+
depth?: number;
|
|
23
|
+
}): Promise<string[]>;
|
|
24
|
+
} & Record<'restore' | 'remove' | 'has', (path: Many<string>, options?: {
|
|
25
|
+
/**
|
|
26
|
+
* @default `process.cwd()`
|
|
27
|
+
*/
|
|
28
|
+
cwd?: string;
|
|
29
|
+
}) => Promise<boolean>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { listFunctions, listFunctionsFiles } from '@netlify/zip-it-and-ship-it';
|
|
2
|
+
type Resolved<T> = T extends Promise<infer U> ? U : T;
|
|
3
|
+
export type ListedFunction = Resolved<ReturnType<typeof listFunctions>>[0];
|
|
4
|
+
export type ListedFunctionFile = Resolved<ReturnType<typeof listFunctionsFiles>>[0];
|
|
5
|
+
export interface NetlifyPluginFunctionsUtil {
|
|
6
|
+
/**
|
|
7
|
+
* Returns the list of Netlify Functions main files as a Promise resolving to an array of objects with the following properties:
|
|
8
|
+
*
|
|
9
|
+
* - `name`: Function name, as used in the URL `https://{hostname}/.netlify/functions/{name}`
|
|
10
|
+
* - `mainFile`: absolute path to the Function's main file
|
|
11
|
+
* - `extension`: file extension of the Function's main file. For Go Functions, this might be an empty string. For Node.js Functions, this is either `.js` or `.zip`.
|
|
12
|
+
* - `runtime` `"js" | "go"`: Function's language runtime. TypeScript Functions use the "js" runtime
|
|
13
|
+
*/
|
|
14
|
+
list(): Promise<Array<ListedFunction>>;
|
|
15
|
+
/**
|
|
16
|
+
* Same as `list()` except it also returns the files required by the Functions' main files. This is much slower. The object have the following additional member:
|
|
17
|
+
*
|
|
18
|
+
* - `srcFile`: absolute path to the file
|
|
19
|
+
*/
|
|
20
|
+
listAll(): Promise<Array<ListedFunctionFile>>;
|
|
21
|
+
/**
|
|
22
|
+
* Add a Functions file or directory to a build.
|
|
23
|
+
*
|
|
24
|
+
* @param path Path to the function file or directory.
|
|
25
|
+
*/
|
|
26
|
+
add(path: string): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrieve Git-related information such as the list of modified/created/deleted files
|
|
3
|
+
* @see https://github.com/netlify/build/blob/master/packages/git-utils/README.md
|
|
4
|
+
*/
|
|
5
|
+
export interface NetlifyPluginGitUtil {
|
|
6
|
+
fileMatch(globPattern: string): readonly string[];
|
|
7
|
+
/**
|
|
8
|
+
* Array of all modified files.
|
|
9
|
+
*/
|
|
10
|
+
modifiedFiles: readonly string[];
|
|
11
|
+
/**
|
|
12
|
+
* Array of all created files.
|
|
13
|
+
*/
|
|
14
|
+
createdFiles: readonly string[];
|
|
15
|
+
/**
|
|
16
|
+
* Array of all deleted files.
|
|
17
|
+
*/
|
|
18
|
+
deletedFiles: readonly string[];
|
|
19
|
+
/**
|
|
20
|
+
* Array of commits with details.
|
|
21
|
+
*/
|
|
22
|
+
commits: ReadonlyArray<{
|
|
23
|
+
sha: string;
|
|
24
|
+
parents: string;
|
|
25
|
+
author: {
|
|
26
|
+
name: string;
|
|
27
|
+
email: string;
|
|
28
|
+
date: string;
|
|
29
|
+
};
|
|
30
|
+
committer: {
|
|
31
|
+
name: string;
|
|
32
|
+
email: string;
|
|
33
|
+
date: string;
|
|
34
|
+
};
|
|
35
|
+
message: string;
|
|
36
|
+
}>;
|
|
37
|
+
/**
|
|
38
|
+
* How many lines of code have changed
|
|
39
|
+
*/
|
|
40
|
+
linesOfCode(): Promise<number>;
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Options as ExecaOptions, ExecaChildProcess } from 'execa';
|
|
2
|
+
type NetlifyPluginRunUtilOptions = Omit<ExecaOptions, 'preferLocal'> & {
|
|
3
|
+
/**
|
|
4
|
+
* @default true
|
|
5
|
+
*/
|
|
6
|
+
preferLocal?: ExecaOptions['preferLocal'];
|
|
7
|
+
};
|
|
8
|
+
type NetlifyPluginRunUtilResult = ExecaChildProcess;
|
|
9
|
+
/**
|
|
10
|
+
* Run commands and processes
|
|
11
|
+
* @see https://github.com/netlify/build/blob/master/packages/run-utils/README.md
|
|
12
|
+
*/
|
|
13
|
+
export interface NetlifyPluginRunUtil {
|
|
14
|
+
(file: string, args?: readonly string[], options?: NetlifyPluginRunUtilOptions): Promise<NetlifyPluginRunUtilResult>;
|
|
15
|
+
command(command: string, options?: NetlifyPluginRunUtilOptions): Promise<NetlifyPluginRunUtilResult>;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Display information in the deploy summary
|
|
3
|
+
*/
|
|
4
|
+
export interface NetlifyPluginStatusUtil {
|
|
5
|
+
/**
|
|
6
|
+
* Only one status is shown per plugin.
|
|
7
|
+
* Calling `utils.status.show()` twice overrides the previous status.
|
|
8
|
+
*/
|
|
9
|
+
show(options: {
|
|
10
|
+
/**
|
|
11
|
+
* Default to the plugin's name followed by a generic title.
|
|
12
|
+
*/
|
|
13
|
+
title?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Message below the title
|
|
16
|
+
*/
|
|
17
|
+
summary: string;
|
|
18
|
+
/**
|
|
19
|
+
* Detailed information shown in a collapsible section.
|
|
20
|
+
* @default ""
|
|
21
|
+
*/
|
|
22
|
+
text?: string;
|
|
23
|
+
}): void;
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import type { NetlifyPluginBuildUtil } from './netlify_plugin_build_util.js'
|
|
2
|
-
import type { NetlifyPluginCacheUtil } from './netlify_plugin_cache_util.js'
|
|
3
|
-
import type { NetlifyPluginFunctionsUtil } from './netlify_plugin_functions_util.js'
|
|
4
|
-
import type { NetlifyPluginGitUtil } from './netlify_plugin_git_util.js'
|
|
5
|
-
import type { NetlifyPluginRunUtil } from './netlify_plugin_run_util.js'
|
|
6
|
-
import type { NetlifyPluginStatusUtil } from './netlify_plugin_status_util.js'
|
|
7
|
-
|
|
1
|
+
import type { NetlifyPluginBuildUtil } from './netlify_plugin_build_util.js';
|
|
2
|
+
import type { NetlifyPluginCacheUtil } from './netlify_plugin_cache_util.js';
|
|
3
|
+
import type { NetlifyPluginFunctionsUtil } from './netlify_plugin_functions_util.js';
|
|
4
|
+
import type { NetlifyPluginGitUtil } from './netlify_plugin_git_util.js';
|
|
5
|
+
import type { NetlifyPluginRunUtil } from './netlify_plugin_run_util.js';
|
|
6
|
+
import type { NetlifyPluginStatusUtil } from './netlify_plugin_status_util.js';
|
|
8
7
|
export interface NetlifyPluginUtils {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
build: NetlifyPluginBuildUtil;
|
|
9
|
+
status: NetlifyPluginStatusUtil;
|
|
10
|
+
cache: NetlifyPluginCacheUtil;
|
|
11
|
+
run: NetlifyPluginRunUtil;
|
|
12
|
+
git: NetlifyPluginGitUtil;
|
|
13
|
+
functions: NetlifyPluginFunctionsUtil;
|
|
15
14
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
type ArrayByMode<T, Mode extends 'immutable' | 'mutable' = 'immutable'> = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}[Mode]
|
|
5
|
-
|
|
6
|
-
export
|
|
2
|
+
immutable: readonly T[];
|
|
3
|
+
mutable: T[];
|
|
4
|
+
}[Mode];
|
|
5
|
+
export type Many<T, Mode extends 'immutable' | 'mutable' = 'immutable'> = T | ArrayByMode<T, Mode>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/utils/blobs.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
/** Retrieve the absolute path of the deploy scoped internal blob directory */
|
|
2
|
+
export declare const getBlobsDir: (buildDir: string, packagePath?: string) => string;
|
|
3
|
+
/**
|
|
4
|
+
* Detect if there are any blobs to upload
|
|
5
|
+
* @param buildDir The build directory. (current working directory where the build is executed)
|
|
6
|
+
* @param packagePath An optional package path for mono repositories
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export declare const anyBlobsToUpload: (buildDir: string, packagePath?: string) => Promise<boolean>;
|
package/lib/utils/blobs.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { resolve } from 'node:path';
|
|
2
2
|
import { fdir } from 'fdir';
|
|
3
3
|
const BLOBS_PATH = '.netlify/blobs/deploy';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
/** Retrieve the absolute path of the deploy scoped internal blob directory */
|
|
5
|
+
export const getBlobsDir = (buildDir, packagePath) => resolve(buildDir, packagePath || '', BLOBS_PATH);
|
|
6
|
+
/**
|
|
7
|
+
* Detect if there are any blobs to upload
|
|
8
|
+
* @param buildDir The build directory. (current working directory where the build is executed)
|
|
9
|
+
* @param packagePath An optional package path for mono repositories
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
export const anyBlobsToUpload = async function (buildDir, packagePath) {
|
|
13
|
+
const blobsDir = getBlobsDir(buildDir, packagePath);
|
|
9
14
|
const { files } = await new fdir().onlyCounts().crawl(blobsDir).withPromise();
|
|
10
15
|
return files > 0;
|
|
11
16
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/build",
|
|
3
|
-
"version": "29.
|
|
3
|
+
"version": "29.31.1",
|
|
4
4
|
"description": "Netlify build module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./lib/index.js",
|
|
@@ -71,11 +71,11 @@
|
|
|
71
71
|
"@netlify/config": "^20.10.0",
|
|
72
72
|
"@netlify/edge-bundler": "10.1.3",
|
|
73
73
|
"@netlify/framework-info": "^9.8.10",
|
|
74
|
-
"@netlify/functions-utils": "^5.2.
|
|
74
|
+
"@netlify/functions-utils": "^5.2.46",
|
|
75
75
|
"@netlify/git-utils": "^5.1.1",
|
|
76
|
-
"@netlify/plugins-list": "^6.
|
|
76
|
+
"@netlify/plugins-list": "^6.73.0",
|
|
77
77
|
"@netlify/run-utils": "^5.1.1",
|
|
78
|
-
"@netlify/zip-it-and-ship-it": "9.28.
|
|
78
|
+
"@netlify/zip-it-and-ship-it": "9.28.2",
|
|
79
79
|
"@opentelemetry/api": "^1.4.1",
|
|
80
80
|
"@opentelemetry/core": "^1.17.1",
|
|
81
81
|
"@sindresorhus/slugify": "^2.0.0",
|
|
@@ -157,5 +157,5 @@
|
|
|
157
157
|
"engines": {
|
|
158
158
|
"node": "^14.16.0 || >=16.0.0"
|
|
159
159
|
},
|
|
160
|
-
"gitHead": "
|
|
160
|
+
"gitHead": "efc258f3a0669d69d47b989e4d8154b18d60af35"
|
|
161
161
|
}
|
package/types/config/build.d.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/* eslint-disable camelcase -- some properties are named in snake case in this API */
|
|
2
|
-
|
|
3
|
-
export interface Build {
|
|
4
|
-
/**
|
|
5
|
-
* Includes a site's [build command](https://docs.netlify.com/configure-builds/get-started/#definitions)
|
|
6
|
-
*/
|
|
7
|
-
command?: string
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* the path to your static content folder
|
|
11
|
-
*/
|
|
12
|
-
publish: string
|
|
13
|
-
base: string
|
|
14
|
-
services: Record<string, unknown>
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Allows specifying a Bash command that will be run from the base directory to determine whether the site needs rebuilding or not.
|
|
18
|
-
* Check out our [ignore builds](https://docs.netlify.com/configure-builds/common-configurations/ignore-builds/) doc for more information on the default ignore behavior and details about constructing a custom ignore command.
|
|
19
|
-
*/
|
|
20
|
-
ignore?: string
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Includes the path to a site's [Edge Handlers directory](https://docs.netlify.com/edge-handlers/configure-and-build/#choose-an-edge-handlers-directory)
|
|
24
|
-
*/
|
|
25
|
-
edge_handlers?: string
|
|
26
|
-
/**
|
|
27
|
-
* Contains a site's [environment variables](https://docs.netlify.com/configure-builds/environment-variables/#netlify-configuration-variables)
|
|
28
|
-
*/
|
|
29
|
-
environment: Partial<Record<string, string>>
|
|
30
|
-
/**
|
|
31
|
-
* Includes options for [post processing](https://docs.netlify.com/configure-builds/file-based-configuration/#post-processing) HTML, CSS, JavaScript, and images
|
|
32
|
-
*/
|
|
33
|
-
processing: {
|
|
34
|
-
skip_processing?: boolean
|
|
35
|
-
css: {
|
|
36
|
-
bundle?: boolean
|
|
37
|
-
minify?: boolean
|
|
38
|
-
}
|
|
39
|
-
js: {
|
|
40
|
-
bundle?: boolean
|
|
41
|
-
minify?: boolean
|
|
42
|
-
}
|
|
43
|
-
html: {
|
|
44
|
-
pretty_url?: boolean
|
|
45
|
-
}
|
|
46
|
-
images: {
|
|
47
|
-
compress?: boolean
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/* eslint-enable camelcase */
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
type GlobPattern = string
|
|
2
|
-
|
|
3
|
-
/* eslint-disable camelcase -- some properties are named in snake case in this API */
|
|
4
|
-
type FunctionsObject = {
|
|
5
|
-
/**
|
|
6
|
-
* a list of additional paths to include in the function bundle. Although our build system includes statically referenced files (like `import * from "./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
|
-
*/
|
|
8
|
-
included_files?: string[]
|
|
9
|
-
} & (
|
|
10
|
-
| {
|
|
11
|
-
/**
|
|
12
|
-
* the function bundling method used in [`@netlify/zip-it-and-ship-it`](https://github.com/netlify/zip-it-and-ship-it).
|
|
13
|
-
*/
|
|
14
|
-
node_bundler?: 'zisi' | 'nft'
|
|
15
|
-
}
|
|
16
|
-
| {
|
|
17
|
-
/**
|
|
18
|
-
* the function bundling method used in [`@netlify/zip-it-and-ship-it`](https://github.com/netlify/zip-it-and-ship-it).
|
|
19
|
-
*/
|
|
20
|
-
node_bundler?: 'esbuild' | 'none'
|
|
21
|
-
|
|
22
|
-
/**
|
|
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
|
-
* This property helps handle dependencies that can’t be inlined, such as modules with native add-ons.
|
|
25
|
-
*/
|
|
26
|
-
external_node_modules?: string[]
|
|
27
|
-
|
|
28
|
-
ignored_node_modules?: string[]
|
|
29
|
-
}
|
|
30
|
-
)
|
|
31
|
-
/* eslint-enable camelcase */
|
|
32
|
-
|
|
33
|
-
export type Functions = {
|
|
34
|
-
'*': FunctionsObject & { deno_import_map?: string }
|
|
35
|
-
[pattern: GlobPattern]: FunctionsObject
|
|
36
|
-
}
|
package/types/config/inputs.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { JSONValue } from '../utils/json_value.js'
|
|
2
|
-
|
|
3
|
-
// Helper type to be used as a workaround for the fact that `interface`s don't have implicit
|
|
4
|
-
// index signatures: https://github.com/microsoft/TypeScript/issues/15300
|
|
5
|
-
export type StringKeys<TObject extends object> = keyof TObject & string
|
|
6
|
-
|
|
7
|
-
export type PluginInputs<Keys extends string = string> = Partial<Record<Keys, JSONValue>>
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { Many } from '../utils/many.js'
|
|
2
|
-
|
|
3
|
-
import type { Build } from './build.js'
|
|
4
|
-
import type { Functions } from './functions.js'
|
|
5
|
-
import type { PluginInputs } from './inputs.js'
|
|
6
|
-
|
|
7
|
-
type HttpStatusCode = number
|
|
8
|
-
|
|
9
|
-
interface Redirect {
|
|
10
|
-
from: string
|
|
11
|
-
to?: string
|
|
12
|
-
status?: HttpStatusCode
|
|
13
|
-
force?: boolean
|
|
14
|
-
signed?: string
|
|
15
|
-
query?: Partial<Record<string, string>>
|
|
16
|
-
headers?: Partial<Record<string, string>>
|
|
17
|
-
conditions?: Partial<Record<'Language' | 'Role' | 'Country' | 'Cookie', readonly string[]>>
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
interface Header {
|
|
21
|
-
for: string
|
|
22
|
-
values: Partial<Record<string, Many<string, 'mutable'>>>
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
interface EdgeFunction {
|
|
26
|
-
path?: `/${string}`
|
|
27
|
-
function: string
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
interface NetlifyPlugin {
|
|
31
|
-
package: string
|
|
32
|
-
inputs: PluginInputs
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
interface ImagesConfig {
|
|
36
|
-
remote_images: string[]
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/* eslint-disable camelcase -- some properties are named in snake case in this API */
|
|
40
|
-
|
|
41
|
-
interface NetlifyConfig {
|
|
42
|
-
/**
|
|
43
|
-
* array of redirects with their modifiable options
|
|
44
|
-
*/
|
|
45
|
-
redirects: Redirect[]
|
|
46
|
-
/**
|
|
47
|
-
* array of headers with their modifiable options
|
|
48
|
-
*/
|
|
49
|
-
headers: Header[]
|
|
50
|
-
/**
|
|
51
|
-
* array of Edge Functions with their modifiable options
|
|
52
|
-
*/
|
|
53
|
-
edge_functions: EdgeFunction[]
|
|
54
|
-
/**
|
|
55
|
-
* object with options for modifying [functions](https://docs.netlify.com/configure-builds/file-based-configuration/#functions)
|
|
56
|
-
*/
|
|
57
|
-
functions: Functions
|
|
58
|
-
build: Build
|
|
59
|
-
plugins: readonly NetlifyPlugin[]
|
|
60
|
-
/**
|
|
61
|
-
* object with options for image transforms
|
|
62
|
-
*/
|
|
63
|
-
images: ImagesConfig
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/* eslint-enable camelcase */
|
package/types/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export type { NetlifyPlugin } from './netlify_plugin.js'
|
|
2
|
-
export type { NetlifyPluginOptions } from './netlify_plugin_options.js'
|
|
3
|
-
export type { OnBuild, OnEnd, OnError, OnPostBuild, OnPreBuild, OnSuccess } from './netlify_event_handler.js'
|
|
4
|
-
export type { NetlifyConfig } from './config/netlify_config.js'
|
|
5
|
-
export type { NetlifyPluginUtils } from './options/netlify_plugin_utils.js'
|
|
6
|
-
export type { NetlifyPluginConstants } from './netlify_plugin_constants.js'
|
|
7
|
-
export type { ListedFunction, ListedFunctionFile } from './options/netlify_plugin_functions_util.js'
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { PluginInputs, StringKeys } from './config/inputs.js'
|
|
2
|
-
import type { NetlifyPluginOptions } from './netlify_plugin_options.js'
|
|
3
|
-
|
|
4
|
-
interface NetlifyEventHandler<PluginOptions extends NetlifyPluginOptions = NetlifyPluginOptions> {
|
|
5
|
-
(options: PluginOptions): void | Promise<void>
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
// To allow interfaces to be used as generics, since they lack implicit index signatures, we have to do some type shenanigans
|
|
9
|
-
// to get TypeScript to behave as we want - only letting the keys of `TInputs` through, and thus not requiring a full index
|
|
10
|
-
// signature on `TInputs`.
|
|
11
|
-
// Related issues: https://github.com/microsoft/TypeScript/issues/15300, https://github.com/netlify/build/issues/3838
|
|
12
|
-
export type OnPreBuild<TInputs extends PluginInputs<StringKeys<TInputs>> = PluginInputs> = NetlifyEventHandler<
|
|
13
|
-
NetlifyPluginOptions<TInputs>
|
|
14
|
-
>
|
|
15
|
-
export type OnBuild<TInputs extends PluginInputs<StringKeys<TInputs>> = PluginInputs> = NetlifyEventHandler<
|
|
16
|
-
NetlifyPluginOptions<TInputs>
|
|
17
|
-
>
|
|
18
|
-
export type OnPostBuild<TInputs extends PluginInputs<StringKeys<TInputs>> = PluginInputs> = NetlifyEventHandler<
|
|
19
|
-
NetlifyPluginOptions<TInputs>
|
|
20
|
-
>
|
|
21
|
-
export type OnError<TInputs extends PluginInputs<StringKeys<TInputs>> = PluginInputs> = NetlifyEventHandler<
|
|
22
|
-
NetlifyPluginOptions<TInputs> & { error: Error }
|
|
23
|
-
>
|
|
24
|
-
export type OnSuccess<TInputs extends PluginInputs<StringKeys<TInputs>> = PluginInputs> = NetlifyEventHandler<
|
|
25
|
-
NetlifyPluginOptions<TInputs>
|
|
26
|
-
>
|
|
27
|
-
export type OnEnd<TInputs extends PluginInputs<StringKeys<TInputs>> = PluginInputs> = NetlifyEventHandler<
|
|
28
|
-
NetlifyPluginOptions<TInputs> & { error?: Error }
|
|
29
|
-
>
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { PluginInputs } from './config/inputs.js'
|
|
2
|
-
import type { OnBuild, OnEnd, OnError, OnPostBuild, OnPreBuild, OnSuccess } from './netlify_event_handler.js'
|
|
3
|
-
|
|
4
|
-
export interface NetlifyPlugin<TInputs extends PluginInputs = PluginInputs> {
|
|
5
|
-
/**
|
|
6
|
-
* Runs before the build command is executed.
|
|
7
|
-
*/
|
|
8
|
-
onPreBuild?: OnPreBuild<TInputs>
|
|
9
|
-
/**
|
|
10
|
-
* runs directly after the build command is executed and before Functions? bundling and Edge Handlers bundling.
|
|
11
|
-
*/
|
|
12
|
-
onBuild?: OnBuild<TInputs>
|
|
13
|
-
/**
|
|
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.
|
|
15
|
-
*/
|
|
16
|
-
onPostBuild?: OnPostBuild<TInputs>
|
|
17
|
-
/**
|
|
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.
|
|
19
|
-
*/
|
|
20
|
-
onError?: OnError<TInputs>
|
|
21
|
-
/**
|
|
22
|
-
* runs when the deploy succeeds. Can’t be used to prevent a build from being deployed.
|
|
23
|
-
*/
|
|
24
|
-
onSuccess?: OnSuccess<TInputs>
|
|
25
|
-
/**
|
|
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.
|
|
27
|
-
*/
|
|
28
|
-
onEnd?: OnEnd<TInputs>
|
|
29
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
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
|
-
/**
|
|
18
|
-
* the directory inside a mono repository where it collects the settings from.
|
|
19
|
-
* This is the value of the package directory field of the build settings
|
|
20
|
-
* `undefined` if none is set.
|
|
21
|
-
*/
|
|
22
|
-
PACKAGE_PATH?: string
|
|
23
|
-
/**
|
|
24
|
-
* the directory where internal Edge Functions source code lives. This is where build plugins should place auto-generated functions.
|
|
25
|
-
* `undefined` if the version of @netlify/build does not support internal Edge Functions
|
|
26
|
-
*/
|
|
27
|
-
INTERNAL_EDGE_FUNCTIONS_SRC?: string
|
|
28
|
-
/**
|
|
29
|
-
* the directory where internal function source code lives. This is where build plugins should place auto-generated functions.
|
|
30
|
-
* `undefined` if the version of @netlify/build does not support internal functions
|
|
31
|
-
*/
|
|
32
|
-
INTERNAL_FUNCTIONS_SRC?: string
|
|
33
|
-
/**
|
|
34
|
-
* the directory where built serverless functions are placed before deployment. Its value is always defined, but the target might not have been created yet.
|
|
35
|
-
*/
|
|
36
|
-
FUNCTIONS_DIST: string
|
|
37
|
-
/**
|
|
38
|
-
* the directory where built Edge Functions are placed before deployment. Its value is always defined, but the target might not have been created yet.
|
|
39
|
-
*/
|
|
40
|
-
EDGE_FUNCTIONS_DIST: string
|
|
41
|
-
/**
|
|
42
|
-
* the directory where Edge Functions source code lives.
|
|
43
|
-
* `undefined` if no `netlify/edge-functions` directory exists.
|
|
44
|
-
*/
|
|
45
|
-
EDGE_FUNCTIONS_SRC?: string
|
|
46
|
-
/**
|
|
47
|
-
* boolean indicating whether the build was [run locally](https://docs.netlify.com/cli/get-started/#run-builds-locally) or on Netlify
|
|
48
|
-
*/
|
|
49
|
-
IS_LOCAL: boolean
|
|
50
|
-
/**
|
|
51
|
-
* version of Netlify Build as a `major.minor.patch` string
|
|
52
|
-
*/
|
|
53
|
-
NETLIFY_BUILD_VERSION: string
|
|
54
|
-
/**
|
|
55
|
-
* the Netlify site ID
|
|
56
|
-
*/
|
|
57
|
-
SITE_ID: string
|
|
58
|
-
/**
|
|
59
|
-
* the Netlify API access token
|
|
60
|
-
*/
|
|
61
|
-
NETLIFY_API_TOKEN?: string
|
|
62
|
-
/**
|
|
63
|
-
* the Netlify API host
|
|
64
|
-
*/
|
|
65
|
-
NETLIFY_API_HOST?: string
|
|
66
|
-
}
|