@mbws/plugin-sdk 0.3.1 → 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 CHANGED
@@ -12,4 +12,4 @@ export declare const PROTOCOL_VERSION: 1;
12
12
  * SDK 自身版本(与 package.json version 保持一致)。
13
13
  * init-ack 上报给宿主做审计,与 manifest.sdk(build 写入)交叉核对。
14
14
  */
15
- export declare const SDK_VERSION = "0.3.1";
15
+ export declare const SDK_VERSION = "0.3.3";
package/dist/version.js CHANGED
@@ -12,4 +12,4 @@ export const PROTOCOL_VERSION = 1;
12
12
  * SDK 自身版本(与 package.json version 保持一致)。
13
13
  * init-ack 上报给宿主做审计,与 manifest.sdk(build 写入)交叉核对。
14
14
  */
15
- export const SDK_VERSION = "0.3.1";
15
+ export const SDK_VERSION = "0.3.3";
package/dist/vite.js CHANGED
@@ -32,6 +32,16 @@ const DEFAULT_API_BASE = "https://union.mobiwusi.com";
32
32
  function resolveApiBase(config) {
33
33
  return (config.apiBaseUrl ?? process.env.MBWS_API_BASE_URL ?? DEFAULT_API_BASE).replace(/\/+$/, "");
34
34
  }
35
+ /**
36
+ * 官方附件库地址(**构建期**解析 platforms hash 用):env > 线上,**刻意不走
37
+ * config.apiBaseUrl**——它是本地联调字段,而附件库是平台生产设施,产物 hash 必须
38
+ * 钉生产库(在线构建容器里按本地地址 fetch 会不可达)。
39
+ * dev 侧(spawn 附件下载 / dev manifest)直接用 resolveApiBase:dev 跑在开发者
40
+ * 本机,apiBaseUrl 指向的本地后端就是正确地址,免导环境变量。
41
+ */
42
+ function attachmentApiBase() {
43
+ return (process.env.MBWS_API_BASE_URL ?? DEFAULT_API_BASE).replace(/\/+$/, "");
44
+ }
35
45
  /** 读请求体(POST 等带 body 的转发用;GET/HEAD 直接跳过) */
36
46
  function readRequestBody(req) {
37
47
  return new Promise((resolve, reject) => {
@@ -182,7 +192,7 @@ export function mbwsVitePlugin(opts) {
182
192
  // mkdir 容错:在线构建场景 outDir 被平台覆盖,本目录可能不存在(写失败会炸构建)
183
193
  fs.mkdirSync(outDir, { recursive: true });
184
194
  const refs = config.attachments ?? [];
185
- const decls = refs.length > 0 ? await resolveAttachmentRefs(refs, resolveApiBase(config)) : [];
195
+ const decls = refs.length > 0 ? await resolveAttachmentRefs(refs, attachmentApiBase()) : [];
186
196
  fs.writeFileSync(path.join(outDir, "manifest.json"), `${JSON.stringify(buildManifest(config, { resolvedAttachments: decls }), null, 2)}\n`);
187
197
  },
188
198
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mbws/plugin-sdk",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Moye 插件开发 SDK——panel/viewer 与宿主的类型定义与运行时端口适配",
5
5
  "license": "MIT",
6
6
  "type": "module",