@netlify/zip-it-and-ship-it 5.1.0 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,6 @@ const FLAGS = {
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),
9
- nftTranspile: false,
10
9
  parseISC: false,
11
10
  parseWithEsbuild: false,
12
11
  traceWithNft: false,
@@ -14,7 +14,6 @@ declare const bundleJsFile: ({ additionalModulePaths, basePath, config, external
14
14
  bundlePaths: Map<string, string>;
15
15
  cleanTempFiles: () => Promise<void>;
16
16
  inputs: string[];
17
- iscImporterPaths: Set<string>;
18
17
  nativeNodeModules: {};
19
18
  nodeModulesWithDynamicImports: string[];
20
19
  warnings: import("@netlify/esbuild").Message[];
@@ -16,7 +16,6 @@ const tmp_promise_1 = require("tmp-promise");
16
16
  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
- const plugin_in_source_config_1 = require("./plugin_in_source_config");
20
19
  const plugin_native_modules_1 = require("./plugin_native_modules");
21
20
  const plugin_node_builtin_1 = require("./plugin_node_builtin");
22
21
  // Maximum number of log messages that an esbuild instance will produce. This
@@ -45,7 +44,6 @@ const bundleJsFile = function ({ additionalModulePaths, basePath, config, extern
45
44
  // format) to be included in the bundle in order to make a dynamic import
46
45
  // work at runtime.
47
46
  const dynamicImportsIncludedPaths = new Set();
48
- const iscImporterPaths = new Set();
49
47
  // The list of esbuild plugins to enable for this build.
50
48
  const plugins = [
51
49
  (0, plugin_node_builtin_1.getNodeBuiltinPlugin)(),
@@ -57,7 +55,6 @@ const bundleJsFile = function ({ additionalModulePaths, basePath, config, extern
57
55
  processImports: config.processDynamicNodeImports !== false,
58
56
  srcDir,
59
57
  }),
60
- (0, plugin_in_source_config_1.getISCImportFinderPlugin)({ importerPaths: iscImporterPaths }),
61
58
  ];
62
59
  // The version of ECMAScript to use as the build target. This will determine
63
60
  // whether certain features are transpiled down or left untransformed.
@@ -95,7 +92,6 @@ const bundleJsFile = function ({ additionalModulePaths, basePath, config, extern
95
92
  bundlePaths,
96
93
  cleanTempFiles,
97
94
  inputs,
98
- iscImporterPaths,
99
95
  nativeNodeModules,
100
96
  nodeModulesWithDynamicImports: [...nodeModulesWithDynamicImports],
101
97
  warnings,
@@ -39,7 +39,7 @@ const getExternalAndIgnoredModules = ({ config, srcDir }) => __awaiter(void 0, v
39
39
  });
40
40
  const bundle = ({ basePath, config = {}, extension, featureFlags, filename, mainFile, name, pluginsModulesPath, repositoryRoot, runtime, srcDir, srcPath, stat, }) => __awaiter(void 0, void 0, void 0, function* () {
41
41
  const { externalModules, ignoredModules } = yield getExternalAndIgnoredModules({ config, srcDir });
42
- const { additionalPaths, bundlePaths, cleanTempFiles, inputs, iscImporterPaths, nativeNodeModules = {}, nodeModulesWithDynamicImports, warnings, } = yield (0, bundler_1.bundleJsFile)({
42
+ const { additionalPaths, bundlePaths, cleanTempFiles, inputs, nativeNodeModules = {}, nodeModulesWithDynamicImports, warnings, } = yield (0, bundler_1.bundleJsFile)({
43
43
  additionalModulePaths: pluginsModulesPath ? [pluginsModulesPath] : [],
44
44
  basePath,
45
45
  config,
@@ -81,7 +81,6 @@ const bundle = ({ basePath, config = {}, extension, featureFlags, filename, main
81
81
  basePath: functionBasePath,
82
82
  bundlerWarnings,
83
83
  inputs,
84
- iscImporterPaths,
85
84
  mainFile: normalizedMainFile,
86
85
  nativeNodeModules,
87
86
  nodeModulesWithDynamicImports,
@@ -19,7 +19,6 @@ declare type BundleFunction = (args: {
19
19
  bundlerWarnings?: BundlerWarning[];
20
20
  cleanupFunction?: CleanupFunction;
21
21
  inputs: string[];
22
- iscImporterPaths?: Set<string>;
23
22
  mainFile: string;
24
23
  nativeNodeModules?: NativeNodeModules;
25
24
  nodeModulesWithDynamicImports?: string[];
@@ -24,7 +24,7 @@ const es_modules_1 = require("./es_modules");
24
24
  // Paths that will be excluded from the tracing process.
25
25
  const ignore = ['node_modules/aws-sdk/**'];
26
26
  const appearsToBeModuleName = (name) => !name.startsWith('.');
27
- const bundle = ({ basePath, config, featureFlags, mainFile, pluginsModulesPath, repositoryRoot = basePath, }) => __awaiter(void 0, void 0, void 0, function* () {
27
+ const bundle = ({ basePath, config, mainFile, pluginsModulesPath, repositoryRoot = basePath, }) => __awaiter(void 0, void 0, void 0, function* () {
28
28
  const { includedFiles = [], includedFilesBasePath } = config;
29
29
  const { exclude: excludedPaths, paths: includedFilePaths } = yield (0, included_files_1.getPathsOfIncludedFiles)(includedFiles, includedFilesBasePath || basePath);
30
30
  const { paths: dependencyPaths, rewrites } = yield traceFilesAndTranspile({
@@ -32,7 +32,6 @@ const bundle = ({ basePath, config, featureFlags, mainFile, pluginsModulesPath,
32
32
  config,
33
33
  mainFile,
34
34
  pluginsModulesPath,
35
- transpile: featureFlags.nftTranspile,
36
35
  });
37
36
  const filteredIncludedPaths = (0, included_files_1.filterExcludedPaths)([...dependencyPaths, ...includedFilePaths], excludedPaths);
38
37
  const dirnames = filteredIncludedPaths.map((filePath) => (0, path_1.normalize)((0, path_1.dirname)(filePath))).sort();
@@ -51,7 +50,7 @@ const ignoreFunction = (path) => {
51
50
  const shouldIgnore = ignore.some((expression) => (0, minimatch_1.default)(normalizedPath, expression));
52
51
  return shouldIgnore;
53
52
  };
54
- const traceFilesAndTranspile = function ({ basePath, config, mainFile, pluginsModulesPath, transpile, }) {
53
+ const traceFilesAndTranspile = function ({ basePath, config, mainFile, pluginsModulesPath, }) {
55
54
  return __awaiter(this, void 0, void 0, function* () {
56
55
  const fsCache = {};
57
56
  const { fileList: dependencyPaths, esmFileList, reasons, } = yield (0, nft_1.nodeFileTrace)([mainFile], {
@@ -86,9 +85,7 @@ const traceFilesAndTranspile = function ({ basePath, config, mainFile, pluginsMo
86
85
  }),
87
86
  });
88
87
  const normalizedDependencyPaths = [...dependencyPaths].map((path) => basePath ? (0, path_1.resolve)(basePath, path) : (0, path_1.resolve)(path));
89
- const rewrites = transpile
90
- ? yield (0, es_modules_1.transpileESM)({ basePath, config, esmPaths: esmFileList, fsCache, reasons })
91
- : undefined;
88
+ const rewrites = yield (0, es_modules_1.transpileESM)({ basePath, config, esmPaths: esmFileList, fsCache, reasons });
92
89
  return {
93
90
  paths: normalizedDependencyPaths,
94
91
  rewrites,
@@ -2,13 +2,11 @@ import { ArgumentPlaceholder, Expression, SpreadElement, JSXNamespacedName } fro
2
2
  import { parse as parseSchedule } from './properties/schedule';
3
3
  declare const IN_SOURCE_CONFIG_MODULE = "@netlify/functions";
4
4
  declare type ISCValues = Partial<ReturnType<typeof parseSchedule>>;
5
- declare const findISCDeclarationsInPaths: (sourcePaths: string[]) => Promise<Partial<{
6
- schedule: string | undefined;
7
- }>>;
5
+ declare const findISCDeclarationsInPath: (sourcePath: string) => Promise<ISCValues>;
8
6
  declare type ISCHandlerArg = ArgumentPlaceholder | Expression | SpreadElement | JSXNamespacedName;
9
7
  interface ISCExport {
10
8
  local: string;
11
9
  args: ISCHandlerArg[];
12
10
  }
13
- export { findISCDeclarationsInPaths, IN_SOURCE_CONFIG_MODULE };
11
+ export { findISCDeclarationsInPath, IN_SOURCE_CONFIG_MODULE };
14
12
  export type { ISCExport, ISCHandlerArg, ISCValues };
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.IN_SOURCE_CONFIG_MODULE = exports.findISCDeclarationsInPaths = void 0;
12
+ exports.IN_SOURCE_CONFIG_MODULE = exports.findISCDeclarationsInPath = void 0;
13
13
  const non_nullable_1 = require("../../../utils/non_nullable");
14
14
  const parser_1 = require("../parser");
15
15
  const exports_1 = require("../parser/exports");
@@ -45,10 +45,5 @@ const findISCDeclarationsInPath = (sourcePath) => __awaiter(void 0, void 0, void
45
45
  const mergedExports = iscExports.reduce((acc, obj) => (Object.assign(Object.assign({}, acc), obj)), {});
46
46
  return mergedExports;
47
47
  });
48
- const findISCDeclarationsInPaths = (sourcePaths) => __awaiter(void 0, void 0, void 0, function* () {
49
- const paths = yield Promise.all(sourcePaths.map(findISCDeclarationsInPath));
50
- const mergedValues = paths.reduce((acc, obj) => (Object.assign(Object.assign({}, acc), obj)), {});
51
- return mergedValues;
52
- });
53
- exports.findISCDeclarationsInPaths = findISCDeclarationsInPaths;
48
+ exports.findISCDeclarationsInPath = findISCDeclarationsInPath;
54
49
  //# sourceMappingURL=index.js.map
@@ -74,7 +74,7 @@ const zipFunction = function ({ archiveFormat, basePath, config = {}, destFolder
74
74
  yield (0, cp_file_1.default)(srcPath, destPath);
75
75
  return { config, path: destPath };
76
76
  }
77
- const { aliases = new Map(), cleanupFunction, basePath: finalBasePath, bundlerWarnings, inputs, iscImporterPaths = new Set(), mainFile: finalMainFile = mainFile, nativeNodeModules, nodeModulesWithDynamicImports, rewrites, srcFiles, } = yield bundler.bundle({
77
+ const { aliases = new Map(), cleanupFunction, basePath: finalBasePath, bundlerWarnings, inputs, mainFile: finalMainFile = mainFile, nativeNodeModules, nodeModulesWithDynamicImports, rewrites, srcFiles, } = yield bundler.bundle({
78
78
  basePath,
79
79
  config,
80
80
  extension,
@@ -91,7 +91,7 @@ const zipFunction = function ({ archiveFormat, basePath, config = {}, destFolder
91
91
  });
92
92
  let inSourceConfig = {};
93
93
  if (featureFlags.parseISC) {
94
- inSourceConfig = yield (0, in_source_config_1.findISCDeclarationsInPaths)([...iscImporterPaths]);
94
+ inSourceConfig = yield (0, in_source_config_1.findISCDeclarationsInPath)(mainFile);
95
95
  }
96
96
  (0, plugin_modules_path_1.createAliases)(srcFiles, pluginsModulesPath, aliases, finalBasePath);
97
97
  const zipPath = yield (0, zip_1.zipNodeJs)({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/zip-it-and-ship-it",
3
- "version": "5.1.0",
3
+ "version": "5.2.0",
4
4
  "description": "Zip it and ship it",
5
5
  "main": "./dist/main.js",
6
6
  "bin": {
@@ -93,7 +93,7 @@
93
93
  },
94
94
  "devDependencies": {
95
95
  "@babel/types": "^7.15.6",
96
- "@netlify/eslint-config-node": "^3.3.8",
96
+ "@netlify/eslint-config-node": "^3.3.10",
97
97
  "@types/archiver": "^5.1.1",
98
98
  "@types/end-of-stream": "^1.4.1",
99
99
  "@types/resolve": "^1.20.1",
@@ -1,5 +0,0 @@
1
- import type { Plugin } from '@netlify/esbuild';
2
- declare const getISCImportFinderPlugin: ({ importerPaths }: {
3
- importerPaths: Set<string>;
4
- }) => Plugin;
5
- export { getISCImportFinderPlugin };
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getISCImportFinderPlugin = void 0;
4
- const in_source_config_1 = require("../../in_source_config");
5
- // An esbuild plugin that collects the paths of any files that import the
6
- // in-source configuration module.
7
- const getISCImportFinderPlugin = ({ importerPaths }) => ({
8
- name: 'find-isc-imports',
9
- setup(build) {
10
- const filter = new RegExp(`^${in_source_config_1.IN_SOURCE_CONFIG_MODULE}$`);
11
- build.onResolve({ filter }, (args) => {
12
- importerPaths.add(args.importer);
13
- // eslint-disable-next-line unicorn/no-useless-undefined
14
- return undefined;
15
- });
16
- },
17
- });
18
- exports.getISCImportFinderPlugin = getISCImportFinderPlugin;
19
- //# sourceMappingURL=plugin_in_source_config.js.map