atomically 2.0.3 → 2.0.5

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.
Files changed (33) hide show
  1. package/.nyc_output/06ea27ff-9d6e-44e2-b922-121687bc5661.json +1 -0
  2. package/.nyc_output/58e93f70-472d-449b-ac6b-4e640c0aeb02.json +1 -0
  3. package/.nyc_output/a4a404bb-72b9-43f0-be83-3d2a65aaec5a.json +1 -0
  4. package/.nyc_output/c18f7e70-50ab-4df7-afb5-2c2e27792296.json +1 -0
  5. package/.nyc_output/d1b8239a-6e10-4482-af38-f54b9a5f29ee.json +1 -0
  6. package/.nyc_output/processinfo/06ea27ff-9d6e-44e2-b922-121687bc5661.json +1 -0
  7. package/.nyc_output/processinfo/58e93f70-472d-449b-ac6b-4e640c0aeb02.json +1 -0
  8. package/.nyc_output/processinfo/a4a404bb-72b9-43f0-be83-3d2a65aaec5a.json +1 -0
  9. package/.nyc_output/processinfo/c18f7e70-50ab-4df7-afb5-2c2e27792296.json +1 -0
  10. package/.nyc_output/processinfo/d1b8239a-6e10-4482-af38-f54b9a5f29ee.json +1 -0
  11. package/.nyc_output/processinfo/index.json +1 -0
  12. package/dist/constants.d.ts +2 -2
  13. package/dist/constants.js +4 -5
  14. package/dist/index.d.ts +1 -2
  15. package/dist/index.js +25 -21
  16. package/dist/types.d.ts +0 -1
  17. package/dist/utils/lang.d.ts +2 -2
  18. package/dist/utils/scheduler.d.ts +1 -1
  19. package/dist/utils/temp.d.ts +1 -1
  20. package/dist/utils/temp.js +1 -1
  21. package/package.json +9 -8
  22. package/.editorconfig +0 -10
  23. package/src/constants.ts +0 -39
  24. package/src/index.ts +0 -331
  25. package/src/types.ts +0 -37
  26. package/src/utils/lang.ts +0 -34
  27. package/src/utils/scheduler.ts +0 -62
  28. package/src/utils/temp.ts +0 -102
  29. package/tasks/benchmark.js +0 -76
  30. package/test/basic.cjs +0 -508
  31. package/test/concurrency.cjs +0 -151
  32. package/test/integration.cjs +0 -289
  33. package/tsconfig.json +0 -3
