🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@complex-suite/plugin

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@complex-suite/plugin - npm Package Compare versions

Comparing version
5.0.6
to
5.0.7
+44
src/types/index.ts
// plugin 包类型集中管理
// 来源:src/{notice, date, layout}.ts
// 来自 notice.ts
export type messageType = 'success' | 'error' | 'info' | 'warn'
export type debugConfirmOption = {
content: string
next: (operate: '' | 'ok' | 'cancel' | 'timeout', development: boolean, debugLevel: number) => void
development?: boolean
debugLevel?: number
offset?: number
okText?: string
cancelText?: string
}
export interface noticeOption {
message: (content: string, type?: messageType, title?: string, duration?: number, option?: unknown) => void
alert: (content: string, title?: string, next?: (operate: string) => void, okText?: string) => void
confirm: (content: string, title?: string, next?: (operate: string) => void, okText?: string, cancelText?: string) => void
debugConfirm: (option: debugConfirmOption) => void
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[prop: string]: (...args: any[]) => any
}
export interface noticeType extends noticeOption {
init: (options: noticeOption) => void
$debugConfirm: (development: boolean, debugLevel: number, option: debugConfirmOption) => void
}
// 来自 date.ts
export type parseType<D = unknown> = (value: Date) => D
export interface PluginDateInitOption {
rule?: Record<string, parseType<Date>>
parser?: Record<string, parseType>
offset?: number
}
// 来自 index.ts
export type optionsType = {
notice?: noticeOption
date?: boolean
}
+7
-0

@@ -0,1 +1,8 @@

### 5.0.7
- feat(locale): 导出消息类型并改用 vue-tsc 进行类型检查。
- docs: 更新项目文档。
### 5.0.6
- refactor(build): 将TypeScript类型导入语法升级为type关键字形式。
### 4.10.2

@@ -2,0 +9,0 @@ - refactor(build): 将TypeScript类型导入语法升级为type关键字形式。

+6
-12

@@ -1,10 +0,9 @@

import date, { type parseType, type PluginDateInitOption, PluginDate } from "./src/date"
import notice, { type noticeOption, type messageType, type debugConfirmOption, type noticeType } from "./src/notice"
import date, { PluginDate } from "./src/date"
import notice from "./src/notice"
import PluginLayout, { PluginLayoutData, type PluginLayoutDataInitOption } from "./src/layout"
import { pluginLocale } from "./src/locale"
import type { PluginMessages } from "./src/locale"
import type { optionsType } from "./src/types"
export type optionsType = {
notice?: noticeOption
date?: boolean
}
export type * from "./src/types"

@@ -24,10 +23,4 @@ const install = function(options: optionsType = {}) {

date,
type parseType,
type PluginDateInitOption,
PluginDate,
notice,
type noticeOption,
type messageType,
type debugConfirmOption,
type noticeType,
PluginLayout,

@@ -37,4 +30,5 @@ PluginLayoutData,

pluginLocale,
type PluginMessages,
install
}
{
"name": "@complex-suite/plugin",
"version": "5.0.6",
"version": "5.0.7",
"description": "a complex plugin",

@@ -8,4 +8,3 @@ "type": "module",

"exports": {
".": "./index.ts",
"./locale/en": "./src/locale/en.ts"
".": "./index.ts"
},

@@ -17,3 +16,3 @@ "repository": {

"dependencies": {
"@complex-suite/utils": "3.0.6"
"@complex-suite/utils": "3.0.7"
},

@@ -20,0 +19,0 @@ "devDependencies": {

import { _Data } from "@complex-suite/utils"
import type { parseType, PluginDateInitOption } from "./types"
export type parseType<D = unknown> = (value: Date) => D
export type { parseType, PluginDateInitOption }
export interface PluginDateInitOption {
rule?: Record<string, parseType<Date>>
parser?: Record<string, parseType>
offset?: number
}
const defaultOffset = 1000 * 60 * 1 // 1分钟

@@ -12,0 +7,0 @@

@@ -6,4 +6,3 @@ import type { LocalePack } from '@complex-suite/utils'

export const enMessages: PluginMessages = {
'notice.timeout':
'Notice timeout is not defined, please confirm notice is initialized!',
'notice.timeout': 'Notice timeout is not defined, please confirm notice is initialized!',
'notice.debugConfirm': 'Debug mode operation confirmation',

@@ -10,0 +9,0 @@ 'notice.devConfirm': 'Development mode operation confirmation',

@@ -10,9 +10,9 @@ import { Locale } from '@complex-suite/utils'

* 【语言包按需加载/注册】构造时默认仅注册中文包。
* 英文包 en 作为独立子路径导出(./locale/en),主入口不加载它,避免无谓的模块求值开销。
* 需要英文时显式导入并注册:
* import en from '@complex-suite/plugin/locale/en'
* pluginLocale.registerLocale(en)
* 英文包通过 registerLoader 注册动态加载器,setLocaleAsync 时自动按需 import。
*/
const pluginLocale = new Locale<PluginMessages>({ pack: zh, name: 'plugin' })
/** 注册英文包动态加载器,setLocaleAsync 时自动触发按需加载 */
pluginLocale.registerLoader('en-US', () => import('./en').then(m => m.default))
export {

@@ -19,0 +19,0 @@ pluginLocale,

import { Wait } from "@complex-suite/utils"
import { pluginLocale } from "./locale"
import type { messageType, debugConfirmOption, noticeOption, noticeType } from "./types"
export type messageType = 'success' | 'error' | 'info' | 'warn'
export type { messageType, debugConfirmOption, noticeOption, noticeType }
export type debugConfirmOption = {
content: string
next: (operate: '' | 'ok' | 'cancel' | 'timeout', development: boolean, debugLevel: number) => void
development?: boolean
debugLevel?: number
offset?: number
okText?: string
cancelText?: string
}
export interface noticeOption {
message: (content: string, type?: messageType, title?: string, duration?: number, option?: unknown) => void
alert: (content: string, title?: string, next?: (operate: string) => void, okText?: string) => void
confirm: (content: string, title?: string, next?: (operate: string) => void, okText?: string, cancelText?: string) => void
debugConfirm: (option: debugConfirmOption) => void
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[prop: string]: (...args: any[]) => any
}
export interface noticeType extends noticeOption {
init: (options: noticeOption) => void
$debugConfirm: (development: boolean, debugLevel: number, option: debugConfirmOption) => void
}
let wait: undefined | Wait = new Wait({

@@ -31,0 +8,0 @@ notice: {

import { defineConfig } from 'vitest/config'
import { fileURLToPath } from 'node:url'
export default defineConfig({
root: fileURLToPath(new URL('.', import.meta.url)),
test: {

@@ -5,0 +7,0 @@ globals: true,