From f60e45a440fbd6db82a4de6fe11bef40e57ca06d Mon Sep 17 00:00:00 2001 From: liuyi Date: Wed, 23 Oct 2024 19:15:45 +0800 Subject: [PATCH] Initial commit --- .github/workflows/CI.yml | 28 ++ .gitignore | 4 + LICENSE | 21 + README-zh_CN.md | 66 +++ README.md | 66 +++ package.json | 38 ++ pnpm-lock.yaml | 896 +++++++++++++++++++++++++++++++++ src/index.ts | 73 +++ src/loaders/replaceLocalize.ts | 21 + src/loaders/replaceNls.ts | 24 + src/locale/dt-zh-hans.json | 270 ++++++++++ src/nls/index.js | 49 ++ tsconfig.json | 12 + 13 files changed, 1568 insertions(+) create mode 100644 .github/workflows/CI.yml create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README-zh_CN.md create mode 100644 README.md create mode 100644 package.json create mode 100644 pnpm-lock.yaml create mode 100644 src/index.ts create mode 100644 src/loaders/replaceLocalize.ts create mode 100644 src/loaders/replaceNls.ts create mode 100644 src/locale/dt-zh-hans.json create mode 100644 src/nls/index.js create mode 100644 tsconfig.json diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..e2d9562 --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,28 @@ +name: CI + +on: + push: + branches: ["master"] + pull_request: + branches: ["master"] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [14.x, 16.x, 18.x, 20.x] + + steps: + - uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + + - name: Build + run: | + npm install + tsc -p tsconfig.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bbdc11b --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +node_modules +out + +.DS_Store diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..123871f --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) DTStack Corporation. All rights reserved. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/README-zh_CN.md b/README-zh_CN.md new file mode 100644 index 0000000..1e0754a --- /dev/null +++ b/README-zh_CN.md @@ -0,0 +1,66 @@ +# monaco-editor-i18n-plugin + +NPM Status + +[English](./README.md) | 简体中文 + +这个插件的作用是在使用 `monaco-editor` 时可以设置语言,主要实现思路是通过覆写 `monaco-editor/esm/vs/nls.js` 文件来实现语言切换的效果。 + +## 安装 + +`npm install monaco-editor-i18n-plugin -D` + +## 使用 + +### 简体中文 + +默认的语言是简体中文,使用到的 `src/locale/dt-zh-hans.json` 是基于 [vscode-loc](https://github.com/microsoft/vscode-loc/blob/release/1.63.3/i18n/vscode-language-pack-zh-hans/translations/main.i18n.json) 精简的。 + +- `ko.config.js` [ko - Project toolkit for React Applications](https://github.com/DTStack/ko) + +```js +const MonacoEditorI18nPlugin = require('monaco-editor-i18n-plugin'); + +const plugin = [ + ..., + { + key: 'WebpackPlugin', + action: 'add', + opts: { + name: 'MonacoEditorI18nPlugin', + fn: () => { + return new MonacoEditorI18nPlugin(); + }, + }, + } +] +``` + +- `webpack.config.js` + +```js +const MonacoEditorI18nPlugin = require('monaco-editor-i18n-plugin'); + +module.exports = { + ..., + plugins: [new MonacoEditorI18nPlugin()], + ..., +}; +``` + +### 自定义语言 + +如果你想使用其他语言或者精简后的 `src/locale/dt-zh-hans.json` 文件不能满足要求,你可以在 [vscode-loc/i18n](https://github.com/microsoft/vscode-loc/tree/release/1.63.3/i18n) 找到其他语言的 JSON 文件。 + +```js +new MonacoEditorI18nPlugin({ + locale: "zh-hant", // 繁体中文 + customLocalePath: path.join(__dirname, "./zh-hant.json"), +}); +``` + +## 注意事项 + +- 目前验证的 `monaco-editor` 版本为 `0.30.1` 和 `0.31.1` +- `vscode-loc` 的版本为 `1.63.3` +- 如果自定义语言不生效,可能是上述两个包的版本没有对应,`vscode-loc` 后续版本的 JSON 文件结构是有变化的,请自行验证。 diff --git a/README.md b/README.md new file mode 100644 index 0000000..1f9a003 --- /dev/null +++ b/README.md @@ -0,0 +1,66 @@ +# monaco-editor-i18n-plugin + +NPM Status + +English | [简体中文](./README-zh_CN.md) + +这个插件的作用是在使用 `monaco-editor` 时可以设置语言,主要实现思路是通过覆写 `monaco-editor/esm/vs/nls.js` 文件来实现语言切换的效果。 + +## Install + +`npm install monaco-editor-i18n-plugin -D` + +## Usage + +### zh-hans + +The default language is Simplified Chinese. The used `src/locale/dt-zh-hans.json` is based on [vscode-loc](https://github.com/microsoft/vscode-loc/blob/release/1.63.3/i18n/vscode-language-pack-zh-hans/translations/main.i18n.json) lite. + +- `ko.config.js` [ko - Project toolkit for React Applications](https://github.com/DTStack/ko) + +```js +const MonacoEditorI18nPlugin = require('monaco-editor-i18n-plugin'); + +const plugin = [ + ..., + { + key: 'WebpackPlugin', + action: 'add', + opts: { + name: 'MonacoEditorI18nPlugin', + fn: () => { + return new MonacoEditorI18nPlugin(); + }, + }, + } +] +``` + +- `webpack.config.js` + +```js +const MonacoEditorI18nPlugin = require('monaco-editor-i18n-plugin'); + +module.exports = { + ..., + plugins: [new MonacoEditorI18nPlugin()], + ..., +}; +``` + +### custom languages + +If you want to use another language or if the `src/locale/dt-zh-hans.json` doesn't meet your requirements, you can get another language's JSON file from [vscode-loc/i18n](https://github.com/microsoft/vscode-loc/tree/release/1.63.3/i18n). + +```js +new MonacoEditorI18nPlugin({ + locale: "zh-hant", // Traditional Chinese + customLocalePath: path.join(__dirname, "./zh-hant.json"), +}); +``` + +## Notice + +- The currently verified versions of `monaco-editor` are `0.30.1` and `0.31.1`. +- The version of `vscode-loc` is `1.63.3`. +- If custom language doesn't work, it may be due to a mismatch between the versions of the two packages. The JSON file structure in later versions of `vscode-loc` has changed, so please verify it by yourself. diff --git a/package.json b/package.json new file mode 100644 index 0000000..75add15 --- /dev/null +++ b/package.json @@ -0,0 +1,38 @@ +{ + "name": "monaco-editor-i18n-plugin", + "version": "0.0.0-beta.7", + "description": "A i18n plugin for the Monaco editor", + "main": "out/index.js", + "typings": "./out/index.d.ts", + "author": "DTStack", + "license": "MIT", + "scripts": { + "build": "rimraf out && tsc -p tsconfig.json && cp -r src/locale out/" + }, + "bugs": { + "url": "https://github.com/DTStack/monaco-editor-i18n-plugin/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/DTStack/monaco-editor-i18n-plugin" + }, + "homepage": "https://github.com/DTStack/monaco-editor-i18n-plugin#readme", + "devDependencies": { + "@types/node": "^22.7.9", + "rimraf": "^5.0.10", + "typescript": "^5.4.5", + "webpack": "^5.68.0" + }, + "peerDependencies": { + "monaco-editor": "0.30.1 || 0.31.1", + "webpack": "^5" + }, + "keywords": [ + "monaco", + "monaco editor", + "vscode", + "nls", + "i18n", + "webpack" + ] +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..7a9ec7a --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,896 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + monaco-editor: + specifier: 0.30.1 || 0.31.1 + version: 0.31.1 + devDependencies: + '@types/node': + specifier: ^22.7.9 + version: 22.7.9 + rimraf: + specifier: ^5.0.10 + version: 5.0.10 + typescript: + specifier: ^5.4.5 + version: 5.6.3 + webpack: + specifier: ^5.68.0 + version: 5.95.0 + +packages: + + '@isaacs/cliui@8.0.2': + resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} + engines: {node: '>=12'} + + '@jridgewell/gen-mapping@0.3.5': + resolution: {integrity: sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==} + engines: {node: '>=6.0.0'} + + '@jridgewell/resolve-uri@3.1.2': + resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} + engines: {node: '>=6.0.0'} + + '@jridgewell/set-array@1.2.1': + resolution: {integrity: sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==} + engines: {node: '>=6.0.0'} + + '@jridgewell/source-map@0.3.6': + resolution: {integrity: sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==} + + '@jridgewell/sourcemap-codec@1.5.0': + resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==} + + '@jridgewell/trace-mapping@0.3.25': + resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} + + '@pkgjs/parseargs@0.11.0': + resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} + engines: {node: '>=14'} + + '@types/estree@1.0.6': + resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==} + + '@types/json-schema@7.0.15': + resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} + + '@types/node@22.7.9': + resolution: {integrity: sha512-jrTfRC7FM6nChvU7X2KqcrgquofrWLFDeYC1hKfwNWomVvrn7JIksqf344WN2X/y8xrgqBd2dJATZV4GbatBfg==} + + '@webassemblyjs/ast@1.12.1': + resolution: {integrity: sha512-EKfMUOPRRUTy5UII4qJDGPpqfwjOmZ5jeGFwid9mnoqIFK+e0vqoi1qH56JpmZSzEL53jKnNzScdmftJyG5xWg==} + + '@webassemblyjs/floating-point-hex-parser@1.11.6': + resolution: {integrity: sha512-ejAj9hfRJ2XMsNHk/v6Fu2dGS+i4UaXBXGemOfQ/JfQ6mdQg/WXtwleQRLLS4OvfDhv8rYnVwH27YJLMyYsxhw==} + + '@webassemblyjs/helper-api-error@1.11.6': + resolution: {integrity: sha512-o0YkoP4pVu4rN8aTJgAyj9hC2Sv5UlkzCHhxqWj8butaLvnpdc2jOwh4ewE6CX0txSfLn/UYaV/pheS2Txg//Q==} + + '@webassemblyjs/helper-buffer@1.12.1': + resolution: {integrity: sha512-nzJwQw99DNDKr9BVCOZcLuJJUlqkJh+kVzVl6Fmq/tI5ZtEyWT1KZMyOXltXLZJmDtvLCDgwsyrkohEtopTXCw==} + + '@webassemblyjs/helper-numbers@1.11.6': + resolution: {integrity: sha512-vUIhZ8LZoIWHBohiEObxVm6hwP034jwmc9kuq5GdHZH0wiLVLIPcMCdpJzG4C11cHoQ25TFIQj9kaVADVX7N3g==} + + '@webassemblyjs/helper-wasm-bytecode@1.11.6': + resolution: {integrity: sha512-sFFHKwcmBprO9e7Icf0+gddyWYDViL8bpPjJJl0WHxCdETktXdmtWLGVzoHbqUcY4Be1LkNfwTmXOJUFZYSJdA==} + + '@webassemblyjs/helper-wasm-section@1.12.1': + resolution: {integrity: sha512-Jif4vfB6FJlUlSbgEMHUyk1j234GTNG9dBJ4XJdOySoj518Xj0oGsNi59cUQF4RRMS9ouBUxDDdyBVfPTypa5g==} + + '@webassemblyjs/ieee754@1.11.6': + resolution: {integrity: sha512-LM4p2csPNvbij6U1f19v6WR56QZ8JcHg3QIJTlSwzFcmx6WSORicYj6I63f9yU1kEUtrpG+kjkiIAkevHpDXrg==} + + '@webassemblyjs/leb128@1.11.6': + resolution: {integrity: sha512-m7a0FhE67DQXgouf1tbN5XQcdWoNgaAuoULHIfGFIEVKA6tu/edls6XnIlkmS6FrXAquJRPni3ZZKjw6FSPjPQ==} + + '@webassemblyjs/utf8@1.11.6': + resolution: {integrity: sha512-vtXf2wTQ3+up9Zsg8sa2yWiQpzSsMyXj0qViVP6xKGCUT8p8YJ6HqI7l5eCnWx1T/FYdsv07HQs2wTFbbof/RA==} + + '@webassemblyjs/wasm-edit@1.12.1': + resolution: {integrity: sha512-1DuwbVvADvS5mGnXbE+c9NfA8QRcZ6iKquqjjmR10k6o+zzsRVesil54DKexiowcFCPdr/Q0qaMgB01+SQ1u6g==} + + '@webassemblyjs/wasm-gen@1.12.1': + resolution: {integrity: sha512-TDq4Ojh9fcohAw6OIMXqiIcTq5KUXTGRkVxbSo1hQnSy6lAM5GSdfwWeSxpAo0YzgsgF182E/U0mDNhuA0tW7w==} + + '@webassemblyjs/wasm-opt@1.12.1': + resolution: {integrity: sha512-Jg99j/2gG2iaz3hijw857AVYekZe2SAskcqlWIZXjji5WStnOpVoat3gQfT/Q5tb2djnCjBtMocY/Su1GfxPBg==} + + '@webassemblyjs/wasm-parser@1.12.1': + resolution: {integrity: sha512-xikIi7c2FHXysxXe3COrVUPSheuBtpcfhbpFj4gmu7KRLYOzANztwUU0IbsqvMqzuNK2+glRGWCEqZo1WCLyAQ==} + + '@webassemblyjs/wast-printer@1.12.1': + resolution: {integrity: sha512-+X4WAlOisVWQMikjbcvY2e0rwPsKQ9F688lksZhBcPycBBuii3O7m8FACbDMWDojpAqvjIncrG8J0XHKyQfVeA==} + + '@xtuc/ieee754@1.2.0': + resolution: {integrity: sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==} + + '@xtuc/long@4.2.2': + resolution: {integrity: sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==} + + acorn-import-attributes@1.9.5: + resolution: {integrity: sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==} + peerDependencies: + acorn: ^8 + + acorn@8.13.0: + resolution: {integrity: sha512-8zSiw54Oxrdym50NlZ9sUusyO1Z1ZchgRLWRaK6c86XJFClyCgFKetdowBg5bKxyp/u+CDBJG4Mpp0m3HLZl9w==} + engines: {node: '>=0.4.0'} + hasBin: true + + ajv-keywords@3.5.2: + resolution: {integrity: sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==} + peerDependencies: + ajv: ^6.9.1 + + ajv@6.12.6: + resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} + + ansi-regex@5.0.1: + resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} + engines: {node: '>=8'} + + ansi-regex@6.1.0: + resolution: {integrity: sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==} + engines: {node: '>=12'} + + ansi-styles@4.3.0: + resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} + engines: {node: '>=8'} + + ansi-styles@6.2.1: + resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} + engines: {node: '>=12'} + + balanced-match@1.0.2: + resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} + + brace-expansion@2.0.1: + resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} + + browserslist@4.24.2: + resolution: {integrity: sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg==} + engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} + hasBin: true + + buffer-from@1.1.2: + resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} + + caniuse-lite@1.0.30001669: + resolution: {integrity: sha512-DlWzFDJqstqtIVx1zeSpIMLjunf5SmwOw0N2Ck/QSQdS8PLS4+9HrLaYei4w8BIAL7IB/UEDu889d8vhCTPA0w==} + + chrome-trace-event@1.0.4: + resolution: {integrity: sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==} + engines: {node: '>=6.0'} + + color-convert@2.0.1: + resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} + engines: {node: '>=7.0.0'} + + color-name@1.1.4: + resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + + commander@2.20.3: + resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} + + cross-spawn@7.0.3: + resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} + engines: {node: '>= 8'} + + eastasianwidth@0.2.0: + resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} + + electron-to-chromium@1.5.43: + resolution: {integrity: sha512-NxnmFBHDl5Sachd2P46O7UJiMaMHMLSofoIWVJq3mj8NJgG0umiSeljAVP9lGzjI0UDLJJ5jjoGjcrB8RSbjLQ==} + + emoji-regex@8.0.0: + resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} + + emoji-regex@9.2.2: + resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} + + enhanced-resolve@5.17.1: + resolution: {integrity: sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==} + engines: {node: '>=10.13.0'} + + es-module-lexer@1.5.4: + resolution: {integrity: sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw==} + + escalade@3.2.0: + resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} + engines: {node: '>=6'} + + eslint-scope@5.1.1: + resolution: {integrity: sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==} + engines: {node: '>=8.0.0'} + + esrecurse@4.3.0: + resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==} + engines: {node: '>=4.0'} + + estraverse@4.3.0: + resolution: {integrity: sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==} + engines: {node: '>=4.0'} + + estraverse@5.3.0: + resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} + engines: {node: '>=4.0'} + + events@3.3.0: + resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==} + engines: {node: '>=0.8.x'} + + fast-deep-equal@3.1.3: + resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + + fast-json-stable-stringify@2.1.0: + resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} + + foreground-child@3.3.0: + resolution: {integrity: sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==} + engines: {node: '>=14'} + + glob-to-regexp@0.4.1: + resolution: {integrity: sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==} + + glob@10.4.5: + resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==} + hasBin: true + + graceful-fs@4.2.11: + resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} + + has-flag@4.0.0: + resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} + engines: {node: '>=8'} + + is-fullwidth-code-point@3.0.0: + resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} + engines: {node: '>=8'} + + isexe@2.0.0: + resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + + jackspeak@3.4.3: + resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==} + + jest-worker@27.5.1: + resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==} + engines: {node: '>= 10.13.0'} + + json-parse-even-better-errors@2.3.1: + resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} + + json-schema-traverse@0.4.1: + resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} + + loader-runner@4.3.0: + resolution: {integrity: sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==} + engines: {node: '>=6.11.5'} + + lru-cache@10.4.3: + resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} + + merge-stream@2.0.0: + resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} + + mime-db@1.52.0: + resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} + engines: {node: '>= 0.6'} + + mime-types@2.1.35: + resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} + engines: {node: '>= 0.6'} + + minimatch@9.0.5: + resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==} + engines: {node: '>=16 || 14 >=14.17'} + + minipass@7.1.2: + resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==} + engines: {node: '>=16 || 14 >=14.17'} + + monaco-editor@0.31.1: + resolution: {integrity: sha512-FYPwxGZAeP6mRRyrr5XTGHD9gRXVjy7GUzF4IPChnyt3fS5WrNxIkS8DNujWf6EQy0Zlzpxw8oTVE+mWI2/D1Q==} + + neo-async@2.6.2: + resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} + + node-releases@2.0.18: + resolution: {integrity: sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==} + + package-json-from-dist@1.0.1: + resolution: {integrity: sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==} + + path-key@3.1.1: + resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} + engines: {node: '>=8'} + + path-scurry@1.11.1: + resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==} + engines: {node: '>=16 || 14 >=14.18'} + + picocolors@1.1.1: + resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + + punycode@2.3.1: + resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} + engines: {node: '>=6'} + + randombytes@2.1.0: + resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} + + rimraf@5.0.10: + resolution: {integrity: sha512-l0OE8wL34P4nJH/H2ffoaniAokM2qSmrtXHmlpvYr5AVVX8msAyW0l8NVJFDxlSK4u3Uh/f41cQheDVdnYijwQ==} + hasBin: true + + safe-buffer@5.2.1: + resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} + + schema-utils@3.3.0: + resolution: {integrity: sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==} + engines: {node: '>= 10.13.0'} + + serialize-javascript@6.0.2: + resolution: {integrity: sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==} + + shebang-command@2.0.0: + resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} + engines: {node: '>=8'} + + shebang-regex@3.0.0: + resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} + engines: {node: '>=8'} + + signal-exit@4.1.0: + resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} + engines: {node: '>=14'} + + source-map-support@0.5.21: + resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} + + source-map@0.6.1: + resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} + engines: {node: '>=0.10.0'} + + string-width@4.2.3: + resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} + engines: {node: '>=8'} + + string-width@5.1.2: + resolution: {integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==} + engines: {node: '>=12'} + + strip-ansi@6.0.1: + resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} + engines: {node: '>=8'} + + strip-ansi@7.1.0: + resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==} + engines: {node: '>=12'} + + supports-color@8.1.1: + resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} + engines: {node: '>=10'} + + tapable@2.2.1: + resolution: {integrity: sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==} + engines: {node: '>=6'} + + terser-webpack-plugin@5.3.10: + resolution: {integrity: sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w==} + engines: {node: '>= 10.13.0'} + peerDependencies: + '@swc/core': '*' + esbuild: '*' + uglify-js: '*' + webpack: ^5.1.0 + peerDependenciesMeta: + '@swc/core': + optional: true + esbuild: + optional: true + uglify-js: + optional: true + + terser@5.36.0: + resolution: {integrity: sha512-IYV9eNMuFAV4THUspIRXkLakHnV6XO7FEdtKjf/mDyrnqUg9LnlOn6/RwRvM9SZjR4GUq8Nk8zj67FzVARr74w==} + engines: {node: '>=10'} + hasBin: true + + typescript@5.6.3: + resolution: {integrity: sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==} + engines: {node: '>=14.17'} + hasBin: true + + undici-types@6.19.8: + resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} + + update-browserslist-db@1.1.1: + resolution: {integrity: sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A==} + hasBin: true + peerDependencies: + browserslist: '>= 4.21.0' + + uri-js@4.4.1: + resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} + + watchpack@2.4.2: + resolution: {integrity: sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw==} + engines: {node: '>=10.13.0'} + + webpack-sources@3.2.3: + resolution: {integrity: sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==} + engines: {node: '>=10.13.0'} + + webpack@5.95.0: + resolution: {integrity: sha512-2t3XstrKULz41MNMBF+cJ97TyHdyQ8HCt//pqErqDvNjU9YQBnZxIHa11VXsi7F3mb5/aO2tuDxdeTPdU7xu9Q==} + engines: {node: '>=10.13.0'} + hasBin: true + peerDependencies: + webpack-cli: '*' + peerDependenciesMeta: + webpack-cli: + optional: true + + which@2.0.2: + resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} + engines: {node: '>= 8'} + hasBin: true + + wrap-ansi@7.0.0: + resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} + engines: {node: '>=10'} + + wrap-ansi@8.1.0: + resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==} + engines: {node: '>=12'} + +snapshots: + + '@isaacs/cliui@8.0.2': + dependencies: + string-width: 5.1.2 + string-width-cjs: string-width@4.2.3 + strip-ansi: 7.1.0 + strip-ansi-cjs: strip-ansi@6.0.1 + wrap-ansi: 8.1.0 + wrap-ansi-cjs: wrap-ansi@7.0.0 + + '@jridgewell/gen-mapping@0.3.5': + dependencies: + '@jridgewell/set-array': 1.2.1 + '@jridgewell/sourcemap-codec': 1.5.0 + '@jridgewell/trace-mapping': 0.3.25 + + '@jridgewell/resolve-uri@3.1.2': {} + + '@jridgewell/set-array@1.2.1': {} + + '@jridgewell/source-map@0.3.6': + dependencies: + '@jridgewell/gen-mapping': 0.3.5 + '@jridgewell/trace-mapping': 0.3.25 + + '@jridgewell/sourcemap-codec@1.5.0': {} + + '@jridgewell/trace-mapping@0.3.25': + dependencies: + '@jridgewell/resolve-uri': 3.1.2 + '@jridgewell/sourcemap-codec': 1.5.0 + + '@pkgjs/parseargs@0.11.0': + optional: true + + '@types/estree@1.0.6': {} + + '@types/json-schema@7.0.15': {} + + '@types/node@22.7.9': + dependencies: + undici-types: 6.19.8 + + '@webassemblyjs/ast@1.12.1': + dependencies: + '@webassemblyjs/helper-numbers': 1.11.6 + '@webassemblyjs/helper-wasm-bytecode': 1.11.6 + + '@webassemblyjs/floating-point-hex-parser@1.11.6': {} + + '@webassemblyjs/helper-api-error@1.11.6': {} + + '@webassemblyjs/helper-buffer@1.12.1': {} + + '@webassemblyjs/helper-numbers@1.11.6': + dependencies: + '@webassemblyjs/floating-point-hex-parser': 1.11.6 + '@webassemblyjs/helper-api-error': 1.11.6 + '@xtuc/long': 4.2.2 + + '@webassemblyjs/helper-wasm-bytecode@1.11.6': {} + + '@webassemblyjs/helper-wasm-section@1.12.1': + dependencies: + '@webassemblyjs/ast': 1.12.1 + '@webassemblyjs/helper-buffer': 1.12.1 + '@webassemblyjs/helper-wasm-bytecode': 1.11.6 + '@webassemblyjs/wasm-gen': 1.12.1 + + '@webassemblyjs/ieee754@1.11.6': + dependencies: + '@xtuc/ieee754': 1.2.0 + + '@webassemblyjs/leb128@1.11.6': + dependencies: + '@xtuc/long': 4.2.2 + + '@webassemblyjs/utf8@1.11.6': {} + + '@webassemblyjs/wasm-edit@1.12.1': + dependencies: + '@webassemblyjs/ast': 1.12.1 + '@webassemblyjs/helper-buffer': 1.12.1 + '@webassemblyjs/helper-wasm-bytecode': 1.11.6 + '@webassemblyjs/helper-wasm-section': 1.12.1 + '@webassemblyjs/wasm-gen': 1.12.1 + '@webassemblyjs/wasm-opt': 1.12.1 + '@webassemblyjs/wasm-parser': 1.12.1 + '@webassemblyjs/wast-printer': 1.12.1 + + '@webassemblyjs/wasm-gen@1.12.1': + dependencies: + '@webassemblyjs/ast': 1.12.1 + '@webassemblyjs/helper-wasm-bytecode': 1.11.6 + '@webassemblyjs/ieee754': 1.11.6 + '@webassemblyjs/leb128': 1.11.6 + '@webassemblyjs/utf8': 1.11.6 + + '@webassemblyjs/wasm-opt@1.12.1': + dependencies: + '@webassemblyjs/ast': 1.12.1 + '@webassemblyjs/helper-buffer': 1.12.1 + '@webassemblyjs/wasm-gen': 1.12.1 + '@webassemblyjs/wasm-parser': 1.12.1 + + '@webassemblyjs/wasm-parser@1.12.1': + dependencies: + '@webassemblyjs/ast': 1.12.1 + '@webassemblyjs/helper-api-error': 1.11.6 + '@webassemblyjs/helper-wasm-bytecode': 1.11.6 + '@webassemblyjs/ieee754': 1.11.6 + '@webassemblyjs/leb128': 1.11.6 + '@webassemblyjs/utf8': 1.11.6 + + '@webassemblyjs/wast-printer@1.12.1': + dependencies: + '@webassemblyjs/ast': 1.12.1 + '@xtuc/long': 4.2.2 + + '@xtuc/ieee754@1.2.0': {} + + '@xtuc/long@4.2.2': {} + + acorn-import-attributes@1.9.5(acorn@8.13.0): + dependencies: + acorn: 8.13.0 + + acorn@8.13.0: {} + + ajv-keywords@3.5.2(ajv@6.12.6): + dependencies: + ajv: 6.12.6 + + ajv@6.12.6: + dependencies: + fast-deep-equal: 3.1.3 + fast-json-stable-stringify: 2.1.0 + json-schema-traverse: 0.4.1 + uri-js: 4.4.1 + + ansi-regex@5.0.1: {} + + ansi-regex@6.1.0: {} + + ansi-styles@4.3.0: + dependencies: + color-convert: 2.0.1 + + ansi-styles@6.2.1: {} + + balanced-match@1.0.2: {} + + brace-expansion@2.0.1: + dependencies: + balanced-match: 1.0.2 + + browserslist@4.24.2: + dependencies: + caniuse-lite: 1.0.30001669 + electron-to-chromium: 1.5.43 + node-releases: 2.0.18 + update-browserslist-db: 1.1.1(browserslist@4.24.2) + + buffer-from@1.1.2: {} + + caniuse-lite@1.0.30001669: {} + + chrome-trace-event@1.0.4: {} + + color-convert@2.0.1: + dependencies: + color-name: 1.1.4 + + color-name@1.1.4: {} + + commander@2.20.3: {} + + cross-spawn@7.0.3: + dependencies: + path-key: 3.1.1 + shebang-command: 2.0.0 + which: 2.0.2 + + eastasianwidth@0.2.0: {} + + electron-to-chromium@1.5.43: {} + + emoji-regex@8.0.0: {} + + emoji-regex@9.2.2: {} + + enhanced-resolve@5.17.1: + dependencies: + graceful-fs: 4.2.11 + tapable: 2.2.1 + + es-module-lexer@1.5.4: {} + + escalade@3.2.0: {} + + eslint-scope@5.1.1: + dependencies: + esrecurse: 4.3.0 + estraverse: 4.3.0 + + esrecurse@4.3.0: + dependencies: + estraverse: 5.3.0 + + estraverse@4.3.0: {} + + estraverse@5.3.0: {} + + events@3.3.0: {} + + fast-deep-equal@3.1.3: {} + + fast-json-stable-stringify@2.1.0: {} + + foreground-child@3.3.0: + dependencies: + cross-spawn: 7.0.3 + signal-exit: 4.1.0 + + glob-to-regexp@0.4.1: {} + + glob@10.4.5: + dependencies: + foreground-child: 3.3.0 + jackspeak: 3.4.3 + minimatch: 9.0.5 + minipass: 7.1.2 + package-json-from-dist: 1.0.1 + path-scurry: 1.11.1 + + graceful-fs@4.2.11: {} + + has-flag@4.0.0: {} + + is-fullwidth-code-point@3.0.0: {} + + isexe@2.0.0: {} + + jackspeak@3.4.3: + dependencies: + '@isaacs/cliui': 8.0.2 + optionalDependencies: + '@pkgjs/parseargs': 0.11.0 + + jest-worker@27.5.1: + dependencies: + '@types/node': 22.7.9 + merge-stream: 2.0.0 + supports-color: 8.1.1 + + json-parse-even-better-errors@2.3.1: {} + + json-schema-traverse@0.4.1: {} + + loader-runner@4.3.0: {} + + lru-cache@10.4.3: {} + + merge-stream@2.0.0: {} + + mime-db@1.52.0: {} + + mime-types@2.1.35: + dependencies: + mime-db: 1.52.0 + + minimatch@9.0.5: + dependencies: + brace-expansion: 2.0.1 + + minipass@7.1.2: {} + + monaco-editor@0.31.1: {} + + neo-async@2.6.2: {} + + node-releases@2.0.18: {} + + package-json-from-dist@1.0.1: {} + + path-key@3.1.1: {} + + path-scurry@1.11.1: + dependencies: + lru-cache: 10.4.3 + minipass: 7.1.2 + + picocolors@1.1.1: {} + + punycode@2.3.1: {} + + randombytes@2.1.0: + dependencies: + safe-buffer: 5.2.1 + + rimraf@5.0.10: + dependencies: + glob: 10.4.5 + + safe-buffer@5.2.1: {} + + schema-utils@3.3.0: + dependencies: + '@types/json-schema': 7.0.15 + ajv: 6.12.6 + ajv-keywords: 3.5.2(ajv@6.12.6) + + serialize-javascript@6.0.2: + dependencies: + randombytes: 2.1.0 + + shebang-command@2.0.0: + dependencies: + shebang-regex: 3.0.0 + + shebang-regex@3.0.0: {} + + signal-exit@4.1.0: {} + + source-map-support@0.5.21: + dependencies: + buffer-from: 1.1.2 + source-map: 0.6.1 + + source-map@0.6.1: {} + + string-width@4.2.3: + dependencies: + emoji-regex: 8.0.0 + is-fullwidth-code-point: 3.0.0 + strip-ansi: 6.0.1 + + string-width@5.1.2: + dependencies: + eastasianwidth: 0.2.0 + emoji-regex: 9.2.2 + strip-ansi: 7.1.0 + + strip-ansi@6.0.1: + dependencies: + ansi-regex: 5.0.1 + + strip-ansi@7.1.0: + dependencies: + ansi-regex: 6.1.0 + + supports-color@8.1.1: + dependencies: + has-flag: 4.0.0 + + tapable@2.2.1: {} + + terser-webpack-plugin@5.3.10(webpack@5.95.0): + dependencies: + '@jridgewell/trace-mapping': 0.3.25 + jest-worker: 27.5.1 + schema-utils: 3.3.0 + serialize-javascript: 6.0.2 + terser: 5.36.0 + webpack: 5.95.0 + + terser@5.36.0: + dependencies: + '@jridgewell/source-map': 0.3.6 + acorn: 8.13.0 + commander: 2.20.3 + source-map-support: 0.5.21 + + typescript@5.6.3: {} + + undici-types@6.19.8: {} + + update-browserslist-db@1.1.1(browserslist@4.24.2): + dependencies: + browserslist: 4.24.2 + escalade: 3.2.0 + picocolors: 1.1.1 + + uri-js@4.4.1: + dependencies: + punycode: 2.3.1 + + watchpack@2.4.2: + dependencies: + glob-to-regexp: 0.4.1 + graceful-fs: 4.2.11 + + webpack-sources@3.2.3: {} + + webpack@5.95.0: + dependencies: + '@types/estree': 1.0.6 + '@webassemblyjs/ast': 1.12.1 + '@webassemblyjs/wasm-edit': 1.12.1 + '@webassemblyjs/wasm-parser': 1.12.1 + acorn: 8.13.0 + acorn-import-attributes: 1.9.5(acorn@8.13.0) + browserslist: 4.24.2 + chrome-trace-event: 1.0.4 + enhanced-resolve: 5.17.1 + es-module-lexer: 1.5.4 + eslint-scope: 5.1.1 + events: 3.3.0 + glob-to-regexp: 0.4.1 + graceful-fs: 4.2.11 + json-parse-even-better-errors: 2.3.1 + loader-runner: 4.3.0 + mime-types: 2.1.35 + neo-async: 2.6.2 + schema-utils: 3.3.0 + tapable: 2.2.1 + terser-webpack-plugin: 5.3.10(webpack@5.95.0) + watchpack: 2.4.2 + webpack-sources: 3.2.3 + transitivePeerDependencies: + - '@swc/core' + - esbuild + - uglify-js + + which@2.0.2: + dependencies: + isexe: 2.0.0 + + wrap-ansi@7.0.0: + dependencies: + ansi-styles: 4.3.0 + string-width: 4.2.3 + strip-ansi: 6.0.1 + + wrap-ansi@8.1.0: + dependencies: + ansi-styles: 6.2.1 + string-width: 5.1.2 + strip-ansi: 7.1.0 diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..85cdda9 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,73 @@ +/** + * monaco-editor-i18n-plugin + * This plugin is referenced from https://github.com/microsoft/monaco-editor/tree/main/webpack-plugin + */ + +import type * as webpack from "webpack"; + +const replaceNls = require.resolve("./loaders/replaceNls"); +const replaceLocalizeLoader = require.resolve("./loaders/replaceLocalize"); + +export declare namespace MonacoEditorI18nPlugin { + interface IMonacoEditorI18nPluginOpts { + /** + * default is zh-cn + */ + locale: "zh-cn"; + + /** + * custom locale file path + * eg: path.join(__dirname, './zh-hant.json') + */ + customLocalePath?: string; + } +} + +// create rules loader +function createLoaderRules(options: MonacoEditorI18nPlugin.IMonacoEditorI18nPluginOpts): webpack.RuleSetRule[] { + return [ + { + test: /\.(js|mjs|jsx|ts|tsx)$/, + enforce: "pre", + include: /[\\\/]monaco-editor[\\\/]esm/, + use: [ + { + loader: replaceNls, + options, + }, + { + loader: replaceLocalizeLoader, + }, + ], + }, + ]; +} + +// add webpack rules to webpack config +function addCompilerRules(compiler: webpack.Compiler, rules: webpack.RuleSetRule[]): void { + const compilerOptions = compiler.options; + if (!compilerOptions.module) { + compilerOptions.module = { rules }; + } else { + const moduleOptions = compilerOptions.module; + moduleOptions.rules = (moduleOptions.rules || []).concat(rules); + } +} + +class MonacoEditorI18nPlugin { + options: MonacoEditorI18nPlugin.IMonacoEditorI18nPluginOpts = { + locale: "zh-cn", + customLocalePath: "", + }; + + constructor(options: MonacoEditorI18nPlugin.IMonacoEditorI18nPluginOpts) { + this.options = options; + } + + apply(compiler: webpack.Compiler): void { + const rules = createLoaderRules(this.options); + addCompilerRules(compiler, rules); + } +} + +module.exports = MonacoEditorI18nPlugin; diff --git a/src/loaders/replaceLocalize.ts b/src/loaders/replaceLocalize.ts new file mode 100644 index 0000000..e05e8d5 --- /dev/null +++ b/src/loaders/replaceLocalize.ts @@ -0,0 +1,21 @@ +import type { PitchLoaderDefinitionFunction } from "webpack"; +import { MonacoEditorI18nPlugin } from ".."; + +const replaceLocalize: PitchLoaderDefinitionFunction = function ( + content: string +) { + const pathRegExp = /monaco-editor[\\\/]esm[\\\/]vs.+\.js$/; + if (!pathRegExp.test(this.resourcePath)) return content; + + const vsPath = this.resourcePath.split(/monaco-editor[\\\/]esm[\\\/]/).pop(); + if (!vsPath) return content; + + // add vscode-loc path to function localize + const path = vsPath.replace(/\\/g, "/").replace(".js", ""); + return content.replace(/(\bfunction\s+localize\()|(\blocalize\()/g, function (text) { + if (/function\s+localize/.test(text)) return text; + return `localize('${path}', `; + }); +}; + +module.exports = replaceLocalize; diff --git a/src/loaders/replaceNls.ts b/src/loaders/replaceNls.ts new file mode 100644 index 0000000..5fe49ef --- /dev/null +++ b/src/loaders/replaceNls.ts @@ -0,0 +1,24 @@ +import type { PitchLoaderDefinitionFunction } from "webpack"; +import { MonacoEditorI18nPlugin } from ".."; + +const fs = require("fs"); +const nls = require.resolve("../nls"); + +const replaceNls: PitchLoaderDefinitionFunction = function ( + content: string +) { + const pathRegExp = /monaco-editor[\\\/]esm[\\\/]vs[\\\/]nls\.js$/; + if (!pathRegExp.test(this.resourcePath)) return content; + + let _content = fs.readFileSync(nls, { encoding: "utf8" }); + + // use user custom locale file path + const { customLocalePath } = this.getOptions() || {}; + if (customLocalePath && _content.includes("monaco-editor-i18n-plugin")) { + _content = _content.replace(/require\("[^"]*"\);/g, `require("${customLocalePath}");`); + } + + return _content; +}; + +module.exports = replaceNls; diff --git a/src/locale/dt-zh-hans.json b/src/locale/dt-zh-hans.json new file mode 100644 index 0000000..3fb7dd1 --- /dev/null +++ b/src/locale/dt-zh-hans.json @@ -0,0 +1,270 @@ +{ + "": [ + "--------------------------------------------------------------------------------------------", + "Copyright (c) Microsoft Corporation. All rights reserved.", + "Licensed under the MIT License. See License.txt in the project root for license information.", + "--------------------------------------------------------------------------------------------", + "Do not edit this file. It is machine generated.", + "", + "monaco-editor version is 0.30.1 or 0.31.1", + "This file is condensed from https://github.com/microsoft/vscode-loc/blob/release/1.63.3/i18n/vscode-language-pack-zh-hans/translations/main.i18n.json" + ], + "version": "1.0.0", + "contents": { + "vs/editor/contrib/clipboard/clipboard": { + "actions.clipboard.copyLabel": "复制", + "actions.clipboard.copyWithSyntaxHighlightingLabel": "复制并突出显示语法", + "actions.clipboard.cutLabel": "剪切", + "actions.clipboard.pasteLabel": "粘贴" + }, + "vs/editor/contrib/find/findController": { + "findNextMatchAction": "查找下一个", + "findPreviousMatchAction": "查找上一个", + "nextSelectionMatchFindAction": "查找下一个选择", + "previousSelectionMatchFindAction": "查找上一个选择", + "startFindAction": "查找", + "startFindWithArgsAction": "使用参数查找", + "startFindWithSelectionAction": "查找选定内容", + "startReplace": "替换" + }, + "vs/editor/contrib/find/findWidget": { + "ariaSearchNoResult": "为“{1}”找到 {0}", + "ariaSearchNoResultEmpty": "找到 {0}", + "ariaSearchNoResultWithLineNum": "在 {2} 处找到“{1}”的 {0}", + "ariaSearchNoResultWithLineNumNoCurrentMatch": "为“{1}”找到 {0}", + "label.closeButton": "关闭", + "label.find": "查找", + "label.matchesLocation": "{1} 中的 {0}", + "label.nextMatchButton": "下一个匹配项", + "label.noResults": "无结果", + "label.previousMatchButton": "上一个匹配项", + "label.replace": "替换", + "label.replaceAllButton": "全部替换", + "label.replaceButton": "替换", + "label.toggleReplaceButton": "切换替换", + "label.toggleSelectionFind": "在选定内容中查找", + "placeholder.find": "查找", + "placeholder.replace": "替换" + }, + "vs/base/browser/ui/findinput/findInputCheckboxes": { + "caseDescription": "区分大小写", + "regexDescription": "使用正则表达式", + "wordsDescription": "全字匹配" + }, + "vs/editor/contrib/multicursor/multicursor": { + "addSelectionToNextFindMatch": "将下一个查找匹配项添加到选择", + "addSelectionToPreviousFindMatch": "将选择内容添加到上一查找匹配项", + "changeAll.label": "更改所有匹配项", + "cursorAdded": "添加的光标: {0}", + "cursorsAdded": "添加的游标: {0}", + "mutlicursor.addCursorsToBottom": "在底部添加光标", + "mutlicursor.addCursorsToTop": "在顶部添加光标", + "mutlicursor.insertAbove": "在上面添加光标", + "mutlicursor.insertAtEndOfEachLineSelected": "在行尾添加光标", + "mutlicursor.insertBelow": "在下面添加光标", + "selectAllOccurrencesOfFindMatch": "选择所有找到的查找匹配项", + "moveSelectionToNextFindMatch": "将上次选择移动到下一个查找匹配项", + "moveSelectionToPreviousFindMatch": "将上个选择内容移动到上一查找匹配项" + }, + "vs/editor/contrib/cursorUndo/cursorUndo": { + "cursor.redo": "光标重做", + "cursor.undo": "光标撤消" + }, + "vs/base/browser/ui/findinput/replaceInput": { + "label.preserveCaseCheckbox": "保留大小写" + }, + "vs/editor/common/standaloneStrings": { + "helpQuickAccess": "显示所有快速访问提供程序", + "gotoLineActionLabel": "转到行/列...", + "quickCommandActionLabel": "命令面板", + "quickOutlineActionLabel": "转到符号...", + "quickOutlineByCategoryActionLabel": "按类别转到符号...", + "quickCommandActionHelp": "显示并运行命令", + "toggleHighContrast": "切换高对比度主题", + "showAccessibilityHelpAction": "显示辅助功能帮助", + "inspectTokens": "开发人员: 检查令牌" + }, + "vs/editor/contrib/comment/comment": { + "comment.block": "切换块注释", + "comment.line": "切换行注释", + "comment.line.add": "添加行注释", + "comment.line.remove": "删除行注释" + }, + "vs/editor/contrib/fontZoom/fontZoom": { + "EditorFontZoomIn.label": "放大编辑器字体", + "EditorFontZoomOut.label": "缩小编辑器字体", + "EditorFontZoomReset.label": "重置编辑器字体大小" + }, + "vs/editor/contrib/contextmenu/contextmenu": { + "action.showContextMenu.label": "显示编辑器上下文菜单" + }, + "vs/editor/contrib/folding/folding": { + "foldAction.label": "折叠", + "foldAllAction.label": "全部折叠", + "foldAllExcept.label": "折叠除所选区域之外的所有区域", + "foldLevelAction.label": "折叠级别 {0}", + "unFoldRecursivelyAction.label": "以递归方式展开", + "unfoldAction.label": "展开", + "unfoldAllAction.label": "全部展开", + "unfoldAllExcept.label": "展开除所选区域之外的所有区域", + "unfoldAllMarkerRegions.label": "展开所有区域", + "toggleFoldAction.label": "切换折叠", + "gotoParentFold.label": "跳转到父级折叠", + "foldAllBlockComments.label": "折叠所有块注释", + "foldAllMarkerRegions.label": "折叠所有区域", + "foldRecursivelyAction.label": "以递归方式折叠", + "gotoNextFold.label": "转到下一个折叠范围", + "gotoPreviousFold.label": "转到上一个折叠范围" + }, + "vs/editor/contrib/linesOperations/linesOperations": { + "duplicateSelection": "重复选择", + "editor.transformToLowercase": "转换为小写", + "editor.transformToSnakecase": "转换为蛇形命名法", + "editor.transformToTitlecase": "转换为词首字母大写", + "editor.transformToUppercase": "转换为大写", + "lines.copyDown": "向下复制行", + "lines.copyUp": "向上复制行", + "lines.deleteAllLeft": "删除左侧所有内容", + "lines.deleteAllRight": "删除右侧所有内容", + "lines.deleteDuplicates": "删除重复行", + "lines.delete": "删除行", + "lines.sortAscending": "按升序排列行", + "lines.sortDescending": "按降序排列行", + "editor.transpose": "转置光标处的字符", + "lines.trimTrailingWhitespace": "裁剪尾随空格", + "lines.outdent": "行减少缩进", + "lines.insertAfter": "在下面插入行", + "lines.insertBefore": "在上面插入行", + "lines.joinLines": "合并行", + "lines.moveDown": "向下移动行", + "lines.moveUp": "向上移动行", + "lines.indent": "行缩进" + }, + "vs/editor/contrib/indentation/indentation": { + "indentationToSpaces": "将缩进转换为空格", + "indentationToTabs": "将缩进转换为制表符", + "detectIndentation": "从内容中检测缩进方式", + "editor.reindentlines": "重新缩进行", + "editor.reindentselectedlines": "重新缩进所选行", + "indentUsingSpaces": "使用空格缩进", + "indentUsingTabs": "使用 \"Tab\" 缩进" + }, + "vs/editor/contrib/toggleTabFocusMode/toggleTabFocusMode": { + "toggle.tabMovesFocus": "切换 Tab 键移动焦点" + }, + "vs/editor/contrib/caretOperations/transpose": { + "transposeLetters.label": "转置字母" + }, + "vs/editor/contrib/suggest/suggestController": { + "suggest.trigger.label": "触发建议", + "suggest.reset.label": "重置建议小组件大小" + }, + "vs/editor/contrib/hover/hover": { + "showDefinitionPreviewHover": "显示定义预览悬停", + "showHover": "显示悬停" + }, + "vs/editor/contrib/wordHighlighter/wordHighlighter": { + "wordHighlight.trigger.label": "触发符号高亮", + "wordHighlight.next.label": "转到下一个突出显示的符号", + "wordHighlight.previous.label": "转到上一个突出显示的符号" + }, + "vs/editor/contrib/inlineCompletions/ghostTextController": { + "action.inlineSuggest.trigger": "触发内联建议" + }, + "vs/editor/contrib/inPlaceReplace/inPlaceReplace": { + "InPlaceReplaceAction.next.label": "替换为下一个值", + "InPlaceReplaceAction.previous.label": "替换为上一个值" + }, + "vs/editor/contrib/bracketMatching/bracketMatching": { + "smartSelect.jumpBracket": "转到括号", + "smartSelect.selectToBracket": "选择括号所有内容" + }, + "vs/editor/contrib/smartSelect/smartSelect": { + "smartSelect.expand": "展开选择", + "smartSelect.shrink": "收起选择" + }, + "vs/editor/contrib/anchorSelect/anchorSelect": { + "setSelectionAnchor": "设置选择定位点" + }, + "vs/editor/contrib/caretOperations/caretOperations": { + "caret.moveLeft": "向左移动所选文本", + "caret.moveRight": "向右移动所选文本" + }, + "vs/editor/contrib/tokenization/tokenization": { + "forceRetokenize": "开发人员: 强制重新进行标记" + }, + "vs/editor/contrib/wordOperations/wordOperations": { + "deleteInsideWord": "删除 Word" + }, + "vs/editor/contrib/links/links": { + "label": "打开链接" + }, + "vs/editor/contrib/gotoError/gotoError": { + "markerAction.next.label": "转到下一个问题 (错误、警告、信息)", + "markerAction.nextInFiles.label": "转到文件中的下一个问题 (错误、警告、信息)", + "markerAction.previous.label": "转到上一个问题 (错误、警告、信息)", + "markerAction.previousInFiles.label": "转到文件中的上一个问题 (错误、警告、信息)" + }, + "vs/editor/contrib/quickAccess/gotoLineQuickAccess": { + "gotoLineLabelEmptyWithLimit": "当前行: {0},字符: {1}。键入要导航到的行号(介于 1 至 {2} 之间)。" + }, + "vs/editor/contrib/quickAccess/gotoSymbolQuickAccess": { + "_constructor": "构造函数 ({0})", + "array": "数组({0})", + "boolean": "布尔值({0})", + "cannotRunGotoSymbolWithoutEditor": "要转到符号,首先打开具有符号信息的文本编辑器。", + "cannotRunGotoSymbolWithoutSymbolProvider": "活动文本编辑器不提供符号信息。", + "class": "类({0})", + "constant": "常量({0})", + "enum": "枚举({0})", + "enumMember": "枚举成员({0})", + "event": "事件({0})", + "field": "字段({0})", + "file": "文件({0})", + "function": "函数({0})", + "interface": "接口({0})", + "key": "键({0})", + "method": "方法({0})", + "modules": "模块({0})", + "namespace": "命名空间({0})", + "noMatchingSymbolResults": "没有匹配的编辑器符号", + "noSymbolResults": "没有编辑器符号", + "number": "数字({0})", + "object": "对象({0})", + "openToBottom": "在底部打开", + "openToSide": "在侧边打开", + "operator": "运算符({0})", + "package": "包({0})", + "property": "属性({0})", + "string": "字符串({0})", + "struct": "结构({0})", + "symbols": "符号({0})", + "typeParameter": "类型参数({0})", + "variable": "变量({0})" + }, + "vs/editor/contrib/format/formatActions": { + "formatDocument.label": "格式化文档", + "formatSelection.label": "格式化选定内容" + }, + "vs/base/browser/ui/inputbox/inputBox": { + "history.inputbox.hint": "对于历史记录" + }, + "vs/platform/quickinput/browser/commandsQuickAccess": { + "morecCommands": "其他命令", + "recentlyUsed": "最近使用" + }, + "vs/editor/contrib/message/messageController": { + "editor.readonly": "无法在只读编辑器中编辑" + }, + "vs/editor/contrib/unicodeHighlighter/unicodeHighlighter": { + "action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters": "禁止突出显示歧义字符", + "action.unicodeHighlight.disableHighlightingOfInvisibleCharacters": "禁止突出显示不可见字符", + "action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters": "禁止突出显示非基本 ASCII 字符", + "action.unicodeHighlight.showExcludeOptions": "显示排除选项" + }, + "vs/editor/browser/widget/diffReview": { + "editor.action.diffReview.next": "转至下一个差异", + "editor.action.diffReview.prev": "转至上一个差异" + } + } +} diff --git a/src/nls/index.js b/src/nls/index.js new file mode 100644 index 0000000..578652f --- /dev/null +++ b/src/nls/index.js @@ -0,0 +1,49 @@ +module.exports["localize"] = module.exports["loadMessageBundle"] = module.exports["config"] = null; + +// This file is condensed from vscode-loc 1.63.3 +const localeData = require("monaco-editor-i18n-plugin/out/locale/dt-zh-hans.json"); + +// replace monaco-editor/esm/vs/nls.js _format +function _format(message, args) { + let result; + if (args.length === 0) { + result = message; + } else { + result = String(message).replace(/\{(\d+)\}/g, function (match, rest) { + const index = rest[0]; + return typeof args[index] !== "undefined" ? args[index] : match; + }); + } + return result; +} + +// replace monaco-editor/esm/vs/nls.js localize +function localize(path, data, defaultMessage) { + const key = typeof data === "object" ? data.key : data; + const _data = localeData ? localeData.contents : {}; + let message = (_data[path] || {})[key]; + if (!message) { + message = defaultMessage; + } + const args = []; + for (let _i = 3; _i < arguments.length; _i++) { + args[_i - 3] = arguments[_i]; + } + return _format(message, args); +} +module.exports["localize"] = localize; + +function loadMessageBundle(_file) { + return localize; +} +module.exports["loadMessageBundle"] = loadMessageBundle; + +function config(_opt) { + return loadMessageBundle; +} +module.exports["config"] = config; + +function getConfiguredDefaultLocale() { + return undefined; +} +module.exports["getConfiguredDefaultLocale"] = getConfiguredDefaultLocale; diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..5fa1f1c --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "module": "commonjs", + "outDir": "out", + "target": "es6", + "declaration": true, + "strict": true, + "allowJs": true + }, + "include": ["src"], + "exclude": ["node_modules"] +}