@joplo-app/kit 0.6.0 → 0.6.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.
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@
11
11
  * 所有函数只返回数据;画板不会执行这些代码,只消费编译出的 IR。
12
12
  */
13
13
  import { type Bind, type CondExpr, type JNode } from './node.js';
14
- export { Custom, $, and, empty, eq, Fragment, neq, not, notEmpty, oneOf, or, Outlet, Slot } from './node.js';
14
+ export { isNode, isBind, bindPath, Custom, $, and, empty, eq, Fragment, neq, not, notEmpty, oneOf, or, Outlet, Slot } from './node.js';
15
15
  export type { Bind, CondExpr, JNode } from './node.js';
16
16
  export { asset } from './asset.js';
17
17
  import type { PluginDef } from './plugin.js';
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@
11
11
  * 所有函数只返回数据;画板不会执行这些代码,只消费编译出的 IR。
12
12
  */
13
13
  import { bindPath, callsite, isBind } from "./node.js";
14
- export { Custom, $, and, empty, eq, Fragment, neq, not, notEmpty, oneOf, or, Outlet, Slot } from "./node.js";
14
+ export { isNode, isBind, bindPath, Custom, $, and, empty, eq, Fragment, neq, not, notEmpty, oneOf, or, Outlet, Slot } from "./node.js";
15
15
  export { asset } from "./asset.js";
16
16
  export const config = (c) => ({ kind: 'config', ...c, source: callsite() });
17
17
  export const layout = (tree) => ({ kind: 'layout', tree, source: callsite() });
package/dist/plugin.d.ts CHANGED
@@ -234,6 +234,7 @@ export type LocalResourceInfo = {
234
234
  durationMs?: number;
235
235
  markers?: Record<string, number>;
236
236
  parts?: Record<string, number>;
237
+ partDurationsMs?: Record<string, number>;
237
238
  credit?: string;
238
239
  };
239
240
  /** Numeric decoded-audio region; encoded guard/delay/padding never count as music time. */
@@ -428,6 +429,11 @@ export declare function definePlugin(p: Omit<PluginDef, 'kind' | 'runtime' | 'ap
428
429
  local?: string | URL;
429
430
  }): PluginDef;
430
431
  export declare const isPluginDef: (v: unknown) => v is PluginDef;
432
+ /**
433
+ * config({ plugins }) 的一项为什么不是可用的插件清单(#60);是合格的清单时返回 null。
434
+ * 报错点名第几项与它实际是什么:插件包的默认导出多数是清单,少数是工厂函数(例如 alda(scores)),忘了调用最常见。
435
+ */
436
+ export declare function pluginEntryProblem(v: unknown, index: number): string | null;
431
437
  /** 组件类型名:`<插件 id>:<组件名>`。 */
432
438
  export declare const pluginType: (pluginId: string, name: string) => string;
433
439
  type Marker = (props: JoploProps) => any;
package/dist/plugin.js CHANGED
@@ -81,6 +81,26 @@ export function definePlugin(p) {
81
81
  return { ...p, kind: 'plugin', apiVersion: PLUGIN_API_VERSION, runtime: fileOf(p.runtime), local: p.local ? fileOf(p.local) : undefined };
82
82
  }
83
83
  export const isPluginDef = (v) => typeof v === 'object' && v !== null && v.kind === 'plugin' && typeof v.id === 'string';
84
+ /**
85
+ * config({ plugins }) 的一项为什么不是可用的插件清单(#60);是合格的清单时返回 null。
86
+ * 报错点名第几项与它实际是什么:插件包的默认导出多数是清单,少数是工厂函数(例如 alda(scores)),忘了调用最常见。
87
+ */
88
+ export function pluginEntryProblem(v, index) {
89
+ const at = `config.plugins[${index}]`;
90
+ if (typeof v === 'function') {
91
+ const name = v.name;
92
+ const call = typeof name === 'string' && /^[A-Za-z_$][\w$]*$/.test(name) ? `${name}(…)` : 'the factory with its options';
93
+ return `${at} is a function${typeof name === 'string' && name ? ` (${name})` : ''}, not a plugin manifest. This plugin's default export is a factory: call it, e.g. plugins: [${call}] (npx joplo skill plugins)`;
94
+ }
95
+ if (typeof v !== 'object' || v === null)
96
+ return `${at} is ${v === null ? 'null' : typeof v}, not a plugin manifest; list the plugin packages' default exports (npx joplo skill plugins)`;
97
+ const p = v;
98
+ if (p.kind !== 'plugin' || typeof p.id !== 'string')
99
+ return `${at} is an object that is not a Joplo plugin manifest (manifests come from a plugin package's default export, made with definePlugin)`;
100
+ if (p.apiVersion !== PLUGIN_API_VERSION)
101
+ return `${at} (${p.id}) targets plugin API ${String(p.apiVersion)}; this Joplo supports API ${PLUGIN_API_VERSION}. Update the plugin package to the same version as joplo`;
102
+ return null;
103
+ }
84
104
  /** 组件类型名:`<插件 id>:<组件名>`。 */
85
105
  export const pluginType = (pluginId, name) => `${pluginId}:${name}`;
86
106
  /** 插件组件的 JSX 标记:`export const Scene3D = Object.assign(pluginComponent(plugin, 'Scene'), { Target: pluginComponent(plugin, 'Target') })`。 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joplo-app/kit",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "Joplo 创作 SDK:用 work、切片与步骤编写可播放、可上手体验的作品;功能评审为作品添加方案比较、情况与规则;含 JSX 运行时(收集为数据,不作为 React 执行)",
5
5
  "license": "PolyForm-Shield-1.0.0",
6
6
  "type": "module",