@netlify/zip-it-and-ship-it 9.39.6 → 9.40.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.
- package/dist/feature_flags.d.ts +2 -2
- package/dist/feature_flags.js +2 -2
- package/dist/runtimes/node/index.js +2 -1
- package/dist/runtimes/node/utils/entry_file.d.ts +1 -0
- package/dist/runtimes/node/utils/entry_file.js +1 -0
- package/dist/runtimes/node/utils/metadata_file.d.ts +6 -0
- package/dist/runtimes/node/utils/metadata_file.js +5 -0
- package/dist/runtimes/node/utils/zip.d.ts +1 -0
- package/dist/runtimes/node/utils/zip.js +6 -6
- package/dist/runtimes/runtime.d.ts +1 -0
- package/dist/zip.d.ts +4 -8
- package/dist/zip.js +2 -1
- package/package.json +3 -3
package/dist/feature_flags.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare const defaultFlags: {
|
|
|
9
9
|
readonly zisi_esbuild_fail_double_glob: false;
|
|
10
10
|
readonly zisi_fix_symlinks: false;
|
|
11
11
|
readonly zisi_add_instrumentation_loader: true;
|
|
12
|
-
readonly
|
|
12
|
+
readonly zisi_add_metadata_file: false;
|
|
13
13
|
};
|
|
14
14
|
export type FeatureFlags = Partial<Record<keyof typeof defaultFlags, boolean>>;
|
|
15
15
|
export declare const getFlags: (input?: Record<string, boolean>, flags?: {
|
|
@@ -23,5 +23,5 @@ export declare const getFlags: (input?: Record<string, boolean>, flags?: {
|
|
|
23
23
|
readonly zisi_esbuild_fail_double_glob: false;
|
|
24
24
|
readonly zisi_fix_symlinks: false;
|
|
25
25
|
readonly zisi_add_instrumentation_loader: true;
|
|
26
|
-
readonly
|
|
26
|
+
readonly zisi_add_metadata_file: false;
|
|
27
27
|
}) => FeatureFlags;
|
package/dist/feature_flags.js
CHANGED
|
@@ -22,8 +22,8 @@ export const defaultFlags = {
|
|
|
22
22
|
zisi_fix_symlinks: false,
|
|
23
23
|
// Adds the `___netlify-telemetry.mjs` file to the function bundle.
|
|
24
24
|
zisi_add_instrumentation_loader: true,
|
|
25
|
-
// Adds a `___netlify-
|
|
26
|
-
|
|
25
|
+
// Adds a `___netlify-metadata.json` file to the function bundle.
|
|
26
|
+
zisi_add_metadata_file: false,
|
|
27
27
|
};
|
|
28
28
|
// List of supported flags and their default value.
|
|
29
29
|
export const getFlags = (input = {}, flags = defaultFlags) => Object.entries(flags).reduce((result, [key, defaultValue]) => ({
|
|
@@ -28,7 +28,7 @@ const getSrcFilesWithBundler = async (parameters) => {
|
|
|
28
28
|
const result = await bundler.getSrcFiles({ ...parameters, pluginsModulesPath });
|
|
29
29
|
return result.srcFiles;
|
|
30
30
|
};
|
|
31
|
-
const zipFunction = async function ({ archiveFormat, basePath, cache, config = {}, destFolder, extension, featureFlags, filename, isInternal, logger, mainFile, name, repositoryRoot, runtime, srcDir, srcPath, stat, }) {
|
|
31
|
+
const zipFunction = async function ({ archiveFormat, basePath, branch, cache, config = {}, destFolder, extension, featureFlags, filename, isInternal, logger, mainFile, name, repositoryRoot, runtime, srcDir, srcPath, stat, }) {
|
|
32
32
|
// If the file is a zip, we assume the function is bundled and ready to go.
|
|
33
33
|
// We simply copy it to the destination path with no further processing.
|
|
34
34
|
if (extension === '.zip') {
|
|
@@ -72,6 +72,7 @@ const zipFunction = async function ({ archiveFormat, basePath, cache, config = {
|
|
|
72
72
|
aliases,
|
|
73
73
|
archiveFormat,
|
|
74
74
|
basePath: finalBasePath,
|
|
75
|
+
branch,
|
|
75
76
|
cache,
|
|
76
77
|
destFolder,
|
|
77
78
|
extension,
|
|
@@ -3,6 +3,7 @@ import { ModuleFormat } from './module_format.js';
|
|
|
3
3
|
export declare const ENTRY_FILE_NAME = "___netlify-entry-point";
|
|
4
4
|
export declare const BOOTSTRAP_FILE_NAME = "___netlify-bootstrap.mjs";
|
|
5
5
|
export declare const BOOTSTRAP_VERSION_FILE_NAME = "___netlify-bootstrap-version";
|
|
6
|
+
export declare const METADATA_FILE_NAME = "___netlify-metadata.json";
|
|
6
7
|
export declare const TELEMETRY_FILE_NAME = "___netlify-telemetry.mjs";
|
|
7
8
|
export interface EntryFile {
|
|
8
9
|
contents: string;
|
|
@@ -8,6 +8,7 @@ import { normalizeFilePath } from './normalize_path.js';
|
|
|
8
8
|
export const ENTRY_FILE_NAME = '___netlify-entry-point';
|
|
9
9
|
export const BOOTSTRAP_FILE_NAME = '___netlify-bootstrap.mjs';
|
|
10
10
|
export const BOOTSTRAP_VERSION_FILE_NAME = '___netlify-bootstrap-version';
|
|
11
|
+
export const METADATA_FILE_NAME = '___netlify-metadata.json';
|
|
11
12
|
export const TELEMETRY_FILE_NAME = '___netlify-telemetry.mjs';
|
|
12
13
|
const require = createRequire(import.meta.url);
|
|
13
14
|
/**
|
|
@@ -7,7 +7,8 @@ import { copyFile } from 'cp-file';
|
|
|
7
7
|
import pMap from 'p-map';
|
|
8
8
|
import { addZipContent, addZipFile, ARCHIVE_FORMAT, endZip, startZip, } from '../../../archive.js';
|
|
9
9
|
import { cachedLstat, mkdirAndWriteFile } from '../../../utils/fs.js';
|
|
10
|
-
import { BOOTSTRAP_FILE_NAME,
|
|
10
|
+
import { BOOTSTRAP_FILE_NAME, METADATA_FILE_NAME, conflictsWithEntryFile, getEntryFile, getTelemetryFile, isNamedLikeEntryFile, } from './entry_file.js';
|
|
11
|
+
import { getMetadataFile } from './metadata_file.js';
|
|
11
12
|
import { normalizeFilePath } from './normalize_path.js';
|
|
12
13
|
import { getPackageJsonIfAvailable } from './package_json.js';
|
|
13
14
|
// Taken from https://www.npmjs.com/package/cpy.
|
|
@@ -99,7 +100,7 @@ const createDirectory = async function ({ aliases = new Map(), basePath, cache,
|
|
|
99
100
|
});
|
|
100
101
|
return { path: functionFolder, entryFilename };
|
|
101
102
|
};
|
|
102
|
-
const createZipArchive = async function ({ aliases = new Map(), basePath, cache, destFolder, extension, featureFlags, filename, mainFile, moduleFormat, rewrites, runtimeAPIVersion, srcFiles, generator, }) {
|
|
103
|
+
const createZipArchive = async function ({ aliases = new Map(), basePath, branch, cache, destFolder, extension, featureFlags, filename, mainFile, moduleFormat, rewrites, runtimeAPIVersion, srcFiles, generator, }) {
|
|
103
104
|
const destPath = join(destFolder, `${basename(filename, extension)}.zip`);
|
|
104
105
|
const { archive, output } = startZip(destPath);
|
|
105
106
|
// There is a naming conflict with the entry file if one of the supporting
|
|
@@ -142,11 +143,10 @@ const createZipArchive = async function ({ aliases = new Map(), basePath, cache,
|
|
|
142
143
|
}
|
|
143
144
|
if (runtimeAPIVersion === 2) {
|
|
144
145
|
const bootstrapPath = addBootstrapFile(srcFiles, aliases);
|
|
145
|
-
if (featureFlags.
|
|
146
|
+
if (featureFlags.zisi_add_metadata_file === true) {
|
|
146
147
|
const { version: bootstrapVersion } = await getPackageJsonIfAvailable(bootstrapPath);
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
148
|
+
const payload = JSON.stringify(getMetadataFile(bootstrapVersion, branch));
|
|
149
|
+
addZipContent(archive, payload, METADATA_FILE_NAME);
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
const deduplicatedSrcFiles = [...new Set(srcFiles)];
|
package/dist/zip.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { ArchiveFormat } from './archive.js';
|
|
2
2
|
import { Config } from './config.js';
|
|
3
3
|
import { FeatureFlags } from './feature_flags.js';
|
|
4
|
+
import { FunctionResult } from './utils/format_result.js';
|
|
4
5
|
import { LogFunction } from './utils/logger.js';
|
|
5
6
|
export interface ZipFunctionOptions {
|
|
6
7
|
archiveFormat?: ArchiveFormat;
|
|
7
8
|
basePath?: string;
|
|
9
|
+
branch?: string;
|
|
8
10
|
config?: Config;
|
|
9
11
|
featureFlags?: FeatureFlags;
|
|
10
12
|
repositoryRoot?: string;
|
|
@@ -19,11 +21,5 @@ export type ZipFunctionsOptions = ZipFunctionOptions & {
|
|
|
19
21
|
parallelLimit?: number;
|
|
20
22
|
internalSrcFolder?: string;
|
|
21
23
|
};
|
|
22
|
-
export declare const zipFunctions: (relativeSrcFolders: string | string[], destFolder: string, { archiveFormat, basePath, config, configFileDirectories, featureFlags: inputFeatureFlags, manifest, parallelLimit, repositoryRoot, systemLog, debug, internalSrcFolder, }?: ZipFunctionsOptions) => Promise<
|
|
23
|
-
|
|
24
|
-
excludedRoutes?: import("./main.js").Route[];
|
|
25
|
-
runtime: import("./main.js").RuntimeName;
|
|
26
|
-
schedule?: string;
|
|
27
|
-
runtimeAPIVersion?: number;
|
|
28
|
-
})[]>;
|
|
29
|
-
export declare const zipFunction: (relativeSrcPath: string, destFolder: string, { archiveFormat, basePath, config: inputConfig, featureFlags: inputFeatureFlags, repositoryRoot, systemLog, debug, internalSrcFolder, }?: ZipFunctionOptions) => Promise<import("./utils/format_result.js").FunctionResult | undefined>;
|
|
24
|
+
export declare const zipFunctions: (relativeSrcFolders: string | string[], destFolder: string, { archiveFormat, basePath, branch, config, configFileDirectories, featureFlags: inputFeatureFlags, manifest, parallelLimit, repositoryRoot, systemLog, debug, internalSrcFolder, }?: ZipFunctionsOptions) => Promise<FunctionResult[]>;
|
|
25
|
+
export declare const zipFunction: (relativeSrcPath: string, destFolder: string, { archiveFormat, basePath, config: inputConfig, featureFlags: inputFeatureFlags, repositoryRoot, systemLog, debug, internalSrcFolder, }?: ZipFunctionOptions) => Promise<FunctionResult | undefined>;
|
package/dist/zip.js
CHANGED
|
@@ -21,7 +21,7 @@ const validateArchiveFormat = (archiveFormat) => {
|
|
|
21
21
|
};
|
|
22
22
|
// Zip `srcFolder/*` (Node.js or Go files) to `destFolder/*.zip` so it can be
|
|
23
23
|
// used by AWS Lambda
|
|
24
|
-
export const zipFunctions = async function (relativeSrcFolders, destFolder, { archiveFormat = ARCHIVE_FORMAT.ZIP, basePath, config = {}, configFileDirectories, featureFlags: inputFeatureFlags, manifest, parallelLimit = DEFAULT_PARALLEL_LIMIT, repositoryRoot = basePath, systemLog, debug, internalSrcFolder, } = {}) {
|
|
24
|
+
export const zipFunctions = async function (relativeSrcFolders, destFolder, { archiveFormat = ARCHIVE_FORMAT.ZIP, basePath, branch, config = {}, configFileDirectories, featureFlags: inputFeatureFlags, manifest, parallelLimit = DEFAULT_PARALLEL_LIMIT, repositoryRoot = basePath, systemLog, debug, internalSrcFolder, } = {}) {
|
|
25
25
|
validateArchiveFormat(archiveFormat);
|
|
26
26
|
const logger = getLogger(systemLog, debug);
|
|
27
27
|
const cache = new RuntimeCache();
|
|
@@ -46,6 +46,7 @@ export const zipFunctions = async function (relativeSrcFolders, destFolder, { ar
|
|
|
46
46
|
const zipResult = await func.runtime.zipFunction({
|
|
47
47
|
archiveFormat,
|
|
48
48
|
basePath,
|
|
49
|
+
branch,
|
|
49
50
|
cache,
|
|
50
51
|
config: func.config,
|
|
51
52
|
destFolder,
|
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.40.0",
|
|
4
4
|
"description": "Zip it and ship it",
|
|
5
5
|
"main": "./dist/main.js",
|
|
6
6
|
"type": "module",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@babel/parser": "^7.22.5",
|
|
45
45
|
"@babel/types": "7.25.6",
|
|
46
46
|
"@netlify/binary-info": "^1.0.0",
|
|
47
|
-
"@netlify/serverless-functions-api": "^1.
|
|
47
|
+
"@netlify/serverless-functions-api": "^1.29.0",
|
|
48
48
|
"@vercel/nft": "^0.27.1",
|
|
49
49
|
"archiver": "^7.0.0",
|
|
50
50
|
"common-path-prefix": "^3.0.0",
|
|
@@ -105,5 +105,5 @@
|
|
|
105
105
|
"engines": {
|
|
106
106
|
"node": "^14.18.0 || >=16.0.0"
|
|
107
107
|
},
|
|
108
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "b7bfbacf3cf839a6d97057ee16ebd53fb319b4a2"
|
|
109
109
|
}
|