@yh-ui/components 1.0.43 → 1.0.45

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.
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.parseDate = exports.generateCalendar = exports.formatDate = exports.DEFAULT_FORMATS = void 0;
7
7
  var _dayjs = _interopRequireDefault(require("../../dayjs.cjs"));
8
- var _dayjsPlugins = require("../../dayjs-plugins.cjs");
8
+ var _dayjsPlugins = require("../../dayjs-plugins");
9
9
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
10
  _dayjs.default.extend(_dayjsPlugins.isBetweenPlugin);
11
11
  _dayjs.default.extend(_dayjsPlugins.weekOfYearPlugin);
@@ -6,7 +6,7 @@ import {
6
6
  isoWeekPlugin,
7
7
  quarterOfYearPlugin,
8
8
  weekOfYearPlugin
9
- } from "../../dayjs-plugins.mjs";
9
+ } from "../../dayjs-plugins";
10
10
  dayjs.extend(isBetweenPlugin);
11
11
  dayjs.extend(weekOfYearPlugin);
12
12
  dayjs.extend(isoWeekPlugin);
@@ -1,48 +1,32 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "advancedFormatPlugin", {
7
- enumerable: true,
8
- get: function () {
9
- return _advancedFormat.default;
10
- }
11
- });
12
- Object.defineProperty(exports, "customParseFormatPlugin", {
13
- enumerable: true,
14
- get: function () {
15
- return _customParseFormat.default;
16
- }
17
- });
18
- Object.defineProperty(exports, "isBetweenPlugin", {
19
- enumerable: true,
20
- get: function () {
21
- return _isBetween.default;
22
- }
23
- });
24
- Object.defineProperty(exports, "isoWeekPlugin", {
25
- enumerable: true,
26
- get: function () {
27
- return _isoWeek.default;
28
- }
29
- });
30
- Object.defineProperty(exports, "quarterOfYearPlugin", {
31
- enumerable: true,
32
- get: function () {
33
- return _quarterOfYear.default;
34
- }
35
- });
36
- Object.defineProperty(exports, "weekOfYearPlugin", {
37
- enumerable: true,
38
- get: function () {
39
- return _weekOfYear.default;
40
- }
41
- });
42
- var _advancedFormat = _interopRequireDefault(require("dayjs/plugin/advancedFormat"));
43
- var _customParseFormat = _interopRequireDefault(require("dayjs/plugin/customParseFormat"));
44
- var _isBetween = _interopRequireDefault(require("dayjs/plugin/isBetween"));
45
- var _isoWeek = _interopRequireDefault(require("dayjs/plugin/isoWeek"));
46
- var _quarterOfYear = _interopRequireDefault(require("dayjs/plugin/quarterOfYear"));
47
- var _weekOfYear = _interopRequireDefault(require("dayjs/plugin/weekOfYear"));
48
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
3
+ const _advancedFormat = require('dayjs/plugin/advancedFormat');
4
+ const _customParseFormat = require('dayjs/plugin/customParseFormat');
5
+ const _isBetween = require('dayjs/plugin/isBetween');
6
+ const _isoWeek = require('dayjs/plugin/isoWeek');
7
+ const _quarterOfYear = require('dayjs/plugin/quarterOfYear');
8
+ const _weekOfYear = require('dayjs/plugin/weekOfYear');
9
+
10
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
11
+
12
+ const _advancedFormat__default = /*#__PURE__*/_interopDefaultCompat(_advancedFormat);
13
+ const _customParseFormat__default = /*#__PURE__*/_interopDefaultCompat(_customParseFormat);
14
+ const _isBetween__default = /*#__PURE__*/_interopDefaultCompat(_isBetween);
15
+ const _isoWeek__default = /*#__PURE__*/_interopDefaultCompat(_isoWeek);
16
+ const _quarterOfYear__default = /*#__PURE__*/_interopDefaultCompat(_quarterOfYear);
17
+ const _weekOfYear__default = /*#__PURE__*/_interopDefaultCompat(_weekOfYear);
18
+
19
+ const interop = (m) => m.default ?? m;
20
+ const advancedFormatPlugin = interop(_advancedFormat__default);
21
+ const customParseFormatPlugin = interop(_customParseFormat__default);
22
+ const isBetweenPlugin = interop(_isBetween__default);
23
+ const isoWeekPlugin = interop(_isoWeek__default);
24
+ const quarterOfYearPlugin = interop(_quarterOfYear__default);
25
+ const weekOfYearPlugin = interop(_weekOfYear__default);
26
+
27
+ exports.advancedFormatPlugin = advancedFormatPlugin;
28
+ exports.customParseFormatPlugin = customParseFormatPlugin;
29
+ exports.isBetweenPlugin = isBetweenPlugin;
30
+ exports.isoWeekPlugin = isoWeekPlugin;
31
+ exports.quarterOfYearPlugin = quarterOfYearPlugin;
32
+ exports.weekOfYearPlugin = weekOfYearPlugin;
@@ -0,0 +1,10 @@
1
+ import { PluginFunc } from 'dayjs';
2
+
3
+ declare const advancedFormatPlugin: PluginFunc;
4
+ declare const customParseFormatPlugin: PluginFunc;
5
+ declare const isBetweenPlugin: PluginFunc;
6
+ declare const isoWeekPlugin: PluginFunc;
7
+ declare const quarterOfYearPlugin: PluginFunc;
8
+ declare const weekOfYearPlugin: PluginFunc;
9
+
10
+ export { advancedFormatPlugin, customParseFormatPlugin, isBetweenPlugin, isoWeekPlugin, quarterOfYearPlugin, weekOfYearPlugin };
@@ -0,0 +1,10 @@
1
+ import { PluginFunc } from 'dayjs';
2
+
3
+ declare const advancedFormatPlugin: PluginFunc;
4
+ declare const customParseFormatPlugin: PluginFunc;
5
+ declare const isBetweenPlugin: PluginFunc;
6
+ declare const isoWeekPlugin: PluginFunc;
7
+ declare const quarterOfYearPlugin: PluginFunc;
8
+ declare const weekOfYearPlugin: PluginFunc;
9
+
10
+ export { advancedFormatPlugin, customParseFormatPlugin, isBetweenPlugin, isoWeekPlugin, quarterOfYearPlugin, weekOfYearPlugin };
@@ -1,7 +1,10 @@
1
- import advancedFormatPlugin from 'dayjs/plugin/advancedFormat';
2
- import customParseFormatPlugin from 'dayjs/plugin/customParseFormat';
3
- import isBetweenPlugin from 'dayjs/plugin/isBetween';
4
- import isoWeekPlugin from 'dayjs/plugin/isoWeek';
5
- import quarterOfYearPlugin from 'dayjs/plugin/quarterOfYear';
6
- import weekOfYearPlugin from 'dayjs/plugin/weekOfYear';
1
+ import { PluginFunc } from 'dayjs';
2
+
3
+ declare const advancedFormatPlugin: PluginFunc;
4
+ declare const customParseFormatPlugin: PluginFunc;
5
+ declare const isBetweenPlugin: PluginFunc;
6
+ declare const isoWeekPlugin: PluginFunc;
7
+ declare const quarterOfYearPlugin: PluginFunc;
8
+ declare const weekOfYearPlugin: PluginFunc;
9
+
7
10
  export { advancedFormatPlugin, customParseFormatPlugin, isBetweenPlugin, isoWeekPlugin, quarterOfYearPlugin, weekOfYearPlugin };
