@guren/server 0.2.0-alpha.7 → 1.0.0-rc.9

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 (54) hide show
  1. package/dist/Application-DtWDHXr1.d.ts +2110 -0
  2. package/dist/BroadcastManager-AkIWUGJo.d.ts +466 -0
  3. package/dist/CacheManager-BkvHEOZX.d.ts +244 -0
  4. package/dist/ConsoleKernel-CqCVrdZs.d.ts +207 -0
  5. package/dist/EventManager-CmIoLt7r.d.ts +207 -0
  6. package/dist/Gate-CNkBYf8m.d.ts +268 -0
  7. package/dist/HealthManager-DUyMIzsZ.d.ts +141 -0
  8. package/dist/I18nManager-Dtgzsf5n.d.ts +270 -0
  9. package/dist/LogManager-7mxnkaPM.d.ts +256 -0
  10. package/dist/MailManager-DpMvYiP9.d.ts +292 -0
  11. package/dist/Scheduler-BstvSca7.d.ts +469 -0
  12. package/dist/StorageManager-oZTHqaza.d.ts +337 -0
  13. package/dist/api-token-JOif2CtG.d.ts +1792 -0
  14. package/dist/app-key-CsBfRC_Q.d.ts +214 -0
  15. package/dist/auth/index.d.ts +418 -0
  16. package/dist/auth/index.js +6742 -0
  17. package/dist/authorization/index.d.ts +129 -0
  18. package/dist/authorization/index.js +621 -0
  19. package/dist/broadcasting/index.d.ts +233 -0
  20. package/dist/broadcasting/index.js +907 -0
  21. package/dist/cache/index.d.ts +233 -0
  22. package/dist/cache/index.js +817 -0
  23. package/dist/encryption/index.d.ts +222 -0
  24. package/dist/encryption/index.js +602 -0
  25. package/dist/events/index.d.ts +155 -0
  26. package/dist/events/index.js +330 -0
  27. package/dist/health/index.d.ts +185 -0
  28. package/dist/health/index.js +379 -0
  29. package/dist/i18n/index.d.ts +101 -0
  30. package/dist/i18n/index.js +597 -0
  31. package/dist/index-9_Jzj5jo.d.ts +7 -0
  32. package/dist/index.d.ts +2628 -619
  33. package/dist/index.js +22229 -3116
  34. package/dist/lambda/index.d.ts +156 -0
  35. package/dist/lambda/index.js +91 -0
  36. package/dist/logging/index.d.ts +50 -0
  37. package/dist/logging/index.js +557 -0
  38. package/dist/mail/index.d.ts +288 -0
  39. package/dist/mail/index.js +695 -0
  40. package/dist/mcp/index.d.ts +139 -0
  41. package/dist/mcp/index.js +382 -0
  42. package/dist/notifications/index.d.ts +271 -0
  43. package/dist/notifications/index.js +741 -0
  44. package/dist/queue/index.d.ts +423 -0
  45. package/dist/queue/index.js +958 -0
  46. package/dist/runtime/index.d.ts +93 -0
  47. package/dist/runtime/index.js +834 -0
  48. package/dist/scheduling/index.d.ts +41 -0
  49. package/dist/scheduling/index.js +836 -0
  50. package/dist/storage/index.d.ts +196 -0
  51. package/dist/storage/index.js +832 -0
  52. package/dist/vite/index.js +203 -3
  53. package/package.json +93 -6
  54. package/dist/chunk-FK2XQSBF.js +0 -160
