@netlify/zip-it-and-ship-it 5.7.2 → 5.7.3

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 (72) hide show
  1. package/README.md +19 -38
  2. package/dist/archive.d.ts +6 -8
  3. package/dist/config.d.ts +4 -5
  4. package/dist/feature_flags.d.ts +4 -6
  5. package/dist/feature_flags.js +2 -3
  6. package/dist/function.d.ts +3 -4
  7. package/dist/main.d.ts +4 -5
  8. package/dist/main.js +4 -4
  9. package/dist/manifest.d.ts +3 -4
  10. package/dist/runtimes/detect_runtime.d.ts +1 -2
  11. package/dist/runtimes/go/builder.d.ts +1 -2
  12. package/dist/runtimes/index.d.ts +3 -3
  13. package/dist/runtimes/node/bundlers/esbuild/bundler.d.ts +2 -3
  14. package/dist/runtimes/node/bundlers/esbuild/bundler.js +3 -4
  15. package/dist/runtimes/node/bundlers/esbuild/bundler_target.d.ts +2 -2
  16. package/dist/runtimes/node/bundlers/esbuild/plugin_dynamic_imports.d.ts +1 -2
  17. package/dist/runtimes/node/bundlers/esbuild/plugin_native_modules.d.ts +1 -2
  18. package/dist/runtimes/node/bundlers/esbuild/plugin_node_builtin.d.ts +1 -2
  19. package/dist/runtimes/node/bundlers/esbuild/special_cases.d.ts +1 -2
  20. package/dist/runtimes/node/bundlers/esbuild/src_files.d.ts +1 -2
  21. package/dist/runtimes/node/bundlers/index.d.ts +6 -7
  22. package/dist/runtimes/node/bundlers/nft/es_modules.d.ts +1 -2
  23. package/dist/runtimes/node/bundlers/nft/transpile.d.ts +1 -2
  24. package/dist/runtimes/node/bundlers/zisi/list_imports.d.ts +1 -2
  25. package/dist/runtimes/node/bundlers/zisi/list_imports.js +1 -1
  26. package/dist/runtimes/node/bundlers/zisi/nested.d.ts +2 -3
  27. package/dist/runtimes/node/bundlers/zisi/published.d.ts +1 -2
  28. package/dist/runtimes/node/bundlers/zisi/resolve.d.ts +2 -3
  29. package/dist/runtimes/node/bundlers/zisi/resolve.js +1 -1
  30. package/dist/runtimes/node/bundlers/zisi/side_files.d.ts +1 -2
  31. package/dist/runtimes/node/bundlers/zisi/src_files.d.ts +1 -2
  32. package/dist/runtimes/node/bundlers/zisi/traverse.d.ts +1 -2
  33. package/dist/runtimes/node/bundlers/zisi/traverse.js +3 -3
  34. package/dist/runtimes/node/bundlers/zisi/tree_files.d.ts +1 -2
  35. package/dist/runtimes/node/bundlers/zisi/tree_shake.d.ts +1 -2
  36. package/dist/runtimes/node/finder.d.ts +2 -3
  37. package/dist/runtimes/node/finder.js +1 -1
  38. package/dist/runtimes/node/in_source_config/index.d.ts +5 -7
  39. package/dist/runtimes/node/in_source_config/index.js +5 -6
  40. package/dist/runtimes/node/parser/exports.d.ts +1 -2
  41. package/dist/runtimes/node/parser/helpers.d.ts +3 -4
  42. package/dist/runtimes/node/parser/imports.d.ts +1 -2
  43. package/dist/runtimes/node/parser/index.d.ts +2 -3
  44. package/dist/runtimes/node/utils/base_path.d.ts +1 -2
  45. package/dist/runtimes/node/utils/detect_es_module.d.ts +1 -2
  46. package/dist/runtimes/node/utils/detect_native_module.d.ts +1 -2
  47. package/dist/runtimes/node/utils/entry_file.d.ts +2 -3
  48. package/dist/runtimes/node/utils/included_files.d.ts +2 -3
  49. package/dist/runtimes/node/utils/module.d.ts +1 -2
  50. package/dist/runtimes/node/utils/node_version.d.ts +7 -7
  51. package/dist/runtimes/node/utils/node_version.js +4 -5
  52. package/dist/runtimes/node/utils/normalize_path.d.ts +1 -2
  53. package/dist/runtimes/node/utils/package_json.d.ts +4 -5
  54. package/dist/runtimes/node/utils/package_json.js +5 -5
  55. package/dist/runtimes/node/utils/plugin_modules_path.d.ts +2 -3
  56. package/dist/runtimes/node/utils/traversal_cache.d.ts +2 -3
  57. package/dist/runtimes/node/utils/zip.d.ts +3 -3
  58. package/dist/runtimes/runtime.d.ts +7 -8
  59. package/dist/runtimes/rust/builder.d.ts +1 -2
  60. package/dist/runtimes/rust/cargo_manifest.d.ts +1 -2
  61. package/dist/runtimes/rust/constants.d.ts +2 -3
  62. package/dist/runtimes/rust/constants.js +2 -4
  63. package/dist/utils/archive_size.d.ts +1 -2
  64. package/dist/utils/format_result.d.ts +2 -4
  65. package/dist/utils/fs.d.ts +10 -12
  66. package/dist/utils/fs.js +5 -8
  67. package/dist/utils/non_nullable.d.ts +1 -2
  68. package/dist/utils/remove_undefined.d.ts +1 -2
  69. package/dist/zip.d.ts +3 -3
  70. package/dist/zip.js +1 -1
  71. package/dist/zip_binary.d.ts +1 -2
  72. package/package.json +1 -1
package/README.md CHANGED
@@ -32,15 +32,11 @@ npm install @netlify/zip-it-and-ship-it
32
32
  - _Return value_: `Promise<object[]>`
33
33
 
34
34
  ```js
35
- const { zipFunctions } = require('@netlify/zip-it-and-ship-it')
35
+ import { zipFunctions } from '@netlify/zip-it-and-ship-it'
36
36
 
37
- const zipNetlifyFunctions = async function () {
38
- const archives = await zipFunctions('functions', 'functions-dist', {
39
- archiveFormat: 'zip',
40
- })
41
-
42
- return archives
43
- }
37
+ const archives = await zipFunctions('functions', 'functions-dist', {
38
+ archiveFormat: 'zip',
39
+ })
44
40
  ```
45
41
 
46
42
  Creates Zip `archives` from Node.js, Go, and Rust programs. Those `archives` are ready to be uploaded to AWS Lambda.
@@ -258,13 +254,9 @@ Additionally, the following properties also exist for Node.js functions:
258
254
  - _Return value_: `object | undefined`
259
255
 
260
256
  ```js
261
- const { zipFunction } = require('@netlify/zip-it-and-ship-it')
262
-
263
- const zipNetlifyFunctions = async function () {
264
- const archive = await zipFunctions('functions/function.js', 'functions-dist')
257
+ import { zipFunction } from '@netlify/zip-it-and-ship-it'
265
258
 
266
- return archive
267
- }
259
+ const archive = await zipFunctions('functions/function.js', 'functions-dist')
268
260
  ```
269
261
 
