@vue-solana/nuxt 2.4.0 → 2.6.0

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.cjs CHANGED
@@ -1,6 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  const kit = require('@nuxt/kit');
4
+ const node_fs = require('node:fs');
5
+ const node_path = require('node:path');
6
+ const node_module = require('node:module');
4
7
 
5
8
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
6
9
  const SOLANA_COMPOSABLE_IMPORTS = [
@@ -31,15 +34,38 @@ const SOLANA_COMPOSABLE_IMPORTS = [
31
34
  ["useTokenAccounts", "useSolanaTokenAccounts"],
32
35
  ["useTokenBalance", "useSolanaTokenBalance"],
33
36
  ["useTrackedData", "useSolanaTrackedData"],
37
+ ["useTransaction", "useSolanaTransaction"],
34
38
  ["useTransactionConfirmation", "useSolanaTransactionConfirmation"],
35
39
  ["useWallet", "useSolanaWallet"],
36
40
  ["useWallets", "useSolanaWallets"]
37
41
  ];
38
- const SOLANA_IMPORTS = SOLANA_COMPOSABLE_IMPORTS.map(([name, as]) => ({
39
- name,
40
- as,
41
- from: `@vue-solana/vue/${name}`
42
- }));
42
+ const SOLANA_SWR_IMPORTS = [
43
+ ["useRequestSwr", "useSolanaRequestSwr"],
44
+ ["useSubscriptionSwr", "useSolanaSubscriptionSwr"],
45
+ ["useTrackedDataSwr", "useSolanaTrackedDataSwr"]
46
+ ];
47
+ const SOLANA_SETUP_IMPORTS = [
48
+ ["createSelectedWalletAccountContext", "createSelectedWalletAccountContext"],
49
+ ["createSolanaPlugin", "createSolanaPlugin"],
50
+ ["selectedWalletAccountInjectionKey", "selectedWalletAccountInjectionKey"],
51
+ ["solanaInjectionKey", "solanaInjectionKey"]
52
+ ];
53
+ function solanaAutoImports(vueDist) {
54
+ return [
55
+ ...SOLANA_COMPOSABLE_IMPORTS.map(([name, as]) => ({
56
+ name,
57
+ as,
58
+ from: vueSource(vueDist, name)
59
+ })),
60
+ ...SOLANA_SWR_IMPORTS.map(([name, as]) => ({ name, as, from: vueSource(vueDist, "swr") }))
61
+ ];
62
+ }
63
+ function solanaSetupAutoImports(vueDist) {
64
+ return SOLANA_SETUP_IMPORTS.map(([name, as]) => ({ name, as, from: vueSource(vueDist) }));
65
+ }
66
+ function vueSource(vueDist, subpath = "index") {
67
+ return vueDist ? node_path.join(vueDist, `${subpath}.mjs`) : `@vue-solana/vue/${subpath}`;
68
+ }
43
69
 
44
70
  const VITE_OPTIMIZE_DEPS = [
45
71
  "@vue-solana/nuxt > @vue-solana/vue > @vue-solana/core > @solana-mobile/wallet-standard-mobile",
@@ -73,6 +99,7 @@ const module$1 = kit.defineNuxtModule({
73
99
  ...options
74
100
  });
75
101
  mergeViteOptimizeDeps(nuxt.options.vite);
102
+ const vueDist = resolveVueDist();
76
103
  nuxt.hook("vite:extendConfig", (config, { isClient }) => {
77
104
  if (!isClient) {
78
105
  return;
@@ -87,8 +114,10 @@ const module$1 = kit.defineNuxtModule({
87
114
  src: resolver.resolve("./runtime/plugin"),
88
115
  mode: "client"
89
116
  });
117
+ kit.addImports(solanaAutoImports(vueDist));
118
+ return;
90
119
  }
91
- kit.addImports(SOLANA_IMPORTS);
120
+ kit.addImports([...solanaAutoImports(vueDist), ...solanaSetupAutoImports(vueDist)]);
92
121
  }
93
122
  });
94
123
  function toPublicSolanaConfig(options) {
@@ -108,5 +137,18 @@ function mergeViteOptimizeDeps(target) {
108
137
  /* @__PURE__ */ new Set([...target.optimizeDeps.needsInterop ?? [], ...VITE_NEEDS_INTEROP])
109
138
  );
110
139
  }
140
+ function resolveVueDist() {
141
+ const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('module.cjs', document.baseURI).href)));
142
+ try {
143
+ return node_path.dirname(require$1.resolve("@vue-solana/vue"));
144
+ } catch {
145
+ for (const dir of require$1.resolve.paths("@vue-solana/vue") ?? []) {
146
+ if (node_fs.existsSync(node_path.join(dir, "@vue-solana/vue/package.json"))) {
147
+ return node_path.join(dir, "@vue-solana/vue/dist");
148
+ }
149
+ }
150
+ return void 0;
151
+ }
152
+ }
111
153
 
112
154
  module.exports = module$1;
