Skip to content

Commit

Permalink
wip: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
hemengke1997 committed Aug 30, 2024
1 parent f93a55c commit 2555b28
Show file tree
Hide file tree
Showing 24 changed files with 12,459 additions and 9,753 deletions.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@
"devDependencies": {
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.7",
"@commitlint/cli": "^19.3.0",
"@minko-fe/commitlint-config": "^2.1.0",
"@minko-fe/eslint-config": "^3.3.1",
"@minko-fe/prettier-config": "^2.2.2",
"@commitlint/cli": "^19.4.1",
"@minko-fe/commitlint-config": "^2.1.2",
"@minko-fe/eslint-config": "^4.0.0",
"@minko-fe/prettier-config": "^2.2.3",
"@minko-fe/tsconfig": "latest",
"eslint": "^9.8.0",
"eslint": "^9.9.1",
"npm-run-all2": "^6.2.2",
"nyc": "^17.0.0",
"prettier-plugin-astro": "^0.14.1",
"prettier-plugin-tailwindcss": "^0.6.5",
"prettier-plugin-tailwindcss": "^0.6.6",
"simple-git-hooks": "^2.11.1",
"taze": "^0.16.3",
"taze": "^0.16.7",
"tsup": "^8.2.4",
"turbo": "^1.13.4",
"typescript": "^5.5.4"
Expand Down
13 changes: 7 additions & 6 deletions packages/istanbul-server-middleware/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"debug": "nyc --all report --reporter=html"
},
"dependencies": {
"@minko-fe/lodash-pro": "^0.3.3",
"archiver": "7.0.0",
"body-parser": "^1.20.2",
"cors": "^2.8.5",
Expand All @@ -32,18 +31,20 @@
"istanbul-lib-coverage": "^3.2.2",
"node-html-parser": "^6.1.13",
"nyc": "^15.1.0",
"pm2": "^5.3.1",
"rimraf": "^5.0.7",
"tsx": "^4.11.0"
"pm2": "^5.4.2",
"rimraf": "^5.0.10",
"tsx": "^4.19.0"
},
"devDependencies": {
"@types/archiver": "^6.0.2",
"@types/body-parser": "^1.19.5",
"@types/cors": "^2.8.17",
"@types/express": "^4.17.21",
"@types/express-serve-static-core": "^4.19.1",
"@types/express-serve-static-core": "^4.19.5",
"@types/fs-extra": "^11.0.4",
"@types/istanbul-lib-coverage": "^2.0.6",
"@types/node": "^20.12.12"
"@types/lodash-es": "^4.17.12",
"@types/node": "^20.16.2",
"lodash-es": "^4.17.21"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/

import * as _ from '@minko-fe/lodash-pro'
import { $ } from 'execa'
import { type Request, type Response } from 'express'
import fg from 'fast-glob'
import fs from 'fs-extra'
import { type CoverageMap, createCoverageMap } from 'istanbul-lib-coverage'
import * as _ from 'lodash-es'
import path from 'node:path'
import * as querystring from 'node:querystring'
import { parse } from 'node-html-parser'
Expand Down
21 changes: 11 additions & 10 deletions packages/istanbul-widget/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@
},
"dependencies": {
"@iconify-json/vscode-icons": "^1.1.37",
"@minko-fe/lodash-pro": "^0.3.3",
"@minko-fe/react-hook": "^0.3.7",
"@neodrag/react": "^2.0.4",
"@radix-ui/react-alert-dialog": "^1.1.1",
"@radix-ui/react-dialog": "^1.1.1",
Expand All @@ -82,31 +80,34 @@
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-switch": "^1.1.0",
"@radix-ui/react-toast": "^1.2.1",
"ahooks": "^3.8.1",
"class-variance-authority": "^0.7.0",
"consola": "^3.2.3",
"context-state": "^3.0.0",
"context-state": "^3.1.1",
"eventemitter3": "^5.0.1",
"tw-clsx": "^0.1.0"
},
"devDependencies": {
"@iconify/tailwind": "^1.1.2",
"@swc/core": "^1.7.6",
"@types/node": "^20.14.14",
"@types/react": "^18.3.3",
"@iconify/tailwind": "^1.1.3",
"@swc/core": "^1.7.21",
"@types/lodash-es": "^4.17.12",
"@types/node": "^20.16.2",
"@types/react": "^18.3.4",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.1",
"autoprefixer": "^10.4.20",
"lodash-es": "^4.17.21",
"npm-run-all2": "^6.2.2",
"postcss": "^8.4.40",
"postcss": "^8.4.41",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"rollup-plugin-visualizer": "^5.12.0",
"tailwindcss": "3.2.7",
"tailwindcss-animate": "^1.0.7",
"tailwindcss-rem-to-px": "^0.1.0",
"tailwindcss-rem-to-px": "^0.1.1",
"tsup-plugin-bundleless": "^0.4.0",
"tsup-plugin-css-legacy": "^0.0.1",
"typescript": "^5.5.4",
"vite": "^5.3.5"
"vite": "^5.4.2"
}
}
6 changes: 3 additions & 3 deletions packages/istanbul-widget/src/core/components/draggable.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { max } from '@minko-fe/lodash-pro'
import { useLocalStorageState, useMemoizedFn } from '@minko-fe/react-hook'
import { type DragOptions, useDraggable } from '@neodrag/react'
import { type PropsWithChildren, memo, useEffect, useRef, useState } from 'react'
import { useLocalStorageState, useMemoizedFn } from 'ahooks'
import { max } from 'lodash-es'
import { memo, type PropsWithChildren, useEffect, useRef, useState } from 'react'
import { cn } from '@/components/utils'
import { ISTANBUL_WIDGET_ID } from '@/utils/const'
import Context from '../context'
Expand Down
2 changes: 1 addition & 1 deletion packages/istanbul-widget/src/core/context.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useDebounceFn, useLatest, useSetState } from '@minko-fe/react-hook'
import { useDebounceFn, useLatest, useSetState } from 'ahooks'
import { createContainer } from 'context-state'
import { useToast } from '@/components/ui'
import { IstanbulWidget } from './core'
Expand Down
4 changes: 2 additions & 2 deletions packages/istanbul-widget/src/core/core.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isArray, isFunction, isObject, merge, set } from '@minko-fe/lodash-pro'
import { type ConsolaInstance, LogLevels, createConsola } from 'consola/browser'
import { type ConsolaInstance, createConsola, LogLevels } from 'consola/browser'
import { isArray, isFunction, isObject, merge, set } from 'lodash-es'
import { ButtonGroupPlugin } from '@/plugins/button-group/button-group-plugin'
import { ReportPlugin } from '@/plugins/report/report-plugin'
import { SettingPlugin } from '@/plugins/setting/setting-plugin'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isFunction, uniqueId } from '@minko-fe/lodash-pro'
import EventEmitter from 'eventemitter3'
import { isFunction, uniqueId } from 'lodash-es'
import { ISTANBUL_WIDGET_ID } from '@/utils/const'
import { type IstanbulWidget } from '../core'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import { IstanbulWidgetPlugin } from './istanbul-widget-plugin'

