@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.
- package/lib/cjs/middlewares/init-resource-router.js +1 -1
- package/lib/cjs/plugins/vite-plugin-block-studio.js +8 -2
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/utils/build-lib.js +3 -4
- package/lib/cjs/utils/helper.js +2 -1
- package/lib/esm/middlewares/init-resource-router.js +2 -2
- package/lib/esm/plugins/vite-plugin-block-studio.js +8 -2
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/utils/build-lib.js +1 -2
- package/lib/esm/utils/helper.js +1 -0
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/lib/types/utils/helper.d.ts +1 -0
- package/package.json +1 -1
|
@@ -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,
|
|
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=${
|
|
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
|
});
|