@netlify/zip-it-and-ship-it 4.29.0 → 4.29.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/archive.d.ts CHANGED
@@ -11,4 +11,5 @@ declare const addZipFile: (archive: Archiver, file: string, name: string, stat:
11
11
  declare const addZipContent: (archive: Archiver, content: Buffer | string, name: string) => void;
12
12
  declare const endZip: (archive: Archiver, output: Writable) => Promise<void>;
13
13
  export { startZip, addZipFile, addZipContent, endZip };
14
- export type { ArchiveFormat, Archiver as ZipArchive };
14
+ export type { ArchiveFormat };
15
+ export { Archiver as ZipArchive } from 'archiver';
package/dist/main.d.ts CHANGED
@@ -2,7 +2,6 @@ import './utils/polyfills';
2
2
  import { Config } from './config';
3
3
  import { FeatureFlags } from './feature_flags';
4
4
  import { RuntimeName } from './runtimes/runtime';
5
- import { zipFunction, zipFunctions } from './zip';
6
5
  interface ListedFunction {
7
6
  name: string;
8
7
  mainFile: string;
@@ -21,4 +20,5 @@ declare const listFunctions: (relativeSrcFolders: string | string[], { featureFl
21
20
  featureFlags?: FeatureFlags;
22
21
  }) => Promise<ListedFunction[]>;
23
22
  declare const listFunctionsFiles: (relativeSrcFolders: string | string[], { basePath, config, featureFlags: inputFeatureFlags }?: ListFunctionsOptions) => Promise<ListedFunctionFile[]>;
24
- export { zipFunctions, zipFunction, listFunctions, listFunctionsFiles };
23
+ export { listFunctions, listFunctionsFiles };
24
+ export { zipFunction, zipFunctions } from './zip';
package/dist/main.js CHANGED
@@ -20,15 +20,12 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  return t;
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.listFunctionsFiles = exports.listFunctions = exports.zipFunction = exports.zipFunctions = void 0;
23
+ exports.zipFunctions = exports.zipFunction = exports.listFunctionsFiles = exports.listFunctions = void 0;
24
24
  const path_1 = require("path");
25
25
  require("./utils/polyfills");
26
26
  const feature_flags_1 = require("./feature_flags");
27
27
  const runtimes_1 = require("./runtimes");
28
28
  const fs_1 = require("./utils/fs");
29
- const zip_1 = require("./zip");
30
- Object.defineProperty(exports, "zipFunction", { enumerable: true, get: function () { return zip_1.zipFunction; } });
31
- Object.defineProperty(exports, "zipFunctions", { enumerable: true, get: function () { return zip_1.zipFunctions; } });
32
29
  // List all Netlify Functions main entry files for a specific directory
33
30
  const listFunctions = function (relativeSrcFolders, { featureFlags: inputFeatureFlags } = {}) {
34
31
  return __awaiter(this, void 0, void 0, function* () {
@@ -75,4 +72,7 @@ const getSrcFiles = function (_a) {
75
72
  srcPath }, args));
76
73
  });
77
74
  };
75
+ var zip_1 = require("./zip");
76
+ Object.defineProperty(exports, "zipFunction", { enumerable: true, get: function () { return zip_1.zipFunction; } });
77
+ Object.defineProperty(exports, "zipFunctions", { enumerable: true, get: function () { return zip_1.zipFunctions; } });
78
78
  //# sourceMappingURL=main.js.map
@@ -17,6 +17,7 @@ const fs_1 = require("../../../../utils/fs");
17
17
  const bundler_target_1 = require("./bundler_target");
18
18
  const plugin_dynamic_imports_1 = require("./plugin_dynamic_imports");
19
19
  const plugin_native_modules_1 = require("./plugin_native_modules");
20
+ const plugin_node_builtin_1 = require("./plugin_node_builtin");
20
21
  // Maximum number of log messages that an esbuild instance will produce. This
21
22
  // limit is important to avoid out-of-memory errors due to too much data being
22
23
  // sent in the Go<>Node IPC channel.
