@vercel/client 18.3.4 → 18.4.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/collect-deployment-files.d.ts +1 -0
- package/dist/collect-deployment-files.js +2 -2
- package/dist/continue.d.ts +1 -0
- package/dist/continue.js +9 -1
- package/dist/create-deployment.d.ts +1 -0
- package/dist/create-deployment.js +13 -5
- package/dist/index.d.ts +1 -0
- package/dist/inspect-deployment-files.d.ts +1 -0
- package/dist/inspect-deployment-files.js +3 -2
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +75 -30
- package/package.json +3 -3
|
@@ -8,6 +8,7 @@ export interface CollectedDeploymentFiles {
|
|
|
8
8
|
workPath: string;
|
|
9
9
|
isDirectory: boolean;
|
|
10
10
|
ignoreList: string[];
|
|
11
|
+
warning?: string;
|
|
11
12
|
}
|
|
12
13
|
export declare function assertDeploymentPath(path: VercelClientOptions['path'] | undefined, debug: Debug): asserts path is VercelClientOptions['path'];
|
|
13
14
|
export declare function collectDeploymentFiles(path: VercelClientOptions['path'] | undefined, clientOptions: CollectDeploymentFilesOptions, debug: Debug): Promise<CollectedDeploymentFiles>;
|
|
@@ -66,7 +66,7 @@ async function collectDeploymentFiles(path, clientOptions, debug) {
|
|
|
66
66
|
} else {
|
|
67
67
|
debug(`Provided 'path' is a single file`);
|
|
68
68
|
}
|
|
69
|
-
const { fileList, ignoreList } = await (0, import_utils.buildFileTree)(
|
|
69
|
+
const { fileList, ignoreList, warning } = await (0, import_utils.buildFileTree)(
|
|
70
70
|
path,
|
|
71
71
|
clientOptions,
|
|
72
72
|
debug
|
|
@@ -86,7 +86,7 @@ ${err.message}`;
|
|
|
86
86
|
}
|
|
87
87
|
throw err;
|
|
88
88
|
}
|
|
89
|
-
return { fileList, filesMap, workPath, isDirectory, ignoreList };
|
|
89
|
+
return { fileList, filesMap, workPath, isDirectory, ignoreList, warning };
|
|
90
90
|
}
|
|
91
91
|
// Annotate the CommonJS export names for ESM import in node:
|
|
92
92
|
0 && (module.exports = {
|
package/dist/continue.d.ts
CHANGED
package/dist/continue.js
CHANGED
|
@@ -53,11 +53,19 @@ async function* continueDeployment(options) {
|
|
|
53
53
|
})
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
-
const { fileList } = await (0, import_utils.buildFileTree)(
|
|
56
|
+
const { fileList, warning } = await (0, import_utils.buildFileTree)(
|
|
57
57
|
options.path,
|
|
58
58
|
{ isDirectory: true, prebuilt: true, vercelOutputDir: outputDir },
|
|
59
59
|
debug
|
|
60
60
|
);
|
|
61
|
+
if (warning) {
|
|
62
|
+
debug("Yielding a prebuilt filePathMap ignore warning");
|
|
63
|
+
yield {
|
|
64
|
+
type: "warning",
|
|
65
|
+
payload: warning,
|
|
66
|
+
code: "PREBUILT_FILEPATHMAP_IGNORED"
|
|
67
|
+
};
|
|
68
|
+
}
|
|
61
69
|
const provisionJsonPath = (0, import_path.join)(outputDir, "provision.json");
|
|
62
70
|
const unbundledFiles = fileList.filter((f) => f === provisionJsonPath);
|
|
63
71
|
let files;
|
|
@@ -2,4 +2,5 @@ import { VercelClientOptions, DeploymentOptions, DeploymentEventType } from './t
|
|
|
2
2
|
export default function buildCreateDeployment(): (clientOptions: VercelClientOptions, deploymentOptions?: DeploymentOptions | Promise<DeploymentOptions>) => AsyncIterableIterator<{
|
|
3
3
|
type: DeploymentEventType;
|
|
4
4
|
payload: any;
|
|
5
|
+
code?: string;
|
|
5
6
|
}>;
|
|
@@ -62,11 +62,19 @@ function buildCreateDeployment() {
|
|
|
62
62
|
yield* (0, import_deploy.deploy)(/* @__PURE__ */ new Map(), clientOptions, deploymentOptions2);
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
|
-
const {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
);
|
|
65
|
+
const {
|
|
66
|
+
fileList,
|
|
67
|
+
filesMap: files,
|
|
68
|
+
warning
|
|
69
|
+
} = await (0, import_collect_deployment_files.collectDeploymentFiles)(path, clientOptions, debug);
|
|
70
|
+
if (warning) {
|
|
71
|
+
debug("Yielding a prebuilt filePathMap ignore warning");
|
|
72
|
+
yield {
|
|
73
|
+
type: "warning",
|
|
74
|
+
payload: warning,
|
|
75
|
+
code: "PREBUILT_FILEPATHMAP_IGNORED"
|
|
76
|
+
};
|
|
77
|
+
}
|
|
70
78
|
if (fileList.length === 0) {
|
|
71
79
|
debug("Deployment path has no files. Yielding a warning event");
|
|
72
80
|
yield {
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { getVercelIgnore, buildFileTree } from './utils/index';
|
|
|
5
5
|
export declare const createDeployment: (clientOptions: import("./types").VercelClientOptions, deploymentOptions?: import("./types").DeploymentOptions | Promise<import("./types").DeploymentOptions>) => AsyncIterableIterator<{
|
|
6
6
|
type: import("./types").DeploymentEventType;
|
|
7
7
|
payload: any;
|
|
8
|
+
code?: string;
|
|
8
9
|
}>;
|
|
9
10
|
export * from './errors';
|
|
10
11
|
export * from './types';
|
|
@@ -12,5 +12,6 @@ export interface DeploymentFileSummary {
|
|
|
12
12
|
ignoredCount: number;
|
|
13
13
|
files: DeploymentFileItem[];
|
|
14
14
|
ignored: string[];
|
|
15
|
+
warning?: string;
|
|
15
16
|
}
|
|
16
17
|
export declare function inspectDeploymentFiles(clientOptions: Pick<VercelClientOptions, 'archive' | 'bulkRedirectsPath' | 'debug' | 'path' | 'prebuilt' | 'projectName' | 'rootDirectory' | 'vercelOutputDir'>): Promise<DeploymentFileSummary>;
|
|
@@ -27,7 +27,7 @@ var import_utils = require("./utils");
|
|
|
27
27
|
async function inspectDeploymentFiles(clientOptions) {
|
|
28
28
|
const { path } = clientOptions;
|
|
29
29
|
const debug = (0, import_utils.createDebug)(clientOptions.debug);
|
|
30
|
-
const { filesMap, workPath, isDirectory, ignoreList } = await (0, import_collect_deployment_files.collectDeploymentFiles)(path, { ...clientOptions }, debug);
|
|
30
|
+
const { filesMap, workPath, isDirectory, ignoreList, warning } = await (0, import_collect_deployment_files.collectDeploymentFiles)(path, { ...clientOptions }, debug);
|
|
31
31
|
const files = [];
|
|
32
32
|
let totalSize = 0;
|
|
33
33
|
for (const [sha, file] of filesMap) {
|
|
@@ -54,7 +54,8 @@ async function inspectDeploymentFiles(clientOptions) {
|
|
|
54
54
|
totalSize,
|
|
55
55
|
ignoredCount: ignoreList.length,
|
|
56
56
|
files,
|
|
57
|
-
ignored: ignoreList.sort()
|
|
57
|
+
ignored: ignoreList.sort(),
|
|
58
|
+
warning
|
|
58
59
|
};
|
|
59
60
|
}
|
|
60
61
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare function parseVercelConfig(filePath?: string): Promise<VercelConf
|
|
|
12
12
|
export declare function buildFileTree(path: string | string[], { isDirectory, prebuilt, vercelOutputDir, rootDirectory, projectName, bulkRedirectsPath, }: Pick<VercelClientOptions, 'isDirectory' | 'prebuilt' | 'vercelOutputDir' | 'rootDirectory' | 'projectName' | 'bulkRedirectsPath'>, debug: Debug): Promise<{
|
|
13
13
|
fileList: string[];
|
|
14
14
|
ignoreList: string[];
|
|
15
|
+
warning?: string;
|
|
15
16
|
}>;
|
|
16
17
|
export declare function getVercelIgnore(cwd: string | string[], prebuilt?: boolean, vercelOutputDir?: string): Promise<{
|
|
17
18
|
ig: Ignore;
|
package/dist/utils/index.js
CHANGED
|
@@ -117,7 +117,10 @@ async function getUserIgnore(cwd) {
|
|
|
117
117
|
if (!ignoreFile) {
|
|
118
118
|
return null;
|
|
119
119
|
}
|
|
120
|
-
return
|
|
120
|
+
return {
|
|
121
|
+
ig: (0, import_ignore.default)().add(clearRelative(ignoreFile)),
|
|
122
|
+
ignoreFileName: vercelignore ? ".vercelignore" : ".nowignore"
|
|
123
|
+
};
|
|
121
124
|
}
|
|
122
125
|
const FILEPATHMAP_VERCELIGNORE_EXCEPTIONS = [
|
|
123
126
|
"node_modules",
|
|
@@ -135,6 +138,24 @@ const filePathMapVercelignoreExceptions = (0, import_ignore.default)().add(
|
|
|
135
138
|
function isFilePathMapIgnoreException(posixRel) {
|
|
136
139
|
return filePathMapVercelignoreExceptions.ignores(posixRel);
|
|
137
140
|
}
|
|
141
|
+
const FILEPATHMAP_IGNORE_ERROR_LIST_LIMIT = 20;
|
|
142
|
+
function formatFilePathMapIgnoreWarning(entries, ignoreFileName, truncated = false) {
|
|
143
|
+
const shown = entries.slice(0, FILEPATHMAP_IGNORE_ERROR_LIST_LIMIT);
|
|
144
|
+
const lines = shown.map((path) => ` ${path}`);
|
|
145
|
+
if (truncated) {
|
|
146
|
+
lines.push(" \u2026and more");
|
|
147
|
+
}
|
|
148
|
+
const count = truncated ? `at least ${shown.length}` : String(entries.length);
|
|
149
|
+
const fileWord = !truncated && entries.length === 1 ? "file" : "files";
|
|
150
|
+
const ignoreFileLabel = ignoreFileName === ".nowignore" ? `\`${ignoreFileName}\` (deprecated)` : `\`${ignoreFileName}\``;
|
|
151
|
+
return [
|
|
152
|
+
`${ignoreFileLabel} excludes ${count} ${fileWord} the prebuilt functions need. An upcoming CLI release will fail this deploy instead of uploading without them.`,
|
|
153
|
+
"",
|
|
154
|
+
...lines,
|
|
155
|
+
"",
|
|
156
|
+
`Remove the colliding rules from \`${ignoreFileName}\`, or exclude those paths from tracing with \`outputFileTracingExcludes\`.`
|
|
157
|
+
].join("\n");
|
|
158
|
+
}
|
|
138
159
|
async function buildFileTree(path, {
|
|
139
160
|
isDirectory,
|
|
140
161
|
prebuilt,
|
|
@@ -145,6 +166,7 @@ async function buildFileTree(path, {
|
|
|
145
166
|
}, debug) {
|
|
146
167
|
const ignoreList = [];
|
|
147
168
|
let fileList;
|
|
169
|
+
let warning;
|
|
148
170
|
let { ig, ignores } = await getVercelIgnore(path, prebuilt, vercelOutputDir);
|
|
149
171
|
debug(`Found ${ignores.length} rules in .vercelignore`);
|
|
150
172
|
debug("Building file tree...");
|
|
@@ -164,52 +186,75 @@ async function buildFileTree(path, {
|
|
|
164
186
|
(file) => (0, import_path.basename)(file) === ".vc-config.json"
|
|
165
187
|
);
|
|
166
188
|
const userIg = await getUserIgnore(path);
|
|
167
|
-
|
|
189
|
+
const ignoredFilePathMap = /* @__PURE__ */ new Set();
|
|
190
|
+
let ignoredFilePathMapTruncated = false;
|
|
191
|
+
const vcConfigs = await Promise.all(
|
|
168
192
|
vcConfigFilePaths.map(async (p) => {
|
|
169
193
|
const configJson = await (0, import_fs_extra.readFile)(p, "utf8");
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
194
|
+
return JSON.parse(configJson);
|
|
195
|
+
})
|
|
196
|
+
);
|
|
197
|
+
for (const config of vcConfigs) {
|
|
198
|
+
if (!config.filePathMap)
|
|
199
|
+
continue;
|
|
200
|
+
for (const v of Object.values(config.filePathMap)) {
|
|
201
|
+
const absPath = (0, import_path.join)(path, v);
|
|
202
|
+
const rel = (0, import_path.relative)(path, absPath);
|
|
203
|
+
const posixRel = rel.split(import_path.sep).join("/");
|
|
204
|
+
if (rel.startsWith("..") || (0, import_path.isAbsolute)(rel)) {
|
|
205
|
+
debug(
|
|
206
|
+
`Ignoring "filePathMap" entry "${v}": resolves outside the deployment root`
|
|
207
|
+
);
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
if (userIg && userIg.ig.ignores(posixRel)) {
|
|
211
|
+
if (isFilePathMapIgnoreException(posixRel)) {
|
|
178
212
|
debug(
|
|
179
|
-
`
|
|
213
|
+
`Keeping "filePathMap" entry "${v}": matches a default-ignored dependency/output path`
|
|
180
214
|
);
|
|
215
|
+
} else if (ignoredFilePathMap.has(posixRel)) {
|
|
216
|
+
continue;
|
|
217
|
+
} else if (fileList.includes(absPath)) {
|
|
218
|
+
debug(
|
|
219
|
+
`Skipping "filePathMap" entry "${v}": already in the upload set`
|
|
220
|
+
);
|
|
221
|
+
continue;
|
|
222
|
+
} else if (ignoredFilePathMap.size >= FILEPATHMAP_IGNORE_ERROR_LIST_LIMIT) {
|
|
223
|
+
ignoredFilePathMapTruncated = true;
|
|
224
|
+
continue;
|
|
225
|
+
} else {
|
|
226
|
+
ignoredFilePathMap.add(posixRel);
|
|
181
227
|
continue;
|
|
182
228
|
}
|
|
183
|
-
if (userIg && userIg.ignores(posixRel)) {
|
|
184
|
-
if (isFilePathMapIgnoreException(posixRel)) {
|
|
185
|
-
debug(
|
|
186
|
-
`Keeping "filePathMap" entry "${v}": matches a default-ignored dependency/output path`
|
|
187
|
-
);
|
|
188
|
-
} else {
|
|
189
|
-
debug(
|
|
190
|
-
`Ignoring "filePathMap" entry "${v}": matched by a rule in .vercelignore/.nowignore`
|
|
191
|
-
);
|
|
192
|
-
continue;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
refs.add(absPath);
|
|
196
229
|
}
|
|
197
|
-
|
|
198
|
-
|
|
230
|
+
refs.add(absPath);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
if (ignoredFilePathMap.size > 0) {
|
|
234
|
+
warning = formatFilePathMapIgnoreWarning(
|
|
235
|
+
[...ignoredFilePathMap].sort((a, b) => a.localeCompare(b)),
|
|
236
|
+
userIg?.ignoreFileName || ".vercelignore",
|
|
237
|
+
ignoredFilePathMapTruncated
|
|
238
|
+
);
|
|
239
|
+
}
|
|
199
240
|
try {
|
|
200
241
|
const {
|
|
201
242
|
findConfig: findMicrofrontendsConfig,
|
|
202
243
|
inferMicrofrontendsLocation
|
|
203
244
|
} = await import("@vercel/microfrontends/microfrontends/utils");
|
|
245
|
+
const customConfigFilename = void 0;
|
|
204
246
|
let microfrontendConfigPath = findMicrofrontendsConfig({
|
|
205
|
-
dir: (0, import_path.join)(path, rootDirectory || "")
|
|
247
|
+
dir: (0, import_path.join)(path, rootDirectory || ""),
|
|
248
|
+
customConfigFilename
|
|
206
249
|
});
|
|
207
250
|
if (!microfrontendConfigPath && !rootDirectory && projectName) {
|
|
208
251
|
microfrontendConfigPath = findMicrofrontendsConfig({
|
|
209
252
|
dir: inferMicrofrontendsLocation({
|
|
210
253
|
repositoryRoot: path,
|
|
211
|
-
|
|
212
|
-
|
|
254
|
+
applicationContext: { name: projectName },
|
|
255
|
+
customConfigFilename
|
|
256
|
+
}),
|
|
257
|
+
customConfigFilename
|
|
213
258
|
});
|
|
214
259
|
}
|
|
215
260
|
if (microfrontendConfigPath) {
|
|
@@ -278,7 +323,7 @@ async function buildFileTree(path, {
|
|
|
278
323
|
fileList = [path];
|
|
279
324
|
debug(`Deploying the provided path as single file`);
|
|
280
325
|
}
|
|
281
|
-
return { fileList, ignoreList };
|
|
326
|
+
return { fileList, ignoreList, warning };
|
|
282
327
|
}
|
|
283
328
|
async function getVercelIgnore(cwd, prebuilt, vercelOutputDir) {
|
|
284
329
|
const ig = (0, import_ignore.default)();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/client",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.4.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"homepage": "https://vercel.com",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"vitest": "4.1.10"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@vercel/microfrontends": "
|
|
30
|
+
"@vercel/microfrontends": "2.4.0",
|
|
31
31
|
"async-retry": "1.2.3",
|
|
32
32
|
"async-sema": "3.0.0",
|
|
33
33
|
"fs-extra": "8.0.1",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"querystring": "^0.2.0",
|
|
38
38
|
"sleep-promise": "8.0.1",
|
|
39
39
|
"tar-fs": "1.16.3",
|
|
40
|
-
"@vercel/build-utils": "14.
|
|
40
|
+
"@vercel/build-utils": "14.10.0",
|
|
41
41
|
"@vercel/error-utils": "2.2.1",
|
|
42
42
|
"@vercel/routing-utils": "6.5.0"
|
|
43
43
|
},
|