Compare commits

..

2 Commits

Author SHA1 Message Date
Steven
4ccdcde463 Publish Stable
- @vercel/build-utils@5.9.0
 - vercel@28.12.6
 - @vercel/client@12.3.1
 - @vercel/fs-detectors@3.7.5
 - @vercel/go@2.2.30
 - @vercel/hydrogen@0.0.44
 - @vercel/next@3.3.15
 - @vercel/node@2.8.13
 - @vercel/python@3.1.40
 - @vercel/redwood@1.0.51
 - @vercel/remix@1.2.5
 - @vercel/ruby@1.3.56
 - @vercel/static-build@1.1.7
2023-01-17 19:25:26 -05:00
Nathan Rajlich
22d3ee160b [build-utils] Add includeDirectories option to glob() (#9245)
Instead of always including empty directories in `glob()`, make it an
opt-in behavior because technically it's a breaking change to include
them by default.
2023-01-17 19:21:40 -05:00
16 changed files with 102 additions and 71 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/build-utils",
"version": "5.8.3",
"version": "5.9.0",
"license": "MIT",
"main": "./dist/index.js",
"types": "./dist/index.d.js",

View File

@@ -6,7 +6,9 @@ import { lstat, Stats } from 'fs-extra';
import { normalizePath } from './normalize-path';
import FileFsRef from '../file-fs-ref';
export type GlobOptions = vanillaGlob_.IOptions;
export interface GlobOptions extends vanillaGlob_.IOptions {
includeDirectories?: boolean;
}
const vanillaGlob = promisify(vanillaGlob_);
@@ -73,18 +75,20 @@ export default async function glob(
}
// Add empty directory entries
for (const relativePath of dirs) {
if (dirsWithEntries.has(relativePath)) continue;
if (options.includeDirectories) {
for (const relativePath of dirs) {
if (dirsWithEntries.has(relativePath)) continue;
let finalPath = relativePath;
if (mountpoint) {
finalPath = path.join(mountpoint, finalPath);
let finalPath = relativePath;
if (mountpoint) {
finalPath = path.join(mountpoint, finalPath);
}
const fsPath = normalizePath(path.join(options.cwd, relativePath));
const stat = statCache[fsPath];
results[finalPath] = new FileFsRef({ mode: stat.mode, fsPath });
}
const fsPath = normalizePath(path.join(options.cwd, relativePath));
const stat = statCache[fsPath];
results[finalPath] = new FileFsRef({ mode: stat.mode, fsPath });
}
return results;

View File

@@ -4,7 +4,7 @@ import { tmpdir } from 'os';
import { glob, isDirectory } from '../src';
describe('glob()', () => {
it('should return entries for empty directories', async () => {
it('should not return entries for empty directories by default', async () => {
const dir = await fs.mkdtemp(join(tmpdir(), 'build-utils-test'));
try {
await Promise.all([
@@ -19,6 +19,33 @@ describe('glob()', () => {
]);
const files = await glob('**', dir);
const fileNames = Object.keys(files).sort();
expect(fileNames).toHaveLength(2);
expect(fileNames).toEqual(['dir-with-file/data.json', 'root.txt']);
expect(isDirectory(files['dir-with-file/data.json'].mode)).toEqual(false);
expect(isDirectory(files['root.txt'].mode)).toEqual(false);
expect(files['dir-with-file']).toBeUndefined();
expect(files['another/subdir']).toBeUndefined();
expect(files['empty-dir']).toBeUndefined();
} finally {
await fs.remove(dir);
}
});
it('should return entries for empty directories with `includeDirectories: true`', async () => {
const dir = await fs.mkdtemp(join(tmpdir(), 'build-utils-test'));
try {
await Promise.all([
fs.writeFile(join(dir, 'root.txt'), 'file at the root'),
fs.mkdirp(join(dir, 'empty-dir')),
fs
.mkdirp(join(dir, 'dir-with-file'))
.then(() =>
fs.writeFile(join(dir, 'dir-with-file/data.json'), '{"a":"b"}')
),
fs.mkdirp(join(dir, 'another/subdir')),
]);
const files = await glob('**', { cwd: dir, includeDirectories: true });
const fileNames = Object.keys(files).sort();
expect(fileNames).toHaveLength(4);
expect(fileNames).toEqual([
'another/subdir',

View File

@@ -1,6 +1,6 @@
{
"name": "vercel",
"version": "28.12.5",
"version": "28.12.6",
"preferGlobal": true,
"license": "Apache-2.0",
"description": "The command-line interface for Vercel",
@@ -41,16 +41,16 @@
"node": ">= 14"
},
"dependencies": {
"@vercel/build-utils": "5.8.3",
"@vercel/go": "2.2.29",
"@vercel/hydrogen": "0.0.43",
"@vercel/next": "3.3.14",
"@vercel/node": "2.8.12",
"@vercel/python": "3.1.39",
"@vercel/redwood": "1.0.50",
"@vercel/remix": "1.2.4",
"@vercel/ruby": "1.3.55",
"@vercel/static-build": "1.1.6"
"@vercel/build-utils": "5.9.0",
"@vercel/go": "2.2.30",
"@vercel/hydrogen": "0.0.44",
"@vercel/next": "3.3.15",
"@vercel/node": "2.8.13",
"@vercel/python": "3.1.40",
"@vercel/redwood": "1.0.51",
"@vercel/remix": "1.2.5",
"@vercel/ruby": "1.3.56",
"@vercel/static-build": "1.1.7"
},
"devDependencies": {
"@alex_neo/jest-expect-message": "1.0.5",
@@ -93,10 +93,10 @@
"@types/which": "1.3.2",
"@types/write-json-file": "2.2.1",
"@types/yauzl-promise": "2.1.0",
"@vercel/client": "12.3.0",
"@vercel/client": "12.3.1",
"@vercel/error-utils": "1.0.8",
"@vercel/frameworks": "1.2.4",
"@vercel/fs-detectors": "3.7.4",
"@vercel/fs-detectors": "3.7.5",
"@vercel/fun": "1.0.4",
"@vercel/ncc": "0.24.0",
"@vercel/routing-utils": "2.1.8",

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/client",
"version": "12.3.0",
"version": "12.3.1",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"homepage": "https://vercel.com",
@@ -43,7 +43,7 @@
]
},
"dependencies": {
"@vercel/build-utils": "5.8.3",
"@vercel/build-utils": "5.9.0",
"@vercel/routing-utils": "2.1.8",
"@zeit/fetch": "5.2.0",
"async-retry": "1.2.3",

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/fs-detectors",
"version": "3.7.4",
"version": "3.7.5",
"description": "Vercel filesystem detectors",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@@ -35,7 +35,7 @@
"@types/minimatch": "3.0.5",
"@types/node": "14.18.33",
"@types/semver": "7.3.10",
"@vercel/build-utils": "5.8.3",
"@vercel/build-utils": "5.9.0",
"typescript": "4.3.4"
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/go",
"version": "2.2.29",
"version": "2.2.30",
"license": "MIT",
"main": "./dist/index",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/go",
@@ -36,7 +36,7 @@
"@types/node": "14.18.33",
"@types/node-fetch": "^2.3.0",
"@types/tar": "^4.0.0",
"@vercel/build-utils": "5.8.3",
"@vercel/build-utils": "5.9.0",
"@vercel/ncc": "0.24.0",
"async-retry": "1.3.1",
"execa": "^1.0.0",

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/hydrogen",
"version": "0.0.43",
"version": "0.0.44",
"license": "MIT",
"main": "./dist/index.js",
"homepage": "https://vercel.com/docs",
@@ -21,7 +21,7 @@
"devDependencies": {
"@types/jest": "27.5.1",
"@types/node": "14.18.33",
"@vercel/build-utils": "5.8.3",
"@vercel/build-utils": "5.9.0",
"@vercel/static-config": "2.0.11",
"execa": "3.2.0",
"fs-extra": "11.1.0",

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/next",
"version": "3.3.14",
"version": "3.3.15",
"license": "MIT",
"main": "./dist/index",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
@@ -45,7 +45,7 @@
"@types/semver": "6.0.0",
"@types/text-table": "0.2.1",
"@types/webpack-sources": "3.2.0",
"@vercel/build-utils": "5.8.3",
"@vercel/build-utils": "5.9.0",
"@vercel/nft": "0.22.5",
"@vercel/routing-utils": "2.1.8",
"async-sema": "3.0.1",

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/node",
"version": "2.8.12",
"version": "2.8.13",
"license": "MIT",
"main": "./dist/index",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/node-js",
@@ -31,7 +31,7 @@
"dependencies": {
"@edge-runtime/vm": "2.0.0",
"@types/node": "14.18.33",
"@vercel/build-utils": "5.8.3",
"@vercel/build-utils": "5.9.0",
"@vercel/node-bridge": "3.1.9",
"@vercel/static-config": "2.0.11",
"edge-runtime": "2.0.0",

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/python",
"version": "3.1.39",
"version": "3.1.40",
"main": "./dist/index.js",
"license": "MIT",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/python",
@@ -23,7 +23,7 @@
"@types/execa": "^0.9.0",
"@types/jest": "27.4.1",
"@types/node": "14.18.33",
"@vercel/build-utils": "5.8.3",
"@vercel/build-utils": "5.9.0",
"@vercel/ncc": "0.24.0",
"execa": "^1.0.0",
"typescript": "4.3.4"

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/redwood",
"version": "1.0.50",
"version": "1.0.51",
"main": "./dist/index.js",
"license": "MIT",
"homepage": "https://vercel.com/docs",
@@ -27,7 +27,7 @@
"@types/aws-lambda": "8.10.19",
"@types/node": "14.18.33",
"@types/semver": "6.0.0",
"@vercel/build-utils": "5.8.3",
"@vercel/build-utils": "5.9.0",
"execa": "3.2.0",
"fs-extra": "11.1.0",
"typescript": "4.3.4"

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/remix",
"version": "1.2.4",
"version": "1.2.5",
"license": "MIT",
"main": "./dist/index.js",
"homepage": "https://vercel.com/docs",
@@ -25,7 +25,7 @@
"devDependencies": {
"@types/jest": "27.5.1",
"@types/node": "14.18.33",
"@vercel/build-utils": "5.8.3",
"@vercel/build-utils": "5.9.0",
"typescript": "4.6.4"
}
}

View File

@@ -1,7 +1,7 @@
{
"name": "@vercel/ruby",
"author": "Nathan Cahill <nathan@nathancahill.com>",
"version": "1.3.55",
"version": "1.3.56",
"license": "MIT",
"main": "./dist/index",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/ruby",
@@ -22,7 +22,7 @@
"devDependencies": {
"@types/fs-extra": "8.0.0",
"@types/semver": "6.0.0",
"@vercel/build-utils": "5.8.3",
"@vercel/build-utils": "5.9.0",
"@vercel/ncc": "0.24.0",
"execa": "2.0.4",
"fs-extra": "^7.0.1",

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/static-build",
"version": "1.1.6",
"version": "1.1.7",
"license": "MIT",
"main": "./dist/index",
"homepage": "https://vercel.com/docs/build-step",
@@ -37,7 +37,7 @@
"@types/node": "14.18.33",
"@types/node-fetch": "2.5.4",
"@types/promise-timeout": "1.3.0",
"@vercel/build-utils": "5.8.3",
"@vercel/build-utils": "5.9.0",
"@vercel/frameworks": "1.2.4",
"@vercel/ncc": "0.24.0",
"@vercel/routing-utils": "2.1.8",

46
pnpm-lock.yaml generated
View File

@@ -198,23 +198,23 @@ importers:
'@types/which': 1.3.2
'@types/write-json-file': 2.2.1
'@types/yauzl-promise': 2.1.0
'@vercel/build-utils': 5.8.3
'@vercel/client': 12.3.0
'@vercel/build-utils': 5.9.0
'@vercel/client': 12.3.1
'@vercel/error-utils': 1.0.8
'@vercel/frameworks': 1.2.4
'@vercel/fs-detectors': 3.7.4
'@vercel/fs-detectors': 3.7.5
'@vercel/fun': 1.0.4
'@vercel/go': 2.2.29
'@vercel/hydrogen': 0.0.43
'@vercel/go': 2.2.30
'@vercel/hydrogen': 0.0.44
'@vercel/ncc': 0.24.0
'@vercel/next': 3.3.14
'@vercel/node': 2.8.12
'@vercel/python': 3.1.39
'@vercel/redwood': 1.0.50
'@vercel/remix': 1.2.4
'@vercel/next': 3.3.15
'@vercel/node': 2.8.13
'@vercel/python': 3.1.40
'@vercel/redwood': 1.0.51
'@vercel/remix': 1.2.5
'@vercel/routing-utils': 2.1.8
'@vercel/ruby': 1.3.55
'@vercel/static-build': 1.1.6
'@vercel/ruby': 1.3.56
'@vercel/static-build': 1.1.7
'@zeit/source-map-support': 0.6.2
ajv: 6.12.2
alpha-sort: 2.0.1
@@ -440,7 +440,7 @@ importers:
'@types/node-fetch': 2.5.4
'@types/recursive-readdir': 2.2.0
'@types/tar-fs': 1.16.1
'@vercel/build-utils': 5.8.3
'@vercel/build-utils': 5.9.0
'@vercel/routing-utils': 2.1.8
'@zeit/fetch': 5.2.0
async-retry: 1.2.3
@@ -545,7 +545,7 @@ importers:
'@types/minimatch': 3.0.5
'@types/node': 14.18.33
'@types/semver': 7.3.10
'@vercel/build-utils': 5.8.3
'@vercel/build-utils': 5.9.0
'@vercel/error-utils': 1.0.8
'@vercel/frameworks': 1.2.4
'@vercel/routing-utils': 2.1.8
@@ -592,7 +592,7 @@ importers:
'@types/node': 14.18.33
'@types/node-fetch': ^2.3.0
'@types/tar': ^4.0.0
'@vercel/build-utils': 5.8.3
'@vercel/build-utils': 5.9.0
'@vercel/ncc': 0.24.0
async-retry: 1.3.1
execa: ^1.0.0
@@ -624,7 +624,7 @@ importers:
specifiers:
'@types/jest': 27.5.1
'@types/node': 14.18.33
'@vercel/build-utils': 5.8.3
'@vercel/build-utils': 5.9.0
'@vercel/static-config': 2.0.11
execa: 3.2.0
fs-extra: 11.1.0
@@ -655,7 +655,7 @@ importers:
'@types/semver': 6.0.0
'@types/text-table': 0.2.1
'@types/webpack-sources': 3.2.0
'@vercel/build-utils': 5.8.3
'@vercel/build-utils': 5.9.0
'@vercel/nft': 0.22.5
'@vercel/routing-utils': 2.1.8
async-sema: 3.0.1
@@ -734,7 +734,7 @@ importers:
'@types/node': 14.18.33
'@types/node-fetch': ^2.6.1
'@types/test-listen': 1.1.0
'@vercel/build-utils': 5.8.3
'@vercel/build-utils': 5.9.0
'@vercel/ncc': 0.24.0
'@vercel/nft': 0.22.5
'@vercel/node-bridge': 3.1.9
@@ -818,7 +818,7 @@ importers:
'@types/execa': ^0.9.0
'@types/jest': 27.4.1
'@types/node': 14.18.33
'@vercel/build-utils': 5.8.3
'@vercel/build-utils': 5.9.0
'@vercel/ncc': 0.24.0
execa: ^1.0.0
typescript: 4.3.4
@@ -836,7 +836,7 @@ importers:
'@types/aws-lambda': 8.10.19
'@types/node': 14.18.33
'@types/semver': 6.0.0
'@vercel/build-utils': 5.8.3
'@vercel/build-utils': 5.9.0
'@vercel/nft': 0.22.5
'@vercel/routing-utils': 2.1.8
execa: 3.2.0
@@ -860,7 +860,7 @@ importers:
specifiers:
'@types/jest': 27.5.1
'@types/node': 14.18.33
'@vercel/build-utils': 5.8.3
'@vercel/build-utils': 5.9.0
'@vercel/nft': 0.22.5
typescript: 4.6.4
dependencies:
@@ -891,7 +891,7 @@ importers:
specifiers:
'@types/fs-extra': 8.0.0
'@types/semver': 6.0.0
'@vercel/build-utils': 5.8.3
'@vercel/build-utils': 5.9.0
'@vercel/ncc': 0.24.0
execa: 2.0.4
fs-extra: ^7.0.1
@@ -917,7 +917,7 @@ importers:
'@types/node': 14.18.33
'@types/node-fetch': 2.5.4
'@types/promise-timeout': 1.3.0
'@vercel/build-utils': 5.8.3
'@vercel/build-utils': 5.9.0
'@vercel/frameworks': 1.2.4
'@vercel/ncc': 0.24.0
'@vercel/routing-utils': 2.1.8