@@ -0,0 +1 @@
1
+ {"parent":"58e93f70-472d-449b-ac6b-4e640c0aeb02","pid":36955,"argv":["/Users/fabio/.nvm/versions/node/v18.19.0/bin/node","/Users/fabio/Code/fabiospampinato/atomically/test/basic.cjs"],"execArgv":[],"cwd":"/Users/fabio/Code/fabiospampinato/atomically","time":1761513266816,"ppid":36954,"coverageFilename":"/Users/fabio/Code/fabiospampinato/atomically/.nyc_output/06ea27ff-9d6e-44e2-b922-121687bc5661.json","externalId":"test/basic.cjs","uuid":"06ea27ff-9d6e-44e2-b922-121687bc5661","files":[]}
@@ -0,0 +1 @@
1
+ {"parent":null,"pid":36954,"argv":["/Users/fabio/.nvm/versions/node/v18.19.0/bin/node","/Users/fabio/Code/fabiospampinato/atomically/node_modules/.bin/tap","--no-check-coverage","--no-coverage-report"],"execArgv":[],"cwd":"/Users/fabio/Code/fabiospampinato/atomically","time":1761513266396,"ppid":36923,"coverageFilename":"/Users/fabio/Code/fabiospampinato/atomically/.nyc_output/58e93f70-472d-449b-ac6b-4e640c0aeb02.json","externalId":"","uuid":"58e93f70-472d-449b-ac6b-4e640c0aeb02","files":[]}
@@ -0,0 +1 @@
1
+ {"parent":"58e93f70-472d-449b-ac6b-4e640c0aeb02","pid":36957,"argv":["/Users/fabio/.nvm/versions/node/v18.19.0/bin/node","/Users/fabio/Code/fabiospampinato/atomically/test/integration.cjs"],"execArgv":[],"cwd":"/Users/fabio/Code/fabiospampinato/atomically","time":1761513266816,"ppid":36954,"coverageFilename":"/Users/fabio/Code/fabiospampinato/atomically/.nyc_output/a4a404bb-72b9-43f0-be83-3d2a65aaec5a.json","externalId":"test/integration.cjs","uuid":"a4a404bb-72b9-43f0-be83-3d2a65aaec5a","files":[]}
@@ -0,0 +1 @@
1
+ {"parent":"58e93f70-472d-449b-ac6b-4e640c0aeb02","pid":36958,"argv":["/Users/fabio/.nvm/versions/node/v18.19.0/bin/node","/Users/fabio/Code/fabiospampinato/atomically/test/atomically.cjs"],"execArgv":[],"cwd":"/Users/fabio/Code/fabiospampinato/atomically","time":1761513266816,"ppid":36954,"coverageFilename":"/Users/fabio/Code/fabiospampinato/atomically/.nyc_output/c18f7e70-50ab-4df7-afb5-2c2e27792296.json","externalId":"test/atomically.cjs","uuid":"c18f7e70-50ab-4df7-afb5-2c2e27792296","files":[]}
@@ -0,0 +1 @@
1
+ {"parent":"58e93f70-472d-449b-ac6b-4e640c0aeb02","pid":36956,"argv":["/Users/fabio/.nvm/versions/node/v18.19.0/bin/node","/Users/fabio/Code/fabiospampinato/atomically/test/concurrency.cjs"],"execArgv":[],"cwd":"/Users/fabio/Code/fabiospampinato/atomically","time":1761513266816,"ppid":36954,"coverageFilename":"/Users/fabio/Code/fabiospampinato/atomically/.nyc_output/d1b8239a-6e10-4482-af38-f54b9a5f29ee.json","externalId":"test/concurrency.cjs","uuid":"d1b8239a-6e10-4482-af38-f54b9a5f29ee","files":[]}
@@ -0,0 +1 @@
1
+ {"processes":{"06ea27ff-9d6e-44e2-b922-121687bc5661":{"parent":"58e93f70-472d-449b-ac6b-4e640c0aeb02","externalId":"test/basic.cjs","children":[]},"58e93f70-472d-449b-ac6b-4e640c0aeb02":{"parent":null,"children":["06ea27ff-9d6e-44e2-b922-121687bc5661","a4a404bb-72b9-43f0-be83-3d2a65aaec5a","c18f7e70-50ab-4df7-afb5-2c2e27792296","d1b8239a-6e10-4482-af38-f54b9a5f29ee"]},"a4a404bb-72b9-43f0-be83-3d2a65aaec5a":{"parent":"58e93f70-472d-449b-ac6b-4e640c0aeb02","externalId":"test/integration.cjs","children":[]},"c18f7e70-50ab-4df7-afb5-2c2e27792296":{"parent":"58e93f70-472d-449b-ac6b-4e640c0aeb02","externalId":"test/atomically.cjs","children":[]},"d1b8239a-6e10-4482-af38-f54b9a5f29ee":{"parent":"58e93f70-472d-449b-ac6b-4e640c0aeb02","externalId":"test/concurrency.cjs","children":[]}},"files":{},"externalIds":{"test/basic.cjs":{"root":"06ea27ff-9d6e-44e2-b922-121687bc5661","children":[]},"test/integration.cjs":{"root":"a4a404bb-72b9-43f0-be83-3d2a65aaec5a","children":[]},"test/atomically.cjs":{"root":"c18f7e70-50ab-4df7-afb5-2c2e27792296","children":[]},"test/concurrency.cjs":{"root":"d1b8239a-6e10-4482-af38-f54b9a5f29ee","children":[]}}}
@@ -5,11 +5,11 @@ declare const DEFAULT_READ_OPTIONS: {};
5
5
  declare const DEFAULT_WRITE_OPTIONS: {};
