@sybz-components/utils 1.0.9 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base.cjs +2 -1
- package/dist/base.d.cts +3 -4
- package/dist/base.d.mts +3 -4
- package/dist/base.d.ts +3 -4
- package/dist/base.mjs +2 -1
- package/dist/codeStandard.cjs +108 -0
- package/dist/codeStandard.d.cts +17 -0
- package/dist/codeStandard.d.mts +17 -0
- package/dist/codeStandard.d.ts +17 -0
- package/dist/codeStandard.mjs +93 -0
- package/dist/confirmSemantic.cjs +27 -0
- package/dist/confirmSemantic.d.cts +29 -0
- package/dist/confirmSemantic.d.mts +29 -0
- package/dist/confirmSemantic.d.ts +29 -0
- package/dist/confirmSemantic.mjs +25 -0
- package/dist/format.cjs +2 -1
- package/dist/format.mjs +2 -1
- package/dist/index.cjs +3 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +2 -1
- package/dist/shared/{utils.Co6HoBFm.mjs → utils.CJdEsMHi.mjs} +12 -6
- package/dist/shared/{utils.Y29JLBLz.cjs → utils.DfuweQgy.cjs} +12 -6
- package/dist/sybz-code-standard.cjs +119 -0
- package/dist/sybz-code-standard.d.cts +1 -0
- package/dist/sybz-code-standard.d.mts +1 -0
- package/dist/sybz-code-standard.d.ts +1 -0
- package/dist/sybz-code-standard.mjs +112 -0
- package/dist/vite.cjs +8 -0
- package/dist/vite.d.cts +4 -1
- package/dist/vite.d.mts +4 -1
- package/dist/vite.d.ts +4 -1
- package/dist/vite.mjs +4 -0
- package/package.json +23 -2
package/dist/base.cjs
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
require('vue');
|
|
4
4
|
require('consola');
|
|
5
5
|
require('es-toolkit');
|
|
6
|
-
const format = require('./shared/utils.
|
|
6
|
+
const format = require('./shared/utils.DfuweQgy.cjs');
|
|
7
|
+
require('./confirmSemantic.cjs');
|
|
7
8
|
require('element-plus');
|
|
8
9
|
require('./is.cjs');
|
|
9
10
|
|
package/dist/base.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
2
|
import { VNode, AppContext, Ref } from 'vue';
|
|
3
|
+
import { ConfirmVariant, ConfirmTarget } from './confirmSemantic.cjs';
|
|
3
4
|
import { MessageOptions, ElMessageBoxOptions, ElMessageBox } from 'element-plus';
|
|
4
5
|
|
|
5
6
|
type Func<Args extends any[] = any[], Return = any> = (...args: Args) => Return;
|
|
@@ -126,9 +127,7 @@ interface CopyOptions extends ToastOptions {
|
|
|
126
127
|
}
|
|
127
128
|
type WidthInput = string | number | Ref<string | number>;
|
|
128
129
|
type ConfirmMessage = string | VNode | (() => VNode);
|
|
129
|
-
type ConfirmVariant = 'default' | 'delete' | 'warning';
|
|
130
130
|
type ConfirmTheme = UtilsTheme;
|
|
131
|
-
type ConfirmTarget = string | number;
|
|
132
131
|
interface ConfirmCustomOptions {
|
|
133
132
|
/**
|
|
134
133
|
* 确认框语义样式。
|
|
@@ -643,5 +642,5 @@ declare function getUtilsBuildTime(fallback?: string): string;
|
|
|
643
642
|
*/
|
|
644
643
|
declare function test(): string;
|
|
645
644
|
|
|
646
|
-
export { $toast, clearStorage, clone, configureUtils, confirm, copy, debounce, delay, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, mockValue, processWidth, random, setStorage, test, throttle, toLine, tryCatch, validate, validateForm, validateOnSubmit };
|
|
647
|
-
export type { ConfirmCustomOptions, ConfirmMessage, ConfirmOptions,
|
|
645
|
+
export { $toast, ConfirmTarget, ConfirmVariant, clearStorage, clone, configureUtils, confirm, copy, debounce, delay, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, mockValue, processWidth, random, setStorage, test, throttle, toLine, tryCatch, validate, validateForm, validateOnSubmit };
|
|
646
|
+
export type { ConfirmCustomOptions, ConfirmMessage, ConfirmOptions, ConfirmTheme, SybzUtilsConfig, ToastOptions, UtilsTheme };
|
package/dist/base.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
2
|
import { VNode, AppContext, Ref } from 'vue';
|
|
3
|
+
import { ConfirmVariant, ConfirmTarget } from './confirmSemantic.mjs';
|
|
3
4
|
import { MessageOptions, ElMessageBoxOptions, ElMessageBox } from 'element-plus';
|
|
4
5
|
|
|
5
6
|
type Func<Args extends any[] = any[], Return = any> = (...args: Args) => Return;
|
|
@@ -126,9 +127,7 @@ interface CopyOptions extends ToastOptions {
|
|
|
126
127
|
}
|
|
127
128
|
type WidthInput = string | number | Ref<string | number>;
|
|
128
129
|
type ConfirmMessage = string | VNode | (() => VNode);
|
|
129
|
-
type ConfirmVariant = 'default' | 'delete' | 'warning';
|
|
130
130
|
type ConfirmTheme = UtilsTheme;
|
|
131
|
-
type ConfirmTarget = string | number;
|
|
132
131
|
interface ConfirmCustomOptions {
|
|
133
132
|
/**
|
|
134
133
|
* 确认框语义样式。
|
|
@@ -643,5 +642,5 @@ declare function getUtilsBuildTime(fallback?: string): string;
|
|
|
643
642
|
*/
|
|
644
643
|
declare function test(): string;
|
|
645
644
|
|
|
646
|
-
export { $toast, clearStorage, clone, configureUtils, confirm, copy, debounce, delay, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, mockValue, processWidth, random, setStorage, test, throttle, toLine, tryCatch, validate, validateForm, validateOnSubmit };
|
|
647
|
-
export type { ConfirmCustomOptions, ConfirmMessage, ConfirmOptions,
|
|
645
|
+
export { $toast, ConfirmTarget, ConfirmVariant, clearStorage, clone, configureUtils, confirm, copy, debounce, delay, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, mockValue, processWidth, random, setStorage, test, throttle, toLine, tryCatch, validate, validateForm, validateOnSubmit };
|
|
646
|
+
export type { ConfirmCustomOptions, ConfirmMessage, ConfirmOptions, ConfirmTheme, SybzUtilsConfig, ToastOptions, UtilsTheme };
|
package/dist/base.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
2
|
import { VNode, AppContext, Ref } from 'vue';
|
|
3
|
+
import { ConfirmVariant, ConfirmTarget } from './confirmSemantic.js';
|
|
3
4
|
import { MessageOptions, ElMessageBoxOptions, ElMessageBox } from 'element-plus';
|
|
4
5
|
|
|
5
6
|
type Func<Args extends any[] = any[], Return = any> = (...args: Args) => Return;
|
|
@@ -126,9 +127,7 @@ interface CopyOptions extends ToastOptions {
|
|
|
126
127
|
}
|
|
127
128
|
type WidthInput = string | number | Ref<string | number>;
|
|
128
129
|
type ConfirmMessage = string | VNode | (() => VNode);
|
|
129
|
-
type ConfirmVariant = 'default' | 'delete' | 'warning';
|
|
130
130
|
type ConfirmTheme = UtilsTheme;
|
|
131
|
-
type ConfirmTarget = string | number;
|
|
132
131
|
interface ConfirmCustomOptions {
|
|
133
132
|
/**
|
|
134
133
|
* 确认框语义样式。
|
|
@@ -643,5 +642,5 @@ declare function getUtilsBuildTime(fallback?: string): string;
|
|
|
643
642
|
*/
|
|
644
643
|
declare function test(): string;
|
|
645
644
|
|
|
646
|
-
export { $toast, clearStorage, clone, configureUtils, confirm, copy, debounce, delay, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, mockValue, processWidth, random, setStorage, test, throttle, toLine, tryCatch, validate, validateForm, validateOnSubmit };
|
|
647
|
-
export type { ConfirmCustomOptions, ConfirmMessage, ConfirmOptions,
|
|
645
|
+
export { $toast, ConfirmTarget, ConfirmVariant, clearStorage, clone, configureUtils, confirm, copy, debounce, delay, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, mockValue, processWidth, random, setStorage, test, throttle, toLine, tryCatch, validate, validateForm, validateOnSubmit };
|
|
646
|
+
export type { ConfirmCustomOptions, ConfirmMessage, ConfirmOptions, ConfirmTheme, SybzUtilsConfig, ToastOptions, UtilsTheme };
|
package/dist/base.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import 'vue';
|
|
2
2
|
import 'consola';
|
|
3
3
|
import 'es-toolkit';
|
|
4
|
-
export { $ as $toast, c as clearStorage, a as clone, b as configureUtils, d as confirm, e as copy, f as debounce, g as delay, h as getStorage, i as getType, j as getUtilsBuildTime, k as getVariable, l as isEmpty, m as log, n as merge, o as mockValue, p as processWidth, r as random, s as setStorage, t as test, q as throttle, u as toLine, v as tryCatch, w as validate, x as validateForm, y as validateOnSubmit } from './shared/utils.
|
|
4
|
+
export { $ as $toast, c as clearStorage, a as clone, b as configureUtils, d as confirm, e as copy, f as debounce, g as delay, h as getStorage, i as getType, j as getUtilsBuildTime, k as getVariable, l as isEmpty, m as log, n as merge, o as mockValue, p as processWidth, r as random, s as setStorage, t as test, q as throttle, u as toLine, v as tryCatch, w as validate, x as validateForm, y as validateOnSubmit } from './shared/utils.CJdEsMHi.mjs';
|
|
5
|
+
import './confirmSemantic.mjs';
|
|
5
6
|
import 'element-plus';
|
|
6
7
|
import './is.mjs';
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const js = require('@eslint/js');
|
|
4
|
+
const tsPlugin = require('@typescript-eslint/eslint-plugin');
|
|
5
|
+
const tsParser = require('@typescript-eslint/parser');
|
|
6
|
+
const prettier = require('eslint-config-prettier');
|
|
7
|
+
const vue = require('eslint-plugin-vue');
|
|
8
|
+
const globals = require('globals');
|
|
9
|
+
const vueParser = require('vue-eslint-parser');
|
|
10
|
+
|
|
11
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
12
|
+
|
|
13
|
+
const js__default = /*#__PURE__*/_interopDefaultCompat(js);
|
|
14
|
+
const tsPlugin__default = /*#__PURE__*/_interopDefaultCompat(tsPlugin);
|
|
15
|
+
const tsParser__default = /*#__PURE__*/_interopDefaultCompat(tsParser);
|
|
16
|
+
const prettier__default = /*#__PURE__*/_interopDefaultCompat(prettier);
|
|
17
|
+
const vue__default = /*#__PURE__*/_interopDefaultCompat(vue);
|
|
18
|
+
const globals__default = /*#__PURE__*/_interopDefaultCompat(globals);
|
|
19
|
+
const vueParser__default = /*#__PURE__*/_interopDefaultCompat(vueParser);
|
|
20
|
+
|
|
21
|
+
const sybzPrettierConfig = {
|
|
22
|
+
singleQuote: true,
|
|
23
|
+
semi: false,
|
|
24
|
+
trailingComma: "all",
|
|
25
|
+
printWidth: 120,
|
|
26
|
+
endOfLine: "lf",
|
|
27
|
+
htmlWhitespaceSensitivity: "ignore"
|
|
28
|
+
};
|
|
29
|
+
const sybzLintStagedConfig = {
|
|
30
|
+
"**/*.{js,jsx,ts,tsx,vue,mjs,cjs}": [
|
|
31
|
+
"sybz-code-standard prettier --write",
|
|
32
|
+
"sybz-code-standard eslint --fix --max-warnings=0"
|
|
33
|
+
],
|
|
34
|
+
"**/*.{css,scss,json,yaml,yml,html,md}": ["sybz-code-standard prettier --write"]
|
|
35
|
+
};
|
|
36
|
+
const baseEslintConfig = [
|
|
37
|
+
{
|
|
38
|
+
ignores: [
|
|
39
|
+
"node_modules/**",
|
|
40
|
+
"dist/**",
|
|
41
|
+
"dist-ssr/**",
|
|
42
|
+
"coverage/**",
|
|
43
|
+
"docs/.vitepress/cache/**",
|
|
44
|
+
"docs/.vitepress/dist/**",
|
|
45
|
+
"packages/*/dist/**",
|
|
46
|
+
".vitepress/**",
|
|
47
|
+
".codex-types-temp/**",
|
|
48
|
+
"*.tsbuildinfo",
|
|
49
|
+
"*.local"
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
js__default.configs.recommended,
|
|
53
|
+
tsPlugin__default.configs["flat/base"],
|
|
54
|
+
...vue__default.configs["flat/recommended"],
|
|
55
|
+
{
|
|
56
|
+
files: ["**/*.{js,jsx,ts,tsx,cjs,mjs,vue}"],
|
|
57
|
+
languageOptions: {
|
|
58
|
+
ecmaVersion: "latest",
|
|
59
|
+
sourceType: "module",
|
|
60
|
+
globals: {
|
|
61
|
+
...globals__default.browser,
|
|
62
|
+
...globals__default.node,
|
|
63
|
+
...globals__default.es2021
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
rules: {
|
|
67
|
+
"no-console": "off",
|
|
68
|
+
"no-unused-vars": "off",
|
|
69
|
+
"vue/no-unused-vars": "off",
|
|
70
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
71
|
+
"vue/multi-word-component-names": "off",
|
|
72
|
+
"vue/no-template-shadow": "off",
|
|
73
|
+
"vue/attribute-hyphenation": ["warn", "always", { ignore: ["dangerouslyUseHTMLString"] }],
|
|
74
|
+
"vue/require-default-prop": "off"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
files: ["**/*.{ts,tsx,vue}"],
|
|
79
|
+
rules: {
|
|
80
|
+
"no-undef": "off",
|
|
81
|
+
"no-redeclare": "off"
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
files: ["**/*.vue"],
|
|
86
|
+
languageOptions: {
|
|
87
|
+
parser: vueParser__default,
|
|
88
|
+
parserOptions: {
|
|
89
|
+
parser: tsParser__default,
|
|
90
|
+
ecmaVersion: "latest",
|
|
91
|
+
sourceType: "module",
|
|
92
|
+
ecmaFeatures: { jsx: true },
|
|
93
|
+
extraFileExtensions: [".vue"]
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
];
|
|
98
|
+
const createSybzEslintConfig = (...extensions) => [
|
|
99
|
+
...baseEslintConfig,
|
|
100
|
+
...extensions,
|
|
101
|
+
prettier__default
|
|
102
|
+
];
|
|
103
|
+
const sybzEslintConfig = createSybzEslintConfig();
|
|
104
|
+
|
|
105
|
+
exports.createSybzEslintConfig = createSybzEslintConfig;
|
|
106
|
+
exports.sybzEslintConfig = sybzEslintConfig;
|
|
107
|
+
exports.sybzLintStagedConfig = sybzLintStagedConfig;
|
|
108
|
+
exports.sybzPrettierConfig = sybzPrettierConfig;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Linter } from 'eslint';
|
|
2
|
+
import { Config } from 'prettier';
|
|
3
|
+
|
|
4
|
+
type SybzEslintConfig = Linter.Config;
|
|
5
|
+
/** 公司前端项目统一使用的 Prettier 配置。 */
|
|
6
|
+
declare const sybzPrettierConfig: Config;
|
|
7
|
+
/** 公司前端项目统一使用的 lint-staged 配置。 */
|
|
8
|
+
declare const sybzLintStagedConfig: Record<string, string[]>;
|
|
9
|
+
/**
|
|
10
|
+
* 创建公司统一的 ESLint flat config。项目级扩展会插入到 Prettier 兼容配置之前。
|
|
11
|
+
*/
|
|
12
|
+
declare const createSybzEslintConfig: (...extensions: Linter.Config[]) => Linter.Config[];
|
|
13
|
+
/** 公司前端项目默认的 ESLint flat config。 */
|
|
14
|
+
declare const sybzEslintConfig: SybzEslintConfig[];
|
|
15
|
+
|
|
16
|
+
export { createSybzEslintConfig, sybzEslintConfig, sybzLintStagedConfig, sybzPrettierConfig };
|
|
17
|
+
export type { SybzEslintConfig };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Linter } from 'eslint';
|
|
2
|
+
import { Config } from 'prettier';
|
|
3
|
+
|
|
4
|
+
type SybzEslintConfig = Linter.Config;
|
|
5
|
+
/** 公司前端项目统一使用的 Prettier 配置。 */
|
|
6
|
+
declare const sybzPrettierConfig: Config;
|
|
7
|
+
/** 公司前端项目统一使用的 lint-staged 配置。 */
|
|
8
|
+
declare const sybzLintStagedConfig: Record<string, string[]>;
|
|
9
|
+
/**
|
|
10
|
+
* 创建公司统一的 ESLint flat config。项目级扩展会插入到 Prettier 兼容配置之前。
|
|
11
|
+
*/
|
|
12
|
+
declare const createSybzEslintConfig: (...extensions: Linter.Config[]) => Linter.Config[];
|
|
13
|
+
/** 公司前端项目默认的 ESLint flat config。 */
|
|
14
|
+
declare const sybzEslintConfig: SybzEslintConfig[];
|
|
15
|
+
|
|
16
|
+
export { createSybzEslintConfig, sybzEslintConfig, sybzLintStagedConfig, sybzPrettierConfig };
|
|
17
|
+
export type { SybzEslintConfig };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Linter } from 'eslint';
|
|
2
|
+
import { Config } from 'prettier';
|
|
3
|
+
|
|
4
|
+
type SybzEslintConfig = Linter.Config;
|
|
5
|
+
/** 公司前端项目统一使用的 Prettier 配置。 */
|
|
6
|
+
declare const sybzPrettierConfig: Config;
|
|
7
|
+
/** 公司前端项目统一使用的 lint-staged 配置。 */
|
|
8
|
+
declare const sybzLintStagedConfig: Record<string, string[]>;
|
|
9
|
+
/**
|
|
10
|
+
* 创建公司统一的 ESLint flat config。项目级扩展会插入到 Prettier 兼容配置之前。
|
|
11
|
+
*/
|
|
12
|
+
declare const createSybzEslintConfig: (...extensions: Linter.Config[]) => Linter.Config[];
|
|
13
|
+
/** 公司前端项目默认的 ESLint flat config。 */
|
|
14
|
+
declare const sybzEslintConfig: SybzEslintConfig[];
|
|
15
|
+
|
|
16
|
+
export { createSybzEslintConfig, sybzEslintConfig, sybzLintStagedConfig, sybzPrettierConfig };
|
|
17
|
+
export type { SybzEslintConfig };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import tsPlugin from '@typescript-eslint/eslint-plugin';
|
|
3
|
+
import tsParser from '@typescript-eslint/parser';
|
|
4
|
+
import prettier from 'eslint-config-prettier';
|
|
5
|
+
import vue from 'eslint-plugin-vue';
|
|
6
|
+
import globals from 'globals';
|
|
7
|
+
import vueParser from 'vue-eslint-parser';
|
|
8
|
+
|
|
9
|
+
const sybzPrettierConfig = {
|
|
10
|
+
singleQuote: true,
|
|
11
|
+
semi: false,
|
|
12
|
+
trailingComma: "all",
|
|
13
|
+
printWidth: 120,
|
|
14
|
+
endOfLine: "lf",
|
|
15
|
+
htmlWhitespaceSensitivity: "ignore"
|
|
16
|
+
};
|
|
17
|
+
const sybzLintStagedConfig = {
|
|
18
|
+
"**/*.{js,jsx,ts,tsx,vue,mjs,cjs}": [
|
|
19
|
+
"sybz-code-standard prettier --write",
|
|
20
|
+
"sybz-code-standard eslint --fix --max-warnings=0"
|
|
21
|
+
],
|
|
22
|
+
"**/*.{css,scss,json,yaml,yml,html,md}": ["sybz-code-standard prettier --write"]
|
|
23
|
+
};
|
|
24
|
+
const baseEslintConfig = [
|
|
25
|
+
{
|
|
26
|
+
ignores: [
|
|
27
|
+
"node_modules/**",
|
|
28
|
+
"dist/**",
|
|
29
|
+
"dist-ssr/**",
|
|
30
|
+
"coverage/**",
|
|
31
|
+
"docs/.vitepress/cache/**",
|
|
32
|
+
"docs/.vitepress/dist/**",
|
|
33
|
+
"packages/*/dist/**",
|
|
34
|
+
".vitepress/**",
|
|
35
|
+
".codex-types-temp/**",
|
|
36
|
+
"*.tsbuildinfo",
|
|
37
|
+
"*.local"
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
js.configs.recommended,
|
|
41
|
+
tsPlugin.configs["flat/base"],
|
|
42
|
+
...vue.configs["flat/recommended"],
|
|
43
|
+
{
|
|
44
|
+
files: ["**/*.{js,jsx,ts,tsx,cjs,mjs,vue}"],
|
|
45
|
+
languageOptions: {
|
|
46
|
+
ecmaVersion: "latest",
|
|
47
|
+
sourceType: "module",
|
|
48
|
+
globals: {
|
|
49
|
+
...globals.browser,
|
|
50
|
+
...globals.node,
|
|
51
|
+
...globals.es2021
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
rules: {
|
|
55
|
+
"no-console": "off",
|
|
56
|
+
"no-unused-vars": "off",
|
|
57
|
+
"vue/no-unused-vars": "off",
|
|
58
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
59
|
+
"vue/multi-word-component-names": "off",
|
|
60
|
+
"vue/no-template-shadow": "off",
|
|
61
|
+
"vue/attribute-hyphenation": ["warn", "always", { ignore: ["dangerouslyUseHTMLString"] }],
|
|
62
|
+
"vue/require-default-prop": "off"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
files: ["**/*.{ts,tsx,vue}"],
|
|
67
|
+
rules: {
|
|
68
|
+
"no-undef": "off",
|
|
69
|
+
"no-redeclare": "off"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
files: ["**/*.vue"],
|
|
74
|
+
languageOptions: {
|
|
75
|
+
parser: vueParser,
|
|
76
|
+
parserOptions: {
|
|
77
|
+
parser: tsParser,
|
|
78
|
+
ecmaVersion: "latest",
|
|
79
|
+
sourceType: "module",
|
|
80
|
+
ecmaFeatures: { jsx: true },
|
|
81
|
+
extraFileExtensions: [".vue"]
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
];
|
|
86
|
+
const createSybzEslintConfig = (...extensions) => [
|
|
87
|
+
...baseEslintConfig,
|
|
88
|
+
...extensions,
|
|
89
|
+
prettier
|
|
90
|
+
];
|
|
91
|
+
const sybzEslintConfig = createSybzEslintConfig();
|
|
92
|
+
|
|
93
|
+
export { createSybzEslintConfig, sybzEslintConfig, sybzLintStagedConfig, sybzPrettierConfig };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function resolveConfirmSemantic(options = {}) {
|
|
4
|
+
const variant = options.variant ?? "default";
|
|
5
|
+
const hasTarget = options.target !== void 0;
|
|
6
|
+
const title = options.title ?? (variant === "delete" ? "\u5220\u9664\u786E\u8BA4" : variant === "warning" ? "\u8B66\u544A" : "\u63D0\u793A");
|
|
7
|
+
const confirmButtonText = options.confirmButtonText ?? (variant === "delete" ? "\u5220\u9664" : "\u786E\u5B9A");
|
|
8
|
+
const confirmButtonType = options.confirmButtonType ?? (variant === "delete" ? "danger" : variant === "warning" ? "warning" : "primary");
|
|
9
|
+
const defaultMessage = variant === "delete" ? hasTarget ? `\u786E\u8BA4\u8981\u5220\u9664${String(options.target)}\u5417\uFF1F\u5220\u9664\u540E\u4E0D\u53EF\u6062\u590D\u3002` : "\u5220\u9664\u540E\u6570\u636E\u5C06\u65E0\u6CD5\u6062\u590D\uFF0C\u786E\u5B9A\u7EE7\u7EED\u5417\uFF1F" : "";
|
|
10
|
+
const theme = options.theme ?? "default";
|
|
11
|
+
return {
|
|
12
|
+
variant,
|
|
13
|
+
target: options.target,
|
|
14
|
+
hasTarget,
|
|
15
|
+
title,
|
|
16
|
+
confirmButtonText,
|
|
17
|
+
confirmButtonType,
|
|
18
|
+
defaultMessage,
|
|
19
|
+
classNames: [
|
|
20
|
+
"s-confirm-semantic",
|
|
21
|
+
`s-confirm-semantic--${variant}`,
|
|
22
|
+
theme !== "default" ? `s-confirm-semantic--${theme}` : ""
|
|
23
|
+
].filter(Boolean)
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
exports.resolveConfirmSemantic = resolveConfirmSemantic;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
type ConfirmVariant = 'default' | 'delete' | 'warning';
|
|
2
|
+
type ConfirmTarget = string | number;
|
|
3
|
+
type ConfirmSemanticTheme = 'default' | 'chenghua' | 'shijingshan';
|
|
4
|
+
type ConfirmSemanticButtonType = 'default' | 'primary' | 'success' | 'warning' | 'info' | 'danger' | 'text' | '';
|
|
5
|
+
interface ConfirmSemanticOptions {
|
|
6
|
+
variant?: ConfirmVariant;
|
|
7
|
+
target?: ConfirmTarget;
|
|
8
|
+
theme?: ConfirmSemanticTheme;
|
|
9
|
+
title?: string;
|
|
10
|
+
confirmButtonText?: string;
|
|
11
|
+
confirmButtonType?: ConfirmSemanticButtonType;
|
|
12
|
+
}
|
|
13
|
+
interface ConfirmSemanticResult {
|
|
14
|
+
variant: ConfirmVariant;
|
|
15
|
+
target?: ConfirmTarget;
|
|
16
|
+
hasTarget: boolean;
|
|
17
|
+
title: string;
|
|
18
|
+
confirmButtonText: string;
|
|
19
|
+
confirmButtonType: ConfirmSemanticButtonType;
|
|
20
|
+
defaultMessage: string;
|
|
21
|
+
classNames: string[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 统一解析 confirm、s-dialog 和 s-popconfirm 的确认语义。
|
|
25
|
+
*/
|
|
26
|
+
declare function resolveConfirmSemantic(options?: ConfirmSemanticOptions): ConfirmSemanticResult;
|
|
27
|
+
|
|
28
|
+
export { resolveConfirmSemantic };
|
|
29
|
+
export type { ConfirmSemanticButtonType, ConfirmSemanticOptions, ConfirmSemanticResult, ConfirmSemanticTheme, ConfirmTarget, ConfirmVariant };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
type ConfirmVariant = 'default' | 'delete' | 'warning';
|
|
2
|
+
type ConfirmTarget = string | number;
|
|
3
|
+
type ConfirmSemanticTheme = 'default' | 'chenghua' | 'shijingshan';
|
|
4
|
+
type ConfirmSemanticButtonType = 'default' | 'primary' | 'success' | 'warning' | 'info' | 'danger' | 'text' | '';
|
|
5
|
+
interface ConfirmSemanticOptions {
|
|
6
|
+
variant?: ConfirmVariant;
|
|
7
|
+
target?: ConfirmTarget;
|
|
8
|
+
theme?: ConfirmSemanticTheme;
|
|
9
|
+
title?: string;
|
|
10
|
+
confirmButtonText?: string;
|
|
11
|
+
confirmButtonType?: ConfirmSemanticButtonType;
|
|
12
|
+
}
|
|
13
|
+
interface ConfirmSemanticResult {
|
|
14
|
+
variant: ConfirmVariant;
|
|
15
|
+
target?: ConfirmTarget;
|
|
16
|
+
hasTarget: boolean;
|
|
17
|
+
title: string;
|
|
18
|
+
confirmButtonText: string;
|
|
19
|
+
confirmButtonType: ConfirmSemanticButtonType;
|
|
20
|
+
defaultMessage: string;
|
|
21
|
+
classNames: string[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 统一解析 confirm、s-dialog 和 s-popconfirm 的确认语义。
|
|
25
|
+
*/
|
|
26
|
+
declare function resolveConfirmSemantic(options?: ConfirmSemanticOptions): ConfirmSemanticResult;
|
|
27
|
+
|
|
28
|
+
export { resolveConfirmSemantic };
|
|
29
|
+
export type { ConfirmSemanticButtonType, ConfirmSemanticOptions, ConfirmSemanticResult, ConfirmSemanticTheme, ConfirmTarget, ConfirmVariant };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
type ConfirmVariant = 'default' | 'delete' | 'warning';
|
|
2
|
+
type ConfirmTarget = string | number;
|
|
3
|
+
type ConfirmSemanticTheme = 'default' | 'chenghua' | 'shijingshan';
|
|
4
|
+
type ConfirmSemanticButtonType = 'default' | 'primary' | 'success' | 'warning' | 'info' | 'danger' | 'text' | '';
|
|
5
|
+
interface ConfirmSemanticOptions {
|
|
6
|
+
variant?: ConfirmVariant;
|
|
7
|
+
target?: ConfirmTarget;
|
|
8
|
+
theme?: ConfirmSemanticTheme;
|
|
9
|
+
title?: string;
|
|
10
|
+
confirmButtonText?: string;
|
|
11
|
+
confirmButtonType?: ConfirmSemanticButtonType;
|
|
12
|
+
}
|
|
13
|
+
interface ConfirmSemanticResult {
|
|
14
|
+
variant: ConfirmVariant;
|
|
15
|
+
target?: ConfirmTarget;
|
|
16
|
+
hasTarget: boolean;
|
|
17
|
+
title: string;
|
|
18
|
+
confirmButtonText: string;
|
|
19
|
+
confirmButtonType: ConfirmSemanticButtonType;
|
|
20
|
+
defaultMessage: string;
|
|
21
|
+
classNames: string[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 统一解析 confirm、s-dialog 和 s-popconfirm 的确认语义。
|
|
25
|
+
*/
|
|
26
|
+
declare function resolveConfirmSemantic(options?: ConfirmSemanticOptions): ConfirmSemanticResult;
|
|
27
|
+
|
|
28
|
+
export { resolveConfirmSemantic };
|
|
29
|
+
export type { ConfirmSemanticButtonType, ConfirmSemanticOptions, ConfirmSemanticResult, ConfirmSemanticTheme, ConfirmTarget, ConfirmVariant };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
function resolveConfirmSemantic(options = {}) {
|
|
2
|
+
const variant = options.variant ?? "default";
|
|
3
|
+
const hasTarget = options.target !== void 0;
|
|
4
|
+
const title = options.title ?? (variant === "delete" ? "\u5220\u9664\u786E\u8BA4" : variant === "warning" ? "\u8B66\u544A" : "\u63D0\u793A");
|
|
5
|
+
const confirmButtonText = options.confirmButtonText ?? (variant === "delete" ? "\u5220\u9664" : "\u786E\u5B9A");
|
|
6
|
+
const confirmButtonType = options.confirmButtonType ?? (variant === "delete" ? "danger" : variant === "warning" ? "warning" : "primary");
|
|
7
|
+
const defaultMessage = variant === "delete" ? hasTarget ? `\u786E\u8BA4\u8981\u5220\u9664${String(options.target)}\u5417\uFF1F\u5220\u9664\u540E\u4E0D\u53EF\u6062\u590D\u3002` : "\u5220\u9664\u540E\u6570\u636E\u5C06\u65E0\u6CD5\u6062\u590D\uFF0C\u786E\u5B9A\u7EE7\u7EED\u5417\uFF1F" : "";
|
|
8
|
+
const theme = options.theme ?? "default";
|
|
9
|
+
return {
|
|
10
|
+
variant,
|
|
11
|
+
target: options.target,
|
|
12
|
+
hasTarget,
|
|
13
|
+
title,
|
|
14
|
+
confirmButtonText,
|
|
15
|
+
confirmButtonType,
|
|
16
|
+
defaultMessage,
|
|
17
|
+
classNames: [
|
|
18
|
+
"s-confirm-semantic",
|
|
19
|
+
`s-confirm-semantic--${variant}`,
|
|
20
|
+
theme !== "default" ? `s-confirm-semantic--${theme}` : ""
|
|
21
|
+
].filter(Boolean)
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { resolveConfirmSemantic };
|
package/dist/format.cjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const format = require('./shared/utils.
|
|
3
|
+
const format = require('./shared/utils.DfuweQgy.cjs');
|
|
4
4
|
require('./is.cjs');
|
|
5
5
|
require('consola');
|
|
6
6
|
require('vue');
|
|
7
7
|
require('es-toolkit');
|
|
8
|
+
require('./confirmSemantic.cjs');
|
|
8
9
|
require('element-plus');
|
|
9
10
|
|
|
10
11
|
|
package/dist/format.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export { z as formatBytes, A as formatBytesConvert, B as formatDurationTime, C as formatTextToHtml, D as formatThousands, E as formatTime, F as formatToFixed } from './shared/utils.
|
|
1
|
+
export { z as formatBytes, A as formatBytesConvert, B as formatDurationTime, C as formatTextToHtml, D as formatThousands, E as formatTime, F as formatToFixed } from './shared/utils.CJdEsMHi.mjs';
|
|
2
2
|
import './is.mjs';
|
|
3
3
|
import 'consola';
|
|
4
4
|
import 'vue';
|
|
5
5
|
import 'es-toolkit';
|
|
6
|
+
import './confirmSemantic.mjs';
|
|
6
7
|
import 'element-plus';
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const format = require('./shared/utils.
|
|
3
|
+
const format = require('./shared/utils.DfuweQgy.cjs');
|
|
4
|
+
const confirmSemantic = require('./confirmSemantic.cjs');
|
|
4
5
|
const is = require('./is.cjs');
|
|
5
6
|
require('vue');
|
|
6
7
|
require('consola');
|
|
@@ -42,6 +43,7 @@ exports.tryCatch = format.tryCatch;
|
|
|
42
43
|
exports.validate = format.validate;
|
|
43
44
|
exports.validateForm = format.validateForm;
|
|
44
45
|
exports.validateOnSubmit = format.validateOnSubmit;
|
|
46
|
+
exports.resolveConfirmSemantic = confirmSemantic.resolveConfirmSemantic;
|
|
45
47
|
exports.isArray = is.isArray;
|
|
46
48
|
exports.isBoolean = is.isBoolean;
|
|
47
49
|
exports.isComponent = is.isComponent;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { $toast, ConfirmCustomOptions, ConfirmMessage, ConfirmOptions,
|
|
1
|
+
export { $toast, ConfirmCustomOptions, ConfirmMessage, ConfirmOptions, ConfirmTheme, SybzUtilsConfig, ToastOptions, UtilsTheme, clearStorage, clone, configureUtils, confirm, copy, debounce, delay, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, mockValue, processWidth, random, setStorage, test, throttle, toLine, tryCatch, validate, validateForm, validateOnSubmit } from './base.cjs';
|
|
2
|
+
export { ConfirmSemanticButtonType, ConfirmSemanticOptions, ConfirmSemanticResult, ConfirmSemanticTheme, ConfirmTarget, ConfirmVariant, resolveConfirmSemantic } from './confirmSemantic.cjs';
|
|
2
3
|
export { isArray, isBoolean, isComponent, isDate, isEmptyObject, isFunction, isIOS, isMap, isNumber, isObject, isPlainObject, isPromise, isRegExp, isSVGElement, isSet, isString, isStringNumber, isSymbol, isUrl, objectToString, toRawType, toTypeString } from './is.cjs';
|
|
3
4
|
export { FormatBytesConvertOptions, FormatBytesOptions, FormatTimeFallback, FormatTimeInput, FormatToFixedOptions, formatBytes, formatBytesConvert, formatDurationTime, formatTextToHtml, formatThousands, formatTime, formatToFixed } from './format.cjs';
|
|
4
5
|
import 'vue';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { $toast, ConfirmCustomOptions, ConfirmMessage, ConfirmOptions,
|
|
1
|
+
export { $toast, ConfirmCustomOptions, ConfirmMessage, ConfirmOptions, ConfirmTheme, SybzUtilsConfig, ToastOptions, UtilsTheme, clearStorage, clone, configureUtils, confirm, copy, debounce, delay, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, mockValue, processWidth, random, setStorage, test, throttle, toLine, tryCatch, validate, validateForm, validateOnSubmit } from './base.mjs';
|
|
2
|
+
export { ConfirmSemanticButtonType, ConfirmSemanticOptions, ConfirmSemanticResult, ConfirmSemanticTheme, ConfirmTarget, ConfirmVariant, resolveConfirmSemantic } from './confirmSemantic.mjs';
|
|
2
3
|
export { isArray, isBoolean, isComponent, isDate, isEmptyObject, isFunction, isIOS, isMap, isNumber, isObject, isPlainObject, isPromise, isRegExp, isSVGElement, isSet, isString, isStringNumber, isSymbol, isUrl, objectToString, toRawType, toTypeString } from './is.mjs';
|
|
3
4
|
export { FormatBytesConvertOptions, FormatBytesOptions, FormatTimeFallback, FormatTimeInput, FormatToFixedOptions, formatBytes, formatBytesConvert, formatDurationTime, formatTextToHtml, formatThousands, formatTime, formatToFixed } from './format.mjs';
|
|
4
5
|
import 'vue';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { $toast, ConfirmCustomOptions, ConfirmMessage, ConfirmOptions,
|
|
1
|
+
export { $toast, ConfirmCustomOptions, ConfirmMessage, ConfirmOptions, ConfirmTheme, SybzUtilsConfig, ToastOptions, UtilsTheme, clearStorage, clone, configureUtils, confirm, copy, debounce, delay, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, mockValue, processWidth, random, setStorage, test, throttle, toLine, tryCatch, validate, validateForm, validateOnSubmit } from './base.js';
|
|
2
|
+
export { ConfirmSemanticButtonType, ConfirmSemanticOptions, ConfirmSemanticResult, ConfirmSemanticTheme, ConfirmTarget, ConfirmVariant, resolveConfirmSemantic } from './confirmSemantic.js';
|
|
2
3
|
export { isArray, isBoolean, isComponent, isDate, isEmptyObject, isFunction, isIOS, isMap, isNumber, isObject, isPlainObject, isPromise, isRegExp, isSVGElement, isSet, isString, isStringNumber, isSymbol, isUrl, objectToString, toRawType, toTypeString } from './is.js';
|
|
3
4
|
export { FormatBytesConvertOptions, FormatBytesOptions, FormatTimeFallback, FormatTimeInput, FormatToFixedOptions, formatBytes, formatBytesConvert, formatDurationTime, formatTextToHtml, formatThousands, formatTime, formatToFixed } from './format.js';
|
|
4
5
|
import 'vue';
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { $ as $toast, c as clearStorage, a as clone, b as configureUtils, d as confirm, e as copy, f as debounce, g as delay, z as formatBytes, A as formatBytesConvert, B as formatDurationTime, C as formatTextToHtml, D as formatThousands, E as formatTime, F as formatToFixed, h as getStorage, i as getType, j as getUtilsBuildTime, k as getVariable, l as isEmpty, m as log, n as merge, o as mockValue, p as processWidth, r as random, s as setStorage, t as test, q as throttle, u as toLine, v as tryCatch, w as validate, x as validateForm, y as validateOnSubmit } from './shared/utils.
|
|
1
|
+
export { $ as $toast, c as clearStorage, a as clone, b as configureUtils, d as confirm, e as copy, f as debounce, g as delay, z as formatBytes, A as formatBytesConvert, B as formatDurationTime, C as formatTextToHtml, D as formatThousands, E as formatTime, F as formatToFixed, h as getStorage, i as getType, j as getUtilsBuildTime, k as getVariable, l as isEmpty, m as log, n as merge, o as mockValue, p as processWidth, r as random, s as setStorage, t as test, q as throttle, u as toLine, v as tryCatch, w as validate, x as validateForm, y as validateOnSubmit } from './shared/utils.CJdEsMHi.mjs';
|
|
2
|
+
export { resolveConfirmSemantic } from './confirmSemantic.mjs';
|
|
2
3
|
export { isArray, isBoolean, isComponent, isDate, isEmptyObject, isFunction, isIOS, isMap, isNumber, isObject, isPlainObject, isPromise, isRegExp, isSVGElement, isSet, isString, isStringNumber, isSymbol, isUrl, objectToString, toRawType, toTypeString } from './is.mjs';
|
|
3
4
|
import 'vue';
|
|
4
5
|
import 'consola';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isRef, unref, isVNode, toRaw } from 'vue';
|
|
2
2
|
import { consola } from 'consola';
|
|
3
3
|
import { cloneDeep } from 'es-toolkit';
|
|
4
|
+
import { resolveConfirmSemantic } from '../confirmSemantic.mjs';
|
|
4
5
|
import { ElMessageBox, ElMessage } from 'element-plus';
|
|
5
6
|
import { isStringNumber, isNumber } from '../is.mjs';
|
|
6
7
|
|
|
@@ -961,20 +962,25 @@ function confirm(messageOrOptions, optionsOrAppContext = null, appContext = null
|
|
|
961
962
|
...messageBoxOptions
|
|
962
963
|
} = options;
|
|
963
964
|
const inputMessage = typeof message === "function" ? message() : message;
|
|
964
|
-
const
|
|
965
|
+
const semantic = resolveConfirmSemantic({
|
|
966
|
+
variant,
|
|
967
|
+
target,
|
|
968
|
+
theme,
|
|
969
|
+
title: typeof messageBoxOptions.title === "string" ? messageBoxOptions.title : void 0,
|
|
970
|
+
confirmButtonText: messageBoxOptions.confirmButtonText
|
|
971
|
+
});
|
|
972
|
+
const resolvedMessage = variant === "delete" && semantic.hasTarget && !inputMessage ? `\u786E\u8BA4\u8981\u5220\u9664<code type="danger">${_escapeHtml(semantic.target)}</code>\u5417\uFF1F\u5220\u9664\u540E\u4E0D\u53EF\u6062\u590D\u3002` : variant === "delete" && !inputMessage ? semantic.defaultMessage : inputMessage;
|
|
965
973
|
const resolvedAppendTo = _resolveAppendTarget(appendTo);
|
|
966
974
|
const resolvedAppContext = _resolveAppContext(optionAppContext || argumentAppContext);
|
|
967
975
|
const isChenghuaTheme = theme === "chenghua";
|
|
968
976
|
const isShijingshanTheme = theme === "shijingshan";
|
|
969
|
-
const variantOptions = variant === "delete" ? { title: "\u5220\u9664\u786E\u8BA4", confirmButtonText: "\u5220\u9664" } : variant === "warning" ? { title: "\u8B66\u544A" } : {};
|
|
970
977
|
const mergeOptions = {
|
|
971
|
-
title:
|
|
978
|
+
title: semantic.title,
|
|
972
979
|
draggable: true,
|
|
973
980
|
showCancelButton: true,
|
|
974
981
|
cancelButtonText: "\u53D6\u6D88",
|
|
975
|
-
confirmButtonText:
|
|
982
|
+
confirmButtonText: semantic.confirmButtonText,
|
|
976
983
|
dangerouslyUseHTMLString: true,
|
|
977
|
-
...variantOptions,
|
|
978
984
|
...messageBoxOptions,
|
|
979
985
|
appendTo: resolvedAppendTo,
|
|
980
986
|
appContext: resolvedAppContext,
|
|
@@ -1064,7 +1070,7 @@ function getVariable(propertyName, fallback = "") {
|
|
|
1064
1070
|
const DEFAULT_BUILD_TIME_FALLBACK = "\u672A\u6CE8\u5165";
|
|
1065
1071
|
function getUtilsBuildTime(fallback = DEFAULT_BUILD_TIME_FALLBACK) {
|
|
1066
1072
|
{
|
|
1067
|
-
return "2026-
|
|
1073
|
+
return "2026-09-04 17:01:04";
|
|
1068
1074
|
}
|
|
1069
1075
|
}
|
|
1070
1076
|
function test() {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const vue = require('vue');
|
|
4
4
|
const consola = require('consola');
|
|
5
5
|
const esToolkit = require('es-toolkit');
|
|
6
|
+
const confirmSemantic = require('../confirmSemantic.cjs');
|
|
6
7
|
const elementPlus = require('element-plus');
|
|
7
8
|
const is = require('../is.cjs');
|
|
8
9
|
|
|
@@ -963,20 +964,25 @@ function confirm(messageOrOptions, optionsOrAppContext = null, appContext = null
|
|
|
963
964
|
...messageBoxOptions
|
|
964
965
|
} = options;
|
|
965
966
|
const inputMessage = typeof message === "function" ? message() : message;
|
|
966
|
-
const
|
|
967
|
+
const semantic = confirmSemantic.resolveConfirmSemantic({
|
|
968
|
+
variant,
|
|
969
|
+
target,
|
|
970
|
+
theme,
|
|
971
|
+
title: typeof messageBoxOptions.title === "string" ? messageBoxOptions.title : void 0,
|
|
972
|
+
confirmButtonText: messageBoxOptions.confirmButtonText
|
|
973
|
+
});
|
|
974
|
+
const resolvedMessage = variant === "delete" && semantic.hasTarget && !inputMessage ? `\u786E\u8BA4\u8981\u5220\u9664<code type="danger">${_escapeHtml(semantic.target)}</code>\u5417\uFF1F\u5220\u9664\u540E\u4E0D\u53EF\u6062\u590D\u3002` : variant === "delete" && !inputMessage ? semantic.defaultMessage : inputMessage;
|
|
967
975
|
const resolvedAppendTo = _resolveAppendTarget(appendTo);
|
|
968
976
|
const resolvedAppContext = _resolveAppContext(optionAppContext || argumentAppContext);
|
|
969
977
|
const isChenghuaTheme = theme === "chenghua";
|
|
970
978
|
const isShijingshanTheme = theme === "shijingshan";
|
|
971
|
-
const variantOptions = variant === "delete" ? { title: "\u5220\u9664\u786E\u8BA4", confirmButtonText: "\u5220\u9664" } : variant === "warning" ? { title: "\u8B66\u544A" } : {};
|
|
972
979
|
const mergeOptions = {
|
|
973
|
-
title:
|
|
980
|
+
title: semantic.title,
|
|
974
981
|
draggable: true,
|
|
975
982
|
showCancelButton: true,
|
|
976
983
|
cancelButtonText: "\u53D6\u6D88",
|
|
977
|
-
confirmButtonText:
|
|
984
|
+
confirmButtonText: semantic.confirmButtonText,
|
|
978
985
|
dangerouslyUseHTMLString: true,
|
|
979
|
-
...variantOptions,
|
|
980
986
|
...messageBoxOptions,
|
|
981
987
|
appendTo: resolvedAppendTo,
|
|
982
988
|
appContext: resolvedAppContext,
|
|
@@ -1066,7 +1072,7 @@ function getVariable(propertyName, fallback = "") {
|
|
|
1066
1072
|
const DEFAULT_BUILD_TIME_FALLBACK = "\u672A\u6CE8\u5165";
|
|
1067
1073
|
function getUtilsBuildTime(fallback = DEFAULT_BUILD_TIME_FALLBACK) {
|
|
1068
1074
|
{
|
|
1069
|
-
return "2026-
|
|
1075
|
+
return "2026-09-04 17:01:04";
|
|
1070
1076
|
}
|
|
1071
1077
|
}
|
|
1072
1078
|
function test() {
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const node_child_process = require('node:child_process');
|
|
5
|
+
const node_fs = require('node:fs');
|
|
6
|
+
const node_module = require('node:module');
|
|
7
|
+
const node_path = require('node:path');
|
|
8
|
+
const husky = require('husky');
|
|
9
|
+
|
|
10
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
11
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
12
|
+
|
|
13
|
+
const husky__default = /*#__PURE__*/_interopDefaultCompat(husky);
|
|
14
|
+
|
|
15
|
+
const cwd = process.cwd();
|
|
16
|
+
const require2 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('sybz-code-standard.cjs', document.baseURI).href)));
|
|
17
|
+
const generatedFiles = {
|
|
18
|
+
"eslint.config.js": "export { sybzEslintConfig as default } from '@sybz-components/utils/codeStandard'\n",
|
|
19
|
+
".prettierrc.js": "export { sybzPrettierConfig as default } from '@sybz-components/utils/codeStandard'\n",
|
|
20
|
+
"lint-staged.config.js": "export { sybzLintStagedConfig as default } from '@sybz-components/utils/codeStandard'\n",
|
|
21
|
+
".editorconfig": `root = true
|
|
22
|
+
|
|
23
|
+
[*]
|
|
24
|
+
charset = utf-8
|
|
25
|
+
end_of_line = lf
|
|
26
|
+
indent_style = space
|
|
27
|
+
indent_size = 2
|
|
28
|
+
insert_final_newline = true
|
|
29
|
+
trim_trailing_whitespace = true
|
|
30
|
+
max_line_length = 120
|
|
31
|
+
|
|
32
|
+
[*.md]
|
|
33
|
+
trim_trailing_whitespace = false
|
|
34
|
+
`
|
|
35
|
+
};
|
|
36
|
+
const scripts = {
|
|
37
|
+
prepare: "sybz-code-standard prepare",
|
|
38
|
+
lint: "sybz-code-standard eslint . --fix",
|
|
39
|
+
"lint:check": "sybz-code-standard eslint .",
|
|
40
|
+
"lint:prettier": "sybz-code-standard prettier . --write",
|
|
41
|
+
"lint:prettier:check": "sybz-code-standard prettier . --check"
|
|
42
|
+
};
|
|
43
|
+
const runPackageBin = (packageName, binPath, args2) => {
|
|
44
|
+
const packageJsonPath = require2.resolve(`${packageName}/package.json`);
|
|
45
|
+
const executablePath = node_path.resolve(packageJsonPath, "..", binPath);
|
|
46
|
+
node_child_process.execFileSync(process.execPath, [executablePath, ...args2], { cwd, stdio: "inherit" });
|
|
47
|
+
};
|
|
48
|
+
const writeIfMissing = (relativePath, content) => {
|
|
49
|
+
const filePath = node_path.resolve(cwd, relativePath);
|
|
50
|
+
if (!node_fs.existsSync(filePath)) {
|
|
51
|
+
node_fs.writeFileSync(filePath, content, "utf8");
|
|
52
|
+
console.log(`\u521B\u5EFA ${relativePath}`);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (node_fs.readFileSync(filePath, "utf8") !== content) {
|
|
56
|
+
console.warn(`\u8DF3\u8FC7 ${relativePath}\uFF1A\u5DF2\u5B58\u5728\u81EA\u5B9A\u4E49\u5185\u5BB9`);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const configurePackageJson = () => {
|
|
60
|
+
const packageJsonPath = node_path.resolve(cwd, "package.json");
|
|
61
|
+
if (!node_fs.existsSync(packageJsonPath)) throw new Error(`\u5F53\u524D\u76EE\u5F55\u4E0D\u5B58\u5728 package.json\uFF1A${cwd}`);
|
|
62
|
+
const packageJson = JSON.parse(node_fs.readFileSync(packageJsonPath, "utf8"));
|
|
63
|
+
packageJson.scripts ??= {};
|
|
64
|
+
for (const [name, command2] of Object.entries(scripts)) {
|
|
65
|
+
const current = packageJson.scripts[name];
|
|
66
|
+
if (!current || current === command2) {
|
|
67
|
+
packageJson.scripts[name] = command2;
|
|
68
|
+
} else {
|
|
69
|
+
console.warn(`\u4FDD\u7559 scripts.${name}\uFF1A\u5DF2\u5B58\u5728\u81EA\u5B9A\u4E49\u547D\u4EE4`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
node_fs.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
|
|
73
|
+
`, "utf8");
|
|
74
|
+
console.log("\u66F4\u65B0 package.json scripts");
|
|
75
|
+
};
|
|
76
|
+
const prepareHusky = () => {
|
|
77
|
+
const result = husky__default();
|
|
78
|
+
if (result) console.warn(result);
|
|
79
|
+
};
|
|
80
|
+
const configurePreCommit = () => {
|
|
81
|
+
prepareHusky();
|
|
82
|
+
const huskyDir = node_path.resolve(cwd, ".husky");
|
|
83
|
+
const hookPath = node_path.resolve(huskyDir, "pre-commit");
|
|
84
|
+
const command2 = "pnpm exec sybz-code-standard staged";
|
|
85
|
+
node_fs.mkdirSync(huskyDir, { recursive: true });
|
|
86
|
+
const current = node_fs.existsSync(hookPath) ? node_fs.readFileSync(hookPath, "utf8").trimEnd() : "";
|
|
87
|
+
if (current.includes("sybz-code-standard staged")) return;
|
|
88
|
+
node_fs.writeFileSync(hookPath, `${current ? `${current}
|
|
89
|
+
` : ""}${command2}
|
|
90
|
+
`, { encoding: "utf8", mode: 493 });
|
|
91
|
+
console.log("\u66F4\u65B0 .husky/pre-commit");
|
|
92
|
+
};
|
|
93
|
+
const init = () => {
|
|
94
|
+
configurePackageJson();
|
|
95
|
+
for (const [filePath, content] of Object.entries(generatedFiles)) writeIfMissing(filePath, content);
|
|
96
|
+
configurePreCommit();
|
|
97
|
+
console.log("\n\u524D\u7AEF\u4EE3\u7801\u7EDF\u4E00\u89C4\u8303\u5DF2\u63A5\u5165\u3002");
|
|
98
|
+
};
|
|
99
|
+
const [command = "init", ...args] = process.argv.slice(2);
|
|
100
|
+
switch (command) {
|
|
101
|
+
case "init":
|
|
102
|
+
init();
|
|
103
|
+
break;
|
|
104
|
+
case "prepare":
|
|
105
|
+
prepareHusky();
|
|
106
|
+
break;
|
|
107
|
+
case "eslint":
|
|
108
|
+
runPackageBin("eslint", "bin/eslint.js", args);
|
|
109
|
+
break;
|
|
110
|
+
case "prettier":
|
|
111
|
+
runPackageBin("prettier", "bin/prettier.cjs", args);
|
|
112
|
+
break;
|
|
113
|
+
case "staged":
|
|
114
|
+
runPackageBin("lint-staged", "bin/lint-staged.js", args);
|
|
115
|
+
break;
|
|
116
|
+
default:
|
|
117
|
+
console.error(`\u672A\u77E5\u547D\u4EE4\uFF1A${command}`);
|
|
118
|
+
process.exitCode = 1;
|
|
119
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { execFileSync } from 'node:child_process';
|
|
3
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
4
|
+
import { createRequire } from 'node:module';
|
|
5
|
+
import { resolve } from 'node:path';
|
|
6
|
+
import husky from 'husky';
|
|
7
|
+
|
|
8
|
+
const cwd = process.cwd();
|
|
9
|
+
const require2 = createRequire(import.meta.url);
|
|
10
|
+
const generatedFiles = {
|
|
11
|
+
"eslint.config.js": "export { sybzEslintConfig as default } from '@sybz-components/utils/codeStandard'\n",
|
|
12
|
+
".prettierrc.js": "export { sybzPrettierConfig as default } from '@sybz-components/utils/codeStandard'\n",
|
|
13
|
+
"lint-staged.config.js": "export { sybzLintStagedConfig as default } from '@sybz-components/utils/codeStandard'\n",
|
|
14
|
+
".editorconfig": `root = true
|
|
15
|
+
|
|
16
|
+
[*]
|
|
17
|
+
charset = utf-8
|
|
18
|
+
end_of_line = lf
|
|
19
|
+
indent_style = space
|
|
20
|
+
indent_size = 2
|
|
21
|
+
insert_final_newline = true
|
|
22
|
+
trim_trailing_whitespace = true
|
|
23
|
+
max_line_length = 120
|
|
24
|
+
|
|
25
|
+
[*.md]
|
|
26
|
+
trim_trailing_whitespace = false
|
|
27
|
+
`
|
|
28
|
+
};
|
|
29
|
+
const scripts = {
|
|
30
|
+
prepare: "sybz-code-standard prepare",
|
|
31
|
+
lint: "sybz-code-standard eslint . --fix",
|
|
32
|
+
"lint:check": "sybz-code-standard eslint .",
|
|
33
|
+
"lint:prettier": "sybz-code-standard prettier . --write",
|
|
34
|
+
"lint:prettier:check": "sybz-code-standard prettier . --check"
|
|
35
|
+
};
|
|
36
|
+
const runPackageBin = (packageName, binPath, args2) => {
|
|
37
|
+
const packageJsonPath = require2.resolve(`${packageName}/package.json`);
|
|
38
|
+
const executablePath = resolve(packageJsonPath, "..", binPath);
|
|
39
|
+
execFileSync(process.execPath, [executablePath, ...args2], { cwd, stdio: "inherit" });
|
|
40
|
+
};
|
|
41
|
+
const writeIfMissing = (relativePath, content) => {
|
|
42
|
+
const filePath = resolve(cwd, relativePath);
|
|
43
|
+
if (!existsSync(filePath)) {
|
|
44
|
+
writeFileSync(filePath, content, "utf8");
|
|
45
|
+
console.log(`\u521B\u5EFA ${relativePath}`);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (readFileSync(filePath, "utf8") !== content) {
|
|
49
|
+
console.warn(`\u8DF3\u8FC7 ${relativePath}\uFF1A\u5DF2\u5B58\u5728\u81EA\u5B9A\u4E49\u5185\u5BB9`);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const configurePackageJson = () => {
|
|
53
|
+
const packageJsonPath = resolve(cwd, "package.json");
|
|
54
|
+
if (!existsSync(packageJsonPath)) throw new Error(`\u5F53\u524D\u76EE\u5F55\u4E0D\u5B58\u5728 package.json\uFF1A${cwd}`);
|
|
55
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
56
|
+
packageJson.scripts ??= {};
|
|
57
|
+
for (const [name, command2] of Object.entries(scripts)) {
|
|
58
|
+
const current = packageJson.scripts[name];
|
|
59
|
+
if (!current || current === command2) {
|
|
60
|
+
packageJson.scripts[name] = command2;
|
|
61
|
+
} else {
|
|
62
|
+
console.warn(`\u4FDD\u7559 scripts.${name}\uFF1A\u5DF2\u5B58\u5728\u81EA\u5B9A\u4E49\u547D\u4EE4`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
|
|
66
|
+
`, "utf8");
|
|
67
|
+
console.log("\u66F4\u65B0 package.json scripts");
|
|
68
|
+
};
|
|
69
|
+
const prepareHusky = () => {
|
|
70
|
+
const result = husky();
|
|
71
|
+
if (result) console.warn(result);
|
|
72
|
+
};
|
|
73
|
+
const configurePreCommit = () => {
|
|
74
|
+
prepareHusky();
|
|
75
|
+
const huskyDir = resolve(cwd, ".husky");
|
|
76
|
+
const hookPath = resolve(huskyDir, "pre-commit");
|
|
77
|
+
const command2 = "pnpm exec sybz-code-standard staged";
|
|
78
|
+
mkdirSync(huskyDir, { recursive: true });
|
|
79
|
+
const current = existsSync(hookPath) ? readFileSync(hookPath, "utf8").trimEnd() : "";
|
|
80
|
+
if (current.includes("sybz-code-standard staged")) return;
|
|
81
|
+
writeFileSync(hookPath, `${current ? `${current}
|
|
82
|
+
` : ""}${command2}
|
|
83
|
+
`, { encoding: "utf8", mode: 493 });
|
|
84
|
+
console.log("\u66F4\u65B0 .husky/pre-commit");
|
|
85
|
+
};
|
|
86
|
+
const init = () => {
|
|
87
|
+
configurePackageJson();
|
|
88
|
+
for (const [filePath, content] of Object.entries(generatedFiles)) writeIfMissing(filePath, content);
|
|
89
|
+
configurePreCommit();
|
|
90
|
+
console.log("\n\u524D\u7AEF\u4EE3\u7801\u7EDF\u4E00\u89C4\u8303\u5DF2\u63A5\u5165\u3002");
|
|
91
|
+
};
|
|
92
|
+
const [command = "init", ...args] = process.argv.slice(2);
|
|
93
|
+
switch (command) {
|
|
94
|
+
case "init":
|
|
95
|
+
init();
|
|
96
|
+
break;
|
|
97
|
+
case "prepare":
|
|
98
|
+
prepareHusky();
|
|
99
|
+
break;
|
|
100
|
+
case "eslint":
|
|
101
|
+
runPackageBin("eslint", "bin/eslint.js", args);
|
|
102
|
+
break;
|
|
103
|
+
case "prettier":
|
|
104
|
+
runPackageBin("prettier", "bin/prettier.cjs", args);
|
|
105
|
+
break;
|
|
106
|
+
case "staged":
|
|
107
|
+
runPackageBin("lint-staged", "bin/lint-staged.js", args);
|
|
108
|
+
break;
|
|
109
|
+
default:
|
|
110
|
+
console.error(`\u672A\u77E5\u547D\u4EE4\uFF1A${command}`);
|
|
111
|
+
process.exitCode = 1;
|
|
112
|
+
}
|
package/dist/vite.cjs
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const codeInspectorPlugin = require('code-inspector-plugin');
|
|
4
|
+
const tailwindcss = require('@tailwindcss/vite');
|
|
4
5
|
const gitCommitLog = require('./gitCommitLog.cjs');
|
|
5
6
|
require('node:child_process');
|
|
6
7
|
require('node:fs');
|
|
7
8
|
require('node:path');
|
|
8
9
|
|
|
10
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
11
|
+
|
|
12
|
+
const tailwindcss__default = /*#__PURE__*/_interopDefaultCompat(tailwindcss);
|
|
13
|
+
|
|
9
14
|
const createCodeInspector = (options = {}) => codeInspectorPlugin.codeInspectorPlugin({ ...options, bundler: "vite" });
|
|
10
15
|
const formatBuildTime = (date) => {
|
|
11
16
|
const pad = (value) => String(value).padStart(2, "0");
|
|
@@ -38,6 +43,9 @@ const createBuildTime = (metaName = "buildTime") => {
|
|
|
38
43
|
};
|
|
39
44
|
const sybzVitePlugins = (options = {}) => {
|
|
40
45
|
const plugins = [];
|
|
46
|
+
if (options.tailwind !== false) {
|
|
47
|
+
plugins.push(...tailwindcss__default(typeof options.tailwind === "object" ? options.tailwind : {}));
|
|
48
|
+
}
|
|
41
49
|
if (options.codeInspector !== false) {
|
|
42
50
|
plugins.push(createCodeInspector(typeof options.codeInspector === "object" ? options.codeInspector : {}));
|
|
43
51
|
}
|
package/dist/vite.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CodeInspectorPluginOptions } from 'code-inspector-plugin';
|
|
2
|
+
import { PluginOptions } from '@tailwindcss/vite';
|
|
2
3
|
import { PluginOption } from 'vite';
|
|
3
4
|
import { GitCommitLogOptions } from './gitCommitLog.cjs';
|
|
4
5
|
|
|
@@ -9,6 +10,8 @@ declare global {
|
|
|
9
10
|
}
|
|
10
11
|
type SybzCodeInspectorOptions = Omit<CodeInspectorPluginOptions, 'bundler'>;
|
|
11
12
|
interface SybzVitePluginsOptions {
|
|
13
|
+
/** Tailwind CSS v4 Vite 插件配置;默认启用,设为 false 时关闭。 */
|
|
14
|
+
tailwind?: boolean | PluginOptions;
|
|
12
15
|
/** 代码定位插件配置;默认启用,设为 false 时关闭。 */
|
|
13
16
|
codeInspector?: boolean | SybzCodeInspectorOptions;
|
|
14
17
|
/** Git 提交信息插件配置;默认启用,设为 false 时关闭。 */
|
|
@@ -19,7 +22,7 @@ interface SybzVitePluginsOptions {
|
|
|
19
22
|
};
|
|
20
23
|
}
|
|
21
24
|
/**
|
|
22
|
-
* 创建 sybz 项目的 Vite
|
|
25
|
+
* 创建 sybz 项目的 Vite 插件预设,默认包含 Tailwind CSS v4、代码定位、Git 提交信息和打包时间。
|
|
23
26
|
* Vite 会自动扁平化插件数组,推荐直接写入 plugins,无需展开运算符。
|
|
24
27
|
*/
|
|
25
28
|
declare const sybzVitePlugins: (options?: SybzVitePluginsOptions) => PluginOption;
|
package/dist/vite.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CodeInspectorPluginOptions } from 'code-inspector-plugin';
|
|
2
|
+
import { PluginOptions } from '@tailwindcss/vite';
|
|
2
3
|
import { PluginOption } from 'vite';
|
|
3
4
|
import { GitCommitLogOptions } from './gitCommitLog.mjs';
|
|
4
5
|
|
|
@@ -9,6 +10,8 @@ declare global {
|
|
|
9
10
|
}
|
|
10
11
|
type SybzCodeInspectorOptions = Omit<CodeInspectorPluginOptions, 'bundler'>;
|
|
11
12
|
interface SybzVitePluginsOptions {
|
|
13
|
+
/** Tailwind CSS v4 Vite 插件配置;默认启用,设为 false 时关闭。 */
|
|
14
|
+
tailwind?: boolean | PluginOptions;
|
|
12
15
|
/** 代码定位插件配置;默认启用,设为 false 时关闭。 */
|
|
13
16
|
codeInspector?: boolean | SybzCodeInspectorOptions;
|
|
14
17
|
/** Git 提交信息插件配置;默认启用,设为 false 时关闭。 */
|
|
@@ -19,7 +22,7 @@ interface SybzVitePluginsOptions {
|
|
|
19
22
|
};
|
|
20
23
|
}
|
|
21
24
|
/**
|
|
22
|
-
* 创建 sybz 项目的 Vite
|
|
25
|
+
* 创建 sybz 项目的 Vite 插件预设,默认包含 Tailwind CSS v4、代码定位、Git 提交信息和打包时间。
|
|
23
26
|
* Vite 会自动扁平化插件数组,推荐直接写入 plugins,无需展开运算符。
|
|
24
27
|
*/
|
|
25
28
|
declare const sybzVitePlugins: (options?: SybzVitePluginsOptions) => PluginOption;
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CodeInspectorPluginOptions } from 'code-inspector-plugin';
|
|
2
|
+
import { PluginOptions } from '@tailwindcss/vite';
|
|
2
3
|
import { PluginOption } from 'vite';
|
|
3
4
|
import { GitCommitLogOptions } from './gitCommitLog.js';
|
|
4
5
|
|
|
@@ -9,6 +10,8 @@ declare global {
|
|
|
9
10
|
}
|
|
10
11
|
type SybzCodeInspectorOptions = Omit<CodeInspectorPluginOptions, 'bundler'>;
|
|
11
12
|
interface SybzVitePluginsOptions {
|
|
13
|
+
/** Tailwind CSS v4 Vite 插件配置;默认启用,设为 false 时关闭。 */
|
|
14
|
+
tailwind?: boolean | PluginOptions;
|
|
12
15
|
/** 代码定位插件配置;默认启用,设为 false 时关闭。 */
|
|
13
16
|
codeInspector?: boolean | SybzCodeInspectorOptions;
|
|
14
17
|
/** Git 提交信息插件配置;默认启用,设为 false 时关闭。 */
|
|
@@ -19,7 +22,7 @@ interface SybzVitePluginsOptions {
|
|
|
19
22
|
};
|
|
20
23
|
}
|
|
21
24
|
/**
|
|
22
|
-
* 创建 sybz 项目的 Vite
|
|
25
|
+
* 创建 sybz 项目的 Vite 插件预设,默认包含 Tailwind CSS v4、代码定位、Git 提交信息和打包时间。
|
|
23
26
|
* Vite 会自动扁平化插件数组,推荐直接写入 plugins,无需展开运算符。
|
|
24
27
|
*/
|
|
25
28
|
declare const sybzVitePlugins: (options?: SybzVitePluginsOptions) => PluginOption;
|
package/dist/vite.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { codeInspectorPlugin } from 'code-inspector-plugin';
|
|
2
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
2
3
|
import { gitCommitLog } from './gitCommitLog.mjs';
|
|
3
4
|
import 'node:child_process';
|
|
4
5
|
import 'node:fs';
|
|
@@ -36,6 +37,9 @@ const createBuildTime = (metaName = "buildTime") => {
|
|
|
36
37
|
};
|
|
37
38
|
const sybzVitePlugins = (options = {}) => {
|
|
38
39
|
const plugins = [];
|
|
40
|
+
if (options.tailwind !== false) {
|
|
41
|
+
plugins.push(...tailwindcss(typeof options.tailwind === "object" ? options.tailwind : {}));
|
|
42
|
+
}
|
|
39
43
|
if (options.codeInspector !== false) {
|
|
40
44
|
plugins.push(createCodeInspector(typeof options.codeInspector === "object" ? options.codeInspector : {}));
|
|
41
45
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sybz-components/utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "utils of sybz-components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|
|
7
7
|
"main": "./dist/index.cjs",
|
|
8
8
|
"module": "./dist/index.mjs",
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
|
+
"bin": {
|
|
11
|
+
"sybz-code-standard": "./dist/sybz-code-standard.mjs"
|
|
12
|
+
},
|
|
10
13
|
"exports": {
|
|
11
14
|
".": {
|
|
12
15
|
"types": "./dist/index.d.ts",
|
|
@@ -23,6 +26,11 @@
|
|
|
23
26
|
"import": "./dist/vite.mjs",
|
|
24
27
|
"require": "./dist/vite.cjs"
|
|
25
28
|
},
|
|
29
|
+
"./codeStandard": {
|
|
30
|
+
"types": "./dist/codeStandard.d.ts",
|
|
31
|
+
"import": "./dist/codeStandard.mjs",
|
|
32
|
+
"require": "./dist/codeStandard.cjs"
|
|
33
|
+
},
|
|
26
34
|
"./*": {
|
|
27
35
|
"types": "./dist/*.d.ts",
|
|
28
36
|
"import": "./dist/*.mjs",
|
|
@@ -46,14 +54,27 @@
|
|
|
46
54
|
},
|
|
47
55
|
"author": "",
|
|
48
56
|
"dependencies": {
|
|
57
|
+
"@eslint/js": "9.39.4",
|
|
58
|
+
"@tailwindcss/vite": "^4.3.3",
|
|
59
|
+
"@typescript-eslint/eslint-plugin": "8.62.0",
|
|
60
|
+
"@typescript-eslint/parser": "8.62.0",
|
|
49
61
|
"@vue/reactivity": "^3.5.18",
|
|
50
62
|
"@vue/shared": "^3.5.18",
|
|
51
63
|
"code-inspector-plugin": "^0.10.1",
|
|
52
64
|
"consola": "^3.4.2",
|
|
53
65
|
"element-plus": "^2.11.5",
|
|
66
|
+
"eslint": "9.39.4",
|
|
67
|
+
"eslint-config-prettier": "9.1.2",
|
|
68
|
+
"eslint-plugin-vue": "10.9.2",
|
|
54
69
|
"es-toolkit": "^1.39.10",
|
|
55
70
|
"lodash-es": "^4.17.21",
|
|
56
|
-
"
|
|
71
|
+
"globals": "16.5.0",
|
|
72
|
+
"husky": "9.1.7",
|
|
73
|
+
"lint-staged": "15.5.2",
|
|
74
|
+
"prettier": "3.8.4",
|
|
75
|
+
"tailwindcss": "^4.3.3",
|
|
76
|
+
"vue": "3.4.15",
|
|
77
|
+
"vue-eslint-parser": "10.4.1"
|
|
57
78
|
},
|
|
58
79
|
"peerDependencies": {
|
|
59
80
|
"vite": ">=5 <8"
|