@dephub/write 1.0.3 → 1.0.4

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.
@@ -1,4 +1,4 @@
1
- import { existsSync } from "node:fs";
1
+ import { canAccess } from "../utils/access.js";
2
2
  import { mkdir, writeFile as writeFile$1 } from "node:fs/promises";
3
3
  import path from "node:path";
4
4
  // src/core/write.ts
@@ -14,7 +14,7 @@ import path from "node:path";
14
14
  */
15
15
  var writeFile = async (filePath, content) => {
16
16
  const dir = path.dirname(filePath);
17
- if (!existsSync(dir)) await mkdir(dir, { recursive: true });
17
+ if (!await canAccess(dir)) await mkdir(dir, { recursive: true });
18
18
  await writeFile$1(filePath, content);
19
19
  };
20
20
  export { writeFile };
package/dist/package.js CHANGED
@@ -1,16 +1,18 @@
1
1
  // package.json
2
2
  var name = "@dephub/write";
3
3
  var type = "module";
4
- var version = "1.0.3";
4
+ var version = "1.0.4";
5
5
  var description = "File writing utility with automatic directory creation for Node.js";
6
6
  var types = "./dist/index.d.ts";
7
7
  var main = "./dist/index.js";
8
8
  var bin = { "write": "./dist/cli.js" };
9
9
  var scripts = {
10
- "prepublishOnly": "pnpm lint && pnpm check && pnpm build",
10
+ "prepublishOnly": "pnpm check && pnpm test && pnpm build",
11
11
  "release": "pnpm publish",
12
12
  "docs": "lineo md 'src/**/*.ts' --outFile code.md --outDir temp",
13
- "check": "tsc --noEmit --skipLibCheck",
13
+ "test": "node --test",
14
+ "check": "pnpm fmt && pnpm lint && pnpm check-types",
15
+ "check-types": "tsc --noEmit --skipLibCheck",
14
16
  "lint": "eslint . --fix --max-warnings 0",
15
17
  "fmt": "prettier --write .",
16
18
  "clean": "rm -rf dist",
@@ -34,7 +36,6 @@ var author = {
34
36
  "email": "dev@estarlincito.com",
35
37
  "url": "https://estarlincito.com"
36
38
  };
37
- var engines = { "node": ">=22.5.0" };
38
39
  var files = [
39
40
  "LICENSE",
40
41
  "README.md",
@@ -47,7 +48,6 @@ var repository = {
47
48
  };
48
49
  var bugs = { "url": "https://github.com/dephub-js/write/issues" };
49
50
  var publishConfig = { "access": "public" };
50
- var packageManager = "pnpm@10.30.3";
51
51
  var dependencies = {
52
52
  "@dephub/command": "^3.0.0",
53
53
  "@dephub/logger": "^1.2.0"
@@ -55,14 +55,17 @@ var dependencies = {
55
55
  var devDependencies = {
56
56
  "@dephub/eslint-ts": "^1.0.5",
57
57
  "@dephub/glob": "^1.0.2",
58
- "@dephub/path": "^1.0.2",
58
+ "@dephub/path": "^2.0.0",
59
59
  "@types/node": "^26.6.6",
60
60
  "eslint": "^10.14.0",
61
61
  "prettier": "^3.9.10",
62
62
  "typescript": "6.0.3",
63
- "vite": "^8.3.5",
63
+ "vite": "^8.3.6",
64
64
  "vite-plugin-dts": "^5.1.2"
65
65
  };
66
+ var imports = { "#/*": "./src/*" };
67
+ var engines = { "node": ">=24.0.0" };
68
+ var packageManager = "pnpm@10.30.3";
66
69
  var package_default = {
67
70
  name,
68
71
  type,
@@ -74,15 +77,16 @@ var package_default = {
74
77
  scripts,
75
78
  keywords,
76
79
  author,
77
- engines,
78
80
  files,
79
81
  license: "MIT",
80
82
  homepage,
81
83
  repository,
82
84
  bugs,
83
85
  publishConfig,
84
- packageManager,
85
86
  dependencies,
86
- devDependencies
87
+ devDependencies,
88
+ imports,
89
+ engines,
90
+ packageManager
87
91
  };
88
- export { author, bin, bugs, package_default as default, dependencies, description, devDependencies, engines, files, homepage, keywords, main, name, packageManager, publishConfig, repository, scripts, type, types, version };
92
+ export { author, bin, bugs, package_default as default, dependencies, description, devDependencies, engines, files, homepage, imports, keywords, main, name, packageManager, publishConfig, repository, scripts, type, types, version };
@@ -0,0 +1,2 @@
1
+ import { PathLike } from 'node:fs';
2
+ export declare function canAccess(path: PathLike): Promise<boolean>;
@@ -0,0 +1,11 @@
1
+ import { access, constants } from "node:fs/promises";
2
+ // src/utils/access.ts
3
+ async function canAccess(path) {
4
+ try {
5
+ await access(path, constants.R_OK | constants.W_OK);
6
+ return true;
7
+ } catch {
8
+ return false;
9
+ }
10
+ }
11
+ export { canAccess };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dephub/write",
3
3
  "type": "module",
4
- "version": "1.0.3",
4
+ "version": "1.0.4",
5
5
  "description": "File writing utility with automatic directory creation for Node.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "main": "./dist/index.js",
@@ -25,9 +25,6 @@
25
25
  "email": "dev@estarlincito.com",
26
26
  "url": "https://estarlincito.com"
27
27
  },
28
- "engines": {
29
- "node": ">=22.5.0"
30
- },
31
28
  "files": [
32
29
  "LICENSE",
33
30
  "README.md",
@@ -52,18 +49,26 @@
52
49
  "devDependencies": {
53
50
  "@dephub/eslint-ts": "^1.0.5",
54
51
  "@dephub/glob": "^1.0.2",
55
- "@dephub/path": "^1.0.2",
52
+ "@dephub/path": "^2.0.0",
56
53
  "@types/node": "^26.6.6",
57
54
  "eslint": "^10.14.0",
58
55
  "prettier": "^3.9.10",
59
56
  "typescript": "6.0.3",
60
- "vite": "^8.3.5",
57
+ "vite": "^8.3.6",
61
58
  "vite-plugin-dts": "^5.1.2"
62
59
  },
60
+ "imports": {
61
+ "#/*": "./src/*"
62
+ },
63
+ "engines": {
64
+ "node": ">=24.0.0"
65
+ },
63
66
  "scripts": {
64
67
  "release": "pnpm publish",
65
68
  "docs": "lineo md 'src/**/*.ts' --outFile code.md --outDir temp",
66
- "check": "tsc --noEmit --skipLibCheck",
69
+ "test": "node --test",
70
+ "check": "pnpm fmt && pnpm lint && pnpm check-types",
71
+ "check-types": "tsc --noEmit --skipLibCheck",
67
72
  "lint": "eslint . --fix --max-warnings 0",
68
73
  "fmt": "prettier --write .",
69
74
  "clean": "rm -rf dist",