@bootstrap-vue-next/nuxt 0.16.2 → 0.16.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/dist/module.d.mts CHANGED
@@ -1,16 +1,23 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
- import { Composables } from 'bootstrap-vue-next';
2
+ import { Composables, Directives } from 'bootstrap-vue-next';
3
3
 
4
4
  type ConfigurationOption<T extends string> = Partial<Record<T, boolean>> & {
5
5
  all: boolean;
6
6
  };
7
+ type ConfigurationValue<T extends string> = boolean | ConfigurationOption<T>;
7
8
  interface ModuleOptions {
8
9
  /**
9
10
  * There would be no reason to disable this, beyond conflicting auto imports. This should probably be left true
10
11
  *
11
12
  * @default true
12
13
  */
13
- composables: ConfigurationOption<keyof typeof Composables> | boolean;
14
+ composables: ConfigurationValue<keyof typeof Composables>;
15
+ /**
16
+ * There would be no reason to disable this, beyond conflicting auto imports. This should probably be left true
17
+ *
18
+ * @default true
19
+ */
20
+ directives: ConfigurationValue<keyof typeof Directives>;
14
21
  }
15
22
 
16
23
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
package/dist/module.d.ts CHANGED
@@ -1,16 +1,23 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
- import { Composables } from 'bootstrap-vue-next';
2
+ import { Composables, Directives } from 'bootstrap-vue-next';
3
3
 
4
4
  type ConfigurationOption<T extends string> = Partial<Record<T, boolean>> & {
5
5
  all: boolean;
6
6
  };
7
+ type ConfigurationValue<T extends string> = boolean | ConfigurationOption<T>;
7
8
  interface ModuleOptions {
8
9
  /**
9
10
  * There would be no reason to disable this, beyond conflicting auto imports. This should probably be left true
10
11
  *
11
12
  * @default true
12
13
  */
13
- composables: ConfigurationOption<keyof typeof Composables> | boolean;
14
+ composables: ConfigurationValue<keyof typeof Composables>;
15
+ /**
16
+ * There would be no reason to disable this, beyond conflicting auto imports. This should probably be left true
17
+ *
18
+ * @default true
19
+ */
20
+ directives: ConfigurationValue<keyof typeof Directives>;
14
21
  }
15
22
 
16
23
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
package/dist/module.json CHANGED
@@ -5,5 +5,5 @@
5
5
  "nuxt": "^3.0.0",
6
6
  "bridge": false
7
7
  },
8
- "version": "0.16.2"
8
+ "version": "0.16.3"
9
9
  }
package/dist/module.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { addComponent, defineNuxtModule, createResolver, addPlugin, addImports } from '@nuxt/kit';
2
- import { Components, Composables } from 'bootstrap-vue-next';
2
+ import { Components, Directives, Composables } from 'bootstrap-vue-next';
3
3
 
