From 715eaaa4086ea9d8b0c66fd079dafcc54bb48ac4 Mon Sep 17 00:00:00 2001 From: Ayo Date: Sun, 23 Oct 2022 23:23:23 +0200 Subject: [PATCH] fix(form): import of validator causes error if not installed --- package-lock.json | 8 ++++++-- packages/form/core/form-control.ts | 2 +- packages/form/package.json | 5 ++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 374100f..7b8189f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10478,8 +10478,11 @@ }, "packages/form": { "name": "@astro-reactive/form", - "version": "0.4.6", + "version": "0.5.0", "license": "MIT", + "dependencies": { + "@astro-reactive/validator": "^0.1.0" + }, "devDependencies": { "@types/chai": "^4.3.3", "@types/eslint": "^8.4.6", @@ -10513,7 +10516,7 @@ }, "packages/validator": { "name": "@astro-reactive/validator", - "version": "0.0.5", + "version": "0.1.0", "license": "MIT", "devDependencies": { "@types/chai": "^4.3.3", @@ -10732,6 +10735,7 @@ "@astro-reactive/form": { "version": "file:packages/form", "requires": { + "@astro-reactive/validator": "^0.1.0", "@types/chai": "^4.3.3", "@types/eslint": "^8.4.6", "@types/mocha": "^10.0.0", diff --git a/packages/form/core/form-control.ts b/packages/form/core/form-control.ts index 5360f69..c82c4ee 100644 --- a/packages/form/core/form-control.ts +++ b/packages/form/core/form-control.ts @@ -51,7 +51,7 @@ export class FormControl { this._placeholder = placeholder; this._validators = validators; - // dynamic import of the validator package + // TODO: implement independence, form should not import validator import('@astro-reactive/validator').then((validator) => { if (validator) { this.validate = validator.validate; diff --git a/packages/form/package.json b/packages/form/package.json index c4c5957..5271e0d 100644 --- a/packages/form/package.json +++ b/packages/form/package.json @@ -54,5 +54,8 @@ "peerDependencies": { "astro": "^1.5.0" }, - "license": "MIT" + "license": "MIT", + "dependencies": { + "@astro-reactive/validator": "^0.1.0" + } }