@bagelink/workspace 1.7.37 → 1.7.39
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/README.md +4 -5
- package/dist/composable.cjs +21 -0
- package/dist/composable.d.cts +50 -0
- package/dist/composable.d.mts +50 -0
- package/dist/composable.d.ts +50 -0
- package/dist/composable.mjs +18 -0
- package/dist/index.cjs +3 -19
- package/dist/index.d.cts +2 -50
- package/dist/index.d.mts +2 -50
- package/dist/index.d.ts +2 -50
- package/dist/index.mjs +2 -18
- package/package.json +6 -1
- package/src/index.ts +5 -0
package/README.md
CHANGED
|
@@ -162,14 +162,13 @@ export default defineConfig(({ mode }) => {
|
|
|
162
162
|
**Access config at runtime with `useWorkspace()`:**
|
|
163
163
|
|
|
164
164
|
```typescript
|
|
165
|
-
import { useWorkspace } from '@bagelink/workspace'
|
|
165
|
+
import { useWorkspace, getApiUrl } from '@bagelink/workspace/composable'
|
|
166
166
|
|
|
167
167
|
// In your app setup
|
|
168
168
|
const { proxy, host, mode } = useWorkspace()
|
|
169
169
|
const auth = initAuth({ baseURL: proxy })
|
|
170
170
|
|
|
171
171
|
// Or get full API URL
|
|
172
|
-
import { getApiUrl } from '@bagelink/workspace'
|
|
173
172
|
const apiUrl = getApiUrl() // 'https://project.bagel.to/api'
|
|
174
173
|
```
|
|
175
174
|
|
|
@@ -177,7 +176,7 @@ const apiUrl = getApiUrl() // 'https://project.bagel.to/api'
|
|
|
177
176
|
|
|
178
177
|
```vue
|
|
179
178
|
<script setup lang="ts">
|
|
180
|
-
import { useWorkspace } from '@bagelink/workspace'
|
|
179
|
+
import { useWorkspace } from '@bagelink/workspace/composable'
|
|
181
180
|
import { initAuth } from '@bagelink/auth'
|
|
182
181
|
|
|
183
182
|
const { proxy, host, mode } = useWorkspace()
|
|
@@ -515,7 +514,7 @@ Show CLI help.
|
|
|
515
514
|
Get workspace configuration at runtime. Config is injected as environment variables during build.
|
|
516
515
|
|
|
517
516
|
```typescript
|
|
518
|
-
import { useWorkspace } from '@bagelink/workspace'
|
|
517
|
+
import { useWorkspace } from '@bagelink/workspace/composable'
|
|
519
518
|
|
|
520
519
|
const { proxy, host, openapiUrl, mode } = useWorkspace()
|
|
521
520
|
```
|
|
@@ -535,7 +534,7 @@ interface RuntimeWorkspaceConfig {
|
|
|
535
534
|
Get the full API URL by combining host and proxy.
|
|
536
535
|
|
|
537
536
|
```typescript
|
|
538
|
-
import { getApiUrl } from '@bagelink/workspace'
|
|
537
|
+
import { getApiUrl } from '@bagelink/workspace/composable'
|
|
539
538
|
|
|
540
539
|
const apiUrl = getApiUrl() // 'https://project.bagel.to/api'
|
|
541
540
|
```
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function useWorkspace() {
|
|
4
|
+
const proxy = undefined.VITE_BGL_PROXY || "/api";
|
|
5
|
+
const host = undefined.VITE_BGL_HOST || "";
|
|
6
|
+
const openapiUrl = undefined.VITE_BGL_OPENAPI_URL;
|
|
7
|
+
const mode = undefined.MODE || "development";
|
|
8
|
+
return {
|
|
9
|
+
proxy,
|
|
10
|
+
host,
|
|
11
|
+
openapiUrl,
|
|
12
|
+
mode
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function getApiUrl() {
|
|
16
|
+
const { host, proxy } = useWorkspace();
|
|
17
|
+
return `${host}${proxy}`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
exports.getApiUrl = getApiUrl;
|
|
21
|
+
exports.useWorkspace = useWorkspace;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime workspace configuration
|
|
3
|
+
* Provides access to workspace config injected at build time
|
|
4
|
+
*/
|
|
5
|
+
interface RuntimeWorkspaceConfig {
|
|
6
|
+
/** API proxy path (e.g., '/api') */
|
|
7
|
+
proxy: string;
|
|
8
|
+
/** API host URL (e.g., 'https://project.bagel.to') */
|
|
9
|
+
host: string;
|
|
10
|
+
/** OpenAPI specification URL (if configured) */
|
|
11
|
+
openapiUrl?: string;
|
|
12
|
+
/** Current environment mode */
|
|
13
|
+
mode: 'localhost' | 'development' | 'production';
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get workspace configuration at runtime
|
|
17
|
+
* Config is injected as environment variables during build
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { useWorkspace } from '@bagelink/workspace'
|
|
22
|
+
*
|
|
23
|
+
* const { proxy, host } = useWorkspace()
|
|
24
|
+
* const auth = initAuth({ baseURL: proxy })
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example In Vue component
|
|
28
|
+
* ```vue
|
|
29
|
+
* <script setup>
|
|
30
|
+
* import { useWorkspace } from '@bagelink/workspace'
|
|
31
|
+
*
|
|
32
|
+
* const { proxy, host, mode } = useWorkspace()
|
|
33
|
+
* </script>
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
declare function useWorkspace(): RuntimeWorkspaceConfig;
|
|
37
|
+
/**
|
|
38
|
+
* Get the full API URL by combining host and proxy
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* import { getApiUrl } from '@bagelink/workspace'
|
|
43
|
+
*
|
|
44
|
+
* const apiUrl = getApiUrl() // 'https://project.bagel.to/api'
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
declare function getApiUrl(): string;
|
|
48
|
+
|
|
49
|
+
export { getApiUrl, useWorkspace };
|
|
50
|
+
export type { RuntimeWorkspaceConfig };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime workspace configuration
|
|
3
|
+
* Provides access to workspace config injected at build time
|
|
4
|
+
*/
|
|
5
|
+
interface RuntimeWorkspaceConfig {
|
|
6
|
+
/** API proxy path (e.g., '/api') */
|
|
7
|
+
proxy: string;
|
|
8
|
+
/** API host URL (e.g., 'https://project.bagel.to') */
|
|
9
|
+
host: string;
|
|
10
|
+
/** OpenAPI specification URL (if configured) */
|
|
11
|
+
openapiUrl?: string;
|
|
12
|
+
/** Current environment mode */
|
|
13
|
+
mode: 'localhost' | 'development' | 'production';
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get workspace configuration at runtime
|
|
17
|
+
* Config is injected as environment variables during build
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { useWorkspace } from '@bagelink/workspace'
|
|
22
|
+
*
|
|
23
|
+
* const { proxy, host } = useWorkspace()
|
|
24
|
+
* const auth = initAuth({ baseURL: proxy })
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example In Vue component
|
|
28
|
+
* ```vue
|
|
29
|
+
* <script setup>
|
|
30
|
+
* import { useWorkspace } from '@bagelink/workspace'
|
|
31
|
+
*
|
|
32
|
+
* const { proxy, host, mode } = useWorkspace()
|
|
33
|
+
* </script>
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
declare function useWorkspace(): RuntimeWorkspaceConfig;
|
|
37
|
+
/**
|
|
38
|
+
* Get the full API URL by combining host and proxy
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* import { getApiUrl } from '@bagelink/workspace'
|
|
43
|
+
*
|
|
44
|
+
* const apiUrl = getApiUrl() // 'https://project.bagel.to/api'
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
declare function getApiUrl(): string;
|
|
48
|
+
|
|
49
|
+
export { getApiUrl, useWorkspace };
|
|
50
|
+
export type { RuntimeWorkspaceConfig };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime workspace configuration
|
|
3
|
+
* Provides access to workspace config injected at build time
|
|
4
|
+
*/
|
|
5
|
+
interface RuntimeWorkspaceConfig {
|
|
6
|
+
/** API proxy path (e.g., '/api') */
|
|
7
|
+
proxy: string;
|
|
8
|
+
/** API host URL (e.g., 'https://project.bagel.to') */
|
|
9
|
+
host: string;
|
|
10
|
+
/** OpenAPI specification URL (if configured) */
|
|
11
|
+
openapiUrl?: string;
|
|
12
|
+
/** Current environment mode */
|
|
13
|
+
mode: 'localhost' | 'development' | 'production';
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get workspace configuration at runtime
|
|
17
|
+
* Config is injected as environment variables during build
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { useWorkspace } from '@bagelink/workspace'
|
|
22
|
+
*
|
|
23
|
+
* const { proxy, host } = useWorkspace()
|
|
24
|
+
* const auth = initAuth({ baseURL: proxy })
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example In Vue component
|
|
28
|
+
* ```vue
|
|
29
|
+
* <script setup>
|
|
30
|
+
* import { useWorkspace } from '@bagelink/workspace'
|
|
31
|
+
*
|
|
32
|
+
* const { proxy, host, mode } = useWorkspace()
|
|
33
|
+
* </script>
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
declare function useWorkspace(): RuntimeWorkspaceConfig;
|
|
37
|
+
/**
|
|
38
|
+
* Get the full API URL by combining host and proxy
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* import { getApiUrl } from '@bagelink/workspace'
|
|
43
|
+
*
|
|
44
|
+
* const apiUrl = getApiUrl() // 'https://project.bagel.to/api'
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
declare function getApiUrl(): string;
|
|
48
|
+
|
|
49
|
+
export { getApiUrl, useWorkspace };
|
|
50
|
+
export type { RuntimeWorkspaceConfig };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function useWorkspace() {
|
|
2
|
+
const proxy = import.meta.env.VITE_BGL_PROXY || "/api";
|
|
3
|
+
const host = import.meta.env.VITE_BGL_HOST || "";
|
|
4
|
+
const openapiUrl = import.meta.env.VITE_BGL_OPENAPI_URL;
|
|
5
|
+
const mode = import.meta.env.MODE || "development";
|
|
6
|
+
return {
|
|
7
|
+
proxy,
|
|
8
|
+
host,
|
|
9
|
+
openapiUrl,
|
|
10
|
+
mode
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function getApiUrl() {
|
|
14
|
+
const { host, proxy } = useWorkspace();
|
|
15
|
+
return `${host}${proxy}`;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { getApiUrl, useWorkspace };
|
package/dist/index.cjs
CHANGED
|
@@ -5,6 +5,7 @@ const node_path = require('node:path');
|
|
|
5
5
|
const process = require('node:process');
|
|
6
6
|
const workspace = require('./shared/workspace.CamNrnD_.cjs');
|
|
7
7
|
const vite = require('./shared/workspace.DfLGMczD.cjs');
|
|
8
|
+
const composable = require('./composable.cjs');
|
|
8
9
|
require('prompts');
|
|
9
10
|
require('node:child_process');
|
|
10
11
|
require('node:url');
|
|
@@ -73,23 +74,6 @@ function mergeConfigs(base, override) {
|
|
|
73
74
|
};
|
|
74
75
|
}
|
|
75
76
|
|
|
76
|
-
function useWorkspace() {
|
|
77
|
-
const proxy = undefined.VITE_BGL_PROXY || "/api";
|
|
78
|
-
const host = undefined.VITE_BGL_HOST || "";
|
|
79
|
-
const openapiUrl = undefined.VITE_BGL_OPENAPI_URL;
|
|
80
|
-
const mode = undefined.MODE || "development";
|
|
81
|
-
return {
|
|
82
|
-
proxy,
|
|
83
|
-
host,
|
|
84
|
-
openapiUrl,
|
|
85
|
-
mode
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
function getApiUrl() {
|
|
89
|
-
const { host, proxy } = useWorkspace();
|
|
90
|
-
return `${host}${proxy}`;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
77
|
function defineWorkspace(configs) {
|
|
94
78
|
return (mode = "development") => {
|
|
95
79
|
return configs[mode] || configs.development;
|
|
@@ -152,9 +136,9 @@ exports.writeNetlifyConfig = workspace.writeNetlifyConfig;
|
|
|
152
136
|
exports.bagelink = vite.bagelink;
|
|
153
137
|
exports.createCustomProxy = vite.createCustomProxy;
|
|
154
138
|
exports.createViteProxy = vite.createViteProxy;
|
|
139
|
+
exports.getApiUrl = composable.getApiUrl;
|
|
140
|
+
exports.useWorkspace = composable.useWorkspace;
|
|
155
141
|
exports.createWorkspace = createWorkspace;
|
|
156
142
|
exports.defineWorkspace = defineWorkspace;
|
|
157
|
-
exports.getApiUrl = getApiUrl;
|
|
158
143
|
exports.mergeConfigs = mergeConfigs;
|
|
159
144
|
exports.resolveConfig = resolveConfig;
|
|
160
|
-
exports.useWorkspace = useWorkspace;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { W as WorkspaceConfig, a as WorkspaceEnvironment, b as WorkspaceOptions, P as ProxyConfig } from './shared/workspace.CSNgk3PR.cjs';
|
|
2
2
|
export { B as BagelinkPluginOptions, c as bagelink } from './shared/workspace.CSNgk3PR.cjs';
|
|
3
|
+
export { RuntimeWorkspaceConfig, getApiUrl, useWorkspace } from './composable.cjs';
|
|
3
4
|
import 'vite';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -53,54 +54,6 @@ declare function createCustomProxy(paths: string[], target: string, options?: {
|
|
|
53
54
|
secure?: boolean;
|
|
54
55
|
}): ProxyConfig;
|
|
55
56
|
|
|
56
|
-
/**
|
|
57
|
-
* Runtime workspace configuration
|
|
58
|
-
* Provides access to workspace config injected at build time
|
|
59
|
-
*/
|
|
60
|
-
interface RuntimeWorkspaceConfig {
|
|
61
|
-
/** API proxy path (e.g., '/api') */
|
|
62
|
-
proxy: string;
|
|
63
|
-
/** API host URL (e.g., 'https://project.bagel.to') */
|
|
64
|
-
host: string;
|
|
65
|
-
/** OpenAPI specification URL (if configured) */
|
|
66
|
-
openapiUrl?: string;
|
|
67
|
-
/** Current environment mode */
|
|
68
|
-
mode: 'localhost' | 'development' | 'production';
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Get workspace configuration at runtime
|
|
72
|
-
* Config is injected as environment variables during build
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
* ```ts
|
|
76
|
-
* import { useWorkspace } from '@bagelink/workspace'
|
|
77
|
-
*
|
|
78
|
-
* const { proxy, host } = useWorkspace()
|
|
79
|
-
* const auth = initAuth({ baseURL: proxy })
|
|
80
|
-
* ```
|
|
81
|
-
*
|
|
82
|
-
* @example In Vue component
|
|
83
|
-
* ```vue
|
|
84
|
-
* <script setup>
|
|
85
|
-
* import { useWorkspace } from '@bagelink/workspace'
|
|
86
|
-
*
|
|
87
|
-
* const { proxy, host, mode } = useWorkspace()
|
|
88
|
-
* </script>
|
|
89
|
-
* ```
|
|
90
|
-
*/
|
|
91
|
-
declare function useWorkspace(): RuntimeWorkspaceConfig;
|
|
92
|
-
/**
|
|
93
|
-
* Get the full API URL by combining host and proxy
|
|
94
|
-
*
|
|
95
|
-
* @example
|
|
96
|
-
* ```ts
|
|
97
|
-
* import { getApiUrl } from '@bagelink/workspace'
|
|
98
|
-
*
|
|
99
|
-
* const apiUrl = getApiUrl() // 'https://project.bagel.to/api'
|
|
100
|
-
* ```
|
|
101
|
-
*/
|
|
102
|
-
declare function getApiUrl(): string;
|
|
103
|
-
|
|
104
57
|
/**
|
|
105
58
|
* Detect if current directory is a workspace root
|
|
106
59
|
*/
|
|
@@ -175,5 +128,4 @@ declare function createWorkspace(options?: WorkspaceOptions): {
|
|
|
175
128
|
clearCache(): void;
|
|
176
129
|
};
|
|
177
130
|
|
|
178
|
-
export { ProxyConfig, WorkspaceConfig, WorkspaceEnvironment, WorkspaceOptions, addProject, createCustomProxy, createViteProxy, createWorkspace, defineWorkspace, generateNetlifyConfig, generateNetlifyRedirect, generateSDK, generateSDKForWorkspace, generateWorkspaceConfig, generateWorkspaceConfigSync,
|
|
179
|
-
export type { RuntimeWorkspaceConfig };
|
|
131
|
+
export { ProxyConfig, WorkspaceConfig, WorkspaceEnvironment, WorkspaceOptions, addProject, createCustomProxy, createViteProxy, createWorkspace, defineWorkspace, generateNetlifyConfig, generateNetlifyRedirect, generateSDK, generateSDKForWorkspace, generateWorkspaceConfig, generateWorkspaceConfigSync, getWorkspaceInfo, initWorkspace, isWorkspace, listProjects, mergeConfigs, resolveConfig, runDev, setBuildEnvVars, setupLint, writeNetlifyConfig };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { W as WorkspaceConfig, a as WorkspaceEnvironment, b as WorkspaceOptions, P as ProxyConfig } from './shared/workspace.CSNgk3PR.mjs';
|
|
2
2
|
export { B as BagelinkPluginOptions, c as bagelink } from './shared/workspace.CSNgk3PR.mjs';
|
|
3
|
+
export { RuntimeWorkspaceConfig, getApiUrl, useWorkspace } from './composable.mjs';
|
|
3
4
|
import 'vite';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -53,54 +54,6 @@ declare function createCustomProxy(paths: string[], target: string, options?: {
|
|
|
53
54
|
secure?: boolean;
|
|
54
55
|
}): ProxyConfig;
|
|
55
56
|
|
|
56
|
-
/**
|
|
57
|
-
* Runtime workspace configuration
|
|
58
|
-
* Provides access to workspace config injected at build time
|
|
59
|
-
*/
|
|
60
|
-
interface RuntimeWorkspaceConfig {
|
|
61
|
-
/** API proxy path (e.g., '/api') */
|
|
62
|
-
proxy: string;
|
|
63
|
-
/** API host URL (e.g., 'https://project.bagel.to') */
|
|
64
|
-
host: string;
|
|
65
|
-
/** OpenAPI specification URL (if configured) */
|
|
66
|
-
openapiUrl?: string;
|
|
67
|
-
/** Current environment mode */
|
|
68
|
-
mode: 'localhost' | 'development' | 'production';
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Get workspace configuration at runtime
|
|
72
|
-
* Config is injected as environment variables during build
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
* ```ts
|
|
76
|
-
* import { useWorkspace } from '@bagelink/workspace'
|
|
77
|
-
*
|
|
78
|
-
* const { proxy, host } = useWorkspace()
|
|
79
|
-
* const auth = initAuth({ baseURL: proxy })
|
|
80
|
-
* ```
|
|
81
|
-
*
|
|
82
|
-
* @example In Vue component
|
|
83
|
-
* ```vue
|
|
84
|
-
* <script setup>
|
|
85
|
-
* import { useWorkspace } from '@bagelink/workspace'
|
|
86
|
-
*
|
|
87
|
-
* const { proxy, host, mode } = useWorkspace()
|
|
88
|
-
* </script>
|
|
89
|
-
* ```
|
|
90
|
-
*/
|
|
91
|
-
declare function useWorkspace(): RuntimeWorkspaceConfig;
|
|
92
|
-
/**
|
|
93
|
-
* Get the full API URL by combining host and proxy
|
|
94
|
-
*
|
|
95
|
-
* @example
|
|
96
|
-
* ```ts
|
|
97
|
-
* import { getApiUrl } from '@bagelink/workspace'
|
|
98
|
-
*
|
|
99
|
-
* const apiUrl = getApiUrl() // 'https://project.bagel.to/api'
|
|
100
|
-
* ```
|
|
101
|
-
*/
|
|
102
|
-
declare function getApiUrl(): string;
|
|
103
|
-
|
|
104
57
|
/**
|
|
105
58
|
* Detect if current directory is a workspace root
|
|
106
59
|
*/
|
|
@@ -175,5 +128,4 @@ declare function createWorkspace(options?: WorkspaceOptions): {
|
|
|
175
128
|
clearCache(): void;
|
|
176
129
|
};
|
|
177
130
|
|
|
178
|
-
export { ProxyConfig, WorkspaceConfig, WorkspaceEnvironment, WorkspaceOptions, addProject, createCustomProxy, createViteProxy, createWorkspace, defineWorkspace, generateNetlifyConfig, generateNetlifyRedirect, generateSDK, generateSDKForWorkspace, generateWorkspaceConfig, generateWorkspaceConfigSync,
|
|
179
|
-
export type { RuntimeWorkspaceConfig };
|
|
131
|
+
export { ProxyConfig, WorkspaceConfig, WorkspaceEnvironment, WorkspaceOptions, addProject, createCustomProxy, createViteProxy, createWorkspace, defineWorkspace, generateNetlifyConfig, generateNetlifyRedirect, generateSDK, generateSDKForWorkspace, generateWorkspaceConfig, generateWorkspaceConfigSync, getWorkspaceInfo, initWorkspace, isWorkspace, listProjects, mergeConfigs, resolveConfig, runDev, setBuildEnvVars, setupLint, writeNetlifyConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { W as WorkspaceConfig, a as WorkspaceEnvironment, b as WorkspaceOptions, P as ProxyConfig } from './shared/workspace.CSNgk3PR.js';
|
|
2
2
|
export { B as BagelinkPluginOptions, c as bagelink } from './shared/workspace.CSNgk3PR.js';
|
|
3
|
+
export { RuntimeWorkspaceConfig, getApiUrl, useWorkspace } from './composable.js';
|
|
3
4
|
import 'vite';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -53,54 +54,6 @@ declare function createCustomProxy(paths: string[], target: string, options?: {
|
|
|
53
54
|
secure?: boolean;
|
|
54
55
|
}): ProxyConfig;
|
|
55
56
|
|
|
56
|
-
/**
|
|
57
|
-
* Runtime workspace configuration
|
|
58
|
-
* Provides access to workspace config injected at build time
|
|
59
|
-
*/
|
|
60
|
-
interface RuntimeWorkspaceConfig {
|
|
61
|
-
/** API proxy path (e.g., '/api') */
|
|
62
|
-
proxy: string;
|
|
63
|
-
/** API host URL (e.g., 'https://project.bagel.to') */
|
|
64
|
-
host: string;
|
|
65
|
-
/** OpenAPI specification URL (if configured) */
|
|
66
|
-
openapiUrl?: string;
|
|
67
|
-
/** Current environment mode */
|
|
68
|
-
mode: 'localhost' | 'development' | 'production';
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Get workspace configuration at runtime
|
|
72
|
-
* Config is injected as environment variables during build
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
* ```ts
|
|
76
|
-
* import { useWorkspace } from '@bagelink/workspace'
|
|
77
|
-
*
|
|
78
|
-
* const { proxy, host } = useWorkspace()
|
|
79
|
-
* const auth = initAuth({ baseURL: proxy })
|
|
80
|
-
* ```
|
|
81
|
-
*
|
|
82
|
-
* @example In Vue component
|
|
83
|
-
* ```vue
|
|
84
|
-
* <script setup>
|
|
85
|
-
* import { useWorkspace } from '@bagelink/workspace'
|
|
86
|
-
*
|
|
87
|
-
* const { proxy, host, mode } = useWorkspace()
|
|
88
|
-
* </script>
|
|
89
|
-
* ```
|
|
90
|
-
*/
|
|
91
|
-
declare function useWorkspace(): RuntimeWorkspaceConfig;
|
|
92
|
-
/**
|
|
93
|
-
* Get the full API URL by combining host and proxy
|
|
94
|
-
*
|
|
95
|
-
* @example
|
|
96
|
-
* ```ts
|
|
97
|
-
* import { getApiUrl } from '@bagelink/workspace'
|
|
98
|
-
*
|
|
99
|
-
* const apiUrl = getApiUrl() // 'https://project.bagel.to/api'
|
|
100
|
-
* ```
|
|
101
|
-
*/
|
|
102
|
-
declare function getApiUrl(): string;
|
|
103
|
-
|
|
104
57
|
/**
|
|
105
58
|
* Detect if current directory is a workspace root
|
|
106
59
|
*/
|
|
@@ -175,5 +128,4 @@ declare function createWorkspace(options?: WorkspaceOptions): {
|
|
|
175
128
|
clearCache(): void;
|
|
176
129
|
};
|
|
177
130
|
|
|
178
|
-
export { ProxyConfig, WorkspaceConfig, WorkspaceEnvironment, WorkspaceOptions, addProject, createCustomProxy, createViteProxy, createWorkspace, defineWorkspace, generateNetlifyConfig, generateNetlifyRedirect, generateSDK, generateSDKForWorkspace, generateWorkspaceConfig, generateWorkspaceConfigSync,
|
|
179
|
-
export type { RuntimeWorkspaceConfig };
|
|
131
|
+
export { ProxyConfig, WorkspaceConfig, WorkspaceEnvironment, WorkspaceOptions, addProject, createCustomProxy, createViteProxy, createWorkspace, defineWorkspace, generateNetlifyConfig, generateNetlifyRedirect, generateSDK, generateSDKForWorkspace, generateWorkspaceConfig, generateWorkspaceConfigSync, getWorkspaceInfo, initWorkspace, isWorkspace, listProjects, mergeConfigs, resolveConfig, runDev, setBuildEnvVars, setupLint, writeNetlifyConfig };
|
package/dist/index.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import { g as generateWorkspaceConfig, s as setBuildEnvVars, w as writeNetlifyCo
|
|
|
5
5
|
export { j as addProject, a as generateNetlifyConfig, b as generateNetlifyRedirect, f as generateSDK, h as generateSDKForWorkspace, c as generateWorkspaceConfigSync, d as getWorkspaceInfo, k as initWorkspace, i as isWorkspace, l as listProjects, r as runDev, e as setupLint } from './shared/workspace.PLrsjsJ2.mjs';
|
|
6
6
|
import { c as createViteProxy } from './shared/workspace.D0MF8ERh.mjs';
|
|
7
7
|
export { b as bagelink, a as createCustomProxy } from './shared/workspace.D0MF8ERh.mjs';
|
|
8
|
+
export { getApiUrl, useWorkspace } from './composable.mjs';
|
|
8
9
|
import 'prompts';
|
|
9
10
|
import 'node:child_process';
|
|
10
11
|
import 'node:url';
|
|
@@ -69,23 +70,6 @@ function mergeConfigs(base, override) {
|
|
|
69
70
|
};
|
|
70
71
|
}
|
|
71
72
|
|
|
72
|
-
function useWorkspace() {
|
|
73
|
-
const proxy = import.meta.env.VITE_BGL_PROXY || "/api";
|
|
74
|
-
const host = import.meta.env.VITE_BGL_HOST || "";
|
|
75
|
-
const openapiUrl = import.meta.env.VITE_BGL_OPENAPI_URL;
|
|
76
|
-
const mode = import.meta.env.MODE || "development";
|
|
77
|
-
return {
|
|
78
|
-
proxy,
|
|
79
|
-
host,
|
|
80
|
-
openapiUrl,
|
|
81
|
-
mode
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
function getApiUrl() {
|
|
85
|
-
const { host, proxy } = useWorkspace();
|
|
86
|
-
return `${host}${proxy}`;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
73
|
function defineWorkspace(configs) {
|
|
90
74
|
return (mode = "development") => {
|
|
91
75
|
return configs[mode] || configs.development;
|
|
@@ -130,4 +114,4 @@ function createWorkspace(options = {}) {
|
|
|
130
114
|
};
|
|
131
115
|
}
|
|
132
116
|
|
|
133
|
-
export { createViteProxy, createWorkspace, defineWorkspace, generateWorkspaceConfig,
|
|
117
|
+
export { createViteProxy, createWorkspace, defineWorkspace, generateWorkspaceConfig, mergeConfigs, resolveConfig, setBuildEnvVars, writeNetlifyConfig };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bagelink/workspace",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.7.
|
|
4
|
+
"version": "1.7.39",
|
|
5
5
|
"description": "Monorepo workspace tooling for Bagel projects with proxy and config management",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Bagel Studio",
|
|
@@ -37,6 +37,11 @@
|
|
|
37
37
|
"require": "./dist/vite.cjs",
|
|
38
38
|
"import": "./dist/vite.mjs"
|
|
39
39
|
},
|
|
40
|
+
"./composable": {
|
|
41
|
+
"types": "./dist/composable.d.ts",
|
|
42
|
+
"require": "./dist/composable.cjs",
|
|
43
|
+
"import": "./dist/composable.mjs"
|
|
44
|
+
},
|
|
40
45
|
"./env": "./env.d.ts"
|
|
41
46
|
},
|
|
42
47
|
"main": "./dist/index.mjs",
|
package/src/index.ts
CHANGED
|
@@ -34,13 +34,18 @@ export {
|
|
|
34
34
|
writeNetlifyConfig,
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
// Runtime composables (browser-safe, no Node.js dependencies)
|
|
37
38
|
export { getApiUrl, useWorkspace } from './composable'
|
|
38
39
|
export type { RuntimeWorkspaceConfig } from './composable'
|
|
40
|
+
|
|
41
|
+
// Node.js / CLI-only exports
|
|
39
42
|
export { getWorkspaceInfo, isWorkspace } from './detect'
|
|
40
43
|
export { runDev } from './dev'
|
|
41
44
|
export { setupLint } from './lint'
|
|
42
45
|
export { generateSDK, generateSDKForWorkspace } from './sdk'
|
|
46
|
+
// Vite plugin (build-time only)
|
|
43
47
|
export { bagelink } from './vite'
|
|
48
|
+
|
|
44
49
|
export type { BagelinkPluginOptions } from './vite'
|
|
45
50
|
export { addProject, initWorkspace, listProjects } from './workspace'
|
|
46
51
|
|