Fixed #6708 - Forms: Could not resolve "valibot"

pull/6714/head
Mert Sincan 2024-11-01 21:53:41 +00:00
parent 97b50aea57
commit cb7e707f03
22 changed files with 60 additions and 25 deletions

View File

@ -43,7 +43,6 @@ const ALIAS_ENTRIES = [
return targetFile ? path.join(folderPath, targetFile) : null; return targetFile ? path.join(folderPath, targetFile) : null;
} }
}, },
{ find: '@primevue/forms/resolvers', replacement: path.resolve(__dirname, './src/resolvers/index.js') },
{ find: '@primevue/forms/useform', replacement: path.resolve(__dirname, './src/useform/index.js') } { find: '@primevue/forms/useform', replacement: path.resolve(__dirname, './src/useform/index.js') }
]; ];
@ -211,7 +210,20 @@ function addStyle() {
} }
function addResolvers() { function addResolvers() {
ENTRY.format.es({ input: process.env.INPUT_DIR + 'resolvers/index.js', output: process.env.OUTPUT_DIR + 'resolvers/index' }); fs.readdirSync(path.resolve(__dirname, process.env.INPUT_DIR + 'resolvers'), { withFileTypes: true })
.filter((dir) => dir.isDirectory())
.forEach(({ name: folderName }) => {
fs.readdirSync(path.resolve(__dirname, process.env.INPUT_DIR + 'resolvers/' + folderName)).forEach((file) => {
let name = file.split(/(.vue)$|(.js)$/)[0].toLowerCase();
if (name === 'index') {
const input = process.env.INPUT_DIR + 'resolvers/' + folderName + '/' + file;
const output = process.env.OUTPUT_DIR + 'resolvers/' + folderName + '/index';
ENTRY.format.es({ input, output });
}
});
});
} }
function addUseForm() { function addUseForm() {

View File

@ -5,7 +5,11 @@ import { clearPackageJson, copyDependencies, renameDTSFile, resolvePath } from '
const { __dirname, __workspace, INPUT_DIR, OUTPUT_DIR } = resolvePath(import.meta.url); const { __dirname, __workspace, INPUT_DIR, OUTPUT_DIR } = resolvePath(import.meta.url);
copyDependencies(INPUT_DIR, OUTPUT_DIR, '/style'); copyDependencies(INPUT_DIR, OUTPUT_DIR, '/style');
renameDTSFile(OUTPUT_DIR, 'index'); renameDTSFile(OUTPUT_DIR, 'index', (name) => {
return name !== 'types.d.ts';
});
fs.copySync(path.resolve(__dirname, '../src/types.d.ts'), `${OUTPUT_DIR}/types.d.ts`);
fs.copySync(path.resolve(__dirname, '../package.json'), `${OUTPUT_DIR}/package.json`); fs.copySync(path.resolve(__dirname, '../package.json'), `${OUTPUT_DIR}/package.json`);
fs.copySync(path.resolve(__dirname, '../README.md'), `${OUTPUT_DIR}/README.md`); fs.copySync(path.resolve(__dirname, '../README.md'), `${OUTPUT_DIR}/README.md`);

View File

@ -10,16 +10,7 @@
import type { DefineComponent, DesignToken, EmitFn, PassThrough } from '@primevue/core'; import type { DefineComponent, DesignToken, EmitFn, PassThrough } from '@primevue/core';
import type { ComponentHooks } from '@primevue/core/basecomponent'; import type { ComponentHooks } from '@primevue/core/basecomponent';
import { VNode } from 'vue'; import { VNode } from 'vue';
import type { PassThroughOptions } from '../types';
/**
* From primevue/passthrough/index.d.ts
*/
export declare type PassThroughMergePropsType = ((...args: any) => object | undefined) | boolean | undefined;
export interface PassThroughOptions {
mergeSections?: boolean | undefined;
mergeProps?: PassThroughMergePropsType;
}
export declare type FormPassThroughOptionType = FormPassThroughAttributes | ((options: FormPassThroughMethodOptions) => FormPassThroughAttributes | string) | string | null | undefined; export declare type FormPassThroughOptionType = FormPassThroughAttributes | ((options: FormPassThroughMethodOptions) => FormPassThroughAttributes | string) | string | null | undefined;

View File

@ -9,16 +9,7 @@
import type { DefineComponent, DesignToken, EmitFn, PassThrough } from '@primevue/core'; import type { DefineComponent, DesignToken, EmitFn, PassThrough } from '@primevue/core';
import type { ComponentHooks } from '@primevue/core/basecomponent'; import type { ComponentHooks } from '@primevue/core/basecomponent';
import { Component, VNode } from 'vue'; import { Component, VNode } from 'vue';
import type { PassThroughOptions } from '../types';
/**
* From primevue/passthrough/index.d.ts
*/
export declare type PassThroughMergePropsType = ((...args: any) => object | undefined) | boolean | undefined;
export interface PassThroughOptions {
mergeSections?: boolean | undefined;
mergeProps?: PassThroughMergePropsType;
}
export declare type FormFieldPassThroughOptionType = FormFieldPassThroughAttributes | ((options: FormFieldPassThroughMethodOptions) => FormFieldPassThroughAttributes | string) | string | null | undefined; export declare type FormFieldPassThroughOptionType = FormFieldPassThroughAttributes | ((options: FormFieldPassThroughMethodOptions) => FormFieldPassThroughAttributes | string) | string | null | undefined;

View File

@ -1 +0,0 @@
export * from '@primeuix/forms/resolvers';

View File

@ -1 +0,0 @@
export * from '@primeuix/forms/resolvers';

View File

@ -0,0 +1 @@
export * from '@primeuix/forms/resolvers/joi';

View File

@ -0,0 +1 @@
export * from '@primeuix/forms/resolvers/joi';

View File

@ -0,0 +1 @@
export * from '@primeuix/forms/resolvers/superstruct';

View File

@ -0,0 +1 @@
export * from '@primeuix/forms/resolvers/superstruct';

View File

@ -0,0 +1,5 @@
{
"main": "./index.js",
"module": "./index.js",
"types": "./index.d.ts"
}

View File

@ -0,0 +1 @@
export * from '@primeuix/forms/resolvers/valibot';

View File

@ -0,0 +1 @@
export * from '@primeuix/forms/resolvers/valibot';

View File

@ -0,0 +1,5 @@
{
"main": "./index.js",
"module": "./index.js",
"types": "./index.d.ts"
}

View File

@ -0,0 +1 @@
export * from '@primeuix/forms/resolvers/yup';

View File

@ -0,0 +1 @@
export * from '@primeuix/forms/resolvers/yup';

View File

@ -0,0 +1,5 @@
{
"main": "./index.js",
"module": "./index.js",
"types": "./index.d.ts"
}

View File

@ -0,0 +1 @@
export * from '@primeuix/forms/resolvers/zod';

View File

@ -0,0 +1 @@
export * from '@primeuix/forms/resolvers/zod';

View File

@ -0,0 +1,5 @@
{
"main": "./index.js",
"module": "./index.js",
"types": "./index.d.ts"
}

9
packages/forms/src/types.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
/**
* From primevue/passthrough/index.d.ts
*/
export declare type PassThroughMergePropsType = ((...args: any) => object | undefined) | boolean | undefined;
export interface PassThroughOptions {
mergeSections?: boolean | undefined;
mergeProps?: PassThroughMergePropsType;
}