@netlify/zip-it-and-ship-it 9.35.0 → 9.35.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.
@@ -115,7 +115,43 @@ export declare const parseFile: (sourcePath: string, { functionName }: FindISCDe
115
115
  * other metadata.
116
116
  */
117
117
  export declare const parseSource: (source: string, { functionName }: FindISCDeclarationsOptions) => StaticAnalysisResult;
118
- export declare const augmentFunctionConfig: (tomlConfig: FunctionConfig, inSourceConfig?: InSourceConfig) => FunctionConfig & InSourceConfig;
118
+ export declare const augmentFunctionConfig: (mainFile: string, tomlConfig: FunctionConfig, inSourceConfig?: InSourceConfig) => {
119
+ name?: string | undefined;
120
+ externalNodeModules?: string[] | undefined;
121
+ generator?: string | undefined;
122
+ includedFiles?: string[] | undefined;
123
+ includedFilesBasePath?: string | undefined;
124
+ ignoredNodeModules?: string[] | undefined;
125
+ nodeBundler?: "none" | "esbuild" | "esbuild_zisi" | "nft" | "zisi" | undefined;
126
+ nodeSourcemap?: boolean | undefined;
127
+ nodeVersion?: string | undefined;
128
+ rustTargetDirectory?: string | undefined;
129
+ schedule?: string | undefined;
130
+ timeout?: number | undefined;
131
+ zipGo?: boolean | undefined;
132
+ nodeModuleFormat?: "cjs" | "esm" | undefined;
133
+ } & {
134
+ name?: string | undefined;
135
+ path?: any[] | undefined;
136
+ externalNodeModules?: string[] | undefined;
137
+ generator?: string | undefined;
138
+ includedFiles?: string[] | undefined;
139
+ ignoredNodeModules?: string[] | undefined;
140
+ nodeBundler?: "none" | "esbuild" | "esbuild_zisi" | "nft" | "zisi" | undefined;
141
+ nodeVersion?: string | undefined;
142
+ schedule?: string | undefined;
143
+ timeout?: number | undefined;
144
+ preferStatic?: boolean | undefined;
145
+ method?: any[] | undefined;
146
+ rateLimit?: {
147
+ windowLimit: number;
148
+ windowSize: number;
149
+ to?: string | undefined;
150
+ action?: "rate_limit" | "rewrite" | undefined;
151
+ aggregateBy?: "domain" | "ip" | ("domain" | "ip")[] | undefined;
152
+ algorithm?: "sliding_window" | undefined;
153
+ } | undefined;
154
+ };
119
155
  export type ISCHandlerArg = ArgumentPlaceholder | Expression | SpreadElement | JSXNamespacedName;
120
156
  export type ISCExportWithCallExpression = {
121
157
  type: 'call-expression';
@@ -1,3 +1,4 @@
1
+ import { dirname } from 'path';
1
2
  import mergeOptions from 'merge-options';
2
3
  import { z } from 'zod';
3
4
  import { functionConfig } from '../../../config.js';
@@ -149,6 +150,18 @@ export const parseSource = (source, { functionName }) => {
149
150
  }
150
151
  return result;
151
152
  };
152
- export const augmentFunctionConfig = (tomlConfig, inSourceConfig = {}) => {
153
- return mergeOptions.call({ concatArrays: true }, tomlConfig, inSourceConfig);
153
+ export const augmentFunctionConfig = (mainFile, tomlConfig, inSourceConfig = {}) => {
154
+ const mergedConfig = mergeOptions.call({ concatArrays: true }, tomlConfig, inSourceConfig);
155
+ // We can't simply merge included files from the TOML and from in-source
156
+ // configuration because their globs are relative to different base paths.
157
+ // In the future, we could shift things around so we resolve each glob
158
+ // relative to the right base, but for now we say that included files in
159
+ // the source override any files defined in the TOML. It doesn't make a lot
160
+ // of sense to be defining include files for a framework-generated function
161
+ // in the TOML anyway.
162
+ if (inSourceConfig?.includedFiles && inSourceConfig.includedFiles.length !== 0) {
163
+ mergedConfig.includedFiles = inSourceConfig.includedFiles;
164
+ mergedConfig.includedFilesBasePath = dirname(mainFile);
165
+ }
166
+ return mergedConfig;
154
167
  };
@@ -38,7 +38,7 @@ const zipFunction = async function ({ archiveFormat, basePath, cache, config = {
38
38
  }
39
39
  const staticAnalysisResult = await parseFile(mainFile, { functionName: name });
40
40
  const runtimeAPIVersion = staticAnalysisResult.runtimeAPIVersion === 2 ? 2 : 1;
41
- const mergedConfig = augmentFunctionConfig(config, staticAnalysisResult.config);
41
+ const mergedConfig = augmentFunctionConfig(mainFile, config, staticAnalysisResult.config);
42
42
  const pluginsModulesPath = await getPluginsModulesPath(srcDir);
43
43
  const bundlerName = await getBundlerName({
44
44
  config: mergedConfig,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/zip-it-and-ship-it",
3
- "version": "9.35.0",
3
+ "version": "9.35.1",
4
4
  "description": "Zip it and ship it",
5
5
  "main": "./dist/main.js",
6
6
  "type": "module",
@@ -105,5 +105,5 @@
105
105
  "engines": {
106
106
  "node": "^14.18.0 || >=16.0.0"
107
107
  },
108
- "gitHead": "69cdd54c620f9c522748b70e8e9d51f0af5e9599"
108
+ "gitHead": "e4464a74add778cb61ff06702ef3a43367a930c3"
109
109
  }