@lingxiteam/ebe-utils 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +217 -0
- package/bin/ebe.js +7 -0
- package/es/constants.d.ts +2 -0
- package/es/constants.js +183 -0
- package/es/index.d.ts +64 -0
- package/es/index.js +539 -0
- package/es/node/babel/getAllImportFiles.d.ts +1 -0
- package/es/node/babel/getAllImportFiles.js +79 -0
- package/es/node/babel/getRealPath.d.ts +5 -0
- package/es/node/babel/getRealPath.js +40 -0
- package/es/node/babel/parse.d.ts +6 -0
- package/es/node/babel/parse.js +20 -0
- package/es/node/cli.d.ts +1 -0
- package/es/node/cli.js +87 -0
- package/es/node/constants.d.ts +1 -0
- package/es/node/constants.js +3 -0
- package/es/node/copyStatic.d.ts +6 -0
- package/es/node/copyStatic.js +25 -0
- package/es/node/move.d.ts +5 -0
- package/es/node/move.js +64 -0
- package/es/node/setup.d.ts +4 -0
- package/es/node/setup.js +40 -0
- package/es/shims.d.ts +4 -0
- package/es/types.d.ts +14 -0
- package/es/types.js +1 -0
- package/lib/node/babel/getAllImportFiles.d.ts +1 -0
- package/lib/node/babel/getAllImportFiles.js +106 -0
- package/lib/node/babel/getRealPath.d.ts +5 -0
- package/lib/node/babel/getRealPath.js +59 -0
- package/lib/node/babel/parse.d.ts +6 -0
- package/lib/node/babel/parse.js +64 -0
- package/lib/node/cli.d.ts +1 -0
- package/lib/node/cli.js +37 -0
- package/lib/node/constants.d.ts +1 -0
- package/lib/node/constants.js +30 -0
- package/lib/node/copyStatic.d.ts +6 -0
- package/lib/node/copyStatic.js +57 -0
- package/lib/node/move.d.ts +5 -0
- package/lib/node/move.js +66 -0
- package/lib/node/setup.d.ts +4 -0
- package/lib/node/setup.js +43 -0
- package/lib/public/.editorconfig +17 -0
- package/lib/public/.prettierignore +15 -0
- package/lib/public/.stylelintrc.js +3 -0
- package/lib/public/deploy.sh +48 -0
- package/lib/public/docker/Dockerfile +11 -0
- package/lib/public/docker/default.conf +24 -0
- package/lib/public/src/assets/pageicon/closeIcon.png +0 -0
- package/lib/public/src/assets/pageicon/deleteIcon.png +0 -0
- package/lib/public/src/assets/pageicon/downloadIcon.png +0 -0
- package/lib/public/src/assets/pageicon/excel.png +0 -0
- package/lib/public/src/assets/pageicon/ico-container-drawer.png +0 -0
- package/lib/public/src/assets/pageicon/ico-container-modal.png +0 -0
- package/lib/public/src/assets/pageicon/ico-container-page.png +0 -0
- package/lib/public/src/assets/pageicon/index.ts +25 -0
- package/lib/public/src/assets/pageicon/leftIcon.png +0 -0
- package/lib/public/src/assets/pageicon/rightIcon.png +0 -0
- package/lib/public/src/assets/pageicon/zoomInIcon.png +0 -0
- package/lib/public/src/assets/pageicon/zoomOutIcon.png +0 -0
- package/lib/public/src/components/ExpBusiObjModal/index.less +28 -0
- package/lib/public/src/components/ExpBusiObjModal/index.tsx +315 -0
- package/lib/public/src/components/ExpSQLServiceModal/index.less +28 -0
- package/lib/public/src/components/ExpSQLServiceModal/index.tsx +295 -0
- package/lib/public/src/components/IconFont/IconFont.tsx +26 -0
- package/lib/public/src/components/IconFont/index.ts +1 -0
- package/lib/public/src/components/ImportBusiObjModal/index.less +262 -0
- package/lib/public/src/components/ImportBusiObjModal/index.tsx +1243 -0
- package/lib/public/src/components/LoaderHelper/index.tsx +29 -0
- package/lib/public/src/components/PreviewFile/index.less +200 -0
- package/lib/public/src/components/PreviewFile/index.tsx +787 -0
- package/lib/public/src/components/PreviewFile/utils.ts +90 -0
- package/lib/public/src/components/ProgressComp/ProgressComp.less +64 -0
- package/lib/public/src/components/ProgressComp/ProgressComp.tsx +34 -0
- package/lib/public/src/components/ProgressComp/index.tsx +153 -0
- package/lib/public/src/components/common/ExpBusiObjModal/index.less +28 -0
- package/lib/public/src/components/common/ExpBusiObjModal/index.tsx +315 -0
- package/lib/public/src/components/common/PreviewFile/index.less +200 -0
- package/lib/public/src/components/common/PreviewFile/index.tsx +787 -0
- package/lib/public/src/components/common/PreviewFile/utils.ts +90 -0
- package/lib/public/src/components/pcfactory/src/Alert/index.tsx +22 -0
- package/lib/public/src/components/pcfactory/src/Animation/index.tsx +186 -0
- package/lib/public/src/components/pcfactory/src/Animation/useAnimation.ts +270 -0
- package/lib/public/src/components/pcfactory/src/Animation/useBackgroundStyle.ts +74 -0
- package/lib/public/src/components/pcfactory/src/Audio/index.tsx +240 -0
- package/lib/public/src/components/pcfactory/src/BarChart/index.tsx +3 -0
- package/lib/public/src/components/pcfactory/src/Button/index.tsx +151 -0
- package/lib/public/src/components/pcfactory/src/Card/index.tsx +201 -0
- package/lib/public/src/components/pcfactory/src/Card/useExtendBtn.tsx +195 -0
- package/lib/public/src/components/pcfactory/src/Cascader/index.tsx +398 -0
- package/lib/public/src/components/pcfactory/src/ChartBar/index.tsx +15 -0
- package/lib/public/src/components/pcfactory/src/ChartBar/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/ChartLine/ChartLine.tsx +48 -0
- package/lib/public/src/components/pcfactory/src/ChartLine/PropsType.ts +88 -0
- package/lib/public/src/components/pcfactory/src/ChartLine/index.tsx +15 -0
- package/lib/public/src/components/pcfactory/src/ChartLine/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/Checkbox/index.tsx +144 -0
- package/lib/public/src/components/pcfactory/src/CheckboxGroup/index.tsx +319 -0
- package/lib/public/src/components/pcfactory/src/Collapse/index.tsx +195 -0
- package/lib/public/src/components/pcfactory/src/CollapsePanel/index.tsx +186 -0
- package/lib/public/src/components/pcfactory/src/Condition/index.tsx +22 -0
- package/lib/public/src/components/pcfactory/src/DatePicker/index.tsx +756 -0
- package/lib/public/src/components/pcfactory/src/Description/index.tsx +447 -0
- package/lib/public/src/components/pcfactory/src/Description/utils/getLabelSizeMode.ts +40 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/CenterLineDivider/index.tsx +190 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/CenterTabDivider/index.tsx +77 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/LeftCardDivider/index.tsx +87 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/LeftLineDivider/index.tsx +106 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/LeftTabDivider/index.tsx +60 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/LeftTopDivider/index.tsx +55 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/LxDashed/index.module.less +10 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/LxDashed/index.tsx +143 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/LxSolid/index.module.less +10 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/LxSolid/index.tsx +126 -0
- package/lib/public/src/components/pcfactory/src/Divider/index.tsx +210 -0
- package/lib/public/src/components/pcfactory/src/Dropdown/index.tsx +385 -0
- package/lib/public/src/components/pcfactory/src/DynamicTabs/PropsType.ts +31 -0
- package/lib/public/src/components/pcfactory/src/DynamicTabs/TabPage.tsx +63 -0
- package/lib/public/src/components/pcfactory/src/DynamicTabs/index.tsx +214 -0
- package/lib/public/src/components/pcfactory/src/Form/Form.tsx +600 -0
- package/lib/public/src/components/pcfactory/src/Form/WrapperForm.ts +14 -0
- package/lib/public/src/components/pcfactory/src/Form/index.tsx +15 -0
- package/lib/public/src/components/pcfactory/src/Form/useFormStatus.ts +47 -0
- package/lib/public/src/components/pcfactory/src/Form/useMonitor.ts +40 -0
- package/lib/public/src/components/pcfactory/src/FormGroup/TitleComp.tsx +107 -0
- package/lib/public/src/components/pcfactory/src/FormGroup/index.tsx +181 -0
- package/lib/public/src/components/pcfactory/src/FreeLayout/index.tsx +151 -0
- package/lib/public/src/components/pcfactory/src/Gantt/Gantt.tsx +460 -0
- package/lib/public/src/components/pcfactory/src/Gantt/const.ts +122 -0
- package/lib/public/src/components/pcfactory/src/Gantt/index.tsx +16 -0
- package/lib/public/src/components/pcfactory/src/Gantt/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/GridView/GridView.tsx +435 -0
- package/lib/public/src/components/pcfactory/src/GridView/index.tsx +24 -0
- package/lib/public/src/components/pcfactory/src/GridView/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/HorizontalView/index.tsx +32 -0
- package/lib/public/src/components/pcfactory/src/Icon/IconED/index.tsx +42 -0
- package/lib/public/src/components/pcfactory/src/Icon/PropsType.ts +57 -0
- package/lib/public/src/components/pcfactory/src/Icon/hooks/index.tsx +300 -0
- package/lib/public/src/components/pcfactory/src/Icon/index.tsx +69 -0
- package/lib/public/src/components/pcfactory/src/IconFont/index.tsx +24 -0
- package/lib/public/src/components/pcfactory/src/Img/BasicImage/index.tsx +90 -0
- package/lib/public/src/components/pcfactory/src/Img/assets/placeholder.png +0 -0
- package/lib/public/src/components/pcfactory/src/Img/index.tsx +91 -0
- package/lib/public/src/components/pcfactory/src/Input/index.tsx +425 -0
- package/lib/public/src/components/pcfactory/src/InputNumber/index.tsx +263 -0
- package/lib/public/src/components/pcfactory/src/LXPieChart/LXPieChart.tsx +23 -0
- package/lib/public/src/components/pcfactory/src/LXPieChart/PropsType.ts +11 -0
- package/lib/public/src/components/pcfactory/src/LXPieChart/index.less +6 -0
- package/lib/public/src/components/pcfactory/src/LXPieChart/index.tsx +15 -0
- package/lib/public/src/components/pcfactory/src/LXPieChart/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/LXRadarChart/LXRadarChat.tsx +25 -0
- package/lib/public/src/components/pcfactory/src/LXRadarChart/PropsType.ts +9 -0
- package/lib/public/src/components/pcfactory/src/LXRadarChart/index.less +7 -0
- package/lib/public/src/components/pcfactory/src/LXRadarChart/index.tsx +17 -0
- package/lib/public/src/components/pcfactory/src/LXRadarChart/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/Layout/index.tsx +130 -0
- package/lib/public/src/components/pcfactory/src/Layout/utils.ts +48 -0
- package/lib/public/src/components/pcfactory/src/LineChart/index.tsx +3 -0
- package/lib/public/src/components/pcfactory/src/Link/index.tsx +117 -0
- package/lib/public/src/components/pcfactory/src/LoopList/index.tsx +551 -0
- package/lib/public/src/components/pcfactory/src/Menu/index.tsx +422 -0
- package/lib/public/src/components/pcfactory/src/ModalSelect/BaseModalSelect.tsx +95 -0
- package/lib/public/src/components/pcfactory/src/ModalSelect/index.tsx +453 -0
- package/lib/public/src/components/pcfactory/src/MultipleSelect/index.tsx +3 -0
- package/lib/public/src/components/pcfactory/src/Pagination/index.tsx +104 -0
- package/lib/public/src/components/pcfactory/src/Password/index.tsx +88 -0
- package/lib/public/src/components/pcfactory/src/PictureVerifyCode/assets/placeholder.png +0 -0
- package/lib/public/src/components/pcfactory/src/PictureVerifyCode/index.tsx +76 -0
- package/lib/public/src/components/pcfactory/src/PieChart/index.tsx +3 -0
- package/lib/public/src/components/pcfactory/src/Progress/index.tsx +155 -0
- package/lib/public/src/components/pcfactory/src/QRCode/const.ts +5 -0
- package/lib/public/src/components/pcfactory/src/QRCode/index.tsx +146 -0
- package/lib/public/src/components/pcfactory/src/QuillEditor/QuillEditor.tsx +197 -0
- package/lib/public/src/components/pcfactory/src/QuillEditor/index.tsx +37 -0
- package/lib/public/src/components/pcfactory/src/QuillEditor/loader.ts +12 -0
- package/lib/public/src/components/pcfactory/src/RadarChart/RadarChartHook.ts +449 -0
- package/lib/public/src/components/pcfactory/src/RadarChart/RadarChartType.ts +39 -0
- package/lib/public/src/components/pcfactory/src/RadarChart/RadarECharts.tsx +86 -0
- package/lib/public/src/components/pcfactory/src/RadarChart/index.tsx +16 -0
- package/lib/public/src/components/pcfactory/src/RadarChart/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/RadarChart/radarDefaultConfig.js +55 -0
- package/lib/public/src/components/pcfactory/src/Radio/index.tsx +260 -0
- package/lib/public/src/components/pcfactory/src/RangePicker/index.tsx +3 -0
- package/lib/public/src/components/pcfactory/src/Rate/index.tsx +187 -0
- package/lib/public/src/components/pcfactory/src/ReactECharts/PropsType.ts +37 -0
- package/lib/public/src/components/pcfactory/src/ReactECharts/ReactECharts.tsx +672 -0
- package/lib/public/src/components/pcfactory/src/ReactECharts/index.tsx +26 -0
- package/lib/public/src/components/pcfactory/src/ReactECharts/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/RemoteComponent/components/FishRender.tsx +31 -0
- package/lib/public/src/components/pcfactory/src/RemoteComponent/components/ReactRender.tsx +55 -0
- package/lib/public/src/components/pcfactory/src/RemoteComponent/components/VueRender.tsx +32 -0
- package/lib/public/src/components/pcfactory/src/RemoteComponent/constant.ts +9 -0
- package/lib/public/src/components/pcfactory/src/RemoteComponent/index.tsx +82 -0
- package/lib/public/src/components/pcfactory/src/RemoteComponent/remote-component.config.ts +12 -0
- package/lib/public/src/components/pcfactory/src/Result/index.tsx +27 -0
- package/lib/public/src/components/pcfactory/src/RichTextEditor/LcdpUeditorMain.tsx +105 -0
- package/lib/public/src/components/pcfactory/src/RichTextEditor/RichTextEditor.tsx +234 -0
- package/lib/public/src/components/pcfactory/src/RichTextEditor/RichTextEditorMain.tsx +41 -0
- package/lib/public/src/components/pcfactory/src/RichTextEditor/index.tsx +33 -0
- package/lib/public/src/components/pcfactory/src/RichTextEditor/loader.ts +12 -0
- package/lib/public/src/components/pcfactory/src/Row/Row.tsx +66 -0
- package/lib/public/src/components/pcfactory/src/Row/index.tsx +9 -0
- package/lib/public/src/components/pcfactory/src/Row/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/Select/index.tsx +628 -0
- package/lib/public/src/components/pcfactory/src/Select/selectUtils.ts +257 -0
- package/lib/public/src/components/pcfactory/src/Slider/index.tsx +351 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/DownloadProgress/DownloadProgress.tsx +27 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/DownloadProgress/index.ts +3 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/UploadItem.tsx +257 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/assets/default.png +0 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/assets/js.png +0 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/assets/pdf.png +0 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/assets/ppt.png +0 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/assets/txt.png +0 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/assets/word.png +0 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/assets/xls.png +0 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/assets/zip.png +0 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/index.tsx +1050 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/uploadItem.less +64 -0
- package/lib/public/src/components/pcfactory/src/Steps/constant/checkcircle.tsx +29 -0
- package/lib/public/src/components/pcfactory/src/Steps/constant/index.ts +2 -0
- package/lib/public/src/components/pcfactory/src/Steps/constant/vector.tsx +13 -0
- package/lib/public/src/components/pcfactory/src/Steps/index.tsx +343 -0
- package/lib/public/src/components/pcfactory/src/SuperSelect/ComSelect.tsx +538 -0
- package/lib/public/src/components/pcfactory/src/SuperSelect/index.tsx +127 -0
- package/lib/public/src/components/pcfactory/src/SuperSelect/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/Swiper/index.tsx +184 -0
- package/lib/public/src/components/pcfactory/src/Switch/index.tsx +219 -0
- package/lib/public/src/components/pcfactory/src/TabPane/index.tsx +145 -0
- package/lib/public/src/components/pcfactory/src/Table/BodyCell/index.tsx +278 -0
- package/lib/public/src/components/pcfactory/src/Table/EditComponent/index.tsx +554 -0
- package/lib/public/src/components/pcfactory/src/Table/FormatCell/GhostTag/index.tsx +34 -0
- package/lib/public/src/components/pcfactory/src/Table/FormatCell/Hyperlink/index.tsx +26 -0
- package/lib/public/src/components/pcfactory/src/Table/FormatCell/PointTag/index.tsx +41 -0
- package/lib/public/src/components/pcfactory/src/Table/FormatCell/PureColourFill/index.tsx +32 -0
- package/lib/public/src/components/pcfactory/src/Table/FormatCell/PureFadeColourTag/index.tsx +34 -0
- package/lib/public/src/components/pcfactory/src/Table/FormatCell/index.tsx +227 -0
- package/lib/public/src/components/pcfactory/src/Table/HeaderCell/HeaderCellTitle/index.tsx +63 -0
- package/lib/public/src/components/pcfactory/src/Table/HeaderCell/index.tsx +32 -0
- package/lib/public/src/components/pcfactory/src/Table/TableHead/index.tsx +501 -0
- package/lib/public/src/components/pcfactory/src/Table/TableSummaryRow/index.tsx +46 -0
- package/lib/public/src/components/pcfactory/src/Table/constant.ts +73 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/index.ts +32 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useCMDActions.ts +325 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useCheckStrict.ts +176 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useColumns.tsx +1851 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useCommon.ts +39 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useDataSource.ts +201 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useExpandable.tsx +324 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useFilter.tsx +274 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useFormatCell.ts +309 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/usePagination.ts +104 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useRowEdit.ts +302 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useRowMerge.ts +93 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useScroll.ts +120 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useSelection.ts +467 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useSort.ts +39 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useSummaryCol.ts +191 -0
- package/lib/public/src/components/pcfactory/src/Table/index.tsx +525 -0
- package/lib/public/src/components/pcfactory/src/Table/utils/SequenceId.ts +104 -0
- package/lib/public/src/components/pcfactory/src/Table/utils/index.ts +442 -0
- package/lib/public/src/components/pcfactory/src/Tabs/index.tsx +209 -0
- package/lib/public/src/components/pcfactory/src/Tag/index.tsx +39 -0
- package/lib/public/src/components/pcfactory/src/Text/index.tsx +191 -0
- package/lib/public/src/components/pcfactory/src/TextArea/ForIETextArea.tsx +96 -0
- package/lib/public/src/components/pcfactory/src/TextArea/index.tsx +255 -0
- package/lib/public/src/components/pcfactory/src/TimePicker/index.tsx +3 -0
- package/lib/public/src/components/pcfactory/src/TlrView/index.tsx +3 -0
- package/lib/public/src/components/pcfactory/src/TooltipView/PropsType.ts +22 -0
- package/lib/public/src/components/pcfactory/src/TooltipView/TooltipViewED/index.tsx +10 -0
- package/lib/public/src/components/pcfactory/src/TooltipView/hooks/index.tsx +90 -0
- package/lib/public/src/components/pcfactory/src/TooltipView/index.tsx +13 -0
- package/lib/public/src/components/pcfactory/src/Transfer/index.tsx +753 -0
- package/lib/public/src/components/pcfactory/src/Tree/TreeNodeMenu/index.tsx +102 -0
- package/lib/public/src/components/pcfactory/src/Tree/index.tsx +1303 -0
- package/lib/public/src/components/pcfactory/src/TreeSelect/index.tsx +639 -0
- package/lib/public/src/components/pcfactory/src/TreeTable/hooks/index.ts +4 -0
- package/lib/public/src/components/pcfactory/src/TreeTable/hooks/useCMDAction.ts +82 -0
- package/lib/public/src/components/pcfactory/src/TreeTable/hooks/useExpandable.tsx +61 -0
- package/lib/public/src/components/pcfactory/src/TreeTable/index.tsx +273 -0
- package/lib/public/src/components/pcfactory/src/Upload/Upload.tsx +740 -0
- package/lib/public/src/components/pcfactory/src/Upload/index.tsx +29 -0
- package/lib/public/src/components/pcfactory/src/Upload/loader.tsx +13 -0
- package/lib/public/src/components/pcfactory/src/VerificationCode/assets/placeholder.png +0 -0
- package/lib/public/src/components/pcfactory/src/VerificationCode/index.tsx +297 -0
- package/lib/public/src/components/pcfactory/src/VerticalView/index.tsx +25 -0
- package/lib/public/src/components/pcfactory/src/VideoPlayer/index.tsx +159 -0
- package/lib/public/src/components/pcfactory/src/View/index.tsx +150 -0
- package/lib/public/src/components/pcfactory/src/View/useBackgroundStyle.ts +75 -0
- package/lib/public/src/components/pcfactory/src/VirtualGroup/index.tsx +16 -0
- package/lib/public/src/components/pcfactory/src/Webview/index.tsx +104 -0
- package/lib/public/src/components/pcfactory/src/index.component.ts +253 -0
- package/lib/public/src/components/pcfactory/src/styles/common.less +107 -0
- package/lib/public/src/components/pcfactory/src/styles/compatible.less +976 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Alert.less +25 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Audio.less +198 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Button.less +32 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Card.less +155 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Cascader.less +54 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Checkbox.less +7 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Collapse.less +214 -0
- package/lib/public/src/components/pcfactory/src/styles/components/DatePicker.less +22 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Description.less +64 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Divider.less +530 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Drawer.less +54 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Dropdown.less +11 -0
- package/lib/public/src/components/pcfactory/src/styles/components/DynamicDataContainer.less +16 -0
- package/lib/public/src/components/pcfactory/src/styles/components/DynamicTabs.less +254 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Form.less +265 -0
- package/lib/public/src/components/pcfactory/src/styles/components/FormGroup.less +111 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Gantt.less +139 -0
- package/lib/public/src/components/pcfactory/src/styles/components/GridView.less +62 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Icon.less +20 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Input.less +164 -0
- package/lib/public/src/components/pcfactory/src/styles/components/InputNumber.less +124 -0
- package/lib/public/src/components/pcfactory/src/styles/components/InputPassword.less +3 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Link.less +4 -0
- package/lib/public/src/components/pcfactory/src/styles/components/LoopList.less +67 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Menu.less +54 -0
- package/lib/public/src/components/pcfactory/src/styles/components/ModalSelect.less +42 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Popconfirm.less +7 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Progress.less +57 -0
- package/lib/public/src/components/pcfactory/src/styles/components/QuillEditor.less +15 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Radio.less +7 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Rate.less +16 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Result.less +26 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Select.less +146 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Slider.less +78 -0
- package/lib/public/src/components/pcfactory/src/styles/components/StdUpload.less +225 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Step.less +91 -0
- package/lib/public/src/components/pcfactory/src/styles/components/SuperSelect.less +83 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Swiper.less +106 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Switch.less +49 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Table.less +1229 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Tabs.less +291 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Tag.less +107 -0
- package/lib/public/src/components/pcfactory/src/styles/components/TextArea.less +12 -0
- package/lib/public/src/components/pcfactory/src/styles/components/TooltipView.less +43 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Transfer.less +155 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Tree.less +329 -0
- package/lib/public/src/components/pcfactory/src/styles/components/TreeSelect.less +65 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Upload.less +26 -0
- package/lib/public/src/components/pcfactory/src/styles/components/VerificationCode.less +162 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Webview.less +31 -0
- package/lib/public/src/components/pcfactory/src/styles/index.less +10 -0
- package/lib/public/src/components/pcfactory/src/styles/index.ued.less +65 -0
- package/lib/public/src/components/pcfactory/src/styles/theme/variables/antdVariables.less +84 -0
- package/lib/public/src/components/pcfactory/src/styles/theme/variables/common.less +9 -0
- package/lib/public/src/components/pcfactory/src/styles/theme/variables/customVariables.less +35 -0
- package/lib/public/src/components/pcfactory/src/styles/theme/variables/index.less +2 -0
- package/lib/public/src/components/pcfactory/src/utils/ChannelContainer.tsx +150 -0
- package/lib/public/src/components/pcfactory/src/utils/ChildRender.ts +103 -0
- package/lib/public/src/components/pcfactory/src/utils/CustomModule.tsx +134 -0
- package/lib/public/src/components/pcfactory/src/utils/DummyFormContext.ts +136 -0
- package/lib/public/src/components/pcfactory/src/utils/Empty/customLocale.tsx +6 -0
- package/lib/public/src/components/pcfactory/src/utils/Empty/empty.tsx +37 -0
- package/lib/public/src/components/pcfactory/src/utils/LoaderHelper.tsx +29 -0
- package/lib/public/src/components/pcfactory/src/utils/PropsType.ts +21 -0
- package/lib/public/src/components/pcfactory/src/utils/WithSyncValue.ts +218 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/index.ts +22 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/useCreation.ts +23 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/useDeepCompareEffect.ts +27 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/useMap.ts +46 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/useMemoizedFn.ts +27 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/usePrevious.ts +19 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/useSafeState.ts +26 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/useSetState.ts +26 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/useUnmountedRef.ts +14 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/useUpdate.ts +9 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/useUpdateEffect.ts +16 -0
- package/lib/public/src/components/pcfactory/src/utils/basicStatusTransfer.ts +32 -0
- package/lib/public/src/components/pcfactory/src/utils/common.ts +367 -0
- package/lib/public/src/components/pcfactory/src/utils/dynamicUtils/DynamicContext.tsx +106 -0
- package/lib/public/src/components/pcfactory/src/utils/formUtils/FormContext.tsx +131 -0
- package/lib/public/src/components/pcfactory/src/utils/formUtils/FormFields.tsx +646 -0
- package/lib/public/src/components/pcfactory/src/utils/formUtils/WrapperContainer.tsx +123 -0
- package/lib/public/src/components/pcfactory/src/utils/formUtils/cmdHelper.ts +411 -0
- package/lib/public/src/components/pcfactory/src/utils/formUtils/common.ts +28 -0
- package/lib/public/src/components/pcfactory/src/utils/getExportDefaultObj.ts +11 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useCommonImperativeHandle.ts +140 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useDataMask.ts +83 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useDoubleClick.ts +63 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useFuncExpExecute.ts +86 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useGetStaticAttrData.ts +41 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useHiddenStyle.ts +43 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useInitReactQuill.ts +90 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useListenState.ts +26 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useLocale.ts +129 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/usePrintMode.tsx +80 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useRules.ts +89 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useTestHelper.ts +26 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useToggleBoolean.ts +33 -0
- package/lib/public/src/components/pcfactory/src/utils/index.ts +19 -0
- package/lib/public/src/components/pcfactory/src/utils/polyfill.js +305 -0
- package/lib/public/src/components/pcfactory/src/utils/renderReadOnly.tsx +105 -0
- package/lib/public/src/components/pcfactory/src/variables.ts +2 -0
- package/lib/public/src/components/pcfactory/typings.d.ts +27 -0
- package/lib/public/src/hooks/useExportCustomDataFile.ts +566 -0
- package/lib/public/src/hooks/useLifeCycle.ts +110 -0
- package/lib/public/src/hooks/useListenProps.ts +14 -0
- package/lib/public/src/hooks/useSafeState.ts +26 -0
- package/lib/public/src/hooks/useSetState.ts +41 -0
- package/lib/public/src/hooks/useSyncState.ts +27 -0
- package/lib/public/src/hooks/useTransSuperObjectParams.ts +82 -0
- package/lib/public/src/hooks/useUnmountedRef.ts +14 -0
- package/lib/public/src/hooks/useUpdateEffect.ts +16 -0
- package/lib/public/src/pages/_preview/index.tsx +23 -0
- package/lib/public/src/services/README.md +32 -0
- package/lib/public/src/services/api/batchInsert.ts +21 -0
- package/lib/public/src/services/api/engine.ts +59 -0
- package/lib/public/src/services/api/file.ts +50 -0
- package/lib/public/src/services/api/findAppConfig.ts +14 -0
- package/lib/public/src/services/api/getAppFileUrlByFileCode.ts +14 -0
- package/lib/public/src/services/api/index.ts +38 -0
- package/lib/public/src/services/type.ts +51 -0
- package/lib/public/src/styles/common.less +41 -0
- package/lib/public/src/styles/index.less +4 -0
- package/lib/public/src/styles/index.ts +1 -0
- package/lib/public/src/styles/theme/variables.less +130 -0
- package/lib/public/src/types/index.ts +246 -0
- package/lib/public/src/utils/AwaitHandleData.ts +46 -0
- package/lib/public/src/utils/Context/Container.tsx +65 -0
- package/lib/public/src/utils/Context/context.tsx +95 -0
- package/lib/public/src/utils/LcdpSpin/index.less +13 -0
- package/lib/public/src/utils/LcdpSpin/index.tsx +12 -0
- package/lib/public/src/utils/ModalManager/Drawer/index.less +30 -0
- package/lib/public/src/utils/ModalManager/Drawer/index.tsx +109 -0
- package/lib/public/src/utils/ModalManager/Modal/index.less +7 -0
- package/lib/public/src/utils/ModalManager/Modal/index.tsx +96 -0
- package/lib/public/src/utils/ModalManager/index.tsx +278 -0
- package/lib/public/src/utils/Security/clientCapabilities.ts +19 -0
- package/lib/public/src/utils/Security/config.ts +89 -0
- package/lib/public/src/utils/Security/const.ts +129 -0
- package/lib/public/src/utils/Security/encipher/aes.ts +52 -0
- package/lib/public/src/utils/Security/encipher/des.ts +52 -0
- package/lib/public/src/utils/Security/encipher/rsa.ts +42 -0
- package/lib/public/src/utils/Security/encipher/sign.ts +212 -0
- package/lib/public/src/utils/Security/encipher/token.ts +52 -0
- package/lib/public/src/utils/Security/httpEncryption.ts +75 -0
- package/lib/public/src/utils/Security/index.ts +28 -0
- package/lib/public/src/utils/Security/requester/fetch.ts +119 -0
- package/lib/public/src/utils/Security/requester/wx.ts +132 -0
- package/lib/public/src/utils/Security/requester/xhr.ts +121 -0
- package/lib/public/src/utils/Security/types.ts +181 -0
- package/lib/public/src/utils/Security/utils/check.ts +62 -0
- package/lib/public/src/utils/Security/utils/cookie.ts +70 -0
- package/lib/public/src/utils/Security/utils/encrypted.ts +122 -0
- package/lib/public/src/utils/Security/utils/message.ts +17 -0
- package/lib/public/src/utils/Security/utils/url.ts +78 -0
- package/lib/public/src/utils/StateListener.ts +69 -0
- package/lib/public/src/utils/User.ts +16 -0
- package/lib/public/src/utils/array.ts +151 -0
- package/lib/public/src/utils/basicStatusTransfer.ts +32 -0
- package/lib/public/src/utils/cmd.ts +27 -0
- package/lib/public/src/utils/customFuncMapping.ts +107 -0
- package/lib/public/src/utils/dataSource/fetchQuery.ts +154 -0
- package/lib/public/src/utils/dataSource/index.ts +1 -0
- package/lib/public/src/utils/engine-utils/exportCustomUtils.ts +215 -0
- package/lib/public/src/utils/engine-utils/hooks/index.ts +3 -0
- package/lib/public/src/utils/engine-utils/hooks/useCreation.ts +23 -0
- package/lib/public/src/utils/engine-utils/index.ts +2 -0
- package/lib/public/src/utils/engine-utils/previewUtil.ts +18 -0
- package/lib/public/src/utils/formUtils.ts +458 -0
- package/lib/public/src/utils/functors/ABS.ts +23 -0
- package/lib/public/src/utils/functors/AESDECRYPT.ts +26 -0
- package/lib/public/src/utils/functors/AESENCRYPT.ts +26 -0
- package/lib/public/src/utils/functors/ARRAYINDEX.ts +23 -0
- package/lib/public/src/utils/functors/ARRAYTOSTR.ts +23 -0
- package/lib/public/src/utils/functors/AVERAGE.ts +23 -0
- package/lib/public/src/utils/functors/CONCAT.ts +20 -0
- package/lib/public/src/utils/functors/COUNTA.ts +22 -0
- package/lib/public/src/utils/functors/COUNTARRAY.ts +20 -0
- package/lib/public/src/utils/functors/COUNTBLANK.ts +22 -0
- package/lib/public/src/utils/functors/COUNTCHAR.ts +26 -0
- package/lib/public/src/utils/functors/DATAMASK.ts +150 -0
- package/lib/public/src/utils/functors/DATEADD.ts +37 -0
- package/lib/public/src/utils/functors/DATENOW.ts +27 -0
- package/lib/public/src/utils/functors/DATETIME.ts +20 -0
- package/lib/public/src/utils/functors/IF.ts +20 -0
- package/lib/public/src/utils/functors/INT.ts +23 -0
- package/lib/public/src/utils/functors/LOG.ts +24 -0
- package/lib/public/src/utils/functors/MAX.ts +24 -0
- package/lib/public/src/utils/functors/MIN.ts +24 -0
- package/lib/public/src/utils/functors/MOD.ts +24 -0
- package/lib/public/src/utils/functors/NUMBER.ts +26 -0
- package/lib/public/src/utils/functors/OBJECTVALUE.ts +20 -0
- package/lib/public/src/utils/functors/POWER.ts +24 -0
- package/lib/public/src/utils/functors/PRODUCT.ts +20 -0
- package/lib/public/src/utils/functors/RANDBETWEEN.ts +22 -0
- package/lib/public/src/utils/functors/RANDOMNUM.ts +30 -0
- package/lib/public/src/utils/functors/ROUND.ts +24 -0
- package/lib/public/src/utils/functors/ROUNDDOWN.ts +24 -0
- package/lib/public/src/utils/functors/ROUNDUP.ts +25 -0
- package/lib/public/src/utils/functors/STRTOARRAY.ts +23 -0
- package/lib/public/src/utils/functors/SUM.ts +20 -0
- package/lib/public/src/utils/functors/index.ts +32 -0
- package/lib/public/src/utils/functors/types.ts +32 -0
- package/lib/public/src/utils/functors/utils/tools.ts +15 -0
- package/lib/public/src/utils/historytool.ts +154 -0
- package/lib/public/src/utils/hooks/index.ts +22 -0
- package/lib/public/src/utils/hooks/useCreation.ts +23 -0
- package/lib/public/src/utils/hooks/useHiddenStyle.ts +19 -0
- package/lib/public/src/utils/hooks/useMovable.ts +227 -0
- package/lib/public/src/utils/hooks/usePersistFn.ts +17 -0
- package/lib/public/src/utils/hooks/useReactive.ts +73 -0
- package/lib/public/src/utils/hooks/useRefState.ts +25 -0
- package/lib/public/src/utils/hooks/useSetState.ts +25 -0
- package/lib/public/src/utils/hooks/useStyle.ts +139 -0
- package/lib/public/src/utils/hooks/useTrackedEffect.ts +39 -0
- package/lib/public/src/utils/hooks/useUpdate.ts +9 -0
- package/lib/public/src/utils/hooks/useUpdateDeepEffect.ts +22 -0
- package/lib/public/src/utils/hooks/useUpdateEffect.ts +18 -0
- package/lib/public/src/utils/hooks/useWhyDidYouUpdate.ts +32 -0
- package/lib/public/src/utils/i18n/i18n.ts +15 -0
- package/lib/public/src/utils/i18n/index.ts +7 -0
- package/lib/public/src/utils/i18n/locale/app/en_US.ts +77 -0
- package/lib/public/src/utils/i18n/locale/app/index.ts +9 -0
- package/lib/public/src/utils/i18n/locale/app/otherLocale.ts +2 -0
- package/lib/public/src/utils/i18n/locale/app/zh_CN.ts +65 -0
- package/lib/public/src/utils/i18n/locale/app/zh_HK.ts +66 -0
- package/lib/public/src/utils/i18n/locale/base/en_US.ts +449 -0
- package/lib/public/src/utils/i18n/locale/base/index.ts +5 -0
- package/lib/public/src/utils/i18n/locale/base/zh_CN.ts +413 -0
- package/lib/public/src/utils/i18n/locale/base/zh_HK.ts +411 -0
- package/lib/public/src/utils/i18n/locale/pc/en_US.ts +131 -0
- package/lib/public/src/utils/i18n/locale/pc/index.ts +9 -0
- package/lib/public/src/utils/i18n/locale/pc/otherLocale.ts +2 -0
- package/lib/public/src/utils/i18n/locale/pc/zh_CN.ts +105 -0
- package/lib/public/src/utils/i18n/locale/pc/zh_HK.ts +105 -0
- package/lib/public/src/utils/i18n/localeMonitor.ts +71 -0
- package/lib/public/src/utils/i18n/locales.ts +30 -0
- package/lib/public/src/utils/i18n/replaceMessage.ts +29 -0
- package/lib/public/src/utils/i18n/types.ts +2 -0
- package/lib/public/src/utils/i18n/useLocale.ts +129 -0
- package/lib/public/src/utils/lcdpApi.ts +215 -0
- package/lib/public/src/utils/lcdpBaseApi.ts +293 -0
- package/lib/public/src/utils/messageApi.ts +93 -0
- package/lib/public/src/utils/platform/index.ts +1 -0
- package/lib/public/src/utils/platform/type.ts +7 -0
- package/lib/public/src/utils/platform/utils/fileUtils.ts +536 -0
- package/lib/public/src/utils/preprocess.ts +88 -0
- package/lib/public/src/utils/sandBoxLoadModule.ts +216 -0
- package/lib/public/src/utils/sandbox/browserCompatible.ts +54 -0
- package/lib/public/src/utils/sandbox/compileCode.ts +81 -0
- package/lib/public/src/utils/sandbox/index.ts +5 -0
- package/lib/public/src/utils/sandbox/sandbox.ts +324 -0
- package/lib/public/src/utils/sandbox/sandboxrules.ts +206 -0
- package/lib/public/src/utils/sandbox/utils.ts +9 -0
- package/lib/public/src/utils/service/baseRequest.ts +111 -0
- package/lib/public/src/utils/service/commonFetch.ts +140 -0
- package/lib/public/src/utils/service/defaultResponseInterceptor.ts +84 -0
- package/lib/public/src/utils/service/resolveApiPath.ts +24 -0
- package/lib/public/src/utils/service/urlHelper.ts +56 -0
- package/lib/public/src/utils/styleInject.ts +17 -0
- package/lib/public/src/utils/svgImage/imageUtils.ts +3 -0
- package/lib/public/src/utils/svgImage/index.ts +10 -0
- package/lib/public/src/utils/uid.ts +33 -0
- package/lib/public/src/utils/useComponentHoc.ts +96 -0
- package/lib/public/src/utils/useSetState.ts +26 -0
- package/lib/public/src/utils/useTool.ts +428 -0
- package/lib/public/tsconfig.json +33 -0
- package/lib/public/typings.d.ts +1 -0
- package/package.json +31 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
2
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
3
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
4
|
+
import { existsSync } from 'fs';
|
|
5
|
+
import { extname } from 'path';
|
|
6
|
+
export var FILE_EXT_NAMES = ['.tsx', '.ts', '.jsx', '.mjs', '.js', '.d.ts'];
|
|
7
|
+
export var LESS_EXT_NAMES = ['.less'];
|
|
8
|
+
export var isJsFile = function isJsFile(file) {
|
|
9
|
+
return FILE_EXT_NAMES.includes(extname(file));
|
|
10
|
+
};
|
|
11
|
+
export var isLessFile = function isLessFile(file) {
|
|
12
|
+
return LESS_EXT_NAMES.includes(extname(file));
|
|
13
|
+
};
|
|
14
|
+
export function getRealPath(target) {
|
|
15
|
+
if (isJsFile(target) || isLessFile(target)) {
|
|
16
|
+
return target;
|
|
17
|
+
} else {
|
|
18
|
+
var _iterator = _createForOfIteratorHelper(FILE_EXT_NAMES),
|
|
19
|
+
_step;
|
|
20
|
+
try {
|
|
21
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
22
|
+
var fileExtName = _step.value;
|
|
23
|
+
var targetWithExtName = "".concat(target).concat(fileExtName);
|
|
24
|
+
// 省略 index 的写法
|
|
25
|
+
var targetIndexWithExtName = "".concat(target, "/index").concat(fileExtName);
|
|
26
|
+
if (existsSync(targetWithExtName)) {
|
|
27
|
+
return targetWithExtName;
|
|
28
|
+
}
|
|
29
|
+
if (existsSync(targetIndexWithExtName)) {
|
|
30
|
+
return targetIndexWithExtName;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
} catch (err) {
|
|
34
|
+
_iterator.e(err);
|
|
35
|
+
} finally {
|
|
36
|
+
_iterator.f();
|
|
37
|
+
}
|
|
38
|
+
return target;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7
|
+
import * as parser from '@babel/parser';
|
|
8
|
+
export function parse(code) {
|
|
9
|
+
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
10
|
+
var excludePlugins = opts.excludePlugins || [];
|
|
11
|
+
var includePlugins = opts.includePlugins || [];
|
|
12
|
+
var plugins = ['jsx', 'typescript', 'classProperties', 'dynamicImport', 'exportDefaultFrom', 'exportNamespaceFrom', 'functionBind', 'nullishCoalescingOperator', 'objectRestSpread', 'optionalChaining', 'decorators-legacy'].concat(_toConsumableArray(includePlugins)).filter(function (p) {
|
|
13
|
+
return !excludePlugins.includes(p);
|
|
14
|
+
});
|
|
15
|
+
return parser.parse(code, {
|
|
16
|
+
sourceType: 'module',
|
|
17
|
+
plugins: plugins,
|
|
18
|
+
allowAwaitOutsideFunction: true
|
|
19
|
+
});
|
|
20
|
+
}
|
package/es/node/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/es/node/cli.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
+
import { cac } from 'cac';
|
|
6
|
+
import { VERSION } from "./constants";
|
|
7
|
+
var cli = cac('ebe');
|
|
8
|
+
|
|
9
|
+
// global options
|
|
10
|
+
|
|
11
|
+
// init
|
|
12
|
+
cli.command('setup', '初始化出码产物项目,完成出码后置动作之后,移除 ebe-utils 依赖').alias('init').alias('i').action( /*#__PURE__*/function () {
|
|
13
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(root, options) {
|
|
14
|
+
var _require, setup;
|
|
15
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
16
|
+
while (1) switch (_context.prev = _context.next) {
|
|
17
|
+
case 0:
|
|
18
|
+
console.log('init ebe package ');
|
|
19
|
+
_require = require("./setup"), setup = _require.setup;
|
|
20
|
+
_context.prev = 2;
|
|
21
|
+
_context.next = 5;
|
|
22
|
+
return setup({
|
|
23
|
+
cwd: process.cwd()
|
|
24
|
+
});
|
|
25
|
+
case 5:
|
|
26
|
+
_context.next = 11;
|
|
27
|
+
break;
|
|
28
|
+
case 7:
|
|
29
|
+
_context.prev = 7;
|
|
30
|
+
_context.t0 = _context["catch"](2);
|
|
31
|
+
console.error(_context.t0);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
case 11:
|
|
34
|
+
_context.prev = 11;
|
|
35
|
+
return _context.finish(11);
|
|
36
|
+
case 13:
|
|
37
|
+
case "end":
|
|
38
|
+
return _context.stop();
|
|
39
|
+
}
|
|
40
|
+
}, _callee, null, [[2, 7, 11, 13]]);
|
|
41
|
+
}));
|
|
42
|
+
return function (_x, _x2) {
|
|
43
|
+
return _ref.apply(this, arguments);
|
|
44
|
+
};
|
|
45
|
+
}());
|
|
46
|
+
|
|
47
|
+
// move
|
|
48
|
+
cli.command('move <path>', '通过提供的入口,将所有相关依赖复制到指定文件夹中').option('--o [outdir]', '指定拷贝产物路径', {
|
|
49
|
+
default: 'factory'
|
|
50
|
+
}).action( /*#__PURE__*/function () {
|
|
51
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(path, option) {
|
|
52
|
+
var o, _require2, move;
|
|
53
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
54
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
55
|
+
case 0:
|
|
56
|
+
o = option.o;
|
|
57
|
+
_require2 = require("./move"), move = _require2.move;
|
|
58
|
+
_context2.prev = 2;
|
|
59
|
+
_context2.next = 5;
|
|
60
|
+
return move({
|
|
61
|
+
target: path,
|
|
62
|
+
outDir: o
|
|
63
|
+
});
|
|
64
|
+
case 5:
|
|
65
|
+
_context2.next = 11;
|
|
66
|
+
break;
|
|
67
|
+
case 7:
|
|
68
|
+
_context2.prev = 7;
|
|
69
|
+
_context2.t0 = _context2["catch"](2);
|
|
70
|
+
console.error(_context2.t0);
|
|
71
|
+
process.exit(1);
|
|
72
|
+
case 11:
|
|
73
|
+
_context2.prev = 11;
|
|
74
|
+
return _context2.finish(11);
|
|
75
|
+
case 13:
|
|
76
|
+
case "end":
|
|
77
|
+
return _context2.stop();
|
|
78
|
+
}
|
|
79
|
+
}, _callee2, null, [[2, 7, 11, 13]]);
|
|
80
|
+
}));
|
|
81
|
+
return function (_x3, _x4) {
|
|
82
|
+
return _ref2.apply(this, arguments);
|
|
83
|
+
};
|
|
84
|
+
}());
|
|
85
|
+
cli.help();
|
|
86
|
+
cli.version(VERSION);
|
|
87
|
+
cli.parse();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const VERSION: string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 将 target 中所有的文件,按照原有的文件夹结构拷贝到 output 目录下,如果不存在对应文件夹则新建,如果存在对应文件则覆盖
|
|
6
|
+
* @param {*} target 拷贝目录
|
|
7
|
+
* @param {*} output 目标路径
|
|
8
|
+
*/
|
|
9
|
+
export var copyStatic = function copyStatic(target, output) {
|
|
10
|
+
var copyRecursive = function copyRecursive(source, destination) {
|
|
11
|
+
if (fs.lstatSync(source).isDirectory()) {
|
|
12
|
+
if (!fs.existsSync(destination)) {
|
|
13
|
+
fs.mkdirSync(destination);
|
|
14
|
+
}
|
|
15
|
+
fs.readdirSync(source).forEach(function (file) {
|
|
16
|
+
var sourcePath = path.join(source, file);
|
|
17
|
+
var destinationPath = path.join(destination, file);
|
|
18
|
+
copyRecursive(sourcePath, destinationPath);
|
|
19
|
+
});
|
|
20
|
+
} else {
|
|
21
|
+
fs.copyFileSync(source, destination);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
copyRecursive(target, output);
|
|
25
|
+
};
|
package/es/node/move.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
+
import { existsSync, mkdirpSync, readFileSync, writeFileSync } from 'fs-extra';
|
|
6
|
+
import { dirname, isAbsolute, join, relative } from 'path';
|
|
7
|
+
import { getAllImportFiles } from "./babel/getAllImportFiles";
|
|
8
|
+
var copyFileSyncAlias = function copyFileSyncAlias(from, to) {
|
|
9
|
+
var _context$match;
|
|
10
|
+
// copyFileSync(file, absTarget);
|
|
11
|
+
var context = readFileSync(from, 'utf-8');
|
|
12
|
+
var importList = ((_context$match = context.match(/from '@\/([^']+)'/g)) === null || _context$match === void 0 ? void 0 : _context$match.map(function (match) {
|
|
13
|
+
return match.slice(8, -1);
|
|
14
|
+
})) || [];
|
|
15
|
+
importList.forEach(function (source) {
|
|
16
|
+
var absolute = join(process.cwd(), 'src', source);
|
|
17
|
+
var filePath = relative(from, absolute);
|
|
18
|
+
context = context.replace("@/".concat(source), filePath);
|
|
19
|
+
});
|
|
20
|
+
writeFileSync(to, context, 'utf-8');
|
|
21
|
+
};
|
|
22
|
+
export function move(_x) {
|
|
23
|
+
return _move.apply(this, arguments);
|
|
24
|
+
}
|
|
25
|
+
function _move() {
|
|
26
|
+
_move = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(moveConfig) {
|
|
27
|
+
var target, outDir, cwd, resolvedTarget, allImportFiles, keys, count;
|
|
28
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
29
|
+
while (1) switch (_context.prev = _context.next) {
|
|
30
|
+
case 0:
|
|
31
|
+
target = moveConfig.target, outDir = moveConfig.outDir;
|
|
32
|
+
cwd = process.cwd();
|
|
33
|
+
resolvedTarget = isAbsolute(target) ? target : join(cwd, target);
|
|
34
|
+
if (existsSync(resolvedTarget)) {
|
|
35
|
+
_context.next = 5;
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
throw new Error("\u6307\u5B9A\u7684\u6587\u4EF6\u4E0D\u5B58\u5728: ".concat(resolvedTarget));
|
|
39
|
+
case 5:
|
|
40
|
+
allImportFiles = getAllImportFiles(resolvedTarget); // 拷贝入口文件
|
|
41
|
+
allImportFiles[resolvedTarget] = true;
|
|
42
|
+
keys = Object.keys(allImportFiles);
|
|
43
|
+
count = keys.length;
|
|
44
|
+
keys.forEach(function (file) {
|
|
45
|
+
if (!existsSync(file)) {
|
|
46
|
+
console.log("\u62F7\u8D1D\u6587\u4EF6\u4E0D\u5B58\u5728: ".concat(file));
|
|
47
|
+
count -= 1;
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
var filePath = relative(cwd, file);
|
|
51
|
+
var absTarget = join(cwd, outDir, filePath);
|
|
52
|
+
// console.log(`[COPY] 拷贝 ${absTarget}`);
|
|
53
|
+
mkdirpSync(dirname(absTarget));
|
|
54
|
+
copyFileSyncAlias(file, absTarget);
|
|
55
|
+
});
|
|
56
|
+
console.log("[COPY] \u5171\u62F7\u8D1D\u6587\u4EF6\u6570 ".concat(count));
|
|
57
|
+
case 11:
|
|
58
|
+
case "end":
|
|
59
|
+
return _context.stop();
|
|
60
|
+
}
|
|
61
|
+
}, _callee);
|
|
62
|
+
}));
|
|
63
|
+
return _move.apply(this, arguments);
|
|
64
|
+
}
|
package/es/node/setup.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
+
import { readFileSync, writeFileSync } from 'fs-extra';
|
|
6
|
+
import { join } from 'path';
|
|
7
|
+
import { copyStatic } from "./copyStatic";
|
|
8
|
+
export function setup(_x) {
|
|
9
|
+
return _setup.apply(this, arguments);
|
|
10
|
+
}
|
|
11
|
+
function _setup() {
|
|
12
|
+
_setup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
13
|
+
var cwd, root, pkgPath, json, pkg;
|
|
14
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
15
|
+
while (1) switch (_context.prev = _context.next) {
|
|
16
|
+
case 0:
|
|
17
|
+
cwd = _ref.cwd;
|
|
18
|
+
root = cwd || process.cwd();
|
|
19
|
+
pkgPath = join(root, 'package.json'); // change package json
|
|
20
|
+
json = readFileSync(pkgPath, 'utf-8');
|
|
21
|
+
if (json) {
|
|
22
|
+
_context.next = 6;
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
throw new Error('命令执行路径错误,请在根目录执行');
|
|
26
|
+
case 6:
|
|
27
|
+
// copyStatic
|
|
28
|
+
copyStatic(join(__dirname, '../public'), root);
|
|
29
|
+
pkg = JSON.parse(json); // 把 postinstall 删了,只需要执行一次就行
|
|
30
|
+
// TODO: 可以加检测机制,判断以上逻辑都执行完成,再删除
|
|
31
|
+
pkg.scripts.postinstall = '';
|
|
32
|
+
writeFileSync(pkgPath, JSON.stringify(pkg), 'utf-8');
|
|
33
|
+
case 10:
|
|
34
|
+
case "end":
|
|
35
|
+
return _context.stop();
|
|
36
|
+
}
|
|
37
|
+
}, _callee);
|
|
38
|
+
}));
|
|
39
|
+
return _setup.apply(this, arguments);
|
|
40
|
+
}
|
package/es/shims.d.ts
ADDED
package/es/types.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface IRulesType {
|
|
2
|
+
[key: string]: IRule;
|
|
3
|
+
}
|
|
4
|
+
export interface IRulePrams {
|
|
5
|
+
paths: string[];
|
|
6
|
+
value: any;
|
|
7
|
+
key: string;
|
|
8
|
+
diffraction?: (data: any) => any;
|
|
9
|
+
}
|
|
10
|
+
export interface IRule {
|
|
11
|
+
rule?: (props: IRulePrams) => any;
|
|
12
|
+
loopRule?: (item: any) => string;
|
|
13
|
+
loop?: IRulesType;
|
|
14
|
+
}
|
package/es/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getAllImportFiles: (target: string, allImportFiles?: any) => any;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/node/babel/getAllImportFiles.ts
|
|
30
|
+
var getAllImportFiles_exports = {};
|
|
31
|
+
__export(getAllImportFiles_exports, {
|
|
32
|
+
getAllImportFiles: () => getAllImportFiles
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(getAllImportFiles_exports);
|
|
35
|
+
var import_traverse = __toESM(require("@babel/traverse"));
|
|
36
|
+
var import_fs = require("fs");
|
|
37
|
+
var import_path = require("path");
|
|
38
|
+
var import_getRealPath = require("./getRealPath");
|
|
39
|
+
var import_parse = require("./parse");
|
|
40
|
+
var getAllImportFiles = (target, allImportFiles = {}) => {
|
|
41
|
+
var _a;
|
|
42
|
+
if (!(0, import_fs.existsSync)(target)) {
|
|
43
|
+
return allImportFiles;
|
|
44
|
+
}
|
|
45
|
+
if (!(0, import_getRealPath.isJsFile)(target) && !(0, import_getRealPath.isLessFile)(target)) {
|
|
46
|
+
allImportFiles[target] = true;
|
|
47
|
+
return allImportFiles;
|
|
48
|
+
}
|
|
49
|
+
const content = (0, import_fs.readFileSync)(target, "utf-8").toString();
|
|
50
|
+
const getNextImport = (importName) => {
|
|
51
|
+
const isAlias = importName.startsWith("@/");
|
|
52
|
+
const isRelative = importName.startsWith(".");
|
|
53
|
+
if (isAlias || isRelative) {
|
|
54
|
+
let nextPath = (0, import_path.resolve)((0, import_path.dirname)(target), importName);
|
|
55
|
+
if (isAlias) {
|
|
56
|
+
nextPath = importName.replace("@/", `${process.cwd()}/src/`);
|
|
57
|
+
}
|
|
58
|
+
let nextTarget = (0, import_getRealPath.getRealPath)(nextPath);
|
|
59
|
+
if (!allImportFiles[nextTarget]) {
|
|
60
|
+
allImportFiles[nextTarget] = true;
|
|
61
|
+
getAllImportFiles(nextTarget, allImportFiles);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
if ((0, import_getRealPath.isLessFile)(target)) {
|
|
66
|
+
const importList = ((_a = content.match(/@import '([^']+)'/g)) == null ? void 0 : _a.map((match) => match.slice(9, -1)).filter((i) => i.startsWith("."))) || [];
|
|
67
|
+
importList.forEach((i) => {
|
|
68
|
+
getNextImport(i);
|
|
69
|
+
});
|
|
70
|
+
return allImportFiles;
|
|
71
|
+
}
|
|
72
|
+
let ast = (0, import_parse.parse)(content);
|
|
73
|
+
const visitor = {
|
|
74
|
+
Import(path) {
|
|
75
|
+
const source = path.parentPath;
|
|
76
|
+
const args = source.get("arguments");
|
|
77
|
+
if (args[0].node) {
|
|
78
|
+
const importName = args[0].node.value;
|
|
79
|
+
getNextImport(importName);
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
ImportDeclaration(path) {
|
|
83
|
+
const source = path.get("source");
|
|
84
|
+
const importName = source.node.value;
|
|
85
|
+
getNextImport(importName);
|
|
86
|
+
},
|
|
87
|
+
ExportAllDeclaration(path) {
|
|
88
|
+
const source = path.get("source");
|
|
89
|
+
const importName = source.node.value;
|
|
90
|
+
getNextImport(importName);
|
|
91
|
+
},
|
|
92
|
+
ExportNamedDeclaration(path) {
|
|
93
|
+
const source = path.get("source");
|
|
94
|
+
if (source.node) {
|
|
95
|
+
const importName = source.node.value;
|
|
96
|
+
getNextImport(importName);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
(0, import_traverse.default)(ast, visitor);
|
|
101
|
+
return allImportFiles;
|
|
102
|
+
};
|
|
103
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
104
|
+
0 && (module.exports = {
|
|
105
|
+
getAllImportFiles
|
|
106
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const FILE_EXT_NAMES: string[];
|
|
2
|
+
export declare const LESS_EXT_NAMES: string[];
|
|
3
|
+
export declare const isJsFile: (file: string) => boolean;
|
|
4
|
+
export declare const isLessFile: (file: string) => boolean;
|
|
5
|
+
export declare function getRealPath(target: string): string;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/node/babel/getRealPath.ts
|
|
20
|
+
var getRealPath_exports = {};
|
|
21
|
+
__export(getRealPath_exports, {
|
|
22
|
+
FILE_EXT_NAMES: () => FILE_EXT_NAMES,
|
|
23
|
+
LESS_EXT_NAMES: () => LESS_EXT_NAMES,
|
|
24
|
+
getRealPath: () => getRealPath,
|
|
25
|
+
isJsFile: () => isJsFile,
|
|
26
|
+
isLessFile: () => isLessFile
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(getRealPath_exports);
|
|
29
|
+
var import_fs = require("fs");
|
|
30
|
+
var import_path = require("path");
|
|
31
|
+
var FILE_EXT_NAMES = [".tsx", ".ts", ".jsx", ".mjs", ".js", ".d.ts"];
|
|
32
|
+
var LESS_EXT_NAMES = [".less"];
|
|
33
|
+
var isJsFile = (file) => FILE_EXT_NAMES.includes((0, import_path.extname)(file));
|
|
34
|
+
var isLessFile = (file) => LESS_EXT_NAMES.includes((0, import_path.extname)(file));
|
|
35
|
+
function getRealPath(target) {
|
|
36
|
+
if (isJsFile(target) || isLessFile(target)) {
|
|
37
|
+
return target;
|
|
38
|
+
} else {
|
|
39
|
+
for (const fileExtName of FILE_EXT_NAMES) {
|
|
40
|
+
const targetWithExtName = `${target}${fileExtName}`;
|
|
41
|
+
const targetIndexWithExtName = `${target}/index${fileExtName}`;
|
|
42
|
+
if ((0, import_fs.existsSync)(targetWithExtName)) {
|
|
43
|
+
return targetWithExtName;
|
|
44
|
+
}
|
|
45
|
+
if ((0, import_fs.existsSync)(targetIndexWithExtName)) {
|
|
46
|
+
return targetIndexWithExtName;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return target;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
FILE_EXT_NAMES,
|
|
55
|
+
LESS_EXT_NAMES,
|
|
56
|
+
getRealPath,
|
|
57
|
+
isJsFile,
|
|
58
|
+
isLessFile
|
|
59
|
+
});
|