@purestack/ts-util-node 1.1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ahmed Yasin Koculu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,8 @@
1
+ # @purestack/ts-util-node
2
+
3
+ File path helpers for PureStack's Node.js build tools. `ensureDir(filePath)`
4
+ creates the parent directory for a file, and `replaceExt(filePath, newExt)`
5
+ returns the path with a different extension.
6
+
7
+ Use this package in build scripts and other Node.js code. Browser-safe helpers
8
+ live in `@purestack/ts-util`.
@@ -0,0 +1,7 @@
1
+ /*! @purestack/ts-util-node v1.1.0 | (c) 2026 Ahmed Yasin Koculu | MIT License */
2
+
3
+ //#region packages/ts-util-node/src/fs.d.ts
4
+ export declare function ensureDir(filePath: string): Promise<void>;
5
+ export declare function replaceExt(filePath: string, newExt: string): string;
6
+ //#endregion
7
+ //# sourceMappingURL=ts-util-node.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ts-util-node.d.mts","names":[],"sources":["../src/fs.ts"],"mappings":";wBAGsB,UAAU,mBAAgB;wBAIhC,WAAW,kBAAkB"}
@@ -0,0 +1,16 @@
1
+ /*! @purestack/ts-util-node v1.1.0 | (c) 2026 Ahmed Yasin Koculu | MIT License */
2
+
3
+ import fs from "node:fs/promises";
4
+ import path from "node:path";
5
+
6
+ //#region packages/ts-util-node/src/fs.ts
7
+ async function ensureDir(filePath) {
8
+ await fs.mkdir(path.dirname(filePath), { recursive: true });
9
+ }
10
+ function replaceExt(filePath, newExt) {
11
+ return filePath.slice(0, -path.extname(filePath).length) + newExt;
12
+ }
13
+
14
+ //#endregion
15
+ export { ensureDir, replaceExt };
16
+ //# sourceMappingURL=ts-util-node.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ts-util-node.mjs","names":[],"sources":["../src/fs.ts"],"sourcesContent":["import fs from 'node:fs/promises'\nimport path from 'node:path'\n\nexport async function ensureDir(filePath: string) {\n await fs.mkdir(path.dirname(filePath), { recursive: true })\n}\n\nexport function replaceExt(filePath: string, newExt: string) {\n return filePath.slice(0, -path.extname(filePath).length) + newExt\n}\n"],"mappings":";;;;AAGA,eAAsB,UAAU,UAAkB;CAChD,MAAM,GAAG,MAAM,KAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAK,CAAC;AAC5D;AAEA,SAAgB,WAAW,UAAkB,QAAgB;CAC3D,OAAO,SAAS,MAAM,GAAG,CAAC,KAAK,QAAQ,QAAQ,CAAC,CAAC,MAAM,IAAI;AAC7D"}
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@purestack/ts-util-node",
3
+ "version": "1.1.0",
4
+ "packageManager": "yarn@4.9.2",
5
+ "module": "./dist/ts-util-node.mjs",
6
+ "types": "./dist/ts-util-node.d.mts",
7
+ "type": "module",
8
+ "sideEffects": false,
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/PureStackStudio/PureStack.git",
12
+ "directory": "packages/ts-util-node"
13
+ },
14
+ "homepage": "https://purestack.studio",
15
+ "bugs": {
16
+ "url": "https://github.com/PureStackStudio/PureStack/issues"
17
+ },
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
21
+ "exports": {
22
+ ".": {
23
+ "types": "./dist/ts-util-node.d.mts",
24
+ "import": "./dist/ts-util-node.mjs"
25
+ }
26
+ },
27
+ "license": "MIT",
28
+ "files": [
29
+ "dist/*.mjs",
30
+ "dist/*.mjs.map",
31
+ "dist/*.d.mts",
32
+ "dist/*.d.mts.map",
33
+ "README.md",
34
+ "LICENSE"
35
+ ],
36
+ "scripts": {
37
+ "build": "tsc",
38
+ "lint": "biome check ./src --formatter-enabled=false --write",
39
+ "test": "vitest"
40
+ }
41
+ }