vite-plugin-blocklet 0.1.0 → 0.1.1
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/index.cjs +20 -0
- package/index.js +1 -1
- package/package.json +13 -3
- package/pnpm-lock.yaml +25 -0
- package/rollup.config.js +7 -0
package/index.cjs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
function createBlockletPlugin() {
|
|
6
|
+
return {
|
|
7
|
+
name: 'vite-plugin-blocklet',
|
|
8
|
+
transform(code, id) {
|
|
9
|
+
if (id.endsWith('/vite/dist/client/client.mjs')) {
|
|
10
|
+
const replacedCode = code.replace(
|
|
11
|
+
'const socketHost = `${__HMR_HOSTNAME__ || location.hostname}:${__HMR_PORT__}`;',
|
|
12
|
+
"let tmpPort = __HMR_PORT__;\nif (window.blocklet) {\ntmpPort = new URL(window.location.href).port;\n}\nconst socketHost = `${__HMR_HOSTNAME__ || location.hostname}${tmpPort ? `:${tmpPort}` : ''}`;",
|
|
13
|
+
);
|
|
14
|
+
return replacedCode;
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
exports.createBlockletPlugin = createBlockletPlugin;
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-blocklet",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"require": "./index.cjs",
|
|
9
|
+
"import": "./index.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
6
12
|
"scripts": {
|
|
7
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
13
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
14
|
+
"build": "rollup -c rollup.config.js"
|
|
8
15
|
},
|
|
9
16
|
"keywords": [],
|
|
10
17
|
"author": "",
|
|
11
|
-
"license": "ISC"
|
|
18
|
+
"license": "ISC",
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"rollup": "^2.70.1"
|
|
21
|
+
}
|
|
12
22
|
}
|
package/pnpm-lock.yaml
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
lockfileVersion: 5.3
|
|
2
|
+
|
|
3
|
+
specifiers:
|
|
4
|
+
rollup: ^2.70.1
|
|
5
|
+
|
|
6
|
+
devDependencies:
|
|
7
|
+
rollup: 2.70.1
|
|
8
|
+
|
|
9
|
+
packages:
|
|
10
|
+
|
|
11
|
+
/fsevents/2.3.2:
|
|
12
|
+
resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==}
|
|
13
|
+
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
|
|
14
|
+
os: [darwin]
|
|
15
|
+
requiresBuild: true
|
|
16
|
+
dev: true
|
|
17
|
+
optional: true
|
|
18
|
+
|
|
19
|
+
/rollup/2.70.1:
|
|
20
|
+
resolution: {integrity: sha512-CRYsI5EuzLbXdxC6RnYhOuRdtz4bhejPMSWjsFLfVM/7w/85n2szZv6yExqUXsBdz5KT8eoubeyDUDjhLHEslA==}
|
|
21
|
+
engines: {node: '>=10.0.0'}
|
|
22
|
+
hasBin: true
|
|
23
|
+
optionalDependencies:
|
|
24
|
+
fsevents: 2.3.2
|
|
25
|
+
dev: true
|