nuxt-monaco-editor 1.0.6 → 1.1.1

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,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.1](https://github.com/e-chan1007/nuxt-monaco-editor/compare/v1.1.0...v1.1.1) (2022-12-09)
6
+
7
+
8
+ ### Features
9
+
10
+ * adjust timings of emitting `load` event ([c7b7796](https://github.com/e-chan1007/nuxt-monaco-editor/commit/c7b7796ec88be107a1d13a0a6c48473b4e858ebf))
11
+
12
+ ## [1.1.0](https://github.com/e-chan1007/nuxt-monaco-editor/compare/v1.0.6...v1.1.0) (2022-11-18)
13
+
14
+
15
+ ### Features
16
+
17
+ * set preload header ([ae92e18](https://github.com/e-chan1007/nuxt-monaco-editor/commit/ae92e18ef5fbd77114b6350526ad29313047c81e))
18
+ * upgrade nuxt ([7463610](https://github.com/e-chan1007/nuxt-monaco-editor/commit/7463610724557fdffeae450a359160c3ef26ef0c))
19
+
5
20
  ### [1.0.6](https://github.com/e-chan1007/nuxt-monaco-editor/compare/v1.0.5...v1.0.6) (2022-10-26)
6
21
 
7
22
 
package/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
  [![npm version](https://badge.fury.io/js/nuxt-monaco-editor.svg)](https://badge.fury.io/js/nuxt-monaco-editor)
3
3
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
4
  [![Codacy Badge](https://app.codacy.com/project/badge/Grade/8b4585be9901491795f8b3c2f5dbb680)](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
+ [![Test result](https://github.com/e-chan1007/nuxt-monaco-editor/actions/workflows/test.yml/badge.svg)](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
@@ -2,7 +2,7 @@
2
2
  "name": "nuxt-monaco-editor",
3
3
  "configKey": "monacoEditor",
4
4
  "compatibility": {
5
- "nuxt": "^3.0.0-rc.9"
5
+ "nuxt": "^3.0.0"
6
6
  },
7
- "version": "1.0.6"
7
+ "version": "1.1.1"
8
8
  }
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-rc.9" }
26
+ compatibility: { nuxt: "^3.0.0" }
27
27
  },
28
28
  defaults: DEFAULTS,
29
29
  setup(options, nuxt) {
@@ -31,6 +31,8 @@ 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;
@@ -43,6 +45,9 @@ const module = defineNuxtModule({
43
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"));
@@ -18,7 +18,7 @@ interface Props {
18
18
  /**
19
19
  * Options passed to the second argument of `monaco.editor.createDiffEditor`
20
20
  */
21
- options?: Monaco.editor.IStandaloneDiffEditorConstructionOptions
21
+ options?: Monaco.editor.IStandaloneDiffEditorConstructionOptions;
22
22
  original?: string;
23
23
  modelValue?: string;
24
24
  }
@@ -77,7 +77,6 @@ defineExpose({
77
77
  onMounted(() => {
78
78
  editor = monaco.editor.createDiffEditor(editorElement.value!, props.options)
79
79
  editorRef.value = editor
80
- emit('load', editor)
81
80
  originalModel = monaco.editor.createModel(props.original, props.lang)
82
81
  modifiedModel = monaco.editor.createModel(props.modelValue, props.lang)
83
82
  editor.setModel({
@@ -90,5 +89,6 @@ onMounted(() => {
90
89
  })
91
90
 
92
91
  isLoading.value = false
92
+ emit('load', editor)
93
93
  })
94
94
  </script>
@@ -5,9 +5,8 @@
5
5
  </template>
6
6
 
7
7
  <script lang="ts" setup>
8
- import { computed } from '@vue/reactivity'
9
8
  import type * as Monaco from 'monaco-editor'
10
- import { onMounted, ref, watch } from 'vue'
9
+ import { computed, onMounted, ref, watch } from 'vue'
11
10
  import { useMonaco } from './composables'
12
11
 
13
12
  interface Props {
@@ -19,7 +18,7 @@ interface Props {
19
18
  /**
20
19
  * Options passed to the second argument of `monaco.editor.create`
21
20
  */
22
- options?: Monaco.editor.IStandaloneEditorConstructionOptions
21
+ options?: Monaco.editor.IStandaloneEditorConstructionOptions;
23
22
  modelValue?: string;
24
23
  }
25
24
 
@@ -69,14 +68,12 @@ defineExpose({
69
68
  onMounted(() => {
70
69
  editor = monaco.editor.create(editorElement.value!, props.options)
71
70
  editorRef.value = editor
72
- emit('load', editor)
73
71
  model = monaco.editor.createModel(props.modelValue, lang.value)
74
72
  editor.setModel(model)
75
-
76
73
  editor.onDidChangeModelContent(() => {
77
74
  emit('update:modelValue', editor.getValue())
78
75
  })
79
-
80
76
  isLoading.value = false
77
+ emit('load', editor)
81
78
  })
82
79
  </script>
@@ -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
- const script = document.createElement("script");
7
- script.src = `${monacoLocation}/vs/loader.js`;
8
- script.onload = () => {
9
- require.config({ paths: { vs: `${monacoLocation}/vs` } });
10
- if (locale !== "en") {
11
- require.config({
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
- document.head.appendChild(script);
15
+ }
16
+ require(["vs/editor/editor.main"], (monaco) => {
17
+ monacoState.value = monaco;
18
+ resolve();
19
+ });
25
20
  }));
package/dist/types.d.ts CHANGED
@@ -7,4 +7,4 @@ declare module '@nuxt/schema' {
7
7
  }
8
8
 
9
9
 
10
- export { default } from './module'
10
+ export { ModuleOptions, MonacoEditorLocale, default } from './module'
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.6",
14
+ "version": "1.1.1",
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-rc.12",
44
- "vite-plugin-static-copy": "^0.9.0"
44
+ "@nuxt/kit": "^3.0.0",
45
+ "vite-plugin-static-copy": "^0.12.0"
45
46
  },
46
47
  "devDependencies": {
47
- "@commitlint/cli": "^17.1.2",
48
- "@commitlint/config-conventional": "^17.1.0",
48
+ "@commitlint/cli": "^17.3.0",
49
+ "@commitlint/config-conventional": "^17.3.0",
49
50
  "@nuxt/module-builder": "latest",
50
- "@nuxtjs/eslint-config-typescript": "latest",
51
- "eslint": "latest",
52
- "husky": "^8.0.1",
51
+ "@nuxt/test-utils-edge": "latest",
52
+ "@nuxtjs/eslint-config-typescript": "^12.0.0",
53
+ "eslint": "^8.29.0",
54
+ "husky": "^8.0.2",
53
55
  "monaco-editor": "^0.34.1",
54
- "nuxt": "3.0.0-rc.12",
56
+ "nuxt": "3.0.0",
55
57
  "pinst": "^3.0.0",
58
+ "playwright": "^1.28.1",
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
- "vuepress": "2.0.0-beta.51"
63
+ "vitest": "^0.25.6",
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.2"
78
+ "packageManager": "yarn@3.2.4"
75
79
  }