Skip to content

Commit

Permalink
Fixed #6708 - Forms: Could not resolve "valibot"
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Nov 1, 2024
1 parent 97b50ae commit cb7e707
Show file tree
Hide file tree
Showing 22 changed files with 60 additions and 25 deletions.
16 changes: 14 additions & 2 deletions packages/forms/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ const ALIAS_ENTRIES = [
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') }
];

Expand Down Expand Up @@ -211,7 +210,20 @@ function addStyle() {
}

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() {
Expand Down
6 changes: 5 additions & 1 deletion packages/forms/scripts/postbuild.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import { clearPackageJson, copyDependencies, renameDTSFile, resolvePath } from '
const { __dirname, __workspace, INPUT_DIR, OUTPUT_DIR } = resolvePath(import.meta.url);

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, '../README.md'), `${OUTPUT_DIR}/README.md`);
Expand Down
11 changes: 1 addition & 10 deletions packages/forms/src/form/Form.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,7 @@
import type { DefineComponent, DesignToken, EmitFn, PassThrough } from '@primevue/core';
import type { ComponentHooks } from '@primevue/core/basecomponent';
import { VNode } from 'vue';

/**
* From primevue/passthrough/index.d.ts
*/
export declare type PassThroughMergePropsType = ((...args: any) => object | undefined) | boolean | undefined;

export interface PassThroughOptions {
mergeSections?: boolean | undefined;
mergeProps?: PassThroughMergePropsType;
}
import type { PassThroughOptions } from '../types';

export declare type FormPassThroughOptionType = FormPassThroughAttributes | ((options: FormPassThroughMethodOptions) => FormPassThroughAttributes | string) | string | null | undefined;

Expand Down
11 changes: 1 addition & 10 deletions packages/forms/src/formfield/FormField.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,7 @@
import type { DefineComponent, DesignToken, EmitFn, PassThrough } from '@primevue/core';
import type { ComponentHooks } from '@primevue/core/basecomponent';
import { Component, VNode } from 'vue';

/**
* From primevue/passthrough/index.d.ts
*/
export declare type PassThroughMergePropsType = ((...args: any) => object | undefined) | boolean | undefined;

export interface PassThroughOptions {
mergeSections?: boolean | undefined;
mergeProps?: PassThroughMergePropsType;
}
import type { PassThroughOptions } from '../types';

export declare type FormFieldPassThroughOptionType = FormFieldPassThroughAttributes | ((options: FormFieldPassThroughMethodOptions) => FormFieldPassThroughAttributes | string) | string | null | undefined;

Expand Down
1 change: 0 additions & 1 deletion packages/forms/src/resolvers/index.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/forms/src/resolvers/index.js

This file was deleted.

1 change: 1 addition & 0 deletions packages/forms/src/resolvers/joi/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@primeuix/forms/resolvers/joi';
1 change: 1 addition & 0 deletions packages/forms/src/resolvers/joi/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@primeuix/forms/resolvers/joi';
File renamed without changes.
1 change: 1 addition & 0 deletions packages/forms/src/resolvers/superstruct/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@primeuix/forms/resolvers/superstruct';
1 change: 1 addition & 0 deletions packages/forms/src/resolvers/superstruct/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@primeuix/forms/resolvers/superstruct';
5 changes: 5 additions & 0 deletions packages/forms/src/resolvers/superstruct/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"main": "./index.js",
"module": "./index.js",
"types": "./index.d.ts"
}
1 change: 1 addition & 0 deletions packages/forms/src/resolvers/valibot/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@primeuix/forms/resolvers/valibot';
1 change: 1 addition & 0 deletions packages/forms/src/resolvers/valibot/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@primeuix/forms/resolvers/valibot';
5 changes: 5 additions & 0 deletions packages/forms/src/resolvers/valibot/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"main": "./index.js",
"module": "./index.js",
"types": "./index.d.ts"
}
1 change: 1 addition & 0 deletions packages/forms/src/resolvers/yup/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@primeuix/forms/resolvers/yup';
1 change: 1 addition & 0 deletions packages/forms/src/resolvers/yup/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@primeuix/forms/resolvers/yup';
5 changes: 5 additions & 0 deletions packages/forms/src/resolvers/yup/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"main": "./index.js",
"module": "./index.js",
"types": "./index.d.ts"
}
1 change: 1 addition & 0 deletions packages/forms/src/resolvers/zod/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@primeuix/forms/resolvers/zod';
1 change: 1 addition & 0 deletions packages/forms/src/resolvers/zod/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@primeuix/forms/resolvers/zod';
5 changes: 5 additions & 0 deletions packages/forms/src/resolvers/zod/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"main": "./index.js",
"module": "./index.js",
"types": "./index.d.ts"
}
9 changes: 9 additions & 0 deletions packages/forms/src/types.d.ts
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit cb7e707

Please sign in to comment.