@@ -1,6 +1,206 @@
1
- import {
2
- gurenVitePlugin
3
- } from "../chunk-FK2XQSBF.js";
1
+ // src/vite/plugin.ts
2
+ import path from "path";
3
+ var defaultOptions = {
4
+ appAlias: "@",
5
+ appDir: "app",
6
+ resourcesAlias: "@resources",
7
+ resourcesDir: "resources/js",
8
+ entry: "resources/js/app.tsx",
9
+ ssrEntry: "resources/js/ssr.tsx",
10
+ outDir: "public/assets",
11
+ ssrOutDir: ".guren/ssr",
12
+ devPort: 5173,
13
+ previewPort: 4173,
14
+ entryFileNames: "[name]-[hash].js",
15
+ chunkFileNames: "[name]-[hash].js",
16
+ assetFileNames: "[name]-[hash][extname]"
17
+ };
18
+ function gurenVitePlugin(options = {}) {
19
+ const resolved = { ...defaultOptions, ...options };
20
+ return {
21
+ name: "guren:vite-config",
22
+ enforce: "pre",
23
+ config(config, env) {
24
+ ensureDefaults(config, resolved, env);
25
+ }
26
+ };
27
+ }
28
+ function ensureDefaults(config, options, env) {
29
+ const root = resolveRoot(config.root);
30
+ ensureAliases(config, options, root);
31
+ ensureServer(config, options);
32
+ ensurePreview(config, options);
33
+ ensureBuild(config, options, root, env);
34
+ }
35
+ function ensureAliases(config, options, root) {
36
+ config.resolve ??= {};
37
+ const alias = toAliasArray(config.resolve.alias);
38
+ maybePushAlias(alias, options.appAlias, path.resolve(root, options.appDir));
39
+ maybePushAlias(alias, options.resourcesAlias, path.resolve(root, options.resourcesDir));
40
+ config.resolve.alias = alias;
41
+ }
42
+ function ensureServer(config, options) {
43
+ config.server ??= {};
44
+ if (config.server.host === void 0) {
45
+ config.server.host = true;
46
+ }
47
+ if (config.server.port === void 0) {
48
+ config.server.port = options.devPort;
49
+ }
50
+ }
51
+ function ensurePreview(config, options) {
52
+ config.preview ??= {};
53
+ if (config.preview.host === void 0) {
54
+ config.preview.host = true;
55
+ }
56
+ if (config.preview.port === void 0) {
57
+ config.preview.port = options.previewPort;
58
+ }
59
+ }
60
+ function ensureBuild(config, options, root, env) {
61
+ config.build ??= {};
62
+ const isSsrBuild = Boolean(env?.ssrBuild ?? env?.isSsrBuild);
63
+ const isServeCommand = env?.command === "serve";
64
+ if (config.build.emptyOutDir === void 0) {
65
+ config.build.emptyOutDir = true;
66
+ }
67
+ if (isSsrBuild) {
68
+ if (config.build.outDir === void 0) {
69
+ config.build.outDir = options.ssrOutDir;
70
+ }
71
+ if (config.build.manifest === void 0) {
72
+ config.build.manifest = true;
73
+ }
74
+ if (config.build.ssr === void 0) {
75
+ config.build.ssr = path.resolve(root, options.ssrEntry);
76
+ }
77
+ config.build.rollupOptions ??= {};
78
+ config.build.rollupOptions.input = path.resolve(root, options.ssrEntry);
79
+ } else {
80
+ if (config.build.outDir === void 0) {
81
+ config.build.outDir = options.outDir;
82
+ }
83
+ if (config.build.manifest === void 0) {
84
+ config.build.manifest = true;
85
+ }
86
+ if (config.build.ssrManifest === void 0) {
87
+ config.build.ssrManifest = true;
88
+ }
89
+ if (!isServeCommand && config.base === void 0) {
90
+ const derivedBase = deriveHttpBaseFromOutDir(options.outDir);
91
+ if (derivedBase) {
92
+ config.base = derivedBase;
93
+ }
94
+ }
95
+ const buildOutDir = resolveBuildOutputDirectory(root, config.build.outDir);
96
+ const rootPublicDir = path.resolve(root, "public");
97
+ if (buildOutDir.startsWith(rootPublicDir)) {
98
+ if (config.build.copyPublicDir === void 0) {
99
+ config.build.copyPublicDir = false;
100
+ }
101
+ if (config.publicDir === void 0) {
102
+ config.publicDir = false;
103
+ }
104
+ }
105
+ }
106
+ config.build.rollupOptions ??= {};
107
+ if (!isSsrBuild && config.build.rollupOptions.input === void 0) {
108
+ config.build.rollupOptions.input = path.resolve(root, options.entry);
109
+ }
110
+ const output = normalizeRollupOutput(config.build.rollupOptions.output);
111
+ if (output.entryFileNames === void 0) {
112
+ output.entryFileNames = options.entryFileNames;
113
+ }
114
+ if (output.chunkFileNames === void 0) {
115
+ output.chunkFileNames = options.chunkFileNames;
116
+ }
117
+ if (output.assetFileNames === void 0) {
118
+ output.assetFileNames = options.assetFileNames;
119
+ }
120
+ if (!isSsrBuild && output.manualChunks === void 0) {
121
+ output.manualChunks = createDefaultManualChunks(root);
122
+ }
123
+ config.build.rollupOptions.output = output;
124
+ }
125
+ function createDefaultManualChunks(root) {
126
+ const normalizedRoot = root.replace(/\\/gu, "/");
127
+ return (id) => {
128
+ const normalizedId = id.replace(/\\/gu, "/");
129
+ if (normalizedId.includes("/packages/inertia-client/")) {
130
+ return "inertia-vendor";
131
+ }
132
+ if (normalizedId.includes("/packages/core/") || normalizedId.includes("/packages/server/") || normalizedId.includes("/packages/orm/")) {
133
+ return "framework-vendor";
134
+ }
135
+ if (!normalizedId.includes("/node_modules/")) {
136
+ if (normalizedId.startsWith(normalizedRoot)) {
137
+ return void 0;
138
+ }
139
+ if (normalizedId.includes("/packages/")) {
140
+ return "framework-vendor";
141
+ }
142
+ return void 0;
143
+ }
144
+ if (/[\\/]node_modules[\\/](react|react-dom|scheduler)[\\/]/u.test(normalizedId)) {
145
+ return "react-vendor";
146
+ }
147
+ if (/[\\/]node_modules[\\/]@inertiajs[\\/]/u.test(normalizedId) || /[\\/]node_modules[\\/](axios|qs|lodash-es|lodash)[\\/]/u.test(normalizedId)) {
148
+ return "inertia-vendor";
149
+ }
150
+ if (/[\\/]node_modules[\\/](@guren|hono)[\\/]/u.test(normalizedId)) {
151
+ return "framework-vendor";
152
+ }
153
+ return "vendor";
154
+ };
155
+ }
156
+ function resolveBuildOutputDirectory(root, outDir) {
157
+ return path.isAbsolute(outDir) ? outDir : path.resolve(root, outDir);
158
+ }
159
+ function deriveHttpBaseFromOutDir(outDir) {
160
+ const normalized = outDir.replace(/\\/gu, "/").replace(/^\.\//u, "");
161
+ if (normalized === "public") {
162
+ return "/public/";
163
+ }
164
+ if (normalized.startsWith("public/")) {
165
+ const remainder = normalized.slice("public/".length);
166
+ const suffix = remainder.length > 0 ? `${remainder.replace(/\/$/u, "")}/` : "";
167
+ return `/public/${suffix}`;
168
+ }
169
+ return void 0;
170
+ }
171
+ function resolveRoot(root) {
172
+ if (!root) {
173
+ return process.cwd();
174
+ }
175
+ return path.isAbsolute(root) ? root : path.resolve(process.cwd(), root);
176
+ }
177
+ function toAliasArray(alias) {
178
+ if (Array.isArray(alias)) {
179
+ return alias.slice();
180
+ }
181
+ if (alias && typeof alias === "object") {
182
+ return Object.entries(alias).map(([find, replacement]) => ({
183
+ find,
184
+ replacement
185
+ }));
186
+ }
187
+ return [];
188
+ }
189
+ function maybePushAlias(alias, find, replacement) {
190
+ const alreadyDefined = alias.some((entry) => entry.find === find);
191
+ if (!alreadyDefined) {
192
+ alias.push({ find, replacement });
193
+ }
194
+ }
195
+ function normalizeRollupOutput(output) {
196
+ if (Array.isArray(output)) {
197
+ if (output.length === 0) {
198
+ return {};
199
+ }
200
+ return output[0];
201
+ }
202
+ return output ?? {};
203
+ }
4
204
  export {
5
205
  gurenVitePlugin as default,
6
206
  gurenVitePlugin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guren/server",
3
- "version": "0.2.0-alpha.7",
3
+ "version": "1.0.0-rc.9",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -25,31 +25,118 @@
25
25
  "types": "./dist/index.d.ts",
26
26
  "default": "./dist/index.js"
27
27
  },
28
+ "./auth": {
29
+ "types": "./dist/auth/index.d.ts",
30
+ "default": "./dist/auth/index.js"
31
+ },
32
+ "./authorization": {
33
+ "types": "./dist/authorization/index.d.ts",
34
+ "default": "./dist/authorization/index.js"
35
+ },
36
+ "./broadcasting": {
37
+ "types": "./dist/broadcasting/index.d.ts",
38
+ "default": "./dist/broadcasting/index.js"
39
+ },
40
+ "./cache": {
41
+ "types": "./dist/cache/index.d.ts",
42
+ "default": "./dist/cache/index.js"
43
+ },
44
+ "./encryption": {
45
+ "types": "./dist/encryption/index.d.ts",
46
+ "default": "./dist/encryption/index.js"
47
+ },
48
+ "./events": {
49
+ "types": "./dist/events/index.d.ts",
50
+ "default": "./dist/events/index.js"
51
+ },
52
+ "./health": {
53
+ "types": "./dist/health/index.d.ts",
54
+ "default": "./dist/health/index.js"
55
+ },
56
+ "./i18n": {
57
+ "types": "./dist/i18n/index.d.ts",
58
+ "default": "./dist/i18n/index.js"
59
+ },
60
+ "./logging": {
61
+ "types": "./dist/logging/index.d.ts",
62
+ "default": "./dist/logging/index.js"
63
+ },
64
+ "./mail": {
65
+ "types": "./dist/mail/index.d.ts",
66
+ "default": "./dist/mail/index.js"
67
+ },
68
+ "./notifications": {
69
+ "types": "./dist/notifications/index.d.ts",
70
+ "default": "./dist/notifications/index.js"
71
+ },
72
+ "./queue": {
73
+ "types": "./dist/queue/index.d.ts",
74
+ "default": "./dist/queue/index.js"
75
+ },
76
+ "./runtime": {
77
+ "types": "./dist/runtime/index.d.ts",
78
+ "default": "./dist/runtime/index.js"
79
+ },
80
+ "./scheduling": {
81
+ "types": "./dist/scheduling/index.d.ts",
82
+ "default": "./dist/scheduling/index.js"
83
+ },
84
+ "./storage": {
85
+ "types": "./dist/storage/index.d.ts",
86
+ "default": "./dist/storage/index.js"
87
+ },
28
88
  "./vite": {
29
89
  "types": "./dist/vite/index.d.ts",
30
90
  "default": "./dist/vite/index.js"
91
+ },
92
+ "./mcp": {
93
+ "types": "./dist/mcp/index.d.ts",
94
+ "default": "./dist/mcp/index.js"
95
+ },
96
+ "./lambda": {
97
+ "types": "./dist/lambda/index.d.ts",
98
+ "default": "./dist/lambda/index.js"
31
99
  }
32
100
  },
