vite-plugin-blocklet 0.5.18 → 0.5.21
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/dist/index.cjs +15 -1
- package/index.js +12 -1
- package/package.json +5 -4
package/dist/index.cjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var vitePluginNodePolyfills = require('vite-plugin-node-polyfills');
|
|
5
6
|
var vite = require('vite');
|
|
6
7
|
var semver = require('semver');
|
|
7
8
|
var Mcrypto = require('@ocap/mcrypto');
|
|
@@ -184,7 +185,13 @@ async function setupClient(app, options = {}) {
|
|
|
184
185
|
}
|
|
185
186
|
|
|
186
187
|
function createBlockletPlugin(options = {}) {
|
|
187
|
-
const {
|
|
188
|
+
const {
|
|
189
|
+
// NOTICE: 由于 polyfill 不是每个项目都必须的,并且有些现有的项目已经配置了 polyfill,所以这个配置默认 disable 会比较好
|
|
190
|
+
disableNodePolyfills = true,
|
|
191
|
+
disableConfig = false,
|
|
192
|
+
disableMeta = false,
|
|
193
|
+
disableHmr = false,
|
|
194
|
+
} = options;
|
|
188
195
|
const plugins = [];
|
|
189
196
|
if (!disableMeta) {
|
|
190
197
|
plugins.push(createMetaPlugin());
|
|
@@ -195,10 +202,17 @@ function createBlockletPlugin(options = {}) {
|
|
|
195
202
|
if (!disableHmr) {
|
|
196
203
|
plugins.push(createHmrPlugin(options));
|
|
197
204
|
}
|
|
205
|
+
if (!disableNodePolyfills) {
|
|
206
|
+
plugins.push(vitePluginNodePolyfills.nodePolyfills({ protocolImports: true }));
|
|
207
|
+
}
|
|
198
208
|
|
|
199
209
|
return plugins;
|
|
200
210
|
}
|
|
201
211
|
|
|
212
|
+
Object.defineProperty(exports, 'nodePolyfills', {
|
|
213
|
+
enumerable: true,
|
|
214
|
+
get: function () { return vitePluginNodePolyfills.nodePolyfills; }
|
|
215
|
+
});
|
|
202
216
|
exports.createBlockletConfig = createConfigPlugin;
|
|
203
217
|
exports.createBlockletHmr = createHmrPlugin;
|
|
204
218
|
exports.createBlockletMeta = createMetaPlugin;
|
package/index.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
+
import { nodePolyfills } from 'vite-plugin-node-polyfills';
|
|
1
2
|
import createHmrPlugin from './libs/hmr.js';
|
|
2
3
|
import createConfigPlugin from './libs/config.js';
|
|
3
4
|
import createMetaPlugin from './libs/meta.js';
|
|
4
5
|
import setupClient from './libs/client.js';
|
|
5
6
|
|
|
6
7
|
export function createBlockletPlugin(options = {}) {
|
|
7
|
-
const {
|
|
8
|
+
const {
|
|
9
|
+
// NOTICE: 由于 polyfill 不是每个项目都必须的,并且有些现有的项目已经配置了 polyfill,所以这个配置默认 disable 会比较好
|
|
10
|
+
disableNodePolyfills = true,
|
|
11
|
+
disableConfig = false,
|
|
12
|
+
disableMeta = false,
|
|
13
|
+
disableHmr = false,
|
|
14
|
+
} = options;
|
|
8
15
|
const plugins = [];
|
|
9
16
|
if (!disableMeta) {
|
|
10
17
|
plugins.push(createMetaPlugin(options));
|
|
@@ -15,6 +22,9 @@ export function createBlockletPlugin(options = {}) {
|
|
|
15
22
|
if (!disableHmr) {
|
|
16
23
|
plugins.push(createHmrPlugin(options));
|
|
17
24
|
}
|
|
25
|
+
if (!disableNodePolyfills) {
|
|
26
|
+
plugins.push(nodePolyfills({ protocolImports: true }));
|
|
27
|
+
}
|
|
18
28
|
|
|
19
29
|
return plugins;
|
|
20
30
|
}
|
|
@@ -24,4 +34,5 @@ export {
|
|
|
24
34
|
createHmrPlugin as createBlockletHmr,
|
|
25
35
|
createConfigPlugin as createBlockletConfig,
|
|
26
36
|
createMetaPlugin as createBlockletMeta,
|
|
37
|
+
nodePolyfills,
|
|
27
38
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-blocklet",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.21",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"files": [
|
|
@@ -27,12 +27,13 @@
|
|
|
27
27
|
"rollup": "^2.79.1"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@arcblock/did": "^1.18.
|
|
31
|
-
"@ocap/mcrypto": "^1.18.
|
|
32
|
-
"@ocap/util": "^1.18.
|
|
30
|
+
"@arcblock/did": "^1.18.65",
|
|
31
|
+
"@ocap/mcrypto": "^1.18.65",
|
|
32
|
+
"@ocap/util": "^1.18.65",
|
|
33
33
|
"get-port": "^5.1.1",
|
|
34
34
|
"mri": "^1.2.0",
|
|
35
35
|
"semver": "^7.3.8",
|
|
36
|
+
"vite-plugin-node-polyfills": "^0.7.0",
|
|
36
37
|
"yaml": "^2.2.1"
|
|
37
38
|
},
|
|
38
39
|
"peerDependencies": {
|