netlify-cli 18.1.0 → 19.0.0-pre.4b63f12
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/base-command.d.ts.map +1 -1
- package/dist/commands/base-command.js +2 -13
- package/dist/commands/blobs/blobs.js +2 -2
- package/dist/commands/build/build.d.ts +4 -11
- package/dist/commands/build/build.d.ts.map +1 -1
- package/dist/commands/build/build.js +1 -7
- package/dist/commands/build/index.js +1 -1
- package/dist/commands/completion/completion.d.ts +4 -4
- package/dist/commands/completion/completion.d.ts.map +1 -1
- package/dist/commands/completion/completion.js +4 -5
- package/dist/commands/deploy/index.d.ts.map +1 -1
- package/dist/commands/deploy/index.js +5 -6
- package/dist/commands/dev/dev.d.ts.map +1 -1
- package/dist/commands/dev/dev.js +1 -15
- package/dist/commands/env/env-list.d.ts +2 -2
- package/dist/commands/env/env-list.d.ts.map +1 -1
- package/dist/commands/env/env.d.ts.map +1 -1
- package/dist/commands/env/env.js +5 -4
- package/dist/commands/functions/functions.d.ts +1 -1
- package/dist/commands/functions/functions.d.ts.map +1 -1
- package/dist/commands/functions/functions.js +4 -2
- package/dist/commands/init/index.d.ts.map +1 -1
- package/dist/commands/init/index.js +0 -2
- package/dist/commands/link/index.d.ts.map +1 -1
- package/dist/commands/link/index.js +0 -2
- package/dist/commands/main.d.ts.map +1 -1
- package/dist/commands/main.js +0 -3
- package/dist/commands/serve/index.d.ts.map +1 -1
- package/dist/commands/serve/index.js +1 -4
- package/dist/commands/status/index.d.ts +1 -1
- package/dist/commands/status/index.d.ts.map +1 -1
- package/dist/commands/status/index.js +2 -1
- package/dist/lib/build.d.ts +36 -67
- package/dist/lib/build.d.ts.map +1 -1
- package/dist/lib/build.js +6 -41
- package/dist/lib/completion/script.js +3 -13
- package/dist/lib/functions/form-submissions-handler.d.ts.map +1 -1
- package/dist/lib/functions/form-submissions-handler.js +0 -2
- package/dist/lib/functions/runtimes/js/builders/netlify-lambda.d.ts.map +1 -1
- package/dist/lib/functions/runtimes/js/builders/netlify-lambda.js +8 -7
- package/dist/lib/functions/runtimes/js/builders/zisi.d.ts.map +1 -1
- package/dist/lib/functions/runtimes/js/builders/zisi.js +0 -1
- package/dist/lib/functions/runtimes/js/worker.js +0 -1
- package/dist/recipes/vscode/settings.d.ts.map +1 -1
- package/dist/recipes/vscode/settings.js +5 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/command-helpers.d.ts +2 -2
- package/dist/utils/command-helpers.js +1 -1
- package/dist/utils/deploy/hash-files.js +3 -3
- package/dist/utils/deploy/hash-fns.d.ts.map +1 -1
- package/dist/utils/deploy/hash-fns.js +3 -2
- package/dist/utils/deploy/hasher-segments.d.ts +3 -3
- package/dist/utils/deploy/hasher-segments.d.ts.map +1 -1
- package/dist/utils/deploy/hasher-segments.js +2 -9
- package/dist/utils/get-global-config.d.ts.map +1 -1
- package/dist/utils/get-global-config.js +2 -2
- package/dist/utils/get-repo-data.d.ts +4 -4
- package/dist/utils/get-repo-data.d.ts.map +1 -1
- package/dist/utils/get-repo-data.js +7 -6
- package/dist/utils/open-browser.d.ts.map +1 -1
- package/dist/utils/open-browser.js +1 -2
- package/dist/utils/proxy.d.ts.map +1 -1
- package/dist/utils/proxy.js +3 -5
- package/dist/utils/rules-proxy.d.ts.map +1 -1
- package/dist/utils/rules-proxy.js +0 -1
- package/dist/utils/run-build.d.ts.map +1 -1
- package/dist/utils/run-build.js +7 -2
- package/dist/utils/sites/create-template.d.ts.map +1 -1
- package/dist/utils/sites/create-template.js +2 -3
- package/dist/utils/state-config.d.ts.map +1 -1
- package/dist/utils/state-config.js +0 -1
- package/dist/utils/types.d.ts +7 -0
- package/dist/utils/types.d.ts.map +1 -1
- package/npm-shrinkwrap.json +29926 -12308
- package/package.json +11 -15
- package/scripts/prepare-for-publish.js +48 -34
- package/dist/commands/integration/deploy.d.ts +0 -8
- package/dist/commands/integration/deploy.d.ts.map +0 -1
- package/dist/commands/integration/deploy.js +0 -353
- package/dist/commands/integration/index.d.ts +0 -4
- package/dist/commands/integration/index.d.ts.map +0 -1
- package/dist/commands/integration/index.js +0 -26
package/dist/lib/build.js
CHANGED
|
@@ -6,43 +6,12 @@ import tomlify from 'tomlify-j0.4';
|
|
|
6
6
|
import { getFeatureFlagsFromSiteInfo } from '../utils/feature-flags.js';
|
|
7
7
|
import { getBootstrapURL } from './edge-functions/bootstrap.js';
|
|
8
8
|
import { featureFlags as edgeFunctionsFeatureFlags } from './edge-functions/consts.js';
|
|
9
|
-
/**
|
|
10
|
-
* The buildConfig + a missing cachedConfig
|
|
11
|
-
* @typedef BuildConfig
|
|
12
|
-
* @type {Parameters<import('@netlify/build/src/core/main.js')>[0] & {cachedConfig: any}}
|
|
13
|
-
*/
|
|
14
9
|
// We have already resolved the configuration using `@netlify/config`
|
|
15
10
|
// This is stored as `netlify.cachedConfig` and can be passed to
|
|
16
11
|
// `@netlify/build --cachedConfig`.
|
|
17
|
-
|
|
18
|
-
*
|
|
19
|
-
* @param {object} config
|
|
20
|
-
* @param {*} config.cachedConfig
|
|
21
|
-
* @param {string} [config.packagePath]
|
|
22
|
-
* @param {string} config.currentDir
|
|
23
|
-
* @param {string} config.token
|
|
24
|
-
* @param {import('commander').OptionValues} config.options
|
|
25
|
-
* @param {*} config.deployHandler
|
|
26
|
-
* @returns {BuildConfig}
|
|
27
|
-
*/
|
|
28
|
-
export const getBuildOptions = async ({
|
|
29
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'cachedConfig' implicitly has an '... Remove this comment to see the full error message
|
|
30
|
-
cachedConfig,
|
|
31
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'currentDir' implicitly has an 'an... Remove this comment to see the full error message
|
|
32
|
-
currentDir,
|
|
33
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'defaultConfig' implicitly has an '... Remove this comment to see the full error message
|
|
34
|
-
defaultConfig,
|
|
35
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'deployHandler' implicitly has an ... Remove this comment to see the full error message
|
|
36
|
-
deployHandler,
|
|
37
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'context' implicitly has an 'any' ... Remove this comment to see the full error message
|
|
38
|
-
options: { context, cwd, debug, dry, json, offline, silent },
|
|
39
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'packagePath' implicitly has an 'a... Remove this comment to see the full error message
|
|
40
|
-
packagePath,
|
|
41
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'token' implicitly has an 'any' ty... Remove this comment to see the full error message
|
|
42
|
-
token, }) => {
|
|
12
|
+
export const getBuildOptions = async ({ cachedConfig, currentDir, defaultConfig, deployHandler, options: { context, cwd, debug, dry, json, offline, silent }, packagePath, token, }) => {
|
|
43
13
|
const eventHandlers = {
|
|
44
14
|
onEnd: {
|
|
45
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'netlifyConfig' implicitly has an ... Remove this comment to see the full error message
|
|
46
15
|
handler: ({ netlifyConfig }) => {
|
|
47
16
|
const string = tomlify.toToml(netlifyConfig);
|
|
48
17
|
if (!fs.existsSync(`${currentDir}/.netlify`)) {
|
|
@@ -55,7 +24,6 @@ token, }) => {
|
|
|
55
24
|
},
|
|
56
25
|
};
|
|
57
26
|
if (deployHandler) {
|
|
58
|
-
// @ts-expect-error TS(2339) FIXME: Property 'onPostBuild' does not exist on type '{ o... Remove this comment to see the full error message
|
|
59
27
|
eventHandlers.onPostBuild = {
|
|
60
28
|
handler: deployHandler,
|
|
61
29
|
description: 'Deploy Site',
|
|
@@ -63,11 +31,11 @@ token, }) => {
|
|
|
63
31
|
}
|
|
64
32
|
return {
|
|
65
33
|
cachedConfig,
|
|
66
|
-
defaultConfig,
|
|
34
|
+
defaultConfig: defaultConfig ?? {},
|
|
67
35
|
siteId: cachedConfig.siteInfo.id,
|
|
68
36
|
accountId: cachedConfig.siteInfo.account_id,
|
|
69
37
|
packagePath,
|
|
70
|
-
token,
|
|
38
|
+
token: token ?? undefined,
|
|
71
39
|
dry,
|
|
72
40
|
debug,
|
|
73
41
|
context,
|
|
@@ -82,16 +50,11 @@ token, }) => {
|
|
|
82
50
|
...getFeatureFlagsFromSiteInfo(cachedConfig.siteInfo),
|
|
83
51
|
functionsBundlingManifest: true,
|
|
84
52
|
},
|
|
53
|
+
// @ts-expect-error(serhalp) -- TODO(serhalp) Upstream the type fixes above into @netlify/build
|
|
85
54
|
eventHandlers,
|
|
86
55
|
edgeFunctionsBootstrapURL: await getBootstrapURL(),
|
|
87
56
|
};
|
|
88
57
|
};
|
|
89
|
-
/**
|
|
90
|
-
* run the build command
|
|
91
|
-
* @param {BuildConfig} options
|
|
92
|
-
* @returns
|
|
93
|
-
*/
|
|
94
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
|
|
95
58
|
export const runBuild = async (options) => {
|
|
96
59
|
// If netlify NETLIFY_API_URL is set we need to pass this information to @netlify/build
|
|
97
60
|
// TODO don't use testOpts, but add real properties to do this.
|
|
@@ -101,6 +64,8 @@ export const runBuild = async (options) => {
|
|
|
101
64
|
scheme: apiUrl.protocol.slice(0, -1),
|
|
102
65
|
host: apiUrl.host,
|
|
103
66
|
};
|
|
67
|
+
// @ts-expect-error(serhalp) -- I don't know what's going on here and I can't convince myself it even works as
|
|
68
|
+
// intended. TODO(serhalp) Investigate and fix types.
|
|
104
69
|
options = { ...options, testOpts };
|
|
105
70
|
}
|
|
106
71
|
const { configMutations, netlifyConfig: newConfig, severityCode: exitCode } = await build(options);
|
|
@@ -4,25 +4,15 @@
|
|
|
4
4
|
// if this file is renamed or moved then it needs to be adapted there
|
|
5
5
|
import { existsSync, readFileSync } from 'fs';
|
|
6
6
|
import process from 'process';
|
|
7
|
-
|
|
8
|
-
import { log, parseEnv } from 'tabtab';
|
|
7
|
+
import { getShellFromEnv, log, parseEnv } from '@pnpm/tabtab';
|
|
9
8
|
import { AUTOCOMPLETION_FILE } from './constants.js';
|
|
10
9
|
import getAutocompletion from './get-autocompletion.js';
|
|
11
|
-
/**
|
|
12
|
-
* @typedef CompletionItem
|
|
13
|
-
* @type import('tabtab').CompletionItem
|
|
14
|
-
*/
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
* @param {import('tabtab').TabtabEnv} env
|
|
18
|
-
* @param {Record<string, CompletionItem & {options: CompletionItem[]}>} program
|
|
19
|
-
* @returns {CompletionItem[]|void}
|
|
20
|
-
*/
|
|
21
10
|
const env = parseEnv(process.env);
|
|
11
|
+
const shell = getShellFromEnv(process.env);
|
|
22
12
|
if (existsSync(AUTOCOMPLETION_FILE)) {
|
|
23
13
|
const program = JSON.parse(readFileSync(AUTOCOMPLETION_FILE, 'utf-8'));
|
|
24
14
|
const autocomplete = getAutocompletion(env, program);
|
|
25
15
|
if (autocomplete && autocomplete.length !== 0) {
|
|
26
|
-
log(autocomplete);
|
|
16
|
+
log(autocomplete, shell);
|
|
27
17
|
}
|
|
28
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-submissions-handler.d.ts","sourceRoot":"","sources":["../../../src/lib/functions/form-submissions-handler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"form-submissions-handler.d.ts","sourceRoot":"","sources":["../../../src/lib/functions/form-submissions-handler.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAS7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEtD,eAAO,MAAM,cAAc,uCAGxB;IACD,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,uBAmBA,CAAA;AAED,eAAO,MAAM,2BAA2B,oCAGrC;IACD,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,OAAO,EAAE,MAAM,CAAA;CAChB,KAAG,cAwIH,CAAA"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { Readable } from 'stream';
|
|
2
|
-
// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'cont... Remove this comment to see the full error message
|
|
3
2
|
import { parse as parseContentType } from 'content-type';
|
|
4
|
-
// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'mult... Remove this comment to see the full error message
|
|
5
3
|
import multiparty from 'multiparty';
|
|
6
4
|
import getRawBody from 'raw-body';
|
|
7
5
|
import { warn } from '../../utils/command-helpers.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"netlify-lambda.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/functions/runtimes/js/builders/netlify-lambda.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,mBAAmB;;;;;;;;
|
|
1
|
+
{"version":3,"file":"netlify-lambda.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/functions/runtimes/js/builders/netlify-lambda.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,mBAAmB;;;;;;;;EAuD/B,CAAA;AAED,wBAA8B,OAAO;;;;;;;;GASpC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFile } from 'fs/promises';
|
|
2
2
|
import { resolve } from 'path';
|
|
3
|
-
import {
|
|
3
|
+
import { Command } from 'commander';
|
|
4
4
|
import execa from '../../../../../utils/execa.js';
|
|
5
5
|
import { fileExistsAsync } from '../../../../fs.js';
|
|
6
6
|
import { memoizedBuild } from '../../../memoized-build.js';
|
|
@@ -10,17 +10,18 @@ export const detectNetlifyLambda = async function ({ packageJson } = {}) {
|
|
|
10
10
|
if (!((dependencies && dependencies['netlify-lambda']) || (devDependencies && devDependencies['netlify-lambda']))) {
|
|
11
11
|
return false;
|
|
12
12
|
}
|
|
13
|
+
const program = new Command()
|
|
14
|
+
.option('-s, --static')
|
|
15
|
+
.option('-c, --config [file]')
|
|
16
|
+
.option('-p, --port [number]')
|
|
17
|
+
.option('-b, --babelrc [file]')
|
|
18
|
+
.option('-t, --timeout [delay]');
|
|
19
|
+
program.allowExcessArguments();
|
|
13
20
|
// @ts-expect-error TS(2571) FIXME: Object is of type 'unknown'.
|
|
14
21
|
const matchingScripts = Object.entries(scripts).filter(([, script]) => script.match(/netlify-lambda\s+build/));
|
|
15
22
|
for (const [key, script] of matchingScripts) {
|
|
16
23
|
// E.g. ["netlify-lambda", "build", "functions/folder"]
|
|
17
24
|
// these are all valid options for netlify-lambda
|
|
18
|
-
program
|
|
19
|
-
.option('-s, --static')
|
|
20
|
-
.option('-c, --config [file]')
|
|
21
|
-
.option('-p, --port [number]')
|
|
22
|
-
.option('-b, --babelrc [file]')
|
|
23
|
-
.option('-t, --timeout [delay]');
|
|
24
25
|
program.parse(script.split(' ') ?? []);
|
|
25
26
|
// We are not interested in 'netlify-lambda' and 'build' commands
|
|
26
27
|
const functionDirectories = program.args.filter((arg) => !['netlify-lambda', 'build'].includes(arg));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zisi.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/functions/runtimes/js/builders/zisi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zisi.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/functions/runtimes/js/builders/zisi.ts"],"names":[],"mappings":"AA+GA;;;;;GAKG;AAEH,eAAO,MAAM,wBAAwB;;;;+EAMjC,CAAA;AAoCJ;;;;;;;;;GASG;AAEH,wBAA8B,OAAO,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE;;;;;;;CAAA;;;;;;;;;;;;;;;;GAoDlG"}
|
|
@@ -4,7 +4,6 @@ import path from 'path';
|
|
|
4
4
|
import { zipFunction, listFunction } from '@netlify/zip-it-and-ship-it';
|
|
5
5
|
import decache from 'decache';
|
|
6
6
|
import { readPackageUp } from 'read-package-up';
|
|
7
|
-
// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'sour... Remove this comment to see the full error message
|
|
8
7
|
import sourceMapSupport from 'source-map-support';
|
|
9
8
|
import { NETLIFYDEVERR } from '../../../../../utils/command-helpers.js';
|
|
10
9
|
import { SERVE_FUNCTIONS_FOLDER } from '../../../../../utils/functions/functions.js';
|
|
@@ -3,7 +3,6 @@ import process from 'process';
|
|
|
3
3
|
import { isMainThread, workerData, parentPort } from 'worker_threads';
|
|
4
4
|
import { isStream } from 'is-stream';
|
|
5
5
|
import lambdaLocal from 'lambda-local';
|
|
6
|
-
// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'sour... Remove this comment to see the full error message
|
|
7
6
|
import sourceMapSupport from 'source-map-support';
|
|
8
7
|
if (isMainThread) {
|
|
9
8
|
throw new Error(`Do not import "${import.meta.url}" in the main thread.`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../src/recipes/vscode/settings.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAKrC,eAAO,MAAM,aAAa;;;;
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../src/recipes/vscode/settings.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAKrC,eAAO,MAAM,aAAa;;;;SA0BzB,CAAA;AAGD,eAAO,MAAM,WAAW;;;;;;EA0BvB,CAAA;AAGD,eAAO,MAAM,aAAa;;;mBAKzB,CAAA"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { mkdir, readFile, stat, writeFile } from 'fs/promises';
|
|
2
|
-
import { dirname, relative } from 'path';
|
|
2
|
+
import { dirname, posix, relative } from 'path';
|
|
3
3
|
import * as JSONC from 'comment-json';
|
|
4
|
-
|
|
5
|
-
import unixify from 'unixify';
|
|
4
|
+
const toUnixPath = (path) => path.replace(/\\/g, '/');
|
|
6
5
|
// @ts-expect-error TS(7006) FIXME: Parameter 'existingSettings' implicitly has an 'an... Remove this comment to see the full error message
|
|
7
6
|
export const applySettings = (existingSettings, { denoBinary, edgeFunctionsPath, repositoryRoot }) => {
|
|
8
|
-
|
|
7
|
+
// TODO(serhalp) I'm not convinced we want to convert to Unix paths on Windows? Does this even work? Was this a
|
|
8
|
+
// workaround for something, perhaps https://github.com/denoland/vscode_deno/pull/745?
|
|
9
|
+
const relativeEdgeFunctionsPath = toUnixPath(posix.normalize(relative(repositoryRoot, edgeFunctionsPath)));
|
|
9
10
|
const settings = JSONC.assign(existingSettings, {
|
|
10
11
|
'deno.enable': true,
|
|
11
12
|
'deno.enablePaths': existingSettings['deno.enablePaths'] || [],
|