@@ -1,14 +1,16 @@
1
- import advancedFormatPlugin from "dayjs/plugin/advancedFormat";
2
- import customParseFormatPlugin from "dayjs/plugin/customParseFormat";
3
- import isBetweenPlugin from "dayjs/plugin/isBetween";
4
- import isoWeekPlugin from "dayjs/plugin/isoWeek";
5
- import quarterOfYearPlugin from "dayjs/plugin/quarterOfYear";
6
- import weekOfYearPlugin from "dayjs/plugin/weekOfYear";
7
- export {
8
- advancedFormatPlugin,
9
- customParseFormatPlugin,
10
- isBetweenPlugin,
11
- isoWeekPlugin,
12
- quarterOfYearPlugin,
13
- weekOfYearPlugin
14
- };
1
+ import _advancedFormat from 'dayjs/plugin/advancedFormat';
2
+ import _customParseFormat from 'dayjs/plugin/customParseFormat';
3
+ import _isBetween from 'dayjs/plugin/isBetween';
4
+ import _isoWeek from 'dayjs/plugin/isoWeek';
5
+ import _quarterOfYear from 'dayjs/plugin/quarterOfYear';
6
+ import _weekOfYear from 'dayjs/plugin/weekOfYear';
7
+
8
+ const interop = (m) => m.default ?? m;
9
+ const advancedFormatPlugin = interop(_advancedFormat);
10
+ const customParseFormatPlugin = interop(_customParseFormat);
11
+ const isBetweenPlugin = interop(_isBetween);
12
+ const isoWeekPlugin = interop(_isoWeek);
13
+ const quarterOfYearPlugin = interop(_quarterOfYear);
14
+ const weekOfYearPlugin = interop(_weekOfYear);
15
+
16
+ export { advancedFormatPlugin, customParseFormatPlugin, isBetweenPlugin, isoWeekPlugin, quarterOfYearPlugin, weekOfYearPlugin };
package/dist/dayjs.cjs CHANGED
@@ -4,10 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
- var dayjsObject = _interopRequireWildcard(require("dayjs"));
8
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
9
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
- const dayjs = typeof dayjsObject === "function" ? dayjsObject :
7
+ var _dayjs = _interopRequireDefault(require("dayjs"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ const dayjs = typeof _dayjs.default === "function" ? _dayjs.default :
11
10
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
- dayjsObject.default || dayjsObject;
11
+ _dayjs.default.default || _dayjs.default;
13
12
  module.exports = dayjs;
package/dist/dayjs.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import * as dayjsObject from "dayjs";
1
+ import dayjsObject from "dayjs";
2
2
  const dayjs = typeof dayjsObject === "function" ? dayjsObject : (
3
3
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
4
  dayjsObject.default || dayjsObject
@@ -21,6 +21,18 @@ Object.keys(_message).forEach(function (key) {
21
21
  }
22
22
  });
23
23
  });