@@ -45,6 +46,7 @@ const bundleJsFile = function ({ additionalModulePaths, basePath, config, extern
45
46
  const dynamicImportsIncludedPaths = new Set();
46
47
  // The list of esbuild plugins to enable for this build.
47
48
  const plugins = [
49
+ (0, plugin_node_builtin_1.getNodeBuiltinPlugin)(),
48
50
  (0, plugin_native_modules_1.getNativeModulesPlugin)(nativeNodeModules),
49
51
  (0, plugin_dynamic_imports_1.getDynamicImportsPlugin)({
50
52
  basePath,
@@ -0,0 +1,3 @@
1
+ import type { Plugin } from '@netlify/esbuild';
2
+ declare const getNodeBuiltinPlugin: () => Plugin;
3
+ export { getNodeBuiltinPlugin };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getNodeBuiltinPlugin = void 0;
4
+ const getNodeBuiltinPlugin = () => ({
5
+ name: 'builtin-modules',
6
+ setup(build) {
7
+ build.onResolve({ filter: /^node:/ }, (args) => ({ path: args.path.slice('node:'.length), external: true }));
8
+ },
9
+ });
10
+ exports.getNodeBuiltinPlugin = getNodeBuiltinPlugin;
11
+ //# sourceMappingURL=plugin_node_builtin.js.map
@@ -13,5 +13,6 @@ interface PackageJson {
13
13
  binary?: boolean;
14
14
  type?: string;
15
15
  }
16
+ declare const sanitisePackageJson: (packageJson: Record<string, unknown>) => PackageJson;
16
17
  declare const getPackageJson: (srcDir: string) => Promise<PackageJson>;
17
- export { getPackageJson, PackageJson };
18
+ export { getPackageJson, PackageJson, sanitisePackageJson };
@@ -12,8 +12,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.getPackageJson = void 0;
15
+ exports.sanitisePackageJson = exports.getPackageJson = void 0;
16
16
  const pkg_dir_1 = __importDefault(require("pkg-dir"));
17
+ const sanitiseFiles = (files) => {
18
+ if (!Array.isArray(files)) {
19
+ return undefined;
20
+ }
21
+ return files.filter((file) => typeof file === 'string');
22
+ };
23
+ const sanitisePackageJson = (packageJson) => (Object.assign(Object.assign({}, packageJson), { files: sanitiseFiles(packageJson.files) }));
24
+ exports.sanitisePackageJson = sanitisePackageJson;
17
25
  // Retrieve the `package.json` of a specific project or module
18
26
  const getPackageJson = function (srcDir) {
19
27
  return __awaiter(this, void 0, void 0, function* () {
@@ -24,8 +32,9 @@ const getPackageJson = function (srcDir) {
24
32
  const packageJsonPath = `${packageRoot}/package.json`;
25
33
  try {
26
34
  // The path depends on the user's build, i.e. must be dynamic
27
- // eslint-disable-next-line import/no-dynamic-require, node/global-require
28
- return require(packageJsonPath);
35
+ // eslint-disable-next-line import/no-dynamic-require, node/global-require, @typescript-eslint/no-var-requires
36
+ const packageJson = require(packageJsonPath);
37
+ return sanitisePackageJson(packageJson);
29
38
  }
30
39
  catch (error) {
31
40
  throw new Error(`${packageJsonPath} is invalid JSON: ${error.message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/zip-it-and-ship-it",
3
- "version": "4.29.0",
3
+ "version": "4.29.4",
4
4
  "description": "Zip it and ship it",
5
5
  "main": "./dist/main.js",
6
6
  "bin": {
@@ -81,7 +81,7 @@
81
81
  "p-map": "^4.0.0",
82
82
  "path-exists": "^4.0.0",
83
83
  "pkg-dir": "^5.0.0",
84
- "precinct": "^8.0.0",
84
+ "precinct": "^8.2.0",
85
85
  "read-package-json-fast": "^2.0.2",
86
86
  "require-package-name": "^2.0.1",
87
87
  "resolve": "^2.0.0-next.1",
@@ -94,7 +94,7 @@
94
94
  },
95
95
  "devDependencies": {
96
96
  "@babel/types": "^7.15.6",
97
- "@netlify/eslint-config-node": "^3.3.5",
97
+ "@netlify/eslint-config-node": "^3.3.6",
98
98
  "@types/archiver": "^5.1.1",
99
99
  "@types/end-of-stream": "^1.4.1",
100
100
  "@types/resolve": "^1.20.1",
@@ -109,7 +109,7 @@
109
109
  "husky": "^4.3.8",
110
110
  "npm-run-all": "^4.1.5",
111
111
  "nyc": "^15.0.0",
112
- "sinon": "^11.1.1",
112
+ "sinon": "^12.0.0",
113
113
  "sort-on": "^4.1.1",
114
114
  "throat": "^6.0.1",
115
115
  "typescript": "^4.4.3"