@netlify/zip-it-and-ship-it 7.0.0 → 7.1.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.
- package/dist/config.d.ts +2 -0
- package/dist/feature_flags.d.ts +1 -1
- package/dist/zip.js +14 -2
- package/package.json +1 -1
package/dist/config.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { FeatureFlags } from './feature_flags.js';
|
|
|
2
2
|
import { FunctionSource } from './function.js';
|
|
3
3
|
import type { NodeBundlerType } from './runtimes/node/bundlers/types.js';
|
|
4
4
|
import type { NodeVersionString } from './runtimes/node/index.js';
|
|
5
|
+
import type { ModuleFormat } from './runtimes/node/utils/module_format.js';
|
|
5
6
|
interface FunctionConfig {
|
|
6
7
|
externalNodeModules?: string[];
|
|
7
8
|
includedFiles?: string[];
|
|
@@ -14,6 +15,7 @@ interface FunctionConfig {
|
|
|
14
15
|
rustTargetDirectory?: string;
|
|
15
16
|
schedule?: string;
|
|
16
17
|
zipGo?: boolean;
|
|
18
|
+
nodeModuleFormat?: ModuleFormat;
|
|
17
19
|
}
|
|
18
20
|
declare type GlobPattern = string;
|
|
19
21
|
declare type Config = Record<GlobPattern, FunctionConfig>;
|
package/dist/feature_flags.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const defaultFlags: Record<string, boolean>;
|
|
2
2
|
export declare type FeatureFlag = keyof typeof defaultFlags;
|
|
3
3
|
export declare type FeatureFlags = Record<FeatureFlag, boolean>;
|
|
4
|
-
export declare const getFlags: (input?: Record<string, boolean>, flags?: Record<string, boolean>) =>
|
|
4
|
+
export declare const getFlags: (input?: Record<string, boolean>, flags?: Record<string, boolean>) => FeatureFlags;
|
package/dist/zip.js
CHANGED
|
@@ -30,13 +30,19 @@ const zipFunctions = async function (relativeSrcFolders, destFolder, { archiveFo
|
|
|
30
30
|
const [paths] = await Promise.all([(0, fs_js_1.listFunctionsDirectories)(srcFolders), fs_1.promises.mkdir(destFolder, { recursive: true })]);
|
|
31
31
|
const functions = await (0, index_js_1.getFunctionsFromPaths)(paths, { config, configFileDirectories, dedupe: true, featureFlags });
|
|
32
32
|
const results = await (0, p_map_1.default)(functions.values(), async (func) => {
|
|
33
|
+
const functionFlags = {
|
|
34
|
+
...featureFlags,
|
|
35
|
+
// If there's a `nodeModuleFormat` configuration property set to `esm`,
|
|
36
|
+
// extend the feature flags with `zisi_pure_esm_mjs` enabled.
|
|
37
|
+
...(func.config.nodeModuleFormat === "esm" /* ModuleFormat.ESM */ ? { zisi_pure_esm_mjs: true } : {}),
|
|
38
|
+
};
|
|
33
39
|
const zipResult = await func.runtime.zipFunction({
|
|
34
40
|
archiveFormat,
|
|
35
41
|
basePath,
|
|
36
42
|
config: func.config,
|
|
37
43
|
destFolder,
|
|
38
44
|
extension: func.extension,
|
|
39
|
-
featureFlags,
|
|
45
|
+
featureFlags: functionFlags,
|
|
40
46
|
filename: func.filename,
|
|
41
47
|
mainFile: func.mainFile,
|
|
42
48
|
name: func.name,
|
|
@@ -70,13 +76,19 @@ const zipFunction = async function (relativeSrcPath, destFolder, { archiveFormat
|
|
|
70
76
|
}
|
|
71
77
|
const { config, extension, filename, mainFile, name, runtime, srcDir, stat: stats, } = functions.values().next().value;
|
|
72
78
|
await fs_1.promises.mkdir(destFolder, { recursive: true });
|
|
79
|
+
const functionFlags = {
|
|
80
|
+
...featureFlags,
|
|
81
|
+
// If there's a `nodeModuleFormat` configuration property set to `esm`,
|
|
82
|
+
// extend the feature flags with `zisi_pure_esm_mjs` enabled.
|
|
83
|
+
...(config.nodeModuleFormat === "esm" /* ModuleFormat.ESM */ ? { zisi_pure_esm_mjs: true } : {}),
|
|
84
|
+
};
|
|
73
85
|
const zipResult = await runtime.zipFunction({
|
|
74
86
|
archiveFormat,
|
|
75
87
|
basePath,
|
|
76
88
|
config,
|
|
77
89
|
destFolder,
|
|
78
90
|
extension,
|
|
79
|
-
featureFlags,
|
|
91
|
+
featureFlags: functionFlags,
|
|
80
92
|
filename,
|
|
81
93
|
mainFile,
|
|
82
94
|
name,
|