(str, renameMap = argumentKeyRenameMap)
| 2147 | } |
| 2148 | |
| 2149 | function formatLoonJsonArgument(str, renameMap = argumentKeyRenameMap) { |
| 2150 | const objectBody = unwrapJsonArgument(str, 'loon-plugin') |
| 2151 | .replace(/["']([^"']+)["']\s*:/g, '$1:') |
| 2152 | .replace(/:\s*["']?\{\{\{([^{}]+)\}\}\}["']?/g, ':$1') |
| 2153 | .replace(/:\s*["']?\{\{([^{}]+)\}\}["']?/g, ':$1') |
| 2154 | .replace(/:\s*["']?\{([^{}]+)\}["']?/g, ':$1') |
| 2155 | .replace(/^\s*\{|\}\s*$/g, '') |
| 2156 | return splitTopLevel(objectBody, ',') |
| 2157 | .filter(Boolean) |
| 2158 | .map(item => { |
| 2159 | const [key, value] = splitFirstTopLevel(item, ':') |
| 2160 | const scriptKey = stripWrapQuote(key).replace(/^\\+|\\+$/g, '') |
| 2161 | const templateKey = stripWrapQuote(value).replace(/^\{+|\}+$/g, '').replace(/^\\+|\\+$/g, '') |
| 2162 | if (templateKey && scriptKey) renameMap.set(templateKey, scriptKey) |
| 2163 | return `{${scriptKey}}` |
| 2164 | }) |
| 2165 | .join(',') |
| 2166 | } |
| 2167 | |
| 2168 | function collectArgumentKeyRenameMap(box) { |
| 2169 | for (let i = 0; i < box.length; i++) { |
no test coverage detected