2023-07-03 22:20:35 +00:00
import { babel } from '@rollup/plugin-babel' ;
2022-09-10 14:15:16 +00:00
import postcss from 'rollup-plugin-postcss' ;
import { terser } from 'rollup-plugin-terser' ;
import vue from 'rollup-plugin-vue' ;
2023-10-24 18:06:20 +00:00
import fs from 'fs-extra' ;
import path from 'path' ;
import pkg from './package.json' ;
2022-09-10 14:15:16 +00:00
let entries = [ ] ;
let core = { } ;
2023-06-26 12:11:04 +00:00
const CORE _ICON _DEPENDENCIES = {
2023-04-01 01:15:53 +00:00
'primevue/baseicon' : 'primevue.baseicon' ,
2023-04-18 12:53:43 +00:00
'primevue/icons/angledoubledown' : 'primevue.icons.angledoubledown' ,
'primevue/icons/angledoubleleft' : 'primevue.icons.angledoubleleft' ,
'primevue/icons/angledoubleright' : 'primevue.icons.angledoubleright' ,
'primevue/icons/angledoubleup' : 'primevue.icons.angledoubleup' ,
'primevue/icons/angledown' : 'primevue.icons.angledown' ,
'primevue/icons/angleleft' : 'primevue.icons.angleleft' ,
'primevue/icons/angleright' : 'primevue.icons.angleright' ,
'primevue/icons/angleup' : 'primevue.icons.angleup' ,
'primevue/icons/arrowdown' : 'primevue.icons.arrowdown' ,
'primevue/icons/arrowup' : 'primevue.icons.arrowup' ,
'primevue/icons/ban' : 'primevue.icons.ban' ,
'primevue/icons/bars' : 'primevue.icons.bars' ,
2024-01-24 10:17:05 +00:00
'primevue/icons/blank' : 'primevue.icons.blank' ,
2023-04-18 12:53:43 +00:00
'primevue/icons/calendar' : 'primevue.icons.calendar' ,
'primevue/icons/check' : 'primevue.icons.check' ,
'primevue/icons/chevrondown' : 'primevue.icons.chevrondown' ,
'primevue/icons/chevronleft' : 'primevue.icons.chevronleft' ,
'primevue/icons/chevronright' : 'primevue.icons.chevronright' ,
'primevue/icons/chevronup' : 'primevue.icons.chevronup' ,
'primevue/icons/exclamationtriangle' : 'primevue.icons.exclamationtriangle' ,
'primevue/icons/eye' : 'primevue.icons.eye' ,
'primevue/icons/eyeslash' : 'primevue.icons.eyeslash' ,
'primevue/icons/filter' : 'primevue.icons.filter' ,
'primevue/icons/filterslash' : 'primevue.icons.filterslash' ,
'primevue/icons/infocircle' : 'primevue.icons.infocircle' ,
'primevue/icons/minus' : 'primevue.icons.minus' ,
'primevue/icons/pencil' : 'primevue.icons.pencil' ,
'primevue/icons/plus' : 'primevue.icons.plus' ,
'primevue/icons/refresh' : 'primevue.icons.refresh' ,
'primevue/icons/search' : 'primevue.icons.search' ,
'primevue/icons/searchminus' : 'primevue.icons.searchminus' ,
'primevue/icons/searchplus' : 'primevue.icons.searchplus' ,
'primevue/icons/sortalt' : 'primevue.icons.sortalt' ,
'primevue/icons/sortamountdown' : 'primevue.icons.sortamountdown' ,
'primevue/icons/sortamountupalt' : 'primevue.icons.sortamountupalt' ,
'primevue/icons/spinner' : 'primevue.icons.spinner' ,
'primevue/icons/star' : 'primevue.icons.star' ,
'primevue/icons/starfill' : 'primevue.icons.starfill' ,
'primevue/icons/thlarge' : 'primevue.icons.thlarge' ,
'primevue/icons/times' : 'primevue.icons.times' ,
'primevue/icons/timescircle' : 'primevue.icons.timescircle' ,
'primevue/icons/trash' : 'primevue.icons.trash' ,
'primevue/icons/undo' : 'primevue.icons.undo' ,
'primevue/icons/upload' : 'primevue.icons.upload' ,
'primevue/icons/windowmaximize' : 'primevue.icons.windowmaximize' ,
'primevue/icons/windowminimize' : 'primevue.icons.windowminimize'
2023-04-01 01:15:53 +00:00
} ;
2023-08-05 01:36:07 +00:00
const CORE _PASSTHROUGH _DEPENDENCIES = {
2024-03-26 14:12:37 +00:00
'primevue/passthrough' : 'primevue.passthrough'
2023-08-05 01:36:07 +00:00
} ;
2023-10-02 10:46:09 +00:00
const CORE _STYLE _DEPENDENCIES = {
'primevue/base/style' : 'primevue.base.style' ,
'primevue/basecomponent/style' : 'primevue.basecomponent.style' ,
'primevue/accordion/style' : 'primevue.accordion.style' ,
'primevue/accordiontab/style' : 'primevue.accordiontab.style' ,
2023-10-24 13:44:43 +00:00
'primevue/animateonscroll/style' : 'primevue.animateonscroll.style' ,
2023-10-02 10:46:09 +00:00
'primevue/autocomplete/style' : 'primevue.autocomplete.style' ,
'primevue/avatar/style' : 'primevue.avatar.style' ,
'primevue/avatargroup/style' : 'primevue.avatargroup.style' ,
'primevue/badge/style' : 'primevue.badge.style' ,
'primevue/badgedirective/style' : 'primevue.badgedirective.style' ,
'primevue/baseicon/style' : 'primevue.baseicon.style' ,
'primevue/blockui/style' : 'primevue.blockui.style' ,
'primevue/breadcrumb/style' : 'primevue.breadcrumb.style' ,
'primevue/button/style' : 'primevue.button.style' ,
2024-02-26 06:24:26 +00:00
'primevue/buttongroup/style' : 'primevue.buttongroup.style' ,
2023-10-02 10:46:09 +00:00
'primevue/calendar/style' : 'primevue.calendar.style' ,
'primevue/card/style' : 'primevue.card.style' ,
'primevue/carousel/style' : 'primevue.carousel.style' ,
'primevue/cascadeselect/style' : 'primevue.cascadeselect.style' ,
'primevue/chart/style' : 'primevue.chart.style' ,
'primevue/checkbox/style' : 'primevue.checkbox.style' ,
'primevue/chip/style' : 'primevue.chip.style' ,
'primevue/chips/style' : 'primevue.chips.style' ,
'primevue/colorpicker/style' : 'primevue.colorpicker.style' ,
'primevue/column/style' : 'primevue.column.style' ,
'primevue/columngroup/style' : 'primevue.columngroup.style' ,
'primevue/confirmdialog/style' : 'primevue.confirmdialog.style' ,
'primevue/confirmpopup/style' : 'primevue.confirmpopup.style' ,
'primevue/contextmenu/style' : 'primevue.contextmenu.style' ,
'primevue/datatable/style' : 'primevue.datatable.style' ,
'primevue/dataview/style' : 'primevue.dataview.style' ,
2024-04-18 14:13:33 +00:00
'primevue/datepicker/style' : 'primevue.datepicker.style' ,
2023-10-02 10:46:09 +00:00
'primevue/deferredcontent/style' : 'primevue.deferredcontent.style' ,
'primevue/dialog/style' : 'primevue.dialog.style' ,
'primevue/divider/style' : 'primevue.divider.style' ,
'primevue/dock/style' : 'primevue.dock.style' ,
2024-04-18 14:13:33 +00:00
'primevue/drawer/style' : 'primevue.drawer.style' ,
2023-10-02 10:46:09 +00:00
'primevue/dropdown/style' : 'primevue.dropdown.style' ,
'primevue/dynamicdialog/style' : 'primevue.dynamicdialog.style' ,
'primevue/editor/style' : 'primevue.editor.style' ,
'primevue/fieldset/style' : 'primevue.fieldset.style' ,
'primevue/fileupload/style' : 'primevue.fileupload.style' ,
'primevue/focustrap/style' : 'primevue.focustrap.style' ,
'primevue/galleria/style' : 'primevue.galleria.style' ,
'primevue/image/style' : 'primevue.image.style' ,
'primevue/inlinemessage/style' : 'primevue.inlinemessage.style' ,
'primevue/inplace/style' : 'primevue.inplace.style' ,
2024-04-18 14:13:33 +00:00
'primevue/inputchips/style' : 'primevue.inputchips.style' ,
2023-11-02 12:48:32 +00:00
'primevue/inputgroup/style' : 'primevue.inputgroup.style' ,
'primevue/inputgroupaddon/style' : 'primevue.inputgroupaddon.style' ,
2023-10-02 10:46:09 +00:00
'primevue/inputmask/style' : 'primevue.inputmask.style' ,
'primevue/inputnumber/style' : 'primevue.inputnumber.style' ,
2024-02-21 18:38:16 +00:00
'primevue/inputotp/style' : 'primevue.inputotp.style' ,
2023-10-02 10:46:09 +00:00
'primevue/inputswitch/style' : 'primevue.inputswitch.style' ,
'primevue/inputtext/style' : 'primevue.inputtext.style' ,
'primevue/knob/style' : 'primevue.knob.style' ,
'primevue/listbox/style' : 'primevue.listbox.style' ,
'primevue/megamenu/style' : 'primevue.megamenu.style' ,
'primevue/menu/style' : 'primevue.menu.style' ,
'primevue/menubar/style' : 'primevue.menubar.style' ,
'primevue/message/style' : 'primevue.message.style' ,
2024-01-16 18:24:48 +00:00
'primevue/metergroup/style' : 'primevue.metergroup.style' ,
2023-10-02 10:46:09 +00:00
'primevue/multiselect/style' : 'primevue.multiselect.style' ,
'primevue/orderlist/style' : 'primevue.orderlist.style' ,
'primevue/organizationchart/style' : 'primevue.organizationchart.style' ,
'primevue/overlaypanel/style' : 'primevue.overlaypanel.style' ,
'primevue/paginator/style' : 'primevue.paginator.style' ,
'primevue/panel/style' : 'primevue.panel.style' ,
'primevue/panelmenu/style' : 'primevue.panelmenu.style' ,
'primevue/password/style' : 'primevue.password.style' ,
'primevue/picklist/style' : 'primevue.picklist.style' ,
2024-04-18 14:13:33 +00:00
'primevue/popover/style' : 'primevue.popover.style' ,
2023-10-02 10:46:09 +00:00
'primevue/portal/style' : 'primevue.portal.style' ,
'primevue/progressbar/style' : 'primevue.progressbar.style' ,
'primevue/progressspinner/style' : 'primevue.progressspinner.style' ,
'primevue/radiobutton/style' : 'primevue.radiobutton.style' ,
'primevue/rating/style' : 'primevue.rating.style' ,
'primevue/ripple/style' : 'primevue.ripple.style' ,
'primevue/row/style' : 'primevue.row.style' ,
'primevue/scrollpanel/style' : 'primevue.scrollpanel.style' ,
'primevue/scrolltop/style' : 'primevue.scrolltop.style' ,
2024-04-18 14:13:33 +00:00
'primevue/select/style' : 'primevue.select.style' ,
2023-10-02 10:46:09 +00:00
'primevue/selectbutton/style' : 'primevue.selectbutton.style' ,
'primevue/sidebar/style' : 'primevue.sidebar.style' ,
'primevue/skeleton/style' : 'primevue.skeleton.style' ,
'primevue/slider/style' : 'primevue.slider.style' ,
'primevue/speeddial/style' : 'primevue.speeddial.style' ,
'primevue/splitbutton/style' : 'primevue.splitbutton.style' ,
'primevue/splitter/style' : 'primevue.splitter.style' ,
'primevue/splitterpanel/style' : 'primevue.splitterpanel.style' ,
2024-02-26 06:24:26 +00:00
'primevue/stepper/style' : 'primevue.stepper.style' ,
'primevue/stepperpanel/style' : 'primevue.stepperpanel.style' ,
2023-10-02 10:46:09 +00:00
'primevue/steps/style' : 'primevue.steps.style' ,
2024-03-31 04:44:48 +00:00
'primevue/styleclass/style' : 'primevue.styleclass.style' ,
2023-10-02 10:46:09 +00:00
'primevue/tabmenu/style' : 'primevue.tabmenu.style' ,
2024-04-19 13:51:57 +00:00
'primevue/tabs/style' : 'primevue.tabs.style' ,
'primevue/tablist/style' : 'primevue.tablist.style' ,
'primevue/tab/style' : 'primevue.tab.style' ,
'primevue/tabpanels/style' : 'primevue.tabpanels.style' ,
2023-10-02 10:46:09 +00:00
'primevue/tabpanel/style' : 'primevue.tabpanel.style' ,
'primevue/tabview/style' : 'primevue.tabview.style' ,
'primevue/tag/style' : 'primevue.tag.style' ,
'primevue/terminal/style' : 'primevue.terminal.style' ,
'primevue/textarea/style' : 'primevue.textarea.style' ,
'primevue/tieredmenu/style' : 'primevue.tieredmenu.style' ,
'primevue/timeline/style' : 'primevue.timeline.style' ,
'primevue/toast/style' : 'primevue.toast.style' ,
'primevue/togglebutton/style' : 'primevue.togglebutton.style' ,
2024-04-18 14:13:33 +00:00
'primevue/toggleswitch/style' : 'primevue.toggleswitch.style' ,
2023-10-02 10:46:09 +00:00
'primevue/toolbar/style' : 'primevue.toolbar.style' ,
'primevue/tooltip/style' : 'primevue.tooltip.style' ,
'primevue/tree/style' : 'primevue.tree.style' ,
'primevue/treeselect/style' : 'primevue.treeselect.style' ,
'primevue/treetable/style' : 'primevue.treetable.style' ,
'primevue/virtualscroller/style' : 'primevue.virtualscroller.style'
} ;
2024-03-27 13:13:15 +00:00
// prettier-ignore
2024-04-19 13:51:57 +00:00
const THEME _COMPONENTS = [ 'accordion' , 'autocomplete' , 'avatar' , 'badge' , 'blockui' , 'breadcrumb' , 'button' , 'buttongroup' , 'card' , 'carousel' , 'cascadeselect' , 'checkbox' , 'chip' , 'colorpicker' , 'confirmdialog' , 'confirmpopup' , 'contextmenu' , 'datatable' , 'dataview' , 'datepicker' , 'dialog' , 'divider' , 'dock' , 'drawer' , 'editor' , 'fieldset' , 'fileupload' , 'floatlabel' , 'galleria' , 'iconfield' , 'image' , 'inlinemessage' , 'inplace' , 'inputchips' , 'inputgroup' , 'inputnumber' , 'inputotp' , 'toggleswitch' , 'inputtext' , 'knob' , 'listbox' , 'megamenu' , 'menu' , 'menubar' , 'message' , 'metergroup' , 'multiselect' , 'orderlist' , 'organizationchart' , 'overlaypanel' , 'paginator' , 'panel' , 'panelmenu' , 'password' , 'picklist' , 'popover' , 'progressbar' , 'progressspinner' , 'radiobutton' , 'rating' , 'scrollpanel' , 'scrolltop' , 'select' , 'selectbutton' , 'skeleton' , 'slider' , 'speeddial' , 'splitbutton' , 'splitter' , 'steps' , 'stepper' , 'tabmenu' , 'tab' , 'tabview' , 'tag' , 'terminal' , 'textarea' , 'tieredmenu' , 'timeline' , 'toast' , 'togglebutton' , 'toggleswitch' , 'toolbar' , 'tooltip' , 'tree' , 'treeselect' , 'treetable' ] ;
2024-03-27 13:13:15 +00:00
const createThemeDependencies = ( design , presets ) => {
const baseDeps = THEME _COMPONENTS . reduce ( ( acc , name ) => {
acc [ ` primevue/themes/ ${ design } /base/ ${ name } ` ] = ` primevue.themes. ${ design } .base. ${ name } ` ;
return acc ;
} , { } ) ;
const presetDeps = presets ? . reduce ( ( p _acc , p _name ) => {
const p _alias = THEME _COMPONENTS . reduce ( ( acc , name ) => {
acc [ ` primevue/themes/ ${ design } /presets/ ${ p _name } / ${ name } ` ] = ` primevue.themes. ${ design } .presets. ${ p _name } . ${ name } ` ;
return acc ;
} , { } ) ;
p _acc = { ... p _acc , ... p _alias } ;
return p _acc ;
} , { } ) ;
const otherDeps = presets ? . reduce ( ( p _acc , p _name ) => {
p _acc = {
... p _acc ,
[ ` primevue/themes/ ${ design } /presets/ ${ p _name } ` ] : ` primevue.themes. ${ design } .presets. ${ p _name } ` ,
[ ` primevue/themes/ ${ design } / ${ p _name } ` ] : ` primevue.themes. ${ design } . ${ p _name } `
} ;
return p _acc ;
} , { } ) ;
const coreDeps = {
[ ` primevue/themes/ ${ design } /base/global ` ] : ` primevue.themes. ${ design } .base.global ` ,
[ ` primevue/themes/ ${ design } /base ` ] : ` primevue.themes. ${ design } .base ` ,
[ ` primevue/themes/ ${ design } ` ] : ` primevue.themes. ${ design } `
} ;
return { ... baseDeps , ... presetDeps , ... otherDeps , ... coreDeps } ;
} ;
const CORE _THEME _DEPENDENCIES = {
... createThemeDependencies ( 'primeone' , [ 'aura' ] ) ,
'primevue/themes/actions' : 'primevue.themes.actions' ,
'primevue/themes/config' : 'primevue.themes.config' ,
'primevue/themes/helpers' : 'primevue.themes.helpers' ,
'primevue/themes/service' : 'primevue.themes.service' ,
'primevue/themes/utils' : 'primevue.themes.utils' ,
'primevue/themes' : 'primevue.themes'
} ;
2023-06-26 12:11:04 +00:00
const CORE _DEPENDENCIES = {
2022-09-10 14:15:16 +00:00
'primevue/utils' : 'primevue.utils' ,
'primevue/api' : 'primevue.api' ,
'primevue/config' : 'primevue.config' ,
2024-04-01 09:49:35 +00:00
'primevue/styled' : 'primevue.styled' ,
'primevue/unstyled' : 'primevue.unstyled' ,
2023-10-19 05:45:22 +00:00
'primevue/base' : 'primevue.base' ,
2023-07-10 22:09:04 +00:00
'primevue/usestyle' : 'primevue.usestyle' ,
2023-11-06 10:56:53 +00:00
... CORE _STYLE _DEPENDENCIES ,
2023-06-21 13:48:00 +00:00
'primevue/basedirective' : 'primevue.basedirective' ,
2022-09-10 14:15:16 +00:00
'primevue/ripple' : 'primevue.ripple' ,
'primevue/portal' : 'primevue.portal' ,
2023-04-01 01:15:53 +00:00
'primevue/basecomponent' : 'primevue.basecomponent' ,
2023-06-26 12:11:04 +00:00
... CORE _ICON _DEPENDENCIES ,
2022-09-10 14:15:16 +00:00
'primevue/tooltip' : 'primevue.tooltip' ,
2022-12-09 08:12:43 +00:00
'primevue/focustrap' : 'primevue.focustrap' ,
2022-09-10 14:15:16 +00:00
'primevue/virtualscroller' : 'primevue.virtualscroller' ,
'primevue/confirmationeventbus' : 'primevue.confirmationeventbus' ,
'primevue/toasteventbus' : 'primevue.toasteventbus' ,
'primevue/overlayeventbus' : 'primevue.overlayeventbus' ,
'primevue/dynamicdialogeventbus' : 'primevue.dynamicdialogeventbus' ,
'primevue/terminalservice' : 'primevue.terminalservice' ,
'primevue/useconfirm' : 'primevue.useconfirm' ,
'primevue/usetoast' : 'primevue.usetoast' ,
'primevue/usedialog' : 'primevue.usedialog' ,
'primevue/button' : 'primevue.button' ,
'primevue/inputtext' : 'primevue.inputtext' ,
'primevue/inputnumber' : 'primevue.inputnumber' ,
2024-01-14 14:11:35 +00:00
'primevue/checkbox' : 'primevue.checkbox' ,
'primevue/radiobutton' : 'primevue.radiobutton' ,
2022-09-10 14:15:16 +00:00
'primevue/message' : 'primevue.message' ,
'primevue/progressbar' : 'primevue.progressbar' ,
'primevue/dialog' : 'primevue.dialog' ,
'primevue/paginator' : 'primevue.paginator' ,
'primevue/tree' : 'primevue.tree' ,
'primevue/menu' : 'primevue.menu' ,
2022-12-09 08:12:43 +00:00
'primevue/tieredmenu' : 'primevue.tieredmenu' ,
2023-07-25 11:53:01 +00:00
'primevue/badge' : 'primevue.badge' ,
2024-03-26 10:26:15 +00:00
'primevue/listbox' : 'primevue.listbox' ,
2024-04-08 12:20:42 +00:00
'primevue/chip' : 'primevue.chip' ,
2024-03-26 10:26:15 +00:00
'primevue/togglebutton' : 'primevue.togglebutton' ,
2024-04-18 14:13:33 +00:00
'primevue/popover' : 'primevue.popover' ,
'primevue/toggleswitch' : 'primevue.toggleswitch' ,
'primevue/inputchips' : 'primevue.inputchips' ,
'primevue/drawer' : 'primevue.drawer' ,
'primevue/datepicker' : 'primevue.datepicker' ,
'primevue/select' : 'primevue.select' ,
2024-03-27 13:13:15 +00:00
... CORE _PASSTHROUGH _DEPENDENCIES ,
... CORE _THEME _DEPENDENCIES
2022-09-10 14:15:16 +00:00
} ;
2023-06-26 12:11:04 +00:00
// dependencies
const GLOBAL _DEPENDENCIES = {
vue : 'Vue'
2022-09-10 14:15:16 +00:00
} ;
2023-06-26 12:11:04 +00:00
const GLOBAL _COMPONENT _DEPENDENCIES = {
... GLOBAL _DEPENDENCIES ,
... CORE _DEPENDENCIES
} ;
// externals
const EXTERNAL = [ 'vue' , 'chart.js/auto' , 'quill' ] ;
const EXTERNAL _COMPONENT = [ ... EXTERNAL , ... Object . keys ( CORE _DEPENDENCIES ) ] ;
// plugins
2023-07-03 22:20:35 +00:00
const BABEL _PLUGIN _OPTIONS = {
extensions : [ '.js' , '.vue' ] ,
exclude : 'node_modules/**' ,
presets : [ '@babel/preset-env' ] ,
plugins : [ ] ,
skipPreflightCheck : true ,
babelHelpers : 'runtime' ,
babelrc : false
} ;
2023-06-26 12:11:04 +00:00
const POSTCSS _PLUGIN _OPTIONS = {
sourceMap : false
} ;
const TERSER _PLUGIN _OPTIONS = {
compress : {
keep _infinity : true ,
pure _getters : true ,
reduce _funcs : false
}
} ;
2023-07-03 22:20:35 +00:00
const PLUGINS = [ vue ( ) , postcss ( POSTCSS _PLUGIN _OPTIONS ) , babel ( BABEL _PLUGIN _OPTIONS ) ] ;
2023-06-26 12:11:04 +00:00
2022-09-10 14:15:16 +00:00
function addEntry ( folder , inFile , outFile ) {
2024-04-01 09:49:35 +00:00
const exports = inFile . startsWith ( 'PrimeVue' ) || folder === 'passthrough/tailwind' ? 'named' : 'auto' ;
2023-06-26 12:11:04 +00:00
const useCorePlugin = Object . keys ( GLOBAL _COMPONENT _DEPENDENCIES ) . some ( ( d ) => d . replace ( 'primevue/' , '' ) === folder ) ;
const plugins = PLUGINS ;
const external = EXTERNAL _COMPONENT ;
const inlineDynamicImports = true ;
const input = ` components/lib/ ${ folder } / ${ inFile } ` ;
const output = ` dist/ ${ folder } / ${ outFile } ` ;
const getEntry = ( isMinify ) => {
return {
input ,
plugins : [ ... plugins , isMinify && terser ( TERSER _PLUGIN _OPTIONS ) , useCorePlugin && corePlugin ( ) ] ,
external ,
inlineDynamicImports
} ;
} ;
const get _CJS _ESM = ( isMinify ) => {
return {
... getEntry ( isMinify ) ,
output : [
{
format : 'cjs' ,
file : ` ${ output } .cjs ${ isMinify ? '.min' : '' } .js ` ,
exports
} ,
{
format : 'esm' ,
file : ` ${ output } .esm ${ isMinify ? '.min' : '' } .js ` ,
exports
}
]
} ;
} ;
const get _IIFE = ( isMinify ) => {
return {
... getEntry ( isMinify ) ,
output : [
{
format : 'iife' ,
name : 'primevue.' + folder . replaceAll ( '/' , '.' ) ,
file : ` ${ output } ${ isMinify ? '.min' : '' } .js ` ,
globals : GLOBAL _COMPONENT _DEPENDENCIES ,
exports
}
]
} ;
} ;
entries . push ( get _CJS _ESM ( ) ) ;
entries . push ( get _IIFE ( ) ) ;
// Minify
entries . push ( get _CJS _ESM ( true ) ) ;
entries . push ( get _IIFE ( true ) ) ;
2022-09-10 14:15:16 +00:00
}
function corePlugin ( ) {
return {
name : 'corePlugin' ,
generateBundle ( outputOptions , bundle ) {
2023-04-01 01:15:53 +00:00
const { name , format } = outputOptions ;
if ( format === 'iife' ) {
2022-09-10 14:15:16 +00:00
Object . keys ( bundle ) . forEach ( ( id ) => {
const chunk = bundle [ id ] ;
2023-04-01 01:15:53 +00:00
const folderName = name . replace ( 'primevue.' , '' ) . replaceAll ( '.' , '/' ) ;
2022-09-10 14:15:16 +00:00
const filePath = ` ./dist/core/core ${ id . indexOf ( '.min.js' ) > 0 ? '.min.js' : '.js' } ` ;
2023-04-01 01:15:53 +00:00
core [ filePath ] ? ( core [ filePath ] [ folderName ] = chunk . code ) : ( core [ filePath ] = { [ ` ${ folderName } ` ] : chunk . code } ) ;
2022-09-10 14:15:16 +00:00
} ) ;
}
}
} ;
}
function addCore ( ) {
const lastEntry = entries [ entries . length - 1 ] ;
lastEntry . plugins = [
... lastEntry . plugins ,
{
name : 'coreMergePlugin' ,
generateBundle ( ) {
Object . entries ( core ) . forEach ( ( [ filePath , value ] ) => {
2023-06-26 12:11:04 +00:00
const code = Object . keys ( CORE _DEPENDENCIES ) . reduce ( ( val , d ) => {
2022-09-10 14:15:16 +00:00
const name = d . replace ( 'primevue/' , '' ) ;
2022-09-14 14:49:38 +00:00
2022-09-10 14:15:16 +00:00
val += value [ name ] + '\n' ;
return val ;
} , '' ) ;
fs . outputFile ( path . resolve ( _ _dirname , filePath ) , code , { } , function ( err ) {
if ( err ) {
// eslint-disable-next-line no-console
return console . error ( err ) ;
}
} ) ;
} ) ;
}
}
] ;
}
function addSFC ( ) {
2023-03-26 05:22:57 +00:00
fs . readdirSync ( path . resolve ( _ _dirname , './components/lib' ) , { withFileTypes : true } )
2022-09-10 14:15:16 +00:00
. filter ( ( dir ) => dir . isDirectory ( ) )
. forEach ( ( { name : folderName } ) => {
2023-03-26 05:22:57 +00:00
fs . readdirSync ( path . resolve ( _ _dirname , './components/lib/' + folderName ) ) . forEach ( ( file ) => {
2022-09-10 14:15:16 +00:00
let name = file . split ( /(.vue)$|(.js)$/ ) [ 0 ] . toLowerCase ( ) ;
2022-12-20 12:32:32 +00:00
2022-09-10 14:15:16 +00:00
if ( /\.vue$/ . test ( file ) && name === folderName ) {
addEntry ( folderName , file , name ) ;
}
} ) ;
} ) ;
}
2023-04-01 01:15:53 +00:00
function addIcon ( ) {
2023-04-18 12:53:43 +00:00
fs . readdirSync ( path . resolve ( _ _dirname , './components/lib/icons' ) , { withFileTypes : true } )
2023-04-01 01:15:53 +00:00
. filter ( ( dir ) => dir . isDirectory ( ) )
. forEach ( ( { name : folderName } ) => {
2023-04-18 12:53:43 +00:00
fs . readdirSync ( path . resolve ( _ _dirname , './components/lib/icons/' + folderName ) ) . forEach ( ( file ) => {
2023-04-01 01:15:53 +00:00
if ( /\.vue$/ . test ( file ) ) {
2023-04-19 07:23:17 +00:00
addEntry ( 'icons/' + folderName , 'index.vue' , 'index' ) ;
2023-04-01 01:15:53 +00:00
}
} ) ;
} ) ;
}
2023-10-02 10:46:09 +00:00
function addStyle ( ) {
fs . readdirSync ( path . resolve ( _ _dirname , './components/lib' ) , { withFileTypes : true } )
. filter ( ( dir ) => dir . isDirectory ( ) )
. forEach ( ( { name : folderName } ) => {
try {
fs . readdirSync ( path . resolve ( _ _dirname , './components/lib/' + folderName + '/style' ) ) . forEach ( ( file ) => {
if ( /\.js$/ . test ( file ) ) {
let name = file . split ( /(.js)$/ ) [ 0 ] . toLowerCase ( ) ;
addEntry ( folderName + '/style' , file , name ) ;
}
} ) ;
} catch { }
} ) ;
}
2024-03-27 13:13:15 +00:00
function traverseDir ( dir , condition , callback ) {
try {
const files = fs . readdirSync ( dir ) ;
files . forEach ( ( file ) => {
const filePath = path . join ( dir , file ) ;
const fileStat = fs . statSync ( filePath ) ;
if ( fileStat . isDirectory ( ) ) {
traverseDir ( filePath , condition , callback ) ;
} else if ( condition ? . ( file ) && fileStat . isFile ( ) ) {
callback ? . ( file , filePath , dir ) ;
}
} ) ;
} catch { }
}
function addThemes ( ) {
traverseDir (
path . resolve ( _ _dirname , './components/lib/themes' ) ,
( file ) => file === 'index.js' ,
( file , filePath , folderPath ) => {
const searchFolder = '/components/lib/' ;
const fpath = folderPath . substring ( folderPath . indexOf ( searchFolder ) + searchFolder . length ) ;
addEntry ( fpath , file , 'index' ) ;
}
) ;
}
2022-09-10 14:15:16 +00:00
function addDirectives ( ) {
2023-07-03 22:20:35 +00:00
addEntry ( 'basedirective' , 'BaseDirective.js' , 'basedirective' ) ;
2022-09-10 14:15:16 +00:00
addEntry ( 'badgedirective' , 'BadgeDirective.js' , 'badgedirective' ) ;
addEntry ( 'ripple' , 'Ripple.js' , 'ripple' ) ;
addEntry ( 'tooltip' , 'Tooltip.js' , 'tooltip' ) ;
2022-12-09 08:12:43 +00:00
addEntry ( 'focustrap' , 'FocusTrap.js' , 'focustrap' ) ;
2022-09-10 14:15:16 +00:00
addEntry ( 'styleclass' , 'StyleClass.js' , 'styleclass' ) ;
2023-10-24 14:32:20 +00:00
addEntry ( 'animateonscroll' , 'AnimateOnScroll.js' , 'animateonscroll' ) ;
2022-09-10 14:15:16 +00:00
}
function addConfig ( ) {
addEntry ( 'config' , 'PrimeVue.js' , 'config' ) ;
2024-04-01 09:49:35 +00:00
addEntry ( 'styled' , 'PrimeVueStyled.js' , 'primevuestyled' ) ;
addEntry ( 'unstyled' , 'PrimeVueUnstyled.js' , 'primevueunstyled' ) ;
2022-09-10 14:15:16 +00:00
}
2023-08-05 01:36:07 +00:00
function addPassThrough ( ) {
addEntry ( 'passthrough' , 'index.js' , 'index' ) ;
2023-07-25 11:53:01 +00:00
}
2022-09-10 14:15:16 +00:00
function addUtils ( ) {
addEntry ( 'utils' , 'Utils.js' , 'utils' ) ;
}
function addApi ( ) {
addEntry ( 'api' , 'Api.js' , 'api' ) ;
}
2023-07-03 22:20:35 +00:00
function addBase ( ) {
addEntry ( 'base' , 'Base.js' , 'base' ) ;
}
2022-09-10 14:15:16 +00:00
function addServices ( ) {
addEntry ( 'confirmationservice' , 'ConfirmationService.js' , 'confirmationservice' ) ;
addEntry ( 'confirmationeventbus' , 'ConfirmationEventBus.js' , 'confirmationeventbus' ) ;
addEntry ( 'useconfirm' , 'UseConfirm.js' , 'useconfirm' ) ;
addEntry ( 'toastservice' , 'ToastService.js' , 'toastservice' ) ;
addEntry ( 'toasteventbus' , 'ToastEventBus.js' , 'toasteventbus' ) ;
addEntry ( 'overlayeventbus' , 'OverlayEventBus.js' , 'overlayeventbus' ) ;
addEntry ( 'usetoast' , 'UseToast.js' , 'usetoast' ) ;
2023-05-30 10:19:48 +00:00
addEntry ( 'usestyle' , 'UseStyle.js' , 'usestyle' ) ;
2022-09-10 14:15:16 +00:00
addEntry ( 'terminalservice' , 'TerminalService.js' , 'terminalservice' ) ;
addEntry ( 'usedialog' , 'UseDialog.js' , 'usedialog' ) ;
addEntry ( 'dialogservice' , 'DialogService.js' , 'dialogservice' ) ;
addEntry ( 'dynamicdialogeventbus' , 'DynamicDialogEventBus.js' , 'dynamicdialogeventbus' ) ;
}
2023-10-24 18:06:20 +00:00
function addPackageJson ( ) {
const outputDir = 'dist' ;
const packageJson = ` {
"name" : "primevue" ,
"version" : "${pkg.version}" ,
"private" : false ,
"author" : "PrimeTek Informatics" ,
"description" : "PrimeVue is an open source UI library for Vue featuring a rich set of 80+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeBlock, which has 370+ ready to use UI blocks to build spectacular applications in no time." ,
"homepage" : "https://primevue.org/" ,
"repository" : {
"type" : "git" ,
"url" : "https://github.com/primefaces/primevue.git"
} ,
"license" : "MIT" ,
"bugs" : {
"url" : "https://github.com/primefaces/primevue/issues"
} ,
"keywords" : [
"primevue" ,
"vue" ,
"vue.js" ,
"vue2" ,
"vue3" ,
"ui library" ,
"component library" ,
"material" ,
"bootstrap" ,
"fluent" ,
"tailwind" ,
"unstyled" ,
"passthrough"
] ,
"web-types" : "./web-types.json" ,
"vetur" : {
"tags" : "./vetur-tags.json" ,
"attributes" : "./vetur-attributes.json"
} ,
"peerDependencies" : {
"vue" : "^3.0.0"
}
} ` ;
! fs . existsSync ( outputDir ) && fs . mkdirSync ( outputDir ) ;
fs . writeFileSync ( path . resolve ( outputDir , 'package.json' ) , packageJson ) ;
}
2022-09-10 14:15:16 +00:00
addUtils ( ) ;
2023-10-02 10:46:09 +00:00
addStyle ( ) ;
2024-03-27 13:13:15 +00:00
addThemes ( ) ;
2023-07-03 22:20:35 +00:00
addBase ( ) ;
2022-09-10 14:15:16 +00:00
addApi ( ) ;
addConfig ( ) ;
addDirectives ( ) ;
addServices ( ) ;
addSFC ( ) ;
2023-04-01 01:15:53 +00:00
addIcon ( ) ;
2023-08-05 01:36:07 +00:00
addPassThrough ( ) ;
2023-07-25 12:55:24 +00:00
addCore ( ) ;
2023-10-24 18:06:20 +00:00
addPackageJson ( ) ;
2022-09-10 14:15:16 +00:00
export default entries ;