@blocklet/pages-kit-block-studio 0.1.30 → 0.1.32
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-uploader-router.js +10 -6
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/utils/generate-wrapper-code.js +14 -1
- package/lib/esm/middlewares/init-uploader-router.js +10 -6
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/utils/generate-wrapper-code.js +14 -1
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -54,6 +54,14 @@ function generateWrapperCode(_a) {
|
|
|
54
54
|
main: 'index.cjs',
|
|
55
55
|
module: 'index.js',
|
|
56
56
|
types: 'index.d.ts',
|
|
57
|
+
peerDependencies: {
|
|
58
|
+
'@blocklet/pages-kit-runtime': 'latest',
|
|
59
|
+
'@blocklet/pages-kit-inner-components': 'latest',
|
|
60
|
+
'@blocklet/pages-kit': 'latest',
|
|
61
|
+
'@blocklet/uploader-server': 'latest',
|
|
62
|
+
'@arcblock/ux': 'latest',
|
|
63
|
+
'@mui/material': '5.16.7',
|
|
64
|
+
},
|
|
57
65
|
dependencies: {
|
|
58
66
|
'@blocklet/pages-kit-runtime': 'latest',
|
|
59
67
|
'@blocklet/pages-kit-inner-components': 'latest',
|
|
@@ -78,6 +86,7 @@ function generateWrapperCode(_a) {
|
|
|
78
86
|
import: './middleware.js',
|
|
79
87
|
types: './middleware.d.ts',
|
|
80
88
|
},
|
|
89
|
+
'./data.json': './data.json',
|
|
81
90
|
},
|
|
82
91
|
}, null, 2);
|
|
83
92
|
const client = `\
|
|
@@ -100,6 +109,8 @@ import { initPackResourceStates } from '@blocklet/pages-kit-inner-components/sit
|
|
|
100
109
|
import { initUploaderRouter } from '@blocklet/pages-kit-block-studio/init-uploader-router';
|
|
101
110
|
import { joinURL } from 'ufo';
|
|
102
111
|
|
|
112
|
+
import StateData from './data.json';
|
|
113
|
+
|
|
103
114
|
const router = Router();
|
|
104
115
|
|
|
105
116
|
router.use('/api/resources', initResourceRouter);
|
|
@@ -109,7 +120,7 @@ let tempStates: any[] = [];
|
|
|
109
120
|
let allResourcesComponents: any[] = [];
|
|
110
121
|
|
|
111
122
|
const PAGES_KIT_BLOCKLET_DID = 'z8iZiDFg3vkkrPwsiba1TLXy3H9XHzFERsP8o';
|
|
112
|
-
const PROJECT_ID = '${project.id}';
|
|
123
|
+
export const PROJECT_ID = '${project.id}';
|
|
113
124
|
|
|
114
125
|
initPackResourceStates(({ states }: any) => {
|
|
115
126
|
allResourcesComponents = states.reduce((acc, { state }) => {
|
|
@@ -124,6 +135,8 @@ initPackResourceStates(({ states }: any) => {
|
|
|
124
135
|
router.get('/api/pages', async (req, res) => {
|
|
125
136
|
const { did, projectId, siteFrom } = req.query;
|
|
126
137
|
|
|
138
|
+
console.log('get state data', StateData);
|
|
139
|
+
return res.json(StateData.state);
|
|
127
140
|
try {
|
|
128
141
|
// Case 1: Using did
|
|
129
142
|
if (did) {
|
|
@@ -4,9 +4,7 @@ import express, { Router } from 'express';
|
|
|
4
4
|
import { PAGES_KIT_DID, PAGES_KIT_RESOURCE_TYPE, MEDIA_KIT_DID, MEDIA_KIT_RESOURCE_TYPE, PAGES_KIT_BLOCK_STUDIO_DID, PAGES_KIT_BLOCK_STUDIO_RESOURCE_TYPE, } from '../constants';
|
|
5
5
|
// init uploader router
|
|
6
6
|
export const initUploaderRouter = Router();
|
|
7
|
-
|
|
8
|
-
express,
|
|
9
|
-
}), initStaticResourceMiddleware({
|
|
7
|
+
const staticResourceMiddleware = initStaticResourceMiddleware({
|
|
10
8
|
express,
|
|
11
9
|
resourceTypes: [
|
|
12
10
|
// image bin resource
|
|
@@ -18,18 +16,24 @@ initUploaderRouter.use('/', initProxyToMediaKitUploadsMiddleware({
|
|
|
18
16
|
{
|
|
19
17
|
type: PAGES_KIT_RESOURCE_TYPE,
|
|
20
18
|
did: PAGES_KIT_DID,
|
|
21
|
-
folder: ['pages', 'components'],
|
|
19
|
+
folder: ['pages', 'components', 'chunks'],
|
|
22
20
|
blacklist: ['.yml'],
|
|
23
21
|
},
|
|
24
22
|
// pages kit block studio resource
|
|
25
23
|
{
|
|
26
24
|
type: PAGES_KIT_BLOCK_STUDIO_RESOURCE_TYPE,
|
|
27
25
|
did: PAGES_KIT_BLOCK_STUDIO_DID,
|
|
28
|
-
folder: ['pages', 'components'],
|
|
26
|
+
folder: ['pages', 'components', 'chunks'],
|
|
29
27
|
blacklist: ['.yml'],
|
|
30
28
|
},
|
|
31
29
|
],
|
|
32
|
-
})
|
|
30
|
+
});
|
|
31
|
+
initUploaderRouter.use('/uploads', initProxyToMediaKitUploadsMiddleware({
|
|
32
|
+
express,
|
|
33
|
+
}), staticResourceMiddleware, (_req, res) => {
|
|
33
34
|
res.status(404).send('404 NOT FOUND').end();
|
|
34
35
|
});
|
|
36
|
+
initUploaderRouter.use('/chunks', staticResourceMiddleware, (_req, res) => {
|
|
37
|
+
res.status(404).send('CHUNK NOT FOUND').end();
|
|
38
|
+
});
|
|
35
39
|
export default initUploaderRouter;
|