Fixed module exports

pull/5880/head
Mert Sincan 2024-06-12 11:06:52 +01:00
parent a054a92ef1
commit 7ce0115342
7 changed files with 105 additions and 7 deletions

View File

@ -14,6 +14,7 @@
"url": "https://github.com/primefaces/primevue/issues" "url": "https://github.com/primefaces/primevue/issues"
}, },
"main": "./index.ts", "main": "./index.ts",
"module": "./index.ts",
"publishConfig": { "publishConfig": {
"main": "./index.mjs", "main": "./index.mjs",
"module": "./index.mjs", "module": "./index.mjs",
@ -44,4 +45,4 @@
"engines": { "engines": {
"node": ">=12.11.0" "node": ">=12.11.0"
} }
} }

View File

@ -13,6 +13,7 @@
"bugs": { "bugs": {
"url": "https://github.com/primefaces/primevue/issues" "url": "https://github.com/primefaces/primevue/issues"
}, },
"types": "./src/index.d.ts",
"exports": { "exports": {
"./api": "./src/api/Api.js", "./api": "./src/api/Api.js",
"./base/style": "./src/base/style/BaseStyle.js", "./base/style": "./src/base/style/BaseStyle.js",
@ -25,7 +26,6 @@
"./usestyle": "./src/usestyle/UseStyle.js", "./usestyle": "./src/usestyle/UseStyle.js",
"./utils": "./src/utils/Utils.js" "./utils": "./src/utils/Utils.js"
}, },
"types": "./src/index.d.ts",
"publishConfig": { "publishConfig": {
"types": "./index.d.ts", "types": "./index.d.ts",
"exports": { "exports": {
@ -53,4 +53,4 @@
"engines": { "engines": {
"node": ">=12.11.0" "node": ">=12.11.0"
} }
} }

View File

@ -14,6 +14,8 @@
"url": "https://github.com/primefaces/primevue/issues" "url": "https://github.com/primefaces/primevue/issues"
}, },
"main": "./src/index.ts", "main": "./src/index.ts",
"module": "./src/index.ts",
"types": "./src/index.ts",
"publishConfig": { "publishConfig": {
"main": "./index.mjs", "main": "./index.mjs",
"module": "./index.mjs", "module": "./index.mjs",
@ -40,4 +42,4 @@
"engines": { "engines": {
"node": ">=12.11.0" "node": ">=12.11.0"
} }
} }

View File

@ -109,6 +109,7 @@ import type { TreeTablePassThroughOptions } from 'primevue/treetable';
import type { VirtualScrollerPassThroughOptions } from 'primevue/virtualscroller'; import type { VirtualScrollerPassThroughOptions } from 'primevue/virtualscroller';
export * from '@primevue/core/config'; export * from '@primevue/core/config';
export { default } from '@primevue/core/config';
export interface PrimeVueConfiguration { export interface PrimeVueConfiguration {
ripple?: boolean; ripple?: boolean;

View File

@ -14,6 +14,7 @@
"url": "https://github.com/primefaces/primevue/issues" "url": "https://github.com/primefaces/primevue/issues"
}, },
"main": "./src/index.js", "main": "./src/index.js",
"module": "./src/index.js",
"types": "./src/index.d.ts", "types": "./src/index.d.ts",
"exports": { "exports": {
".": "./src/index.js", ".": "./src/index.js",
@ -30,8 +31,20 @@
"types": "./index.d.ts", "types": "./index.d.ts",
"import": "./index.mjs" "import": "./index.mjs"
}, },
"./*": { "./aura/*": {
"types": "./types/*/index.d.ts", "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" "import": "./*/index.mjs"
} }
}, },
@ -49,4 +62,4 @@
"engines": { "engines": {
"node": ">=12.11.0" "node": ">=12.11.0"
} }
} }

View File

@ -1,5 +1,38 @@
import fs from 'fs-extra';
import path from 'path'; import path from 'path';
import { removeBuild, resolvePath, updatePackageJson } from '../../../scripts/build-helper.mjs'; import { removeBuild, resolvePath, updatePackageJson } from '../../../scripts/build-helper.mjs';
removeBuild(import.meta.url); 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));

View File

@ -150,5 +150,53 @@ export interface InputTextDesignTokens extends ColorSchemeDesignToken<InputTextD
* @designToken inputtext.transition.duration * @designToken inputtext.transition.duration
*/ */
transitionDuration?: string; transitionDuration?: string;
/**
* Sm of root
*/
sm?: {
/**
* Sm font size of root
*
* @designToken inputtext.sm.font.size
*/
fontSize?: string;
/**
* Sm padding x of root
*
* @designToken inputtext.sm.padding.x
*/
paddingX?: string;
/**
* Sm padding y of root
*
* @designToken inputtext.sm.padding.y
*/
paddingY?: string;
};
/**
* Lg of root
*/
lg?: {
/**
* Lg font size of root
*
* @designToken inputtext.lg.font.size
*/
fontSize?: string;
/**
* Lg padding x of root
*
* @designToken inputtext.lg.padding.x
*/
paddingX?: string;
/**
* Lg padding y of root
*
* @designToken inputtext.lg.padding.y
*/
paddingY?: string;
};
} }
} }