@atlaspack/fs 2.14.5-dev.14 → 2.14.5-dev.55

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": "@atlaspack/fs",
3
- "version": "2.14.5-dev.14+8c369e38c",
3
+ "version": "2.14.5-dev.55+5a11f33c5",
4
4
  "description": "Blazing fast, zero configuration web application bundler",
5
5
  "license": "(MIT OR Apache-2.0)",
6
6
  "publishConfig": {
@@ -49,20 +49,20 @@
49
49
  },
50
50
  "scripts": {
51
51
  "build-ts": "mkdir -p lib && flow-to-ts src/types.js > lib/types.d.ts",
52
- "check-ts": "tsc --noEmit index.d.ts"
52
+ "check-ts": "tsc --module node16 --moduleResolution node16 --noEmit index.d.ts"
53
53
  },
54
54
  "dependencies": {
55
- "@atlaspack/build-cache": "2.13.3-dev.82+8c369e38c",
56
- "@atlaspack/feature-flags": "2.14.1-dev.82+8c369e38c",
57
- "@atlaspack/logger": "2.14.5-dev.14+8c369e38c",
58
- "@atlaspack/rust": "3.2.1-dev.14+8c369e38c",
59
- "@atlaspack/types-internal": "2.14.1-dev.82+8c369e38c",
60
- "@atlaspack/utils": "2.14.5-dev.14+8c369e38c",
61
- "@atlaspack/workers": "2.14.5-dev.14+8c369e38c",
55
+ "@atlaspack/build-cache": "2.13.3-dev.123+5a11f33c5",
56
+ "@atlaspack/feature-flags": "2.14.1-dev.123+5a11f33c5",
57
+ "@atlaspack/logger": "2.14.5-dev.55+5a11f33c5",
58
+ "@atlaspack/rust": "3.2.1-dev.55+5a11f33c5",
59
+ "@atlaspack/types-internal": "2.14.1-dev.123+5a11f33c5",
60
+ "@atlaspack/utils": "2.14.5-dev.55+5a11f33c5",
61
+ "@atlaspack/workers": "2.14.5-dev.55+5a11f33c5",
62
62
  "@parcel/watcher": "^2.0.7"
63
63
  },
64
64
  "devDependencies": {
65
- "@atlaspack/watcher-watchman-js": "2.14.5-dev.14+8c369e38c",
65
+ "@atlaspack/watcher-watchman-js": "2.14.5-dev.55+5a11f33c5",
66
66
  "graceful-fs": "^4.2.4",
67
67
  "ncp": "^2.0.0",
68
68
  "nullthrows": "^1.1.1",
@@ -73,5 +73,5 @@
73
73
  "./src/NodeFS.js": "./src/NodeFS.browser.js"
74
74
  },
75
75
  "type": "commonjs",
76
- "gitHead": "8c369e38ccd428409811114aebd6044c27f90705"
76
+ "gitHead": "5a11f33c51ff74d1cf8d4b72cfa0fda833aa980a"
77
77
  }
package/src/MemoryFS.js CHANGED
@@ -497,6 +497,7 @@ export class MemoryFS implements FileSystem {
497
497
  }
498
498
 
499
499
  createWriteStream(filePath: FilePath, options: ?FileOptions): WriteStream {
500
+ this.mkdirp(path.dirname(filePath));
500
501
  return new WriteStream(this, filePath, options);
501
502
  }
502
503
 
@@ -549,9 +550,12 @@ export class MemoryFS implements FileSystem {
549
550
  dir += path.sep;
550
551
  }
551
552
 
552
- if (event.path.startsWith(dir)) {
553
+ const relevantEvents = events.filter((event) =>
554
+ event.path.startsWith(dir),
555
+ );
556
+ if (relevantEvents.length > 0) {
553
557
  for (let watcher of watchers) {
554
- watcher.trigger(events);
558
+ watcher.trigger(relevantEvents);
555
559
  }
556
560
  }
557
561
  }
package/src/NodeFS.js CHANGED
@@ -198,6 +198,7 @@ export class NodeFS implements FileSystem {
198
198
  snapshot: FilePath,
199
199
  opts: WatcherOptions,
200
200
  ): Promise<void> {
201
+ await this.mkdirp(path.dirname(snapshot));
201
202
  await this.watcher().writeSnapshot(dir, snapshot, opts);
202
203
  }
203
204
 
@@ -139,6 +139,7 @@ export class NodeVCSAwareFS extends NodeFS {
139
139
  }
140
140
 
141
141
  const snapshotDirectory = path.dirname(snapshot);
142
+ await this.mkdirp(snapshotDirectory);
142
143
  const filename = path.basename(snapshot, '.txt');
143
144
  const nativeSnapshotPath = path.join(
144
145
  snapshotDirectory,
package/src/index.js CHANGED
@@ -27,10 +27,15 @@ export async function ncp(
27
27
  source: FilePath,
28
28
  destinationFS: FileSystem,
29
29
  destination: FilePath,
30
+ filter?: (filePath: FilePath) => boolean,
30
31
  ) {
31
32
  await destinationFS.mkdirp(destination);
32
33
  let files = await sourceFS.readdir(source);
33
34
  for (let file of files) {
35
+ if (filter && !filter(file)) {
36
+ continue;
37
+ }
38
+
34
39
  let sourcePath = path.join(source, file);
35
40
  let destPath = path.join(destination, file);
36
41
  let stats = await sourceFS.stat(sourcePath);
@@ -40,7 +45,7 @@ export async function ncp(
40
45
  destinationFS.createWriteStream(destPath),
41
46
  );
42
47
  } else if (stats.isDirectory()) {
43
- await ncp(sourceFS, sourcePath, destinationFS, destPath);
48
+ await ncp(sourceFS, sourcePath, destinationFS, destPath, filter);
44
49
  }
45
50
  }
46
51
  }