@netlify/zip-it-and-ship-it 5.5.2 → 5.7.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.
Files changed (34) hide show
  1. package/dist/bin.js +2 -1
  2. package/dist/config.d.ts +3 -4
  3. package/dist/feature_flags.js +1 -0
  4. package/dist/runtimes/go/builder.js +1 -1
  5. package/dist/runtimes/node/bundlers/esbuild/index.js +1 -0
  6. package/dist/runtimes/node/bundlers/esbuild/special_cases.js +1 -10
  7. package/dist/runtimes/node/bundlers/index.d.ts +9 -2
  8. package/dist/runtimes/node/bundlers/index.js +21 -1
  9. package/dist/runtimes/node/bundlers/nft/es_modules.d.ts +10 -3
  10. package/dist/runtimes/node/bundlers/nft/es_modules.js +34 -5
  11. package/dist/runtimes/node/bundlers/nft/index.js +15 -4
  12. package/dist/runtimes/node/bundlers/zisi/index.js +1 -0
  13. package/dist/runtimes/node/bundlers/zisi/list_imports.js +5 -1
  14. package/dist/runtimes/node/bundlers/zisi/nested.js +8 -4
  15. package/dist/runtimes/node/bundlers/zisi/resolve.js +5 -3
  16. package/dist/runtimes/node/index.d.ts +1 -1
  17. package/dist/runtimes/node/index.js +4 -22
  18. package/dist/runtimes/node/utils/entry_file.d.ts +13 -0
  19. package/dist/runtimes/node/utils/entry_file.js +24 -0
  20. package/dist/runtimes/node/utils/module_format.d.ts +1 -0
  21. package/dist/runtimes/node/utils/module_format.js +3 -0
  22. package/dist/runtimes/node/utils/node_version.d.ts +10 -0
  23. package/dist/runtimes/node/utils/node_version.js +35 -0
  24. package/dist/runtimes/node/utils/normalize_path.d.ts +6 -0
  25. package/dist/runtimes/node/utils/normalize_path.js +20 -0
  26. package/dist/runtimes/node/utils/package_json.d.ts +2 -1
  27. package/dist/runtimes/node/utils/package_json.js +11 -1
  28. package/dist/runtimes/node/utils/zip.d.ts +2 -0
  29. package/dist/runtimes/node/utils/zip.js +9 -28
  30. package/dist/runtimes/runtime.d.ts +1 -1
  31. package/dist/runtimes/rust/builder.js +4 -4
  32. package/dist/utils/shell.d.ts +21 -1
  33. package/dist/utils/shell.js +2 -2
  34. package/package.json +8 -7
package/dist/bin.js CHANGED
@@ -6,6 +6,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  const process_1 = require("process");
8
8
  const yargs_1 = __importDefault(require("yargs"));
9
+ const helpers_1 = require("yargs/helpers");
9
10
  const main_1 = require("./main");
10
11
  // CLI entry point
11
12
  const runCli = async function () {
@@ -23,7 +24,7 @@ const runCli = async function () {
23
24
  }
24
25
  };
