diff --git a/package.json b/package.json index 221b43d..7c4ff38 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,6 @@ ], "devDependencies": { "@0x-jerry/x-release": "^0.4.0", - "@types/lodash-es": "^4.17.9", "@types/minimist": "^1.2.2", "@types/node": "^20.6.2", "@vitest/coverage-v8": "^1.0.0", @@ -37,7 +36,6 @@ }, "dependencies": { "@0x-jerry/utils": "^2.0.0", - "lodash-es": "^4.17.21", "minimist": "^1.2.8" } } \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d2f6b26..ad8ff30 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,9 +8,6 @@ dependencies: '@0x-jerry/utils': specifier: ^2.0.0 version: 2.0.0 - lodash-es: - specifier: ^4.17.21 - version: 4.17.21 minimist: specifier: ^1.2.8 version: 1.2.8 @@ -19,9 +16,6 @@ devDependencies: '@0x-jerry/x-release': specifier: ^0.4.0 version: 0.4.0 - '@types/lodash-es': - specifier: ^4.17.9 - version: 4.17.9 '@types/minimist': specifier: ^1.2.2 version: 1.2.2 @@ -478,16 +472,6 @@ packages: resolution: {integrity: sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==} dev: true - /@types/lodash-es@4.17.9: - resolution: {integrity: sha512-ZTcmhiI3NNU7dEvWLZJkzG6ao49zOIjEgIE0RgV7wbPxU0f2xT3VSAHw2gmst8swH6V0YkLRGp4qPlX/6I90MQ==} - dependencies: - '@types/lodash': 4.14.198 - dev: true - - /@types/lodash@4.14.198: - resolution: {integrity: sha512-trNJ/vtMZYMLhfN45uLq4ShQSw0/S7xCTLLVM+WM1rmFpba/VS42jVUgaO3w/NOLiWR/09lnYk0yMaA/atdIsg==} - dev: true - /@types/minimist@1.2.2: resolution: {integrity: sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==} dev: true @@ -1045,10 +1029,6 @@ packages: pkg-types: 1.0.3 dev: true - /lodash-es@4.17.21: - resolution: {integrity: sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==} - dev: false - /lodash.sortby@4.7.0: resolution: {integrity: sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==} dev: true diff --git a/readme.md b/readme.md index f4b67fa..23a62b8 100644 --- a/readme.md +++ b/readme.md @@ -53,5 +53,4 @@ TODO - [vitest](https://vitest.dev/) - [minimist](https://github.com/minimistjs/minimist) -- [lodash](https://lodash.com) - [tsup](https://tsup.egoist.dev) \ No newline at end of file diff --git a/src/parser.ts b/src/parser.ts index 5421c37..508cd4c 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -7,11 +7,10 @@ import { type CmdAction, ProgramFlag, } from './types' -import { builtinType, isType, splitFirst } from './utils' -import { uniqueId } from 'lodash-es' +import { autoIncrement, builtinType, isType, splitFirst } from './utils' const TOKEN_ID_PREFIX = '__token_id__' -const nextId = () => uniqueId(TOKEN_ID_PREFIX) +const nextId = autoIncrement(TOKEN_ID_PREFIX) const tokenIdReg = new RegExp(`${TOKEN_ID_PREFIX}\\d+`, 'g') diff --git a/src/utils.ts b/src/utils.ts index 74e918c..87c22bc 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -19,3 +19,8 @@ export function isType(targetType: string | undefined, type: string | string[]) export function isBuiltinType(type?: string) { return Object.values(builtinType).flat().includes(type!) } + +export function autoIncrement(prefix = 'i') { + let i = 1; + return () => `${prefix}${i++}` +} \ No newline at end of file