xinyu-pro 0.22.0 → 0.22.2

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.
@@ -54,7 +54,10 @@ function rowToPlugin(row: Record<string, unknown>) {
54
54
  uiSlots: parseJsonField(row.ui_slots),
55
55
  ...perms,
56
56
  publicExports: parseJsonField(row.public_exports),
57
- dependencies: parseJsonField(row.dependencies),
57
+ dependencies: (() => {
58
+ const parsed = parseJsonField(row.dependencies);
59
+ return Array.isArray(parsed) ? parsed : [];
60
+ })(),
58
61
  createdAt: row.created_at,
59
62
  updatedAt: row.updated_at,
60
63
  };
@@ -2,6 +2,8 @@ import { NextRequest, NextResponse } from 'next/server';
2
2
  import { execute } from '@/lib/db';
3
3
  import { ensureDb } from '@/lib/db-init';
4
4
 
5
+ export const dynamic = 'force-dynamic';
6
+
5
7
  const SETTINGS_KEY = 'app_settings';
6
8
 
7
9
  export async function GET() {
package/lib/db.ts CHANGED
@@ -14,7 +14,9 @@ async function ensureDb(): Promise<SqlJsDatabase> {
14
14
  if (db) return db;
15
15
  if (!initPromise) {
16
16
  initPromise = (async () => {
17
- if (!SQL) SQL = await initSqlJs();
17
+ if (!SQL) SQL = await initSqlJs({
18
+ locateFile: (file: string) => join(process.cwd(), 'public', file),
19
+ });
18
20
  const dbPath = getDbPath();
19
21
  if (existsSync(dbPath)) {
20
22
  const buffer = readFileSync(dbPath);
@@ -774,7 +774,7 @@ class PluginRuntimeEngine {
774
774
  if (!callerInstance) {
775
775
  throw new Error(`[PluginRuntime] 调用方插件 ${callerPluginId} 未加载`);
776
776
  }
777
- const callerDeps = callerInstance.manifest.dependencies || [];
777
+ const callerDeps = Array.isArray(callerInstance.manifest.dependencies) ? callerInstance.manifest.dependencies : [];
778
778
  const hasDeclaredDep = callerDeps.some(d => d.pluginId === targetPluginId);
779
779
  if (!hasDeclaredDep) {
780
780
  throw new Error(`[PluginRuntime] 插件 ${callerPluginId} 未声明对 ${targetPluginId} 的依赖,请在 manifest.dependencies 中添加`);
@@ -844,7 +844,7 @@ class PluginRuntimeEngine {
844
844
 
845
845
  /** 检查插件的依赖状态 */
846
846
  checkDependencies(manifest: PluginManifest): DependencyStatus[] {
847
- const deps = manifest.dependencies || [];
847
+ const deps = Array.isArray(manifest.dependencies) ? manifest.dependencies : [];
848
848
  return deps.map(dep => {
849
849
  const targetInstance = this.state.instances.get(dep.pluginId);
850
850
  if (!targetInstance) {
@@ -897,7 +897,7 @@ class PluginRuntimeEngine {
897
897
  visiting.add(id);
898
898
 
899
899
  const manifest = manifestMap.get(id);
900
- if (manifest?.dependencies) {
900
+ if (Array.isArray(manifest?.dependencies)) {
901
901
  for (const dep of manifest.dependencies) {
902
902
  if (manifestMap.has(dep.pluginId)) {
903
903
  visit(dep.pluginId);
package/next.config.mjs CHANGED
@@ -6,6 +6,12 @@ const nextConfig = {
6
6
  typescript: {
7
7
  ignoreBuildErrors: true,
8
8
  },
9
+ webpack: (config, { isServer }) => {
10
+ if (isServer) {
11
+ config.externals = [...(Array.isArray(config.externals) ? config.externals : []), 'sql.js'];
12
+ }
13
+ return config;
14
+ },
9
15
  async headers() {
10
16
  const cspValue = [
11
17
  "default-src 'self'",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xinyu-pro",
3
- "version": "0.22.0",
3
+ "version": "0.22.2",
4
4
  "private": false,
5
5
  "description": "星语 Pro - AI 驱动的互动叙事平台",
6
6
  "author": "RestRegular",
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/version.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.22.0",
2
+ "version": "0.22.2",
3
3
  "name": "xinyu-pro",
4
4
  "displayName": "星语 Pro",
5
5
  "description": "AI 驱动的互动叙事平台"