diff --git a/package.json b/package.json index ab1cf2696..6814bb5a7 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "@vueuse/core": "^11.1.0", "allof-merge": "^0.6.6", "flatted": "^3.3.1", - "httpsnippet-lite": "^3.0.5", + "httpsnippet": "^3.0.7", "json-schema": "^0.4.0", "markdown-it": "^14.1.0", "oas-normalize": "^11.1.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c7280da73..8baa82d08 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -53,9 +53,9 @@ importers: flatted: specifier: ^3.3.1 version: 3.3.1 - httpsnippet-lite: - specifier: ^3.0.5 - version: 3.0.5 + httpsnippet: + specifier: ^3.0.7 + version: 3.0.7 json-schema: specifier: ^0.4.0 version: 0.4.0 @@ -687,7 +687,6 @@ packages: '@evilmartians/lefthook@1.7.16': resolution: {integrity: sha512-fGmn7Gfb006wtlyKVcxQ2k6OpmgUxIsTGUqrsMMLaSWNaGfPl/ki6m4JnJVgA2cJV7ZikTOOOPQLBJ0Pqh6nxw==} - cpu: [x64, arm64, ia32] os: [darwin, linux, win32] hasBin: true @@ -1194,9 +1193,6 @@ packages: '@types/estree@1.0.6': resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==} - '@types/har-format@1.2.15': - resolution: {integrity: sha512-RpQH4rXLuvTXKR0zqHq3go0RVXYv/YVqv4TnPH95VbwUxZdQlK1EtcMvQvMpDngHbt13Csh9Z4qT9AbkiQH5BA==} - '@types/hast@3.0.4': resolution: {integrity: sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==} @@ -2191,6 +2187,9 @@ packages: duplexer2@0.1.4: resolution: {integrity: sha512-asLFVfWWtJ90ZyOUHMqk7/S2w2guQKxUI2itj3d92ADHhxUSbCMGi1f1cBcJ7xM1To+pE/Khbwo1yuNbMEPKeA==} + duplexer@0.1.2: + resolution: {integrity: sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==} + eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} @@ -2389,6 +2388,9 @@ packages: resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} engines: {node: '>=0.10.0'} + event-stream@4.0.1: + resolution: {integrity: sha512-qACXdu/9VHPBzcyhdOWR5/IahhGMf0roTeZJfzz077GwylcDd90yOHLouhmv7GJ5XzPi6ekaQWd8AvPP2nOvpA==} + event-target-shim@5.0.1: resolution: {integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==} engines: {node: '>=6'} @@ -2543,16 +2545,15 @@ packages: resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} engines: {node: '>= 6'} - formdata-node@4.4.1: - resolution: {integrity: sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==} - engines: {node: '>= 12.20'} - fraction.js@4.3.7: resolution: {integrity: sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==} from2@2.3.0: resolution: {integrity: sha512-OMcX/4IC/uqEPVgGeyfN22LJk6AZrMkRZHxcHBMBvHScDGgwTm2GT2Wkgtocyd3JfZffjj2kYUDXXII0Fk9W0g==} + from@0.1.7: + resolution: {integrity: sha512-twe20eF1OxVxp/ML/kq2p1uc6KvFK/+vs8WjEbeKmV2He22MKm7YF2ANIt+EOqhJ5L3K/SuuPhk0hWQDjOM23g==} + fs-extra@11.2.0: resolution: {integrity: sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==} engines: {node: '>=14.14'} @@ -2724,6 +2725,9 @@ packages: engines: {node: '>=0.4.7'} hasBin: true + har-validator-compiled@1.0.0: + resolution: {integrity: sha512-dher7nFSx+Ef6OoqVveLClh8itAR3vd8Qx70Lh/hEgP1iGeARAolbci7Y8JBrHIYgFCT6xRdvvL16AR9Zh07Dw==} + has-bigints@1.0.2: resolution: {integrity: sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==} @@ -2834,9 +2838,10 @@ packages: resolution: {integrity: sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==} engines: {node: '>= 14'} - httpsnippet-lite@3.0.5: - resolution: {integrity: sha512-So4qTXY5iFj5XtFDwyz2PicUu+8NWrI8e8h+ZeZoVtMNcFQp4FFIntBHUE+JPUG6QQU8o1VHCy+X4ETRDwt9CA==} - engines: {node: '>=14.13'} + httpsnippet@3.0.7: + resolution: {integrity: sha512-jlJv2Mxu5bfSysmlhiAPmxbk6UxFx0EhsKIw1aR7mlIwDzFMXuxcnTgQB30L0hfq92bbLKiwhW5xHor3Af07uQ==} + engines: {node: ^14.19.1 || ^16.14.2 || ^18.0.0 || ^20.0.0} + hasBin: true human-signals@2.1.0: resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==} @@ -3397,6 +3402,9 @@ packages: make-error@1.3.6: resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} + map-stream@0.0.7: + resolution: {integrity: sha512-C0X0KQmGm3N2ftbTGBhSyuydQ+vV1LC3f3zPvT3RXHXNZrvfPZcoXp/N5DOa8vedX/rTMm2CjTtivFg2STJMRQ==} + markdown-it@14.1.0: resolution: {integrity: sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==} hasBin: true @@ -3584,10 +3592,6 @@ packages: resolution: {integrity: sha512-V52MLl7BU+tH2Np9tDrIXK8bql3MVUadnMIl/0/oZSGC9keuro0O9UUv9QKp0aMvtN8HRew4G7byY7H4eWsxaQ==} engines: {node: ^12.20 || >=14.13} - node-domexception@1.0.0: - resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==} - engines: {node: '>=10.5.0'} - node-emoji@2.1.3: resolution: {integrity: sha512-E2WEOVsgs7O16zsURJ/eH8BqhF029wGpEOnv7Urwdo2wmQanOACwJQh0devF9D9RhoZru0+9JXIS0dBXIAz+lA==} engines: {node: '>=18'} @@ -3974,6 +3978,9 @@ packages: resolution: {integrity: sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==} engines: {node: '>= 14.16'} + pause-stream@0.0.11: + resolution: {integrity: sha512-e3FBlXLmN/D1S+zHzanP4E/4Z60oFAa3O051qt1pxa7DEJWKAyil6upYVXCWadEnuoqa4Pkc9oUx9zsxYeRv8A==} + pbkdf2@3.1.2: resolution: {integrity: sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==} engines: {node: '>=0.12'} @@ -4551,6 +4558,9 @@ packages: resolution: {integrity: sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==} engines: {node: '>= 10.x'} + split@1.0.1: + resolution: {integrity: sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==} + stackback@0.0.2: resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} @@ -4563,6 +4573,9 @@ packages: stream-combiner2@1.1.1: resolution: {integrity: sha512-3PnJbYgS56AeWgtKF5jtJRT6uFJe56Z0Hc5Ngg/6sI6rIt8iiMBTa9cvdyFfpMQjaVHr8dusbNeFGIIonxOvKw==} + stream-combiner@0.2.2: + resolution: {integrity: sha512-6yHMqgLYDzQDcAkL+tjJDC5nSNuNIx0vZtRZeiPh7Saef7VHX9H5Ijn9l2VIol2zaNYlYEX6KyuT/237A58qEQ==} + stream-http@3.2.0: resolution: {integrity: sha512-Oq1bLqisTyK3TSCXpPbT4sdeYNdmyZJv1LxpEm2vu1ZhK89kSE5YXwZc3cWk0MagGaKriBh9mCFbVGtO+vY29A==} @@ -5182,10 +5195,6 @@ packages: wcwidth@1.0.1: resolution: {integrity: sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==} - web-streams-polyfill@4.0.0-beta.3: - resolution: {integrity: sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==} - engines: {node: '>= 14'} - webidl-conversions@3.0.1: resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} @@ -6539,8 +6548,6 @@ snapshots: '@types/estree@1.0.6': {} - '@types/har-format@1.2.15': {} - '@types/hast@3.0.4': dependencies: '@types/unist': 3.0.3 @@ -7709,6 +7716,8 @@ snapshots: dependencies: readable-stream: 2.3.8 + duplexer@0.1.2: {} + eastasianwidth@0.2.0: {} editorconfig@1.0.4: @@ -8022,6 +8031,16 @@ snapshots: esutils@2.0.3: {} + event-stream@4.0.1: + dependencies: + duplexer: 0.1.2 + from: 0.1.7 + map-stream: 0.0.7 + pause-stream: 0.0.11 + split: 1.0.1 + stream-combiner: 0.2.2 + through: 2.3.8 + event-target-shim@5.0.1: {} events@3.3.0: {} @@ -8203,11 +8222,6 @@ snapshots: combined-stream: 1.0.8 mime-types: 2.1.35 - formdata-node@4.4.1: - dependencies: - node-domexception: 1.0.0 - web-streams-polyfill: 4.0.0-beta.3 - fraction.js@4.3.7: {} from2@2.3.0: @@ -8215,6 +8229,8 @@ snapshots: inherits: 2.0.4 readable-stream: 2.3.8 + from@0.1.7: {} + fs-extra@11.2.0: dependencies: graceful-fs: 4.2.11 @@ -8417,6 +8433,8 @@ snapshots: optionalDependencies: uglify-js: 3.19.3 + har-validator-compiled@1.0.0: {} + has-bigints@1.0.2: {} has-flag@3.0.0: {} @@ -8536,11 +8554,14 @@ snapshots: transitivePeerDependencies: - supports-color - httpsnippet-lite@3.0.5: + httpsnippet@3.0.7: dependencies: - '@types/har-format': 1.2.15 - formdata-node: 4.4.1 + chalk: 4.1.2 + event-stream: 4.0.1 + form-data: 4.0.0 + har-validator-compiled: 1.0.0 stringify-object: 3.3.0 + yargs: 17.7.2 human-signals@2.1.0: {} @@ -9045,6 +9066,8 @@ snapshots: make-error@1.3.6: {} + map-stream@0.0.7: {} + markdown-it@14.1.0: dependencies: argparse: 2.0.1 @@ -9217,8 +9240,6 @@ snapshots: jsonpath-plus: 6.0.1 lodash.topath: 4.5.2 - node-domexception@1.0.0: {} - node-emoji@2.1.3: dependencies: '@sindresorhus/is': 4.6.0 @@ -9557,6 +9578,10 @@ snapshots: pathval@2.0.0: {} + pause-stream@0.0.11: + dependencies: + through: 2.3.8 + pbkdf2@3.1.2: dependencies: create-hash: 1.2.0 @@ -10154,6 +10179,10 @@ snapshots: split2@4.2.0: {} + split@1.0.1: + dependencies: + through: 2.3.8 + stackback@0.0.2: {} std-env@3.7.0: {} @@ -10168,6 +10197,11 @@ snapshots: duplexer2: 0.1.4 readable-stream: 2.3.8 + stream-combiner@0.2.2: + dependencies: + duplexer: 0.1.2 + through: 2.3.8 + stream-http@3.2.0: dependencies: builtin-status-codes: 3.0.0 @@ -10877,8 +10911,6 @@ snapshots: dependencies: defaults: 1.0.4 - web-streams-polyfill@4.0.0-beta.3: {} - webidl-conversions@3.0.1: {} webidl-conversions@7.0.0: {} diff --git a/src/components/spec-document/samples/RequestSample.vue b/src/components/spec-document/samples/RequestSample.vue index 77daa7df9..1f879508e 100644 --- a/src/components/spec-document/samples/RequestSample.vue +++ b/src/components/spec-document/samples/RequestSample.vue @@ -90,13 +90,13 @@ import { watch, ref, computed, inject } from 'vue' import type { PropType, Ref } from 'vue' import type { IHttpOperation, INodeExample } from '@stoplight/types' -import { HTTPSnippet } from 'httpsnippet-lite' +import { HTTPSnippet } from 'httpsnippet' import { requestSampleConfigs } from '@/constants' import { getRequestHeaders } from '@/utils' import CodeBlock from '@/components/common/CodeBlock.vue' import CollapsablePanel from '@/components/common/CollapsablePanel.vue' import type { LanguageCode } from '@/types/request-languages' -import type { HarRequest, HTTPSnippet as HTTPSnippetType, TargetId } from 'httpsnippet-lite' +import type { HarRequest, HTTPSnippet as HTTPSnippetType, TargetId } from 'httpsnippet' import SelectDropdown from '@/components/common/SelectDropdown.vue' import LanguageIcon from '@/components/common/LanguageIcon.vue' import type { SelectItem } from '@/types' @@ -243,7 +243,7 @@ watch(() => ({ requestQuery: props.requestQuery, authQuery: props.authQuery, requestBody: props.requestBody, -}), async (newValue, oldValue) => { +}), (newValue, oldValue) => { if (newValue.method !== oldValue?.method && requestConfigs.value?.[0]) { selectedLang.value = requestConfigs.value[0].httpSnippetLanguage @@ -308,7 +308,7 @@ watch(() => ({ requestCode.value = newValue.requestBody return requestSampleConfigs.filter(c => c.httpSnippetLanguage !== 'json') } else if (snippet.value) { - requestCode.value = await snippet.value.convert((newValue.lang as TargetId), newValue.lib) + requestCode.value = snippet.value.convert((newValue.lang as TargetId), newValue.lib) || '' } } } diff --git a/src/types/request-languages.ts b/src/types/request-languages.ts index 190031f30..ddf064212 100644 --- a/src/types/request-languages.ts +++ b/src/types/request-languages.ts @@ -1,4 +1,4 @@ -import type { TargetId, ClientId } from 'httpsnippet-lite' +import type { TargetId, ClientId } from 'httpsnippet' export type LanguageCode = TargetId | 'json' interface LibraryConfig { label: string diff --git a/vite.config.ts b/vite.config.ts index fb1fc575d..8188dbcfc 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -75,7 +75,7 @@ export default defineConfig({ * during the build */ nodePolyfills({ - include: ['util', 'path'], + include: ['util', 'path', 'querystring'], }), vue({ features: {