diff --git a/packages/auto-import-resolver/package.json b/packages/auto-import-resolver/package.json index 1448ee532..5b5a06229 100644 --- a/packages/auto-import-resolver/package.json +++ b/packages/auto-import-resolver/package.json @@ -14,6 +14,7 @@ "url": "https://github.com/primefaces/primevue/issues" }, "main": "./index.ts", + "module": "./index.ts", "publishConfig": { "main": "./index.mjs", "module": "./index.mjs", @@ -44,4 +45,4 @@ "engines": { "node": ">=12.11.0" } -} \ No newline at end of file +} diff --git a/packages/core/package.json b/packages/core/package.json index b4c99b1b0..26ae9e9cf 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -13,6 +13,7 @@ "bugs": { "url": "https://github.com/primefaces/primevue/issues" }, + "types": "./src/index.d.ts", "exports": { "./api": "./src/api/Api.js", "./base/style": "./src/base/style/BaseStyle.js", @@ -25,7 +26,6 @@ "./usestyle": "./src/usestyle/UseStyle.js", "./utils": "./src/utils/Utils.js" }, - "types": "./src/index.d.ts", "publishConfig": { "types": "./index.d.ts", "exports": { @@ -53,4 +53,4 @@ "engines": { "node": ">=12.11.0" } -} \ No newline at end of file +} diff --git a/packages/metadata/package.json b/packages/metadata/package.json index 74ac14da5..c2911e665 100644 --- a/packages/metadata/package.json +++ b/packages/metadata/package.json @@ -14,6 +14,8 @@ "url": "https://github.com/primefaces/primevue/issues" }, "main": "./src/index.ts", + "module": "./src/index.ts", + "types": "./src/index.ts", "publishConfig": { "main": "./index.mjs", "module": "./index.mjs", @@ -40,4 +42,4 @@ "engines": { "node": ">=12.11.0" } -} \ No newline at end of file +} diff --git a/packages/primevue/src/config/Config.d.ts b/packages/primevue/src/config/Config.d.ts index 9edcfc447..651889e46 100644 --- a/packages/primevue/src/config/Config.d.ts +++ b/packages/primevue/src/config/Config.d.ts @@ -109,6 +109,7 @@ import type { TreeTablePassThroughOptions } from 'primevue/treetable'; import type { VirtualScrollerPassThroughOptions } from 'primevue/virtualscroller'; export * from '@primevue/core/config'; +export { default } from '@primevue/core/config'; export interface PrimeVueConfiguration { ripple?: boolean; diff --git a/packages/themes/package.json b/packages/themes/package.json index 21c94f4b7..9f1f58da0 100644 --- a/packages/themes/package.json +++ b/packages/themes/package.json @@ -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": { ".": "./src/index.js", @@ -30,8 +31,20 @@ "types": "./index.d.ts", "import": "./index.mjs" }, - "./*": { + "./aura/*": { "types": "./types/*/index.d.ts", + "import": "./aura/*/index.mjs" + }, + "./lara/*": { + "types": "./types/*/index.d.ts", + "import": "./lara/*/index.mjs" + }, + "./nora/*": { + "types": "./types/*/index.d.ts", + "import": "./nora/*/index.mjs" + }, + "./*": { + "types": "./*/index.d.ts", "import": "./*/index.mjs" } }, @@ -49,4 +62,4 @@ "engines": { "node": ">=12.11.0" } -} \ No newline at end of file +} diff --git a/packages/themes/scripts/prebuild.mjs b/packages/themes/scripts/prebuild.mjs index e8449e469..587e61aad 100644 --- a/packages/themes/scripts/prebuild.mjs +++ b/packages/themes/scripts/prebuild.mjs @@ -1,5 +1,38 @@ +import fs from 'fs-extra'; import path from 'path'; import { removeBuild, resolvePath, updatePackageJson } from '../../../scripts/build-helper.mjs'; removeBuild(import.meta.url); -updatePackageJson(path.resolve(resolvePath(import.meta.url).__dirname, '../package.json')); + +const { __dirname, INPUT_DIR } = resolvePath(import.meta.url); +const __root = path.resolve(__dirname, '../'); +const pkg = path.resolve(__root, './package.json'); + +updatePackageJson(pkg); + +// update package.json > "publishConfig.exports" for publish +let exports = { + '.': { + types: './index.d.ts', + import: './index.mjs' + } +}; + +fs.readdirSync(path.resolve(__root, INPUT_DIR + 'presets'), { withFileTypes: true }) + .filter((dir) => dir.isDirectory()) + .forEach(({ name: folderName }) => { + exports[`./${folderName}/*`] = { + types: `./types/*/index.d.ts`, + import: `./${folderName}/*/index.mjs` + }; + }); +exports['./*'] = { + types: './*/index.d.ts', + import: './*/index.mjs' +}; + +const pkgJson = JSON.parse(fs.readFileSync(pkg, { encoding: 'utf8', flag: 'r' })); + +pkgJson.publishConfig.exports = exports; + +fs.writeFileSync(pkg, JSON.stringify(pkgJson, null, 4)); diff --git a/packages/themes/types/inputtext/index.d.ts b/packages/themes/types/inputtext/index.d.ts index 3d325d885..29b68417d 100644 --- a/packages/themes/types/inputtext/index.d.ts +++ b/packages/themes/types/inputtext/index.d.ts @@ -150,5 +150,53 @@ export interface InputTextDesignTokens extends ColorSchemeDesignToken