Skip to content
This repository was archived by the owner on Dec 6, 2021. It is now read-only.

Commit 697e21f

Browse files
authored
Merge pull request #65 from b2nil/dev
fix lib builds
2 parents 91c1612 + ee59e63 commit 697e21f

File tree

66 files changed

+702
-707
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+702
-707
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ yarn add taro-ui-vue3
2626
- 按需引用组件和组件样式
2727

2828
```typescript
29-
import { AtButton } from 'taro-ui-vue3'
29+
import { AtButton } from 'taro-ui-vue3/lib'
3030
import 'taro-ui-vue3/dist/style/components/button.scss'
3131

3232
export default {

config/index.js

+40-14
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const path = require('path')
2+
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
23

34
const config = {
45
projectName: 'taro-ui-vue3',
@@ -18,10 +19,9 @@ const config = {
1819
},
1920
alias: {
2021
'@/components': path.resolve(__dirname, '..', 'src/components'),
21-
'@/utils': path.resolve(__dirname, '..', 'src/utils'),
2222
'@/style': path.resolve(__dirname, '..', 'src/style'),
2323
'@/assets': path.resolve(__dirname, '..', 'src/assets'),
24-
'@/composables': path.resolve(__dirname, '..', 'src/composables'),
24+
'taro-ui-vue3$': path.resolve(__dirname, '..', 'dist/index.esm.js')
2525
},
2626
copy: {
2727
patterns: [
@@ -53,16 +53,24 @@ const config = {
5353
}
5454
},
5555
webpackChain(chain) {
56-
chain.module
57-
.rule('typescript')
58-
.test(/.\ts$/)
59-
.use('ts-loader')
60-
.loader('ts-loader')
61-
.tap(options => ({
62-
...options,
63-
appendTsSuffixTo: [/\.vue$/]
64-
}))
65-
.end()
56+
chain.merge({
57+
plugin: {
58+
install: {
59+
plugin: BundleAnalyzerPlugin,
60+
},
61+
},
62+
optimization: {
63+
usedExports: true,
64+
},
65+
module: {
66+
rules: [
67+
{
68+
include: path.resolve('node_modules', 'taro-ui-vue3'),
69+
sideEffects: false
70+
}
71+
]
72+
}
73+
})
6674
}
6775
},
6876
h5: {
@@ -84,8 +92,26 @@ const config = {
8492
},
8593
webpackChain(chain) {
8694
chain.resolve.alias
87-
.set('@tarojs/components$', path.resolve(__dirname, '..', 'node_modules/@tarojs/components/dist-h5/vue3/index.js'))
88-
.set('@tarojs/components/dist/taro-components/taro-components.css', path.resolve(__dirname, '..', 'node_modules/@tarojs/components/dist/taro-components/taro-components.css'))
95+
.set('@tarojs/components$', '@tarojs/components/dist-h5/vue3/index.js')
96+
97+
chain.merge({
98+
plugin: {
99+
install: {
100+
plugin: BundleAnalyzerPlugin,
101+
},
102+
},
103+
optimization: {
104+
usedExports: true,
105+
},
106+
module: {
107+
rules: [
108+
{
109+
include: path.resolve('node_modules', 'taro-ui-vue3'),
110+
sideEffects: false
111+
}
112+
]
113+
}
114+
})
89115
},
90116
router: {
91117
mode: 'browser'

package.json

+11-6
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
"name": "taro-ui-vue3",
33
"version": "1.0.0-alpha.15",
44
"description": "Taro UI Rewritten in Vue 3.0",
5-
"main:h5": "dist/index.esm.js",
6-
"browser": "dist/index.umd.js",
75
"module": "dist/index.esm.js",
86
"main": "dist/index.js",
97
"source": "src/index.ts",
@@ -22,6 +20,7 @@
2220
"files": [
2321
"dist",
2422
"lib/components",
23+
"lib/composables",
2524
"lib/utils",
2625
"lib/index.js",
2726
"lib/index.js.map",
@@ -75,21 +74,25 @@
7574
"ios >= 8"
7675
],
7776
"dependencies": {
78-
"@babel/runtime": "^7.7.7",
7977
"dayjs": "^1.8.29",
80-
"lodash": "^4.17.19",
78+
"lodash-es": "^4.17.15"
79+
},
80+
"peerDependencies": {
81+
"@tarojs/components": "^3.0.15",
82+
"@tarojs/taro": "^3.0.15",
8183
"vue": "^3.0.0"
8284
},
8385
"devDependencies": {
8486
"@babel/core": "^7.8.0",
85-
"@rollup/plugin-commonjs": "^15.0.0",
87+
"@babel/runtime": "^7.7.7",
8688
"@rollup/plugin-json": "^4.1.0",
8789
"@rollup/plugin-node-resolve": "^9.0.0",
8890
"@tarojs/components": "^3.0.15",
8991
"@tarojs/mini-runner": "^3.0.15",
9092
"@tarojs/runtime": "^3.0.15",
9193
"@tarojs/taro": "^3.0.15",
9294
"@tarojs/webpack-runner": "^3.0.15",
95+
"@types/lodash-es": "^4.17.3",
9396
"@types/webpack-env": "^1.13.6",
9497
"@typescript-eslint/eslint-plugin": "^2.x",
9598
"@typescript-eslint/parser": "^2.x",
@@ -108,6 +111,8 @@
108111
"stylelint": "^9.3.0",
109112
"ts-loader": "^8.0.2",
110113
"typescript": "^3.7.0",
111-
"vue-loader": "^16.0.0-beta.7"
114+
"vue": "^3.0.0",
115+
"vue-loader": "^16.0.0-beta.7",
116+
"webpack-bundle-analyzer": "^4.2.0"
112117
}
113118
}

rollup.config.js

+1-17
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import NodePath from 'path'
22
import RollupJson from '@rollup/plugin-json'
33
import RollupNodeResolve from '@rollup/plugin-node-resolve'
4-
import RollupCommonjs from '@rollup/plugin-commonjs'
54
import RollupTypescript from 'rollup-plugin-typescript2'
65
import RollupCopy from 'rollup-plugin-copy'
76
import RollupSass from 'rollup-plugin-sass'
@@ -11,9 +10,8 @@ import Package from './package.json'
1110
const resolveFile = path => NodePath.resolve(__dirname, path)
1211
const externalPackages = [
1312
'vue',
14-
'@tarojs/components',
15-
'@tarojs/runtime',
1613
'@tarojs/taro',
14+
'@tarojs/components',
1715
]
1816

1917
export default {
@@ -28,17 +26,6 @@ export default {
2826
file: resolveFile(Package.module),
2927
format: 'es',
3028
sourcemap: true
31-
},
32-
{
33-
file: resolveFile(Package.browser),
34-
format: 'umd',
35-
name: 'taro-ui-vue3',
36-
sourcemap: true,
37-
globals: {
38-
'vue': 'vue',
39-
'@tarojs/components': 'components',
40-
'@tarojs/taro': 'Taro'
41-
}
4229
}
4330
],
4431
external: externalPackages,
@@ -49,9 +36,6 @@ export default {
4936
moduleDirectory: 'node_modules'
5037
}
5138
}),
52-
RollupCommonjs({
53-
include: /\/node_modules\//
54-
}),
5539
RollupJson(),
5640
RollupTypescript({
5741
tsconfig: resolveFile('tsconfig.rollup.json')

src/components/calendar/body/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Swiper, SwiperItem, View } from '@tarojs/components'
33
import { BaseEventOrig, ITouch, ITouchEvent } from '@tarojs/components/types/common'
44
import { AtCalendarBodyListGroup, AtCalendarBodyProps, Calendar, AtCalendarBodyState } from 'types/calendar'
55
import Taro from '@tarojs/taro'
6-
import dayjs from 'dayjs'
6+
import dayjs from 'dayjs/esm/index'
77
import { delayQuerySelector } from '../../../utils/common'
88
import generateCalendarGroup from '../common/helper'
99
import AtCalendarDateList from '../ui/date-list/index'

src/components/calendar/common/helper.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import dayjs, { Dayjs } from 'dayjs'
2-
import _flow from 'lodash/flow'
1+
import dayjs, { Dayjs } from 'dayjs/esm/index'
2+
import _flow from 'lodash-es/flow'
33
import { Calendar } from 'types/calendar'
44
import * as constant from './constant'
55
import plugins from './plugins'
@@ -26,11 +26,11 @@ function getFullItem(
2626
export default function generateCalendarGroup(
2727
options: Calendar.GroupOptions
2828
): (
29-
generateDate: number,
30-
selectedDate: Calendar.SelectedDate,
31-
isShowStatus?: boolean
32-
) => Calendar.ListInfo<Calendar.Item> {
33-
return function(
29+
generateDate: number,
30+
selectedDate: Calendar.SelectedDate,
31+
isShowStatus?: boolean
32+
) => Calendar.ListInfo<Calendar.Item> {
33+
return function (
3434
generateDate: number,
3535
selectedDate: Calendar.SelectedDate,
3636
isShowStatus?: boolean

src/components/calendar/common/plugins.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import dayjs from 'dayjs'
2-
import _isEmpty from 'lodash/isEmpty'
1+
import dayjs from 'dayjs/esm/index'
2+
import _isEmpty from 'lodash-es/isEmpty'
33
import { Calendar } from 'types/calendar'
44

55
interface PluginArg {

src/components/calendar/controller/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { h, defineComponent, computed, PropType } from "vue"
22
import { Picker, Text, View } from '@tarojs/components'
33
import { Calendar, AtCalendarControllerProps } from 'types/calendar'
44
import { CommonEvent } from '@tarojs/components/types/common'
5-
import dayjs from 'dayjs'
5+
import dayjs from 'dayjs/esm/index'
66

77
const AtCalendarController = defineComponent({
88
name: "AtCalendarController",

src/components/calendar/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { h, defineComponent, reactive, toRefs, watch, nextTick, mergeProps, PropType } from "vue"
2-
import dayjs, { Dayjs } from 'dayjs'
2+
import dayjs, { Dayjs } from 'dayjs/esm/index'
33

44
import { View } from '@tarojs/components'
55
import { CommonEvent } from '@tarojs/components/types/common'

src/components/countdown/index.scss

-74
This file was deleted.

src/components/countdown/index.ts

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import { AtCountDownProps, AtCountdownState } from 'types/countdown'
44

55
import AtCountdownItem from "./item"
66

7-
import './index.scss'
8-
97
const toSeconds = (
108
day: number,
119
hours: number,

src/components/divider/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { h, defineComponent, computed, mergeProps, PropType } from "vue"
22
import { View } from '@tarojs/components'
33
import { AtDividerProps } from 'types/divider'
4-
import { pxTransform } from "@/utils/common"
4+
import { pxTransform } from "../../utils/common"
55

66
const AtDivider = defineComponent({
77
name: "AtDivider",

src/components/float-layout/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { h, defineComponent, computed, ref, nextTick, watch, mergeProps, PropType } from "vue"
2-
import { handleTouchScroll } from "@/utils/common"
2+
import { handleTouchScroll } from "../../utils/common"
33

44
import { ScrollView, Text, View } from '@tarojs/components'
55
import { CommonEvent } from '@tarojs/components/types/common'

src/components/grid/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { h, defineComponent, computed, mergeProps, PropType } from "vue"
2-
import _chunk from 'lodash/chunk'
2+
import _chunk from 'lodash-es/chunk'
33
import { Image, View, Text } from '@tarojs/components'
44
import { CommonEvent } from '@tarojs/components/types'
55
import { AtGridProps, AtGridItem } from 'types/grid'
6-
import { mergeStyle } from "@/utils/common"
6+
import { mergeStyle } from "../../utils/common"
77

88
const AtGrid = defineComponent({
99
name: "AtGrid",

src/components/icon/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { defineComponent, computed, h, mergeProps, PropType } from "vue"
22
import { Text } from '@tarojs/components'
33
import { AtIconProps } from "types/icon"
4-
import { pxTransform } from "@/utils/common"
4+
import { pxTransform } from "../../utils/common"
55

66
const AtIcon = defineComponent({
77
name: "AtIcon",

src/components/image-picker/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { h, defineComponent, computed, mergeProps, PropType } from "vue"
22
import Taro from '@tarojs/taro'
33

4-
import { uuid } from '@/utils/common'
4+
import { uuid } from '../../utils/common'
55

66
import { Image, View } from '@tarojs/components'
77
import { AtImagePickerProps, File } from 'types/image-picker'

src/components/indexes/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
import {
1616
delayQuerySelector,
1717
pxTransform,
18-
} from "@/utils/common"
18+
} from "../../utils/common"
1919

2020
import Taro from '@tarojs/taro'
2121
import { ScrollView, View } from '@tarojs/components'

src/components/input-number/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { h, defineComponent, computed, mergeProps, PropType } from "vue"
2-
import _toString from 'lodash/toString'
3-
import { pxTransform } from "@/utils/common"
2+
import _toString from 'lodash-es/toString'
3+
import { pxTransform } from "../../utils/common"
44

55
import { Input, Text, View } from '@tarojs/components'
66
import { CommonEvent, ITouchEvent } from '@tarojs/components/types/common'

src/components/input/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
KeyboardHeightEventDetail,
1212
} from "types/input"
1313
import { ENV_TYPE, getEnv } from "@tarojs/taro"
14-
import { uuid } from "@/utils/common"
14+
import { uuid } from "../../utils/common"
1515

1616
type PickAtInputProps = Pick<AtInputProps, 'maxLength' | 'disabled' | 'password'>
1717
type GetInputPropsReturn = PickAtInputProps & Pick<InputProps, 'type'>

src/components/modal/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defineComponent, reactive, nextTick, watch, h, computed, mergeProps, PropType } from 'vue'
22

3-
import { handleTouchScroll } from '@/utils/common'
3+
import { handleTouchScroll } from '../../utils/common'
44

55
import Taro from '@tarojs/taro'
66
import { Button, Text, View } from '@tarojs/components'

src/components/nav-bar/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { h, defineComponent, computed, mergeProps, PropType } from 'vue'
22
import { Text, View } from '@tarojs/components'
33
import { ITouchEvent } from '@tarojs/components/types/common'
44
import { AtNavBarProps } from 'types/nav-bar'
5-
import { mergeStyle, pxTransform } from '@/utils/common'
5+
import { mergeStyle, pxTransform } from '../../utils/common'
66

77
const AtNavBar = defineComponent({
88
name: "AtNavBar",

src/components/range/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
delayQuerySelector,
77
getEventDetail,
88
mergeStyle
9-
} from '@/utils/common'
9+
} from '../../utils/common'
1010

1111
const AtRange = defineComponent({
1212
name: "AtRange",

src/components/rate/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { h, defineComponent, computed, mergeProps, PropType } from 'vue'
22
import { Text, View } from '@tarojs/components'
33
import { CommonEvent } from '@tarojs/components/types/common'
44
import { AtRateProps } from 'types/rate'
5-
import { pxTransform } from '@/utils/common'
5+
import { pxTransform } from '../../utils/common'
66

77
const AtRate = defineComponent({
88
name: "AtRate",

src/components/search-bar/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Input, Text, View } from '@tarojs/components'
33
import { BaseEventOrig, CommonEvent, ITouchEvent } from '@tarojs/components/types/common'
44
import { AtSearchBarProps, AtSearchBarState } from 'types/search-bar'
55
import { ENV_TYPE, getEnv } from '@tarojs/taro'
6-
import { uuid } from '@/utils/common'
6+
import { uuid } from '../../utils/common'
77

88
const AtSearchBar = defineComponent({
99
name: "AtSearchBar",

src/components/segmented-control/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { h, defineComponent, computed, mergeProps, PropType } from 'vue'
22
import { View } from '@tarojs/components'
33
import { CommonEvent } from '@tarojs/components/types/common'
44
import { AtSegmentedControlProps } from 'types/segmented-control'
5-
import { pxTransform } from '@/utils/common'
5+
import { pxTransform } from '../../utils/common'
66

77
const AtSegmentedControl = defineComponent({
88

src/components/skeleton/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import {
1111
View
1212
} from "@tarojs/components"
1313

14-
import { dimensionsFactory } from "@/composables/dimensions"
15-
import { makeElevationProps, useElevationClasses } from "@/composables/elevation"
14+
import { dimensionsFactory } from "../../composables/dimensions"
15+
import { makeElevationProps, useElevationClasses } from "../../composables/elevation"
1616

1717
// types
1818
import {

0 commit comments

Comments
 (0)