33
101
  "scripts": {
34
- "build": "tsup",
102
+ "build": "NODE_OPTIONS='--max-old-space-size=8192' tsup",
35
103
  "dev": "bun --watch src/index.ts",
36
104
  "typecheck": "tsc --noEmit",
37
105
  "test": "bun test"
38
106
  },
39
107
  "dependencies": {
40
- "@guren/inertia-client": "^0.2.0-alpha.7",
108
+ "@guren/inertia-client": "^1.0.0-rc.9",
109
+ "@modelcontextprotocol/sdk": "^1.27.1",
41
110
  "chalk": "^5.3.0",
42
111
  "consola": "^3.4.2",
43
112
  "figlet": "^1.7.0",
44
- "hono": "^4.4.0"
113
+ "hono": "^4.12.8",
114
+ "ioredis": "^5.9.1",
115
+ "nodemailer": "^7.0.12"
45
116
  },
46
117
  "peerDependencies": {
118
+ "@aws-sdk/client-s3": "^3.0.0",
119
+ "@aws-sdk/client-sqs": "^3.0.0",
120
+ "@aws-sdk/s3-request-presigner": "^3.0.0",
47
121
  "vite": ">=7.0.0"
48
122
  },
123
+ "peerDependenciesMeta": {
124
+ "@aws-sdk/client-s3": {
125
+ "optional": true
126
+ },
127
+ "@aws-sdk/client-sqs": {
128
+ "optional": true
129
+ },
130
+ "@aws-sdk/s3-request-presigner": {
131
+ "optional": true
132
+ }
133
+ },
49
134
  "devDependencies": {
135
+ "@types/ioredis": "^5.0.0",
50
136
  "@types/node": "^20.14.10",
51
- "vite": "^7.0.0",
137
+ "@types/nodemailer": "^7.0.5",
52
138
  "tsup": "^8.5.0",
53
- "typescript": "^5.4.0"
139
+ "typescript": "^5.4.0",
140
+ "vite": "^8.0.0"
54
141
  }
