@blocklet/pages-kit-block-studio 0.4.70 → 0.4.72
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/constants/index.js +1 -1
- package/lib/cjs/constants/new-block-template/@metadata.json +2 -2
- package/lib/cjs/constants/new-block-template/index.js +2 -2
- package/lib/cjs/constants/new-block-template/index.tsx +1 -1
- package/lib/cjs/middlewares/init-block-studio-router.js +1 -0
- package/lib/cjs/middlewares/init-resource-router.js +1 -1
- package/lib/cjs/plugins/_theme.js +1 -1
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/utils/helper.js +4 -5
- package/lib/esm/constants/index.js +1 -1
- package/lib/esm/constants/new-block-template/@metadata.json +2 -2
- package/lib/esm/constants/new-block-template/index.js +1 -1
- package/lib/esm/constants/new-block-template/index.tsx +1 -1
- package/lib/esm/middlewares/init-block-studio-router.js +1 -0
- package/lib/esm/middlewares/init-resource-router.js +1 -1
- package/lib/esm/plugins/_theme.js +1 -1
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/utils/helper.js +3 -4
- package/lib/types/constants/index.d.ts +1 -1
- package/lib/types/constants/new-block-template/index.d.ts +1 -1
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/lib/types/utils/helper.d.ts +0 -1
- package/package.json +4 -4
package/lib/esm/utils/helper.js
CHANGED
|
@@ -79,7 +79,7 @@ export const downloadAsset = async ({ asset, savePath, componentDid, }) => {
|
|
|
79
79
|
await mkdir(path.dirname(savePath), { recursive: true });
|
|
80
80
|
// download asset from pages-kit's /uploads
|
|
81
81
|
const res = await call({
|
|
82
|
-
name:
|
|
82
|
+
name: componentDid,
|
|
83
83
|
path: joinURL('/uploads', fileName),
|
|
84
84
|
responseType: 'stream',
|
|
85
85
|
method: 'GET',
|
|
@@ -105,7 +105,7 @@ export function initializeMetadata(tempFilePath) {
|
|
|
105
105
|
if (!filePath) {
|
|
106
106
|
throw new Error('File path is required');
|
|
107
107
|
}
|
|
108
|
-
if (
|
|
108
|
+
if (fs.existsSync(filePath)) {
|
|
109
109
|
content = fs.readFileSync(filePath, 'utf-8');
|
|
110
110
|
}
|
|
111
111
|
let metadata = {};
|
|
@@ -133,7 +133,7 @@ export function initializeMetadata(tempFilePath) {
|
|
|
133
133
|
if (!metadata.name) {
|
|
134
134
|
metadata.name = getBlockName(filePath);
|
|
135
135
|
}
|
|
136
|
-
if (
|
|
136
|
+
if (!fs.existsSync(filePath)) {
|
|
137
137
|
fs.writeFileSync(filePath, JSON.stringify(metadata, null, 2));
|
|
138
138
|
}
|
|
139
139
|
return metadata;
|
|
@@ -144,7 +144,6 @@ export function generateYaml(metadata) {
|
|
|
144
144
|
export function getBlockStudioInfo() {
|
|
145
145
|
return config.components.find((c) => c.did === PAGES_KIT_BLOCK_STUDIO_DID);
|
|
146
146
|
}
|
|
147
|
-
export const isPagesKitBlockStudio = process.env.BLOCKLET_COMPONENT_DID === PAGES_KIT_BLOCK_STUDIO_DID;
|
|
148
147
|
export const getBlockCode = (filePath) => {
|
|
149
148
|
// Check path safety first
|
|
150
149
|
if (!isPathSafe(filePath)) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const PAGES_KIT_DID = "z8iZiDFg3vkkrPwsiba1TLXy3H9XHzFERsP8o";
|
|
2
2
|
export declare const PAGES_KIT_RESOURCE_TYPE = "page";
|
|
3
|
-
export declare const PAGES_KIT_BLOCK_STUDIO_DID = "
|
|
3
|
+
export declare const PAGES_KIT_BLOCK_STUDIO_DID = "z2qa7BQdkEb3TwYyEYC1psK6uvmGnHSUHt5RM";
|
|
4
4
|
export declare const PAGES_KIT_BLOCK_STUDIO_RESOURCE_TYPE = "page";
|
|
5
5
|
export declare const MEDIA_KIT_DID = "z8ia1mAXo8ZE7ytGF36L5uBf9kD2kenhqFGp9";
|
|
6
6
|
export declare const MEDIA_KIT_RESOURCE_TYPE = "imgpack";
|
|
@@ -14,7 +14,7 @@ export interface BlockProps {
|
|
|
14
14
|
/** @description id: x3lqht8ikble1itx | type: string | visible: false */
|
|
15
15
|
copyright?: string;
|
|
16
16
|
}
|
|
17
|
-
export default function
|
|
17
|
+
export default function BlockComponent({ title, logo, description, copyright }: BlockProps): import("react/jsx-runtime").JSX.Element;
|
|
18
18
|
export declare const EditComponent: React.FC<BlockProps & {
|
|
19
19
|
onChange?: (value: BlockProps) => void;
|
|
20
20
|
}>;
|