netlify-cli 17.21.2 → 17.22.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.
Files changed (39) hide show
  1. package/dist/commands/deploy/deploy.d.ts.map +1 -1
  2. package/dist/commands/deploy/deploy.js +2 -3
  3. package/dist/commands/dev/dev.d.ts.map +1 -1
  4. package/dist/commands/dev/dev.js +4 -2
  5. package/dist/commands/functions/functions-serve.js +2 -2
  6. package/dist/commands/serve/index.d.ts.map +1 -1
  7. package/dist/commands/serve/index.js +1 -0
  8. package/dist/commands/serve/serve.d.ts.map +1 -1
  9. package/dist/commands/serve/serve.js +14 -5
  10. package/dist/lib/blobs/blobs.d.ts +16 -5
  11. package/dist/lib/blobs/blobs.d.ts.map +1 -1
  12. package/dist/lib/blobs/blobs.js +25 -7
  13. package/dist/lib/build.d.ts +2 -2
  14. package/dist/lib/build.d.ts.map +1 -1
  15. package/dist/lib/build.js +2 -2
  16. package/dist/lib/edge-functions/bootstrap.d.ts +2 -1
  17. package/dist/lib/edge-functions/bootstrap.d.ts.map +1 -1
  18. package/dist/lib/edge-functions/bootstrap.js +18 -2
  19. package/dist/lib/edge-functions/proxy.d.ts +2 -2
  20. package/dist/lib/edge-functions/proxy.d.ts.map +1 -1
  21. package/dist/lib/edge-functions/proxy.js +1 -7
  22. package/dist/lib/functions/netlify-function.d.ts.map +1 -1
  23. package/dist/lib/spinner.d.ts +7 -17
  24. package/dist/lib/spinner.d.ts.map +1 -1
  25. package/dist/lib/spinner.js +0 -14
  26. package/dist/tsconfig.tsbuildinfo +1 -1
  27. package/dist/utils/framework-server.d.ts.map +1 -1
  28. package/dist/utils/framework-server.js +0 -2
  29. package/dist/utils/proxy-server.d.ts +4 -3
  30. package/dist/utils/proxy-server.d.ts.map +1 -1
  31. package/dist/utils/proxy-server.js +2 -1
  32. package/dist/utils/proxy.d.ts +2 -1
  33. package/dist/utils/proxy.d.ts.map +1 -1
  34. package/dist/utils/proxy.js +29 -23
  35. package/dist/utils/run-build.d.ts +4 -5
  36. package/dist/utils/run-build.d.ts.map +1 -1
  37. package/dist/utils/run-build.js +1 -5
  38. package/npm-shrinkwrap.json +305 -224
  39. package/package.json +4 -3
@@ -1 +1 @@
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"}
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;AAuuB5C,eAAO,MAAM,MAAM,YAAmB,YAAY,WAAW,WAAW,kBAmHvE,CAAA"}
@@ -475,7 +475,7 @@ const bundleEdgeFunctions = async (options, command) => {
475
475
  packagePath: command.workspacePackage,
476
476
  buffer: true,
477
477
  featureFlags: edgeFunctionsFeatureFlags,
478
- edgeFunctionsBootstrapURL: getBootstrapURL(),
478
+ edgeFunctionsBootstrapURL: await getBootstrapURL(),
479
479
  });
480
480
  if (!success) {
481
481
  statusCb({
@@ -703,7 +703,7 @@ export const deploy = async (options, command) => {
703
703
  siteId,
704
704
  deployToProduction,
705
705
  });
706
- return {};
706
+ return { newEnvChanges: { DEPLOY_ID: results.deployId, DEPLOY_URL: results.deployUrl } };
707
707
  },
708
708
  });
709
709
  }
@@ -729,7 +729,6 @@ export const deploy = async (options, command) => {
729
729
  deployToProduction,
730
730
  });
