@netlify/zip-it-and-ship-it 9.14.0 → 9.15.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.
|
@@ -40,6 +40,7 @@ export const bundleJsFile = async function ({ additionalModulePaths, basePath, c
|
|
|
40
40
|
getDynamicImportsPlugin({
|
|
41
41
|
basePath,
|
|
42
42
|
includedPaths: dynamicImportsIncludedPaths,
|
|
43
|
+
logger: featureFlags.zisi_log_dynamic_imports ? logger : undefined,
|
|
43
44
|
moduleNames: nodeModulesWithDynamicImports,
|
|
44
45
|
processImports: config.processDynamicNodeImports !== false,
|
|
45
46
|
srcDir,
|
|
@@ -103,11 +104,6 @@ let require=___nfyCreateRequire(import.meta.url);
|
|
|
103
104
|
const inputs = Object.keys(metafile.inputs).map((path) => resolve(path));
|
|
104
105
|
const cleanTempFiles = getCleanupFunction([...bundlePaths.keys()]);
|
|
105
106
|
const additionalPaths = [...dynamicImportsIncludedPaths, ...includedFilesFromModuleDetection];
|
|
106
|
-
if (featureFlags.zisi_log_dynamic_imports && dynamicImportsIncludedPaths.size !== 0) {
|
|
107
|
-
// Capping the number of paths to avoid large log volumes.
|
|
108
|
-
const paths = [...dynamicImportsIncludedPaths].slice(0, 20).join(', ');
|
|
109
|
-
logger.system(`Functions bundling included paths by parsing dynamic import: ${paths}`);
|
|
110
|
-
}
|
|
111
107
|
return {
|
|
112
108
|
additionalPaths,
|
|
113
109
|
bundlePaths,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { Plugin } from '@netlify/esbuild';
|
|
2
|
-
|
|
2
|
+
import { Logger } from '../../../../utils/logger.js';
|
|
3
|
+
export declare const getDynamicImportsPlugin: ({ basePath, includedPaths, logger, moduleNames, processImports, srcDir, }: {
|
|
3
4
|
basePath?: string | undefined;
|
|
4
5
|
includedPaths: Set<string>;
|
|
6
|
+
logger?: Logger | undefined;
|
|
5
7
|
moduleNames: Set<string>;
|
|
6
8
|
processImports: boolean;
|
|
7
9
|
srcDir: string;
|
|
@@ -10,7 +10,7 @@ import { readPackageJson } from '../../utils/package_json.js';
|
|
|
10
10
|
// issues. Secondly, it parses the dynamic expressions and tries to include in
|
|
11
11
|
// the bundle all the files that are possibly needed to make the import work at
|
|
12
12
|
// runtime. This is not always possible, but we do our best.
|
|
13
|
-
export const getDynamicImportsPlugin = ({ basePath, includedPaths, moduleNames, processImports, srcDir, }) => ({
|
|
13
|
+
export const getDynamicImportsPlugin = ({ basePath, includedPaths, logger, moduleNames, processImports, srcDir, }) => ({
|
|
14
14
|
name: 'dynamic-imports',
|
|
15
15
|
setup(build) {
|
|
16
16
|
const cache = new Map();
|
|
@@ -26,6 +26,7 @@ export const getDynamicImportsPlugin = ({ basePath, includedPaths, moduleNames,
|
|
|
26
26
|
// The parser has found a glob of paths that should be included in the
|
|
27
27
|
// bundle to make this import work, so we add it to `includedPaths`.
|
|
28
28
|
includedPaths.add(includedPathsGlob);
|
|
29
|
+
logger?.system(`Functions bundling processed dynamic import with expression: ${expression}`);
|
|
29
30
|
// Create the shim that will handle the import at runtime.
|
|
30
31
|
const contents = getShimContents({ expressionType, resolveDir, srcDir });
|
|
31
32
|
// This is the only branch where we actually solve a dynamic import.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/zip-it-and-ship-it",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.15.0",
|
|
4
4
|
"description": "Zip it and ship it",
|
|
5
5
|
"main": "./dist/main.js",
|
|
6
6
|
"type": "module",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@babel/parser": "^7.22.5",
|
|
58
58
|
"@netlify/binary-info": "^1.0.0",
|
|
59
59
|
"@netlify/esbuild": "0.14.39",
|
|
60
|
-
"@netlify/serverless-functions-api": "^1.
|
|
60
|
+
"@netlify/serverless-functions-api": "^1.6.0",
|
|
61
61
|
"@vercel/nft": "^0.23.0",
|
|
62
62
|
"archiver": "^5.3.0",
|
|
63
63
|
"common-path-prefix": "^3.0.0",
|