netlify-cli 9.6.11 → 9.8.0
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/npm-shrinkwrap.json +77 -14
- package/package.json +1 -1
- package/src/commands/deploy/deploy.js +6 -1
- package/src/commands/dev/dev-exec.js +2 -2
- package/src/commands/dev/dev.js +1 -1
- package/src/commands/functions/functions-create.js +14 -2
- package/src/commands/functions/functions-serve.js +1 -1
- package/src/lib/functions/config.js +2 -1
- package/src/utils/deploy/deploy-site.js +2 -0
- package/src/utils/deploy/hash-fns.js +6 -1
- package/src/utils/dev.js +2 -2
- package/src/utils/dot-env.js +8 -5
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "netlify-cli",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.8.0",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "netlify-cli",
|
|
9
|
-
"version": "9.
|
|
9
|
+
"version": "9.8.0",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"path-key": "^3.1.1",
|
|
100
100
|
"prettyjson": "^1.2.1",
|
|
101
101
|
"pump": "^3.0.0",
|
|
102
|
-
"raw-body": "^2.
|
|
102
|
+
"raw-body": "^2.5.0",
|
|
103
103
|
"read-pkg-up": "^7.0.1",
|
|
104
104
|
"semver": "^7.3.5",
|
|
105
105
|
"source-map-support": "^0.5.19",
|
|
@@ -11973,6 +11973,20 @@
|
|
|
11973
11973
|
"url": "https://github.com/sponsors/ljharb"
|
|
11974
11974
|
}
|
|
11975
11975
|
},
|
|
11976
|
+
"node_modules/express/node_modules/raw-body": {
|
|
11977
|
+
"version": "2.4.3",
|
|
11978
|
+
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.3.tgz",
|
|
11979
|
+
"integrity": "sha512-UlTNLIcu0uzb4D2f4WltY6cVjLi+/jEN4lgEUj3E04tpMDpUlkBo/eSn6zou9hum2VMNpCCUone0O0WeJim07g==",
|
|
11980
|
+
"dependencies": {
|
|
11981
|
+
"bytes": "3.1.2",
|
|
11982
|
+
"http-errors": "1.8.1",
|
|
11983
|
+
"iconv-lite": "0.4.24",
|
|
11984
|
+
"unpipe": "1.0.0"
|
|
11985
|
+
},
|
|
11986
|
+
"engines": {
|
|
11987
|
+
"node": ">= 0.8"
|
|
11988
|
+
}
|
|
11989
|
+
},
|
|
11976
11990
|
"node_modules/express/node_modules/safe-buffer": {
|
|
11977
11991
|
"version": "5.2.1",
|
|
11978
11992
|
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
|
@@ -19938,12 +19952,12 @@
|
|
|
19938
19952
|
}
|
|
19939
19953
|
},
|
|
19940
19954
|
"node_modules/raw-body": {
|
|
19941
|
-
"version": "2.
|
|
19942
|
-
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.
|
|
19943
|
-
"integrity": "sha512-
|
|
19955
|
+
"version": "2.5.0",
|
|
19956
|
+
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.0.tgz",
|
|
19957
|
+
"integrity": "sha512-XpyZ6O7PVu3ItMQl0LslfsRoKxMOxi3SzDkrOtxMES5AqLFpYjQCryxI4LGygUN2jL+RgFsPkMPPlG7cg/47+A==",
|
|
19944
19958
|
"dependencies": {
|
|
19945
19959
|
"bytes": "3.1.2",
|
|
19946
|
-
"http-errors": "
|
|
19960
|
+
"http-errors": "2.0.0",
|
|
19947
19961
|
"iconv-lite": "0.4.24",
|
|
19948
19962
|
"unpipe": "1.0.0"
|
|
19949
19963
|
},
|
|
@@ -19959,6 +19973,29 @@
|
|
|
19959
19973
|
"node": ">= 0.8"
|
|
19960
19974
|
}
|
|
19961
19975
|
},
|
|
19976
|
+
"node_modules/raw-body/node_modules/depd": {
|
|
19977
|
+
"version": "2.0.0",
|
|
19978
|
+
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
|
|
19979
|
+
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
|
|
19980
|
+
"engines": {
|
|
19981
|
+
"node": ">= 0.8"
|
|
19982
|
+
}
|
|
19983
|
+
},
|
|
19984
|
+
"node_modules/raw-body/node_modules/http-errors": {
|
|
19985
|
+
"version": "2.0.0",
|
|
19986
|
+
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
|
|
19987
|
+
"integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
|
|
19988
|
+
"dependencies": {
|
|
19989
|
+
"depd": "2.0.0",
|
|
19990
|
+
"inherits": "2.0.4",
|
|
19991
|
+
"setprototypeof": "1.2.0",
|
|
19992
|
+
"statuses": "2.0.1",
|
|
19993
|
+
"toidentifier": "1.0.1"
|
|
19994
|
+
},
|
|
19995
|
+
"engines": {
|
|
19996
|
+
"node": ">= 0.8"
|
|
19997
|
+
}
|
|
19998
|
+
},
|
|
19962
19999
|
"node_modules/rc": {
|
|
19963
20000
|
"version": "1.2.8",
|
|
19964
20001
|
"resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
|
|
@@ -21918,7 +21955,6 @@
|
|
|
21918
21955
|
"version": "2.0.1",
|
|
21919
21956
|
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
|
|
21920
21957
|
"integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
|
|
21921
|
-
"dev": true,
|
|
21922
21958
|
"engines": {
|
|
21923
21959
|
"node": ">= 0.8"
|
|
21924
21960
|
}
|
|
@@ -33156,6 +33192,17 @@
|
|
|
33156
33192
|
"resolved": "https://registry.npmjs.org/qs/-/qs-6.9.7.tgz",
|
|
33157
33193
|
"integrity": "sha512-IhMFgUmuNpyRfxA90umL7ByLlgRXu6tIfKPpF5TmcfRLlLCckfP/g3IQmju6jjpu+Hh8rA+2p6A27ZSPOOHdKw=="
|
|
33158
33194
|
},
|
|
33195
|
+
"raw-body": {
|
|
33196
|
+
"version": "2.4.3",
|
|
33197
|
+
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.3.tgz",
|
|
33198
|
+
"integrity": "sha512-UlTNLIcu0uzb4D2f4WltY6cVjLi+/jEN4lgEUj3E04tpMDpUlkBo/eSn6zou9hum2VMNpCCUone0O0WeJim07g==",
|
|
33199
|
+
"requires": {
|
|
33200
|
+
"bytes": "3.1.2",
|
|
33201
|
+
"http-errors": "1.8.1",
|
|
33202
|
+
"iconv-lite": "0.4.24",
|
|
33203
|
+
"unpipe": "1.0.0"
|
|
33204
|
+
}
|
|
33205
|
+
},
|
|
33159
33206
|
"safe-buffer": {
|
|
33160
33207
|
"version": "5.2.1",
|
|
33161
33208
|
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
|
@@ -39135,12 +39182,12 @@
|
|
|
39135
39182
|
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg=="
|
|
39136
39183
|
},
|
|
39137
39184
|
"raw-body": {
|
|
39138
|
-
"version": "2.
|
|
39139
|
-
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.
|
|
39140
|
-
"integrity": "sha512-
|
|
39185
|
+
"version": "2.5.0",
|
|
39186
|
+
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.0.tgz",
|
|
39187
|
+
"integrity": "sha512-XpyZ6O7PVu3ItMQl0LslfsRoKxMOxi3SzDkrOtxMES5AqLFpYjQCryxI4LGygUN2jL+RgFsPkMPPlG7cg/47+A==",
|
|
39141
39188
|
"requires": {
|
|
39142
39189
|
"bytes": "3.1.2",
|
|
39143
|
-
"http-errors": "
|
|
39190
|
+
"http-errors": "2.0.0",
|
|
39144
39191
|
"iconv-lite": "0.4.24",
|
|
39145
39192
|
"unpipe": "1.0.0"
|
|
39146
39193
|
},
|
|
@@ -39149,6 +39196,23 @@
|
|
|
39149
39196
|
"version": "3.1.2",
|
|
39150
39197
|
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
|
|
39151
39198
|
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg=="
|
|
39199
|
+
},
|
|
39200
|
+
"depd": {
|
|
39201
|
+
"version": "2.0.0",
|
|
39202
|
+
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
|
|
39203
|
+
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw=="
|
|
39204
|
+
},
|
|
39205
|
+
"http-errors": {
|
|
39206
|
+
"version": "2.0.0",
|
|
39207
|
+
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
|
|
39208
|
+
"integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
|
|
39209
|
+
"requires": {
|
|
39210
|
+
"depd": "2.0.0",
|
|
39211
|
+
"inherits": "2.0.4",
|
|
39212
|
+
"setprototypeof": "1.2.0",
|
|
39213
|
+
"statuses": "2.0.1",
|
|
39214
|
+
"toidentifier": "1.0.1"
|
|
39215
|
+
}
|
|
39152
39216
|
}
|
|
39153
39217
|
}
|
|
39154
39218
|
},
|
|
@@ -40704,8 +40768,7 @@
|
|
|
40704
40768
|
"statuses": {
|
|
40705
40769
|
"version": "2.0.1",
|
|
40706
40770
|
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
|
|
40707
|
-
"integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ=="
|
|
40708
|
-
"dev": true
|
|
40771
|
+
"integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ=="
|
|
40709
40772
|
},
|
|
40710
40773
|
"stealthy-require": {
|
|
40711
40774
|
"version": "1.1.1",
|
package/package.json
CHANGED
|
@@ -529,7 +529,12 @@ const deploy = async (options, command) => {
|
|
|
529
529
|
deployFolder,
|
|
530
530
|
functionsFolder,
|
|
531
531
|
})
|
|
532
|
-
const
|
|
532
|
+
const siteEnv = get(siteData, 'build_settings.env')
|
|
533
|
+
const functionsConfig = normalizeFunctionsConfig({
|
|
534
|
+
functionsConfig: config.functions,
|
|
535
|
+
projectRoot: site.root,
|
|
536
|
+
siteEnv,
|
|
537
|
+
})
|
|
533
538
|
|
|
534
539
|
const redirectsPath = `${deployFolder}/_redirects`
|
|
535
540
|
const { restoreConfig, updateConfig } = await netlifyConfigPromise
|
|
@@ -8,8 +8,8 @@ const { injectEnvVariables } = require('../../utils')
|
|
|
8
8
|
* @param {import('../base-command').BaseCommand} command
|
|
9
9
|
*/
|
|
10
10
|
const devExec = async (cmd, options, command) => {
|
|
11
|
-
const { cachedConfig, site } = command.netlify
|
|
12
|
-
await injectEnvVariables({ env: cachedConfig.env, site })
|
|
11
|
+
const { cachedConfig, config, site } = command.netlify
|
|
12
|
+
await injectEnvVariables({ devConfig: { ...config.dev }, env: cachedConfig.env, site })
|
|
13
13
|
|
|
14
14
|
await execa(cmd, command.args.slice(1), {
|
|
15
15
|
stdio: 'inherit',
|
package/src/commands/dev/dev.js
CHANGED
|
@@ -326,7 +326,7 @@ const dev = async (options, command) => {
|
|
|
326
326
|
)
|
|
327
327
|
}
|
|
328
328
|
|
|
329
|
-
await injectEnvVariables({ env: command.netlify.cachedConfig.env, site })
|
|
329
|
+
await injectEnvVariables({ devConfig, env: command.netlify.cachedConfig.env, site })
|
|
330
330
|
|
|
331
331
|
const { addonsUrls, capabilities, siteUrl, timeouts } = await getSiteInformation({
|
|
332
332
|
// inherited from base command --offline
|
|
@@ -477,8 +477,14 @@ const createFunctionAddon = async function ({ addonName, addons, api, siteData,
|
|
|
477
477
|
* @param {(command: import('../base-command').BaseCommand) => any} config.onComplete
|
|
478
478
|
*/
|
|
479
479
|
const handleOnComplete = async ({ command, onComplete }) => {
|
|
480
|
+
const { config } = command.netlify
|
|
481
|
+
|
|
480
482
|
if (onComplete) {
|
|
481
|
-
await injectEnvVariables({
|
|
483
|
+
await injectEnvVariables({
|
|
484
|
+
devConfig: { ...config.dev },
|
|
485
|
+
env: command.netlify.cachedConfig.env,
|
|
486
|
+
site: command.netlify.site,
|
|
487
|
+
})
|
|
482
488
|
await onComplete.call(command)
|
|
483
489
|
}
|
|
484
490
|
}
|
|
@@ -491,6 +497,8 @@ const handleOnComplete = async ({ command, onComplete }) => {
|
|
|
491
497
|
* @param {string} config.fnPath
|
|
492
498
|
*/
|
|
493
499
|
const handleAddonDidInstall = async ({ addonCreated, addonDidInstall, command, fnPath }) => {
|
|
500
|
+
const { config } = command.netlify
|
|
501
|
+
|
|
494
502
|
if (!addonCreated || !addonDidInstall) {
|
|
495
503
|
return
|
|
496
504
|
}
|
|
@@ -508,7 +516,11 @@ const handleAddonDidInstall = async ({ addonCreated, addonDidInstall, command, f
|
|
|
508
516
|
return
|
|
509
517
|
}
|
|
510
518
|
|
|
511
|
-
await injectEnvVariables({
|
|
519
|
+
await injectEnvVariables({
|
|
520
|
+
devConfig: { ...config.dev },
|
|
521
|
+
env: command.netlify.cachedConfig.env,
|
|
522
|
+
site: command.netlify.site,
|
|
523
|
+
})
|
|
512
524
|
addonDidInstall(fnPath)
|
|
513
525
|
}
|
|
514
526
|
|
|
@@ -17,7 +17,7 @@ const functionsServe = async (options, command) => {
|
|
|
17
17
|
|
|
18
18
|
const functionsDir = getFunctionsDir({ options, config }, join('netlify', 'functions'))
|
|
19
19
|
|
|
20
|
-
await injectEnvVariables({ env: command.netlify.cachedConfig.env, site })
|
|
20
|
+
await injectEnvVariables({ devConfig: { ...config.dev }, env: command.netlify.cachedConfig.env, site })
|
|
21
21
|
|
|
22
22
|
const { capabilities, siteUrl, timeouts } = await getSiteInformation({
|
|
23
23
|
offline: options.offline,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// The function configuration keys returned by @netlify/config are not an exact
|
|
2
2
|
// match to the properties that @netlify/zip-it-and-ship-it expects. We do that
|
|
3
3
|
// translation here.
|
|
4
|
-
const normalizeFunctionsConfig = ({ functionsConfig = {}, projectRoot }) =>
|
|
4
|
+
const normalizeFunctionsConfig = ({ functionsConfig = {}, projectRoot, siteEnv = {} }) =>
|
|
5
5
|
Object.entries(functionsConfig).reduce(
|
|
6
6
|
(result, [pattern, config]) => ({
|
|
7
7
|
...result,
|
|
@@ -11,6 +11,7 @@ const normalizeFunctionsConfig = ({ functionsConfig = {}, projectRoot }) =>
|
|
|
11
11
|
includedFilesBasePath: projectRoot,
|
|
12
12
|
ignoredNodeModules: config.ignored_node_modules,
|
|
13
13
|
nodeBundler: config.node_bundler === 'esbuild' ? 'esbuild_zisi' : config.node_bundler,
|
|
14
|
+
nodeVersion: siteEnv.AWS_LAMBDA_JS_RUNTIME,
|
|
14
15
|
processDynamicNodeImports: true,
|
|
15
16
|
schedule: config.schedule,
|
|
16
17
|
zipGo: true,
|
|
@@ -37,6 +37,7 @@ const deploySite = async (
|
|
|
37
37
|
maxRetry = DEFAULT_MAX_RETRY,
|
|
38
38
|
// API calls this the 'title'
|
|
39
39
|
message: title,
|
|
40
|
+
siteEnv,
|
|
40
41
|
skipFunctionsCache,
|
|
41
42
|
statusCb = () => {
|
|
42
43
|
/* default to noop */
|
|
@@ -65,6 +66,7 @@ const deploySite = async (
|
|
|
65
66
|
rootDir,
|
|
66
67
|
manifestPath,
|
|
67
68
|
skipFunctionsCache,
|
|
69
|
+
siteEnv,
|
|
68
70
|
}),
|
|
69
71
|
])
|
|
70
72
|
const filesCount = Object.keys(files).length
|
|
@@ -61,7 +61,12 @@ const getFunctionZips = async ({
|
|
|
61
61
|
})
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
const featureFlags = {
|
|
65
|
+
zisi_detect_esm: true,
|
|
66
|
+
zisi_pure_esm: true,
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return await zipIt.zipFunctions(directories, tmpDir, { basePath: rootDir, config: functionsConfig, featureFlags })
|
|
65
70
|
}
|
|
66
71
|
|
|
67
72
|
const hashFns = async (
|
package/src/utils/dev.js
CHANGED
|
@@ -139,9 +139,9 @@ const getEnvSourceName = (source) => {
|
|
|
139
139
|
|
|
140
140
|
// Takes a set of environment variables in the format provided by @netlify/config, augments it with variables from both
|
|
141
141
|
// dot-env files and the process itself, and injects into `process.env`.
|
|
142
|
-
const injectEnvVariables = async ({ env, site }) => {
|
|
142
|
+
const injectEnvVariables = async ({ devConfig, env, site }) => {
|
|
143
143
|
const environment = new Map(Object.entries(env))
|
|
144
|
-
const dotEnvFiles = await loadDotEnvFiles({ projectDir: site.root })
|
|
144
|
+
const dotEnvFiles = await loadDotEnvFiles({ envFiles: devConfig.envFiles, projectDir: site.root })
|
|
145
145
|
|
|
146
146
|
dotEnvFiles.forEach(({ env: fileEnv, file }) => {
|
|
147
147
|
Object.keys(fileEnv).forEach((key) => {
|
package/src/utils/dot-env.js
CHANGED
|
@@ -8,8 +8,8 @@ const { isFileAsync } = require('../lib/fs')
|
|
|
8
8
|
|
|
9
9
|
const { warn } = require('./command-helpers')
|
|
10
10
|
|
|
11
|
-
const loadDotEnvFiles = async function ({ projectDir }) {
|
|
12
|
-
const response = await tryLoadDotEnvFiles({ projectDir })
|
|
11
|
+
const loadDotEnvFiles = async function ({ envFiles, projectDir }) {
|
|
12
|
+
const response = await tryLoadDotEnvFiles({ projectDir, dotenvFiles: envFiles })
|
|
13
13
|
|
|
14
14
|
const filesWithWarning = response.filter((el) => el.warning)
|
|
15
15
|
filesWithWarning.forEach((el) => {
|
|
@@ -19,8 +19,10 @@ const loadDotEnvFiles = async function ({ projectDir }) {
|
|
|
19
19
|
return response.filter((el) => el.file && el.env)
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
// in the user configuration, the order is highest to lowest
|
|
23
|
+
const defaultEnvFiles = ['.env.development', '.env']
|
|
24
|
+
|
|
25
|
+
const tryLoadDotEnvFiles = async ({ projectDir, dotenvFiles = defaultEnvFiles }) => {
|
|
24
26
|
const results = await Promise.all(
|
|
25
27
|
dotenvFiles.map(async (file) => {
|
|
26
28
|
const filepath = path.resolve(projectDir, file)
|
|
@@ -40,7 +42,8 @@ const tryLoadDotEnvFiles = async ({ projectDir }) => {
|
|
|
40
42
|
}),
|
|
41
43
|
)
|
|
42
44
|
|
|
43
|
-
return
|
|
45
|
+
// we return in order of lowest to highest priority
|
|
46
|
+
return results.filter(Boolean).reverse()
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
module.exports = { loadDotEnvFiles, tryLoadDotEnvFiles }
|