731
731
  if (options.open) {
732
- // @ts-expect-error TS(2339) FIXME: Property 'siteUrl' does not exist on type '{}'.
733
732
  const urlToOpen = deployToProduction ? results.siteUrl : results.deployUrl;
734
733
  // @ts-expect-error TS(2345) FIXME: Argument of type '{ url: any; }' is not assignable... Remove this comment to see the full error message
735
734
  await openBrowser({ url: urlToOpen });
@@ -1 +1 @@
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,gBAwGpD,CAAA"}
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,kBA0JpE,CAAA;AAED,eAAO,MAAM,gBAAgB,YAAa,WAAW,gBA8GpD,CAAA"}
@@ -2,7 +2,7 @@ import process from 'process';
2
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
3
3
  import { applyMutations } from '@netlify/config';
4
4
  import { Option } from 'commander';
5
- import { BLOBS_CONTEXT_VARIABLE, encodeBlobsContext, getBlobsContext } from '../../lib/blobs/blobs.js';
5
+ import { BLOBS_CONTEXT_VARIABLE, encodeBlobsContext, getBlobsContextWithEdgeAccess } 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';
8
8
  import { printBanner } from '../../utils/banner.js';
@@ -78,7 +78,7 @@ export const dev = async (options, command) => {
78
78
  };
79
79
  let { env } = cachedConfig;
80
80
  env.NETLIFY_DEV = { sources: ['internal'], value: 'true' };
81
- const blobsContext = await getBlobsContext({
81
+ const blobsContext = await getBlobsContextWithEdgeAccess({
82
82
  debug: options.debug,
83
83
  projectRoot: command.workingDir,
84
84
  siteID: site.id ?? UNLINKED_SITE_MOCK_ID,
@@ -174,6 +174,7 @@ export const dev = async (options, command) => {
174
174
  config: mutatedConfig,
175
175
  configPath: configPathOverride,
176
176
  debug: options.debug,
177
+ disableEdgeFunctions: options.internalDisableEdgeFunctions,
177
178
  projectDir: command.workingDir,
178
179
  env,
179
180
  getUpdatedConfig,
@@ -213,6 +214,7 @@ export const createDevCommand = (program) => {
213
214
  .option('-d ,--dir <path>', 'dir with static files')
214
215
  .option('-f ,--functions <folder>', 'specify a functions folder to serve')
215
216
  .option('-o ,--offline', 'disables any features that require network access')
217
+ .addOption(new Option('--internal-disable-edge-functions', "disables edge functions. use this if your environment doesn't support Deno. This option is internal and should not be used by end users.").hideHelp(true))
216
218
  .option('-l, --live [subdomain]', 'start a public live session; optionally, supply a subdomain to generate a custom URL', false)
217
219
  .addOption(new Option('--functionsPort <port>', 'Old, prefer --functions-port. Port of functions server')
218
220
  .argParser((value) => Number.parseInt(value))
@@ -1,5 +1,5 @@
1
1
  import { join } from 'path';
2
- import { getBlobsContext } from '../../lib/blobs/blobs.js';
2
+ import { getBlobsContextWithEdgeAccess } from '../../lib/blobs/blobs.js';
3
3
  import { startFunctionsServer } from '../../lib/functions/server.js';
4
4
  import { printBanner } from '../../utils/banner.js';
5
5
  import { UNLINKED_SITE_MOCK_ID, acquirePort, getDotEnvVariables, getSiteInformation, injectEnvVariables, } from '../../utils/dev.js';
@@ -24,7 +24,7 @@ export const functionsServe = async (options, command) => {
24
24
  defaultPort: DEFAULT_PORT,
25
25
  errorMessage: 'Could not acquire configured functions port',
26
26
  });
27
- const blobsContext = await getBlobsContext({
27
+ const blobsContext = await getBlobsContextWithEdgeAccess({
28
28
  debug: options.debug,
29
29
  projectRoot: command.workingDir,
30
30
  siteID: site.id ?? UNLINKED_SITE_MOCK_ID,
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/serve/index.ts"],"names":[],"mappings":"AAIA,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAE5C,eAAO,MAAM,kBAAkB,YAAa,WAAW,gBA4CjD,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/serve/index.ts"],"names":[],"mappings":"AAIA,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAE5C,eAAO,MAAM,kBAAkB,YAAa,WAAW,gBAkDjD,CAAA"}
@@ -9,6 +9,7 @@ export const createServeCommand = (program) => program
9
9
  .option('-d ,--dir <path>', 'dir with static files')
10
10
  .option('-f ,--functions <folder>', 'specify a functions folder to serve')
11
11
  .option('-o ,--offline', 'disables any features that require network access')
12
+ .addOption(new Option('--internal-disable-edge-functions', "disables edge functions. use this if your environment doesn't support Deno. This option is internal and should not be used by end users.").hideHelp(true))
12
13
  .addOption(new Option('--functionsPort <port>', 'Old, prefer --functions-port. Port of functions server')
13
14
  .argParser((value) => Number.parseInt(value))
14
15
  .hideHelp(true))
@@ -1 +1 @@
1
- {"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../../src/commands/serve/serve.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAwBxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAG5C,eAAO,MAAM,KAAK,YAAmB,YAAY,WAAW,WAAW,uBA+ItE,CAAA"}
1
+ {"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../../src/commands/serve/serve.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AA6BxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAG5C,eAAO,MAAM,KAAK,YAAmB,YAAY,WAAW,WAAW,uBA0JtE,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import process from 'process';
2
- import { BLOBS_CONTEXT_VARIABLE, encodeBlobsContext, getBlobsContext } from '../../lib/blobs/blobs.js';
2
+ import { BLOBS_CONTEXT_VARIABLE, encodeBlobsContext, getBlobsContextWithAPIAccess, getBlobsContextWithEdgeAccess, } from '../../lib/blobs/blobs.js';
3
3
  import { promptEditorHelper } from '../../lib/edge-functions/editor-helper.js';
4
4
  import { startFunctionsServer } from '../../lib/functions/server.js';
5
5
  import { printBanner } from '../../utils/banner.js';
@@ -64,19 +64,26 @@ export const serve = async (options, command) => {
64
64
  command.setAnalyticsPayload({ live: options.live });
65
65
  log(`${NETLIFYDEVLOG} Building site for production`);
66
66
  log(`${NETLIFYDEVWARN} Changes will not be hot-reloaded, so if you need to rebuild your site you must exit and run 'netlify serve' again`);
67
- const blobsContext = await getBlobsContext({
67
+ const blobsOptions = {
68
68
  debug: options.debug,
69
69
  projectRoot: command.workingDir,
70
70
  siteID: site.id ?? UNLINKED_SITE_MOCK_ID,
71
- });
72
- process.env[BLOBS_CONTEXT_VARIABLE] = encodeBlobsContext(blobsContext);
71
+ };
72
+ // We start by running a build, so we want a Blobs context with API access,
73
+ // which is what build plugins use.
74
+ process.env[BLOBS_CONTEXT_VARIABLE] = encodeBlobsContext(await getBlobsContextWithAPIAccess(blobsOptions));
73
75
  const { configPath: configPathOverride } = await runBuildTimeline({
74
76
  command,
75
77
  settings,
76
78
  options,
79
+ env: {},
77
80
  });
81
+ // Now we generate a second Blobs context object, this time with edge access
82
+ // for runtime access (i.e. from functions and edge functions).
83
+ const runtimeBlobsContext = await getBlobsContextWithEdgeAccess(blobsOptions);
84
+ process.env[BLOBS_CONTEXT_VARIABLE] = encodeBlobsContext(runtimeBlobsContext);
78
85
  const functionsRegistry = await startFunctionsServer({
79
- blobsContext,
86
+ blobsContext: runtimeBlobsContext,
80
87
  command,
81
88
  config,
82
89
  debug: options.debug,
@@ -109,10 +116,12 @@ export const serve = async (options, command) => {
109
116
  const inspectSettings = generateInspectSettings(options.edgeInspect, options.edgeInspectBrk);
110
117
  const url = await startProxyServer({
111
118
  addonsUrls,
119
+ blobsContext: runtimeBlobsContext,
112
120
  command,
113
121
  config,
114
122
  configPath: configPathOverride,
115
123
  debug: options.debug,
124
+ disableEdgeFunctions: options.internalDisableEdgeFunctions,
116
125
  env,
117
126
  functionsRegistry,
118
127
  geolocationMode: options.geo,
@@ -1,21 +1,32 @@
1
- export declare const BLOBS_CONTEXT_VARIABLE = "NETLIFY_BLOBS_CONTEXT";
2
- export interface BlobsContext {
1
+ interface BaseBlobsContext {
3
2
  deployID: string;
4
- edgeURL: string;
5
3
  siteID: string;
6
4
  token: string;
5
+ }
6
+ export interface BlobsContextWithAPIAccess extends BaseBlobsContext {
7
+ apiURL: string;
8
+ }
9
+ export interface BlobsContextWithEdgeAccess extends BaseBlobsContext {
10
+ edgeURL: string;
7
11
  uncachedEdgeURL: string;
8
12
  }
13
+ export type BlobsContext = BlobsContextWithAPIAccess | BlobsContextWithEdgeAccess;
14
+ export declare const BLOBS_CONTEXT_VARIABLE = "NETLIFY_BLOBS_CONTEXT";
9
15
  interface GetBlobsContextOptions {
10
16
  debug: boolean;
11
17
  projectRoot: string;
12
18
  siteID: string;
13
19
  }
20
+ /**
21
+ * Starts a local Blobs server and returns a context object that lets build
22
+ * plugins connect to it.
23
+ */
24
+ export declare const getBlobsContextWithAPIAccess: ({ debug, projectRoot, siteID }: GetBlobsContextOptions) => Promise<BlobsContextWithAPIAccess>;
14
25
  /**
15
26
  * Starts a local Blobs server and returns a context object that lets functions
16
- * connect to it.
27
+ * and edge functions connect to it.
17
28
  */
18
- export declare const getBlobsContext: ({ debug, projectRoot, siteID }: GetBlobsContextOptions) => Promise<BlobsContext>;
29
+ export declare const getBlobsContextWithEdgeAccess: ({ debug, projectRoot, siteID }: GetBlobsContextOptions) => Promise<BlobsContextWithEdgeAccess>;
19
30
  /**
20
31
  * Returns a Base-64, JSON-encoded representation of the Blobs context. This is
21
32
  * the format that the `@netlify/blobs` package expects to find the context in.
@@ -1 +1 @@
1
- {"version":3,"file":"blobs.d.ts","sourceRoot":"","sources":["../../../src/lib/blobs/blobs.ts"],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AACH,eAAO,MAAM,kBAAkB,YAAa,YAAY,WAA4D,CAAA"}
@@ -13,7 +13,12 @@ const printLocalBlobsNotice = () => {
13
13
  hasPrintedLocalBlobsNotice = true;
14
14
  log(`${NETLIFYDEVLOG} Netlify Blobs running in sandbox mode for local development. Refer to https://ntl.fyi/local-blobs for more information.`);
15
15
  };
16
- const startBlobsServer = async (debug, projectRoot, token) => {
16
+ /**
17
+ * Starts a local Blobs server on a random port and generates a random token
18
+ * for its authentication.
19
+ */
20
+ const initializeBlobsServer = async (projectRoot, debug) => {
21
+ const token = uuidv4();
17
22
  const directory = path.resolve(projectRoot, getPathInProject(['blobs-serve']));
18
23
  const server = new BlobsServer({
19
24
  debug,
@@ -24,16 +29,29 @@ const startBlobsServer = async (debug, projectRoot, token) => {
24
29
  token,
25
30
  });
26
31
  const { port } = await server.start();
27
- return { port };
32
+ const url = `http://localhost:${port}`;
33
+ return { url, token };
34
+ };
35
+ /**
36
+ * Starts a local Blobs server and returns a context object that lets build
37
+ * plugins connect to it.
38
+ */
39
+ export const getBlobsContextWithAPIAccess = async ({ debug, projectRoot, siteID }) => {
40
+ const { token, url } = await initializeBlobsServer(projectRoot, debug);
41
+ const context = {
42
+ apiURL: url,
43
+ deployID: '0',
44
+ siteID,
45
+ token,
46
+ };
47
+ return context;
28
48
  };
29
49
  /**
30
50
  * Starts a local Blobs server and returns a context object that lets functions
31
- * connect to it.
51
+ * and edge functions connect to it.
32
52
  */
33
- export const getBlobsContext = async ({ debug, projectRoot, siteID }) => {
34
- const token = uuidv4();
35
- const { port } = await startBlobsServer(debug, projectRoot, token);
36
- const url = `http://localhost:${port}`;
53
+ export const getBlobsContextWithEdgeAccess = async ({ debug, projectRoot, siteID }) => {
54
+ const { token, url } = await initializeBlobsServer(projectRoot, debug);
37
55
  const context = {
38
56
  deployID: '0',
39
57
  edgeURL: url,
@@ -29,7 +29,7 @@ export declare const getBuildOptions: ({ cachedConfig, currentDir, deployHandler
29
29
  };
30
30
  packagePath: any;
31
31
  token: any;
32
- }) => {
32
+ }) => Promise<{
33
33
  cachedConfig: any;
34
34
  siteId: any;
35
35
  packagePath: any;
@@ -57,7 +57,7 @@ export declare const getBuildOptions: ({ cachedConfig, currentDir, deployHandler
57
57
  };
58
58
  };
59
59
  edgeFunctionsBootstrapURL: string;
60
- };
60
+ }>;
61
61
  /**
62
62
  * run the build command
63
63
  * @param {BuildConfig} options
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/lib/build.ts"],"names":[],"mappings":"AAYA;;;;GAIG;AAKH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6D3B,CAAA;AAED;;;;GAIG;AAEH,eAAO,MAAM,QAAQ;;;;EAcpB,CAAA"}
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/lib/build.ts"],"names":[],"mappings":"AAYA;;;;GAIG;AAKH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6D3B,CAAA;AAED;;;;GAIG;AAEH,eAAO,MAAM,QAAQ;;;;EAcpB,CAAA"}
package/dist/lib/build.js CHANGED
@@ -25,7 +25,7 @@ import { featureFlags as edgeFunctionsFeatureFlags } from './edge-functions/cons
25
25
  * @param {*} config.deployHandler
26
26
  * @returns {BuildConfig}
27
27
  */
28
- export const getBuildOptions = ({
28
+ export const getBuildOptions = async ({
29
29
  // @ts-expect-error TS(7031) FIXME: Binding element 'cachedConfig' implicitly has an '... Remove this comment to see the full error message
30
30
  cachedConfig,
31
31
  // @ts-expect-error TS(7031) FIXME: Binding element 'currentDir' implicitly has an 'an... Remove this comment to see the full error message
@@ -79,7 +79,7 @@ token, }) => {
79
79
  functionsBundlingManifest: true,
80
80
  },
81
81
  eventHandlers,
82
- edgeFunctionsBootstrapURL: getBootstrapURL(),
82
+ edgeFunctionsBootstrapURL: await getBootstrapURL(),
83
83
  };
84
84
  };
85
85
  /**
@@ -1,2 +1,3 @@
1
- export declare const getBootstrapURL: () => string;
1
+ export declare const FALLBACK_BOOTSTRAP_URL = "https://edge.netlify.com/bootstrap/index-combined.ts";
2
+ export declare const getBootstrapURL: () => Promise<string>;
2
3
  //# sourceMappingURL=bootstrap.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../../src/lib/edge-functions/bootstrap.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,eAAe,cAAyD,CAAA"}
1
+ {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../../src/lib/edge-functions/bootstrap.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,sBAAsB,yDAAyD,CAAA;AAE5F,eAAO,MAAM,eAAe,uBAe3B,CAAA"}
@@ -1,3 +1,19 @@
1
1
  import { env } from 'process';
2
- const latestBootstrapURL = 'https://65f9b38dc160de0008d35515--edge.netlify.com/bootstrap/index-combined.ts';
3
- export const getBootstrapURL = () => env.NETLIFY_EDGE_BOOTSTRAP || latestBootstrapURL;
2
+ import { getURL } from '@netlify/edge-functions/version';
3
+ import { warn } from '../../utils/command-helpers.js';
4
+ export const FALLBACK_BOOTSTRAP_URL = 'https://edge.netlify.com/bootstrap/index-combined.ts';
5
+ export const getBootstrapURL = async () => {
6
+ if (env.NETLIFY_EDGE_BOOTSTRAP) {
7
+ return env.NETLIFY_EDGE_BOOTSTRAP;
8
+ }
9
+ try {
10
+ return await getURL();
11
+ }
12
+ catch (error) {
13
+ warn(`Could not load latest version of Edge Functions environment: ${error?.message}`);
14
+ // If there was an error getting the bootstrap URL from the module, let's
15
+ // use the latest version of the bootstrap. This is not ideal, but better
16
+ // than failing to serve requests with edge functions.
17
+ return FALLBACK_BOOTSTRAP_URL;
18
+ }
19
+ };
@@ -1,7 +1,7 @@
1
1
  import type { IncomingMessage } from 'http';
2
2
  import BaseCommand from '../../commands/base-command.js';
3
3
  import { $TSFixMe } from '../../commands/types.js';
4
- import { BlobsContext } from '../blobs/blobs.js';
4
+ import { BlobsContextWithEdgeAccess } from '../blobs/blobs.js';
5
5
  declare const headersSymbol: unique symbol;
6
6
  export declare const handleProxyRequest: (req: any, proxyReq: any) => void;
7
7
  interface SiteInfo {
@@ -13,7 +13,7 @@ export declare const createSiteInfoHeader: (siteInfo: SiteInfo, localURL: string
13
13
  export declare const createAccountInfoHeader: (accountInfo?: {}) => string;
14
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
15
  accountId: string;
16
- blobsContext: BlobsContext;
16
+ blobsContext: BlobsContextWithEdgeAccess;
17
17
  command: BaseCommand;
18
18
  config: $TSFixMe;
19
19
  configPath: string;
@@ -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;AAM3C,OAAO,WAAW,MAAM,gCAAgC,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAGlD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAUhD,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;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,iCAkDjF,CAAA;AAGD,eAAO,MAAM,sBAAsB,uBAA4C,CAAA"}
@@ -15,14 +15,8 @@ import { EdgeFunctionsRegistry } from './registry.js';
15
15
  const headersSymbol = Symbol('Edge Functions Headers');
16
16
  const LOCAL_HOST = '127.0.0.1';
17
17
  const getDownloadUpdateFunctions = () => {
18
- // @ts-expect-error TS(7034) FIXME: Variable 'spinner' implicitly has type 'any' in so... Remove this comment to see the full error message
19
18
  let spinner;
20
- /**
21
- * @param {Error=} error_
22
- */
23
- // @ts-expect-error TS(7006) FIXME: Parameter 'error_' implicitly has an 'any' type.
24
19
  const onAfterDownload = (error_) => {
25
- // @ts-expect-error TS(2345) FIXME: Argument of type '{ error: boolean; spinner: any; ... Remove this comment to see the full error message
26
20
  stopSpinner({ error: Boolean(error_), spinner });
27
21
  };
28
22
  const onBeforeDownload = () => {
@@ -125,7 +119,7 @@ const prepareServer = async ({ command, config, configPath, debug, directory, en
125
119
  const runIsolate = await bundler.serve({
126
120
  ...getDownloadUpdateFunctions(),
127
121
  basePath: projectDir,
128
- bootstrapURL: getBootstrapURL(),
122
+ bootstrapURL: await getBootstrapURL(),
129
123
  debug,
130
124
  distImportMapPath: join(projectDir, distImportMapPath),
131
125
  featureFlags,
@@ -1 +1 @@
1
- {"version":3,"file":"netlify-function.d.ts","sourceRoot":"","sources":["../../../src/lib/functions/netlify-function.ts"],"names":[],"mappings":"AA2BA,MAAM,CAAC,OAAO,OAAO,eAAe;IAClC,SAAgB,IAAI,EAAE,MAAM,CAAA;IAC5B,SAAgB,QAAQ,EAAE,MAAM,CAAA;IAChC,SAAgB,WAAW,EAAE,MAAM,CAAA;IACnC,SAAgB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjC,SAAgB,OAAO,EAAE,MAAM,CAAA;IAE/B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAQ;IAClC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAQ;IACpC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAc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
4
  */
7
5
  export declare const startSpinner: ({ text }: {
8
- text: any;
9
- }) => import("ora").Ora;
6
+ text: string;
7
+ }) => Ora;
10
8
  /**
11
9
  * Stops the spinner with the following text
12
- * @param {object} config
13
- * @param {ora.Ora} config.spinner
14
- * @param {boolean} [config.error]
15
- * @param {string} [config.text]
16
- * @returns {void}
17
10
  */
18
11
  export declare const stopSpinner: ({ error, spinner, text }: {
19
- error: any;
20
- spinner: any;
21
- text: any;
12
+ error: boolean;
13
+ spinner: Ora;
14
+ text?: string | undefined;
22
15
  }) => void;
23
16
  /**
24
17
  * Clears the spinner
25
- * @param {object} config
26
- * @param {ora.Ora} config.spinner
27
- * @returns {void}
28
18
  */
29
19
  export declare const clearSpinner: ({ spinner }: {
30
- spinner: any;
20
+ spinner: Ora;
31
21
  }) => void;
32
22
  //# sourceMappingURL=spinner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../src/lib/spinner.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AAEH,eAAO,MAAM,YAAY;;uBAGb,CAAA;AAEZ;;;;;;;GAOG;AAEH,eAAO,MAAM,WAAW;;;;UAUvB,CAAA;AAED;;;;;GAKG;AAEH,eAAO,MAAM,YAAY;;UAIxB,CAAA"}
1
+ {"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../src/lib/spinner.ts"],"names":[],"mappings":"AACA,OAAY,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAE9B;;GAEG;AACH,eAAO,MAAM,YAAY;UAAsB,MAAM;SAGzC,CAAA;AAEZ;;GAEG;AACH,eAAO,MAAM,WAAW;WAAuC,OAAO;aAAW,GAAG;;UAUnF,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,YAAY;aAA4B,GAAG;UAIvD,CAAA"}
@@ -2,23 +2,13 @@ import logSymbols from 'log-symbols';
2
2
  import ora from 'ora';
3
3
  /**
4
4
  * Creates a spinner with the following text
5
- * @param {object} config
6
- * @param {string} config.text
7
- * @returns {ora.Ora}
8
5
  */
9
- // @ts-expect-error TS(7031) FIXME: Binding element 'text' implicitly has an 'any' typ... Remove this comment to see the full error message
10
6
  export const startSpinner = ({ text }) => ora({
11
7
  text,
12
8
  }).start();
13
9
  /**
14
10
  * Stops the spinner with the following text
15
- * @param {object} config
16
- * @param {ora.Ora} config.spinner
17
- * @param {boolean} [config.error]
18
- * @param {string} [config.text]
19
- * @returns {void}
20
11
  */
21
- // @ts-expect-error TS(7031) FIXME: Binding element 'error' implicitly has an 'any' ty... Remove this comment to see the full error message
22
12
  export const stopSpinner = ({ error, spinner, text }) => {
23
13
  if (!spinner) {
24
14
  return;
@@ -32,11 +22,7 @@ export const stopSpinner = ({ error, spinner, text }) => {
32
22
  };
33
23
  /**
34
24
  * Clears the spinner
35
- * @param {object} config
36
- * @param {ora.Ora} config.spinner
37
- * @returns {void}
38
25
  */
39
- // @ts-expect-error TS(7031) FIXME: Binding element 'spinner' implicitly has an 'any' ... Remove this comment to see the full error message
40
26
  export const clearSpinner = ({ spinner }) => {
41
27
  if (spinner) {
42
28
  spinner.stop();