@bagelink/workspace 1.7.37 → 1.7.41
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 +20 -5
- package/dist/bin/bgl.cjs +1012 -14
- package/dist/bin/bgl.mjs +1001 -4
- 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 -150
- package/dist/index.d.cts +4 -172
- package/dist/index.d.mts +4 -172
- package/dist/index.d.ts +4 -172
- package/dist/index.mjs +2 -126
- 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 +6 -1
- package/src/index.ts +9 -77
- 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
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import process from 'node:process';
|
|
2
|
-
import { fileURLToPath } from 'node:url';
|
|
3
|
-
|
|
4
|
-
function createViteProxy(config) {
|
|
5
|
-
const proxy = {};
|
|
6
|
-
if (config.proxy && config.host) {
|
|
7
|
-
proxy[config.proxy] = {
|
|
8
|
-
target: config.host,
|
|
9
|
-
changeOrigin: true,
|
|
10
|
-
rewrite: (path) => path.replace(new RegExp(`^${config.proxy}`), ""),
|
|
11
|
-
secure: true
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
if (config.host) {
|
|
15
|
-
proxy["/files"] = {
|
|
16
|
-
target: config.host,
|
|
17
|
-
changeOrigin: true,
|
|
18
|
-
secure: true
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
return proxy;
|
|
22
|
-
}
|
|
23
|
-
function createCustomProxy(paths, target, options = {}) {
|
|
24
|
-
const proxy = {};
|
|
25
|
-
for (const path of paths) {
|
|
26
|
-
proxy[path] = {
|
|
27
|
-
target,
|
|
28
|
-
changeOrigin: options.changeOrigin ?? true,
|
|
29
|
-
secure: options.secure ?? true,
|
|
30
|
-
...options.rewrite === true && {
|
|
31
|
-
rewrite: (p) => p.replace(new RegExp(`^${path}`), "")
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
return proxy;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function bagelink(options) {
|
|
39
|
-
const { workspace, config = {} } = options;
|
|
40
|
-
let workspaceConfig;
|
|
41
|
-
return {
|
|
42
|
-
name: "vite-plugin-bagelink",
|
|
43
|
-
enforce: "pre",
|
|
44
|
-
configResolved(resolved) {
|
|
45
|
-
workspaceConfig = workspace(resolved.mode);
|
|
46
|
-
},
|
|
47
|
-
config(userConfig, { mode }) {
|
|
48
|
-
workspaceConfig = workspace(mode);
|
|
49
|
-
const alias = {};
|
|
50
|
-
if (config.includeSharedAlias !== false) {
|
|
51
|
-
const sharedPath = config.sharedPath ?? "../shared";
|
|
52
|
-
alias["@shared"] = fileURLToPath(new URL(sharedPath, `file://${process.cwd()}/`));
|
|
53
|
-
}
|
|
54
|
-
alias["@"] = fileURLToPath(new URL("./src", `file://${process.cwd()}/`));
|
|
55
|
-
if (config.additionalAliases) {
|
|
56
|
-
Object.assign(alias, config.additionalAliases);
|
|
57
|
-
}
|
|
58
|
-
const server = config.configureProxy !== false ? {
|
|
59
|
-
proxy: createViteProxy(workspaceConfig)
|
|
60
|
-
} : void 0;
|
|
61
|
-
const define = {
|
|
62
|
-
"import.meta.env.VITE_BGL_PROXY": JSON.stringify(workspaceConfig.proxy),
|
|
63
|
-
"import.meta.env.VITE_BGL_HOST": JSON.stringify(workspaceConfig.host),
|
|
64
|
-
...workspaceConfig.openapi_url && {
|
|
65
|
-
"import.meta.env.VITE_BGL_OPENAPI_URL": JSON.stringify(workspaceConfig.openapi_url)
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
return {
|
|
69
|
-
resolve: {
|
|
70
|
-
alias
|
|
71
|
-
},
|
|
72
|
-
define,
|
|
73
|
-
...server && { server }
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export { createCustomProxy as a, bagelink as b, createViteProxy as c };
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const process = require('node:process');
|
|
4
|
-
const node_url = require('node:url');
|
|
5
|
-
|
|
6
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
7
|
-
|
|
8
|
-
const process__default = /*#__PURE__*/_interopDefaultCompat(process);
|
|
9
|
-
|
|
10
|
-
function createViteProxy(config) {
|
|
11
|
-
const proxy = {};
|
|
12
|
-
if (config.proxy && config.host) {
|
|
13
|
-
proxy[config.proxy] = {
|
|
14
|
-
target: config.host,
|
|
15
|
-
changeOrigin: true,
|
|
16
|
-
rewrite: (path) => path.replace(new RegExp(`^${config.proxy}`), ""),
|
|
17
|
-
secure: true
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
if (config.host) {
|
|
21
|
-
proxy["/files"] = {
|
|
22
|
-
target: config.host,
|
|
23
|
-
changeOrigin: true,
|
|
24
|
-
secure: true
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
return proxy;
|
|
28
|
-
}
|
|
29
|
-
function createCustomProxy(paths, target, options = {}) {
|
|
30
|
-
const proxy = {};
|
|
31
|
-
for (const path of paths) {
|
|
32
|
-
proxy[path] = {
|
|
33
|
-
target,
|
|
34
|
-
changeOrigin: options.changeOrigin ?? true,
|
|
35
|
-
secure: options.secure ?? true,
|
|
36
|
-
...options.rewrite === true && {
|
|
37
|
-
rewrite: (p) => p.replace(new RegExp(`^${path}`), "")
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
return proxy;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function bagelink(options) {
|
|
45
|
-
const { workspace, config = {} } = options;
|
|
46
|
-
let workspaceConfig;
|
|
47
|
-
return {
|
|
48
|
-
name: "vite-plugin-bagelink",
|
|
49
|
-
enforce: "pre",
|
|
50
|
-
configResolved(resolved) {
|
|
51
|
-
workspaceConfig = workspace(resolved.mode);
|
|
52
|
-
},
|
|
53
|
-
config(userConfig, { mode }) {
|
|
54
|
-
workspaceConfig = workspace(mode);
|
|
55
|
-
const alias = {};
|
|
56
|
-
if (config.includeSharedAlias !== false) {
|
|
57
|
-
const sharedPath = config.sharedPath ?? "../shared";
|
|
58
|
-
alias["@shared"] = node_url.fileURLToPath(new URL(sharedPath, `file://${process__default.cwd()}/`));
|
|
59
|
-
}
|
|
60
|
-
alias["@"] = node_url.fileURLToPath(new URL("./src", `file://${process__default.cwd()}/`));
|
|
61
|
-
if (config.additionalAliases) {
|
|
62
|
-
Object.assign(alias, config.additionalAliases);
|
|
63
|
-
}
|
|
64
|
-
const server = config.configureProxy !== false ? {
|
|
65
|
-
proxy: createViteProxy(workspaceConfig)
|
|
66
|
-
} : void 0;
|
|
67
|
-
const define = {
|
|
68
|
-
"import.meta.env.VITE_BGL_PROXY": JSON.stringify(workspaceConfig.proxy),
|
|
69
|
-
"import.meta.env.VITE_BGL_HOST": JSON.stringify(workspaceConfig.host),
|
|
70
|
-
...workspaceConfig.openapi_url && {
|
|
71
|
-
"import.meta.env.VITE_BGL_OPENAPI_URL": JSON.stringify(workspaceConfig.openapi_url)
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
return {
|
|
75
|
-
resolve: {
|
|
76
|
-
alias
|
|
77
|
-
},
|
|
78
|
-
define,
|
|
79
|
-
...server && { server }
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
exports.bagelink = bagelink;
|
|
86
|
-
exports.createCustomProxy = createCustomProxy;
|
|
87
|
-
exports.createViteProxy = createViteProxy;
|