package/dist/module.d.cts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { defineNuxtModule } from '@nuxt/kit';
2
2
  import { VueSolanaPluginOptions } from '@vue-solana/vue';
3
+ export * from '@vue-solana/vue';
3
4
 
4
5
  type ModuleOptions = Omit<VueSolanaPluginOptions, "wallet" | "payer" | "payerSecretKey"> & {
5
6
  /**
@@ -10,6 +11,7 @@ type ModuleOptions = Omit<VueSolanaPluginOptions, "wallet" | "payer" | "payerSec
10
11
  clientPlugin?: boolean;
11
12
  };
12
13
  type DefinedNuxtModule = ReturnType<ReturnType<typeof defineNuxtModule<ModuleOptions>>["with"]>;
14
+
13
15
  declare const module$1: DefinedNuxtModule;
14
16
 
15
17
  export = module$1;
package/dist/module.d.mts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { defineNuxtModule } from '@nuxt/kit';
2
2
  import { VueSolanaPluginOptions } from '@vue-solana/vue';
3
+ export * from '@vue-solana/vue';
3
4
 
4
5
  type ModuleOptions = Omit<VueSolanaPluginOptions, "wallet" | "payer" | "payerSecretKey"> & {
5
6
  /**
@@ -10,6 +11,7 @@ type ModuleOptions = Omit<VueSolanaPluginOptions, "wallet" | "payer" | "payerSec
10
11
  clientPlugin?: boolean;
11
12
  };
12
13
  type DefinedNuxtModule = ReturnType<ReturnType<typeof defineNuxtModule<ModuleOptions>>["with"]>;
14
+
13
15
  declare const module$1: DefinedNuxtModule;
14
16
 
15
17
  export { module$1 as default };
package/dist/module.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { defineNuxtModule } from '@nuxt/kit';
2
2
  import { VueSolanaPluginOptions } from '@vue-solana/vue';
3
+ export * from '@vue-solana/vue';
3
4
 
4
5
  type ModuleOptions = Omit<VueSolanaPluginOptions, "wallet" | "payer" | "payerSecretKey"> & {
5
6
  /**
@@ -10,6 +11,7 @@ type ModuleOptions = Omit<VueSolanaPluginOptions, "wallet" | "payer" | "payerSec
10
11
  clientPlugin?: boolean;
11
12
  };
12
13
  type DefinedNuxtModule = ReturnType<ReturnType<typeof defineNuxtModule<ModuleOptions>>["with"]>;
14
+
13
15
  declare const module$1: DefinedNuxtModule;
14
16
 
15
17
  export = module$1;
package/dist/module.mjs CHANGED
@@ -1,4 +1,7 @@
1
1
  import { defineNuxtModule, createResolver, addPlugin, addImports } from '@nuxt/kit';
2
+ import { existsSync } from 'node:fs';
3
+ import { join, dirname } from 'node:path';
4
+ import { createRequire } from 'node:module';
2
5
 
3
6
  const SOLANA_COMPOSABLE_IMPORTS = [
4
7
  ["useAccountInfo", "useSolanaAccountInfo"],
@@ -28,15 +31,38 @@ const SOLANA_COMPOSABLE_IMPORTS = [
28
31
  ["useTokenAccounts", "useSolanaTokenAccounts"],
29
32
  ["useTokenBalance", "useSolanaTokenBalance"],
30
33
  ["useTrackedData", "useSolanaTrackedData"],
34
+ ["useTransaction", "useSolanaTransaction"],
31
35
  ["useTransactionConfirmation", "useSolanaTransactionConfirmation"],
32
36
  ["useWallet", "useSolanaWallet"],
33
37
  ["useWallets", "useSolanaWallets"]
34
38
  ];
35
- const SOLANA_IMPORTS = SOLANA_COMPOSABLE_IMPORTS.map(([name, as]) => ({
36
- name,
37
- as,
38
- from: `@vue-solana/vue/${name}`
39
- }));
39
+ const SOLANA_SWR_IMPORTS = [
40
+ ["useRequestSwr", "useSolanaRequestSwr"],
41
+ ["useSubscriptionSwr", "useSolanaSubscriptionSwr"],
42
+ ["useTrackedDataSwr", "useSolanaTrackedDataSwr"]
43
+ ];
44
+ const SOLANA_SETUP_IMPORTS = [
45
+ ["createSelectedWalletAccountContext", "createSelectedWalletAccountContext"],
46
+ ["createSolanaPlugin", "createSolanaPlugin"],
47
+ ["selectedWalletAccountInjectionKey", "selectedWalletAccountInjectionKey"],
48
+ ["solanaInjectionKey", "solanaInjectionKey"]
49
+ ];
50
+ function solanaAutoImports(vueDist) {
51
+ return [
52
+ ...SOLANA_COMPOSABLE_IMPORTS.map(([name, as]) => ({
53
+ name,
54
+ as,
55
+ from: vueSource(vueDist, name)
56
+ })),
57
+ ...SOLANA_SWR_IMPORTS.map(([name, as]) => ({ name, as, from: vueSource(vueDist, "swr") }))
58
+ ];
59
+ }
60
+ function solanaSetupAutoImports(vueDist) {
61
+ return SOLANA_SETUP_IMPORTS.map(([name, as]) => ({ name, as, from: vueSource(vueDist) }));
62
+ }
63
+ function vueSource(vueDist, subpath = "index") {
64
+ return vueDist ? join(vueDist, `${subpath}.mjs`) : `@vue-solana/vue/${subpath}`;
65
+ }
40
66
 
41
67
  const VITE_OPTIMIZE_DEPS = [
42
68
  "@vue-solana/nuxt > @vue-solana/vue > @vue-solana/core > @solana-mobile/wallet-standard-mobile",
@@ -70,6 +96,7 @@ const module$1 = defineNuxtModule({
70
96
  ...options
71
97
  });
72
98
  mergeViteOptimizeDeps(nuxt.options.vite);
99
+ const vueDist = resolveVueDist();
73
100
  nuxt.hook("vite:extendConfig", (config, { isClient }) => {
74
101
  if (!isClient) {
75
102
  return;
@@ -84,8 +111,10 @@ const module$1 = defineNuxtModule({
84
111
  src: resolver.resolve("./runtime/plugin"),
85
112
  mode: "client"
86
113
  });
114
+ addImports(solanaAutoImports(vueDist));
115
+ return;
87
116
  }
88
- addImports(SOLANA_IMPORTS);
117
+ addImports([...solanaAutoImports(vueDist), ...solanaSetupAutoImports(vueDist)]);
89
118
  }
90
119
  });
91
120
  function toPublicSolanaConfig(options) {
@@ -105,5 +134,18 @@ function mergeViteOptimizeDeps(target) {
105
134
  /* @__PURE__ */ new Set([...target.optimizeDeps.needsInterop ?? [], ...VITE_NEEDS_INTEROP])
106
135
  );
