nuxt-monaco-editor 1.0.5 → 1.1.0
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 +15 -0
- package/README.md +1 -0
- package/dist/module.json +2 -2
- package/dist/module.mjs +10 -5
- package/dist/runtime/plugin.client.mjs +12 -17
- package/dist/types.d.ts +1 -1
- package/package.json +15 -11
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [1.1.0](https://github.com/e-chan1007/nuxt-monaco-editor/compare/v1.0.6...v1.1.0) (2022-11-18)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* set preload header ([ae92e18](https://github.com/e-chan1007/nuxt-monaco-editor/commit/ae92e18ef5fbd77114b6350526ad29313047c81e))
|
|
11
|
+
* upgrade nuxt ([7463610](https://github.com/e-chan1007/nuxt-monaco-editor/commit/7463610724557fdffeae450a359160c3ef26ef0c))
|
|
12
|
+
|
|
13
|
+
### [1.0.6](https://github.com/e-chan1007/nuxt-monaco-editor/compare/v1.0.5...v1.0.6) (2022-10-26)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* destination where monaco-editor is copied was wrong ([f3a839e](https://github.com/e-chan1007/nuxt-monaco-editor/commit/f3a839eab2a6602aa582d772e7a54d8573237f81))
|
|
19
|
+
|
|
5
20
|
### [1.0.5](https://github.com/e-chan1007/nuxt-monaco-editor/compare/v1.0.4...v1.0.5) (2022-10-26)
|
|
6
21
|
|
|
7
22
|
|
package/README.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
[](https://badge.fury.io/js/nuxt-monaco-editor)
|
|
3
3
|
[](https://opensource.org/licenses/MIT)
|
|
4
4
|
[](https://www.codacy.com/gh/e-chan1007/nuxt-monaco-editor/dashboard?utm_source=github.com&utm_medium=referral&utm_content=e-chan1007/nuxt-monaco-editor&utm_campaign=Badge_Grade)
|
|
5
|
+
[](https://github.com/e-chan1007/nuxt-monaco-editor/actions/workflows/test.yml)
|
|
5
6
|
|
|
6
7
|
Integrate [monaco-editor](https://microsoft.github.io/monaco-editor/) with Nuxt
|
|
7
8
|
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -2,6 +2,8 @@ import { fileURLToPath } from 'url';
|
|
|
2
2
|
import { defineNuxtModule, createResolver, extendViteConfig, checkNuxtCompatibility, addPlugin, addComponent, addImports } from '@nuxt/kit';
|
|
3
3
|
import { viteStaticCopy } from 'vite-plugin-static-copy';
|
|
4
4
|
|
|
5
|
+
|
|
6
|
+
|
|
5
7
|
// -- Unbuild CommonJS Shims --
|
|
6
8
|
import __cjs_url__ from 'url';
|
|
7
9
|
import __cjs_path__ from 'path';
|
|
@@ -9,8 +11,6 @@ import __cjs_mod__ from 'module';
|
|
|
9
11
|
const __filename = __cjs_url__.fileURLToPath(import.meta.url);
|
|
10
12
|
const __dirname = __cjs_path__.dirname(__filename);
|
|
11
13
|
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
12
|
-
|
|
13
|
-
|
|
14
14
|
const DEFAULTS = {
|
|
15
15
|
dest: "_monaco",
|
|
16
16
|
locale: "en",
|
|
@@ -23,7 +23,7 @@ const module = defineNuxtModule({
|
|
|
23
23
|
meta: {
|
|
24
24
|
name: "nuxt-monaco-editor",
|
|
25
25
|
configKey: "monacoEditor",
|
|
26
|
-
compatibility: { nuxt: "^3.0.0
|
|
26
|
+
compatibility: { nuxt: "^3.0.0" }
|
|
27
27
|
},
|
|
28
28
|
defaults: DEFAULTS,
|
|
29
29
|
setup(options, nuxt) {
|
|
@@ -31,18 +31,23 @@ const module = defineNuxtModule({
|
|
|
31
31
|
const { resolve: resolveURL } = createResolver(nuxt.options.app.baseURL);
|
|
32
32
|
const { resolve } = createResolver(runtimeDir);
|
|
33
33
|
const monacoEditorLocation = resolveURL(options.dest);
|
|
34
|
+
nuxt.options.app.head.link?.push({ rel: "preload", as: "script", href: `${monacoEditorLocation}/vs/editor/editor.main.js` });
|
|
35
|
+
nuxt.options.app.head.script?.push({ src: `${monacoEditorLocation}/vs/loader.js` });
|
|
34
36
|
nuxt.options.build.transpile.push(runtimeDir);
|
|
35
37
|
nuxt.options.build.transpile.push("monaco-editor");
|
|
36
38
|
nuxt.options.runtimeConfig.app.__MONACO_EDITOR_LOCALE__ = options.locale;
|
|
37
39
|
nuxt.options.runtimeConfig.app.__MONACO_EDITOR_LOCATION__ = monacoEditorLocation;
|
|
38
40
|
extendViteConfig(async (config) => {
|
|
39
|
-
const shouldAppendURLPrefix = await checkNuxtCompatibility({ nuxt: "^3.0.0-rc.12" })
|
|
41
|
+
const shouldAppendURLPrefix = await checkNuxtCompatibility({ nuxt: "^3.0.0-rc.12" });
|
|
40
42
|
const viteStaticCopyPlugin = viteStaticCopy({
|
|
41
43
|
targets: [{
|
|
42
44
|
src: require.resolve("monaco-editor/min/vs/loader.js").replace(/\\/g, "/").replace(/\/vs\/loader\.js$/, "/*"),
|
|
43
|
-
dest: (shouldAppendURLPrefix ? "__url/" : "") + monacoEditorLocation.slice(1)
|
|
45
|
+
dest: nuxt.options.dev ? (shouldAppendURLPrefix ? "__url/" : "") + monacoEditorLocation.slice(1) : options.dest
|
|
44
46
|
}]
|
|
45
47
|
});
|
|
48
|
+
if (!config.plugins) {
|
|
49
|
+
config.plugins = [];
|
|
50
|
+
}
|
|
46
51
|
config.plugins.push(...viteStaticCopyPlugin);
|
|
47
52
|
});
|
|
48
53
|
addPlugin(resolve("plugin.client"));
|
|
@@ -3,23 +3,18 @@ import { _useMonacoState } from "./composables.mjs";
|
|
|
3
3
|
export default defineNuxtPlugin((_nuxtApp) => new Promise((resolve) => {
|
|
4
4
|
const monacoState = _useMonacoState();
|
|
5
5
|
const { __MONACO_EDITOR_LOCALE__: locale, __MONACO_EDITOR_LOCATION__: monacoLocation } = useRuntimeConfig().app;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"vs/nls": {
|
|
13
|
-
availableLanguages: {
|
|
14
|
-
"*": locale
|
|
15
|
-
}
|
|
6
|
+
require.config({ paths: { vs: `${monacoLocation}/vs` } });
|
|
7
|
+
if (locale !== "en") {
|
|
8
|
+
require.config({
|
|
9
|
+
"vs/nls": {
|
|
10
|
+
availableLanguages: {
|
|
11
|
+
"*": locale
|
|
16
12
|
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
require(["vs/editor/editor.main"], (monaco) => {
|
|
20
|
-
monacoState.value = monaco;
|
|
21
|
-
resolve();
|
|
13
|
+
}
|
|
22
14
|
});
|
|
23
|
-
}
|
|
24
|
-
|
|
15
|
+
}
|
|
16
|
+
require(["vs/editor/editor.main"], (monaco) => {
|
|
17
|
+
monacoState.value = monaco;
|
|
18
|
+
resolve();
|
|
19
|
+
});
|
|
25
20
|
}));
|
package/dist/types.d.ts
CHANGED
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.0
|
|
14
|
+
"version": "1.1.0",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"exports": {
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"_postinstall": "husky install",
|
|
31
31
|
"build": "nuxt-module-build",
|
|
32
32
|
"lint": "eslint --ext .js,.cjs,.mjs,.ts,.cts,.mts,.vue . && remark . -q",
|
|
33
|
+
"test": "nuxi test",
|
|
33
34
|
"prepack": "pinst --disable && nuxt-module-build",
|
|
34
35
|
"release": "standard-version",
|
|
35
36
|
"dev": "nuxi dev playground",
|
|
@@ -40,24 +41,27 @@
|
|
|
40
41
|
"docs:serve": "vuepress serve docs --port 3000"
|
|
41
42
|
},
|
|
42
43
|
"dependencies": {
|
|
43
|
-
"@nuxt/kit": "^3.0.0
|
|
44
|
-
"vite-plugin-static-copy": "^0.
|
|
44
|
+
"@nuxt/kit": "^3.0.0",
|
|
45
|
+
"vite-plugin-static-copy": "^0.12.0"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
|
-
"@commitlint/cli": "^17.
|
|
48
|
-
"@commitlint/config-conventional": "^17.
|
|
48
|
+
"@commitlint/cli": "^17.2.0",
|
|
49
|
+
"@commitlint/config-conventional": "^17.2.0",
|
|
49
50
|
"@nuxt/module-builder": "latest",
|
|
50
|
-
"@
|
|
51
|
-
"eslint": "
|
|
52
|
-
"
|
|
51
|
+
"@nuxt/test-utils-edge": "latest",
|
|
52
|
+
"@nuxtjs/eslint-config-typescript": "^11.0.0",
|
|
53
|
+
"eslint": "^8.27.0",
|
|
54
|
+
"husky": "^8.0.2",
|
|
53
55
|
"monaco-editor": "^0.34.1",
|
|
54
|
-
"nuxt": "3.0.0
|
|
56
|
+
"nuxt": "3.0.0",
|
|
55
57
|
"pinst": "^3.0.0",
|
|
58
|
+
"playwright": "^1.28.0",
|
|
56
59
|
"remark-cli": "^11.0.0",
|
|
57
60
|
"remark-lint": "^9.1.1",
|
|
58
61
|
"remark-preset-lint-recommended": "^6.1.2",
|
|
59
62
|
"standard-version": "^9.5.0",
|
|
60
|
-
"
|
|
63
|
+
"vitest": "^0.25.2",
|
|
64
|
+
"vuepress": "2.0.0-beta.50"
|
|
61
65
|
},
|
|
62
66
|
"peerDependencies": {
|
|
63
67
|
"monaco-editor": "*"
|
|
@@ -71,5 +75,5 @@
|
|
|
71
75
|
]
|
|
72
76
|
]
|
|
73
77
|
},
|
|
74
|
-
"packageManager": "yarn@3.2.
|
|
78
|
+
"packageManager": "yarn@3.2.4"
|
|
75
79
|
}
|