Add `default` option to exports in package.json

pull/6705/head
Mert Sincan 2024-11-01 06:06:39 +00:00
parent 9a03549424
commit 7f11861ed9
4 changed files with 13 additions and 6 deletions

View File

@ -15,6 +15,7 @@
},
"main": "./index.ts",
"module": "./index.ts",
"types": "./index.ts",
"publishConfig": {
"main": "./index.mjs",
"module": "./index.mjs",
@ -22,7 +23,8 @@
"exports": {
".": {
"types": "./index.d.mts",
"import": "./index.mjs"
"import": "./index.mjs",
"default": "./index.mjs"
}
},
"directory": "dist",

View File

@ -14,6 +14,7 @@
"url": "https://github.com/primefaces/primevue/issues"
},
"main": "./src/index.js",
"module": "./src/index.js",
"types": "./src/index.d.ts",
"exports": {
"./api": "./src/api/Api.js",
@ -31,15 +32,18 @@
},
"publishConfig": {
"main": "./index.mjs",
"module": "./index.mjs",
"types": "./index.d.ts",
"exports": {
".": {
"types": "./index.d.ts",
"import": "./index.mjs"
"import": "./index.mjs",
"default": "./index.mjs"
},
"./*": {
"types": "./*/index.d.ts",
"import": "./*/index.mjs"
"import": "./*/index.mjs",
"default": "./*/index.mjs"
}
},
"directory": "dist",

View File

@ -23,7 +23,8 @@
"exports": {
".": {
"types": "./index.d.mts",
"import": "./index.mjs"
"import": "./index.mjs",
"default": "./index.mjs"
}
},
"directory": "dist",

View File

@ -76,7 +76,7 @@ export function copyDependencies(inFolder, outFolder, subFolder) {
});
}
export async function renameDTSFile(dir, newName) {
export async function renameDTSFile(dir, newName, resolver) {
const entries = await fs.readdir(dir, { withFileTypes: true });
for (const entry of entries) {
@ -84,7 +84,7 @@ export async function renameDTSFile(dir, newName) {
if (entry.isDirectory()) {
await renameDTSFile(fullPath, newName);
} else if (entry.name.endsWith('.d.ts')) {
} else if (entry.name.endsWith('.d.ts') && (resolver?.(entry.name, dir) ?? true)) {
const newFullPath = path.join(dir, `${newName}.d.ts`);
await fs.rename(fullPath, newFullPath);