107
136
  }
137
+ function resolveVueDist() {
138
+ const require = createRequire(import.meta.url);
139
+ try {
140
+ return dirname(require.resolve("@vue-solana/vue"));
141
+ } catch {
142
+ for (const dir of require.resolve.paths("@vue-solana/vue") ?? []) {
143
+ if (existsSync(join(dir, "@vue-solana/vue/package.json"))) {
144
+ return join(dir, "@vue-solana/vue/dist");
145
+ }
146
+ }
147
+ return void 0;
148
+ }
149
+ }
108
150
 
109
151
  export { module$1 as default };
@@ -4,6 +4,13 @@ const kit = require('@vue-solana/vue/kit');
4
4
 
5
5
 
6
6
 
7
- exports.address = kit.address;
8
- exports.createSolanaClient = kit.createSolanaClient;
9
- exports.lamports = kit.lamports;
7
+ Object.prototype.hasOwnProperty.call(kit, '__proto__') &&
8
+ !Object.prototype.hasOwnProperty.call(exports, '__proto__') &&
9
+ Object.defineProperty(exports, '__proto__', {
10
+ enumerable: true,
11
+ value: kit['__proto__']
12
+ });
13
+
14
+ Object.keys(kit).forEach(function (k) {
15
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = kit[k];
16
+ });
@@ -1 +1 @@
1
- export { Address, Lamports, Rpc, SolanaClient, SolanaRpcApi, address, createSolanaClient, lamports } from '@vue-solana/vue/kit';
1
+ export * from '@vue-solana/vue/kit';
@@ -1 +1 @@
1
- export { Address, Lamports, Rpc, SolanaClient, SolanaRpcApi, address, createSolanaClient, lamports } from '@vue-solana/vue/kit';
1
+ export * from '@vue-solana/vue/kit';
@@ -1 +1 @@
1
- export { Address, Lamports, Rpc, SolanaClient, SolanaRpcApi, address, createSolanaClient, lamports } from '@vue-solana/vue/kit';
1
+ export * from '@vue-solana/vue/kit';
@@ -1 +1 @@
1
- export { address, createSolanaClient, lamports } from '@vue-solana/vue/kit';
1
+ export * from '@vue-solana/vue/kit';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-solana/nuxt",
3
- "version": "2.4.0",
3
+ "version": "2.6.0",
4
4
  "description": "Nuxt module for Solana applications.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -20,6 +20,7 @@
20
20
  "directory": "packages/nuxt"
21
21
  },
22
22
  "type": "module",
23
+ "sideEffects": false,
23
24
  "main": "./dist/module.cjs",
24
25
  "module": "./dist/module.mjs",
25
26
  "types": "./dist/module.d.mts",
@@ -47,7 +48,7 @@
47
48
  "access": "public"
48
49
  },
49
50
  "dependencies": {
50
- "@vue-solana/vue": "2.4.0"
51
+ "@vue-solana/vue": "2.6.0"
51
52
  },
52
53
  "peerDependencies": {
53
54
  "nuxt": "^3.0.0 || ^4.0.0"