fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #3487 from hey-api/fix/reserved-keywords-expand

fix: expand reserved keywords with more globals

authored by

Lubos and committed by
GitHub
3be5ff23 6e7765f6

+177 -2
+5
.changeset/busy-plums-cover.md
··· 1 + --- 2 + "@hey-api/openapi-ts": patch 3 + --- 4 + 5 + **dsl(reserved)**: expand reserved keywords with more globals
+128
packages/openapi-ts/src/ts-dsl/utils/__tests__/name.test.ts
··· 10 10 output: 'document_', 11 11 }, 12 12 { 13 + name: 'fetch', 14 + output: 'fetch_', 15 + }, 16 + { 13 17 name: 'history', 14 18 output: 'history_', 15 19 }, ··· 26 30 output: 'window_', 27 31 }, 28 32 { 33 + name: 'AbortController', 34 + output: 'AbortController_', 35 + }, 36 + { 37 + name: 'AbortSignal', 38 + output: 'AbortSignal_', 39 + }, 40 + { 41 + name: 'Blob', 42 + output: 'Blob_', 43 + }, 44 + { 45 + name: 'CustomEvent', 46 + output: 'CustomEvent_', 47 + }, 48 + { 49 + name: 'Event', 50 + output: 'Event_', 51 + }, 52 + { 53 + name: 'EventTarget', 54 + output: 'EventTarget_', 55 + }, 56 + { 57 + name: 'File', 58 + output: 'File_', 59 + }, 60 + { 61 + name: 'FileList', 62 + output: 'FileList_', 63 + }, 64 + { 65 + name: 'FileReader', 66 + output: 'FileReader_', 67 + }, 68 + { 69 + name: 'FormData', 70 + output: 'FormData_', 71 + }, 72 + { 73 + name: 'Headers', 74 + output: 'Headers_', 75 + }, 76 + { 77 + name: 'Request', 78 + output: 'Request_', 79 + }, 80 + { 81 + name: 'Response', 82 + output: 'Response_', 83 + }, 84 + { 85 + name: 'TextDecoder', 86 + output: 'TextDecoder_', 87 + }, 88 + { 89 + name: 'TextEncoder', 90 + output: 'TextEncoder_', 91 + }, 92 + { 93 + name: 'URL', 94 + output: 'URL_', 95 + }, 96 + { 97 + name: 'URLSearchParams', 98 + output: 'URLSearchParams_', 99 + }, 100 + { 29 101 name: 'console', 30 102 output: 'console_', 31 103 }, ··· 34 106 output: 'Array_', 35 107 }, 36 108 { 109 + name: 'ArrayBuffer', 110 + output: 'ArrayBuffer_', 111 + }, 112 + { 113 + name: 'BigInt', 114 + output: 'BigInt_', 115 + }, 116 + { 117 + name: 'Boolean', 118 + output: 'Boolean_', 119 + }, 120 + { 121 + name: 'DataView', 122 + output: 'DataView_', 123 + }, 124 + { 37 125 name: 'Date', 38 126 output: 'Date_', 39 127 }, ··· 58 146 output: 'Math_', 59 147 }, 60 148 { 149 + name: 'Number', 150 + output: 'Number_', 151 + }, 152 + { 61 153 name: 'Object', 62 154 output: 'Object_', 63 155 }, ··· 66 158 output: 'Promise_', 67 159 }, 68 160 { 161 + name: 'Proxy', 162 + output: 'Proxy_', 163 + }, 164 + { 165 + name: 'Reflect', 166 + output: 'Reflect_', 167 + }, 168 + { 69 169 name: 'RegExp', 70 170 output: 'RegExp_', 71 171 }, 72 172 { 73 173 name: 'Set', 74 174 output: 'Set_', 175 + }, 176 + { 177 + name: 'String', 178 + output: 'String_', 179 + }, 180 + { 181 + name: 'Symbol', 182 + output: 'Symbol_', 75 183 }, 76 184 { 77 185 name: 'WeakMap', ··· 282 390 output: 'yield_', 283 391 }, 284 392 { 393 + name: '__dirname', 394 + output: '__dirname_', 395 + }, 396 + { 397 + name: '__filename', 398 + output: '__filename_', 399 + }, 400 + { 401 + name: 'exports', 402 + output: 'exports_', 403 + }, 404 + { 285 405 name: 'global', 286 406 output: 'global_', 287 407 }, 288 408 { 409 + name: 'module', 410 + output: 'module_', 411 + }, 412 + { 289 413 name: 'process', 290 414 output: 'process_', 415 + }, 416 + { 417 + name: 'require', 418 + output: 'require_', 291 419 }, 292 420 { 293 421 name: 'Buffer',
+44 -2
packages/openapi-ts/src/ts-dsl/utils/keywords.ts
··· 1 - const browserGlobals = ['document', 'history', 'location', 'navigator', 'window']; 1 + const browserGlobals = [ 2 + 'document', 3 + 'fetch', 4 + 'history', 5 + 'location', 6 + 'navigator', 7 + 'window', 8 + 'AbortController', 9 + 'AbortSignal', 10 + 'Blob', 11 + 'CustomEvent', 12 + 'Event', 13 + 'EventTarget', 14 + 'File', 15 + 'FileList', 16 + 'FileReader', 17 + 'FormData', 18 + 'Headers', 19 + 'Request', 20 + 'Response', 21 + 'TextDecoder', 22 + 'TextEncoder', 23 + 'URL', 24 + 'URLSearchParams', 25 + ]; 2 26 3 27 const javaScriptGlobals = [ 4 28 'console', 5 29 'Array', 30 + 'ArrayBuffer', 31 + 'BigInt', 32 + 'Boolean', 33 + 'DataView', 6 34 'Date', 7 35 'Error', 8 36 'Function', 9 37 'JSON', 10 38 'Map', 11 39 'Math', 40 + 'Number', 12 41 'Object', 13 42 'Promise', 43 + 'Proxy', 44 + 'Reflect', 14 45 'RegExp', 15 46 'Set', 47 + 'String', 48 + 'Symbol', 16 49 'WeakMap', 17 50 'WeakSet', 18 51 ]; ··· 70 103 'yield', 71 104 ]; 72 105 73 - const nodeGlobals = ['global', 'process', 'Buffer']; 106 + const nodeGlobals = [ 107 + '__dirname', 108 + '__filename', 109 + 'exports', 110 + 'global', 111 + 'module', 112 + 'process', 113 + 'require', 114 + 'Buffer', 115 + ]; 74 116 75 117 const typeScriptKeywords = [ 76 118 'any',