@blocklet/pages-kit-block-studio 0.0.4 → 0.0.6
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/block-studio/generate-wrapper-code.js +4 -7
- package/lib/cjs/block-studio/plugins/vite-plugin-block-studio.js +16 -13
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/block-studio/generate-wrapper-code.js +4 -7
- package/lib/esm/block-studio/plugins/vite-plugin-block-studio.js +16 -13
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -72,19 +72,16 @@ function generateWrapperCode(_a) {
|
|
|
72
72
|
},
|
|
73
73
|
}, null, 2);
|
|
74
74
|
const index = `\
|
|
75
|
-
import
|
|
75
|
+
import HomeComponent from '@blocklet/pages-kit-runtime/client';
|
|
76
76
|
export * from '@blocklet/pages-kit-runtime/client';
|
|
77
|
+
import React from 'react';
|
|
77
78
|
|
|
78
79
|
window.__PAGE_STATE__ = ${JSON.stringify(state, null, 2)};
|
|
79
80
|
window.__PROJECT_ID__ = "${project.id}";
|
|
80
81
|
|
|
81
82
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
projectId: window.__PROJECT_ID__,
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
export default initProjectRuntime;
|
|
83
|
+
// 导出一个 React 组件而不是实例
|
|
84
|
+
export default HomeComponent;
|
|
88
85
|
`;
|
|
89
86
|
const client = index;
|
|
90
87
|
const tsFiles = [
|
|
@@ -57,7 +57,7 @@ function initBlockStudioPlugins(options) {
|
|
|
57
57
|
(0, utils_1.setBlockEntryFilesPattern)(entryFilesPattern);
|
|
58
58
|
// fallback to __dirname if _theme.tsx not exists
|
|
59
59
|
const pagesDir = (0, fs_1.existsSync)(path.join(workingDir, '_theme.tsx')) ? workingDir : __dirname.replace('cjs', 'esm');
|
|
60
|
-
utils_1.logger.log('initBlockStudioPlugins options', {
|
|
60
|
+
utils_1.logger.log('initBlockStudioPlugins options: ', {
|
|
61
61
|
cwd: workingDir,
|
|
62
62
|
entryFilesPattern: (0, utils_1.getBlockEntryFilesPattern)(),
|
|
63
63
|
pagesDir,
|
|
@@ -90,9 +90,7 @@ function initBlockStudioPlugins(options) {
|
|
|
90
90
|
const multiMode = !!process.argv.includes('--multi');
|
|
91
91
|
const name = yield Promise.resolve(`${`${workingDir}/package.json`}`).then(s => __importStar(require(s))).then((res) => res.name).catch(() => 'MyLib');
|
|
92
92
|
return {
|
|
93
|
-
build: {
|
|
94
|
-
cssCodeSplit: false,
|
|
95
|
-
lib: {
|
|
93
|
+
build: Object.assign({ cssCodeSplit: false, lib: {
|
|
96
94
|
name,
|
|
97
95
|
entry: Object.assign({}, Object.fromEntries((0, utils_1.findComponentFiles)({ cwd: workingDir })
|
|
98
96
|
.map((entry) => {
|
|
@@ -109,36 +107,41 @@ function initBlockStudioPlugins(options) {
|
|
|
109
107
|
// multiMode not support umd
|
|
110
108
|
formats: ['es', multiMode ? 'umd' : 'cjs'],
|
|
111
109
|
fileName: (format, entryName) => `${format}/${entryName}.js`,
|
|
112
|
-
},
|
|
113
|
-
rollupOptions: {
|
|
110
|
+
}, rollupOptions: {
|
|
114
111
|
external: [
|
|
115
112
|
'react',
|
|
116
113
|
'react-router-dom',
|
|
117
114
|
'react-dom',
|
|
115
|
+
'react-is',
|
|
116
|
+
'react/jsx-runtime',
|
|
118
117
|
'crypto',
|
|
119
|
-
'@emotion/react',
|
|
120
|
-
'@emotion/styled',
|
|
118
|
+
// '@emotion/react',
|
|
119
|
+
// '@emotion/styled',
|
|
121
120
|
'@arcblock/ux',
|
|
122
|
-
|
|
121
|
+
'@arcblock/did-connect',
|
|
123
122
|
],
|
|
124
123
|
output: {
|
|
125
124
|
// 为所有外部依赖提供全局变量
|
|
126
125
|
globals: {
|
|
127
126
|
react: 'React',
|
|
128
127
|
'react-dom': 'ReactDOM',
|
|
128
|
+
'react-is': 'ReactIs',
|
|
129
129
|
'react-router-dom': 'ReactRouterDOM',
|
|
130
|
-
'
|
|
131
|
-
'@emotion/
|
|
130
|
+
'react/jsx-runtime': 'ReactJsxRuntime',
|
|
131
|
+
// '@emotion/react': 'emotionReact',
|
|
132
|
+
// '@emotion/styled': 'emotionStyled',
|
|
132
133
|
'@mui/material': 'MUI',
|
|
133
134
|
'@arcblock/ux': 'ArcBlockUX',
|
|
135
|
+
'@arcblock/did-connect': 'ArcBlockDidConnect',
|
|
134
136
|
},
|
|
135
137
|
paths: {
|
|
136
138
|
// Redirect 'react' imports to '@blocklet/pages-kit/builtin/react'
|
|
137
139
|
// react: '@blocklet/pages-kit/builtin/react',
|
|
138
140
|
},
|
|
141
|
+
// 确保正确处理命名导出和默认导出
|
|
142
|
+
// interop: 'auto',
|
|
139
143
|
},
|
|
140
|
-
},
|
|
141
|
-
},
|
|
144
|
+
} }, _config === null || _config === void 0 ? void 0 : _config.build),
|
|
142
145
|
};
|
|
143
146
|
});
|
|
144
147
|
},
|