mirror of
https://gitea.redwind.top/Austin/subscription
synced 2024-11-16 11:42:34 +08:00
perf: check allowPropertyNames
This commit is contained in:
parent
04cb5362de
commit
70af6e10ee
32
package.json
32
package.json
|
@ -21,27 +21,27 @@
|
|||
"updateSubs": "tsx ./scripts/updateSubs.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^17.8.1",
|
||||
"@commitlint/config-conventional": "^17.8.1",
|
||||
"@commitlint/types": "^17.8.1",
|
||||
"@gkd-kit/selector": "0.0.16",
|
||||
"@types/lodash": "^4.14.201",
|
||||
"@types/node": "^20.9.0",
|
||||
"@typescript-eslint/eslint-plugin": "6.11.0",
|
||||
"@typescript-eslint/parser": "6.11.0",
|
||||
"@commitlint/cli": "^18.4.4",
|
||||
"@commitlint/config-conventional": "^18.4.4",
|
||||
"@commitlint/types": "^18.4.4",
|
||||
"@gkd-kit/selector": "0.0.18",
|
||||
"@types/lodash": "^4.14.202",
|
||||
"@types/node": "^20.11.5",
|
||||
"@typescript-eslint/eslint-plugin": "6.19.0",
|
||||
"@typescript-eslint/parser": "6.19.0",
|
||||
"dayjs": "^1.11.10",
|
||||
"eslint": "^8.53.0",
|
||||
"eslint-config-prettier": "9.0.0",
|
||||
"eslint-define-config": "1.24.1",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-config-prettier": "9.1.0",
|
||||
"eslint-define-config": "2.1.0",
|
||||
"husky": "^8.0.3",
|
||||
"json5": "^2.2.3",
|
||||
"lint-staged": "^15.1.0",
|
||||
"lint-staged": "^15.2.0",
|
||||
"lodash": "^4.17.21",
|
||||
"picocolors": "^1.0.0",
|
||||
"pinyin-pro": "3.18.1",
|
||||
"prettier": "^3.1.0",
|
||||
"tsx": "^3.14.0",
|
||||
"typescript": "^5.2.2"
|
||||
"pinyin-pro": "3.19.2",
|
||||
"prettier": "^3.2.4",
|
||||
"tsx": "^4.7.0",
|
||||
"typescript": "^5.3.3"
|
||||
},
|
||||
"author": "lisonge",
|
||||
"license": "MIT",
|
||||
|
|
881
pnpm-lock.yaml
881
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,40 @@
|
|||
import { CommonSelector } from '@gkd-kit/selector';
|
||||
|
||||
export const parseSelector = (source: string) => {
|
||||
return CommonSelector.Companion.parse(source);
|
||||
const selector = CommonSelector.Companion.parse(source);
|
||||
selector.propertyNames.forEach((name) => {
|
||||
if (!allowPropertyNames.has(name)) {
|
||||
throw new Error(`Property ${name} is not allowed in selector`);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const allowPropertyNames = new Set([
|
||||
'id',
|
||||
'vid',
|
||||
|
||||
'name',
|
||||
'text',
|
||||
'text.length',
|
||||
'desc',
|
||||
'desc.length',
|
||||
|
||||
'clickable',
|
||||
'focusable',
|
||||
'checkable',
|
||||
'checked',
|
||||
'editable',
|
||||
'longClickable',
|
||||
'visibleToUser',
|
||||
|
||||
'left',
|
||||
'top',
|
||||
'right',
|
||||
'bottom',
|
||||
'width',
|
||||
'height',
|
||||
|
||||
'index',
|
||||
'depth',
|
||||
'childCount',
|
||||
]);
|
||||
|
|
Loading…
Reference in New Issue
Block a user