6
6
  declare const DEFAULT_USER_UID: number;
7
7
  declare const DEFAULT_USER_GID: number;
8
+ declare const DEFAULT_INTERVAL_ASYNC = 200;
8
9
  declare const DEFAULT_TIMEOUT_ASYNC = 7500;
9
10
  declare const DEFAULT_TIMEOUT_SYNC = 1000;
10
11
  declare const IS_POSIX: boolean;
11
12
  declare const IS_USER_ROOT: boolean;
12
13
  declare const LIMIT_BASENAME_LENGTH = 128;
13
- declare const LIMIT_FILES_DESCRIPTORS = 10000;
14
14
  declare const NOOP: () => void;
15
- export { DEFAULT_ENCODING, DEFAULT_FILE_MODE, DEFAULT_FOLDER_MODE, DEFAULT_READ_OPTIONS, DEFAULT_WRITE_OPTIONS, DEFAULT_USER_UID, DEFAULT_USER_GID, DEFAULT_TIMEOUT_ASYNC, DEFAULT_TIMEOUT_SYNC, IS_POSIX, IS_USER_ROOT, LIMIT_BASENAME_LENGTH, LIMIT_FILES_DESCRIPTORS, NOOP };
15
+ export { DEFAULT_ENCODING, DEFAULT_FILE_MODE, DEFAULT_FOLDER_MODE, DEFAULT_READ_OPTIONS, DEFAULT_WRITE_OPTIONS, DEFAULT_USER_UID, DEFAULT_USER_GID, DEFAULT_INTERVAL_ASYNC, DEFAULT_TIMEOUT_ASYNC, DEFAULT_TIMEOUT_SYNC, IS_POSIX, IS_USER_ROOT, LIMIT_BASENAME_LENGTH, NOOP };
package/dist/constants.js CHANGED
@@ -1,5 +1,4 @@
1
1
  /* IMPORT */
2
- import os from 'node:os';
3
2
  import process from 'node:process';
4
3
  /* MAIN */
5
4
  const DEFAULT_ENCODING = 'utf8';
@@ -7,14 +6,14 @@ const DEFAULT_FILE_MODE = 0o666;
7
6
  const DEFAULT_FOLDER_MODE = 0o777;
8
7
  const DEFAULT_READ_OPTIONS = {};
9
8
  const DEFAULT_WRITE_OPTIONS = {};
10
- const DEFAULT_USER_UID = os.userInfo().uid;
11
- const DEFAULT_USER_GID = os.userInfo().gid;
9
+ const DEFAULT_USER_UID = process.geteuid ? process.geteuid() : -1;
10
+ const DEFAULT_USER_GID = process.getegid ? process.getegid() : -1;
11
+ const DEFAULT_INTERVAL_ASYNC = 200;
12
12
  const DEFAULT_TIMEOUT_ASYNC = 7500;
13
13
  const DEFAULT_TIMEOUT_SYNC = 1000;
14
14
  const IS_POSIX = !!process.getuid;
15
15
  const IS_USER_ROOT = process.getuid ? !process.getuid() : false;
16
16
  const LIMIT_BASENAME_LENGTH = 128; //TODO: Fetch the real limit from the filesystem //TODO: Fetch the whole-path length limit too
17
- const LIMIT_FILES_DESCRIPTORS = 10000; //TODO: Fetch the real limit from the filesystem
18
17
  const NOOP = () => { };
19
18
  /* EXPORT */