55
142
  }
@@ -1,160 +0,0 @@
1
- // src/vite/plugin.ts
2
- import path from "path";
3
- var defaultOptions = {
4
- appAlias: "@",
5
- appDir: "app",
6
- resourcesAlias: "@resources",
7
- resourcesDir: "resources/js",
8
- entry: "resources/js/app.tsx",
9
- ssrEntry: "resources/js/ssr.tsx",
10
- outDir: "public/assets",
11
- ssrOutDir: ".guren/ssr",
12
- devPort: 5173,
13
- previewPort: 4173,
14
- entryFileNames: "[name]-[hash].js",
15
- chunkFileNames: "[name]-[hash].js",
16
- assetFileNames: "[name]-[hash][extname]"
17
- };
18
- function gurenVitePlugin(options = {}) {
19
- const resolved = { ...defaultOptions, ...options };
20
- return {
21
- name: "guren:vite-config",
22
- enforce: "pre",
23
- config(config, env) {
24
- ensureDefaults(config, resolved, env);
25
- }
26
- };
27
- }
28
- function ensureDefaults(config, options, env) {
29
- const root = resolveRoot(config.root);
30
- ensureAliases(config, options, root);
31
- ensureServer(config, options);
32
- ensurePreview(config, options);
33
- ensureBuild(config, options, root, env);
34
- }
35
- function ensureAliases(config, options, root) {
36
- config.resolve ??= {};
37
- const alias = toAliasArray(config.resolve.alias);
38
- maybePushAlias(alias, options.appAlias, path.resolve(root, options.appDir));
39
- maybePushAlias(alias, options.resourcesAlias, path.resolve(root, options.resourcesDir));
40
- config.resolve.alias = alias;
41
- }
42
- function ensureServer(config, options) {
43
- config.server ??= {};
44
- if (config.server.host === void 0) {
45
- config.server.host = true;
46
- }
47
- if (config.server.port === void 0) {
48
- config.server.port = options.devPort;
49
- }
50
- }
51
- function ensurePreview(config, options) {
52
- config.preview ??= {};
53
- if (config.preview.host === void 0) {
54
- config.preview.host = true;
55
- }
56
- if (config.preview.port === void 0) {
57
- config.preview.port = options.previewPort;
58
- }
59
- }
60
- function ensureBuild(config, options, root, env) {
61
- config.build ??= {};
62
- const isSsrBuild = Boolean(env?.ssrBuild ?? env?.isSsrBuild);
63
- const isServeCommand = env?.command === "serve";
64
- if (config.build.emptyOutDir === void 0) {
65
- config.build.emptyOutDir = true;
66
- }
67
- if (isSsrBuild) {
68
- if (config.build.outDir === void 0) {
69
- config.build.outDir = options.ssrOutDir;
70
- }
71
- if (config.build.manifest === void 0) {
72
- config.build.manifest = true;
73
- }
74
- if (config.build.ssr === void 0) {
75
- config.build.ssr = path.resolve(root, options.ssrEntry);
76
- }
77
- config.build.rollupOptions ??= {};
78
- config.build.rollupOptions.input = path.resolve(root, options.ssrEntry);
79
- } else {
80
- if (config.build.outDir === void 0) {
81
- config.build.outDir = options.outDir;
82
- }
83
- if (config.build.manifest === void 0) {
84
- config.build.manifest = true;
85
- }
86
- if (config.build.ssrManifest === void 0) {
87
- config.build.ssrManifest = true;
88
- }
89
- if (!isServeCommand && config.base === void 0) {
90
- const derivedBase = deriveHttpBaseFromOutDir(options.outDir);
91
- if (derivedBase) {
92
- config.base = derivedBase;
93
- }
94
- }
95
- }
96
- config.build.rollupOptions ??= {};
97
- if (!isSsrBuild && config.build.rollupOptions.input === void 0) {
98
- config.build.rollupOptions.input = path.resolve(root, options.entry);
99
- }
100
- const output = normalizeRollupOutput(config.build.rollupOptions.output);
101
- if (output.entryFileNames === void 0) {
102
- output.entryFileNames = options.entryFileNames;
103
- }
104
- if (output.chunkFileNames === void 0) {
105
- output.chunkFileNames = options.chunkFileNames;
106
- }
107
- if (output.assetFileNames === void 0) {
108
- output.assetFileNames = options.assetFileNames;
109
- }
110
- config.build.rollupOptions.output = output;
111
- }
112
- function deriveHttpBaseFromOutDir(outDir) {
113
- const normalized = outDir.replace(/\\/gu, "/").replace(/^\.\//u, "");
114
- if (normalized === "public") {
115
- return "/public/";
116
- }
117
- if (normalized.startsWith("public/")) {
118
- const remainder = normalized.slice("public/".length);
119
- const suffix = remainder.length > 0 ? `${remainder.replace(/\/$/u, "")}/` : "";
120
- return `/public/${suffix}`;
121
- }
122
- return void 0;
123
- }
124
- function resolveRoot(root) {
125
- if (!root) {
126
- return process.cwd();
127
- }
128
- return path.isAbsolute(root) ? root : path.resolve(process.cwd(), root);
129
- }
130
- function toAliasArray(alias) {
131
- if (Array.isArray(alias)) {
132
- return alias.slice();
133
- }
134
- if (alias && typeof alias === "object") {
135
- return Object.entries(alias).map(([find, replacement]) => ({
136
- find,
137
- replacement
138
- }));
139
- }
140
- return [];
141
- }
142
- function maybePushAlias(alias, find, replacement) {
143
- const alreadyDefined = alias.some((entry) => entry.find === find);
144
- if (!alreadyDefined) {
145
- alias.push({ find, replacement });
146
- }
147
- }
148
- function normalizeRollupOutput(output) {
149
- if (Array.isArray(output)) {
150
- if (output.length === 0) {
151
- return {};
152
- }
153
- return output[0];
154
- }
155
- return output ?? {};
156
- }
157
-
158
- export {
159
- gurenVitePlugin
160
- };