diff --git a/tools/fs/files.ts b/tools/fs/files.ts index b91a5a6799..9980d767ff 100644 --- a/tools/fs/files.ts +++ b/tools/fs/files.ts @@ -404,6 +404,8 @@ export function treeHash(root: string, optionsParams: { } hash.update('file ' + JSON.stringify(relativePath) + ' ' + stat.size + ' ' + fileHash(absPath) + '\n'); + + // @ts-ignore if (stat.mode & 0o100) { hash.update('exec\n'); } @@ -537,6 +539,8 @@ export function cp_r(from: string, to: string, options: { // owner. (This mode will be modified by umask.) We don't copy the // mode *directly* because this function is used by 'meteor create' // which is copying from the read-only tools tree into a writable app. + + // @ts-ignore mode: (stat.mode & 0o100) ? 0o777 : 0o666, }); @@ -1698,6 +1702,8 @@ export function copyFile(from: string, to: string, flags = 0) { // modified by umask.) We don't copy the mode *directly* because this function // is used by 'meteor create' which is copying from the read-only tools tree // into a writable app. + + // @ts-ignore chmod(to, (stat.mode & 0o100) ? 0o777 : 0o666); } } diff --git a/tools/fs/safe-watcher.ts b/tools/fs/safe-watcher.ts index c90fa56c18..909dfa6b26 100644 --- a/tools/fs/safe-watcher.ts +++ b/tools/fs/safe-watcher.ts @@ -1,4 +1,4 @@ -import { FSWatcher, Stats } from "fs"; +import { FSWatcher, Stats, BigIntStats } from "fs"; import { Profile } from "../tool-env/profile"; import { statOrNull, @@ -89,7 +89,7 @@ function acquireWatcher(absPath: string, callback: EntryCallback) { } function startNewWatcher(absPath: string): Entry { - let stat: Stats | null = null; + let stat: Stats | BigIntStats | null = null; if (DEDUPLICATE_BY_INO) { stat = statOrNull(absPath); diff --git a/tools/fs/watch.ts b/tools/fs/watch.ts index f473840331..970d38be09 100644 --- a/tools/fs/watch.ts +++ b/tools/fs/watch.ts @@ -1,4 +1,4 @@ -import { Stats, FSWatcher, Dirent } from "fs"; +import { Stats, BigIntStats, FSWatcher, Dirent } from "fs"; import * as files from "./files"; import * as safeWatcher from "./safe-watcher"; import { createHash } from "crypto"; @@ -351,7 +351,7 @@ function readAndStatDirectory(absPath: string) { // Add slashes to the end of directories. const contentsWithSlashes: string[] = []; contents.forEach(entry => { - let stat: Dirent | Stats | null = entry; + let stat: Dirent | Stats | BigIntStats | null = entry; let name = entry.name; if (entry.isSymbolicLink()) { @@ -428,7 +428,7 @@ export class Watcher { watcher: safeWatcher.SafeWatcher | null; // Undefined until we stat the file for the first time, then null // if the file is observed to be missing. - lastStat?: Stats | null + lastStat?: Stats | BigIntStats | null }> = Object.create(null); constructor(options: { diff --git a/tools/isobuild/resolver.ts b/tools/isobuild/resolver.ts index 0092f20fb4..c84c56f29e 100644 --- a/tools/isobuild/resolver.ts +++ b/tools/isobuild/resolver.ts @@ -14,7 +14,7 @@ import { convertToOSPath, convertToPosixPath, } from "../fs/files"; -import { Stats } from "fs"; +import { Stats, BigIntStats } from "fs"; import { wrap } from "optimism"; import { optimisticStatOrNull, @@ -42,7 +42,7 @@ export type ResolverOptions = { } export type Resolution = { - stat: Stats; + stat: Stats | BigIntStats; path: string; packageJsonMap?: Record>; id?: string; @@ -63,7 +63,7 @@ export default class Resolver { private nodeModulesPaths: string[]; private mainFields: string[]; - public statOrNull = optimisticStatOrNull as (path: string) => Stats | null; + public statOrNull = optimisticStatOrNull as (path: string) => Stats | BigIntStats | null; constructor({ sourceRoot,