Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Commit b63076f

Browse files
authored
Merge pull request #215 from asigloo/hotifx/remove-vue-demi-rollup
fix(build): remove vue-demi
2 parents d9d7de5 + ed11af8 commit b63076f

File tree

17 files changed

+30
-49
lines changed

17 files changed

+30
-49
lines changed

dev/typescript/App.vue

+3-4
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,9 @@ import {
8181
email,
8282
pattern,
8383
ValidatorTrigger,
84-
ValidationTriggerTypes,
8584
TextAreaField,
86-
} from '../../src';
87-
/* } from '../../dist/as-dynamic-forms.esm'; */
85+
/* } from '../../src'; */
86+
} from '../../dist/as-dynamic-forms.esm';
8887
export default defineComponent({
8988
name: 'app',
9089
setup() {
@@ -236,7 +235,7 @@ export default defineComponent({
236235
validations: [emailValidator],
237236
238237
validationTrigger: ValidatorTrigger({
239-
type: ValidationTriggerTypes.CHANGE,
238+
type: 'change',
240239
threshold: 4,
241240
}),
242241
}),

package.json

+1-6
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@
4545
"jsdelivr": "dist/as-dynamic-forms.global.js",
4646
"module": "dist/as-dynamic-forms.esm-bundler.js",
4747
"types": "dist/as-dynamic-forms.d.ts",
48-
"peerDependencies": {
49-
"@vue/composition-api": "^1.0.0-beta.10",
50-
"vue": "^2.0.0 || >=3.0.4"
51-
},
5248
"devDependencies": {
5349
"@microsoft/api-extractor": "^7.12.0",
5450
"@rollup/plugin-alias": "^3.1.1",
@@ -95,7 +91,6 @@
9591
},
9692
"dependencies": {
9793
"deep-clone": "^3.0.3",
98-
"deep-object-diff": "^1.1.0",
99-
"vue-demi": "^0.5.3"
94+
"deep-object-diff": "^1.1.0"
10095
}
10196
}

rollup.config.js

+2-10
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,6 @@ const outputConfigs = {
3333
file: pkg.main,
3434
format: `cjs`,
3535
},
36-
'global-vue-3': {
37-
file: pkg.unpkg.replace('2', '3'),
38-
format: `iife`,
39-
},
40-
'global-vue-2': {
41-
file: pkg.unpkg,
42-
format: `iife`,
43-
},
4436
esm: {
4537
file: pkg.browser,
4638
format: `es`,
@@ -56,7 +48,7 @@ function createConfig(format, output, plugins = []) {
5648
output.sourcemap = !!process.env.SOURCE_MAP;
5749
output.banner = banner;
5850
output.externalLiveBindings = false;
59-
output.globals = { 'vue-demi': 'VueDemi' };
51+
output.globals = { vue: 'Vue' };
6052

6153
const isProductionBuild = /\.prod\.js$/.test(output.file);
6254
const isGlobalBuild = format === 'global';
@@ -86,7 +78,7 @@ function createConfig(format, output, plugins = []) {
8678
// during a single build.
8779
/* hasTSChecked = true; */
8880

89-
const external = ['vue-demi'];
81+
const external = ['vue'];
9082

9183
const nodePlugins = [resolve(), commonjs()];
9284

src/components/checkbox-input/CheckboxInput.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { defineComponent, h, PropType } from 'vue-demi';
2+
import { defineComponent, h, PropType } from 'vue';
33
import { FormControl, CheckboxInput } from '@/core/models';
44
import { useInputEvents } from '@/composables/input-events';
55
import { useInputValidation } from '@/composables/use-validation';

src/components/dynamic-form/DynamicForm.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
</template>
3737

3838
<script lang="ts">
39-
import { nextTick } from 'vue-demi';
39+
import { nextTick } from 'vue';
4040
4141
import {
4242
defineComponent,
@@ -48,7 +48,7 @@ import {
4848
watch,
4949
inject,
5050
toRaw,
51-
} from 'vue-demi';
51+
} from 'vue';
5252
import { diff } from 'deep-object-diff';
5353
5454
import DynamicInput from '../dynamic-input/DynamicInput.vue';

src/components/dynamic-input/DynamicInput.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
/* eslint-disable @typescript-eslint/no-use-before-define */
33
4-
import { defineComponent, PropType, computed, h } from 'vue-demi';
4+
import { defineComponent, PropType, computed, h } from 'vue';
55
import TextInputComponent from '../text-input/TextInput.vue';
66
import SelectInputComponent from '../select-input/SelectInput.vue';
77
import TextAreaInputComponent from '../text-area-input/TextAreaInput.vue';

src/components/number-input/NumberInput.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { defineComponent, h, PropType } from 'vue-demi';
2+
import { defineComponent, h, PropType } from 'vue';
33
import { FormControl, NumberInput } from '@/core/models';
44
import { useInputEvents } from '@/composables/input-events';
55
import { useInputValidation } from '@/composables/use-validation';

src/components/radio-input/RadioInput.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { defineComponent, h, PropType } from 'vue-demi';
2+
import { defineComponent, h, PropType } from 'vue';
33
import { FormControl, RadioInput } from '@/core/models';
44
import { useInputEvents } from '@/composables/input-events';
55
import { useInputValidation } from '@/composables/use-validation';

src/components/select-input/SelectInput.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { defineComponent, h, PropType, computed } from 'vue-demi';
2+
import { defineComponent, h, PropType, computed } from 'vue';
33
import { FormControl, SelectInput } from '@/core/models';
44
import { useInputEvents } from '@/composables/input-events';
55
import { isObject } from '@/core/utils/helpers';

src/components/text-area-input/TextAreaInput.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { defineComponent, h, PropType } from 'vue-demi';
2+
import { defineComponent, h, PropType } from 'vue';
33
import { FormControl, TextAreaInput } from '@/core/models';
44
import { useInputEvents } from '@/composables/input-events';
55
import { useInputValidation } from '@/composables/use-validation';

src/components/text-input/TextInput.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { defineComponent, h, PropType } from 'vue-demi';
2+
import { defineComponent, h, PropType } from 'vue';
33
import {
44
ColorInput,
55
EmailInput,

src/composables/input-events.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
2-
import { computed, ComputedRef, watch } from 'vue-demi';
2+
import { computed, ComputedRef, watch } from 'vue';
33
import { hasValue } from '../core/utils/helpers';
44

55
import { useInputValidation } from '@/composables/use-validation';

src/composables/use-validation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { ErrorMessage } from '@/core/models';
44
import { removeEmpty } from '@/core/utils/helpers';
5-
import { computed, ref, watch } from 'vue-demi';
5+
import { computed, ref, watch } from 'vue';
66

77
export function useInputValidation(props: any, emit: any) {
88
const isPendingValidation = ref(false);

src/core/models.ts

+9-10
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ export interface DynamicForm {
2929
options?: FormOptions;
3030
}
3131

32+
export const enum ValidationTriggerTypes {
33+
BLUR = 'blur',
34+
CHANGE = 'change',
35+
}
36+
export interface ValidationTrigger {
37+
type: ValidationTriggerTypes;
38+
threshold: number;
39+
}
40+
3241
export interface ErrorMessage {
3342
text: string;
3443
value: boolean | null;
@@ -173,13 +182,3 @@ export const enum FieldTypes {
173182
CUSTOM = 'custom-field',
174183
COLOR = 'color',
175184
}
176-
177-
export const enum ValidationTriggerTypes {
178-
BLUR = 'blur',
179-
CHANGE = 'change',
180-
}
181-
182-
export interface ValidationTrigger {
183-
type: ValidationTriggerTypes;
184-
threshold: number;
185-
}

src/dynamicForms.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { App, isVue3 } from 'vue-demi';
1+
import { App } from 'vue';
22
import { dynamicFormsSymbol } from './useApi';
33
import DynamicForm from './components/dynamic-form/DynamicForm.vue';
44
import { FormOptions } from './core/models';
@@ -22,11 +22,7 @@ export function createDynamicForms(
2222
const self = this;
2323

2424
app.component('dynamic-form', DynamicForm);
25-
if (isVue3) {
26-
app.provide(dynamicFormsSymbol, self);
27-
} else {
28-
app.config.globalProperties.$vdf = self;
29-
}
25+
app.provide(dynamicFormsSymbol, self);
3026
},
3127
};
3228

src/shims-vue.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
declare module '*.vue' {
2-
import { defineComponent } from 'vue-demi';
2+
import { defineComponent } from 'vue';
33
const component: ReturnType<typeof defineComponent>;
44
export default component;
55
}

src/useApi.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { inject, InjectionKey } from 'vue-demi';
1+
import { inject, InjectionKey } from 'vue';
22
import { DynamicFormsPlugin } from './dynamicForms';
33

44
export const dynamicFormsSymbol: InjectionKey<DynamicFormsPlugin> = Symbol();

0 commit comments

Comments
 (0)