netlify-cli 17.19.1 → 17.19.3
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 +4 -0
- package/dist/commands/base-command.d.ts.map +1 -1
- package/dist/commands/base-command.js +6 -0
- package/dist/commands/deploy/deploy.d.ts.map +1 -1
- package/dist/commands/deploy/deploy.js +23 -57
- package/dist/commands/dev/dev.d.ts.map +1 -1
- package/dist/commands/dev/dev.js +2 -1
- package/dist/commands/serve/serve.d.ts.map +1 -1
- package/dist/commands/serve/serve.js +1 -0
- package/dist/lib/edge-functions/deploy.d.ts +3 -6
- package/dist/lib/edge-functions/deploy.d.ts.map +1 -1
- package/dist/lib/edge-functions/deploy.js +0 -5
- package/dist/lib/edge-functions/proxy.d.ts +23 -41
- package/dist/lib/edge-functions/proxy.d.ts.map +1 -1
- package/dist/lib/edge-functions/proxy.js +7 -86
- package/dist/lib/edge-functions/registry.d.ts +5 -2
- package/dist/lib/edge-functions/registry.d.ts.map +1 -1
- package/dist/lib/edge-functions/registry.js +3 -3
- package/dist/lib/settings.d.ts +1 -0
- package/dist/lib/settings.d.ts.map +1 -1
- package/dist/lib/settings.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/deploy/deploy-site.d.ts +4 -1
- package/dist/utils/deploy/deploy-site.d.ts.map +1 -1
- package/dist/utils/deploy/deploy-site.js +8 -18
- package/dist/utils/deploy/hash-fns.d.ts +14 -10
- package/dist/utils/deploy/hash-fns.d.ts.map +1 -1
- package/dist/utils/deploy/hash-fns.js +5 -34
- 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 +3 -0
- package/dist/utils/proxy.d.ts +2 -1
- package/dist/utils/proxy.d.ts.map +1 -1
- package/dist/utils/proxy.js +12 -9
- package/npm-shrinkwrap.json +236 -328
- package/package.json +3 -3
|
@@ -63,6 +63,10 @@ export default class BaseCommand extends Command {
|
|
|
63
63
|
pathPrefix?: string;
|
|
64
64
|
scheme?: string;
|
|
65
65
|
}): ReturnType<typeof resolveConfig>;
|
|
66
|
+
/**
|
|
67
|
+
* get a path inside the `.netlify` project folder
|
|
68
|
+
*/
|
|
69
|
+
getPathInProject(...paths: string[]): string;
|
|
66
70
|
/**
|
|
67
71
|
* Returns the context that should be used in case one hasn't been explicitly
|
|
68
72
|
* set. The default context is `dev` most of the time, but some commands may
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-command.d.ts","sourceRoot":"","sources":["../../src/commands/base-command.ts"],"names":[],"mappings":"AAKA,OAAO,EAAiB,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAG5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAU,MAAM,WAAW,CAAA;AAgCjD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAA;AAEhD,KAAK,SAAS,GAAG;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAClC,CAAA;AAwFD,0EAA0E;AAC1E,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,OAAO;;IAC9C,4DAA4D;IAE5D,OAAO,EAAE,cAAc,CAAA;IACvB,SAAS,EAAE,SAAS,CAAyC;IAE7D,OAAO,EAAE,OAAO,CAAA;IAEhB;;;;OAIG;IAGH,UAAU,SAAgB;IAE1B;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,uEAAuE;IACvE,gBAAgB,CAAC,EAAE,MAAM,CAAA;IAEzB;;;OAGG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW;IAqDxC,mIAAmI;IACnI,aAAa;IAKb,mFAAmF;IACnF,QAAQ,EAAE,MAAM,EAAE,CAAK;IACvB,oCAAoC;IACpC,WAAW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cAAc,CAAC,EAAE,MAAM,CAAA;QACvB,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,UAAU,CAAC,EAAE,MAAM,CAAA;QACnB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC;IA+CpC;;OAEG;IACH,gBAAgB,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM;IAI5C;;;;OAIG;IACH,iBAAiB,IAAI,YAAY,GAAG,KAAK;IAIzC;;OAEG;IACH,cAAc,CAAC,CAAC,GAAG,IAAI,GAAG,OAAO,GAAG,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC;CAGjE"}
|
|
@@ -558,6 +558,12 @@ class BaseCommand extends Command {
|
|
|
558
558
|
error(message, { exit: true });
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
|
+
/**
|
|
562
|
+
* get a path inside the `.netlify` project folder
|
|
563
|
+
*/
|
|
564
|
+
getPathInProject(...paths) {
|
|
565
|
+
return join(this.workspacePackage || '', '.netlify', ...paths);
|
|
566
|
+
}
|
|
561
567
|
/**
|
|
562
568
|
* Returns the context that should be used in case one hasn't been explicitly
|
|
563
569
|
* set. The default context is `dev` most of the time, but some commands may
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/commands/deploy/deploy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/commands/deploy/deploy.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAgCxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AA+tB5C,eAAO,MAAM,MAAM,YAAmB,YAAY,WAAW,WAAW,kBAoHvE,CAAA"}
|
|
@@ -49,18 +49,8 @@ const triggerDeploy = async ({ api, options, siteData, siteId }) => {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
-
/**
|
|
53
|
-
|
|
54
|
-
* @param {object} config
|
|
55
|
-
* @param {import('../base-command.js').default} config.command The process working directory
|
|
56
|
-
* @param {object} config.config
|
|
57
|
-
* @param {import('commander').OptionValues} config.options
|
|
58
|
-
* @param {object} config.site
|
|
59
|
-
* @param {object} config.siteData
|
|
60
|
-
* @returns {Promise<string>}
|
|
61
|
-
*/
|
|
62
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'command' implicitly has an 'any' ... Remove this comment to see the full error message
|
|
63
|
-
const getDeployFolder = async ({ command, config, options, site, siteData }) => {
|
|
52
|
+
/** Retrieves the folder containing the static files that need to be deployed */
|
|
53
|
+
const getDeployFolder = async ({ command, config, options, site, siteData, }) => {
|
|
64
54
|
let deployFolder;
|
|
65
55
|
// if the `--dir .` flag is provided we should resolve it to the working directory.
|
|
66
56
|
// - in regular sites this is the `process.cwd`
|
|
@@ -91,25 +81,20 @@ const getDeployFolder = async ({ command, config, options, site, siteData }) =>
|
|
|
91
81
|
}
|
|
92
82
|
return deployFolder;
|
|
93
83
|
};
|
|
94
|
-
/**
|
|
95
|
-
* @param {string} deployFolder
|
|
96
|
-
*/
|
|
97
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'deployFolder' implicitly has an 'any' t... Remove this comment to see the full error message
|
|
98
84
|
const validateDeployFolder = async (deployFolder) => {
|
|
99
|
-
/** @type {import('fs').Stats} */
|
|
100
85
|
let stats;
|
|
101
86
|
try {
|
|
102
87
|
stats = await stat(deployFolder);
|
|
103
88
|
}
|
|
104
89
|
catch (error_) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
90
|
+
if (error_ && typeof error_ === 'object' && 'code' in error_) {
|
|
91
|
+
if (error_.code === 'ENOENT') {
|
|
92
|
+
return error(`The deploy directory "${deployFolder}" has not been found. Did you forget to run 'netlify build'?`);
|
|
93
|
+
}
|
|
94
|
+
// Improve the message of permission errors
|
|
95
|
+
if (error_.code === 'EACCES') {
|
|
96
|
+
return error('Permission error when trying to access deploy folder');
|
|
97
|
+
}
|
|
113
98
|
}
|
|
114
99
|
throw error_;
|
|
115
100
|
}
|
|
@@ -118,18 +103,8 @@ const validateDeployFolder = async (deployFolder) => {
|
|
|
118
103
|
}
|
|
119
104
|
return stats;
|
|
120
105
|
};
|
|
121
|
-
/**
|
|
122
|
-
|
|
123
|
-
* @param {object} config
|
|
124
|
-
* @param {object} config.config
|
|
125
|
-
* @param {import('commander').OptionValues} config.options
|
|
126
|
-
* @param {object} config.site
|
|
127
|
-
* @param {object} config.siteData
|
|
128
|
-
* @param {string} config.workingDir // The process working directory
|
|
129
|
-
* @returns {string|undefined}
|
|
130
|
-
*/
|
|
131
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'config' implicitly has an 'any' t... Remove this comment to see the full error message
|
|
132
|
-
const getFunctionsFolder = ({ config, options, site, siteData, workingDir }) => {
|
|
106
|
+
/** get the functions directory */
|
|
107
|
+
const getFunctionsFolder = ({ config, options, site, siteData, workingDir, }) => {
|
|
133
108
|
let functionsFolder;
|
|
134
109
|
// Support "functions" and "Functions"
|
|
135
110
|
const funcConfig = config.functionsDirectory;
|
|
@@ -144,13 +119,7 @@ const getFunctionsFolder = ({ config, options, site, siteData, workingDir }) =>
|
|
|
144
119
|
}
|
|
145
120
|
return functionsFolder;
|
|
146
121
|
};
|
|
147
|
-
/**
|
|
148
|
-
*
|
|
149
|
-
* @param {string|undefined} functionsFolder
|
|
150
|
-
*/
|
|
151
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'functionsFolder' implicitly has an 'any... Remove this comment to see the full error message
|
|
152
122
|
const validateFunctionsFolder = async (functionsFolder) => {
|
|
153
|
-
/** @type {import('fs').Stats|undefined} */
|
|
154
123
|
let stats;
|
|
155
124
|
if (functionsFolder) {
|
|
156
125
|
// we used to hard error if functions folder is specified but doesn't exist
|
|
@@ -159,14 +128,14 @@ const validateFunctionsFolder = async (functionsFolder) => {
|
|
|
159
128
|
stats = await stat(functionsFolder);
|
|
160
129
|
}
|
|
161
130
|
catch (error_) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
131
|
+
if (error_ && typeof error_ === 'object' && 'code' in error_) {
|
|
132
|
+
if (error_.code === 'ENOENT') {
|
|
133
|
+
log(`Functions folder "${functionsFolder}" specified but it doesn't exist! Will proceed without deploying functions`);
|
|
134
|
+
}
|
|
135
|
+
// Improve the message of permission errors
|
|
136
|
+
if (error_.code === 'EACCES') {
|
|
137
|
+
error('Permission error when trying to access functions folder');
|
|
138
|
+
}
|
|
170
139
|
}
|
|
171
140
|
}
|
|
172
141
|
}
|
|
@@ -175,8 +144,7 @@ const validateFunctionsFolder = async (functionsFolder) => {
|
|
|
175
144
|
}
|
|
176
145
|
return stats;
|
|
177
146
|
};
|
|
178
|
-
|
|
179
|
-
const validateFolders = async ({ deployFolder, functionsFolder }) => {
|
|
147
|
+
const validateFolders = async ({ deployFolder, functionsFolder, }) => {
|
|
180
148
|
const deployFolderStat = await validateDeployFolder(deployFolder);
|
|
181
149
|
const functionsFolderStat = await validateFunctionsFolder(functionsFolder);
|
|
182
150
|
return { deployFolderStat, functionsFolderStat };
|
|
@@ -348,9 +316,7 @@ const runDeploy = async ({
|
|
|
348
316
|
// @ts-expect-error TS(7031) FIXME: Binding element 'alias' implicitly has an 'any' ty... Remove this comment to see the full error message
|
|
349
317
|
alias,
|
|
350
318
|
// @ts-expect-error TS(7031) FIXME: Binding element 'api' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
351
|
-
api,
|
|
352
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'command' implicitly has an 'any' ... Remove this comment to see the full error message
|
|
353
|
-
command,
|
|
319
|
+
api, command,
|
|
354
320
|
// @ts-expect-error TS(7031) FIXME: Binding element 'config' implicitly has an 'any' t... Remove this comment to see the full error message
|
|
355
321
|
config,
|
|
356
322
|
// @ts-expect-error TS(7031) FIXME: Binding element 'deployFolder' implicitly has an '... Remove this comment to see the full error message
|
|
@@ -418,7 +384,7 @@ title, }) => {
|
|
|
418
384
|
cachedConfig: command.netlify.cachedConfig,
|
|
419
385
|
packagePath: command.workspacePackage,
|
|
420
386
|
});
|
|
421
|
-
results = await deploySite(api, siteId, deployFolder, {
|
|
387
|
+
results = await deploySite(command, api, siteId, deployFolder, {
|
|
422
388
|
// @ts-expect-error FIXME
|
|
423
389
|
config,
|
|
424
390
|
fnDir: functionDirectories,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/commands/dev/dev.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/commands/dev/dev.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAU,MAAM,WAAW,CAAA;AA0BhD,OAAO,WAAW,MAAM,oBAAoB,CAAA;AA4D5C,eAAO,MAAM,GAAG,YAAmB,YAAY,WAAW,WAAW,kBAyJpE,CAAA;AAED,eAAO,MAAM,gBAAgB,YAAa,WAAW,gBAuGpD,CAAA"}
|
package/dist/commands/dev/dev.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import process from 'process';
|
|
2
|
-
import { Option } from 'commander';
|
|
3
2
|
// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module '@net... Remove this comment to see the full error message
|
|
4
3
|
import { applyMutations } from '@netlify/config';
|
|
4
|
+
import { Option } from 'commander';
|
|
5
5
|
import { BLOBS_CONTEXT_VARIABLE, encodeBlobsContext, getBlobsContext } from '../../lib/blobs/blobs.js';
|
|
6
6
|
import { promptEditorHelper } from '../../lib/edge-functions/editor-helper.js';
|
|
7
7
|
import { startFunctionsServer } from '../../lib/functions/server.js';
|
|
@@ -170,6 +170,7 @@ export const dev = async (options, command) => {
|
|
|
170
170
|
await startProxyServer({
|
|
171
171
|
addonsUrls,
|
|
172
172
|
blobsContext,
|
|
173
|
+
command,
|
|
173
174
|
config: mutatedConfig,
|
|
174
175
|
configPath: configPathOverride,
|
|
175
176
|
debug: options.debug,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../../src/commands/serve/serve.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAwBxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAG5C,eAAO,MAAM,KAAK,YAAmB,YAAY,WAAW,WAAW,
|
|
1
|
+
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../../src/commands/serve/serve.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAwBxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAG5C,eAAO,MAAM,KAAK,YAAmB,YAAY,WAAW,WAAW,uBA4ItE,CAAA"}
|
|
@@ -106,6 +106,7 @@ export const serve = async (options, command) => {
|
|
|
106
106
|
// @ts-expect-error TS(2345) FIXME: Argument of type '{ addonsUrls: { [k: string]: any... Remove this comment to see the full error message
|
|
107
107
|
const url = await startProxyServer({
|
|
108
108
|
addonsUrls,
|
|
109
|
+
command,
|
|
109
110
|
config,
|
|
110
111
|
configPath: configPathOverride,
|
|
111
112
|
debug: options.debug,
|
|
@@ -2,10 +2,7 @@
|
|
|
2
2
|
* @param {string} workingDir
|
|
3
3
|
* @param {*} file
|
|
4
4
|
*/
|
|
5
|
-
export declare const deployFileNormalizer: (workingDir:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*/
|
|
9
|
-
export declare const getDistPathIfExists: (workingDir: any) => Promise<string | undefined>;
|
|
10
|
-
export declare const isEdgeFunctionFile: (filePath: any) => any;
|
|
5
|
+
export declare const deployFileNormalizer: (workingDir: string, file: any) => any;
|
|
6
|
+
export declare const getDistPathIfExists: (workingDir: string) => Promise<string | undefined>;
|
|
7
|
+
export declare const isEdgeFunctionFile: (filePath: string) => boolean;
|
|
11
8
|
//# sourceMappingURL=deploy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/lib/edge-functions/deploy.ts"],"names":[],"mappings":"AASA;;;GAGG;AAEH,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/lib/edge-functions/deploy.ts"],"names":[],"mappings":"AASA;;;GAGG;AAEH,eAAO,MAAM,oBAAoB,eAAgB,MAAM,mBAStD,CAAA;AAED,eAAO,MAAM,mBAAmB,eAAsB,MAAM,gCAa3D,CAAA;AAED,eAAO,MAAM,kBAAkB,aAAc,MAAM,YAA+C,CAAA"}
|
|
@@ -17,10 +17,6 @@ export const deployFileNormalizer = (workingDir, file) => {
|
|
|
17
17
|
normalizedPath,
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
/**
|
|
21
|
-
* @param {string} workingDir
|
|
22
|
-
*/
|
|
23
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'workingDir' implicitly has an 'any' typ... Remove this comment to see the full error message
|
|
24
20
|
export const getDistPathIfExists = async (workingDir) => {
|
|
25
21
|
try {
|
|
26
22
|
const absoluteDistPath = join(workingDir, distPath);
|
|
@@ -34,5 +30,4 @@ export const getDistPathIfExists = async (workingDir) => {
|
|
|
34
30
|
// no-op
|
|
35
31
|
}
|
|
36
32
|
};
|
|
37
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'filePath' implicitly has an 'any' type.
|
|
38
33
|
export const isEdgeFunctionFile = (filePath) => filePath.startsWith(`${PUBLIC_URL_PATH}/`);
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { IncomingMessage } from 'http';
|
|
2
|
+
import BaseCommand from '../../commands/base-command.js';
|
|
3
|
+
import { $TSFixMe } from '../../commands/types.js';
|
|
4
|
+
import { BlobsContext } from '../blobs/blobs.js';
|
|
2
5
|
declare const headersSymbol: unique symbol;
|
|
3
6
|
export declare const handleProxyRequest: (req: any, proxyReq: any) => void;
|
|
4
7
|
interface SiteInfo {
|
|
@@ -8,47 +11,26 @@ interface SiteInfo {
|
|
|
8
11
|
}
|
|
9
12
|
export declare const createSiteInfoHeader: (siteInfo: SiteInfo, localURL: string) => string;
|
|
10
13
|
export declare const createAccountInfoHeader: (accountInfo?: {}) => string;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
* @returns
|
|
32
|
-
*/
|
|
33
|
-
export declare const initializeProxy: ({ accountId, blobsContext, config, configPath, debug, env: configEnv, geoCountry, geolocationMode, getUpdatedConfig, inspectSettings, mainPort, offline, passthroughPort, projectDir, repositoryRoot, settings, siteInfo, state, }: {
|
|
34
|
-
accountId: any;
|
|
35
|
-
blobsContext: any;
|
|
36
|
-
config: any;
|
|
37
|
-
configPath: any;
|
|
38
|
-
debug: any;
|
|
39
|
-
env: any;
|
|
40
|
-
geoCountry: any;
|
|
41
|
-
geolocationMode: any;
|
|
42
|
-
getUpdatedConfig: any;
|
|
43
|
-
inspectSettings: any;
|
|
44
|
-
mainPort: any;
|
|
45
|
-
offline: any;
|
|
46
|
-
passthroughPort: any;
|
|
47
|
-
projectDir: any;
|
|
48
|
-
repositoryRoot: any;
|
|
49
|
-
settings: any;
|
|
50
|
-
siteInfo: any;
|
|
51
|
-
state: any;
|
|
14
|
+
export declare const initializeProxy: ({ accountId, blobsContext, command, config, configPath, debug, env: configEnv, geoCountry, geolocationMode, getUpdatedConfig, inspectSettings, mainPort, offline, passthroughPort, projectDir, repositoryRoot, settings, siteInfo, state, }: {
|
|
15
|
+
accountId: string;
|
|
16
|
+
blobsContext: BlobsContext;
|
|
17
|
+
command: BaseCommand;
|
|
18
|
+
config: $TSFixMe;
|
|
19
|
+
configPath: string;
|
|
20
|
+
debug: boolean;
|
|
21
|
+
env: $TSFixMe;
|
|
22
|
+
offline: $TSFixMe;
|
|
23
|
+
geoCountry: $TSFixMe;
|
|
24
|
+
geolocationMode: $TSFixMe;
|
|
25
|
+
getUpdatedConfig: $TSFixMe;
|
|
26
|
+
inspectSettings: $TSFixMe;
|
|
27
|
+
mainPort: $TSFixMe;
|
|
28
|
+
passthroughPort: $TSFixMe;
|
|
29
|
+
projectDir: string;
|
|
30
|
+
repositoryRoot?: string | undefined;
|
|
31
|
+
settings: $TSFixMe;
|
|
32
|
+
siteInfo: $TSFixMe;
|
|
33
|
+
state: $TSFixMe;
|
|
52
34
|
}) => Promise<(req: IncomingMessage & {
|
|
53
35
|
[headersSymbol]: Record<string, string>;
|
|
54
36
|
}) => Promise<string | undefined>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../../src/lib/edge-functions/proxy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../../src/lib/edge-functions/proxy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,MAAM,CAAA;AAM3C,OAAO,WAAW,MAAM,gCAAgC,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAGlD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAShD,QAAA,MAAM,aAAa,eAAmC,CAAA;AA4BtD,eAAO,MAAM,kBAAkB,mCAI9B,CAAA;AAKD,UAAU,QAAQ;IAChB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,eAAO,MAAM,oBAAoB,aAAc,QAAQ,YAAY,MAAM,WAKxE,CAAA;AAED,eAAO,MAAM,uBAAuB,8BAMnC,CAAA;AAED,eAAO,MAAM,eAAe;eAqBf,MAAM;kBACH,YAAY;aACjB,WAAW;YACZ,QAAQ;gBACJ,MAAM;WACX,OAAO;SACT,QAAQ;aACJ,QAAQ;gBACL,QAAQ;qBACH,QAAQ;sBACP,QAAQ;qBACT,QAAQ;cACf,QAAQ;qBACD,QAAQ;gBACb,MAAM;;cAER,QAAQ;cACR,QAAQ;WACX,QAAQ;oBAyBI,eAAe,GAAG;IAAE,eAAe,EAAE,OAAO,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,iCAkDjF,CAAA;AAGD,eAAO,MAAM,sBAAsB,uBAA4C,CAAA"}
|
|
@@ -6,11 +6,10 @@ import getAvailablePort from 'get-port';
|
|
|
6
6
|
import { NETLIFYDEVERR, chalk, error as printError } from '../../utils/command-helpers.js';
|
|
7
7
|
import { getFeatureFlagsFromSiteInfo } from '../../utils/feature-flags.js';
|
|
8
8
|
import { getGeoLocation } from '../geo-location.js';
|
|
9
|
-
import { getPathInProject } from '../settings.js';
|
|
10
9
|
import { startSpinner, stopSpinner } from '../spinner.js';
|
|
11
10
|
import { getBootstrapURL } from './bootstrap.js';
|
|
12
11
|
import { DIST_IMPORT_MAP_PATH, EDGE_FUNCTIONS_SERVE_FOLDER } from './consts.js';
|
|
13
|
-
import {
|
|
12
|
+
import { getFeatureFlagsHeader, getInvocationMetadataHeader, headers } from './headers.js';
|
|
14
13
|
import { EdgeFunctionsRegistry } from './registry.js';
|
|
15
14
|
const headersSymbol = Symbol('Edge Functions Headers');
|
|
16
15
|
const LOCAL_HOST = '127.0.0.1';
|
|
@@ -52,65 +51,7 @@ export const createAccountInfoHeader = (accountInfo = {}) => {
|
|
|
52
51
|
const accountString = JSON.stringify(account);
|
|
53
52
|
return Buffer.from(accountString).toString('base64');
|
|
54
53
|
};
|
|
55
|
-
|
|
56
|
-
*
|
|
57
|
-
* @param {object} config
|
|
58
|
-
* @param {*} config.accountId
|
|
59
|
-
* @param {import("../blobs/blobs.js").BlobsContext} config.blobsContext
|
|
60
|
-
* @param {*} config.config
|
|
61
|
-
* @param {*} config.configPath
|
|
62
|
-
* @param {*} config.debug
|
|
63
|
-
* @param {*} config.env
|
|
64
|
-
* @param {*} config.geoCountry
|
|
65
|
-
* @param {*} config.geolocationMode
|
|
66
|
-
* @param {*} config.getUpdatedConfig
|
|
67
|
-
* @param {*} config.inspectSettings
|
|
68
|
-
* @param {*} config.mainPort
|
|
69
|
-
* @param {boolean=} config.offline
|
|
70
|
-
* @param {*} config.passthroughPort
|
|
71
|
-
* @param {*} config.projectDir
|
|
72
|
-
* @param {*} config.settings
|
|
73
|
-
* @param {*} config.siteInfo
|
|
74
|
-
* @param {*} config.state
|
|
75
|
-
* @returns
|
|
76
|
-
*/
|
|
77
|
-
export const initializeProxy = async ({
|
|
78
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'accountId' implicitly has an 'any... Remove this comment to see the full error message
|
|
79
|
-
accountId,
|
|
80
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'blobsContext' implicitly has an '... Remove this comment to see the full error message
|
|
81
|
-
blobsContext,
|
|
82
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'config' implicitly has an 'any' t... Remove this comment to see the full error message
|
|
83
|
-
config,
|
|
84
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'configPath' implicitly has an 'an... Remove this comment to see the full error message
|
|
85
|
-
configPath,
|
|
86
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'debug' implicitly has an 'any' ty... Remove this comment to see the full error message
|
|
87
|
-
debug,
|
|
88
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'configEnv' implicitly has an 'any... Remove this comment to see the full error message
|
|
89
|
-
env: configEnv,
|
|
90
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'geoCountry' implicitly has an 'an... Remove this comment to see the full error message
|
|
91
|
-
geoCountry,
|
|
92
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'geolocationMode' implicitly has a... Remove this comment to see the full error message
|
|
93
|
-
geolocationMode,
|
|
94
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'getUpdatedConfig' implicitly has ... Remove this comment to see the full error message
|
|
95
|
-
getUpdatedConfig,
|
|
96
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'inspectSettings' implicitly has a... Remove this comment to see the full error message
|
|
97
|
-
inspectSettings,
|
|
98
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'mainPort' implicitly has an 'any'... Remove this comment to see the full error message
|
|
99
|
-
mainPort,
|
|
100
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'offline' implicitly has an 'any' ... Remove this comment to see the full error message
|
|
101
|
-
offline,
|
|
102
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'passthroughPort' implicitly has a... Remove this comment to see the full error message
|
|
103
|
-
passthroughPort,
|
|
104
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'projectDir' implicitly has an 'an... Remove this comment to see the full error message
|
|
105
|
-
projectDir,
|
|
106
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'repositoryRoot' implicitly has an... Remove this comment to see the full error message
|
|
107
|
-
repositoryRoot,
|
|
108
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'settings' implicitly has an 'any'... Remove this comment to see the full error message
|
|
109
|
-
settings,
|
|
110
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'siteInfo' implicitly has an 'any'... Remove this comment to see the full error message
|
|
111
|
-
siteInfo,
|
|
112
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'state' implicitly has an 'any' ty... Remove this comment to see the full error message
|
|
113
|
-
state, }) => {
|
|
54
|
+
export const initializeProxy = async ({ accountId, blobsContext, command, config, configPath, debug, env: configEnv, geoCountry, geolocationMode, getUpdatedConfig, inspectSettings, mainPort, offline, passthroughPort, projectDir, repositoryRoot, settings, siteInfo, state, }) => {
|
|
114
55
|
const userFunctionsPath = config.build.edge_functions;
|
|
115
56
|
const isolatePort = await getAvailablePort();
|
|
116
57
|
const runtimeFeatureFlags = ['edge_functions_bootstrap_failure_mode', 'edge_functions_bootstrap_populate_environment'];
|
|
@@ -120,6 +61,7 @@ state, }) => {
|
|
|
120
61
|
// the network if needed. We don't want to wait for that to be completed, or
|
|
121
62
|
// the command will be left hanging.
|
|
122
63
|
const server = prepareServer({
|
|
64
|
+
command,
|
|
123
65
|
config,
|
|
124
66
|
configPath,
|
|
125
67
|
debug,
|
|
@@ -174,32 +116,10 @@ state, }) => {
|
|
|
174
116
|
};
|
|
175
117
|
// @ts-expect-error TS(7006) FIXME: Parameter 'req' implicitly has an 'any' type.
|
|
176
118
|
export const isEdgeFunctionsRequest = (req) => req[headersSymbol] !== undefined;
|
|
177
|
-
const prepareServer = async ({
|
|
178
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'config' implicitly has an 'any' t... Remove this comment to see the full error message
|
|
179
|
-
config,
|
|
180
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'configPath' implicitly has an 'an... Remove this comment to see the full error message
|
|
181
|
-
configPath,
|
|
182
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'debug' implicitly has an 'any' ty... Remove this comment to see the full error message
|
|
183
|
-
debug,
|
|
184
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'directory' implicitly has an 'any... Remove this comment to see the full error message
|
|
185
|
-
directory,
|
|
186
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'configEnv' implicitly has an 'any... Remove this comment to see the full error message
|
|
187
|
-
env: configEnv,
|
|
188
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'featureFlags' implicitly has an '... Remove this comment to see the full error message
|
|
189
|
-
featureFlags,
|
|
190
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'getUpdatedConfig' implicitly has ... Remove this comment to see the full error message
|
|
191
|
-
getUpdatedConfig,
|
|
192
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'inspectSettings' implicitly has a... Remove this comment to see the full error message
|
|
193
|
-
inspectSettings,
|
|
194
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'port' implicitly has an 'any' typ... Remove this comment to see the full error message
|
|
195
|
-
port,
|
|
196
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'projectDir' implicitly has an 'an... Remove this comment to see the full error message
|
|
197
|
-
projectDir,
|
|
198
|
-
// @ts-expect-error TS(7031) FIXME: Binding element 'repositoryRoot' implicitly has an... Remove this comment to see the full error message
|
|
199
|
-
repositoryRoot, }) => {
|
|
119
|
+
const prepareServer = async ({ command, config, configPath, debug, directory, env: configEnv, featureFlags, getUpdatedConfig, inspectSettings, port, projectDir, repositoryRoot, }) => {
|
|
200
120
|
try {
|
|
201
|
-
const distImportMapPath = getPathInProject(
|
|
202
|
-
const servePath = resolve(projectDir, getPathInProject(
|
|
121
|
+
const distImportMapPath = command.getPathInProject(DIST_IMPORT_MAP_PATH);
|
|
122
|
+
const servePath = resolve(projectDir, command.getPathInProject(EDGE_FUNCTIONS_SERVE_FOLDER));
|
|
203
123
|
await rm(servePath, { force: true, recursive: true });
|
|
204
124
|
const runIsolate = await bundler.serve({
|
|
205
125
|
...getDownloadUpdateFunctions(),
|
|
@@ -216,6 +136,7 @@ repositoryRoot, }) => {
|
|
|
216
136
|
servePath,
|
|
217
137
|
});
|
|
218
138
|
const registry = new EdgeFunctionsRegistry({
|
|
139
|
+
command,
|
|
219
140
|
bundler,
|
|
220
141
|
config,
|
|
221
142
|
configPath,
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { Declaration } from '@netlify/edge-bundler';
|
|
2
|
+
import BaseCommand from '../../commands/base-command.js';
|
|
2
3
|
import type { FeatureFlags } from '../../utils/feature-flags.js';
|
|
3
|
-
interface Config {
|
|
4
|
+
export interface Config {
|
|
4
5
|
edge_functions?: Declaration[];
|
|
5
6
|
[key: string]: unknown;
|
|
6
7
|
}
|
|
7
8
|
type RunIsolate = Awaited<ReturnType<typeof import('@netlify/edge-bundler').serve>>;
|
|
8
9
|
interface EdgeFunctionsRegistryOptions {
|
|
10
|
+
command: BaseCommand;
|
|
9
11
|
bundler: typeof import('@netlify/edge-bundler');
|
|
10
12
|
config: Config;
|
|
11
13
|
configPath: string;
|
|
@@ -45,7 +47,8 @@ export declare class EdgeFunctionsRegistry {
|
|
|
45
47
|
private runIsolate;
|
|
46
48
|
private servePath;
|
|
47
49
|
private projectDir;
|
|
48
|
-
|
|
50
|
+
private command;
|
|
51
|
+
constructor({ bundler, command, config, configPath, directories, env, featureFlags, getUpdatedConfig, importMapFromTOML, projectDir, runIsolate, servePath, }: EdgeFunctionsRegistryOptions);
|
|
49
52
|
private doInitialScan;
|
|
50
53
|
private get functions();
|
|
51
54
|
private build;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/lib/edge-functions/registry.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAuD,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/lib/edge-functions/registry.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAuD,MAAM,uBAAuB,CAAA;AAE7G,OAAO,WAAW,MAAM,gCAAgC,CAAA;AAYxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAMhE,MAAM,WAAW,MAAM;IACrB,cAAc,CAAC,EAAE,WAAW,EAAE,CAAA;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAGD,KAAK,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,cAAc,uBAAuB,EAAE,KAAK,CAAC,CAAC,CAAA;AAInF,UAAU,4BAA4B;IACpC,OAAO,EAAE,W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SAAS,CAAQ;IACzB,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,OAAO,CAAa;gBAEhB,EACV,OAAO,EACP,OAAO,EACP,MAAM,EACN,UAAU,EACV,WAAW,EACX,GAAG,EACH,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,UAAU,EACV,SAAS,GACV,EAAE,4BAA4B;YAoBjB,aAAa;IAc3B,OAAO,KAAK,SAAS,GAEpB;YAEa,KAAK;IAmEnB;;;;;OAKG;IACH,OAAO,CAAC,WAAW;YA0BL,+BAA+B;IAsB7C,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAMtC,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,MAAM,CAAC,uBAAuB;YAoBxB,gBAAgB;IAoCxB,UAAU;IAIhB;;OAEG;IACH,OAAO,CAAC,QAAQ;IA2ChB;;;OAGG;IACH,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;;;IAuC5C;;;OAGG;IACH,OAAO,CAAC,YAAY;IA0CpB;;;OAGG;YACW,QAAQ;IAqBtB,OAAO,KAAK,iBAAiB,GAE5B;YAEa,gBAAgB;YAShB,mBAAmB;YAgBnB,gBAAgB;YA+BhB,aAAa;YAwBb,wBAAwB;CAWvC"}
|
|
@@ -3,7 +3,6 @@ import { join } from 'path';
|
|
|
3
3
|
import { fileURLToPath } from 'url';
|
|
4
4
|
import { NETLIFYDEVERR, NETLIFYDEVLOG, NETLIFYDEVWARN, nonNullable, chalk, log, warn, watchDebounced, isNodeError, } from '../../utils/command-helpers.js';
|
|
5
5
|
import { MultiMap } from '../../utils/multimap.js';
|
|
6
|
-
import { getPathInProject } from '../settings.js';
|
|
7
6
|
import { INTERNAL_EDGE_FUNCTIONS_FOLDER } from './consts.js';
|
|
8
7
|
/**
|
|
9
8
|
* Helper method which, given a edge bundler graph module and an index of modules by path, traverses its dependency tree
|
|
@@ -30,7 +29,7 @@ function traverseLocalDependencies({ dependencies = [] }, modulesByPath) {
|
|
|
30
29
|
});
|
|
31
30
|
}
|
|
32
31
|
export class EdgeFunctionsRegistry {
|
|
33
|
-
constructor({ bundler, config, configPath, directories, env, featureFlags, getUpdatedConfig, importMapFromTOML, projectDir, runIsolate, servePath, }) {
|
|
32
|
+
constructor({ bundler, command, config, configPath, directories, env, featureFlags, getUpdatedConfig, importMapFromTOML, projectDir, runIsolate, servePath, }) {
|
|
34
33
|
this.buildError = null;
|
|
35
34
|
this.declarationsFromDeployConfig = [];
|
|
36
35
|
// Mapping file URLs to names of functions that use them as dependencies.
|
|
@@ -44,6 +43,7 @@ export class EdgeFunctionsRegistry {
|
|
|
44
43
|
this.functionPaths = new Map();
|
|
45
44
|
this.manifest = null;
|
|
46
45
|
this.routes = [];
|
|
46
|
+
this.command = command;
|
|
47
47
|
this.bundler = bundler;
|
|
48
48
|
this.configPath = configPath;
|
|
49
49
|
this.directories = directories;
|
|
@@ -332,7 +332,7 @@ export class EdgeFunctionsRegistry {
|
|
|
332
332
|
return { functionsConfig, graph, npmSpecifiersWithExtraneousFiles, success };
|
|
333
333
|
}
|
|
334
334
|
get internalDirectory() {
|
|
335
|
-
return join(this.projectDir, getPathInProject(
|
|
335
|
+
return join(this.projectDir, this.command.getPathInProject(INTERNAL_EDGE_FUNCTIONS_FOLDER));
|
|
336
336
|
}
|
|
337
337
|
async readDeployConfig() {
|
|
338
338
|
const manifestPath = join(this.internalDirectory, 'manifest.json');
|
package/dist/lib/settings.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export declare const getPathInHome: (paths: any) => string;
|
|
|
14
14
|
/**
|
|
15
15
|
* get a path inside the project folder
|
|
16
16
|
* @param {string[]} paths
|
|
17
|
+
* @deprecated This does not work in monorepos use Basecommand.getPathInProject instead
|
|
17
18
|
* @returns {string}
|
|
18
19
|
*/
|
|
19
20
|
export declare const getPathInProject: (paths: any) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/lib/settings.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AAEH,eAAO,MAAM,mBAAmB,wBAG/B,CAAA;AAED;;;;GAIG;AAEH,eAAO,MAAM,aAAa,wBAGzB,CAAA;AAED
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/lib/settings.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AAEH,eAAO,MAAM,mBAAmB,wBAG/B,CAAA;AAED;;;;GAIG;AAEH,eAAO,MAAM,aAAa,wBAGzB,CAAA;AAED;;;;;GAKG;AAEH,eAAO,MAAM,gBAAgB,wBAG5B,CAAA"}
|
package/dist/lib/settings.js
CHANGED
|
@@ -27,6 +27,7 @@ export const getPathInHome = (paths) => {
|
|
|
27
27
|
/**
|
|
28
28
|
* get a path inside the project folder
|
|
29
29
|
* @param {string[]} paths
|
|
30
|
+
* @deprecated This does not work in monorepos use Basecommand.getPathInProject instead
|
|
30
31
|
* @returns {string}
|
|
31
32
|
*/
|
|
32
33
|
// @ts-expect-error TS(7006) FIXME: Parameter 'paths' implicitly has an 'any' type.
|