@bagelink/workspace 1.7.39 → 1.7.43
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 +23 -7
- package/dist/bin/bgl.cjs +1081 -14
- package/dist/bin/bgl.mjs +1070 -4
- package/dist/index.cjs +0 -131
- package/dist/index.d.cts +3 -123
- package/dist/index.d.mts +3 -123
- package/dist/index.d.ts +3 -123
- package/dist/index.mjs +1 -109
- package/dist/shared/workspace.D1xukL92.d.cts +44 -0
- package/dist/shared/workspace.D1xukL92.d.mts +44 -0
- package/dist/shared/workspace.D1xukL92.d.ts +44 -0
- package/dist/shared/workspace.Dx9_TIij.cjs +86 -0
- package/dist/shared/workspace.Twuo1PFw.mjs +78 -0
- package/dist/vite.cjs +88 -4
- package/dist/vite.d.cts +97 -2
- package/dist/vite.d.mts +97 -2
- package/dist/vite.d.ts +97 -2
- package/dist/vite.mjs +82 -3
- package/package.json +1 -1
- package/src/index.ts +8 -81
- package/src/lint.ts +90 -2
- package/src/vite.ts +4 -0
- package/dist/shared/workspace.CSNgk3PR.d.cts +0 -113
- package/dist/shared/workspace.CSNgk3PR.d.mts +0 -113
- package/dist/shared/workspace.CSNgk3PR.d.ts +0 -113
- package/dist/shared/workspace.CamNrnD_.cjs +0 -1155
- package/dist/shared/workspace.D0MF8ERh.mjs +0 -79
- package/dist/shared/workspace.DfLGMczD.cjs +0 -87
- package/dist/shared/workspace.PLrsjsJ2.mjs +0 -1134
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
type WorkspaceEnvironment = 'localhost' | 'development' | 'production';
|
|
2
|
+
interface WorkspaceConfig {
|
|
3
|
+
/**
|
|
4
|
+
* The host URL of the backend API server
|
|
5
|
+
* @example 'http://localhost:8000' | 'https://project.bagel.to'
|
|
6
|
+
*/
|
|
7
|
+
host: string;
|
|
8
|
+
/**
|
|
9
|
+
* The proxy path to use for API requests
|
|
10
|
+
* @default '/api'
|
|
11
|
+
*/
|
|
12
|
+
proxy: string;
|
|
13
|
+
/**
|
|
14
|
+
* Optional OpenAPI specification URL for SDK generation
|
|
15
|
+
*/
|
|
16
|
+
openapi_url?: string;
|
|
17
|
+
}
|
|
18
|
+
interface WorkspaceOptions {
|
|
19
|
+
/**
|
|
20
|
+
* Root directory of the workspace
|
|
21
|
+
* @default process.cwd()
|
|
22
|
+
*/
|
|
23
|
+
root?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Path to the config file relative to root
|
|
26
|
+
* @default 'bgl.config.ts'
|
|
27
|
+
*/
|
|
28
|
+
configFile?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Enable interactive config generation if no config is found
|
|
31
|
+
* @default true
|
|
32
|
+
*/
|
|
33
|
+
interactive?: boolean;
|
|
34
|
+
}
|
|
35
|
+
interface ProxyConfig {
|
|
36
|
+
[path: string]: {
|
|
37
|
+
target: string;
|
|
38
|
+
changeOrigin: boolean;
|
|
39
|
+
rewrite?: (path: string) => string;
|
|
40
|
+
secure: boolean;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type { ProxyConfig as P, WorkspaceEnvironment as W, WorkspaceConfig as a, WorkspaceOptions as b };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
type WorkspaceEnvironment = 'localhost' | 'development' | 'production';
|
|
2
|
+
interface WorkspaceConfig {
|
|
3
|
+
/**
|
|
4
|
+
* The host URL of the backend API server
|
|
5
|
+
* @example 'http://localhost:8000' | 'https://project.bagel.to'
|
|
6
|
+
*/
|
|
7
|
+
host: string;
|
|
8
|
+
/**
|
|
9
|
+
* The proxy path to use for API requests
|
|
10
|
+
* @default '/api'
|
|
11
|
+
*/
|
|
12
|
+
proxy: string;
|
|
13
|
+
/**
|
|
14
|
+
* Optional OpenAPI specification URL for SDK generation
|
|
15
|
+
*/
|
|
16
|
+
openapi_url?: string;
|
|
17
|
+
}
|
|
18
|
+
interface WorkspaceOptions {
|
|
19
|
+
/**
|
|
20
|
+
* Root directory of the workspace
|
|
21
|
+
* @default process.cwd()
|
|
22
|
+
*/
|
|
23
|
+
root?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Path to the config file relative to root
|
|
26
|
+
* @default 'bgl.config.ts'
|
|
27
|
+
*/
|
|
28
|
+
configFile?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Enable interactive config generation if no config is found
|
|
31
|
+
* @default true
|
|
32
|
+
*/
|
|
33
|
+
interactive?: boolean;
|
|
34
|
+
}
|
|
35
|
+
interface ProxyConfig {
|
|
36
|
+
[path: string]: {
|
|
37
|
+
target: string;
|
|
38
|
+
changeOrigin: boolean;
|
|
39
|
+
rewrite?: (path: string) => string;
|
|
40
|
+
secure: boolean;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type { ProxyConfig as P, WorkspaceEnvironment as W, WorkspaceConfig as a, WorkspaceOptions as b };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
type WorkspaceEnvironment = 'localhost' | 'development' | 'production';
|
|
2
|
+
interface WorkspaceConfig {
|
|
3
|
+
/**
|
|
4
|
+
* The host URL of the backend API server
|
|
5
|
+
* @example 'http://localhost:8000' | 'https://project.bagel.to'
|
|
6
|
+
*/
|
|
7
|
+
host: string;
|
|
8
|
+
/**
|
|
9
|
+
* The proxy path to use for API requests
|
|
10
|
+
* @default '/api'
|
|
11
|
+
*/
|
|
12
|
+
proxy: string;
|
|
13
|
+
/**
|
|
14
|
+
* Optional OpenAPI specification URL for SDK generation
|
|
15
|
+
*/
|
|
16
|
+
openapi_url?: string;
|
|
17
|
+
}
|
|
18
|
+
interface WorkspaceOptions {
|
|
19
|
+
/**
|
|
20
|
+
* Root directory of the workspace
|
|
21
|
+
* @default process.cwd()
|
|
22
|
+
*/
|
|
23
|
+
root?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Path to the config file relative to root
|
|
26
|
+
* @default 'bgl.config.ts'
|
|
27
|
+
*/
|
|
28
|
+
configFile?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Enable interactive config generation if no config is found
|
|
31
|
+
* @default true
|
|
32
|
+
*/
|
|
33
|
+
interactive?: boolean;
|
|
34
|
+
}
|
|
35
|
+
interface ProxyConfig {
|
|
36
|
+
[path: string]: {
|
|
37
|
+
target: string;
|
|
38
|
+
changeOrigin: boolean;
|
|
39
|
+
rewrite?: (path: string) => string;
|
|
40
|
+
secure: boolean;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type { ProxyConfig as P, WorkspaceEnvironment as W, WorkspaceConfig as a, WorkspaceOptions as b };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const node_fs = require('node:fs');
|
|
4
|
+
const node_path = require('node:path');
|
|
5
|
+
const process = require('node:process');
|
|
6
|
+
|
|
7
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
8
|
+
|
|
9
|
+
const process__default = /*#__PURE__*/_interopDefaultCompat(process);
|
|
10
|
+
|
|
11
|
+
function generateNetlifyRedirect(config) {
|
|
12
|
+
const redirect = `# API Proxy Configuration
|
|
13
|
+
# Environment variables are set in Netlify UI or netlify.toml [build.environment] section
|
|
14
|
+
|
|
15
|
+
[[redirects]]
|
|
16
|
+
from = "${config.proxy}/*"
|
|
17
|
+
to = "${config.host}/:splat"
|
|
18
|
+
status = 200
|
|
19
|
+
force = true
|
|
20
|
+
headers = {X-From = "Netlify"}
|
|
21
|
+
`;
|
|
22
|
+
return redirect;
|
|
23
|
+
}
|
|
24
|
+
function generateNetlifyConfigTemplate() {
|
|
25
|
+
return `# Standard Netlify configuration for Bagelink projects
|
|
26
|
+
# Uses environment variables for proxy configuration
|
|
27
|
+
|
|
28
|
+
[build.environment]
|
|
29
|
+
# Set these in Netlify UI or override here
|
|
30
|
+
# BGL_PROXY_PATH = "/api"
|
|
31
|
+
# BGL_API_HOST = "https://your-project.bagel.to"
|
|
32
|
+
|
|
33
|
+
[[redirects]]
|
|
34
|
+
# Proxy API requests to backend
|
|
35
|
+
# Uses BGL_PROXY_PATH and BGL_API_HOST from environment
|
|
36
|
+
from = "/api/*"
|
|
37
|
+
to = "https://your-project.bagel.to/:splat"
|
|
38
|
+
status = 200
|
|
39
|
+
force = true
|
|
40
|
+
headers = {X-From = "Netlify"}
|
|
41
|
+
|
|
42
|
+
# Example: Multiple API backends
|
|
43
|
+
# [[redirects]]
|
|
44
|
+
# from = "/api/v2/*"
|
|
45
|
+
# to = "https://api-v2.example.com/:splat"
|
|
46
|
+
# status = 200
|
|
47
|
+
# force = true
|
|
48
|
+
`;
|
|
49
|
+
}
|
|
50
|
+
function generateNetlifyConfig(config, additionalConfig, useTemplate = false) {
|
|
51
|
+
if (useTemplate) {
|
|
52
|
+
return generateNetlifyConfigTemplate();
|
|
53
|
+
}
|
|
54
|
+
const redirect = generateNetlifyRedirect(config);
|
|
55
|
+
if (additionalConfig !== void 0 && additionalConfig !== "") {
|
|
56
|
+
return `${redirect}
|
|
57
|
+
${additionalConfig}`;
|
|
58
|
+
}
|
|
59
|
+
return redirect;
|
|
60
|
+
}
|
|
61
|
+
function writeNetlifyConfig(config, outPath = "./netlify.toml", additionalConfig, useTemplate = false) {
|
|
62
|
+
const content = generateNetlifyConfig(config, additionalConfig, useTemplate);
|
|
63
|
+
const resolvedPath = node_path.resolve(outPath);
|
|
64
|
+
node_fs.writeFileSync(resolvedPath, content, "utf-8");
|
|
65
|
+
console.log(`\u2713 Generated netlify.toml at ${resolvedPath}`);
|
|
66
|
+
if (!useTemplate) {
|
|
67
|
+
console.log("\n\u{1F4A1} Tip: For environment-based config, set these in Netlify UI:");
|
|
68
|
+
console.log(` BGL_PROXY_PATH = "${config.proxy}"`);
|
|
69
|
+
console.log(` BGL_API_HOST = "${config.host}"`);
|
|
70
|
+
if (config.openapi_url) {
|
|
71
|
+
console.log(` BGL_OPENAPI_URL = "${config.openapi_url}"`);
|
|
72
|
+
}
|
|
73
|
+
console.log("");
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function setBuildEnvVars(config) {
|
|
77
|
+
process__default.env.BGL_PROXY_PATH = config.proxy;
|
|
78
|
+
process__default.env.BGL_API_HOST = config.host;
|
|
79
|
+
if (config.openapi_url !== void 0 && config.openapi_url !== "") {
|
|
80
|
+
process__default.env.BGL_OPENAPI_URL = config.openapi_url;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
exports.generateNetlifyConfig = generateNetlifyConfig;
|
|
85
|
+
exports.setBuildEnvVars = setBuildEnvVars;
|
|
86
|
+
exports.writeNetlifyConfig = writeNetlifyConfig;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { writeFileSync } from 'node:fs';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import process from 'node:process';
|
|
4
|
+
|
|
5
|
+
function generateNetlifyRedirect(config) {
|
|
6
|
+
const redirect = `# API Proxy Configuration
|
|
7
|
+
# Environment variables are set in Netlify UI or netlify.toml [build.environment] section
|
|
8
|
+
|
|
9
|
+
[[redirects]]
|
|
10
|
+
from = "${config.proxy}/*"
|
|
11
|
+
to = "${config.host}/:splat"
|
|
12
|
+
status = 200
|
|
13
|
+
force = true
|
|
14
|
+
headers = {X-From = "Netlify"}
|
|
15
|
+
`;
|
|
16
|
+
return redirect;
|
|
17
|
+
}
|
|
18
|
+
function generateNetlifyConfigTemplate() {
|
|
19
|
+
return `# Standard Netlify configuration for Bagelink projects
|
|
20
|
+
# Uses environment variables for proxy configuration
|
|
21
|
+
|
|
22
|
+
[build.environment]
|
|
23
|
+
# Set these in Netlify UI or override here
|
|
24
|
+
# BGL_PROXY_PATH = "/api"
|
|
25
|
+
# BGL_API_HOST = "https://your-project.bagel.to"
|
|
26
|
+
|
|
27
|
+
[[redirects]]
|
|
28
|
+
# Proxy API requests to backend
|
|
29
|
+
# Uses BGL_PROXY_PATH and BGL_API_HOST from environment
|
|
30
|
+
from = "/api/*"
|
|
31
|
+
to = "https://your-project.bagel.to/:splat"
|
|
32
|
+
status = 200
|
|
33
|
+
force = true
|
|
34
|
+
headers = {X-From = "Netlify"}
|
|
35
|
+
|
|
36
|
+
# Example: Multiple API backends
|
|
37
|
+
# [[redirects]]
|
|
38
|
+
# from = "/api/v2/*"
|
|
39
|
+
# to = "https://api-v2.example.com/:splat"
|
|
40
|
+
# status = 200
|
|
41
|
+
# force = true
|
|
42
|
+
`;
|
|
43
|
+
}
|
|
44
|
+
function generateNetlifyConfig(config, additionalConfig, useTemplate = false) {
|
|
45
|
+
if (useTemplate) {
|
|
46
|
+
return generateNetlifyConfigTemplate();
|
|
47
|
+
}
|
|
48
|
+
const redirect = generateNetlifyRedirect(config);
|
|
49
|
+
if (additionalConfig !== void 0 && additionalConfig !== "") {
|
|
50
|
+
return `${redirect}
|
|
51
|
+
${additionalConfig}`;
|
|
52
|
+
}
|
|
53
|
+
return redirect;
|
|
54
|
+
}
|
|
55
|
+
function writeNetlifyConfig(config, outPath = "./netlify.toml", additionalConfig, useTemplate = false) {
|
|
56
|
+
const content = generateNetlifyConfig(config, additionalConfig, useTemplate);
|
|
57
|
+
const resolvedPath = resolve(outPath);
|
|
58
|
+
writeFileSync(resolvedPath, content, "utf-8");
|
|
59
|
+
console.log(`\u2713 Generated netlify.toml at ${resolvedPath}`);
|
|
60
|
+
if (!useTemplate) {
|
|
61
|
+
console.log("\n\u{1F4A1} Tip: For environment-based config, set these in Netlify UI:");
|
|
62
|
+
console.log(` BGL_PROXY_PATH = "${config.proxy}"`);
|
|
63
|
+
console.log(` BGL_API_HOST = "${config.host}"`);
|
|
64
|
+
if (config.openapi_url) {
|
|
65
|
+
console.log(` BGL_OPENAPI_URL = "${config.openapi_url}"`);
|
|
66
|
+
}
|
|
67
|
+
console.log("");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function setBuildEnvVars(config) {
|
|
71
|
+
process.env.BGL_PROXY_PATH = config.proxy;
|
|
72
|
+
process.env.BGL_API_HOST = config.host;
|
|
73
|
+
if (config.openapi_url !== void 0 && config.openapi_url !== "") {
|
|
74
|
+
process.env.BGL_OPENAPI_URL = config.openapi_url;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export { generateNetlifyConfig as g, setBuildEnvVars as s, writeNetlifyConfig as w };
|
package/dist/vite.cjs
CHANGED
|
@@ -1,9 +1,93 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('node:process');
|
|
4
|
-
require('node:url');
|
|
5
|
-
const
|
|
3
|
+
const process = require('node:process');
|
|
4
|
+
const node_url = require('node:url');
|
|
5
|
+
const netlify = require('./shared/workspace.Dx9_TIij.cjs');
|
|
6
|
+
require('node:fs');
|
|
7
|
+
require('node:path');
|
|
6
8
|
|
|
9
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
7
10
|
|
|
11
|
+
const process__default = /*#__PURE__*/_interopDefaultCompat(process);
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
function createViteProxy(config) {
|
|
14
|
+
const proxy = {};
|
|
15
|
+
if (config.proxy && config.host) {
|
|
16
|
+
proxy[config.proxy] = {
|
|
17
|
+
target: config.host,
|
|
18
|
+
changeOrigin: true,
|
|
19
|
+
rewrite: (path) => path.replace(new RegExp(`^${config.proxy}`), ""),
|
|
20
|
+
secure: true
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
if (config.host) {
|
|
24
|
+
proxy["/files"] = {
|
|
25
|
+
target: config.host,
|
|
26
|
+
changeOrigin: true,
|
|
27
|
+
secure: true
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
return proxy;
|
|
31
|
+
}
|
|
32
|
+
function createCustomProxy(paths, target, options = {}) {
|
|
33
|
+
const proxy = {};
|
|
34
|
+
for (const path of paths) {
|
|
35
|
+
proxy[path] = {
|
|
36
|
+
target,
|
|
37
|
+
changeOrigin: options.changeOrigin ?? true,
|
|
38
|
+
secure: options.secure ?? true,
|
|
39
|
+
...options.rewrite === true && {
|
|
40
|
+
rewrite: (p) => p.replace(new RegExp(`^${path}`), "")
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return proxy;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function bagelink(options) {
|
|
48
|
+
const { workspace, config = {} } = options;
|
|
49
|
+
let workspaceConfig;
|
|
50
|
+
return {
|
|
51
|
+
name: "vite-plugin-bagelink",
|
|
52
|
+
enforce: "pre",
|
|
53
|
+
configResolved(resolved) {
|
|
54
|
+
workspaceConfig = workspace(resolved.mode);
|
|
55
|
+
},
|
|
56
|
+
config(userConfig, { mode }) {
|
|
57
|
+
workspaceConfig = workspace(mode);
|
|
58
|
+
const alias = {};
|
|
59
|
+
if (config.includeSharedAlias !== false) {
|
|
60
|
+
const sharedPath = config.sharedPath ?? "../shared";
|
|
61
|
+
alias["@shared"] = node_url.fileURLToPath(new URL(sharedPath, `file://${process__default.cwd()}/`));
|
|
62
|
+
}
|
|
63
|
+
alias["@"] = node_url.fileURLToPath(new URL("./src", `file://${process__default.cwd()}/`));
|
|
64
|
+
if (config.additionalAliases) {
|
|
65
|
+
Object.assign(alias, config.additionalAliases);
|
|
66
|
+
}
|
|
67
|
+
const server = config.configureProxy !== false ? {
|
|
68
|
+
proxy: createViteProxy(workspaceConfig)
|
|
69
|
+
} : void 0;
|
|
70
|
+
const define = {
|
|
71
|
+
"import.meta.env.VITE_BGL_PROXY": JSON.stringify(workspaceConfig.proxy),
|
|
72
|
+
"import.meta.env.VITE_BGL_HOST": JSON.stringify(workspaceConfig.host),
|
|
73
|
+
...workspaceConfig.openapi_url && {
|
|
74
|
+
"import.meta.env.VITE_BGL_OPENAPI_URL": JSON.stringify(workspaceConfig.openapi_url)
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
return {
|
|
78
|
+
resolve: {
|
|
79
|
+
alias
|
|
80
|
+
},
|
|
81
|
+
define,
|
|
82
|
+
...server && { server }
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
exports.generateNetlifyConfig = netlify.generateNetlifyConfig;
|
|
89
|
+
exports.setBuildEnvVars = netlify.setBuildEnvVars;
|
|
90
|
+
exports.writeNetlifyConfig = netlify.writeNetlifyConfig;
|
|
91
|
+
exports.bagelink = bagelink;
|
|
92
|
+
exports.createCustomProxy = createCustomProxy;
|
|
93
|
+
exports.createViteProxy = createViteProxy;
|
package/dist/vite.d.cts
CHANGED
|
@@ -1,2 +1,97 @@
|
|
|
1
|
-
import 'vite';
|
|
2
|
-
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
import { a as WorkspaceConfig, P as ProxyConfig, W as WorkspaceEnvironment } from './shared/workspace.D1xukL92.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Generate complete netlify.toml file
|
|
6
|
+
*/
|
|
7
|
+
declare function generateNetlifyConfig(config: WorkspaceConfig, additionalConfig?: string, useTemplate?: boolean): string;
|
|
8
|
+
/**
|
|
9
|
+
* Write netlify.toml file to disk
|
|
10
|
+
*/
|
|
11
|
+
declare function writeNetlifyConfig(config: WorkspaceConfig, outPath?: string, additionalConfig?: string, useTemplate?: boolean): void;
|
|
12
|
+
/**
|
|
13
|
+
* Set environment variables for build process
|
|
14
|
+
*/
|
|
15
|
+
declare function setBuildEnvVars(config: WorkspaceConfig): void;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Create Vite proxy configuration from WorkspaceConfig
|
|
19
|
+
*/
|
|
20
|
+
declare function createViteProxy(config: WorkspaceConfig): ProxyConfig;
|
|
21
|
+
/**
|
|
22
|
+
* Create custom proxy configuration
|
|
23
|
+
*/
|
|
24
|
+
declare function createCustomProxy(paths: string[], target: string, options?: {
|
|
25
|
+
changeOrigin?: boolean;
|
|
26
|
+
rewrite?: boolean;
|
|
27
|
+
secure?: boolean;
|
|
28
|
+
}): ProxyConfig;
|
|
29
|
+
|
|
30
|
+
interface BagelinkPluginOptions {
|
|
31
|
+
/**
|
|
32
|
+
* Path to shared package relative to project
|
|
33
|
+
* @default '../shared'
|
|
34
|
+
*/
|
|
35
|
+
sharedPath?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Whether to include @shared alias
|
|
38
|
+
* @default true
|
|
39
|
+
*/
|
|
40
|
+
includeSharedAlias?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Additional path aliases beyond @ and @shared
|
|
43
|
+
*/
|
|
44
|
+
additionalAliases?: Record<string, string>;
|
|
45
|
+
/**
|
|
46
|
+
* Whether to auto-configure proxy
|
|
47
|
+
* @default true
|
|
48
|
+
*/
|
|
49
|
+
configureProxy?: boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Vite plugin for Bagelink workspace integration
|
|
53
|
+
* Automatically configures proxy and path aliases based on bgl.config.ts
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* import { defineConfig } from 'vite'
|
|
58
|
+
* import vue from '@vitejs/plugin-vue'
|
|
59
|
+
* import { bagelink } from '@bagelink/workspace/vite'
|
|
60
|
+
* import workspace from './bgl.config'
|
|
61
|
+
*
|
|
62
|
+
* export default defineConfig({
|
|
63
|
+
* plugins: [
|
|
64
|
+
* vue(),
|
|
65
|
+
* bagelink({ workspace })
|
|
66
|
+
* ]
|
|
67
|
+
* })
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @example With custom options
|
|
71
|
+
* ```ts
|
|
72
|
+
* import { defineConfig } from 'vite'
|
|
73
|
+
* import vue from '@vitejs/plugin-vue'
|
|
74
|
+
* import { bagelink } from '@bagelink/workspace/vite'
|
|
75
|
+
* import workspace from './bgl.config'
|
|
76
|
+
*
|
|
77
|
+
* export default defineConfig({
|
|
78
|
+
* plugins: [
|
|
79
|
+
* vue(),
|
|
80
|
+
* bagelink({
|
|
81
|
+
* workspace,
|
|
82
|
+
* sharedPath: '../packages/shared',
|
|
83
|
+
* additionalAliases: {
|
|
84
|
+
* '@utils': fileURLToPath(new URL('./src/utils', import.meta.url))
|
|
85
|
+
* }
|
|
86
|
+
* })
|
|
87
|
+
* ]
|
|
88
|
+
* })
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
declare function bagelink(options: {
|
|
92
|
+
workspace: (mode: WorkspaceEnvironment) => WorkspaceConfig;
|
|
93
|
+
config?: BagelinkPluginOptions;
|
|
94
|
+
}): Plugin;
|
|
95
|
+
|
|
96
|
+
export { bagelink, createCustomProxy, createViteProxy, generateNetlifyConfig, setBuildEnvVars, writeNetlifyConfig };
|
|
97
|
+
export type { BagelinkPluginOptions };
|
package/dist/vite.d.mts
CHANGED
|
@@ -1,2 +1,97 @@
|
|
|
1
|
-
import 'vite';
|
|
2
|
-
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
import { a as WorkspaceConfig, P as ProxyConfig, W as WorkspaceEnvironment } from './shared/workspace.D1xukL92.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Generate complete netlify.toml file
|
|
6
|
+
*/
|
|
7
|
+
declare function generateNetlifyConfig(config: WorkspaceConfig, additionalConfig?: string, useTemplate?: boolean): string;
|
|
8
|
+
/**
|
|
9
|
+
* Write netlify.toml file to disk
|
|
10
|
+
*/
|
|
11
|
+
declare function writeNetlifyConfig(config: WorkspaceConfig, outPath?: string, additionalConfig?: string, useTemplate?: boolean): void;
|
|
12
|
+
/**
|
|
13
|
+
* Set environment variables for build process
|
|
14
|
+
*/
|
|
15
|
+
declare function setBuildEnvVars(config: WorkspaceConfig): void;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Create Vite proxy configuration from WorkspaceConfig
|
|
19
|
+
*/
|
|
20
|
+
declare function createViteProxy(config: WorkspaceConfig): ProxyConfig;
|
|
21
|
+
/**
|
|
22
|
+
* Create custom proxy configuration
|
|
23
|
+
*/
|
|
24
|
+
declare function createCustomProxy(paths: string[], target: string, options?: {
|
|
25
|
+
changeOrigin?: boolean;
|
|
26
|
+
rewrite?: boolean;
|
|
27
|
+
secure?: boolean;
|
|
28
|
+
}): ProxyConfig;
|
|
29
|
+
|
|
30
|
+
interface BagelinkPluginOptions {
|
|
31
|
+
/**
|
|
32
|
+
* Path to shared package relative to project
|
|
33
|
+
* @default '../shared'
|
|
34
|
+
*/
|
|
35
|
+
sharedPath?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Whether to include @shared alias
|
|
38
|
+
* @default true
|
|
39
|
+
*/
|
|
40
|
+
includeSharedAlias?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Additional path aliases beyond @ and @shared
|
|
43
|
+
*/
|
|
44
|
+
additionalAliases?: Record<string, string>;
|
|
45
|
+
/**
|
|
46
|
+
* Whether to auto-configure proxy
|
|
47
|
+
* @default true
|
|
48
|
+
*/
|
|
49
|
+
configureProxy?: boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Vite plugin for Bagelink workspace integration
|
|
53
|
+
* Automatically configures proxy and path aliases based on bgl.config.ts
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* import { defineConfig } from 'vite'
|
|
58
|
+
* import vue from '@vitejs/plugin-vue'
|
|
59
|
+
* import { bagelink } from '@bagelink/workspace/vite'
|
|
60
|
+
* import workspace from './bgl.config'
|
|
61
|
+
*
|
|
62
|
+
* export default defineConfig({
|
|
63
|
+
* plugins: [
|
|
64
|
+
* vue(),
|
|
65
|
+
* bagelink({ workspace })
|
|
66
|
+
* ]
|
|
67
|
+
* })
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @example With custom options
|
|
71
|
+
* ```ts
|
|
72
|
+
* import { defineConfig } from 'vite'
|
|
73
|
+
* import vue from '@vitejs/plugin-vue'
|
|
74
|
+
* import { bagelink } from '@bagelink/workspace/vite'
|
|
75
|
+
* import workspace from './bgl.config'
|
|
76
|
+
*
|
|
77
|
+
* export default defineConfig({
|
|
78
|
+
* plugins: [
|
|
79
|
+
* vue(),
|
|
80
|
+
* bagelink({
|
|
81
|
+
* workspace,
|
|
82
|
+
* sharedPath: '../packages/shared',
|
|
83
|
+
* additionalAliases: {
|
|
84
|
+
* '@utils': fileURLToPath(new URL('./src/utils', import.meta.url))
|
|
85
|
+
* }
|
|
86
|
+
* })
|
|
87
|
+
* ]
|
|
88
|
+
* })
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
declare function bagelink(options: {
|
|
92
|
+
workspace: (mode: WorkspaceEnvironment) => WorkspaceConfig;
|
|
93
|
+
config?: BagelinkPluginOptions;
|
|
94
|
+
}): Plugin;
|
|
95
|
+
|
|
96
|
+
export { bagelink, createCustomProxy, createViteProxy, generateNetlifyConfig, setBuildEnvVars, writeNetlifyConfig };
|
|
97
|
+
export type { BagelinkPluginOptions };
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,2 +1,97 @@
|
|
|
1
|
-
import 'vite';
|
|
2
|
-
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
import { a as WorkspaceConfig, P as ProxyConfig, W as WorkspaceEnvironment } from './shared/workspace.D1xukL92.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Generate complete netlify.toml file
|
|
6
|
+
*/
|
|
7
|
+
declare function generateNetlifyConfig(config: WorkspaceConfig, additionalConfig?: string, useTemplate?: boolean): string;
|
|
8
|
+
/**
|
|
9
|
+
* Write netlify.toml file to disk
|
|
10
|
+
*/
|
|
11
|
+
declare function writeNetlifyConfig(config: WorkspaceConfig, outPath?: string, additionalConfig?: string, useTemplate?: boolean): void;
|
|
12
|
+
/**
|
|
13
|
+
* Set environment variables for build process
|
|
14
|
+
*/
|
|
15
|
+
declare function setBuildEnvVars(config: WorkspaceConfig): void;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Create Vite proxy configuration from WorkspaceConfig
|
|
19
|
+
*/
|
|
20
|
+
declare function createViteProxy(config: WorkspaceConfig): ProxyConfig;
|
|
21
|
+
/**
|
|
22
|
+
* Create custom proxy configuration
|
|
23
|
+
*/
|
|
24
|
+
declare function createCustomProxy(paths: string[], target: string, options?: {
|
|
25
|
+
changeOrigin?: boolean;
|
|
26
|
+
rewrite?: boolean;
|
|
27
|
+
secure?: boolean;
|
|
28
|
+
}): ProxyConfig;
|
|
29
|
+
|
|
30
|
+
interface BagelinkPluginOptions {
|
|
31
|
+
/**
|
|
32
|
+
* Path to shared package relative to project
|
|
33
|
+
* @default '../shared'
|
|
34
|
+
*/
|
|
35
|
+
sharedPath?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Whether to include @shared alias
|
|
38
|
+
* @default true
|
|
39
|
+
*/
|
|
40
|
+
includeSharedAlias?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Additional path aliases beyond @ and @shared
|
|
43
|
+
*/
|
|
44
|
+
additionalAliases?: Record<string, string>;
|
|
45
|
+
/**
|
|
46
|
+
* Whether to auto-configure proxy
|
|
47
|
+
* @default true
|
|
48
|
+
*/
|
|
49
|
+
configureProxy?: boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Vite plugin for Bagelink workspace integration
|
|
53
|
+
* Automatically configures proxy and path aliases based on bgl.config.ts
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* import { defineConfig } from 'vite'
|
|
58
|
+
* import vue from '@vitejs/plugin-vue'
|
|
59
|
+
* import { bagelink } from '@bagelink/workspace/vite'
|
|
60
|
+
* import workspace from './bgl.config'
|
|
61
|
+
*
|
|
62
|
+
* export default defineConfig({
|
|
63
|
+
* plugins: [
|
|
64
|
+
* vue(),
|
|
65
|
+
* bagelink({ workspace })
|
|
66
|
+
* ]
|
|
67
|
+
* })
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @example With custom options
|
|
71
|
+
* ```ts
|
|
72
|
+
* import { defineConfig } from 'vite'
|
|
73
|
+
* import vue from '@vitejs/plugin-vue'
|
|
74
|
+
* import { bagelink } from '@bagelink/workspace/vite'
|
|
75
|
+
* import workspace from './bgl.config'
|
|
76
|
+
*
|
|
77
|
+
* export default defineConfig({
|
|
78
|
+
* plugins: [
|
|
79
|
+
* vue(),
|
|
80
|
+
* bagelink({
|
|
81
|
+
* workspace,
|
|
82
|
+
* sharedPath: '../packages/shared',
|
|
83
|
+
* additionalAliases: {
|
|
84
|
+
* '@utils': fileURLToPath(new URL('./src/utils', import.meta.url))
|
|
85
|
+
* }
|
|
86
|
+
* })
|
|
87
|
+
* ]
|
|
88
|
+
* })
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
declare function bagelink(options: {
|
|
92
|
+
workspace: (mode: WorkspaceEnvironment) => WorkspaceConfig;
|
|
93
|
+
config?: BagelinkPluginOptions;
|
|
94
|
+
}): Plugin;
|
|
95
|
+
|
|
96
|
+
export { bagelink, createCustomProxy, createViteProxy, generateNetlifyConfig, setBuildEnvVars, writeNetlifyConfig };
|
|
97
|
+
export type { BagelinkPluginOptions };
|