Refactor on bundle
parent
7ce0115342
commit
895532cfe7
|
@ -13,6 +13,7 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/primefaces/primevue/issues"
|
||||
},
|
||||
"main": "./src/index.js",
|
||||
"types": "./src/index.d.ts",
|
||||
"exports": {
|
||||
"./api": "./src/api/Api.js",
|
||||
|
@ -27,6 +28,7 @@
|
|||
"./utils": "./src/utils/Utils.js"
|
||||
},
|
||||
"publishConfig": {
|
||||
"main": "./index.mjs",
|
||||
"types": "./index.d.ts",
|
||||
"exports": {
|
||||
"./*": {
|
||||
|
@ -53,4 +55,4 @@
|
|||
"engines": {
|
||||
"node": ">=12.11.0"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -174,6 +174,7 @@ const ENTRY = {
|
|||
};
|
||||
|
||||
function addCore() {
|
||||
ENTRY.format.es({ input: process.env.INPUT_DIR + 'index.js', output: process.env.OUTPUT_DIR + 'index' });
|
||||
ENTRY.format.es({ input: process.env.INPUT_DIR + 'config/PrimeVue.js', output: process.env.OUTPUT_DIR + 'config/index' });
|
||||
ENTRY.format.es({ input: process.env.INPUT_DIR + 'service/PrimeVueService.js', output: process.env.OUTPUT_DIR + 'service/index' });
|
||||
}
|
||||
|
|
|
@ -41,3 +41,17 @@ export declare type DesignToken<T = void> = T | object | undefined;
|
|||
export declare type DefaultPassThrough<T = void> = T | ((instance?: VNode) => T | undefined) | undefined;
|
||||
|
||||
export declare type HintedString<T extends string> = (string & {}) | T;
|
||||
|
||||
/**
|
||||
* Modules
|
||||
*/
|
||||
export * from '@primevue/core/api';
|
||||
export * from '@primevue/core/base/style';
|
||||
export * from '@primevue/core/basecomponent';
|
||||
export * from '@primevue/core/basecomponent/style';
|
||||
export * from '@primevue/core/basedirective';
|
||||
export * from '@primevue/core/config';
|
||||
export { default as PrimeVue } from '@primevue/core/config';
|
||||
export * from '@primevue/core/service';
|
||||
export * from '@primevue/core/usestyle';
|
||||
export * from '@primevue/core/utils';
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
// Api
|
||||
export * from '@primevue/core/api';
|
||||
|
||||
// Base
|
||||
export { default as Base } from '@primevue/core/base';
|
||||
export { default as BaseStyle } from '@primevue/core/base/style';
|
||||
|
||||
// BaseComponent
|
||||
export { default as BaseComponent } from '@primevue/core/basecomponent';
|
||||
export { default as BaseComponentStyle } from '@primevue/core/basecomponent/style';
|
||||
|
||||
// BaseDirective
|
||||
export { default as BaseDirective } from '@primevue/core/basedirective';
|
||||
|
||||
// PrimeVue
|
||||
export * from '@primevue/core/config';
|
||||
export { default as PrimeVue } from '@primevue/core/config';
|
||||
|
||||
// PrimeVueService
|
||||
export { default as PrimeVueService } from '@primevue/core/service';
|
||||
|
||||
// UseStyle
|
||||
export * from '@primevue/core/usestyle';
|
||||
|
||||
// Utils
|
||||
export * from '@primevue/core/utils';
|
|
@ -43,4 +43,4 @@
|
|||
"engines": {
|
||||
"node": ">=12.11.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,11 +92,8 @@
|
|||
"./columngroup": "./src/columngroup/ColumnGroup.vue",
|
||||
"./columngroup/style": "./src/columngroup/style/ColumnGroupStyle.js",
|
||||
"./config": "./src/config/Config.js",
|
||||
"./config/style": "./src/config/style/ConfigStyle.js",
|
||||
"./confirmationeventbus": "./src/confirmationeventbus/ConfirmationEventBus.js",
|
||||
"./confirmationeventbus/style": "./src/confirmationeventbus/style/ConfirmationEventBusStyle.js",
|
||||
"./confirmationservice": "./src/confirmationservice/ConfirmationService.js",
|
||||
"./confirmationservice/style": "./src/confirmationservice/style/ConfirmationServiceStyle.js",
|
||||
"./confirmdialog": "./src/confirmdialog/ConfirmDialog.vue",
|
||||
"./confirmdialog/style": "./src/confirmdialog/style/ConfirmDialogStyle.js",
|
||||
"./confirmpopup": "./src/confirmpopup/ConfirmPopup.vue",
|
||||
|
@ -114,7 +111,6 @@
|
|||
"./dialog": "./src/dialog/Dialog.vue",
|
||||
"./dialog/style": "./src/dialog/style/DialogStyle.js",
|
||||
"./dialogservice": "./src/dialogservice/DialogService.js",
|
||||
"./dialogservice/style": "./src/dialogservice/style/DialogServiceStyle.js",
|
||||
"./divider": "./src/divider/Divider.vue",
|
||||
"./divider/style": "./src/divider/style/DividerStyle.js",
|
||||
"./dock": "./src/dock/Dock.vue",
|
||||
|
@ -126,7 +122,6 @@
|
|||
"./dynamicdialog": "./src/dynamicdialog/DynamicDialog.vue",
|
||||
"./dynamicdialog/style": "./src/dynamicdialog/style/DynamicDialogStyle.js",
|
||||
"./dynamicdialogeventbus": "./src/dynamicdialogeventbus/DynamicDialogEventBus.js",
|
||||
"./dynamicdialogeventbus/style": "./src/dynamicdialogeventbus/style/DynamicDialogEventBusStyle.js",
|
||||
"./editor": "./src/editor/Editor.vue",
|
||||
"./editor/style": "./src/editor/style/EditorStyle.js",
|
||||
"./fieldset": "./src/fieldset/Fieldset.vue",
|
||||
|
@ -188,7 +183,6 @@
|
|||
"./overlaybadge": "./src/overlaybadge/OverlayBadge.vue",
|
||||
"./overlaybadge/style": "./src/overlaybadge/style/OverlayBadgeStyle.js",
|
||||
"./overlayeventbus": "./src/overlayeventbus/OverlayEventBus.js",
|
||||
"./overlayeventbus/style": "./src/overlayeventbus/style/OverlayEventBusStyle.js",
|
||||
"./overlaypanel": "./src/overlaypanel/OverlayPanel.vue",
|
||||
"./overlaypanel/style": "./src/overlaypanel/style/OverlayPanelStyle.js",
|
||||
"./paginator": "./src/paginator/Paginator.vue",
|
||||
|
@ -276,7 +270,6 @@
|
|||
"./terminal": "./src/terminal/Terminal.vue",
|
||||
"./terminal/style": "./src/terminal/style/TerminalStyle.js",
|
||||
"./terminalservice": "./src/terminalservice/TerminalService.js",
|
||||
"./terminalservice/style": "./src/terminalservice/style/TerminalServiceStyle.js",
|
||||
"./textarea": "./src/textarea/Textarea.vue",
|
||||
"./textarea/style": "./src/textarea/style/TextareaStyle.js",
|
||||
"./tieredmenu": "./src/tieredmenu/TieredMenu.vue",
|
||||
|
@ -286,9 +279,7 @@
|
|||
"./toast": "./src/toast/Toast.vue",
|
||||
"./toast/style": "./src/toast/style/ToastStyle.js",
|
||||
"./toasteventbus": "./src/toasteventbus/ToastEventBus.js",
|
||||
"./toasteventbus/style": "./src/toasteventbus/style/ToastEventBusStyle.js",
|
||||
"./toastservice": "./src/toastservice/ToastService.js",
|
||||
"./toastservice/style": "./src/toastservice/style/ToastServiceStyle.js",
|
||||
"./togglebutton": "./src/togglebutton/ToggleButton.vue",
|
||||
"./togglebutton/style": "./src/togglebutton/style/ToggleButtonStyle.js",
|
||||
"./toggleswitch": "./src/toggleswitch/ToggleSwitch.vue",
|
||||
|
@ -304,13 +295,9 @@
|
|||
"./treetable": "./src/treetable/TreeTable.vue",
|
||||
"./treetable/style": "./src/treetable/style/TreeTableStyle.js",
|
||||
"./useconfirm": "./src/useconfirm/UseConfirm.js",
|
||||
"./useconfirm/style": "./src/useconfirm/style/UseConfirmStyle.js",
|
||||
"./usedialog": "./src/usedialog/UseDialog.js",
|
||||
"./usedialog/style": "./src/usedialog/style/UseDialogStyle.js",
|
||||
"./usestyle": "./src/usestyle/UseStyle.js",
|
||||
"./usestyle/style": "./src/usestyle/style/UseStyleStyle.js",
|
||||
"./usetoast": "./src/usetoast/UseToast.js",
|
||||
"./usetoast/style": "./src/usetoast/style/UseToastStyle.js",
|
||||
"./virtualscroller": "./src/virtualscroller/VirtualScroller.vue",
|
||||
"./virtualscroller/style": "./src/virtualscroller/style/VirtualScrollerStyle.js",
|
||||
"./*": "./*"
|
||||
|
|
|
@ -53,6 +53,7 @@ const ALIAS_ENTRIES = [
|
|||
{ find: '@primevue/core/service', replacement: path.resolve(__dirname, '../core/src/service/PrimeVueService.js') },
|
||||
{ find: '@primevue/core/usestyle', replacement: path.resolve(__dirname, '../core/src/usestyle/UseStyle.js') },
|
||||
{ find: '@primevue/core/utils', replacement: path.resolve(__dirname, '../core/src/utils/Utils.js') },
|
||||
{ find: '@primevue/core', replacement: path.resolve(__dirname, '../core/src/index.js') },
|
||||
{ find: '@primevue/icons/baseicon/style', replacement: path.resolve(__dirname, '../icons/src/baseicon/style/BaseIconStyle.js') },
|
||||
{ find: '@primevue/icons/baseicon', replacement: path.resolve(__dirname, '../icons/src/baseicon/BaseIcon.vue') },
|
||||
{ find: '@primevue/themes', replacement: path.resolve(__dirname, '../themes/src/index.js') }
|
||||
|
|
|
@ -12,24 +12,83 @@ updatePackageJson(pkg);
|
|||
|
||||
// update package.json > "exports" for local
|
||||
let exports = {};
|
||||
let umd = {
|
||||
ignoredFolders: ['useconfirm', 'usedialog', 'usetoast', 'usestyle'],
|
||||
exports: [
|
||||
`// API
|
||||
export * from '@primevue/core';
|
||||
|
||||
// BaseIcon
|
||||
export { default as BaseIcon } from '@primevue/icons/baseicon';
|
||||
export { default as BaseIconStyle } from '@primevue/icons/baseicon/style';
|
||||
|
||||
// Themes
|
||||
export * from '@primevue/themes';
|
||||
|
||||
// UseConfirm
|
||||
export * from './useconfirm/UseConfirm.js';
|
||||
|
||||
// UseDialog
|
||||
export * from './usedialog/UseDialog.js';
|
||||
|
||||
// UseToast
|
||||
export * from './usetoast/UseToast.js';
|
||||
|
||||
// UseStyle
|
||||
export * from './usestyle/UseStyle.js';
|
||||
`
|
||||
]
|
||||
};
|
||||
|
||||
fs.readdirSync(path.resolve(__root, INPUT_DIR), { withFileTypes: true })
|
||||
.filter((dir) => dir.isDirectory())
|
||||
.forEach(({ name: folderName }) => {
|
||||
fs.readdirSync(path.resolve(__root, INPUT_DIR + folderName)).forEach((file) => {
|
||||
const folderPath = path.resolve(__root, INPUT_DIR + folderName);
|
||||
|
||||
fs.readdirSync(folderPath).forEach((file) => {
|
||||
let fileName = file.split(/(.vue)$|(.js)$/)[0];
|
||||
let name = fileName.toLowerCase();
|
||||
|
||||
if (name === folderName) {
|
||||
const validUMDFolder = !umd.ignoredFolders.includes(folderName);
|
||||
|
||||
exports[`./${folderName}`] = `./${INPUT_DIR}${folderName}/${file}`;
|
||||
exports[`./${folderName}/style`] = `./${INPUT_DIR}${folderName}/style/${fileName}Style.js`;
|
||||
validUMDFolder &&
|
||||
umd.exports.push(
|
||||
`
|
||||
// ${fileName}
|
||||
export * from './${folderName}/${file}';
|
||||
export { default as ${fileName} } from './${folderName}/${file}';
|
||||
`
|
||||
);
|
||||
|
||||
try {
|
||||
fs.readdirSync(folderPath + '/style').forEach((file) => {
|
||||
let subFileName = file.split(/(.js)$/)[0];
|
||||
let subName = subFileName.toLowerCase();
|
||||
|
||||
if (subName === `${folderName}style`) {
|
||||
exports[`./${folderName}/style`] = `./${INPUT_DIR}${folderName}/style/${file}`;
|
||||
validUMDFolder &&
|
||||
umd.exports.push(
|
||||
`export * from './${folderName}/style/${file}';
|
||||
export { default as ${subFileName} } from './${folderName}/style/${file}';
|
||||
`
|
||||
);
|
||||
}
|
||||
});
|
||||
} catch {}
|
||||
}
|
||||
});
|
||||
});
|
||||
exports['./*'] = './*';
|
||||
|
||||
// package.json
|
||||
const pkgJson = JSON.parse(fs.readFileSync(pkg, { encoding: 'utf8', flag: 'r' }));
|
||||
|
||||
pkgJson.exports = exports;
|
||||
|
||||
fs.writeFileSync(pkg, JSON.stringify(pkgJson, null, 4));
|
||||
|
||||
// UMD
|
||||
fs.writeFileSync(INPUT_DIR + 'primevue.js', umd.exports.join(''));
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// API
|
||||
export * from '@primevue/core';
|
||||
|
||||
// BaseIcon
|
||||
export { default as BaseIcon } from '@primevue/icons/baseicon';
|
||||
export { default as BaseIconStyle } from '@primevue/icons/baseicon/style';
|
||||
|
||||
// Themes
|
||||
export * from '@primevue/themes';
|
||||
|
||||
// UseConfirm
|
||||
export * from './useconfirm/UseConfirm.js';
|
||||
|
||||
// UseDialog
|
||||
export * from './usedialog/UseDialog.js';
|
||||
|
||||
// UseToast
|
||||
export * from './usetoast/UseToast.js';
|
||||
|
||||
// UseStyle
|
||||
export * from './usestyle/UseStyle.js';
|
||||
|
||||
// Accordion
|
||||
export * from './accordion/Accordion.vue';
|
||||
export { default as Accordion } from './accordion/Accordion.vue';
|
||||
|
@ -34,9 +56,6 @@ export { default as AnimateOnScroll } from './animateonscroll/AnimateOnScroll.js
|
|||
export * from './animateonscroll/style/AnimateOnScrollStyle.js';
|
||||
export { default as AnimateOnScrollStyle } from './animateonscroll/style/AnimateOnScrollStyle.js';
|
||||
|
||||
// Api
|
||||
export * from '@primevue/core/api';
|
||||
|
||||
// AutoComplete
|
||||
export * from './autocomplete/AutoComplete.vue';
|
||||
export { default as AutoComplete } from './autocomplete/AutoComplete.vue';
|
||||
|
@ -67,28 +86,6 @@ export { default as BadgeDirective } from './badgedirective/BadgeDirective.js';
|
|||
export * from './badgedirective/style/BadgeDirectiveStyle.js';
|
||||
export { default as BadgeDirectiveStyle } from './badgedirective/style/BadgeDirectiveStyle.js';
|
||||
|
||||
// Base
|
||||
export * from '@primevue/core/base';
|
||||
export { default as Base } from '@primevue/core/base';
|
||||
export * from '@primevue/core/base/style';
|
||||
export { default as BaseStyle } from '@primevue/core/base/style';
|
||||
|
||||
// BaseComponent
|
||||
export * from '@primevue/core/basecomponent';
|
||||
export { default as BaseComponent } from '@primevue/core/basecomponent';
|
||||
export * from '@primevue/core/basecomponent/style';
|
||||
export { default as BaseComponentStyle } from '@primevue/core/basecomponent/style';
|
||||
|
||||
// BaseDirective
|
||||
export * from '@primevue/core/basedirective';
|
||||
export { default as BaseDirective } from '@primevue/core/basedirective';
|
||||
|
||||
// BaseIcon
|
||||
export * from '@primevue/icons/baseicon';
|
||||
export { default as BaseIcon } from '@primevue/icons/baseicon';
|
||||
export * from '@primevue/icons/baseicon/style';
|
||||
export { default as BaseIconStyle } from '@primevue/icons/baseicon/style';
|
||||
|
||||
// BlockUI
|
||||
export * from './blockui/BlockUI.vue';
|
||||
export { default as BlockUI } from './blockui/BlockUI.vue';
|
||||
|
@ -180,8 +177,8 @@ export * from './columngroup/style/ColumnGroupStyle.js';
|
|||
export { default as ColumnGroupStyle } from './columngroup/style/ColumnGroupStyle.js';
|
||||
|
||||
// Config
|
||||
export * from '@primevue/core/config';
|
||||
export { default as Config } from '@primevue/core/config';
|
||||
export * from './config/Config.js';
|
||||
export { default as Config } from './config/Config.js';
|
||||
|
||||
// ConfirmationEventBus
|
||||
export * from './confirmationeventbus/ConfirmationEventBus.js';
|
||||
|
@ -277,6 +274,12 @@ export { default as DynamicDialogStyle } from './dynamicdialog/style/DynamicDial
|
|||
export * from './dynamicdialogeventbus/DynamicDialogEventBus.js';
|
||||
export { default as DynamicDialogEventBus } from './dynamicdialogeventbus/DynamicDialogEventBus.js';
|
||||
|
||||
// Editor
|
||||
export * from './editor/Editor.vue';
|
||||
export { default as Editor } from './editor/Editor.vue';
|
||||
export * from './editor/style/EditorStyle.js';
|
||||
export { default as EditorStyle } from './editor/style/EditorStyle.js';
|
||||
|
||||
// Fieldset
|
||||
export * from './fieldset/Fieldset.vue';
|
||||
export { default as Fieldset } from './fieldset/Fieldset.vue';
|
||||
|
@ -289,6 +292,12 @@ export { default as FileUpload } from './fileupload/FileUpload.vue';
|
|||
export * from './fileupload/style/FileUploadStyle.js';
|
||||
export { default as FileUploadStyle } from './fileupload/style/FileUploadStyle.js';
|
||||
|
||||
// FloatLabel
|
||||
export * from './floatlabel/FloatLabel.vue';
|
||||
export { default as FloatLabel } from './floatlabel/FloatLabel.vue';
|
||||
export * from './floatlabel/style/FloatLabelStyle.js';
|
||||
export { default as FloatLabelStyle } from './floatlabel/style/FloatLabelStyle.js';
|
||||
|
||||
// FocusTrap
|
||||
export * from './focustrap/FocusTrap.js';
|
||||
export { default as FocusTrap } from './focustrap/FocusTrap.js';
|
||||
|
@ -473,9 +482,6 @@ export { default as PanelMenu } from './panelmenu/PanelMenu.vue';
|
|||
export * from './panelmenu/style/PanelMenuStyle.js';
|
||||
export { default as PanelMenuStyle } from './panelmenu/style/PanelMenuStyle.js';
|
||||
|
||||
// PassThrough
|
||||
export * from './passthrough/index.js';
|
||||
|
||||
// Password
|
||||
export * from './password/Password.vue';
|
||||
export { default as Password } from './password/Password.vue';
|
||||
|
@ -560,10 +566,6 @@ export { default as SelectButton } from './selectbutton/SelectButton.vue';
|
|||
export * from './selectbutton/style/SelectButtonStyle.js';
|
||||
export { default as SelectButtonStyle } from './selectbutton/style/SelectButtonStyle.js';
|
||||
|
||||
// PrimeVueService
|
||||
export * from '@primevue/core/service';
|
||||
export { default as PrimeVueService } from '@primevue/core/service';
|
||||
|
||||
// Sidebar
|
||||
export * from './sidebar/Sidebar.vue';
|
||||
export { default as Sidebar } from './sidebar/Sidebar.vue';
|
||||
|
@ -606,6 +608,36 @@ export { default as SplitterPanel } from './splitterpanel/SplitterPanel.vue';
|
|||
export * from './splitterpanel/style/SplitterPanelStyle.js';
|
||||
export { default as SplitterPanelStyle } from './splitterpanel/style/SplitterPanelStyle.js';
|
||||
|
||||
// Step
|
||||
export * from './step/Step.vue';
|
||||
export { default as Step } from './step/Step.vue';
|
||||
export * from './step/style/StepStyle.js';
|
||||
export { default as StepStyle } from './step/style/StepStyle.js';
|
||||
|
||||
// StepItem
|
||||
export * from './stepitem/StepItem.vue';
|
||||
export { default as StepItem } from './stepitem/StepItem.vue';
|
||||
export * from './stepitem/style/StepItemStyle.js';
|
||||
export { default as StepItemStyle } from './stepitem/style/StepItemStyle.js';
|
||||
|
||||
// StepList
|
||||
export * from './steplist/StepList.vue';
|
||||
export { default as StepList } from './steplist/StepList.vue';
|
||||
export * from './steplist/style/StepListStyle.js';
|
||||
export { default as StepListStyle } from './steplist/style/StepListStyle.js';
|
||||
|
||||
// StepPanel
|
||||
export * from './steppanel/StepPanel.vue';
|
||||
export { default as StepPanel } from './steppanel/StepPanel.vue';
|
||||
export * from './steppanel/style/StepPanelStyle.js';
|
||||
export { default as StepPanelStyle } from './steppanel/style/StepPanelStyle.js';
|
||||
|
||||
// StepPanels
|
||||
export * from './steppanels/StepPanels.vue';
|
||||
export { default as StepPanels } from './steppanels/StepPanels.vue';
|
||||
export * from './steppanels/style/StepPanelsStyle.js';
|
||||
export { default as StepPanelsStyle } from './steppanels/style/StepPanelsStyle.js';
|
||||
|
||||
// Stepper
|
||||
export * from './stepper/Stepper.vue';
|
||||
export { default as Stepper } from './stepper/Stepper.vue';
|
||||
|
@ -762,26 +794,8 @@ export { default as TreeTable } from './treetable/TreeTable.vue';
|
|||
export * from './treetable/style/TreeTableStyle.js';
|
||||
export { default as TreeTableStyle } from './treetable/style/TreeTableStyle.js';
|
||||
|
||||
// UseConfirm
|
||||
export * from './useconfirm/UseConfirm.js';
|
||||
|
||||
// UseDialog
|
||||
export * from './usedialog/UseDialog.js';
|
||||
|
||||
// UseStyle
|
||||
export * from './usestyle/UseStyle.js';
|
||||
|
||||
// UseToast
|
||||
export * from './usetoast/UseToast.js';
|
||||
|
||||
// Utils
|
||||
export * from '@primevue/core/utils';
|
||||
|
||||
// VirtualScroller
|
||||
export * from './virtualscroller/VirtualScroller.vue';
|
||||
export { default as VirtualScroller } from './virtualscroller/VirtualScroller.vue';
|
||||
export * from './virtualscroller/style/VirtualScrollerStyle.js';
|
||||
export { default as VirtualScrollerStyle } from './virtualscroller/style/VirtualScrollerStyle.js';
|
||||
|
||||
// Themes
|
||||
export * from '@primevue/themes';
|
||||
|
|
Loading…
Reference in New Issue