@baeta/util-path 2.0.0-next.2 → 2.0.0-next.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @baeta/util-path
2
2
 
3
+ ## 2.0.0-next.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#389](https://github.com/andreisergiu98/baeta/pull/389) [`3e7a4d7`](https://github.com/andreisergiu98/baeta/commit/3e7a4d71a59543b8a506938f788aec8b5d907776) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - Switch internals to 'pathe'
8
+
9
+ - [#284](https://github.com/andreisergiu98/baeta/pull/284) [`53322ca`](https://github.com/andreisergiu98/baeta/commit/53322ca8ad0c10bce70e49692d5d15023ec3a5e8) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - Repalce upath with pathe
10
+
11
+ ## 2.0.0-next.3
12
+
13
+ ### Patch Changes
14
+
15
+ - [`831cfa2`](https://github.com/andreisergiu98/baeta/commit/831cfa2a11445aaf7f2d1a1d7ddf073db9bb8008) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - Bump utility packages
16
+
3
17
  ## 2.0.0-next.2
4
18
 
5
19
  ### Patch Changes
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  <div align="center">
6
6
  <h1>Baeta</h1>
7
7
  <a href="https://www.npmjs.com/package/@baeta/cli"><img src="https://img.shields.io/npm/v/@baeta/cli.svg?style=flat" /></a>
8
- <a href="https://github.com/andreisergiu98/baeta/actions/workflows/testing.yml"><img src="https://img.shields.io/github/actions/workflow/status/andreisergiu98/baeta/testing.yml" /></a>
8
+ <a href="https://github.com/andreisergiu98/baeta/actions/workflows/checks.yml"><img src="https://img.shields.io/github/actions/workflow/status/andreisergiu98/baeta/checks.yml" /></a>
9
9
  <a href="https://github.com/andreisergiu98/baeta/pulls"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" /></a>
10
10
  <a href="https://github.com/andreisergiu98/baeta/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" /></a>
11
11
  <br />
@@ -77,43 +77,68 @@ type Query {
77
77
  #### 2. Implement your resolvers
78
78
 
79
79
  ```typescript
80
- import { getUserModule } from "./typedef";
80
+ import { UserModule } from "./typedef.ts";
81
81
 
82
- const { Query } = getUserModule();
82
+ const { Query } = UserModule;
83
83
 
84
- Query.user(({ args }) => {
84
+ const userQuery = Query.user.resolve(({ args }) => {
85
85
  return dataSource.user.find(args.where);
86
86
  });
87
87
 
88
- Query.users(() => {
88
+ const usersQuery = Query.users.resolve(() => {
89
89
  return dataSource.user.findMany();
90
90
  });
91
+
92
+ Query.$fields({
93
+ user: userQuery,
94
+ users: usersQuery,
95
+ });
91
96
  ```
92
97
 
93
98
  #### 3. Add authorization
94
99
 
95
100
  ```typescript
96
- const { Query, Mutation } = getUserModule();
97
-
98
- Query.users.$auth({
99
- $or: {
100
- isPublic: true,
101
- isLoggedIn: true,
102
- },
103
- });
101
+ import { UserModule } from "./typedef.ts";
102
+
103
+ const { Query } = UserModule;
104
+
105
+ const userQuery = Query.user
106
+ .$auth({
107
+ $or: {
108
+ isPublic: true,
109
+ isLoggedIn: true,
110
+ },
111
+ })
112
+ .resolve(async ({ args }) => {
113
+ // ...
114
+ });
104
115
  ```
105
116
 
106
117
  #### 4. Add caching
107
118
 
108
119
  ```typescript
109
- import { getUserModule } from "./typedef";
110
-
111
- const { User, Query } = getUserModule();
120
+ const { Query, Mutation, User } = UserModule;
112
121
 
113
122
  export const userCache = User.$createCache();
114
123
 
115
- Query.user.$useCache(userCache);
116
- Query.users.$useCache(userCache);
124
+ const userQuery = Query.user
125
+ .$auth({
126
+ // ...
127
+ })
128
+ .$useCache(userCache)
129
+ .resolve(async ({ args }) => {
130
+ // ...
131
+ });
132
+
133
+ const updateUserMutation = Mutation.updateUser
134
+ .$use(async (next) => {
135
+ const user = await next();
136
+ await userCache.save(user);
137
+ return user;
138
+ })
139
+ .resolve(async ({ args }) => {
140
+ // ...
141
+ });
117
142
  ```
118
143
 
119
144
  ## Compatibility
package/dist/index.d.ts CHANGED
@@ -1,75 +1,9 @@
1
- import { ParsedPath } from 'node:path';
2
- import upath from 'upath';
1
+ import pathe_default from "pathe";
2
+ export * from "pathe";
3
3
 
4
+ //#region index.d.ts
4
5
  declare function posixPath(pathname: string): string;
5
6
  declare function winPath(pathname: string): string;
6
- declare const addExt: typeof upath.addExt;
7
- declare const basename: typeof upath.basename;
8
- declare const changeExt: typeof upath.changeExt;
9
- declare const defaultExt: typeof upath.defaultExt;
10
- declare const delimiter: string;
11
- declare const dirname: typeof upath.dirname;
12
- declare const extname: typeof upath.extname;
13
- /**
14
- * Returns a path string from an object - the opposite of parse().
15
- *
16
- * @param pathObject path to evaluate.
17
- */
18
- declare const format: (pathObject: ParsedPath) => string;
19
- declare const isAbsolute: typeof upath.isAbsolute;
20
- declare const join: typeof upath.join;
21
- /**
22
- * Exactly like path.join(), but it keeps the first meaningful ./.
23
- *
24
- * Note that the unix / is returned everywhere, so windows \ is always converted to unix /.
25
- *
26
- * @param paths string paths to join
27
- */
28
- declare const joinSafe: (...paths: string[]) => string;
29
- declare const normalize: typeof upath.normalize;
30
- declare const normalizeSafe: typeof upath.normalizeSafe;
31
- declare const normalizeTrim: typeof upath.normalizeTrim;
32
- declare const parse: typeof upath.parse;
33
- declare const posix: typeof upath.posix;
34
- declare const relative: typeof upath.relative;
35
- /**
36
- * Removes the specific ext extension from filename, if it has it. Otherwise it leaves it as is. As in all upath functions, it be .ext or ext.
37
- *
38
- * @param filename string filename to remove extension to
39
- * @param ext string extension to remove
40
- */
41
- declare const removeExt: (filename: string, ext: string) => string;
42
- declare const resolve: typeof upath.resolve;
43
- declare const sep: string;
44
- declare const toUnix: typeof upath.toUnix;
45
- declare const trimExt: typeof upath.trimExt;
46
- declare const win32: typeof upath.win32;
47
- declare const _default: {
48
- addExt: typeof upath.addExt;
49
- basename: typeof upath.basename;
50
- changeExt: typeof upath.changeExt;
51
- defaultExt: typeof upath.defaultExt;
52
- delimiter: string;
53
- dirname: typeof upath.dirname;
54
- extname: typeof upath.extname;
55
- format: (pathObject: ParsedPath) => string;
56
- isAbsolute: typeof upath.isAbsolute;
57
- join: typeof upath.join;
58
- joinSafe: (...paths: string[]) => string;
59
- normalize: typeof upath.normalize;
60
- normalizeSafe: typeof upath.normalizeSafe;
61
- normalizeTrim: typeof upath.normalizeTrim;
62
- parse: typeof upath.parse;
63
- posix: typeof upath.posix;
64
- relative: typeof upath.relative;
65
- removeExt: (filename: string, ext: string) => string;
66
- resolve: typeof upath.resolve;
67
- sep: string;
68
- toUnix: typeof upath.toUnix;
69
- trimExt: typeof upath.trimExt;
70
- win32: typeof upath.win32;
71
- posixPath: typeof posixPath;
72
- winPath: typeof winPath;
73
- };
74
-
75
- export { addExt, basename, changeExt, _default as default, defaultExt, delimiter, dirname, extname, format, isAbsolute, join, joinSafe, normalize, normalizeSafe, normalizeTrim, parse, posix, posixPath, relative, removeExt, resolve, sep, toUnix, trimExt, win32, winPath };
7
+ //#endregion
8
+ export { pathe_default as default, posixPath, winPath };
9
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,88 +1,14 @@
1
- // index.ts
2
- import path from "path";
3
- import upath from "upath";
1
+ import path from "node:path";
2
+ import pathe_default from "pathe";
3
+ export * from "pathe";
4
+ //#region index.ts
4
5
  function posixPath(pathname) {
5
- return pathname.split(path.win32.sep).join(path.posix.sep);
6
+ return pathname.split(path.win32.sep).join(path.posix.sep);
6
7
  }
7
8
  function winPath(pathname) {
8
- return pathname.split(path.posix.sep).join(path.win32.sep);
9
+ return pathname.split(path.posix.sep).join(path.win32.sep);
9
10
  }
10
- var addExt = upath.addExt;
11
- var basename = upath.basename;
12
- var changeExt = upath.changeExt;
13
- var defaultExt = upath.defaultExt;
14
- var delimiter = upath.delimiter;
15
- var dirname = upath.dirname;
16
- var extname = upath.extname;
17
- var format = upath.format;
18
- var isAbsolute = upath.isAbsolute;
19
- var join = upath.join;
20
- var joinSafe = upath.joinSafe;
21
- var normalize = upath.normalize;
22
- var normalizeSafe = upath.normalizeSafe;
23
- var normalizeTrim = upath.normalizeTrim;
24
- var parse = upath.parse;
25
- var posix = upath.posix;
26
- var relative = upath.relative;
27
- var removeExt = upath.removeExt;
28
- var resolve = upath.resolve;
29
- var sep = upath.sep;
30
- var toUnix = upath.toUnix;
31
- var trimExt = upath.trimExt;
32
- var win32 = upath.win32;
33
- var index_default = {
34
- addExt,
35
- basename,
36
- changeExt,
37
- defaultExt,
38
- delimiter,
39
- dirname,
40
- extname,
41
- format,
42
- isAbsolute,
43
- join,
44
- joinSafe,
45
- normalize,
46
- normalizeSafe,
47
- normalizeTrim,
48
- parse,
49
- posix,
50
- relative,
51
- removeExt,
52
- resolve,
53
- sep,
54
- toUnix,
55
- trimExt,
56
- win32,
57
- posixPath,
58
- winPath
59
- };
60
- export {
61
- addExt,
62
- basename,
63
- changeExt,
64
- index_default as default,
65
- defaultExt,
66
- delimiter,
67
- dirname,
68
- extname,
69
- format,
70
- isAbsolute,
71
- join,
72
- joinSafe,
73
- normalize,
74
- normalizeSafe,
75
- normalizeTrim,
76
- parse,
77
- posix,
78
- posixPath,
79
- relative,
80
- removeExt,
81
- resolve,
82
- sep,
83
- toUnix,
84
- trimExt,
85
- win32,
86
- winPath
87
- };
11
+ //#endregion
12
+ export { pathe_default as default, posixPath, winPath };
13
+
88
14
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../index.ts"],"sourcesContent":["import path, { type ParsedPath } from 'node:path';\nimport upath from 'upath';\n\nexport function posixPath(pathname: string) {\n\treturn pathname.split(path.win32.sep).join(path.posix.sep);\n}\n\nexport function winPath(pathname: string) {\n\treturn pathname.split(path.posix.sep).join(path.win32.sep);\n}\n\nexport const addExt = upath.addExt;\nexport const basename = upath.basename;\nexport const changeExt = upath.changeExt;\nexport const defaultExt = upath.defaultExt;\nexport const delimiter = upath.delimiter;\nexport const dirname = upath.dirname;\nexport const extname = upath.extname;\n\n/**\n * Returns a path string from an object - the opposite of parse().\n *\n * @param pathObject path to evaluate.\n */\nexport const format = upath.format as (pathObject: ParsedPath) => string;\n\nexport const isAbsolute = upath.isAbsolute;\nexport const join = upath.join;\n\n/**\n * Exactly like path.join(), but it keeps the first meaningful ./.\n *\n * Note that the unix / is returned everywhere, so windows \\ is always converted to unix /.\n *\n * @param paths string paths to join\n */\nexport const joinSafe = upath.joinSafe as (...paths: string[]) => string;\n\nexport const normalize = upath.normalize;\nexport const normalizeSafe = upath.normalizeSafe;\nexport const normalizeTrim = upath.normalizeTrim;\nexport const parse = upath.parse;\nexport const posix = upath.posix;\nexport const relative = upath.relative;\n\n/**\n * Removes the specific ext extension from filename, if it has it. Otherwise it leaves it as is. As in all upath functions, it be .ext or ext.\n *\n * @param filename string filename to remove extension to\n * @param ext string extension to remove\n */\nexport const removeExt = upath.removeExt as (filename: string, ext: string) => string;\n\nexport const resolve = upath.resolve;\nexport const sep = upath.sep;\nexport const toUnix = upath.toUnix;\nexport const trimExt = upath.trimExt;\nexport const win32 = upath.win32;\n\nexport default {\n\taddExt,\n\tbasename,\n\tchangeExt,\n\tdefaultExt,\n\tdelimiter,\n\tdirname,\n\textname,\n\tformat,\n\tisAbsolute,\n\tjoin,\n\tjoinSafe,\n\tnormalize,\n\tnormalizeSafe,\n\tnormalizeTrim,\n\tparse,\n\tposix,\n\trelative,\n\tremoveExt,\n\tresolve,\n\tsep,\n\ttoUnix,\n\ttrimExt,\n\twin32,\n\tposixPath,\n\twinPath,\n};\n"],"mappings":";AAAA,OAAO,UAA+B;AACtC,OAAO,WAAW;AAEX,SAAS,UAAU,UAAkB;AAC3C,SAAO,SAAS,MAAM,KAAK,MAAM,GAAG,EAAE,KAAK,KAAK,MAAM,GAAG;AAC1D;AAEO,SAAS,QAAQ,UAAkB;AACzC,SAAO,SAAS,MAAM,KAAK,MAAM,GAAG,EAAE,KAAK,KAAK,MAAM,GAAG;AAC1D;AAEO,IAAM,SAAS,MAAM;AACrB,IAAM,WAAW,MAAM;AACvB,IAAM,YAAY,MAAM;AACxB,IAAM,aAAa,MAAM;AACzB,IAAM,YAAY,MAAM;AACxB,IAAM,UAAU,MAAM;AACtB,IAAM,UAAU,MAAM;AAOtB,IAAM,SAAS,MAAM;AAErB,IAAM,aAAa,MAAM;AACzB,IAAM,OAAO,MAAM;AASnB,IAAM,WAAW,MAAM;AAEvB,IAAM,YAAY,MAAM;AACxB,IAAM,gBAAgB,MAAM;AAC5B,IAAM,gBAAgB,MAAM;AAC5B,IAAM,QAAQ,MAAM;AACpB,IAAM,QAAQ,MAAM;AACpB,IAAM,WAAW,MAAM;AAQvB,IAAM,YAAY,MAAM;AAExB,IAAM,UAAU,MAAM;AACtB,IAAM,MAAM,MAAM;AAClB,IAAM,SAAS,MAAM;AACrB,IAAM,UAAU,MAAM;AACtB,IAAM,QAAQ,MAAM;AAE3B,IAAO,gBAAQ;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;","names":[]}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../index.ts"],"sourcesContent":["import path from 'node:path';\n\nexport * from 'pathe';\nexport { default } from 'pathe';\n\nexport function posixPath(pathname: string) {\n\treturn pathname.split(path.win32.sep).join(path.posix.sep);\n}\n\nexport function winPath(pathname: string) {\n\treturn pathname.split(path.posix.sep).join(path.win32.sep);\n}\n"],"mappings":";;;;AAKA,SAAgB,UAAU,UAAkB;AAC3C,QAAO,SAAS,MAAM,KAAK,MAAM,IAAI,CAAC,KAAK,KAAK,MAAM,IAAI;;AAG3D,SAAgB,QAAQ,UAAkB;AACzC,QAAO,SAAS,MAAM,KAAK,MAAM,IAAI,CAAC,KAAK,KAAK,MAAM,IAAI"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baeta/util-path",
3
- "version": "2.0.0-next.2",
3
+ "version": "2.0.0-next.4",
4
4
  "keywords": [
5
5
  "baeta",
6
6
  "graphql",
@@ -37,21 +37,27 @@
37
37
  "package.json"
38
38
  ],
39
39
  "scripts": {
40
- "build": "tsup",
41
- "prepack": "prep",
42
- "postpack": "prep --clean",
43
- "test": "ava",
40
+ "build": "builder build",
41
+ "check:deps": "builder check-deps",
42
+ "prepack": "builder prepare",
43
+ "postpack": "builder prepare --restore",
44
+ "test": "builder test",
44
45
  "types": "tsc --noEmit"
45
46
  },
47
+ "ava": {
48
+ "extensions": [
49
+ "ts"
50
+ ]
51
+ },
46
52
  "dependencies": {
47
- "upath": "^2.0.1"
53
+ "pathe": "^2.0.3"
48
54
  },
49
55
  "devDependencies": {
50
56
  "@baeta/builder": "^0.0.0",
51
57
  "@baeta/testing": "^0.0.0",
52
58
  "@baeta/tsconfig": "^0.0.0",
53
- "@types/node": "^22.18.11",
54
- "typescript": "^5.9.3"
59
+ "@types/node": "^22.19.17",
60
+ "typescript": "^6.0.0"
55
61
  },
56
62
  "engines": {
57
63
  "node": ">=22.20.0"
@@ -65,15 +71,6 @@
65
71
  }
66
72
  }
67
73
  },
68
- "ava": {
69
- "extensions": {
70
- "ts": "module"
71
- },
72
- "nodeArguments": [
73
- "--no-warnings",
74
- "--experimental-transform-types"
75
- ]
76
- },
77
74
  "typedocOptions": {
78
75
  "entryPoints": [
79
76
  "./index.ts"