1.7.1原版
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "tsc && vite build",
|
||||
"dev": "vite",
|
||||
"lint": "eslint 'src/**/*.ts'",
|
||||
"prettier": "prettier \"**/*.{cjs,html,js,json,md,ts}\" --ignore-path ./.gitignore --write"
|
||||
},
|
||||
"dependencies": {
|
||||
"@halo-dev/search-widget": "workspace:*"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { SearchModal } from '@halo-dev/search-widget';
|
||||
import '@halo-dev/search-widget/var.css';
|
||||
import type { SearchOption } from '@halo-dev/api-client';
|
||||
|
||||
export { SearchModal };
|
||||
|
||||
const searchModalElement = document.createElement(
|
||||
'search-modal'
|
||||
) as SearchModal;
|
||||
|
||||
document.body.append(searchModalElement);
|
||||
|
||||
export function open(options: SearchOption) {
|
||||
searchModalElement.options = options;
|
||||
searchModalElement.open = true;
|
||||
}
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
/// <reference types="vite/client" />
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": ["src"]
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath, URL } from 'node:url';
|
||||
import { defineConfig } from 'vite';
|
||||
|
||||
export default defineConfig({
|
||||
experimental: {
|
||||
enableNativePlugin: true,
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||
},
|
||||
},
|
||||
define: { 'process.env.NODE_ENV': "'production'" },
|
||||
build: {
|
||||
outDir: fileURLToPath(
|
||||
new URL('../../src/main/resources/static', import.meta.url)
|
||||
),
|
||||
emptyOutDir: true,
|
||||
cssCodeSplit: false,
|
||||
lib: {
|
||||
entry: path.resolve(__dirname, 'src/index.ts'),
|
||||
formats: ['iife'],
|
||||
name: 'SearchWidget',
|
||||
fileName: (format) => `search-widget.${format}.js`,
|
||||
cssFileName: 'style',
|
||||
},
|
||||
sourcemap: false,
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user