20
- export { DEFAULT_ENCODING, DEFAULT_FILE_MODE, DEFAULT_FOLDER_MODE, DEFAULT_READ_OPTIONS, DEFAULT_WRITE_OPTIONS, DEFAULT_USER_UID, DEFAULT_USER_GID, DEFAULT_TIMEOUT_ASYNC, DEFAULT_TIMEOUT_SYNC, IS_POSIX, IS_USER_ROOT, LIMIT_BASENAME_LENGTH, LIMIT_FILES_DESCRIPTORS, NOOP };
19
+ export { DEFAULT_ENCODING, DEFAULT_FILE_MODE, DEFAULT_FOLDER_MODE, DEFAULT_READ_OPTIONS, DEFAULT_WRITE_OPTIONS, DEFAULT_USER_UID, DEFAULT_USER_GID, DEFAULT_INTERVAL_ASYNC, DEFAULT_TIMEOUT_ASYNC, DEFAULT_TIMEOUT_SYNC, IS_POSIX, IS_USER_ROOT, LIMIT_BASENAME_LENGTH, NOOP };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- /// <reference types="node" />
2
- import type { Callback, Data, Encoding, Path, ReadOptions, WriteOptions } from './types';
1
+ import type { Callback, Data, Encoding, Path, ReadOptions, WriteOptions } from './types.js';
3
2
  declare function readFile(filePath: Path, options: Encoding | ReadOptions & {
4
3
  encoding: string;
5
4
  }): Promise<string>;
package/dist/index.js CHANGED
@@ -1,21 +1,23 @@
1
1
  /* IMPORT */
2
2
  import path from 'node:path';
3
3
  import fs from 'stubborn-fs';
4
- import { DEFAULT_ENCODING, DEFAULT_FILE_MODE, DEFAULT_FOLDER_MODE, DEFAULT_READ_OPTIONS, DEFAULT_WRITE_OPTIONS, DEFAULT_USER_UID, DEFAULT_USER_GID, DEFAULT_TIMEOUT_ASYNC, DEFAULT_TIMEOUT_SYNC, IS_POSIX } from './constants.js';
4
+ import { DEFAULT_ENCODING, DEFAULT_FILE_MODE, DEFAULT_FOLDER_MODE, DEFAULT_READ_OPTIONS, DEFAULT_WRITE_OPTIONS, DEFAULT_USER_UID, DEFAULT_USER_GID, DEFAULT_INTERVAL_ASYNC, DEFAULT_TIMEOUT_ASYNC, DEFAULT_TIMEOUT_SYNC, IS_POSIX } from './constants.js';
5
5
  import { isException, isFunction, isString, isUndefined } from './utils/lang.js';
6
6
  import Scheduler from './utils/scheduler.js';
7
7
  import Temp from './utils/temp.js';
8
8
  function readFile(filePath, options = DEFAULT_READ_OPTIONS) {
9
9
  if (isString(options))
10
10
  return readFile(filePath, { encoding: options });
11
- const timeout = Date.now() + ((options.timeout ?? DEFAULT_TIMEOUT_ASYNC) || -1);
12
- return fs.retry.readFile(timeout)(filePath, options);
11
+ const timeout = options.timeout ?? DEFAULT_TIMEOUT_ASYNC;
12
+ const retryOptions = { timeout, interval: DEFAULT_INTERVAL_ASYNC };
13
+ return fs.retry.readFile(retryOptions)(filePath, options);
13
14
  }
14
15
  function readFileSync(filePath, options = DEFAULT_READ_OPTIONS) {
15
16
  if (isString(options))
16
17
  return readFileSync(filePath, { encoding: options });
17
- const timeout = Date.now() + ((options.timeout ?? DEFAULT_TIMEOUT_SYNC) || -1);
18
- return fs.retry.readFileSync(timeout)(filePath, options);
18
+ const timeout = options.timeout ?? DEFAULT_TIMEOUT_SYNC;
19
+ const retryOptions = { timeout };
20
+ return fs.retry.readFileSync(retryOptions)(filePath, options);
19
21
  }
