Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"type": "commonjs",
"exports": {
".": {
"import": "./dist/index.js",
"import": "./dist/esm/index.js",
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
}
Expand All @@ -41,7 +41,9 @@
"dist"
],
"scripts": {
"build": "tsc --project tsconfig.build.json",
"build": "npm run build:cjs && npm run build:esm",
"build:cjs": "tsc --project tsconfig.build.json",
"build:esm": "tsc --project tsconfig.build.esm.json",
"format": "prettier . --write",
"lint": "npm run lint:eslint && npm run lint:markdownlint && npm run lint:prettier",
"lint:eslint": "eslint .",
Expand Down
10 changes: 1 addition & 9 deletions src/validators/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import Vue from 'vue';

export type Validator = (value: unknown) => string | undefined;
export type VuePropValidator = (value: unknown) => boolean;

Expand All @@ -23,13 +21,7 @@ export function vuePropValidator(
for (const validator of validators) {
const errorMessage = validator(value);
if (errorMessage) {
if (typeof Vue === 'object' && 'util' in Vue) {
// @ts-expect-error -- Vue.util is only available in Vue 2, but provides more context than console.warn
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
Vue.util.warn(`${errorMessage} (received: '${String(value)}')`);
} else {
console.warn(`${errorMessage} (received: '${String(value)}')`);
}
console.warn(`${errorMessage} (received: '${String(value)}')`);
return false;
}
}
Expand Down
9 changes: 9 additions & 0 deletions tsconfig.build.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.build.json",
"compilerOptions": {
"module": "esnext",
"moduleResolution": "bundler",
"outDir": "./dist/esm",
"declaration": false
}
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"target": "es2019",
"module": "node16",
"declaration": true,
"outDir": "./dist/",
"outDir": "./dist",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
Expand Down