@netlify/zip-it-and-ship-it 5.8.0 → 5.9.2
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/runtimes/node/bundlers/nft/es_modules.d.ts +2 -1
- package/dist/runtimes/node/bundlers/nft/es_modules.js +4 -4
- package/dist/runtimes/node/bundlers/nft/index.js +4 -2
- package/dist/runtimes/node/bundlers/nft/transpile.d.ts +1 -1
- package/dist/runtimes/node/bundlers/nft/transpile.js +23 -12
- package/package.json +7 -7
|
@@ -3,7 +3,7 @@ import type { FunctionConfig } from '../../../../config.js';
|
|
|
3
3
|
import { FeatureFlags } from '../../../../feature_flags.js';
|
|
4
4
|
import { FsCache } from '../../../../utils/fs.js';
|
|
5
5
|
import { ModuleFormat } from '../../utils/module_format.js';
|
|
6
|
-
export declare const processESM: ({ basePath, config, esmPaths, featureFlags, fsCache, mainFile, reasons, }: {
|
|
6
|
+
export declare const processESM: ({ basePath, config, esmPaths, featureFlags, fsCache, mainFile, reasons, name, }: {
|
|
7
7
|
basePath: string | undefined;
|
|
8
8
|
config: FunctionConfig;
|
|
9
9
|
esmPaths: Set<string>;
|
|
@@ -11,6 +11,7 @@ export declare const processESM: ({ basePath, config, esmPaths, featureFlags, fs
|
|
|
11
11
|
fsCache: FsCache;
|
|
12
12
|
mainFile: string;
|
|
13
13
|
reasons: NodeFileTraceReasons;
|
|
14
|
+
name: string;
|
|
14
15
|
}) => Promise<{
|
|
15
16
|
rewrites?: Map<string, string> | undefined;
|
|
16
17
|
moduleFormat: ModuleFormat;
|
|
@@ -28,7 +28,7 @@ const patchESMPackage = async (path, fsCache) => {
|
|
|
28
28
|
};
|
|
29
29
|
return JSON.stringify(patchedPackageJson);
|
|
30
30
|
};
|
|
31
|
-
const processESM = async ({ basePath, config, esmPaths, featureFlags, fsCache, mainFile, reasons, }) => {
|
|
31
|
+
const processESM = async ({ basePath, config, esmPaths, featureFlags, fsCache, mainFile, reasons, name, }) => {
|
|
32
32
|
const entrypointIsESM = isEntrypointESM({ basePath, esmPaths, mainFile });
|
|
33
33
|
if (!entrypointIsESM) {
|
|
34
34
|
return {
|
|
@@ -42,7 +42,7 @@ const processESM = async ({ basePath, config, esmPaths, featureFlags, fsCache, m
|
|
|
42
42
|
moduleFormat: 'esm',
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
const rewrites = await transpileESM({ basePath, config, esmPaths, fsCache, reasons });
|
|
45
|
+
const rewrites = await transpileESM({ basePath, config, esmPaths, fsCache, reasons, name });
|
|
46
46
|
return {
|
|
47
47
|
moduleFormat: 'cjs',
|
|
48
48
|
rewrites,
|
|
@@ -75,7 +75,7 @@ const shouldTranspile = (path, cache, esmPaths, reasons) => {
|
|
|
75
75
|
cache.set(path, shouldTranspilePath);
|
|
76
76
|
return shouldTranspilePath;
|
|
77
77
|
};
|
|
78
|
-
const transpileESM = async ({ basePath, config, esmPaths, fsCache, reasons, }) => {
|
|
78
|
+
const transpileESM = async ({ basePath, config, esmPaths, fsCache, reasons, name, }) => {
|
|
79
79
|
const cache = new Map();
|
|
80
80
|
const pathsToTranspile = [...esmPaths].filter((path) => shouldTranspile(path, cache, esmPaths, reasons));
|
|
81
81
|
const pathsToTranspileSet = new Set(pathsToTranspile);
|
|
@@ -91,7 +91,7 @@ const transpileESM = async ({ basePath, config, esmPaths, fsCache, reasons, }) =
|
|
|
91
91
|
const rewrites = await getPatchedESMPackages(packageJsonPaths, fsCache);
|
|
92
92
|
await Promise.all(pathsToTranspile.map(async (path) => {
|
|
93
93
|
const absolutePath = resolvePath(path, basePath);
|
|
94
|
-
const transpiled = await (0, transpile_js_1.transpile)(absolutePath, config);
|
|
94
|
+
const transpiled = await (0, transpile_js_1.transpile)(absolutePath, config, name);
|
|
95
95
|
rewrites.set(absolutePath, transpiled);
|
|
96
96
|
}));
|
|
97
97
|
return rewrites;
|
|
@@ -15,7 +15,7 @@ const es_modules_js_1 = require("./es_modules.js");
|
|
|
15
15
|
// Paths that will be excluded from the tracing process.
|
|
16
16
|
const ignore = ['node_modules/aws-sdk/**'];
|
|
17
17
|
const appearsToBeModuleName = (name) => !name.startsWith('.');
|
|
18
|
-
const bundle = async ({ basePath, config, featureFlags, mainFile, pluginsModulesPath, repositoryRoot = basePath, }) => {
|
|
18
|
+
const bundle = async ({ basePath, config, featureFlags, mainFile, name, pluginsModulesPath, repositoryRoot = basePath, }) => {
|
|
19
19
|
const { includedFiles = [], includedFilesBasePath } = config;
|
|
20
20
|
const { exclude: excludedPaths, paths: includedFilePaths } = await (0, included_files_js_1.getPathsOfIncludedFiles)(includedFiles, includedFilesBasePath || basePath);
|
|
21
21
|
const { moduleFormat, paths: dependencyPaths, rewrites, } = await traceFilesAndTranspile({
|
|
@@ -24,6 +24,7 @@ const bundle = async ({ basePath, config, featureFlags, mainFile, pluginsModules
|
|
|
24
24
|
featureFlags,
|
|
25
25
|
mainFile,
|
|
26
26
|
pluginsModulesPath,
|
|
27
|
+
name,
|
|
27
28
|
});
|
|
28
29
|
const filteredIncludedPaths = (0, included_files_js_1.filterExcludedPaths)([...dependencyPaths, ...includedFilePaths], excludedPaths);
|
|
29
30
|
const dirnames = filteredIncludedPaths.map((filePath) => (0, path_1.normalize)((0, path_1.dirname)(filePath))).sort();
|
|
@@ -43,7 +44,7 @@ const ignoreFunction = (path) => {
|
|
|
43
44
|
const shouldIgnore = ignore.some((expression) => (0, minimatch_1.default)(normalizedPath, expression));
|
|
44
45
|
return shouldIgnore;
|
|
45
46
|
};
|
|
46
|
-
const traceFilesAndTranspile = async function ({ basePath, config, featureFlags, mainFile, pluginsModulesPath, }) {
|
|
47
|
+
const traceFilesAndTranspile = async function ({ basePath, config, featureFlags, mainFile, pluginsModulesPath, name, }) {
|
|
47
48
|
const fsCache = {};
|
|
48
49
|
const { fileList: dependencyPaths, esmFileList, reasons, } = await (0, nft_1.nodeFileTrace)([mainFile], {
|
|
49
50
|
base: basePath,
|
|
@@ -85,6 +86,7 @@ const traceFilesAndTranspile = async function ({ basePath, config, featureFlags,
|
|
|
85
86
|
fsCache,
|
|
86
87
|
mainFile,
|
|
87
88
|
reasons,
|
|
89
|
+
name,
|
|
88
90
|
});
|
|
89
91
|
return {
|
|
90
92
|
moduleFormat,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { FunctionConfig } from '../../../../config.js';
|
|
2
|
-
export declare const transpile: (path: string, config: FunctionConfig) => Promise<string>;
|
|
2
|
+
export declare const transpile: (path: string, config: FunctionConfig, functionName: string) => Promise<string>;
|
|
@@ -3,21 +3,32 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.transpile = void 0;
|
|
4
4
|
const esbuild_1 = require("@netlify/esbuild");
|
|
5
5
|
const bundler_target_js_1 = require("../esbuild/bundler_target.js");
|
|
6
|
-
const transpile = async (path, config) => {
|
|
6
|
+
const transpile = async (path, config, functionName) => {
|
|
7
7
|
// The version of ECMAScript to use as the build target. This will determine
|
|
8
8
|
// whether certain features are transpiled down or left untransformed.
|
|
9
9
|
const nodeTarget = (0, bundler_target_js_1.getBundlerTarget)(config.nodeVersion);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
try {
|
|
11
|
+
const transpiled = await (0, esbuild_1.build)({
|
|
12
|
+
bundle: false,
|
|
13
|
+
entryPoints: [path],
|
|
14
|
+
format: 'cjs',
|
|
15
|
+
logLevel: 'error',
|
|
16
|
+
platform: 'node',
|
|
17
|
+
sourcemap: Boolean(config.nodeSourcemap),
|
|
18
|
+
target: [nodeTarget],
|
|
19
|
+
write: false,
|
|
20
|
+
});
|
|
21
|
+
return transpiled.outputFiles[0].text;
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
const bundler = 'nft';
|
|
25
|
+
const runtime = 'js';
|
|
26
|
+
error.customErrorInfo = {
|
|
27
|
+
type: 'functionsBundling',
|
|
28
|
+
location: { bundler, functionName, runtime },
|
|
29
|
+
};
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
21
32
|
};
|
|
22
33
|
exports.transpile = transpile;
|
|
23
34
|
//# sourceMappingURL=transpile.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/zip-it-and-ship-it",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.9.2",
|
|
4
4
|
"description": "Zip it and ship it",
|
|
5
5
|
"main": "./dist/main.js",
|
|
6
6
|
"bin": {
|
|
@@ -53,15 +53,15 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@babel/parser": "7.16.8",
|
|
56
|
-
"@netlify/esbuild": "
|
|
57
|
-
"@vercel/nft": "^0.
|
|
56
|
+
"@netlify/esbuild": "0.14.25",
|
|
57
|
+
"@vercel/nft": "^0.18.0",
|
|
58
58
|
"archiver": "^5.3.0",
|
|
59
59
|
"common-path-prefix": "^3.0.0",
|
|
60
60
|
"cp-file": "^9.0.0",
|
|
61
61
|
"del": "^6.0.0",
|
|
62
62
|
"elf-cam": "^0.1.1",
|
|
63
63
|
"end-of-stream": "^1.4.4",
|
|
64
|
-
"es-module-lexer": "^0.
|
|
64
|
+
"es-module-lexer": "^0.10.0",
|
|
65
65
|
"execa": "^5.0.0",
|
|
66
66
|
"filter-obj": "^2.0.1",
|
|
67
67
|
"find-up": "^5.0.0",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"p-map": "^4.0.0",
|
|
75
75
|
"path-exists": "^4.0.0",
|
|
76
76
|
"pkg-dir": "^5.0.0",
|
|
77
|
-
"precinct": "^
|
|
77
|
+
"precinct": "^9.0.1",
|
|
78
78
|
"read-package-json-fast": "^2.0.2",
|
|
79
79
|
"require-package-name": "^2.0.1",
|
|
80
80
|
"resolve": "^2.0.0-next.1",
|
|
@@ -86,14 +86,14 @@
|
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
88
|
"@babel/types": "^7.15.6",
|
|
89
|
-
"@netlify/eslint-config-node": "^
|
|
89
|
+
"@netlify/eslint-config-node": "^6.0.0",
|
|
90
90
|
"@types/archiver": "^5.1.1",
|
|
91
91
|
"@types/end-of-stream": "^1.4.1",
|
|
92
92
|
"@types/resolve": "^1.20.1",
|
|
93
93
|
"@types/semver": "^7.3.8",
|
|
94
94
|
"@types/unixify": "^1.0.0",
|
|
95
95
|
"@types/yargs": "^17.0.4",
|
|
96
|
-
"ava": "^
|
|
96
|
+
"ava": "^4.0.0",
|
|
97
97
|
"c8": "^7.11.0",
|
|
98
98
|
"cpy": "^8.0.0",
|
|
99
99
|
"deepmerge": "^4.2.2",
|