@blocklet/pages-kit-block-studio 0.1.26 → 0.1.27
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/new-block-template/index.js +55 -0
- package/lib/cjs/middlewares/init-resource-router.js +5 -1
- package/lib/cjs/plugins/vite-plugin-html-transform.js +2 -0
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/constants/new-block-template/index.js +50 -0
- package/lib/esm/middlewares/init-resource-router.js +5 -1
- package/lib/esm/plugins/vite-plugin-html-transform.js +2 -0
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/types/constants/new-block-template/index.d.ts +13 -0
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/tsconfig.json +1 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.EditComponent = void 0;
|
|
15
|
+
exports.default = HelloWorld;
|
|
16
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
17
|
+
// default export
|
|
18
|
+
function HelloWorld({ title = 'Hello World', logo, description, copyright }) {
|
|
19
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
20
|
+
display: 'flex',
|
|
21
|
+
flexDirection: 'column',
|
|
22
|
+
alignItems: 'center',
|
|
23
|
+
padding: '16px 0',
|
|
24
|
+
}, children: [title && (0, jsx_runtime_1.jsx)("h1", { children: title }), logo && ((0, jsx_runtime_1.jsx)("img", { src: typeof logo === 'object' ? logo.url : logo, alt: "logo", style: {
|
|
25
|
+
margin: '16px 0',
|
|
26
|
+
maxWidth: '200px',
|
|
27
|
+
} })), description && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
28
|
+
color: '#666',
|
|
29
|
+
marginTop: '8px',
|
|
30
|
+
}, children: description })), copyright && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
31
|
+
color: '#999',
|
|
32
|
+
fontSize: '12px',
|
|
33
|
+
marginTop: '16px',
|
|
34
|
+
}, children: copyright }))] }));
|
|
35
|
+
}
|
|
36
|
+
// export edit component
|
|
37
|
+
const EditComponent = (_a) => {
|
|
38
|
+
var { onChange } = _a, props = __rest(_a, ["onChange"]);
|
|
39
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column', gap: '16px' }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
40
|
+
fontSize: '14px',
|
|
41
|
+
fontWeight: 500,
|
|
42
|
+
color: '#333',
|
|
43
|
+
padding: '8px 0',
|
|
44
|
+
borderBottom: '1px solid #eee',
|
|
45
|
+
}, children: "Footer Parameters" }), (0, jsx_runtime_1.jsx)("input", { id: "copyright-input", type: "text", style: {
|
|
46
|
+
width: '100%',
|
|
47
|
+
padding: '8px 12px',
|
|
48
|
+
border: '1px solid #ddd',
|
|
49
|
+
borderRadius: '4px',
|
|
50
|
+
fontSize: '14px',
|
|
51
|
+
transition: 'border-color 0.3s',
|
|
52
|
+
outline: 'none',
|
|
53
|
+
}, value: props.copyright || '', onChange: (e) => onChange === null || onChange === void 0 ? void 0 : onChange({ copyright: e.target.value }), placeholder: "Please Input Copyright" })] }));
|
|
54
|
+
};
|
|
55
|
+
exports.EditComponent = EditComponent;
|
|
@@ -140,7 +140,7 @@ exports.initResourceRouter.post('/', (req, res) => __awaiter(void 0, void 0, voi
|
|
|
140
140
|
const buildProcess = (0, child_process_1.spawn)('pnpm', ['run', 'build-lib'], {
|
|
141
141
|
stdio: 'inherit',
|
|
142
142
|
shell: true,
|
|
143
|
-
env: Object.assign(Object.assign({}, process.env), { FORCE_COLOR: '1', BLOCK_FILTER: componentIds.join(',') }),
|
|
143
|
+
env: Object.assign(Object.assign({}, process.env), { FORCE_COLOR: '1', BLOCK_FILTER: componentIds.join(','), NODE_OPTIONS: '--max_old_space_size=16384' }),
|
|
144
144
|
});
|
|
145
145
|
yield new Promise((resolve, reject) => {
|
|
146
146
|
buildProcess.on('close', (code) => {
|
|
@@ -149,6 +149,10 @@ exports.initResourceRouter.post('/', (req, res) => __awaiter(void 0, void 0, voi
|
|
|
149
149
|
else
|
|
150
150
|
reject(new Error(`Build process exited with code ${code}`));
|
|
151
151
|
});
|
|
152
|
+
buildProcess.on('error', (error) => {
|
|
153
|
+
console.error('Build process error:', error);
|
|
154
|
+
reject(error);
|
|
155
|
+
});
|
|
152
156
|
});
|
|
153
157
|
const dir = getExportDir(projectId, releaseId);
|
|
154
158
|
fs_1.default.rmSync(dir, { recursive: true, force: true });
|
|
@@ -21,6 +21,7 @@ exports.RESOLVED_VIRTUAL_MODULE_ID = `\0${exports.VIRTUAL_MODULE_ID}`;
|
|
|
21
21
|
const isRelativePath = (path) => {
|
|
22
22
|
return path.startsWith('./') || path.startsWith('../') || (!path.startsWith('http') && !path.startsWith('//'));
|
|
23
23
|
};
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
24
25
|
function extractExternalResources(html, _dirPath) {
|
|
25
26
|
const external = {
|
|
26
27
|
js: [],
|
|
@@ -204,6 +205,7 @@ ${content.trim()}`;
|
|
|
204
205
|
name: (0, path_1.basename)(dirPath),
|
|
205
206
|
};
|
|
206
207
|
}
|
|
208
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
207
209
|
function generateComponent(content, _isDev = true) {
|
|
208
210
|
const htmlContent = content.html;
|
|
209
211
|
const { name } = content;
|