nuxt-monaco-editor 1.0.0 → 1.0.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,4 +2,13 @@
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.0.1](https://github.com/e-chan1007/nuxt-monaco-editor/compare/v1.0.0...v1.0.1) (2022-08-26)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * fix monaco base path ([25ef917](https://github.com/e-chan1007/nuxt-monaco-editor/commit/25ef91748507fc88bdf3710a372b96f4c5076da1))
11
+ * follow `app.baseURL` in nuxt.config ([1946988](https://github.com/e-chan1007/nuxt-monaco-editor/commit/1946988a839d036df2cac17e94877c561109cc97))
12
+ * replace `\\` in path with `/` (for windows) ([ea0084e](https://github.com/e-chan1007/nuxt-monaco-editor/commit/ea0084e03a83b1f9e73c51ef979bc77e8f645c43))
13
+
5
14
  ## 1.0.0 (2022-08-25)
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # nuxt-monaco-editor
1
+ # Nuxt Monaco Editor
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)
@@ -35,6 +35,7 @@ export default defineNuxtConfig({
35
35
  export default defineNuxtConfig({
36
36
  monacoEditor: {
37
37
  // These are default values:
38
+ dest: '_monaco',
38
39
  locale: 'en',
39
40
  componentName: {
40
41
  codeEditor: 'MonacoEditor',
package/dist/module.d.ts CHANGED
@@ -2,6 +2,7 @@ import * as _nuxt_schema from '@nuxt/schema';
2
2
 
3
3
  declare type MonacoEditorLocale = 'de' | 'es' | 'fr' | 'it' | 'ja' | 'ko' | 'ru' | 'zh-cn' | 'zh-tw' | 'en';
4
4
  interface ModuleOptions {
5
+ dest?: string;
5
6
  locale?: MonacoEditorLocale;
6
7
  componentName?: {
7
8
  codeEditor?: string;
package/dist/module.json CHANGED
@@ -4,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "1.0.0"
7
+ "version": "1.0.1"
8
8
  }
package/dist/module.mjs CHANGED
@@ -12,6 +12,7 @@ const require = __cjs_mod__.createRequire(import.meta.url);
12
12
 
13
13
 
14
14
  const DEFAULTS = {
15
+ dest: "_monaco",
15
16
  locale: "en",
16
17
  componentName: {
17
18
  codeEditor: "MonacoEditor",
@@ -27,14 +28,17 @@ const module = defineNuxtModule({
27
28
  defaults: DEFAULTS,
28
29
  setup(options, nuxt) {
29
30
  const runtimeDir = fileURLToPath(new URL("./runtime", import.meta.url));
31
+ const { resolve: resolveURL } = createResolver(nuxt.options.app.baseURL);
30
32
  const { resolve } = createResolver(runtimeDir);
33
+ const monacoEditorLocation = resolveURL(options.dest);
31
34
  nuxt.options.build.transpile.push(runtimeDir);
32
35
  nuxt.options.build.transpile.push("monaco-editor");
33
36
  nuxt.options.runtimeConfig.app.__MONACO_EDITOR_LOCALE__ = options.locale;
37
+ nuxt.options.runtimeConfig.app.__MONACO_EDITOR_LOCATION__ = monacoEditorLocation;
34
38
  const [viteStaticCopyServePlugin, viteStaticCopyBuildPlugin] = viteStaticCopy({
35
39
  targets: [{
36
- src: require.resolve("monaco-editor/min/vs/loader.js").replace(/\/vs\/loader\.js$/, "/*"),
37
- dest: "_monaco"
40
+ src: require.resolve("monaco-editor/min/vs/loader.js").replace(/\\/g, "/").replace(/\/vs\/loader\.js$/, "/*"),
41
+ dest: monacoEditorLocation.slice(1)
38
42
  }]
39
43
  });
40
44
  addVitePlugin(viteStaticCopyServePlugin);
@@ -2,11 +2,11 @@ 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 locale = useRuntimeConfig().app.__MONACO_EDITOR_LOCALE__;
5
+ const { __MONACO_EDITOR_LOCALE__: locale, __MONACO_EDITOR_LOCATION__: monacoLocation } = useRuntimeConfig().app;
6
6
  const script = document.createElement("script");
7
- script.src = "/_monaco/vs/loader.js";
7
+ script.src = `${monacoLocation}/vs/loader.js`;
8
8
  script.onload = () => {
9
- require.config({ paths: { vs: "_monaco/vs" } });
9
+ require.config({ paths: { vs: `${monacoLocation}/vs` } });
10
10
  if (locale !== "en") {
11
11
  require.config({
12
12
  "vs/nls": {
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "type": "git",
6
6
  "url": "https://github.com/e-chan1007/nuxt-monaco-editor.git"
7
7
  },
8
- "version": "1.0.0",
8
+ "version": "1.0.1",
9
9
  "type": "module",
10
10
  "license": "MIT",
11
11
  "exports": {