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

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.
@@ -122,7 +122,7 @@ exports.initBlockStudioRouter.post('/', async (req, res) => {
122
122
  try {
123
123
  const dir = path_1.default.dirname(filePath);
124
124
  if (!fs_1.default.existsSync(dir)) {
125
- fs_1.default.mkdirSync(dir, { recursive: true });
125
+ throw new Error('Directory not found');
126
126
  }
127
127
  const currentMetadata = (0, helper_1.initializeMetadata)(filePath);
128
128
  const mergedContent = { ...currentMetadata, ...content };
@@ -192,7 +192,7 @@ exports.initBlockStudioRouter.post('/create', async (req, res) => {
192
192
  return res.status(500).json({ error: 'Failed to create block' });
193
193
  }
194
194
  });
195
- exports.initBlockStudioRouter.get('/all', async (req, res) => {
195
+ exports.initBlockStudioRouter.get('/resources', async (req, res) => {
196
196
  const { withBlockletData = true } = req.query;
197
197
  const allBlocks = await (0, helper_1.findComponentFiles)();
198
198
  // get code to metadata
@@ -221,6 +221,10 @@ exports.initBlockStudioRouter.get('/all', async (req, res) => {
221
221
  }
222
222
  return res.json((0, lodash_1.keyBy)(allBlocksWithCode, 'id'));
223
223
  });
224
+ exports.initBlockStudioRouter.get('/components', async (_req, res) => {
225
+ const allBlocks = await (0, helper_1.findComponentFiles)();
226
+ return res.json(allBlocks);
227
+ });
224
228
  // 统一的属性到接口转换端点 - 可以预览或生成
225
229
  exports.initBlockStudioRouter.post('/properties-to-interface', async (req, res) => {
226
230
  const write = req.body.write === true;