Sfoglia il codice sorgente

chore(core-shared): migrate build to tsdown

xingyu4j 3 mesi fa
parent
commit
59912a00bc

+ 8 - 8
packages/@core/base/shared/package.json

@@ -11,8 +11,8 @@
   "license": "MIT",
   "type": "module",
   "scripts": {
-    "build": "tsdown",
-    "stub": "tsdown"
+    "build": "pnpm exec tsdown",
+    "stub": "pnpm exec tsdown"
   },
   "files": [
     "dist"
@@ -53,27 +53,27 @@
   "publishConfig": {
     "exports": {
       "./constants": {
-        "types": "./dist/constants/index.d.mts",
+        "types": "./dist/constants/index.d.ts",
         "default": "./dist/constants/index.mjs"
       },
       "./utils": {
-        "types": "./dist/utils/index.d.mts",
+        "types": "./dist/utils/index.d.ts",
         "default": "./dist/utils/index.mjs"
       },
       "./color": {
-        "types": "./dist/color/index.d.mts",
+        "types": "./dist/color/index.d.ts",
         "default": "./dist/color/index.mjs"
       },
       "./cache": {
-        "types": "./dist/cache/index.d.mts",
+        "types": "./dist/cache/index.d.ts",
         "default": "./dist/cache/index.mjs"
       },
       "./store": {
-        "types": "./dist/store.d.mts",
+        "types": "./dist/store.d.ts",
         "default": "./dist/store.mjs"
       },
       "./global-state": {
-        "types": "./dist/global-state.d.mts",
+        "types": "./dist/global-state.d.ts",
         "default": "./dist/global-state.mjs"
       }
     }

+ 2 - 2
packages/@core/base/shared/src/utils/__tests__/date.test.ts

@@ -1,6 +1,6 @@
 import dayjs from 'dayjs';
-import timezone from 'dayjs/plugin/timezone';
-import utc from 'dayjs/plugin/utc';
+import timezone from 'dayjs/plugin/timezone.js';
+import utc from 'dayjs/plugin/utc.js';
 import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
 
 import {

+ 2 - 2
packages/@core/base/shared/src/utils/date.ts

@@ -1,6 +1,6 @@
 import dayjs from 'dayjs';
-import timezone from 'dayjs/plugin/timezone';
-import utc from 'dayjs/plugin/utc';
+import timezone from 'dayjs/plugin/timezone.js';
+import utc from 'dayjs/plugin/utc.js';
 
 dayjs.extend(utc);
 dayjs.extend(timezone);

+ 3 - 0
packages/@core/base/shared/tsdown.config.ts

@@ -12,4 +12,7 @@ export default defineConfig({
     'utils/index': 'src/utils/index.ts',
   },
   format: ['esm'],
+  outExtensions: () => ({
+    dts: '.d.ts',
+  }),
 });