Files
react-native-devtools-frontend/node_modules/rollup-plugin-sourcemaps2/dist/decode-uri-component.cjs.map
T
Simon Zünd abf0cd1847 [deps] Update rollup to 4.24.3 (and update plugins)
Since we have the major version jump, we needed to update quite
a few things to make this work:

  1. rollup4 ships with native binaries. We can't check them into
     our node_modules for all platforms. Luckily they also ship a
     a wasm version. This requires us to adjust the 'binary' path
     to `node_modules/@rollup/wasm-node/dist/bin/rollup` instead.

  2. rollup4 is more strict when it comes to ES modules vs
     CommonJS. We adjust this by renaming the rollup config files.

  3. Some plugins got deprecated so we had to replace them with
     the newer versions (source maps and terser).

Bug: None
Change-Id: If13d590c8185db6ad85b3992d0a869111909dc8c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5999255
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
2024-11-07 05:25:54 +00:00

1 line
5.8 KiB
Plaintext

{"version":3,"file":"decode-uri-component.cjs","sources":["../src/decode-uri-component.ts"],"sourcesContent":["const token = '%[a-f0-9]{2}';\nconst singleMatcher = new RegExp(`(${token})|([^%]+?)`, 'gi');\nconst multiMatcher = new RegExp(`(${token})+`, 'gi');\n\nfunction decodeComponents(components: RegExpMatchArray | [], split?: number): string[] {\n let splitAt = split;\n\n try {\n // Try to decode the entire string first\n return [decodeURIComponent(components.join(''))];\n } catch {\n // Do nothing\n }\n\n if (components.length === 1) {\n return components;\n }\n\n splitAt = splitAt ?? 1;\n\n // Split the array in 2 parts\n const left = components.slice(0, splitAt) as RegExpMatchArray;\n const right = components.slice(splitAt) as RegExpMatchArray;\n\n return Array.prototype.concat.call(\n [],\n decodeComponents(left),\n decodeComponents(right),\n ) as string[];\n}\n\nfunction decode(input: string): string {\n let localInput = input;\n\n try {\n return decodeURIComponent(localInput);\n } catch {\n let tokens = RegExp(singleMatcher).exec(localInput) || [];\n\n for (let i = 1; i < tokens.length; i++) {\n localInput = decodeComponents(tokens, i).join('');\n\n tokens = RegExp(singleMatcher).exec(localInput) || [];\n }\n\n return localInput;\n }\n}\n\nfunction customDecodeURIComponent(input: string): string {\n let localInput = input;\n\n // Keep track of all the replacements and prefill the map with the `BOM`\n const replaceMap: Record<string, string> = {\n '%FE%FF': '\\uFFFD\\uFFFD',\n '%FF%FE': '\\uFFFD\\uFFFD',\n };\n\n let match = multiMatcher.exec(localInput);\n while (match) {\n try {\n // Decode as big chunks as possible\n replaceMap[match[0]] = decodeURIComponent(match[0]);\n } catch {\n const result = decode(match[0]);\n\n if (result !== match[0]) {\n replaceMap[match[0]] = result;\n }\n }\n\n match = multiMatcher.exec(localInput);\n }\n\n // Add `%C2` at the end of the map to make sure it does not replace the combinator before everything else\n replaceMap['%C2'] = '\\uFFFD';\n\n const entries = Object.keys(replaceMap);\n\n for (const key of entries) {\n // Replace all decoded components\n localInput = localInput.replace(new RegExp(key, 'g'), replaceMap[key]);\n }\n\n return localInput;\n}\n\nexport default function decodeUriComponent(encodedURI: string): string {\n if (typeof encodedURI !== 'string') {\n throw new TypeError(\n `Expected \\`encodedURI\\` to be of type \\`string\\`, got \\`${typeof encodedURI}\\``,\n );\n }\n\n try {\n // Try the built in decoder first\n return decodeURIComponent(encodedURI);\n } catch {\n // Fallback to a more advanced decoder\n return customDecodeURIComponent(encodedURI);\n }\n}\n"],"names":["token","singleMatcher","RegExp","multiMatcher","decodeComponents","components","split","splitAt","decodeURIComponent","join","length","left","slice","right","Array","prototype","concat","call","decode","input","localInput","tokens","exec","i","customDecodeURIComponent","replaceMap","match","result","entries","Object","keys","key","replace","decodeUriComponent","encodedURI","TypeError"],"mappings":";;AAAA,MAAMA,KAAQ,GAAA,cAAA,CAAA;AACd,MAAMC,aAAAA,GAAgB,IAAIC,MAAO,CAAA,CAAC,CAAC,EAAEF,KAAAA,CAAM,UAAU,CAAC,EAAE,IAAA,CAAA,CAAA;AACxD,MAAMG,YAAAA,GAAe,IAAID,MAAO,CAAA,CAAC,CAAC,EAAEF,KAAAA,CAAM,EAAE,CA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