24
+ var _useMessage = require("./src/use-message.cjs");
25
+ Object.keys(_useMessage).forEach(function (key) {
26
+ if (key === "default" || key === "__esModule") return;
27
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
28
+ if (key in exports && exports[key] === _useMessage[key]) return;
29
+ Object.defineProperty(exports, key, {
30
+ enumerable: true,
31
+ get: function () {
32
+ return _useMessage[key];
33
+ }
34
+ });
35
+ });
24
36
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
25
37
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
26
38
  const YhMessage = exports.YhMessage = (0, _utils.withInstallFunction)(_method.default, "$message");
@@ -1,6 +1,7 @@
1
1
  export declare const YhMessage: import("@yh-ui/utils").SFCWithInstall<import("./src/message").MessageFn>;
2
2
  export default YhMessage;
3
3
  export * from './src/message';
4
+ export * from './src/use-message';
4
5
  export type YhMessageProps = import('./src/message').MessageProps;
5
6
  export type YhMessageEmits = import('./src/message').MessageEmits;
6
7
  export type YhMessageSlots = import('./src/message').MessageSlots;
@@ -7,3 +7,4 @@ YhMessage.install = (app) => {
7
7
  };
8
8
  export default YhMessage;
9
9
  export * from "./src/message.mjs";
10
+ export * from "./src/use-message.mjs";
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useMessage = useMessage;
7
+ var _index = _interopRequireDefault(require("../index.cjs"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ function useMessage() {
10
+ return _index.default;
11
+ }
@@ -0,0 +1,6 @@
1
+ import type { MessageFn } from './message';
2
+ /**
3
+ * 获取全局 Message 服务实例。
4
+ * 无需注入,直接返回全局单例 API,与 `YhMessage` 完全等价。
5
+ */
6
+ export declare function useMessage(): MessageFn;
@@ -0,0 +1,4 @@
1
+ import YhMessage from "../index.mjs";
2
+ export function useMessage() {
3
+ return YhMessage;
4
+ }
@@ -22,6 +22,18 @@ Object.keys(_messageBox2).forEach(function (key) {
22
22
  }
23
23
  });
24
24
  });
25
+ var _useMessageBox = require("./src/use-message-box.cjs");
26
+ Object.keys(_useMessageBox).forEach(function (key) {
27
+ if (key === "default" || key === "__esModule") return;
28
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
29
+ if (key in exports && exports[key] === _useMessageBox[key]) return;
30
+ Object.defineProperty(exports, key, {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _useMessageBox[key];
34
+ }
35
+ });
36
+ });
25
37
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
26
38
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
27
39
  const YhMessageBox = exports.YhMessageBox = (0, _utils.withInstallFunction)(_method.default, "$msgbox");
@@ -2,6 +2,7 @@ import './src/message-box.css';
2
2
  export declare const YhMessageBox: import("@yh-ui/utils").SFCWithInstall<import("./src/message-box").MessageBoxHandler>;
3
3
  export default YhMessageBox;
4
4
  export * from './src/message-box';
5
+ export * from './src/use-message-box';
5
6
  export type YhMessageBoxType = import('./src/message-box').MessageBoxType;
