@expo/metro-file-map 56.0.1 → 56.0.2
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/build/cache/DiskCacheManager.d.ts +7 -0
- package/build/cache/DiskCacheManager.js +6 -1
- package/build/crawlers/node/fallback.js +2 -1
- package/build/crawlers/node/index.js +8 -2
- package/build/crawlers/watchman/index.js +2 -2
- package/build/lib/RootPathUtils.js +5 -4
- package/build/lib/TreeFS.js +1 -1
- package/build/lib/isWatcherExcluded.d.ts +1 -0
- package/build/lib/isWatcherExcluded.js +7 -0
- package/build/watchers/AbstractWatcher.js +3 -3
- package/package.json +2 -2
- package/build/lib/isVcsPath.d.ts +0 -1
- package/build/lib/isVcsPath.js +0 -7
|
@@ -5,6 +5,13 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import type { BuildParameters, CacheData, CacheManager, CacheManagerFactoryOptions, CacheManagerWriteOptions } from '../types';
|
|
8
|
+
declare global {
|
|
9
|
+
namespace NodeJS {
|
|
10
|
+
interface Process {
|
|
11
|
+
isBun?: boolean;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
interface AutoSaveOptions {
|
|
9
16
|
readonly debounceMs: number;
|
|
10
17
|
}
|
|
@@ -17,7 +17,12 @@ const timers_1 = require("timers");
|
|
|
17
17
|
const v8_1 = require("v8");
|
|
18
18
|
const rootRelativeCacheKeys_1 = __importDefault(require("../lib/rootRelativeCacheKeys"));
|
|
19
19
|
const debug = require('debug')('Metro:FileMapCache');
|
|
20
|
-
|
|
20
|
+
let DEFAULT_PREFIX = 'metro-file-map';
|
|
21
|
+
if (process.isBun) {
|
|
22
|
+
// NOTE(@kitten): The v8 serialize/deserialize format isn't 100% compatible between
|
|
23
|
+
// Node and Bun and therefore we should fork the cache file
|
|
24
|
+
DEFAULT_PREFIX += '-bun';
|
|
25
|
+
}
|
|
21
26
|
const DEFAULT_DIRECTORY = (0, os_1.tmpdir)();
|
|
22
27
|
const DEFAULT_AUTO_SAVE_DEBOUNCE_MS = 5000;
|
|
23
28
|
// NOTE(@kitten): We're incompatible with Metro, so need our own naming
|
|
@@ -68,7 +68,8 @@ function createFallbackFilesystem(opts) {
|
|
|
68
68
|
}
|
|
69
69
|
if (entry.isDirectory()) {
|
|
70
70
|
// NOTE(@kitten): ".git" and ".hg" check replace the VCS_DIRECTORIES ignore pattern
|
|
71
|
-
|
|
71
|
+
// NOTE(@kitten): `.cxx` is ephemeral and should always be safe to ignore
|
|
72
|
+
if (!result.has(name) && name !== '.git' && name !== '.hg' && name !== '.cxx') {
|
|
72
73
|
const childDir = new Map();
|
|
73
74
|
markDir(childDir, FallbackFlag.VISITED);
|
|
74
75
|
result.set(name, childDir);
|
|
@@ -58,15 +58,21 @@ function find(roots, extensions, ignore, includeSymlinks, rootDir, console, prev
|
|
|
58
58
|
fs.readdir(directory, { withFileTypes: true }, (err, entries) => {
|
|
59
59
|
activeCalls--;
|
|
60
60
|
if (err) {
|
|
61
|
-
|
|
61
|
+
// NOTE(@kitten): This isn't necessarily a problem and we can ignore this
|
|
62
|
+
/*
|
|
63
|
+
console.warn(
|
|
64
|
+
`Error "${(err as any).code ?? err.message}" reading contents of "${directory}", skipping. Add this directory to your ignore list to exclude it.`
|
|
65
|
+
);
|
|
66
|
+
*/
|
|
62
67
|
}
|
|
63
68
|
else {
|
|
64
69
|
for (let idx = 0; idx < entries.length; idx++) {
|
|
65
70
|
const entry = entries[idx];
|
|
66
71
|
const name = entry.name;
|
|
67
72
|
// NOTE(@kitten): This replaces the VCS_DIRECTORIES ignore pattern
|
|
73
|
+
// NOTE(@kitten): `.cxx` is ephemeral and should always be safe to ignore
|
|
68
74
|
const isDirectory = entry.isDirectory();
|
|
69
|
-
if (isDirectory && (name === '.git' || name === '.hg')) {
|
|
75
|
+
if (isDirectory && (name === '.git' || name === '.hg' || name === '.cxx')) {
|
|
70
76
|
continue;
|
|
71
77
|
}
|
|
72
78
|
const file = directory + path.sep + name;
|
|
@@ -49,7 +49,7 @@ const path = __importStar(require("path"));
|
|
|
49
49
|
const perf_hooks_1 = require("perf_hooks");
|
|
50
50
|
const planQuery_1 = require("./planQuery");
|
|
51
51
|
const RootPathUtils_1 = require("../../lib/RootPathUtils");
|
|
52
|
-
const
|
|
52
|
+
const isWatcherExcluded_1 = __importDefault(require("../../lib/isWatcherExcluded"));
|
|
53
53
|
const normalizePathSeparatorsToPosix_1 = __importDefault(require("../../lib/normalizePathSeparatorsToPosix"));
|
|
54
54
|
const normalizePathSeparatorsToSystem_1 = __importDefault(require("../../lib/normalizePathSeparatorsToSystem"));
|
|
55
55
|
const WATCHMAN_WARNING_INITIAL_DELAY_MILLISECONDS = 10000;
|
|
@@ -248,7 +248,7 @@ async function watchmanCrawl({ abortSignal, computeSha1, extensions, ignore, inc
|
|
|
248
248
|
// Whether watchman can return exists: false in a fresh instance
|
|
249
249
|
// response is unknown, but there's nothing we need to do in that case.
|
|
250
250
|
}
|
|
251
|
-
else if (!(0,
|
|
251
|
+
else if (!(0, isWatcherExcluded_1.default)(fileData.name) && !ignore(filePath)) {
|
|
252
252
|
const { mtime_ms, size } = fileData;
|
|
253
253
|
(0, invariant_1.default)(mtime_ms != null && size != null, 'missing file data in watchman response');
|
|
254
254
|
const mtime = typeof mtime_ms === 'number' ? mtime_ms : mtime_ms.toNumber();
|
|
@@ -130,10 +130,11 @@ class RootPathUtils {
|
|
|
130
130
|
if (right.length === 0) {
|
|
131
131
|
return left;
|
|
132
132
|
}
|
|
133
|
-
else if (pos > this.#rootDepth * UP_FRAGMENT_SEP_LENGTH) {
|
|
134
|
-
//
|
|
135
|
-
//
|
|
136
|
-
//
|
|
133
|
+
else if (IS_WIN32 && pos > this.#rootDepth * UP_FRAGMENT_SEP_LENGTH) {
|
|
134
|
+
// On a real file system, navigating to `..` at the top level (posix `/`
|
|
135
|
+
// or Windows drive) is a no-op, but we can't respect that on Windows
|
|
136
|
+
// because Metro uses e.g. `..\..\D:\foo` to represent cross-drive
|
|
137
|
+
// relative paths.
|
|
137
138
|
return right;
|
|
138
139
|
}
|
|
139
140
|
// left may already end in a path separator only if it is a filesystem root,
|
package/build/lib/TreeFS.js
CHANGED
|
@@ -13,10 +13,10 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
13
13
|
const invariant_1 = __importDefault(require("invariant"));
|
|
14
14
|
const path_1 = __importDefault(require("path"));
|
|
15
15
|
const constants_1 = __importDefault(require("../constants"));
|
|
16
|
+
const RootPathUtils_1 = require("./RootPathUtils");
|
|
16
17
|
const normalizePathSeparatorsToPosix_1 = __importDefault(require("./normalizePathSeparatorsToPosix"));
|
|
17
18
|
const normalizePathSeparatorsToSystem_1 = __importDefault(require("./normalizePathSeparatorsToSystem"));
|
|
18
19
|
const fallback_1 = require("../crawlers/node/fallback");
|
|
19
|
-
const RootPathUtils_1 = require("./RootPathUtils");
|
|
20
20
|
function isDirectory(node) {
|
|
21
21
|
return node instanceof Map;
|
|
22
22
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function isWatcherExcluded(filePath: string): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = isWatcherExcluded;
|
|
4
|
+
const EXCLUDED_DIR_SEGMENT = /(?:^|[/\\])\.(?:git|hg|cxx)[/\\]/;
|
|
5
|
+
function isWatcherExcluded(filePath) {
|
|
6
|
+
return EXCLUDED_DIR_SEGMENT.test(filePath);
|
|
7
|
+
}
|
|
@@ -45,7 +45,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
45
45
|
exports.AbstractWatcher = void 0;
|
|
46
46
|
const events_1 = __importDefault(require("events"));
|
|
47
47
|
const path = __importStar(require("path"));
|
|
48
|
-
const
|
|
48
|
+
const isWatcherExcluded_1 = __importDefault(require("../lib/isWatcherExcluded"));
|
|
49
49
|
const common_1 = require("./common");
|
|
50
50
|
class AbstractWatcher {
|
|
51
51
|
root;
|
|
@@ -60,8 +60,8 @@ class AbstractWatcher {
|
|
|
60
60
|
this.ignored = ignored;
|
|
61
61
|
this.globs = globs;
|
|
62
62
|
this.doIgnore = ignored
|
|
63
|
-
? (filePath) => (0,
|
|
64
|
-
:
|
|
63
|
+
? (filePath) => (0, isWatcherExcluded_1.default)(filePath) || (0, common_1.posixPathMatchesPattern)(ignored, filePath)
|
|
64
|
+
: isWatcherExcluded_1.default;
|
|
65
65
|
this.root = path.resolve(dir);
|
|
66
66
|
}
|
|
67
67
|
onFileEvent(listener) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/metro-file-map",
|
|
3
|
-
"version": "56.0.
|
|
3
|
+
"version": "56.0.2",
|
|
4
4
|
"description": "A metro-file-map fork for Expo used with the Metro bundler",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "51c27fce31a5b3a877a4b05d832dabf4a99db5e1",
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "expo-module tsc",
|
|
48
48
|
"clean": "expo-module clean",
|
package/build/lib/isVcsPath.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function isVcsPath(filePath: string): boolean;
|
package/build/lib/isVcsPath.js
DELETED