@blocklet/pages-kit-block-studio 0.0.11 → 0.0.12

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.
@@ -153,7 +153,7 @@ exports.initResourceRouter.post('/', (req, res) => __awaiter(void 0, void 0, voi
153
153
  fs_1.default.rmSync(dir, { recursive: true, force: true });
154
154
  fs_1.default.mkdirSync(dir, { recursive: true });
155
155
  const rootDir = process.cwd();
156
- const tmpPackage = (0, path_1.join)(rootDir, 'lib');
156
+ const tmpPackage = (0, path_1.join)(rootDir, helper_1.libDir);
157
157
  yield copyRecursive(tmpPackage, dir);
158
158
  fs_1.default.rmSync(tmpPackage, { recursive: true, force: true });
159
159
  res.json({ success: true });
@@ -157,16 +157,22 @@ function initBlockStudioPlugins(options) {
157
157
  const isHtml = relative.endsWith('.html');
158
158
  const blockName = (0, helper_1.getBlockName)(relative);
159
159
  const pageId = `/${blockName}`;
160
+ const dirPath = path.dirname(filePath);
161
+ const metadataPath = path.join(dirPath, '@metadata.json');
160
162
  api.addPageData({
161
163
  pageId,
162
- dataPath: isHtml ? `${vite_plugin_html_transform_1.VIRTUAL_MODULE_ID}?dir=${path.dirname(filePath)}` : filePath,
164
+ dataPath: isHtml ? `${vite_plugin_html_transform_1.VIRTUAL_MODULE_ID}?dir=${dirPath}` : filePath,
163
165
  staticData: isHtml
164
166
  ? {
165
167
  isHtmlPreview: true,
166
168
  dataPath: filePath,
167
169
  blockName,
170
+ dirPath,
171
+ metadataPath,
168
172
  }
169
- : Object.assign(Object.assign({}, (yield helpers.extractStaticData(file))), { code: (0, fs_1.readFileSync)(file.path, 'utf-8'), dataPath: filePath, blockName }),
173
+ : Object.assign(Object.assign({}, (yield helpers.extractStaticData(file))), { code: (0, fs_1.readFileSync)(file.path, 'utf-8'), dataPath: filePath, blockName,
174
+ dirPath,
175
+ metadataPath }),
170
176
  });
171
177
  });
172
178
  });