@tomjs/vite-plugin-hbuilderx 1.0.0
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/CHANGELOG.md +5 -0
- package/LICENSE +21 -0
- package/README.md +351 -0
- package/dist/client.iife.js +42 -0
- package/dist/index.d.ts +82 -0
- package/dist/index.js +336 -0
- package/dist/webview.d.ts +14 -0
- package/dist/webview.js +18 -0
- package/env-hbuilderx.d.ts +36 -0
- package/env.d.ts +24 -0
- package/eslint.config.mjs +6 -0
- package/package.json +64 -0
- package/src/constants.ts +4 -0
- package/src/index.ts +420 -0
- package/src/logger.ts +9 -0
- package/src/types.ts +81 -0
- package/src/utils.ts +36 -0
- package/src/webview/client.ts +47 -0
- package/src/webview/global.d.ts +4 -0
- package/src/webview/template.html +90 -0
- package/src/webview/webview.ts +25 -0
- package/src/webview/window.d.ts +9 -0
- package/tsconfig.json +15 -0
- package/tsconfig.web.json +9 -0
- package/tsdown.config.ts +38 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import template from './template.html';
|
|
2
|
+
|
|
3
|
+
export interface WebviewHtmlOptions {
|
|
4
|
+
/**
|
|
5
|
+
* local server url
|
|
6
|
+
*/
|
|
7
|
+
serverUrl: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param options serverUrl string or object options
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export function getWebviewHtml(options: WebviewHtmlOptions) {
|
|
16
|
+
const opts: WebviewHtmlOptions = {
|
|
17
|
+
serverUrl: '',
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
Object.assign(opts, options);
|
|
21
|
+
|
|
22
|
+
return (template as string).replace(/\{\{serverUrl\}\}/g, opts.serverUrl);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default getWebviewHtml;
|
package/tsconfig.json
ADDED
package/tsdown.config.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { defineConfig } from 'tsdown';
|
|
2
|
+
|
|
3
|
+
export default defineConfig((_options) => {
|
|
4
|
+
return [
|
|
5
|
+
{
|
|
6
|
+
entry: ['src/index.ts'],
|
|
7
|
+
format: ['esm'],
|
|
8
|
+
target: ['node18.19'],
|
|
9
|
+
external: ['vite'],
|
|
10
|
+
shims: true,
|
|
11
|
+
clean: false,
|
|
12
|
+
dts: true,
|
|
13
|
+
publint: true,
|
|
14
|
+
fixedExtension: false,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
entry: ['src/webview/webview.ts'],
|
|
18
|
+
format: ['esm'],
|
|
19
|
+
target: ['node18.19'],
|
|
20
|
+
shims: true,
|
|
21
|
+
clean: false,
|
|
22
|
+
dts: true,
|
|
23
|
+
publint: true,
|
|
24
|
+
loader: {
|
|
25
|
+
'.html': 'text',
|
|
26
|
+
},
|
|
27
|
+
fixedExtension: false,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
entry: ['src/webview/client.ts'],
|
|
31
|
+
format: ['iife'],
|
|
32
|
+
target: ['chrome89'],
|
|
33
|
+
platform: 'browser',
|
|
34
|
+
clean: false,
|
|
35
|
+
dts: false,
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
});
|