mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-24 06:40:20 +03:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
63c842bdb3 | ||
|
|
748126f207 |
No files matched your search
Vendored
+3
-7
@@ -108,6 +108,7 @@ declare module '@vue/runtime-core' {
|
||||
Ipv6UlaGenerator: typeof import('./src/tools/ipv6-ula-generator/ipv6-ula-generator.vue')['default']
|
||||
JsonDiff: typeof import('./src/tools/json-diff/json-diff.vue')['default']
|
||||
JsonMinify: typeof import('./src/tools/json-minify/json-minify.vue')['default']
|
||||
JsonToCsharp: typeof import('./src/tools/json-to-csharp/json-to-csharp.vue')['default']
|
||||
JsonToCsv: typeof import('./src/tools/json-to-csv/json-to-csv.vue')['default']
|
||||
JsonToToml: typeof import('./src/tools/json-to-toml/json-to-toml.vue')['default']
|
||||
JsonToYaml: typeof import('./src/tools/json-to-yaml-converter/json-to-yaml.vue')['default']
|
||||
@@ -127,24 +128,19 @@ declare module '@vue/runtime-core' {
|
||||
MetaTagGenerator: typeof import('./src/tools/meta-tag-generator/meta-tag-generator.vue')['default']
|
||||
MimeTypes: typeof import('./src/tools/mime-types/mime-types.vue')['default']
|
||||
NavbarButtons: typeof import('./src/components/NavbarButtons.vue')['default']
|
||||
NCheckbox: typeof import('naive-ui')['NCheckbox']
|
||||
NCode: typeof import('naive-ui')['NCode']
|
||||
NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
|
||||
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
||||
NDivider: typeof import('naive-ui')['NDivider']
|
||||
NEllipsis: typeof import('naive-ui')['NEllipsis']
|
||||
NFormItem: typeof import('naive-ui')['NFormItem']
|
||||
NGi: typeof import('naive-ui')['NGi']
|
||||
NGrid: typeof import('naive-ui')['NGrid']
|
||||
NH1: typeof import('naive-ui')['NH1']
|
||||
NH3: typeof import('naive-ui')['NH3']
|
||||
NIcon: typeof import('naive-ui')['NIcon']
|
||||
NInputNumber: typeof import('naive-ui')['NInputNumber']
|
||||
NLabel: typeof import('naive-ui')['NLabel']
|
||||
NLayout: typeof import('naive-ui')['NLayout']
|
||||
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
|
||||
NMenu: typeof import('naive-ui')['NMenu']
|
||||
NScrollbar: typeof import('naive-ui')['NScrollbar']
|
||||
NSpin: typeof import('naive-ui')['NSpin']
|
||||
NSpace: typeof import('naive-ui')['NSpace']
|
||||
NumeronymGenerator: typeof import('./src/tools/numeronym-generator/numeronym-generator.vue')['default']
|
||||
OtpCodeGeneratorAndValidator: typeof import('./src/tools/otp-code-generator-and-validator/otp-code-generator-and-validator.vue')['default']
|
||||
PasswordStrengthAnalyser: typeof import('./src/tools/password-strength-analyser/password-strength-analyser.vue')['default']
|
||||
|
||||
+1
-4
@@ -61,11 +61,9 @@
|
||||
"figlet": "^1.7.0",
|
||||
"figue": "^1.2.0",
|
||||
"fuse.js": "^6.6.2",
|
||||
"hash-wasm": "^4.11.0",
|
||||
"highlight.js": "^11.7.0",
|
||||
"iarna-toml-esm": "^3.0.5",
|
||||
"ibantools": "^4.3.3",
|
||||
"js-base64": "^3.7.6",
|
||||
"json5": "^2.2.3",
|
||||
"jwt-decode": "^3.1.2",
|
||||
"libphonenumber-js": "^1.10.28",
|
||||
@@ -139,6 +137,5 @@
|
||||
"vitest": "^0.34.0",
|
||||
"workbox-window": "^7.0.0",
|
||||
"zx": "^7.2.1"
|
||||
},
|
||||
"packageManager": "pnpm@8.15.3"
|
||||
}
|
||||
}
|
||||
Generated
+233
-131
@@ -37,7 +37,7 @@ dependencies:
|
||||
version: 10.3.0(vue@3.3.4)
|
||||
'@vueuse/head':
|
||||
specifier: ^1.0.0
|
||||
version: 1.0.0(vue@3.3.4)
|
||||
version: 1.0.0(typescript@5.2.2)(vue@3.3.4)
|
||||
'@vueuse/router':
|
||||
specifier: ^10.0.0
|
||||
version: 10.0.0(vue-router@4.1.6)(vue@3.3.4)
|
||||
@@ -83,9 +83,6 @@ dependencies:
|
||||
fuse.js:
|
||||
specifier: ^6.6.2
|
||||
version: 6.6.2
|
||||
hash-wasm:
|
||||
specifier: ^4.11.0
|
||||
version: 4.11.0
|
||||
highlight.js:
|
||||
specifier: ^11.7.0
|
||||
version: 11.7.0
|
||||
@@ -95,9 +92,6 @@ dependencies:
|
||||
ibantools:
|
||||
specifier: ^4.3.3
|
||||
version: 4.3.3
|
||||
js-base64:
|
||||
specifier: ^3.7.6
|
||||
version: 3.7.7
|
||||
json5:
|
||||
specifier: ^2.2.3
|
||||
version: 2.2.3
|
||||
@@ -814,6 +808,11 @@ packages:
|
||||
resolution: {integrity: sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
|
||||
/@babel/helper-string-parser@7.25.9:
|
||||
resolution: {integrity: sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
dev: false
|
||||
|
||||
/@babel/helper-validator-identifier@7.22.20:
|
||||
resolution: {integrity: sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
@@ -822,6 +821,11 @@ packages:
|
||||
resolution: {integrity: sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
|
||||
/@babel/helper-validator-identifier@7.25.9:
|
||||
resolution: {integrity: sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
dev: false
|
||||
|
||||
/@babel/helper-validator-option@7.22.15:
|
||||
resolution: {integrity: sha512-bMn7RmyFjY/mdECUbgn9eoSY4vqvacUnS9i9vGAGttgFWesO6B4CYWA7XlpbWgBt71iv/hfbPlynohStqnu5hA==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
@@ -914,6 +918,14 @@ packages:
|
||||
dependencies:
|
||||
'@babel/types': 7.23.0
|
||||
|
||||
/@babel/parser@7.26.9:
|
||||
resolution: {integrity: sha512-81NWa1njQblgZbQHxWHpxxCzNsa3ZwvFqpUg7P+NNUU6f3UU2jBEg4OlF/J6rl8+PQGh1q6/zWScd001YwcA5A==}
|
||||
engines: {node: '>=6.0.0'}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
'@babel/types': 7.26.9
|
||||
dev: false
|
||||
|
||||
/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@7.22.15(@babel/core@7.23.2):
|
||||
resolution: {integrity: sha512-FB9iYlz7rURmRJyXRKEnalYPPdn87H5no108cyuQQyMwlpJ2SJtpIUBI27kdTin956pz+LPypkPVPUTlxOmrsg==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
@@ -1901,6 +1913,14 @@ packages:
|
||||
'@babel/helper-validator-identifier': 7.22.20
|
||||
to-fast-properties: 2.0.0
|
||||
|
||||
/@babel/types@7.26.9:
|
||||
resolution: {integrity: sha512-Y3IR1cRnOxOCDvMmNiym7XpXQ93iGDDPHx+Zj+NM+rg0fBaShfQLkg+hKPaZCEvg5N/LeCo4+Rj/i3FuJsIQaw==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
dependencies:
|
||||
'@babel/helper-string-parser': 7.25.9
|
||||
'@babel/helper-validator-identifier': 7.25.9
|
||||
dev: false
|
||||
|
||||
/@css-render/plugin-bem@0.15.12(css-render@0.15.12):
|
||||
resolution: {integrity: sha512-Lq2jSOZn+wYQtsyaFj6QRz2EzAnd3iW5fZeHO1WSXQdVYwvwGX0ZiH3X2JQgtgYLT1yeGtrwrqJdNdMEUD2xTw==}
|
||||
peerDependencies:
|
||||
@@ -2339,6 +2359,10 @@ packages:
|
||||
/@jridgewell/sourcemap-codec@1.4.15:
|
||||
resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==}
|
||||
|
||||
/@jridgewell/sourcemap-codec@1.5.0:
|
||||
resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==}
|
||||
dev: false
|
||||
|
||||
/@jridgewell/trace-mapping@0.3.18:
|
||||
resolution: {integrity: sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==}
|
||||
dependencies:
|
||||
@@ -3350,18 +3374,18 @@ packages:
|
||||
'@unhead/schema': 0.5.1
|
||||
dev: false
|
||||
|
||||
/@unhead/vue@0.5.1(vue@3.3.4):
|
||||
/@unhead/vue@0.5.1(typescript@5.2.2)(vue@3.3.4):
|
||||
resolution: {integrity: sha512-s4y4uj3NMqaUs0K+WQXbWGj/2+Glk/DEJ9yeJOcJIiro/+IhUMByD71jyCM43Xn8YBPy14VY/ZYb9ZFU2WCZgw==}
|
||||
peerDependencies:
|
||||
vue: '>=2.7 || >=3'
|
||||
dependencies:
|
||||
'@unhead/dom': 0.5.1
|
||||
'@unhead/schema': 0.5.1
|
||||
'@vueuse/shared': 10.11.0(vue@3.3.4)
|
||||
'@vueuse/shared': 12.8.2(typescript@5.2.2)
|
||||
unhead: 0.5.1
|
||||
vue: 3.3.4
|
||||
transitivePeerDependencies:
|
||||
- '@vue/composition-api'
|
||||
- typescript
|
||||
dev: false
|
||||
|
||||
/@unocss/astro@0.57.1(rollup@2.79.1)(vite@4.4.9):
|
||||
@@ -3750,6 +3774,16 @@ packages:
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@vue/compiler-core@3.5.13:
|
||||
resolution: {integrity: sha512-oOdAkwqUfW1WqpwSYJce06wvt6HljgY3fGeM9NcVA1HaYOij3mZG9Rkysn0OHuyUAGMbEbARIpsG+LPVlBJ5/Q==}
|
||||
dependencies:
|
||||
'@babel/parser': 7.26.9
|
||||
'@vue/shared': 3.5.13
|
||||
entities: 4.5.0
|
||||
estree-walker: 2.0.2
|
||||
source-map-js: 1.2.1
|
||||
dev: false
|
||||
|
||||
/@vue/compiler-dom@3.2.47:
|
||||
resolution: {integrity: sha512-dBBnEHEPoftUiS03a4ggEig74J2YBZ2UIeyfpcRM2tavgMWo4bsEfgCGsu+uJIL/vax9S+JztH8NmQerUo7shQ==}
|
||||
dependencies:
|
||||
@@ -3771,6 +3805,13 @@ packages:
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@vue/compiler-dom@3.5.13:
|
||||
resolution: {integrity: sha512-ZOJ46sMOKUjO3e94wPdCzQ6P1Lx/vhp2RSvfaab88Ajexs0AHeV0uasYhi99WPaogmBlRHNRuly8xV75cNTMDA==}
|
||||
dependencies:
|
||||
'@vue/compiler-core': 3.5.13
|
||||
'@vue/shared': 3.5.13
|
||||
dev: false
|
||||
|
||||
/@vue/compiler-sfc@3.2.47:
|
||||
resolution: {integrity: sha512-rog05W+2IFfxjMcFw10tM9+f7i/+FFpZJJ5XHX72NP9eC2uRD+42M3pYcQqDXVYoj74kHMSEdQ/WmCjt8JFksQ==}
|
||||
dependencies:
|
||||
@@ -3800,6 +3841,20 @@ packages:
|
||||
postcss: 8.4.28
|
||||
source-map-js: 1.0.2
|
||||
|
||||
/@vue/compiler-sfc@3.5.13:
|
||||
resolution: {integrity: sha512-6VdaljMpD82w6c2749Zhf5T9u5uLBWKnVue6XWxprDobftnletJ8+oel7sexFfM3qIxNmVE7LSFGTpv6obNyaQ==}
|
||||
dependencies:
|
||||
'@babel/parser': 7.26.9
|
||||
'@vue/compiler-core': 3.5.13
|
||||
'@vue/compiler-dom': 3.5.13
|
||||
'@vue/compiler-ssr': 3.5.13
|
||||
'@vue/shared': 3.5.13
|
||||
estree-walker: 2.0.2
|
||||
magic-string: 0.30.17
|
||||
postcss: 8.5.3
|
||||
source-map-js: 1.2.1
|
||||
dev: false
|
||||
|
||||
/@vue/compiler-ssr@3.2.47:
|
||||
resolution: {integrity: sha512-wVXC+gszhulcMD8wpxMsqSOpvDZ6xKXSVWkf50Guf/S+28hTAXPDYRTbLQ3EDkOP5Xz/+SY37YiwDquKbJOgZw==}
|
||||
dependencies:
|
||||
@@ -3822,6 +3877,13 @@ packages:
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@vue/compiler-ssr@3.5.13:
|
||||
resolution: {integrity: sha512-wMH6vrYHxQl/IybKJagqbquvxpWCuVYpoUJfCqFZwa/JY1GdATAQ+TgVtgrwwMZ0D07QhA99rs/EAAWfvG6KpA==}
|
||||
dependencies:
|
||||
'@vue/compiler-dom': 3.5.13
|
||||
'@vue/shared': 3.5.13
|
||||
dev: false
|
||||
|
||||
/@vue/devtools-api@6.5.0:
|
||||
resolution: {integrity: sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q==}
|
||||
|
||||
@@ -3868,12 +3930,25 @@ packages:
|
||||
dependencies:
|
||||
'@vue/shared': 3.3.4
|
||||
|
||||
/@vue/reactivity@3.5.13:
|
||||
resolution: {integrity: sha512-NaCwtw8o48B9I6L1zl2p41OHo/2Z4wqYGGIK1Khu5T7yxrn+ATOixn/Udn2m+6kZKB/J7cuT9DbWWhRxqixACg==}
|
||||
dependencies:
|
||||
'@vue/shared': 3.5.13
|
||||
dev: false
|
||||
|
||||
/@vue/runtime-core@3.3.4:
|
||||
resolution: {integrity: sha512-R+bqxMN6pWO7zGI4OMlmvePOdP2c93GsHFM/siJI7O2nxFRzj55pLwkpCedEY+bTMgp5miZ8CxfIZo3S+gFqvA==}
|
||||
dependencies:
|
||||
'@vue/reactivity': 3.3.4
|
||||
'@vue/shared': 3.3.4
|
||||
|
||||
/@vue/runtime-core@3.5.13:
|
||||
resolution: {integrity: sha512-Fj4YRQ3Az0WTZw1sFe+QDb0aXCerigEpw418pw1HBUKFtnQHWzwojaukAs2X/c9DQz4MQ4bsXTGlcpGxU/RCIw==}
|
||||
dependencies:
|
||||
'@vue/reactivity': 3.5.13
|
||||
'@vue/shared': 3.5.13
|
||||
dev: false
|
||||
|
||||
/@vue/runtime-dom@3.3.4:
|
||||
resolution: {integrity: sha512-Aj5bTJ3u5sFsUckRghsNjVTtxZQ1OyMWCr5dZRAPijF/0Vy4xEoRCwLyHXcj4D0UFbJ4lbx3gPTgg06K/GnPnQ==}
|
||||
dependencies:
|
||||
@@ -3881,6 +3956,15 @@ packages:
|
||||
'@vue/shared': 3.3.4
|
||||
csstype: 3.1.2
|
||||
|
||||
/@vue/runtime-dom@3.5.13:
|
||||
resolution: {integrity: sha512-dLaj94s93NYLqjLiyFzVs9X6dWhTdAlEAciC3Moq7gzAc13VJUdCnjjRurNM6uTLFATRHexHCTu/Xp3eW6yoog==}
|
||||
dependencies:
|
||||
'@vue/reactivity': 3.5.13
|
||||
'@vue/runtime-core': 3.5.13
|
||||
'@vue/shared': 3.5.13
|
||||
csstype: 3.1.3
|
||||
dev: false
|
||||
|
||||
/@vue/server-renderer@3.3.4(vue@3.3.4):
|
||||
resolution: {integrity: sha512-Q6jDDzR23ViIb67v+vM1Dqntu+HUexQcsWKhhQa4ARVzxOY2HbC7QRW/ggkDBd5BU+uM1sV6XOAP0b216o34JQ==}
|
||||
peerDependencies:
|
||||
@@ -3901,6 +3985,16 @@ packages:
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@vue/server-renderer@3.5.13(vue@3.5.13):
|
||||
resolution: {integrity: sha512-wAi4IRJV/2SAW3htkTlB+dHeRmpTiVIK1OGLWV1yeStVSebSQQOwGwIq0D3ZIoBj2C2qpgz5+vX9iEBkTdk5YA==}
|
||||
peerDependencies:
|
||||
vue: 3.5.13
|
||||
dependencies:
|
||||
'@vue/compiler-ssr': 3.5.13
|
||||
'@vue/shared': 3.5.13
|
||||
vue: 3.5.13(typescript@5.2.2)
|
||||
dev: false
|
||||
|
||||
/@vue/shared@3.2.47:
|
||||
resolution: {integrity: sha512-BHGyyGN3Q97EZx0taMQ+OLNuZcW3d37ZEVmEAyeoA9ERdGvm9Irc/0Fua8SNyOtV1w6BS4q25wbMzJujO9HIfQ==}
|
||||
dev: true
|
||||
@@ -3914,6 +4008,10 @@ packages:
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@vue/shared@3.5.13:
|
||||
resolution: {integrity: sha512-/hnE/qP5ZoGpol0a5mDi45bOd7t3tjYJBjsgCsivow7D48cJeV5l05RD82lPqi7gRiphZM37rnhW1l6ZoCNNnQ==}
|
||||
dev: false
|
||||
|
||||
/@vue/test-utils@2.3.2(vue@3.3.4):
|
||||
resolution: {integrity: sha512-hJnVaYhbrIm0yBS0+e1Y0Sj85cMyAi+PAbK4JHqMRUZ6S622Goa+G7QzkRSyvCteG8wop7tipuEbHoZo26wsSA==}
|
||||
peerDependencies:
|
||||
@@ -3951,17 +4049,17 @@ packages:
|
||||
- vue
|
||||
dev: false
|
||||
|
||||
/@vueuse/head@1.0.0(vue@3.3.4):
|
||||
/@vueuse/head@1.0.0(typescript@5.2.2)(vue@3.3.4):
|
||||
resolution: {integrity: sha512-wighjD6iLxEitpg6EDeS5dGDB9tcOSMhpblrAOKR6qBP93U3cjG72n0LhlBUD9miu41lNxXFVGHgSc6BVJ9BMg==}
|
||||
peerDependencies:
|
||||
vue: '>=2.7 || >=3'
|
||||
dependencies:
|
||||
'@unhead/schema': 0.5.1
|
||||
'@unhead/ssr': 0.5.1
|
||||
'@unhead/vue': 0.5.1(vue@3.3.4)
|
||||
'@unhead/vue': 0.5.1(typescript@5.2.2)(vue@3.3.4)
|
||||
vue: 3.3.4
|
||||
transitivePeerDependencies:
|
||||
- '@vue/composition-api'
|
||||
- typescript
|
||||
dev: false
|
||||
|
||||
/@vueuse/metadata@10.3.0:
|
||||
@@ -3990,15 +4088,6 @@ packages:
|
||||
- vue
|
||||
dev: false
|
||||
|
||||
/@vueuse/shared@10.11.0(vue@3.3.4):
|
||||
resolution: {integrity: sha512-fyNoIXEq3PfX1L3NkNhtVQUSRtqYwJtJg+Bp9rIzculIZWHTkKSysujrOk2J+NrRulLTQH9+3gGSfYLWSEWU1A==}
|
||||
dependencies:
|
||||
vue-demi: 0.14.8(vue@3.3.4)
|
||||
transitivePeerDependencies:
|
||||
- '@vue/composition-api'
|
||||
- vue
|
||||
dev: false
|
||||
|
||||
/@vueuse/shared@10.3.0(vue@3.3.4):
|
||||
resolution: {integrity: sha512-kGqCTEuFPMK4+fNWy6dUOiYmxGcUbtznMwBZLC1PubidF4VZY05B+Oht7Jh7/6x4VOWGpvu3R37WHi81cKpiqg==}
|
||||
dependencies:
|
||||
@@ -4008,6 +4097,14 @@ packages:
|
||||
- vue
|
||||
dev: false
|
||||
|
||||
/@vueuse/shared@12.8.2(typescript@5.2.2):
|
||||
resolution: {integrity: sha512-dznP38YzxZoNloI0qpEfpkms8knDtaoQ6Y/sfS0L7Yki4zh40LFHEhur0odJC6xTHG5dxWVPiUWBXn+wCG2s5w==}
|
||||
dependencies:
|
||||
vue: 3.5.13(typescript@5.2.2)
|
||||
transitivePeerDependencies:
|
||||
- typescript
|
||||
dev: false
|
||||
|
||||
/@zhead/schema@1.0.0-beta.13:
|
||||
resolution: {integrity: sha512-P1A1vRGFBhITco8Iw4/hvnDYoE/SoVrd71dW1pBFdXJb3vP+pBtoOuhbEKy0ROJGOyzQuqvFibcwzyLlWMqNiQ==}
|
||||
dev: false
|
||||
@@ -4119,7 +4216,7 @@ packages:
|
||||
/array-buffer-byte-length@1.0.0:
|
||||
resolution: {integrity: sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==}
|
||||
dependencies:
|
||||
call-bind: 1.0.7
|
||||
call-bind: 1.0.5
|
||||
is-array-buffer: 3.0.2
|
||||
dev: true
|
||||
|
||||
@@ -4133,10 +4230,10 @@ packages:
|
||||
engines: {node: '>= 0.4'}
|
||||
dependencies:
|
||||
array-buffer-byte-length: 1.0.0
|
||||
call-bind: 1.0.7
|
||||
call-bind: 1.0.5
|
||||
define-properties: 1.2.1
|
||||
es-abstract: 1.22.3
|
||||
get-intrinsic: 1.2.4
|
||||
get-intrinsic: 1.2.2
|
||||
is-array-buffer: 3.0.2
|
||||
is-shared-array-buffer: 1.0.2
|
||||
dev: true
|
||||
@@ -4303,15 +4400,12 @@ packages:
|
||||
engines: {node: '>=8'}
|
||||
dev: true
|
||||
|
||||
/call-bind@1.0.7:
|
||||
resolution: {integrity: sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==}
|
||||
engines: {node: '>= 0.4'}
|
||||
/call-bind@1.0.5:
|
||||
resolution: {integrity: sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==}
|
||||
dependencies:
|
||||
es-define-property: 1.0.0
|
||||
es-errors: 1.3.0
|
||||
function-bind: 1.1.2
|
||||
get-intrinsic: 1.2.4
|
||||
set-function-length: 1.2.2
|
||||
get-intrinsic: 1.2.2
|
||||
set-function-length: 1.1.1
|
||||
dev: true
|
||||
|
||||
/callsites@3.1.0:
|
||||
@@ -4721,6 +4815,10 @@ packages:
|
||||
/csstype@3.1.2:
|
||||
resolution: {integrity: sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==}
|
||||
|
||||
/csstype@3.1.3:
|
||||
resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==}
|
||||
dev: false
|
||||
|
||||
/dash-get@1.0.2:
|
||||
resolution: {integrity: sha512-4FbVrHDwfOASx7uQVxeiCTo7ggSdYZbqs8lH+WU6ViypPlDbe9y6IP5VVUDQBv9DcnyaiPT5XT0UWHgJ64zLeQ==}
|
||||
dev: false
|
||||
@@ -4824,13 +4922,13 @@ packages:
|
||||
clone: 1.0.4
|
||||
dev: true
|
||||
|
||||
/define-data-property@1.1.4:
|
||||
resolution: {integrity: sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==}
|
||||
/define-data-property@1.1.1:
|
||||
resolution: {integrity: sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==}
|
||||
engines: {node: '>= 0.4'}
|
||||
dependencies:
|
||||
es-define-property: 1.0.0
|
||||
es-errors: 1.3.0
|
||||
get-intrinsic: 1.2.2
|
||||
gopd: 1.0.1
|
||||
has-property-descriptors: 1.0.1
|
||||
dev: true
|
||||
|
||||
/define-lazy-prop@2.0.0:
|
||||
@@ -4842,8 +4940,8 @@ packages:
|
||||
resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==}
|
||||
engines: {node: '>= 0.4'}
|
||||
dependencies:
|
||||
define-data-property: 1.1.4
|
||||
has-property-descriptors: 1.0.2
|
||||
define-data-property: 1.1.1
|
||||
has-property-descriptors: 1.0.1
|
||||
object-keys: 1.1.1
|
||||
dev: true
|
||||
|
||||
@@ -5010,7 +5108,6 @@ packages:
|
||||
/entities@4.5.0:
|
||||
resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==}
|
||||
engines: {node: '>=0.12'}
|
||||
dev: true
|
||||
|
||||
/errno@0.1.8:
|
||||
resolution: {integrity: sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A==}
|
||||
@@ -5033,15 +5130,15 @@ packages:
|
||||
array-buffer-byte-length: 1.0.0
|
||||
arraybuffer.prototype.slice: 1.0.2
|
||||
available-typed-arrays: 1.0.5
|
||||
call-bind: 1.0.7
|
||||
call-bind: 1.0.5
|
||||
es-set-tostringtag: 2.0.2
|
||||
es-to-primitive: 1.2.1
|
||||
function.prototype.name: 1.1.6
|
||||
get-intrinsic: 1.2.4
|
||||
get-intrinsic: 1.2.2
|
||||
get-symbol-description: 1.0.0
|
||||
globalthis: 1.0.3
|
||||
gopd: 1.0.1
|
||||
has-property-descriptors: 1.0.2
|
||||
has-property-descriptors: 1.0.1
|
||||
has-proto: 1.0.1
|
||||
has-symbols: 1.0.3
|
||||
hasown: 2.0.0
|
||||
@@ -5071,23 +5168,11 @@ packages:
|
||||
which-typed-array: 1.1.13
|
||||
dev: true
|
||||
|
||||
/es-define-property@1.0.0:
|
||||
resolution: {integrity: sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==}
|
||||
engines: {node: '>= 0.4'}
|
||||
dependencies:
|
||||
get-intrinsic: 1.2.4
|
||||
dev: true
|
||||
|
||||
/es-errors@1.3.0:
|
||||
resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==}
|
||||
engines: {node: '>= 0.4'}
|
||||
dev: true
|
||||
|
||||
/es-set-tostringtag@2.0.2:
|
||||
resolution: {integrity: sha512-BuDyupZt65P9D2D2vA/zqcI3G5xRsklm5N3xCwuiy+/vKy8i0ifdsQP1sLgO4tZDSCaQUSnmC48khknGMV3D2Q==}
|
||||
engines: {node: '>= 0.4'}
|
||||
dependencies:
|
||||
get-intrinsic: 1.2.4
|
||||
get-intrinsic: 1.2.2
|
||||
has-tostringtag: 1.0.0
|
||||
hasown: 2.0.0
|
||||
dev: true
|
||||
@@ -5768,7 +5853,7 @@ packages:
|
||||
resolution: {integrity: sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==}
|
||||
engines: {node: '>= 0.4'}
|
||||
dependencies:
|
||||
call-bind: 1.0.7
|
||||
call-bind: 1.0.5
|
||||
define-properties: 1.2.1
|
||||
es-abstract: 1.22.3
|
||||
functions-have-names: 1.2.3
|
||||
@@ -5796,11 +5881,9 @@ packages:
|
||||
resolution: {integrity: sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==}
|
||||
dev: true
|
||||
|
||||
/get-intrinsic@1.2.4:
|
||||
resolution: {integrity: sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==}
|
||||
engines: {node: '>= 0.4'}
|
||||
/get-intrinsic@1.2.2:
|
||||
resolution: {integrity: sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==}
|
||||
dependencies:
|
||||
es-errors: 1.3.0
|
||||
function-bind: 1.1.2
|
||||
has-proto: 1.0.1
|
||||
has-symbols: 1.0.3
|
||||
@@ -5825,8 +5908,8 @@ packages:
|
||||
resolution: {integrity: sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==}
|
||||
engines: {node: '>= 0.4'}
|
||||
dependencies:
|
||||
call-bind: 1.0.7
|
||||
get-intrinsic: 1.2.4
|
||||
call-bind: 1.0.5
|
||||
get-intrinsic: 1.2.2
|
||||
dev: true
|
||||
|
||||
/get-tsconfig@4.7.2:
|
||||
@@ -5921,7 +6004,7 @@ packages:
|
||||
/gopd@1.0.1:
|
||||
resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==}
|
||||
dependencies:
|
||||
get-intrinsic: 1.2.4
|
||||
get-intrinsic: 1.2.2
|
||||
dev: true
|
||||
|
||||
/graceful-fs@4.2.11:
|
||||
@@ -5962,10 +6045,10 @@ packages:
|
||||
engines: {node: '>=8'}
|
||||
dev: true
|
||||
|
||||
/has-property-descriptors@1.0.2:
|
||||
resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==}
|
||||
/has-property-descriptors@1.0.1:
|
||||
resolution: {integrity: sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==}
|
||||
dependencies:
|
||||
es-define-property: 1.0.0
|
||||
get-intrinsic: 1.2.2
|
||||
dev: true
|
||||
|
||||
/has-proto@1.0.1:
|
||||
@@ -5992,10 +6075,6 @@ packages:
|
||||
function-bind: 1.1.2
|
||||
dev: true
|
||||
|
||||
/hash-wasm@4.11.0:
|
||||
resolution: {integrity: sha512-HVusNXlVqHe0fzIzdQOGolnFN6mX/fqcrSAOcTBXdvzrXVHwTz11vXeKRmkR5gTuwVpvHZEIyKoePDvuAR+XwQ==}
|
||||
dev: false
|
||||
|
||||
/hasown@2.0.0:
|
||||
resolution: {integrity: sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==}
|
||||
engines: {node: '>= 0.4'}
|
||||
@@ -6191,9 +6270,9 @@ packages:
|
||||
resolution: {integrity: sha512-Xj6dv+PsbtwyPpEflsejS+oIZxmMlV44zAhG479uYu89MsjcYOhCFnNyKrkJrihbsiasQyY0afoCl/9BLR65bg==}
|
||||
engines: {node: '>= 0.4'}
|
||||
dependencies:
|
||||
get-intrinsic: 1.2.4
|
||||
get-intrinsic: 1.2.2
|
||||
hasown: 2.0.0
|
||||
side-channel: 1.0.6
|
||||
side-channel: 1.0.4
|
||||
dev: true
|
||||
|
||||
/ip-address@7.1.0:
|
||||
@@ -6226,8 +6305,8 @@ packages:
|
||||
/is-array-buffer@3.0.2:
|
||||
resolution: {integrity: sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==}
|
||||
dependencies:
|
||||
call-bind: 1.0.7
|
||||
get-intrinsic: 1.2.4
|
||||
call-bind: 1.0.5
|
||||
get-intrinsic: 1.2.2
|
||||
is-typed-array: 1.1.12
|
||||
dev: true
|
||||
|
||||
@@ -6251,7 +6330,7 @@ packages:
|
||||
resolution: {integrity: sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==}
|
||||
engines: {node: '>= 0.4'}
|
||||
dependencies:
|
||||
call-bind: 1.0.7
|
||||
call-bind: 1.0.5
|
||||
has-tostringtag: 1.0.0
|
||||
dev: true
|
||||
|
||||
@@ -6388,7 +6467,7 @@ packages:
|
||||
resolution: {integrity: sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==}
|
||||
engines: {node: '>= 0.4'}
|
||||
dependencies:
|
||||
call-bind: 1.0.7
|
||||
call-bind: 1.0.5
|
||||
has-tostringtag: 1.0.0
|
||||
dev: true
|
||||
|
||||
@@ -6400,7 +6479,7 @@ packages:
|
||||
/is-shared-array-buffer@1.0.2:
|
||||
resolution: {integrity: sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==}
|
||||
dependencies:
|
||||
call-bind: 1.0.7
|
||||
call-bind: 1.0.5
|
||||
dev: true
|
||||
|
||||
/is-stream@2.0.1:
|
||||
@@ -6443,7 +6522,7 @@ packages:
|
||||
/is-weakref@1.0.2:
|
||||
resolution: {integrity: sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==}
|
||||
dependencies:
|
||||
call-bind: 1.0.7
|
||||
call-bind: 1.0.5
|
||||
dev: true
|
||||
|
||||
/is-what@3.14.1:
|
||||
@@ -6499,10 +6578,6 @@ packages:
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/js-base64@3.7.7:
|
||||
resolution: {integrity: sha512-7rCnleh0z2CkXhH67J8K1Ytz0b2Y+yxTPL+/KOJoa20hfnVQ/3/T6W/KflYI4bRHRagNeXeU2bkNGI3v1oS/lw==}
|
||||
dev: false
|
||||
|
||||
/js-beautify@1.14.6:
|
||||
resolution: {integrity: sha512-GfofQY5zDp+cuHc+gsEXKPpNw2KbPddreEo35O6jT6i0RVK6LhsoYBhq5TvK4/n74wnA0QbK8gGd+jUZwTMKJw==}
|
||||
engines: {node: '>=10'}
|
||||
@@ -6796,6 +6871,12 @@ packages:
|
||||
dependencies:
|
||||
'@jridgewell/sourcemap-codec': 1.4.15
|
||||
|
||||
/magic-string@0.30.17:
|
||||
resolution: {integrity: sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==}
|
||||
dependencies:
|
||||
'@jridgewell/sourcemap-codec': 1.5.0
|
||||
dev: false
|
||||
|
||||
/magic-string@0.30.2:
|
||||
resolution: {integrity: sha512-lNZdu7pewtq/ZvWUp9Wpf/x7WzMTsR26TWV03BRZrXFsv+BI6dy8RAiKgm1uM/kyR0rCfUcqvOlXKG66KhIGug==}
|
||||
engines: {node: '>=12'}
|
||||
@@ -7029,6 +7110,12 @@ packages:
|
||||
resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==}
|
||||
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
|
||||
|
||||
/nanoid@3.3.9:
|
||||
resolution: {integrity: sha512-SppoicMGpZvbF1l3z4x7No3OlIjP7QJvC9XR7AhZr1kL133KHnKPztkKDc+Ir4aJ/1VhTySrtKhrsycmrMQfvg==}
|
||||
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
|
||||
hasBin: true
|
||||
dev: false
|
||||
|
||||
/natural-compare@1.4.0:
|
||||
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
|
||||
dev: true
|
||||
@@ -7154,7 +7241,7 @@ packages:
|
||||
resolution: {integrity: sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==}
|
||||
engines: {node: '>= 0.4'}
|
||||
dependencies:
|
||||
call-bind: 1.0.7
|
||||
call-bind: 1.0.5
|
||||
define-properties: 1.2.1
|
||||
has-symbols: 1.0.3
|
||||
object-keys: 1.1.1
|
||||
@@ -7404,6 +7491,10 @@ packages:
|
||||
/picocolors@1.0.0:
|
||||
resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==}
|
||||
|
||||
/picocolors@1.1.1:
|
||||
resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}
|
||||
dev: false
|
||||
|
||||
/picomatch@2.3.1:
|
||||
resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==}
|
||||
engines: {node: '>=8.6'}
|
||||
@@ -7494,6 +7585,15 @@ packages:
|
||||
source-map-js: 1.0.2
|
||||
dev: true
|
||||
|
||||
/postcss@8.5.3:
|
||||
resolution: {integrity: sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==}
|
||||
engines: {node: ^10 || ^12 || >=14}
|
||||
dependencies:
|
||||
nanoid: 3.3.9
|
||||
picocolors: 1.1.1
|
||||
source-map-js: 1.2.1
|
||||
dev: false
|
||||
|
||||
/prelude-ls@1.2.1:
|
||||
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
|
||||
engines: {node: '>= 0.8.0'}
|
||||
@@ -7806,7 +7906,7 @@ packages:
|
||||
resolution: {integrity: sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==}
|
||||
engines: {node: '>= 0.4'}
|
||||
dependencies:
|
||||
call-bind: 1.0.7
|
||||
call-bind: 1.0.5
|
||||
define-properties: 1.2.1
|
||||
set-function-name: 2.0.1
|
||||
dev: true
|
||||
@@ -7957,8 +8057,8 @@ packages:
|
||||
resolution: {integrity: sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q==}
|
||||
engines: {node: '>=0.4'}
|
||||
dependencies:
|
||||
call-bind: 1.0.7
|
||||
get-intrinsic: 1.2.4
|
||||
call-bind: 1.0.5
|
||||
get-intrinsic: 1.2.2
|
||||
has-symbols: 1.0.3
|
||||
isarray: 2.0.5
|
||||
dev: true
|
||||
@@ -7970,8 +8070,8 @@ packages:
|
||||
/safe-regex-test@1.0.0:
|
||||
resolution: {integrity: sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==}
|
||||
dependencies:
|
||||
call-bind: 1.0.7
|
||||
get-intrinsic: 1.2.4
|
||||
call-bind: 1.0.5
|
||||
get-intrinsic: 1.2.2
|
||||
is-regex: 1.1.4
|
||||
dev: true
|
||||
|
||||
@@ -8061,25 +8161,23 @@ packages:
|
||||
resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==}
|
||||
dev: false
|
||||
|
||||
/set-function-length@1.2.2:
|
||||
resolution: {integrity: sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==}
|
||||
/set-function-length@1.1.1:
|
||||
resolution: {integrity: sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==}
|
||||
engines: {node: '>= 0.4'}
|
||||
dependencies:
|
||||
define-data-property: 1.1.4
|
||||
es-errors: 1.3.0
|
||||
function-bind: 1.1.2
|
||||
get-intrinsic: 1.2.4
|
||||
define-data-property: 1.1.1
|
||||
get-intrinsic: 1.2.2
|
||||
gopd: 1.0.1
|
||||
has-property-descriptors: 1.0.2
|
||||
has-property-descriptors: 1.0.1
|
||||
dev: true
|
||||
|
||||
/set-function-name@2.0.1:
|
||||
resolution: {integrity: sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==}
|
||||
engines: {node: '>= 0.4'}
|
||||
dependencies:
|
||||
define-data-property: 1.1.4
|
||||
define-data-property: 1.1.1
|
||||
functions-have-names: 1.2.3
|
||||
has-property-descriptors: 1.0.2
|
||||
has-property-descriptors: 1.0.1
|
||||
dev: true
|
||||
|
||||
/set-value@4.1.0:
|
||||
@@ -8102,13 +8200,11 @@ packages:
|
||||
engines: {node: '>=8'}
|
||||
dev: true
|
||||
|
||||
/side-channel@1.0.6:
|
||||
resolution: {integrity: sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==}
|
||||
engines: {node: '>= 0.4'}
|
||||
/side-channel@1.0.4:
|
||||
resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==}
|
||||
dependencies:
|
||||
call-bind: 1.0.7
|
||||
es-errors: 1.3.0
|
||||
get-intrinsic: 1.2.4
|
||||
call-bind: 1.0.5
|
||||
get-intrinsic: 1.2.2
|
||||
object-inspect: 1.13.1
|
||||
dev: true
|
||||
|
||||
@@ -8160,6 +8256,11 @@ packages:
|
||||
resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
/source-map-js@1.2.1:
|
||||
resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: false
|
||||
|
||||
/source-map-support@0.5.21:
|
||||
resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==}
|
||||
dependencies:
|
||||
@@ -8259,22 +8360,22 @@ packages:
|
||||
/string.prototype.matchall@4.0.10:
|
||||
resolution: {integrity: sha512-rGXbGmOEosIQi6Qva94HUjgPs9vKW+dkG7Y8Q5O2OYkWL6wFaTRZO8zM4mhP94uX55wgyrXzfS2aGtGzUL7EJQ==}
|
||||
dependencies:
|
||||
call-bind: 1.0.7
|
||||
call-bind: 1.0.5
|
||||
define-properties: 1.2.1
|
||||
es-abstract: 1.22.3
|
||||
get-intrinsic: 1.2.4
|
||||
get-intrinsic: 1.2.2
|
||||
has-symbols: 1.0.3
|
||||
internal-slot: 1.0.6
|
||||
regexp.prototype.flags: 1.5.1
|
||||
set-function-name: 2.0.1
|
||||
side-channel: 1.0.6
|
||||
side-channel: 1.0.4
|
||||
dev: true
|
||||
|
||||
/string.prototype.trim@1.2.8:
|
||||
resolution: {integrity: sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==}
|
||||
engines: {node: '>= 0.4'}
|
||||
dependencies:
|
||||
call-bind: 1.0.7
|
||||
call-bind: 1.0.5
|
||||
define-properties: 1.2.1
|
||||
es-abstract: 1.22.3
|
||||
dev: true
|
||||
@@ -8282,7 +8383,7 @@ packages:
|
||||
/string.prototype.trimend@1.0.7:
|
||||
resolution: {integrity: sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==}
|
||||
dependencies:
|
||||
call-bind: 1.0.7
|
||||
call-bind: 1.0.5
|
||||
define-properties: 1.2.1
|
||||
es-abstract: 1.22.3
|
||||
dev: true
|
||||
@@ -8290,7 +8391,7 @@ packages:
|
||||
/string.prototype.trimstart@1.0.7:
|
||||
resolution: {integrity: sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg==}
|
||||
dependencies:
|
||||
call-bind: 1.0.7
|
||||
call-bind: 1.0.5
|
||||
define-properties: 1.2.1
|
||||
es-abstract: 1.22.3
|
||||
dev: true
|
||||
@@ -8587,8 +8688,8 @@ packages:
|
||||
resolution: {integrity: sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==}
|
||||
engines: {node: '>= 0.4'}
|
||||
dependencies:
|
||||
call-bind: 1.0.7
|
||||
get-intrinsic: 1.2.4
|
||||
call-bind: 1.0.5
|
||||
get-intrinsic: 1.2.2
|
||||
is-typed-array: 1.1.12
|
||||
dev: true
|
||||
|
||||
@@ -8596,7 +8697,7 @@ packages:
|
||||
resolution: {integrity: sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==}
|
||||
engines: {node: '>= 0.4'}
|
||||
dependencies:
|
||||
call-bind: 1.0.7
|
||||
call-bind: 1.0.5
|
||||
for-each: 0.3.3
|
||||
has-proto: 1.0.1
|
||||
is-typed-array: 1.1.12
|
||||
@@ -8607,7 +8708,7 @@ packages:
|
||||
engines: {node: '>= 0.4'}
|
||||
dependencies:
|
||||
available-typed-arrays: 1.0.5
|
||||
call-bind: 1.0.7
|
||||
call-bind: 1.0.5
|
||||
for-each: 0.3.3
|
||||
has-proto: 1.0.1
|
||||
is-typed-array: 1.1.12
|
||||
@@ -8616,7 +8717,7 @@ packages:
|
||||
/typed-array-length@1.0.4:
|
||||
resolution: {integrity: sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==}
|
||||
dependencies:
|
||||
call-bind: 1.0.7
|
||||
call-bind: 1.0.5
|
||||
for-each: 0.3.3
|
||||
is-typed-array: 1.1.12
|
||||
dev: true
|
||||
@@ -8652,7 +8753,7 @@ packages:
|
||||
/unbox-primitive@1.0.2:
|
||||
resolution: {integrity: sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==}
|
||||
dependencies:
|
||||
call-bind: 1.0.7
|
||||
call-bind: 1.0.5
|
||||
has-bigints: 1.0.2
|
||||
has-symbols: 1.0.3
|
||||
which-boxed-primitive: 1.0.2
|
||||
@@ -9186,21 +9287,6 @@ packages:
|
||||
vue: 3.3.4
|
||||
dev: false
|
||||
|
||||
/vue-demi@0.14.8(vue@3.3.4):
|
||||
resolution: {integrity: sha512-Uuqnk9YE9SsWeReYqK2alDI5YzciATE0r2SkA6iMAtuXvNTMNACJLJEXNXaEy94ECuBe4Sk6RzRU80kjdbIo1Q==}
|
||||
engines: {node: '>=12'}
|
||||
hasBin: true
|
||||
requiresBuild: true
|
||||
peerDependencies:
|
||||
'@vue/composition-api': ^1.0.0-rc.1
|
||||
vue: ^3.0.0-0 || ^2.6.0
|
||||
peerDependenciesMeta:
|
||||
'@vue/composition-api':
|
||||
optional: true
|
||||
dependencies:
|
||||
vue: 3.3.4
|
||||
dev: false
|
||||
|
||||
/vue-eslint-parser@9.3.1(eslint@8.47.0):
|
||||
resolution: {integrity: sha512-Clr85iD2XFZ3lJ52/ppmUDG/spxQu6+MAeHXjjyI4I1NUYZ9xmenQp4N0oaHJhrA8OOxltCVxMRfANGa70vU0g==}
|
||||
engines: {node: ^14.17.0 || >=16.0.0}
|
||||
@@ -9267,6 +9353,22 @@ packages:
|
||||
'@vue/server-renderer': 3.3.4(vue@3.3.4)
|
||||
'@vue/shared': 3.3.4
|
||||
|
||||
/vue@3.5.13(typescript@5.2.2):
|
||||
resolution: {integrity: sha512-wmeiSMxkZCSc+PM2w2VRsOYAZC8GdipNFRTsLSfodVqI9mbejKeXEGr8SckuLnrQPGe3oJN5c3K0vpoU9q/wCQ==}
|
||||
peerDependencies:
|
||||
typescript: '*'
|
||||
peerDependenciesMeta:
|
||||
typescript:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@vue/compiler-dom': 3.5.13
|
||||
'@vue/compiler-sfc': 3.5.13
|
||||
'@vue/runtime-dom': 3.5.13
|
||||
'@vue/server-renderer': 3.5.13(vue@3.5.13)
|
||||
'@vue/shared': 3.5.13
|
||||
typescript: 5.2.2
|
||||
dev: false
|
||||
|
||||
/vueuc@0.4.51(vue@3.3.4):
|
||||
resolution: {integrity: sha512-pLiMChM4f+W8czlIClGvGBYo656lc2Y0/mXFSCydcSmnCR1izlKPGMgiYBGjbY9FDkFG8a2HEVz7t0DNzBWbDw==}
|
||||
peerDependencies:
|
||||
@@ -9371,7 +9473,7 @@ packages:
|
||||
engines: {node: '>= 0.4'}
|
||||
dependencies:
|
||||
available-typed-arrays: 1.0.5
|
||||
call-bind: 1.0.7
|
||||
call-bind: 1.0.5
|
||||
for-each: 0.3.3
|
||||
gopd: 1.0.1
|
||||
has-tostringtag: 1.0.0
|
||||
|
||||
@@ -48,7 +48,7 @@ const output = computed(() => transformer.value(input.value));
|
||||
monospace
|
||||
/>
|
||||
|
||||
<div overflow-auto>
|
||||
<div>
|
||||
<div mb-5px>
|
||||
{{ outputLabel }}
|
||||
</div>
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
import _ from 'lodash';
|
||||
|
||||
function useDebouncedRef<T>(initialValue: T, delay: number, immediate: boolean = false) {
|
||||
const state = ref(initialValue);
|
||||
const debouncedRef = customRef((track, trigger) => ({
|
||||
get() {
|
||||
track();
|
||||
return state.value;
|
||||
},
|
||||
set: _.debounce(
|
||||
(value) => {
|
||||
state.value = value;
|
||||
trigger();
|
||||
},
|
||||
delay,
|
||||
{ leading: immediate },
|
||||
),
|
||||
}));
|
||||
return debouncedRef;
|
||||
}
|
||||
export default useDebouncedRef;
|
||||
@@ -1,13 +1,8 @@
|
||||
import { extension as getExtensionFromMimeType, extension as getMimeTypeFromExtension } from 'mime-types';
|
||||
import { extension as getExtensionFromMime } from 'mime-types';
|
||||
import type { Ref } from 'vue';
|
||||
import _ from 'lodash';
|
||||
|
||||
export {
|
||||
getMimeTypeFromBase64,
|
||||
getMimeTypeFromExtension, getExtensionFromMimeType,
|
||||
useDownloadFileFromBase64, useDownloadFileFromBase64Refs,
|
||||
previewImageFromBase64,
|
||||
};
|
||||
export { getMimeTypeFromBase64, useDownloadFileFromBase64 };
|
||||
|
||||
const commonMimeTypesSignatures = {
|
||||
'JVBERi0': 'application/pdf',
|
||||
@@ -41,78 +36,30 @@ function getFileExtensionFromMimeType({
|
||||
defaultExtension?: string
|
||||
}) {
|
||||
if (mimeType) {
|
||||
return getExtensionFromMimeType(mimeType) ?? defaultExtension;
|
||||
return getExtensionFromMime(mimeType) ?? defaultExtension;
|
||||
}
|
||||
|
||||
return defaultExtension;
|
||||
}
|
||||
|
||||
function downloadFromBase64({ sourceValue, filename, extension, fileMimeType }:
|
||||
{ sourceValue: string; filename?: string; extension?: string; fileMimeType?: string }) {
|
||||
if (sourceValue === '') {
|
||||
throw new Error('Base64 string is empty');
|
||||
}
|
||||
|
||||
const defaultExtension = extension ?? 'txt';
|
||||
const { mimeType } = getMimeTypeFromBase64({ base64String: sourceValue });
|
||||
let base64String = sourceValue;
|
||||
if (!mimeType) {
|
||||
const targetMimeType = fileMimeType ?? getMimeTypeFromExtension(defaultExtension);
|
||||
base64String = `data:${targetMimeType};base64,${sourceValue}`;
|
||||
}
|
||||
|
||||
const cleanExtension = extension ?? getFileExtensionFromMimeType(
|
||||
{ mimeType, defaultExtension });
|
||||
let cleanFileName = filename ?? `file.${cleanExtension}`;
|
||||
if (extension && !cleanFileName.endsWith(`.${extension}`)) {
|
||||
cleanFileName = `${cleanFileName}.${cleanExtension}`;
|
||||
}
|
||||
|
||||
const a = document.createElement('a');
|
||||
a.href = base64String;
|
||||
a.download = cleanFileName;
|
||||
a.click();
|
||||
}
|
||||
|
||||
function useDownloadFileFromBase64(
|
||||
{ source, filename, extension, fileMimeType }:
|
||||
{ source: Ref<string>; filename?: string; extension?: string; fileMimeType?: string }) {
|
||||
function useDownloadFileFromBase64({ source, filename }: { source: Ref<string>; filename?: string }) {
|
||||
return {
|
||||
download() {
|
||||
downloadFromBase64({ sourceValue: source.value, filename, extension, fileMimeType });
|
||||
if (source.value === '') {
|
||||
throw new Error('Base64 string is empty');
|
||||
}
|
||||
|
||||
const { mimeType } = getMimeTypeFromBase64({ base64String: source.value });
|
||||
const base64String = mimeType
|
||||
? source.value
|
||||
: `data:text/plain;base64,${source.value}`;
|
||||
|
||||
const cleanFileName = filename ?? `file.${getFileExtensionFromMimeType({ mimeType })}`;
|
||||
|
||||
const a = document.createElement('a');
|
||||
a.href = base64String;
|
||||
a.download = cleanFileName;
|
||||
a.click();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function useDownloadFileFromBase64Refs(
|
||||
{ source, filename, extension }:
|
||||
{ source: Ref<string>; filename?: Ref<string>; extension?: Ref<string> }) {
|
||||
return {
|
||||
download() {
|
||||
downloadFromBase64({ sourceValue: source.value, filename: filename?.value, extension: extension?.value });
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function previewImageFromBase64(base64String: string): HTMLImageElement {
|
||||
if (base64String === '') {
|
||||
throw new Error('Base64 string is empty');
|
||||
}
|
||||
|
||||
const img = document.createElement('img');
|
||||
img.src = base64String;
|
||||
|
||||
const container = document.createElement('div');
|
||||
container.appendChild(img);
|
||||
|
||||
const previewContainer = document.getElementById('previewContainer');
|
||||
if (previewContainer) {
|
||||
previewContainer.innerHTML = '';
|
||||
previewContainer.appendChild(container);
|
||||
}
|
||||
else {
|
||||
throw new Error('Preview container element not found');
|
||||
}
|
||||
|
||||
return img;
|
||||
}
|
||||
@@ -2,19 +2,12 @@
|
||||
import { useBase64 } from '@vueuse/core';
|
||||
import type { Ref } from 'vue';
|
||||
import { useCopy } from '@/composable/copy';
|
||||
import { getExtensionFromMimeType, getMimeTypeFromBase64, previewImageFromBase64, useDownloadFileFromBase64Refs } from '@/composable/downloadBase64';
|
||||
import { useDownloadFileFromBase64 } from '@/composable/downloadBase64';
|
||||
import { useValidation } from '@/composable/validation';
|
||||
import { isValidBase64 } from '@/utils/base64';
|
||||
|
||||
const fileName = ref('file');
|
||||
const fileExtension = ref('');
|
||||
const base64Input = ref('');
|
||||
const { download } = useDownloadFileFromBase64Refs(
|
||||
{
|
||||
source: base64Input,
|
||||
filename: fileName,
|
||||
extension: fileExtension,
|
||||
});
|
||||
const { download } = useDownloadFileFromBase64({ source: base64Input });
|
||||
const base64InputValidation = useValidation({
|
||||
source: base64Input,
|
||||
rules: [
|
||||
@@ -25,35 +18,6 @@ const base64InputValidation = useValidation({
|
||||
],
|
||||
});
|
||||
|
||||
watch(
|
||||
base64Input,
|
||||
(newValue, _) => {
|
||||
const { mimeType } = getMimeTypeFromBase64({ base64String: newValue });
|
||||
if (mimeType) {
|
||||
fileExtension.value = getExtensionFromMimeType(mimeType) || fileExtension.value;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
function previewImage() {
|
||||
if (!base64InputValidation.isValid) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const image = previewImageFromBase64(base64Input.value);
|
||||
image.style.maxWidth = '100%';
|
||||
image.style.maxHeight = '400px';
|
||||
const previewContainer = document.getElementById('previewContainer');
|
||||
if (previewContainer) {
|
||||
previewContainer.innerHTML = '';
|
||||
previewContainer.appendChild(image);
|
||||
}
|
||||
}
|
||||
catch (_) {
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
function downloadFile() {
|
||||
if (!base64InputValidation.isValid) {
|
||||
return;
|
||||
@@ -80,24 +44,6 @@ async function onUpload(file: File) {
|
||||
|
||||
<template>
|
||||
<c-card title="Base64 to file">
|
||||
<n-grid cols="3" x-gap="12">
|
||||
<n-gi span="2">
|
||||
<c-input-text
|
||||
v-model:value="fileName"
|
||||
label="File Name"
|
||||
placeholder="Download filename"
|
||||
mb-2
|
||||
/>
|
||||
</n-gi>
|
||||
<n-gi>
|
||||
<c-input-text
|
||||
v-model:value="fileExtension"
|
||||
label="Extension"
|
||||
placeholder="Extension"
|
||||
mb-2
|
||||
/>
|
||||
</n-gi>
|
||||
</n-grid>
|
||||
<c-input-text
|
||||
v-model:value="base64Input"
|
||||
multiline
|
||||
@@ -107,14 +53,7 @@ async function onUpload(file: File) {
|
||||
mb-2
|
||||
/>
|
||||
|
||||
<div flex justify-center py-2>
|
||||
<div id="previewContainer" />
|
||||
</div>
|
||||
|
||||
<div flex justify-center gap-3>
|
||||
<c-button :disabled="base64Input === '' || !base64InputValidation.isValid" @click="previewImage()">
|
||||
Preview image
|
||||
</c-button>
|
||||
<div flex justify-center>
|
||||
<c-button :disabled="base64Input === '' || !base64InputValidation.isValid" @click="downloadFile()">
|
||||
Download file
|
||||
</c-button>
|
||||
|
||||
@@ -4,7 +4,6 @@ import emojiKeywords from 'emojilib';
|
||||
import _ from 'lodash';
|
||||
import type { EmojiInfo } from './emoji.types';
|
||||
import { useFuzzySearch } from '@/composable/fuzzySearch';
|
||||
import useDebouncedRef from '@/composable/debouncedref';
|
||||
|
||||
const escapeUnicode = ({ emoji }: { emoji: string }) => emoji.split('').map(unit => `\\u${unit.charCodeAt(0).toString(16).padStart(4, '0')}`).join('');
|
||||
const getEmojiCodePoints = ({ emoji }: { emoji: string }) => emoji.codePointAt(0) ? `0x${emoji.codePointAt(0)?.toString(16)}` : undefined;
|
||||
@@ -24,7 +23,7 @@ const emojisGroups: { emojiInfos: EmojiInfo[]; group: string }[] = _
|
||||
.map((emojiInfos, group) => ({ group, emojiInfos }))
|
||||
.value();
|
||||
|
||||
const searchQuery = useDebouncedRef('', 500);
|
||||
const searchQuery = ref('');
|
||||
|
||||
const { searchResult } = useFuzzySearch({
|
||||
search: searchQuery,
|
||||
|
||||
@@ -2,30 +2,9 @@
|
||||
import type { lib } from 'crypto-js';
|
||||
import { MD5, RIPEMD160, SHA1, SHA224, SHA256, SHA3, SHA384, SHA512, enc } from 'crypto-js';
|
||||
|
||||
import {
|
||||
adler32,
|
||||
argon2d,
|
||||
argon2i,
|
||||
argon2id,
|
||||
blake2b,
|
||||
blake2s,
|
||||
blake3,
|
||||
crc32,
|
||||
crc32c,
|
||||
createSHA256,
|
||||
keccak,
|
||||
pbkdf2,
|
||||
sm3,
|
||||
whirlpool,
|
||||
xxhash128,
|
||||
xxhash3,
|
||||
xxhash32,
|
||||
xxhash64,
|
||||
} from 'hash-wasm';
|
||||
|
||||
import InputCopyable from '../../components/InputCopyable.vue';
|
||||
import { convertHexToBin } from './hash-text.service';
|
||||
import { useQueryParamOrStorage } from '@/composable/queryParams';
|
||||
import { useQueryParam } from '@/composable/queryParams';
|
||||
|
||||
const algos = {
|
||||
MD5,
|
||||
@@ -41,27 +20,7 @@ const algos = {
|
||||
type AlgoNames = keyof typeof algos;
|
||||
type Encoding = keyof typeof enc | 'Bin';
|
||||
const algoNames = Object.keys(algos) as AlgoNames[];
|
||||
|
||||
const algosWasm = {
|
||||
adler32,
|
||||
crc32,
|
||||
crc32c,
|
||||
blake2b,
|
||||
blake2s,
|
||||
blake3,
|
||||
keccak,
|
||||
xxhash32,
|
||||
xxhash64,
|
||||
xxhash3,
|
||||
xxhash128,
|
||||
sm3,
|
||||
whirlpool,
|
||||
} as const;
|
||||
|
||||
type AlgoWasmNames = keyof typeof algosWasm;
|
||||
const algoWasmNames = Object.keys(algosWasm) as AlgoWasmNames[];
|
||||
|
||||
const encoding = useQueryParamOrStorage<Encoding>({ defaultValue: 'Hex', storageName: 'hash-text:encoding', name: 'encoding' });
|
||||
const encoding = useQueryParam<Encoding>({ defaultValue: 'Hex', name: 'encoding' });
|
||||
const clearText = ref('');
|
||||
|
||||
function formatWithEncoding(words: lib.WordArray, encoding: Encoding) {
|
||||
@@ -73,91 +32,12 @@ function formatWithEncoding(words: lib.WordArray, encoding: Encoding) {
|
||||
}
|
||||
|
||||
const hashText = (algo: AlgoNames, value: string) => formatWithEncoding(algos[algo](value), encoding.value);
|
||||
|
||||
const defaultHashWasmValues = {
|
||||
adler32: '',
|
||||
crc32: '',
|
||||
crc32c: '',
|
||||
blake2b: '',
|
||||
blake2s: '',
|
||||
blake3: '',
|
||||
keccak: '',
|
||||
xxhash32: '',
|
||||
xxhash64: '',
|
||||
xxhash3: '',
|
||||
xxhash128: '',
|
||||
sm3: '',
|
||||
whirlpool: '',
|
||||
};
|
||||
const hashWasmValues = computedAsync(async () => {
|
||||
const encodingValue = encoding.value;
|
||||
const clearTextValue = clearText.value;
|
||||
const ret = defaultHashWasmValues;
|
||||
for (const algo of algoWasmNames) {
|
||||
ret[algo] = formatWithEncoding(enc.Hex.parse(await algosWasm[algo](clearTextValue)), encodingValue);
|
||||
}
|
||||
return ret;
|
||||
}, defaultHashWasmValues);
|
||||
|
||||
const salt = new Uint8Array(16);
|
||||
window.crypto.getRandomValues(salt);
|
||||
const hashWasmArgon2i = computedAsync(async () => {
|
||||
const clearTextValue = clearText.value;
|
||||
return await argon2i({
|
||||
password: clearTextValue,
|
||||
salt,
|
||||
parallelism: 1,
|
||||
memorySize: 128,
|
||||
iterations: 4,
|
||||
hashLength: 16,
|
||||
outputType: 'encoded',
|
||||
});
|
||||
});
|
||||
const hashWasmArgon2d = computedAsync(async () => {
|
||||
const clearTextValue = clearText.value;
|
||||
return await argon2d({
|
||||
password: clearTextValue,
|
||||
salt,
|
||||
parallelism: 1,
|
||||
memorySize: 128,
|
||||
iterations: 4,
|
||||
hashLength: 16,
|
||||
outputType: 'encoded',
|
||||
});
|
||||
});
|
||||
const hashWasmArgon2id = computedAsync(async () => {
|
||||
const clearTextValue = clearText.value;
|
||||
return await argon2id({
|
||||
password: clearTextValue,
|
||||
salt,
|
||||
parallelism: 1,
|
||||
memorySize: 128,
|
||||
iterations: 4,
|
||||
hashLength: 16,
|
||||
outputType: 'encoded',
|
||||
});
|
||||
});
|
||||
const hashWasmPBKDF2 = computedAsync(async () => {
|
||||
const clearTextValue = clearText.value;
|
||||
return await pbkdf2({
|
||||
password: clearTextValue,
|
||||
salt,
|
||||
iterations: 16,
|
||||
hashLength: 32,
|
||||
hashFunction: createSHA256(),
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<c-card>
|
||||
<c-input-text
|
||||
v-model:value="clearText"
|
||||
multiline raw-text
|
||||
placeholder="Your string to hash..." rows="3"
|
||||
autosize autofocus label="Your text to hash:"
|
||||
/>
|
||||
<c-input-text v-model:value="clearText" multiline raw-text placeholder="Your string to hash..." rows="3" autosize autofocus label="Your text to hash:" />
|
||||
|
||||
<n-divider />
|
||||
|
||||
@@ -193,44 +73,6 @@ const hashWasmPBKDF2 = computedAsync(async () => {
|
||||
<InputCopyable :value="hashText(algo, clearText)" readonly />
|
||||
</n-input-group>
|
||||
</div>
|
||||
|
||||
<div v-for="algo in algoWasmNames" :key="algo" style="margin: 5px 0">
|
||||
<n-input-group>
|
||||
<n-input-group-label style="flex: 0 0 120px">
|
||||
{{ algo.toUpperCase() }}
|
||||
</n-input-group-label>
|
||||
<InputCopyable :value="hashWasmValues[algo]" readonly />
|
||||
</n-input-group>
|
||||
</div>
|
||||
|
||||
<n-divider />
|
||||
|
||||
<div style="margin: 5px 0">
|
||||
<n-input-group>
|
||||
<n-input-group-label style="flex: 0 0 120px">
|
||||
Argon2d
|
||||
</n-input-group-label>
|
||||
<InputCopyable :value="hashWasmArgon2d" readonly />
|
||||
</n-input-group>
|
||||
<n-input-group>
|
||||
<n-input-group-label style="flex: 0 0 120px">
|
||||
Argon2i
|
||||
</n-input-group-label>
|
||||
<InputCopyable :value="hashWasmArgon2i" readonly />
|
||||
</n-input-group>
|
||||
<n-input-group>
|
||||
<n-input-group-label style="flex: 0 0 120px">
|
||||
Argon2id
|
||||
</n-input-group-label>
|
||||
<InputCopyable :value="hashWasmArgon2id" readonly />
|
||||
</n-input-group>
|
||||
<n-input-group>
|
||||
<n-input-group-label style="flex: 0 0 120px">
|
||||
PBKDF2
|
||||
</n-input-group-label>
|
||||
<InputCopyable :value="hashWasmPBKDF2" readonly />
|
||||
</n-input-group>
|
||||
</div>
|
||||
</c-card>
|
||||
</div>
|
||||
</template>
|
||||
@@ -5,8 +5,7 @@ import { translate } from '@/plugins/i18n.plugin';
|
||||
export const tool = defineTool({
|
||||
name: translate('tools.hash-text.title'),
|
||||
path: '/hash-text',
|
||||
description:
|
||||
'Hash a text string using the function you need : MD5, SHA1, SHA256, SHA224, SHA512, SHA384, SHA3, RIPEMD160, ADLER32, CRC32, CRC32C, BLAKE, KECCAK, XXHASH, SM3, WHIRLPOOL or Argon2(i/d/id)',
|
||||
description: translate('tools.hash-text.description'),
|
||||
keywords: [
|
||||
'hash',
|
||||
'digest',
|
||||
@@ -21,24 +20,6 @@ export const tool = defineTool({
|
||||
'SHA384',
|
||||
'SHA3',
|
||||
'RIPEMD160',
|
||||
'ADLER32',
|
||||
'BLAKE2B',
|
||||
'BLAKE2S',
|
||||
'BLAKE3',
|
||||
'CRC32',
|
||||
'CRC32C',
|
||||
'KECCAK',
|
||||
'PBKDF2',
|
||||
'SM3',
|
||||
'WHIRLPOOL',
|
||||
'XXHASH128',
|
||||
'XXHASH3',
|
||||
'XXHASH32',
|
||||
'XXHASH64',
|
||||
'Argon2',
|
||||
'Argon2i',
|
||||
'Argon2d',
|
||||
'Argon2id',
|
||||
],
|
||||
component: () => import('./hash-text.vue'),
|
||||
icon: EyeOff,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { tool as base64FileConverter } from './base64-file-converter';
|
||||
import { tool as base64StringConverter } from './base64-string-converter';
|
||||
import { tool as basicAuthGenerator } from './basic-auth-generator';
|
||||
import { tool as jsonToCsharp } from './json-to-csharp';
|
||||
|
||||
import { tool as asciiTextDrawer } from './ascii-text-drawer';
|
||||
|
||||
@@ -107,6 +108,7 @@ export const toolsByCategory: ToolCategory[] = [
|
||||
listConverter,
|
||||
tomlToJson,
|
||||
tomlToYaml,
|
||||
jsonToCsharp,
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { CSharp } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'JSON to C#',
|
||||
path: '/json-to-csharp',
|
||||
description: 'Convert JSON data to C# type definition',
|
||||
keywords: ['json', 'c#', 'csharp'],
|
||||
component: () => import('./json-to-csharp.vue'),
|
||||
icon: CSharp,
|
||||
createdAt: new Date('2024-05-11'),
|
||||
});
|
||||
@@ -0,0 +1,102 @@
|
||||
<script setup lang="ts">
|
||||
import JSON5 from 'json5';
|
||||
import json2csharp from './json2csharp';
|
||||
import type { UseValidationRule } from '@/composable/validation';
|
||||
import TextareaCopyable from '@/components/TextareaCopyable.vue';
|
||||
import { withDefaultOnError } from '@/utils/defaults';
|
||||
import { useQueryParamOrStorage } from '@/composable/queryParams';
|
||||
|
||||
const defaultValue = `{
|
||||
a:"n",
|
||||
arr: [1, 2],
|
||||
nested: {
|
||||
a:1,
|
||||
b:"2"
|
||||
}
|
||||
}`;
|
||||
const jsonInput = ref(defaultValue);
|
||||
const pascalCase = useQueryParamOrStorage({ name: 'pascalcase', storageName: 'json-c#:pc', defaultValue: true });
|
||||
const useFields = useQueryParamOrStorage({ name: 'fields', storageName: 'json-c#:fi', defaultValue: false });
|
||||
const useNullable = useQueryParamOrStorage({ name: 'nullable', storageName: 'json-c#:null', defaultValue: false });
|
||||
const addJsonProperty = useQueryParamOrStorage({ name: 'pascal', storageName: 'json-c#:jsp', defaultValue: false });
|
||||
const nullValueHandlingIgnore = useQueryParamOrStorage({ name: 'pascal', storageName: 'json-c#:ign', defaultValue: true });
|
||||
const addJsonPropertyName = useQueryParamOrStorage({ name: 'pascal', storageName: 'json-c#:jspp', defaultValue: true });
|
||||
const generateImmutableClasses = useQueryParamOrStorage({ name: 'pascal', storageName: 'json-c#:imm', defaultValue: false });
|
||||
const useRecordTypes = useQueryParamOrStorage({ name: 'pascal', storageName: 'json-c#:rec', defaultValue: true });
|
||||
const useReadonlyLists = useQueryParamOrStorage({ name: 'pascal', storageName: 'json-c#:rdl', defaultValue: false });
|
||||
const rootTypeName = useQueryParamOrStorage({ name: 'root', storageName: 'json-c#:rt', defaultValue: 'Root' });
|
||||
|
||||
const csharpOutput = computed(() => withDefaultOnError(
|
||||
() => json2csharp({
|
||||
src: JSON5.parse(jsonInput.value),
|
||||
rootTypeName: rootTypeName.value,
|
||||
pascalCase: pascalCase.value,
|
||||
useFields: useFields.value,
|
||||
useNullable: useNullable.value,
|
||||
addJsonProperty: addJsonProperty.value,
|
||||
nullValueHandlingIgnore: nullValueHandlingIgnore.value,
|
||||
addJsonPropertyName: addJsonPropertyName.value,
|
||||
generateImmutableClasses: generateImmutableClasses.value,
|
||||
useRecordTypes: useRecordTypes.value,
|
||||
useReadonlyLists: useReadonlyLists.value,
|
||||
}), ''));
|
||||
const rules: UseValidationRule<string>[] = [
|
||||
{
|
||||
validator: (v: string) => v === '' || JSON5.parse(v),
|
||||
message: 'Provided JSON is not valid.',
|
||||
},
|
||||
];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<c-card title="JSON to C#">
|
||||
<c-input-text
|
||||
v-model:value="jsonInput"
|
||||
multiline
|
||||
placeholder="Put your json string here..."
|
||||
rows="10"
|
||||
label="JSON to C#"
|
||||
:validation-rules="rules"
|
||||
raw-text
|
||||
mb-5
|
||||
/>
|
||||
<n-space justify="center">
|
||||
<n-checkbox v-model:checked="pascalCase">
|
||||
Use Pascal case
|
||||
</n-checkbox>
|
||||
<n-checkbox v-model:checked="useRecordTypes">
|
||||
Use Record types
|
||||
</n-checkbox>
|
||||
<n-checkbox v-model:checked="generateImmutableClasses">
|
||||
Generate Immutable classes
|
||||
</n-checkbox>
|
||||
<n-checkbox v-model:checked="useFields">
|
||||
Use fields
|
||||
</n-checkbox>
|
||||
<n-checkbox v-model:checked="addJsonProperty">
|
||||
Add JsonProperty attributes
|
||||
</n-checkbox>
|
||||
<n-checkbox v-model:checked="nullValueHandlingIgnore" :disabled="!addJsonProperty">
|
||||
Use NullValueHandling.Ignore
|
||||
</n-checkbox>
|
||||
<n-checkbox v-model:checked="addJsonPropertyName">
|
||||
Add JsonPropertyName attributes
|
||||
</n-checkbox>
|
||||
<n-checkbox v-model:checked="useNullable">
|
||||
Use nullable types
|
||||
</n-checkbox>
|
||||
<n-checkbox v-model:checked="useReadonlyLists">
|
||||
Use Readonly lists
|
||||
</n-checkbox>
|
||||
</n-space>
|
||||
<c-input-text v-model:value="rootTypeName" label="Root type name" placeholder="Your root type name..." clearable raw-text mb-5 />
|
||||
</c-card>
|
||||
<c-card title="Your C# code" mt-2>
|
||||
<TextareaCopyable
|
||||
:value="csharpOutput"
|
||||
language="csharp"
|
||||
/>
|
||||
</c-card>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,617 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { getPrimitiveProp, isDate, json2classes, json2csharp } from './json2csharp';
|
||||
|
||||
// Test isDate function
|
||||
describe('isDate', () => {
|
||||
it('should return true for valid date strings', () => {
|
||||
expect(isDate('2024-03-08')).toBe(true);
|
||||
expect(isDate('2024-03-08T12:34:56Z')).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false for invalid date strings', () => {
|
||||
expect(isDate('hello')).toBe(false);
|
||||
expect(isDate('2024-13-08')).toBe(false); // Invalid month
|
||||
expect(isDate('9999-99-99')).toBe(false); // Invalid format
|
||||
});
|
||||
});
|
||||
|
||||
// Test getPrimitiveProp function
|
||||
describe('getPrimitiveProp', () => {
|
||||
it('should return \'string\' type for non-date strings', () => {
|
||||
expect(getPrimitiveProp('hello', 'testKey')).toEqual({
|
||||
type: 'string',
|
||||
name: 'testKey',
|
||||
canBeNullable: false,
|
||||
});
|
||||
});
|
||||
|
||||
it('should return \'DateTime\' type for date strings', () => {
|
||||
expect(getPrimitiveProp('2024-03-08', 'dateKey')).toEqual({
|
||||
type: 'DateTime',
|
||||
name: 'dateKey',
|
||||
canBeNullable: true,
|
||||
});
|
||||
});
|
||||
|
||||
it('should return \'int\' for integers', () => {
|
||||
expect(getPrimitiveProp(42, 'numberKey')).toEqual({
|
||||
type: 'int',
|
||||
name: 'numberKey',
|
||||
canBeNullable: true,
|
||||
});
|
||||
});
|
||||
|
||||
it('should return \'double\' for floating point numbers', () => {
|
||||
expect(getPrimitiveProp(3.14, 'floatKey')).toEqual({
|
||||
type: 'double',
|
||||
name: 'floatKey',
|
||||
canBeNullable: true,
|
||||
});
|
||||
});
|
||||
|
||||
it('should return \'bool\' for boolean values', () => {
|
||||
expect(getPrimitiveProp(true, 'boolKey')).toEqual({
|
||||
type: 'bool',
|
||||
name: 'boolKey',
|
||||
canBeNullable: true,
|
||||
});
|
||||
});
|
||||
|
||||
it('should throw an error for unsupported types', () => {
|
||||
expect(() => getPrimitiveProp({}, 'objKey')).toThrow('Unexpected key \'objKey\' of type object');
|
||||
});
|
||||
});
|
||||
|
||||
// Test json2classes function
|
||||
describe('json2classes', () => {
|
||||
it('should convert JSON to class definitions with custom root', () => {
|
||||
const json = { name: 'John', age: 30 };
|
||||
const result = json2classes(json, 'Main');
|
||||
expect(result).to.deep.eq([
|
||||
{
|
||||
key: 'Main',
|
||||
props: [
|
||||
{ type: 'string', name: 'name', canBeNullable: false },
|
||||
{ type: 'int', name: 'age', canBeNullable: true },
|
||||
],
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it('should handle nested objects', () => {
|
||||
const json = { user: { name: 'John' } };
|
||||
const result = json2classes(json);
|
||||
expect(result).to.deep.eq([
|
||||
{ key: 'Root', props: [{ type: 'User', name: 'user' }] },
|
||||
{ key: 'User', props: [{ type: 'string', name: 'name', canBeNullable: false }] },
|
||||
]);
|
||||
});
|
||||
|
||||
it('should handle arrays of primitives', () => {
|
||||
const json = { numbers: [1, 2, 3] };
|
||||
const result = json2classes(json);
|
||||
expect(result).to.deep.eq([
|
||||
{ key: 'Root', props: [{ type: 'int', name: 'numbers', isArray: true, canBeNullable: true }] },
|
||||
]);
|
||||
});
|
||||
|
||||
it('should handle arrays of objects', () => {
|
||||
const json = { users: [{ name: 'John' }, { name: 'Jane' }] };
|
||||
const result = json2classes(json);
|
||||
expect(result).to.deep.eq([
|
||||
{ key: 'Root', props: [{ type: 'UsersItem', name: 'users', isArray: true }] },
|
||||
{ key: 'UsersItem', props: [{ type: 'string', name: 'name', canBeNullable: false }] },
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
// Test json2csharp function
|
||||
describe('json2csharp', () => {
|
||||
const cleanTabs = (s: string) => s.replace(/\t/g, ' ');
|
||||
|
||||
it('should convert JSON to C# class with default options', () => {
|
||||
const json = JSON.stringify({ name: 'John', age: 30 });
|
||||
const result = cleanTabs(json2csharp({ src: json }));
|
||||
|
||||
expect(result).toBe(`using System;
|
||||
using System.Text.Json;
|
||||
|
||||
public class Root
|
||||
{
|
||||
[JsonPropertyName(\"name\")]
|
||||
public string Name { get; set; }
|
||||
[JsonPropertyName(\"age\")]
|
||||
public int Age { get; set; }
|
||||
}`);
|
||||
});
|
||||
|
||||
it('should not change case if pascalCase option is false', () => {
|
||||
const json = JSON.stringify({ test: { user_name: 'John' } });
|
||||
const result = cleanTabs(json2csharp({ src: json, pascalCase: false }));
|
||||
|
||||
expect(result).toBe(`using System;
|
||||
using System.Text.Json;
|
||||
|
||||
public class Root
|
||||
{
|
||||
[JsonPropertyName(\"test\")]
|
||||
public Test test { get; set; }
|
||||
}
|
||||
|
||||
public class Test
|
||||
{
|
||||
[JsonPropertyName(\"user_name\")]
|
||||
public string user_name { get; set; }
|
||||
}`);
|
||||
});
|
||||
|
||||
it('should handle when root is an array', () => {
|
||||
const json = JSON.stringify([{ age: 30 }]);
|
||||
const result = cleanTabs(json2csharp({ src: json, useNullable: true }));
|
||||
|
||||
expect(result).toBe(`using System;
|
||||
using System.Text.Json;
|
||||
|
||||
public class RootItem
|
||||
{
|
||||
[JsonPropertyName(\"age\")]
|
||||
public int? Age { get; set; }
|
||||
}`);
|
||||
});
|
||||
|
||||
it('should use nullable types if useNullable option is true', () => {
|
||||
const json = JSON.stringify({ age: 30 });
|
||||
const result = cleanTabs(json2csharp({ src: json, useNullable: true }));
|
||||
|
||||
expect(result).toBe(`using System;
|
||||
using System.Text.Json;
|
||||
|
||||
public class Root
|
||||
{
|
||||
[JsonPropertyName(\"age\")]
|
||||
public int? Age { get; set; }
|
||||
}`);
|
||||
});
|
||||
|
||||
it('should add JsonProperty attributes if addJsonProperty is true', () => {
|
||||
const json = JSON.stringify({ name: 'John' });
|
||||
const result = cleanTabs(json2csharp({ src: json, addJsonProperty: true }));
|
||||
|
||||
expect(result).toBe(`using System;
|
||||
using Newtonsoft.Json;
|
||||
using System.Text.Json;
|
||||
|
||||
public class Root
|
||||
{
|
||||
[JsonProperty(\"name\", NullValueHandling = NullValueHandling.Ignore)]
|
||||
[JsonPropertyName(\"name\")]
|
||||
public string Name { get; set; }
|
||||
}`);
|
||||
});
|
||||
|
||||
it('should add JsonPropertyName attributes if addJsonPropertyName is true', () => {
|
||||
const json = JSON.stringify({ name: 'John' });
|
||||
const result = cleanTabs(json2csharp({ src: json, addJsonPropertyName: true }));
|
||||
|
||||
expect(result).toBe(`using System;
|
||||
using System.Text.Json;
|
||||
|
||||
public class Root
|
||||
{
|
||||
[JsonPropertyName(\"name\")]
|
||||
public string Name { get; set; }
|
||||
}`);
|
||||
});
|
||||
|
||||
it('should generate immutable classes if generateImmutableClasses is true', () => {
|
||||
const json = JSON.stringify({ name: 'John' });
|
||||
const result = cleanTabs(json2csharp({ src: json, generateImmutableClasses: true }));
|
||||
|
||||
expect(result).toBe(`using System;
|
||||
using System.Text.Json;
|
||||
|
||||
public class Root
|
||||
{
|
||||
public Root(
|
||||
string name
|
||||
){
|
||||
this.Name = name;
|
||||
}
|
||||
|
||||
[JsonPropertyName(\"name\")]
|
||||
public string Name { get; }
|
||||
}`);
|
||||
});
|
||||
|
||||
it('should convert JSON with arrays into C# classes', () => {
|
||||
const json = {
|
||||
users: [{ name: 'John', age: 30 }, { name: 'Jane', age: 25 }],
|
||||
};
|
||||
|
||||
expect(cleanTabs(json2csharp({ src: json }))).toBe(`using System;
|
||||
using System.Text.Json;
|
||||
|
||||
public class Root
|
||||
{
|
||||
[JsonPropertyName(\"users\")]
|
||||
public UsersItem[] Users { get; set; }
|
||||
}
|
||||
|
||||
public class UsersItem
|
||||
{
|
||||
[JsonPropertyName(\"name\")]
|
||||
public string Name { get; set; }
|
||||
[JsonPropertyName(\"age\")]
|
||||
public int Age { get; set; }
|
||||
}`);
|
||||
expect(cleanTabs(json2csharp({ src: json, useRecordTypes: true }))).toBe(`using System;
|
||||
using System.Text.Json;
|
||||
|
||||
public record Root(
|
||||
[property: JsonPropertyName(\"users\")]
|
||||
UsersItem[] Users
|
||||
);
|
||||
|
||||
public record UsersItem(
|
||||
[property: JsonPropertyName(\"name\")]
|
||||
string Name,
|
||||
[property: JsonPropertyName(\"age\")]
|
||||
int Age
|
||||
);`);
|
||||
expect(cleanTabs(json2csharp({ src: json, useRecordTypes: true, pascalCase: false, useReadonlyLists: true }))).toBe(`using System;
|
||||
using System.Text.Json;
|
||||
|
||||
public record Root(
|
||||
[property: JsonPropertyName(\"users\")]
|
||||
IReadonlyList<UsersItem> users
|
||||
);
|
||||
|
||||
public record UsersItem(
|
||||
[property: JsonPropertyName(\"name\")]
|
||||
string name,
|
||||
[property: JsonPropertyName(\"age\")]
|
||||
int age
|
||||
);`);
|
||||
});
|
||||
|
||||
it('should generate C# record types when useRecordTypes is true', () => {
|
||||
const json = JSON.stringify({ name: 'John', age: 30 });
|
||||
const result = cleanTabs(json2csharp({ src: json, useRecordTypes: true }));
|
||||
|
||||
expect(result).toBe(`using System;
|
||||
using System.Text.Json;
|
||||
|
||||
public record Root(
|
||||
[property: JsonPropertyName(\"name\")]
|
||||
string Name,
|
||||
[property: JsonPropertyName(\"age\")]
|
||||
int Age
|
||||
);`);
|
||||
});
|
||||
|
||||
it('should generate C# record types with attributes when useRecordTypes/addJsonProperty/addJsonPropertyName are true', () => {
|
||||
const json = JSON.stringify({ name: 'John', age: 30 });
|
||||
const result = cleanTabs(json2csharp({
|
||||
src: json,
|
||||
useRecordTypes: true,
|
||||
addJsonProperty: true,
|
||||
addJsonPropertyName: true,
|
||||
}));
|
||||
|
||||
expect(result).toBe(`using System;
|
||||
using Newtonsoft.Json;
|
||||
using System.Text.Json;
|
||||
|
||||
public record Root(
|
||||
[property: JsonProperty(\"name\", NullValueHandling = NullValueHandling.Ignore)]
|
||||
[property: JsonPropertyName(\"name\")]
|
||||
string Name,
|
||||
[property: JsonProperty(\"age\", NullValueHandling = NullValueHandling.Ignore)]
|
||||
[property: JsonPropertyName(\"age\")]
|
||||
int Age
|
||||
);`);
|
||||
});
|
||||
|
||||
it('should handle arrays of primitives', () => {
|
||||
const json = JSON.stringify({ numbers: [1, 2, 3] });
|
||||
const result = cleanTabs(json2csharp({ src: json }));
|
||||
|
||||
expect(result).toBe(`using System;
|
||||
using System.Text.Json;
|
||||
|
||||
public class Root
|
||||
{
|
||||
[JsonPropertyName(\"numbers\")]
|
||||
public int[] Numbers { get; set; }
|
||||
}`);
|
||||
});
|
||||
|
||||
it('should handle arrays of objects with PascalCase enabled', () => {
|
||||
const json = JSON.stringify({
|
||||
items: [{ item_name: 'A', price: 10.5 }],
|
||||
});
|
||||
const result = cleanTabs(json2csharp({
|
||||
src: json,
|
||||
pascalCase: true,
|
||||
addJsonProperty: true,
|
||||
addJsonPropertyName: true,
|
||||
}));
|
||||
|
||||
expect(result).toBe(`using System;
|
||||
using Newtonsoft.Json;
|
||||
using System.Text.Json;
|
||||
|
||||
public class Root
|
||||
{
|
||||
[JsonProperty(\"items\", NullValueHandling = NullValueHandling.Ignore)]
|
||||
[JsonPropertyName(\"items\")]
|
||||
public ItemsItem[] Items { get; set; }
|
||||
}
|
||||
|
||||
public class ItemsItem
|
||||
{
|
||||
[JsonProperty(\"item_name\", NullValueHandling = NullValueHandling.Ignore)]
|
||||
[JsonPropertyName(\"item_name\")]
|
||||
public string ItemName { get; set; }
|
||||
[JsonProperty(\"price\", NullValueHandling = NullValueHandling.Ignore)]
|
||||
[JsonPropertyName(\"price\")]
|
||||
public double Price { get; set; }
|
||||
}`);
|
||||
});
|
||||
|
||||
it('should use nullable types for optional fields when useNullable is true', () => {
|
||||
const json = JSON.stringify({ age: null, price: 10.5 });
|
||||
const result = cleanTabs(json2csharp({ src: json, useNullable: true }));
|
||||
|
||||
expect(result).toBe(`using System;
|
||||
using System.Text.Json;
|
||||
|
||||
public class Root
|
||||
{
|
||||
[JsonPropertyName(\"age\")]
|
||||
public Age Age { get; set; }
|
||||
[JsonPropertyName(\"price\")]
|
||||
public double? Price { get; set; }
|
||||
}
|
||||
|
||||
public class Age
|
||||
{
|
||||
}`);
|
||||
});
|
||||
|
||||
it('should use fields when useFields is true', () => {
|
||||
const json = JSON.stringify({ age: 1, price: 10.5 });
|
||||
const result = cleanTabs(json2csharp({ src: json, useFields: true }));
|
||||
|
||||
expect(result).toBe(`using System;
|
||||
using System.Text.Json;
|
||||
|
||||
public class Root
|
||||
{
|
||||
[JsonPropertyName(\"age\")]
|
||||
public int Age;
|
||||
[JsonPropertyName(\"price\")]
|
||||
public double Price;
|
||||
}`);
|
||||
});
|
||||
|
||||
it('should add JsonProperty attributes when addJsonProperty is true', () => {
|
||||
const json = JSON.stringify({ firstName: 'John', lastName: 'Doe' });
|
||||
const result = cleanTabs(json2csharp({ src: json, addJsonProperty: true, nullValueHandlingIgnore: false }));
|
||||
|
||||
expect(result).toBe(`using System;
|
||||
using Newtonsoft.Json;
|
||||
using System.Text.Json;
|
||||
|
||||
public class Root
|
||||
{
|
||||
[JsonProperty(\"firstName\")]
|
||||
[JsonPropertyName(\"firstName\")]
|
||||
public string FirstName { get; set; }
|
||||
[JsonProperty(\"lastName\")]
|
||||
[JsonPropertyName(\"lastName\")]
|
||||
public string LastName { get; set; }
|
||||
}`);
|
||||
});
|
||||
|
||||
it('should add JsonProperty attributes when addJsonProperty and nullValueHandlingIgnore are true', () => {
|
||||
const json = JSON.stringify({ firstName: 'John', lastName: 'Doe' });
|
||||
const result = cleanTabs(json2csharp({ src: json, addJsonProperty: true, nullValueHandlingIgnore: true }));
|
||||
|
||||
expect(result).toBe(`using System;
|
||||
using Newtonsoft.Json;
|
||||
using System.Text.Json;
|
||||
|
||||
public class Root
|
||||
{
|
||||
[JsonProperty(\"firstName\", NullValueHandling = NullValueHandling.Ignore)]
|
||||
[JsonPropertyName(\"firstName\")]
|
||||
public string FirstName { get; set; }
|
||||
[JsonProperty(\"lastName\", NullValueHandling = NullValueHandling.Ignore)]
|
||||
[JsonPropertyName(\"lastName\")]
|
||||
public string LastName { get; set; }
|
||||
}`);
|
||||
});
|
||||
|
||||
it('should handle all types', () => {
|
||||
const json = JSON.stringify({
|
||||
id: 1, date: '2025-06-09', amount: 1.4, group: null, active: true, email: 'test@example.com',
|
||||
});
|
||||
const result = cleanTabs(json2csharp({ src: json }));
|
||||
|
||||
expect(result).toBe(`using System;
|
||||
using System.Text.Json;
|
||||
|
||||
public class Root
|
||||
{
|
||||
[JsonPropertyName(\"id\")]
|
||||
public int Id { get; set; }
|
||||
[JsonPropertyName(\"date\")]
|
||||
public DateTime Date { get; set; }
|
||||
[JsonPropertyName(\"amount\")]
|
||||
public double Amount { get; set; }
|
||||
[JsonPropertyName(\"group\")]
|
||||
public Group Group { get; set; }
|
||||
[JsonPropertyName(\"active\")]
|
||||
public bool Active { get; set; }
|
||||
[JsonPropertyName(\"email\")]
|
||||
public string Email { get; set; }
|
||||
}
|
||||
|
||||
public class Group
|
||||
{
|
||||
}`);
|
||||
});
|
||||
|
||||
it('should use readonly lists when useReadonlyLists is true', () => {
|
||||
const json = JSON.stringify({
|
||||
items: [{ name: 'Item1' }, { name: 'Item2' }],
|
||||
});
|
||||
const result = cleanTabs(json2csharp({ src: json, useReadonlyLists: true }));
|
||||
|
||||
expect(result).toBe(`using System;
|
||||
using System.Text.Json;
|
||||
|
||||
public class Root
|
||||
{
|
||||
[JsonPropertyName(\"items\")]
|
||||
public List<ItemsItem> Items { get; } = new List<ItemsItem>;
|
||||
}
|
||||
|
||||
public class ItemsItem
|
||||
{
|
||||
[JsonPropertyName(\"name\")]
|
||||
public string Name { get; set; }
|
||||
}`);
|
||||
});
|
||||
|
||||
it('should use immutable class properties when generateImmutableClasses is true', () => {
|
||||
const json = JSON.stringify({ title: 'Book', pages: 300 });
|
||||
const result = cleanTabs(json2csharp({ src: json, generateImmutableClasses: true }));
|
||||
|
||||
expect(result).toBe(`using System;
|
||||
using System.Text.Json;
|
||||
|
||||
public class Root
|
||||
{
|
||||
public Root(
|
||||
string title,
|
||||
int pages
|
||||
){
|
||||
this.Title = title;
|
||||
this.Pages = pages;
|
||||
}
|
||||
|
||||
[JsonPropertyName(\"title\")]
|
||||
public string Title { get; }
|
||||
[JsonPropertyName(\"pages\")]
|
||||
public int Pages { get; }
|
||||
}`);
|
||||
});
|
||||
|
||||
it('should generate a combination of options correctly', () => {
|
||||
const json = JSON.stringify({
|
||||
people: [
|
||||
{ first_name: 'John', age: 30 },
|
||||
{ first_name: 'Jane', age: 25 },
|
||||
],
|
||||
});
|
||||
|
||||
expect(cleanTabs(json2csharp({
|
||||
src: json,
|
||||
pascalCase: true,
|
||||
useNullable: true,
|
||||
addJsonProperty: true,
|
||||
generateImmutableClasses: true,
|
||||
useRecordTypes: false,
|
||||
useReadonlyLists: true,
|
||||
}))).toBe(`using System;
|
||||
using Newtonsoft.Json;
|
||||
using System.Text.Json;
|
||||
|
||||
public class Root
|
||||
{
|
||||
public Root(
|
||||
List<PeopleItem> people
|
||||
){
|
||||
this.People = people;
|
||||
}
|
||||
|
||||
[JsonProperty(\"people\", NullValueHandling = NullValueHandling.Ignore)]
|
||||
[JsonPropertyName(\"people\")]
|
||||
public List<PeopleItem> People { get; } = new List<PeopleItem>;
|
||||
}
|
||||
|
||||
public class PeopleItem
|
||||
{
|
||||
public PeopleItem(
|
||||
string firstName,
|
||||
int? age
|
||||
){
|
||||
this.FirstName = firstName;
|
||||
this.Age = age;
|
||||
}
|
||||
|
||||
[JsonProperty(\"first_name\", NullValueHandling = NullValueHandling.Ignore)]
|
||||
[JsonPropertyName(\"first_name\")]
|
||||
public string FirstName { get; }
|
||||
[JsonProperty(\"age\", NullValueHandling = NullValueHandling.Ignore)]
|
||||
[JsonPropertyName(\"age\")]
|
||||
public int? Age { get; }
|
||||
}`);
|
||||
expect(cleanTabs(json2csharp({
|
||||
src: json,
|
||||
pascalCase: true,
|
||||
useNullable: true,
|
||||
addJsonProperty: true,
|
||||
addJsonPropertyName: true,
|
||||
generateImmutableClasses: false,
|
||||
useRecordTypes: false,
|
||||
useReadonlyLists: true,
|
||||
}))).toBe(`using System;
|
||||
using Newtonsoft.Json;
|
||||
using System.Text.Json;
|
||||
|
||||
public class Root
|
||||
{
|
||||
[JsonProperty(\"people\", NullValueHandling = NullValueHandling.Ignore)]
|
||||
[JsonPropertyName(\"people\")]
|
||||
public List<PeopleItem> People { get; } = new List<PeopleItem>;
|
||||
}
|
||||
|
||||
public class PeopleItem
|
||||
{
|
||||
[JsonProperty(\"first_name\", NullValueHandling = NullValueHandling.Ignore)]
|
||||
[JsonPropertyName(\"first_name\")]
|
||||
public string FirstName { get; set; }
|
||||
[JsonProperty(\"age\", NullValueHandling = NullValueHandling.Ignore)]
|
||||
[JsonPropertyName(\"age\")]
|
||||
public int? Age { get; set; }
|
||||
}`);
|
||||
expect(cleanTabs(json2csharp({
|
||||
src: json,
|
||||
pascalCase: true,
|
||||
useNullable: true,
|
||||
addJsonProperty: true,
|
||||
useRecordTypes: true,
|
||||
useReadonlyLists: true,
|
||||
}))).toBe(`using System;
|
||||
using Newtonsoft.Json;
|
||||
using System.Text.Json;
|
||||
|
||||
public record Root(
|
||||
[property: JsonProperty(\"people\", NullValueHandling = NullValueHandling.Ignore)]
|
||||
[property: JsonPropertyName(\"people\")]
|
||||
IReadonlyList<PeopleItem> People
|
||||
);
|
||||
|
||||
public record PeopleItem(
|
||||
[property: JsonProperty(\"first_name\", NullValueHandling = NullValueHandling.Ignore)]
|
||||
[property: JsonPropertyName(\"first_name\")]
|
||||
string FirstName,
|
||||
[property: JsonProperty(\"age\", NullValueHandling = NullValueHandling.Ignore)]
|
||||
[property: JsonPropertyName(\"age\")]
|
||||
int? Age
|
||||
);`);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,215 @@
|
||||
import { camelCase as convertToCamelCase, pascalCase as convertToPascalCase } from 'change-case';
|
||||
import JSON5 from 'json5';
|
||||
|
||||
function normalize(src: string, firstUpper = true) {
|
||||
// return /^\d$/.test(src.charAt(0))
|
||||
// ? `N${pascalCase(src)}`
|
||||
// : pascalCase(src);
|
||||
return /^\d$/.test(src.charAt(0))
|
||||
? `N${src}`
|
||||
: (firstUpper ? src.charAt(0).toUpperCase() + src.slice(1) : src);
|
||||
}
|
||||
|
||||
export function isDate(src: string) {
|
||||
return /^(\d{4})(-(0[1-9]|1[0-2])(-([12]\d|0[1-9]|3[01]))([T\s]((([01]\d|2[0-3])((:)[0-5]\d))([\:]\d+)?)?(:[0-5]\d([\.]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)$/.test(
|
||||
src,
|
||||
);
|
||||
}
|
||||
|
||||
interface Prop { type: string; name: string; isArray?: boolean; canBeNullable?: boolean }
|
||||
|
||||
export function getPrimitiveProp(obj: any, key: string): Prop {
|
||||
const type = typeof obj;
|
||||
switch (type) {
|
||||
case 'string':
|
||||
// eslint-disable-next-line no-case-declarations
|
||||
const isObjDate = isDate(obj);
|
||||
return { type: isObjDate ? 'DateTime' : 'string', name: key, canBeNullable: isObjDate };
|
||||
case 'number':
|
||||
return { type: Number.isInteger(obj) ? 'int' : 'double', name: key, canBeNullable: true };
|
||||
case 'boolean':
|
||||
return { type: 'bool', name: key, canBeNullable: true };
|
||||
default:
|
||||
throw new Error(`Unexpected key '${key}' of type ${type}`);
|
||||
}
|
||||
}
|
||||
|
||||
interface ClassType { key: string; props: Array<Prop> }
|
||||
|
||||
function handleObject(
|
||||
classes: Array<ClassType>,
|
||||
obj: any,
|
||||
key: string,
|
||||
skip: boolean = false) {
|
||||
const normalizedKey = normalize(key);
|
||||
let target: ClassType = classes.find(x => x.key === normalizedKey) as never;
|
||||
if (!target) {
|
||||
target = { key: normalizedKey, props: [] };
|
||||
if (!skip) {
|
||||
classes.push(target);
|
||||
}
|
||||
}
|
||||
|
||||
if (obj != null) {
|
||||
Object.keys(obj).forEach((k) => {
|
||||
const keyName = Number.isNaN(Number(k)) ? k : `${normalizedKey}Item`;
|
||||
let prop: Prop | null = null;
|
||||
if (typeof obj[k] == 'object') {
|
||||
if (Array.isArray(obj[k])) {
|
||||
if (Array.from(obj[k]).length > 0) {
|
||||
if (typeof obj[k][0] == 'object') {
|
||||
handleObject(classes, obj[k], keyName, true);
|
||||
prop = {
|
||||
type: normalize(`${keyName}Item`),
|
||||
name: keyName,
|
||||
isArray: true,
|
||||
};
|
||||
}
|
||||
else {
|
||||
prop = getPrimitiveProp(obj[k][0], keyName);
|
||||
prop.isArray = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
handleObject(classes, obj[k], keyName);
|
||||
prop = { type: normalize(keyName), name: keyName };
|
||||
}
|
||||
}
|
||||
else {
|
||||
prop = getPrimitiveProp(obj[k], keyName);
|
||||
}
|
||||
|
||||
if (prop && !target.props.some(x => x.name === prop?.name)) {
|
||||
target.props.push(prop);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function json2classes(src: object, rootTypeName: string = 'Root') {
|
||||
const classes: Array<ClassType> = [];
|
||||
handleObject(classes, src, rootTypeName);
|
||||
return classes;
|
||||
}
|
||||
|
||||
export function json2csharp(
|
||||
{
|
||||
src,
|
||||
rootTypeName = 'Root',
|
||||
pascalCase = true,
|
||||
nullValueHandlingIgnore = true,
|
||||
addJsonPropertyName = true,
|
||||
useReadonlyLists,
|
||||
useRecordTypes,
|
||||
addJsonProperty,
|
||||
generateImmutableClasses,
|
||||
useFields,
|
||||
useNullable,
|
||||
}: {
|
||||
src: any
|
||||
rootTypeName?: string
|
||||
pascalCase?: boolean
|
||||
useFields?: boolean
|
||||
useNullable?: boolean
|
||||
addJsonProperty?: boolean
|
||||
nullValueHandlingIgnore?: boolean
|
||||
addJsonPropertyName?: boolean
|
||||
generateImmutableClasses?: boolean
|
||||
useRecordTypes?: boolean
|
||||
useReadonlyLists?: boolean
|
||||
}) {
|
||||
const normalizeCase = (s: string) => {
|
||||
const normalized = normalize(s, pascalCase);
|
||||
return pascalCase ? convertToPascalCase(normalized) : normalized;
|
||||
};
|
||||
|
||||
const getPropType = (p: Prop) => {
|
||||
let type = p.type;
|
||||
if (p.isArray) {
|
||||
if (useReadonlyLists) {
|
||||
type = useRecordTypes ? `IReadonlyList<${type}>` : `List<${type}>`;
|
||||
}
|
||||
else {
|
||||
type = `${type}[]`;
|
||||
}
|
||||
}
|
||||
const nullable = useNullable && p.canBeNullable ? '?' : '';
|
||||
return { type, nullable };
|
||||
};
|
||||
|
||||
const srcObj = typeof src === 'string' ? JSON5.parse(src) : src;
|
||||
const classes = json2classes(
|
||||
Array.isArray(srcObj) ? srcObj[0] : srcObj,
|
||||
Array.isArray(srcObj) ? `${rootTypeName}Item` : rootTypeName);
|
||||
let result = '';
|
||||
result += 'using System;\n';
|
||||
result += addJsonProperty ? 'using Newtonsoft.Json;\n' : '';
|
||||
result += addJsonPropertyName ? 'using System.Text.Json;\n' : '';
|
||||
result += '\n';
|
||||
classes.forEach((c) => {
|
||||
if (useRecordTypes) {
|
||||
result += `public record ${normalizeCase(c.key)}(\n`;
|
||||
}
|
||||
else {
|
||||
result += `public class ${normalizeCase(c.key)}\n`;
|
||||
result += '{\n';
|
||||
}
|
||||
if (!useRecordTypes && generateImmutableClasses) {
|
||||
result += `\tpublic ${normalizeCase(c.key)}(\n`;
|
||||
c.props.forEach((p) => {
|
||||
const propType = getPropType(p);
|
||||
result += `\t\t${propType.type}${propType.nullable} ${convertToCamelCase(p.name)},\n`;
|
||||
});
|
||||
result = result.replace(/,\n$/, '\n');
|
||||
result += '\t){\n';
|
||||
c.props.forEach((p) => {
|
||||
result += `\t\tthis.${normalizeCase(p.name)} = ${convertToCamelCase(p.name)};\n`;
|
||||
});
|
||||
result += '\t}\n\n';
|
||||
}
|
||||
c.props.forEach((p) => {
|
||||
const scope = useRecordTypes ? 'property: ' : '';
|
||||
if (addJsonProperty) {
|
||||
if (nullValueHandlingIgnore) {
|
||||
result += `\t[${scope}JsonProperty("${p.name}", NullValueHandling = NullValueHandling.Ignore)]\n`;
|
||||
}
|
||||
else {
|
||||
result += `\t[${scope}JsonProperty("${p.name}")]\n`;
|
||||
}
|
||||
}
|
||||
if (addJsonPropertyName) {
|
||||
result += `\t[${scope}JsonPropertyName("${p.name}")]\n`;
|
||||
}
|
||||
|
||||
const propType = getPropType(p);
|
||||
if (useRecordTypes) {
|
||||
result += `\t${propType.type}${propType.nullable} ${normalizeCase(p.name)},\n`;
|
||||
}
|
||||
else {
|
||||
const newList = useReadonlyLists && p.isArray ? ` = new ${propType.type};` : '';
|
||||
if (useFields) {
|
||||
result += `\tpublic ${propType.type}${propType.nullable} ${normalizeCase(p.name)}${(newList || ';')}`;
|
||||
}
|
||||
else if (generateImmutableClasses || (p.isArray && useReadonlyLists)) {
|
||||
result += `\tpublic ${propType.type}${propType.nullable} ${normalizeCase(p.name)} { get; }${newList}`;
|
||||
}
|
||||
else {
|
||||
result += `\tpublic ${propType.type}${propType.nullable} ${normalizeCase(p.name)} { get; set; }${newList}`;
|
||||
}
|
||||
result += '\n';
|
||||
}
|
||||
});
|
||||
if (useRecordTypes) {
|
||||
result = result.replace(/,\n$/, '\n');
|
||||
result += ');\n\n';
|
||||
}
|
||||
else {
|
||||
result += '}\n\n';
|
||||
}
|
||||
});
|
||||
|
||||
return result.trim();
|
||||
}
|
||||
|
||||
export default json2csharp;
|
||||
@@ -39,7 +39,7 @@ const validation = useValidation({
|
||||
{{ section.title }}
|
||||
</th>
|
||||
<tr v-for="{ claim, claimDescription, friendlyValue, value } in decodedJWT[section.key]" :key="claim + value">
|
||||
<td class="claims" style="vertical-align: top;">
|
||||
<td class="claims">
|
||||
<span font-bold>
|
||||
{{ claim }}
|
||||
</span>
|
||||
@@ -47,7 +47,7 @@ const validation = useValidation({
|
||||
({{ claimDescription }})
|
||||
</span>
|
||||
</td>
|
||||
<td style="word-wrap: break-word;word-break: break-all;">
|
||||
<td>
|
||||
<span>{{ value }}</span>
|
||||
<span v-if="friendlyValue" ml-2 op-70>
|
||||
({{ friendlyValue }})
|
||||
|
||||
@@ -38,8 +38,7 @@ describe('base64 utils', () => {
|
||||
|
||||
it('should throw for incorrect base64 string', () => {
|
||||
expect(() => base64ToText('a')).to.throw('Incorrect base64 string');
|
||||
// should not really be false because trimming of space is now implied
|
||||
// expect(() => base64ToText(' ')).to.throw('Incorrect base64 string');
|
||||
expect(() => base64ToText(' ')).to.throw('Incorrect base64 string');
|
||||
expect(() => base64ToText('é')).to.throw('Incorrect base64 string');
|
||||
// missing final '='
|
||||
expect(() => base64ToText('bG9yZW0gaXBzdW0')).to.throw('Incorrect base64 string');
|
||||
@@ -57,17 +56,17 @@ describe('base64 utils', () => {
|
||||
|
||||
it('should return false for incorrect base64 string', () => {
|
||||
expect(isValidBase64('a')).to.eql(false);
|
||||
expect(isValidBase64(' ')).to.eql(false);
|
||||
expect(isValidBase64('é')).to.eql(false);
|
||||
expect(isValidBase64('data:text/plain;notbase64,YQ==')).to.eql(false);
|
||||
// missing final '='
|
||||
expect(isValidBase64('bG9yZW0gaXBzdW0')).to.eql(false);
|
||||
});
|
||||
|
||||
it('should return true for untrimmed correct base64 string', () => {
|
||||
expect(isValidBase64('bG9yZW0gaXBzdW0= ')).to.eql(true);
|
||||
expect(isValidBase64(' LTE=')).to.eql(true);
|
||||
expect(isValidBase64(' YQ== ')).to.eql(true);
|
||||
expect(isValidBase64(' ')).to.eql(true);
|
||||
it('should return false for untrimmed correct base64 string', () => {
|
||||
expect(isValidBase64('bG9yZW0gaXBzdW0= ')).to.eql(false);
|
||||
expect(isValidBase64(' LTE=')).to.eql(false);
|
||||
expect(isValidBase64(' YQ== ')).to.eql(false);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
+4
-7
@@ -1,9 +1,7 @@
|
||||
import { Base64 } from 'js-base64';
|
||||
|
||||
export { textToBase64, base64ToText, isValidBase64, removePotentialDataAndMimePrefix };
|
||||
|
||||
function textToBase64(str: string, { makeUrlSafe = false }: { makeUrlSafe?: boolean } = {}) {
|
||||
const encoded = Base64.encode(str);
|
||||
const encoded = window.btoa(str);
|
||||
return makeUrlSafe ? makeUriSafe(encoded) : encoded;
|
||||
}
|
||||
|
||||
@@ -18,7 +16,7 @@ function base64ToText(str: string, { makeUrlSafe = false }: { makeUrlSafe?: bool
|
||||
}
|
||||
|
||||
try {
|
||||
return Base64.decode(cleanStr);
|
||||
return window.atob(cleanStr);
|
||||
}
|
||||
catch (_) {
|
||||
throw new Error('Incorrect base64 string');
|
||||
@@ -36,11 +34,10 @@ function isValidBase64(str: string, { makeUrlSafe = false }: { makeUrlSafe?: boo
|
||||
}
|
||||
|
||||
try {
|
||||
const reEncodedBase64 = Base64.fromUint8Array(Base64.toUint8Array(cleanStr));
|
||||
if (makeUrlSafe) {
|
||||
return removePotentialPadding(reEncodedBase64) === cleanStr;
|
||||
return removePotentialPadding(window.btoa(window.atob(cleanStr))) === cleanStr;
|
||||
}
|
||||
return reEncodedBase64 === cleanStr.replace(/\s/g, '');
|
||||
return window.btoa(window.atob(cleanStr)) === cleanStr;
|
||||
}
|
||||
catch (err) {
|
||||
return false;
|
||||
|
||||
Reference in new issue
Block a user