@netlify/zip-it-and-ship-it 9.9.0 → 9.10.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,7 +94,7 @@ const zipFunction = async function ({ config, destFolder, filename, mainFile, sr
|
|
|
94
94
|
runtime,
|
|
95
95
|
};
|
|
96
96
|
await zipBinary({ ...zipOptions, srcPath: binary.path, stat: binary.stat });
|
|
97
|
-
return { config, path: zipPath };
|
|
97
|
+
return { config, path: zipPath, entryFilename: zipOptions.filename };
|
|
98
98
|
}
|
|
99
99
|
// We don't need to zip the binary, so we can just copy it to the right path.
|
|
100
100
|
// We do this only if we're not building from source, as otherwise the build
|
|
@@ -105,6 +105,7 @@ const zipFunction = async function ({ config, destFolder, filename, mainFile, sr
|
|
|
105
105
|
return {
|
|
106
106
|
config,
|
|
107
107
|
path: destPath,
|
|
108
|
+
entryFilename: '',
|
|
108
109
|
displayName: config?.name,
|
|
109
110
|
generator: config?.generator || getInternalValue(isInternal),
|
|
110
111
|
};
|
|
@@ -31,7 +31,7 @@ const zipFunction = async function ({ archiveFormat, basePath, cache, config = {
|
|
|
31
31
|
if (extension === '.zip') {
|
|
32
32
|
const destPath = join(destFolder, filename);
|
|
33
33
|
await copyFile(srcPath, destPath);
|
|
34
|
-
return { config, path: destPath };
|
|
34
|
+
return { config, path: destPath, entryFilename: '' };
|
|
35
35
|
}
|
|
36
36
|
const inSourceConfig = await findISCDeclarationsInPath(mainFile, name, featureFlags);
|
|
37
37
|
const runtimeAPIVersion = inSourceConfig.runtimeAPIVersion === 2 ? 2 : 1;
|
|
@@ -96,7 +96,8 @@ const zipFunction = async function ({ archiveFormat, basePath, cache, config = {
|
|
|
96
96
|
invocationMode,
|
|
97
97
|
nativeNodeModules,
|
|
98
98
|
nodeModulesWithDynamicImports,
|
|
99
|
-
path: zipPath,
|
|
99
|
+
path: zipPath.path,
|
|
100
|
+
entryFilename: zipPath.entryFilename,
|
|
100
101
|
runtimeVersion: getNodeRuntime(config.nodeVersion),
|
|
101
102
|
displayName: config?.name,
|
|
102
103
|
generator: config?.generator || getInternalValue(isInternal),
|
|
@@ -18,5 +18,8 @@ interface ZipNodeParameters {
|
|
|
18
18
|
}
|
|
19
19
|
export declare const zipNodeJs: ({ archiveFormat, ...options }: ZipNodeParameters & {
|
|
20
20
|
archiveFormat: ArchiveFormat;
|
|
21
|
-
}) => Promise<
|
|
21
|
+
}) => Promise<{
|
|
22
|
+
path: string;
|
|
23
|
+
entryFilename: string;
|
|
24
|
+
}>;
|
|
22
25
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Buffer } from 'buffer';
|
|
2
2
|
import { mkdir, rm, writeFile } from 'fs/promises';
|
|
3
3
|
import os from 'os';
|
|
4
|
-
import { basename, join } from 'path';
|
|
4
|
+
import { basename, extname, join } from 'path';
|
|
5
5
|
import { getPath as getV2APIPath } from '@netlify/serverless-functions-api';
|
|
6
6
|
import { copyFile } from 'cp-file';
|
|
7
7
|
import pMap from 'p-map';
|
|
@@ -55,7 +55,7 @@ const createDirectory = async function ({ aliases = new Map(), basePath, destFol
|
|
|
55
55
|
}
|
|
56
56
|
return copyFile(srcFile, absoluteDestPath);
|
|
57
57
|
}, { concurrency: COPY_FILE_CONCURRENCY });
|
|
58
|
-
return functionFolder;
|
|
58
|
+
return { path: functionFolder, entryFilename };
|
|
59
59
|
};
|
|
60
60
|
const createZipArchive = async function ({ aliases = new Map(), basePath, cache, destFolder, extension, featureFlags, filename, mainFile, moduleFormat, rewrites, runtimeAPIVersion, srcFiles, }) {
|
|
61
61
|
const destPath = join(destFolder, `${basename(filename, extension)}.zip`);
|
|
@@ -80,6 +80,7 @@ const createZipArchive = async function ({ aliases = new Map(), basePath, cache,
|
|
|
80
80
|
// If there is a naming conflict, we move all user files (everything other
|
|
81
81
|
// than the entry file) to its own sub-directory.
|
|
82
82
|
const userNamespace = hasEntryFileConflict ? DEFAULT_USER_SUBDIRECTORY : '';
|
|
83
|
+
let entryFilename = `${basename(filename, extname(filename))}.js`;
|
|
83
84
|
if (needsEntryFile) {
|
|
84
85
|
const entryFile = getEntryFile({
|
|
85
86
|
commonPrefix: basePath,
|
|
@@ -90,6 +91,7 @@ const createZipArchive = async function ({ aliases = new Map(), basePath, cache,
|
|
|
90
91
|
featureFlags,
|
|
91
92
|
runtimeAPIVersion,
|
|
92
93
|
});
|
|
94
|
+
entryFilename = entryFile.filename;
|
|
93
95
|
addEntryFileToZip(archive, entryFile);
|
|
94
96
|
}
|
|
95
97
|
if (runtimeAPIVersion === 2) {
|
|
@@ -110,7 +112,7 @@ const createZipArchive = async function ({ aliases = new Map(), basePath, cache,
|
|
|
110
112
|
});
|
|
111
113
|
});
|
|
112
114
|
await endZip(archive, output);
|
|
113
|
-
return destPath;
|
|
115
|
+
return { path: destPath, entryFilename };
|
|
114
116
|
};
|
|
115
117
|
export const zipNodeJs = function ({ archiveFormat, ...options }) {
|
|
116
118
|
if (archiveFormat === ARCHIVE_FORMAT.ZIP) {
|
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.10.0",
|
|
4
4
|
"description": "Zip it and ship it",
|
|
5
5
|
"main": "./dist/main.js",
|
|
6
6
|
"type": "module",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@babel/parser": "^7.22.5",
|
|
58
58
|
"@netlify/binary-info": "^1.0.0",
|
|
59
59
|
"@netlify/esbuild": "0.14.39",
|
|
60
|
-
"@netlify/serverless-functions-api": "^1.5.
|
|
60
|
+
"@netlify/serverless-functions-api": "^1.5.1",
|
|
61
61
|
"@vercel/nft": "^0.22.0",
|
|
62
62
|
"archiver": "^5.3.0",
|
|
63
63
|
"common-path-prefix": "^3.0.0",
|
|
@@ -92,14 +92,14 @@
|
|
|
92
92
|
"@types/archiver": "5.3.2",
|
|
93
93
|
"@types/glob": "8.1.0",
|
|
94
94
|
"@types/is-ci": "3.0.0",
|
|
95
|
-
"@types/node": "14.18.
|
|
95
|
+
"@types/node": "14.18.51",
|
|
96
96
|
"@types/normalize-path": "3.0.0",
|
|
97
97
|
"@types/resolve": "1.20.2",
|
|
98
98
|
"@types/semver": "7.5.0",
|
|
99
99
|
"@types/tmp": "0.2.3",
|
|
100
100
|
"@types/unixify": "1.0.0",
|
|
101
101
|
"@types/yargs": "17.0.24",
|
|
102
|
-
"@vitest/coverage-v8": "0.32.
|
|
102
|
+
"@vitest/coverage-v8": "0.32.2",
|
|
103
103
|
"cpy": "9.0.1",
|
|
104
104
|
"deepmerge": "4.3.1",
|
|
105
105
|
"get-stream": "6.0.1",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"npm-run-all": "4.1.5",
|
|
109
109
|
"source-map-support": "0.5.21",
|
|
110
110
|
"typescript": "5.1.3",
|
|
111
|
-
"vitest": "0.32.
|
|
111
|
+
"vitest": "0.32.2"
|
|
112
112
|
},
|
|
113
113
|
"engines": {
|
|
114
114
|
"node": "^14.18.0 || >=16.0.0"
|