@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.
@@ -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;
@@ -0,0 +1,9 @@
1
+ /// <reference types="@tomjs/hbuilderx/client" />
2
+
3
+ export { };
4
+
5
+ declare global {
6
+ interface Window {
7
+ acquirehbuilderxApi: any;
8
+ }
9
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "extends": "@tomjs/tsconfig/node.json",
3
+ "references": [
4
+ {
5
+ "path": "./tsconfig.web.json"
6
+ }
7
+ ],
8
+ "include": [
9
+ "src/**/*.ts",
10
+ "src/**/*.d.ts"
11
+ ],
12
+ "exclude": [
13
+ "src/webview/client.ts"
14
+ ]
15
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "@tomjs/tsconfig/web.json",
3
+ "compilerOptions": {
4
+ "composite": true,
5
+ "allowImportingTsExtensions": false,
6
+ "noEmit": false
7
+ },
8
+ "include": ["src/webview/client.ts", "src/webview/window.d.ts"]
9
+ }
@@ -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
+ });