nuxt-monaco-editor 1.1.3-beta.1 → 1.1.4

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 CHANGED
@@ -2,12 +2,19 @@
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.3-beta.1](https://github.com/e-chan1007/nuxt-monaco-editor/compare/v1.1.3-beta.0...v1.1.3-beta.1) (2023-01-27)
5
+ ### [1.1.4](https://github.com/e-chan1007/nuxt-monaco-editor/compare/v1.1.3...v1.1.4) (2023-02-22)
6
6
 
7
7
 
8
8
  ### Bug Fixes
9
9
 
10
- * keep compatibility with nuxt 3.0.0 ([90840f0](https://github.com/e-chan1007/nuxt-monaco-editor/commit/90840f076cb14e98067cdf7c832157f07c684ac6))
10
+ * change the directory to which `monaco-editor` will be copied ([7f88db5](https://github.com/e-chan1007/nuxt-monaco-editor/commit/7f88db5ea359ae0b91ea7664872b9f908f26994a))
11
+
12
+ ### [1.1.3](https://github.com/e-chan1007/nuxt-monaco-editor/compare/v1.1.3-beta.0...v1.1.3) (2023-01-28)
13
+
14
+
15
+ ### ⚠ BREAKING CHANGES
16
+
17
+ * drop support for `nuxt@^3.0.0` ([1d4d22c](https://github.com/e-chan1007/nuxt-monaco-editor/commit/1d4d22cf094abad4b2f475151483b87c6a9b4589))
11
18
 
12
19
  ### [1.1.3-beta.0](https://github.com/e-chan1007/nuxt-monaco-editor/compare/v1.1.2...v1.1.3-beta.0) (2023-01-27)
13
20
 
package/dist/module.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "nuxt-monaco-editor",
3
3
  "configKey": "monacoEditor",
4
4
  "compatibility": {
5
- "nuxt": "^3.0.0"
5
+ "nuxt": "^3.1.0"
6
6
  },
7
- "version": "1.1.3-beta.1"
7
+ "version": "1.1.4"
8
8
  }
package/dist/module.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { fileURLToPath } from 'url';
2
- import { defineNuxtModule, createResolver, extendViteConfig, getNuxtVersion, addPlugin, addComponent, addImports } from '@nuxt/kit';
2
+ import { defineNuxtModule, createResolver, addVitePlugin, addPlugin, addComponent, addImports } from '@nuxt/kit';
3
3
  import { viteStaticCopy } from 'vite-plugin-static-copy';
4
4
 
5
5
 
@@ -23,32 +23,27 @@ 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.1.0" }
27
27
  },
28
28
  defaults: DEFAULTS,
29
29
  setup(options, nuxt) {
30
+ const isDev = nuxt.options.dev;
31
+ options.dest = (isDev ? "_nuxt_monaco_editor/" : "_nuxt/") + options.dest;
30
32
  const runtimeDir = fileURLToPath(new URL("./runtime", import.meta.url));
31
33
  const { resolve: resolveURL } = createResolver(nuxt.options.app.baseURL);
32
34
  const { resolve } = createResolver(runtimeDir);
33
35
  const monacoEditorLocation = resolveURL(options.dest);
34
- nuxt.options.app.head.script?.push({ src: `${monacoEditorLocation}/vs/loader.js` });
35
36
  nuxt.options.build.transpile.push(runtimeDir);
36
37
  nuxt.options.build.transpile.push(({ isClient }) => isClient ? "monaco-editor" : false);
37
38
  nuxt.options.runtimeConfig.app.__MONACO_EDITOR_LOCALE__ = options.locale;
38
39
  nuxt.options.runtimeConfig.app.__MONACO_EDITOR_LOCATION__ = monacoEditorLocation;
39
- extendViteConfig(async (config) => {
40
- const shouldAppendURLPrefix = (await getNuxtVersion()).startsWith("3.0.0");
41
- const viteStaticCopyPlugin = viteStaticCopy({
42
- targets: [{
43
- src: require.resolve("monaco-editor/min/vs/loader.js").replace(/\\/g, "/").replace(/\/vs\/loader\.js$/, "/*"),
44
- dest: nuxt.options.dev ? (shouldAppendURLPrefix ? "__url/" : "") + monacoEditorLocation.slice(1) : options.dest
45
- }]
46
- });
47
- if (!config.plugins) {
48
- config.plugins = [];
49
- }
50
- config.plugins.push(...viteStaticCopyPlugin);
40
+ const viteStaticCopyPlugin = viteStaticCopy({
41
+ targets: [{
42
+ src: require.resolve("monaco-editor/min/vs/loader.js").replace(/\\/g, "/").replace(/\/vs\/loader\.js$/, "/*"),
43
+ dest: options.dest
44
+ }]
51
45
  });
46
+ addVitePlugin(viteStaticCopyPlugin);
52
47
  addPlugin(resolve("plugin.client"));
53
48
  addComponent({ name: options.componentName.codeEditor, filePath: resolve("MonacoEditor.vue") });
54
49
  addComponent({ name: options.componentName.diffEditor, filePath: resolve("MonacoDiffEditor.vue") });
@@ -2,19 +2,24 @@ import { defineNuxtPlugin, useRuntimeConfig } from "#app";
2
2
  import { _useMonacoState } from "./composables.mjs";
3
3
  export default defineNuxtPlugin((_nuxtApp) => new Promise((resolve) => {
4
4
  const monacoState = _useMonacoState();
5
- const { __MONACO_EDITOR_LOCALE__: locale, __MONACO_EDITOR_LOCATION__: monacoLocation } = useRuntimeConfig().app;
6
- require.config({ paths: { vs: `${monacoLocation}/vs` } });
7
- if (locale !== "en") {
8
- require.config({
9
- "vs/nls": {
10
- availableLanguages: {
11
- "*": locale
5
+ const { __MONACO_EDITOR_LOCALE__: locale, __MONACO_EDITOR_LOCATION__: monacoEditorLocation } = useRuntimeConfig().app;
6
+ const loaderScript = document.createElement("script");
7
+ loaderScript.src = `${monacoEditorLocation}/vs/loader.js`;
8
+ loaderScript.addEventListener("load", () => {
9
+ require.config({ paths: { vs: `${monacoEditorLocation}/vs` } });
10
+ if (locale !== "en") {
11
+ require.config({
12
+ "vs/nls": {
13
+ availableLanguages: {
14
+ "*": locale
15
+ }
12
16
  }
13
- }
17
+ });
18
+ }
19
+ require(["vs/editor/editor.main"], (monaco) => {
20
+ monacoState.value = monaco;
21
+ resolve();
14
22
  });
15
- }
16
- require(["vs/editor/editor.main"], (monaco) => {
17
- monacoState.value = monaco;
18
- resolve();
19
23
  });
24
+ document.body.appendChild(loaderScript);
20
25
  }));
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.1.3-beta.1",
14
+ "version": "1.1.4",
15
15
  "type": "module",
16
16
  "license": "MIT",
17
17
  "exports": {
@@ -42,28 +42,28 @@
42
42
  "docs:preview": "nuxt preview docs"
43
43
  },
44
44
  "dependencies": {
45
- "@nuxt/kit": "^3.1.1",
45
+ "@nuxt/kit": "^3.2.2",
46
46
  "vite-plugin-static-copy": "^0.13.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@commitlint/cli": "^17.4.2",
50
- "@commitlint/config-conventional": "^17.4.2",
51
- "@nuxt-themes/docus": "^1.6.3",
49
+ "@commitlint/cli": "^17.4.4",
50
+ "@commitlint/config-conventional": "^17.4.4",
51
+ "@nuxt-themes/docus": "^1.8.3",
52
52
  "@nuxt/module-builder": "latest",
53
- "@nuxt/test-utils": "^3.1.1",
53
+ "@nuxt/test-utils": "^3.2.2",
54
54
  "@nuxtjs/eslint-config-typescript": "^12.0.0",
55
- "eslint": "^8.32.0",
56
- "execa": "^6.1.0",
55
+ "eslint": "^8.34.0",
56
+ "execa": "^7.0.0",
57
57
  "husky": "^8.0.3",
58
- "monaco-editor": "^0.34.1",
59
- "nuxt": "^3.1.1",
58
+ "monaco-editor": "^0.35.0",
59
+ "nuxt": "^3.2.2",
60
60
  "pinst": "^3.0.0",
61
- "playwright": "^1.30.0",
61
+ "playwright": "^1.31.0",
62
62
  "remark-cli": "^11.0.0",
63
63
  "remark-lint": "^9.1.1",
64
64
  "remark-preset-lint-recommended": "^6.1.2",
65
65
  "standard-version": "^9.5.0",
66
- "vitest": "^0.28.3"
66
+ "vitest": "^0.28.5"
67
67
  },
68
68
  "peerDependencies": {
69
69
  "monaco-editor": "*"