@stacksjs/server 0.58.72 → 0.59.1

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.
@@ -0,0 +1,12 @@
1
+ interface ServerOptions {
2
+ type?: 'frontend' | 'backend' | 'api' | 'library' | 'desktop' | 'docs' | 'email' | 'admin' | 'system-tray';
3
+ host?: string;
4
+ port?: number;
5
+ open?: boolean;
6
+ }
7
+ export declare function config(options: ServerOptions): {
8
+ host: string;
9
+ port: any;
10
+ open: boolean;
11
+ };
12
+ export {};
@@ -0,0 +1 @@
1
+ export { config as server } from './config';
package/dist/index.js CHANGED
@@ -1,37 +1,47 @@
1
+ // @bun
1
2
  // src/config.ts
2
- function config(options) {
3
+ import {ports} from "@stacksjs/config";
4
+ function config2(options) {
3
5
  const serversMap = {
4
6
  frontend: {
5
7
  host: "localhost",
6
- port: 3333
8
+ port: ports.frontend
9
+ },
10
+ backend: {
11
+ host: "localhost",
12
+ port: ports.backend
7
13
  },
8
14
  api: {
9
15
  host: "localhost",
10
- port: 3334
16
+ port: ports.api
11
17
  },
12
- dashboard: {
18
+ admin: {
13
19
  host: "localhost",
14
- port: 3335
20
+ port: ports.admin
15
21
  },
16
22
  library: {
17
23
  host: "localhost",
18
- port: 3336
24
+ port: ports.library
19
25
  },
20
26
  desktop: {
21
27
  host: "localhost",
22
- port: 3337
28
+ port: ports.desktop
23
29
  },
24
30
  docs: {
25
31
  host: "localhost",
26
- port: 3338
32
+ port: ports.docs
33
+ },
34
+ email: {
35
+ host: "localhost",
36
+ port: ports.email
27
37
  },
28
- example: {
38
+ inspect: {
29
39
  host: "localhost",
30
- port: 3339
40
+ port: ports.inspect
31
41
  },
32
42
  "system-tray": {
33
43
  host: "localhost",
34
- port: 3340
44
+ port: ports.systemTray
35
45
  }
36
46
  };
37
47
  if (options.type && ["frontend", "api", "library", "desktop", "docs", "example", "dashboard", "system-tray"].includes(options.type)) {
@@ -43,10 +53,10 @@ function config(options) {
43
53
  }
44
54
  return {
45
55
  host: options.host || "stacks.localhost",
46
- port: options.port || 3333,
56
+ port: options.port || 3000,
47
57
  open: options.open || false
48
58
  };
49
59
  }
50
60
  export {
51
- config as server
61
+ config2 as server
52
62
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/server",
3
3
  "type": "module",
4
- "version": "0.58.72",
4
+ "version": "0.59.1",
5
5
  "description": "Local development and production-ready.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
@@ -60,7 +60,7 @@
60
60
  "@stacksjs/path": "latest",
61
61
  "@stacksjs/router": "latest",
62
62
  "@stacksjs/validation": "latest",
63
- "vite": "^5.1.3"
63
+ "vite": "^5.1.5"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@stacksjs/development": "latest"
package/src/config.ts CHANGED
@@ -1,5 +1,7 @@
1
+ import { ports } from '@stacksjs/config'
2
+
1
3
  interface ServerOptions {
2
- type?: 'frontend' | 'api' | 'library' | 'desktop' | 'docs' | 'example' | 'dashboard' | 'system-tray'
4
+ type?: 'frontend' | 'backend' | 'api' | 'library' | 'desktop' | 'docs' | 'email' | 'admin' | 'system-tray'
3
5
  host?: string
4
6
  port?: number
5
7
  open?: boolean
@@ -9,42 +11,52 @@ export function config(options: ServerOptions) {
9
11
  const serversMap = {
10
12
  'frontend': {
11
13
  host: 'localhost',
12
- port: 3333,
14
+ port: ports.frontend,
15
+ },
16
+
17
+ 'backend': {
18
+ host: 'localhost',
19
+ port: ports.backend,
13
20
  },
14
21
 
15
22
  'api': {
16
23
  host: 'localhost',
17
- port: 3334,
24
+ port: ports.api,
18
25
  },
19
26
 
20
- 'dashboard': {
27
+ 'admin': {
21
28
  host: 'localhost',
22
- port: 3335,
29
+ port: ports.admin,
23
30
  },
24
31
 
25
32
  'library': { // component library
26
33
  host: 'localhost',
27
- port: 3336,
34
+ port: ports.library,
28
35
  },
29
36
 
30
37
  'desktop': {
31
38
  host: 'localhost',
32
- port: 3337,
39
+ port: ports.desktop,
33
40
  },
34
41
 
35
42
  'docs': {
36
43
  host: 'localhost',
37
- port: 3338,
44
+ port: ports.docs,
45
+ },
46
+
47
+ 'email': {
48
+ host: 'localhost',
49
+ port: ports.email,
38
50
  },
39
51
 
40
- 'example': {
52
+ 'inspect': {
41
53
  host: 'localhost',
42
- port: 3339,
54
+ port: ports.inspect,
43
55
  },
44
56
 
45
57
  'system-tray': {
46
58
  host: 'localhost',
47
- port: 3340,
59
+ port: ports.systemTray,
48
60
  },
49
61
  }
50
62
 
@@ -58,7 +70,7 @@ export function config(options: ServerOptions) {
58
70
 
59
71
  return {
60
72
  host: options.host || 'stacks.localhost',
61
- port: options.port || 3333,
73
+ port: options.port || 3000,
62
74
  open: options.open || false,
63
75
  }
64
76
  }