@netlify/zip-it-and-ship-it 15.3.3 → 15.3.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/feature_flags.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export declare const defaultFlags: {
|
|
2
2
|
readonly buildRustSource: boolean;
|
|
3
|
-
readonly parseWithEsbuild: false;
|
|
4
3
|
readonly traceWithNft: false;
|
|
5
4
|
readonly zisi_pure_esm: false;
|
|
6
5
|
readonly zisi_pure_esm_mjs: false;
|
|
@@ -12,7 +11,6 @@ export declare const defaultFlags: {
|
|
|
12
11
|
export type FeatureFlags = Partial<Record<keyof typeof defaultFlags, boolean>>;
|
|
13
12
|
export declare const getFlags: (input?: Record<string, boolean>, flags?: {
|
|
14
13
|
readonly buildRustSource: boolean;
|
|
15
|
-
readonly parseWithEsbuild: false;
|
|
16
14
|
readonly traceWithNft: false;
|
|
17
15
|
readonly zisi_pure_esm: false;
|
|
18
16
|
readonly zisi_pure_esm_mjs: false;
|
package/dist/feature_flags.js
CHANGED
|
@@ -2,8 +2,6 @@ import { env } from 'process';
|
|
|
2
2
|
export const defaultFlags = {
|
|
3
3
|
// Build Rust functions from source.
|
|
4
4
|
buildRustSource: Boolean(env.NETLIFY_EXPERIMENTAL_BUILD_RUST_SOURCE),
|
|
5
|
-
// Use esbuild to trace dependencies in the legacy bundler.
|
|
6
|
-
parseWithEsbuild: false,
|
|
7
5
|
// Use NFT as the default bundler.
|
|
8
6
|
traceWithNft: false,
|
|
9
7
|
// Output pure (i.e. untranspiled) ESM files when the function file has ESM
|
|
@@ -1,64 +1,7 @@
|
|
|
1
|
-
import * as esbuild from 'esbuild';
|
|
2
|
-
import { isBuiltin } from 'node:module';
|
|
3
1
|
import precinct from 'precinct';
|
|
4
|
-
import { tmpName } from 'tmp-promise';
|
|
5
2
|
import { FunctionBundlingUserError } from '../../../../utils/error.js';
|
|
6
|
-
import { safeUnlink } from '../../../../utils/fs.js';
|
|
7
3
|
import { RUNTIME } from '../../../runtime.js';
|
|
8
4
|
import { NODE_BUNDLER } from '../types.js';
|
|
9
|
-
// Maximum number of log messages that an esbuild instance will produce. This
|
|
10
|
-
// limit is important to avoid out-of-memory errors due to too much data being
|
|
11
|
-
// sent in the Go<>Node IPC channel.
|
|
12
|
-
const ESBUILD_LOG_LIMIT = 10;
|
|
13
|
-
const getListImportsPlugin = ({ imports, path }) => ({
|
|
14
|
-
name: 'list-imports',
|
|
15
|
-
setup(build) {
|
|
16
|
-
build.onResolve({ filter: /.*/ }, (args) => {
|
|
17
|
-
const isEntryPoint = args.path === path;
|
|
18
|
-
const isImport = !isEntryPoint && !isBuiltin(args.path);
|
|
19
|
-
if (isImport) {
|
|
20
|
-
imports.add(args.path);
|
|
21
|
-
}
|
|
22
|
-
return {
|
|
23
|
-
namespace: 'list-imports',
|
|
24
|
-
external: isImport,
|
|
25
|
-
};
|
|
26
|
-
});
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
const listImportsWithESBuild = async ({ functionName, path, }) => {
|
|
30
|
-
// We're not interested in the output that esbuild generates, we're just
|
|
31
|
-
// using it for its parsing capabilities in order to find import/require
|
|
32
|
-
// statements. However, if we don't give esbuild a path in `outfile`, it
|
|
33
|
-
// will pipe the output to stdout, which we also don't want. So we create
|
|
34
|
-
// a temporary file to serve as the esbuild output and then get rid of it
|
|
35
|
-
// when we're done.
|
|
36
|
-
const targetPath = await tmpName();
|
|
37
|
-
const imports = new Set();
|
|
38
|
-
try {
|
|
39
|
-
await esbuild.build({
|
|
40
|
-
bundle: true,
|
|
41
|
-
entryPoints: [path],
|
|
42
|
-
logLevel: 'error',
|
|
43
|
-
logLimit: ESBUILD_LOG_LIMIT,
|
|
44
|
-
outfile: targetPath,
|
|
45
|
-
platform: 'node',
|
|
46
|
-
plugins: [getListImportsPlugin({ imports, path })],
|
|
47
|
-
target: 'esnext',
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
catch (error) {
|
|
51
|
-
throw FunctionBundlingUserError.addCustomErrorInfo(error, {
|
|
52
|
-
functionName,
|
|
53
|
-
runtime: RUNTIME.JAVASCRIPT,
|
|
54
|
-
bundler: NODE_BUNDLER.ZISI,
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
finally {
|
|
58
|
-
await safeUnlink(targetPath);
|
|
59
|
-
}
|
|
60
|
-
return [...imports];
|
|
61
|
-
};
|
|
62
5
|
const listImportsWithPrecinct = async ({ functionName, path }) => {
|
|
63
6
|
try {
|
|
64
7
|
return await precinct.paperwork(path, { includeCore: false });
|
|
@@ -75,4 +18,4 @@ const listImportsWithPrecinct = async ({ functionName, path }) => {
|
|
|
75
18
|
throw error;
|
|
76
19
|
}
|
|
77
20
|
};
|
|
78
|
-
export const listImports = async ({ featureFlags, ...args }) =>
|
|
21
|
+
export const listImports = async ({ featureFlags, ...args }) => await listImportsWithPrecinct(args);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/zip-it-and-ship-it",
|
|
3
|
-
"version": "15.3.
|
|
3
|
+
"version": "15.3.4",
|
|
4
4
|
"description": "Zip it and ship it",
|
|
5
5
|
"main": "./dist/main.js",
|
|
6
6
|
"type": "module",
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
"engines": {
|
|
101
101
|
"node": ">=22.12.0"
|
|
102
102
|
},
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "584d4952868504a07a5741b8c37fbef6b10b61b2"
|
|
104
104
|
}
|