@vinejs/compiler
Advanced tools
| /** | ||
| * Converts the value to a valid JavaScript variable name | ||
| */ | ||
| export declare function toVariableName(value: string): string; |
+60
-2
@@ -788,2 +788,61 @@ // src/compiler/buffer.ts | ||
| // src/helpers.ts | ||
| var NUMBER_CHAR_RE = /\d/; | ||
| var VALID_CHARS = /[A-Za-z0-9]+/; | ||
| function isUppercase(char = "") { | ||
| if (NUMBER_CHAR_RE.test(char)) { | ||
| return void 0; | ||
| } | ||
| return char !== char.toLowerCase(); | ||
| } | ||
| function upperFirst(value) { | ||
| return value ? value[0].toUpperCase() + value.slice(1) : ""; | ||
| } | ||
| function lowerFirst(value) { | ||
| return value ? value[0].toLowerCase() + value.slice(1) : ""; | ||
| } | ||
| function splitByCase(value) { | ||
| const parts = []; | ||
| if (!value || typeof value !== "string") { | ||
| return parts; | ||
| } | ||
| let buff = ""; | ||
| let previousUpper; | ||
| let previousSplitter; | ||
| for (const char of value) { | ||
| const isSplitter = !VALID_CHARS.test(char); | ||
| if (isSplitter === true) { | ||
| parts.push(buff); | ||
| buff = ""; | ||
| previousUpper = void 0; | ||
| continue; | ||
| } | ||
| const isUpper = isUppercase(char); | ||
| if (previousSplitter === false) { | ||
| if (previousUpper === false && isUpper === true) { | ||
| parts.push(buff); | ||
| buff = char; | ||
| previousUpper = isUpper; | ||
| continue; | ||
| } | ||
| if (previousUpper === true && isUpper === false && buff.length > 1) { | ||
| const lastChar = buff.at(-1); | ||
| parts.push(buff.slice(0, Math.max(0, buff.length - 1))); | ||
| buff = lastChar + char; | ||
| previousUpper = isUpper; | ||
| continue; | ||
| } | ||
| } | ||
| buff += char; | ||
| previousUpper = isUpper; | ||
| previousSplitter = isSplitter; | ||
| } | ||
| parts.push(buff); | ||
| return parts; | ||
| } | ||
| function toVariableName(value) { | ||
| const pascalCase = splitByCase(value).map((p) => upperFirst(p.toLowerCase())).join(""); | ||
| return /^[0-9]+/.test(pascalCase) ? `var_${pascalCase}` : lowerFirst(pascalCase); | ||
| } | ||
| // src/compiler/fields/object_field.ts | ||
@@ -798,3 +857,3 @@ function createObjectField(node, variablesCounter, parent) { | ||
| wildCardPath, | ||
| variableName: `${node.propertyName}_${variablesCounter}`, | ||
| variableName: `${toVariableName(node.propertyName)}_${variablesCounter}`, | ||
| valueExpression: `${parent.variableName}.value['${node.fieldName}']`, | ||
@@ -1073,2 +1132,1 @@ outputExpression: `${parent.variableName}_out['${node.propertyName}']`, | ||
| }; | ||
| //# sourceMappingURL=index.js.map |
+63
-49
| { | ||
| "name": "@vinejs/compiler", | ||
| "version": "2.5.0", | ||
| "version": "2.5.1", | ||
| "description": "Low level compiler for VineJS validator", | ||
@@ -22,14 +22,13 @@ "type": "module", | ||
| "test": "c8 npm run quick:test", | ||
| "quick:test": "node --loader=ts-node/esm bin/test.ts", | ||
| "lint": "eslint", | ||
| "format": "prettier --write .", | ||
| "typecheck": "tsc --noEmit", | ||
| "clean": "del-cli build", | ||
| "typecheck": "tsc --noEmit", | ||
| "precompile": "npm run lint && npm run clean", | ||
| "compile": "tsup-node && tsc --emitDeclarationOnly --declaration", | ||
| "build": "npm run compile", | ||
| "release": "np", | ||
| "release": "release-it", | ||
| "version": "npm run build", | ||
| "prepublishOnly": "npm run build", | ||
| "lint": "eslint . --ext=.ts", | ||
| "format": "prettier --write .", | ||
| "sync-labels": "github-label-sync --labels .github/labels.json vinejs/compiler" | ||
| "quick:test": "node --import=ts-node-maintained/register/esm --enable-source-maps bin/test.ts" | ||
| }, | ||
@@ -44,24 +43,24 @@ "keywords": [ | ||
| "devDependencies": { | ||
| "@adonisjs/eslint-config": "^1.3.0", | ||
| "@adonisjs/prettier-config": "^1.3.0", | ||
| "@adonisjs/tsconfig": "^1.3.0", | ||
| "@japa/assert": "^2.1.0", | ||
| "@japa/runner": "^3.1.1", | ||
| "@swc/core": "^1.4.11", | ||
| "@types/node": "^20.11.30", | ||
| "acorn": "^8.11.3", | ||
| "ajv": "^8.12.0", | ||
| "@adonisjs/eslint-config": "^2.0.0-beta.7", | ||
| "@adonisjs/prettier-config": "^1.4.0", | ||
| "@adonisjs/tsconfig": "^1.4.0", | ||
| "@japa/assert": "^3.0.0", | ||
| "@japa/runner": "^3.1.4", | ||
| "@release-it/conventional-changelog": "^9.0.3", | ||
| "@swc/core": "^1.9.3", | ||
| "@types/node": "^22.10.1", | ||
| "acorn": "^8.14.0", | ||
| "ajv": "^8.17.1", | ||
| "benchmark": "^2.1.4", | ||
| "c8": "^9.1.0", | ||
| "del-cli": "^5.1.0", | ||
| "eslint": "^8.57.0", | ||
| "github-label-sync": "^2.3.1", | ||
| "c8": "^10.1.2", | ||
| "del-cli": "^6.0.0", | ||
| "eslint": "^9.15.0", | ||
| "js-beautify": "^1.15.1", | ||
| "np": "^10.0.2", | ||
| "prettier": "^3.2.5", | ||
| "tinybench": "^2.6.0", | ||
| "ts-node": "^10.9.2", | ||
| "tsup": "^8.0.2", | ||
| "typescript": "^5.4.3", | ||
| "zod": "^3.22.4" | ||
| "prettier": "^3.4.1", | ||
| "release-it": "^17.10.0", | ||
| "tinybench": "^3.0.6", | ||
| "ts-node-maintained": "^10.9.4", | ||
| "tsup": "^8.3.5", | ||
| "typescript": "^5.7.2", | ||
| "zod": "^3.23.8" | ||
| }, | ||
@@ -81,10 +80,40 @@ "repository": { | ||
| "access": "public", | ||
| "tag": "latest" | ||
| "provenance": true | ||
| }, | ||
| "np": { | ||
| "message": "chore(release): %s", | ||
| "tag": "latest", | ||
| "branch": "main", | ||
| "anyBranch": false | ||
| "tsup": { | ||
| "entry": [ | ||
| "./index.ts", | ||
| "./src/types.ts" | ||
| ], | ||
| "outDir": "./build", | ||
| "clean": true, | ||
| "format": "esm", | ||
| "dts": false, | ||
| "sourcemap": false, | ||
| "target": "esnext" | ||
| }, | ||
| "release-it": { | ||
| "git": { | ||
| "requireCleanWorkingDir": true, | ||
| "requireUpstream": true, | ||
| "commitMessage": "chore(release): ${version}", | ||
| "tagAnnotation": "v${version}", | ||
| "push": true, | ||
| "tagName": "v${version}" | ||
| }, | ||
| "github": { | ||
| "release": true | ||
| }, | ||
| "npm": { | ||
| "publish": true, | ||
| "skipChecks": true | ||
| }, | ||
| "plugins": { | ||
| "@release-it/conventional-changelog": { | ||
| "preset": { | ||
| "name": "angular" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "c8": { | ||
@@ -101,18 +130,3 @@ "reporter": [ | ||
| }, | ||
| "eslintConfig": { | ||
| "extends": "@adonisjs/eslint-config/package" | ||
| }, | ||
| "prettier": "@adonisjs/prettier-config", | ||
| "tsup": { | ||
| "entry": [ | ||
| "./index.ts", | ||
| "./src/types.ts" | ||
| ], | ||
| "outDir": "./build", | ||
| "clean": true, | ||
| "format": "esm", | ||
| "dts": false, | ||
| "sourcemap": true, | ||
| "target": "esnext" | ||
| } | ||
| "prettier": "@adonisjs/prettier-config" | ||
| } |
Sorry, the diff of this file is too big to display
| {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]} |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Obfuscated code
Supply chain riskObfuscated files are intentionally packed to hide their behavior. This could be a sign of malware.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
1894
3.38%0
-100%68762
-51.89%42
-2.33%