@vinejs/compiler
Advanced tools
Comparing version 2.4.1 to 2.5.0
@@ -41,2 +41,3 @@ // src/compiler/buffer.ts | ||
valueExpression, | ||
parentExpression, | ||
fieldNameExpression, | ||
@@ -50,2 +51,8 @@ parentValueExpression | ||
})` : valueExpression; | ||
let fieldPathOutputExpression = ""; | ||
if (parentExpression === "root" || parentExpression === "root_item") { | ||
fieldPathOutputExpression = fieldNameExpression; | ||
} else if (fieldNameExpression !== "''") { | ||
fieldPathOutputExpression = `${parentExpression}.getFieldPath() + '.' + ${fieldNameExpression}`; | ||
} | ||
return `const ${variableName} = defineValue(${inValueExpression}, { | ||
@@ -56,2 +63,5 @@ data: root, | ||
wildCardPath: '${wildCardPath}', | ||
getFieldPath() { | ||
return ${fieldPathOutputExpression}; | ||
}, | ||
mutate: defineValue, | ||
@@ -86,2 +96,3 @@ report: report, | ||
isArrayMember: this.field.isArrayMember, | ||
parentExpression: this.field.parentExpression, | ||
parentValueExpression: this.field.parentValueExpression, | ||
@@ -676,2 +687,3 @@ valueExpression: this.field.valueExpression, | ||
return { | ||
parentExpression: parent.variableName, | ||
parentValueExpression: parent.variableName, | ||
@@ -746,2 +758,3 @@ fieldNameExpression: `''`, | ||
return { | ||
parentExpression: parent.variableName, | ||
parentValueExpression: `${parent.variableName}.value`, | ||
@@ -762,2 +775,3 @@ fieldNameExpression: `${parent.variableName}_i`, | ||
return { | ||
parentExpression: parent.variableName, | ||
parentValueExpression: `${parent.variableName}.value`, | ||
@@ -785,2 +799,3 @@ fieldNameExpression: `${node.fieldName}`, | ||
return { | ||
parentExpression: parent.variableName, | ||
parentValueExpression: `${parent.variableName}.value`, | ||
@@ -801,2 +816,3 @@ fieldNameExpression: `'${node.fieldName}'`, | ||
return { | ||
parentExpression: parent.variableName, | ||
parentValueExpression: `${parent.variableName}.value`, | ||
@@ -803,0 +819,0 @@ fieldNameExpression: `${parent.variableName}_i`, |
import { RefIdentifier } from '../../types.js'; | ||
type FieldOptions = { | ||
parentExpression: string; | ||
variableName: string; | ||
@@ -16,3 +17,3 @@ valueExpression: string; | ||
*/ | ||
export declare function defineFieldVariables({ parseFnRefId, variableName, wildCardPath, isArrayMember, valueExpression, fieldNameExpression, parentValueExpression, }: FieldOptions): string; | ||
export declare function defineFieldVariables({ parseFnRefId, variableName, wildCardPath, isArrayMember, valueExpression, parentExpression, fieldNameExpression, parentValueExpression, }: FieldOptions): string; | ||
export {}; |
@@ -71,2 +71,7 @@ /** | ||
/** | ||
* Returns the nested path to the field. The parts | ||
* are joined by a dot notation. | ||
*/ | ||
getFieldPath(): string; | ||
/** | ||
* Wildcard path for the field. The value is a nested | ||
@@ -365,2 +370,3 @@ * pointer to the field under validation. | ||
export type CompilerField = { | ||
parentExpression: string; | ||
parentValueExpression: string; | ||
@@ -367,0 +373,0 @@ fieldNameExpression: string; |
{ | ||
"name": "@vinejs/compiler", | ||
"version": "2.4.1", | ||
"version": "2.5.0", | ||
"description": "Low level compiler for VineJS validator", | ||
@@ -48,4 +48,4 @@ "type": "module", | ||
"@japa/runner": "^3.1.1", | ||
"@swc/core": "^1.4.6", | ||
"@types/node": "^20.11.25", | ||
"@swc/core": "^1.4.11", | ||
"@types/node": "^20.11.30", | ||
"acorn": "^8.11.3", | ||
@@ -59,3 +59,3 @@ "ajv": "^8.12.0", | ||
"js-beautify": "^1.15.1", | ||
"np": "^10.0.0", | ||
"np": "^10.0.2", | ||
"prettier": "^3.2.5", | ||
@@ -65,3 +65,3 @@ "tinybench": "^2.6.0", | ||
"tsup": "^8.0.2", | ||
"typescript": "^5.4.2", | ||
"typescript": "^5.4.3", | ||
"zod": "^3.22.4" | ||
@@ -68,0 +68,0 @@ }, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
142917
1832