@arkyn/server 3.0.1-beta.148 → 3.0.1-beta.150

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.
Files changed (2) hide show
  1. package/generate-exports.ts +57 -0
  2. package/package.json +141 -2
@@ -0,0 +1,57 @@
1
+ import { resolve } from "node:path";
2
+ import Bun from "bun";
3
+
4
+ interface ExportEntry {
5
+ import: string;
6
+ types?: string;
7
+ }
8
+
9
+ interface PackageJson {
10
+ exports?: Record<string, ExportEntry>;
11
+ [key: string]: unknown;
12
+ }
13
+
14
+ const root = process.cwd();
15
+
16
+ const indexContent = await Bun.file(resolve(root, "src/index.ts")).text();
17
+
18
+ const packageJson = (await Bun.file(
19
+ resolve(root, "package.json"),
20
+ ).json()) as PackageJson;
21
+
22
+ const exportsMap: Record<string, ExportEntry> = {};
23
+
24
+ const regex =
25
+ /export\s+(?:\*|\{[\s\S]*?\}|type\s+\{[\s\S]*?\})\s+from\s+["'](.+)["']/g;
26
+
27
+ for (const match of indexContent.matchAll(regex)) {
28
+ let importPath = match[1];
29
+
30
+ if (!importPath.startsWith(".")) continue;
31
+
32
+ importPath = importPath.replace(/^\.\//, "");
33
+
34
+ const exportName = importPath.split("/").pop()!;
35
+
36
+ exportsMap[`./${exportName}`] = {
37
+ import: `./dist/${importPath}/index.js`,
38
+ types: `./dist/${importPath}/index.d.ts`,
39
+ };
40
+ }
41
+
42
+ packageJson.exports = {
43
+ ".": {
44
+ import: "./dist/bundle.js",
45
+ types: "./dist/index.d.ts",
46
+ },
47
+ ...Object.fromEntries(
48
+ Object.entries(exportsMap).sort(([a], [b]) => a.localeCompare(b)),
49
+ ),
50
+ };
51
+
52
+ await Bun.write(
53
+ resolve(root, "package.json"),
54
+ JSON.stringify(packageJson, null, 2) + "\n",
55
+ );
56
+
57
+ console.log(`Added ${Object.keys(exportsMap).length + 2} exports.`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkyn/server",
3
- "version": "3.0.1-beta.148",
3
+ "version": "3.0.1-beta.150",
4
4
  "author": "Arkyn | Lucas Gonçalves",
5
5
  "main": "./dist/bundle.js",
6
6
  "module": "./dist/bundle.js",
@@ -25,8 +25,147 @@
25
25
  "url": "git+https://github.com/Lucas-Eduardo-Goncalves/arkyn.git",
26
26
  "directory": "packages/server"
27
27
  },
28
+ "sideEffects": false,
29
+ "exports": {
30
+ ".": {
31
+ "import": "./dist/bundle.js",
32
+ "types": "./dist/index.d.ts"
33
+ },
34
+ "./apiService": {
35
+ "import": "./dist/services/apiService/index.js",
36
+ "types": "./dist/services/apiService/index.d.ts"
37
+ },
38
+ "./badGateway": {
39
+ "import": "./dist/http/badResponses/badGateway/index.js",
40
+ "types": "./dist/http/badResponses/badGateway/index.d.ts"
41
+ },
42
+ "./badRequest": {
43
+ "import": "./dist/http/badResponses/badRequest/index.js",
44
+ "types": "./dist/http/badResponses/badRequest/index.d.ts"
45
+ },
46
+ "./conflict": {
47
+ "import": "./dist/http/badResponses/conflict/index.js",
48
+ "types": "./dist/http/badResponses/conflict/index.d.ts"
49
+ },
50
+ "./created": {
51
+ "import": "./dist/http/successResponses/created/index.js",
52
+ "types": "./dist/http/successResponses/created/index.d.ts"
53
+ },
54
+ "./debugService": {
55
+ "import": "./dist/services/debugService/index.js",
56
+ "types": "./dist/services/debugService/index.d.ts"
57
+ },
58
+ "./decodeRequestBody": {
59
+ "import": "./dist/utilities/decodeRequestBody/index.js",
60
+ "types": "./dist/utilities/decodeRequestBody/index.d.ts"
61
+ },
62
+ "./decodeRequestErrorMessage": {
63
+ "import": "./dist/utilities/decodeRequestErrorMessage/index.js",
64
+ "types": "./dist/utilities/decodeRequestErrorMessage/index.d.ts"
65
+ },
66
+ "./errorHandler": {
67
+ "import": "./dist/utilities/errorHandler/index.js",
68
+ "types": "./dist/utilities/errorHandler/index.d.ts"
69
+ },
70
+ "./flushDebugLogs": {
71
+ "import": "./dist/utilities/flushDebugLogs/index.js",
72
+ "types": "./dist/utilities/flushDebugLogs/index.d.ts"
73
+ },
74
+ "./forbidden": {
75
+ "import": "./dist/http/badResponses/forbidden/index.js",
76
+ "types": "./dist/http/badResponses/forbidden/index.d.ts"
77
+ },
78
+ "./formAsyncParse": {
79
+ "import": "./dist/utilities/formAsyncParse/index.js",
80
+ "types": "./dist/utilities/formAsyncParse/index.d.ts"
81
+ },
82
+ "./formParse": {
83
+ "import": "./dist/utilities/formParse/index.js",
84
+ "types": "./dist/utilities/formParse/index.d.ts"
85
+ },
86
+ "./found": {
87
+ "import": "./dist/http/successResponses/found/index.js",
88
+ "types": "./dist/http/successResponses/found/index.d.ts"
89
+ },
90
+ "./getScopedParams": {
91
+ "import": "./dist/utilities/getScopedParams/index.js",
92
+ "types": "./dist/utilities/getScopedParams/index.d.ts"
93
+ },
94
+ "./logService": {
95
+ "import": "./dist/services/logService/index.js",
96
+ "types": "./dist/services/logService/index.d.ts"
97
+ },
98
+ "./noContent": {
99
+ "import": "./dist/http/successResponses/noContent/index.js",
100
+ "types": "./dist/http/successResponses/noContent/index.d.ts"
101
+ },
102
+ "./notFound": {
103
+ "import": "./dist/http/badResponses/notFound/index.js",
104
+ "types": "./dist/http/badResponses/notFound/index.d.ts"
105
+ },
106
+ "./notImplemented": {
107
+ "import": "./dist/http/badResponses/notImplemented/index.js",
108
+ "types": "./dist/http/badResponses/notImplemented/index.d.ts"
109
+ },
110
+ "./schemaValidator": {
111
+ "import": "./dist/utilities/schemaValidator/index.js",
112
+ "types": "./dist/utilities/schemaValidator/index.d.ts"
113
+ },
114
+ "./serverError": {
115
+ "import": "./dist/http/badResponses/serverError/index.js",
116
+ "types": "./dist/http/badResponses/serverError/index.d.ts"
117
+ },
118
+ "./success": {
119
+ "import": "./dist/http/successResponses/success/index.js",
120
+ "types": "./dist/http/successResponses/success/index.d.ts"
121
+ },
122
+ "./unauthorized": {
123
+ "import": "./dist/http/badResponses/unauthorized/index.js",
124
+ "types": "./dist/http/badResponses/unauthorized/index.d.ts"
125
+ },
126
+ "./unprocessableEntity": {
127
+ "import": "./dist/http/badResponses/unprocessableEntity/index.js",
128
+ "types": "./dist/http/badResponses/unprocessableEntity/index.d.ts"
129
+ },
130
+ "./updated": {
131
+ "import": "./dist/http/successResponses/updated/index.js",
132
+ "types": "./dist/http/successResponses/updated/index.d.ts"
133
+ },
134
+ "./validateCep": {
135
+ "import": "./dist/validations/validateCep/index.js",
136
+ "types": "./dist/validations/validateCep/index.d.ts"
137
+ },
138
+ "./validateCnpj": {
139
+ "import": "./dist/validations/validateCnpj/index.js",
140
+ "types": "./dist/validations/validateCnpj/index.d.ts"
141
+ },
142
+ "./validateCpf": {
143
+ "import": "./dist/validations/validateCpf/index.js",
144
+ "types": "./dist/validations/validateCpf/index.d.ts"
145
+ },
146
+ "./validateDate": {
147
+ "import": "./dist/validations/validateDate/index.js",
148
+ "types": "./dist/validations/validateDate/index.d.ts"
149
+ },
150
+ "./validateEmail": {
151
+ "import": "./dist/validations/validateEmail/index.js",
152
+ "types": "./dist/validations/validateEmail/index.d.ts"
153
+ },
154
+ "./validatePassword": {
155
+ "import": "./dist/validations/validatePassword/index.js",
156
+ "types": "./dist/validations/validatePassword/index.d.ts"
157
+ },
158
+ "./validatePhone": {
159
+ "import": "./dist/validations/validatePhone/index.js",
160
+ "types": "./dist/validations/validatePhone/index.d.ts"
161
+ },
162
+ "./validateRg": {
163
+ "import": "./dist/validations/validateRg/index.js",
164
+ "types": "./dist/validations/validateRg/index.d.ts"
165
+ }
166
+ },
28
167
  "scripts": {
29
- "build": "bunx vite build && tsc",
168
+ "build": "bunx vite build && tsc && bun ./generate-exports.ts",
30
169
  "test": "vitest --config vitest.config.ts",
31
170
  "typecheck": "bunx tsc --project tsconfig.json --noEmit"
32
171
  },