@vercel/static-build 1.3.25 → 1.3.26

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.
@@ -33,8 +33,8 @@ async function readBuildOutputDirectory({ workPath, nodeVersion, }) {
33
33
  configFileName: 'build.json',
34
34
  });
35
35
  const outputs = {
36
- staticFiles: _shared_1.isObjectEmpty(staticFiles) ? null : staticFiles,
37
- functions: _shared_1.isObjectEmpty(functions) ? null : functions,
36
+ staticFiles: (0, _shared_1.isObjectEmpty)(staticFiles) ? null : staticFiles,
37
+ functions: (0, _shared_1.isObjectEmpty)(functions) ? null : functions,
38
38
  routes: routes.length ? routes : null,
39
39
  images,
40
40
  build,
@@ -59,7 +59,7 @@ async function readBuildOutputDirectory({ workPath, nodeVersion, }) {
59
59
  exports.readBuildOutputDirectory = readBuildOutputDirectory;
60
60
  async function readStaticFiles({ workPath, }) {
61
61
  const staticFilePath = path_1.default.join(workPath, VERCEL_BUILD_OUTPUT, 'static');
62
- const staticFiles = await build_utils_1.glob('**', {
62
+ const staticFiles = await (0, build_utils_1.glob)('**', {
63
63
  cwd: staticFilePath,
64
64
  });
65
65
  return staticFiles;
@@ -69,12 +69,12 @@ async function readFunctions({ workPath, functionsMountPath, nodeVersion, }) {
69
69
  const functionsConfig = await readFunctionsConfig({ workPath });
70
70
  // Find all entrypoints and create a Lambda for each of them.
71
71
  let functionsPath = path_1.default.join(workPath, VERCEL_BUILD_OUTPUT, 'functions');
72
- let functionEntrypoints = await build_utils_1.glob('*/index{,.*}', { cwd: functionsPath });
72
+ let functionEntrypoints = await (0, build_utils_1.glob)('*/index{,.*}', { cwd: functionsPath });
73
73
  let isLegacyFunctions = false;
74
74
  // To not break existing projects, we have to keep supporting the `functions/node` folder.
75
75
  if (!Object.keys(functionEntrypoints).length) {
76
76
  functionsPath = path_1.default.join(functionsPath, 'node');
77
- functionEntrypoints = await build_utils_1.glob('*/index.{js,mjs}', {
77
+ functionEntrypoints = await (0, build_utils_1.glob)('*/index.{js,mjs}', {
78
78
  cwd: functionsPath,
79
79
  });
80
80
  isLegacyFunctions = true;
@@ -84,7 +84,7 @@ async function readFunctions({ workPath, functionsMountPath, nodeVersion, }) {
84
84
  const functionName = path_1.default.dirname(entrypointFile);
85
85
  const lambdaConfig = functionsConfig.get(functionName) || {};
86
86
  const { runtime, handler, ...config } = lambdaConfig;
87
- const lambdaFiles = await build_utils_1.glob('**', {
87
+ const lambdaFiles = await (0, build_utils_1.glob)('**', {
88
88
  cwd: path_1.default.join(functionsPath, functionName),
89
89
  });
90
90
  if (!lambdaConfig.runtime && isLegacyFunctions) {
@@ -122,7 +122,7 @@ async function readFunctions({ workPath, functionsMountPath, nodeVersion, }) {
122
122
  ? path_1.default.join(functionsMountPath, parsed.dir, parsed.name)
123
123
  : path_1.default.join(functionsMountPath, functionName);
124
124
  output[newPath] = lambda;
125
- build_utils_1.debug(`Created Lambda "${newPath}" from "${path_1.default.join(functionsPath, entrypointFile)}".`);
125
+ (0, build_utils_1.debug)(`Created Lambda "${newPath}" from "${path_1.default.join(functionsPath, entrypointFile)}".`);
126
126
  }
127
127
  return output;
128
128
  }
@@ -10,6 +10,7 @@ const build_utils_1 = require("@vercel/build-utils");
10
10
  const _shared_1 = require("./_shared");
11
11
  const ts_morph_1 = require("ts-morph");
12
12
  const static_config_1 = require("@vercel/static-config");
13
+ const error_utils_1 = require("@vercel/error-utils");
13
14
  const BUILD_OUTPUT_DIR = '.output';
14
15
  const BRIDGE_MIDDLEWARE_V2_TO_V3 = `
15
16
 
@@ -36,7 +37,7 @@ async function getBuildOutputDirectory(workingDir) {
36
37
  const outputDir = path_1.default.join(workingDir, BUILD_OUTPUT_DIR);
37
38
  // check for one of several config files
38
39
  const finderPromises = CONFIG_FILES.map(configFile => {
39
- return fs_extra_1.pathExists(path_1.default.join(outputDir, configFile));
40
+ return (0, fs_extra_1.pathExists)(path_1.default.join(outputDir, configFile));
40
41
  });
41
42
  const finders = await Promise.all(finderPromises);
42
43
  if (finders.some(found => found)) {
@@ -67,7 +68,7 @@ async function readBuildOutputDirectory({ workPath, }) {
67
68
  regions: (() => {
68
69
  try {
69
70
  const project = new ts_morph_1.Project();
70
- const config = static_config_1.getConfig(project, middleware.file.fsPath);
71
+ const config = (0, static_config_1.getConfig)(project, middleware.file.fsPath);
71
72
  return config?.regions;
72
73
  }
73
74
  catch (err) {
@@ -78,18 +79,18 @@ async function readBuildOutputDirectory({ workPath, }) {
78
79
  }
79
80
  const staticFiles = await readStaticFiles({ workPath });
80
81
  const outputs = {
81
- staticFiles: _shared_1.isObjectEmpty(staticFiles) ? null : staticFiles,
82
- functions: _shared_1.isObjectEmpty(functions) ? null : functions,
82
+ staticFiles: (0, _shared_1.isObjectEmpty)(staticFiles) ? null : staticFiles,
83
+ functions: (0, _shared_1.isObjectEmpty)(functions) ? null : functions,
83
84
  routes: routes.length ? routes : null,
84
85
  };
85
86
  if (outputs.functions) {
86
- build_utils_1.debug(`Detected Serverless Functions in "${BUILD_OUTPUT_DIR}"`);
87
+ (0, build_utils_1.debug)(`Detected Serverless Functions in "${BUILD_OUTPUT_DIR}"`);
87
88
  }
88
89
  if (outputs.staticFiles) {
89
- build_utils_1.debug(`Detected Static Assets in "${BUILD_OUTPUT_DIR}"`);
90
+ (0, build_utils_1.debug)(`Detected Static Assets in "${BUILD_OUTPUT_DIR}"`);
90
91
  }
91
92
  if (outputs.routes) {
92
- build_utils_1.debug(`Detected Routes Configuration in "${BUILD_OUTPUT_DIR}"`);
93
+ (0, build_utils_1.debug)(`Detected Routes Configuration in "${BUILD_OUTPUT_DIR}"`);
93
94
  }
94
95
  return outputs;
95
96
  }
@@ -97,19 +98,22 @@ exports.readBuildOutputDirectory = readBuildOutputDirectory;
97
98
  async function getMiddleware(workPath) {
98
99
  const manifestPath = path_1.default.join(workPath, BUILD_OUTPUT_DIR, 'functions-manifest.json');
99
100
  try {
100
- const manifest = await fs_extra_1.readJson(manifestPath);
101
+ const manifest = await (0, fs_extra_1.readJson)(manifestPath);
101
102
  if (manifest.pages['_middleware.js'].runtime !== 'web') {
102
103
  return;
103
104
  }
104
105
  }
105
106
  catch (error) {
106
- if (error.code !== 'ENOENT')
107
+ if (!(0, error_utils_1.isErrnoException)(error)) {
107
108
  throw error;
108
- return;
109
+ }
110
+ if (error.code !== 'ENOENT') {
111
+ throw error;
112
+ }
109
113
  }
110
114
  const middlewareRelativePath = path_1.default.join(BUILD_OUTPUT_DIR, 'server/pages/_middleware.js');
111
115
  const middlewareAbsoluatePath = path_1.default.join(workPath, middlewareRelativePath);
112
- await fs_extra_1.appendFile(middlewareAbsoluatePath, BRIDGE_MIDDLEWARE_V2_TO_V3);
116
+ await (0, fs_extra_1.appendFile)(middlewareAbsoluatePath, BRIDGE_MIDDLEWARE_V2_TO_V3);
113
117
  const route = {
114
118
  src: '/(.*)',
115
119
  middlewarePath: 'middleware',
@@ -124,7 +128,7 @@ async function getMiddleware(workPath) {
124
128
  }
125
129
  async function readStaticFiles({ workPath, }) {
126
130
  const staticFilePath = path_1.default.join(workPath, BUILD_OUTPUT_DIR, 'static');
127
- const staticFiles = await build_utils_1.glob('**', {
131
+ const staticFiles = await (0, build_utils_1.glob)('**', {
128
132
  cwd: staticFilePath,
129
133
  });
130
134
  return staticFiles;
@@ -11,8 +11,8 @@ const BUILD_OUTPUT_DIR = '.vercel/output';
11
11
  */
12
12
  async function getBuildOutputDirectory(path) {
13
13
  try {
14
- const outputDir = path_1.join(path, BUILD_OUTPUT_DIR);
15
- const configPath = path_1.join(outputDir, 'config.json');
14
+ const outputDir = (0, path_1.join)(path, BUILD_OUTPUT_DIR);
15
+ const configPath = (0, path_1.join)(outputDir, 'config.json');
16
16
  await fs_1.promises.stat(configPath);
17
17
  return outputDir;
18
18
  }
@@ -25,8 +25,8 @@ async function getBuildOutputDirectory(path) {
25
25
  exports.getBuildOutputDirectory = getBuildOutputDirectory;
26
26
  async function readConfig(path) {
27
27
  try {
28
- const outputDir = path_1.join(path, BUILD_OUTPUT_DIR);
29
- const configPath = path_1.join(outputDir, 'config.json');
28
+ const outputDir = (0, path_1.join)(path, BUILD_OUTPUT_DIR);
29
+ const configPath = (0, path_1.join)(outputDir, 'config.json');
30
30
  return JSON.parse(await fs_1.promises.readFile(configPath, 'utf8'));
31
31
  }
32
32
  catch (err) {
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -74,13 +78,13 @@ async function updateGatsbyConfig(dir, plugins) {
74
78
  const gatsbyConfigPathTs = path.join(dir, `${GATSBY_CONFIG_FILE}.ts`);
75
79
  const gatsbyConfigPathMjs = path.join(dir, `${GATSBY_CONFIG_FILE}.mjs`);
76
80
  const gatsbyConfigPathJs = path.join(dir, `${GATSBY_CONFIG_FILE}.js`);
77
- if (await _shared_1.fileExists(gatsbyConfigPathTs)) {
81
+ if (await (0, _shared_1.fileExists)(gatsbyConfigPathTs)) {
78
82
  await updateGatsbyConfigTs(gatsbyConfigPathTs, plugins);
79
83
  }
80
- else if (await _shared_1.fileExists(gatsbyConfigPathMjs)) {
84
+ else if (await (0, _shared_1.fileExists)(gatsbyConfigPathMjs)) {
81
85
  await updateGatsbyConfigMjs(gatsbyConfigPathMjs, plugins);
82
86
  }
83
- else if (await _shared_1.fileExists(gatsbyConfigPathJs)) {
87
+ else if (await (0, _shared_1.fileExists)(gatsbyConfigPathJs)) {
84
88
  await updateGatsbyConfigJs(gatsbyConfigPathJs, plugins);
85
89
  }
86
90
  else {
@@ -91,7 +95,7 @@ module.exports = ${JSON.stringify({ plugins })}`);
91
95
  const GENERATED_FILE_COMMENT = `// This file was generated by @vercel/static-build`;
92
96
  async function updateGatsbyConfigTs(configPath, plugins) {
93
97
  const renamedPath = `${configPath}.__vercel_builder_backup__.ts`;
94
- if (!(await _shared_1.fileExists(renamedPath))) {
98
+ if (!(await (0, _shared_1.fileExists)(renamedPath))) {
95
99
  await fs_extra_1.default.rename(configPath, renamedPath);
96
100
  }
97
101
  await fs_extra_1.default.writeFile(configPath, `${GENERATED_FILE_COMMENT}
@@ -126,7 +130,7 @@ export default vercelConfig;
126
130
  }
127
131
  async function updateGatsbyConfigMjs(configPath, plugins) {
128
132
  const renamedPath = `${configPath}.__vercel_builder_backup__.mjs`;
129
- if (!(await _shared_1.fileExists(renamedPath))) {
133
+ if (!(await (0, _shared_1.fileExists)(renamedPath))) {
130
134
  await fs_extra_1.default.rename(configPath, renamedPath);
131
135
  }
132
136
  await fs_extra_1.default.writeFile(configPath, `${GENERATED_FILE_COMMENT}
@@ -159,7 +163,7 @@ export default vercelConfig;
159
163
  }
160
164
  async function updateGatsbyConfigJs(configPath, plugins) {
161
165
  const renamedPath = `${configPath}.__vercel_builder_backup__.js`;
162
- if (!(await _shared_1.fileExists(renamedPath))) {
166
+ if (!(await (0, _shared_1.fileExists)(renamedPath))) {
163
167
  await fs_extra_1.default.rename(configPath, renamedPath);
164
168
  }
165
169
  await fs_extra_1.default.writeFile(configPath, `${GENERATED_FILE_COMMENT}
@@ -193,13 +197,13 @@ async function updateGatsbyNode(dir) {
193
197
  const gatsbyNodePathTs = path.join(dir, `${GATSBY_NODE_FILE}.ts`);
194
198
  const gatsbyNodePathMjs = path.join(dir, `${GATSBY_NODE_FILE}.mjs`);
195
199
  const gatsbyNodePathJs = path.join(dir, `${GATSBY_NODE_FILE}.js`);
196
- if (await _shared_1.fileExists(gatsbyNodePathTs)) {
200
+ if (await (0, _shared_1.fileExists)(gatsbyNodePathTs)) {
197
201
  await updateGatsbyNodeTs(gatsbyNodePathTs);
198
202
  }
199
- else if (await _shared_1.fileExists(gatsbyNodePathMjs)) {
203
+ else if (await (0, _shared_1.fileExists)(gatsbyNodePathMjs)) {
200
204
  await updateGatsbyNodeMjs(gatsbyNodePathMjs);
201
205
  }
202
- else if (await _shared_1.fileExists(gatsbyNodePathJs)) {
206
+ else if (await (0, _shared_1.fileExists)(gatsbyNodePathJs)) {
203
207
  await updateGatsbyNodeJs(gatsbyNodePathJs);
204
208
  }
205
209
  else {
@@ -209,7 +213,7 @@ module.exports = require('@vercel/gatsby-plugin-vercel-builder/gatsby-node.js');
209
213
  }
210
214
  async function updateGatsbyNodeTs(configPath) {
211
215
  const renamedPath = `${configPath}.__vercel_builder_backup__.ts`;
212
- if (!(await _shared_1.fileExists(renamedPath))) {
216
+ if (!(await (0, _shared_1.fileExists)(renamedPath))) {
213
217
  await fs_extra_1.default.rename(configPath, renamedPath);
214
218
  }
215
219
  await fs_extra_1.default.writeFile(configPath, `${GENERATED_FILE_COMMENT}
@@ -229,7 +233,7 @@ export const onPostBuild: GatsbyNode['onPostBuild'] = async (args, options) => {
229
233
  }
230
234
  async function updateGatsbyNodeMjs(configPath) {
231
235
  const renamedPath = `${configPath}.__vercel_builder_backup__.mjs`;
232
- if (!(await _shared_1.fileExists(renamedPath))) {
236
+ if (!(await (0, _shared_1.fileExists)(renamedPath))) {
233
237
  await fs_extra_1.default.rename(configPath, renamedPath);
234
238
  }
235
239
  await fs_extra_1.default.writeFile(configPath, `${GENERATED_FILE_COMMENT}
@@ -248,7 +252,7 @@ export const onPostBuild = async (args, options) => {
248
252
  }
249
253
  async function updateGatsbyNodeJs(configPath) {
250
254
  const renamedPath = `${configPath}.__vercel_builder_backup__.js`;
251
- if (!(await _shared_1.fileExists(renamedPath))) {
255
+ if (!(await (0, _shared_1.fileExists)(renamedPath))) {
252
256
  await fs_extra_1.default.rename(configPath, renamedPath);
253
257
  }
254
258
  await fs_extra_1.default.writeFile(configPath, `${GENERATED_FILE_COMMENT}
@@ -9,23 +9,23 @@ const ANALYTICS_PLUGIN_PACKAGE = '@nuxtjs/web-vitals';
9
9
  async function injectVercelAnalyticsPlugin(dir) {
10
10
  // First update the `.nuxtrc` file to inject the Speed Insights (formerly Analytics) plugin.
11
11
  // See: https://gist.github.com/pi0/23b5253ac19b4ed5a70add3b971545c9
12
- const nuxtrcPath = path_1.join(dir, '.nuxtrc');
12
+ const nuxtrcPath = (0, path_1.join)(dir, '.nuxtrc');
13
13
  console.log(`Injecting Nuxt.js Speed Insights plugin "${ANALYTICS_PLUGIN_PACKAGE}" to \`${nuxtrcPath}\``);
14
- rc9_1.update({
14
+ (0, rc9_1.update)({
15
15
  'modules[]': ANALYTICS_PLUGIN_PACKAGE,
16
16
  }, {
17
17
  name: nuxtrcPath,
18
18
  });
19
19
  // The dependency needs to be listed in `package.json` as well so
20
20
  // that `npm i` installs the package.
21
- const pkgJson = (await _shared_1.readPackageJson(dir));
21
+ const pkgJson = (await (0, _shared_1.readPackageJson)(dir));
22
22
  if (!pkgJson.dependencies) {
23
23
  pkgJson.dependencies = {};
24
24
  }
25
25
  if (!pkgJson.dependencies[ANALYTICS_PLUGIN_PACKAGE]) {
26
26
  pkgJson.dependencies[ANALYTICS_PLUGIN_PACKAGE] = 'latest';
27
27
  console.log(`Adding "${ANALYTICS_PLUGIN_PACKAGE}" to \`package.json\` "dependencies"`);
28
- await _shared_1.writePackageJson(dir, pkgJson);
28
+ await (0, _shared_1.writePackageJson)(dir, pkgJson);
29
29
  }
30
30
  }
31
31
  exports.injectVercelAnalyticsPlugin = injectVercelAnalyticsPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/static-build",
3
- "version": "1.3.25",
3
+ "version": "1.3.26",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/build-step",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@vercel/gatsby-plugin-vercel-analytics": "1.0.10",
23
- "@vercel/gatsby-plugin-vercel-builder": "1.2.10"
23
+ "@vercel/gatsby-plugin-vercel-builder": "1.3.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/aws-lambda": "8.10.64",
@@ -32,12 +32,13 @@
32
32
  "@types/node-fetch": "2.5.4",
33
33
  "@types/promise-timeout": "1.3.0",
34
34
  "@types/semver": "7.3.13",
35
- "@vercel/build-utils": "6.7.1",
36
- "@vercel/frameworks": "1.3.4",
37
- "@vercel/fs-detectors": "3.8.11",
35
+ "@vercel/build-utils": "6.7.2",
36
+ "@vercel/error-utils": "1.0.10",
37
+ "@vercel/frameworks": "1.3.5",
38
+ "@vercel/fs-detectors": "3.8.12",
38
39
  "@vercel/ncc": "0.24.0",
39
- "@vercel/routing-utils": "2.2.0",
40
- "@vercel/static-config": "2.0.16",
40
+ "@vercel/routing-utils": "2.2.1",
41
+ "@vercel/static-config": "2.0.17",
41
42
  "execa": "3.2.0",
42
43
  "fs-extra": "10.0.0",
43
44
  "get-port": "5.0.0",
@@ -47,8 +48,7 @@
47
48
  "rc9": "1.2.0",
48
49
  "semver": "7.3.8",
49
50
  "tree-kill": "1.2.2",
50
- "ts-morph": "12.0.0",
51
- "typescript": "4.3.4"
51
+ "ts-morph": "12.0.0"
52
52
  },
53
- "gitHead": "7082da84511740ea0304b5f93b0073bbb3f3a9ed"
53
+ "gitHead": "2de365f9cfea3ce283d2bf855507c71209f1e3d8"
54
54
  }