4
4
  const useComponents = () => {
5
5
  Object.keys(Components).forEach((name) => {
@@ -23,6 +23,10 @@ const parseActiveImports = (options, values) => {
23
23
  return Object.entries(merge).filter(([name, value]) => !!value && values.includes(name)).map(([name]) => name);
24
24
  };
25
25
 
26
+ const normalizeConfigurationValue = (option) => {
27
+ return typeof option === "boolean" ? { all: option } : option;
28
+ };
29
+
26
30
  const module = defineNuxtModule({
27
31
  meta: {
28
32
  name: "bootstrap-vue-next",
@@ -33,41 +37,45 @@ const module = defineNuxtModule({
33
37
  }
34
38
  },
35
39
  defaults: {
36
- composables: true
40
+ composables: true,
41
+ directives: true
37
42
  },
38
43
  setup(options, nuxt) {
39
44
  const { resolve } = createResolver(import.meta.url);
40
- addPlugin(resolve("./runtime/plugins/createBootstrap"));
41
- const normalizedComposableOptions = typeof options.composables === "boolean" ? { all: options.composables } : options.composables;
42
45
  nuxt.options.build.transpile.push(resolve("./runtime"));
43
- const transformAssetUrls = {
44
- BImg: ["src"]
45
- };
46
- if (nuxt.options.vite.vue === void 0) {
47
- nuxt.options.vite.vue = {
48
- template: {
49
- transformAssetUrls
50
- }
51
- };
52
- } else if (nuxt.options.vite.vue.template === void 0) {
53
- nuxt.options.vite.vue.template = {
54
- transformAssetUrls
55
- };
56
- } else if (nuxt.options.vite.vue.template.transformAssetUrls === void 0) {
57
- nuxt.options.vite.vue.template.transformAssetUrls = transformAssetUrls;
58
- } else if (
59
- // Do not overwrite user options
60
- !(typeof nuxt.options.vite.vue.template.transformAssetUrls !== "boolean" && ("BImg" in nuxt.options.vite.vue.template.transformAssetUrls || "b-img" in nuxt.options.vite.vue.template.transformAssetUrls))
61
- ) {
62
- Object.assign(nuxt.options.vite.vue.template.transformAssetUrls, transformAssetUrls);
63
- }
46
+ nuxt.options.css.push("bootstrap-vue-next/dist/bootstrap-vue-next.css");
47
+ const normalizedComposableOptions = normalizeConfigurationValue(options.composables);
48
+ const normalizedDirectiveOptions = normalizeConfigurationValue(options.directives);
64
49
  nuxt.options.css.push("bootstrap-vue-next/dist/bootstrap-vue-next.css");
65
50
  nuxt.options.vite.optimizeDeps = nuxt.options.vite.optimizeDeps || {};
66
51
  nuxt.options.vite.optimizeDeps.include = nuxt.options.vite.optimizeDeps.include || [];
67
52
  nuxt.options.vite.optimizeDeps.include.push("bootstrap-vue-next");
53
+ addPlugin(resolve("./runtime/createBootstrap"));
54
+ const transformAssetUrls = Object.freeze({
55
+ BImg: ["src"]
56
+ });
57
+ nuxt.options.vite.vue = nuxt.options.vite.vue || {};
58
+ nuxt.options.vite.vue.template = nuxt.options.vite.vue.template || {};
59
+ nuxt.options.vite.vue.template.transformAssetUrls = nuxt.options.vite.vue.template.transformAssetUrls ?? {};
60
+ if (typeof nuxt.options.vite.vue.template.transformAssetUrls !== "boolean" && !("BImg" in nuxt.options.vite.vue.template.transformAssetUrls || "b-img" in nuxt.options.vite.vue.template.transformAssetUrls)) {
61
+ nuxt.options.vite.vue.template.transformAssetUrls = {
62
+ ...nuxt.options.vite.vue.template.transformAssetUrls,
63
+ ...transformAssetUrls
64
+ };
65
+ }
68
66
  useComponents();
67
+ if (Object.values(normalizedDirectiveOptions).some((el) => el === true)) {
68
+ const activeDirectives = parseActiveImports(
69
+ normalizedDirectiveOptions,
70
+ Object.keys(Directives)
71
+ );
72
+ nuxt.options.runtimeConfig.public.bootstrapVueNext = {
73
+ directives: activeDirectives
74
+ };
75
+ addPlugin(resolve("./runtime/useDirectives"));
76
+ }
69
77
  if (Object.values(normalizedComposableOptions).some((el) => el === true)) {
70
- parseActiveImports(normalizedComposableOptions, Object.keys(Composables)).map(
78
+ parseActiveImports(normalizedComposableOptions, Object.keys(Composables)).forEach(
71
79
  (name) => addImports({
72
80
  from: "bootstrap-vue-next",
73
81
  name
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -1,5 +1,5 @@
1
1
  import { createBootstrap } from "bootstrap-vue-next";
2
- import { defineNuxtPlugin } from "nuxt/app";
2
+ import { defineNuxtPlugin } from "#imports";
3
3
  export default defineNuxtPlugin((nuxtApp) => {
4
4
  nuxtApp.vueApp.use(
5
5
  createBootstrap({
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,20 @@
1
+ import { Directives } from "bootstrap-vue-next";
2
+ import { defineNuxtPlugin, useRuntimeConfig } from "#imports";
3
+ export default defineNuxtPlugin((nuxtApp) => {
4
+ const usedDirectives = useRuntimeConfig().public.bootstrapVueNext.directives;
5
+ const directiveValues = Object.entries(Directives);
6
+ const result = directiveValues.reduce(
7
+ (acc, [key, value]) => {
8
+ if (usedDirectives.includes(key)) {
9
+ acc[key] = value;
10
+ }
11
+ return acc;
12
+ },
13
+ {}
14
+ );
15
+ const sliceName = (str) => str.toLowerCase().startsWith("v") ? str.slice(1) : str;
16
+ Object.entries(result).forEach(([key, value]) => {
17
+ const parsedName = sliceName(key);
18
+ nuxtApp.vueApp.directive(parsedName, value);
19
+ });
20
+ });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bootstrap-vue-next/nuxt",
3
3
  "description": "Nuxt Module for BootstrapVueNext",
4
- "version": "0.16.2",
4
+ "version": "0.16.3",
5
5
  "license": "MIT",
6
6
  "author": {
7
7
  "name": "Issayah",
@@ -21,27 +21,27 @@
21
21
  ],
22
22
  "types": "./dist/types.d.ts",
23
23
  "peerDependencies": {
24
- "bootstrap-vue-next": "^0.16.2"
24
+ "bootstrap-vue-next": "^0.16.3"
25
25
  },
26
26
  "dependencies": {
27
- "@nuxt/kit": "^3.9.1"
27
+ "@nuxt/kit": "^3.10.1"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@nuxt/devtools": "^1.0.8",
31
31
  "@nuxt/eslint-config": "^0.2.0",
32
32
  "@nuxt/module-builder": "^0.5.5",
33
- "@nuxt/schema": "^3.9.1",
34
- "@nuxt/test-utils": "^3.9.0",
35
- "@rushstack/eslint-patch": "^1.6.1",
36
- "@types/node": "^20.11.4",
33
+ "@nuxt/schema": "^3.10.1",
34
+ "@nuxt/test-utils": "^3.11.0",
35
+ "@rushstack/eslint-patch": "^1.7.2",
36
+ "@types/node": "^20.11.17",
37
37
  "@vue/eslint-config-prettier": "^9.0.0",
38
38
  "eslint": "^8.56.0",
39
39
  "eslint-define-config": "^2.1.0",
40
- "nuxt": "^3.9.1",
41
- "prettier": "^3.2.2",
40
+ "nuxt": "^3.10.1",
41
+ "prettier": "^3.2.5",
42
42
  "unimport": "^3.7.1",
43
- "vue": "^3.4.14",
44
- "bootstrap-vue-next": "^0.16.2"
43
+ "vue": "^3.4.18",
44
+ "bootstrap-vue-next": "^0.16.3"
45
45
  },
46
46
  "repository": {
47
47
  "type": "git",
@@ -1,2 +0,0 @@
1
- declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
2
- export default _default;