@vercel/build-utils 2.12.3-canary.3 → 2.12.3-canary.30

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.
@@ -0,0 +1,65 @@
1
+ import { Lambda } from './lambda';
2
+ import type { BuildOptions } from './types';
3
+ /**
4
+ * Convert legacy Runtime to a Plugin.
5
+ * @param buildRuntime - a legacy build() function from a Runtime
6
+ * @param packageName - the name of the package, for example `vercel-plugin-python`
7
+ * @param ext - the file extension, for example `.py`
8
+ */
9
+ export declare function convertRuntimeToPlugin(buildRuntime: (options: BuildOptions) => Promise<{
10
+ output: Lambda;
11
+ }>, packageName: string, ext: string): ({ workPath }: {
12
+ workPath: string;
13
+ }) => Promise<void>;
14
+ /**
15
+ * If `.output/functions-manifest.json` exists, append to the pages
16
+ * property. Otherwise write a new file.
17
+ */
18
+ export declare function updateFunctionsManifest({ workPath, pages, }: {
19
+ workPath: string;
20
+ pages: {
21
+ [key: string]: any;
22
+ };
23
+ }): Promise<void>;
24
+ /**
25
+ * Append routes to the `routes-manifest.json` file.
26
+ * If the file does not exist, it will be created.
27
+ */
28
+ export declare function updateRoutesManifest({ workPath, redirects, rewrites, headers, dynamicRoutes, staticRoutes, }: {
29
+ workPath: string;
30
+ redirects?: {
31
+ source: string;
32
+ destination: string;
33
+ statusCode: number;
34
+ regex: string;
35
+ }[];
36
+ rewrites?: {
37
+ source: string;
38
+ destination: string;
39
+ regex: string;
40
+ }[];
41
+ headers?: {
42
+ source: string;
43
+ headers: {
44
+ key: string;
45
+ value: string;
46
+ }[];
47
+ regex: string;
48
+ }[];
49
+ dynamicRoutes?: {
50
+ page: string;
51
+ regex: string;
52
+ namedRegex?: string;
53
+ routeKeys?: {
54
+ [named: string]: string;
55
+ };
56
+ }[];
57
+ staticRoutes?: {
58
+ page: string;
59
+ regex: string;
60
+ namedRegex?: string;
61
+ routeKeys?: {
62
+ [named: string]: string;
63
+ };
64
+ }[];
65
+ }): Promise<void>;
@@ -0,0 +1,202 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.updateRoutesManifest = exports.updateFunctionsManifest = exports.convertRuntimeToPlugin = void 0;
7
+ const fs_extra_1 = __importDefault(require("fs-extra"));
8
+ const path_1 = require("path");
9
+ const glob_1 = __importDefault(require("./fs/glob"));
10
+ const normalize_path_1 = require("./fs/normalize-path");
11
+ const lambda_1 = require("./lambda");
12
+ const _1 = require(".");
13
+ // `.output` was already created by the Build Command, so we have
14
+ // to ensure its contents don't get bundled into the Lambda. Similarily,
15
+ // we don't want to bundle anything from `.vercel` either. Lastly,
16
+ // Builders/Runtimes didn't have `vercel.json` or `now.json`.
17
+ const ignoredPaths = ['.output', '.vercel', 'vercel.json', 'now.json'];
18
+ const shouldIgnorePath = (file, ignoreFilter, ignoreFile) => {
19
+ const isNative = ignoredPaths.some(item => {
20
+ return file.startsWith(item);
21
+ });
22
+ if (!ignoreFile) {
23
+ return isNative;
24
+ }
25
+ return isNative || ignoreFilter(file);
26
+ };
27
+ /**
28
+ * Convert legacy Runtime to a Plugin.
29
+ * @param buildRuntime - a legacy build() function from a Runtime
30
+ * @param packageName - the name of the package, for example `vercel-plugin-python`
31
+ * @param ext - the file extension, for example `.py`
32
+ */
33
+ function convertRuntimeToPlugin(buildRuntime, packageName, ext) {
34
+ // This `build()` signature should match `plugin.build()` signature in `vercel build`.
35
+ return async function build({ workPath }) {
36
+ const opts = { cwd: workPath };
37
+ const files = await glob_1.default('**', opts);
38
+ // We also don't want to provide any files to Runtimes that were ignored
39
+ // through `.vercelignore` or `.nowignore`, because the Build Step does the same.
40
+ const ignoreFilter = await _1.getIgnoreFilter(workPath);
41
+ // We're not passing this as an `ignore` filter to the `glob` function above,
42
+ // so that we can re-use exactly the same `getIgnoreFilter` method that the
43
+ // Build Step uses (literally the same code). Note that this exclusion only applies
44
+ // when deploying. Locally, another exclusion further below is needed.
45
+ for (const file in files) {
46
+ if (shouldIgnorePath(file, ignoreFilter, true)) {
47
+ delete files[file];
48
+ }
49
+ }
50
+ const entrypointPattern = `api/**/*${ext}`;
51
+ const entrypoints = await glob_1.default(entrypointPattern, opts);
52
+ const pages = {};
53
+ const pluginName = packageName.replace('vercel-plugin-', '');
54
+ const traceDir = path_1.join(workPath, `.output`, `inputs`,
55
+ // Legacy Runtimes can only provide API Routes, so that's
56
+ // why we can use this prefix for all of them. Here, we have to
57
+ // make sure to not use a cryptic hash name, because people
58
+ // need to be able to easily inspect the output.
59
+ `api-routes-${pluginName}`);
60
+ await fs_extra_1.default.ensureDir(traceDir);
61
+ for (const entrypoint of Object.keys(entrypoints)) {
62
+ const { output } = await buildRuntime({
63
+ files,
64
+ entrypoint,
65
+ workPath,
66
+ config: {
67
+ zeroConfig: true,
68
+ },
69
+ meta: {
70
+ avoidTopLevelInstall: true,
71
+ },
72
+ });
73
+ pages[entrypoint] = {
74
+ handler: output.handler,
75
+ runtime: output.runtime,
76
+ memory: output.memory,
77
+ maxDuration: output.maxDuration,
78
+ environment: output.environment,
79
+ allowQuery: output.allowQuery,
80
+ };
81
+ // @ts-ignore This symbol is a private API
82
+ const lambdaFiles = output[lambda_1.FILES_SYMBOL];
83
+ // When deploying, the `files` that are passed to the Legacy Runtimes already
84
+ // have certain files that are ignored stripped, but locally, that list of
85
+ // files isn't used by the Legacy Runtimes, so we need to apply the filters
86
+ // to the outputs that they are returning instead.
87
+ for (const file in lambdaFiles) {
88
+ if (shouldIgnorePath(file, ignoreFilter, false)) {
89
+ delete lambdaFiles[file];
90
+ }
91
+ }
92
+ const entry = path_1.join(workPath, '.output', 'server', 'pages', entrypoint);
93
+ await fs_extra_1.default.ensureDir(path_1.dirname(entry));
94
+ await linkOrCopy(files[entrypoint].fsPath, entry);
95
+ const tracedFiles = [];
96
+ Object.entries(lambdaFiles).forEach(async ([relPath, file]) => {
97
+ const newPath = path_1.join(traceDir, relPath);
98
+ tracedFiles.push({ absolutePath: newPath, relativePath: relPath });
99
+ if (file.fsPath) {
100
+ await linkOrCopy(file.fsPath, newPath);
101
+ }
102
+ else if (file.type === 'FileBlob') {
103
+ const { data, mode } = file;
104
+ await fs_extra_1.default.writeFile(newPath, data, { mode });
105
+ }
106
+ else {
107
+ throw new Error(`Unknown file type: ${file.type}`);
108
+ }
109
+ });
110
+ const nft = path_1.join(workPath, '.output', 'server', 'pages', `${entrypoint}.nft.json`);
111
+ const json = JSON.stringify({
112
+ version: 1,
113
+ files: tracedFiles.map(f => ({
114
+ input: normalize_path_1.normalizePath(path_1.relative(nft, f.absolutePath)),
115
+ output: normalize_path_1.normalizePath(f.relativePath),
116
+ })),
117
+ });
118
+ await fs_extra_1.default.ensureDir(path_1.dirname(nft));
119
+ await fs_extra_1.default.writeFile(nft, json);
120
+ }
121
+ await updateFunctionsManifest({ workPath, pages });
122
+ };
123
+ }
124
+ exports.convertRuntimeToPlugin = convertRuntimeToPlugin;
125
+ async function linkOrCopy(existingPath, newPath) {
126
+ try {
127
+ await fs_extra_1.default.createLink(existingPath, newPath);
128
+ }
129
+ catch (err) {
130
+ if (err.code !== 'EEXIST') {
131
+ await fs_extra_1.default.copyFile(existingPath, newPath);
132
+ }
133
+ }
134
+ }
135
+ async function readJson(filePath) {
136
+ try {
137
+ const str = await fs_extra_1.default.readFile(filePath, 'utf8');
138
+ return JSON.parse(str);
139
+ }
140
+ catch (err) {
141
+ if (err.code === 'ENOENT') {
142
+ return {};
143
+ }
144
+ throw err;
145
+ }
146
+ }
147
+ /**
148
+ * If `.output/functions-manifest.json` exists, append to the pages
149
+ * property. Otherwise write a new file.
150
+ */
151
+ async function updateFunctionsManifest({ workPath, pages, }) {
152
+ const functionsManifestPath = path_1.join(workPath, '.output', 'functions-manifest.json');
153
+ const functionsManifest = await readJson(functionsManifestPath);
154
+ if (!functionsManifest.version)
155
+ functionsManifest.version = 1;
156
+ if (!functionsManifest.pages)
157
+ functionsManifest.pages = {};
158
+ for (const [pageKey, pageConfig] of Object.entries(pages)) {
159
+ functionsManifest.pages[pageKey] = { ...pageConfig };
160
+ }
161
+ await fs_extra_1.default.writeFile(functionsManifestPath, JSON.stringify(functionsManifest));
162
+ }
163
+ exports.updateFunctionsManifest = updateFunctionsManifest;
164
+ /**
165
+ * Append routes to the `routes-manifest.json` file.
166
+ * If the file does not exist, it will be created.
167
+ */
168
+ async function updateRoutesManifest({ workPath, redirects, rewrites, headers, dynamicRoutes, staticRoutes, }) {
169
+ const routesManifestPath = path_1.join(workPath, '.output', 'routes-manifest.json');
170
+ const routesManifest = await readJson(routesManifestPath);
171
+ if (!routesManifest.version)
172
+ routesManifest.version = 3;
173
+ if (routesManifest.pages404 === undefined)
174
+ routesManifest.pages404 = true;
175
+ if (redirects) {
176
+ if (!routesManifest.redirects)
177
+ routesManifest.redirects = [];
178
+ routesManifest.redirects.push(...redirects);
179
+ }
180
+ if (rewrites) {
181
+ if (!routesManifest.rewrites)
182
+ routesManifest.rewrites = [];
183
+ routesManifest.rewrites.push(...rewrites);
184
+ }
185
+ if (headers) {
186
+ if (!routesManifest.headers)
187
+ routesManifest.headers = [];
188
+ routesManifest.headers.push(...headers);
189
+ }
190
+ if (dynamicRoutes) {
191
+ if (!routesManifest.dynamicRoutes)
192
+ routesManifest.dynamicRoutes = [];
193
+ routesManifest.dynamicRoutes.push(...dynamicRoutes);
194
+ }
195
+ if (staticRoutes) {
196
+ if (!routesManifest.staticRoutes)
197
+ routesManifest.staticRoutes = [];
198
+ routesManifest.staticRoutes.push(...staticRoutes);
199
+ }
200
+ await fs_extra_1.default.writeFile(routesManifestPath, JSON.stringify(routesManifest));
201
+ }
202
+ exports.updateRoutesManifest = updateRoutesManifest;
@@ -34,5 +34,11 @@ export declare function detectBuilders(files: string[], pkg?: PackageJson | unde
34
34
  redirectRoutes: Route[] | null;
35
35
  rewriteRoutes: Route[] | null;
36
36
  errorRoutes: Route[] | null;
37
+ limitedRoutes: LimitedRoutes | null;
37
38
  }>;
