dlzn-ui 1.20.0 → 1.22.0
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/build/utils.mjs +11 -0
- package/eslint-config.mjs +4 -1
- package/package.json +3 -2
- package/prettier-config.mjs +5 -13
- package/vite-config.d.ts +6 -0
- package/vite-config.mjs +12 -47
package/build/utils.mjs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { existsSync as e } from "node:fs";
|
|
2
|
+
import { dirname as t, resolve as n } from "node:path";
|
|
3
|
+
import { fileURLToPath as r } from "node:url";
|
|
4
|
+
//#region build/utils.ts
|
|
5
|
+
function i(i, a) {
|
|
6
|
+
let o = t(r(i)), s = a.map((e) => n(o, e)).findIndex((t) => e(t));
|
|
7
|
+
if (s === -1) throw Error(`resolveOne: path not found: ${a.join(", ")}`);
|
|
8
|
+
return a[s];
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { i as resolveOne };
|
package/eslint-config.mjs
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import antfu, { perfectionist as perfectionistConfigFn } from '@antfu/eslint-config'
|
|
2
2
|
import perfectionist from 'eslint-plugin-perfectionist'
|
|
3
3
|
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
|
|
4
|
-
import
|
|
4
|
+
import { resolveOne } from './build/utils.ts'
|
|
5
5
|
|
|
6
|
+
const prettierOptions = await import(
|
|
7
|
+
resolveOne(import.meta.url, ['./prettier.config.mjs', './prettier-config.mjs'])
|
|
8
|
+
)
|
|
6
9
|
const perfectionistConfig = await perfectionistConfigFn({})
|
|
7
10
|
/** @type {import('eslint').Linter.Config[]} */
|
|
8
11
|
const eslintConfig = await antfu(
|
package/package.json
CHANGED
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
"types": "./utils/index.d.ts"
|
|
24
24
|
},
|
|
25
25
|
"./vite-config": {
|
|
26
|
-
"import": "./vite-config.mjs"
|
|
26
|
+
"import": "./vite-config.mjs",
|
|
27
|
+
"types": "./vite-config.d.ts"
|
|
27
28
|
}
|
|
28
29
|
},
|
|
29
30
|
"keywords": [],
|
|
@@ -66,6 +67,6 @@
|
|
|
66
67
|
"**/*.css"
|
|
67
68
|
],
|
|
68
69
|
"type": "module",
|
|
69
|
-
"version": "1.
|
|
70
|
+
"version": "1.22.0",
|
|
70
71
|
"scripts": {}
|
|
71
72
|
}
|
package/prettier-config.mjs
CHANGED
|
@@ -4,18 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
// @ts-check
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import { dirname, resolve } from 'node:path'
|
|
9
|
-
import { fileURLToPath } from 'node:url'
|
|
10
|
-
|
|
11
|
-
const here = dirname(fileURLToPath(import.meta.url))
|
|
12
|
-
|
|
13
|
-
function resolveDefaultCssEntry() {
|
|
14
|
-
const distCss = resolve(here, 'assets/css/tailwindcss-entry.css')
|
|
15
|
-
const srcCss = resolve(here, 'src/assets/css/tailwindcss-entry.css')
|
|
16
|
-
|
|
17
|
-
return existsSync(distCss) ? distCss : srcCss
|
|
18
|
-
}
|
|
7
|
+
import { resolveOne } from './build/utils.ts'
|
|
19
8
|
|
|
20
9
|
/** @type {import('prettier').Config & import('prettier-plugin-tailwindcss').PluginOptions} */
|
|
21
10
|
export default {
|
|
@@ -37,7 +26,10 @@ export default {
|
|
|
37
26
|
singleAttributePerLine: false, // 会在 HTML、JSX、Vue 和 Angular 中格式化为每个属性单独占一行。
|
|
38
27
|
singleQuote: true, // 使用单引号
|
|
39
28
|
tabWidth: 2, // 缩进长度
|
|
40
|
-
tailwindStylesheet:
|
|
29
|
+
tailwindStylesheet: resolveOne(import.meta.url, [
|
|
30
|
+
'./assets/css/tailwindcss-entry.css',
|
|
31
|
+
'./src/assets/css/tailwindcss-entry.css',
|
|
32
|
+
]),
|
|
41
33
|
trailingComma: 'all',
|
|
42
34
|
useTabs: false, // 使用空格代替tab缩进
|
|
43
35
|
vueIndentScriptAndStyle: false, // 不对vue中的script及style标签缩进
|
package/vite-config.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ConfigEnv, UserConfig } from 'vite';
|
|
2
|
+
import { default as tailwindAutoReference } from 'vite-plugin-vue-tailwind-auto-reference';
|
|
3
|
+
declare const _default: (_env: ConfigEnv, options: {
|
|
4
|
+
tailwindAutoReferenceParameters?: Parameters<typeof tailwindAutoReference>;
|
|
5
|
+
}) => UserConfig;
|
|
6
|
+
export default _default;
|
package/vite-config.mjs
CHANGED
|
@@ -1,47 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
* @typedef {import('vite').UserConfig} UserConfig
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
const here = dirname(fileURLToPath(import.meta.url))
|
|
17
|
-
|
|
18
|
-
function resolveDefaultCssEntry() {
|
|
19
|
-
const distCss = resolve(here, 'assets/css/tailwindcss-entry.css')
|
|
20
|
-
const srcCss = resolve(here, 'src/assets/css/tailwindcss-entry.css')
|
|
21
|
-
|
|
22
|
-
return existsSync(distCss) ? distCss : srcCss
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* @param {ConfigEnv} env
|
|
27
|
-
* @param {DlznViteOptions} options
|
|
28
|
-
* @returns {UserConfig} Vite config
|
|
29
|
-
*/
|
|
30
|
-
export default (env, options) => {
|
|
31
|
-
const tailwindAutoReferenceParameters = [
|
|
32
|
-
options.tailwindAutoReferenceParameters?.[0] ?? resolveDefaultCssEntry(),
|
|
33
|
-
...(options.tailwindAutoReferenceParameters?.slice(1) ?? []),
|
|
34
|
-
]
|
|
35
|
-
|
|
36
|
-
return {
|
|
37
|
-
plugins: [
|
|
38
|
-
vue({
|
|
39
|
-
// features: {
|
|
40
|
-
// optionsAPI: false, // 不能删掉,tdesign 内部使用到了
|
|
41
|
-
// },
|
|
42
|
-
}),
|
|
43
|
-
tailwindAutoReference(...tailwindAutoReferenceParameters),
|
|
44
|
-
tailwindcss(),
|
|
45
|
-
],
|
|
46
|
-
}
|
|
47
|
-
}
|
|
1
|
+
import { resolveOne as e } from "./build/utils.mjs";
|
|
2
|
+
import t from "@tailwindcss/vite";
|
|
3
|
+
import n from "@vitejs/plugin-vue";
|
|
4
|
+
import r from "vite-plugin-vue-tailwind-auto-reference";
|
|
5
|
+
//#region vite.config.common.ts
|
|
6
|
+
var i = (i, a) => ({ plugins: [
|
|
7
|
+
n({}),
|
|
8
|
+
r(a.tailwindAutoReferenceParameters?.[0] ?? e(import.meta.url, ["./assets/css/tailwindcss-entry.css", "./src/assets/css/tailwindcss-entry.css"]), a.tailwindAutoReferenceParameters?.[1]),
|
|
9
|
+
t()
|
|
10
|
+
] });
|
|
11
|
+
//#endregion
|
|
12
|
+
export { i as default };
|