@bagelink/workspace 1.7.69 → 1.7.72

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/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { W as WorkspaceEnvironment, a as WorkspaceConfig } from './shared/workspace.D1xukL92.cjs';
2
- export { P as ProxyConfig, b as WorkspaceOptions } from './shared/workspace.D1xukL92.cjs';
1
+ import { W as WorkspaceEnvironment, a as WorkspaceConfig } from './shared/workspace.-kRoU6TC.cjs';
2
+ export { P as ProxyConfig, b as WorkspaceOptions } from './shared/workspace.-kRoU6TC.cjs';
3
3
  export { RuntimeWorkspaceConfig, getApiUrl, useWorkspace } from './composable.cjs';
4
4
 
5
5
  /**
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { W as WorkspaceEnvironment, a as WorkspaceConfig } from './shared/workspace.D1xukL92.mjs';
2
- export { P as ProxyConfig, b as WorkspaceOptions } from './shared/workspace.D1xukL92.mjs';
1
+ import { W as WorkspaceEnvironment, a as WorkspaceConfig } from './shared/workspace.-kRoU6TC.mjs';
2
+ export { P as ProxyConfig, b as WorkspaceOptions } from './shared/workspace.-kRoU6TC.mjs';
3
3
  export { RuntimeWorkspaceConfig, getApiUrl, useWorkspace } from './composable.mjs';
4
4
 
5
5
  /**
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { W as WorkspaceEnvironment, a as WorkspaceConfig } from './shared/workspace.D1xukL92.js';
2
- export { P as ProxyConfig, b as WorkspaceOptions } from './shared/workspace.D1xukL92.js';
1
+ import { W as WorkspaceEnvironment, a as WorkspaceConfig } from './shared/workspace.-kRoU6TC.js';
2
+ export { P as ProxyConfig, b as WorkspaceOptions } from './shared/workspace.-kRoU6TC.js';
3
3
  export { RuntimeWorkspaceConfig, getApiUrl, useWorkspace } from './composable.js';
4
4
 
5
5
  /**
@@ -38,6 +38,8 @@ interface ProxyConfig {
38
38
  changeOrigin: boolean;
39
39
  rewrite?: (path: string) => string;
40
40
  secure: boolean;
41
+ ws?: boolean;
42
+ configure?: (proxy: any, options: any) => void;
41
43
  };
42
44
  }
43
45
 
@@ -38,6 +38,8 @@ interface ProxyConfig {
38
38
  changeOrigin: boolean;
39
39
  rewrite?: (path: string) => string;
40
40
  secure: boolean;
41
+ ws?: boolean;
42
+ configure?: (proxy: any, options: any) => void;
41
43
  };
42
44
  }
43
45
 
@@ -38,6 +38,8 @@ interface ProxyConfig {
38
38
  changeOrigin: boolean;
39
39
  rewrite?: (path: string) => string;
40
40
  secure: boolean;
41
+ ws?: boolean;
42
+ configure?: (proxy: any, options: any) => void;
41
43
  };
42
44
  }
43
45
 
package/dist/vite.cjs CHANGED
@@ -17,14 +17,26 @@ function createViteProxy(config) {
17
17
  target: config.host,
18
18
  changeOrigin: true,
19
19
  rewrite: (path) => path.replace(new RegExp(`^${config.proxy}`), ""),
20
- secure: true
20
+ secure: false,
21
+ ws: true,
22
+ configure: (proxy2, _options) => {
23
+ proxy2.on("proxyReq", (proxyReq, req, _res) => {
24
+ if (req.headers.origin) {
25
+ proxyReq.setHeader("origin", config.host);
26
+ }
27
+ });
28
+ proxy2.on("error", (err, _req, _res) => {
29
+ console.log("proxy error", err);
30
+ });
31
+ }
21
32
  };
22
33
  }
23
34
  if (config.host) {
24
35
  proxy["/files"] = {
25
36
  target: config.host,
26
37
  changeOrigin: true,
27
- secure: true
38
+ secure: false,
39
+ ws: true
28
40
  };
29
41
  }
30
42
  return proxy;
@@ -35,7 +47,8 @@ function createCustomProxy(paths, target, options = {}) {
35
47
  proxy[path] = {
36
48
  target,
37
49
  changeOrigin: options.changeOrigin ?? true,
38
- secure: options.secure ?? true,
50
+ secure: options.secure ?? false,
51
+ ws: options.ws ?? true,
39
52
  ...options.rewrite === true && {
40
53
  rewrite: (p) => p.replace(new RegExp(`^${path}`), "")
41
54
  }
package/dist/vite.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Plugin } from 'vite';
2
- import { a as WorkspaceConfig, P as ProxyConfig, W as WorkspaceEnvironment } from './shared/workspace.D1xukL92.cjs';
2
+ import { a as WorkspaceConfig, P as ProxyConfig, W as WorkspaceEnvironment } from './shared/workspace.-kRoU6TC.cjs';
3
3
 
4
4
  /**
5
5
  * Generate complete netlify.toml file
@@ -25,6 +25,7 @@ declare function createCustomProxy(paths: string[], target: string, options?: {
25
25
  changeOrigin?: boolean;
26
26
  rewrite?: boolean;
27
27
  secure?: boolean;
28
+ ws?: boolean;
28
29
  }): ProxyConfig;
29
30
 
30
31
  interface BagelinkPluginOptions {
package/dist/vite.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Plugin } from 'vite';
2
- import { a as WorkspaceConfig, P as ProxyConfig, W as WorkspaceEnvironment } from './shared/workspace.D1xukL92.mjs';
2
+ import { a as WorkspaceConfig, P as ProxyConfig, W as WorkspaceEnvironment } from './shared/workspace.-kRoU6TC.mjs';
3
3
 
4
4
  /**
5
5
  * Generate complete netlify.toml file
@@ -25,6 +25,7 @@ declare function createCustomProxy(paths: string[], target: string, options?: {
25
25
  changeOrigin?: boolean;
26
26
  rewrite?: boolean;
27
27
  secure?: boolean;
28
+ ws?: boolean;
28
29
  }): ProxyConfig;
29
30
 
30
31
  interface BagelinkPluginOptions {
package/dist/vite.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Plugin } from 'vite';
2
- import { a as WorkspaceConfig, P as ProxyConfig, W as WorkspaceEnvironment } from './shared/workspace.D1xukL92.js';
2
+ import { a as WorkspaceConfig, P as ProxyConfig, W as WorkspaceEnvironment } from './shared/workspace.-kRoU6TC.js';
3
3
 
4
4
  /**
5
5
  * Generate complete netlify.toml file
@@ -25,6 +25,7 @@ declare function createCustomProxy(paths: string[], target: string, options?: {
25
25
  changeOrigin?: boolean;
26
26
  rewrite?: boolean;
27
27
  secure?: boolean;
28
+ ws?: boolean;
28
29
  }): ProxyConfig;
29
30
 
30
31
  interface BagelinkPluginOptions {
package/dist/vite.mjs CHANGED
@@ -11,14 +11,26 @@ function createViteProxy(config) {
11
11
  target: config.host,
12
12
  changeOrigin: true,
13
13
  rewrite: (path) => path.replace(new RegExp(`^${config.proxy}`), ""),
14
- secure: true
14
+ secure: false,
15
+ ws: true,
16
+ configure: (proxy2, _options) => {
17
+ proxy2.on("proxyReq", (proxyReq, req, _res) => {
18
+ if (req.headers.origin) {
19
+ proxyReq.setHeader("origin", config.host);
20
+ }
21
+ });
22
+ proxy2.on("error", (err, _req, _res) => {
23
+ console.log("proxy error", err);
24
+ });
25
+ }
15
26
  };
16
27
  }
17
28
  if (config.host) {
18
29
  proxy["/files"] = {
19
30
  target: config.host,
20
31
  changeOrigin: true,
21
- secure: true
32
+ secure: false,
33
+ ws: true
22
34
  };
23
35
  }
24
36
  return proxy;
@@ -29,7 +41,8 @@ function createCustomProxy(paths, target, options = {}) {
29
41
  proxy[path] = {
30
42
  target,
31
43
  changeOrigin: options.changeOrigin ?? true,
32
- secure: options.secure ?? true,
44
+ secure: options.secure ?? false,
45
+ ws: options.ws ?? true,
33
46
  ...options.rewrite === true && {
34
47
  rewrite: (p) => p.replace(new RegExp(`^${path}`), "")
35
48
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/workspace",
3
3
  "type": "module",
4
- "version": "1.7.69",
4
+ "version": "1.7.72",
5
5
  "description": "Monorepo workspace tooling for Bagel projects with proxy and config management",
6
6
  "author": {
7
7
  "name": "Bagel Studio",
package/src/proxy.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { IncomingMessage, ServerResponse, ClientRequest } from 'node:http'
1
2
  import type { WorkspaceConfig, ProxyConfig } from './types'
2
3
 
3
4
  /**
@@ -12,7 +13,19 @@ export function createViteProxy(config: WorkspaceConfig): ProxyConfig {
12
13
  target: config.host,
13
14
  changeOrigin: true,
14
15
  rewrite: (path: string) => path.replace(new RegExp(`^${config.proxy}`), ''),
15
- secure: true,
16
+ secure: false,
17
+ ws: true,
18
+ configure: (proxy: any, _options: any) => {
19
+ proxy.on('proxyReq', (proxyReq: ClientRequest, req: IncomingMessage, _res: ServerResponse) => {
20
+ // Ensure proper headers are forwarded
21
+ if (req.headers.origin) {
22
+ proxyReq.setHeader('origin', config.host)
23
+ }
24
+ })
25
+ proxy.on('error', (err: Error, _req: IncomingMessage, _res: ServerResponse) => {
26
+ console.log('proxy error', err)
27
+ })
28
+ },
16
29
  }
17
30
  }
18
31
 
@@ -21,7 +34,8 @@ export function createViteProxy(config: WorkspaceConfig): ProxyConfig {
21
34
  proxy['/files'] = {
22
35
  target: config.host,
23
36
  changeOrigin: true,
24
- secure: true,
37
+ secure: false,
38
+ ws: true,
25
39
  }
26
40
  }
27
41
 
@@ -38,6 +52,7 @@ export function createCustomProxy(
38
52
  changeOrigin?: boolean
39
53
  rewrite?: boolean
40
54
  secure?: boolean
55
+ ws?: boolean
41
56
  } = {}
42
57
  ): ProxyConfig {
43
58
  const proxy: ProxyConfig = {}
@@ -46,7 +61,8 @@ export function createCustomProxy(
46
61
  proxy[path] = {
47
62
  target,
48
63
  changeOrigin: options.changeOrigin ?? true,
49
- secure: options.secure ?? true,
64
+ secure: options.secure ?? false,
65
+ ws: options.ws ?? true,
50
66
  ...(options.rewrite === true && {
51
67
  rewrite: (p: string) => p.replace(new RegExp(`^${path}`), ''),
52
68
  }),
package/src/types.ts CHANGED
@@ -45,5 +45,7 @@ export interface ProxyConfig {
45
45
  changeOrigin: boolean
46
46
  rewrite?: (path: string) => string
47
47
  secure: boolean
48
+ ws?: boolean
49
+ configure?: (proxy: any, options: any) => void
48
50
  }
49
51
  }