6
7
  export type YhMessageBoxData = import('./src/message-box').MessageBoxData;
7
8
  export type YhMessageBoxAction = import('./src/message-box').MessageBoxAction;
@@ -14,3 +14,4 @@ YhMessageBox.install = (app) => {
14
14
  };
15
15
  export default YhMessageBox;
16
16
  export * from "./src/message-box.mjs";
17
+ export * from "./src/use-message-box.mjs";
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useMessageBox = useMessageBox;
7
+ var _index = _interopRequireDefault(require("../index.cjs"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ function useMessageBox() {
10
+ return _index.default;
11
+ }
@@ -0,0 +1,6 @@
1
+ import type { MessageBoxHandler } from './message-box';
2
+ /**
3
+ * 获取全局 MessageBox 服务实例。
4
+ * 无需注入,直接返回全局单例 API,与 `YhMessageBox` 完全等价。
5
+ */
6
+ export declare function useMessageBox(): MessageBoxHandler;
@@ -0,0 +1,4 @@
1
+ import YhMessageBox from "../index.mjs";
2
+ export function useMessageBox() {
3
+ return YhMessageBox;
4
+ }
@@ -21,6 +21,18 @@ Object.keys(_notification).forEach(function (key) {
21
21
  }
22
22
  });
23
23
  });
24
+ var _useNotification = require("./src/use-notification.cjs");
25
+ Object.keys(_useNotification).forEach(function (key) {
26
+ if (key === "default" || key === "__esModule") return;
27
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
28
+ if (key in exports && exports[key] === _useNotification[key]) return;
29
+ Object.defineProperty(exports, key, {
30
+ enumerable: true,
31
+ get: function () {
32
+ return _useNotification[key];
33
+ }
34
+ });
35
+ });
24
36
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
25
37
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
26
38
  const YhNotification = exports.YhNotification = (0, _utils.withInstallFunction)(_method.default, "$notify");
@@ -1,6 +1,7 @@
1
1
  export declare const YhNotification: import("@yh-ui/utils").SFCWithInstall<import("./src/notification").NotificationFn>;
2
2
  export default YhNotification;
3
3
  export * from './src/notification';
4
+ export * from './src/use-notification';
4
5
  export type YhNotificationProps = import('./src/notification').NotificationProps;
5
6
  export type YhNotificationEmits = import('./src/notification').NotificationEmits;
6
7
  export type YhNotificationSlots = import('./src/notification').NotificationSlots;
@@ -7,3 +7,4 @@ YhNotification.install = (app) => {
7
7
  };
8
8
  export default YhNotification;
9
9
  export * from "./src/notification.mjs";
