xshell 0.0.70 → 0.0.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"prototype.browser.js","sourceRoot":"","sources":["prototype.browser.ts"],"names":[],"mappings":"AAAA,+BAA+B;AA+K/B,OAAO,SAAS,MAAM,WAAW,CAAA;AACjC,OAAO,UAAU,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAA;AAEtC,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,EAAE,CAAA;AAGvC,MAAM,UAAU,8BAA8B,CAAE,OAAqC;IACjF,OAAO,MAAM,CAAC,WAAW,CACrB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;SAClB,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE;YAC5B,YAAY,EAAE,IAAI;YAClB,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE,KAAK;YACjB,KAAK;SACc,CAAC,CAAC,CAC5B,CAAC,CAAA;AACV,CAAC;AAGD,MAAM,UAAU,8BAA8B,CAAE,OAAqC;IACjF,OAAO,MAAM,CAAC,WAAW,CACrB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;SAClB,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE;YAC1B,YAAY,EAAE,IAAI;YAClB,UAAU,EAAE,KAAK;YACjB,GAAG;SACgB,CAAC,CAAC,CAC5B,CAAC,CAAA;AACV,CAAC;AAGD,MAAM,CAAC,MAAM,GAAG,GAAG,gCAAgC,CAAA;AAEnD,MAAM,CAAC,MAAM,MAAM,GAAG;IAClB,MAAM,EAAI,GAAG;IACb,MAAM,EAAI,GAAG;IACb,QAAQ,EAAE,GAAG;CAChB,CAAA;AAED,MAAM,CAAC,M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AAK,MAAM,CAAC;YAEpE,wEAAwE;YACxE,CAAC,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAE5C,wCAAwC;YACxC,CAAC,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAE5C,yBAAyB;YACzB,CAAC,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAE5C,mBAAmB;YACnB,CAAC,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAE5C,+BAA+B;YAC/B,CAAC,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAE5C,iBAAiB;YACjB,CAAC,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAE5C,iDAAiD;YACjD,CAAC,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAE5C,gCAAgC;YAChC,CAAC,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAC5C,CAAC,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAE5C,kBAAkB;YAClB,CAAC,OAAO,IAAI,SAAS,IAAI,SAAS,IAAI,OAAO,CAAC;YAE9C,kCAAkC;YAClC,CAAC,OAAO,IAAI,SAAS,IAAI,SAAS,IAAI,OAAO,CAAC;YAE9C,mEAAmE;YACnE,CAAC,OAAO,IAAI,SAAS,IAAI,SAAS,IAAI,OAAO,CAAC,CACjD,CACJ,CAAA;AACL,CAAC","sourcesContent":["/** 在浏览器端修改 prototype,需要更加小心 */\n\ndeclare global {\n interface String {\n readonly width: number\n \n // --- 工具方法\n /** 截取字符串不超过 width 显示宽度的部分,并保留颜色 \n 找到并记录能容纳 字符串 + … 的最后一个字符的位置 i_fitted \n 若完整的字符串长度超过 width,返回 slice(0, i_fitted + 1) + … \n 否则 返回 this \n */\n truncate (this: string, width: number): string\n \n /** pad string to `<width>` \n - character?: `' '`\n - position?: `'right'`\n */\n pad (this: string, width: number, { character, position }?: { character?: string, position?: 'left' | 'right'}): string\n \n limit (this: string, width: number, { character, position }?: { character?: string, position?: 'left' | 'right'}): string\n \n to_regexp (this: string, preservations?: string, flags?: string): RegExp\n \n to_bool (this: string): boolean\n \n /** 字符串模式替换 \n - pattern: 匹配部分的格式\n - pattern_: 替换后的格式\n - preservations?: `''` 保留的正则表达式字符\n - flags?: `''` 正则匹配选项\n - transformer?: `(name, matched) => matched || ''` placeholder transformer\n - pattern_placeholder?: `/\\{.*?\\}/g`\n \n ```ts\n 'g:/acgn/海贼王/[Skytree][海贼王][One_Piece][893][GB_BIG5_JP][X264_AAC][1080P][CRRIP][天空树双语字幕组].mkv'.refmt( \n '{dirp}/[Skytree][海贼王][{ en_name: \\\\w+ }][{ episode: \\\\d+ }][GB_BIG5_JP][{encoding}_AAC][1080P][CRRIP][天空树双语字幕组].{format}', \n 'g:/acgn/海贼王/{episode} {encoding}.{format}', \n '\\\\+', \n 'i', \n (name, value) => name === 'episode' ? String(+value + 1) : value.toLowerCase() \n )\n ```\n */\n refmt ( this: string,\n pattern: string,\n \n pattern_: string,\n \n preservations?: string,\n \n flags?: string,\n \n transformer?: (name: string, value: string, placeholders: { [name: string]: string }) => string,\n \n pattern_placeholder?: RegExp\n \n ): string\n \n \n /** 字符串模式搜索\n ```ts\n 'git+https://github.com/tamino-martinius/node-ts-dedent-123.git'.find(\n '^{protocol:[\\\\w+]+}://{hostname:[\\\\w\\\\.]+}/{username}/{project}-{index:\\\\d+}.{suffix}', '^', 'i'\n )\n {\n protocol: 'git+https',\n hostname: 'github.com',\n ...\n }\n ```\n \n - preservations?: `''` 保留的正则表达式字符\n - flags?: `''` 正则匹配选项\n - pattern_placeholder?: `/\\{.*?\\}/g`\n */\n find (this: string,\n \n pattern: string, \n \n preservations?: string, \n \n flags?: string, \n \n pattern_placeholder?: RegExp\n \n ): Record<string, string>\n \n \n /** - type?: `'single'` */\n quote (this: string, type?: keyof typeof quotes | 'psh'): string\n \n /** - shape?: `'parenthesis'` */\n bracket (this: string, shape?: keyof typeof brackets): string\n \n surround (this: string, left: string, right?: string): string\n \n surround_tag (this: string, tag_name: string): string\n \n to_lf (this: string): string\n \n to_crlf (this: string): string\n \n /** 'xxx'.replace(/pattern/g, '') \n 如果 pattern 是 string 则在创建 RegExp 时自动加上 flags (默认 'g'), 否则忽略 flags\n */\n rm (this: string, pattern: string | RegExp, flags?: string): string\n \n \n // --- 文本处理\n /** 将 string 划分为行,并去掉最后一个 \\n 之后的 '' */\n split_lines (this: string): string[]\n \n trim_doc_comment (this: string): string\n \n split_indent (this: string): { indent: number, text: string }\n \n \n space (this: string): string\n \n to_slash (this: string): string\n \n to_backslash (this: string): string\n }\n \n \n interface Date {\n /** - ms?: `false` 显示到 ms */\n to_str (this: Date, ms?: boolean): string\n \n to_date_str (this: Date): string\n \n /** - ms?: `false` 显示到 ms */\n to_time_str (this: Date, ms?: boolean): string\n }\n \n \n interface Number {\n /** 12.4 KB (1 KB = 1024 B) */\n to_fsize_str (this: number, units?: 'iec' | 'metric'): string\n \n \n to_bin_str (this: number): string\n \n to_hex_str (this: number, length?: number): string\n \n to_oct_str (this: number): string\n }\n \n \n interface Array<T> {\n indent (this: string[], width: number, c?: string): string[]\n \n // --- 文本处理\n /**\n - trim_line?: `true`\n - rm_empty_lines?: `true`\n - rm_last_empty_lines?: `false`\n */\n trim_lines (this: string[], { trim_line, rm_empty_lines, rm_last_empty_lines }?: { trim_line?: boolean, rm_empty_lines?: boolean, rm_last_empty_lines?: boolean }): string[]\n \n join_lines (): string\n }\n \n \n interface BigInt {\n toJSON (this: bigint): string\n }\n \n \n interface Error {\n toJSON (this: Error): string\n }\n}\n\nimport byte_size from 'byte-size'\nimport EmojiRegex from 'emoji-regex'\n\nimport { t } from './i18n/instance.js'\n\nexport const emoji_regex = EmojiRegex()\n\n\nexport function to_method_property_descriptors (methods: { [name: string]: Function }): PropertyDescriptorMap {\n return Object.fromEntries(\n Object.entries(methods)\n .map(([name, value]) => ([name, {\n configurable: true,\n writable: true,\n enumerable: false,\n value,\n } as PropertyDescriptor])\n ))\n}\n\n\nexport function to_getter_property_descriptors (getters: { [name: string]: Function }): PropertyDescriptorMap {\n return Object.fromEntries(\n Object.entries(getters)\n .map(([name, get]) => ([name, {\n configurable: true,\n enumerable: false,\n get,\n } as PropertyDescriptor])\n ))\n}\n\n\nexport const cjk = '([\\u2e80-\\u9fff\\uf900-\\ufaff])'\n\nexport const quotes = {\n single: \"'\",\n double: '\"',\n backtick: '`',\n}\n\nexport const brackets = {\n round: ['(', ')'],\n square: ['[', ']'],\n curly: ['{', '}'],\n pointy: ['<', '>'],\n corner: ['「', '」'],\n fat: ['【', '】'],\n tortoise_shell: ['〔', '〕'],\n} as const\n\n\n\n// ------------------------------------ String.prototype\nObject.defineProperties(String.prototype, {\n ... to_getter_property_descriptors({\n width (this: string) {\n const s = this.replace(emoji_regex, ' ')\n let width = 0\n for (let i = 0; i < s.length; i++) {\n const code = s.codePointAt(i)\n \n if (\n (code <= 0x1f || (code >= 0x7f && code <= 0x9f)) || // ignore control characters\n code >= 0x300 && code <= 0x36f // ignore combining characters\n ) continue\n \n // surrogates\n if (code > 0xffff)\n i++\n \n width += is_codepoint_fullwidth(code) ? 2 : 1\n }\n return width\n }\n }),\n \n \n \n // ------------ 文本处理工具方法\n ... to_method_property_descriptors({\n /** 截取字符串不超过 width 显示宽度的部分,并保留颜色 \n 找到并记录能容纳 字符串 + … 的最后一个字符的位置 i_fitted \n - 若完整的字符串长度超过 width,返回 slice(0, i_fitted + 1) + … \n - 否则 返回 this \n */\n truncate (this: string, width: number) {\n const color_bak = this.startsWith('\\u001b') ? this.slice(0, 5) : ''\n if (width <= 2) return this.slice(0, width)\n let i_fitted = 0\n let fitted_width = 0\n let cur_width = 0\n for (let i = 0; i < this.length; i++) {\n const code = this.codePointAt(i)\n \n if (\n (code <= 0x1F || (code >= 0x7F && code <= 0x9F)) || // Ignore control characters\n code >= 0x300 && code <= 0x36F // Ignore combining characters\n ) continue\n \n // surrogates (codepoint 需要用两个 utf-16 编码单位表示,因此这里跳过第二个编码单位,防止重复计算显示宽度)\n if (code > 0xFFFF)\n i++\n \n const w = is_codepoint_fullwidth(code) ? 2 : 1\n \n if (cur_width + w + 2 <= width) {\n i_fitted = i\n fitted_width += w\n }\n \n cur_width += w\n \n if (cur_width > width) {\n const i_fitted_next = i_fitted + 1\n const t = this.slice(0, i_fitted_next) + ' '.repeat(width - 2 - fitted_width) + '…' \n return color_bak ? color_bak + t + '\\u001b[39m' : t\n }\n }\n return this\n },\n \n \n pad (this: string, width: number, { character = ' ', position = 'right' }: { character?: string, position?: 'left' | 'right'} = { }) {\n const _width = this.width\n if (_width >= width) return this\n if (position === 'right') return this + character.repeat( (width - _width) / character.width )\n return character.repeat(width - _width) + this\n },\n \n \n limit (this: string, width: number, { character = ' ', position = 'right' }: { character?: string, position?: 'left' | 'right'} = { }) {\n return this.pad(width, { character, position }).truncate(width)\n },\n \n \n to_regexp (this: string, preservations: string, flags = ''): RegExp {\n const preserved_chars = new Set(preservations)\n const replace_chars: string = Array.prototype.filter.call('|\\\\{}()[]^$+*?.-', (c: string) => !preserved_chars.has(c))\n .map((c: string) =>\n c === ']' ? '\\\\]' : c\n ).join('')\n \n return new RegExp(\n this.replace(\n new RegExp(`[${replace_chars}]`, 'g'),\n '\\\\$&'\n ), \n flags\n )\n },\n \n \n to_bool (this: string) {\n return this.length && this !== '0' && this.toLowerCase() !== 'false'\n },\n \n refmt (this: string, \n pattern : string,\n pattern_: string,\n preservations: string = '',\n flags = '',\n transformer: (name: string, value: string, placeholders: { [name: string]: string }) => string = (name, value) => value || '',\n pattern_placeholder = /\\{.*?\\}/g,\n ): string {\n // --- 转换 pattern 为 pattern_regx\n let last_end = 0\n \n // placeholder matched group indexes\n let $placeholders: Record<string, number> = { }\n \n let regx_parts = [ ]\n \n function add_part (left: number, right?: number) {\n const part = pattern.slice(left, right)\n if (part)\n regx_parts.push(\n part.to_regexp(preservations).source.bracket()\n )\n }\n \n pattern.replace(pattern_placeholder, ($0, offset) => {\n add_part(last_end, offset)\n last_end = offset + $0.length\n \n const placeholder = $0.slice(1, -1)\n let [placeholder_name, placeholder_pattern] = placeholder.split(':').map(s => s.trim())\n let optional = false\n if (placeholder_name.endsWith('?')) {\n placeholder_name = placeholder_name.slice(0, -1)\n optional = true\n }\n $placeholders[placeholder_name] = regx_parts.push(\n placeholder_pattern ? \n `${placeholder_pattern.bracket()}${optional ? '?' : ''}`\n :\n '(.*?)'\n )\n return ''\n })\n \n add_part(last_end)\n \n // 最后一个 (.*?) 改为贪心匹配,满足 .{suffix} 的需要\n regx_parts = regx_parts.filter(part => part)\n if (regx_parts.last === '(.*?)')\n regx_parts[regx_parts.length - 1] = '(.*)'\n \n const pattern_regx = new RegExp(regx_parts.join(''), flags)\n \n \n // --- 根据 pattern_regx 去匹配原有字符串,获取匹配结果,生成 placeholders 词典\n const matches = pattern_regx.exec(this)\n \n if (!matches) return this\n \n const placeholders = Object.fromEntries(\n Object.entries($placeholders)\n .map(([name, $i]) => [\n [name, matches[$i]],\n [`${name}.before`, matches[$i - 1] || ''],\n [`${name}.after`, matches[$i + 1] || ''],\n ])\n .flat()\n )\n \n \n // --- 转换 pattern_ 为 replacement_str,如果有 transformer 则在遇到 placeholder 时应用\n last_end = 0\n let replacement_parts = [ ]\n \n pattern_.replace(pattern_placeholder, ($0, offset) => {\n replacement_parts.push(\n pattern_.slice(last_end, offset)\n )\n last_end = offset + $0.length\n \n const placeholder_name = $0.slice(1, -1)\n \n replacement_parts.push(\n transformer(placeholder_name, placeholders[placeholder_name], placeholders)\n )\n \n return ''\n })\n replacement_parts.push(\n pattern_.slice(last_end)\n )\n \n return this.replace(pattern_regx, replacement_parts.join(''))\n },\n \n \n find (this: string,\n pattern: string, \n preservations: string = '', \n flags = '', \n pattern_placeholder = /\\{.*?\\}/g\n ): Record<string, string> {\n // --- 转换 pattern 为 pattern_regx\n let last_end = 0\n \n // placeholder matched group index\n let $placeholders: Record<string, number> = { }\n \n let regx_parts = [ ]\n \n function add_part (left: number, right?: number) {\n const part = pattern.slice(left, right)\n if (part)\n regx_parts.push(\n part.to_regexp(preservations).source.bracket()\n )\n }\n \n pattern.replace(pattern_placeholder, ($0, offset) => {\n add_part(last_end, offset)\n last_end = offset + $0.length\n \n const placeholder = $0.slice(1, -1)\n let [placeholder_name, placeholder_pattern] = placeholder.split(':').map(s => s.trim())\n let optional = false\n if (placeholder_name.endsWith('?')) {\n placeholder_name = placeholder_name.slice(0, -1)\n optional = true\n }\n \n $placeholders[placeholder_name] = regx_parts.push(\n placeholder_pattern ? \n `${placeholder_pattern.bracket()}${optional ? '?' : ''}`\n :\n '(.*?)'\n )\n return ''\n })\n \n add_part(last_end)\n \n // 最后一个 (.*?) 改为贪心匹配,满足 .{suffix} 的需要\n regx_parts = regx_parts.filter(part => part)\n if (regx_parts[regx_parts.length - 1] === '(.*?)')\n regx_parts[regx_parts.length - 1] = '(.*)'\n \n const pattern_regx = new RegExp(regx_parts.join(''), flags)\n \n \n // --- 根据 pattern_regx 去匹配原有字符串,获取匹配结果,生成 placeholders 词典\n const matches = pattern_regx.exec(this)\n \n if (!matches) return { }\n \n return Object.fromEntries(\n Object.entries($placeholders)\n .map(([name, $i]) => \n [name, matches[$i] || '']\n )\n )\n },\n \n quote (this: string, type: keyof typeof quotes | 'psh' = 'single') {\n if (type === 'psh')\n return `& ${this.quote()}`\n return this.surround(quotes[type])\n },\n \n \n bracket (this: string, shape: keyof typeof brackets = 'round') {\n return this.surround(...brackets[shape] as [string, string])\n },\n \n \n surround (this: string, left: string, right?: string) {\n return left + this + (right || left)\n },\n \n surround_tag (this: string, tag_name: string): string {\n return '<' + tag_name + '>' + this + '</' + tag_name + '>'\n },\n \n \n to_lf (this: string) {\n return this.replace(/\\r\\n/g, '\\n')\n },\n \n \n to_crlf (this: string) {\n return this.replace(/\\n/g, '\\r\\n')\n },\n \n \n rm (this: string, pattern: string | RegExp, flags: string = 'g') {\n if (typeof pattern === 'string')\n pattern = new RegExp(pattern, flags)\n \n return this.replace(pattern, '')\n },\n \n \n split_lines (this: string, delimiter: string | RegExp = /\\r?\\n/) {\n let lines = this.split(delimiter)\n if (lines.last === '')\n lines.pop()\n return lines\n },\n \n \n split_indent (this: string): { indent: number, text: string } {\n let i = 0\n let indent = 0\n for (; i < this.length; i++)\n if (this[i] === ' ')\n indent += 1\n else if (this[i] === '\\t')\n indent += 4\n else\n break\n \n return {\n indent,\n text: this.slice(i)\n }\n },\n \n \n space (this: string) {\n if (!this) return this\n let text_: string\n text_ = this\n .replace(new RegExp(cjk + `(['\"])`, 'g'), '$1 $2')\n .replace(new RegExp(`(['\"])` + cjk, 'g'), '$1 $2')\n \n .replace(/([\"']+)\\s*(.+?)\\s*([\"']+)/g, '$1$2$3')\n \n .replace(new RegExp(cjk + '([\\\\+\\\\-\\\\*\\\\/=&\\\\\\\\\\\\|<>])([A-Za-z0-9])', 'g'), '$1 $2 $3')\n .replace(new RegExp('([A-Za-z0-9])([\\\\+\\\\-\\\\*\\\\/=&\\\\\\\\\\\\|<>])' + cjk, 'g'), '$1 $2 $3')\n \n const textBak = text_\n \n text_ = text_.replace(new RegExp(cjk + '([\\\\(\\\\[\\\\{<\\u201c]+(.*?)[\\\\)\\\\]\\\\}>\\u201d]+)' + cjk, 'g'), '$1 $2 $4')\n \n if (text_ === textBak)\n text_ = text_\n .replace(new RegExp(cjk + '([\\\\(\\\\[\\\\{<\\u201c>])', 'g'), '$1 $2')\n .replace(new RegExp('([\\\\)\\\\]\\\\}>\\u201d<])' + cjk, 'g'), '$1 $2')\n \n return text_\n .replace(/([\\(\\[\\{<\\u201c]+)(\\s*)(.+?)(\\s*)([\\)\\]\\}>\\u201d]+)/g, '$1$3$5')\n .replace(new RegExp(cjk + '([~!;:,\\\\.\\\\?\\u2026])([A-Za-z0-9])', 'g'), '$1$2 $3')\n .replace(new RegExp(cjk + '([A-Za-z0-9`\\\\$%\\\\^&\\\\*\\\\-=\\\\+\\\\\\\\\\\\|\\\\/@\\u00a1-\\u00ff\\u2022\\u2027\\u2150-\\u218f])', 'g'), '$1 $2')\n .replace(new RegExp('([A-Za-z0-9`\\\\$%\\\\^&\\\\*\\\\-=\\\\+\\\\\\\\\\\\|\\\\/@\\u00a1-\\u00ff\\u2022\\u2027\\u2150-\\u218f])' + cjk, 'g'), '$1 $2')\n },\n \n to_slash (this: string) {\n return this.replaceAll('\\\\', '/')\n },\n \n to_backslash (this: string) {\n return this.replaceAll('/', '\\\\')\n },\n })\n})\n\n\n// ------------------------------------ Date.prototype\nObject.defineProperties(Date.prototype, to_method_property_descriptors({\n to_str (this: Date, ms?: boolean) {\n const [ampm, hour] = (() => {\n let hour = this.getHours()\n if (hour <= 6)\n return [t('凌晨'), hour]\n \n if (hour <= 8)\n return [t('清晨'), hour]\n \n if (hour <= 9)\n return [t('早上'), hour]\n \n if (hour <= 10)\n return [t('上午'), hour]\n \n if (hour <= 12)\n return [t('中午'), hour]\n \n hour -= 12\n \n if (hour <= 5)\n return [t('下午'), hour]\n \n if (hour <= 10)\n return [t('晚上'), hour]\n \n return [t('深夜'), hour]\n })()\n \n const zero_padding = { character: '0', position: 'left' } as const\n \n return '' +\n // year.month.date\n this.getFullYear() + '.' + \n String(this.getMonth() + 1).pad(2, zero_padding) + '.' + \n String(this.getDate()).pad(2, zero_padding) + ' ' +\n \n // 上午\n ampm + ' ' +\n \n // 10:03:02\n String(hour).pad(2, zero_padding) + ':' +\n String(this.getMinutes()).pad(2, zero_padding) + ':' +\n String(this.getSeconds()).pad(2, zero_padding) + \n \n (ms ?\n '.' + String(this.getMilliseconds()).pad(3, zero_padding)\n :\n ''\n )\n },\n \n to_date_str (this: Date) {\n return this.to_str().split(' ')[0]\n },\n \n to_time_str (this: Date, ms?: boolean) {\n const [, ampm, time ] = this.to_str(ms).split(' ')\n return `${ampm} ${time}`\n },\n}))\n\n\n\n// ------------------------------------ Number.prototype\nObject.defineProperties(Number.prototype, to_method_property_descriptors({\n to_fsize_str (this: number, units: 'iec' | 'metric' = 'iec') {\n const { value, unit } = byte_size(this, { units })\n return `${value} ${unit.replace('i', '')}`\n },\n \n to_bin_str (this: number) {\n return `0b${this.toString(2)}`\n },\n \n to_hex_str (this: number, length?: number) {\n const s = this.toString(16)\n // 长度自动对齐到 4 的倍数\n if (!length)\n length = Math.ceil(s.length / 4) * 4\n return `0x${'0'.repeat(length - s.length)}${s}`\n },\n \n to_oct_str (this: number) {\n return `0o${this.toString(8)}`\n },\n}))\n\n\n\n// ------------------------------------ Array.prototype\nObject.defineProperties(Array.prototype, {\n // --- 文本处理工具方法\n ... to_method_property_descriptors({\n trim_lines (this: string[], { trim_line = true, rm_empty_lines = true, rm_last_empty_lines = false }: { trim_line?: boolean, rm_empty_lines?: boolean, rm_last_empty_lines?: boolean } = { }) {\n if (!this.length)\n return this\n let lines = this\n \n if (trim_line)\n lines = lines.map(line => line.trim())\n \n if (rm_empty_lines)\n return lines.filter( line => line )\n \n if (rm_last_empty_lines) {\n lines.reverse()\n const i_not_empty = lines.findIndex( line => line )\n if (i_not_empty !== -1)\n lines = lines.slice(i_not_empty)\n lines.reverse()\n return lines\n }\n \n return lines\n },\n \n \n indent (this: string[], width?: number, character: string = ' ') {\n return this.map(line => \n character.repeat(width) + line\n )\n },\n \n \n join_lines (this: string[], append = true) {\n return `${this.join('\\n')}${append ? '\\n' : ''}`\n }\n })\n})\n\n\nObject.defineProperties(BigInt.prototype, to_method_property_descriptors({\n toJSON (this: bigint) {\n return this.toString()\n }\n}))\n\nObject.defineProperties(Error.prototype, to_method_property_descriptors({\n toJSON (this: Error) {\n return Object.fromEntries(\n Object.getOwnPropertyNames(this)\n .map(name => \n [name, this[name]])\n )\n }\n}))\n\n\n\nexport function to_json (obj: any, replacer?: any) {\n return JSON.stringify(obj, replacer, 4) + '\\n'\n}\n\nexport function is_codepoint_fullwidth (codepoint: number) {\n // code points are derived from:\n // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt\n return (\n !Number.isNaN(codepoint) &&\n codepoint >= 0x1100 &&\n (\n codepoint <= 0x115f || // hangul jamo\n \n codepoint === 0x201c || codepoint === 0x201d || // \n codepoint === 0x2026 || // …\n codepoint === 0x203b || // ※\n \n // arrows\n (0x2190 <= codepoint && codepoint <= 0x21FF) ||\n \n codepoint === 0x2329 || // left-pointing angle bracket\n codepoint === 0x232a || // right-pointing angle bracket\n \n // ①\n (0x2460 <= codepoint && codepoint <= 0x24ff) ||\n \n // box drawing\n (0x2500 <= codepoint && codepoint <= 0x257f) ||\n \n // shapes, symbols, …\n (0x2580 <= codepoint && codepoint <= 0x2bef) ||\n \n // cjk radicals supplement .. enclosed cjk letters and months\n (0x2e80 <= codepoint && codepoint <= 0x3247 && codepoint !== 0x303f) ||\n \n // enclosed cjk letters and months .. cjk unified ideographs extension a\n (0x3250 <= codepoint && codepoint <= 0x4dbf) ||\n \n // cjk unified ideographs .. yi radicals\n (0x4E00 <= codepoint && codepoint <= 0xA4C6) ||\n \n // hangul jamo extended-a\n (0xa960 <= codepoint && codepoint <= 0xa97c) ||\n \n // hangul syllables\n (0xac00 <= codepoint && codepoint <= 0xd7a3) ||\n \n // cjk compatibility ideographs\n (0xf900 <= codepoint && codepoint <= 0xfaff) ||\n \n // vertical forms\n (0xfe10 <= codepoint && codepoint <= 0xfe19) ||\n \n // cjk compatibility forms .. small form variants\n (0xfe30 <= codepoint && codepoint <= 0xfe6b) ||\n \n // halfwidth and fullwidth forms\n (0xff01 <= codepoint && codepoint <= 0xff60) ||\n (0xffe0 <= codepoint && codepoint <= 0xffe6) ||\n \n // kana supplement\n (0x1b000 <= codepoint && codepoint <= 0x1b001) ||\n \n // enclosed ideographic supplement\n (0x1f200 <= codepoint && codepoint <= 0x1f251) ||\n \n // cjk unified ideographs extension b .. tertiary ideographic plane\n (0x20000 <= codepoint && codepoint <= 0x3fffd)\n )\n )\n}\n"]}
1
+ {"version":3,"file":"prototype.browser.js","sourceRoot":"","sources":["prototype.browser.ts"],"names":[],"mappings":"AAAA,+BAA+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M,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAE5C,mBAAmB;YACnB,CAAC,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAE5C,+BAA+B;YAC/B,CAAC,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAE5C,iBAAiB;YACjB,CAAC,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAE5C,iDAAiD;YACjD,CAAC,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAE5C,gCAAgC;YAChC,CAAC,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAC5C,CAAC,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAE5C,kBAAkB;YAClB,CAAC,OAAO,IAAI,SAAS,IAAI,SAAS,IAAI,OAAO,CAAC;YAE9C,kCAAkC;YAClC,CAAC,OAAO,IAAI,SAAS,IAAI,SAAS,IAAI,OAAO,CAAC;YAE9C,mEAAmE;YACnE,CAAC,OAAO,IAAI,SAAS,IAAI,SAAS,IAAI,OAAO,CAAC,CACjD,CACJ,CAAA;AACL,CAAC","sourcesContent":["/** 在浏览器端修改 prototype,需要更加小心 */\n\ndeclare global {\n interface String {\n readonly width: number\n \n // --- 工具方法\n /** 截取字符串不超过 width 显示宽度的部分,并保留颜色 \n 找到并记录能容纳 字符串 + … 的最后一个字符的位置 i_fitted \n 若完整的字符串长度超过 width,返回 slice(0, i_fitted + 1) + … \n 否则 返回 this \n */\n truncate (this: string, width: number): string\n \n /** pad string to `<width>` \n - character?: `' '`\n - position?: `'right'`\n */\n pad (this: string, width: number, { character, position }?: { character?: string, position?: 'left' | 'right'}): string\n \n limit (this: string, width: number, { character, position }?: { character?: string, position?: 'left' | 'right'}): string\n \n to_regexp (this: string, preservations?: string, flags?: string): RegExp\n \n to_bool (this: string): boolean\n \n /** 字符串模式替换 \n - pattern: 匹配部分的格式\n - pattern_: 替换后的格式\n - preservations?: `''` 保留的正则表达式字符\n - flags?: `''` 正则匹配选项\n - transformer?: `(name, matched) => matched || ''` placeholder transformer\n - pattern_placeholder?: `/\\{.*?\\}/g`\n \n ```ts\n 'g:/acgn/海贼王/[Skytree][海贼王][One_Piece][893][GB_BIG5_JP][X264_AAC][1080P][CRRIP][天空树双语字幕组].mkv'.refmt( \n '{dirp}/[Skytree][海贼王][{ en_name: \\\\w+ }][{ episode: \\\\d+ }][GB_BIG5_JP][{encoding}_AAC][1080P][CRRIP][天空树双语字幕组].{format}', \n 'g:/acgn/海贼王/{episode} {encoding}.{format}', \n '\\\\+', \n 'i', \n (name, value) => name === 'episode' ? String(+value + 1) : value.toLowerCase() \n )\n ```\n */\n refmt ( this: string,\n pattern: string,\n \n pattern_: string,\n \n preservations?: string,\n \n flags?: string,\n \n transformer?: (name: string, value: string, placeholders: { [name: string]: string }) => string,\n \n pattern_placeholder?: RegExp\n \n ): string\n \n \n /** 字符串模式搜索\n ```ts\n 'git+https://github.com/tamino-martinius/node-ts-dedent-123.git'.find(\n '^{protocol:[\\\\w+]+}://{hostname:[\\\\w\\\\.]+}/{username}/{project}-{index:\\\\d+}.{suffix}', '^', 'i'\n )\n {\n protocol: 'git+https',\n hostname: 'github.com',\n ...\n }\n ```\n \n - preservations?: `''` 保留的正则表达式字符\n - flags?: `''` 正则匹配选项\n - pattern_placeholder?: `/\\{.*?\\}/g`\n */\n find (this: string,\n \n pattern: string, \n \n preservations?: string, \n \n flags?: string, \n \n pattern_placeholder?: RegExp\n \n ): Record<string, string>\n \n \n /** - type?: `'single'` */\n quote (this: string, type?: keyof typeof quotes | 'psh'): string\n \n /** - shape?: `'parenthesis'` */\n bracket (this: string, shape?: keyof typeof brackets): string\n \n surround (this: string, left: string, right?: string): string\n \n surround_tag (this: string, tag_name: string): string\n \n to_lf (this: string): string\n \n to_crlf (this: string): string\n \n /** 'xxx'.replace(/pattern/g, '') \n 如果 pattern 是 string 则在创建 RegExp 时自动加上 flags (默认 'g'), 否则忽略 flags\n */\n rm (this: string, pattern: string | RegExp, flags?: string): string\n \n \n // --- 文本处理\n /** 将 string 划分为行,并去掉最后一个 \\n 之后的 '' */\n split_lines (this: string): string[]\n \n trim_doc_comment (this: string): string\n \n split_indent (this: string): { indent: number, text: string }\n \n \n space (this: string): string\n \n to_slash (this: string): string\n \n to_backslash (this: string): string\n }\n \n \n interface Date {\n /** - ms?: `false` 显示到 ms */\n to_str (this: Date, ms?: boolean): string\n \n to_date_str (this: Date): string\n \n /** - ms?: `false` 显示到 ms */\n to_time_str (this: Date, ms?: boolean): string\n }\n \n \n interface Number {\n /** 12.4 KB (1 KB = 1024 B) */\n to_fsize_str (this: number, units?: 'iec' | 'metric'): string\n \n \n to_bin_str (this: number): string\n \n to_hex_str (this: number, length?: number): string\n \n to_oct_str (this: number): string\n }\n \n \n interface Array<T> {\n indent (this: string[], width: number, c?: string): string[]\n \n // --- 文本处理\n /**\n - trim_line?: `true`\n - rm_empty_lines?: `true`\n - rm_last_empty_lines?: `false`\n */\n trim_lines (this: string[], { trim_line, rm_empty_lines, rm_last_empty_lines }?: { trim_line?: boolean, rm_empty_lines?: boolean, rm_last_empty_lines?: boolean }): string[]\n \n /** - append?: `true` 是否在 join 之后增加 \\n */\n join_lines (append?: boolean): string\n }\n \n \n interface BigInt {\n toJSON (this: bigint): string\n }\n \n \n interface Error {\n toJSON (this: Error): string\n }\n}\n\nimport byte_size from 'byte-size'\nimport EmojiRegex from 'emoji-regex'\n\nimport { t } from './i18n/instance.js'\n\nexport const emoji_regex = EmojiRegex()\n\n\nexport function to_method_property_descriptors (methods: { [name: string]: Function }): PropertyDescriptorMap {\n return Object.fromEntries(\n Object.entries(methods)\n .map(([name, value]) => ([name, {\n configurable: true,\n writable: true,\n enumerable: false,\n value,\n } as PropertyDescriptor])\n ))\n}\n\n\nexport function to_getter_property_descriptors (getters: { [name: string]: Function }): PropertyDescriptorMap {\n return Object.fromEntries(\n Object.entries(getters)\n .map(([name, get]) => ([name, {\n configurable: true,\n enumerable: false,\n get,\n } as PropertyDescriptor])\n ))\n}\n\n\nexport const cjk = '([\\u2e80-\\u9fff\\uf900-\\ufaff])'\n\nexport const quotes = {\n single: \"'\",\n double: '\"',\n backtick: '`',\n}\n\nexport const brackets = {\n round: ['(', ')'],\n square: ['[', ']'],\n curly: ['{', '}'],\n pointy: ['<', '>'],\n corner: ['「', '」'],\n fat: ['【', '】'],\n tortoise_shell: ['〔', '〕'],\n} as const\n\n\n\n// ------------------------------------ String.prototype\nObject.defineProperties(String.prototype, {\n ... to_getter_property_descriptors({\n width (this: string) {\n const s = this.replace(emoji_regex, ' ')\n let width = 0\n for (let i = 0; i < s.length; i++) {\n const code = s.codePointAt(i)\n \n if (\n (code <= 0x1f || (code >= 0x7f && code <= 0x9f)) || // ignore control characters\n code >= 0x300 && code <= 0x36f // ignore combining characters\n ) continue\n \n // surrogates\n if (code > 0xffff)\n i++\n \n width += is_codepoint_fullwidth(code) ? 2 : 1\n }\n return width\n }\n }),\n \n \n \n // ------------ 文本处理工具方法\n ... to_method_property_descriptors({\n /** 截取字符串不超过 width 显示宽度的部分,并保留颜色 \n 找到并记录能容纳 字符串 + … 的最后一个字符的位置 i_fitted \n - 若完整的字符串长度超过 width,返回 slice(0, i_fitted + 1) + … \n - 否则 返回 this \n */\n truncate (this: string, width: number) {\n const color_bak = this.startsWith('\\u001b') ? this.slice(0, 5) : ''\n if (width <= 2) return this.slice(0, width)\n let i_fitted = 0\n let fitted_width = 0\n let cur_width = 0\n for (let i = 0; i < this.length; i++) {\n const code = this.codePointAt(i)\n \n if (\n (code <= 0x1F || (code >= 0x7F && code <= 0x9F)) || // Ignore control characters\n code >= 0x300 && code <= 0x36F // Ignore combining characters\n ) continue\n \n // surrogates (codepoint 需要用两个 utf-16 编码单位表示,因此这里跳过第二个编码单位,防止重复计算显示宽度)\n if (code > 0xFFFF)\n i++\n \n const w = is_codepoint_fullwidth(code) ? 2 : 1\n \n if (cur_width + w + 2 <= width) {\n i_fitted = i\n fitted_width += w\n }\n \n cur_width += w\n \n if (cur_width > width) {\n const i_fitted_next = i_fitted + 1\n const t = this.slice(0, i_fitted_next) + ' '.repeat(width - 2 - fitted_width) + '…' \n return color_bak ? color_bak + t + '\\u001b[39m' : t\n }\n }\n return this\n },\n \n \n pad (this: string, width: number, { character = ' ', position = 'right' }: { character?: string, position?: 'left' | 'right'} = { }) {\n const _width = this.width\n if (_width >= width) return this\n if (position === 'right') return this + character.repeat( (width - _width) / character.width )\n return character.repeat(width - _width) + this\n },\n \n \n limit (this: string, width: number, { character = ' ', position = 'right' }: { character?: string, position?: 'left' | 'right'} = { }) {\n return this.pad(width, { character, position }).truncate(width)\n },\n \n \n to_regexp (this: string, preservations: string, flags = ''): RegExp {\n const preserved_chars = new Set(preservations)\n const replace_chars: string = Array.prototype.filter.call('|\\\\{}()[]^$+*?.-', (c: string) => !preserved_chars.has(c))\n .map((c: string) =>\n c === ']' ? '\\\\]' : c\n ).join('')\n \n return new RegExp(\n this.replace(\n new RegExp(`[${replace_chars}]`, 'g'),\n '\\\\$&'\n ), \n flags\n )\n },\n \n \n to_bool (this: string) {\n return this.length && this !== '0' && this.toLowerCase() !== 'false'\n },\n \n refmt (this: string, \n pattern : string,\n pattern_: string,\n preservations: string = '',\n flags = '',\n transformer: (name: string, value: string, placeholders: { [name: string]: string }) => string = (name, value) => value || '',\n pattern_placeholder = /\\{.*?\\}/g,\n ): string {\n // --- 转换 pattern 为 pattern_regx\n let last_end = 0\n \n // placeholder matched group indexes\n let $placeholders: Record<string, number> = { }\n \n let regx_parts = [ ]\n \n function add_part (left: number, right?: number) {\n const part = pattern.slice(left, right)\n if (part)\n regx_parts.push(\n part.to_regexp(preservations).source.bracket()\n )\n }\n \n pattern.replace(pattern_placeholder, ($0, offset) => {\n add_part(last_end, offset)\n last_end = offset + $0.length\n \n const placeholder = $0.slice(1, -1)\n let [placeholder_name, placeholder_pattern] = placeholder.split(':').map(s => s.trim())\n let optional = false\n if (placeholder_name.endsWith('?')) {\n placeholder_name = placeholder_name.slice(0, -1)\n optional = true\n }\n $placeholders[placeholder_name] = regx_parts.push(\n placeholder_pattern ? \n `${placeholder_pattern.bracket()}${optional ? '?' : ''}`\n :\n '(.*?)'\n )\n return ''\n })\n \n add_part(last_end)\n \n // 最后一个 (.*?) 改为贪心匹配,满足 .{suffix} 的需要\n regx_parts = regx_parts.filter(part => part)\n if (regx_parts.last === '(.*?)')\n regx_parts[regx_parts.length - 1] = '(.*)'\n \n const pattern_regx = new RegExp(regx_parts.join(''), flags)\n \n \n // --- 根据 pattern_regx 去匹配原有字符串,获取匹配结果,生成 placeholders 词典\n const matches = pattern_regx.exec(this)\n \n if (!matches) return this\n \n const placeholders = Object.fromEntries(\n Object.entries($placeholders)\n .map(([name, $i]) => [\n [name, matches[$i]],\n [`${name}.before`, matches[$i - 1] || ''],\n [`${name}.after`, matches[$i + 1] || ''],\n ])\n .flat()\n )\n \n \n // --- 转换 pattern_ 为 replacement_str,如果有 transformer 则在遇到 placeholder 时应用\n last_end = 0\n let replacement_parts = [ ]\n \n pattern_.replace(pattern_placeholder, ($0, offset) => {\n replacement_parts.push(\n pattern_.slice(last_end, offset)\n )\n last_end = offset + $0.length\n \n const placeholder_name = $0.slice(1, -1)\n \n replacement_parts.push(\n transformer(placeholder_name, placeholders[placeholder_name], placeholders)\n )\n \n return ''\n })\n replacement_parts.push(\n pattern_.slice(last_end)\n )\n \n return this.replace(pattern_regx, replacement_parts.join(''))\n },\n \n \n find (this: string,\n pattern: string, \n preservations: string = '', \n flags = '', \n pattern_placeholder = /\\{.*?\\}/g\n ): Record<string, string> {\n // --- 转换 pattern 为 pattern_regx\n let last_end = 0\n \n // placeholder matched group index\n let $placeholders: Record<string, number> = { }\n \n let regx_parts = [ ]\n \n function add_part (left: number, right?: number) {\n const part = pattern.slice(left, right)\n if (part)\n regx_parts.push(\n part.to_regexp(preservations).source.bracket()\n )\n }\n \n pattern.replace(pattern_placeholder, ($0, offset) => {\n add_part(last_end, offset)\n last_end = offset + $0.length\n \n const placeholder = $0.slice(1, -1)\n let [placeholder_name, placeholder_pattern] = placeholder.split(':').map(s => s.trim())\n let optional = false\n if (placeholder_name.endsWith('?')) {\n placeholder_name = placeholder_name.slice(0, -1)\n optional = true\n }\n \n $placeholders[placeholder_name] = regx_parts.push(\n placeholder_pattern ? \n `${placeholder_pattern.bracket()}${optional ? '?' : ''}`\n :\n '(.*?)'\n )\n return ''\n })\n \n add_part(last_end)\n \n // 最后一个 (.*?) 改为贪心匹配,满足 .{suffix} 的需要\n regx_parts = regx_parts.filter(part => part)\n if (regx_parts[regx_parts.length - 1] === '(.*?)')\n regx_parts[regx_parts.length - 1] = '(.*)'\n \n const pattern_regx = new RegExp(regx_parts.join(''), flags)\n \n \n // --- 根据 pattern_regx 去匹配原有字符串,获取匹配结果,生成 placeholders 词典\n const matches = pattern_regx.exec(this)\n \n if (!matches) return { }\n \n return Object.fromEntries(\n Object.entries($placeholders)\n .map(([name, $i]) => \n [name, matches[$i] || '']\n )\n )\n },\n \n quote (this: string, type: keyof typeof quotes | 'psh' = 'single') {\n if (type === 'psh')\n return `& ${this.quote()}`\n return this.surround(quotes[type])\n },\n \n \n bracket (this: string, shape: keyof typeof brackets = 'round') {\n return this.surround(...brackets[shape] as [string, string])\n },\n \n \n surround (this: string, left: string, right?: string) {\n return left + this + (right || left)\n },\n \n surround_tag (this: string, tag_name: string): string {\n return '<' + tag_name + '>' + this + '</' + tag_name + '>'\n },\n \n \n to_lf (this: string) {\n return this.replace(/\\r\\n/g, '\\n')\n },\n \n \n to_crlf (this: string) {\n return this.replace(/\\n/g, '\\r\\n')\n },\n \n \n rm (this: string, pattern: string | RegExp, flags: string = 'g') {\n if (typeof pattern === 'string')\n pattern = new RegExp(pattern, flags)\n \n return this.replace(pattern, '')\n },\n \n \n split_lines (this: string, delimiter: string | RegExp = /\\r?\\n/) {\n let lines = this.split(delimiter)\n if (lines.last === '')\n lines.pop()\n return lines\n },\n \n \n split_indent (this: string): { indent: number, text: string } {\n let i = 0\n let indent = 0\n for (; i < this.length; i++)\n if (this[i] === ' ')\n indent += 1\n else if (this[i] === '\\t')\n indent += 4\n else\n break\n \n return {\n indent,\n text: this.slice(i)\n }\n },\n \n \n space (this: string) {\n if (!this) return this\n let text_: string\n text_ = this\n .replace(new RegExp(cjk + `(['\"])`, 'g'), '$1 $2')\n .replace(new RegExp(`(['\"])` + cjk, 'g'), '$1 $2')\n \n .replace(/([\"']+)\\s*(.+?)\\s*([\"']+)/g, '$1$2$3')\n \n .replace(new RegExp(cjk + '([\\\\+\\\\-\\\\*\\\\/=&\\\\\\\\\\\\|<>])([A-Za-z0-9])', 'g'), '$1 $2 $3')\n .replace(new RegExp('([A-Za-z0-9])([\\\\+\\\\-\\\\*\\\\/=&\\\\\\\\\\\\|<>])' + cjk, 'g'), '$1 $2 $3')\n \n const textBak = text_\n \n text_ = text_.replace(new RegExp(cjk + '([\\\\(\\\\[\\\\{<\\u201c]+(.*?)[\\\\)\\\\]\\\\}>\\u201d]+)' + cjk, 'g'), '$1 $2 $4')\n \n if (text_ === textBak)\n text_ = text_\n .replace(new RegExp(cjk + '([\\\\(\\\\[\\\\{<\\u201c>])', 'g'), '$1 $2')\n .replace(new RegExp('([\\\\)\\\\]\\\\}>\\u201d<])' + cjk, 'g'), '$1 $2')\n \n return text_\n .replace(/([\\(\\[\\{<\\u201c]+)(\\s*)(.+?)(\\s*)([\\)\\]\\}>\\u201d]+)/g, '$1$3$5')\n .replace(new RegExp(cjk + '([~!;:,\\\\.\\\\?\\u2026])([A-Za-z0-9])', 'g'), '$1$2 $3')\n .replace(new RegExp(cjk + '([A-Za-z0-9`\\\\$%\\\\^&\\\\*\\\\-=\\\\+\\\\\\\\\\\\|\\\\/@\\u00a1-\\u00ff\\u2022\\u2027\\u2150-\\u218f])', 'g'), '$1 $2')\n .replace(new RegExp('([A-Za-z0-9`\\\\$%\\\\^&\\\\*\\\\-=\\\\+\\\\\\\\\\\\|\\\\/@\\u00a1-\\u00ff\\u2022\\u2027\\u2150-\\u218f])' + cjk, 'g'), '$1 $2')\n },\n \n to_slash (this: string) {\n return this.replaceAll('\\\\', '/')\n },\n \n to_backslash (this: string) {\n return this.replaceAll('/', '\\\\')\n },\n })\n})\n\n\n// ------------------------------------ Date.prototype\nObject.defineProperties(Date.prototype, to_method_property_descriptors({\n to_str (this: Date, ms?: boolean) {\n const [ampm, hour] = (() => {\n let hour = this.getHours()\n if (hour <= 6)\n return [t('凌晨'), hour]\n \n if (hour <= 8)\n return [t('清晨'), hour]\n \n if (hour <= 9)\n return [t('早上'), hour]\n \n if (hour <= 10)\n return [t('上午'), hour]\n \n if (hour <= 12)\n return [t('中午'), hour]\n \n hour -= 12\n \n if (hour <= 5)\n return [t('下午'), hour]\n \n if (hour <= 10)\n return [t('晚上'), hour]\n \n return [t('深夜'), hour]\n })()\n \n const zero_padding = { character: '0', position: 'left' } as const\n \n return '' +\n // year.month.date\n this.getFullYear() + '.' + \n String(this.getMonth() + 1).pad(2, zero_padding) + '.' + \n String(this.getDate()).pad(2, zero_padding) + ' ' +\n \n // 上午\n ampm + ' ' +\n \n // 10:03:02\n String(hour).pad(2, zero_padding) + ':' +\n String(this.getMinutes()).pad(2, zero_padding) + ':' +\n String(this.getSeconds()).pad(2, zero_padding) + \n \n (ms ?\n '.' + String(this.getMilliseconds()).pad(3, zero_padding)\n :\n ''\n )\n },\n \n to_date_str (this: Date) {\n return this.to_str().split(' ')[0]\n },\n \n to_time_str (this: Date, ms?: boolean) {\n const [, ampm, time ] = this.to_str(ms).split(' ')\n return `${ampm} ${time}`\n },\n}))\n\n\n\n// ------------------------------------ Number.prototype\nObject.defineProperties(Number.prototype, to_method_property_descriptors({\n to_fsize_str (this: number, units: 'iec' | 'metric' = 'iec') {\n const { value, unit } = byte_size(this, { units })\n return `${value} ${unit.replace('i', '')}`\n },\n \n to_bin_str (this: number) {\n return `0b${this.toString(2)}`\n },\n \n to_hex_str (this: number, length?: number) {\n const s = this.toString(16)\n // 长度自动对齐到 4 的倍数\n if (!length)\n length = Math.ceil(s.length / 4) * 4\n return `0x${'0'.repeat(length - s.length)}${s}`\n },\n \n to_oct_str (this: number) {\n return `0o${this.toString(8)}`\n },\n}))\n\n\n\n// ------------------------------------ Array.prototype\nObject.defineProperties(Array.prototype, {\n // --- 文本处理工具方法\n ... to_method_property_descriptors({\n trim_lines (this: string[], { trim_line = true, rm_empty_lines = true, rm_last_empty_lines = false }: { trim_line?: boolean, rm_empty_lines?: boolean, rm_last_empty_lines?: boolean } = { }) {\n if (!this.length)\n return this\n let lines = this\n \n if (trim_line)\n lines = lines.map(line => line.trim())\n \n if (rm_empty_lines)\n return lines.filter( line => line )\n \n if (rm_last_empty_lines) {\n lines.reverse()\n const i_not_empty = lines.findIndex( line => line )\n if (i_not_empty !== -1)\n lines = lines.slice(i_not_empty)\n lines.reverse()\n return lines\n }\n \n return lines\n },\n \n \n indent (this: string[], width?: number, character: string = ' ') {\n return this.map(line => \n character.repeat(width) + line\n )\n },\n \n \n join_lines (this: string[], append = true) {\n return `${this.join('\\n')}${append ? '\\n' : ''}`\n }\n })\n})\n\n\nObject.defineProperties(BigInt.prototype, to_method_property_descriptors({\n toJSON (this: bigint) {\n return this.toString()\n }\n}))\n\nObject.defineProperties(Error.prototype, to_method_property_descriptors({\n toJSON (this: Error) {\n return Object.fromEntries(\n Object.getOwnPropertyNames(this)\n .map(name => \n [name, this[name]])\n )\n }\n}))\n\n\n\nexport function to_json (obj: any, replacer?: any) {\n return JSON.stringify(obj, replacer, 4) + '\\n'\n}\n\nexport function is_codepoint_fullwidth (codepoint: number) {\n // code points are derived from:\n // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt\n return (\n !Number.isNaN(codepoint) &&\n codepoint >= 0x1100 &&\n (\n codepoint <= 0x115f || // hangul jamo\n \n codepoint === 0x201c || codepoint === 0x201d || // \n codepoint === 0x2026 || // …\n codepoint === 0x203b || // ※\n \n // arrows\n (0x2190 <= codepoint && codepoint <= 0x21FF) ||\n \n codepoint === 0x2329 || // left-pointing angle bracket\n codepoint === 0x232a || // right-pointing angle bracket\n \n // ①\n (0x2460 <= codepoint && codepoint <= 0x24ff) ||\n \n // box drawing\n (0x2500 <= codepoint && codepoint <= 0x257f) ||\n \n // shapes, symbols, …\n (0x2580 <= codepoint && codepoint <= 0x2bef) ||\n \n // cjk radicals supplement .. enclosed cjk letters and months\n (0x2e80 <= codepoint && codepoint <= 0x3247 && codepoint !== 0x303f) ||\n \n // enclosed cjk letters and months .. cjk unified ideographs extension a\n (0x3250 <= codepoint && codepoint <= 0x4dbf) ||\n \n // cjk unified ideographs .. yi radicals\n (0x4E00 <= codepoint && codepoint <= 0xA4C6) ||\n \n // hangul jamo extended-a\n (0xa960 <= codepoint && codepoint <= 0xa97c) ||\n \n // hangul syllables\n (0xac00 <= codepoint && codepoint <= 0xd7a3) ||\n \n // cjk compatibility ideographs\n (0xf900 <= codepoint && codepoint <= 0xfaff) ||\n \n // vertical forms\n (0xfe10 <= codepoint && codepoint <= 0xfe19) ||\n \n // cjk compatibility forms .. small form variants\n (0xfe30 <= codepoint && codepoint <= 0xfe6b) ||\n \n // halfwidth and fullwidth forms\n (0xff01 <= codepoint && codepoint <= 0xff60) ||\n (0xffe0 <= codepoint && codepoint <= 0xffe6) ||\n \n // kana supplement\n (0x1b000 <= codepoint && codepoint <= 0x1b001) ||\n \n // enclosed ideographic supplement\n (0x1f200 <= codepoint && codepoint <= 0x1f251) ||\n \n // cjk unified ideographs extension b .. tertiary ideographic plane\n (0x20000 <= codepoint && codepoint <= 0x3fffd)\n )\n )\n}\n"]}
package/prototype.d.ts CHANGED
@@ -146,7 +146,8 @@ declare global {
146
146
  indent: number;
147
147
  text: string;
148
148
  }[];
