poof 2.1.1 → 3.0.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.
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs/promises';
3
+
4
+ const CONCURRENCY = 16;
5
+ const MAX_RETRIES = 3;
6
+ const RETRY_DELAY = 100;
7
+ async function* parseNullDelimitedPaths(stream) {
8
+ let buffer = Buffer.alloc(0);
9
+ for await (const chunk of stream) {
10
+ buffer = Buffer.concat([buffer, chunk]);
11
+ let nullIndex = buffer.indexOf(0);
12
+ while (nullIndex !== -1) {
13
+ const filePath = buffer.subarray(0, nullIndex);
14
+ if (filePath.length > 0) {
15
+ yield filePath;
16
+ }
17
+ buffer = buffer.subarray(nullIndex + 1);
18
+ nullIndex = buffer.indexOf(0);
19
+ }
20
+ }
21
+ if (buffer.length > 0) {
22
+ yield buffer;
23
+ }
24
+ }
25
+ const pool = /* @__PURE__ */ new Set();
26
+ for await (const filePath of parseNullDelimitedPaths(process.stdin)) {
27
+ const task = fs.rm(filePath, {
28
+ recursive: true,
29
+ force: true,
30
+ maxRetries: MAX_RETRIES,
31
+ retryDelay: RETRY_DELAY
32
+ }).catch(() => {
33
+ }).then(() => {
34
+ pool.delete(task);
35
+ });
36
+ pool.add(task);
37
+ if (pool.size >= CONCURRENCY) {
38
+ await Promise.race(pool);
39
+ }
40
+ }
41
+ await Promise.all(pool);
package/package.json CHANGED
@@ -1,64 +1,26 @@
1
1
  {
2
2
  "name": "poof",
3
- "version": "2.1.1",
4
- "description": "Simple data processing with decorators",
5
- "main": "dist/index.js",
6
- "jsnext:main": "lib/index.js",
7
- "files": [
8
- "dist/index.js",
9
- "lib/**/*.js"
10
- ],
3
+ "version": "3.0.0",
4
+ "description": "Fast, non-blocking rm -rf alternative. Deletes files instantly while cleanup runs in the background.",
11
5
  "keywords": [
12
- "assert",
13
- "decorator",
14
- "decorators",
15
- "processing",
16
- "validate",
17
- "validation",
18
- "validator"
6
+ "rm",
7
+ "rimraf",
8
+ "delete",
9
+ "remove",
10
+ "fast",
11
+ "cli"
19
12
  ],
20
- "homepage": "https://github.com/fatfisz/poof",
21
- "repository": "https://github.com/fatfisz/poof.git",
22
- "author": {
23
- "name": "FatFisz",
24
- "url": "https://github.com/fatfisz"
25
- },
26
13
  "license": "MIT",
27
- "scripts": {
28
- "prepublish": "grunt prepublish",
29
- "test": "grunt test"
30
- },
31
- "dependencies": {
32
- "poof-factory": "^2.1.1"
33
- },
34
- "devDependencies": {
35
- "eslint": "~2.9.0",
36
- "eslint-config-fatfisz": "~2.9.0",
37
- "grunt": "^1.0.1",
38
- "grunt-babel": "^5.0.3",
39
- "grunt-cli": "^1.2.0",
40
- "grunt-contrib-clean": "^1.0.0",
41
- "grunt-eslint": "^18.1.0",
42
- "grunt-mocha-test": "^0.12.7",
43
- "grunt-rollup": "^0.7.1",
44
- "load-grunt-tasks": "^3.5.0",
45
- "mocha": "^2.5.3",
46
- "mockery": "^1.7.0",
47
- "rollup-plugin-babel": "^1.0.0",
48
- "should": "^8.4.0",
49
- "should-sinon": "0.0.5",
50
- "sinon": "^2.0.0-pre"
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "type": "module",
18
+ "bin": "./dist/cli.mjs",
19
+ "exports": "./dist/index.mjs",
20
+ "imports": {
21
+ "#rm-worker": "./dist/spawn-rm/worker.mjs"
51
22
  },
52
- "babel": {
53
- "loose": [
54
- "es6.classes",
55
- "es6.destructuring",
56
- "es6.forOf",
57
- "es6.properties.computed",
58
- "es6.spread"
59
- ],
60
- "optional": [
61
- "es7.decorators"
62
- ]
23
+ "engines": {
24
+ "node": ">=20.8.0"
63
25
  }
64
- }
26
+ }
package/dist/index.js DELETED
@@ -1,9 +0,0 @@
1
- 'use strict';
2
-
3
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
4
-
5
- var poofFactory = _interopDefault(require('poof-factory'));
6
-
7
- var index = poofFactory(false);
8
-
9
- module.exports = index;
package/lib/index.js DELETED
@@ -1,4 +0,0 @@
1
- import poofFactory from 'poof-factory';
2
-
3
-
4
- export default poofFactory(false);