From 9779cdffa7150b136dcb10853515173a8cd0e086 Mon Sep 17 00:00:00 2001 From: Shigma Date: Sat, 27 Jan 2024 00:44:45 +0800 Subject: [PATCH] refa: add esm exports for core packages, fix #1339 --- packages/axios/package.json | 8 +++++--- packages/core/package.json | 11 ++++++++++- packages/core/src/index.ts | 2 +- packages/protocol/package.json | 8 +++++--- packages/satori/package.json | 14 ++++++++++++-- packages/server-satori/package.json | 12 +++++++----- 6 files changed, 40 insertions(+), 15 deletions(-) diff --git a/packages/axios/package.json b/packages/axios/package.json index 506393ee..f32eda61 100644 --- a/packages/axios/package.json +++ b/packages/axios/package.json @@ -2,12 +2,14 @@ "name": "cordis-axios", "description": "Axios service for cordis", "version": "4.0.2", - "main": "lib/index.js", + "type": "module", + "main": "lib/index.cjs", + "module": "lib/index.mjs", "types": "lib/index.d.ts", "exports": { ".": { - "node": "./lib/index.js", - "browser": "./lib/index.mjs", + "require": "./lib/index.cjs", + "import": "./lib/index.mjs", "types": "./lib/index.d.ts" }, "./package.json": "./package.json" diff --git a/packages/core/package.json b/packages/core/package.json index eb6916a3..d5f4fab7 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -2,9 +2,18 @@ "name": "@satorijs/core", "description": "Core components of Satorijs", "version": "3.4.2", + "type": "module", "main": "lib/index.cjs", "module": "lib/index.mjs", - "typings": "lib/index.d.ts", + "types": "lib/index.d.ts", + "exports": { + ".": { + "require": "./lib/index.cjs", + "import": "./lib/index.mjs", + "types": "./lib/index.d.ts" + }, + "./package.json": "./package.json" + }, "files": [ "lib", "src" diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 543a96ea..5ee0b637 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -3,7 +3,7 @@ import { Awaitable, defineProperty, Dict } from 'cosmokit' import { Bot } from './bot' import { Session } from './session' import Schema from 'schemastery' -import Quester from 'cordis-axios' +import { Quester } from 'cordis-axios' import * as logger from '@cordisjs/logger' import TimerService from '@cordisjs/timer' import { Event, SendOptions } from '@satorijs/protocol' diff --git a/packages/protocol/package.json b/packages/protocol/package.json index 74421bd2..1710e3a8 100644 --- a/packages/protocol/package.json +++ b/packages/protocol/package.json @@ -2,12 +2,14 @@ "name": "@satorijs/protocol", "description": "Protocol types for Satori protocol", "version": "1.2.0", - "main": "lib/index.js", + "type": "module", + "main": "lib/index.cjs", + "module": "lib/index.mjs", "types": "lib/index.d.ts", "exports": { ".": { - "node": "./lib/index.js", - "browser": "./lib/index.mjs", + "require": "./lib/index.cjs", + "import": "./lib/index.mjs", "types": "./lib/index.d.ts" }, "./package.json": "./package.json" diff --git a/packages/satori/package.json b/packages/satori/package.json index caf1c3d0..f19e34ab 100644 --- a/packages/satori/package.json +++ b/packages/satori/package.json @@ -2,8 +2,18 @@ "name": "@satorijs/satori", "description": "Core components of Satorijs", "version": "3.4.2", - "main": "lib/index.js", - "typings": "lib/index.d.ts", + "type": "module", + "main": "lib/index.cjs", + "module": "lib/index.mjs", + "types": "lib/index.d.ts", + "exports": { + ".": { + "require": "./lib/index.cjs", + "import": "./lib/index.mjs", + "types": "./lib/index.d.ts" + }, + "./package.json": "./package.json" + }, "files": [ "lib", "src" diff --git a/packages/server-satori/package.json b/packages/server-satori/package.json index ec424870..ba8e4618 100644 --- a/packages/server-satori/package.json +++ b/packages/server-satori/package.json @@ -2,12 +2,14 @@ "name": "@satorijs/server-satori", "description": "Basic API server for Satori protocol", "version": "2.4.0", - "main": "lib/index.js", + "type": "module", + "main": "lib/index.cjs", + "module": "lib/index.mjs", "types": "lib/index.d.ts", "exports": { ".": { - "node": "./lib/index.js", - "browser": "./lib/index.mjs", + "require": "./lib/index.cjs", + "import": "./lib/index.mjs", "types": "./lib/index.d.ts" }, "./package.json": "./package.json" @@ -35,9 +37,9 @@ "api" ], "devDependencies": { - "@cordisjs/server": "^0.1.3" + "@cordisjs/server": "^0.1.5" }, "peerDependencies": { - "@satorijs/satori": "^3.4.2" + "@satorijs/satori": "^3.4.4" } }