nuxt-charts 2.1.0-beta-3 → 2.1.0-beta-5

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/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3"
6
6
  },
7
- "version": "2.1.0-beta-3",
7
+ "version": "2.1.0-beta-5",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "unknown"
package/dist/module.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { addComponent, addImportsSources, defineNuxtModule, createResolver } from '@nuxt/kit';
2
2
 
3
3
  const resolveComponents = (config, filePath) => {
4
- const { prefix } = config;
4
+ const { prefix, include, global } = config;
5
5
  const allComponents = [
6
6
  "AreaChart",
7
7
  "LineChart",
@@ -15,26 +15,22 @@ const resolveComponents = (config, filePath) => {
15
15
  "TopoJSONMap",
16
16
  "DottedMap"
17
17
  ];
18
- allComponents.forEach((component) => {
19
- if (typeof component === "string") {
20
- addComponent({
21
- export: component,
22
- name: prefix + component,
23
- mode: "client",
24
- filePath
25
- });
26
- } else if (Array.isArray(component)) {
27
- addComponent({
28
- export: component[0],
29
- name: prefix + component[1],
30
- mode: "client",
31
- filePath
32
- });
33
- }
18
+ const components = include?.length ? allComponents.filter((component) => include.includes(component)) : allComponents;
19
+ components.forEach((component) => {
20
+ addComponent({
21
+ export: component,
22
+ name: prefix + component,
23
+ mode: "client",
24
+ global,
25
+ filePath
26
+ });
34
27
  });
35
28
  };
36
29
 
37
- const resolveImports = (_, filePath) => {
30
+ const resolveImports = (config, filePath) => {
31
+ if (!config.autoImports) {
32
+ return;
33
+ }
38
34
  const allTypes = ["BulletLegendItemInterface", "MarkerConfig", "CrosshairConfig", "AxisConfig", "MapRegion", "MapPin"];
39
35
  addImportsSources({
40
36
  from: filePath,
@@ -64,10 +60,17 @@ const module = defineNuxtModule({
64
60
  },
65
61
  moduleDependencies: {},
66
62
  async setup(options, nuxt) {
67
- nuxt.options.build.transpile = [
68
- "vue-chrts",
69
- ...nuxt.options.build.transpile
70
- ];
63
+ const deps = ["vue-chrts", "@unovis/ts", "@unovis/vue"];
64
+ nuxt.options.vite.optimizeDeps = nuxt.options.vite.optimizeDeps || {};
65
+ nuxt.options.vite.optimizeDeps.include = nuxt.options.vite.optimizeDeps.include || [];
66
+ nuxt.options.vite.optimizeDeps.include.push(...deps);
67
+ nuxt.options.build.transpile = nuxt.options.build.transpile || [];
68
+ nuxt.options.build.transpile.push(...deps);
69
+ nuxt.options.vite.ssr = nuxt.options.vite.ssr || {};
70
+ nuxt.options.vite.ssr.noExternal = nuxt.options.vite.ssr.noExternal || [];
71
+ if (Array.isArray(nuxt.options.vite.ssr.noExternal)) {
72
+ nuxt.options.vite.ssr.noExternal.push(...deps);
73
+ }
71
74
  const { resolve } = createResolver(import.meta.url);
72
75
  const runtimePath = resolve("./runtime/vue-chrts");
73
76
  resolveImports(options, runtimePath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-charts",
3
- "version": "2.1.0-beta-3",
3
+ "version": "2.1.0-beta-5",
4
4
  "description": "Nuxt module for vue-chrts",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -18,7 +18,7 @@
18
18
  "dependencies": {
19
19
  "@unovis/ts": "^1.6.2",
20
20
  "@unovis/vue": "^1.6.2",
21
- "vue-chrts": "2.1.0-beta-3"
21
+ "vue-chrts": "2.1.0-beta-5"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@nuxt/eslint": "^1.7.1",