netlify-cli 17.26.3 → 17.27.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/dist/commands/dev/dev.d.ts.map +1 -1
- package/dist/commands/dev/dev.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/proxy-server.d.ts +2 -1
- package/dist/utils/proxy-server.d.ts.map +1 -1
- package/dist/utils/proxy-server.js +2 -1
- package/dist/utils/proxy.d.ts +1 -1
- package/dist/utils/proxy.d.ts.map +1 -1
- package/dist/utils/proxy.js +14 -2
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -10,9 +10,10 @@ interface InspectSettings {
|
|
|
10
10
|
address?: string;
|
|
11
11
|
}
|
|
12
12
|
export declare const generateInspectSettings: (edgeInspect: boolean | string, edgeInspectBrk: boolean | string) => InspectSettings;
|
|
13
|
-
export declare const startProxyServer: ({ accountId, addonsUrls, blobsContext, command, config, configPath, debug, disableEdgeFunctions, env, functionsRegistry, geoCountry, geolocationMode, getUpdatedConfig, inspectSettings, offline, projectDir, repositoryRoot, settings, site, siteInfo, state, }: {
|
|
13
|
+
export declare const startProxyServer: ({ accountId, addonsUrls, api, blobsContext, command, config, configPath, debug, disableEdgeFunctions, env, functionsRegistry, geoCountry, geolocationMode, getUpdatedConfig, inspectSettings, offline, projectDir, repositoryRoot, settings, site, siteInfo, state, }: {
|
|
14
14
|
accountId: string;
|
|
15
15
|
addonsUrls: $TSFixMe;
|
|
16
|
+
api?: (import("netlify").NetlifyAPI & Record<string, (...args: any) => Promise<any>>) | undefined;
|
|
16
17
|
blobsContext?: BlobsContextWithEdgeAccess | undefined;
|
|
17
18
|
command: BaseCommand;
|
|
18
19
|
config: NetlifyOptions['config'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy-server.d.ts","sourceRoot":"","sources":["../../src/utils/proxy-server.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM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;;WAGzB,OAAO;0BACQ,OAAO;SACxB,cAAc,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC;qBACzB,eAAe;sBACd,MAAM,QAAQ,MAAM,CAAC;qBACtB,MAAM;gBACX,MAAM;cACR,cAAc;aACf,OAAO;UACV,QAAQ;cACJ,QAAQ;gBACN,MAAM;;WAEX,WAAW;;qBAgCnB,CAAA"}
|
|
@@ -17,7 +17,7 @@ export const generateInspectSettings = (edgeInspect, edgeInspectBrk) => {
|
|
|
17
17
|
address: getAddress(),
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
export const startProxyServer = async ({ accountId, addonsUrls, blobsContext, command, config, configPath, debug, disableEdgeFunctions, env, functionsRegistry, geoCountry, geolocationMode, getUpdatedConfig, inspectSettings, offline, projectDir, repositoryRoot, settings, site, siteInfo, state, }) => {
|
|
20
|
+
export const startProxyServer = async ({ accountId, addonsUrls, api, blobsContext, command, config, configPath, debug, disableEdgeFunctions, env, functionsRegistry, geoCountry, geolocationMode, getUpdatedConfig, inspectSettings, offline, projectDir, repositoryRoot, settings, site, siteInfo, state, }) => {
|
|
21
21
|
const url = await startProxy({
|
|
22
22
|
addonsUrls,
|
|
23
23
|
blobsContext,
|
|
@@ -39,6 +39,7 @@ export const startProxyServer = async ({ accountId, addonsUrls, blobsContext, co
|
|
|
39
39
|
siteInfo,
|
|
40
40
|
accountId,
|
|
41
41
|
repositoryRoot,
|
|
42
|
+
api,
|
|
42
43
|
});
|
|
43
44
|
if (!url) {
|
|
44
45
|
log(NETLIFYDEVERR, `Unable to start proxy server on port '${settings.port}'`);
|
package/dist/utils/proxy.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { BaseCommand } from '../commands/index.js';
|
|
|
2
2
|
import { $TSFixMe } from '../commands/types.js';
|
|
3
3
|
import { ServerSettings } from './types.js';
|
|
4
4
|
export declare const getProxyUrl: (settings: Pick<ServerSettings, 'https' | 'port'>) => string;
|
|
5
|
-
export declare const startProxy: ({ accountId, addonsUrls, blobsContext, command, config, configPath, debug, disableEdgeFunctions, env, functionsRegistry, geoCountry, geolocationMode, getUpdatedConfig, inspectSettings, offline, projectDir, repositoryRoot, settings, siteInfo, state, }: {
|
|
5
|
+
export declare const startProxy: ({ accountId, addonsUrls, api, blobsContext, command, config, configPath, debug, disableEdgeFunctions, env, functionsRegistry, geoCountry, geolocationMode, getUpdatedConfig, inspectSettings, offline, projectDir, repositoryRoot, settings, siteInfo, state, }: {
|
|
6
6
|
command: BaseCommand;
|
|
7
7
|
settings: ServerSettings;
|
|
8
8
|
disableEdgeFunctions: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../src/utils/proxy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../src/utils/proxy.ts"],"names":[],"mappings":"AA6BA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAkB,MAAM,sBAAsB,CAAA;AAkB/D,OAAO,EAAqB,cAAc,EAAE,MAAM,YAAY,CAAA;AAqxB9D,eAAO,MAAM,WAAW,aAAuB,KAAK,cAAc,EAAE,OAAO,GAAG,MAAM,CAAC,WAGpF,CAAA;AAID,eAAO,MAAM,UAAU;aAsBT,WAAW;cAAY,cAAc;0BAAwB,OAAO;2CA4GjF,CAAA"}
|
package/dist/utils/proxy.js
CHANGED
|
@@ -5,6 +5,7 @@ import http from 'http';
|
|
|
5
5
|
import https from 'https';
|
|
6
6
|
import { isIPv6 } from 'net';
|
|
7
7
|
import path from 'path';
|
|
8
|
+
import process from 'process';
|
|
8
9
|
import util from 'util';
|
|
9
10
|
import zlib from 'zlib';
|
|
10
11
|
// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'cont... Remove this comment to see the full error message
|
|
@@ -21,6 +22,7 @@ import { jwtDecode } from 'jwt-decode';
|
|
|
21
22
|
import { locatePath } from 'locate-path';
|
|
22
23
|
import pFilter from 'p-filter';
|
|
23
24
|
import toReadableStream from 'to-readable-stream';
|
|
25
|
+
import throttle from 'lodash/throttle.js';
|
|
24
26
|
import { handleProxyRequest, initializeProxy as initializeEdgeFunctionsProxy, isEdgeFunctionsRequest, } from '../lib/edge-functions/proxy.js';
|
|
25
27
|
import { fileExistsAsync, isFileAsync } from '../lib/fs.js';
|
|
26
28
|
import { getFormHandler } from '../lib/functions/form-submissions-handler.js';
|
|
@@ -176,6 +178,12 @@ const alternativePathsFor = function (url) {
|
|
|
176
178
|
}
|
|
177
179
|
return paths;
|
|
178
180
|
};
|
|
181
|
+
const notifyActivity = throttle((api, siteId, devServerId) => {
|
|
182
|
+
// eslint-disable-next-line promise/prefer-await-to-callbacks, promise/prefer-await-to-then
|
|
183
|
+
api.markDevServerActivity({ siteId, devServerId }).catch((error) => {
|
|
184
|
+
console.error(`${NETLIFYDEVWARN} Failed to notify activity`, error);
|
|
185
|
+
});
|
|
186
|
+
}, 30 * 1000);
|
|
179
187
|
const serveRedirect = async function ({ env, functionsRegistry, imageProxy, match, options, proxy, req, res, siteInfo, }) {
|
|
180
188
|
if (!match)
|
|
181
189
|
return proxy.web(req, res, options);
|
|
@@ -552,7 +560,7 @@ const initializeProxy = async function ({ config, configPath, distDir, env, host
|
|
|
552
560
|
};
|
|
553
561
|
return handlers;
|
|
554
562
|
};
|
|
555
|
-
const onRequest = async ({ addonsUrls, edgeFunctionsProxy, env, functionsRegistry, functionsServer, imageProxy, proxy, rewriter, settings, siteInfo, }, req, res) => {
|
|
563
|
+
const onRequest = async ({ addonsUrls, api, edgeFunctionsProxy, env, functionsRegistry, functionsServer, imageProxy, proxy, rewriter, settings, siteInfo, }, req, res) => {
|
|
556
564
|
req.originalBody =
|
|
557
565
|
req.method && ['GET', 'OPTIONS', 'HEAD'].includes(req.method) ? null : await createStreamPromise(req, BYTES_LIMIT);
|
|
558
566
|
if (isImageRequest(req)) {
|
|
@@ -594,6 +602,9 @@ const onRequest = async ({ addonsUrls, edgeFunctionsProxy, env, functionsRegistr
|
|
|
594
602
|
jwtRolePath: settings.jwtRolePath,
|
|
595
603
|
framework: settings.framework,
|
|
596
604
|
};
|
|
605
|
+
if (api && process.env.NETLIFY_DEV_SERVER_ID) {
|
|
606
|
+
notifyActivity(api, siteInfo.id, process.env.NETLIFY_DEV_SERVER_ID);
|
|
607
|
+
}
|
|
597
608
|
if (match) {
|
|
598
609
|
// We don't want to generate an ETag for 3xx redirects.
|
|
599
610
|
// @ts-expect-error TS(7031) FIXME: Binding element 'statusCode' implicitly has an 'an... Remove this comment to see the full error message
|
|
@@ -620,7 +631,7 @@ export const getProxyUrl = function (settings) {
|
|
|
620
631
|
const scheme = settings.https ? 'https' : 'http';
|
|
621
632
|
return `${scheme}://localhost:${settings.port}`;
|
|
622
633
|
};
|
|
623
|
-
export const startProxy = async function ({ accountId, addonsUrls, blobsContext, command, config, configPath, debug, disableEdgeFunctions, env, functionsRegistry, geoCountry, geolocationMode, getUpdatedConfig, inspectSettings, offline, projectDir, repositoryRoot, settings, siteInfo, state, }) {
|
|
634
|
+
export const startProxy = async function ({ accountId, addonsUrls, api, blobsContext, command, config, configPath, debug, disableEdgeFunctions, env, functionsRegistry, geoCountry, geolocationMode, getUpdatedConfig, inspectSettings, offline, projectDir, repositoryRoot, settings, siteInfo, state, }) {
|
|
624
635
|
const secondaryServerPort = settings.https ? await getAvailablePort() : null;
|
|
625
636
|
const functionsServer = settings.functionsPort ? `http://127.0.0.1:${settings.functionsPort}` : null;
|
|
626
637
|
let edgeFunctionsProxy;
|
|
@@ -685,6 +696,7 @@ export const startProxy = async function ({ accountId, addonsUrls, blobsContext,
|
|
|
685
696
|
imageProxy,
|
|
686
697
|
siteInfo,
|
|
687
698
|
env,
|
|
699
|
+
api,
|
|
688
700
|
});
|
|
689
701
|
const primaryServer = settings.https
|
|
690
702
|
? https.createServer({ cert: settings.https.cert, key: settings.https.key }, onRequestWithOptions)
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "netlify-cli",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.27.0",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "netlify-cli",
|
|
9
|
-
"version": "17.
|
|
9
|
+
"version": "17.27.0",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|