slidestudio 0.4.0 → 0.4.1

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.
@@ -4432,8 +4432,11 @@ const server = http.createServer(diagnostics.wrap(async (req, res) => {
4432
4432
  res.writeHead(404);
4433
4433
  return res.end("not found");
4434
4434
  }
4435
- const runtimeFile = path.join(ROOT, "packages/pptd-v2/dist", name);
4436
- if (!fs.existsSync(runtimeFile)) {
4435
+ const runtimeFile = [
4436
+ path.join(ROOT, "packages/pptd-v2/dist", name),
4437
+ path.join(ROOT, "node_modules/@open-slidestudio/pptd-v2/dist", name),
4438
+ ].find((candidate) => fs.existsSync(candidate));
4439
+ if (!runtimeFile) {
4437
4440
  return json(res, 503, {
4438
4441
  error: `${name} runtime missing; run npm run build:native`,
4439
4442
  });
@@ -25,7 +25,17 @@ function parseBundledFontFamilies(fontsCssPath) {
25
25
  continue;
26
26
  const weightMatch = /font-weight:\s*(\d+)/.exec(block);
27
27
  const style = /font-style:\s*italic\b/i.test(block) ? "italic" : undefined;
28
- const file = path.resolve(path.dirname(fontsCssPath), src[1].trim());
28
+ const rawSrc = src[1].trim();
29
+ let file = path.resolve(path.dirname(fontsCssPath), rawSrc);
30
+ if (!fs.existsSync(file) && rawSrc.startsWith("./fonts/")) {
31
+ // 独立精简包的按需中文字体缓存在 SLIDESTUDIO_ASSETS_DIR/fonts。
32
+ const assetsDir = process.env.SLIDESTUDIO_ASSETS_DIR?.trim();
33
+ if (assetsDir) {
34
+ const cached = path.join(assetsDir, "fonts", path.basename(rawSrc));
35
+ if (fs.existsSync(cached))
36
+ file = cached;
37
+ }
38
+ }
29
39
  if (!fs.existsSync(file))
30
40
  continue;
31
41
  const list = families.get(family) ?? [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slidestudio",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "type": "module",
5
5
  "description": "Standalone SlideStudio CLI and MCP server",
6
6
  "license": "Apache-2.0",
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "type": "module",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "standaloneAssets": {
5
- "version": "0.4.0",
6
- "sha256": "7bcbdbdcef007dc29c93b0ae88174c9216ed25c67d7d0cd0bb5b219df063e177"
5
+ "version": "0.4.1",
6
+ "sha256": "15d6491bd9da7e91a1f8a0c987039c9316c98d1f094851f68e9d59d959b90db5"
7
7
  }
8
8
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "type": "module",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "standaloneAssets": {
5
- "version": "0.4.0",
6
- "sha256": "7bcbdbdcef007dc29c93b0ae88174c9216ed25c67d7d0cd0bb5b219df063e177"
5
+ "version": "0.4.1",
6
+ "sha256": "15d6491bd9da7e91a1f8a0c987039c9316c98d1f094851f68e9d59d959b90db5"
7
7
  }
8
8
  }