netlify-cli 17.14.1 → 17.15.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.
@@ -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;AAgB3C,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;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;oBA8DP,eAAe,GAAG;IAAE,eAAe,EAAE,OAAO,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,iCAkDjF,CAAA;AAGD,eAAO,MAAM,sBAAsB,uBAA4C,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;AAiB3C,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;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;oBA4DP,eAAe,GAAG;IAAE,eAAe,EAAE,OAAO,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,iCAkDjF,CAAA;AAGD,eAAO,MAAM,sBAAsB,uBAA4C,CAAA"}
@@ -4,6 +4,7 @@ import { join, resolve } from 'path';
4
4
  import * as bundler from '@netlify/edge-bundler';
5
5
  import getAvailablePort from 'get-port';
6
6
  import { NETLIFYDEVERR, chalk, error as printError } from '../../utils/command-helpers.js';
7
+ import { getFeatureFlagsFromSiteInfo } from '../../utils/feature-flags.js';
7
8
  import { getGeoLocation } from '../geo-location.js';
8
9
  import { getPathInProject } from '../settings.js';
9
10
  import { startSpinner, stopSpinner } from '../spinner.js';
@@ -112,11 +113,9 @@ siteInfo,
112
113
  state, }) => {
113
114
  const userFunctionsPath = config.build.edge_functions;
114
115
  const isolatePort = await getAvailablePort();
115
- const buildFeatureFlags = {
116
- edge_functions_npm_modules: true,
117
- };
118
116
  const runtimeFeatureFlags = ['edge_functions_bootstrap_failure_mode', 'edge_functions_bootstrap_populate_environment'];
119
117
  const protocol = settings.https ? 'https' : 'http';
118
+ const buildFeatureFlags = { ...getFeatureFlagsFromSiteInfo(siteInfo), edge_functions_npm_modules: true };
120
119
  // Initializes the server, bootstrapping the Deno CLI and downloading it from
121
120
  // the network if needed. We don't want to wait for that to be completed, or
122
121
  // the command will be left hanging.
@@ -223,6 +222,7 @@ repositoryRoot, }) => {
223
222
  debug,
224
223
  directories: [directory].filter(Boolean),
225
224
  env: configEnv,
225
+ featureFlags,
226
226
  getUpdatedConfig,
227
227
  importMapFromTOML: config.functions['*'].deno_import_map,
228
228
  projectDir,
@@ -1,4 +1,5 @@
1
1
  import type { Declaration } from '@netlify/edge-bundler';
2
+ import type { FeatureFlags } from '../../utils/feature-flags.js';
2
3
  interface Config {
3
4
  edge_functions?: Declaration[];
4
5
  [key: string]: unknown;
@@ -14,6 +15,7 @@ interface EdgeFunctionsRegistryOptions {
14
15
  sources: string[];
15
16
  value: string;
16
17
  }>;
18
+ featureFlags: FeatureFlags;
17
19
  getUpdatedConfig: () => Promise<Config>;
18
20
  projectDir: string;
19
21
  runIsolate: RunIsolate;
@@ -21,10 +23,10 @@ interface EdgeFunctionsRegistryOptions {
21
23
  importMapFromTOML?: string;
22
24
  }
23
25
  export declare class EdgeFunctionsRegistry {
26
+ importMapFromDeployConfig?: string;
24
27
  private buildError;
25
28
  private bundler;
26
29
  private configPath;
27
- importMapFromDeployConfig?: string;
28
30
  private importMapFromTOML?;
29
31
  private declarationsFromDeployConfig;
30
32
  private declarationsFromTOML;
@@ -32,6 +34,7 @@ export declare class EdgeFunctionsRegistry {
32
34
  private directories;
33
35
  private directoryWatchers;
34
36
  private env;
37
+ private featureFlags;
35
38
  private userFunctions;
36
39
  private internalFunctions;
37
40
  private functionPaths;
@@ -42,7 +45,7 @@ export declare class EdgeFunctionsRegistry {
42
45
  private runIsolate;
43
46
  private servePath;
44
47
  private projectDir;
45
- constructor({ bundler, config, configPath, directories, env, getUpdatedConfig, importMapFromTOML, projectDir, runIsolate, servePath, }: EdgeFunctionsRegistryOptions);
48
+ constructor({ bundler, config, configPath, directories, env, featureFlags, getUpdatedConfig, importMapFromTOML, projectDir, runIsolate, servePath, }: EdgeFunctionsRegistryOptions);
46
49
  private doInitialScan;
47
50
  private get functions();
48
51
  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;AAmB7G,UAAU,MAAM;IACd,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,CA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AG,EACH,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,UAAU,EACV,SAAS,GACV,EAAE,4BAA4B;YAmBjB,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"}
@@ -5,7 +5,6 @@ import { NETLIFYDEVERR, NETLIFYDEVLOG, NETLIFYDEVWARN, nonNullable, chalk, log,
5
5
  import { MultiMap } from '../../utils/multimap.js';
6
6
  import { getPathInProject } from '../settings.js';
7
7
  import { INTERNAL_EDGE_FUNCTIONS_FOLDER } from './consts.js';
8
- const featureFlags = { edge_functions_correct_order: true };
9
8
  /**
10
9
  * Helper method which, given a edge bundler graph module and an index of modules by path, traverses its dependency tree
11
10
  * and returns an array of all of ist local dependencies
@@ -31,7 +30,7 @@ function traverseLocalDependencies({ dependencies = [] }, modulesByPath) {
31
30
  });
32
31
  }
33
32
  export class EdgeFunctionsRegistry {
34
- constructor({ bundler, config, configPath, directories, env, getUpdatedConfig, importMapFromTOML, projectDir, runIsolate, servePath, }) {
33
+ constructor({ bundler, config, configPath, directories, env, featureFlags, getUpdatedConfig, importMapFromTOML, projectDir, runIsolate, servePath, }) {
35
34
  this.buildError = null;
36
35
  this.declarationsFromDeployConfig = [];
37
36
  // Mapping file URLs to names of functions that use them as dependencies.
@@ -48,6 +47,7 @@ export class EdgeFunctionsRegistry {
48
47
  this.bundler = bundler;
49
48
  this.configPath = configPath;
50
49
  this.directories = directories;
50
+ this.featureFlags = featureFlags;
51
51
  this.getUpdatedConfig = getUpdatedConfig;
52
52
  this.runIsolate = runIsolate;
53
53
  this.servePath = servePath;
@@ -124,13 +124,13 @@ export class EdgeFunctionsRegistry {
124
124
  * found in both internal and user functions.
125
125
  */
126
126
  buildRoutes(internalFunctionConfigs, userFunctionConfigs) {
127
- const declarations = this.bundler.mergeDeclarations(this.declarationsFromTOML, userFunctionConfigs, internalFunctionConfigs, this.declarationsFromDeployConfig, featureFlags);
127
+ const declarations = this.bundler.mergeDeclarations(this.declarationsFromTOML, userFunctionConfigs, internalFunctionConfigs, this.declarationsFromDeployConfig, this.featureFlags);
128
128
  const { declarationsWithoutFunction, manifest, unroutedFunctions } = this.bundler.generateManifest({
129
129
  declarations,
130
130
  userFunctionConfig: userFunctionConfigs,
131
131
  internalFunctionConfig: internalFunctionConfigs,
132
132
  functions: this.functions,
133
- featureFlags,
133
+ featureFlags: this.featureFlags,
134
134
  });
135
135
  const routes = [...manifest.routes, ...manifest.post_cache_routes].map((route) => ({
136
136
  ...route,
@@ -44,7 +44,7 @@ export const getBuildFunction = async ({ config, directory, errorExit, func, pro
44
44
  const workerURL = new URL('worker.js', import.meta.url);
45
45
  // @ts-expect-error TS(7031) FIXME: Binding element 'context' implicitly has an 'any' ... Remove this comment to see the full error message
46
46
  export const invokeFunction = async ({ context, environment, event, func, timeout }) => {
47
- if (func.buildData.runtimeAPIVersion !== 2) {
47
+ if (func.buildData?.runtimeAPIVersion !== 2) {
48
48
  return await invokeFunctionDirectly({ context, event, func, timeout });
49
49
  }
50
50
  const workerData = {