@netlify/zip-it-and-ship-it 9.17.3 → 9.18.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.
- package/dist/bin.js +1 -0
- package/dist/feature_flags.d.ts +2 -0
- package/dist/feature_flags.js +2 -0
- package/dist/function.d.ts +1 -0
- package/dist/function.js +1 -0
- package/dist/main.d.ts +2 -2
- package/dist/runtimes/go/index.js +8 -3
- package/dist/runtimes/index.d.ts +2 -2
- package/dist/runtimes/node/bundlers/esbuild/bundler.js +10 -1
- package/dist/runtimes/node/bundlers/nft/es_modules.js +9 -2
- package/dist/runtimes/node/index.js +4 -0
- package/package.json +6 -6
package/dist/bin.js
CHANGED
|
@@ -40,6 +40,7 @@ const OPTIONS = {
|
|
|
40
40
|
config: {
|
|
41
41
|
default: {},
|
|
42
42
|
describe: 'An object matching glob-like expressions to objects containing configuration properties. Whenever a function name matches one of the expressions, it inherits the configuration properties',
|
|
43
|
+
coerce: (config) => (typeof config === 'string' ? JSON.parse(config) : config),
|
|
43
44
|
},
|
|
44
45
|
manifest: {
|
|
45
46
|
string: true,
|
package/dist/feature_flags.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare const defaultFlags: {
|
|
|
7
7
|
readonly zisi_output_cjs_extension: false;
|
|
8
8
|
readonly zisi_unique_entry_file: false;
|
|
9
9
|
readonly zisi_esbuild_fail_double_glob: false;
|
|
10
|
+
readonly zisi_golang_use_al2: false;
|
|
10
11
|
};
|
|
11
12
|
export type FeatureFlags = Partial<Record<keyof typeof defaultFlags, boolean>>;
|
|
12
13
|
export declare const getFlags: (input?: Record<string, boolean>, flags?: {
|
|
@@ -18,4 +19,5 @@ export declare const getFlags: (input?: Record<string, boolean>, flags?: {
|
|
|
18
19
|
readonly zisi_output_cjs_extension: false;
|
|
19
20
|
readonly zisi_unique_entry_file: false;
|
|
20
21
|
readonly zisi_esbuild_fail_double_glob: false;
|
|
22
|
+
readonly zisi_golang_use_al2: false;
|
|
21
23
|
}) => FeatureFlags;
|
package/dist/feature_flags.js
CHANGED
|
@@ -18,6 +18,8 @@ export const defaultFlags = {
|
|
|
18
18
|
zisi_unique_entry_file: false,
|
|
19
19
|
// If multiple glob stars are in includedFiles, fail the build instead of warning.
|
|
20
20
|
zisi_esbuild_fail_double_glob: false,
|
|
21
|
+
// Bundle for the provided.AL2 runtime for Go functions.
|
|
22
|
+
zisi_golang_use_al2: false,
|
|
21
23
|
};
|
|
22
24
|
// List of supported flags and their default value.
|
|
23
25
|
export const getFlags = (input = {}, flags = defaultFlags) => Object.entries(flags).reduce((result, [key, defaultValue]) => ({
|
package/dist/function.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { FunctionConfig } from './config.js';
|
|
|
4
4
|
import type { Runtime, ZipFunctionResult } from './runtimes/runtime.js';
|
|
5
5
|
import { ObjectValues } from './types/utils.js';
|
|
6
6
|
export declare const INVOCATION_MODE: {
|
|
7
|
+
readonly Background: "background";
|
|
7
8
|
readonly Buffer: "buffer";
|
|
8
9
|
readonly Stream: "stream";
|
|
9
10
|
};
|
package/dist/function.js
CHANGED
package/dist/main.d.ts
CHANGED
|
@@ -28,13 +28,13 @@ interface ListFunctionsOptions {
|
|
|
28
28
|
parseISC?: boolean;
|
|
29
29
|
}
|
|
30
30
|
export declare const listFunctions: (relativeSrcFolders: string | string[], { featureFlags: inputFeatureFlags, config, configFileDirectories, parseISC, }?: {
|
|
31
|
-
featureFlags?: Partial<Record<"buildRustSource" | "parseWithEsbuild" | "traceWithNft" | "zisi_pure_esm" | "zisi_pure_esm_mjs" | "zisi_output_cjs_extension" | "zisi_unique_entry_file" | "zisi_esbuild_fail_double_glob", boolean>> | undefined;
|
|
31
|
+
featureFlags?: Partial<Record<"buildRustSource" | "parseWithEsbuild" | "traceWithNft" | "zisi_pure_esm" | "zisi_pure_esm_mjs" | "zisi_output_cjs_extension" | "zisi_unique_entry_file" | "zisi_esbuild_fail_double_glob" | "zisi_golang_use_al2", boolean>> | undefined;
|
|
32
32
|
config?: Config | undefined;
|
|
33
33
|
configFileDirectories?: string[] | undefined;
|
|
34
34
|
parseISC?: boolean | undefined;
|
|
35
35
|
}) => Promise<ListedFunction[]>;
|
|
36
36
|
export declare const listFunction: (path: string, { featureFlags: inputFeatureFlags, config, configFileDirectories, parseISC, }?: {
|
|
37
|
-
featureFlags?: Partial<Record<"buildRustSource" | "parseWithEsbuild" | "traceWithNft" | "zisi_pure_esm" | "zisi_pure_esm_mjs" | "zisi_output_cjs_extension" | "zisi_unique_entry_file" | "zisi_esbuild_fail_double_glob", boolean>> | undefined;
|
|
37
|
+
featureFlags?: Partial<Record<"buildRustSource" | "parseWithEsbuild" | "traceWithNft" | "zisi_pure_esm" | "zisi_pure_esm_mjs" | "zisi_output_cjs_extension" | "zisi_unique_entry_file" | "zisi_esbuild_fail_double_glob" | "zisi_golang_use_al2", boolean>> | undefined;
|
|
38
38
|
config?: Config | undefined;
|
|
39
39
|
configFileDirectories?: string[] | undefined;
|
|
40
40
|
parseISC?: boolean | undefined;
|
|
@@ -68,7 +68,7 @@ const processSource = async ({ cache, mainFile, path, }) => {
|
|
|
68
68
|
stat,
|
|
69
69
|
};
|
|
70
70
|
};
|
|
71
|
-
const zipFunction = async function ({ config, destFolder, filename, mainFile, srcDir, srcPath, stat, isInternal, }) {
|
|
71
|
+
const zipFunction = async function ({ config, destFolder, filename, mainFile, srcDir, srcPath, stat, isInternal, featureFlags, }) {
|
|
72
72
|
const destPath = join(destFolder, filename);
|
|
73
73
|
const isSource = extname(mainFile) === '.go';
|
|
74
74
|
let binary = {
|
|
@@ -90,11 +90,16 @@ const zipFunction = async function ({ config, destFolder, filename, mainFile, sr
|
|
|
90
90
|
const zipPath = `${destPath}.zip`;
|
|
91
91
|
const zipOptions = {
|
|
92
92
|
destPath: zipPath,
|
|
93
|
-
filename: basename(destPath),
|
|
93
|
+
filename: featureFlags.zisi_golang_use_al2 ? 'bootstrap' : basename(destPath),
|
|
94
94
|
runtime,
|
|
95
95
|
};
|
|
96
96
|
await zipBinary({ ...zipOptions, srcPath: binary.path, stat: binary.stat });
|
|
97
|
-
return {
|
|
97
|
+
return {
|
|
98
|
+
config,
|
|
99
|
+
path: zipPath,
|
|
100
|
+
entryFilename: zipOptions.filename,
|
|
101
|
+
runtimeVersion: featureFlags.zisi_golang_use_al2 ? 'provided.al2' : undefined,
|
|
102
|
+
};
|
|
98
103
|
}
|
|
99
104
|
// We don't need to zip the binary, so we can just copy it to the right path.
|
|
100
105
|
// We do this only if we're not building from source, as otherwise the build
|
package/dist/runtimes/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare const getFunctionsFromPaths: (paths: string[], { cache, config, c
|
|
|
11
11
|
config?: Config | undefined;
|
|
12
12
|
configFileDirectories?: string[] | undefined;
|
|
13
13
|
dedupe?: boolean | undefined;
|
|
14
|
-
featureFlags?: Partial<Record<"buildRustSource" | "parseWithEsbuild" | "traceWithNft" | "zisi_pure_esm" | "zisi_pure_esm_mjs" | "zisi_output_cjs_extension" | "zisi_unique_entry_file" | "zisi_esbuild_fail_double_glob", boolean>> | undefined;
|
|
14
|
+
featureFlags?: Partial<Record<"buildRustSource" | "parseWithEsbuild" | "traceWithNft" | "zisi_pure_esm" | "zisi_pure_esm_mjs" | "zisi_output_cjs_extension" | "zisi_unique_entry_file" | "zisi_esbuild_fail_double_glob" | "zisi_golang_use_al2", boolean>> | undefined;
|
|
15
15
|
}) => Promise<FunctionMap>;
|
|
16
16
|
/**
|
|
17
17
|
* Gets a list of functions found in a list of paths.
|
|
@@ -20,6 +20,6 @@ export declare const getFunctionFromPath: (path: string, { cache, config, config
|
|
|
20
20
|
cache: RuntimeCache;
|
|
21
21
|
config?: Config | undefined;
|
|
22
22
|
configFileDirectories?: string[] | undefined;
|
|
23
|
-
featureFlags?: Partial<Record<"buildRustSource" | "parseWithEsbuild" | "traceWithNft" | "zisi_pure_esm" | "zisi_pure_esm_mjs" | "zisi_output_cjs_extension" | "zisi_unique_entry_file" | "zisi_esbuild_fail_double_glob", boolean>> | undefined;
|
|
23
|
+
featureFlags?: Partial<Record<"buildRustSource" | "parseWithEsbuild" | "traceWithNft" | "zisi_pure_esm" | "zisi_pure_esm_mjs" | "zisi_output_cjs_extension" | "zisi_unique_entry_file" | "zisi_esbuild_fail_double_glob" | "zisi_golang_use_al2", boolean>> | undefined;
|
|
24
24
|
}) => Promise<FunctionSource | undefined>;
|
|
25
25
|
export {};
|
|
@@ -149,6 +149,15 @@ var __glob = (map) => (path) => {
|
|
|
149
149
|
const inputs = Object.keys(metafile.inputs).map((path) => resolve(path));
|
|
150
150
|
const cleanTempFiles = getCleanupFunction([...bundlePaths.keys()]);
|
|
151
151
|
const additionalPaths = includedFilesFromModuleDetection;
|
|
152
|
+
const updatedWarnings = warnings.map((warning) => {
|
|
153
|
+
if (warning.id === 'empty-import-meta') {
|
|
154
|
+
return {
|
|
155
|
+
...warning,
|
|
156
|
+
text: `"import.meta" is not available and will be empty, use __dirname instead`,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
return warning;
|
|
160
|
+
});
|
|
152
161
|
return {
|
|
153
162
|
additionalPaths,
|
|
154
163
|
bundlePaths,
|
|
@@ -157,7 +166,7 @@ var __glob = (map) => (path) => {
|
|
|
157
166
|
moduleFormat,
|
|
158
167
|
nativeNodeModules,
|
|
159
168
|
outputExtension,
|
|
160
|
-
warnings,
|
|
169
|
+
warnings: updatedWarnings,
|
|
161
170
|
};
|
|
162
171
|
}
|
|
163
172
|
catch (error) {
|
|
@@ -55,8 +55,9 @@ export const processESM = async ({ basePath, cache, config, esmPaths, featureFla
|
|
|
55
55
|
};
|
|
56
56
|
const resolvePath = (relativePath, basePath) => basePath ? resolve(basePath, relativePath) : resolve(relativePath);
|
|
57
57
|
const shouldTranspile = (path, cache, esmPaths, reasons) => {
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
const cached = cache.get(path);
|
|
59
|
+
if (typeof cached === 'boolean') {
|
|
60
|
+
return cached;
|
|
60
61
|
}
|
|
61
62
|
const reason = reasons.get(path);
|
|
62
63
|
// This isn't an expected case, but if the path doesn't exist in `reasons` we
|
|
@@ -73,6 +74,12 @@ const shouldTranspile = (path, cache, esmPaths, reasons) => {
|
|
|
73
74
|
cache.set(path, isESM);
|
|
74
75
|
return isESM;
|
|
75
76
|
}
|
|
77
|
+
// This is called recursively, so it's possible that another iteration will
|
|
78
|
+
// also try to answer the question of whether this path needs transpiling.
|
|
79
|
+
// Assuming, for the sake of this iteration, that the answer is yes, just
|
|
80
|
+
// to avoid an infinite loop. We'll rewrite the map entry with the correct
|
|
81
|
+
// value before the iteration ends.
|
|
82
|
+
cache.set(path, true);
|
|
76
83
|
// The path should be transpiled if every parent will also be transpiled, or
|
|
77
84
|
// if there is no parent.
|
|
78
85
|
const shouldTranspilePath = parentPaths.every((parentPath) => shouldTranspile(parentPath, cache, esmPaths, reasons));
|
|
@@ -88,6 +88,10 @@ const zipFunction = async function ({ archiveFormat, basePath, cache, config = {
|
|
|
88
88
|
if (runtimeAPIVersion === 2) {
|
|
89
89
|
invocationMode = INVOCATION_MODE.Stream;
|
|
90
90
|
}
|
|
91
|
+
// If this is a background function, set the right `invocationMode` value.
|
|
92
|
+
if (name.endsWith('-background')) {
|
|
93
|
+
invocationMode = INVOCATION_MODE.Background;
|
|
94
|
+
}
|
|
91
95
|
return {
|
|
92
96
|
bundler: bundlerName,
|
|
93
97
|
bundlerWarnings,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/zip-it-and-ship-it",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.18.1",
|
|
4
4
|
"description": "Zip it and ship it",
|
|
5
5
|
"main": "./dist/main.js",
|
|
6
6
|
"type": "module",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@netlify/binary-info": "^1.0.0",
|
|
59
59
|
"@netlify/serverless-functions-api": "^1.7.3",
|
|
60
60
|
"@vercel/nft": "^0.23.0",
|
|
61
|
-
"archiver": "^
|
|
61
|
+
"archiver": "^6.0.0",
|
|
62
62
|
"common-path-prefix": "^3.0.0",
|
|
63
63
|
"cp-file": "^10.0.0",
|
|
64
64
|
"es-module-lexer": "^1.0.0",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"yargs": "^17.0.0"
|
|
89
89
|
},
|
|
90
90
|
"devDependencies": {
|
|
91
|
-
"@babel/types": "7.22.
|
|
91
|
+
"@babel/types": "7.22.17",
|
|
92
92
|
"@netlify/eslint-config-node": "7.0.1",
|
|
93
93
|
"@skn0tt/lambda-local": "2.0.3",
|
|
94
94
|
"@types/archiver": "5.3.2",
|
|
@@ -101,18 +101,18 @@
|
|
|
101
101
|
"@types/tmp": "0.2.3",
|
|
102
102
|
"@types/unixify": "1.0.0",
|
|
103
103
|
"@types/yargs": "17.0.24",
|
|
104
|
-
"@vitest/coverage-v8": "0.34.
|
|
104
|
+
"@vitest/coverage-v8": "0.34.4",
|
|
105
105
|
"browserslist": "4.21.10",
|
|
106
106
|
"cardinal": "2.1.1",
|
|
107
107
|
"cpy": "9.0.1",
|
|
108
108
|
"deepmerge": "4.3.1",
|
|
109
|
-
"get-stream": "
|
|
109
|
+
"get-stream": "8.0.1",
|
|
110
110
|
"husky": "8.0.3",
|
|
111
111
|
"is-ci": "3.0.1",
|
|
112
112
|
"npm-run-all": "4.1.5",
|
|
113
113
|
"source-map-support": "0.5.21",
|
|
114
114
|
"typescript": "5.2.2",
|
|
115
|
-
"vitest": "0.34.
|
|
115
|
+
"vitest": "0.34.4"
|
|
116
116
|
},
|
|
117
117
|
"engines": {
|
|
118
118
|
"node": "^14.18.0 || >=16.0.0"
|