netlify-cli 17.23.5 → 17.23.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/dist/commands/build/build.d.ts.map +1 -1
- package/dist/commands/build/build.js +6 -12
- package/dist/commands/deploy/deploy.d.ts.map +1 -1
- package/dist/commands/deploy/deploy.js +10 -13
- package/dist/commands/dev/dev-exec.d.ts.map +1 -1
- package/dist/commands/dev/dev-exec.js +3 -6
- package/dist/commands/dev/dev.d.ts.map +1 -1
- package/dist/commands/dev/dev.js +3 -3
- package/dist/commands/env/env-clone.d.ts.map +1 -1
- package/dist/commands/env/env-clone.js +3 -105
- package/dist/commands/env/env-get.d.ts.map +1 -1
- package/dist/commands/env/env-get.js +3 -9
- package/dist/commands/env/env-import.d.ts.map +1 -1
- package/dist/commands/env/env-import.js +2 -25
- package/dist/commands/env/env-list.d.ts.map +1 -1
- package/dist/commands/env/env-list.js +14 -17
- package/dist/commands/env/env-set.d.ts.map +1 -1
- package/dist/commands/env/env-set.js +1 -33
- package/dist/commands/env/env-unset.d.ts.map +1 -1
- package/dist/commands/env/env-unset.js +2 -34
- package/dist/commands/functions/functions-create.js +2 -3
- package/dist/commands/integration/deploy.d.ts.map +1 -1
- package/dist/commands/integration/deploy.js +5 -2
- package/dist/commands/serve/serve.js +1 -1
- package/dist/commands/sites/sites-create-template.d.ts.map +1 -1
- package/dist/commands/sites/sites-create-template.js +13 -2
- package/dist/lib/exec-fetcher.d.ts +1 -1
- package/dist/lib/exec-fetcher.d.ts.map +1 -1
- package/dist/lib/exec-fetcher.js +2 -3
- package/dist/lib/functions/registry.js +1 -1
- package/dist/lib/functions/runtimes/js/index.d.ts +7 -5
- package/dist/lib/functions/runtimes/js/index.d.ts.map +1 -1
- package/dist/lib/functions/runtimes/js/index.js +4 -3
- package/dist/lib/functions/server.d.ts.map +1 -1
- package/dist/lib/functions/server.js +10 -11
- package/dist/lib/geo-location.js +2 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/functions/functions.d.ts +3 -3
- package/dist/utils/functions/functions.d.ts.map +1 -1
- package/dist/utils/functions/functions.js +0 -3
- package/dist/utils/gh-auth.js +1 -1
- package/dist/utils/live-tunnel.d.ts.map +1 -1
- package/dist/utils/live-tunnel.js +5 -1
- package/dist/utils/proxy.d.ts.map +1 -1
- package/dist/utils/proxy.js +3 -4
- package/dist/utils/read-repo-url.d.ts +1 -1
- package/dist/utils/read-repo-url.d.ts.map +1 -1
- package/dist/utils/sites/utils.d.ts +2 -2
- package/dist/utils/sites/utils.d.ts.map +1 -1
- package/dist/utils/sites/utils.js +1 -0
- package/functions-templates/go/hello-world/go.mod +1 -1
- package/functions-templates/javascript/scheduled-function/package.json +1 -1
- package/functions-templates/javascript/submission-created/package.json +1 -1
- package/functions-templates/rust/hello-world/Cargo.toml +1 -1
- package/functions-templates/typescript/hello-world/package-lock.json +38 -121
- package/functions-templates/typescript/hello-world/package.json +2 -2
- package/functions-templates/typescript/scheduled-function/package.json +2 -2
- package/npm-shrinkwrap.json +2609 -2566
- package/package.json +25 -25
|
@@ -14,7 +14,9 @@ import { getSiteNameInput } from './sites-create.js';
|
|
|
14
14
|
// @ts-expect-error TS(7006) FIXME: Parameter 'token' implicitly has an 'any' type.
|
|
15
15
|
export const fetchTemplates = async (token) => {
|
|
16
16
|
const templatesFromGithubOrg = await getTemplatesFromGitHub(token);
|
|
17
|
-
return (
|
|
17
|
+
return (
|
|
18
|
+
// @ts-expect-error TS(18046) - 'templatesFromGithubOrg' if of type 'unknown'
|
|
19
|
+
templatesFromGithubOrg
|
|
18
20
|
// @ts-expect-error TS(7006) FIXME: Parameter 'repo' implicitly has an 'any' type.
|
|
19
21
|
.filter((repo) => !repo.archived && !repo.disabled)
|
|
20
22
|
// @ts-expect-error TS(7006) FIXME: Parameter 'template' implicitly has an 'any' type.
|
|
@@ -97,14 +99,18 @@ export const sitesCreateTemplate = async (repository, options, command) => {
|
|
|
97
99
|
const siteName = inputName.trim();
|
|
98
100
|
// Create new repo from template
|
|
99
101
|
repoResp = await createRepo(templateName, ghToken, siteName || templateName);
|
|
102
|
+
// @ts-expect-error TS(18046) - 'repoResp' if of type 'unknown'
|
|
100
103
|
if (repoResp.errors) {
|
|
104
|
+
// @ts-expect-error TS(18046) - 'repoResp' if of type 'unknown'
|
|
101
105
|
if (repoResp.errors[0].includes('Name already exists on this account')) {
|
|
102
106
|
warn(`Oh no! We found already a repository with this name. It seems you have already created a template with the name ${templateName}. Please try to run the command again and provide a different name.`);
|
|
103
107
|
// @ts-expect-error TS(2554) FIXME: Expected 1 arguments, but got 0.
|
|
104
108
|
await inputSiteName();
|
|
105
109
|
}
|
|
106
110
|
else {
|
|
107
|
-
throw new Error(
|
|
111
|
+
throw new Error(
|
|
112
|
+
// @ts-expect-error TS(18046) - 'repoResp' if of type 'unknown'
|
|
113
|
+
`Oops! Seems like something went wrong trying to create the repository. We're getting the following error: '${repoResp.errors[0]}'. You can try to re-run this command again or open an issue in our repository: https://github.com/netlify/cli/issues`);
|
|
108
114
|
}
|
|
109
115
|
}
|
|
110
116
|
else {
|
|
@@ -113,8 +119,11 @@ export const sitesCreateTemplate = async (repository, options, command) => {
|
|
|
113
119
|
body: {
|
|
114
120
|
repo: {
|
|
115
121
|
provider: 'github',
|
|
122
|
+
// @ts-expect-error TS(18046) - 'repoResp' if of type 'unknown'
|
|
116
123
|
repo: repoResp.full_name,
|
|
124
|
+
// @ts-expect-error TS(18046) - 'repoResp' if of type 'unknown'
|
|
117
125
|
private: repoResp.private,
|
|
126
|
+
// @ts-expect-error TS(18046) - 'repoResp' if of type 'unknown'
|
|
118
127
|
branch: repoResp.default_branch,
|
|
119
128
|
},
|
|
120
129
|
name: siteName,
|
|
@@ -165,7 +174,9 @@ export const sitesCreateTemplate = async (repository, options, command) => {
|
|
|
165
174
|
});
|
|
166
175
|
if (cloneConfirm) {
|
|
167
176
|
log();
|
|
177
|
+
// @ts-expect-error TS(18046) - 'repoResp' if of type 'unknown'
|
|
168
178
|
await execa('git', ['clone', repoResp.clone_url, `${repoResp.name}`]);
|
|
179
|
+
// @ts-expect-error TS(18046) - 'repoResp' if of type 'unknown'
|
|
169
180
|
log(`🚀 Repository cloned successfully. You can find it under the ${chalk.magenta(repoResp.name)} folder`);
|
|
170
181
|
}
|
|
171
182
|
if (options.withCi) {
|
|
@@ -9,7 +9,7 @@ export declare const shouldFetchLatestVersion: ({ binPath, execArgs, execName, l
|
|
|
9
9
|
packageName: any;
|
|
10
10
|
pattern: any;
|
|
11
11
|
}) => Promise<boolean>;
|
|
12
|
-
export declare const getArch: () => "amd64" | "386" | "arm" | "arm64" | "mips" | "mipsel" | "ppc" | "ppc64" | "riscv64" | "s390" | "s390x";
|
|
12
|
+
export declare const getArch: () => "amd64" | "386" | "arm" | "arm64" | "loong64" | "mips" | "mipsel" | "ppc" | "ppc64" | "riscv64" | "s390" | "s390x";
|
|
13
13
|
/**
|
|
14
14
|
* Tries to get the latest release from the github releases to download the binary.
|
|
15
15
|
* Is throwing an error if there is no binary that matches the system os or arch
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec-fetcher.d.ts","sourceRoot":"","sources":["../../src/lib/exec-fetcher.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"exec-fetcher.d.ts","sourceRoot":"","sources":["../../src/lib/exec-fetcher.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,WAAW;;SAAiE,CAAA;AAsBzF,eAAO,MAAM,wBAAwB;;;;;;;sBA+CpC,CAAA;AAED,eAAO,MAAM,OAAO,0HASnB,CAAA;AAED;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,kBAAkB;;;;;;mBA6C9B,CAAA"}
|
package/dist/lib/exec-fetcher.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import process from 'process';
|
|
3
3
|
import { fetchLatest, fetchVersion, newerVersion, updateAvailable } from 'gh-release-fetch';
|
|
4
|
-
|
|
5
|
-
import isExe from 'isexe';
|
|
4
|
+
import { isexe } from 'isexe';
|
|
6
5
|
import { NETLIFYDEVWARN, error, getTerminalLink, log } from '../utils/command-helpers.js';
|
|
7
6
|
import execa from '../utils/execa.js';
|
|
8
7
|
const isWindows = () => process.platform === 'win32';
|
|
@@ -42,7 +41,7 @@ packageName,
|
|
|
42
41
|
// @ts-expect-error TS(7031) FIXME: Binding element 'pattern' implicitly has an 'any' ... Remove this comment to see the full error message
|
|
43
42
|
pattern, }) => {
|
|
44
43
|
const execPath = path.join(binPath, getExecName({ execName }));
|
|
45
|
-
const exists = await
|
|
44
|
+
const exists = await isexe(execPath, { ignoreErrors: true });
|
|
46
45
|
if (!exists) {
|
|
47
46
|
return true;
|
|
48
47
|
}
|
|
@@ -316,7 +316,7 @@ export class FunctionsRegistry {
|
|
|
316
316
|
func.mainFile = v2EntryPointPath;
|
|
317
317
|
}
|
|
318
318
|
catch {
|
|
319
|
-
func.mainFile = join(unzippedDirectory,
|
|
319
|
+
func.mainFile = join(unzippedDirectory, basename(manifestEntry.mainFile));
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
322
|
else {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type NetlifyFunction from '../../netlify-function.js';
|
|
2
|
+
import { $TSFixMe } from '../../../../commands/types.js';
|
|
1
3
|
export declare const name = "js";
|
|
2
4
|
export declare const getBuildFunction: ({ config, directory, errorExit, func, projectRoot }: {
|
|
3
5
|
config: any;
|
|
@@ -13,11 +15,11 @@ export declare const invokeFunction: ({ context, environment, event, func, timeo
|
|
|
13
15
|
func: any;
|
|
14
16
|
timeout: any;
|
|
15
17
|
}) => Promise<unknown>;
|
|
16
|
-
export declare const invokeFunctionDirectly: ({ context, event, func, timeout }: {
|
|
17
|
-
context:
|
|
18
|
-
event:
|
|
19
|
-
func:
|
|
20
|
-
timeout:
|
|
18
|
+
export declare const invokeFunctionDirectly: ({ context, event, func, timeout, }: {
|
|
19
|
+
context: $TSFixMe;
|
|
20
|
+
event: $TSFixMe;
|
|
21
|
+
func: NetlifyFunction;
|
|
22
|
+
timeout: number;
|
|
21
23
|
}) => Promise<unknown>;
|
|
22
24
|
export declare const onDirectoryScan: () => Promise<void>;
|
|
23
25
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/functions/runtimes/js/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/functions/runtimes/js/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,eAAe,MAAM,2BAA2B,CAAA;AAK5D,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AAExD,eAAO,MAAM,IAAI,OAAO,CAAA;AAqBxB,eAAO,MAAM,gBAAgB;;;;;;kBAsB5B,CAAA;AAKD,eAAO,MAAM,cAAc;;;;;;sBAsC1B,CAAA;AAED,eAAO,MAAM,sBAAsB;aAMxB,QAAQ;WACV,QAAQ;UACT,eAAe;aACZ,MAAM;sBAwBhB,CAAA;AAED,eAAO,MAAM,eAAe,qBAS3B,CAAA"}
|
|
@@ -77,11 +77,11 @@ export const invokeFunction = async ({ context, environment, event, func, timeou
|
|
|
77
77
|
worker.on('error', reject);
|
|
78
78
|
});
|
|
79
79
|
};
|
|
80
|
-
|
|
81
|
-
export const invokeFunctionDirectly = async ({ context, event, func, timeout }) => {
|
|
80
|
+
export const invokeFunctionDirectly = async ({ context, event, func, timeout, }) => {
|
|
82
81
|
// If a function builder has defined a `buildPath` property, we use it.
|
|
83
82
|
// Otherwise, we'll invoke the function's main file.
|
|
84
|
-
const
|
|
83
|
+
const { buildPath } = await func.getBuildData();
|
|
84
|
+
const lambdaPath = buildPath ?? func.mainFile;
|
|
85
85
|
const result = await lambdaLocal.execute({
|
|
86
86
|
clientContext: JSON.stringify(context),
|
|
87
87
|
environment: {
|
|
@@ -96,6 +96,7 @@ export const invokeFunctionDirectly = async ({ context, event, func, timeout })
|
|
|
96
96
|
lambdaPath,
|
|
97
97
|
timeoutMs: timeout * SECONDS_TO_MILLISECONDS,
|
|
98
98
|
verboseLevel: 3,
|
|
99
|
+
esm: lambdaPath.endsWith('.mjs'),
|
|
99
100
|
});
|
|
100
101
|
return result;
|
|
101
102
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/lib/functions/server.ts"],"names":[],"mappings":"AAIA,OAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,SAAS,CAAA;AAKtD,OAAO,KAAK,WAAW,MAAM,gCAAgC,CAAA;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/lib/functions/server.ts"],"names":[],"mappings":"AAIA,OAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,SAAS,CAAA;AAKtD,OAAO,KAAK,WAAW,MAAM,gCAAgC,CAAA;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAWvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAMrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAuDjD,eAAO,MAAM,aAAa,YAAsB,yBAAyB,KAAG,cA6K3E,CAAA;AAED,UAAU,yBAAyB;IACjC,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,QAAQ,CAAA;IACf,MAAM,EAAE,QAAQ,CAAA;IAChB,eAAe,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAA;CAC7C;AA4BD,eAAO,MAAM,oBAAoB,YACtB;IACP,YAAY,EAAE,YAAY,CAAA;IAC1B,OAAO,EAAE,WAAW,CAAA;IACpB,MAAM,EAAE,QAAQ,CAAA;IAChB,YAAY,EAAE,QAAQ,CAAA;IACtB,KAAK,EAAE,OAAO,CAAA;IACd,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,QAAQ,EAAE,QAAQ,CAAA;IAClB,IAAI,EAAE,QAAQ,CAAA;IACd,QAAQ,EAAE,QAAQ,CAAA;IAClB,QAAQ,EAAE,QAAQ,CAAA;CACnB,GAAG,KAAK,yBAAyB,EAAE,mBAAmB,CAAC,KACvD,QAAQ,iBAAiB,GAAG,SAAS,CAiFvC,CAAA"}
|
|
@@ -4,8 +4,9 @@ import path from 'path';
|
|
|
4
4
|
import express from 'express';
|
|
5
5
|
// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'expr... Remove this comment to see the full error message
|
|
6
6
|
import expressLogging from 'express-logging';
|
|
7
|
-
import jwtDecode from 'jwt-decode';
|
|
7
|
+
import { jwtDecode } from 'jwt-decode';
|
|
8
8
|
import { NETLIFYDEVERR, NETLIFYDEVLOG, error as errorExit, log } from '../../utils/command-helpers.js';
|
|
9
|
+
import { UNLINKED_SITE_MOCK_ID } from '../../utils/dev.js';
|
|
9
10
|
import { isFeatureFlagEnabled } from '../../utils/feature-flags.js';
|
|
10
11
|
import { CLOCKWORK_USERAGENT, getFunctionsDistPath, getFunctionsServePath, getInternalFunctionsDir, } from '../../utils/functions/index.js';
|
|
11
12
|
import { NFFunctionName, NFFunctionRoute } from '../../utils/headers.js';
|
|
@@ -17,7 +18,6 @@ import { FunctionsRegistry } from './registry.js';
|
|
|
17
18
|
import { handleScheduledFunction } from './scheduled.js';
|
|
18
19
|
import { handleSynchronousFunction } from './synchronous.js';
|
|
19
20
|
import { shouldBase64Encode } from './utils.js';
|
|
20
|
-
import { UNLINKED_SITE_MOCK_ID } from '../../utils/dev.js';
|
|
21
21
|
// @ts-expect-error TS(7006) FIXME: Parameter 'headers' implicitly has an 'any' type.
|
|
22
22
|
const buildClientContext = function (headers) {
|
|
23
23
|
// inject a client context based on auth header, ported over from netlify-lambda (https://github.com/netlify/netlify-lambda/pull/57)
|
|
@@ -27,7 +27,7 @@ const buildClientContext = function (headers) {
|
|
|
27
27
|
if (parts.length !== 2 || parts[0] !== 'Bearer')
|
|
28
28
|
return;
|
|
29
29
|
const identity = {
|
|
30
|
-
url: 'https://netlify-dev-locally-emulated-identity.netlify.
|
|
30
|
+
url: 'https://netlify-dev-locally-emulated-identity.netlify.app/.netlify/identity',
|
|
31
31
|
token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzb3VyY2UiOiJuZXRsaWZ5IGRldiIsInRlc3REYXRhIjoiTkVUTElGWV9ERVZfTE9DQUxMWV9FTVVMQVRFRF9JREVOVElUWSJ9.2eSDqUOZAOBsx39FHFePjYj12k0LrxldvGnlvDu3GMI',
|
|
32
32
|
// you can decode this with https://jwt.io/
|
|
33
33
|
// just says
|
|
@@ -39,15 +39,14 @@ const buildClientContext = function (headers) {
|
|
|
39
39
|
try {
|
|
40
40
|
// This data is available on both the context root and under custom.netlify for retro-compatibility.
|
|
41
41
|
// In the future it will only be available in custom.netlify.
|
|
42
|
-
// @ts-expect-error
|
|
43
42
|
const user = jwtDecode(parts[1]);
|
|
44
43
|
const netlifyContext = JSON.stringify({
|
|
45
|
-
identity
|
|
46
|
-
user
|
|
44
|
+
identity,
|
|
45
|
+
user,
|
|
47
46
|
});
|
|
48
47
|
return {
|
|
49
|
-
identity
|
|
50
|
-
user
|
|
48
|
+
identity,
|
|
49
|
+
user,
|
|
51
50
|
custom: {
|
|
52
51
|
netlify: Buffer.from(netlifyContext).toString('base64'),
|
|
53
52
|
},
|
|
@@ -224,14 +223,14 @@ const getFunctionsServer = (options) => {
|
|
|
224
223
|
};
|
|
225
224
|
export const startFunctionsServer = async (options) => {
|
|
226
225
|
const { blobsContext, capabilities, command, config, debug, loadDistFunctions, settings, site, siteInfo, siteUrl, timeouts, } = options;
|
|
227
|
-
const internalFunctionsDir = await getInternalFunctionsDir({ base: site.root });
|
|
226
|
+
const internalFunctionsDir = await getInternalFunctionsDir({ base: site.root, packagePath: command.workspacePackage });
|
|
228
227
|
const functionsDirectories = [];
|
|
229
228
|
let manifest;
|
|
230
229
|
// If the `loadDistFunctions` parameter is sent, the functions server will
|
|
231
230
|
// use the built functions created by zip-it-and-ship-it rather than building
|
|
232
231
|
// them from source.
|
|
233
232
|
if (loadDistFunctions) {
|
|
234
|
-
const distPath = await getFunctionsDistPath({ base: site.root });
|
|
233
|
+
const distPath = await getFunctionsDistPath({ base: site.root, packagePath: command.workspacePackage });
|
|
235
234
|
if (distPath) {
|
|
236
235
|
functionsDirectories.push(distPath);
|
|
237
236
|
// When using built functions, read the manifest file so that we can
|
|
@@ -254,7 +253,7 @@ export const startFunctionsServer = async (options) => {
|
|
|
254
253
|
functionsDirectories.push(...sourceDirectories);
|
|
255
254
|
}
|
|
256
255
|
try {
|
|
257
|
-
const functionsServePath = getFunctionsServePath({ base: site.root });
|
|
256
|
+
const functionsServePath = getFunctionsServePath({ base: site.root, packagePath: command.workspacePackage });
|
|
258
257
|
await fs.rm(functionsServePath, { force: true, recursive: true });
|
|
259
258
|
}
|
|
260
259
|
catch {
|
package/dist/lib/geo-location.js
CHANGED
|
@@ -99,8 +99,9 @@ export const getGeoLocation = async ({ geoCountry, mode, offline, state }) => {
|
|
|
99
99
|
const getGeoLocationFromAPI = async () => {
|
|
100
100
|
const res = await fetch(API_URL, {
|
|
101
101
|
method: 'GET',
|
|
102
|
-
|
|
102
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT),
|
|
103
103
|
});
|
|
104
|
+
// @ts-expect-error TS(2339) - Property 'geo' does not exist on type 'unknown'
|
|
104
105
|
const { geo } = await res.json();
|
|
105
106
|
return geo;
|
|
106
107
|
};
|