39
+ interface LimitedRoutes {
40
+ defaultRoutes: Route[];
41
+ redirectRoutes: Route[];
42
+ rewriteRoutes: Route[];
43
+ }
38
44
  export {};
@@ -66,6 +66,7 @@ async function detectBuilders(files, pkg, options = {}) {
66
66
  redirectRoutes: null,
67
67
  rewriteRoutes: null,
68
68
  errorRoutes: null,
69
+ limitedRoutes: null,
69
70
  };
70
71
  }
71
72
  const sortedFiles = files.sort(sortFiles);
@@ -113,6 +114,7 @@ async function detectBuilders(files, pkg, options = {}) {
113
114
  redirectRoutes: null,
114
115
  rewriteRoutes: null,
115
116
  errorRoutes: null,
117
+ limitedRoutes: null,
116
118
  };
117
119
  }
118
120
  if (apiRoute) {
@@ -167,6 +169,7 @@ async function detectBuilders(files, pkg, options = {}) {
167
169
  defaultRoutes: null,
168
170
  rewriteRoutes: null,
169
171
  errorRoutes: null,
172
+ limitedRoutes: null,
170
173
  };
171
174
  }
172
175
  // If `outputDirectory` is an empty string,
@@ -203,6 +206,7 @@ async function detectBuilders(files, pkg, options = {}) {
203
206
  defaultRoutes: null,
204
207
  rewriteRoutes: null,
205
208
  errorRoutes: null,
209
+ limitedRoutes: null,
206
210
  };
