From 54e8493a21b556f0f8ead8910fe3d9fbb5809ae4 Mon Sep 17 00:00:00 2001 From: arlo Date: Sat, 3 Feb 2024 13:14:32 +0800 Subject: [PATCH] refactor!: deprecate schema package --- package.json | 4 +- packages/schema/README.md | 3 - packages/schema/package.json | 27 ------ packages/schema/src/index.ts | 3 - packages/schema/src/types/context.ts | 21 ----- packages/schema/src/types/hook.ts | 32 -------- packages/schema/src/types/index.ts | 3 - packages/schema/src/types/vue.ts | 118 --------------------------- packages/schema/tsup.config.ts | 14 ---- packages/schema/types.d.ts | 1 - pnpm-lock.yaml | 2 - tsconfig.json | 1 - 12 files changed, 1 insertion(+), 228 deletions(-) delete mode 100644 packages/schema/README.md delete mode 100644 packages/schema/package.json delete mode 100644 packages/schema/src/index.ts delete mode 100644 packages/schema/src/types/context.ts delete mode 100644 packages/schema/src/types/hook.ts delete mode 100644 packages/schema/src/types/index.ts delete mode 100644 packages/schema/src/types/vue.ts delete mode 100644 packages/schema/tsup.config.ts delete mode 100644 packages/schema/types.d.ts diff --git a/package.json b/package.json index afa6f2f1..21e49542 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,6 @@ "stub:shared": "nr -C packages/shared stub", "stub:core": "nr -C packages/core stub", "stub:devtools-kit": "nr -C packages/devtools-kit stub", - "stub:schema": "nr -C packages/schema stub", "stub:overlay": "nr -C packages/overlay stub", "stub:client": "nr -C packages/client stub", "stub:vite": "nr -C packages/vite stub", @@ -35,7 +34,6 @@ "build:core": "nr -C packages/core build", "build:devtools-kit": "nr -C packages/devtools-kit build", "build:devtools": "nr -C packages/devtools build", - "build:schema": "nr -C packages/schema build", "build:overlay": "nr -C packages/overlay build", "build:client": "nr -C packages/client build", "build:electron": "nr -C packages/electron build", @@ -47,7 +45,7 @@ "dev:ui-play": "nr -C packages/ui-playground dev", "prepare:type": "pnpm -r --filter='./packages/**' run prepare:type", "dev": "NODE_OPTIONS=\"--max-old-space-size=8192\" nr prepare:type && nr build:ui && pnpm -r --parallel --filter='./packages/**' run stub", - "build": "pnpm build:schema && pnpm -r --filter='./packages/{shared,core,ui,devtools-kit,vite}' run build && pnpm build:client && pnpm build:overlay && pnpm build:browser-extension && pnpm build:electron && pnpm build:devtools && pnpm build:devtools-api", + "build": "pnpm -r --filter='./packages/{shared,core,ui,devtools-kit,vite}' run build && pnpm build:client && pnpm build:overlay && pnpm build:browser-extension && pnpm build:electron && pnpm build:devtools && pnpm build:devtools-api", "build:browser-extension": "nr -C packages/browser-extension build", "lint": "eslint .", "lint:fix": "eslint . --fix", diff --git a/packages/schema/README.md b/packages/schema/README.md deleted file mode 100644 index 6e9cf2f3..00000000 --- a/packages/schema/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# @vue/devtools-ui - -> UI kit for DevTools. diff --git a/packages/schema/package.json b/packages/schema/package.json deleted file mode 100644 index 4c2b8794..00000000 --- a/packages/schema/package.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "@vue/devtools-schema", - "type": "module", - "version": "7.0.14", - "author": "webfansplz", - "license": "MIT", - "sideEffects": false, - "exports": { - ".": { - "import": "./dist/index.js", - "require": "./dist/index.cjs" - } - }, - "main": "./dist/index.cjs", - "module": "./dist/index.js", - "types": "./types.d.ts", - "files": [ - "**.d.ts", - "dist" - ], - "scripts": { - "build": "tsup --clean", - "prepare:type": "tsup --dts-only", - "stub": "tsup --watch" - }, - "dependencies": {} -} diff --git a/packages/schema/src/index.ts b/packages/schema/src/index.ts deleted file mode 100644 index d96850fa..00000000 --- a/packages/schema/src/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -// Types - -export * from './types/index' diff --git a/packages/schema/src/types/context.ts b/packages/schema/src/types/context.ts deleted file mode 100644 index d8bdc2d2..00000000 --- a/packages/schema/src/types/context.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { AppRecord } from './vue' - -export interface DevToolsContext { - appRecord: AppRecord | null - api: unknown - inspector: { - id: string - nodeId: string - filter: string - treeFilterPlaceholder: string - }[] - timelineLayer: { - id: string - label: string - color: number - }[] - routerInfo: unknown - router: unknown - activeInspectorTreeId: string - componentPluginHookBuffer: Array<() => void> -} diff --git a/packages/schema/src/types/hook.ts b/packages/schema/src/types/hook.ts deleted file mode 100644 index 81eeece9..00000000 --- a/packages/schema/src/types/hook.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type { AppRecord } from './vue' - -export enum DevToolsHooks { - // internal - APP_INIT = 'app:init', - APP_UNMOUNT = 'app:unmount', - COMPONENT_UPDATED = 'component:updated', - COMPONENT_ADDED = 'component:added', - COMPONENT_REMOVED = 'component:removed', - COMPONENT_EMIT = 'component:emit', - PERFORMANCE_START = 'perf:start', - PERFORMANCE_END = 'perf:end', - ADD_ROUTE = 'router:add-route', - REMOVE_ROUTE = 'router:remove-route', - RENDER_TRACKED = 'render:tracked', - RENDER_TRIGGERED = 'render:triggered', - APP_CONNECTED = 'app:connected', - SETUP_DEVTOOLS_PLUGIN = 'devtools-plugin:setup', -} - -export interface DevtoolsHook { - id: string - enabled?: boolean - events: Map - emit: (event: DevToolsHooks, ...payload: any[]) => void - on: (event: DevToolsHooks, handler: Function) => () => void - once: (event: DevToolsHooks, handler: Function) => void - off: (event: DevToolsHooks, handler: Function) => void - appRecords: AppRecord[] - apps: Record - cleanupBuffer?: (matchArg: unknown) => boolean -} diff --git a/packages/schema/src/types/index.ts b/packages/schema/src/types/index.ts deleted file mode 100644 index 98cf64df..00000000 --- a/packages/schema/src/types/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './context' -export * from './vue' -export * from './hook' diff --git a/packages/schema/src/types/vue.ts b/packages/schema/src/types/vue.ts deleted file mode 100644 index 0382b212..00000000 --- a/packages/schema/src/types/vue.ts +++ /dev/null @@ -1,118 +0,0 @@ -import type { App, ComponentInternalInstance, ComponentOptions, ConcreteComponent, SuspenseBoundary, VNode } from 'vue' - -type CacheKey = string | number | symbol | ConcreteComponent -type Cache = Map - -export type VueAppInstance = ComponentInternalInstance & { - type: { - _componentTag: string | undefined - components: Record - __VUE_DEVTOOLS_COMPONENT_GUSSED_NAME__: string - __isKeepAlive: boolean - devtools: { - hide: boolean - } - mixins: ComponentOptions[] - extends: ComponentOptions - vuex: { - getters: Record - } - computed: Record - } - __v_cache: Cache - __VUE_DEVTOOLS_UID__: string - _isBeingDestroyed: boolean - _instance: VueAppInstance - _container: { - _vnode: { - component: VueAppInstance - } - } - isUnmounted: boolean - parent: VueAppInstance - appContext: { - app: VueAppInstance & App & { - __VUE_DEVTOOLS_APP_RECORD_ID__: string - __VUE_DEVTOOLS_APP_RECORD__: AppRecord - } - } - __VUE_DEVTOOLS_APP_RECORD__: AppRecord - suspense: SuspenseBoundary & { suspenseKey: string } - renderContext: Record - devtoolsRawSetupState: Record - setupState: Record - provides: Record - ctx: Record -} - -export declare type PluginSettingsItem = { - label: string - description?: string -} & ({ - type: 'boolean' - defaultValue: boolean -} | { - type: 'choice' - defaultValue: string | number - options: { - value: string | number - label: string - }[] - component?: 'select' | 'button-group' -} | { - type: 'text' - defaultValue: string -}) - -export interface PluginDescriptor { - id: string - label: string - app: VueAppInstance - packageName?: string - homepage?: string - componentStateTypes?: string[] - logo?: string - disableAppScope?: boolean - disablePluginScope?: boolean - /** - * Run the plugin setup and expose the api even if the devtools is not opened yet. - * Useful to record timeline events early. - */ - enableEarlyProxy?: boolean - settings?: Record -} - -// @TODO -export type PluginApi = any - -export type PluginSetupFunction = (api: PluginApi) => void - -export interface AppRecord { - id: string | number - name: string - app?: App - version?: string - types?: Record - instanceMap: Map - rootInstance: VueAppInstance - api?: PluginApi - routerId?: string - moduleDetectives?: { - vueRouter: boolean - pinia: boolean - vueI18n: boolean - } -} - -export interface DevToolsState { - connected: boolean - clientConnected: boolean - vitePluginDetected: boolean - appRecords: AppRecord[] - activeAppRecord: AppRecord | null - selectedComponentId: string | null - pluginBuffer: [PluginDescriptor, PluginSetupFunction][] - tabs: unknown[] - commands: unknown[] - activeAppRecordId: string | null -} diff --git a/packages/schema/tsup.config.ts b/packages/schema/tsup.config.ts deleted file mode 100644 index db26dd2e..00000000 --- a/packages/schema/tsup.config.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { defineConfig } from 'tsup' - -export default defineConfig({ - entryPoints: [ - 'src/index.ts', - 'src/types/index', - ], - external: [ - 'vue', - ], - format: ['esm', 'cjs'], - dts: true, - shims: true, -}) diff --git a/packages/schema/types.d.ts b/packages/schema/types.d.ts deleted file mode 100644 index 9247c2a8..00000000 --- a/packages/schema/types.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './dist/index' diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 93e67ebe..f7846366 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -481,8 +481,6 @@ importers: specifier: workspace:* version: link:../vite - packages/schema: {} - packages/shared: dependencies: rfdc: diff --git a/tsconfig.json b/tsconfig.json index 94492949..8ca652aa 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,7 +8,6 @@ "paths": { "@vue/devtools-shared": ["./packages/shared/src/index.ts"], "@vue/devtools-core": ["./packages/core/src/index.ts"], - "@vue/devtools-schema": ["./packages/schema/src/index.ts"], "@vue/devtools-kit": ["./packages/devtools-kit/src/index.ts"], "@vue/devtools-ui": ["./packages/ui/src/index.ts"], "@vue/devtools-ui/theme": ["./packages/ui/theme/index.ts"],