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

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,12 @@
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.3](https://github.com/e-chan1007/nuxt-monaco-editor/compare/v1.1.3-beta.0...v1.1.3) (2023-01-28)
6
6
 
7
7
 
8
- ### Bug Fixes
8
+ ### BREAKING CHANGES
9
9
 
10
- * keep compatibility with nuxt 3.0.0 ([90840f0](https://github.com/e-chan1007/nuxt-monaco-editor/commit/90840f076cb14e98067cdf7c832157f07c684ac6))
10
+ * drop support for `nuxt@^3.0.0` ([1d4d22c](https://github.com/e-chan1007/nuxt-monaco-editor/commit/1d4d22cf094abad4b2f475151483b87c6a9b4589))
11
11
 
12
12
  ### [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
13
 
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.3"
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, extendViteConfig, addPlugin, addComponent, addImports } from '@nuxt/kit';
3
3
  import { viteStaticCopy } from 'vite-plugin-static-copy';
4
4
 
5
5
 
@@ -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.1.0" }
27
27
  },
28
28
  defaults: DEFAULTS,
29
29
  setup(options, nuxt) {
@@ -31,17 +31,15 @@ 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.script?.push({ src: `${monacoEditorLocation}/vs/loader.js` });
35
34
  nuxt.options.build.transpile.push(runtimeDir);
36
35
  nuxt.options.build.transpile.push(({ isClient }) => isClient ? "monaco-editor" : false);
37
36
  nuxt.options.runtimeConfig.app.__MONACO_EDITOR_LOCALE__ = options.locale;
38
37
  nuxt.options.runtimeConfig.app.__MONACO_EDITOR_LOCATION__ = monacoEditorLocation;
39
- extendViteConfig(async (config) => {
40
- const shouldAppendURLPrefix = (await getNuxtVersion()).startsWith("3.0.0");
38
+ extendViteConfig((config) => {
41
39
  const viteStaticCopyPlugin = viteStaticCopy({
42
40
  targets: [{
43
41
  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
42
+ dest: options.dest
45
43
  }]
46
44
  });
47
45
  if (!config.plugins) {
@@ -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.3",
15
15
  "type": "module",
16
16
  "license": "MIT",
17
17
  "exports": {