@stryke/fs 0.30.1 → 0.30.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.
@@ -14,27 +14,27 @@ var _promises = require("node:fs/promises");
14
14
  var _helpers = require("./helpers.cjs");
15
15
  var _isFile = require("./is-file.cjs");
16
16
  var _listFiles = require("./list-files.cjs");
17
- async function copyFile(t, r) {
18
- return (0, _promises.copyFile)(t, r);
17
+ async function copyFile(r, i) {
18
+ return (0, _promises.copyFile)(r, i);
19
19
  }
20
- function copyFileSync(t, r) {
21
- return (0, _nodeFs.copyFileSync)(t, r);
20
+ function copyFileSync(r, i) {
21
+ return (0, _nodeFs.copyFileSync)(r, i);
22
22
  }
23
- async function copyFiles(t, r) {
24
- const i = t instanceof URL ? (0, _mlly.fileURLToPath)(t) : t,
25
- o = r instanceof URL ? (0, _mlly.fileURLToPath)(r) : r;
26
- return (0, _isFile.isFile)(i) ? copyFile(i, o) : (await (0, _helpers.createDirectory)(o), Promise.all((await (0, _listFiles.listFiles)(i)).map(async n => {
27
- const c = (0, _path.joinPaths)(i, n),
28
- s = (0, _path.joinPaths)(o, n);
29
- (0, _isFile.isDirectory)(n) ? await copyFiles(c, s) : await copyFile(c, s);
23
+ async function copyFiles(r, i) {
24
+ const t = r instanceof URL ? (0, _mlly.fileURLToPath)(r) : r,
25
+ n = i instanceof URL ? (0, _mlly.fileURLToPath)(i) : i;
26
+ return (0, _isFile.isFile)(t) ? copyFile(t, n) : (await (0, _helpers.createDirectory)(n), Promise.all((await (0, _listFiles.listFiles)(t.includes("*") ? t : (0, _path.joinPaths)(t, "**", "*"))).map(async o => {
27
+ const s = (0, _path.joinPaths)(t, o),
28
+ e = (0, _path.joinPaths)(n, o);
29
+ (0, _isFile.isDirectory)(o) ? await copyFiles(s, e) : await copyFile(s, e);
30
30
  })));
31
31
  }
32
- function copyFilesSync(t, r) {
33
- const i = t instanceof URL ? (0, _mlly.fileURLToPath)(t) : t,
34
- o = r instanceof URL ? (0, _mlly.fileURLToPath)(r) : r;
35
- return (0, _isFile.isFile)(i) ? copyFileSync(i, o) : ((0, _helpers.createDirectorySync)(o), (0, _listFiles.listFilesSync)(i).map(n => {
36
- const c = (0, _path.joinPaths)(i, n),
37
- s = (0, _path.joinPaths)(o, n);
38
- (0, _isFile.isDirectory)(n) ? copyFilesSync(c, s) : copyFileSync(c, s);
32
+ function copyFilesSync(r, i) {
33
+ const t = r instanceof URL ? (0, _mlly.fileURLToPath)(r) : r,
34
+ n = i instanceof URL ? (0, _mlly.fileURLToPath)(i) : i;
35
+ return (0, _isFile.isFile)(t) ? copyFileSync(t, n) : ((0, _helpers.createDirectorySync)(n), (0, _listFiles.listFilesSync)(t.includes("*") ? t : (0, _path.joinPaths)(t, "**", "*")).map(o => {
36
+ const s = (0, _path.joinPaths)(t, o),
37
+ e = (0, _path.joinPaths)(n, o);
38
+ (0, _isFile.isDirectory)(o) ? copyFilesSync(s, e) : copyFileSync(s, e);
39
39
  }));
40
40
  }
@@ -1 +1 @@
1
- import{joinPaths as e}from"@stryke/path";import{fileURLToPath as f}from"mlly";import{copyFileSync as m}from"node:fs";import{copyFile as y}from"node:fs/promises";import{createDirectory as l,createDirectorySync as L}from"./helpers";import{isDirectory as p,isFile as a}from"./is-file";import{listFiles as R,listFilesSync as U}from"./list-files";export async function copyFile(t,r){return y(t,r)}export function copyFileSync(t,r){return m(t,r)}export async function copyFiles(t,r){const i=t instanceof URL?f(t):t,o=r instanceof URL?f(r):r;return a(i)?copyFile(i,o):(await l(o),Promise.all((await R(i)).map(async n=>{const c=e(i,n),s=e(o,n);p(n)?await copyFiles(c,s):await copyFile(c,s)})))}export function copyFilesSync(t,r){const i=t instanceof URL?f(t):t,o=r instanceof URL?f(r):r;return a(i)?copyFileSync(i,o):(L(o),U(i).map(n=>{const c=e(i,n),s=e(o,n);p(n)?copyFilesSync(c,s):copyFileSync(c,s)}))}
1
+ import{joinPaths as c}from"@stryke/path";import{fileURLToPath as f}from"mlly";import{copyFileSync as m}from"node:fs";import{copyFile as l}from"node:fs/promises";import{createDirectory as y,createDirectorySync as L}from"./helpers";import{isDirectory as p,isFile as a}from"./is-file";import{listFiles as R,listFilesSync as U}from"./list-files";export async function copyFile(r,i){return l(r,i)}export function copyFileSync(r,i){return m(r,i)}export async function copyFiles(r,i){const t=r instanceof URL?f(r):r,n=i instanceof URL?f(i):i;return a(t)?copyFile(t,n):(await y(n),Promise.all((await R(t.includes("*")?t:c(t,"**","*"))).map(async o=>{const s=c(t,o),e=c(n,o);p(o)?await copyFiles(s,e):await copyFile(s,e)})))}export function copyFilesSync(r,i){const t=r instanceof URL?f(r):r,n=i instanceof URL?f(i):i;return a(t)?copyFileSync(t,n):(L(n),U(t.includes("*")?t:c(t,"**","*")).map(o=>{const s=c(t,o),e=c(n,o);p(o)?copyFilesSync(s,e):copyFileSync(s,e)}))}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/fs",
3
- "version": "0.30.1",
3
+ "version": "0.30.2",
4
4
  "type": "module",
5
5
  "description": "A package containing various file system utilities that expand the functionality of NodeJs's built-in `fs` module.",
6
6
  "repository": {
@@ -395,5 +395,5 @@
395
395
  "main": "./dist/index.cjs",
396
396
  "module": "./dist/index.mjs",
397
397
  "types": "./dist/index.d.ts",
398
- "gitHead": "e4e84e05b3cd3c057f3817b6cc40de600caa6fe5"
398
+ "gitHead": "7e6ed3188262b6c7b92c9104c1d6327fd033d367"
399
399
  }