@baeta/util-path 2.0.0-next.2 → 2.0.0-next.3

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,11 @@
1
1
  # @baeta/util-path
2
2
 
3
+ ## 2.0.0-next.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`831cfa2`](https://github.com/andreisergiu98/baeta/commit/831cfa2a11445aaf7f2d1a1d7ddf073db9bb8008) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - Bump utility packages
8
+
3
9
  ## 2.0.0-next.2
4
10
 
5
11
  ### 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,6 +1,7 @@
1
- import { ParsedPath } from 'node:path';
2
- import upath from 'upath';
1
+ import { ParsedPath } from "node:path";
2
+ import upath from "upath";
3
3
 
4
+ //#region index.d.ts
4
5
  declare function posixPath(pathname: string): string;
5
6
  declare function winPath(pathname: string): string;
6
7
  declare const addExt: typeof upath.addExt;
@@ -45,31 +46,32 @@ declare const toUnix: typeof upath.toUnix;
45
46
  declare const trimExt: typeof upath.trimExt;
46
47
  declare const win32: typeof upath.win32;
47
48
  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;
49
+ addExt: typeof upath.addExt;
50
+ basename: typeof upath.basename;
51
+ changeExt: typeof upath.changeExt;
52
+ defaultExt: typeof upath.defaultExt;
53
+ delimiter: string;
54
+ dirname: typeof upath.dirname;
55
+ extname: typeof upath.extname;
56
+ format: (pathObject: ParsedPath) => string;
57
+ isAbsolute: typeof upath.isAbsolute;
58
+ join: typeof upath.join;
59
+ joinSafe: (...paths: string[]) => string;
60
+ normalize: typeof upath.normalize;
61
+ normalizeSafe: typeof upath.normalizeSafe;
62
+ normalizeTrim: typeof upath.normalizeTrim;
63
+ parse: typeof upath.parse;
64
+ posix: typeof upath.posix;
65
+ relative: typeof upath.relative;
66
+ removeExt: (filename: string, ext: string) => string;
67
+ resolve: typeof upath.resolve;
68
+ sep: string;
69
+ toUnix: typeof upath.toUnix;
70
+ trimExt: typeof upath.trimExt;
71
+ win32: typeof upath.win32;
72
+ posixPath: typeof posixPath;
73
+ winPath: typeof winPath;
73
74
  };
74
-
75
+ //#endregion
75
76
  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 };
77
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,88 +1,82 @@
1
- // index.ts
2
- import path from "path";
1
+ import path from "node:path";
3
2
  import upath from "upath";
3
+
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
11
+ const addExt = upath.addExt;
12
+ const basename = upath.basename;
13
+ const changeExt = upath.changeExt;
14
+ const defaultExt = upath.defaultExt;
15
+ const delimiter = upath.delimiter;
16
+ const dirname = upath.dirname;
17
+ const extname = upath.extname;
18
+ /**
19
+ * Returns a path string from an object - the opposite of parse().
20
+ *
21
+ * @param pathObject path to evaluate.
22
+ */
23
+ const format = upath.format;
24
+ const isAbsolute = upath.isAbsolute;
25
+ const join = upath.join;
26
+ /**
27
+ * Exactly like path.join(), but it keeps the first meaningful ./.
28
+ *
29
+ * Note that the unix / is returned everywhere, so windows \ is always converted to unix /.
30
+ *
31
+ * @param paths string paths to join
32
+ */
33
+ const joinSafe = upath.joinSafe;
34
+ const normalize = upath.normalize;
35
+ const normalizeSafe = upath.normalizeSafe;
36
+ const normalizeTrim = upath.normalizeTrim;
37
+ const parse = upath.parse;
38
+ const posix = upath.posix;
39
+ const relative = upath.relative;
40
+ /**
41
+ * 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.
42
+ *
43
+ * @param filename string filename to remove extension to
44
+ * @param ext string extension to remove
45
+ */
46
+ const removeExt = upath.removeExt;
47
+ const resolve = upath.resolve;
48
+ const sep = upath.sep;
49
+ const toUnix = upath.toUnix;
50
+ const trimExt = upath.trimExt;
51
+ const win32 = upath.win32;
52
+ var util_path_default = {
53
+ addExt,
54
+ basename,
55
+ changeExt,
56
+ defaultExt,
57
+ delimiter,
58
+ dirname,
59
+ extname,
60
+ format,
61
+ isAbsolute,
62
+ join,
63
+ joinSafe,
64
+ normalize,
65
+ normalizeSafe,
66
+ normalizeTrim,
67
+ parse,
68
+ posix,
69
+ relative,
70
+ removeExt,
71
+ resolve,
72
+ sep,
73
+ toUnix,
74
+ trimExt,
75
+ win32,
76
+ posixPath,
77
+ winPath
87
78
  };
79
+
80
+ //#endregion
81
+ export { addExt, basename, changeExt, util_path_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 };
88
82
  //# 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, { 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":";;;;AAGA,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;;AAG3D,MAAa,SAAS,MAAM;AAC5B,MAAa,WAAW,MAAM;AAC9B,MAAa,YAAY,MAAM;AAC/B,MAAa,aAAa,MAAM;AAChC,MAAa,YAAY,MAAM;AAC/B,MAAa,UAAU,MAAM;AAC7B,MAAa,UAAU,MAAM;;;;;;AAO7B,MAAa,SAAS,MAAM;AAE5B,MAAa,aAAa,MAAM;AAChC,MAAa,OAAO,MAAM;;;;;;;;AAS1B,MAAa,WAAW,MAAM;AAE9B,MAAa,YAAY,MAAM;AAC/B,MAAa,gBAAgB,MAAM;AACnC,MAAa,gBAAgB,MAAM;AACnC,MAAa,QAAQ,MAAM;AAC3B,MAAa,QAAQ,MAAM;AAC3B,MAAa,WAAW,MAAM;;;;;;;AAQ9B,MAAa,YAAY,MAAM;AAE/B,MAAa,UAAU,MAAM;AAC7B,MAAa,MAAM,MAAM;AACzB,MAAa,SAAS,MAAM;AAC5B,MAAa,UAAU,MAAM;AAC7B,MAAa,QAAQ,MAAM;AAE3B,wBAAe;CACd;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA"}
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.3",
4
4
  "keywords": [
5
5
  "baeta",
6
6
  "graphql",
@@ -37,12 +37,18 @@
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
+ "prepack": "builder prepare",
42
+ "postpack": "builder prepare --clean",
43
+ "test": "builder test",
44
+ "test:circular": "builder test-circular",
44
45
  "types": "tsc --noEmit"
45
46
  },
47
+ "ava": {
48
+ "extensions": {
49
+ "ts": "module"
50
+ }
51
+ },
46
52
  "dependencies": {
47
53
  "upath": "^2.0.1"
48
54
  },
@@ -50,7 +56,7 @@
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",
59
+ "@types/node": "^22.19.1",
54
60
  "typescript": "^5.9.3"
55
61
  },
56
62
  "engines": {
@@ -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"