metro-file-map 0.74.1 → 0.75.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "metro-file-map",
3
- "version": "0.74.1",
3
+ "version": "0.75.0",
4
4
  "description": "[Experimental] - 🚇 File crawling, watching and mapping for Metro",
5
5
  "main": "src/index.js",
6
6
  "repository": {
@@ -32,5 +32,8 @@
32
32
  },
33
33
  "optionalDependencies": {
34
34
  "fsevents": "^2.3.2"
35
+ },
36
+ "engines": {
37
+ "node": ">=14.17.0"
35
38
  }
36
39
  }
package/src/index.js CHANGED
@@ -108,8 +108,6 @@ function _interopRequireDefault(obj) {
108
108
 
109
109
  // $FlowFixMe[untyped-import] - jest-regex-util
110
110
 
111
- // $FlowFixMe[untyped-import] - jest-worker
112
-
113
111
  // $FlowFixMe[untyped-import] - this is a polyfill
114
112
 
115
113
  const debug = require("debug")("Metro:FileMap");
@@ -226,8 +224,10 @@ class HasteMap extends _events.default {
226
224
  (_options$perfLoggerFa2 = options.perfLoggerFactory) === null ||
227
225
  _options$perfLoggerFa2 === void 0
228
226
  ? void 0
229
- : _options$perfLoggerFa2.call(options).subSpan("hasteMap")) !==
230
- null && _options$perfLoggerFa !== void 0
227
+ : _options$perfLoggerFa2
228
+ .call(options, "START_UP")
229
+ .subSpan("hasteMap")) !== null &&
230
+ _options$perfLoggerFa !== void 0
231
231
  ? _options$perfLoggerFa
232
232
  : null;
233
233
  (_this$_startupPerfLog = this._startupPerfLogger) === null ||
@@ -978,6 +978,10 @@ class HasteMap extends _events.default {
978
978
  }
979
979
  const fileType = fileSystem.getType(relativeFilePath);
980
980
  const add = (metadata) => {
981
+ // Don't emit events relating to symlinks if enableSymlinks: false
982
+ if (!this._options.enableSymlinks && type === "l") {
983
+ return null;
984
+ }
981
985
  eventsQueue.push({
982
986
  filePath: absoluteFilePath,
983
987
  metadata,
package/src/index.js.flow CHANGED
@@ -9,6 +9,7 @@
9
9
  * @oncall react_native
10
10
  */
11
11
 
12
+ import type {IJestWorker} from 'jest-worker';
12
13
  import type {
13
14
  BuildParameters,
14
15
  BuildResult,
@@ -54,7 +55,6 @@ import EventEmitter from 'events';
54
55
  import invariant from 'invariant';
55
56
  // $FlowFixMe[untyped-import] - jest-regex-util
56
57
  import {escapePathForRegex} from 'jest-regex-util';
57
- // $FlowFixMe[untyped-import] - jest-worker
58
58
  import {Worker} from 'jest-worker';
59
59
  import * as path from 'path';
60
60
  // $FlowFixMe[untyped-import] - this is a polyfill
@@ -125,7 +125,8 @@ type InternalOptions = {
125
125
  watchmanDeferStates: $ReadOnlyArray<string>,
126
126
  };
127
127
 
128
- type WorkerInterface = {worker: typeof worker};
128
+ type WorkerObj = {worker: typeof worker};
129
+ type WorkerInterface = IJestWorker<WorkerObj> | WorkerObj;
129
130
 
130
131
  export {default as ModuleMap} from './ModuleMap';
131
132
  export {DiskCacheManager} from './cache/DiskCacheManager';
@@ -259,7 +260,7 @@ export default class HasteMap extends EventEmitter {
259
260
 
260
261
  if (options.perfLoggerFactory) {
261
262
  this._startupPerfLogger =
262
- options.perfLoggerFactory?.().subSpan('hasteMap') ?? null;
263
+ options.perfLoggerFactory?.('START_UP').subSpan('hasteMap') ?? null;
263
264
  this._startupPerfLogger?.point('constructor_start');
264
265
  }
265
266
 
@@ -813,7 +814,7 @@ export default class HasteMap extends EventEmitter {
813
814
  if ((options && options.forceInBand) || this._options.maxWorkers <= 1) {
814
815
  this._worker = {worker};
815
816
  } else {
816
- this._worker = new Worker(require.resolve('./worker'), {
817
+ this._worker = new Worker<WorkerObj>(require.resolve('./worker'), {
817
818
  exposedMethods: ['worker'],
818
819
  maxRetries: 3,
819
820
  numWorkers: this._options.maxWorkers,
@@ -968,6 +969,11 @@ export default class HasteMap extends EventEmitter {
968
969
  const fileType = fileSystem.getType(relativeFilePath);
969
970
 
970
971
  const add = (metadata: ChangeEventMetadata) => {
972
+ // Don't emit events relating to symlinks if enableSymlinks: false
973
+ if (!this._options.enableSymlinks && type === 'l') {
974
+ return null;
975
+ }
976
+
971
977
  eventsQueue.push({
972
978
  filePath: absoluteFilePath,
973
979
  metadata,