25
26
  const parseArgs = function () {
26
- return yargs_1.default
27
+ return (0, yargs_1.default)((0, helpers_1.hideBin)(process_1.argv))
27
28
  .command('* <srcFolder> <destFolder>', 'Create ZIP archives from a directory')
28
29
  .options(OPTIONS)
29
30
  .usage(USAGE)
package/dist/config.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { FunctionSource } from './function';
2
- import type { NodeBundlerName } from './runtimes/node';
3
- declare type SupportedVersionNumbers = 8 | 10 | 12 | 14;
4
- declare type NodeVersion = `${SupportedVersionNumbers}.x` | `nodejs${SupportedVersionNumbers}.x`;
2
+ import type { NodeVersionString } from './runtimes/node';
3
+ import type { NodeBundlerName } from './runtimes/node/bundlers';
5
4
  interface FunctionConfig {
6
5
  externalNodeModules?: string[];
7
6
  includedFiles?: string[];
@@ -9,7 +8,7 @@ interface FunctionConfig {
9
8
  ignoredNodeModules?: string[];
10
9
  nodeBundler?: NodeBundlerName;
11
10
  nodeSourcemap?: boolean;
12
- nodeVersion?: NodeVersion;
11
+ nodeVersion?: NodeVersionString;
13
12
  processDynamicNodeImports?: boolean;
14
13
  rustTargetDirectory?: string;
15
14
  schedule?: string;
@@ -8,6 +8,7 @@ const FLAGS = {
8
8
  defaultEsModulesToEsbuild: Boolean(process_1.env.NETLIFY_EXPERIMENTAL_DEFAULT_ES_MODULES_TO_ESBUILD),
9
9
  parseWithEsbuild: false,
10
10
  traceWithNft: false,
11
+ zisi_pure_esm: false,
11
12
  };
12
13
  exports.defaultFlags = FLAGS;
13
14
  // List of supported flags and their default value.
@@ -7,7 +7,7 @@ const shell_1 = require("../../utils/shell");
7
7
  const build = async ({ destPath, mainFile, srcDir }) => {
8
8
  const functionName = (0, path_1.basename)(srcDir);
9
9
  try {
10
- await (0, shell_1.runCommand)('go', ['build', '-o', destPath, '-ldflags', '-s -w'], {
10
+ await shell_1.shellUtils.runCommand('go', ['build', '-o', destPath, '-ldflags', '-s -w'], {
11
11
  cwd: srcDir,
12
12
  env: {
13
13
  CGO_ENABLED: '0',
@@ -78,6 +78,7 @@ const bundle = async ({ basePath, config = {}, extension, featureFlags, filename
78
78
  bundlerWarnings,
79
79
  inputs,
80
80
  mainFile: normalizedMainFile,
81
+ moduleFormat: 'cjs',
81
82
  nativeNodeModules,
82
83
  nodeModulesWithDynamicImports,
83
84
  srcFiles: [...supportingSrcFiles, ...bundlePaths.keys()],
@@ -4,15 +4,6 @@ exports.getExternalAndIgnoredModulesFromSpecialCases = void 0;
4
4
  const package_json_1 = require("../../utils/package_json");
5
5
  const EXTERNAL_MODULES = ['@prisma/client'];
6
6
  const IGNORED_MODULES = ['aws-sdk'];
7
- const getPackageJsonIfAvailable = async (srcDir) => {
8
- try {
9
- const packageJson = await (0, package_json_1.getPackageJson)(srcDir);
10
- return packageJson;
11
- }
12
- catch {
13
- return {};
14
- }
15
- };
16
7
  const getModulesForNextJs = ({ dependencies, devDependencies }) => {
17
8
  const allDependencies = { ...dependencies, ...devDependencies };
18
9
  const externalModules = allDependencies.next ? ['critters', 'nanoid'] : [];
@@ -23,7 +14,7 @@ const getModulesForNextJs = ({ dependencies, devDependencies }) => {
23
14
  };
24
15
  };
25
16
  const getExternalAndIgnoredModulesFromSpecialCases = async ({ srcDir }) => {
26
- const { dependencies = {}, devDependencies = {} } = await getPackageJsonIfAvailable(srcDir);
17
+ const { dependencies = {}, devDependencies = {} } = await (0, package_json_1.getPackageJsonIfAvailable)(srcDir);
27
18
  const { externalModules: nextJsExternalModules, ignoredModules: nextJsIgnoredModules } = getModulesForNextJs({
28
19
  dependencies,
29
20
  devDependencies,
@@ -1,8 +1,9 @@
1
1
  import type { Message } from '@netlify/esbuild';
2
- import type { NodeBundlerName } from '..';
3
2
  import { FunctionConfig } from '../../../config';
4
3
  import { FeatureFlag, FeatureFlags } from '../../../feature_flags';
5
4
  import { FunctionSource } from '../../../function';
5
+ import { ModuleFormat } from '../utils/module_format';
6
+ export declare type NodeBundlerName = 'esbuild' | 'esbuild_zisi' | 'nft' | 'zisi';
6
7
  declare type BundlerWarning = Message;
7
8
  declare type CleanupFunction = () => Promise<void>;
8
9
  declare type NativeNodeModules = Record<string, Record<string, string | undefined>>;
@@ -20,6 +21,7 @@ declare type BundleFunction = (args: {
20
21
  cleanupFunction?: CleanupFunction;
21
22
  inputs: string[];
22
23
  mainFile: string;
24
+ moduleFormat: ModuleFormat;
23
25
  nativeNodeModules?: NativeNodeModules;
24
26
  nodeModulesWithDynamicImports?: string[];
25
27
  srcFiles: string[];
@@ -36,5 +38,10 @@ interface NodeBundler {
36
38
  getSrcFiles: GetSrcFilesFunction;
37
39
  }
38
40
  declare const getBundler: (name: NodeBundlerName) => NodeBundler;
39
- export { getBundler };
41
+ declare const getDefaultBundler: ({ extension, mainFile, featureFlags, }: {
42
+ extension: string;
43
+ mainFile: string;
44
+ featureFlags: FeatureFlags;
45
+ }) => Promise<NodeBundlerName>;
46
+ export { getBundler, getDefaultBundler };
40
47
  export type { BundleFunction, GetSrcFilesFunction, NativeNodeModules };
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getBundler = void 0;
6
+ exports.getDefaultBundler = exports.getBundler = void 0;
7
+ const detect_es_module_1 = require("../utils/detect_es_module");
7
8
  const esbuild_1 = __importDefault(require("./esbuild"));
8
9
  const nft_1 = __importDefault(require("./nft"));
9
10
  const zisi_1 = __importDefault(require("./zisi"));
@@ -21,4 +22,23 @@ const getBundler = (name) => {
21
22
  }
22
23
  };
23
24
  exports.getBundler = getBundler;
25
+ // We use ZISI as the default bundler, except for certain extensions, for which
26
+ // esbuild is the only option.
27
+ const getDefaultBundler = async ({ extension, mainFile, featureFlags, }) => {
28
+ const { defaultEsModulesToEsbuild, traceWithNft } = featureFlags;
29
+ if (['.mjs', '.ts'].includes(extension)) {
30
+ return 'esbuild';
31
+ }
32
+ if (traceWithNft) {
33
+ return 'nft';
34
+ }
35
+ if (defaultEsModulesToEsbuild) {
36
+ const isEsModule = await (0, detect_es_module_1.detectEsModule)({ mainFile });
37
+ if (isEsModule) {
38
+ return 'esbuild';
39
+ }
40
+ }
41
+ return 'zisi';
42
+ };
43
+ exports.getDefaultBundler = getDefaultBundler;
24
44
  //# sourceMappingURL=index.js.map
@@ -1,11 +1,18 @@
1
1
  import { NodeFileTraceReasons } from '@vercel/nft';
2
2
  import type { FunctionConfig } from '../../../../config';
3
+ import { FeatureFlags } from '../../../../feature_flags';
3
4
  import { FsCache } from '../../../../utils/fs';
4
- declare const transpileESM: ({ basePath, config, esmPaths, fsCache, reasons, }: {
5
+ import { ModuleFormat } from '../../utils/module_format';
6
+ declare const processESM: ({ basePath, config, esmPaths, featureFlags, fsCache, mainFile, reasons, }: {
5
7
  basePath: string | undefined;
6
8
  config: FunctionConfig;
7
9
  esmPaths: Set<string>;
10
+ featureFlags: FeatureFlags;
8
11
  fsCache: FsCache;
12
+ mainFile: string;
9
13
  reasons: NodeFileTraceReasons;
10
- }) => Promise<Map<string, string>>;
11
- export { transpileESM };
14
+ }) => Promise<{
15
+ rewrites?: Map<string, string> | undefined;
16
+ moduleFormat: ModuleFormat;
17
+ }>;
18
+ export { processESM };
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.transpileESM = void 0;
3
+ exports.processESM = void 0;
4
4
  const path_1 = require("path");
5
5
  const fs_1 = require("../../../../utils/fs");
6
+ const node_version_1 = require("../../utils/node_version");
7
+ const package_json_1 = require("../../utils/package_json");
6
8
  const transpile_1 = require("./transpile");
7
9
  const getPatchedESMPackages = async (packages, fsCache) => {
8
10
  const patchedPackages = await Promise.all(packages.map((path) => patchESMPackage(path, fsCache)));
@@ -12,6 +14,11 @@ const getPatchedESMPackages = async (packages, fsCache) => {
12
14
  });
13
15
  return patchedPackagesMap;
14
16
  };
17
+ const isEntrypointESM = ({ basePath, esmPaths, mainFile, }) => {
18
+ const absoluteESMPaths = new Set([...esmPaths].map((path) => resolvePath(path, basePath)));
19
+ const entrypointIsESM = absoluteESMPaths.has(mainFile);
20
+ return entrypointIsESM;
21
+ };
15
22
  const patchESMPackage = async (path, fsCache) => {
16
23
  const file = (await (0, fs_1.cachedReadFile)(fsCache, path, 'utf8'));
17
24
  const packageJson = JSON.parse(file);
@@ -21,6 +28,28 @@ const patchESMPackage = async (path, fsCache) => {
21
28
  };
22
29
  return JSON.stringify(patchedPackageJson);
23
30
  };
31
+ const processESM = async ({ basePath, config, esmPaths, featureFlags, fsCache, mainFile, reasons, }) => {
32
+ const entrypointIsESM = isEntrypointESM({ basePath, esmPaths, mainFile });
33
+ if (!entrypointIsESM) {
34
+ return {
35
+ moduleFormat: 'cjs',
36
+ };
37
+ }
38
+ const packageJson = await (0, package_json_1.getPackageJsonIfAvailable)((0, path_1.dirname)(mainFile));
39
+ const nodeSupport = (0, node_version_1.getNodeSupportMatrix)(config.nodeVersion);
40
+ if (featureFlags.zisi_pure_esm && packageJson.type === 'module' && nodeSupport.esm) {
41
+ return {
42
+ moduleFormat: 'esm',
43
+ };
44
+ }
45
+ const rewrites = await transpileESM({ basePath, config, esmPaths, fsCache, reasons });
46
+ return {
47
+ moduleFormat: 'cjs',
48
+ rewrites,
49
+ };
50
+ };
51
+ exports.processESM = processESM;
52
+ const resolvePath = (relativePath, basePath) => basePath ? (0, path_1.resolve)(basePath, relativePath) : (0, path_1.resolve)(relativePath);
24
53
  const shouldTranspile = (path, cache, esmPaths, reasons) => {
25
54
  if (cache.has(path)) {
26
55
  return cache.get(path);
@@ -33,15 +62,16 @@ const shouldTranspile = (path, cache, esmPaths, reasons) => {
33
62
  return false;
34
63
  }
35
64
  const { parents } = reason;
65
+ const parentPaths = [...parents].filter((parentPath) => parentPath !== path);
36
66
  // If the path is an entrypoint, we transpile it only if it's an ESM file.
37
- if (parents.size === 0) {
67
+ if (parentPaths.length === 0) {
38
68
  const isESM = esmPaths.has(path);
39
69
  cache.set(path, isESM);
40
70
  return isESM;
41
71
  }
42
72
  // The path should be transpiled if every parent will also be transpiled, or
43
73
  // if there is no parent.
44
- const shouldTranspilePath = [...parents].every((parentPath) => shouldTranspile(parentPath, cache, esmPaths, reasons));
74
+ const shouldTranspilePath = parentPaths.every((parentPath) => shouldTranspile(parentPath, cache, esmPaths, reasons));
45
75
  cache.set(path, shouldTranspilePath);
46
76
  return shouldTranspilePath;
47
77
  };
@@ -60,11 +90,10 @@ const transpileESM = async ({ basePath, config, esmPaths, fsCache, reasons, }) =
60
90
  .map(([path]) => (basePath ? (0, path_1.resolve)(basePath, path) : (0, path_1.resolve)(path)));
61
91
  const rewrites = await getPatchedESMPackages(packageJsonPaths, fsCache);
62
92
  await Promise.all(pathsToTranspile.map(async (path) => {
63
- const absolutePath = basePath ? (0, path_1.resolve)(basePath, path) : (0, path_1.resolve)(path);
93
+ const absolutePath = resolvePath(path, basePath);
64
94
  const transpiled = await (0, transpile_1.transpile)(absolutePath, config);
65
95
  rewrites.set(absolutePath, transpiled);
66
96
  }));
67
97
  return rewrites;
68
98
  };
69
- exports.transpileESM = transpileESM;
70
99
  //# sourceMappingURL=es_modules.js.map
@@ -15,12 +15,13 @@ const es_modules_1 = require("./es_modules");
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, mainFile, pluginsModulesPath, repositoryRoot = basePath, }) => {
18
+ const bundle = async ({ basePath, config, featureFlags, mainFile, pluginsModulesPath, repositoryRoot = basePath, }) => {
19
19
  const { includedFiles = [], includedFilesBasePath } = config;
20
20
  const { exclude: excludedPaths, paths: includedFilePaths } = await (0, included_files_1.getPathsOfIncludedFiles)(includedFiles, includedFilesBasePath || basePath);
21
- const { paths: dependencyPaths, rewrites } = await traceFilesAndTranspile({
21
+ const { moduleFormat, paths: dependencyPaths, rewrites, } = await traceFilesAndTranspile({
22
22
  basePath: repositoryRoot,
23
23
  config,
24
+ featureFlags,
24
25
  mainFile,
25
26
  pluginsModulesPath,
26
27
  });
@@ -32,6 +33,7 @@ const bundle = async ({ basePath, config, mainFile, pluginsModulesPath, reposito
32
33
  basePath: (0, base_path_1.getBasePath)(dirnames),
33
34
  inputs: dependencyPaths,
34
35
  mainFile,
36
+ moduleFormat,
35
37
  rewrites,
36
38
  srcFiles,
37
39
  };
@@ -41,7 +43,7 @@ const ignoreFunction = (path) => {
41
43
  const shouldIgnore = ignore.some((expression) => (0, minimatch_1.default)(normalizedPath, expression));
42
44
  return shouldIgnore;
43
45
  };
44
- const traceFilesAndTranspile = async function ({ basePath, config, mainFile, pluginsModulesPath, }) {
46
+ const traceFilesAndTranspile = async function ({ basePath, config, featureFlags, mainFile, pluginsModulesPath, }) {
45
47
  const fsCache = {};
46
48
  const { fileList: dependencyPaths, esmFileList, reasons, } = await (0, nft_1.nodeFileTrace)([mainFile], {
47
49
  base: basePath,
@@ -75,8 +77,17 @@ const traceFilesAndTranspile = async function ({ basePath, config, mainFile, plu
75
77
  },
76
78
  });
77
79
  const normalizedDependencyPaths = [...dependencyPaths].map((path) => basePath ? (0, path_1.resolve)(basePath, path) : (0, path_1.resolve)(path));
78
- const rewrites = await (0, es_modules_1.transpileESM)({ basePath, config, esmPaths: esmFileList, fsCache, reasons });
80
+ const { moduleFormat, rewrites } = await (0, es_modules_1.processESM)({
81
+ basePath,
82
+ config,
83
+ esmPaths: esmFileList,
84
+ featureFlags,
85
+ fsCache,
86
+ mainFile,
87
+ reasons,
88
+ });
79
89
  return {
90
+ moduleFormat,
80
91
  paths: normalizedDependencyPaths,
81
92
  rewrites,
82
93
  };
@@ -26,6 +26,7 @@ const bundle = async ({ basePath, config, extension, featureFlags, filename, mai
26
26
  basePath: (0, base_path_1.getBasePath)(dirnames),
27
27
  inputs: srcFiles,
28
28
  mainFile,
29
+ moduleFormat: 'cjs',
29
30
  srcFiles,
30
31
  };
31
32
  };
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.handleModuleNotFound = exports.getNestedDependencies = void 0;
4
- const semver_1 = require("semver");
7
+ const semver_1 = __importDefault(require("semver"));
5
8
  // Apply the Node.js module logic recursively on its own dependencies, using
6
9
  // the `package.json` `dependencies`, `peerDependencies` and
7
10
  // `optionalDependencies` keys
@@ -57,7 +60,8 @@ const isOptionalModule = function (moduleName, { optionalDependencies = {}, peer
57
60
  peerDependencies[moduleName] !== undefined));
58
61
  };
59
62
  const MIN_NEXT_VERSION = '10.0.4';
60
- const satisfiesRange = (range) => Boolean((0, semver_1.validRange)(range)) && ((0, semver_1.satisfies)(MIN_NEXT_VERSION, range) || (0, semver_1.ltr)(MIN_NEXT_VERSION, range));
63
+ const satisfiesRange = (range) => Boolean(semver_1.default.validRange(range)) &&
64
+ (semver_1.default.satisfies(MIN_NEXT_VERSION, range) || semver_1.default.ltr(MIN_NEXT_VERSION, range));
61
65
  // 'critters' is used only in Next.js >= 10.0.4 when enabling an experimental option and has to be installed manually
62
66
  // we ignore it if it's missing
63
67
  const isExternalCrittersModule = function (moduleName, { dependencies = {}, devDependencies = {} }) {
@@ -70,8 +74,8 @@ const isExternalCrittersModule = function (moduleName, { dependencies = {}, devD
70
74
  }
71
75
  // can the declared Next.js version resolve to >=10.0.4 ?
72
76
  // test exact versions
73
- if ((0, semver_1.valid)(nextVersion)) {
74
- return (0, semver_1.gte)(nextVersion, MIN_NEXT_VERSION);
77
+ if (semver_1.default.valid(nextVersion)) {
78
+ return semver_1.default.gte(nextVersion, MIN_NEXT_VERSION);
75
79
  }
76
80
  return satisfiesRange(nextVersion);
77
81
  };
@@ -4,11 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.resolvePathPreserveSymlinks = exports.resolvePackage = void 0;
7
+ const module_1 = require("module");
7
8
  const process_1 = require("process");
8
9
  const find_up_1 = __importDefault(require("find-up"));
9
10
  const path_exists_1 = __importDefault(require("path-exists"));
10
11
  const resolve_1 = __importDefault(require("resolve"));
11
- const semver_1 = require("semver");
12
+ const semver_1 = __importDefault(require("semver"));
13
+ const requireLib = (0, module_1.createRequire)(__filename);
12
14
  const BACKSLASH_REGEXP = /\\/g;
13
15
  // Find the path to a module's `package.json`
14
16
  // We need to use `resolve` instead of `require.resolve()` because:
@@ -29,7 +31,7 @@ const resolvePackage = async function (moduleName, baseDirs) {
29
31
  return await resolvePathPreserveSymlinks(`${moduleName}/package.json`, baseDirs);
30
32
  }
31
33
  catch (error) {
32
- if ((0, semver_1.lt)(process_1.version, REQUEST_RESOLVE_MIN_VERSION)) {
34
+ if (semver_1.default.lt(process_1.version, REQUEST_RESOLVE_MIN_VERSION)) {
33
35
  throw error;
34
36
  }
35
37
  try {
@@ -75,7 +77,7 @@ const resolvePathPreserveSymlinks = async function (path, baseDirs) {
75
77
  };
76
78
  exports.resolvePathPreserveSymlinks = resolvePathPreserveSymlinks;
77
79
  const resolvePathFollowSymlinks = function (path, baseDirs) {
78
- return require.resolve(path, { paths: baseDirs });
80
+ return requireLib.resolve(path, { paths: baseDirs });
79
81
  };
80
82
  // `require.resolve()` on a module's specific file (like `package.json`)
81
83
  // can be forbidden by the package author by using an `exports` field in
@@ -1,4 +1,4 @@
1
1
  import { Runtime } from '../runtime';
2
- export declare type NodeBundlerName = 'esbuild' | 'esbuild_zisi' | 'nft' | 'zisi';
2
+ export { NodeVersionString } from './utils/node_version';
3
3
  declare const runtime: Runtime;
4
4
  export default runtime;
@@ -8,33 +8,14 @@ const cp_file_1 = __importDefault(require("cp-file"));
8
8
  const bundlers_1 = require("./bundlers");
9
9
  const finder_1 = require("./finder");
10
10
  const in_source_config_1 = require("./in_source_config");
11
- const detect_es_module_1 = require("./utils/detect_es_module");
12
11
  const plugin_modules_path_1 = require("./utils/plugin_modules_path");
13
12
  const zip_1 = require("./utils/zip");
14
- // We use ZISI as the default bundler, except for certain extensions, for which
15
- // esbuild is the only option.
16
- const getDefaultBundler = async ({ extension, mainFile, featureFlags, }) => {
17
- const { defaultEsModulesToEsbuild, traceWithNft } = featureFlags;
18
- if (['.mjs', '.ts'].includes(extension)) {
19
- return 'esbuild';
20
- }
21
- if (traceWithNft) {
22
- return 'nft';
23
- }
24
- if (defaultEsModulesToEsbuild) {
25
- const isEsModule = await (0, detect_es_module_1.detectEsModule)({ mainFile });
26
- if (isEsModule) {
27
- return 'esbuild';
28
- }
29
- }
30
- return 'zisi';
31
- };
32
13
  // A proxy for the `getSrcFiles` function which adds a default `bundler` using
33
14
  // the `getDefaultBundler` function.
34
15
  const getSrcFilesWithBundler = async (parameters) => {
35
16
  const pluginsModulesPath = await (0, plugin_modules_path_1.getPluginsModulesPath)(parameters.srcDir);
36
17
  const bundlerName = parameters.config.nodeBundler ||
37
- (await getDefaultBundler({
18
+ (await (0, bundlers_1.getDefaultBundler)({
38
19
  extension: parameters.extension,
39
20
  featureFlags: parameters.featureFlags,
40
21
  mainFile: parameters.mainFile,
@@ -44,7 +25,7 @@ const getSrcFilesWithBundler = async (parameters) => {
44
25
  };
45
26
  const zipFunction = async function ({ archiveFormat, basePath, config = {}, destFolder, extension, featureFlags, filename, mainFile, name, repositoryRoot, runtime, srcDir, srcPath, stat, }) {
46
27
  const pluginsModulesPath = await (0, plugin_modules_path_1.getPluginsModulesPath)(srcDir);
47
- const bundlerName = config.nodeBundler || (await getDefaultBundler({ extension, mainFile, featureFlags }));
28
+ const bundlerName = config.nodeBundler || (await (0, bundlers_1.getDefaultBundler)({ extension, mainFile, featureFlags }));
48
29
  const bundler = (0, bundlers_1.getBundler)(bundlerName);
49
30
  // If the file is a zip, we assume the function is bundled and ready to go.
50
31
  // We simply copy it to the destination path with no further processing.
@@ -53,7 +34,7 @@ const zipFunction = async function ({ archiveFormat, basePath, config = {}, dest
53
34
  await (0, cp_file_1.default)(srcPath, destPath);
54
35
  return { config, path: destPath };
55
36
  }
56
- const { aliases = new Map(), cleanupFunction, basePath: finalBasePath, bundlerWarnings, inputs, mainFile: finalMainFile = mainFile, nativeNodeModules, nodeModulesWithDynamicImports, rewrites, srcFiles, } = await bundler.bundle({
37
+ const { aliases = new Map(), cleanupFunction, basePath: finalBasePath, bundlerWarnings, inputs, mainFile: finalMainFile = mainFile, moduleFormat, nativeNodeModules, nodeModulesWithDynamicImports, rewrites, srcFiles, } = await bundler.bundle({
57
38
  basePath,
58
39
  config,
59
40
  extension,
@@ -78,6 +59,7 @@ const zipFunction = async function ({ archiveFormat, basePath, config = {}, dest
78
59
  extension,
79
60
  filename,
80
61
  mainFile: finalMainFile,
62
+ moduleFormat,
81
63
  rewrites,
82
64
  srcFiles,
83
65
  });
@@ -0,0 +1,13 @@
1
+ import type { ModuleFormat } from './module_format';
2
+ interface EntryFile {
3
+ contents: string;
4
+ filename: string;
5
+ }
6
+ declare const getEntryFile: ({ commonPrefix, filename, mainFile, moduleFormat, userNamespace, }: {
7
+ commonPrefix: string;
8
+ filename: string;
9
+ mainFile: string;
10
+ moduleFormat: ModuleFormat;
11
+ userNamespace: string;
12
+ }) => EntryFile;
13
+ export { EntryFile, getEntryFile };
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEntryFile = void 0;
4
+ const path_1 = require("path");
5
+ const normalize_path_1 = require("./normalize_path");
6
+ const getEntryFileContents = (mainPath, moduleFormat) => {
7
+ const importPath = `.${mainPath.startsWith('/') ? mainPath : `/${mainPath}`}`;
8
+ if (moduleFormat === 'cjs') {
9
+ return `module.exports = require('${importPath}')`;
10
+ }
11
+ return `export { handler } from '${importPath}'`;
12
+ };
13
+ const getEntryFile = ({ commonPrefix, filename, mainFile, moduleFormat, userNamespace, }) => {
14
+ const mainPath = (0, normalize_path_1.normalizeFilePath)({ commonPrefix, path: mainFile, userNamespace });
15
+ const extension = (0, path_1.extname)(filename);
16
+ const entryFilename = `${(0, path_1.basename)(filename, extension)}.js`;
17
+ const contents = getEntryFileContents(mainPath, moduleFormat);
18
+ return {
19
+ contents,
20
+ filename: entryFilename,
21
+ };
22
+ };
23
+ exports.getEntryFile = getEntryFile;
24
+ //# sourceMappingURL=entry_file.js.map
@@ -0,0 +1 @@
1
+ export declare type ModuleFormat = 'cjs' | 'esm';
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=module_format.js.map
@@ -0,0 +1,10 @@
1
+ declare type SupportedVersionNumbers = 8 | 10 | 12 | 14;
2
+ declare type NodeVersionString = `${SupportedVersionNumbers}.x` | `nodejs${SupportedVersionNumbers}.x`;
3
+ interface NodeVersionSupport {
4
+ esm: boolean;
5
+ }
6
+ declare const DEFAULT_NODE_VERSION = 14;
7
+ declare const getNodeVersion: (configVersion?: string | undefined) => number;
8
+ declare const getNodeSupportMatrix: (configVersion?: string | undefined) => NodeVersionSupport;
9
+ declare const parseVersion: (input: string | undefined) => number | undefined;
10
+ export { DEFAULT_NODE_VERSION, getNodeSupportMatrix, getNodeVersion, NodeVersionString, NodeVersionSupport, parseVersion, };
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseVersion = exports.getNodeVersion = exports.getNodeSupportMatrix = exports.DEFAULT_NODE_VERSION = void 0;
4
+ // Must match the default version used in Bitballoon.
5
+ const DEFAULT_NODE_VERSION = 14;
6
+ exports.DEFAULT_NODE_VERSION = DEFAULT_NODE_VERSION;
7
+ const VERSION_REGEX = /(nodejs)?(\d+)\.x/;
8
+ const getNodeVersion = (configVersion) => { var _a; return (_a = parseVersion(configVersion)) !== null && _a !== void 0 ? _a : DEFAULT_NODE_VERSION; };
9
+ exports.getNodeVersion = getNodeVersion;
10
+ const getNodeSupportMatrix = (configVersion) => {
11
+ const versionNumber = getNodeVersion(configVersion);
12
+ return {
13
+ esm: versionNumber >= 14,
14
+ };
15
+ };
16
+ exports.getNodeSupportMatrix = getNodeSupportMatrix;
17
+ // Takes a string in the format defined by the `NodeVersion` type and returns
18
+ // the numeric major version (e.g. "nodejs14.x" => 14).
19
+ const parseVersion = (input) => {
20
+ if (input === undefined) {
21
+ return;
22
+ }
23
+ const match = input.match(VERSION_REGEX);
24
+ if (match === null) {
25
+ return;
26
+ }
27
+ const version = Number.parseInt(match[2]);
28
+ if (Number.isNaN(version)) {
29
+ return;
30
+ }
31
+ return version;
32
+ };
33
+ exports.parseVersion = parseVersion;
34
+ /* eslint-enable no-magic-numbers */
35
+ //# sourceMappingURL=node_version.js.map
@@ -0,0 +1,6 @@
1
+ declare const normalizeFilePath: ({ commonPrefix, path, userNamespace, }: {
2
+ commonPrefix: string;
3
+ path: string;
4
+ userNamespace: string;
5
+ }) => string;
6
+ export { normalizeFilePath };
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.normalizeFilePath = void 0;
7
+ const path_1 = require("path");
8
+ const unixify_1 = __importDefault(require("unixify"));
9
+ // `adm-zip` and `require()` expect Unix paths.
10
+ // We remove the common path prefix.
11
+ // With files on different Windows drives, we remove the drive letter.
12
+ const normalizeFilePath = function ({ commonPrefix, path, userNamespace, }) {
13
+ const userNamespacePathSegment = userNamespace ? `${userNamespace}${path_1.sep}` : '';
14
+ const pathA = (0, path_1.normalize)(path);
15
+ const pathB = pathA.replace(commonPrefix, userNamespacePathSegment);
16
+ const pathC = (0, unixify_1.default)(pathB);
17
+ return pathC;
18
+ };
19
+ exports.normalizeFilePath = normalizeFilePath;
20
+ //# sourceMappingURL=normalize_path.js.map
@@ -15,4 +15,5 @@ interface PackageJson {
15
15
  }
16
16
  declare const sanitisePackageJson: (packageJson: Record<string, unknown>) => PackageJson;
17
17
  declare const getPackageJson: (srcDir: string) => Promise<PackageJson>;
18
- export { getPackageJson, PackageJson, sanitisePackageJson };
18
+ declare const getPackageJsonIfAvailable: (srcDir: string) => Promise<PackageJson>;
19
+ export { getPackageJson, getPackageJsonIfAvailable, PackageJson, sanitisePackageJson };
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.sanitisePackageJson = exports.getPackageJson = void 0;
6
+ exports.sanitisePackageJson = exports.getPackageJsonIfAvailable = exports.getPackageJson = void 0;
7
7
  const pkg_dir_1 = __importDefault(require("pkg-dir"));
8
8
  const sanitiseFiles = (files) => {
9
9
  if (!Array.isArray(files)) {
@@ -34,4 +34,14 @@ const getPackageJson = async function (srcDir) {
34
34
  }
35
35
  };
36
36
  exports.getPackageJson = getPackageJson;
37
+ const getPackageJsonIfAvailable = async (srcDir) => {
38
+ try {
39
+ const packageJson = await getPackageJson(srcDir);
40
+ return packageJson;
41
+ }
42
+ catch {
43
+ return {};
44
+ }
45
+ };
46
+ exports.getPackageJsonIfAvailable = getPackageJsonIfAvailable;
37
47
  //# sourceMappingURL=package_json.js.map
@@ -1,3 +1,4 @@
1
+ import type { ModuleFormat } from './module_format';
1
2
  declare type ArchiveFormat = 'none' | 'zip';
2
3
  interface ZipNodeParameters {
3
4
  aliases?: Map<string, string>;
@@ -6,6 +7,7 @@ interface ZipNodeParameters {
6
7
  extension: string;
7
8
  filename: string;
8
9
  mainFile: string;
10
+ moduleFormat: ModuleFormat;
9
11
  rewrites?: Map<string, string>;
10
12
  srcFiles: string[];
11
13
  }
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.zipNodeJs = void 0;
7
- /* eslint-disable max-lines */
8
7
  const buffer_1 = require("buffer");
9
8
  const fs_1 = require("fs");
10
9
  const os_1 = __importDefault(require("os"));
@@ -12,19 +11,21 @@ const path_1 = require("path");
12
11
  const cp_file_1 = __importDefault(require("cp-file"));
13
12
  const del_1 = __importDefault(require("del"));
14
13
  const p_map_1 = __importDefault(require("p-map"));
15
- const unixify_1 = __importDefault(require("unixify"));
16
14
  const archive_1 = require("../../../archive");
17
15
  const fs_2 = require("../../../utils/fs");
16
+ const entry_file_1 = require("./entry_file");
17
+ const normalize_path_1 = require("./normalize_path");
18
18
  // Taken from https://www.npmjs.com/package/cpy.
19
19
  const COPY_FILE_CONCURRENCY = os_1.default.cpus().length === 0 ? 2 : os_1.default.cpus().length * 2;
20
20
  // Sub-directory to place all user-defined files (i.e. everything other than
21
21
  // the entry file generated by zip-it-and-ship-it).
22
22
  const DEFAULT_USER_SUBDIRECTORY = 'src';
23
- const createDirectory = async function ({ aliases = new Map(), basePath, destFolder, extension, filename, mainFile, rewrites = new Map(), srcFiles, }) {
24
- const { contents: entryContents, filename: entryFilename } = getEntryFile({
23
+ const createDirectory = async function ({ aliases = new Map(), basePath, destFolder, extension, filename, mainFile, moduleFormat, rewrites = new Map(), srcFiles, }) {
24
+ const { contents: entryContents, filename: entryFilename } = (0, entry_file_1.getEntryFile)({
25
25
  commonPrefix: basePath,
26
26
  filename,
27
27
  mainFile,
28
+ moduleFormat,
28
29
  userNamespace: DEFAULT_USER_SUBDIRECTORY,
29
30
  });
30
31
  const functionFolder = (0, path_1.join)(destFolder, (0, path_1.basename)(filename, extension));
@@ -36,7 +37,7 @@ const createDirectory = async function ({ aliases = new Map(), basePath, destFol
36
37
  // Copying source files.
37
38
  await (0, p_map_1.default)(srcFiles, (srcFile) => {
38
39
  const destPath = aliases.get(srcFile) || srcFile;
39
- const normalizedDestPath = normalizeFilePath({
40
+ const normalizedDestPath = (0, normalize_path_1.normalizeFilePath)({
40
41
  commonPrefix: basePath,
41
42
  path: destPath,
42
43
  userNamespace: DEFAULT_USER_SUBDIRECTORY,
@@ -49,7 +50,7 @@ const createDirectory = async function ({ aliases = new Map(), basePath, destFol
49
50
  }, { concurrency: COPY_FILE_CONCURRENCY });
50
51
  return functionFolder;
51
52
  };
52
- const createZipArchive = async function ({ aliases, basePath, destFolder, extension, filename, mainFile, rewrites, srcFiles, }) {
53
+ const createZipArchive = async function ({ aliases, basePath, destFolder, extension, filename, mainFile, moduleFormat, rewrites, srcFiles, }) {
53
54
  const destPath = (0, path_1.join)(destFolder, `${(0, path_1.basename)(filename, extension)}.zip`);
54
55
  const { archive, output } = (0, archive_1.startZip)(destPath);
55
56
  const entryFilename = `${(0, path_1.basename)(filename, extension)}.js`;
@@ -65,7 +66,7 @@ const createZipArchive = async function ({ aliases, basePath, destFolder, extens
65
66
  // than the entry file) to its own sub-directory.
66
67
  const userNamespace = hasEntryFileConflict ? DEFAULT_USER_SUBDIRECTORY : '';
67
68
  if (needsEntryFile) {
68
- const entryFile = getEntryFile({ commonPrefix: basePath, filename, mainFile, userNamespace });
69
+ const entryFile = (0, entry_file_1.getEntryFile)({ commonPrefix: basePath, filename, mainFile, moduleFormat, userNamespace });
69
70
  addEntryFileToZip(archive, entryFile);
70
71
  }
71
72
  const srcFilesInfos = await Promise.all(srcFiles.map(addStat));
@@ -100,18 +101,9 @@ const addStat = async function (srcFile) {
100
101
  const stat = await fs_1.promises.lstat(srcFile);
101
102
  return { srcFile, stat };
102
103
  };
103
- const getEntryFile = ({ commonPrefix, filename, mainFile, userNamespace, }) => {
104
- const mainPath = normalizeFilePath({ commonPrefix, path: mainFile, userNamespace });
105
- const extension = (0, path_1.extname)(filename);
106
- const entryFilename = `${(0, path_1.basename)(filename, extension)}.js`;
107
- return {
108
- contents: `module.exports = require('.${mainPath.startsWith('/') ? mainPath : `/${mainPath}`}')`,
109
- filename: entryFilename,
110
- };
111
- };
112
104
  const zipJsFile = function ({ aliases = new Map(), archive, commonPrefix, rewrites = new Map(), stat, srcFile, userNamespace, }) {
113
105
  const destPath = aliases.get(srcFile) || srcFile;
114
- const normalizedDestPath = normalizeFilePath({ commonPrefix, path: destPath, userNamespace });
106
+ const normalizedDestPath = (0, normalize_path_1.normalizeFilePath)({ commonPrefix, path: destPath, userNamespace });
115
107
  if (rewrites.has(srcFile)) {
116
108
  (0, archive_1.addZipContent)(archive, rewrites.get(srcFile), normalizedDestPath);
117
109
  }
@@ -119,15 +111,4 @@ const zipJsFile = function ({ aliases = new Map(), archive, commonPrefix, rewrit
119
111
  (0, archive_1.addZipFile)(archive, srcFile, normalizedDestPath, stat);
120
112
  }
121
113
  };
122
- // `adm-zip` and `require()` expect Unix paths.
123
- // We remove the common path prefix.
124
- // With files on different Windows drives, we remove the drive letter.
125
- const normalizeFilePath = function ({ commonPrefix, path, userNamespace, }) {
126
- const userNamespacePathSegment = userNamespace ? `${userNamespace}${path_1.sep}` : '';
127
- const pathA = (0, path_1.normalize)(path);
128
- const pathB = pathA.replace(commonPrefix, userNamespacePathSegment);
129
- const pathC = (0, unixify_1.default)(pathB);
130
- return pathC;
131
- };
132
- /* eslint-enable max-lines */
133
114
  //# sourceMappingURL=zip.js.map
@@ -3,7 +3,7 @@ import { FunctionConfig } from '../config';
3
3
  import { FeatureFlags } from '../feature_flags';
4
4
  import { FunctionSource, SourceFile } from '../function';
5
5
  import { FsCache } from '../utils/fs';
6
- import type { NodeBundlerName } from './node';
6
+ import type { NodeBundlerName } from './node/bundlers';
7
7
  import type { ISCValues } from './node/in_source_config';
8
8
  declare type RuntimeName = 'go' | 'js' | 'rs';
9
9
  declare type FindFunctionsInPathsFunction = (args: {
@@ -38,7 +38,7 @@ const build = async ({ config, name, srcDir }) => {
38
38
  exports.build = build;
39
39
  const cargoBuild = async ({ functionName, srcDir, targetDirectory, }) => {
40
40
  try {
41
- await (0, shell_1.runCommand)('cargo', ['build', '--target', constants_1.BUILD_TARGET, '--release'], {
41
+ await shell_1.shellUtils.runCommand('cargo', ['build', '--target', constants_1.BUILD_TARGET, '--release'], {
42
42
  cwd: srcDir,
43
43
  env: {
44
44
  CARGO_TARGET_DIR: targetDirectory,
@@ -60,7 +60,7 @@ const cargoBuild = async ({ functionName, srcDir, targetDirectory, }) => {
60
60
  };
61
61
  const checkRustToolchain = async () => {
62
62
  try {
63
- await (0, shell_1.runCommand)('cargo', ['-V']);
63
+ await shell_1.shellUtils.runCommand('cargo', ['-V']);
64
64
  return true;
65
65
  }
66
66
  catch {
@@ -86,8 +86,8 @@ let toolchainInstallation;
86
86
  // `BUILD_TARGET`. The Promise is saved to `toolchainInstallation`, so
87
87
  // that we run the command just once for multiple Rust functions.
88
88
  const installToolchain = async () => {
89
- await (0, shell_1.runCommand)('rustup', ['default', 'stable']);
90
- await (0, shell_1.runCommand)('rustup', ['target', 'add', constants_1.BUILD_TARGET]);
89
+ await shell_1.shellUtils.runCommand('rustup', ['default', 'stable']);
90
+ await shell_1.shellUtils.runCommand('rustup', ['target', 'add', constants_1.BUILD_TARGET]);
91
91
  };
92
92
  const installToolchainOnce = () => {
93
93
  if (toolchainInstallation === undefined) {
@@ -1,2 +1,22 @@
1
+ /// <reference types="node" />
1
2
  import execa from 'execa';
2
- export { execa as runCommand };
3
+ export declare const shellUtils: {
4
+ runCommand: {
5
+ (file: string, arguments?: readonly string[] | undefined, options?: execa.Options<string> | undefined): execa.ExecaChildProcess<string>;
6
+ (file: string, arguments?: readonly string[] | undefined, options?: execa.Options<null> | undefined): execa.ExecaChildProcess<Buffer>;
7
+ (file: string, options?: execa.Options<string> | undefined): execa.ExecaChildProcess<string>;
8
+ (file: string, options?: execa.Options<null> | undefined): execa.ExecaChildProcess<Buffer>;
9
+ sync(file: string, arguments?: readonly string[] | undefined, options?: execa.SyncOptions<string> | undefined): execa.ExecaSyncReturnValue<string>;
10
+ sync(file: string, arguments?: readonly string[] | undefined, options?: execa.SyncOptions<null> | undefined): execa.ExecaSyncReturnValue<Buffer>;
11
+ sync(file: string, options?: execa.SyncOptions<string> | undefined): execa.ExecaSyncReturnValue<string>;
12
+ sync(file: string, options?: execa.SyncOptions<null> | undefined): execa.ExecaSyncReturnValue<Buffer>;
13
+ command(command: string, options?: execa.Options<string> | undefined): execa.ExecaChildProcess<string>;
14
+ command(command: string, options?: execa.Options<null> | undefined): execa.ExecaChildProcess<Buffer>;
15
+ commandSync(command: string, options?: execa.SyncOptions<string> | undefined): execa.ExecaSyncReturnValue<string>;
16
+ commandSync(command: string, options?: execa.SyncOptions<null> | undefined): execa.ExecaSyncReturnValue<Buffer>;
17
+ node(scriptPath: string, arguments?: readonly string[] | undefined, options?: execa.NodeOptions<string> | undefined): execa.ExecaChildProcess<string>;
18
+ node(scriptPath: string, arguments?: readonly string[] | undefined, options?: execa.Options<null> | undefined): execa.ExecaChildProcess<Buffer>;
19
+ node(scriptPath: string, options?: execa.Options<string> | undefined): execa.ExecaChildProcess<string>;
20
+ node(scriptPath: string, options?: execa.Options<null> | undefined): execa.ExecaChildProcess<Buffer>;
21
+ };
22
+ };
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.runCommand = void 0;
6
+ exports.shellUtils = void 0;
7
7
  const execa_1 = __importDefault(require("execa"));
8
- exports.runCommand = execa_1.default;
8
+ exports.shellUtils = { runCommand: execa_1.default };
9
9
  //# sourceMappingURL=shell.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/zip-it-and-ship-it",
3
- "version": "5.5.2",
3
+ "version": "5.7.2",
4
4
  "description": "Zip it and ship it",
5
5
  "main": "./dist/main.js",
6
6
  "bin": {
@@ -29,8 +29,8 @@
29
29
  "test:ci": "npm run build && c8 -r lcovonly -r text -r json ava"
30
30
  },
31
31
  "config": {
32
- "eslint": "--ignore-path .gitignore --cache --format=codeframe --max-warnings=0 \"{src,tests,.github}/**/*.{js,ts,md,html}\" \"*.{js,ts,md,html}\" \".*.{js,ts,md,html}\"",
33
- "prettier": "--ignore-path .gitignore --loglevel=warn \"{src,tests,.github}/**/*.{js,ts,md,yml,json,html}\" \"*.{js,ts,yml,json,html}\" \".*.{js,ts,yml,json,html}\" \"!package-lock.json\""
32
+ "eslint": "--ignore-path .gitignore --cache --format=codeframe --max-warnings=0 \"{src,tests,.github}/**/*.{mjs,cjs,js,mts,cts,ts,md,html}\" \"*.{cjs,mjs,js,cts,mts,ts,md,html}\" \".*.{cjs,mjs,js,cts,mts,ts,md,html}\"",
33
+ "prettier": "--ignore-path .gitignore --loglevel=warn \"{src,tests,.github}/**/*.{cjs,mjs,js,cts,mts,ts,md,yml,json,html}\" \"*.{cjs,mjs,js,cts,mts,ts,yml,json,html}\" \".*.{cjs,mjs,js,cts,mts,ts,yml,json,html}\" \"!package-lock.json\""
34
34
  },
35
35
  "eslintIgnore": [
36
36
  "benchmarks/fixtures/**"
@@ -81,13 +81,13 @@
81
81
  "semver": "^7.0.0",
82
82
  "tmp-promise": "^3.0.2",
83
83
  "toml": "^3.0.0",
84
- "typescript": "^4.4.3",
84
+ "typescript": "^4.6.0-beta",
85
85
  "unixify": "^1.0.0",
86
86
  "yargs": "^16.0.0"
87
87
  },
88
88
  "devDependencies": {
89
89
  "@babel/types": "^7.15.6",
90
- "@netlify/eslint-config-node": "^4.1.7",
90
+ "@netlify/eslint-config-node": "^5.1.4",
91
91
  "@types/archiver": "^5.1.1",
92
92
  "@types/end-of-stream": "^1.4.1",
93
93
  "@types/resolve": "^1.20.1",
@@ -102,7 +102,7 @@
102
102
  "husky": "^7.0.4",
103
103
  "npm-run-all": "^4.1.5",
104
104
  "p-every": "^2.0.0",
105
- "sinon": "^12.0.0",
105
+ "sinon": "^13.0.0",
106
106
  "sort-on": "^4.1.1",
107
107
  "source-map-support": "^0.5.20",
108
108
  "throat": "^6.0.1"
@@ -112,7 +112,8 @@
112
112
  },
113
113
  "ava": {
114
114
  "files": [
115
- "tests/*"
115
+ "tests/*",
116
+ "tests/unit/**/*.js"
116
117
  ],
117
118
  "verbose": true,
118
119
  "timeout": "2m"