@netlify/build 18.23.0 → 18.23.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": "18.23.
|
|
3
|
+
"version": "18.23.1",
|
|
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.2.0",
|
|
63
63
|
"@netlify/run-utils": "^2.0.0",
|
|
64
|
-
"@netlify/zip-it-and-ship-it": "^4.29.
|
|
64
|
+
"@netlify/zip-it-and-ship-it": "^4.29.5",
|
|
65
65
|
"@sindresorhus/slugify": "^1.1.0",
|
|
66
66
|
"@ungap/from-entries": "^0.2.1",
|
|
67
67
|
"ansi-escapes": "^4.3.2",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const path = require('path')
|
|
4
4
|
|
|
5
|
-
const { log, logArray, logErrorSubHeader, logWarningSubHeader
|
|
5
|
+
const { log, logArray, logErrorSubHeader, logWarningSubHeader } = require('../logger')
|
|
6
6
|
const { THEME } = require('../theme')
|
|
7
7
|
|
|
8
8
|
const logBundleResultFunctions = ({ functions, headerMessage, logs, error }) => {
|
|
@@ -17,24 +17,6 @@ const logBundleResultFunctions = ({ functions, headerMessage, logs, error }) =>
|
|
|
17
17
|
logArray(logs, functionNames)
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
const MAX_AWS_ZIP_SIZE = 50000000
|
|
21
|
-
|
|
22
|
-
const logSizeWarnings = ({ results, logs }) => {
|
|
23
|
-
const oversizedFunctions = results.filter(({ size }) => size > MAX_AWS_ZIP_SIZE)
|
|
24
|
-
oversizedFunctions.forEach(({ name, bundler }) => {
|
|
25
|
-
logErrorSubHeader(logs, `Function ${name} exceeds size limit of 50mb`)
|
|
26
|
-
|
|
27
|
-
if (bundler === 'zisi') {
|
|
28
|
-
logMessage(logs, `You're using the default bundler, and could benefit from esbuild: https://ntl.fyi/try-esbuild`)
|
|
29
|
-
} else {
|
|
30
|
-
logMessage(
|
|
31
|
-
logs,
|
|
32
|
-
`To debug, run \`$ netlify build\` locally and examine the contents of .netlify/functions/${name}.zip`,
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
})
|
|
36
|
-
}
|
|
37
|
-
|
|
38
20
|
const logBundleResults = ({ logs, results = [] }) => {
|
|
39
21
|
const resultsWithErrors = results.filter(({ bundlerErrors }) => bundlerErrors && bundlerErrors.length !== 0)
|
|
40
22
|
const resultsWithWarnings = results.filter(
|
|
@@ -65,8 +47,6 @@ const logBundleResults = ({ logs, results = [] }) => {
|
|
|
65
47
|
if (modulesWithDynamicImports.length !== 0) {
|
|
66
48
|
logModulesWithDynamicImports({ logs, modulesWithDynamicImports })
|
|
67
49
|
}
|
|
68
|
-
|
|
69
|
-
logSizeWarnings({ results, logs })
|
|
70
50
|
}
|
|
71
51
|
|
|
72
52
|
const logFunctionsNonExistingDir = function (logs, relativeFunctionsSrc) {
|
|
@@ -9,12 +9,23 @@ const { log, logMessage, logSubHeader } = require('../logger')
|
|
|
9
9
|
|
|
10
10
|
const pReadFile = promisify(readFile)
|
|
11
11
|
|
|
12
|
-
const logConfigMutations = function (logs, newConfigMutations) {
|
|
13
|
-
|
|
12
|
+
const logConfigMutations = function (logs, newConfigMutations, debug) {
|
|
13
|
+
const configMutationsToLog = debug ? newConfigMutations : newConfigMutations.filter(shouldLogConfigMutation)
|
|
14
|
+
configMutationsToLog.forEach(({ keysString, value }) => {
|
|
14
15
|
logConfigMutation(logs, keysString, value)
|
|
15
16
|
})
|
|
16
17
|
}
|
|
17
18
|
|
|
19
|
+
// Some configuration mutations are only logged in debug mode
|
|
20
|
+
const shouldLogConfigMutation = function ({ keysString }) {
|
|
21
|
+
return !HIDDEN_PROPS.some((hiddenProp) => keysString.startsWith(hiddenProp))
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// `functions` is an object which can have thousands of properties, one per
|
|
25
|
+
// function file. This can be very verbose, especially for plugins which create
|
|
26
|
+
// many function files like Essential Next.js
|
|
27
|
+
const HIDDEN_PROPS = ['functions']
|
|
28
|
+
|
|
18
29
|
const logConfigMutation = function (logs, keysString, value) {
|
|
19
30
|
const newValue = shouldHideConfigValue(keysString) ? '' : ` to ${inspect(value, { colors: false })}`
|
|
20
31
|
log(logs, `Netlify configuration property "${keysString}" value changed${newValue}.`)
|
|
@@ -29,7 +29,7 @@ const updateNetlifyConfig = async function ({
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
validateConfigMutations(newConfigMutations)
|
|
32
|
-
logConfigMutations(logs, newConfigMutations)
|
|
32
|
+
logConfigMutations(logs, newConfigMutations, debug)
|
|
33
33
|
const configMutationsA = [...configMutations, ...newConfigMutations]
|
|
34
34
|
const {
|
|
35
35
|
config: netlifyConfigA,
|
package/types/config/inputs.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { JSONValue } from '../utils/json_value'
|
|
2
2
|
|
|
3
|
-
|
|
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,19 +1,29 @@
|
|
|
1
|
-
import { PluginInputs } from './config/inputs'
|
|
1
|
+
import { PluginInputs, StringKeys } from './config/inputs'
|
|
2
2
|
import { NetlifyPluginOptions } from './netlify_plugin_options'
|
|
3
3
|
|
|
4
4
|
interface NetlifyEventHandler<PluginOptions extends NetlifyPluginOptions = NetlifyPluginOptions> {
|
|
5
5
|
(options: PluginOptions): void | Promise<void>
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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<
|
|
11
13
|
NetlifyPluginOptions<TInputs>
|
|
12
14
|
>
|
|
13
|
-
export type
|
|
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<
|
|
14
22
|
NetlifyPluginOptions<TInputs> & { error: Error }
|
|
15
23
|
>
|
|
16
|
-
export type OnSuccess<TInputs extends PluginInputs = PluginInputs> = NetlifyEventHandler<
|
|
17
|
-
|
|
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<
|
|
18
28
|
NetlifyPluginOptions<TInputs> & { error?: Error }
|
|
19
29
|
>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { PluginInputs } from './config/inputs'
|
|
1
|
+
import { PluginInputs, StringKeys } from './config/inputs'
|
|
2
2
|
import { NetlifyConfig } from './config/netlify_config'
|
|
3
3
|
import { NetlifyPluginConstants } from './netlify_plugin_constants'
|
|
4
4
|
import { NetlifyPluginUtils } from './options/netlify_plugin_utils'
|
|
5
5
|
import { JSONValue } from './utils/json_value'
|
|
6
6
|
|
|
7
|
-
export interface NetlifyPluginOptions<TInputs extends PluginInputs = PluginInputs> {
|
|
7
|
+
export interface NetlifyPluginOptions<TInputs extends PluginInputs<StringKeys<TInputs>> = PluginInputs> {
|
|
8
8
|
/**
|
|
9
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).
|
|
10
10
|
*/
|