@blocklet/pages-kit-block-studio 0.1.35 → 0.1.37
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.
|
@@ -59,33 +59,33 @@ const BUILTIN_MODULES_VAR = '__PAGES_KIT_BUILTIN_MODULES__';
|
|
|
59
59
|
// import initRemoteScriptLocalizerPlugin from './vite-plugin-remote-script-localizer';
|
|
60
60
|
const defaultBlockExternals = {
|
|
61
61
|
// 核心 React 相关
|
|
62
|
-
react: `window
|
|
63
|
-
'react-dom': `window
|
|
64
|
-
'react-router-dom': `window
|
|
65
|
-
'react-hook-form': `window
|
|
66
|
-
'react-wrap-balancer': `window
|
|
62
|
+
react: `window.${BUILTIN_MODULES_VAR}.modules["@blocklet/pages-kit/builtin/react"]`,
|
|
63
|
+
'react-dom': `window.${BUILTIN_MODULES_VAR}.modules["@blocklet/pages-kit/builtin/react-dom"]`,
|
|
64
|
+
'react-router-dom': `window.${BUILTIN_MODULES_VAR}.modules["@blocklet/pages-kit/builtin/react-router-dom"]`,
|
|
65
|
+
'react-hook-form': `window.${BUILTIN_MODULES_VAR}.modules["@blocklet/pages-kit/builtin/react-hook-form"]`,
|
|
66
|
+
'react-wrap-balancer': `window.${BUILTIN_MODULES_VAR}.modules["@blocklet/pages-kit/builtin/react-wrap-balancer"]`,
|
|
67
67
|
// ArcBlock 相关
|
|
68
|
-
'@arcblock/ux': `window
|
|
69
|
-
'@arcblock/did-connect/lib/Session': `window
|
|
70
|
-
'@arcblock/ux/lib/Locale/context': `window
|
|
68
|
+
'@arcblock/ux': `window.${BUILTIN_MODULES_VAR}.modules["@blocklet/pages-kit/builtin/arcblock/ux"]`,
|
|
69
|
+
'@arcblock/did-connect/lib/Session': `window.${BUILTIN_MODULES_VAR}.modules["@blocklet/pages-kit/builtin/session"]`,
|
|
70
|
+
'@arcblock/ux/lib/Locale/context': `window.${BUILTIN_MODULES_VAR}.modules["@blocklet/pages-kit/builtin/locale"]`,
|
|
71
71
|
// MUI 相关
|
|
72
|
-
// '@mui/material': `window
|
|
73
|
-
// '@mui/lab': `window
|
|
72
|
+
// '@mui/material': `window.${BUILTIN_MODULES_VAR}.modules["@blocklet/pages-kit/builtin/mui/material"]`,
|
|
73
|
+
// '@mui/lab': `window.${BUILTIN_MODULES_VAR}.modules["@blocklet/pages-kit/builtin/mui/lab"]`,
|
|
74
74
|
// 其他工具库
|
|
75
|
-
dayjs: `window
|
|
76
|
-
zustand: `window
|
|
77
|
-
'zustand/middleware/immer': `window
|
|
78
|
-
immer: `window
|
|
79
|
-
stream: `window
|
|
80
|
-
'@iconify/react': `window
|
|
75
|
+
dayjs: `window.${BUILTIN_MODULES_VAR}.modules["@blocklet/pages-kit/builtin/dayjs"]`,
|
|
76
|
+
zustand: `window.${BUILTIN_MODULES_VAR}.modules["@blocklet/pages-kit/builtin/zustand"]`,
|
|
77
|
+
'zustand/middleware/immer': `window.${BUILTIN_MODULES_VAR}.modules["@blocklet/pages-kit/builtin/zustand/middleware/immer"]`,
|
|
78
|
+
immer: `window.${BUILTIN_MODULES_VAR}.modules["@blocklet/pages-kit/builtin/immer"]`,
|
|
79
|
+
stream: `window.${BUILTIN_MODULES_VAR}.modules["@blocklet/pages-kit/builtin/stream"]`,
|
|
80
|
+
'@iconify/react': `window.${BUILTIN_MODULES_VAR}.modules["@blocklet/pages-kit/builtin/iconify/react"]`,
|
|
81
81
|
// 页面相关组件
|
|
82
|
-
'@blocklet/pages-kit/builtin/components': `window
|
|
83
|
-
'@blocklet/pages-kit/builtin/page/header': `window
|
|
84
|
-
'@blocklet/pages-kit/builtin/pages-kit': `window
|
|
82
|
+
'@blocklet/pages-kit/builtin/components': `window.${BUILTIN_MODULES_VAR}.modules["@blocklet/pages-kit/builtin/components"]`,
|
|
83
|
+
'@blocklet/pages-kit/builtin/page/header': `window.${BUILTIN_MODULES_VAR}.modules["@blocklet/pages-kit/builtin/page/header"]`,
|
|
84
|
+
'@blocklet/pages-kit/builtin/pages-kit': `window.${BUILTIN_MODULES_VAR}.modules["@blocklet/pages-kit/builtin/pages-kit"]`,
|
|
85
85
|
// 异步组件
|
|
86
|
-
'react-markdown': `window
|
|
87
|
-
'react-syntax-highlighter': `window
|
|
88
|
-
'react-scroll-to-bottom': `window
|
|
86
|
+
'react-markdown': `window.${BUILTIN_MODULES_VAR}.modules["@blocklet/pages-kit/builtin/async/react-markdown"]`,
|
|
87
|
+
'react-syntax-highlighter': `window.${BUILTIN_MODULES_VAR}.modules["@blocklet/pages-kit/builtin/async/react-syntax-highlighter"]`,
|
|
88
|
+
'react-scroll-to-bottom': `window.${BUILTIN_MODULES_VAR}.modules["@blocklet/pages-kit/builtin/async/react-scroll-to-bottom"]`,
|
|
89
89
|
// 浏览器原生
|
|
90
90
|
crypto: 'window.crypto',
|
|
91
91
|
};
|
|
@@ -132,7 +132,7 @@ function initBlockStudioPlugins(options) {
|
|
|
132
132
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
133
133
|
config(_config) {
|
|
134
134
|
return __awaiter(this, void 0, void 0, function* () {
|
|
135
|
-
var _a;
|
|
135
|
+
var _a, _b, _c, _d;
|
|
136
136
|
const filterModules = process.argv.includes('--filter')
|
|
137
137
|
? (_a = process.argv[process.argv.indexOf('--filter') + 1]) === null || _a === void 0 ? void 0 : _a.split(',')
|
|
138
138
|
: null;
|
|
@@ -160,30 +160,25 @@ function initBlockStudioPlugins(options) {
|
|
|
160
160
|
}));
|
|
161
161
|
return {
|
|
162
162
|
plugins,
|
|
163
|
-
build: Object.assign({ cssCodeSplit: false, lib: {
|
|
163
|
+
build: Object.assign(Object.assign({}, _config === null || _config === void 0 ? void 0 : _config.build), { cssCodeSplit: false, lib: {
|
|
164
164
|
name,
|
|
165
165
|
entry: Object.assign({}, Object.fromEntries(entryList)),
|
|
166
166
|
formats: ['es', !multiMode ? 'umd' : 'cjs'],
|
|
167
167
|
fileName: (format, entryName) => `${format}/${entryName}.js`,
|
|
168
|
-
}, rollupOptions: {
|
|
169
|
-
external: (id) => {
|
|
168
|
+
}, rollupOptions: Object.assign(Object.assign({}, (_b = _config === null || _config === void 0 ? void 0 : _config.build) === null || _b === void 0 ? void 0 : _b.rollupOptions), { external: (id) => {
|
|
170
169
|
// 将 externalMappings 中的键也添加到 external 中
|
|
171
170
|
const skip = [...Object.keys(externalMappings)];
|
|
172
171
|
if (skip.some((s) => id === s || id.startsWith(`${s}/`))) {
|
|
173
172
|
return true;
|
|
174
173
|
}
|
|
175
174
|
return false;
|
|
176
|
-
},
|
|
177
|
-
output: {
|
|
178
|
-
chunkFileNames: () => {
|
|
175
|
+
}, output: Object.assign(Object.assign({}, (_d = (_c = _config === null || _config === void 0 ? void 0 : _config.build) === null || _c === void 0 ? void 0 : _c.rollupOptions) === null || _d === void 0 ? void 0 : _d.output), { chunkFileNames: () => {
|
|
179
176
|
return '[format]/_chunks/[name]-[hash].js';
|
|
180
|
-
},
|
|
177
|
+
},
|
|
181
178
|
// 使用没有 window. 前缀的映射用于 globals 配置
|
|
182
|
-
globals: externalMappingsWithoutWindow,
|
|
179
|
+
globals: externalMappingsWithoutWindow,
|
|
183
180
|
// 确保正确处理命名导出和默认导出
|
|
184
|
-
interop: 'auto',
|
|
185
|
-
},
|
|
186
|
-
} }, _config === null || _config === void 0 ? void 0 : _config.build),
|
|
181
|
+
interop: 'auto' }) }) }),
|
|
187
182
|
};
|
|
188
183
|
});
|
|
189
184
|
},
|