@blocklet/pages-kit-block-studio 0.4.66 → 0.4.67

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.
@@ -47,6 +47,7 @@ const constants_1 = require("../constants");
47
47
  // 导入Zod相关工具
48
48
  const block_props_utils_1 = require("../utils/block-props-utils");
49
49
  const helper_1 = require("../utils/helper");
50
+ const ts_morph_utils_1 = require("../utils/ts-morph-utils");
50
51
  const zod_utils_1 = require("../utils/zod-utils");
51
52
  exports.initBlockStudioRouter = (0, express_1.Router)();
52
53
  const BINARY_EXTENSIONS = ['.png', '.jpg', '.jpeg', '.gif', '.webp', '.ico', '.svg'];
@@ -308,7 +309,13 @@ exports.initBlockStudioRouter.post('/interface-to-properties', async (req, res)
308
309
  return res.status(404).json({ success: false, error: 'BlockProps interface not found or could not be parsed' });
309
310
  }
310
311
  try {
311
- const newProperties = await (0, zod_utils_1.tsFileInterfaceToProperties)(componentPath, 'BlockProps', currentMetadata.properties || {});
312
+ const zodSchema = await (0, ts_morph_utils_1.tsFileToZodSchema)(componentPath, 'BlockProps');
313
+ const jsonSchema = (0, zod_utils_1.zodSchemaToJsonSchema)(zodSchema);
314
+ const newProperties = (0, zod_utils_1.jsonSchemaToProperties)(jsonSchema, {
315
+ existingProperties: currentMetadata.properties || {},
316
+ key: '',
317
+ isRoot: true,
318
+ });
312
319
  // 如果请求要求写入文件
313
320
  if (write) {
314
321
  // 更新元数据