@blocklet/pages-kit-block-studio 0.1.3 → 0.1.4
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 @@ exports.initBlockStudioPlugins = initBlockStudioPlugins;
|
|
|
47
47
|
// import typescript from '@rollup/plugin-typescript';
|
|
48
48
|
const fs_1 = require("fs");
|
|
49
49
|
const path = __importStar(require("path"));
|
|
50
|
+
const ufo_1 = require("ufo");
|
|
50
51
|
const vite_plugin_react_pages_1 = __importStar(require("vite-plugin-react-pages"));
|
|
51
52
|
const helper_1 = require("../utils/helper");
|
|
52
53
|
const vite_plugin_html_transform_1 = require("./vite-plugin-html-transform");
|
|
@@ -162,21 +163,23 @@ function initBlockStudioPlugins(options) {
|
|
|
162
163
|
const pageId = `/${blockName}`;
|
|
163
164
|
const dirPath = path.dirname(filePath);
|
|
164
165
|
const metadataPath = path.join(dirPath, '@metadata.json');
|
|
166
|
+
const dataPath = isHtml ? `${vite_plugin_html_transform_1.VIRTUAL_MODULE_ID}?dir=${dirPath}` : filePath;
|
|
165
167
|
api.addPageData({
|
|
166
168
|
pageId,
|
|
167
|
-
dataPath
|
|
169
|
+
dataPath,
|
|
168
170
|
staticData: isHtml
|
|
169
171
|
? {
|
|
170
|
-
|
|
171
|
-
dataPath
|
|
172
|
+
isHtml: true,
|
|
173
|
+
dataPath,
|
|
172
174
|
code: (0, vite_plugin_html_transform_1.generateComponent)((0, vite_plugin_html_transform_1.readHtmlFiles)(dirPath)),
|
|
173
175
|
blockName,
|
|
174
176
|
dirPath,
|
|
177
|
+
importPath: (0, ufo_1.joinURL)('@id', dataPath),
|
|
175
178
|
metadataPath,
|
|
176
179
|
}
|
|
177
|
-
: Object.assign(Object.assign({}, (yield helpers.extractStaticData(file))), { code: (0, fs_1.readFileSync)(file.path, 'utf-8'), dataPath
|
|
178
|
-
|
|
179
|
-
metadataPath }),
|
|
180
|
+
: Object.assign(Object.assign({}, (yield helpers.extractStaticData(file))), { code: (0, fs_1.readFileSync)(file.path, 'utf-8'), dataPath,
|
|
181
|
+
blockName,
|
|
182
|
+
dirPath, importPath: (0, ufo_1.joinURL)('@fs', dataPath), metadataPath }),
|
|
180
183
|
});
|
|
181
184
|
});
|
|
182
185
|
});
|