270
262
  This is like [`zipFunctions()`](#zipfunctionssrcfolder-destfolder-options) except it bundles a single Function.
@@ -276,13 +268,9 @@ The return value is `undefined` if the function is invalid.
276
268
  Returns the list of functions to bundle.
277
269
 
278
270
  ```js
279
- const { listFunctions } = require('@netlify/zip-it-and-ship-it')
280
-
281
- const listNetlifyFunctions = async function () {
282
- const functions = await listFunctions('functions/function.js')
271
+ import { listFunctions } from '@netlify/zip-it-and-ship-it'
283
272
 
284
- return functions
285
- }
273
+ const functions = await listFunctions('functions/function.js')
286
274
  ```
287
275
 
288
276
  ### `srcFolders`
@@ -326,12 +314,9 @@ Like [`listFunctions()`](#listfunctionssrcfolder), except it returns not only th
326
314
  their required files. This is much slower.
327
315
 
328
316
  ```js
329
- const { listFunctionsFiles } = require('@netlify/zip-it-and-ship-it')
317
+ import { listFunctionsFiles } from '@netlify/zip-it-and-ship-it'
330
318
 
331
- const listNetlifyFunctionsFiles = async function () {
332
- const functions = await listFunctionsFiles('functions/function.js')
333
- return functions
334
- }
319
+ const functions = await listFunctionsFiles('functions/function.js')
335
320
  ```
336
321
 
337
322
  ### `srcFolders`
@@ -400,20 +385,16 @@ included in the bundle.
400
385
  You can enable esbuild by setting the [`config` option](#config) when calling `zipFunction` or `zipFunctions`:
401
386
 
402
387
  ```js
403
- const { zipFunctions } = require('@netlify/zip-it-and-ship-it')
404
-
405
- const zipNetlifyFunctions = async function () {
406
- const archives = await zipFunctions('functions', 'functions-dist', {
407
- config: {
408
- // Applying these settings to all functions.
409
- '*': {
410
- nodeBundler: 'esbuild',
411
- },
412
- },
413
- })
388
+ import { zipFunctions } from '@netlify/zip-it-and-ship-it'
414
389
 
415
- return archives
416
- }
390
+ const archives = await zipFunctions('functions', 'functions-dist', {
391
+ config: {
392
+ // Applying these settings to all functions.
393
+ '*': {
394
+ nodeBundler: 'esbuild',
395
+ },
396
+ },
397
+ })
417
398
  ```
418
399
 
419
400
  # Feature flags
package/dist/archive.d.ts CHANGED
@@ -2,14 +2,12 @@ import { Buffer } from 'buffer';
2
2
  import { Stats } from 'fs';
3
3
  import { Writable } from 'stream';
4
4
  import { Archiver } from 'archiver';
5
- declare type ArchiveFormat = 'none' | 'zip';
6
- declare const startZip: (destPath: string) => {
5
+ export { Archiver as ZipArchive } from 'archiver';
6
+ export declare type ArchiveFormat = 'none' | 'zip';
7
+ export declare const startZip: (destPath: string) => {
7
8
  archive: Archiver;
8
9
  output: Writable;
9
10
  };
10
- declare const addZipFile: (archive: Archiver, file: string, name: string, stat: Stats) => void;
11
- declare const addZipContent: (archive: Archiver, content: Buffer | string, name: string) => void;
12
- declare const endZip: (archive: Archiver, output: Writable) => Promise<void>;
13
- export { startZip, addZipFile, addZipContent, endZip };
14
- export type { ArchiveFormat };
15
- export { Archiver as ZipArchive } from 'archiver';
11
+ export declare const addZipFile: (archive: Archiver, file: string, name: string, stat: Stats) => void;
12
+ export declare const addZipContent: (archive: Archiver, content: Buffer | string, name: string) => void;
13
+ export declare const endZip: (archive: Archiver, output: Writable) => Promise<void>;
package/dist/config.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { FunctionSource } from './function';
2
2
  import type { NodeVersionString } from './runtimes/node';
3
3
  import type { NodeBundlerName } from './runtimes/node/bundlers';
4
- interface FunctionConfig {
4
+ export interface FunctionConfig {
5
5
  externalNodeModules?: string[];
6
6
  includedFiles?: string[];
7
7
  includedFilesBasePath?: string;
@@ -15,10 +15,9 @@ interface FunctionConfig {
15
15
  zipGo?: boolean;
16
16
  }
17
17
  declare type GlobPattern = string;
18
- declare type Config = Record<GlobPattern, FunctionConfig>;
19
- declare const getConfigForFunction: ({ config, func, }: {
18
+ export declare type Config = Record<GlobPattern, FunctionConfig>;
19
+ export declare const getConfigForFunction: ({ config, func, }: {
20
20
  config?: Config | undefined;
21
21
  func: Omit<FunctionSource, 'config'>;
22
22
  }) => FunctionConfig;
23
- export { getConfigForFunction };
24
- export type { Config, FunctionConfig };
23
+ export {};
@@ -1,6 +1,4 @@
1
- declare const FLAGS: Record<string, boolean>;
2
- declare type FeatureFlag = keyof typeof FLAGS;
3
- declare type FeatureFlags = Record<FeatureFlag, boolean>;
4
- declare const getFlags: (input?: Record<string, boolean>, flags?: Record<string, boolean>) => {};
5
- export { FLAGS as defaultFlags, getFlags };
6
- export type { FeatureFlag, FeatureFlags };
1
+ export declare const defaultFlags: Record<string, boolean>;
2
+ export declare type FeatureFlag = keyof typeof defaultFlags;
3
+ export declare type FeatureFlags = Record<FeatureFlag, boolean>;
4
+ export declare const getFlags: (input?: Record<string, boolean>, flags?: Record<string, boolean>) => {};
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getFlags = exports.defaultFlags = void 0;
4
4
  const process_1 = require("process");
5
- const FLAGS = {
5
+ exports.defaultFlags = {
6
6
  buildGoSource: Boolean(process_1.env.NETLIFY_EXPERIMENTAL_BUILD_GO_SOURCE),
7
7
  buildRustSource: Boolean(process_1.env.NETLIFY_EXPERIMENTAL_BUILD_RUST_SOURCE),
8
8
  defaultEsModulesToEsbuild: Boolean(process_1.env.NETLIFY_EXPERIMENTAL_DEFAULT_ES_MODULES_TO_ESBUILD),
@@ -10,9 +10,8 @@ const FLAGS = {
10
10
  traceWithNft: false,
11
11
  zisi_pure_esm: false,
12
12
  };
13
- exports.defaultFlags = FLAGS;
14
13
  // List of supported flags and their default value.
15
- const getFlags = (input = {}, flags = FLAGS) => Object.entries(flags).reduce((result, [key, defaultValue]) => ({
14
+ const getFlags = (input = {}, flags = exports.defaultFlags) => Object.entries(flags).reduce((result, [key, defaultValue]) => ({
16
15
  ...result,
17
16
  [key]: input[key] === undefined ? defaultValue : input[key],
18
17
  }), {});
@@ -2,13 +2,13 @@
2
2
  import { Stats } from 'fs';
3
3
  import type { FunctionConfig } from './config';
4
4
  import type { Runtime, ZipFunctionResult } from './runtimes/runtime';
5
- declare type FunctionArchive = ZipFunctionResult & {
5
+ export declare type FunctionArchive = ZipFunctionResult & {
6
6
  mainFile: string;
7
7
  name: string;
8
8
  runtime: Runtime;
9
9
  size?: number;
10
10
  };
11
- interface SourceFile {
11
+ export interface SourceFile {
12
12
  extension: string;
13
13
  filename: string;
14
14
  mainFile: string;
@@ -17,8 +17,7 @@ interface SourceFile {
17
17
  srcPath: string;
18
18
  stat: Stats;
19
19
  }
20
- declare type FunctionSource = SourceFile & {
20
+ export declare type FunctionSource = SourceFile & {
21
21
  config: FunctionConfig;
22
22
  runtime: Runtime;
23
23
  };
24
- export { FunctionArchive, FunctionSource, SourceFile };
package/dist/main.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Config } from './config';
2
2
  import { FeatureFlags } from './feature_flags';
3
3
  import { RuntimeName } from './runtimes/runtime';
4
+ export { zipFunction, zipFunctions } from './zip';
4
5
  interface ListedFunction {
5
6
  name: string;
6
7
  mainFile: string;
@@ -17,16 +18,14 @@ interface ListFunctionsOptions {
17
18
  featureFlags?: FeatureFlags;
18
19
  parseISC?: boolean;
19
20
  }
20
- declare const listFunctions: (relativeSrcFolders: string | string[], { featureFlags: inputFeatureFlags, config, parseISC, }?: {
21
+ export declare const listFunctions: (relativeSrcFolders: string | string[], { featureFlags: inputFeatureFlags, config, parseISC, }?: {
21
22
  featureFlags?: FeatureFlags | undefined;
22
23
  config?: Config | undefined;
23
24
  parseISC?: boolean | undefined;
24
25
  }) => Promise<ListedFunction[]>;
25
- declare const listFunction: (path: string, { featureFlags: inputFeatureFlags, config, parseISC, }?: {
26
+ export declare const listFunction: (path: string, { featureFlags: inputFeatureFlags, config, parseISC, }?: {
26
27
  featureFlags?: FeatureFlags | undefined;
27
28
  config?: Config | undefined;
28
29
  parseISC?: boolean | undefined;
29
30
  }) => Promise<ListedFunction | undefined>;
30
- declare const listFunctionsFiles: (relativeSrcFolders: string | string[], { basePath, config, featureFlags: inputFeatureFlags, parseISC }?: ListFunctionsOptions) => Promise<ListedFunctionFile[]>;
31
- export { listFunctions, listFunction, listFunctionsFiles };
32
- export { zipFunction, zipFunctions } from './zip';
31
+ export declare const listFunctionsFiles: (relativeSrcFolders: string | string[], { basePath, config, featureFlags: inputFeatureFlags, parseISC }?: ListFunctionsOptions) => Promise<ListedFunctionFile[]>;
package/dist/main.js CHANGED
@@ -1,11 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.zipFunctions = exports.zipFunction = exports.listFunctionsFiles = exports.listFunction = exports.listFunctions = void 0;
3
+ exports.listFunctionsFiles = exports.listFunction = exports.listFunctions = exports.zipFunctions = exports.zipFunction = void 0;
4
4
  const path_1 = require("path");
5
5
  const feature_flags_1 = require("./feature_flags");
6
6
  const runtimes_1 = require("./runtimes");
7
7
  const in_source_config_1 = require("./runtimes/node/in_source_config");
8
8
  const fs_1 = require("./utils/fs");
9
+ var zip_1 = require("./zip");
10
+ Object.defineProperty(exports, "zipFunction", { enumerable: true, get: function () { return zip_1.zipFunction; } });
11
+ Object.defineProperty(exports, "zipFunctions", { enumerable: true, get: function () { return zip_1.zipFunctions; } });
9
12
  const augmentWithISC = async (func) => {
10
13
  // ISC is currently only supported in JavaScript and TypeScript functions.
11
14
  if (func.runtime.name !== 'js') {
@@ -68,7 +71,4 @@ const getSrcFiles = async function ({ extension, runtime, srcPath, ...args }) {
68
71
  ...args,
69
72
  });
70
73
  };
71
- var zip_1 = require("./zip");
72
- Object.defineProperty(exports, "zipFunction", { enumerable: true, get: function () { return zip_1.zipFunction; } });
73
- Object.defineProperty(exports, "zipFunctions", { enumerable: true, get: function () { return zip_1.zipFunctions; } });
74
74
  //# sourceMappingURL=main.js.map
@@ -6,7 +6,7 @@ interface ManifestFunction {
6
6
  runtime: string;
7
7
  schedule?: string;
8
8
  }
9
- interface Manifest {
9
+ export interface Manifest {
10
10
  functions: ManifestFunction[];
11
11
  system: {
12
12
  arch: string;
@@ -15,9 +15,8 @@ interface Manifest {
15
15
  timestamp: number;
16
16
  version: number;
17
17
  }
18
- declare const createManifest: ({ functions, path }: {
18
+ export declare const createManifest: ({ functions, path }: {
19
19
  functions: FunctionResult[];
20
20
  path: string;
21
21
  }) => Promise<void>;
22
- export { createManifest };
23
- export type { Manifest };
22
+ export {};
@@ -1,7 +1,6 @@
1
1
  import { FsCache } from '../utils/fs';
2
2
  import type { RuntimeName } from './runtime';
3
- declare const detectBinaryRuntime: ({ fsCache, path, }: {
3
+ export declare const detectBinaryRuntime: ({ fsCache, path, }: {
4
4
  fsCache: FsCache;
5
5
  path: string;
6
6
  }) => Promise<RuntimeName | undefined>;
7
- export { detectBinaryRuntime };
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- declare const build: ({ destPath, mainFile, srcDir }: {
2
+ export declare const build: ({ destPath, mainFile, srcDir }: {
3
3
  destPath: string;
4
4
  mainFile: string;
5
5
  srcDir: string;
@@ -10,4 +10,3 @@ declare const build: ({ destPath, mainFile, srcDir }: {
10
10
  srcPath: string;
11
11
  stat: import("fs").Stats;
12
12
  }>;
13
- export { build };
@@ -5,7 +5,7 @@ declare type FunctionMap = Map<string, FunctionSource>;
5
5
  /**
6
6
  * Gets a list of functions found in a list of paths.
7
7
  */
8
- declare const getFunctionsFromPaths: (paths: string[], { config, dedupe, featureFlags, }?: {
8
+ export declare const getFunctionsFromPaths: (paths: string[], { config, dedupe, featureFlags, }?: {
9
9
  config?: Config | undefined;
10
10
  dedupe?: boolean | undefined;
11
11
  featureFlags?: FeatureFlags | undefined;
@@ -13,8 +13,8 @@ declare const getFunctionsFromPaths: (paths: string[], { config, dedupe, feature
13
13
  /**
14
14
  * Gets a list of functions found in a list of paths.
15
15
  */
16
- declare const getFunctionFromPath: (path: string, { config, featureFlags }?: {
16
+ export declare const getFunctionFromPath: (path: string, { config, featureFlags }?: {
17
17
  config?: Config | undefined;
18
18
  featureFlags?: FeatureFlags | undefined;
19
19
  }) => Promise<FunctionSource | undefined>;
20
- export { getFunctionsFromPaths, getFunctionFromPath };
20
+ export {};
@@ -1,6 +1,6 @@
1
1
  import type { FunctionConfig } from '../../../../config';
2
- declare const ESBUILD_LOG_LIMIT = 10;
3
- declare const bundleJsFile: ({ additionalModulePaths, basePath, config, externalModules, ignoredModules, name, srcDir, srcFile, }: {
2
+ export declare const ESBUILD_LOG_LIMIT = 10;
3
+ export declare const bundleJsFile: ({ additionalModulePaths, basePath, config, externalModules, ignoredModules, name, srcDir, srcFile, }: {
4
4
  additionalModulePaths?: string[] | undefined;
5
5
  basePath?: string | undefined;
6
6
  config: FunctionConfig;
@@ -18,4 +18,3 @@ declare const bundleJsFile: ({ additionalModulePaths, basePath, config, external
18
18
  nodeModulesWithDynamicImports: string[];
19
19
  warnings: import("@netlify/esbuild").Message[];
20
20
  }>;
21
- export { bundleJsFile, ESBUILD_LOG_LIMIT };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ESBUILD_LOG_LIMIT = exports.bundleJsFile = void 0;
3
+ exports.bundleJsFile = exports.ESBUILD_LOG_LIMIT = void 0;
4
4
  const path_1 = require("path");
5
5
  const esbuild_1 = require("@netlify/esbuild");
6
6
  const tmp_promise_1 = require("tmp-promise");
@@ -12,8 +12,7 @@ const plugin_node_builtin_1 = require("./plugin_node_builtin");
12
12
  // Maximum number of log messages that an esbuild instance will produce. This
13
13
  // limit is important to avoid out-of-memory errors due to too much data being
14
14
  // sent in the Go<>Node IPC channel.
15
- const ESBUILD_LOG_LIMIT = 10;
16
- exports.ESBUILD_LOG_LIMIT = ESBUILD_LOG_LIMIT;
15
+ exports.ESBUILD_LOG_LIMIT = 10;
17
16
  // When resolving imports with no extension (e.g. require('./foo')), these are
18
17
  // the extensions that esbuild will look for, in this order.
19
18
  const RESOLVE_EXTENSIONS = ['.js', '.jsx', '.mjs', '.cjs', '.ts', '.json'];
@@ -59,7 +58,7 @@ const bundleJsFile = async function ({ additionalModulePaths, basePath, config,
59
58
  entryPoints: [srcFile],
60
59
  external,
61
60
  logLevel: 'warning',
62
- logLimit: ESBUILD_LOG_LIMIT,
61
+ logLimit: exports.ESBUILD_LOG_LIMIT,
63
62
  metafile: true,
64
63
  nodePaths: additionalModulePaths,
65
64
  outdir: targetDirectory,
@@ -6,5 +6,5 @@ declare const versionMap: {
6
6
  };
7
7
  declare type VersionKeys = keyof typeof versionMap;
8
8
  declare type VersionValues = typeof versionMap[VersionKeys];
9
- declare const getBundlerTarget: (suppliedVersion?: string | undefined) => VersionValues;
10
- export { getBundlerTarget };
9
+ export declare const getBundlerTarget: (suppliedVersion?: string | undefined) => VersionValues;
10
+ export {};
@@ -1,9 +1,8 @@
1
1
  import type { Plugin } from '@netlify/esbuild';
2
- declare const getDynamicImportsPlugin: ({ basePath, includedPaths, moduleNames, processImports, srcDir, }: {
2
+ export declare const getDynamicImportsPlugin: ({ basePath, includedPaths, moduleNames, processImports, srcDir, }: {
3
3
  basePath?: string | undefined;
4
4
  includedPaths: Set<string>;
5
5
  moduleNames: Set<string>;
6
6
  processImports: boolean;
7
7
  srcDir: string;
8
8
  }) => Plugin;
9
- export { getDynamicImportsPlugin };
@@ -1,4 +1,3 @@
1
1
  import type { Plugin } from '@netlify/esbuild';
2
2
  import type { NativeNodeModules } from '..';
3
- declare const getNativeModulesPlugin: (externalizedModules: NativeNodeModules) => Plugin;
4
- export { getNativeModulesPlugin };
3
+ export declare const getNativeModulesPlugin: (externalizedModules: NativeNodeModules) => Plugin;
@@ -1,3 +1,2 @@
1
1
  import type { Plugin } from '@netlify/esbuild';
2
- declare const getNodeBuiltinPlugin: () => Plugin;
3
- export { getNodeBuiltinPlugin };
2
+ export declare const getNodeBuiltinPlugin: () => Plugin;
@@ -1,7 +1,6 @@
1
- declare const getExternalAndIgnoredModulesFromSpecialCases: ({ srcDir }: {
1
+ export declare const getExternalAndIgnoredModulesFromSpecialCases: ({ srcDir }: {
2
2
  srcDir: string;
3
3
  }) => Promise<{
4
4
  externalModules: string[];
5
5
  ignoredModules: string[];
6
6
  }>;
7
- export { getExternalAndIgnoredModulesFromSpecialCases };
@@ -1,3 +1,2 @@
1
1
  import type { GetSrcFilesFunction } from '..';
2
- declare const getSrcFiles: GetSrcFilesFunction;
3
- export { getSrcFiles };
2
+ export declare const getSrcFiles: GetSrcFilesFunction;
@@ -6,8 +6,8 @@ import { ModuleFormat } from '../utils/module_format';
6
6
  export declare type NodeBundlerName = 'esbuild' | 'esbuild_zisi' | 'nft' | 'zisi';
7
7
  declare type BundlerWarning = Message;
8
8
  declare type CleanupFunction = () => Promise<void>;
9
- declare type NativeNodeModules = Record<string, Record<string, string | undefined>>;
10
- declare type BundleFunction = (args: {
9
+ export declare type NativeNodeModules = Record<string, Record<string, string | undefined>>;
10
+ export declare type BundleFunction = (args: {
11
11
  basePath?: string;
12
12
  config: FunctionConfig;
13
13
  featureFlags: Record<FeatureFlag, boolean>;
@@ -26,7 +26,7 @@ declare type BundleFunction = (args: {
26
26
  nodeModulesWithDynamicImports?: string[];
27
27
  srcFiles: string[];
28
28
  }>;
29
- declare type GetSrcFilesFunction = (args: {
29
+ export declare type GetSrcFilesFunction = (args: {
30
30
  basePath?: string;
31
31
  config: FunctionConfig;
32
32
  featureFlags: FeatureFlags;
@@ -37,11 +37,10 @@ interface NodeBundler {
37
37
  bundle: BundleFunction;
38
38
  getSrcFiles: GetSrcFilesFunction;
39
39
  }
40
- declare const getBundler: (name: NodeBundlerName) => NodeBundler;
41
- declare const getDefaultBundler: ({ extension, mainFile, featureFlags, }: {
40
+ export declare const getBundler: (name: NodeBundlerName) => NodeBundler;
41
+ export declare const getDefaultBundler: ({ extension, mainFile, featureFlags, }: {
42
42
  extension: string;
43
43
  mainFile: string;
44
44
  featureFlags: FeatureFlags;
45
45
  }) => Promise<NodeBundlerName>;
46
- export { getBundler, getDefaultBundler };
47
- export type { BundleFunction, GetSrcFilesFunction, NativeNodeModules };
46
+ export {};
@@ -3,7 +3,7 @@ import type { FunctionConfig } from '../../../../config';
3
3
  import { FeatureFlags } from '../../../../feature_flags';
4
4
  import { FsCache } from '../../../../utils/fs';
5
5
  import { ModuleFormat } from '../../utils/module_format';
6
- declare const processESM: ({ basePath, config, esmPaths, featureFlags, fsCache, mainFile, reasons, }: {
6
+ export declare const processESM: ({ basePath, config, esmPaths, featureFlags, fsCache, mainFile, reasons, }: {
7
7
  basePath: string | undefined;
8
8
  config: FunctionConfig;
9
9
  esmPaths: Set<string>;
@@ -15,4 +15,3 @@ declare const processESM: ({ basePath, config, esmPaths, featureFlags, fsCache,
15
15
  rewrites?: Map<string, string> | undefined;
16
16
  moduleFormat: ModuleFormat;
17
17
  }>;
18
- export { processESM };
@@ -1,3 +1,2 @@
1
1
  import type { FunctionConfig } from '../../../../config';
2
- declare const transpile: (path: string, config: FunctionConfig) => Promise<string>;
3
- export { transpile };
2
+ export declare const transpile: (path: string, config: FunctionConfig) => Promise<string>;
@@ -1,5 +1,4 @@
1
- declare const listImports: ({ functionName, path }: {
1
+ export declare const listImports: ({ functionName, path, }: {
2
2
  functionName: string;
3
3
  path: string;
4
4
  }) => Promise<string[]>;
5
- export { listImports };
@@ -51,7 +51,7 @@ const getListImportsPlugin = ({ imports, path }) => ({
51
51
  });
52
52
  },
53
53
  });
54
- const listImports = async ({ functionName, path }) => {
54
+ const listImports = async ({ functionName, path, }) => {
55
55
  // We're not interested in the output that esbuild generates, we're just
56
56
  // using it for its parsing capabilities in order to find import/require
57
57
  // statements. However, if we don't give esbuild a path in `outfile`, it
@@ -1,10 +1,9 @@
1
1
  import { PackageJson } from '../../utils/package_json';
2
- declare const getNestedDependencies: ({ dependencies, peerDependencies, optionalDependencies, }: PackageJson) => string[];
3
- declare const handleModuleNotFound: ({ error, moduleName, packageJson, }: {
2
+ export declare const getNestedDependencies: ({ dependencies, peerDependencies, optionalDependencies, }: PackageJson) => string[];
3
+ export declare const handleModuleNotFound: ({ error, moduleName, packageJson, }: {
4
4
  error: Error & {
5
5
  code: string;
6
6
  };
7
7
  moduleName: string;
8
8
  packageJson: PackageJson;
9
9
  }) => [] | never;
10
- export { getNestedDependencies, handleModuleNotFound };
@@ -1,2 +1 @@
1
- declare const getPublishedFiles: (modulePath: string) => Promise<string[]>;
2
- export { getPublishedFiles };
1
+ export declare const getPublishedFiles: (modulePath: string) => Promise<string[]>;
@@ -1,3 +1,2 @@
1
- declare const resolvePackage: (moduleName: string, baseDirs: string[]) => Promise<string>;
2
- declare const resolvePathPreserveSymlinks: (path: string, baseDirs: string[]) => Promise<string>;
3
- export { resolvePackage, resolvePathPreserveSymlinks };
1
+ export declare const resolvePackage: (moduleName: string, baseDirs: string[]) => Promise<string>;
2
+ export declare const resolvePathPreserveSymlinks: (path: string, baseDirs: string[]) => Promise<string>;
@@ -28,7 +28,7 @@ const BACKSLASH_REGEXP = /\\/g;
28
28
  // So, on errors, we fallback to `require.resolve()`
29
29
  const resolvePackage = async function (moduleName, baseDirs) {
30
30
  try {
31
- return await resolvePathPreserveSymlinks(`${moduleName}/package.json`, baseDirs);
31
+ return await (0, exports.resolvePathPreserveSymlinks)(`${moduleName}/package.json`, baseDirs);
32
32
  }
33
33
  catch (error) {
34
34
  if (semver_1.default.lt(process_1.version, REQUEST_RESOLVE_MIN_VERSION)) {
@@ -1,2 +1 @@
1
- declare const getSideFiles: (modulePath: string, moduleName: string) => Promise<string[]>;
2
- export { getSideFiles };
1
+ export declare const getSideFiles: (modulePath: string, moduleName: string) => Promise<string[]>;
@@ -1,3 +1,2 @@
1
1
  import type { GetSrcFilesFunction } from '..';
2
- declare const getSrcFiles: GetSrcFilesFunction;
3
- export { getSrcFiles };
2
+ export declare const getSrcFiles: GetSrcFilesFunction;
@@ -1,10 +1,9 @@
1
1
  import { PackageJson } from '../../utils/package_json';
2
2
  import { TraversalCache } from '../../utils/traversal_cache';
3
- declare const getDependencyPathsForDependency: ({ dependency, basedir, state, packageJson, pluginsModulesPath, }: {
3
+ export declare const getDependencyPathsForDependency: ({ dependency, basedir, state, packageJson, pluginsModulesPath, }: {
4
4
  dependency: string;
5
5
  basedir: string;
6
6
  state: TraversalCache;
7
7
  packageJson: PackageJson;
8
8
  pluginsModulesPath?: string | undefined;
9
9
  }) => Promise<string[]>;
10
- export { getDependencyPathsForDependency };
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getDependencyPathsForDependency = void 0;
4
+ const fs_1 = require("fs");
4
5
  const path_1 = require("path");
5
6
  const non_nullable_1 = require("../../../../utils/non_nullable");
6
7
  const module_1 = require("../../utils/module");
@@ -42,8 +43,7 @@ const getDependenciesForModuleName = async function ({ moduleName, basedir, stat
42
43
  state.moduleNames.add(moduleName);
43
44
  state.modulePaths.add(modulePath);
44
45
  // The path depends on the user's build, i.e. must be dynamic
45
- // eslint-disable-next-line import/no-dynamic-require, node/global-require, @typescript-eslint/no-var-requires
46
- const packageJson = require(packagePath);
46
+ const packageJson = JSON.parse(await fs_1.promises.readFile(packagePath, 'utf8'));
47
47
  const [publishedFiles, sideFiles, depsPaths] = await Promise.all([
48
48
  (0, published_1.getPublishedFiles)(modulePath),
49
49
  (0, side_files_1.getSideFiles)(modulePath, moduleName),
@@ -56,7 +56,7 @@ const isExcludedModule = function (moduleName) {
56
56
  };
57
57
  const getNestedModules = async function ({ modulePath, state, packageJson, pluginsModulesPath, }) {
58
58
  const dependencies = (0, nested_1.getNestedDependencies)(packageJson);
59
- const depsPaths = await Promise.all(dependencies.map((dependency) => getDependencyPathsForDependency({ dependency, basedir: modulePath, state, packageJson, pluginsModulesPath })));
59
+ const depsPaths = await Promise.all(dependencies.map((dependency) => (0, exports.getDependencyPathsForDependency)({ dependency, basedir: modulePath, state, packageJson, pluginsModulesPath })));
60
60
  return depsPaths.flat();
61
61
  };
62
62
  //# sourceMappingURL=traverse.js.map
@@ -1,3 +1,2 @@
1
1
  import { Stats } from 'fs';
2
- declare const getTreeFiles: (srcPath: string, stat: Stats) => Promise<string[]>;
3
- export { getTreeFiles };
2
+ export declare const getTreeFiles: (srcPath: string, stat: Stats) => Promise<string[]>;
@@ -1,2 +1 @@
1
- declare const shouldTreeShake: (dependency: string, treeShakeNext: boolean) => boolean;
2
- export { shouldTreeShake };
1
+ export declare const shouldTreeShake: (dependency: string, treeShakeNext: boolean) => boolean;
@@ -1,4 +1,3 @@
1
1
  import { FindFunctionsInPathsFunction, FindFunctionInPathFunction } from '../runtime';
2
- declare const findFunctionsInPaths: FindFunctionsInPathsFunction;
3
- declare const findFunctionInPath: FindFunctionInPathFunction;
4
- export { findFunctionsInPaths, findFunctionInPath };
2
+ export declare const findFunctionsInPaths: FindFunctionsInPathsFunction;
3
+ export declare const findFunctionInPath: FindFunctionInPathFunction;
@@ -20,7 +20,7 @@ const sortByExtension = (fA, fB) => {
20
20
  return indexB - indexA;
21
21
  };
22
22
  const findFunctionsInPaths = async function ({ paths, fsCache, featureFlags }) {
23
- const functions = await Promise.all(paths.map((path) => findFunctionInPath({ path, fsCache, featureFlags })));
23
+ const functions = await Promise.all(paths.map((path) => (0, exports.findFunctionInPath)({ path, fsCache, featureFlags })));
24
24
  // It's fine to mutate the array since its scope is local to this function.
25
25
  const sortedFunctions = functions.filter(non_nullable_1.nonNullable).sort((fA, fB) => {
26
26
  // We first sort the functions array to put directories first. This is so
@@ -1,12 +1,10 @@
1
1
  import { ArgumentPlaceholder, Expression, SpreadElement, JSXNamespacedName } from '@babel/types';
2
2
  import { parse as parseSchedule } from './properties/schedule';
3
- declare const IN_SOURCE_CONFIG_MODULE = "@netlify/functions";
4
- declare type ISCValues = Partial<ReturnType<typeof parseSchedule>>;
5
- declare const findISCDeclarationsInPath: (sourcePath: string) => Promise<ISCValues>;
6
- declare type ISCHandlerArg = ArgumentPlaceholder | Expression | SpreadElement | JSXNamespacedName;
7
- interface ISCExport {
3
+ export declare const IN_SOURCE_CONFIG_MODULE = "@netlify/functions";
4
+ export declare type ISCValues = Partial<ReturnType<typeof parseSchedule>>;
5
+ export declare const findISCDeclarationsInPath: (sourcePath: string) => Promise<ISCValues>;
6
+ export declare type ISCHandlerArg = ArgumentPlaceholder | Expression | SpreadElement | JSXNamespacedName;
7
+ export interface ISCExport {
8
8
  local: string;
9
9
  args: ISCHandlerArg[];
10
10
  }
11
- export { findISCDeclarationsInPath, IN_SOURCE_CONFIG_MODULE };
12
- export type { ISCExport, ISCHandlerArg, ISCValues };
@@ -1,13 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IN_SOURCE_CONFIG_MODULE = exports.findISCDeclarationsInPath = void 0;
3
+ exports.findISCDeclarationsInPath = exports.IN_SOURCE_CONFIG_MODULE = void 0;
4
4
  const non_nullable_1 = require("../../../utils/non_nullable");
5
5
  const parser_1 = require("../parser");
6
6
  const exports_1 = require("../parser/exports");
7
7
  const imports_1 = require("../parser/imports");
8
8
  const schedule_1 = require("./properties/schedule");
9
- const IN_SOURCE_CONFIG_MODULE = '@netlify/functions';
10
- exports.IN_SOURCE_CONFIG_MODULE = IN_SOURCE_CONFIG_MODULE;
9
+ exports.IN_SOURCE_CONFIG_MODULE = '@netlify/functions';
11
10
  // Parses a JS/TS file and looks for in-source config declarations. It returns
12
11
  // an array of all declarations found, with `property` indicating the name of
13
12
  // the property and `data` its value.
@@ -16,9 +15,9 @@ const findISCDeclarationsInPath = async (sourcePath) => {
16
15
  if (ast === null) {
17
16
  return {};
18
17
  }
19
- const imports = ast.body.flatMap((node) => (0, imports_1.getImports)(node, IN_SOURCE_CONFIG_MODULE));
20
- const exports = (0, exports_1.getMainExport)(ast.body);
21
- const iscExports = exports
18
+ const imports = ast.body.flatMap((node) => (0, imports_1.getImports)(node, exports.IN_SOURCE_CONFIG_MODULE));
19
+ const mainExports = (0, exports_1.getMainExport)(ast.body);
20
+ const iscExports = mainExports
22
21
  .map(({ args, local: exportName }) => {
23
22
  const matchingImport = imports.find(({ local: importName }) => importName === exportName);
24
23
  if (matchingImport === undefined) {
@@ -1,4 +1,3 @@
1
1
  import { Statement } from '@babel/types';
2
2
  import type { ISCExport } from '../in_source_config';
3
- declare const getMainExport: (nodes: Statement[]) => ISCExport[];
4
- export { getMainExport };
3
+ export declare const getMainExport: (nodes: Statement[]) => ISCExport[];
@@ -1,7 +1,6 @@
1
1
  import { AssignmentExpression, Expression, ExpressionStatement, ImportDeclaration, Statement } from '@babel/types';
2
- declare const isImport: (node: Statement, importPath: string) => node is ImportDeclaration;
3
- declare const isModuleExports: (node: Statement, dotExpression?: string[]) => node is ExpressionStatement & {
2
+ export declare const isImport: (node: Statement, importPath: string) => node is ImportDeclaration;
3
+ export declare const isModuleExports: (node: Statement, dotExpression?: string[]) => node is ExpressionStatement & {
4
4
  expression: AssignmentExpression;
5
5
  };
6
- declare const isRequire: (node: Expression | undefined | null, requirePath: string) => boolean;
7
- export { isImport, isModuleExports, isRequire };
6
+ export declare const isRequire: (node: Expression | undefined | null, requirePath: string) => boolean;
@@ -1,6 +1,5 @@
1
1
  import { Statement } from '@babel/types';
2
- declare const getImports: (node: Statement, importPath: string) => {
2
+ export declare const getImports: (node: Statement, importPath: string) => {
3
3
  imported: string;
4
4
  local: string;
5
5
  }[];
6
- export { getImports };
@@ -1,4 +1,4 @@
1
- declare const parseExpression: ({ basePath, expression: rawExpression, resolveDir, }: {
1
+ export declare const parseExpression: ({ basePath, expression: rawExpression, resolveDir, }: {
2
2
  basePath: string;
3
3
  expression: string;
4
4
  resolveDir: string;
@@ -6,5 +6,4 @@ declare const parseExpression: ({ basePath, expression: rawExpression, resolveDi
6
6
  includedPathsGlob: string | null | undefined;
7
7
  type: string;
8
8
  } | undefined;
9
- declare const safelyParseFile: (path: string) => Promise<import("@babel/types").Program | null>;
10
- export { parseExpression, safelyParseFile };
9
+ export declare const safelyParseFile: (path: string) => Promise<import("@babel/types").Program | null>;
@@ -1,2 +1 @@
1
- declare const getBasePath: (dirnames: string[]) => string;
2
- export { getBasePath };
1
+ export declare const getBasePath: (dirnames: string[]) => string;
@@ -1,4 +1,3 @@
1
- declare const detectEsModule: ({ mainFile }: {
1
+ export declare const detectEsModule: ({ mainFile }: {
2
2
  mainFile: string;
3
3
  }) => Promise<boolean>;
4
- export { detectEsModule };
@@ -1,3 +1,2 @@
1
1
  import { PackageJson } from './package_json';
2
- declare const isNativeModule: ({ binary, dependencies, devDependencies, files, gypfile, }: PackageJson) => boolean;
3
- export { isNativeModule };
2
+ export declare const isNativeModule: ({ binary, dependencies, devDependencies, files, gypfile, }: PackageJson) => boolean;
@@ -1,13 +1,12 @@
1
1
  import type { ModuleFormat } from './module_format';
2
- interface EntryFile {
2
+ export interface EntryFile {
3
3
  contents: string;
4
4
  filename: string;
5
5
  }
6
- declare const getEntryFile: ({ commonPrefix, filename, mainFile, moduleFormat, userNamespace, }: {
6
+ export declare const getEntryFile: ({ commonPrefix, filename, mainFile, moduleFormat, userNamespace, }: {
7
7
  commonPrefix: string;
8
8
  filename: string;
9
9
  mainFile: string;
10
10
  moduleFormat: ModuleFormat;
11
11
  userNamespace: string;
12
12
  }) => EntryFile;
13
- export { EntryFile, getEntryFile };
@@ -1,6 +1,5 @@
1
- declare const filterExcludedPaths: (paths: string[], exclude?: string[]) => string[];
2
- declare const getPathsOfIncludedFiles: (includedFiles: string[], basePath?: string | undefined) => Promise<{
1
+ export declare const filterExcludedPaths: (paths: string[], exclude?: string[]) => string[];
2
+ export declare const getPathsOfIncludedFiles: (includedFiles: string[], basePath?: string | undefined) => Promise<{
3
3
  exclude: string[];
4
4
  paths: string[];
5
5
  }>;
6
- export { filterExcludedPaths, getPathsOfIncludedFiles };
@@ -1,2 +1 @@
1
- declare const getModuleName: (dependency: string) => string;
2
- export { getModuleName };
1
+ export declare const getModuleName: (dependency: string) => string;
@@ -1,10 +1,10 @@
1
1
  declare type SupportedVersionNumbers = 8 | 10 | 12 | 14;
2
- declare type NodeVersionString = `${SupportedVersionNumbers}.x` | `nodejs${SupportedVersionNumbers}.x`;
3
- interface NodeVersionSupport {
2
+ export declare type NodeVersionString = `${SupportedVersionNumbers}.x` | `nodejs${SupportedVersionNumbers}.x`;
3
+ export interface NodeVersionSupport {
4
4
  esm: boolean;
5
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, };
6
+ export declare const DEFAULT_NODE_VERSION = 14;
7
+ export declare const getNodeVersion: (configVersion?: string | undefined) => number;
8
+ export declare const getNodeSupportMatrix: (configVersion?: string | undefined) => NodeVersionSupport;
9
+ export declare const parseVersion: (input: string | undefined) => number | undefined;
10
+ export {};
@@ -1,14 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseVersion = exports.getNodeVersion = exports.getNodeSupportMatrix = exports.DEFAULT_NODE_VERSION = void 0;
3
+ exports.parseVersion = exports.getNodeSupportMatrix = exports.getNodeVersion = exports.DEFAULT_NODE_VERSION = void 0;
4
4
  // Must match the default version used in Bitballoon.
5
- const DEFAULT_NODE_VERSION = 14;
6
- exports.DEFAULT_NODE_VERSION = DEFAULT_NODE_VERSION;
5
+ exports.DEFAULT_NODE_VERSION = 14;
7
6
  const VERSION_REGEX = /(nodejs)?(\d+)\.x/;
8
- const getNodeVersion = (configVersion) => { var _a; return (_a = parseVersion(configVersion)) !== null && _a !== void 0 ? _a : DEFAULT_NODE_VERSION; };
7
+ const getNodeVersion = (configVersion) => { var _a; return (_a = (0, exports.parseVersion)(configVersion)) !== null && _a !== void 0 ? _a : exports.DEFAULT_NODE_VERSION; };
9
8
  exports.getNodeVersion = getNodeVersion;
10
9
  const getNodeSupportMatrix = (configVersion) => {
11
- const versionNumber = getNodeVersion(configVersion);
10
+ const versionNumber = (0, exports.getNodeVersion)(configVersion);
12
11
  return {
13
12
  esm: versionNumber >= 14,
14
13
  };
@@ -1,6 +1,5 @@
1
- declare const normalizeFilePath: ({ commonPrefix, path, userNamespace, }: {
1
+ export declare const normalizeFilePath: ({ commonPrefix, path, userNamespace, }: {
2
2
  commonPrefix: string;
3
3
  path: string;
4
4
  userNamespace: string;
5
5
  }) => string;
6
- export { normalizeFilePath };
@@ -1,4 +1,4 @@
1
- interface PackageJson {
1
+ export interface PackageJson {
2
2
  name?: string;
3
3
  version?: string;
4
4
  dependencies?: Record<string, string>;
@@ -13,7 +13,6 @@ interface PackageJson {
13
13
  binary?: boolean;
14
14
  type?: string;
15
15
  }
16
- declare const sanitisePackageJson: (packageJson: Record<string, unknown>) => PackageJson;
17
- declare const getPackageJson: (srcDir: string) => Promise<PackageJson>;
18
- declare const getPackageJsonIfAvailable: (srcDir: string) => Promise<PackageJson>;
19
- export { getPackageJson, getPackageJsonIfAvailable, PackageJson, sanitisePackageJson };
16
+ export declare const sanitisePackageJson: (packageJson: Record<string, unknown>) => PackageJson;
17
+ export declare const getPackageJson: (srcDir: string) => Promise<PackageJson>;
18
+ export declare const getPackageJsonIfAvailable: (srcDir: string) => Promise<PackageJson>;
@@ -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.sanitisePackageJson = exports.getPackageJsonIfAvailable = exports.getPackageJson = void 0;
6
+ exports.getPackageJsonIfAvailable = exports.getPackageJson = exports.sanitisePackageJson = void 0;
7
+ const fs_1 = require("fs");
7
8
  const pkg_dir_1 = __importDefault(require("pkg-dir"));
8
9
  const sanitiseFiles = (files) => {
9
10
  if (!Array.isArray(files)) {
@@ -25,9 +26,8 @@ const getPackageJson = async function (srcDir) {
25
26
  const packageJsonPath = `${packageRoot}/package.json`;
26
27
  try {
27
28
  // The path depends on the user's build, i.e. must be dynamic
28
- // eslint-disable-next-line import/no-dynamic-require, node/global-require, @typescript-eslint/no-var-requires
29
- const packageJson = require(packageJsonPath);
30
- return sanitisePackageJson(packageJson);
29
+ const packageJson = JSON.parse(await fs_1.promises.readFile(packageJsonPath, 'utf8'));
30
+ return (0, exports.sanitisePackageJson)(packageJson);
31
31
  }
32
32
  catch (error) {
33
33
  throw new Error(`${packageJsonPath} is invalid JSON: ${error.message}`);
@@ -36,7 +36,7 @@ const getPackageJson = async function (srcDir) {
36
36
  exports.getPackageJson = getPackageJson;
37
37
  const getPackageJsonIfAvailable = async (srcDir) => {
38
38
  try {
39
- const packageJson = await getPackageJson(srcDir);
39
+ const packageJson = await (0, exports.getPackageJson)(srcDir);
40
40
  return packageJson;
41
41
  }
42
42
  catch {
@@ -1,3 +1,2 @@
1
- declare const createAliases: (paths: string[], pluginsModulesPath: string | undefined, aliases: Map<string, string>, basePath: string) => void;
2
- declare const getPluginsModulesPath: (srcDir: string) => Promise<string | undefined>;
3
- export { createAliases, getPluginsModulesPath };
1
+ export declare const createAliases: (paths: string[], pluginsModulesPath: string | undefined, aliases: Map<string, string>, basePath: string) => void;
2
+ export declare const getPluginsModulesPath: (srcDir: string) => Promise<string | undefined>;
@@ -1,7 +1,6 @@
1
- interface TraversalCache {
1
+ export interface TraversalCache {
2
2
  localFiles: Set<string>;
3
3
  moduleNames: Set<string>;
4
4
  modulePaths: Set<string>;
5
5
  }
6
- declare const getNewCache: () => TraversalCache;
7
- export { TraversalCache, getNewCache };
6
+ export declare const getNewCache: () => TraversalCache;
@@ -1,5 +1,5 @@
1
1
  import type { ModuleFormat } from './module_format';
2
- declare type ArchiveFormat = 'none' | 'zip';
2
+ export declare type ArchiveFormat = 'none' | 'zip';
3
3
  interface ZipNodeParameters {
4
4
  aliases?: Map<string, string>;
5
5
  basePath: string;
@@ -11,7 +11,7 @@ interface ZipNodeParameters {
11
11
  rewrites?: Map<string, string>;
12
12
  srcFiles: string[];
13
13
  }
14
- declare const zipNodeJs: ({ archiveFormat, ...options }: ZipNodeParameters & {
14
+ export declare const zipNodeJs: ({ archiveFormat, ...options }: ZipNodeParameters & {
15
15
  archiveFormat: ArchiveFormat;
16
16
  }) => Promise<string>;
17
- export { ArchiveFormat, zipNodeJs };
17
+ export {};
@@ -5,24 +5,24 @@ import { FunctionSource, SourceFile } from '../function';
5
5
  import { FsCache } from '../utils/fs';
6
6
  import type { NodeBundlerName } from './node/bundlers';
7
7
  import type { ISCValues } from './node/in_source_config';
8
- declare type RuntimeName = 'go' | 'js' | 'rs';
9
- declare type FindFunctionsInPathsFunction = (args: {
8
+ export declare type RuntimeName = 'go' | 'js' | 'rs';
9
+ export declare type FindFunctionsInPathsFunction = (args: {
10
10
  featureFlags: FeatureFlags;
11
11
  fsCache: FsCache;
12
12
  paths: string[];
13
13
  }) => Promise<SourceFile[]>;
14
- declare type FindFunctionInPathFunction = (args: {
14
+ export declare type FindFunctionInPathFunction = (args: {
15
15
  featureFlags: FeatureFlags;
16
16
  fsCache: FsCache;
17
17
  path: string;
18
18
  }) => Promise<SourceFile | undefined>;
19
- declare type GetSrcFilesFunction = (args: {
19
+ export declare type GetSrcFilesFunction = (args: {
20
20
  basePath?: string;
21
21
  config: FunctionConfig;
22
22
  featureFlags: FeatureFlags;
23
23
  repositoryRoot?: string;
24
24
  } & FunctionSource) => Promise<string[]>;
25
- interface ZipFunctionResult {
25
+ export interface ZipFunctionResult {
26
26
  bundler?: NodeBundlerName;
27
27
  bundlerErrors?: object[];
28
28
  bundlerWarnings?: object[];
@@ -33,7 +33,7 @@ interface ZipFunctionResult {
33
33
  nodeModulesWithDynamicImports?: string[];
34
34
  path: string;
35
35
  }
36
- declare type ZipFunction = (args: {
36
+ export declare type ZipFunction = (args: {
37
37
  archiveFormat: ArchiveFormat;
38
38
  basePath?: string;
39
39
  config: FunctionConfig;
@@ -41,11 +41,10 @@ declare type ZipFunction = (args: {
41
41
  featureFlags: FeatureFlags;
42
42
  repositoryRoot?: string;
43
43
  } & FunctionSource) => Promise<ZipFunctionResult>;
44
- interface Runtime {
44
+ export interface Runtime {
45
45
  findFunctionsInPaths: FindFunctionsInPathsFunction;
46
46
  findFunctionInPath: FindFunctionInPathFunction;
47
47
  getSrcFiles?: GetSrcFilesFunction;
48
48
  name: RuntimeName;
49
49
  zipFunction: ZipFunction;
50
50
  }
51
- export { FindFunctionInPathFunction, FindFunctionsInPathsFunction, GetSrcFilesFunction, Runtime, RuntimeName, ZipFunction, ZipFunctionResult, };
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { FunctionConfig } from '../../config';
3
- declare const build: ({ config, name, srcDir }: {
3
+ export declare const build: ({ config, name, srcDir }: {
4
4
  config: FunctionConfig;
5
5
  name: string;
6
6
  srcDir: string;
@@ -8,4 +8,3 @@ declare const build: ({ config, name, srcDir }: {
8
8
  path: string;
9
9
  stat: import("fs").Stats;
10
10
  }>;
11
- export { build };
@@ -1,6 +1,5 @@
1
- interface CargoManifest {
1
+ export interface CargoManifest {
2
2
  package: {
3
3
  name: string;
4
4
  };
5
5
  }
6
- export { CargoManifest };
@@ -1,3 +1,2 @@
1
- declare const BUILD_TARGET = "x86_64-unknown-linux-musl";
2
- declare const MANIFEST_NAME = "Cargo.toml";
3
- export { BUILD_TARGET, MANIFEST_NAME };
1
+ export declare const BUILD_TARGET = "x86_64-unknown-linux-musl";
2
+ export declare const MANIFEST_NAME = "Cargo.toml";
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MANIFEST_NAME = exports.BUILD_TARGET = void 0;
4
- const BUILD_TARGET = 'x86_64-unknown-linux-musl';
5
- exports.BUILD_TARGET = BUILD_TARGET;
6
- const MANIFEST_NAME = 'Cargo.toml';
7
- exports.MANIFEST_NAME = MANIFEST_NAME;
4
+ exports.BUILD_TARGET = 'x86_64-unknown-linux-musl';
5
+ exports.MANIFEST_NAME = 'Cargo.toml';
8
6
  //# sourceMappingURL=constants.js.map
@@ -1,3 +1,2 @@
1
1
  import type { FunctionArchive } from '../function';
2
- declare const addArchiveSize: (result: FunctionArchive) => Promise<FunctionArchive>;
3
- export { addArchiveSize };
2
+ export declare const addArchiveSize: (result: FunctionArchive) => Promise<FunctionArchive>;
@@ -1,9 +1,7 @@
1
1
  import { FunctionArchive } from '../function';
2
2
  import { RuntimeName } from '../runtimes/runtime';
3
- declare type FunctionResult = Omit<FunctionArchive, 'runtime'> & {
3
+ export declare type FunctionResult = Omit<FunctionArchive, 'runtime'> & {
4
4
  runtime: RuntimeName;
5
5
  schedule?: string;
6
6
  };
7
- declare const formatZipResult: (archive: FunctionArchive) => FunctionResult;
8
- export { formatZipResult };
9
- export type { FunctionResult };
7
+ export declare const formatZipResult: (archive: FunctionArchive) => FunctionResult;
@@ -1,18 +1,16 @@
1
1
  /// <reference types="node" />
2
2
  import { promises as fs } from 'fs';
3
- declare type FsCache = Record<string, unknown>;
4
- declare const cachedLstat: (cache: FsCache, path: string, opts?: import("fs").StatOptions | undefined) => Promise<import("fs").Stats | import("fs").BigIntStats>;
5
- declare const cachedReaddir: (cache: FsCache, path: string, options: import("fs").ObjectEncodingOptions & {
3
+ export declare type FsCache = Record<string, unknown>;
4
+ export declare const cachedLstat: (cache: FsCache, path: string, opts?: import("fs").StatOptions | undefined) => Promise<import("fs").Stats | import("fs").BigIntStats>;
5
+ export declare const cachedReaddir: (cache: FsCache, path: string, options: import("fs").ObjectEncodingOptions & {
6
6
  withFileTypes: true;
7
7
  }) => Promise<import("fs").Dirent[]>;
8
- declare const cachedReadFile: (cache: FsCache, path: string, options?: BufferEncoding | (import("fs").ObjectEncodingOptions & import("events").Abortable & {
8
+ export declare const cachedReadFile: (cache: FsCache, path: string, options?: BufferEncoding | (import("fs").ObjectEncodingOptions & import("events").Abortable & {
9
9
  flag?: import("fs").OpenMode | undefined;
10
10
  }) | null | undefined) => Promise<string | Buffer>;
11
- declare const getPathWithExtension: (path: string, extension: string) => string;
12
- declare const safeUnlink: (path: string) => Promise<void>;
13
- declare const listFunctionsDirectories: (srcFolders: string[]) => Promise<string[]>;
14
- declare const listFunctionsDirectory: (srcFolder: string) => Promise<string[]>;
15
- declare const resolveFunctionsDirectories: (input: string | string[]) => string[];
16
- declare const mkdirAndWriteFile: typeof fs.writeFile;
17
- export { cachedLstat, cachedReaddir, cachedReadFile, getPathWithExtension, listFunctionsDirectories, listFunctionsDirectory, resolveFunctionsDirectories, safeUnlink, mkdirAndWriteFile, };
18
- export type { FsCache };
11
+ export declare const getPathWithExtension: (path: string, extension: string) => string;
12
+ export declare const safeUnlink: (path: string) => Promise<void>;
13
+ export declare const listFunctionsDirectories: (srcFolders: string[]) => Promise<string[]>;
14
+ export declare const listFunctionsDirectory: (srcFolder: string) => Promise<string[]>;
15
+ export declare const resolveFunctionsDirectories: (input: string | string[]) => string[];
16
+ export declare const mkdirAndWriteFile: typeof fs.writeFile;
package/dist/utils/fs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mkdirAndWriteFile = exports.safeUnlink = exports.resolveFunctionsDirectories = exports.listFunctionsDirectory = exports.listFunctionsDirectories = exports.getPathWithExtension = exports.cachedReadFile = exports.cachedReaddir = exports.cachedLstat = void 0;
3
+ exports.mkdirAndWriteFile = exports.resolveFunctionsDirectories = exports.listFunctionsDirectory = exports.listFunctionsDirectories = exports.safeUnlink = exports.getPathWithExtension = exports.cachedReadFile = exports.cachedReaddir = exports.cachedLstat = void 0;
4
4
  const fs_1 = require("fs");
5
5
  const path_1 = require("path");
6
6
  const non_nullable_1 = require("./non_nullable");
@@ -18,12 +18,9 @@ const makeCachedFunction = (func) => (cache, path, ...args) => {
18
18
  }
19
19
  return cache[key];
20
20
  };
21
- const cachedLstat = makeCachedFunction(fs_1.promises.lstat);
22
- exports.cachedLstat = cachedLstat;
23
- const cachedReaddir = makeCachedFunction(fs_1.promises.readdir);
24
- exports.cachedReaddir = cachedReaddir;
25
- const cachedReadFile = makeCachedFunction(fs_1.promises.readFile);
26
- exports.cachedReadFile = cachedReadFile;
21
+ exports.cachedLstat = makeCachedFunction(fs_1.promises.lstat);
22
+ exports.cachedReaddir = makeCachedFunction(fs_1.promises.readdir);
23
+ exports.cachedReadFile = makeCachedFunction(fs_1.promises.readFile);
27
24
  const getPathWithExtension = (path, extension) => (0, path_1.format)({ ...(0, path_1.parse)(path), base: undefined, ext: extension });
28
25
  exports.getPathWithExtension = getPathWithExtension;
29
26
  const safeUnlink = async (path) => {
@@ -39,7 +36,7 @@ exports.safeUnlink = safeUnlink;
39
36
  const listFunctionsDirectories = async function (srcFolders) {
40
37
  const filenamesByDirectory = await Promise.all(srcFolders.map(async (srcFolder) => {
41
38
  try {
42
- const filenames = await listFunctionsDirectory(srcFolder);
39
+ const filenames = await (0, exports.listFunctionsDirectory)(srcFolder);
43
40
  return filenames;
44
41
  }
45
42
  catch {
@@ -1,2 +1 @@
1
- declare const nonNullable: <T>(value: T) => value is NonNullable<T>;
2
- export { nonNullable };
1
+ export declare const nonNullable: <T>(value: T) => value is NonNullable<T>;
@@ -1,2 +1 @@
1
- declare const removeUndefined: <T>(obj: T) => T;
2
- export { removeUndefined };
1
+ export declare const removeUndefined: <T>(obj: T) => T;
package/dist/zip.d.ts CHANGED
@@ -13,9 +13,9 @@ declare type ZipFunctionsOptions = ZipFunctionOptions & {
13
13
  manifest?: string;
14
14
  parallelLimit?: number;
15
15
  };
16
- declare const zipFunctions: (relativeSrcFolders: string | string[], destFolder: string, { archiveFormat, basePath, config, featureFlags: inputFeatureFlags, manifest, parallelLimit, repositoryRoot, }?: ZipFunctionsOptions) => Promise<(Omit<import("./function").FunctionArchive, "runtime"> & {
16
+ export declare const zipFunctions: (relativeSrcFolders: string | string[], destFolder: string, { archiveFormat, basePath, config, featureFlags: inputFeatureFlags, manifest, parallelLimit, repositoryRoot, }?: ZipFunctionsOptions) => Promise<(Omit<import("./function").FunctionArchive, "runtime"> & {
17
17
  runtime: import("./runtimes/runtime").RuntimeName;
18
18
  schedule?: string | undefined;
19
19
  })[]>;
20
- declare const zipFunction: (relativeSrcPath: string, destFolder: string, { archiveFormat, basePath, config: inputConfig, featureFlags: inputFeatureFlags, repositoryRoot, }?: ZipFunctionOptions) => Promise<import("./utils/format_result").FunctionResult | undefined>;
21
- export { zipFunction, zipFunctions };
20
+ export declare const zipFunction: (relativeSrcPath: string, destFolder: string, { archiveFormat, basePath, config: inputConfig, featureFlags: inputFeatureFlags, repositoryRoot, }?: ZipFunctionOptions) => Promise<import("./utils/format_result").FunctionResult | undefined>;
21
+ export {};
package/dist/zip.js CHANGED
@@ -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.zipFunctions = exports.zipFunction = void 0;
6
+ exports.zipFunction = exports.zipFunctions = void 0;
7
7
  const fs_1 = require("fs");
8
8
  const path_1 = require("path");
9
9
  const p_map_1 = __importDefault(require("p-map"));
@@ -1,10 +1,9 @@
1
1
  import type { Stats } from 'fs';
2
2
  import { Runtime } from './runtimes/runtime';
3
- declare const zipBinary: ({ destPath, filename, runtime, srcPath, stat, }: {
3
+ export declare const zipBinary: ({ destPath, filename, runtime, srcPath, stat, }: {
4
4
  destPath: string;
5
5
  filename: string;
6
6
  runtime: Runtime;
7
7
  srcPath: string;
8
8
  stat: Stats;
9
9
  }) => Promise<void>;
10
- export { zipBinary };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/zip-it-and-ship-it",
3
- "version": "5.7.2",
3
+ "version": "5.7.3",
4
4
  "description": "Zip it and ship it",
5
5
  "main": "./dist/main.js",
6
6
  "bin": {