@wener/common 2.0.1 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ai/qwen3vl/index.js +2 -0
- package/lib/ai/qwen3vl/index.js.map +1 -0
- package/lib/ai/qwen3vl/utils.js +31 -0
- package/lib/ai/qwen3vl/utils.js.map +1 -0
- package/lib/ai/vision/DocLayoutElementTypeSchema.js +28 -0
- package/lib/ai/vision/DocLayoutElementTypeSchema.js.map +1 -0
- package/lib/ai/vision/ImageAnnotationSchema.js +50 -0
- package/lib/ai/vision/ImageAnnotationSchema.js.map +1 -0
- package/lib/ai/vision/index.js +3 -0
- package/lib/ai/vision/index.js.map +1 -0
- package/lib/ai/vision/resolveImageAnnotation.js +105 -0
- package/lib/ai/vision/resolveImageAnnotation.js.map +1 -0
- package/lib/cn/ChineseResidentIdNo.js +48 -0
- package/lib/cn/ChineseResidentIdNo.js.map +1 -0
- package/lib/cn/ChineseResidentIdNo.mod.js +1 -0
- package/lib/cn/{ResidentIdentityCardNumber.test.js → ChineseResidentIdNo.test.js} +7 -6
- package/lib/cn/DivisionCode.js +217 -301
- package/lib/cn/DivisionCode.js.map +1 -0
- package/lib/cn/DivisionCode.mod.js +1 -0
- package/lib/cn/DivisionCode.test.js +9 -15
- package/lib/cn/Mod11.js +43 -0
- package/lib/cn/Mod11.js.map +1 -0
- package/lib/cn/Mod31.js +49 -0
- package/lib/cn/Mod31.js.map +1 -0
- package/lib/cn/UnifiedSocialCreditCode.js +137 -113
- package/lib/cn/UnifiedSocialCreditCode.js.map +1 -0
- package/lib/cn/UnifiedSocialCreditCode.mod.js +1 -0
- package/lib/cn/UnifiedSocialCreditCode.test.js +1 -1
- package/lib/cn/formatChineseAmount.js +77 -0
- package/lib/cn/formatChineseAmount.js.map +1 -0
- package/lib/cn/index.js +6 -2
- package/lib/cn/index.js.map +1 -0
- package/lib/cn/mod.js +6 -0
- package/lib/cn/parseChineseNumber.js +94 -0
- package/lib/cn/parseChineseNumber.js.map +1 -0
- package/lib/cn/parseChineseNumber.test.js +278 -0
- package/lib/cn/pinyin/cartesianProduct.js +22 -0
- package/lib/cn/pinyin/cartesianProduct.js.map +1 -0
- package/lib/cn/pinyin/cartesianProduct.test.js +179 -0
- package/lib/cn/pinyin/data.json +23573 -0
- package/lib/cn/pinyin/loader.js +14 -0
- package/lib/cn/pinyin/loader.js.map +1 -0
- package/lib/cn/pinyin/preload.js +3 -0
- package/lib/cn/pinyin/preload.js.map +1 -0
- package/lib/cn/pinyin/toPinyin.test.js +167 -0
- package/lib/cn/pinyin/toPinyinPure.js +33 -0
- package/lib/cn/pinyin/toPinyinPure.js.map +1 -0
- package/lib/cn/pinyin/transform.js +14 -0
- package/lib/cn/pinyin/transform.js.map +1 -0
- package/lib/cn/types.d.js +2 -0
- package/lib/cn/types.d.js.map +1 -0
- package/lib/consola/createStandardConsolaReporter.js +6 -6
- package/lib/consola/createStandardConsolaReporter.js.map +1 -0
- package/lib/consola/formatLogObject.js +67 -135
- package/lib/consola/formatLogObject.js.map +1 -0
- package/lib/consola/formatLogObject.test.js +184 -0
- package/lib/consola/index.js +1 -0
- package/lib/consola/index.js.map +1 -0
- package/lib/data/formatSort.js +6 -5
- package/lib/data/formatSort.js.map +1 -0
- package/lib/data/index.js +1 -0
- package/lib/data/index.js.map +1 -0
- package/lib/data/maybeNumber.js +5 -7
- package/lib/data/maybeNumber.js.map +1 -0
- package/lib/data/parseSort.js +22 -28
- package/lib/data/parseSort.js.map +1 -0
- package/lib/data/resolvePagination.js +13 -17
- package/lib/data/resolvePagination.js.map +1 -0
- package/lib/data/types.d.js +2 -0
- package/lib/data/types.d.js.map +1 -0
- package/lib/dayjs/dayjs.js +40 -0
- package/lib/dayjs/dayjs.js.map +1 -0
- package/lib/dayjs/formatDuration.js +59 -0
- package/lib/dayjs/formatDuration.js.map +1 -0
- package/lib/dayjs/formatDuration.test.js +90 -0
- package/lib/dayjs/index.js +5 -0
- package/lib/dayjs/index.js.map +1 -0
- package/lib/dayjs/parseDuration.js +29 -0
- package/lib/dayjs/parseDuration.js.map +1 -0
- package/lib/dayjs/parseRelativeTime.js +90 -0
- package/lib/dayjs/parseRelativeTime.js.map +1 -0
- package/lib/dayjs/parseRelativeTime.test.js +247 -0
- package/lib/dayjs/resolveRelativeTime.js +158 -0
- package/lib/dayjs/resolveRelativeTime.js.map +1 -0
- package/lib/dayjs/resolveRelativeTime.test.js +310 -0
- package/lib/decimal/index.js +2 -0
- package/lib/decimal/index.js.map +1 -0
- package/lib/decimal/parseDecimal.js +15 -0
- package/lib/decimal/parseDecimal.js.map +1 -0
- package/lib/emittery/emitter.js +10 -0
- package/lib/emittery/emitter.js.map +1 -0
- package/lib/emittery/index.js +2 -0
- package/lib/emittery/index.js.map +1 -0
- package/lib/foundation/schema/SexType.js +16 -0
- package/lib/foundation/schema/SexType.js.map +1 -0
- package/lib/foundation/schema/index.js +2 -0
- package/lib/foundation/schema/index.js.map +1 -0
- package/lib/foundation/schema/parseSexType.js +19 -0
- package/lib/foundation/schema/parseSexType.js.map +1 -0
- package/lib/foundation/schema/types.js +7 -0
- package/lib/foundation/schema/types.js.map +1 -0
- package/lib/fs/FileSystemError.js +23 -0
- package/lib/fs/FileSystemError.js.map +1 -0
- package/lib/fs/IFileSystem.d.js +3 -0
- package/lib/fs/IFileSystem.d.js.map +1 -0
- package/lib/fs/MemoryFileSystem.test.js +188 -0
- package/lib/fs/createBrowserFileSystem.js +248 -0
- package/lib/fs/createBrowserFileSystem.js.map +1 -0
- package/lib/fs/createMemoryFileSystem.js +516 -0
- package/lib/fs/createMemoryFileSystem.js.map +1 -0
- package/lib/fs/createSandboxFileSystem.js +108 -0
- package/lib/fs/createSandboxFileSystem.js.map +1 -0
- package/lib/fs/createWebDavFileSystem.js +137 -0
- package/lib/fs/createWebDavFileSystem.js.map +1 -0
- package/lib/fs/findMimeType.js +17 -0
- package/lib/fs/findMimeType.js.map +1 -0
- package/lib/fs/index.js +8 -0
- package/lib/fs/index.js.map +1 -0
- package/lib/fs/orpc/FileSystemContract.js +93 -0
- package/lib/fs/orpc/FileSystemContract.js.map +1 -0
- package/lib/fs/orpc/createContractClientFileSystem.js +93 -0
- package/lib/fs/orpc/createContractClientFileSystem.js.map +1 -0
- package/lib/fs/orpc/index.js +3 -0
- package/lib/fs/orpc/index.js.map +1 -0
- package/lib/fs/orpc/server/createFileSystemContractImpl.js +63 -0
- package/lib/fs/orpc/server/createFileSystemContractImpl.js.map +1 -0
- package/lib/fs/orpc/server/index.js +2 -0
- package/lib/fs/orpc/server/index.js.map +1 -0
- package/lib/fs/s3/createS3MiniFileSystem.js +705 -0
- package/lib/fs/s3/createS3MiniFileSystem.js.map +1 -0
- package/lib/fs/s3/index.js +2 -0
- package/lib/fs/s3/index.js.map +1 -0
- package/lib/fs/s3/s3mini.test.js +584 -0
- package/lib/fs/scandir.js +59 -0
- package/lib/fs/scandir.js.map +1 -0
- package/lib/fs/server/createDatabaseFileSystem.js +750 -0
- package/lib/fs/server/createDatabaseFileSystem.js.map +1 -0
- package/lib/fs/server/createNodeFileSystem.js +401 -0
- package/lib/fs/server/createNodeFileSystem.js.map +1 -0
- package/lib/fs/server/dbfs.test.js +221 -0
- package/lib/fs/server/index.js +2 -0
- package/lib/fs/server/index.js.map +1 -0
- package/lib/fs/server/loadTestDatabase.js +127 -0
- package/lib/fs/server/loadTestDatabase.js.map +1 -0
- package/lib/fs/tests/runFileSystemTest.js +318 -0
- package/lib/fs/tests/runFileSystemTest.js.map +1 -0
- package/lib/fs/types.js +27 -0
- package/lib/fs/types.js.map +1 -0
- package/lib/fs/utils/getFileUrl.js +35 -0
- package/lib/fs/utils/getFileUrl.js.map +1 -0
- package/lib/fs/utils.js +22 -0
- package/lib/fs/utils.js.map +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -0
- package/lib/jsonschema/JsonSchema.js +146 -172
- package/lib/jsonschema/JsonSchema.js.map +1 -0
- package/lib/jsonschema/forEachJsonSchema.js +44 -0
- package/lib/jsonschema/forEachJsonSchema.js.map +1 -0
- package/lib/jsonschema/index.js +2 -0
- package/lib/jsonschema/index.js.map +1 -0
- package/lib/jsonschema/types.d.js +2 -0
- package/lib/jsonschema/types.d.js.map +1 -0
- package/lib/meta/defineFileType.js +20 -103
- package/lib/meta/defineFileType.js.map +1 -0
- package/lib/meta/defineInit.js +31 -250
- package/lib/meta/defineInit.js.map +1 -0
- package/lib/meta/defineMetadata.js +24 -140
- package/lib/meta/defineMetadata.js.map +1 -0
- package/lib/meta/index.js +1 -0
- package/lib/meta/index.js.map +1 -0
- package/lib/orpc/createOpenApiContractClient.js +27 -0
- package/lib/orpc/createOpenApiContractClient.js.map +1 -0
- package/lib/orpc/createRpcContractClient.js +34 -0
- package/lib/orpc/createRpcContractClient.js.map +1 -0
- package/lib/orpc/index.js +3 -0
- package/lib/orpc/index.js.map +1 -0
- package/lib/orpc/resolveLinkPlugins.js +28 -0
- package/lib/orpc/resolveLinkPlugins.js.map +1 -0
- package/lib/password/PHC.js +63 -87
- package/lib/password/PHC.js.map +1 -0
- package/lib/password/PHC.test.js +11 -3
- package/lib/password/Password.js +30 -292
- package/lib/password/Password.js.map +1 -0
- package/lib/password/Password.test.js +35 -22
- package/lib/password/createArgon2PasswordAlgorithm.js +35 -191
- package/lib/password/createArgon2PasswordAlgorithm.js.map +1 -0
- package/lib/password/createBase64PasswordAlgorithm.js +8 -141
- package/lib/password/createBase64PasswordAlgorithm.js.map +1 -0
- package/lib/password/createBcryptPasswordAlgorithm.js +13 -168
- package/lib/password/createBcryptPasswordAlgorithm.js.map +1 -0
- package/lib/password/createPBKDF2PasswordAlgorithm.js +46 -228
- package/lib/password/createPBKDF2PasswordAlgorithm.js.map +1 -0
- package/lib/password/createScryptPasswordAlgorithm.js +55 -211
- package/lib/password/createScryptPasswordAlgorithm.js.map +1 -0
- package/lib/password/index.js +1 -0
- package/lib/password/index.js.map +1 -0
- package/lib/password/server/index.js +1 -0
- package/lib/password/server/index.js.map +1 -0
- package/lib/resource/Identifiable.js +2 -0
- package/lib/resource/Identifiable.js.map +1 -0
- package/lib/resource/ListQuery.js +47 -0
- package/lib/resource/ListQuery.js.map +1 -0
- package/lib/resource/getTitleOfResource.js +3 -5
- package/lib/resource/getTitleOfResource.js.map +1 -0
- package/lib/resource/index.js +2 -0
- package/lib/resource/index.js.map +1 -0
- package/lib/resource/schema/AnyResourceSchema.js +3 -2
- package/lib/resource/schema/AnyResourceSchema.js.map +1 -0
- package/lib/resource/schema/BaseResourceSchema.js +2 -1
- package/lib/resource/schema/BaseResourceSchema.js.map +1 -0
- package/lib/resource/schema/ResourceActionType.js +6 -4
- package/lib/resource/schema/ResourceActionType.js.map +1 -0
- package/lib/resource/schema/ResourceStatus.js +5 -3
- package/lib/resource/schema/ResourceStatus.js.map +1 -0
- package/lib/resource/schema/ResourceType.js +5 -3
- package/lib/resource/schema/ResourceType.js.map +1 -0
- package/lib/resource/schema/index.js +6 -0
- package/lib/resource/schema/index.js.map +1 -0
- package/lib/resource/schema/types.js +16 -20
- package/lib/resource/schema/types.js.map +1 -0
- package/lib/s3/formatS3Url.js +65 -0
- package/lib/s3/formatS3Url.js.map +1 -0
- package/lib/s3/formatS3Url.test.js +262 -0
- package/lib/s3/index.js +3 -0
- package/lib/s3/index.js.map +1 -0
- package/lib/s3/parseS3Url.js +65 -0
- package/lib/s3/parseS3Url.js.map +1 -0
- package/lib/s3/parseS3Url.test.js +270 -0
- package/lib/schema/SchemaRegistry.js +45 -0
- package/lib/schema/SchemaRegistry.js.map +1 -0
- package/lib/schema/SchemaRegistry.mod.js +2 -0
- package/lib/schema/TypeSchema.d.js +2 -0
- package/lib/schema/TypeSchema.d.js.map +1 -0
- package/lib/schema/createSchemaData.js +26 -125
- package/lib/schema/createSchemaData.js.map +1 -0
- package/lib/schema/findJsonSchemaByPath.js +13 -36
- package/lib/schema/findJsonSchemaByPath.js.map +1 -0
- package/lib/schema/formatZodError.js +140 -0
- package/lib/schema/formatZodError.js.map +1 -0
- package/lib/schema/formatZodError.test.js +196 -0
- package/lib/schema/getSchemaCache.js +5 -5
- package/lib/schema/getSchemaCache.js.map +1 -0
- package/lib/schema/getSchemaOptions.js +8 -11
- package/lib/schema/getSchemaOptions.js.map +1 -0
- package/lib/schema/index.js +2 -0
- package/lib/schema/index.js.map +1 -0
- package/lib/schema/toJsonSchema.js +47 -290
- package/lib/schema/toJsonSchema.js.map +1 -0
- package/lib/schema/validate.js +33 -45
- package/lib/schema/validate.js.map +1 -0
- package/lib/tools/generateSchema.js +39 -197
- package/lib/tools/generateSchema.js.map +1 -0
- package/lib/tools/renderJsonSchemaToMarkdownDoc.js +55 -143
- package/lib/tools/renderJsonSchemaToMarkdownDoc.js.map +1 -0
- package/lib/utils/buildBaseUrl.js +13 -0
- package/lib/utils/buildBaseUrl.js.map +1 -0
- package/lib/utils/buildRedactorFormSchema.js +59 -0
- package/lib/utils/buildRedactorFormSchema.js.map +1 -0
- package/lib/utils/getEstimateProcessTime.js +21 -0
- package/lib/utils/getEstimateProcessTime.js.map +1 -0
- package/lib/utils/index.js +4 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/resolveFeatureOptions.js +12 -0
- package/lib/utils/resolveFeatureOptions.js.map +1 -0
- package/package.json +77 -20
- package/src/ai/qwen3vl/index.ts +1 -0
- package/src/ai/qwen3vl/utils.ts +36 -0
- package/src/ai/vision/DocLayoutElementTypeSchema.ts +30 -0
- package/src/ai/vision/ImageAnnotationSchema.ts +60 -0
- package/src/ai/vision/index.ts +2 -0
- package/src/ai/vision/resolveImageAnnotation.ts +135 -0
- package/src/cn/ChineseResidentIdNo.test.ts +18 -0
- package/src/cn/ChineseResidentIdNo.ts +74 -0
- package/src/cn/DivisionCode.test.ts +3 -13
- package/src/cn/DivisionCode.ts +138 -193
- package/src/cn/{Mod11Checksum.ts → Mod11.ts} +3 -1
- package/src/cn/{Mod31Checksum.ts → Mod31.ts} +2 -0
- package/src/cn/UnifiedSocialCreditCode.test.ts +2 -2
- package/src/cn/UnifiedSocialCreditCode.ts +119 -124
- package/src/cn/__snapshots__/ChineseResidentIdNo.test.ts.snap +14 -0
- package/src/cn/__snapshots__/UnifiedSocialCreditCode.test.ts.snap +41 -12
- package/src/cn/formatChineseAmount.ts +61 -0
- package/src/cn/index.ts +6 -2
- package/src/cn/parseChineseNumber.test.ts +159 -0
- package/src/cn/parseChineseNumber.ts +97 -0
- package/src/cn/pinyin/cartesianProduct.test.ts +64 -0
- package/src/cn/pinyin/cartesianProduct.ts +24 -0
- package/src/cn/pinyin/data.json +23573 -0
- package/src/cn/pinyin/loader.ts +12 -0
- package/src/cn/pinyin/preload.ts +3 -0
- package/src/cn/pinyin/toPinyin.test.ts +12 -0
- package/src/cn/pinyin/toPinyinPure.ts +43 -0
- package/src/cn/pinyin/transform.ts +12 -0
- package/src/consola/formatLogObject.test.ts +27 -0
- package/src/consola/formatLogObject.ts +46 -10
- package/src/dayjs/dayjs.ts +40 -0
- package/src/dayjs/formatDuration.test.ts +14 -0
- package/src/dayjs/formatDuration.ts +86 -0
- package/src/dayjs/index.ts +5 -0
- package/src/dayjs/parseDuration.ts +40 -0
- package/src/dayjs/parseRelativeTime.test.ts +185 -0
- package/src/dayjs/parseRelativeTime.ts +115 -0
- package/src/dayjs/resolveRelativeTime.test.ts +357 -0
- package/src/dayjs/resolveRelativeTime.ts +167 -0
- package/src/decimal/index.ts +1 -0
- package/src/decimal/parseDecimal.ts +16 -0
- package/src/emittery/emitter.ts +9 -0
- package/src/emittery/index.ts +1 -0
- package/src/foundation/schema/SexType.ts +21 -0
- package/src/foundation/schema/index.ts +1 -0
- package/src/foundation/schema/parseSexType.ts +19 -0
- package/src/foundation/schema/types.ts +8 -0
- package/src/fs/FileSystemError.ts +26 -0
- package/src/fs/IFileSystem.d.ts +102 -0
- package/src/fs/MemoryFileSystem.test.ts +37 -0
- package/src/fs/createBrowserFileSystem.ts +291 -0
- package/src/fs/createMemoryFileSystem.ts +604 -0
- package/src/fs/createSandboxFileSystem.ts +136 -0
- package/src/fs/createWebDavFileSystem.ts +172 -0
- package/src/fs/findMimeType.ts +23 -0
- package/src/fs/index.ts +8 -0
- package/src/fs/orpc/FileSystemContract.ts +92 -0
- package/src/fs/orpc/createContractClientFileSystem.ts +115 -0
- package/src/fs/orpc/index.ts +2 -0
- package/src/fs/orpc/server/createFileSystemContractImpl.ts +64 -0
- package/src/fs/orpc/server/index.ts +1 -0
- package/src/fs/s3/createS3MiniFileSystem.ts +830 -0
- package/src/fs/s3/index.ts +1 -0
- package/src/fs/s3/s3mini.test.ts +264 -0
- package/src/fs/scandir.ts +75 -0
- package/src/fs/server/createDatabaseFileSystem.ts +668 -0
- package/src/fs/server/createNodeFileSystem.ts +499 -0
- package/src/fs/server/dbfs.test.ts +47 -0
- package/src/fs/server/index.ts +1 -0
- package/src/fs/server/loadTestDatabase.ts +131 -0
- package/src/fs/tests/runFileSystemTest.ts +288 -0
- package/src/fs/types.ts +29 -0
- package/src/fs/utils/getFileUrl.ts +44 -0
- package/src/fs/utils.ts +23 -0
- package/src/jsonschema/JsonSchema.ts +118 -110
- package/src/jsonschema/forEachJsonSchema.ts +50 -0
- package/src/jsonschema/index.ts +1 -0
- package/src/orpc/createOpenApiContractClient.ts +52 -0
- package/src/orpc/createRpcContractClient.ts +50 -0
- package/src/orpc/index.ts +2 -0
- package/src/orpc/resolveLinkPlugins.ts +29 -0
- package/src/password/PHC.ts +3 -3
- package/src/password/Password.test.ts +1 -1
- package/src/password/Password.ts +2 -2
- package/src/password/createPBKDF2PasswordAlgorithm.ts +2 -2
- package/src/resource/ListQuery.ts +53 -0
- package/src/resource/index.ts +1 -0
- package/src/resource/schema/AnyResourceSchema.ts +17 -3
- package/src/resource/schema/index.ts +5 -0
- package/src/s3/formatS3Url.test.ts +254 -0
- package/src/s3/formatS3Url.ts +84 -0
- package/src/s3/index.ts +2 -0
- package/src/s3/parseS3Url.test.ts +258 -0
- package/src/s3/parseS3Url.ts +88 -0
- package/src/schema/SchemaRegistry.ts +48 -0
- package/src/schema/createSchemaData.ts +1 -1
- package/src/schema/formatZodError.test.ts +196 -0
- package/src/schema/formatZodError.ts +151 -0
- package/src/schema/getSchemaOptions.ts +3 -3
- package/src/schema/index.ts +1 -0
- package/src/utils/buildBaseUrl.ts +12 -0
- package/src/utils/buildRedactorFormSchema.ts +85 -0
- package/src/utils/getEstimateProcessTime.ts +36 -0
- package/src/utils/index.ts +5 -0
- package/src/utils/resolveFeatureOptions.ts +14 -0
- package/lib/cn/Mod11Checksum.js +0 -85
- package/lib/cn/Mod31Checksum.js +0 -97
- package/lib/cn/ResidentIdentityCardNumber.js +0 -50
- package/lib/cn/formatDate.js +0 -13
- package/lib/cn/parseSex.js +0 -20
- package/lib/resource/schema/SchemaRegistry.js +0 -38
- package/lib/resource/schema/SexType.js +0 -10
- package/lib/search/AdvanceSearch.js +0 -9
- package/lib/search/AdvanceSearch.test.js +0 -435
- package/lib/search/formatAdvanceSearch.js +0 -78
- package/lib/search/index.js +0 -1
- package/lib/search/optimizeAdvanceSearch.js +0 -143
- package/lib/search/parseAdvanceSearch.js +0 -20
- package/lib/search/parser.d.js +0 -1
- package/lib/search/parser.js +0 -3088
- package/lib/search/types.d.js +0 -1
- package/src/cn/ResidentIdentityCardNumber.test.ts +0 -17
- package/src/cn/ResidentIdentityCardNumber.ts +0 -96
- package/src/cn/__snapshots__/ResidentIdentityCardNumber.test.ts.snap +0 -15
- package/src/cn/formatDate.ts +0 -12
- package/src/cn/parseSex.ts +0 -13
- package/src/resource/schema/SchemaRegistry.ts +0 -42
- package/src/resource/schema/SexType.ts +0 -13
- package/src/search/AdvanceSearch.test.ts +0 -149
- package/src/search/AdvanceSearch.ts +0 -14
- package/src/search/Makefile +0 -2
- package/src/search/__snapshots__/AdvanceSearch.test.ts.snap +0 -675
- package/src/search/formatAdvanceSearch.ts +0 -52
- package/src/search/index.ts +0 -1
- package/src/search/optimizeAdvanceSearch.ts +0 -77
- package/src/search/parseAdvanceSearch.ts +0 -23
- package/src/search/parser.d.ts +0 -8
- package/src/search/parser.js +0 -2794
- package/src/search/parser.peggy +0 -237
- package/src/search/types.d.ts +0 -45
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { setCharToPinyinTable } from "./toPinyinPure.js";
|
|
2
|
+
import { transformData } from "./transform.js";
|
|
3
|
+
export function loadCharToPinyinTable() {
|
|
4
|
+
return import("./data.json", {
|
|
5
|
+
with: {
|
|
6
|
+
type: "json"
|
|
7
|
+
}
|
|
8
|
+
}).then((v) => v.default).then((data) => {
|
|
9
|
+
let out = transformData(data);
|
|
10
|
+
setCharToPinyinTable(out);
|
|
11
|
+
return out;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/cn/pinyin/loader.ts"],"sourcesContent":["import { setCharToPinyinTable } from './toPinyinPure';\nimport { transformData } from './transform';\n\nexport function loadCharToPinyinTable(): Promise<Record<string, string[]>> {\n\treturn import('./data.json' as unknown as string, { with: { type: 'json' } })\n\t\t.then((v) => v.default as Record<string, string[]>)\n\t\t.then((data) => {\n\t\t\tlet out = transformData(data);\n\t\t\tsetCharToPinyinTable(out);\n\t\t\treturn out;\n\t\t});\n}\n"],"names":["setCharToPinyinTable","transformData","loadCharToPinyinTable","with","type","then","v","default","data","out"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,iBAAiB;AACtD,SAASC,aAAa,QAAQ,cAAc;AAE5C,OAAO,SAASC;IACf,OAAO,MAAM,CAAC,eAAoC;QAAEC,MAAM;YAAEC,MAAM;QAAO;IAAE,GACzEC,IAAI,CAAC,CAACC,IAAMA,EAAEC,OAAO,EACrBF,IAAI,CAAC,CAACG;QACN,IAAIC,MAAMR,cAAcO;QACxBR,qBAAqBS;QACrB,OAAOA;IACR;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/cn/pinyin/preload.ts"],"sourcesContent":["import { loadCharToPinyinTable } from './loader';\n\nawait loadCharToPinyinTable();\n"],"names":["loadCharToPinyinTable"],"mappings":"AAAA,SAASA,qBAAqB,QAAQ,WAAW;AAEjD,MAAMA"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2
|
+
try {
|
|
3
|
+
var info = gen[key](arg);
|
|
4
|
+
var value = info.value;
|
|
5
|
+
}
|
|
6
|
+
catch (error) {
|
|
7
|
+
reject(error);
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
if (info.done) {
|
|
11
|
+
resolve(value);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
Promise.resolve(value).then(_next, _throw);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function _async_to_generator(fn) {
|
|
18
|
+
return function () {
|
|
19
|
+
var self = this, args = arguments;
|
|
20
|
+
return new Promise(function (resolve, reject) {
|
|
21
|
+
var gen = fn.apply(self, args);
|
|
22
|
+
function _next(value) {
|
|
23
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
24
|
+
}
|
|
25
|
+
function _throw(err) {
|
|
26
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
27
|
+
}
|
|
28
|
+
_next(undefined);
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function _ts_generator(thisArg, body) {
|
|
33
|
+
var f, y, t, _ = {
|
|
34
|
+
label: 0,
|
|
35
|
+
sent: function () {
|
|
36
|
+
if (t[0] & 1)
|
|
37
|
+
throw t[1];
|
|
38
|
+
return t[1];
|
|
39
|
+
},
|
|
40
|
+
trys: [],
|
|
41
|
+
ops: []
|
|
42
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
43
|
+
return d(g, "next", {
|
|
44
|
+
value: verb(0)
|
|
45
|
+
}), d(g, "throw", {
|
|
46
|
+
value: verb(1)
|
|
47
|
+
}), d(g, "return", {
|
|
48
|
+
value: verb(2)
|
|
49
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
50
|
+
value: function () {
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
}), g;
|
|
54
|
+
function verb(n) {
|
|
55
|
+
return function (v) {
|
|
56
|
+
return step([
|
|
57
|
+
n,
|
|
58
|
+
v
|
|
59
|
+
]);
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function step(op) {
|
|
63
|
+
if (f)
|
|
64
|
+
throw new TypeError("Generator is already executing.");
|
|
65
|
+
while (g && (g = 0, op[0] && (_ = 0)), _)
|
|
66
|
+
try {
|
|
67
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
|
68
|
+
return t;
|
|
69
|
+
if (y = 0, t)
|
|
70
|
+
op = [
|
|
71
|
+
op[0] & 2,
|
|
72
|
+
t.value
|
|
73
|
+
];
|
|
74
|
+
switch (op[0]) {
|
|
75
|
+
case 0:
|
|
76
|
+
case 1:
|
|
77
|
+
t = op;
|
|
78
|
+
break;
|
|
79
|
+
case 4:
|
|
80
|
+
_.label++;
|
|
81
|
+
return {
|
|
82
|
+
value: op[1],
|
|
83
|
+
done: false
|
|
84
|
+
};
|
|
85
|
+
case 5:
|
|
86
|
+
_.label++;
|
|
87
|
+
y = op[1];
|
|
88
|
+
op = [
|
|
89
|
+
0
|
|
90
|
+
];
|
|
91
|
+
continue;
|
|
92
|
+
case 7:
|
|
93
|
+
op = _.ops.pop();
|
|
94
|
+
_.trys.pop();
|
|
95
|
+
continue;
|
|
96
|
+
default:
|
|
97
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
98
|
+
_ = 0;
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
102
|
+
_.label = op[1];
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
106
|
+
_.label = t[1];
|
|
107
|
+
t = op;
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
if (t && _.label < t[2]) {
|
|
111
|
+
_.label = t[2];
|
|
112
|
+
_.ops.push(op);
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
if (t[2])
|
|
116
|
+
_.ops.pop();
|
|
117
|
+
_.trys.pop();
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
op = body.call(thisArg, _);
|
|
121
|
+
}
|
|
122
|
+
catch (e) {
|
|
123
|
+
op = [
|
|
124
|
+
6,
|
|
125
|
+
e
|
|
126
|
+
];
|
|
127
|
+
y = 0;
|
|
128
|
+
}
|
|
129
|
+
finally {
|
|
130
|
+
f = t = 0;
|
|
131
|
+
}
|
|
132
|
+
if (op[0] & 5)
|
|
133
|
+
throw op[1];
|
|
134
|
+
return {
|
|
135
|
+
value: op[0] ? op[1] : void 0,
|
|
136
|
+
done: true
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
import { assert, test } from "vitest";
|
|
141
|
+
import { loadCharToPinyinTable } from "./loader.js";
|
|
142
|
+
import { toPinyinPure } from "./toPinyinPure.js";
|
|
143
|
+
test("toPinyin", function () {
|
|
144
|
+
return _async_to_generator(function () {
|
|
145
|
+
return _ts_generator(this, function (_state) {
|
|
146
|
+
switch (_state.label) {
|
|
147
|
+
case 0:
|
|
148
|
+
return [
|
|
149
|
+
4,
|
|
150
|
+
loadCharToPinyinTable()
|
|
151
|
+
];
|
|
152
|
+
case 1:
|
|
153
|
+
_state.sent();
|
|
154
|
+
assert.deepEqual(toPinyinPure("\u771F\u601D"), [
|
|
155
|
+
"zhen,sai",
|
|
156
|
+
"zhen,si"
|
|
157
|
+
]);
|
|
158
|
+
return [
|
|
159
|
+
2
|
|
160
|
+
];
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
// char to py -> 350k
|
|
164
|
+
// py to char -> 145k
|
|
165
|
+
// csv -> 96k
|
|
166
|
+
})();
|
|
167
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { cartesianProduct } from "./cartesianProduct.js";
|
|
2
|
+
let CharToPinyinTable;
|
|
3
|
+
export function setCharToPinyinTable(table) {
|
|
4
|
+
CharToPinyinTable = table;
|
|
5
|
+
}
|
|
6
|
+
export function getCharToPinyinTable() {
|
|
7
|
+
if (!CharToPinyinTable) {
|
|
8
|
+
return {};
|
|
9
|
+
}
|
|
10
|
+
return CharToPinyinTable;
|
|
11
|
+
}
|
|
12
|
+
export function toPinyinPureFirst(s, sep = ",") {
|
|
13
|
+
let tab = getCharToPinyinTable();
|
|
14
|
+
return s.split("").map((c) => tab[c]?.[0]).filter(Boolean).join(sep);
|
|
15
|
+
}
|
|
16
|
+
export function toPinyinPure(s, sep = ",") {
|
|
17
|
+
let tab = getCharToPinyinTable();
|
|
18
|
+
// ensure order
|
|
19
|
+
return cartesianProduct(s.split("").map((c) => tab[c] || "")).sort((a, b) => {
|
|
20
|
+
for (let i = 0; i < a.length; i++) {
|
|
21
|
+
let x = a[i];
|
|
22
|
+
let y = b[i];
|
|
23
|
+
if (x < y)
|
|
24
|
+
return -1;
|
|
25
|
+
if (x > y)
|
|
26
|
+
return 1;
|
|
27
|
+
}
|
|
28
|
+
return 0;
|
|
29
|
+
}).map((v) => v.filter(Boolean).join(sep));
|
|
30
|
+
} // export function lookupPinyinPure(s: string): Array<Array<string>> {
|
|
31
|
+
// return cartesianProductOfArray(s.split('').map(c => Lookup[c]));
|
|
32
|
+
// }
|
|
33
|
+
//# sourceMappingURL=toPinyinPure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/cn/pinyin/toPinyinPure.ts"],"sourcesContent":["import { cartesianProduct } from './cartesianProduct';\n\nlet CharToPinyinTable: Record<string, string[]> | undefined;\n\nexport function setCharToPinyinTable(table: Record<string, string[]>) {\n\tCharToPinyinTable = table;\n}\n\nexport function getCharToPinyinTable() {\n\tif (!CharToPinyinTable) {\n\t\treturn {};\n\t}\n\treturn CharToPinyinTable;\n}\n\nexport function toPinyinPureFirst(s: string, sep = ','): string {\n\tlet tab = getCharToPinyinTable();\n\treturn s\n\t\t.split('')\n\t\t.map((c) => tab[c]?.[0])\n\t\t.filter(Boolean)\n\t\t.join(sep);\n}\n\nexport function toPinyinPure(s: string, sep = ','): string[] {\n\tlet tab = getCharToPinyinTable();\n\t// ensure order\n\treturn cartesianProduct(s.split('').map((c) => tab[c] || ''))\n\t\t.sort((a, b) => {\n\t\t\tfor (let i = 0; i < a.length; i++) {\n\t\t\t\tlet x = a[i];\n\t\t\t\tlet y = b[i];\n\t\t\t\tif (x < y) return -1;\n\t\t\t\tif (x > y) return 1;\n\t\t\t}\n\t\t\treturn 0;\n\t\t})\n\t\t.map((v) => v.filter(Boolean).join(sep));\n}\n\n// export function lookupPinyinPure(s: string): Array<Array<string>> {\n// return cartesianProductOfArray(s.split('').map(c => Lookup[c]));\n// }\n"],"names":["cartesianProduct","CharToPinyinTable","setCharToPinyinTable","table","getCharToPinyinTable","toPinyinPureFirst","s","sep","tab","split","map","c","filter","Boolean","join","toPinyinPure","sort","a","b","i","length","x","y","v"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,qBAAqB;AAEtD,IAAIC;AAEJ,OAAO,SAASC,qBAAqBC,KAA+B;IACnEF,oBAAoBE;AACrB;AAEA,OAAO,SAASC;IACf,IAAI,CAACH,mBAAmB;QACvB,OAAO,CAAC;IACT;IACA,OAAOA;AACR;AAEA,OAAO,SAASI,kBAAkBC,CAAS,EAAEC,MAAM,GAAG;IACrD,IAAIC,MAAMJ;IACV,OAAOE,EACLG,KAAK,CAAC,IACNC,GAAG,CAAC,CAACC,IAAMH,GAAG,CAACG,EAAE,EAAE,CAAC,EAAE,EACtBC,MAAM,CAACC,SACPC,IAAI,CAACP;AACR;AAEA,OAAO,SAASQ,aAAaT,CAAS,EAAEC,MAAM,GAAG;IAChD,IAAIC,MAAMJ;IACV,eAAe;IACf,OAAOJ,iBAAiBM,EAAEG,KAAK,CAAC,IAAIC,GAAG,CAAC,CAACC,IAAMH,GAAG,CAACG,EAAE,IAAI,KACvDK,IAAI,CAAC,CAACC,GAAGC;QACT,IAAK,IAAIC,IAAI,GAAGA,IAAIF,EAAEG,MAAM,EAAED,IAAK;YAClC,IAAIE,IAAIJ,CAAC,CAACE,EAAE;YACZ,IAAIG,IAAIJ,CAAC,CAACC,EAAE;YACZ,IAAIE,IAAIC,GAAG,OAAO,CAAC;YACnB,IAAID,IAAIC,GAAG,OAAO;QACnB;QACA,OAAO;IACR,GACCZ,GAAG,CAAC,CAACa,IAAMA,EAAEX,MAAM,CAACC,SAASC,IAAI,CAACP;AACrC,EAEA,sEAAsE;CACtE,qEAAqE;CACrE,IAAI"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function transformData(input) {
|
|
2
|
+
let out = {};
|
|
3
|
+
for (let [py, chars] of Object.entries(input)){
|
|
4
|
+
for (let c of chars){
|
|
5
|
+
if (!out[c]) {
|
|
6
|
+
out[c] = [];
|
|
7
|
+
}
|
|
8
|
+
out[c].push(py);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return out;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=transform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/cn/pinyin/transform.ts"],"sourcesContent":["export function transformData(input: Record<string, string[]>) {\n\tlet out = {} as Record<string, string[]>;\n\tfor (let [py, chars] of Object.entries(input)) {\n\t\tfor (let c of chars) {\n\t\t\tif (!out[c]) {\n\t\t\t\tout[c] = [];\n\t\t\t}\n\t\t\tout[c].push(py);\n\t\t}\n\t}\n\treturn out;\n}\n"],"names":["transformData","input","out","py","chars","Object","entries","c","push"],"mappings":"AAAA,OAAO,SAASA,cAAcC,KAA+B;IAC5D,IAAIC,MAAM,CAAC;IACX,KAAK,IAAI,CAACC,IAAIC,MAAM,IAAIC,OAAOC,OAAO,CAACL,OAAQ;QAC9C,KAAK,IAAIM,KAAKH,MAAO;YACpB,IAAI,CAACF,GAAG,CAACK,EAAE,EAAE;gBACZL,GAAG,CAACK,EAAE,GAAG,EAAE;YACZ;YACAL,GAAG,CAACK,EAAE,CAACC,IAAI,CAACL;QACb;IACD;IACA,OAAOD;AACR"}
|
package/lib/cn/types.d.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/cn/types.d.ts"],"sourcesContent":["/**\n * 居民身份证\n *\n * @see https://en.wikipedia.org/wiki/Resident_Identity_Card\n * @see https://en.wikipedia.org/wiki/Foreign_Permanent_Resident_ID_Card\n */\nexport interface ResidentIdentityCardInfo {\n\t/**\n\t * @title 姓名\n\t */\n\tname: string;\n\t/**\n\t * @title 性别\n\t */\n\tsex: 'Male' | 'Female';\n\t/**\n\t * @title 民族\n\t * 例如 '汉'/'满'/'回'\n\t */\n\tethnicity: string;\n\t/**\n\t * @title 出生日期\n\t * @format date\n\t */\n\tbirthDate: string;\n\t/**\n\t * @title 地址\n\t *\n\t * - 通常为 domicile/户籍地\n\t */\n\taddress: string;\n\t/**\n\t * @title 身份证号\n\t */\n\tidentityCardNumber: string;\n\t/**\n\t * @title 签发机关\n\t */\n\tissuer: string;\n\t/**\n\t * @title 有效期开始日期\n\t * @format date\n\t */\n\tvalidStartDate: string;\n\t/**\n\t * @title 有效期结束日期\n\t * @format date\n\t * @description 如长期有效则为 空\n\t */\n\tvalidEndDate?: string;\n}\n"],"names":[],"mappings":"AAAA;;;;;CAKC,GACD,WA4CC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { formatLogObject } from "./formatLogObject.js";
|
|
2
|
-
export function createStandardConsolaReporter() {
|
|
3
|
-
var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref_format = _ref.format, format = _ref_format === void 0 ? formatLogObject : _ref_format;
|
|
2
|
+
export function createStandardConsolaReporter({ format = formatLogObject } = {}) {
|
|
4
3
|
return {
|
|
5
|
-
log:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
log: (o, ctx) => {
|
|
5
|
+
let out = format(o, ctx);
|
|
6
|
+
let fn = console.log;
|
|
7
|
+
const { level } = o;
|
|
9
8
|
if (level < 1) {
|
|
10
9
|
fn = console.error;
|
|
11
10
|
}
|
|
@@ -16,3 +15,4 @@ export function createStandardConsolaReporter() {
|
|
|
16
15
|
}
|
|
17
16
|
};
|
|
18
17
|
}
|
|
18
|
+
//# sourceMappingURL=createStandardConsolaReporter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/consola/createStandardConsolaReporter.ts"],"sourcesContent":["import type { ConsolaOptions, ConsolaReporter, LogObject } from 'consola/core';\nimport { formatLogObject } from './formatLogObject';\n\ntype Formatter = (\n\to: LogObject,\n\tctx: {\n\t\toptions: ConsolaOptions;\n\t},\n) => string;\n\nexport function createStandardConsolaReporter({\n\tformat = formatLogObject,\n}: {\n\tformat?: Formatter;\n} = {}): ConsolaReporter {\n\treturn {\n\t\tlog: (o, ctx) => {\n\t\t\tlet out = format(o, ctx);\n\t\t\tlet fn = console.log;\n\n\t\t\tconst { level } = o;\n\t\t\tif (level < 1) {\n\t\t\t\tfn = console.error;\n\t\t\t} else if (level === 1) {\n\t\t\t\tfn = console.warn;\n\t\t\t}\n\n\t\t\tfn(out);\n\t\t},\n\t};\n}\n"],"names":["formatLogObject","createStandardConsolaReporter","format","log","o","ctx","out","fn","console","level","error","warn"],"mappings":"AACA,SAASA,eAAe,QAAQ,oBAAoB;AASpD,OAAO,SAASC,8BAA8B,EAC7CC,SAASF,eAAe,EAGxB,GAAG,CAAC,CAAC;IACL,OAAO;QACNG,KAAK,CAACC,GAAGC;YACR,IAAIC,MAAMJ,OAAOE,GAAGC;YACpB,IAAIE,KAAKC,QAAQL,GAAG;YAEpB,MAAM,EAAEM,KAAK,EAAE,GAAGL;YAClB,IAAIK,QAAQ,GAAG;gBACdF,KAAKC,QAAQE,KAAK;YACnB,OAAO,IAAID,UAAU,GAAG;gBACvBF,KAAKC,QAAQG,IAAI;YAClB;YAEAJ,GAAGD;QACJ;IACD;AACD"}
|
|
@@ -1,93 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
function _array_with_holes(arr) {
|
|
7
|
-
if (Array.isArray(arr)) return arr;
|
|
8
|
-
}
|
|
9
|
-
function _array_without_holes(arr) {
|
|
10
|
-
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
11
|
-
}
|
|
12
|
-
function _define_property(obj, key, value) {
|
|
13
|
-
if (key in obj) {
|
|
14
|
-
Object.defineProperty(obj, key, {
|
|
15
|
-
value: value,
|
|
16
|
-
enumerable: true,
|
|
17
|
-
configurable: true,
|
|
18
|
-
writable: true
|
|
19
|
-
});
|
|
20
|
-
} else {
|
|
21
|
-
obj[key] = value;
|
|
22
|
-
}
|
|
23
|
-
return obj;
|
|
24
|
-
}
|
|
25
|
-
function _iterable_to_array(iter) {
|
|
26
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
27
|
-
}
|
|
28
|
-
function _non_iterable_rest() {
|
|
29
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
30
|
-
}
|
|
31
|
-
function _non_iterable_spread() {
|
|
32
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
33
|
-
}
|
|
34
|
-
function _object_spread(target) {
|
|
35
|
-
for(var i = 1; i < arguments.length; i++){
|
|
36
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
37
|
-
var ownKeys = Object.keys(source);
|
|
38
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
39
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
40
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
41
|
-
}));
|
|
42
|
-
}
|
|
43
|
-
ownKeys.forEach(function(key) {
|
|
44
|
-
_define_property(target, key, source[key]);
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
return target;
|
|
48
|
-
}
|
|
49
|
-
function ownKeys(object, enumerableOnly) {
|
|
50
|
-
var keys = Object.keys(object);
|
|
51
|
-
if (Object.getOwnPropertySymbols) {
|
|
52
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
53
|
-
if (enumerableOnly) {
|
|
54
|
-
symbols = symbols.filter(function(sym) {
|
|
55
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
keys.push.apply(keys, symbols);
|
|
59
|
-
}
|
|
60
|
-
return keys;
|
|
61
|
-
}
|
|
62
|
-
function _object_spread_props(target, source) {
|
|
63
|
-
source = source != null ? source : {};
|
|
64
|
-
if (Object.getOwnPropertyDescriptors) {
|
|
65
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
66
|
-
} else {
|
|
67
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
68
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
return target;
|
|
72
|
-
}
|
|
73
|
-
function _to_array(arr) {
|
|
74
|
-
return _array_with_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_rest();
|
|
75
|
-
}
|
|
76
|
-
function _to_consumable_array(arr) {
|
|
77
|
-
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
78
|
-
}
|
|
79
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
80
|
-
if (!o) return;
|
|
81
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
82
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
83
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
84
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
85
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
86
|
-
}
|
|
87
|
-
import colors from 'chalk';
|
|
88
|
-
import dayjs from 'dayjs';
|
|
89
|
-
import { isDevelopment } from 'std-env';
|
|
90
|
-
var levelColors = {
|
|
1
|
+
import colors, { Chalk } from "chalk";
|
|
2
|
+
import dayjs from "dayjs";
|
|
3
|
+
import { isDevelopment } from "std-env";
|
|
4
|
+
const LevelColors = {
|
|
91
5
|
trace: colors.gray,
|
|
92
6
|
debug: colors.cyan,
|
|
93
7
|
info: colors.blueBright,
|
|
@@ -103,7 +17,7 @@ var levelColors = {
|
|
|
103
17
|
box: colors.white,
|
|
104
18
|
verbose: colors.green
|
|
105
19
|
};
|
|
106
|
-
|
|
20
|
+
const levelShort = {
|
|
107
21
|
trace: 'TRAC',
|
|
108
22
|
debug: 'DEBG',
|
|
109
23
|
info: 'INFO',
|
|
@@ -119,18 +33,27 @@ var levelShort = {
|
|
|
119
33
|
box: 'BOX ',
|
|
120
34
|
verbose: 'VERB'
|
|
121
35
|
};
|
|
122
|
-
|
|
36
|
+
const start = Date.now();
|
|
37
|
+
const Colors = colors;
|
|
38
|
+
const NoColors = new Chalk({
|
|
39
|
+
level: 0
|
|
40
|
+
});
|
|
123
41
|
export function formatLogObject(o, ctx) {
|
|
124
|
-
|
|
42
|
+
const shouldColor = Boolean(ctx.options?.formatOptions?.colors);
|
|
43
|
+
let { date, type, tag } = o;
|
|
125
44
|
type = type === 'log' ? 'info' : type;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
45
|
+
const colors = shouldColor ? Colors : NoColors;
|
|
46
|
+
let color = LevelColors[type] || colors.white;
|
|
47
|
+
if (!shouldColor) {
|
|
48
|
+
color = (v)=>v;
|
|
49
|
+
}
|
|
50
|
+
const levelText = levelShort[type] || type.toUpperCase().slice(0, 4); // Get first 4 chars, consistent uppercase
|
|
51
|
+
let line = '';
|
|
52
|
+
let out = [];
|
|
130
53
|
// Timestamp
|
|
131
54
|
if (isDevelopment) {
|
|
132
55
|
// process.hrtime.bigint()
|
|
133
|
-
|
|
56
|
+
let diff = (date.getTime() - start) / 1000;
|
|
134
57
|
out.push(colors.gray(diff.toFixed(3).padStart(7, ' ')));
|
|
135
58
|
} else {
|
|
136
59
|
out.push(colors.gray(dayjs(date).format('YYYY-MM-DD HH:mm:ss.SSS')));
|
|
@@ -139,17 +62,19 @@ export function formatLogObject(o, ctx) {
|
|
|
139
62
|
// Pad to 4 characters
|
|
140
63
|
out.push(color(levelText.padEnd(4, ' ')));
|
|
141
64
|
if (tag) {
|
|
142
|
-
out.push(colors.yellow(
|
|
65
|
+
out.push(colors.yellow(`[${tag}]`)); // Added color for tag
|
|
143
66
|
}
|
|
144
67
|
{
|
|
145
|
-
|
|
68
|
+
const [message, ...additional] = formatArgs(o.args, {
|
|
69
|
+
colors: shouldColor
|
|
70
|
+
}).split('\n');
|
|
146
71
|
out.push(characterFormat(message));
|
|
147
72
|
line = out.join(' ');
|
|
148
73
|
if (additional.length > 0) {
|
|
149
74
|
line += characterFormat(additional.join('\n'));
|
|
150
75
|
}
|
|
151
76
|
if (type === 'trace') {
|
|
152
|
-
|
|
77
|
+
const _err = new Error('Trace: ' + o.message);
|
|
153
78
|
line += formatStack(_err.stack || '', _err.message);
|
|
154
79
|
}
|
|
155
80
|
}
|
|
@@ -169,32 +94,20 @@ export function formatLogObject(o, ctx) {
|
|
|
169
94
|
}
|
|
170
95
|
function characterFormat(str) {
|
|
171
96
|
return str// highlight backticks
|
|
172
|
-
.replace(/`([^`]+)`/gm,
|
|
173
|
-
|
|
174
|
-
})// underline underscores
|
|
175
|
-
.replace(/\s+_([^_]+)_\s+/gm, function(_, m) {
|
|
176
|
-
return " ".concat(colors.underline(m), " ");
|
|
177
|
-
});
|
|
97
|
+
.replace(/`([^`]+)`/gm, (_, m)=>colors.cyan(m))// underline underscores
|
|
98
|
+
.replace(/\s+_([^_]+)_\s+/gm, (_, m)=>` ${colors.underline(m)} `);
|
|
178
99
|
}
|
|
179
100
|
function parseStack(stack, message) {
|
|
180
101
|
// const cwd = process.cwd() + sep;
|
|
181
|
-
|
|
182
|
-
return l.trim().replace('file://', '');
|
|
183
|
-
});
|
|
102
|
+
const lines = stack.split('\n').splice(message.split('\n').length).map((l)=>l.trim().replace('file://', ''));
|
|
184
103
|
return lines;
|
|
185
104
|
}
|
|
186
105
|
function formatStack(stack, message, opts) {
|
|
187
|
-
|
|
188
|
-
return
|
|
189
|
-
return ' ' + line.replace(/^at +/, function(m) {
|
|
190
|
-
return colors.gray(m);
|
|
191
|
-
}).replace(/\((.+)\)/, function(_, m) {
|
|
192
|
-
return "(".concat(colors.cyan(m), ")");
|
|
193
|
-
});
|
|
194
|
-
}).join("\n".concat(indent));
|
|
106
|
+
const indent = ' '.repeat((opts?.errorLevel || 0) + 1);
|
|
107
|
+
return `\n${indent}` + parseStack(stack, message).map((line)=>' ' + line.replace(/^at +/, (m)=>colors.gray(m)).replace(/\((.+)\)/, (_, m)=>`(${colors.cyan(m)})`)).join(`\n${indent}`);
|
|
195
108
|
}
|
|
196
109
|
function formatArgs(args, opts) {
|
|
197
|
-
|
|
110
|
+
const _args = args.map((arg)=>{
|
|
198
111
|
if (arg && typeof arg.stack === 'string') {
|
|
199
112
|
return formatError(arg, opts);
|
|
200
113
|
}
|
|
@@ -202,25 +115,44 @@ function formatArgs(args, opts) {
|
|
|
202
115
|
});
|
|
203
116
|
// Only supported with Node >= 10
|
|
204
117
|
// https://nodejs.org/api/util.html#util_util_inspect_object_options
|
|
205
|
-
return formatWithOptions.
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
118
|
+
return formatWithOptions(Boolean(opts.colors), ..._args);
|
|
119
|
+
}
|
|
120
|
+
function formatWithOptions(shouldColor, ...params) {
|
|
121
|
+
return params.map((value)=>formatValue(value, shouldColor)).join(' ');
|
|
122
|
+
}
|
|
123
|
+
function formatValue(value, shouldColor = false) {
|
|
124
|
+
const colors = shouldColor ? Colors : NoColors;
|
|
125
|
+
if (value === null) return 'null';
|
|
126
|
+
if (value === undefined) return 'undefined';
|
|
127
|
+
if (typeof value === 'string') return value;
|
|
128
|
+
if (typeof value === 'number' || typeof value === 'boolean') return String(value);
|
|
129
|
+
if (typeof value === 'object' && value.constructor === Object) {
|
|
130
|
+
const entries = Object.entries(value);
|
|
131
|
+
if (entries.length === 0) return '{}';
|
|
132
|
+
return entries.map(([key, val])=>{
|
|
133
|
+
const keyStr = shouldColor ? colors.blue(key) : key;
|
|
134
|
+
const valStr = shouldColor ? colors.green(JSON.stringify(val)) : JSON.stringify(val);
|
|
135
|
+
return `${keyStr}=${valStr}`;
|
|
136
|
+
}).join(' ');
|
|
137
|
+
}
|
|
138
|
+
// For arrays and other objects, use JSON.stringify directly
|
|
139
|
+
try {
|
|
140
|
+
const result = JSON.stringify(value);
|
|
141
|
+
return shouldColor ? colors.green(result) : result;
|
|
142
|
+
} catch {
|
|
143
|
+
return String(value);
|
|
212
144
|
}
|
|
213
|
-
// import { formatWithOptions } from 'node:util';
|
|
214
|
-
return params.join(' ');
|
|
215
145
|
}
|
|
216
146
|
function formatError(err, opts) {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
147
|
+
const message = err.message ?? formatWithOptions(Boolean(opts.colors), err);
|
|
148
|
+
const stack = err.stack ? formatStack(err.stack, message, opts) : '';
|
|
149
|
+
const level = opts?.errorLevel || 0;
|
|
150
|
+
const causedPrefix = level > 0 ? `${' '.repeat(level)}[cause]: ` : '';
|
|
151
|
+
const causedError = err.cause ? '\n\n' + formatError(err.cause, {
|
|
152
|
+
...opts,
|
|
223
153
|
errorLevel: level + 1
|
|
224
|
-
})
|
|
154
|
+
}) : '';
|
|
225
155
|
return causedPrefix + message + '\n' + stack + causedError;
|
|
226
156
|
}
|
|
157
|
+
|
|
158
|
+
//# sourceMappingURL=formatLogObject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/consola/formatLogObject.ts"],"sourcesContent":["import colors, { Chalk, type ChalkInstance } from 'chalk';\nimport type { ConsolaOptions, FormatOptions, LogObject, LogType } from 'consola/core';\nimport dayjs from 'dayjs';\nimport { isDevelopment } from 'std-env';\n\nconst LevelColors: Record<LogType, (str: string) => string> = {\n\ttrace: colors.gray,\n\tdebug: colors.cyan,\n\tinfo: colors.blueBright,\n\twarn: colors.yellow,\n\terror: colors.red,\n\tfatal: colors.bgRed.white,\n\tsilent: colors.white,\n\tlog: colors.white,\n\tsuccess: colors.green,\n\tfail: colors.red,\n\tready: colors.green,\n\tstart: colors.cyan,\n\tbox: colors.white,\n\tverbose: colors.green,\n};\n\nconst levelShort: Record<LogType, string> = {\n\ttrace: 'TRAC',\n\tdebug: 'DEBG',\n\tinfo: 'INFO',\n\twarn: 'WARN',\n\terror: 'ERRO',\n\tfatal: 'FATL',\n\tsilent: 'SLNT',\n\tlog: 'LOG ', // Added space to make it 4 characters\n\tsuccess: 'SUCC',\n\tfail: 'FAIL',\n\tready: 'READ',\n\tstart: 'STRT',\n\tbox: 'BOX ', // Added space to make it 4 characters\n\tverbose: 'VERB',\n};\nconst start = Date.now();\n\nconst Colors: ChalkInstance = colors;\nconst NoColors = new Chalk({ level: 0 });\n\nexport function formatLogObject(\n\to: LogObject,\n\tctx: {\n\t\toptions: ConsolaOptions;\n\t},\n) {\n\tconst shouldColor = Boolean(ctx.options?.formatOptions?.colors);\n\n\tlet { date, type, tag } = o;\n\ttype = type === 'log' ? 'info' : type;\n\tconst colors = shouldColor ? Colors : NoColors;\n\tlet color = LevelColors[type] || colors.white;\n\tif (!shouldColor) {\n\t\tcolor = (v) => v;\n\t}\n\tconst levelText = levelShort[type] || type.toUpperCase().slice(0, 4); // Get first 4 chars, consistent uppercase\n\n\tlet line = '';\n\tlet out: string[] = [];\n\n\t// Timestamp\n\tif (isDevelopment) {\n\t\t// process.hrtime.bigint()\n\t\tlet diff = (date.getTime() - start) / 1000;\n\n\t\tout.push(colors.gray(diff.toFixed(3).padStart(7, ' ')));\n\t} else {\n\t\tout.push(colors.gray(dayjs(date).format('YYYY-MM-DD HH:mm:ss.SSS')));\n\t}\n\n\t// Log Level (colored)\n\t// Pad to 4 characters\n\tout.push(color(levelText.padEnd(4, ' ')));\n\n\tif (tag) {\n\t\tout.push(colors.yellow(`[${tag}]`)); // Added color for tag\n\t}\n\n\t{\n\t\tconst [message, ...additional] = formatArgs(o.args, { colors: shouldColor }).split('\\n');\n\n\t\tout.push(characterFormat(message));\n\n\t\tline = out.join(' ');\n\t\tif (additional.length > 0) {\n\t\t\tline += characterFormat(additional.join('\\n'));\n\t\t}\n\n\t\tif (type === 'trace') {\n\t\t\tconst _err = new Error('Trace: ' + o.message);\n\t\t\tline += formatStack(_err.stack || '', _err.message);\n\t\t}\n\t}\n\n\t// if (!message && typeof args[0] === 'string') {\n\t// message = args.shift();\n\t// }\n\t// if (message) {\n\t// out.push(message);\n\t// }\n\t// if (args.length) {\n\t// out.push(...args.map((a) => (typeof a === 'string' ? a : JSON.stringify(a)))); // Handle non-string args\n\t// }\n\n\t// todo format error\n\t// https://github.com/unjs/consola/blob/main/src/reporters/fancy.ts\n\n\t// return out.join(' '); // Increased spacing for better readability\n\treturn line;\n}\n\nfunction characterFormat(str: string) {\n\treturn (\n\t\tstr\n\t\t\t// highlight backticks\n\t\t\t.replace(/`([^`]+)`/gm, (_, m) => colors.cyan(m))\n\t\t\t// underline underscores\n\t\t\t.replace(/\\s+_([^_]+)_\\s+/gm, (_, m) => ` ${colors.underline(m)} `)\n\t);\n}\n\nfunction parseStack(stack: string, message: string) {\n\t// const cwd = process.cwd() + sep;\n\n\tconst lines = stack\n\t\t.split('\\n')\n\t\t.splice(message.split('\\n').length)\n\t\t.map(\n\t\t\t(l) => l.trim().replace('file://', ''),\n\t\t\t// .replace(cwd, '')\n\t\t);\n\n\treturn lines;\n}\n\nfunction formatStack(stack: string, message: string, opts?: FormatOptions) {\n\tconst indent = ' '.repeat((opts?.errorLevel || 0) + 1);\n\treturn (\n\t\t`\\n${indent}`\n\t\t+ parseStack(stack, message)\n\t\t\t.map(\n\t\t\t\t(line) =>\n\t\t\t\t\t' ' + line.replace(/^at +/, (m) => colors.gray(m)).replace(/\\((.+)\\)/, (_, m) => `(${colors.cyan(m)})`),\n\t\t\t)\n\t\t\t.join(`\\n${indent}`)\n\t);\n}\n\nfunction formatArgs(args: any[], opts: FormatOptions) {\n\tconst _args = args.map((arg) => {\n\t\tif (arg && typeof arg.stack === 'string') {\n\t\t\treturn formatError(arg, opts);\n\t\t}\n\t\treturn arg;\n\t});\n\n\t// Only supported with Node >= 10\n\t// https://nodejs.org/api/util.html#util_util_inspect_object_options\n\treturn formatWithOptions(Boolean(opts.colors), ..._args);\n}\n\nfunction formatWithOptions(shouldColor: boolean, ...params: any[]) {\n\treturn params.map((value) => formatValue(value, shouldColor)).join(' ');\n}\n\nfunction formatValue(value: any, shouldColor: boolean = false): string {\n\tconst colors = shouldColor ? Colors : NoColors;\n\n\tif (value === null) return 'null';\n\tif (value === undefined) return 'undefined';\n\tif (typeof value === 'string') return value;\n\tif (typeof value === 'number' || typeof value === 'boolean') return String(value);\n\n\tif (typeof value === 'object' && value.constructor === Object) {\n\t\tconst entries = Object.entries(value);\n\t\tif (entries.length === 0) return '{}';\n\t\treturn entries\n\t\t\t.map(([key, val]) => {\n\t\t\t\tconst keyStr = shouldColor ? colors.blue(key) : key;\n\t\t\t\tconst valStr = shouldColor ? colors.green(JSON.stringify(val)) : JSON.stringify(val);\n\t\t\t\treturn `${keyStr}=${valStr}`;\n\t\t\t})\n\t\t\t.join(' ');\n\t}\n\n\t// For arrays and other objects, use JSON.stringify directly\n\ttry {\n\t\tconst result = JSON.stringify(value);\n\t\treturn shouldColor ? colors.green(result) : result;\n\t} catch {\n\t\treturn String(value);\n\t}\n}\n\nfunction formatError(err: any, opts: FormatOptions): string {\n\tconst message = err.message ?? formatWithOptions(Boolean(opts.colors), err);\n\tconst stack = err.stack ? formatStack(err.stack, message, opts) : '';\n\n\tconst level = opts?.errorLevel || 0;\n\tconst causedPrefix = level > 0 ? `${' '.repeat(level)}[cause]: ` : '';\n\tconst causedError = err.cause ? '\\n\\n' + formatError(err.cause, { ...opts, errorLevel: level + 1 }) : '';\n\n\treturn causedPrefix + message + '\\n' + stack + causedError;\n}\n"],"names":["colors","Chalk","dayjs","isDevelopment","LevelColors","trace","gray","debug","cyan","info","blueBright","warn","yellow","error","red","fatal","bgRed","white","silent","log","success","green","fail","ready","start","box","verbose","levelShort","Date","now","Colors","NoColors","level","formatLogObject","o","ctx","shouldColor","Boolean","options","formatOptions","date","type","tag","color","v","levelText","toUpperCase","slice","line","out","diff","getTime","push","toFixed","padStart","format","padEnd","message","additional","formatArgs","args","split","characterFormat","join","length","_err","Error","formatStack","stack","str","replace","_","m","underline","parseStack","lines","splice","map","l","trim","opts","indent","repeat","errorLevel","_args","arg","formatError","formatWithOptions","params","value","formatValue","undefined","String","Object","entries","key","val","keyStr","blue","valStr","JSON","stringify","result","err","causedPrefix","causedError","cause"],"mappings":"AAAA,OAAOA,UAAUC,KAAK,QAA4B,QAAQ;AAE1D,OAAOC,WAAW,QAAQ;AAC1B,SAASC,aAAa,QAAQ,UAAU;AAExC,MAAMC,cAAwD;IAC7DC,OAAOL,OAAOM,IAAI;IAClBC,OAAOP,OAAOQ,IAAI;IAClB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