149
- join_lines(): string;
149
+ /** - append?: `true` 是否在 join 之后增加 \n */
150
+ join_lines(append?: boolean): string;
150
151
  }
151
152
  interface BigInt {
152
153
  toJSON(this: bigint): string;
package/prototype.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3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,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,IAAI,SAAS,KAAK,MAAM,CAAC;YAEpE,wEAAwE;YACxE,CAAC,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAE5C,wCAAwC;YACxC,CAAC,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAE5C,yBAAyB;YACzB,CAAC,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAE5C,mBAAmB;YACnB,CAAC,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAE5C,+BAA+B;YAC/B,CAAC,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAE5C,iBAAiB;YACjB,CAAC,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAE5C,iDAAiD;YACjD,CAAC,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAE5C,gCAAgC;YAChC,CAAC,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAC5C,CAAC,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAE5C,kBAAkB;YAClB,CAAC,OAAO,IAAI,SAAS,IAAI,SAAS,IAAI,OAAO,CAAC;YAE9C,kCAAkC;YAClC,CAAC,OAAO,IAAI,SAAS,IAAI,SAAS,IAAI,OAAO,CAAC;YAE9C,mEAAmE;YACnE,CAAC,OAAO,IAAI,SAAS,IAAI,SAAS,IAAI,OAAO,CAAC,CACjD,CACJ,CAAA;AACL,CAAC","sourcesContent":["declare global {\n var my_prototype_defined: boolean\n \n interface String {\n readonly width: number\n \n // --- 工具方法\n /** 截取字符串不超过 width 显示宽度的部分,并保留颜色 \n 找到并记录能容纳 字符串 + … 的最后一个字符的位置 i_fitted \n 若完整的字符串长度超过 width,返回 slice(0, i_fitted + 1) + … \n 否则 返回 this \n */\n truncate (this: string, width: number): string\n \n /** pad string to `<width>` \n - character?: `' '`\n - position?: `'right'`\n */\n pad (this: string, width: number, { character, position }?: { character?: string, position?: 'left' | 'right'}): string\n \n limit (this: string, width: number, { character, position }?: { character?: string, position?: 'left' | 'right'}): string\n \n to_regexp (this: string, preservations?: string, flags?: string): RegExp\n \n to_bool (this: string): boolean\n \n /** 字符串模式替换 \n - pattern: 匹配部分的格式\n - pattern_: 替换后的格式\n - preservations?: `''` 保留的正则表达式字符\n - flags?: `''` 正则匹配选项\n - transformer?: `(name, matched) => matched || ''` placeholder transformer\n - pattern_placeholder?: `/\\{.*?\\}/g`\n \n ```ts\n 'g:/acgn/海贼王/[Skytree][海贼王][One_Piece][893][GB_BIG5_JP][X264_AAC][1080P][CRRIP][天空树双语字幕组].mkv'.refmt( \n '{dirp}/[Skytree][海贼王][{ en_name: \\\\w+ }][{ episode: \\\\d+ }][GB_BIG5_JP][{encoding}_AAC][1080P][CRRIP][天空树双语字幕组].{format}', \n 'g:/acgn/海贼王/{episode} {encoding}.{format}', \n '\\\\+', \n 'i', \n (name, value) => name === 'episode' ? String(+value + 1) : value.toLowerCase() \n )\n ```\n */\n refmt ( this: string,\n pattern: string,\n \n pattern_: string,\n \n preservations?: string,\n \n flags?: string,\n \n transformer?: (name: string, value: string, placeholders: { [name: string]: string }) => string,\n \n pattern_placeholder?: RegExp\n \n ): string\n \n \n /** 字符串模式搜索\n ```ts\n 'git+https://github.com/tamino-martinius/node-ts-dedent-123.git'.find(\n '^{protocol:[\\\\w+]+}://{hostname:[\\\\w\\\\.]+}/{username}/{project}-{index:\\\\d+}.{suffix}', '^', 'i'\n )\n {\n protocol: 'git+https',\n hostname: 'github.com',\n ...\n }\n ```\n \n - preservations?: `''` 保留的正则表达式字符\n - flags?: `''` 正则匹配选项\n - pattern_placeholder?: `/\\{.*?\\}/g`\n */\n find (this: string,\n \n pattern: string, \n \n preservations?: string, \n \n flags?: string, \n \n pattern_placeholder?: RegExp\n \n ): Record<string, string>\n \n \n /** - type?: `'single'` */\n quote (this: string, type?: keyof typeof quotes | 'psh'): string\n \n /** - shape?: `'parenthesis'` */\n bracket (this: string, shape?: keyof typeof brackets): string\n \n surround (this: string, left: string, right?: string): string\n \n surround_tag (this: string, tag_name: string): string\n \n to_lf (this: string): string\n \n to_crlf (this: string): string\n \n /** 'xxx'.replace(/pattern/g, '') \n 如果 pattern 是 string 则在创建 RegExp 时自动加上 flags (默认 'g'), 否则忽略 flags\n */\n rm (this: string, pattern: string | RegExp, flags?: string): string\n \n \n // --- chalk colors\n readonly red: string\n readonly red_: string\n \n readonly green: string\n readonly green_: string\n \n readonly yellow: string\n readonly yellow_: string\n \n readonly blue: string\n readonly blue_: string\n \n readonly magenta: string\n readonly magenta_: string\n \n readonly cyan: string\n readonly cyan_: string\n \n readonly grey: string\n \n readonly underline: string\n \n strip_ansi (this: string): string\n \n \n // --- 文本处理\n /** 将 string 划分为行,并去掉最后一个 \\n 之后的 '' */\n split_lines (this: string): string[]\n \n trim_doc_comment (this: string): string\n \n split_indent (this: string): { indent: number, text: string }\n \n \n to_base64 (this: string): string\n \n \n /** - buffer: `false` 直接返回 Buffer */\n decode_base64 (this: string): string\n decode_base64 (this: string, buffer: true): Buffer\n decode_base64 (this: string, buffer?: boolean): string | Buffer\n \n \n space (this: string): string\n \n \n // --- 文件路径操作\n fdir: string\n \n /** path.basename, 如: \n - D:/0/aaa.txt -> aaa.txt\n - D:/aaa/ -> aaa\n */\n fname: string\n \n /** .txt */\n fext: string\n \n to_slash (this: string): string\n \n to_backslash (this: string): string\n }\n \n \n interface Date {\n /** - ms?: `false` 显示到 ms */\n to_str (this: Date, ms?: boolean): string\n \n to_date_str (this: Date): string\n \n /** - ms?: `false` 显示到 ms */\n to_time_str (this: Date, ms?: boolean): string\n }\n \n \n interface Number {\n /** 12.4 KB (1 KB = 1024 B) */\n to_fsize_str (this: number, units?: 'iec' | 'metric'): string\n \n \n to_bin_str (this: number): string\n \n to_hex_str (this: number, length?: number): string\n \n to_oct_str (this: number): string\n }\n \n \n interface Array<T> {\n last: T\n \n log (this: string[], limit?: number): void\n \n indent (this: string[], width: number, c?: string): string[]\n \n indent2to4 (this: string[]): string[]\n \n \n // --- 文本处理\n /**\n - trim_line?: `true`\n - rm_empty_lines?: `true`\n - rm_last_empty_lines?: `false`\n */\n trim_lines (this: string[], { trim_line, rm_empty_lines, rm_last_empty_lines }?: { trim_line?: boolean, rm_empty_lines?: boolean, rm_last_empty_lines?: boolean }): string[]\n \n trim_license (this: string[]): string[]\n \n split_indents (this: string[]): { indent: number, text: string }[]\n \n join_lines (): string\n }\n \n \n interface BigInt {\n toJSON (this: bigint): string\n }\n \n \n interface Error {\n toJSON (this: Error): string\n }\n}\n\n\nimport path from 'upath'\nimport byte_size from 'byte-size'\n\nimport EmojiRegex from 'emoji-regex'\n\nimport strip_ansi from 'strip-ansi'\nimport chalk from 'chalk'\nchalk.level = 2\n\nimport { t } from './i18n/instance.js'\n\n\nexport const emoji_regex = EmojiRegex()\n\nexport { chalk }\n\nexport function to_method_property_descriptors (methods: { [name: string]: Function }): PropertyDescriptorMap {\n return Object.fromEntries(\n Object.entries(methods)\n .map(([name, value]) => ([name, {\n configurable: true,\n writable: true,\n enumerable: false,\n value,\n } as PropertyDescriptor])\n ))\n}\n\n\nexport function to_getter_property_descriptors (getters: { [name: string]: Function }): PropertyDescriptorMap {\n return Object.fromEntries(\n Object.entries(getters)\n .map(([name, get]) => ([name, {\n configurable: true,\n enumerable: false,\n get,\n } as PropertyDescriptor])\n ))\n}\n\n\nexport const cjk = '([\\u2e80-\\u9fff\\uf900-\\ufaff])'\n\nexport const quotes = {\n single: \"'\",\n double: '\"',\n backtick: '`',\n}\n\nexport const brackets = {\n round: ['(', ')'],\n square: ['[', ']'],\n curly: ['{', '}'],\n pointy: ['<', '>'],\n corner: ['「', '」'],\n fat: ['【', '】'],\n tortoise_shell: ['〔', '〕'],\n} as const\n\nconst color_map = Object.fromEntries(\n ['red_', 'green_', 'yellow_', 'blue_', 'magenta_', 'cyan_'].map(color =>\n [color, `${color.slice(0, -1)}Bright`])\n)\n\n\nif (!global.my_prototype_defined) {\n // ------------------------------------ String.prototype\n Object.defineProperties(String.prototype, {\n ... to_getter_property_descriptors({\n width (this: string) {\n const s = strip_ansi(\n this.replace(emoji_regex, ' ')\n )\n let width = 0\n for (let i = 0; i < s.length; i++) {\n const code = s.codePointAt(i)\n \n if (\n (code <= 0x1f || (code >= 0x7f && code <= 0x9f)) || // ignore control characters\n code >= 0x300 && code <= 0x36f // ignore combining characters\n ) continue\n \n // surrogates\n if (code > 0xffff)\n i++\n \n width += is_codepoint_fullwidth(code) ? 2 : 1\n }\n return width\n }\n }),\n \n \n // ------------ 文本处理工具方法\n ... to_method_property_descriptors({\n /** 截取字符串不超过 width 显示宽度的部分,并保留颜色 \n 找到并记录能容纳 字符串 + … 的最后一个字符的位置 i_fitted \n - 若完整的字符串长度超过 width,返回 slice(0, i_fitted + 1) + … \n - 否则 返回 this \n */\n truncate (this: string, width: number) {\n const color_bak = this.startsWith('\\u001b') ? this.slice(0, 5) : ''\n const s = strip_ansi(this)\n if (width <= 2) return this.slice(0, width)\n let i_fitted = 0\n let fitted_width = 0\n let cur_width = 0\n for (let i = 0; i < s.length; i++) {\n const code = s.codePointAt(i)\n \n if (\n (code <= 0x1F || (code >= 0x7F && code <= 0x9F)) || // Ignore control characters\n code >= 0x300 && code <= 0x36F // Ignore combining characters\n ) continue\n \n // surrogates (codepoint 需要用两个 utf-16 编码单位表示,因此这里跳过第二个编码单位,防止重复计算显示宽度)\n if (code > 0xFFFF)\n i++\n \n const w = is_codepoint_fullwidth(code) ? 2 : 1\n \n if (cur_width + w + 2 <= width) {\n i_fitted = i\n fitted_width += w\n }\n \n cur_width += w\n \n if (cur_width > width) {\n const i_fitted_next = i_fitted + 1\n const t = s.slice(0, i_fitted_next) + ' '.repeat(width - 2 - fitted_width) + '…' \n return color_bak ? color_bak + t + '\\u001b[39m' : t\n }\n }\n return this\n },\n \n \n pad (this: string, width: number, { character = ' ', position = 'right' }: { character?: string, position?: 'left' | 'right'} = { }) {\n const _width = this.width\n if (_width >= width) return this\n if (position === 'right') return this + character.repeat( (width - _width) / character.width )\n return character.repeat(width - _width) + this\n },\n \n \n limit (this: string, width: number, { character = ' ', position = 'right' }: { character?: string, position?: 'left' | 'right'} = { }) {\n return this.pad(width, { character, position }).truncate(width)\n },\n \n \n to_regexp (this: string, preservations: string, flags = ''): RegExp {\n const preserved_chars = new Set(preservations)\n const replace_chars: string = Array.prototype.filter.call('|\\\\{}()[]^$+*?.-', (c: string) => !preserved_chars.has(c))\n .map((c: string) =>\n c === ']' ? '\\\\]' : c\n ).join('')\n \n return new RegExp(\n this.replace(\n new RegExp(`[${replace_chars}]`, 'g'),\n '\\\\$&'\n ), \n flags\n )\n },\n \n \n to_bool (this: string) {\n return this.length && this !== '0' && this.toLowerCase() !== 'false'\n },\n \n refmt (this: string, \n pattern : string,\n pattern_: string,\n preservations: string = '',\n flags = '',\n transformer: (name: string, value: string, placeholders: { [name: string]: string }) => string = (name, value) => value || '',\n pattern_placeholder = /\\{.*?\\}/g,\n ): string {\n // --- 转换 pattern 为 pattern_regx\n let last_end = 0\n \n // placeholder matched group indexes\n let $placeholders: Record<string, number> = { }\n \n let regx_parts = [ ]\n \n function add_part (left: number, right?: number) {\n const part = pattern.slice(left, right)\n if (part)\n regx_parts.push(\n part.to_regexp(preservations).source.bracket()\n )\n }\n \n pattern.replace(pattern_placeholder, ($0, offset) => {\n add_part(last_end, offset)\n last_end = offset + $0.length\n \n const placeholder = $0.slice(1, -1)\n let [placeholder_name, placeholder_pattern] = placeholder.split(':').map(s => s.trim())\n let optional = false\n if (placeholder_name.endsWith('?')) {\n placeholder_name = placeholder_name.slice(0, -1)\n optional = true\n }\n $placeholders[placeholder_name] = regx_parts.push(\n placeholder_pattern ? \n `${placeholder_pattern.bracket()}${optional ? '?' : ''}`\n :\n '(.*?)'\n )\n return ''\n })\n \n add_part(last_end)\n \n // 最后一个 (.*?) 改为贪心匹配,满足 .{suffix} 的需要\n regx_parts = regx_parts.filter(part => part)\n if (regx_parts.last === '(.*?)')\n regx_parts[regx_parts.length - 1] = '(.*)'\n \n const pattern_regx = new RegExp(regx_parts.join(''), flags)\n \n \n // --- 根据 pattern_regx 去匹配原有字符串,获取匹配结果,生成 placeholders 词典\n const matches = pattern_regx.exec(this)\n \n if (!matches) return this\n \n const placeholders = Object.fromEntries(\n Object.entries($placeholders)\n .map(([name, $i]) => [\n [name, matches[$i]],\n [`${name}.before`, matches[$i - 1] || ''],\n [`${name}.after`, matches[$i + 1] || ''],\n ])\n .flat()\n )\n \n \n // --- 转换 pattern_ 为 replacement_str,如果有 transformer 则在遇到 placeholder 时应用\n last_end = 0\n let replacement_parts = [ ]\n \n pattern_.replace(pattern_placeholder, ($0, offset) => {\n replacement_parts.push(\n pattern_.slice(last_end, offset)\n )\n last_end = offset + $0.length\n \n const placeholder_name = $0.slice(1, -1)\n \n replacement_parts.push(\n transformer(placeholder_name, placeholders[placeholder_name], placeholders)\n )\n \n return ''\n })\n replacement_parts.push(\n pattern_.slice(last_end)\n )\n \n return this.replace(pattern_regx, replacement_parts.join(''))\n },\n \n \n find (this: string,\n pattern: string, \n preservations: string = '', \n flags = '', \n pattern_placeholder = /\\{.*?\\}/g\n ): Record<string, string> {\n // --- 转换 pattern 为 pattern_regx\n let last_end = 0\n \n // placeholder matched group index\n let $placeholders: Record<string, number> = { }\n \n let regx_parts = [ ]\n \n function add_part (left: number, right?: number) {\n const part = pattern.slice(left, right)\n if (part)\n regx_parts.push(\n part.to_regexp(preservations).source.bracket()\n )\n }\n \n pattern.replace(pattern_placeholder, ($0, offset) => {\n add_part(last_end, offset)\n last_end = offset + $0.length\n \n const placeholder = $0.slice(1, -1)\n let [placeholder_name, placeholder_pattern] = placeholder.split(':').map(s => s.trim())\n let optional = false\n if (placeholder_name.endsWith('?')) {\n placeholder_name = placeholder_name.slice(0, -1)\n optional = true\n }\n \n $placeholders[placeholder_name] = regx_parts.push(\n placeholder_pattern ? \n `${placeholder_pattern.bracket()}${optional ? '?' : ''}`\n :\n '(.*?)'\n )\n return ''\n })\n \n add_part(last_end)\n \n // 最后一个 (.*?) 改为贪心匹配,满足 .{suffix} 的需要\n regx_parts = regx_parts.filter(part => part)\n if (regx_parts[regx_parts.length - 1] === '(.*?)')\n regx_parts[regx_parts.length - 1] = '(.*)'\n \n const pattern_regx = new RegExp(regx_parts.join(''), flags)\n \n \n // --- 根据 pattern_regx 去匹配原有字符串,获取匹配结果,生成 placeholders 词典\n const matches = pattern_regx.exec(this)\n \n if (!matches) return { }\n \n return Object.fromEntries(\n Object.entries($placeholders)\n .map(([name, $i]) => \n [name, matches[$i] || '']\n )\n )\n },\n \n quote (this: string, type: keyof typeof quotes | 'psh' = 'single') {\n if (type === 'psh')\n return `& ${this.quote()}`\n return this.surround(quotes[type])\n },\n \n \n bracket (this: string, shape: keyof typeof brackets = 'round') {\n return this.surround(...brackets[shape] as [string, string])\n },\n \n \n surround (this: string, left: string, right?: string) {\n return left + this + (right || left)\n },\n \n surround_tag (this: string, tag_name: string): string {\n return '<' + tag_name + '>' + this + '</' + tag_name + '>'\n },\n \n \n to_lf (this: string) {\n return this.replace(/\\r\\n/g, '\\n')\n },\n \n \n to_crlf (this: string) {\n return this.replace(/\\n/g, '\\r\\n')\n },\n \n \n rm (this: string, pattern: string | RegExp, flags: string = 'g') {\n if (typeof pattern === 'string')\n pattern = new RegExp(pattern, flags)\n \n return this.replace(pattern, '')\n },\n \n \n split_lines (this: string, delimiter: string | RegExp = /\\r?\\n/) {\n let lines = this.split(delimiter)\n if (lines.last === '')\n lines.pop()\n return lines\n },\n \n \n split_indent (this: string): { indent: number, text: string } {\n let i = 0\n let indent = 0\n for (; i < this.length; i++)\n if (this[i] === ' ')\n indent += 1\n else if (this[i] === '\\t')\n indent += 4\n else\n break\n \n return {\n indent,\n text: this.slice(i)\n }\n },\n \n \n trim_doc_comment (this: string) {\n return `/** ${this.slice(3, -2).replace(/\\s*\\*\\s*/g, ' ').replace(/@(param|params|return) \\{.*?\\}\\s*/g, '').trim()} */`\n },\n \n \n to_base64 (this: string) {\n return Buffer.from(this).toString('base64')\n },\n \n \n decode_base64 (this: string, buffer = false) {\n const buf = Buffer.from(this, 'base64')\n if (buffer)\n return buf\n return buf.toString()\n },\n \n \n strip_ansi (this: string) {\n return strip_ansi(this)\n },\n \n \n space (this: string) {\n if (!this) return this\n let text_: string\n text_ = this\n .replace(new RegExp(cjk + `(['\"])`, 'g'), '$1 $2')\n .replace(new RegExp(`(['\"])` + cjk, 'g'), '$1 $2')\n \n .replace(/([\"']+)\\s*(.+?)\\s*([\"']+)/g, '$1$2$3')\n \n .replace(new RegExp(cjk + '([\\\\+\\\\-\\\\*\\\\/=&\\\\\\\\\\\\|<>])([A-Za-z0-9])', 'g'), '$1 $2 $3')\n .replace(new RegExp('([A-Za-z0-9])([\\\\+\\\\-\\\\*\\\\/=&\\\\\\\\\\\\|<>])' + cjk, 'g'), '$1 $2 $3')\n \n const text_bak = text_\n \n text_ = text_.replace(new RegExp(cjk + '([\\\\(\\\\[\\\\{<\\u201c]+(.*?)[\\\\)\\\\]\\\\}>\\u201d]+)' + cjk, 'g'), '$1 $2 $4')\n \n if (text_ === text_bak)\n text_ = text_\n .replace(new RegExp(cjk + '([\\\\(\\\\[\\\\{<\\u201c>])', 'g'), '$1 $2')\n .replace(new RegExp('([\\\\)\\\\]\\\\}>\\u201d<])' + cjk, 'g'), '$1 $2')\n \n return text_\n .replace(/([\\(\\[\\{<\\u201c]+)(\\s*)(.+?)(\\s*)([\\)\\]\\}>\\u201d]+)/g, '$1$3$5')\n .replace(new RegExp(cjk + '([~!;:,\\\\.\\\\?\\u2026])([A-Za-z0-9])', 'g'), '$1$2 $3')\n .replace(new RegExp(cjk + '([A-Za-z0-9`\\\\$%\\\\^&\\\\*\\\\-=\\\\+\\\\\\\\\\\\|\\\\/@\\u00a1-\\u00ff\\u2022\\u2027\\u2150-\\u218f])', 'g'), '$1 $2')\n .replace(new RegExp('([A-Za-z0-9`\\\\$%\\\\^&\\\\*\\\\-=\\\\+\\\\\\\\\\\\|\\\\/@\\u00a1-\\u00ff\\u2022\\u2027\\u2150-\\u218f])' + cjk, 'g'), '$1 $2')\n }\n }),\n \n \n // ------------ chalk colors\n ... Object.fromEntries(\n [\n 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'grey', \n 'red_', 'green_', 'yellow_', 'blue_', 'magenta_', 'cyan_',\n 'underline',\n ].map(color =>\n ([color, {\n configurable: true,\n get (this: string) {\n return chalk[color_map[color] || color](this)\n }\n }]))\n ),\n \n \n // ------------ 文件路径操作\n ... to_getter_property_descriptors({\n fdir (this: string) {\n const dir = path.dirname(this)\n return dir.endsWith('/') ? dir : `${dir}/`\n },\n \n fname (this: string) {\n return path.basename(this)\n },\n \n fext (this: string) {\n return path.extname(this)\n },\n }),\n \n ... to_method_property_descriptors({\n to_slash (this: string) {\n if (!this)\n return this\n return path.normalizeSafe(this)\n },\n \n to_backslash (this: string) {\n return this.replaceAll('/', '\\\\')\n },\n })\n })\n \n \n // ------------------------------------ Date.prototype\n Object.defineProperties(Date.prototype, to_method_property_descriptors({\n to_str (this: Date, ms?: boolean) {\n const [ampm, hour] = (() => {\n let hour = this.getHours()\n if (hour <= 6)\n return [t('凌晨'), hour]\n \n if (hour <= 8)\n return [t('清晨'), hour]\n \n if (hour <= 9)\n return [t('早上'), hour]\n \n if (hour <= 10)\n return [t('上午'), hour]\n \n if (hour <= 12)\n return [t('中午'), hour]\n \n hour -= 12\n \n if (hour <= 5)\n return [t('下午'), hour]\n \n if (hour <= 10)\n return [t('晚上'), hour]\n \n return [t('深夜'), hour]\n })()\n \n const zero_padding = { character: '0', position: 'left' } as const\n \n return '' +\n // year.month.date\n this.getFullYear() + '.' + \n String(this.getMonth() + 1).pad(2, zero_padding) + '.' + \n String(this.getDate()).pad(2, zero_padding) + ' ' +\n \n // 上午\n ampm + ' ' +\n \n // 10:03:02\n String(hour).pad(2, zero_padding) + ':' +\n String(this.getMinutes()).pad(2, zero_padding) + ':' +\n String(this.getSeconds()).pad(2, zero_padding) + \n \n (ms ?\n '.' + String(this.getMilliseconds()).pad(3, zero_padding)\n :\n ''\n )\n },\n \n to_date_str (this: Date) {\n return this.to_str().split(' ')[0]\n },\n \n to_time_str (this: Date, ms?: boolean) {\n const [, ampm, time] = this.to_str(ms).split(' ')\n return `${ampm} ${time}`\n },\n }))\n \n \n \n // ------------------------------------ Number.prototype\n Object.defineProperties(Number.prototype, to_method_property_descriptors({\n to_fsize_str (this: number, units: 'iec' | 'metric' = 'iec') {\n const { value, unit } = byte_size(this, { units })\n return `${value} ${unit.replace('i', '')}`\n },\n \n to_bin_str (this: number) {\n return `0b${this.toString(2)}`\n },\n \n to_hex_str (this: number, length?: number) {\n const s = this.toString(16)\n // 长度自动对齐到 4 的倍数\n if (!length)\n length = Math.ceil(s.length / 4) * 4\n return `0x${'0'.repeat(length - s.length)}${s}`\n },\n \n to_oct_str (this: number) {\n return `0o${this.toString(8)}`\n },\n }))\n \n \n \n // ------------------------------------ Array.prototype\n Object.defineProperties(Array.prototype, {\n ... to_getter_property_descriptors({\n last (this: any[]) {\n return this[this.length - 1]\n }\n }),\n \n \n // --- 文本处理工具方法\n ... to_method_property_descriptors({\n log (this: string[], limit: number = 10000) {\n const text = this.join('\\n') + '\\n'\n if (limit === -1 || this.length <= limit)\n console.log(text)\n else if (limit > 0)\n console.log(text.slice(0, limit) + '\\n...'.blue)\n else \n console.log('...\\n'.blue + text.slice(limit))\n },\n \n trim_lines (this: string[], { trim_line = true, rm_empty_lines = true, rm_last_empty_lines = false }: { trim_line?: boolean, rm_empty_lines?: boolean, rm_last_empty_lines?: boolean } = { }) {\n if (!this.length)\n return this\n let lines = this\n \n if (trim_line)\n lines = lines.map(line => line.trim())\n \n if (rm_empty_lines)\n return lines.filter( line => line )\n \n if (rm_last_empty_lines) {\n lines.reverse()\n const i_not_empty = lines.findIndex( line => line )\n if (i_not_empty !== -1)\n lines = lines.slice(i_not_empty)\n lines.reverse()\n return lines\n }\n \n return lines\n },\n \n \n trim_license (this: string[]) {\n const i = this.indexOf('/*')\n const j = this.indexOf('*/')\n if (i === 0 && this[i+1].includes('License'))\n return this.slice(j+1)\n else\n return this\n },\n \n split_indents (this: string[]): { indent: number, text: string }[] {\n return this.map(line => \n line.split_indent()\n )\n },\n \n indent (this: string[], width?: number, character: string = ' ') {\n return this.map(line => \n character.repeat(width) + line\n )\n },\n \n indent2to4 (this: string[]) {\n return this.split_indents()\n .map(line => \n ' '.repeat(\n Math.floor(line.indent / 2) * 4\n ) + line.text\n )\n },\n \n join_lines (this: string[], append = true) {\n return `${this.join('\\n')}${append ? '\\n' : ''}`\n }\n })\n })\n \n \n Object.defineProperties(BigInt.prototype, to_method_property_descriptors({\n toJSON (this: bigint) {\n return this.toString()\n }\n }))\n \n Object.defineProperties(Error.prototype, to_method_property_descriptors({\n toJSON (this: Error) {\n return Object.fromEntries(\n Object.getOwnPropertyNames(this)\n .map(name => \n [name, this[name]])\n )\n }\n }))\n}\n\n\nexport function to_json (obj: any, replacer?: any) {\n return JSON.stringify(obj, replacer, 4) + '\\n'\n}\n\nexport function to_json_safely (obj: any, replacer?: any) {\n return to_json(obj, replacer)\n .replace(/\\u2028/g, '\\\\u2028')\n .replace(/\\u2029/g, '\\\\u2029')\n .replace(/<\\/script>/g, '<\\\\/script>')\n}\n\n\nexport function is_codepoint_fullwidth (codepoint: number) {\n // code points are derived from:\n // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt\n return (\n !Number.isNaN(codepoint) &&\n codepoint >= 0x1100 &&\n (\n codepoint <= 0x115f || // hangul jamo\n \n codepoint === 0x201c || codepoint === 0x201d || // \n codepoint === 0x2026 || // …\n codepoint === 0x203b || // ※\n \n // arrows\n (0x2190 <= codepoint && codepoint <= 0x21FF) ||\n \n codepoint === 0x2329 || // left-pointing angle bracket\n codepoint === 0x232a || // right-pointing angle bracket\n \n // ①\n (0x2460 <= codepoint && codepoint <= 0x24ff) ||\n \n // box drawing\n (0x2500 <= codepoint && codepoint <= 0x257f) ||\n \n // shapes, symbols, …\n (0x2580 <= codepoint && codepoint <= 0x2bef) ||\n \n // cjk radicals supplement .. enclosed cjk letters and months\n (0x2e80 <= codepoint && codepoint <= 0x3247 && codepoint !== 0x303f) ||\n \n // enclosed cjk letters and months .. cjk unified ideographs extension a\n (0x3250 <= codepoint && codepoint <= 0x4dbf) ||\n \n // cjk unified ideographs .. yi radicals\n (0x4E00 <= codepoint && codepoint <= 0xA4C6) ||\n \n // hangul jamo extended-a\n (0xa960 <= codepoint && codepoint <= 0xa97c) ||\n \n // hangul syllables\n (0xac00 <= codepoint && codepoint <= 0xd7a3) ||\n \n // cjk compatibility ideographs\n (0xf900 <= codepoint && codepoint <= 0xfaff) ||\n \n // vertical forms\n (0xfe10 <= codepoint && codepoint <= 0xfe19) ||\n \n // cjk compatibility forms .. small form variants\n (0xfe30 <= codepoint && codepoint <= 0xfe6b) ||\n \n // halfwidth and fullwidth forms\n (0xff01 <= codepoint && codepoint <= 0xff60) ||\n (0xffe0 <= codepoint && codepoint <= 0xffe6) ||\n \n // kana supplement\n (0x1b000 <= codepoint && codepoint <= 0x1b001) ||\n \n // enclosed ideographic supplement\n (0x1f200 <= codepoint && codepoint <= 0x1f251) ||\n \n // cjk unified ideographs extension b .. tertiary ideographic plane\n (0x20000 <= codepoint && codepoint <= 0x3fffd)\n )\n )\n}\n"]}
1
+ {"version":3,"file":"prototype.js","sourceRoot":"","sources":["prototype.ts"],"names":[],"mappings":"AA4OA,OAAO,IAAI,MAAM,OAAO,CAAA;AACxB,OAAO,SAAS,MAAM,WAAW,CAAA;AAEjC,OAAO,UAAU,MAAM,aAAa,CAAA;AAEpC,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,KAAK,CAAC,KAAK,GAAG,CAAC,CAAA;AAEf,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAA;AAGtC,MAAM,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AAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAE5C,+BAA+B;YAC/B,CAAC,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAE5C,iBAAiB;YACjB,CAAC,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAE5C,iDAAiD;YACjD,CAAC,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAE5C,gCAAgC;YAChC,CAAC,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAC5C,CAAC,MAAM,IAAI,SAAS,IAAI,SAAS,IAAI,MAAM,CAAC;YAE5C,kBAAkB;YAClB,CAAC,OAAO,IAAI,SAAS,IAAI,SAAS,IAAI,OAAO,CAAC;YAE9C,kCAAkC;YAClC,CAAC,OAAO,IAAI,SAAS,IAAI,SAAS,IAAI,OAAO,CAAC;YAE9C,mEAAmE;YACnE,CAAC,OAAO,IAAI,SAAS,IAAI,SAAS,IAAI,OAAO,CAAC,CACjD,CACJ,CAAA;AACL,CAAC","sourcesContent":["declare global {\n var my_prototype_defined: boolean\n \n interface String {\n readonly width: number\n \n // --- 工具方法\n /** 截取字符串不超过 width 显示宽度的部分,并保留颜色 \n 找到并记录能容纳 字符串 + … 的最后一个字符的位置 i_fitted \n 若完整的字符串长度超过 width,返回 slice(0, i_fitted + 1) + … \n 否则 返回 this \n */\n truncate (this: string, width: number): string\n \n /** pad string to `<width>` \n - character?: `' '`\n - position?: `'right'`\n */\n pad (this: string, width: number, { character, position }?: { character?: string, position?: 'left' | 'right'}): string\n \n limit (this: string, width: number, { character, position }?: { character?: string, position?: 'left' | 'right'}): string\n \n to_regexp (this: string, preservations?: string, flags?: string): RegExp\n \n to_bool (this: string): boolean\n \n /** 字符串模式替换 \n - pattern: 匹配部分的格式\n - pattern_: 替换后的格式\n - preservations?: `''` 保留的正则表达式字符\n - flags?: `''` 正则匹配选项\n - transformer?: `(name, matched) => matched || ''` placeholder transformer\n - pattern_placeholder?: `/\\{.*?\\}/g`\n \n ```ts\n 'g:/acgn/海贼王/[Skytree][海贼王][One_Piece][893][GB_BIG5_JP][X264_AAC][1080P][CRRIP][天空树双语字幕组].mkv'.refmt( \n '{dirp}/[Skytree][海贼王][{ en_name: \\\\w+ }][{ episode: \\\\d+ }][GB_BIG5_JP][{encoding}_AAC][1080P][CRRIP][天空树双语字幕组].{format}', \n 'g:/acgn/海贼王/{episode} {encoding}.{format}', \n '\\\\+', \n 'i', \n (name, value) => name === 'episode' ? String(+value + 1) : value.toLowerCase() \n )\n ```\n */\n refmt ( this: string,\n pattern: string,\n \n pattern_: string,\n \n preservations?: string,\n \n flags?: string,\n \n transformer?: (name: string, value: string, placeholders: { [name: string]: string }) => string,\n \n pattern_placeholder?: RegExp\n \n ): string\n \n \n /** 字符串模式搜索\n ```ts\n 'git+https://github.com/tamino-martinius/node-ts-dedent-123.git'.find(\n '^{protocol:[\\\\w+]+}://{hostname:[\\\\w\\\\.]+}/{username}/{project}-{index:\\\\d+}.{suffix}', '^', 'i'\n )\n {\n protocol: 'git+https',\n hostname: 'github.com',\n ...\n }\n ```\n \n - preservations?: `''` 保留的正则表达式字符\n - flags?: `''` 正则匹配选项\n - pattern_placeholder?: `/\\{.*?\\}/g`\n */\n find (this: string,\n \n pattern: string, \n \n preservations?: string, \n \n flags?: string, \n \n pattern_placeholder?: RegExp\n \n ): Record<string, string>\n \n \n /** - type?: `'single'` */\n quote (this: string, type?: keyof typeof quotes | 'psh'): string\n \n /** - shape?: `'parenthesis'` */\n bracket (this: string, shape?: keyof typeof brackets): string\n \n surround (this: string, left: string, right?: string): string\n \n surround_tag (this: string, tag_name: string): string\n \n to_lf (this: string): string\n \n to_crlf (this: string): string\n \n /** 'xxx'.replace(/pattern/g, '') \n 如果 pattern 是 string 则在创建 RegExp 时自动加上 flags (默认 'g'), 否则忽略 flags\n */\n rm (this: string, pattern: string | RegExp, flags?: string): string\n \n \n // --- chalk colors\n readonly red: string\n readonly red_: string\n \n readonly green: string\n readonly green_: string\n \n readonly yellow: string\n readonly yellow_: string\n \n readonly blue: string\n readonly blue_: string\n \n readonly magenta: string\n readonly magenta_: string\n \n readonly cyan: string\n readonly cyan_: string\n \n readonly grey: string\n \n readonly underline: string\n \n strip_ansi (this: string): string\n \n \n // --- 文本处理\n /** 将 string 划分为行,并去掉最后一个 \\n 之后的 '' */\n split_lines (this: string): string[]\n \n trim_doc_comment (this: string): string\n \n split_indent (this: string): { indent: number, text: string }\n \n \n to_base64 (this: string): string\n \n \n /** - buffer: `false` 直接返回 Buffer */\n decode_base64 (this: string): string\n decode_base64 (this: string, buffer: true): Buffer\n decode_base64 (this: string, buffer?: boolean): string | Buffer\n \n \n space (this: string): string\n \n \n // --- 文件路径操作\n fdir: string\n \n /** path.basename, 如: \n - D:/0/aaa.txt -> aaa.txt\n - D:/aaa/ -> aaa\n */\n fname: string\n \n /** .txt */\n fext: string\n \n to_slash (this: string): string\n \n to_backslash (this: string): string\n }\n \n \n interface Date {\n /** - ms?: `false` 显示到 ms */\n to_str (this: Date, ms?: boolean): string\n \n to_date_str (this: Date): string\n \n /** - ms?: `false` 显示到 ms */\n to_time_str (this: Date, ms?: boolean): string\n }\n \n \n interface Number {\n /** 12.4 KB (1 KB = 1024 B) */\n to_fsize_str (this: number, units?: 'iec' | 'metric'): string\n \n \n to_bin_str (this: number): string\n \n to_hex_str (this: number, length?: number): string\n \n to_oct_str (this: number): string\n }\n \n \n interface Array<T> {\n last: T\n \n log (this: string[], limit?: number): void\n \n indent (this: string[], width: number, c?: string): string[]\n \n indent2to4 (this: string[]): string[]\n \n \n // --- 文本处理\n /**\n - trim_line?: `true`\n - rm_empty_lines?: `true`\n - rm_last_empty_lines?: `false`\n */\n trim_lines (this: string[], { trim_line, rm_empty_lines, rm_last_empty_lines }?: { trim_line?: boolean, rm_empty_lines?: boolean, rm_last_empty_lines?: boolean }): string[]\n \n trim_license (this: string[]): string[]\n \n split_indents (this: string[]): { indent: number, text: string }[]\n \n /** - append?: `true` 是否在 join 之后增加 \\n */\n join_lines (append?: boolean): string\n }\n \n \n interface BigInt {\n toJSON (this: bigint): string\n }\n \n \n interface Error {\n toJSON (this: Error): string\n }\n}\n\n\nimport path from 'upath'\nimport byte_size from 'byte-size'\n\nimport EmojiRegex from 'emoji-regex'\n\nimport strip_ansi from 'strip-ansi'\nimport chalk from 'chalk'\nchalk.level = 2\n\nimport { t } from './i18n/instance.js'\n\n\nexport const emoji_regex = EmojiRegex()\n\nexport { chalk }\n\nexport function to_method_property_descriptors (methods: { [name: string]: Function }): PropertyDescriptorMap {\n return Object.fromEntries(\n Object.entries(methods)\n .map(([name, value]) => ([name, {\n configurable: true,\n writable: true,\n enumerable: false,\n value,\n } as PropertyDescriptor])\n ))\n}\n\n\nexport function to_getter_property_descriptors (getters: { [name: string]: Function }): PropertyDescriptorMap {\n return Object.fromEntries(\n Object.entries(getters)\n .map(([name, get]) => ([name, {\n configurable: true,\n enumerable: false,\n get,\n } as PropertyDescriptor])\n ))\n}\n\n\nexport const cjk = '([\\u2e80-\\u9fff\\uf900-\\ufaff])'\n\nexport const quotes = {\n single: \"'\",\n double: '\"',\n backtick: '`',\n}\n\nexport const brackets = {\n round: ['(', ')'],\n square: ['[', ']'],\n curly: ['{', '}'],\n pointy: ['<', '>'],\n corner: ['「', '」'],\n fat: ['【', '】'],\n tortoise_shell: ['〔', '〕'],\n} as const\n\nconst color_map = Object.fromEntries(\n ['red_', 'green_', 'yellow_', 'blue_', 'magenta_', 'cyan_'].map(color =>\n [color, `${color.slice(0, -1)}Bright`])\n)\n\n\nif (!global.my_prototype_defined) {\n // ------------------------------------ String.prototype\n Object.defineProperties(String.prototype, {\n ... to_getter_property_descriptors({\n width (this: string) {\n const s = strip_ansi(\n this.replace(emoji_regex, ' ')\n )\n let width = 0\n for (let i = 0; i < s.length; i++) {\n const code = s.codePointAt(i)\n \n if (\n (code <= 0x1f || (code >= 0x7f && code <= 0x9f)) || // ignore control characters\n code >= 0x300 && code <= 0x36f // ignore combining characters\n ) continue\n \n // surrogates\n if (code > 0xffff)\n i++\n \n width += is_codepoint_fullwidth(code) ? 2 : 1\n }\n return width\n }\n }),\n \n \n // ------------ 文本处理工具方法\n ... to_method_property_descriptors({\n /** 截取字符串不超过 width 显示宽度的部分,并保留颜色 \n 找到并记录能容纳 字符串 + … 的最后一个字符的位置 i_fitted \n - 若完整的字符串长度超过 width,返回 slice(0, i_fitted + 1) + … \n - 否则 返回 this \n */\n truncate (this: string, width: number) {\n const color_bak = this.startsWith('\\u001b') ? this.slice(0, 5) : ''\n const s = strip_ansi(this)\n if (width <= 2) return this.slice(0, width)\n let i_fitted = 0\n let fitted_width = 0\n let cur_width = 0\n for (let i = 0; i < s.length; i++) {\n const code = s.codePointAt(i)\n \n if (\n (code <= 0x1F || (code >= 0x7F && code <= 0x9F)) || // Ignore control characters\n code >= 0x300 && code <= 0x36F // Ignore combining characters\n ) continue\n \n // surrogates (codepoint 需要用两个 utf-16 编码单位表示,因此这里跳过第二个编码单位,防止重复计算显示宽度)\n if (code > 0xFFFF)\n i++\n \n const w = is_codepoint_fullwidth(code) ? 2 : 1\n \n if (cur_width + w + 2 <= width) {\n i_fitted = i\n fitted_width += w\n }\n \n cur_width += w\n \n if (cur_width > width) {\n const i_fitted_next = i_fitted + 1\n const t = s.slice(0, i_fitted_next) + ' '.repeat(width - 2 - fitted_width) + '…' \n return color_bak ? color_bak + t + '\\u001b[39m' : t\n }\n }\n return this\n },\n \n \n pad (this: string, width: number, { character = ' ', position = 'right' }: { character?: string, position?: 'left' | 'right'} = { }) {\n const _width = this.width\n if (_width >= width) return this\n if (position === 'right') return this + character.repeat( (width - _width) / character.width )\n return character.repeat(width - _width) + this\n },\n \n \n limit (this: string, width: number, { character = ' ', position = 'right' }: { character?: string, position?: 'left' | 'right'} = { }) {\n return this.pad(width, { character, position }).truncate(width)\n },\n \n \n to_regexp (this: string, preservations: string, flags = ''): RegExp {\n const preserved_chars = new Set(preservations)\n const replace_chars: string = Array.prototype.filter.call('|\\\\{}()[]^$+*?.-', (c: string) => !preserved_chars.has(c))\n .map((c: string) =>\n c === ']' ? '\\\\]' : c\n ).join('')\n \n return new RegExp(\n this.replace(\n new RegExp(`[${replace_chars}]`, 'g'),\n '\\\\$&'\n ), \n flags\n )\n },\n \n \n to_bool (this: string) {\n return this.length && this !== '0' && this.toLowerCase() !== 'false'\n },\n \n refmt (this: string, \n pattern : string,\n pattern_: string,\n preservations: string = '',\n flags = '',\n transformer: (name: string, value: string, placeholders: { [name: string]: string }) => string = (name, value) => value || '',\n pattern_placeholder = /\\{.*?\\}/g,\n ): string {\n // --- 转换 pattern 为 pattern_regx\n let last_end = 0\n \n // placeholder matched group indexes\n let $placeholders: Record<string, number> = { }\n \n let regx_parts = [ ]\n \n function add_part (left: number, right?: number) {\n const part = pattern.slice(left, right)\n if (part)\n regx_parts.push(\n part.to_regexp(preservations).source.bracket()\n )\n }\n \n pattern.replace(pattern_placeholder, ($0, offset) => {\n add_part(last_end, offset)\n last_end = offset + $0.length\n \n const placeholder = $0.slice(1, -1)\n let [placeholder_name, placeholder_pattern] = placeholder.split(':').map(s => s.trim())\n let optional = false\n if (placeholder_name.endsWith('?')) {\n placeholder_name = placeholder_name.slice(0, -1)\n optional = true\n }\n $placeholders[placeholder_name] = regx_parts.push(\n placeholder_pattern ? \n `${placeholder_pattern.bracket()}${optional ? '?' : ''}`\n :\n '(.*?)'\n )\n return ''\n })\n \n add_part(last_end)\n \n // 最后一个 (.*?) 改为贪心匹配,满足 .{suffix} 的需要\n regx_parts = regx_parts.filter(part => part)\n if (regx_parts.last === '(.*?)')\n regx_parts[regx_parts.length - 1] = '(.*)'\n \n const pattern_regx = new RegExp(regx_parts.join(''), flags)\n \n \n // --- 根据 pattern_regx 去匹配原有字符串,获取匹配结果,生成 placeholders 词典\n const matches = pattern_regx.exec(this)\n \n if (!matches) return this\n \n const placeholders = Object.fromEntries(\n Object.entries($placeholders)\n .map(([name, $i]) => [\n [name, matches[$i]],\n [`${name}.before`, matches[$i - 1] || ''],\n [`${name}.after`, matches[$i + 1] || ''],\n ])\n .flat()\n )\n \n \n // --- 转换 pattern_ 为 replacement_str,如果有 transformer 则在遇到 placeholder 时应用\n last_end = 0\n let replacement_parts = [ ]\n \n pattern_.replace(pattern_placeholder, ($0, offset) => {\n replacement_parts.push(\n pattern_.slice(last_end, offset)\n )\n last_end = offset + $0.length\n \n const placeholder_name = $0.slice(1, -1)\n \n replacement_parts.push(\n transformer(placeholder_name, placeholders[placeholder_name], placeholders)\n )\n \n return ''\n })\n replacement_parts.push(\n pattern_.slice(last_end)\n )\n \n return this.replace(pattern_regx, replacement_parts.join(''))\n },\n \n \n find (this: string,\n pattern: string, \n preservations: string = '', \n flags = '', \n pattern_placeholder = /\\{.*?\\}/g\n ): Record<string, string> {\n // --- 转换 pattern 为 pattern_regx\n let last_end = 0\n \n // placeholder matched group index\n let $placeholders: Record<string, number> = { }\n \n let regx_parts = [ ]\n \n function add_part (left: number, right?: number) {\n const part = pattern.slice(left, right)\n if (part)\n regx_parts.push(\n part.to_regexp(preservations).source.bracket()\n )\n }\n \n pattern.replace(pattern_placeholder, ($0, offset) => {\n add_part(last_end, offset)\n last_end = offset + $0.length\n \n const placeholder = $0.slice(1, -1)\n let [placeholder_name, placeholder_pattern] = placeholder.split(':').map(s => s.trim())\n let optional = false\n if (placeholder_name.endsWith('?')) {\n placeholder_name = placeholder_name.slice(0, -1)\n optional = true\n }\n \n $placeholders[placeholder_name] = regx_parts.push(\n placeholder_pattern ? \n `${placeholder_pattern.bracket()}${optional ? '?' : ''}`\n :\n '(.*?)'\n )\n return ''\n })\n \n add_part(last_end)\n \n // 最后一个 (.*?) 改为贪心匹配,满足 .{suffix} 的需要\n regx_parts = regx_parts.filter(part => part)\n if (regx_parts[regx_parts.length - 1] === '(.*?)')\n regx_parts[regx_parts.length - 1] = '(.*)'\n \n const pattern_regx = new RegExp(regx_parts.join(''), flags)\n \n \n // --- 根据 pattern_regx 去匹配原有字符串,获取匹配结果,生成 placeholders 词典\n const matches = pattern_regx.exec(this)\n \n if (!matches) return { }\n \n return Object.fromEntries(\n Object.entries($placeholders)\n .map(([name, $i]) => \n [name, matches[$i] || '']\n )\n )\n },\n \n quote (this: string, type: keyof typeof quotes | 'psh' = 'single') {\n if (type === 'psh')\n return `& ${this.quote()}`\n return this.surround(quotes[type])\n },\n \n \n bracket (this: string, shape: keyof typeof brackets = 'round') {\n return this.surround(...brackets[shape] as [string, string])\n },\n \n \n surround (this: string, left: string, right?: string) {\n return left + this + (right || left)\n },\n \n surround_tag (this: string, tag_name: string): string {\n return '<' + tag_name + '>' + this + '</' + tag_name + '>'\n },\n \n \n to_lf (this: string) {\n return this.replace(/\\r\\n/g, '\\n')\n },\n \n \n to_crlf (this: string) {\n return this.replace(/\\n/g, '\\r\\n')\n },\n \n \n rm (this: string, pattern: string | RegExp, flags: string = 'g') {\n if (typeof pattern === 'string')\n pattern = new RegExp(pattern, flags)\n \n return this.replace(pattern, '')\n },\n \n \n split_lines (this: string, delimiter: string | RegExp = /\\r?\\n/) {\n let lines = this.split(delimiter)\n if (lines.last === '')\n lines.pop()\n return lines\n },\n \n \n split_indent (this: string): { indent: number, text: string } {\n let i = 0\n let indent = 0\n for (; i < this.length; i++)\n if (this[i] === ' ')\n indent += 1\n else if (this[i] === '\\t')\n indent += 4\n else\n break\n \n return {\n indent,\n text: this.slice(i)\n }\n },\n \n \n trim_doc_comment (this: string) {\n return `/** ${this.slice(3, -2).replace(/\\s*\\*\\s*/g, ' ').replace(/@(param|params|return) \\{.*?\\}\\s*/g, '').trim()} */`\n },\n \n \n to_base64 (this: string) {\n return Buffer.from(this).toString('base64')\n },\n \n \n decode_base64 (this: string, buffer = false) {\n const buf = Buffer.from(this, 'base64')\n if (buffer)\n return buf\n return buf.toString()\n },\n \n \n strip_ansi (this: string) {\n return strip_ansi(this)\n },\n \n \n space (this: string) {\n if (!this) return this\n let text_: string\n text_ = this\n .replace(new RegExp(cjk + `(['\"])`, 'g'), '$1 $2')\n .replace(new RegExp(`(['\"])` + cjk, 'g'), '$1 $2')\n \n .replace(/([\"']+)\\s*(.+?)\\s*([\"']+)/g, '$1$2$3')\n \n .replace(new RegExp(cjk + '([\\\\+\\\\-\\\\*\\\\/=&\\\\\\\\\\\\|<>])([A-Za-z0-9])', 'g'), '$1 $2 $3')\n .replace(new RegExp('([A-Za-z0-9])([\\\\+\\\\-\\\\*\\\\/=&\\\\\\\\\\\\|<>])' + cjk, 'g'), '$1 $2 $3')\n \n const text_bak = text_\n \n text_ = text_.replace(new RegExp(cjk + '([\\\\(\\\\[\\\\{<\\u201c]+(.*?)[\\\\)\\\\]\\\\}>\\u201d]+)' + cjk, 'g'), '$1 $2 $4')\n \n if (text_ === text_bak)\n text_ = text_\n .replace(new RegExp(cjk + '([\\\\(\\\\[\\\\{<\\u201c>])', 'g'), '$1 $2')\n .replace(new RegExp('([\\\\)\\\\]\\\\}>\\u201d<])' + cjk, 'g'), '$1 $2')\n \n return text_\n .replace(/([\\(\\[\\{<\\u201c]+)(\\s*)(.+?)(\\s*)([\\)\\]\\}>\\u201d]+)/g, '$1$3$5')\n .replace(new RegExp(cjk + '([~!;:,\\\\.\\\\?\\u2026])([A-Za-z0-9])', 'g'), '$1$2 $3')\n .replace(new RegExp(cjk + '([A-Za-z0-9`\\\\$%\\\\^&\\\\*\\\\-=\\\\+\\\\\\\\\\\\|\\\\/@\\u00a1-\\u00ff\\u2022\\u2027\\u2150-\\u218f])', 'g'), '$1 $2')\n .replace(new RegExp('([A-Za-z0-9`\\\\$%\\\\^&\\\\*\\\\-=\\\\+\\\\\\\\\\\\|\\\\/@\\u00a1-\\u00ff\\u2022\\u2027\\u2150-\\u218f])' + cjk, 'g'), '$1 $2')\n }\n }),\n \n \n // ------------ chalk colors\n ... Object.fromEntries(\n [\n 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'grey', \n 'red_', 'green_', 'yellow_', 'blue_', 'magenta_', 'cyan_',\n 'underline',\n ].map(color =>\n ([color, {\n configurable: true,\n get (this: string) {\n return chalk[color_map[color] || color](this)\n }\n }]))\n ),\n \n \n // ------------ 文件路径操作\n ... to_getter_property_descriptors({\n fdir (this: string) {\n const dir = path.dirname(this)\n return dir.endsWith('/') ? dir : `${dir}/`\n },\n \n fname (this: string) {\n return path.basename(this)\n },\n \n fext (this: string) {\n return path.extname(this)\n },\n }),\n \n ... to_method_property_descriptors({\n to_slash (this: string) {\n if (!this)\n return this\n return path.normalizeSafe(this)\n },\n \n to_backslash (this: string) {\n return this.replaceAll('/', '\\\\')\n },\n })\n })\n \n \n // ------------------------------------ Date.prototype\n Object.defineProperties(Date.prototype, to_method_property_descriptors({\n to_str (this: Date, ms?: boolean) {\n const [ampm, hour] = (() => {\n let hour = this.getHours()\n if (hour <= 6)\n return [t('凌晨'), hour]\n \n if (hour <= 8)\n return [t('清晨'), hour]\n \n if (hour <= 9)\n return [t('早上'), hour]\n \n if (hour <= 10)\n return [t('上午'), hour]\n \n if (hour <= 12)\n return [t('中午'), hour]\n \n hour -= 12\n \n if (hour <= 5)\n return [t('下午'), hour]\n \n if (hour <= 10)\n return [t('晚上'), hour]\n \n return [t('深夜'), hour]\n })()\n \n const zero_padding = { character: '0', position: 'left' } as const\n \n return '' +\n // year.month.date\n this.getFullYear() + '.' + \n String(this.getMonth() + 1).pad(2, zero_padding) + '.' + \n String(this.getDate()).pad(2, zero_padding) + ' ' +\n \n // 上午\n ampm + ' ' +\n \n // 10:03:02\n String(hour).pad(2, zero_padding) + ':' +\n String(this.getMinutes()).pad(2, zero_padding) + ':' +\n String(this.getSeconds()).pad(2, zero_padding) + \n \n (ms ?\n '.' + String(this.getMilliseconds()).pad(3, zero_padding)\n :\n ''\n )\n },\n \n to_date_str (this: Date) {\n return this.to_str().split(' ')[0]\n },\n \n to_time_str (this: Date, ms?: boolean) {\n const [, ampm, time] = this.to_str(ms).split(' ')\n return `${ampm} ${time}`\n },\n }))\n \n \n \n // ------------------------------------ Number.prototype\n Object.defineProperties(Number.prototype, to_method_property_descriptors({\n to_fsize_str (this: number, units: 'iec' | 'metric' = 'iec') {\n const { value, unit } = byte_size(this, { units })\n return `${value} ${unit.replace('i', '')}`\n },\n \n to_bin_str (this: number) {\n return `0b${this.toString(2)}`\n },\n \n to_hex_str (this: number, length?: number) {\n const s = this.toString(16)\n // 长度自动对齐到 4 的倍数\n if (!length)\n length = Math.ceil(s.length / 4) * 4\n return `0x${'0'.repeat(length - s.length)}${s}`\n },\n \n to_oct_str (this: number) {\n return `0o${this.toString(8)}`\n },\n }))\n \n \n \n // ------------------------------------ Array.prototype\n Object.defineProperties(Array.prototype, {\n ... to_getter_property_descriptors({\n last (this: any[]) {\n return this[this.length - 1]\n }\n }),\n \n \n // --- 文本处理工具方法\n ... to_method_property_descriptors({\n log (this: string[], limit: number = 10000) {\n const text = this.join('\\n') + '\\n'\n if (limit === -1 || this.length <= limit)\n console.log(text)\n else if (limit > 0)\n console.log(text.slice(0, limit) + '\\n...'.blue)\n else \n console.log('...\\n'.blue + text.slice(limit))\n },\n \n trim_lines (this: string[], { trim_line = true, rm_empty_lines = true, rm_last_empty_lines = false }: { trim_line?: boolean, rm_empty_lines?: boolean, rm_last_empty_lines?: boolean } = { }) {\n if (!this.length)\n return this\n let lines = this\n \n if (trim_line)\n lines = lines.map(line => line.trim())\n \n if (rm_empty_lines)\n return lines.filter( line => line )\n \n if (rm_last_empty_lines) {\n lines.reverse()\n const i_not_empty = lines.findIndex( line => line )\n if (i_not_empty !== -1)\n lines = lines.slice(i_not_empty)\n lines.reverse()\n return lines\n }\n \n return lines\n },\n \n \n trim_license (this: string[]) {\n const i = this.indexOf('/*')\n const j = this.indexOf('*/')\n if (i === 0 && this[i+1].includes('License'))\n return this.slice(j+1)\n else\n return this\n },\n \n split_indents (this: string[]): { indent: number, text: string }[] {\n return this.map(line => \n line.split_indent()\n )\n },\n \n indent (this: string[], width?: number, character: string = ' ') {\n return this.map(line => \n character.repeat(width) + line\n )\n },\n \n indent2to4 (this: string[]) {\n return this.split_indents()\n .map(line => \n ' '.repeat(\n Math.floor(line.indent / 2) * 4\n ) + line.text\n )\n },\n \n join_lines (this: string[], append = true) {\n return `${this.join('\\n')}${append ? '\\n' : ''}`\n }\n })\n })\n \n \n Object.defineProperties(BigInt.prototype, to_method_property_descriptors({\n toJSON (this: bigint) {\n return this.toString()\n }\n }))\n \n Object.defineProperties(Error.prototype, to_method_property_descriptors({\n toJSON (this: Error) {\n return Object.fromEntries(\n Object.getOwnPropertyNames(this)\n .map(name => \n [name, this[name]])\n )\n }\n }))\n}\n\n\nexport function to_json (obj: any, replacer?: any) {\n return JSON.stringify(obj, replacer, 4) + '\\n'\n}\n\nexport function to_json_safely (obj: any, replacer?: any) {\n return to_json(obj, replacer)\n .replace(/\\u2028/g, '\\\\u2028')\n .replace(/\\u2029/g, '\\\\u2029')\n .replace(/<\\/script>/g, '<\\\\/script>')\n}\n\n\nexport function is_codepoint_fullwidth (codepoint: number) {\n // code points are derived from:\n // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt\n return (\n !Number.isNaN(codepoint) &&\n codepoint >= 0x1100 &&\n (\n codepoint <= 0x115f || // hangul jamo\n \n codepoint === 0x201c || codepoint === 0x201d || // \n codepoint === 0x2026 || // …\n codepoint === 0x203b || // ※\n \n // arrows\n (0x2190 <= codepoint && codepoint <= 0x21FF) ||\n \n codepoint === 0x2329 || // left-pointing angle bracket\n codepoint === 0x232a || // right-pointing angle bracket\n \n // ①\n (0x2460 <= codepoint && codepoint <= 0x24ff) ||\n \n // box drawing\n (0x2500 <= codepoint && codepoint <= 0x257f) ||\n \n // shapes, symbols, …\n (0x2580 <= codepoint && codepoint <= 0x2bef) ||\n \n // cjk radicals supplement .. enclosed cjk letters and months\n (0x2e80 <= codepoint && codepoint <= 0x3247 && codepoint !== 0x303f) ||\n \n // enclosed cjk letters and months .. cjk unified ideographs extension a\n (0x3250 <= codepoint && codepoint <= 0x4dbf) ||\n \n // cjk unified ideographs .. yi radicals\n (0x4E00 <= codepoint && codepoint <= 0xA4C6) ||\n \n // hangul jamo extended-a\n (0xa960 <= codepoint && codepoint <= 0xa97c) ||\n \n // hangul syllables\n (0xac00 <= codepoint && codepoint <= 0xd7a3) ||\n \n // cjk compatibility ideographs\n (0xf900 <= codepoint && codepoint <= 0xfaff) ||\n \n // vertical forms\n (0xfe10 <= codepoint && codepoint <= 0xfe19) ||\n \n // cjk compatibility forms .. small form variants\n (0xfe30 <= codepoint && codepoint <= 0xfe6b) ||\n \n // halfwidth and fullwidth forms\n (0xff01 <= codepoint && codepoint <= 0xff60) ||\n (0xffe0 <= codepoint && codepoint <= 0xffe6) ||\n \n // kana supplement\n (0x1b000 <= codepoint && codepoint <= 0x1b001) ||\n \n // enclosed ideographic supplement\n (0x1f200 <= codepoint && codepoint <= 0x1f251) ||\n \n // cjk unified ideographs extension b .. tertiary ideographic plane\n (0x20000 <= codepoint && codepoint <= 0x3fffd)\n )\n )\n}\n"]}
package/repl.js CHANGED
@@ -261,12 +261,7 @@ export async function repl_ts(code) {
261
261
  }
262
262
  export async function start_repl() {
263
263
  // ------------ load library
264
- log_section(t('xshell 正在启动'), { time: true });
265
- log_mod_loaded('prototype');
266
- log_mod_loaded('utils');
267
- log_mod_loaded('file');
268
- log_mod_loaded('process');
269
- log_mod_loaded('net');
264
+ log_section(t('xshell 开始启动'), { color: 'green', time: true });
270
265
  // --- prevent from exiting
271
266
  process.on('uncaughtException', error => {
272
267
  console.error(error);
@@ -279,14 +274,13 @@ export async function start_repl() {
279
274
  useColors: true,
280
275
  terminal: true,
281
276
  });
282
- log_section(t('repl 已启动'), { color: 'yellow', time: true });
277
+ log_section(t('nodejs.repl 启动成功'), { color: 'yellow', time: true });
283
278
  process.title = 'xshell';
284
279
  await Promise.all([
285
280
  pollute_global(),
286
281
  load_tsconfig(),
287
282
  (async () => {
288
283
  // --- http server
289
- log_section(t('server 正在启动'), { color: 'green', time: true });
290
284
  let { Server } = await import('./server.js');
291
285
  server = new Server(8421, {
292
286
  remote: new Remote({
@@ -302,14 +296,16 @@ export async function start_repl() {
302
296
  })
303
297
  });
304
298
  await server.start();
305
- log_section(t('server 已启动'), { color: 'green', time: true });
299
+ log_section(t('server 启动成功'), { color: 'green', time: true });
306
300
  })(),
307
301
  ]);
308
- log_section(t('xshell 启动完成'), { color: 'red', time: true });
309
- console.log((t('xshell 正在监听: ') + 'http://0.0.0.0:8421').green);
302
+ console.log('-'.repeat(30).red);
303
+ log_section(t('xshell 启动成功'), { color: 'red', time: true });
304
+ console.log('-'.repeat(30).red);
305
+ console.log((t('xshell 正在监听: ') + 'http://localhost:8421').green);
310
306
  }
311
307
  export async function stop() {
312
- log_section('xshell is exiting', { color: 'red' });
308
+ log_section(t('xshell 正在退出'), { color: 'red' });
313
309
  for (const key in fwatchers)
314
310
  fwatchers[key].close();
315
311
  server.stop();
@@ -350,7 +346,7 @@ export async function pollute_global() {
350
346
  pollute_module_exports('./server.js'),
351
347
  pollute_module_exports('./repl.js'),
352
348
  ]);
353
- log_section(t('所有模块全部加载'), { color: 'green', time: true });
349
+ log_section(t('所有模块加载成功'), { color: 'green', time: true });
354
350
  }
355
351
  export async function pollute_module_exports(fp_mod) {
356
352
  Object.assign(global, await import(fp_mod));