Files
2026-03-03 23:49:13 +01:00

1 line
16 KiB
Plaintext

{"version":3,"file":"dedent.mjs","sources":["../src/dedent.ts"],"sourcesContent":["type Tag<A extends unknown[], R, T> = (\n this: T,\n strings: TemplateStringsArray,\n ...substitutions: A\n) => R;\n\nconst cache = new WeakMap<TemplateStringsArray, TemplateStringsArray>();\nconst newline = /(\\n|\\r\\n?|\\u2028|\\u2029)/g;\nconst leadingWhitespace = /^\\s*/;\nconst nonWhitespace = /\\S/;\nconst slice = Array.prototype.slice;\n\nconst zero = '0'.charCodeAt(0);\nconst nine = '9'.charCodeAt(0);\nconst lowerA = 'a'.charCodeAt(0);\nconst lowerF = 'f'.charCodeAt(0);\nconst upperA = 'A'.charCodeAt(0);\nconst upperF = 'F'.charCodeAt(0);\n\nfunction dedent(str: string): string;\nfunction dedent(str: TemplateStringsArray, ...substitutions: unknown[]): string;\nfunction dedent<A extends unknown[], R, T>(tag: Tag<A, R, T>): Tag<A, R, T>;\nfunction dedent<A extends unknown[], R, T>(\n arg: string | TemplateStringsArray | Tag<A, R, T>,\n): string | Tag<A, R, T> {\n if (typeof arg === 'string') {\n return process([arg])[0];\n }\n\n if (typeof arg === 'function') {\n return function () {\n const args = slice.call(arguments);\n args[0] = processTemplateStringsArray(args[0]);\n return (arg as any).apply(this, args);\n } as Tag<A, R, T>;\n }\n\n const strings = processTemplateStringsArray(arg);\n // TODO: This is just `String.cooked`: https://tc39.es/proposal-string-cooked/\n let s = getCooked(strings, 0);\n for (let i = 1; i < strings.length; i++) {\n s += arguments[i] + getCooked(strings, i);\n }\n return s;\n}\n\nfunction getCooked(strings: readonly (string | undefined)[], index: number): string {\n const str = strings[index];\n if (str === undefined) throw new TypeError(`invalid cooked string at index ${index}`);\n return str;\n}\n\nfunction processTemplateStringsArray(strings: TemplateStringsArray): TemplateStringsArray {\n const cached = cache.get(strings);\n if (cached) return cached;\n\n const raw = process(strings.raw);\n const cooked = raw.map(cook) as unknown as TemplateStringsArray;\n\n Object.defineProperty(cooked, 'raw', {\n value: Object.freeze(raw),\n });\n Object.freeze(cooked);\n cache.set(strings, cooked);\n\n return cooked;\n}\n\nfunction process(strings: readonly string[]): readonly string[] {\n // splitQuasis is an array of arrays. The inner array is contains text content lines on the\n // even indices, and the newline char that ends the text content line on the odd indices.\n // In the first array, the inner array's 0 index is the opening line of the template literal.\n // In all other arrays, the inner array's 0 index is the continuation of the line directly after a\n // template expression.\n //\n // Eg, in the following case:\n //\n // ```\n // String.dedent`\n // first\n // ${expression} second\n // third\n // `\n // ```\n //\n // We expect the following splitQuasis:\n //\n // ```\n // [\n // [\"\", \"\\n\", \" first\", \"\\n\", \" \"],\n // [\" second\", \"\\n\", \" third\", \"\\n\", \"\"],\n // ]\n // ```\n const splitQuasis = strings.map((quasi) => quasi.split(newline));\n\n let common;\n for (let i = 0; i < splitQuasis.length; i++) {\n const lines = splitQuasis[i];\n\n // The first split is the static text starting at the opening line until the first template\n // expression (or the end of the template if there are no expressions).\n const firstSplit = i === 0;\n\n // The last split is all the static text after the final template expression until the closing\n // line. If there are no template expressions, then the first split is also the last split.\n const lastSplit = i + 1 === splitQuasis.length;\n\n // The opening line must be empty (it very likely is) and it must not contain a template\n // expression. The opening line's trailing newline char is removed.\n if (firstSplit) {\n // Length > 1 ensures there is a newline, and there is not a template expression.\n if (lines.length === 1 || lines[0].length > 0) {\n throw new Error('invalid content on opening line');\n }\n // Clear the captured newline char.\n lines[1] = '';\n }\n\n // The closing line may only contain whitespace and must not contain a template expression. The\n // closing line and its preceding newline are removed.\n if (lastSplit) {\n // Length > 1 ensures there is a newline, and there is not a template expression.\n if (lines.length === 1 || nonWhitespace.test(lines[lines.length - 1])) {\n throw new Error('invalid content on closing line');\n }\n // Clear the captured newline char, and the whitespace on the closing line.\n lines[lines.length - 2] = '';\n lines[lines.length - 1] = '';\n }\n\n // In the first spit, the index 0 is the opening line (which must be empty by now), and in all\n // other splits, its the content trailing the template expression (and so can't be part of\n // leading whitespace).\n // Every odd index is the captured newline char, so we'll skip and only process evens.\n for (let j = 2; j < lines.length; j += 2) {\n const text = lines[j];\n\n // If we are on the last line of this split, and we are not processing the last split (which\n // is after all template expressions), then this line contains a template expression.\n const lineContainsTemplateExpression = j + 1 === lines.length && !lastSplit;\n\n // leadingWhitespace is guaranteed to match something, but it could be 0 chars.\n const leading = leadingWhitespace.exec(text)![0];\n\n // Empty lines do not affect the common indentation, and whitespace only lines are emptied\n // (and also don't affect the comon indentation).\n if (!lineContainsTemplateExpression && leading.length === text.length) {\n lines[j] = '';\n continue;\n }\n\n common = commonStart(leading, common);\n }\n }\n\n const min = common ? common.length : 0;\n return splitQuasis.map((lines) => {\n let quasi = lines[0];\n for (let i = 1; i < lines.length; i += 2) {\n const newline = lines[i];\n const text = lines[i + 1];\n quasi += newline + text.slice(min);\n }\n return quasi;\n });\n}\n\nfunction commonStart(a: string, b: string | undefined): string {\n if (b === undefined || a === b) return a;\n let i = 0;\n for (const len = Math.min(a.length, b.length); i < len; i++) {\n if (a[i] !== b[i]) break;\n }\n return a.slice(0, i);\n}\n\nfunction cook(raw: string): string | undefined {\n let out = '';\n let start = 0;\n\n // We need to find every backslash escape sequence, and cook the escape into a real char.\n let i = 0;\n while ((i = raw.indexOf('\\\\', i)) > -1) {\n out += raw.slice(start, i);\n\n // If the backslash is the last char of the string, then it was an invalid sequence.\n // This can't actually happen in a tagged template literal, but could happen if you manually\n // invoked the tag with an array.\n if (++i === raw.length) return undefined;\n\n const next = raw[i++];\n switch (next) {\n // Escaped control codes need to be individually processed.\n case 'b':\n out += '\\b';\n break;\n case 't':\n out += '\\t';\n break;\n case 'n':\n out += '\\n';\n break;\n case 'v':\n out += '\\v';\n break;\n case 'f':\n out += '\\f';\n break;\n case 'r':\n out += '\\r';\n break;\n\n // Escaped line terminators just skip the char.\n case '\\r':\n // Treat `\\r\\n` as a single terminator.\n if (i < raw.length && raw[i] === '\\n') ++i;\n // fall through\n case '\\n':\n case '\\u2028':\n case '\\u2029':\n break;\n\n // `\\0` is a null control char, but `\\0` followed by another digit is an illegal octal escape.\n case '0':\n if (isDigit(raw, i)) return undefined;\n out += '\\0';\n break;\n\n // Hex escapes must contain 2 hex chars.\n case 'x': {\n const n = parseHex(raw, i, i + 2);\n if (n === -1) return undefined;\n i += 2;\n out += String.fromCharCode(n);\n break;\n }\n\n // Unicode escapes contain either 4 chars, or an unlimited number between `{` and `}`.\n // The hex value must not overflow 0x10ffff.\n case 'u': {\n let n;\n if (i < raw.length && raw[i] === '{') {\n const end = raw.indexOf('}', ++i);\n if (end === -1) return undefined;\n\n n = parseHex(raw, i, end);\n i = end + 1;\n } else {\n n = parseHex(raw, i, i + 4);\n i += 4;\n }\n if (n === -1 || n > 0x10ffff) return undefined;\n\n out += String.fromCodePoint(n);\n break;\n }\n\n default:\n if (isDigit(next, 0)) return undefined;\n out += next;\n }\n\n start = i;\n }\n\n return out + raw.slice(start);\n}\n\nfunction isDigit(str: string, index: number): boolean {\n const c = str.charCodeAt(index);\n return c >= zero && c <= nine;\n}\n\nfunction parseHex(str: string, index: number, end: number): number {\n if (end >= str.length) return -1;\n\n let n = 0;\n for (; index < end; index++) {\n const c = hexToInt(str.charCodeAt(index));\n if (c === -1) return -1;\n n = n * 16 + c;\n }\n return n;\n}\n\nfunction hexToInt(c: number): number {\n if (c >= zero && c <= nine) return c - zero;\n if (c >= lowerA && c <= lowerF) return c - lowerA + 10;\n if (c >= upperA && c <= upperF) return c - upperA + 10;\n return -1;\n}\n\nexport default dedent;\n"],"names":[],"mappings":"AAMA,MAAM,KAAK,GAAG,IAAI,OAAO,EAA8C,CAAC;AACxE,MAAM,OAAO,GAAG,2BAA2B,CAAC;AAC5C,MAAM,iBAAiB,GAAG,MAAM,CAAC;AACjC,MAAM,aAAa,GAAG,IAAI,CAAC;AAC3B,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC;AAEpC,MAAM,IAAI,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAC/B,MAAM,IAAI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