@mbws/plugin-sdk 0.3.2 → 0.3.3
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/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/vite.js +5 -3
- package/package.json +1 -1
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/dist/vite.js
CHANGED
|
@@ -33,9 +33,11 @@ function resolveApiBase(config) {
|
|
|
33
33
|
return (config.apiBaseUrl ?? process.env.MBWS_API_BASE_URL ?? DEFAULT_API_BASE).replace(/\/+$/, "");
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* 官方附件库地址(**构建期**解析 platforms hash 用):env > 线上,**刻意不走
|
|
37
37
|
* config.apiBaseUrl**——它是本地联调字段,而附件库是平台生产设施,产物 hash 必须
|
|
38
38
|
* 钉生产库(在线构建容器里按本地地址 fetch 会不可达)。
|
|
39
|
+
* dev 侧(spawn 附件下载 / dev manifest)直接用 resolveApiBase:dev 跑在开发者
|
|
40
|
+
* 本机,apiBaseUrl 指向的本地后端就是正确地址,免导环境变量。
|
|
39
41
|
*/
|
|
40
42
|
function attachmentApiBase() {
|
|
41
43
|
return (process.env.MBWS_API_BASE_URL ?? DEFAULT_API_BASE).replace(/\/+$/, "");
|
|
@@ -67,7 +69,7 @@ export function mbwsVitePlugin(opts) {
|
|
|
67
69
|
return [];
|
|
68
70
|
if (resolvedAttachmentsCache)
|
|
69
71
|
return resolvedAttachmentsCache;
|
|
70
|
-
resolvedAttachmentsCache = await resolveAttachmentRefs(refs,
|
|
72
|
+
resolvedAttachmentsCache = await resolveAttachmentRefs(refs, resolveApiBase(config));
|
|
71
73
|
return resolvedAttachmentsCache;
|
|
72
74
|
};
|
|
73
75
|
// manifest 是纯派生物,构建/供给共用同一序列化姿势(尾换行对齐文件写习惯)。
|
|
@@ -344,7 +346,7 @@ async function ensureLibraryAttachment(config, root, name, log) {
|
|
|
344
346
|
let resolved = devAttachmentResolves.get(resolveKey);
|
|
345
347
|
if (!resolved) {
|
|
346
348
|
try {
|
|
347
|
-
const response = await fetch(`${
|
|
349
|
+
const response = await fetch(`${resolveApiBase(config)}/api/plugin-attachments/resolve` +
|
|
348
350
|
`?name=${encodeURIComponent(name)}&version=${encodeURIComponent(ref.version)}` +
|
|
349
351
|
`&platform=${platform}`);
|
|
350
352
|
// 未登记/平台缺失/后端不可达都归「dev 不可用」,交给调用方 501 文案
|