207
211
  }
208
212
  const builders = [];
@@ -221,7 +225,7 @@ async function detectBuilders(files, pkg, options = {}) {
221
225
  });
222
226
  }
223
227
  }
224
- const routesResult = getRouteResult(apiRoutes, dynamicRoutes, usedOutputDirectory, apiBuilders, frontendBuilder, options);
228
+ const routesResult = getRouteResult(pkg, apiRoutes, dynamicRoutes, usedOutputDirectory, apiBuilders, frontendBuilder, options);
225
229
  return {
226
230
  warnings,
227
231
  builders: builders.length ? builders : null,
@@ -230,6 +234,7 @@ async function detectBuilders(files, pkg, options = {}) {
230
234
  defaultRoutes: routesResult.defaultRoutes,
231
235
  rewriteRoutes: routesResult.rewriteRoutes,
232
236
  errorRoutes: routesResult.errorRoutes,
237
+ limitedRoutes: routesResult.limitedRoutes,
233
238
  };
234
239
  }
235
240
  exports.detectBuilders = detectBuilders;
@@ -670,23 +675,51 @@ function createRouteFromPath(filePath, featHandleMiss, cleanUrls) {
670
675
  }
671
676
  return { route, isDynamic };
672
677
  }
673
- function getRouteResult(apiRoutes, dynamicRoutes, outputDirectory, apiBuilders, frontendBuilder, options) {
678
+ function getRouteResult(pkg, apiRoutes, dynamicRoutes, outputDirectory, apiBuilders, frontendBuilder, options) {
674
679
  var _a, _b;
680
+ const deps = Object.assign({}, pkg === null || pkg === void 0 ? void 0 : pkg.dependencies, pkg === null || pkg === void 0 ? void 0 : pkg.devDependencies);
675
681
  const defaultRoutes = [];
676
682
  const redirectRoutes = [];
677
683
  const rewriteRoutes = [];
678
684
  const errorRoutes = [];
685
+ const limitedRoutes = {
686
+ defaultRoutes: [],
687
+ redirectRoutes: [],
688
+ rewriteRoutes: [],
689
+ };
679
690
  const framework = ((_a = frontendBuilder === null || frontendBuilder === void 0 ? void 0 : frontendBuilder.config) === null || _a === void 0 ? void 0 : _a.framework) || '';
680
691
  const isNextjs = framework === 'nextjs' || _1.isOfficialRuntime('next', frontendBuilder === null || frontendBuilder === void 0 ? void 0 : frontendBuilder.use);
681
692
  const ignoreRuntimes = (_b = slugToFramework.get(framework)) === null || _b === void 0 ? void 0 : _b.ignoreRuntimes;
682
693
  if (apiRoutes && apiRoutes.length > 0) {
683
694
  if (options.featHandleMiss) {
695
+ // Exclude extension names if the corresponding plugin is not found in package.json
696
+ // detectBuilders({ignoreRoutesForBuilders: ['@vercel/python']})
697
+ // return a copy of routes.
698
+ // We should exclud errorRoutes and
684
699
  const extSet = detectApiExtensions(apiBuilders);
700
+ const withTag = options.tag ? `@${options.tag}` : '';
701
+ const extSetLimited = detectApiExtensions(apiBuilders.filter(b => {
702
+ if (b.use === `@vercel/python${withTag}` &&
703
+ !('vercel-plugin-python' in deps)) {
704
+ return false;
705
+ }
706
+ if (b.use === `@vercel/go${withTag}` &&
707
+ !('vercel-plugin-go' in deps)) {
708
+ return false;
709
+ }
710
+ if (b.use === `@vercel/ruby${withTag}` &&
711
+ !('vercel-plugin-ruby' in deps)) {
712
+ return false;
713
+ }
714
+ return true;
715
+ }));
685
716
  if (extSet.size > 0) {
686
- const exts = Array.from(extSet)
717
+ const extGroup = `(?:\\.(?:${Array.from(extSet)
687
718
  .map(ext => ext.slice(1))
688
- .join('|');
689
- const extGroup = `(?:\\.(?:${exts}))`;
719
+ .join('|')}))`;
720
+ const extGroupLimited = `(?:\\.(?:${Array.from(extSetLimited)
721
+ .map(ext => ext.slice(1))
722
+ .join('|')}))`;
690
723
  if (options.cleanUrls) {
691
724
  redirectRoutes.push({
692
725
  src: `^/(api(?:.+)?)/index${extGroup}?/?$`,
@@ -700,6 +733,18 @@ function getRouteResult(apiRoutes, dynamicRoutes, outputDirectory, apiBuilders,
700
733
  },
701
734
  status: 308,
702
735
  });
736
+ limitedRoutes.redirectRoutes.push({
737
+ src: `^/(api(?:.+)?)/index${extGroupLimited}?/?$`,
738
+ headers: { Location: options.trailingSlash ? '/$1/' : '/$1' },
739
+ status: 308,
740
+ });
741
+ limitedRoutes.redirectRoutes.push({
742
+ src: `^/api/(.+)${extGroupLimited}/?$`,
743
+ headers: {
744
+ Location: options.trailingSlash ? '/api/$1/' : '/api/$1',
745
+ },
746
+ status: 308,
747
+ });
703
748
  }
704
749
  else {
705
750
  defaultRoutes.push({ handle: 'miss' });
@@ -708,9 +753,16 @@ function getRouteResult(apiRoutes, dynamicRoutes, outputDirectory, apiBuilders,
708
753
  dest: '/api/$1',
709
754
  check: true,
710
755
  });
756
+ limitedRoutes.defaultRoutes.push({ handle: 'miss' });
757
+ limitedRoutes.defaultRoutes.push({
758
+ src: `^/api/(.+)${extGroupLimited}$`,
759
+ dest: '/api/$1',
760
+ check: true,
761
+ });
711
762
  }
712
763
  }
713
764
  rewriteRoutes.push(...dynamicRoutes);
765
+ limitedRoutes.rewriteRoutes.push(...dynamicRoutes);
714
766
  if (typeof ignoreRuntimes === 'undefined') {
715
767
  // This route is only necessary to hide the directory listing
716
768
  // to avoid enumerating serverless function names.
@@ -755,6 +807,7 @@ function getRouteResult(apiRoutes, dynamicRoutes, outputDirectory, apiBuilders,
755
807
  redirectRoutes,
756
808
  rewriteRoutes,
757
809
  errorRoutes,
810
+ limitedRoutes,
758
811
  };
759
812
  }
760
813
  function sortFilesBySegmentCount(fileA, fileB) {
package/dist/fs/glob.js CHANGED
@@ -8,6 +8,7 @@ const assert_1 = __importDefault(require("assert"));
8
8
  const glob_1 = __importDefault(require("glob"));
9
9
  const util_1 = require("util");
10
10
  const fs_extra_1 = require("fs-extra");
11
+ const normalize_path_1 = require("./normalize-path");
11
12
  const file_fs_ref_1 = __importDefault(require("../file-fs-ref"));
12
13
  const vanillaGlob = util_1.promisify(glob_1.default);
13
14
  async function glob(pattern, opts, mountpoint) {
@@ -31,7 +32,7 @@ async function glob(pattern, opts, mountpoint) {
31
32
  options.dot = true;
32
33
  const files = await vanillaGlob(pattern, options);
33
34
  for (const relativePath of files) {
34
- const fsPath = path_1.default.join(options.cwd, relativePath).replace(/\\/g, '/');
35
+ const fsPath = normalize_path_1.normalizePath(path_1.default.join(options.cwd, relativePath));
35
36
  let stat = options.statCache[fsPath];
36
37
  assert_1.default(stat, `statCache does not contain value for ${relativePath} (resolved to ${fsPath})`);
37
38
  const isSymlink = options.symlinks[fsPath];
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Convert Windows separators to Unix separators.
3
+ */
4
+ export declare function normalizePath(p: string): string;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizePath = void 0;
4
+ const isWin = process.platform === 'win32';
5
+ /**
6
+ * Convert Windows separators to Unix separators.
7
+ */
8
+ function normalizePath(p) {
9
+ return isWin ? p.replace(/\\/g, '/') : p;
10
+ }
11
+ exports.normalizePath = normalizePath;
@@ -0,0 +1 @@
1
+ export default function (downloadPath: string, rootDirectory?: string | undefined): Promise<(p: string) => any>;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const path_1 = __importDefault(require("path"));
7
+ const fs_extra_1 = __importDefault(require("fs-extra"));
8
+ const ignore_1 = __importDefault(require("ignore"));
9
+ function isCodedError(error) {
10
+ return (error !== null &&
11
+ error !== undefined &&
12
+ error.code !== undefined);
13
+ }
14
+ function clearRelative(s) {
15
+ return s.replace(/(\n|^)\.\//g, '$1');
16
+ }
17
+ async function default_1(downloadPath, rootDirectory) {
18
+ const readFile = async (p) => {
19
+ try {
20
+ return await fs_extra_1.default.readFile(p, 'utf8');
21
+ }
22
+ catch (error) {
23
+ if (error.code === 'ENOENT' ||
24
+ (error instanceof Error && error.message.includes('ENOENT'))) {
25
+ return undefined;
26
+ }
27
+ throw error;
28
+ }
29
+ };
30
+ const vercelIgnorePath = path_1.default.join(downloadPath, rootDirectory || '', '.vercelignore');
31
+ const nowIgnorePath = path_1.default.join(downloadPath, rootDirectory || '', '.nowignore');
32
+ const ignoreContents = [];
33
+ try {
34
+ ignoreContents.push(...(await Promise.all([readFile(vercelIgnorePath), readFile(nowIgnorePath)])).filter(Boolean));
35
+ }
36
+ catch (error) {
37
+ if (isCodedError(error) && error.code === 'ENOTDIR') {
38
+ console.log(`Warning: Cannot read ignore file from ${vercelIgnorePath}`);
39
+ }
40
+ else {
41
+ throw error;
42
+ }
43
+ }
44
+ if (ignoreContents.length === 2) {
45
+ throw new Error('Cannot use both a `.vercelignore` and `.nowignore` file. Please delete the `.nowignore` file.');
46
+ }
47
+ if (ignoreContents.length === 0) {
48
+ return () => false;
49
+ }
50
+ const ignoreFilter = ignore_1.default().add(clearRelative(ignoreContents[0]));
51
+ return function (p) {
52
+ // we should not ignore now.json and vercel.json if it asked to.
53
+ // we depend on these files for building the app with sourceless
54
+ if (p === 'now.json' || p === 'vercel.json')
55
+ return false;
56
+ return ignoreFilter.test(p).ignored;
57
+ };
58
+ }
59
+ exports.default = default_1;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import FileBlob from './file-blob';
2
3
  import FileFsRef from './file-fs-ref';
3
4
  import FileRef from './file-ref';
@@ -12,11 +13,14 @@ import { getLatestNodeVersion, getDiscontinuedNodeVersions } from './fs/node-ver
12
13
  import streamToBuffer from './fs/stream-to-buffer';
13
14
  import shouldServe from './should-serve';
14
15
  import debug from './debug';
15
- export { FileBlob, FileFsRef, FileRef, Lambda, createLambda, Prerender, download, DownloadedFiles, getWriteableDirectory, glob, GlobOptions, rename, execAsync, spawnAsync, getScriptName, installDependencies, runPackageJsonScript, execCommand, spawnCommand, walkParentDirs, getNodeBinPath, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, getNodeVersion, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, streamToBuffer, shouldServe, debug, isSymbolicLink, getLambdaOptionsFromFunction, scanParentDirs, };
16
+ import getIgnoreFilter from './get-ignore-filter';
17
+ export { FileBlob, FileFsRef, FileRef, Lambda, createLambda, Prerender, download, DownloadedFiles, getWriteableDirectory, glob, GlobOptions, rename, execAsync, spawnAsync, getScriptName, installDependencies, runPackageJsonScript, execCommand, spawnCommand, walkParentDirs, getNodeBinPath, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, getNodeVersion, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, streamToBuffer, shouldServe, debug, isSymbolicLink, getLambdaOptionsFromFunction, scanParentDirs, getIgnoreFilter, };
16
18
  export { detectBuilders, detectOutputDirectory, detectApiDirectory, detectApiExtensions, } from './detect-builders';
17
19
  export { detectFramework } from './detect-framework';
18
20
  export { DetectorFilesystem } from './detectors/filesystem';
19
21
  export { readConfigFile } from './fs/read-config-file';
22
+ export { normalizePath } from './fs/normalize-path';
23
+ export { convertRuntimeToPlugin, updateFunctionsManifest, updateRoutesManifest, } from './convert-runtime-to-plugin';
20
24
  export * from './schemas';
21
25
  export * from './types';
22
26
  export * from './errors';
@@ -30,3 +34,8 @@ export declare const isStaticRuntime: (name?: string | undefined) => boolean;
30
34
  * Throws an error if *both* env vars are defined.
31
35
  */
32
36
  export declare const getPlatformEnv: (name: string) => string | undefined;
37
+ /**
38
+ * Helper function for generating file or directories names in `.output/inputs`
39
+ * for dependencies of files provided to the File System API.
40
+ */
41
+ export declare const getInputHash: (source: Buffer | string) => string;