diff --git a/package.json b/package.json index d34939f..fcf1342 100644 --- a/package.json +++ b/package.json @@ -10,10 +10,17 @@ "preview": "vite preview" }, "dependencies": { - "@codemirror/lang-css": "^6.2.1", + "@codemirror/lang-go": "^6.0.1", "@codemirror/lang-html": "^6.4.9", "@codemirror/lang-javascript": "^6.2.2", + "@codemirror/lang-json": "^6.0.1", + "@codemirror/lang-markdown": "^6.2.5", "@codemirror/lang-python": "^6.1.6", + "@codemirror/lang-sass": "^6.0.2", + "@codemirror/lang-sql": "^6.7.1", + "@codemirror/lang-vue": "^0.1.3", + "@codemirror/lang-xml": "^6.1.0", + "@codemirror/lang-yaml": "^6.1.1", "@vicons/ionicons5": "^0.12.0", "axios": "^1.7.3", "codemirror": "^6.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fc6fa9c..dfdad0b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,18 +8,39 @@ importers: .: dependencies: - '@codemirror/lang-css': - specifier: ^6.2.1 - version: 6.2.1(@codemirror/view@6.33.0) + '@codemirror/lang-go': + specifier: ^6.0.1 + version: 6.0.1(@codemirror/view@6.33.0) '@codemirror/lang-html': specifier: ^6.4.9 version: 6.4.9 '@codemirror/lang-javascript': specifier: ^6.2.2 version: 6.2.2 + '@codemirror/lang-json': + specifier: ^6.0.1 + version: 6.0.1 + '@codemirror/lang-markdown': + specifier: ^6.2.5 + version: 6.2.5 '@codemirror/lang-python': specifier: ^6.1.6 version: 6.1.6(@codemirror/view@6.33.0) + '@codemirror/lang-sass': + specifier: ^6.0.2 + version: 6.0.2(@codemirror/view@6.33.0) + '@codemirror/lang-sql': + specifier: ^6.7.1 + version: 6.7.1(@codemirror/view@6.33.0) + '@codemirror/lang-vue': + specifier: ^0.1.3 + version: 0.1.3 + '@codemirror/lang-xml': + specifier: ^6.1.0 + version: 6.1.0 + '@codemirror/lang-yaml': + specifier: ^6.1.1 + version: 6.1.1(@codemirror/view@6.33.0) '@vicons/ionicons5': specifier: ^0.12.0 version: 0.12.0 @@ -116,15 +137,39 @@ packages: '@codemirror/lang-css@6.2.1': resolution: {integrity: sha512-/UNWDNV5Viwi/1lpr/dIXJNWiwDxpw13I4pTUAsNxZdg6E0mI2kTQb0P2iHczg1Tu+H4EBgJR+hYhKiHKko7qg==} + '@codemirror/lang-go@6.0.1': + resolution: {integrity: sha512-7fNvbyNylvqCphW9HD6WFnRpcDjr+KXX/FgqXy5H5ZS0eC5edDljukm/yNgYkwTsgp2busdod50AOTIy6Jikfg==} + '@codemirror/lang-html@6.4.9': resolution: {integrity: sha512-aQv37pIMSlueybId/2PVSP6NPnmurFDVmZwzc7jszd2KAF8qd4VBbvNYPXWQq90WIARjsdVkPbw29pszmHws3Q==} '@codemirror/lang-javascript@6.2.2': resolution: {integrity: sha512-VGQfY+FCc285AhWuwjYxQyUQcYurWlxdKYT4bqwr3Twnd5wP5WSeu52t4tvvuWmljT4EmgEgZCqSieokhtY8hg==} + '@codemirror/lang-json@6.0.1': + resolution: {integrity: sha512-+T1flHdgpqDDlJZ2Lkil/rLiRy684WMLc74xUnjJH48GQdfJo/pudlTRreZmKwzP8/tGdKf83wlbAdOCzlJOGQ==} + + '@codemirror/lang-markdown@6.2.5': + resolution: {integrity: sha512-Hgke565YcO4fd9pe2uLYxnMufHO5rQwRr+AAhFq8ABuhkrjyX8R5p5s+hZUTdV60O0dMRjxKhBLxz8pu/MkUVA==} + '@codemirror/lang-python@6.1.6': resolution: {integrity: sha512-ai+01WfZhWqM92UqjnvorkxosZ2aq2u28kHvr+N3gu012XqY2CThD67JPMHnGceRfXPDBmn1HnyqowdpF57bNg==} + '@codemirror/lang-sass@6.0.2': + resolution: {integrity: sha512-l/bdzIABvnTo1nzdY6U+kPAC51czYQcOErfzQ9zSm9D8GmNPD0WTW8st/CJwBTPLO8jlrbyvlSEcN20dc4iL0Q==} + + '@codemirror/lang-sql@6.7.1': + resolution: {integrity: sha512-flQa7zemrLKk0TIrOJnpeyH/b29BcVybtsTeZMgAo40O6kGbrnUSCgwI3TF5iJY3O9VXJKKCA+i0CBVvDfr88w==} + + '@codemirror/lang-vue@0.1.3': + resolution: {integrity: sha512-QSKdtYTDRhEHCfo5zOShzxCmqKJvgGrZwDQSdbvCRJ5pRLWBS7pD/8e/tH44aVQT6FKm0t6RVNoSUWHOI5vNug==} + + '@codemirror/lang-xml@6.1.0': + resolution: {integrity: sha512-3z0blhicHLfwi2UgkZYRPioSgVTo9PV5GP5ducFH6FaHy0IAJRg+ixj5gTR1gnT/glAIC8xv4w2VL1LoZfs+Jg==} + + '@codemirror/lang-yaml@6.1.1': + resolution: {integrity: sha512-HV2NzbK9bbVnjWxwObuZh5FuPCowx51mEfoFT9y3y+M37fA3+pbxx4I7uePuygFzDsAmCTwQSc/kXh/flab4uw==} + '@codemirror/language@6.10.2': resolution: {integrity: sha512-kgbTYTo0Au6dCSc/TFy7fK3fpJmgHDv1sG1KNQKJXVi+xBTEeBPY/M30YXiU6mMXeH+YIDLsbrT4ZwNRdtF+SA==} @@ -303,6 +348,9 @@ packages: '@lezer/css@1.1.8': resolution: {integrity: sha512-7JhxupKuMBaWQKjQoLtzhGj83DdnZY9MckEOG5+/iLKNK2ZJqKc6hf6uc0HjwCX7Qlok44jBNqZhHKDhEhZYLA==} + '@lezer/go@1.0.0': + resolution: {integrity: sha512-co9JfT3QqX1YkrMmourYw2Z8meGC50Ko4d54QEcQbEYpvdUvN4yb0NBZdn/9ertgvjsySxHsKzH3lbm3vqJ4Jw==} + '@lezer/highlight@1.2.1': resolution: {integrity: sha512-Z5duk4RN/3zuVO7Jq0pGLJ3qynpxUVsh7IbUbGj88+uV2ApSAn6kWg2au3iJb+0Zi7kKtqffIESgNcRXWZWmSA==} @@ -312,12 +360,27 @@ packages: '@lezer/javascript@1.4.17': resolution: {integrity: sha512-bYW4ctpyGK+JMumDApeUzuIezX01H76R1foD6LcRX224FWfyYit/HYxiPGDjXXe/wQWASjCvVGoukTH68+0HIA==} + '@lezer/json@1.0.2': + resolution: {integrity: sha512-xHT2P4S5eeCYECyKNPhr4cbEL9tc8w83SPwRC373o9uEdrvGKTZoJVAGxpOsZckMlEh9W23Pc72ew918RWQOBQ==} + '@lezer/lr@1.4.2': resolution: {integrity: sha512-pu0K1jCIdnQ12aWNaAVU5bzi7Bd1w54J3ECgANPmYLtQKP0HBj2cE/5coBD66MT10xbtIuUr7tg0Shbsvk0mDA==} + '@lezer/markdown@1.3.0': + resolution: {integrity: sha512-ErbEQ15eowmJUyT095e9NJc3BI9yZ894fjSDtHftD0InkfUBGgnKSU6dvan9jqsZuNHg2+ag/1oyDRxNsENupQ==} + '@lezer/python@1.1.14': resolution: {integrity: sha512-ykDOb2Ti24n76PJsSa4ZoDF0zH12BSw1LGfQXCYJhJyOGiFTfGaX0Du66Ze72R+u/P35U+O6I9m8TFXov1JzsA==} + '@lezer/sass@1.0.6': + resolution: {integrity: sha512-w/RCO2dIzZH1To8p+xjs8cE+yfgGus8NZ/dXeWl/QzHyr+TeBs71qiE70KPImEwvTsmEjoWh0A5SxMzKd5BWBQ==} + + '@lezer/xml@1.0.5': + resolution: {integrity: sha512-VFouqOzmUWfIg+tfmpcdV33ewtK+NSwd4ngSe1aG7HFb4BN0ExyY1b8msp+ndFrnlG4V4iC8yXacjFtrwERnaw==} + + '@lezer/yaml@1.0.3': + resolution: {integrity: sha512-GuBLekbw9jDBDhGur82nuwkxKQ+a3W5H0GfaAthDXcAu+XdpS43VlnxA9E9hllkpSP5ellRDKjLLj7Lu9Wr6xA==} + '@mapbox/node-pre-gyp@1.0.11': resolution: {integrity: sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==} hasBin: true @@ -1147,6 +1210,16 @@ snapshots: transitivePeerDependencies: - '@codemirror/view' + '@codemirror/lang-go@6.0.1(@codemirror/view@6.33.0)': + dependencies: + '@codemirror/autocomplete': 6.18.0(@codemirror/language@6.10.2)(@codemirror/state@6.4.1)(@codemirror/view@6.33.0)(@lezer/common@1.2.1) + '@codemirror/language': 6.10.2 + '@codemirror/state': 6.4.1 + '@lezer/common': 1.2.1 + '@lezer/go': 1.0.0 + transitivePeerDependencies: + - '@codemirror/view' + '@codemirror/lang-html@6.4.9': dependencies: '@codemirror/autocomplete': 6.18.0(@codemirror/language@6.10.2)(@codemirror/state@6.4.1)(@codemirror/view@6.33.0)(@lezer/common@1.2.1) @@ -1169,6 +1242,21 @@ snapshots: '@lezer/common': 1.2.1 '@lezer/javascript': 1.4.17 + '@codemirror/lang-json@6.0.1': + dependencies: + '@codemirror/language': 6.10.2 + '@lezer/json': 1.0.2 + + '@codemirror/lang-markdown@6.2.5': + dependencies: + '@codemirror/autocomplete': 6.18.0(@codemirror/language@6.10.2)(@codemirror/state@6.4.1)(@codemirror/view@6.33.0)(@lezer/common@1.2.1) + '@codemirror/lang-html': 6.4.9 + '@codemirror/language': 6.10.2 + '@codemirror/state': 6.4.1 + '@codemirror/view': 6.33.0 + '@lezer/common': 1.2.1 + '@lezer/markdown': 1.3.0 + '@codemirror/lang-python@6.1.6(@codemirror/view@6.33.0)': dependencies: '@codemirror/autocomplete': 6.18.0(@codemirror/language@6.10.2)(@codemirror/state@6.4.1)(@codemirror/view@6.33.0)(@lezer/common@1.2.1) @@ -1179,6 +1267,56 @@ snapshots: transitivePeerDependencies: - '@codemirror/view' + '@codemirror/lang-sass@6.0.2(@codemirror/view@6.33.0)': + dependencies: + '@codemirror/lang-css': 6.2.1(@codemirror/view@6.33.0) + '@codemirror/language': 6.10.2 + '@codemirror/state': 6.4.1 + '@lezer/common': 1.2.1 + '@lezer/sass': 1.0.6 + transitivePeerDependencies: + - '@codemirror/view' + + '@codemirror/lang-sql@6.7.1(@codemirror/view@6.33.0)': + dependencies: + '@codemirror/autocomplete': 6.18.0(@codemirror/language@6.10.2)(@codemirror/state@6.4.1)(@codemirror/view@6.33.0)(@lezer/common@1.2.1) + '@codemirror/language': 6.10.2 + '@codemirror/state': 6.4.1 + '@lezer/common': 1.2.1 + '@lezer/highlight': 1.2.1 + '@lezer/lr': 1.4.2 + transitivePeerDependencies: + - '@codemirror/view' + + '@codemirror/lang-vue@0.1.3': + dependencies: + '@codemirror/lang-html': 6.4.9 + '@codemirror/lang-javascript': 6.2.2 + '@codemirror/language': 6.10.2 + '@lezer/common': 1.2.1 + '@lezer/highlight': 1.2.1 + '@lezer/lr': 1.4.2 + + '@codemirror/lang-xml@6.1.0': + dependencies: + '@codemirror/autocomplete': 6.18.0(@codemirror/language@6.10.2)(@codemirror/state@6.4.1)(@codemirror/view@6.33.0)(@lezer/common@1.2.1) + '@codemirror/language': 6.10.2 + '@codemirror/state': 6.4.1 + '@codemirror/view': 6.33.0 + '@lezer/common': 1.2.1 + '@lezer/xml': 1.0.5 + + '@codemirror/lang-yaml@6.1.1(@codemirror/view@6.33.0)': + dependencies: + '@codemirror/autocomplete': 6.18.0(@codemirror/language@6.10.2)(@codemirror/state@6.4.1)(@codemirror/view@6.33.0)(@lezer/common@1.2.1) + '@codemirror/language': 6.10.2 + '@codemirror/state': 6.4.1 + '@lezer/common': 1.2.1 + '@lezer/highlight': 1.2.1 + '@lezer/yaml': 1.0.3 + transitivePeerDependencies: + - '@codemirror/view' + '@codemirror/language@6.10.2': dependencies: '@codemirror/state': 6.4.1 @@ -1299,6 +1437,12 @@ snapshots: '@lezer/highlight': 1.2.1 '@lezer/lr': 1.4.2 + '@lezer/go@1.0.0': + dependencies: + '@lezer/common': 1.2.1 + '@lezer/highlight': 1.2.1 + '@lezer/lr': 1.4.2 + '@lezer/highlight@1.2.1': dependencies: '@lezer/common': 1.2.1 @@ -1315,16 +1459,45 @@ snapshots: '@lezer/highlight': 1.2.1 '@lezer/lr': 1.4.2 + '@lezer/json@1.0.2': + dependencies: + '@lezer/common': 1.2.1 + '@lezer/highlight': 1.2.1 + '@lezer/lr': 1.4.2 + '@lezer/lr@1.4.2': dependencies: '@lezer/common': 1.2.1 + '@lezer/markdown@1.3.0': + dependencies: + '@lezer/common': 1.2.1 + '@lezer/highlight': 1.2.1 + '@lezer/python@1.1.14': dependencies: '@lezer/common': 1.2.1 '@lezer/highlight': 1.2.1 '@lezer/lr': 1.4.2 + '@lezer/sass@1.0.6': + dependencies: + '@lezer/common': 1.2.1 + '@lezer/highlight': 1.2.1 + '@lezer/lr': 1.4.2 + + '@lezer/xml@1.0.5': + dependencies: + '@lezer/common': 1.2.1 + '@lezer/highlight': 1.2.1 + '@lezer/lr': 1.4.2 + + '@lezer/yaml@1.0.3': + dependencies: + '@lezer/common': 1.2.1 + '@lezer/highlight': 1.2.1 + '@lezer/lr': 1.4.2 + '@mapbox/node-pre-gyp@1.0.11': dependencies: detect-libc: 2.0.3 diff --git a/src/class/PluginCenter.ts b/src/class/PluginCenter.ts index 985d84e..f5f1505 100644 --- a/src/class/PluginCenter.ts +++ b/src/class/PluginCenter.ts @@ -20,7 +20,6 @@ export default class PluginCenter { register(key: string, plugin: plugin) { this.pluginsMap[key] = plugin - console.log(this.pluginsMap) } /** @@ -29,7 +28,7 @@ export default class PluginCenter { registerComponent( key: string, name: string, - getComponent: () => any, + getComponent: () => Promise, filter: ( VDirectorys: VirtualDirectory[], VFiles: VirtualFile[] diff --git a/src/hooks/init.ts b/src/hooks/init.ts index 859bd3d..ac28ef5 100644 --- a/src/hooks/init.ts +++ b/src/hooks/init.ts @@ -1,4 +1,4 @@ -// import MiaoDirectory from '@/views/miaoDirectory.vue' +import MiaoDirectory from '@/views/miaoDirectory.vue' import usePluginCenter from './usePluginCenter' export default function init() { @@ -6,7 +6,7 @@ export default function init() { pluginCenter.registerComponent( 'miaoDirectory', '文件夹', - async() => (await import('@/views/miaoDirectory.vue')).default, + async () => MiaoDirectory, (vDirs, vFiles) => { if (vFiles.length) { return false @@ -74,7 +74,23 @@ export default function init() { if (vFiles.length !== 1) { return false } - for (let end of ['js', 'ts', 'py', 'html', 'css']) { + for (let end of [ + 'js', + 'ts', + 'jsx', + 'tsx', + 'py', + 'html', + 'css', + 'scss', + 'go', + 'json', + 'md', + 'yaml', + 'txt', + 'xml', + 'vue', + ]) { if (vFiles[0].name.endsWith(end)) { return true } diff --git a/src/hooks/useMiaoFetchApi.ts b/src/hooks/useMiaoFetchApi.ts index 50e4a25..e336d22 100644 --- a/src/hooks/useMiaoFetchApi.ts +++ b/src/hooks/useMiaoFetchApi.ts @@ -77,12 +77,13 @@ const miaoFetchApi = { // const { baseUrl, api } = Config const url = vFile.url const retry = option?.retry ?? 0 + const axiosOption = option?.axiosOption ?? {} const { miaoFetch } = useMiaoFetch({ retry }) const response = await miaoFetch({ - url + url, ...axiosOption }) return response.data }, diff --git a/src/types/fetch.ts b/src/types/fetch.ts index 9fc1508..cfea9e2 100644 --- a/src/types/fetch.ts +++ b/src/types/fetch.ts @@ -1,8 +1,10 @@ +import { AxiosRequestConfig } from "axios"; import { directory, file } from "./type"; export type miaoFetchConfig = { - retry?: number; -}; + retry?: number + axiosOption?: AxiosRequestConfig +} export type getOption = {} & miaoFetchConfig; diff --git a/src/views/miaoCodeMirror.vue b/src/views/miaoCodeMirror.vue index 94b437b..89dd5f6 100644 --- a/src/views/miaoCodeMirror.vue +++ b/src/views/miaoCodeMirror.vue @@ -1,5 +1,6 @@