@netlify/zip-it-and-ship-it 16.4.0 → 16.5.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.
|
@@ -94,6 +94,7 @@ export declare const inSourceConfig: z.ZodObject<{
|
|
|
94
94
|
export type InSourceConfig = z.infer<typeof inSourceConfig>;
|
|
95
95
|
export declare const serverConfig: z.ZodObject<{
|
|
96
96
|
excludedPath: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>>>;
|
|
97
|
+
includedFiles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
97
98
|
path: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>>>;
|
|
98
99
|
region: z.ZodOptional<z.ZodPreprocess<z.ZodEnum<{
|
|
99
100
|
cmh: "cmh";
|
|
@@ -106,21 +107,6 @@ export declare const serverConfig: z.ZodObject<{
|
|
|
106
107
|
}>>>;
|
|
107
108
|
}, z.core.$strict>;
|
|
108
109
|
export type ServerConfig = z.infer<typeof serverConfig>;
|
|
109
|
-
export declare const serverInSourceConfig: z.ZodObject<{
|
|
110
|
-
excludedPath: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>>>;
|
|
111
|
-
path: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>>>;
|
|
112
|
-
region: z.ZodOptional<z.ZodPreprocess<z.ZodEnum<{
|
|
113
|
-
cmh: "cmh";
|
|
114
|
-
fra: "fra";
|
|
115
|
-
}>>>;
|
|
116
|
-
size: z.ZodOptional<z.ZodPreprocess<z.ZodEnum<{
|
|
117
|
-
small: "small";
|
|
118
|
-
medium: "medium";
|
|
119
|
-
large: "large";
|
|
120
|
-
}>>>;
|
|
121
|
-
includedFiles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
122
|
-
}, z.core.$strict>;
|
|
123
|
-
export type ServerInSourceConfig = z.infer<typeof serverInSourceConfig>;
|
|
124
110
|
/**
|
|
125
111
|
* Loads a file at a given path, parses it into an AST, and returns a series of
|
|
126
112
|
* data points, such as in-source configuration properties and other metadata.
|
|
@@ -59,16 +59,12 @@ export const inSourceConfig = functionConfigShape
|
|
|
59
59
|
export const serverConfig = z
|
|
60
60
|
.object({
|
|
61
61
|
excludedPath: paths,
|
|
62
|
+
includedFiles: z.array(z.string()).optional(),
|
|
62
63
|
path: paths,
|
|
63
64
|
region: serverRegion.optional(),
|
|
64
65
|
size: serverSize.optional(),
|
|
65
66
|
})
|
|
66
67
|
.strict();
|
|
67
|
-
export const serverInSourceConfig = serverConfig
|
|
68
|
-
.extend({
|
|
69
|
-
includedFiles: z.array(z.string()).optional(),
|
|
70
|
-
})
|
|
71
|
-
.strict();
|
|
72
68
|
/**
|
|
73
69
|
* Resolves the default export expression to an ObjectExpression if possible,
|
|
74
70
|
* following identifier bindings when needed.
|
|
@@ -184,7 +180,7 @@ const getWrappedConfigExport = (nodes, getAllBindings) => {
|
|
|
184
180
|
}
|
|
185
181
|
};
|
|
186
182
|
const parseServerConfig = (config, functionName) => {
|
|
187
|
-
const { data, error, success } =
|
|
183
|
+
const { data, error, success } = serverConfig.safeParse(config);
|
|
188
184
|
if (success) {
|
|
189
185
|
return data;
|
|
190
186
|
}
|
package/dist/server.d.ts
CHANGED
package/dist/server.js
CHANGED
|
@@ -2,7 +2,7 @@ import { promises as fs } from 'fs';
|
|
|
2
2
|
import { extname, join, resolve } from 'path';
|
|
3
3
|
import { ARCHIVE_FORMAT } from './archive.js';
|
|
4
4
|
import { getFunctionFromPath } from './runtimes/index.js';
|
|
5
|
-
import { parseFile, serverConfig
|
|
5
|
+
import { parseFile, serverConfig } from './runtimes/node/in_source_config/index.js';
|
|
6
6
|
import { RUNTIME } from './runtimes/runtime.js';
|
|
7
7
|
import { FunctionBundlingUserError } from './utils/error.js';
|
|
8
8
|
import { formatZipResult } from './utils/format_result.js';
|
|
@@ -88,11 +88,19 @@ export const bundleServer = async (server, destFolder, { basePath, cache, featur
|
|
|
88
88
|
const fromNetlifyConfig = parseNetlifyServerConfig(server.config);
|
|
89
89
|
const srcPath = resolve(server.path);
|
|
90
90
|
const source = await readServerSource(srcPath, { cache, featureFlags });
|
|
91
|
+
if (fromNetlifyConfig.includedFiles !== undefined && basePath === undefined) {
|
|
92
|
+
throw new Error('Netlify Server includedFiles from the [server] block need a basePath to resolve from');
|
|
93
|
+
}
|
|
94
|
+
// Included files from the [server] block resolve from the base path.
|
|
95
|
+
// In-source ones resolve from the entry file and replace them.
|
|
96
|
+
const functionConfig = fromNetlifyConfig.includedFiles === undefined
|
|
97
|
+
? source.config
|
|
98
|
+
: { ...source.config, includedFiles: fromNetlifyConfig.includedFiles, includedFilesBasePath: basePath };
|
|
91
99
|
const zipResult = await source.runtime.zipFunction({
|
|
92
100
|
archiveFormat: ARCHIVE_FORMAT.ZIP,
|
|
93
101
|
basePath,
|
|
94
102
|
cache,
|
|
95
|
-
config:
|
|
103
|
+
config: functionConfig,
|
|
96
104
|
destFolder,
|
|
97
105
|
extension: source.extension,
|
|
98
106
|
featureFlags,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/zip-it-and-ship-it",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.5.0",
|
|
4
4
|
"description": "Zip it and ship it",
|
|
5
5
|
"main": "./dist/main.js",
|
|
6
6
|
"type": "module",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@netlify/types": "3.1.0",
|
|
80
|
-
"@opentelemetry/sdk-trace-base": "~2.
|
|
80
|
+
"@opentelemetry/sdk-trace-base": "~2.12.0",
|
|
81
81
|
"@types/archiver": "8.0.0",
|
|
82
82
|
"@types/node": "^22.12.0",
|
|
83
83
|
"@types/normalize-path": "3.0.2",
|
|
@@ -99,5 +99,5 @@
|
|
|
99
99
|
"engines": {
|
|
100
100
|
"node": ">=22.12.0"
|
|
101
101
|
},
|
|
102
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "d21ff03cab97f189702f9900e48eb988cdd104cc"
|
|
103
103
|
}
|