nuxt-monaco-editor 1.2.7 → 1.2.9
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.
- package/CHANGELOG.md +9 -0
- package/README.md +1 -8
- package/dist/i18n/cs.json +14324 -0
- package/dist/i18n/de.json +14324 -0
- package/dist/i18n/es.json +14324 -0
- package/dist/i18n/fr.json +14324 -0
- package/dist/i18n/it.json +14324 -0
- package/dist/i18n/ja.json +14324 -0
- package/dist/i18n/ko.json +14324 -0
- package/dist/i18n/pl.json +14324 -0
- package/dist/i18n/pt-BR.json +14324 -0
- package/dist/i18n/qps-ploc.json +14324 -0
- package/dist/i18n/ru.json +14324 -0
- package/dist/i18n/tr.json +14324 -0
- package/dist/i18n/zh-hans.json +14324 -0
- package/dist/i18n/zh-hant.json +14324 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +20 -9
- package/dist/runtime/nls.d.mts +4 -0
- package/dist/runtime/nls.mjs +9 -1
- package/package.json +26 -22
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -29,25 +29,33 @@ const plugin = (options, nuxtOptions) => ({
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
async load(id) {
|
|
32
|
+
id = id.split("?")[0];
|
|
33
|
+
const vsPath = id.includes("monaco-editor/esm") ? id.split("monaco-editor/esm/").pop() : null;
|
|
32
34
|
if (options.locale !== "en") {
|
|
33
|
-
id = id.split("?")[0];
|
|
34
35
|
if (rewrittenMonacoFiles.has(id)) {
|
|
35
36
|
return { code: rewrittenMonacoFiles.get(id) };
|
|
36
37
|
}
|
|
37
38
|
if (/\/(vscode-)?nls\.m?js/.test(id)) {
|
|
38
|
-
const code = (await fs.readFile(resolve("nls.mjs"), "utf-8")).replace("__LOCALE_DATA_PATH__", `monaco-editor
|
|
39
|
+
const code = (await fs.readFile(resolve("nls.mjs"), "utf-8")).replace("__LOCALE_DATA_PATH__", `nuxt-monaco-editor/dist/i18n/${options.locale}.json`);
|
|
39
40
|
rewrittenMonacoFiles.set(id, code);
|
|
40
41
|
return { code };
|
|
41
42
|
}
|
|
42
|
-
if (
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
rewrittenMonacoFiles.set(id, code);
|
|
48
|
-
return { code };
|
|
43
|
+
if (vsPath && id.endsWith(".js")) {
|
|
44
|
+
const path = vsPath.replace(/\.js$/, "");
|
|
45
|
+
let code = (await fs.readFile(id, "utf-8")).replace(/import \* as nls from '.+nls\.js(\?v=.+)?';/g, `import * as nls from '${nlsPath}';`).replace(/(?<!function )localize\(/g, `localize('${path}', `);
|
|
46
|
+
if (path === "vs/base/common/platform") {
|
|
47
|
+
code = code.replace("let _isWeb = false;", "let _isWeb = true;");
|
|
49
48
|
}
|
|
49
|
+
rewrittenMonacoFiles.set(id, code);
|
|
50
|
+
return { code };
|
|
50
51
|
}
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (vsPath === "vs/base/common/platform.js") {
|
|
55
|
+
let code = await fs.readFile(id, "utf-8");
|
|
56
|
+
code = code.replace("let _isWeb = false;", "let _isWeb = true;");
|
|
57
|
+
rewrittenMonacoFiles.set(id, code);
|
|
58
|
+
return { code };
|
|
51
59
|
}
|
|
52
60
|
}
|
|
53
61
|
});
|
|
@@ -70,6 +78,9 @@ const module = defineNuxtModule({
|
|
|
70
78
|
const isDev = nuxt.options.dev;
|
|
71
79
|
const runtimeDir = fileURLToPath(new URL("./runtime", import.meta.url));
|
|
72
80
|
const { resolve } = createResolver(runtimeDir);
|
|
81
|
+
if (isDev) {
|
|
82
|
+
nuxt.options.vite.optimizeDeps?.exclude?.push("monaco-editor");
|
|
83
|
+
}
|
|
73
84
|
nuxt.options.build.transpile.push(runtimeDir);
|
|
74
85
|
nuxt.options.build.transpile.push(({ isClient }) => isClient ? "monaco-editor" : false);
|
|
75
86
|
addVitePlugin(plugin(options, nuxt.options));
|
package/dist/runtime/nls.d.mts
CHANGED
|
@@ -3,3 +3,7 @@ export function localize(path: any, _data: any, defaultMessage: any, ...args: an
|
|
|
3
3
|
export function loadMessageBundle(file: any): typeof localize;
|
|
4
4
|
export function config(opt: any): typeof loadMessageBundle;
|
|
5
5
|
export function getConfiguredDefaultLocale(): undefined;
|
|
6
|
+
export function localize2(data: any, message: any, ...args: any[]): {
|
|
7
|
+
value: any;
|
|
8
|
+
original: any;
|
|
9
|
+
};
|
package/dist/runtime/nls.mjs
CHANGED
|
@@ -15,7 +15,7 @@ export function _format (message, args) {
|
|
|
15
15
|
|
|
16
16
|
export function localize (path, _data, defaultMessage) {
|
|
17
17
|
const key = typeof _data === 'object' ? _data.key : _data
|
|
18
|
-
const data = localeData || {}
|
|
18
|
+
const data = localeData?.contents || {}
|
|
19
19
|
let message = (data[path] || {})[key]
|
|
20
20
|
if (!message) {
|
|
21
21
|
message = defaultMessage
|
|
@@ -27,6 +27,14 @@ export function localize (path, _data, defaultMessage) {
|
|
|
27
27
|
return _format(message, args)
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
export const localize2 = (data, message, ...args) => {
|
|
31
|
+
const original = _format(message, args)
|
|
32
|
+
return {
|
|
33
|
+
value: original,
|
|
34
|
+
original
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
30
38
|
export function loadMessageBundle (file) {
|
|
31
39
|
return localize
|
|
32
40
|
}
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"type": "git",
|
|
12
12
|
"url": "https://github.com/e-chan1007/nuxt-monaco-editor.git"
|
|
13
13
|
},
|
|
14
|
-
"version": "1.2.
|
|
14
|
+
"version": "1.2.9",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"exports": {
|
|
@@ -31,45 +31,49 @@
|
|
|
31
31
|
"scripts": {
|
|
32
32
|
"postpack": "pinst --enable",
|
|
33
33
|
"_postinstall": "husky install && playwright install",
|
|
34
|
-
"build": "nuxt-module-build",
|
|
34
|
+
"build": "nuxt-module-build && yarn loc:build",
|
|
35
35
|
"lint": "eslint --ext .js,.cjs,.mjs,.ts,.cts,.mts,.vue . && remark . -q",
|
|
36
36
|
"test": "nuxt test",
|
|
37
|
-
"prepack": "pinst --disable && nuxt-module-build",
|
|
37
|
+
"prepack": "pinst --disable && nuxt-module-build && yarn loc:build",
|
|
38
38
|
"release": "standard-version",
|
|
39
39
|
"dev": "nuxt dev playground",
|
|
40
40
|
"dev:build": "nuxt build playground",
|
|
41
|
-
"dev:prepare": "nuxt-module-build --stub && nuxt prepare playground",
|
|
41
|
+
"dev:prepare": "nuxt-module-build --stub && nuxt prepare playground && yarn loc:build",
|
|
42
42
|
"docs:dev": "nuxt dev docs",
|
|
43
43
|
"docs:generate": "nuxt generate docs",
|
|
44
44
|
"docs:prepare": "nuxt prepare docs",
|
|
45
|
-
"docs:preview": "nuxt preview docs"
|
|
45
|
+
"docs:preview": "nuxt preview docs",
|
|
46
|
+
"loc:build": "jiti scripts/build-loc.ts"
|
|
46
47
|
},
|
|
47
48
|
"dependencies": {
|
|
48
|
-
"@nuxt/kit": "^3.
|
|
49
|
-
"defu": "^6.1.
|
|
50
|
-
"
|
|
51
|
-
"vite-plugin-static-copy": "^0.17.0"
|
|
49
|
+
"@nuxt/kit": "^3.11.2",
|
|
50
|
+
"defu": "^6.1.4",
|
|
51
|
+
"vite-plugin-static-copy": "^1.0.3"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@commitlint/cli": "^
|
|
55
|
-
"@commitlint/config-conventional": "^
|
|
54
|
+
"@commitlint/cli": "^19.2.2",
|
|
55
|
+
"@commitlint/config-conventional": "^19.2.2",
|
|
56
56
|
"@nuxt-themes/docus": "^1.15.0",
|
|
57
57
|
"@nuxt/module-builder": "latest",
|
|
58
|
-
"@nuxt/test-utils": "
|
|
58
|
+
"@nuxt/test-utils": "3.11.0",
|
|
59
59
|
"@nuxtjs/eslint-config-typescript": "^12.1.0",
|
|
60
|
-
"
|
|
60
|
+
"@vue/test-utils": "^2.4.5",
|
|
61
|
+
"eslint": "^8.57.0",
|
|
61
62
|
"execa": "^8.0.1",
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
63
|
+
"happy-dom": "^14.7.1",
|
|
64
|
+
"husky": "^9.0.11",
|
|
65
|
+
"jiti": "^1.21.0",
|
|
66
|
+
"monaco-editor": "^0.47.0",
|
|
67
|
+
"nuxt": "^3.11.2",
|
|
65
68
|
"pinst": "^3.0.0",
|
|
66
|
-
"playwright": "^1.
|
|
69
|
+
"playwright": "^1.43.1",
|
|
70
|
+
"playwright-core": "^1.43.1",
|
|
67
71
|
"remark-cli": "^12.0.0",
|
|
68
|
-
"remark-lint": "^
|
|
69
|
-
"remark-preset-lint-recommended": "^
|
|
72
|
+
"remark-lint": "^10.0.0",
|
|
73
|
+
"remark-preset-lint-recommended": "^7.0.0",
|
|
70
74
|
"standard-version": "^9.5.0",
|
|
71
|
-
"typescript": "^5.
|
|
72
|
-
"vitest": "^
|
|
75
|
+
"typescript": "^5.4.5",
|
|
76
|
+
"vitest": "^1.5.0"
|
|
73
77
|
},
|
|
74
78
|
"peerDependencies": {
|
|
75
79
|
"monaco-editor": "*"
|
|
@@ -86,5 +90,5 @@
|
|
|
86
90
|
"workspaces": [
|
|
87
91
|
"playground"
|
|
88
92
|
],
|
|
89
|
-
"packageManager": "yarn@4.
|
|
93
|
+
"packageManager": "yarn@4.1.1"
|
|
90
94
|
}
|