20
22
  function writeFile(filePath, data, options, callback) {
21
23
  if (isFunction(options))
@@ -28,7 +30,8 @@ function writeFile(filePath, data, options, callback) {
28
30
  async function writeFileAsync(filePath, data, options = DEFAULT_WRITE_OPTIONS) {
29
31
  if (isString(options))
30
32
  return writeFileAsync(filePath, data, { encoding: options });
31
- const timeout = Date.now() + ((options.timeout ?? DEFAULT_TIMEOUT_ASYNC) || -1);
33
+ const timeout = options.timeout ?? DEFAULT_TIMEOUT_ASYNC;
34
+ const retryOptions = { timeout, interval: DEFAULT_INTERVAL_ASYNC };
32
35
  let schedulerCustomDisposer = null;
33
36
  let schedulerDisposer = null;
34
37
  let tempDisposer = null;
@@ -63,25 +66,25 @@ async function writeFileAsync(filePath, data, options = DEFAULT_WRITE_OPTIONS) {
63
66
  recursive: true
64
67
  });
65
68
  }
66
- fd = await fs.retry.open(timeout)(tempPath, 'w', options.mode || DEFAULT_FILE_MODE);
69
+ fd = await fs.retry.open(retryOptions)(tempPath, 'w', options.mode || DEFAULT_FILE_MODE);
67
70
  if (options.tmpCreated) {
68
71
  options.tmpCreated(tempPath);
69
72
  }
70
73
  if (isString(data)) {
71
- await fs.retry.write(timeout)(fd, data, 0, options.encoding || DEFAULT_ENCODING);
74
+ await fs.retry.write(retryOptions)(fd, data, 0, options.encoding || DEFAULT_ENCODING);
72
75
  }
73
76
  else if (!isUndefined(data)) {
74
- await fs.retry.write(timeout)(fd, data, 0, data.length, 0);
77
+ await fs.retry.write(retryOptions)(fd, data, 0, data.length, 0);
75
78
  }
76
79
  if (options.fsync !== false) {
77
80
  if (options.fsyncWait !== false) {
78
- await fs.retry.fsync(timeout)(fd);
81
+ await fs.retry.fsync(retryOptions)(fd);
79
82
  }
80
83
  else {
81
84
  fs.attempt.fsync(fd);
82
85
  }
83
86
  }
84
- await fs.retry.close(timeout)(fd);
87
+ await fs.retry.close(retryOptions)(fd);
85
88
  fd = null;
86
89
  if (options.chown && (options.chown.uid !== DEFAULT_USER_UID || options.chown.gid !== DEFAULT_USER_GID)) {
87
90
  await fs.attempt.chown(tempPath, options.chown.uid, options.chown.gid);
@@ -90,14 +93,14 @@ async function writeFileAsync(filePath, data, options = DEFAULT_WRITE_OPTIONS) {
90
93
  await fs.attempt.chmod(tempPath, options.mode);
91
94
  }
92
95
  try {
93
- await fs.retry.rename(timeout)(tempPath, filePath);
96
+ await fs.retry.rename(retryOptions)(tempPath, filePath);
94
97
  }
95
98
  catch (error) {
96
99
  if (!isException(error))
97
100
  throw error;
98
101
  if (error.code !== 'ENAMETOOLONG')
99
102
  throw error;
100
- await fs.retry.rename(timeout)(tempPath, Temp.truncate(filePath));
103
+ await fs.retry.rename(retryOptions)(tempPath, Temp.truncate(filePath));
101
104
  }
102
105
  tempDisposer();
103
106
  tempPath = null;
@@ -116,7 +119,8 @@ async function writeFileAsync(filePath, data, options = DEFAULT_WRITE_OPTIONS) {
116
119
  function writeFileSync(filePath, data, options = DEFAULT_WRITE_OPTIONS) {
117
120
  if (isString(options))
118
121
  return writeFileSync(filePath, data, { encoding: options });
119
- const timeout = Date.now() + ((options.timeout ?? DEFAULT_TIMEOUT_SYNC) || -1);
122
+ const timeout = options.timeout ?? DEFAULT_TIMEOUT_SYNC;
123
+ const retryOptions = { timeout };
120
124
  let tempDisposer = null;
121
125
  let tempPath = null;
122
126
  let fd = null;
@@ -146,25 +150,25 @@ function writeFileSync(filePath, data, options = DEFAULT_WRITE_OPTIONS) {
146
150
  recursive: true
147
151
  });
148
152
  }
149
- fd = fs.retry.openSync(timeout)(tempPath, 'w', options.mode || DEFAULT_FILE_MODE);
153
+ fd = fs.retry.openSync(retryOptions)(tempPath, 'w', options.mode || DEFAULT_FILE_MODE);
150
154
  if (options.tmpCreated) {
151
155
  options.tmpCreated(tempPath);
152
156
  }
153
157
  if (isString(data)) {
154
- fs.retry.writeSync(timeout)(fd, data, 0, options.encoding || DEFAULT_ENCODING);
158
+ fs.retry.writeSync(retryOptions)(fd, data, 0, options.encoding || DEFAULT_ENCODING);
155
159
  }
156
160
  else if (!isUndefined(data)) {
157
- fs.retry.writeSync(timeout)(fd, data, 0, data.length, 0);
161
+ fs.retry.writeSync(retryOptions)(fd, data, 0, data.length, 0);
158
162
  }
159
163
  if (options.fsync !== false) {
160
164
  if (options.fsyncWait !== false) {
161
- fs.retry.fsyncSync(timeout)(fd);
165
+ fs.retry.fsyncSync(retryOptions)(fd);
162
166
  }
163
167
  else {
164
168
  fs.attempt.fsync(fd);
165
169
  }
166
170
  }
167
- fs.retry.closeSync(timeout)(fd);
171
+ fs.retry.closeSync(retryOptions)(fd);
168
172
  fd = null;
169
173
  if (options.chown && (options.chown.uid !== DEFAULT_USER_UID || options.chown.gid !== DEFAULT_USER_GID)) {
170
174
  fs.attempt.chownSync(tempPath, options.chown.uid, options.chown.gid);
@@ -173,14 +177,14 @@ function writeFileSync(filePath, data, options = DEFAULT_WRITE_OPTIONS) {
173
177
  fs.attempt.chmodSync(tempPath, options.mode);
174
178
  }
175
179
  try {
176
- fs.retry.renameSync(timeout)(tempPath, filePath);
180
+ fs.retry.renameSync(retryOptions)(tempPath, filePath);
177
181
  }
178
182
  catch (error) {
179
183
  if (!isException(error))
180
184
  throw error;
181
185
  if (error.code !== 'ENAMETOOLONG')
182
186
  throw error;
183
- fs.retry.renameSync(timeout)(tempPath, Temp.truncate(filePath));
187
+ fs.retry.renameSync(retryOptions)(tempPath, Temp.truncate(filePath));
184
188
  }
185
189
  tempDisposer();
186
190
  tempPath = null;
package/dist/types.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  type Callback = (error: Exception | void) => void;
3
2
  type Data = Uint8Array | string | undefined;
4
3
  type Disposer = () => void;
@@ -1,5 +1,5 @@
1
- /// <reference types="node" />
2
- declare const isException: (value: unknown) => value is NodeJS.ErrnoException;
1
+ import type { Exception } from '../types.js';
2
+ declare const isException: (value: unknown) => value is Exception;
3
3
  declare const isFunction: (value: unknown) => value is Function;
4
4
  declare const isString: (value: unknown) => value is string;
5
5
  declare const isUndefined: (value: unknown) => value is undefined;
@@ -1,4 +1,4 @@
1
- import type { Disposer } from '../types';
1
+ import type { Disposer } from '../types.js';
2
2
  declare const Scheduler: {
3
3
  next: (id: string) => void;
4
4
  schedule: (id: string) => Promise<Disposer>;
@@ -1,4 +1,4 @@
1
- import type { Disposer } from '../types';
1
+ import type { Disposer } from '../types.js';
2
2
  declare const Temp: {
3
3
  store: Record<string, boolean>;
4
4
  create: (filePath: string) => string;
@@ -7,7 +7,7 @@ import { LIMIT_BASENAME_LENGTH } from '../constants.js';
7
7
  //TODO: Maybe publish this as a standalone package
8
8
  const Temp = {
9
9
  /* VARIABLES */
10
- store: {},
10
+ store: {}, // filePath => purge
11
11
  /* API */
12
12
  create: (filePath) => {
13
13
  const randomness = `000000${Math.floor(Math.random() * 16777215).toString(16)}`.slice(-6); // 6 random-enough hex characters
package/package.json CHANGED
@@ -2,7 +2,8 @@
2
2
  "name": "atomically",
3
3
  "repository": "github:fabiospampinato/atomically",
4
4
  "description": "Read and write files atomically and reliably.",
5
- "version": "2.0.3",
5
+ "license": "MIT",
6
+ "version": "2.0.5",
6
7
  "type": "module",
7
8
  "main": "dist/index.js",
8
9
  "exports": "./dist/index.js",
@@ -26,16 +27,16 @@
26
27
  "reliable"
27
28
  ],
28
29
  "dependencies": {
29
- "stubborn-fs": "^1.2.5",
30
- "when-exit": "^2.1.1"
30
+ "stubborn-fs": "^2.0.0",
31
+ "when-exit": "^2.1.4"
31
32
  },
32
33
  "devDependencies": {
33
- "@types/node": "^20.4.6",
34
- "esbuild": "^0.18.17",
34
+ "@types/node": "^18.19.130",
35
+ "esbuild": "^0.18.20",
35
36
  "require-inject": "^1.4.4",
36
37
  "tap": "^16.3.8",
37
- "tsex": "^3.0.0",
38
- "typescript": "^5.1.6",
39
- "write-file-atomic": "^5.0.1"
38
+ "tsex": "^4.0.2",
39
+ "typescript": "^5.9.3",
40
+ "write-file-atomic": "^7.0.0"
40
41
  }
41
42
  }
package/.editorconfig DELETED
@@ -1,10 +0,0 @@
1
-
2
- root = true
3
-
4
- [*]
5
- charset = utf-8
6
- end_of_line = lf
7
- indent_size = 2
8
- indent_style = space
9
- insert_final_newline = true
10
- trim_trailing_whitespace = true
package/src/constants.ts DELETED
@@ -1,39 +0,0 @@
1
-
2
- /* IMPORT */
3
-
4
- import os from 'node:os';
5
- import process from 'node:process';
6
-
7
- /* MAIN */
8
-
9
- const DEFAULT_ENCODING = 'utf8';
10
-
11
- const DEFAULT_FILE_MODE = 0o666;
12
-
13
- const DEFAULT_FOLDER_MODE = 0o777;
14
-
15
- const DEFAULT_READ_OPTIONS = {};
16
-
17
- const DEFAULT_WRITE_OPTIONS = {};
18
-
19
- const DEFAULT_USER_UID = os.userInfo ().uid;
20
-
21
- const DEFAULT_USER_GID = os.userInfo ().gid;
22
-
23
- const DEFAULT_TIMEOUT_ASYNC = 7500;
24
-
25
- const DEFAULT_TIMEOUT_SYNC = 1000;
26
-
27
- const IS_POSIX = !!process.getuid;
28
-
29
- const IS_USER_ROOT = process.getuid ? !process.getuid () : false;
30
-
31
- const LIMIT_BASENAME_LENGTH = 128; //TODO: Fetch the real limit from the filesystem //TODO: Fetch the whole-path length limit too
32
-
33
- const LIMIT_FILES_DESCRIPTORS = 10_000; //TODO: Fetch the real limit from the filesystem
34
-
35
- const NOOP = () => {};
36
-
37
- /* EXPORT */
38
-
39
- export {DEFAULT_ENCODING, DEFAULT_FILE_MODE, DEFAULT_FOLDER_MODE, DEFAULT_READ_OPTIONS, DEFAULT_WRITE_OPTIONS, DEFAULT_USER_UID, DEFAULT_USER_GID, DEFAULT_TIMEOUT_ASYNC, DEFAULT_TIMEOUT_SYNC, IS_POSIX, IS_USER_ROOT, LIMIT_BASENAME_LENGTH, LIMIT_FILES_DESCRIPTORS, NOOP};