netlify-cli 12.11.0 → 12.12.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/npm-shrinkwrap.json +2226 -1039
- package/package.json +9 -7
- package/src/functions-templates/javascript/token-hider/package-lock.json +6 -6
- package/src/functions-templates/rust/hello-world/Cargo.toml +1 -1
- package/src/lib/edge-functions/registry.mjs +45 -16
- package/src/recipes/vscode/settings.mjs +7 -6
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "netlify-cli",
|
|
3
3
|
"description": "Netlify command line tool",
|
|
4
|
-
"version": "12.
|
|
4
|
+
"version": "12.12.1",
|
|
5
5
|
"author": "Netlify Inc.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
@@ -71,17 +71,17 @@
|
|
|
71
71
|
"certs": "openssl req -x509 -out localhost.crt -keyout localhost.key -newkey rsa:2048 -nodes -sha256 -subj \"/CN=localhost\" -extensions EXT -config certconf"
|
|
72
72
|
},
|
|
73
73
|
"config": {
|
|
74
|
-
"eslint": "--
|
|
75
|
-
"prettier": "--ignore-path .
|
|
74
|
+
"eslint": "--cache --format=codeframe --max-warnings=0 \"{src,scripts,site,tests,.github}/**/*.{mjs,cjs,js,md,html}\" \"*.{mjs,cjs,js,md,html}\" \".*.{mjs,cjs,js,md,html}\"",
|
|
75
|
+
"prettier": "--ignore-path .eslintignore --loglevel=warn \"{src,tools,scripts,site,tests,.github}/**/*.{mjs,cjs,js,md,yml,json,html}\" \"*.{mjs,cjs,js,yml,json,html}\" \".*.{mjs,cjs,js,yml,json,html}\" \"!CHANGELOG.md\" \"!npm-shrinkwrap.json\" \"!**/*/package-lock.json\" \"!.github/**/*.md\""
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"@fastify/static": "^6.6.0",
|
|
79
|
-
"@netlify/build": "^29.5.
|
|
79
|
+
"@netlify/build": "^29.5.7",
|
|
80
80
|
"@netlify/config": "^20.3.3",
|
|
81
|
-
"@netlify/edge-bundler": "^8.
|
|
81
|
+
"@netlify/edge-bundler": "^8.6.0",
|
|
82
82
|
"@netlify/framework-info": "^9.8.1",
|
|
83
83
|
"@netlify/local-functions-proxy": "^1.1.1",
|
|
84
|
-
"@netlify/zip-it-and-ship-it": "^8.
|
|
84
|
+
"@netlify/zip-it-and-ship-it": "^8.6.0",
|
|
85
85
|
"@octokit/rest": "^19.0.0",
|
|
86
86
|
"ansi-escapes": "^5.0.0",
|
|
87
87
|
"ansi-styles": "^5.0.0",
|
|
@@ -94,7 +94,8 @@
|
|
|
94
94
|
"chokidar": "^3.0.2",
|
|
95
95
|
"ci-info": "^3.0.0",
|
|
96
96
|
"clean-deep": "^3.0.2",
|
|
97
|
-
"commander": "^
|
|
97
|
+
"commander": "^10.0.0",
|
|
98
|
+
"comment-json": "^4.2.3",
|
|
98
99
|
"concordance": "^5.0.0",
|
|
99
100
|
"configstore": "^5.0.0",
|
|
100
101
|
"content-type": "^1.0.4",
|
|
@@ -186,6 +187,7 @@
|
|
|
186
187
|
"@vitest/coverage-c8": "^0.28.0",
|
|
187
188
|
"ava": "^4.0.0",
|
|
188
189
|
"c8": "^7.11.0",
|
|
190
|
+
"cpy": "^9.0.1",
|
|
189
191
|
"eslint-plugin-sort-destructure-keys": "^1.3.5",
|
|
190
192
|
"fast-glob": "^3.2.7",
|
|
191
193
|
"form-data": "^4.0.0",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
|
|
20
20
|
},
|
|
21
21
|
"node_modules/axios": {
|
|
22
|
-
"version": "1.
|
|
23
|
-
"resolved": "https://registry.npmjs.org/axios/-/axios-1.
|
|
24
|
-
"integrity": "sha512-
|
|
22
|
+
"version": "1.3.3",
|
|
23
|
+
"resolved": "https://registry.npmjs.org/axios/-/axios-1.3.3.tgz",
|
|
24
|
+
"integrity": "sha512-eYq77dYIFS77AQlhzEL937yUBSepBfPIe8FcgEDN35vMNZKMrs81pgnyrQpwfy4NF4b4XWX1Zgx7yX+25w8QJA==",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"follow-redirects": "^1.15.0",
|
|
27
27
|
"form-data": "^4.0.0",
|
|
@@ -198,9 +198,9 @@
|
|
|
198
198
|
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
|
|
199
199
|
},
|
|
200
200
|
"axios": {
|
|
201
|
-
"version": "1.
|
|
202
|
-
"resolved": "https://registry.npmjs.org/axios/-/axios-1.
|
|
203
|
-
"integrity": "sha512-
|
|
201
|
+
"version": "1.3.3",
|
|
202
|
+
"resolved": "https://registry.npmjs.org/axios/-/axios-1.3.3.tgz",
|
|
203
|
+
"integrity": "sha512-eYq77dYIFS77AQlhzEL937yUBSepBfPIe8FcgEDN35vMNZKMrs81pgnyrQpwfy4NF4b4XWX1Zgx7yX+25w8QJA==",
|
|
204
204
|
"requires": {
|
|
205
205
|
"follow-redirects": "^1.15.0",
|
|
206
206
|
"form-data": "^4.0.0",
|
|
@@ -3,6 +3,16 @@ import { fileURLToPath } from 'url'
|
|
|
3
3
|
|
|
4
4
|
import { NETLIFYDEVERR, NETLIFYDEVLOG, chalk, log, warn, watchDebounced } from '../../utils/command-helpers.mjs'
|
|
5
5
|
|
|
6
|
+
// TODO: Import from `@netlify/edge-bundler` once it exports this type.
|
|
7
|
+
/**
|
|
8
|
+
* @typedef InSourceDeclaration
|
|
9
|
+
* @type {object}
|
|
10
|
+
* @property {string} [cache]
|
|
11
|
+
* @property {string} function
|
|
12
|
+
* @property {string | string[]} [path]
|
|
13
|
+
* @property {string | string[]} [excludedPath]
|
|
14
|
+
*/
|
|
15
|
+
|
|
6
16
|
/**
|
|
7
17
|
* @typedef EdgeFunction
|
|
8
18
|
* @type {object}
|
|
@@ -21,10 +31,11 @@ import { NETLIFYDEVERR, NETLIFYDEVLOG, chalk, log, warn, watchDebounced } from '
|
|
|
21
31
|
* @typedef EdgeFunctionDeclarationWithPattern
|
|
22
32
|
* @type {object}
|
|
23
33
|
* @property {string} function
|
|
24
|
-
* @property {
|
|
34
|
+
* @property {string} pattern
|
|
25
35
|
*/
|
|
26
36
|
|
|
27
|
-
/** @typedef {(EdgeFunctionDeclarationWithPath | EdgeFunctionDeclarationWithPattern)
|
|
37
|
+
/** @typedef {(EdgeFunctionDeclarationWithPath | EdgeFunctionDeclarationWithPattern)} EdgeFunctionDeclaration */
|
|
38
|
+
/** @typedef {Awaited<ReturnType<typeof import('@netlify/edge-bundler').serve>>} RunIsolate */
|
|
28
39
|
|
|
29
40
|
export class EdgeFunctionsRegistry {
|
|
30
41
|
/**
|
|
@@ -37,7 +48,7 @@ export class EdgeFunctionsRegistry {
|
|
|
37
48
|
* @param {() => Promise<object>} opts.getUpdatedConfig
|
|
38
49
|
* @param {EdgeFunction[]} opts.internalFunctions
|
|
39
50
|
* @param {string} opts.projectDir
|
|
40
|
-
* @param {
|
|
51
|
+
* @param {RunIsolate} opts.runIsolate
|
|
41
52
|
*/
|
|
42
53
|
constructor({
|
|
43
54
|
bundler,
|
|
@@ -50,9 +61,6 @@ export class EdgeFunctionsRegistry {
|
|
|
50
61
|
projectDir,
|
|
51
62
|
runIsolate,
|
|
52
63
|
}) {
|
|
53
|
-
/**
|
|
54
|
-
* @type {import('@netlify/edge-bundler')}
|
|
55
|
-
*/
|
|
56
64
|
this.bundler = bundler
|
|
57
65
|
|
|
58
66
|
/**
|
|
@@ -76,7 +84,7 @@ export class EdgeFunctionsRegistry {
|
|
|
76
84
|
this.internalFunctions = internalFunctions
|
|
77
85
|
|
|
78
86
|
/**
|
|
79
|
-
* @type {
|
|
87
|
+
* @type {RunIsolate}
|
|
80
88
|
*/
|
|
81
89
|
this.runIsolate = runIsolate
|
|
82
90
|
|
|
@@ -91,7 +99,7 @@ export class EdgeFunctionsRegistry {
|
|
|
91
99
|
this.declarationsFromConfig = this.getDeclarationsFromConfig(config)
|
|
92
100
|
|
|
93
101
|
/**
|
|
94
|
-
* @type {
|
|
102
|
+
* @type {InSourceDeclaration[]}
|
|
95
103
|
*/
|
|
96
104
|
this.declarationsFromSource = []
|
|
97
105
|
|
|
@@ -287,7 +295,7 @@ export class EdgeFunctionsRegistry {
|
|
|
287
295
|
*/
|
|
288
296
|
async matchURLPath(urlPath) {
|
|
289
297
|
const declarations = this.mergeDeclarations()
|
|
290
|
-
const manifest =
|
|
298
|
+
const manifest = this.bundler.generateManifest({
|
|
291
299
|
declarations,
|
|
292
300
|
functions: this.functions,
|
|
293
301
|
})
|
|
@@ -309,14 +317,14 @@ export class EdgeFunctionsRegistry {
|
|
|
309
317
|
return { functionNames, orphanedDeclarations }
|
|
310
318
|
}
|
|
311
319
|
|
|
312
|
-
|
|
320
|
+
matchURLPathAgainstOrphanedDeclarations(urlPath) {
|
|
313
321
|
// `generateManifest` will only include functions for which there is both a
|
|
314
322
|
// function file and a config declaration, but we want to catch cases where
|
|
315
323
|
// a config declaration exists without a matching function file. To do that
|
|
316
324
|
// we compute a list of functions from the declarations (the `path` doesn't
|
|
317
325
|
// really matter).
|
|
318
326
|
const functions = this.declarationsFromConfig.map((declaration) => ({ name: declaration.function, path: '' }))
|
|
319
|
-
const manifest =
|
|
327
|
+
const manifest = this.bundler.generateManifest({
|
|
320
328
|
declarations: this.declarationsFromConfig,
|
|
321
329
|
functions,
|
|
322
330
|
})
|
|
@@ -346,12 +354,33 @@ export class EdgeFunctionsRegistry {
|
|
|
346
354
|
const declarations = [...this.declarationsFromConfig]
|
|
347
355
|
|
|
348
356
|
this.declarationsFromSource.forEach((declarationFromSource) => {
|
|
349
|
-
const
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
357
|
+
const { path: pathOrPaths, ...configProps } = declarationFromSource
|
|
358
|
+
|
|
359
|
+
// Find any declarations in the config for the function.
|
|
360
|
+
const indexes = declarations
|
|
361
|
+
.filter(({ function: func }) => func === declarationFromSource.function)
|
|
362
|
+
.map((_, index) => index)
|
|
363
|
+
|
|
364
|
+
// If the in-source declaration doesn't have a path, add its properties
|
|
365
|
+
// to any existing declarations for the function.
|
|
366
|
+
if (pathOrPaths === undefined) {
|
|
367
|
+
indexes.forEach((index) => {
|
|
368
|
+
declarations[index] = { ...declarations[index], ...configProps }
|
|
369
|
+
})
|
|
353
370
|
} else {
|
|
354
|
-
|
|
371
|
+
// The in-source declaration has a path, and those take precedence.
|
|
372
|
+
// Discard any config declarations first.
|
|
373
|
+
indexes.forEach((index) => {
|
|
374
|
+
declarations.splice(index, 1)
|
|
375
|
+
})
|
|
376
|
+
|
|
377
|
+
// The path may be an array or a string, so let's normalize that first.
|
|
378
|
+
const paths = Array.isArray(pathOrPaths) ? pathOrPaths : [pathOrPaths]
|
|
379
|
+
|
|
380
|
+
// Create a new declaration for each path.
|
|
381
|
+
paths.forEach((path) => {
|
|
382
|
+
declarations.push({ ...configProps, path })
|
|
383
|
+
})
|
|
355
384
|
}
|
|
356
385
|
})
|
|
357
386
|
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { mkdir, readFile, stat, writeFile } from 'fs/promises'
|
|
2
2
|
import { dirname, relative } from 'path'
|
|
3
3
|
|
|
4
|
+
// eslint-disable-next-line import/no-namespace
|
|
5
|
+
import * as JSONC from 'comment-json'
|
|
4
6
|
import unixify from 'unixify'
|
|
5
7
|
|
|
6
8
|
export const applySettings = (existingSettings, { denoBinary, edgeFunctionsPath, repositoryRoot }) => {
|
|
7
9
|
const relativeEdgeFunctionsPath = unixify(relative(repositoryRoot, edgeFunctionsPath))
|
|
8
|
-
const settings = {
|
|
9
|
-
...existingSettings,
|
|
10
|
+
const settings = JSONC.assign(existingSettings, {
|
|
10
11
|
'deno.enable': true,
|
|
11
12
|
'deno.enablePaths': existingSettings['deno.enablePaths'] || [],
|
|
12
13
|
'deno.unstable': true,
|
|
13
14
|
'deno.importMap': '.netlify/edge-functions-import-map.json',
|
|
14
|
-
}
|
|
15
|
+
})
|
|
15
16
|
|
|
16
17
|
// If the Edge Functions path isn't already in `deno.enabledPaths`, let's add
|
|
17
18
|
// it.
|
|
@@ -38,11 +39,11 @@ export const getSettings = async (settingsPath) => {
|
|
|
38
39
|
throw new Error(`${settingsPath} is not a valid file.`)
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
const file = await readFile(settingsPath)
|
|
42
|
+
const file = await readFile(settingsPath, 'utf8')
|
|
42
43
|
|
|
43
44
|
return {
|
|
44
45
|
fileExists: true,
|
|
45
|
-
settings:
|
|
46
|
+
settings: JSONC.parse(file),
|
|
46
47
|
}
|
|
47
48
|
} catch (error) {
|
|
48
49
|
if (error.code !== 'ENOENT') {
|
|
@@ -57,7 +58,7 @@ export const getSettings = async (settingsPath) => {
|
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
export const writeSettings = async ({ settings, settingsPath }) => {
|
|
60
|
-
const serializedSettings =
|
|
61
|
+
const serializedSettings = JSONC.stringify(settings, null, 2)
|
|
61
62
|
|
|
62
63
|
await mkdir(dirname(settingsPath), { recursive: true })
|
|
63
64
|
await writeFile(settingsPath, serializedSettings)
|