export type IstanbulWidgetReactPluginProps = {} & PluginType

export class IstanbulWidgetReactPlugin<T extends {} = {}> extends IstanbulWidgetPlugin {
export class IstanbulWidgetReactPlugin<
T extends Record<string, any> = Record<string, any>,
> extends IstanbulWidgetPlugin {
private _root!: HTMLDivElement
constructor(
/**
Expand Down
3 changes: 1 addition & 2 deletions packages/istanbul-widget/src/istanbul-widget.iife.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { isBrowser } from '@minko-fe/lodash-pro'
import { IstanbulWidget } from './core/core'

declare global {
Expand All @@ -8,6 +7,6 @@ declare global {
}

// ssr support
if (isBrowser()) {
if (typeof window !== 'undefined') {
window.IstanbulWidget = IstanbulWidget
}
4 changes: 2 additions & 2 deletions packages/istanbul-widget/src/plugins/setting/setting.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isObject, remove, toNumber } from '@minko-fe/lodash-pro'
import { useLocalStorageState, useMemoizedFn, useSetState, useUpdateEffect } from '@minko-fe/react-hook'
import { useLocalStorageState, useMemoizedFn, useSetState, useUpdateEffect } from 'ahooks'
import { isObject, remove, toNumber } from 'lodash-es'
import { memo, useEffect, useMemo, useRef, useState } from 'react'
import {
AlertDialog,
Expand Down
6 changes: 3 additions & 3 deletions packages/istanbul-widget/src/utils/query.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { isArray } from '@minko-fe/lodash-pro'
import { isArray } from 'lodash-es'

const $ = {
one(selector: string, contextElement: Element | Document = document) {
try {
return <HTMLElement>contextElement.querySelector(selector) || undefined
} catch (e) {
} catch {
return undefined
}
},
Expand All @@ -23,7 +23,7 @@ const $ = {
try {
const nodeList = <NodeListOf<HTMLElement>>contextElement.querySelectorAll(selector)
return <HTMLElement[]>[].slice.call(nodeList)
} catch (e) {
} catch {
return <HTMLElement[]>[]
}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/istanbul-widget/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Options, defineConfig } from 'tsup'
import { defineConfig, type Options } from 'tsup'
import { bundleless } from 'tsup-plugin-bundleless'
import { cssLegacy } from 'tsup-plugin-css-legacy'
import pkg from './package.json'
Expand Down
2 changes: 1 addition & 1 deletion packages/istanbul-widget/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import react from '@vitejs/plugin-react'
import path from 'node:path'
import { visualizer as rollupVisualizer } from 'rollup-plugin-visualizer'
import { type PluginOption, defineConfig } from 'vite'
import { defineConfig, type PluginOption } from 'vite'
import pkg from './package.json'

function visualizer() {
Expand Down
9 changes: 5 additions & 4 deletions packages/vite-plugin-istanbul-widget/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
},
"dependencies": {
"@istanbuljs/load-nyc-config": "1.1.0",
"@minko-fe/lodash-pro": "^0.3.3",
"debug": "^4.3.6",
"es-module-lexer": "1.5.3",
"espree": "10.0.1",
Expand All @@ -84,16 +83,18 @@
"magic-string": "^0.30.11",
"picocolors": "1.0.0",
"source-map": "0.7.4",
"test-exclude": "6.0.0",
"vite-plugin-istanbul": "6.0.0"
"test-exclude": "6.0.0"
},
"devDependencies": {
"@types/debug": "^4.1.12",
"@types/lodash-es": "^4.17.12",
"@types/node": "^20.14.14",
"@types/react": "^18.3.3",
"@types/serialize-javascript": "5.0.4",
"lodash-es": "^4.17.21",
"react": "^18.3.1",
"serialize-javascript": "6.0.2",
"typescript": "^5.5.4"
"typescript": "^5.5.4",
"vite-plugin-istanbul": "6.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/vite-plugin-istanbul-widget/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Plugin } from 'vite'
import { isArray, set } from '@minko-fe/lodash-pro'
import { isArray, set } from 'lodash-es'
import istanbul from 'vite-plugin-istanbul'
import { vendor } from './meta'
import { type VitePluginIstanbulWidgetOptions } from './types'
Expand Down
1 change: 1 addition & 0 deletions packages/vite-plugin-istanbul-widget/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const tsup = defineConfig((option) => {
target: 'node16',
format: ['cjs', 'esm'],
external: ['vite-plugin-istanbul/*'],
noExternal: ['vite-plugin-istanbul'],
platform: 'node',
splitting: false,
treeshake: true,
Expand Down
10 changes: 5 additions & 5 deletions playground/astro-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
},
"dependencies": {
"@astrojs/check": "^0.5.10",
"astro": "^4.8.7",
"astro": "^4.15.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"typescript": "^5.4.5",
"typescript": "^5.5.4",
"vite-plugin-istanbul-widget": "workspace:*",
"vite-plugin-public-typescript": "latest"
"vite-plugin-public-typescript": "^3.2.3"
},
"devDependencies": {
"@astrojs/react": "^3.3.4",
"@astrojs/react": "^3.6.2",
"@minko-fe/tsconfig": "latest",
"@types/react": "^18.3.2"
"@types/react": "^18.3.4"
}
}
6 changes: 3 additions & 3 deletions playground/astro3-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
"@astrojs/node": "6.0.0",
"@astrojs/react": "3.0.2",
"@minko-fe/tsconfig": "latest",
"@types/react": "^18.3.2",
"typescript": "^5.4.5",
"@types/react": "^18.3.4",
"typescript": "^5.5.4",
"vite-plugin-istanbul-widget": "workspace:*",
"vite-plugin-public-typescript": "latest"
"vite-plugin-public-typescript": "^3.2.3"
}
}
16 changes: 8 additions & 8 deletions playground/nextjs14-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@
"lint": "next lint"
},
"dependencies": {
"next": "^14.2.3",
"next": "^14.2.7",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@types/node": "^20.12.12",
"@types/react": "^18.3.2",
"@types/node": "^20.16.2",
"@types/react": "^18.3.4",
"@types/react-dom": "^18.3.0",
"babel-plugin-istanbul": "^6.1.1",
"istanbul-widget": "workspace:*",
"postcss": "^8.4.38",
"tailwindcss": "^3.4.3",
"typescript": "^5.4.5",
"vite": "^5.2.11",
"postcss": "^8.4.41",
"tailwindcss": "^3.4.10",
"typescript": "^5.5.4",
"vite": "^5.4.2",
"vite-plugin-istanbul-widget": "workspace:*",
"vite-plugin-public-typescript": "latest"
"vite-plugin-public-typescript": "^3.2.3"
}
}
10 changes: 5 additions & 5 deletions playground/react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
"react-dom": "^18.3.1"
},
"devDependencies": {
"@types/react": "^18.3.2",
"@types/react": "^18.3.4",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.0",
"typescript": "^5.4.5",
"vite": "^5.2.11",
"@vitejs/plugin-react": "^4.3.1",
"typescript": "^5.5.4",
"vite": "^5.4.2",
"vite-plugin-istanbul-widget": "workspace:*",
"vite-plugin-public-typescript": "latest"
"vite-plugin-public-typescript": "^3.2.3"
}
}
26 changes: 13 additions & 13 deletions playground/remix-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@
"typecheck": "tsc"
},
"dependencies": {
"@remix-run/node": "^2.9.2",
"@remix-run/react": "^2.9.2",
"@remix-run/serve": "^2.9.2",
"isbot": "^4.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"@remix-run/node": "^2.11.2",
"@remix-run/react": "^2.11.2",
"@remix-run/serve": "^2.11.2",
"isbot": "^4.4.0",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@remix-run/dev": "^2.9.2",
"@types/react": "^18.2.20",
"@types/react-dom": "^18.2.7",
"typescript": "^5.4.5",
"vite": "^5.2.11",
"@remix-run/dev": "^2.11.2",
"@types/react": "^18.3.4",
"@types/react-dom": "^18.3.0",
"typescript": "^5.5.4",
"vite": "^5.4.2",
"vite-plugin-istanbul-widget": "workspace:*",
"vite-plugin-public-typescript": "latest",
"vite-tsconfig-paths": "^4.2.1"
"vite-plugin-public-typescript": "^3.2.3",
"vite-tsconfig-paths": "^5.0.1"
}
}
Loading

0 comments on commit 2555b28

Please sign in to comment.