@netlify/zip-it-and-ship-it 9.29.1 → 9.30.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/main.js
CHANGED
|
@@ -5,7 +5,6 @@ import { parseFile } from './runtimes/node/in_source_config/index.js';
|
|
|
5
5
|
import { RUNTIME } from './runtimes/runtime.js';
|
|
6
6
|
import { RuntimeCache } from './utils/cache.js';
|
|
7
7
|
import { listFunctionsDirectories, resolveFunctionsDirectories } from './utils/fs.js';
|
|
8
|
-
import { getLogger } from './utils/logger.js';
|
|
9
8
|
export { zipFunction, zipFunctions } from './zip.js';
|
|
10
9
|
export { ARCHIVE_FORMAT } from './archive.js';
|
|
11
10
|
export { NODE_BUNDLER } from './runtimes/node/bundlers/types.js';
|
|
@@ -17,7 +16,6 @@ const augmentWithStaticAnalysis = async (func) => {
|
|
|
17
16
|
}
|
|
18
17
|
const staticAnalysisResult = await parseFile(func.mainFile, {
|
|
19
18
|
functionName: func.name,
|
|
20
|
-
logger: getLogger(),
|
|
21
19
|
});
|
|
22
20
|
return { ...func, staticAnalysisResult };
|
|
23
21
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ArgumentPlaceholder, Expression, SpreadElement, JSXNamespacedName } from '@babel/types';
|
|
2
2
|
import { InvocationMode } from '../../../function.js';
|
|
3
|
-
import { Logger } from '../../../utils/logger.js';
|
|
4
3
|
import { Route } from '../../../utils/routes.js';
|
|
5
4
|
import type { ModuleFormat } from '../utils/module_format.js';
|
|
6
5
|
export declare const IN_SOURCE_CONFIG_MODULE = "@netlify/functions";
|
|
@@ -16,19 +15,18 @@ export interface StaticAnalysisResult extends ISCValues {
|
|
|
16
15
|
}
|
|
17
16
|
interface FindISCDeclarationsOptions {
|
|
18
17
|
functionName: string;
|
|
19
|
-
logger: Logger;
|
|
20
18
|
}
|
|
21
19
|
/**
|
|
22
20
|
* Loads a file at a given path, parses it into an AST, and returns a series of
|
|
23
21
|
* data points, such as in-source configuration properties and other metadata.
|
|
24
22
|
*/
|
|
25
|
-
export declare const parseFile: (sourcePath: string, { functionName
|
|
23
|
+
export declare const parseFile: (sourcePath: string, { functionName }: FindISCDeclarationsOptions) => Promise<StaticAnalysisResult>;
|
|
26
24
|
/**
|
|
27
25
|
* Takes a JS/TS source as a string, parses it into an AST, and returns a
|
|
28
26
|
* series of data points, such as in-source configuration properties and
|
|
29
27
|
* other metadata.
|
|
30
28
|
*/
|
|
31
|
-
export declare const parseSource: (source: string, { functionName
|
|
29
|
+
export declare const parseSource: (source: string, { functionName }: FindISCDeclarationsOptions) => StaticAnalysisResult;
|
|
32
30
|
export type ISCHandlerArg = ArgumentPlaceholder | Expression | SpreadElement | JSXNamespacedName;
|
|
33
31
|
export type ISCExportWithCallExpression = {
|
|
34
32
|
type: 'call-expression';
|
|
@@ -39,19 +39,19 @@ const normalizeMethods = (input, name) => {
|
|
|
39
39
|
* Loads a file at a given path, parses it into an AST, and returns a series of
|
|
40
40
|
* data points, such as in-source configuration properties and other metadata.
|
|
41
41
|
*/
|
|
42
|
-
export const parseFile = async (sourcePath, { functionName
|
|
42
|
+
export const parseFile = async (sourcePath, { functionName }) => {
|
|
43
43
|
const source = await safelyReadSource(sourcePath);
|
|
44
44
|
if (source === null) {
|
|
45
45
|
return {};
|
|
46
46
|
}
|
|
47
|
-
return parseSource(source, { functionName
|
|
47
|
+
return parseSource(source, { functionName });
|
|
48
48
|
};
|
|
49
49
|
/**
|
|
50
50
|
* Takes a JS/TS source as a string, parses it into an AST, and returns a
|
|
51
51
|
* series of data points, such as in-source configuration properties and
|
|
52
52
|
* other metadata.
|
|
53
53
|
*/
|
|
54
|
-
export const parseSource = (source, { functionName
|
|
54
|
+
export const parseSource = (source, { functionName }) => {
|
|
55
55
|
const ast = safelyParseSource(source);
|
|
56
56
|
if (ast === null) {
|
|
57
57
|
return {};
|
|
@@ -68,7 +68,6 @@ export const parseSource = (source, { functionName, logger }) => {
|
|
|
68
68
|
inputModuleFormat,
|
|
69
69
|
runtimeAPIVersion: 2,
|
|
70
70
|
};
|
|
71
|
-
logger.system('detected v2 function');
|
|
72
71
|
if (typeof configExport.schedule === 'string') {
|
|
73
72
|
result.schedule = configExport.schedule;
|
|
74
73
|
}
|
|
@@ -35,7 +35,7 @@ const zipFunction = async function ({ archiveFormat, basePath, cache, config = {
|
|
|
35
35
|
await copyFile(srcPath, destPath);
|
|
36
36
|
return { config, path: destPath, entryFilename: '' };
|
|
37
37
|
}
|
|
38
|
-
const staticAnalysisResult = await parseFile(mainFile, { functionName: name
|
|
38
|
+
const staticAnalysisResult = await parseFile(mainFile, { functionName: name });
|
|
39
39
|
const runtimeAPIVersion = staticAnalysisResult.runtimeAPIVersion === 2 ? 2 : 1;
|
|
40
40
|
const pluginsModulesPath = await getPluginsModulesPath(srcDir);
|
|
41
41
|
const bundlerName = await getBundlerName({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Buffer } from 'buffer';
|
|
2
2
|
import { mkdir, readlink as readLink, rm, symlink, writeFile } from 'fs/promises';
|
|
3
3
|
import os from 'os';
|
|
4
|
-
import { basename, extname, join } from 'path';
|
|
4
|
+
import { basename, extname, join, dirname } from 'path';
|
|
5
5
|
import { getPath as getV2APIPath } from '@netlify/serverless-functions-api';
|
|
6
6
|
import { copyFile } from 'cp-file';
|
|
7
7
|
import pMap from 'p-map';
|
|
@@ -80,7 +80,10 @@ const createDirectory = async function ({ aliases = new Map(), basePath, cache,
|
|
|
80
80
|
}
|
|
81
81
|
return copyFile(srcFile, absoluteDestPath);
|
|
82
82
|
}, { concurrency: COPY_FILE_CONCURRENCY });
|
|
83
|
-
await pMap([...symlinks.entries()], ([target, path]) =>
|
|
83
|
+
await pMap([...symlinks.entries()], async ([target, path]) => {
|
|
84
|
+
await mkdir(dirname(path), { recursive: true });
|
|
85
|
+
await symlink(target, path);
|
|
86
|
+
}, {
|
|
84
87
|
concurrency: COPY_FILE_CONCURRENCY,
|
|
85
88
|
});
|
|
86
89
|
return { path: functionFolder, entryFilename };
|