10
+ export * from "./src/use-notification.mjs";
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useNotification = useNotification;
7
+ var _index = _interopRequireDefault(require("../index.cjs"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ function useNotification() {
10
+ return _index.default;
11
+ }
@@ -0,0 +1,6 @@
1
+ import type { NotificationFn } from './notification';
2
+ /**
3
+ * 获取全局 Notification 服务实例。
4
+ * 无需注入,直接返回全局单例 API,与 `YhNotification` 完全等价。
5
+ */
6
+ export declare function useNotification(): NotificationFn;
@@ -0,0 +1,4 @@
1
+ import YhNotification from "../index.mjs";
2
+ export function useNotification() {
3
+ return YhNotification;
4
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.YhUIVitePlugin = YhUIVitePlugin;
7
+
8
+ const DAYJS_PLUGINS = ["dayjs", "dayjs/plugin/advancedFormat", "dayjs/plugin/customParseFormat", "dayjs/plugin/isBetween", "dayjs/plugin/isoWeek", "dayjs/plugin/quarterOfYear", "dayjs/plugin/weekOfYear"];
9
+ function YhUIVitePlugin(options = {}) {
10
+ const {
11
+ optimizeDayjs = true
12
+ } = options;
13
+ return {
14
+ name: "yh-ui:vite-plugin",
15
+ config() {
16
+ if (!optimizeDayjs) return {};
17
+ return {
18
+ optimizeDeps: {
19
+ // 强制 Vite 将 dayjs CJS 插件预构建为 ESM,解决 pnpm 严格模式下的 404 和
20
+ // "does not provide an export named 'default'" 报错
21
+ include: [...DAYJS_PLUGINS]
22
+ },
23
+ ssr: {
24
+ // SSR 模式下同样需要处理这些 CJS 模块
25
+ noExternal: ["dayjs"]
26
+ }
27
+ };
28
+ }
29
+ };
30
+ }
31
+ module.exports = YhUIVitePlugin;
@@ -0,0 +1,29 @@
1
+ import type { Plugin } from 'vite';
2
+ export interface YhUIVitePluginOptions {
3
+ /**
4
+ * 是否自动预构建 dayjs 及其插件(推荐保持开启)。
5
+ * 解决 pnpm + Vite 6 下 dayjs CJS 插件无 default export 的问题。
6
+ * @default true
7
+ */
8
+ optimizeDayjs?: boolean;
9
+ }
10
+ /**
11
+ * YH-UI Vite 插件。
12
+ *
13
+ * 自动处理 pnpm + Vite 6 环境下的 CJS/ESM 互操作问题,
14
+ * 无需手动配置 `optimizeDeps`。
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * // vite.config.ts
19
+ * import { defineConfig } from 'vite'
20
+ * import vue from '@vitejs/plugin-vue'
21
+ * import { YhUIVitePlugin } from '@yh-ui/components/vite-plugin'
22
+ *
23
+ * export default defineConfig({
24
+ * plugins: [vue(), YhUIVitePlugin()]
25
+ * })
26
+ * ```
27
+ */
28
+ export declare function YhUIVitePlugin(options?: YhUIVitePluginOptions): Plugin;
29
+ export default YhUIVitePlugin;
@@ -0,0 +1,30 @@
1
+ const DAYJS_PLUGINS = [
2
+ "dayjs",
3
+ "dayjs/plugin/advancedFormat",
4
+ "dayjs/plugin/customParseFormat",
5
+ "dayjs/plugin/isBetween",
6
+ "dayjs/plugin/isoWeek",
7
+ "dayjs/plugin/quarterOfYear",
8
+ "dayjs/plugin/weekOfYear"
9
+ ];
10
+ export function YhUIVitePlugin(options = {}) {
11
+ const { optimizeDayjs = true } = options;
12
+ return {
13
+ name: "yh-ui:vite-plugin",
14
+ config() {
15
+ if (!optimizeDayjs) return {};
16
+ return {
17
+ optimizeDeps: {
18
+ // 强制 Vite 将 dayjs CJS 插件预构建为 ESM,解决 pnpm 严格模式下的 404 和
19
+ // "does not provide an export named 'default'" 报错
20
+ include: [...DAYJS_PLUGINS]
21
+ },
22
+ ssr: {
23
+ // SSR 模式下同样需要处理这些 CJS 模块
24
+ noExternal: ["dayjs"]
25
+ }
26
+ };
27
+ }
28
+ };
29
+ }
30
+ export default YhUIVitePlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yh-ui/components",
3
- "version": "1.0.43",
3
+ "version": "1.0.45",
4
4
  "description": "YH-UI Vue 3 Components",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -22,6 +22,11 @@
22
22
  "import": "./dist/resolver.mjs",
23
23
  "require": "./dist/resolver.cjs"
24
24
  },
25
+ "./vite-plugin": {
26
+ "types": "./dist/vite-plugin.d.ts",
27
+ "import": "./dist/vite-plugin.mjs",
28
+ "require": "./dist/vite-plugin.cjs"
29
+ },
25
30
  "./style": "./dist/style.css",
26
31
  "./style.css": "./dist/style.css",
27
32
  "./*": {
@@ -45,10 +50,10 @@
45
50
  "dependencies": {
46
51
  "@webcontainer/api": "^1.6.1",
47
52
  "@floating-ui/dom": "^1.7.4",
48
- "@yh-ui/hooks": "^1.0.43",
49
- "@yh-ui/locale": "^1.0.43",
50
- "@yh-ui/theme": "^1.0.43",
51
- "@yh-ui/utils": "^1.0.43",
53
+ "@yh-ui/hooks": "^1.0.45",
54
+ "@yh-ui/locale": "^1.0.45",
55
+ "@yh-ui/theme": "^1.0.45",
56
+ "@yh-ui/utils": "^1.0.45",
52
57
  "async-validator": "^4.2.5",
53
58
  "dayjs": "^1.11.19",
54
59
  "dompurify": "^3.3.3"
@@ -82,6 +87,7 @@
82
87
  "devDependencies": {
83
88
  "@types/markdown-it": "^14.1.2",
84
89
  "@vitejs/plugin-vue": "^6.0.0",
90
+ "vite": "^6.0.0",
85
91
  "monaco-editor": "^0.55.1",
86
92
  "xlsx": "^0.18.5",
87
93
  "viewerjs": "^1.11.7",