@vue-solana/nuxt 2.6.1 → 3.0.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/README.md +2 -0
- package/dist/module.d.ts +1 -1
- package/dist/runtime/plugin.d.ts +1 -1
- package/package.json +5 -9
- package/dist/module.cjs +0 -154
- package/dist/module.d.cts +0 -18
- package/dist/runtime/buffer-polyfill.cjs +0 -8
- package/dist/runtime/buffer-polyfill.d.cts +0 -2
- package/dist/runtime/kit.cjs +0 -16
- package/dist/runtime/kit.d.cts +0 -1
- package/dist/runtime/plugin.cjs +0 -23
- package/dist/runtime/plugin.d.cts +0 -3
package/README.md
CHANGED
|
@@ -47,6 +47,8 @@ npx nuxt module add @vue-solana/nuxt
|
|
|
47
47
|
|
|
48
48
|
This installs the package and adds `@vue-solana/nuxt` to the `modules` array in `nuxt.config.ts`.
|
|
49
49
|
|
|
50
|
+
Since v3.0.0 this package is ESM only. There is no `require` export condition and no top-level `main`, so `require("@vue-solana/nuxt")` fails with `No "exports" main defined`. Nuxt apps are unaffected; pin to `@vue-solana/nuxt@^2` if you must stay on CommonJS.
|
|
51
|
+
|
|
50
52
|
## Module Setup
|
|
51
53
|
|
|
52
54
|
```ts
|
package/dist/module.d.ts
CHANGED
package/dist/runtime/plugin.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue-solana/nuxt",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Nuxt module for Solana applications.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -21,24 +21,20 @@
|
|
|
21
21
|
},
|
|
22
22
|
"type": "module",
|
|
23
23
|
"sideEffects": false,
|
|
24
|
-
"main": "./dist/module.cjs",
|
|
25
24
|
"module": "./dist/module.mjs",
|
|
26
25
|
"types": "./dist/module.d.mts",
|
|
27
26
|
"exports": {
|
|
28
27
|
".": {
|
|
29
28
|
"types": "./dist/module.d.mts",
|
|
30
|
-
"import": "./dist/module.mjs"
|
|
31
|
-
"require": "./dist/module.cjs"
|
|
29
|
+
"import": "./dist/module.mjs"
|
|
32
30
|
},
|
|
33
31
|
"./buffer-polyfill": {
|
|
34
32
|
"types": "./dist/runtime/buffer-polyfill.d.ts",
|
|
35
|
-
"import": "./dist/runtime/buffer-polyfill.mjs"
|
|
36
|
-
"require": "./dist/runtime/buffer-polyfill.cjs"
|
|
33
|
+
"import": "./dist/runtime/buffer-polyfill.mjs"
|
|
37
34
|
},
|
|
38
35
|
"./kit": {
|
|
39
36
|
"types": "./dist/runtime/kit.d.ts",
|
|
40
|
-
"import": "./dist/runtime/kit.mjs"
|
|
41
|
-
"require": "./dist/runtime/kit.cjs"
|
|
37
|
+
"import": "./dist/runtime/kit.mjs"
|
|
42
38
|
}
|
|
43
39
|
},
|
|
44
40
|
"files": [
|
|
@@ -48,7 +44,7 @@
|
|
|
48
44
|
"access": "public"
|
|
49
45
|
},
|
|
50
46
|
"dependencies": {
|
|
51
|
-
"@vue-solana/vue": "
|
|
47
|
+
"@vue-solana/vue": "3.0.0"
|
|
52
48
|
},
|
|
53
49
|
"peerDependencies": {
|
|
54
50
|
"nuxt": "^3.0.0 || ^4.0.0"
|
package/dist/module.cjs
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
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');
|
|
7
|
-
|
|
8
|
-
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
9
|
-
const SOLANA_COMPOSABLE_IMPORTS = [
|
|
10
|
-
["useAccountInfo", "useSolanaAccountInfo"],
|
|
11
|
-
["useAction", "useSolanaAction"],
|
|
12
|
-
["useAirdrop", "useSolanaAirdrop"],
|
|
13
|
-
["useBalance", "useSolanaBalance"],
|
|
14
|
-
["useConnection", "useSolanaConnection"],
|
|
15
|
-
["useIdentity", "useSolanaIdentity"],
|
|
16
|
-
["usePlanTransaction", "useSolanaPlanTransaction"],
|
|
17
|
-
["usePlanTransactions", "useSolanaPlanTransactions"],
|
|
18
|
-
["useProgramAccounts", "useSolanaProgramAccounts"],
|
|
19
|
-
["usePayer", "useSolanaPayer"],
|
|
20
|
-
["useRequest", "useSolanaRequest"],
|
|
21
|
-
["useRpc", "useSolanaRpc"],
|
|
22
|
-
["useSelectedWalletAccount", "useSolanaSelectedWalletAccount"],
|
|
23
|
-
["useSendTransaction", "useSolanaSendTransaction"],
|
|
24
|
-
["useSendTransactions", "useSolanaSendTransactions"],
|
|
25
|
-
["useSignIn", "useSolanaSignIn"],
|
|
26
|
-
["useSignMessage", "useSolanaSignMessage"],
|
|
27
|
-
["useSignAndSendTransaction", "useSolanaSignAndSendTransaction"],
|
|
28
|
-
["useSignTransactions", "useSolanaSignTransactions"],
|
|
29
|
-
["useSignAndSendTransactions", "useSolanaSignAndSendTransactions"],
|
|
30
|
-
["useSignatureStatus", "useSolanaSignatureStatus"],
|
|
31
|
-
["useSolana", "useSolana"],
|
|
32
|
-
["useSolanaClient", "useSolanaClient"],
|
|
33
|
-
["useSubscription", "useSolanaSubscription"],
|
|
34
|
-
["useTokenAccounts", "useSolanaTokenAccounts"],
|
|
35
|
-
["useTokenBalance", "useSolanaTokenBalance"],
|
|
36
|
-
["useTrackedData", "useSolanaTrackedData"],
|
|
37
|
-
["useTransaction", "useSolanaTransaction"],
|
|
38
|
-
["useTransactionConfirmation", "useSolanaTransactionConfirmation"],
|
|
39
|
-
["useWallet", "useSolanaWallet"],
|
|
40
|
-
["useWallets", "useSolanaWallets"]
|
|
41
|
-
];
|
|
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
|
-
}
|
|
69
|
-
|
|
70
|
-
const VITE_OPTIMIZE_DEPS = [
|
|
71
|
-
"@vue-solana/nuxt > @vue-solana/vue > @vue-solana/core > @solana-mobile/wallet-standard-mobile",
|
|
72
|
-
"@vue-solana/nuxt > @vue-solana/vue > @vue-solana/core > buffer",
|
|
73
|
-
"@vue-solana/nuxt > @vue-solana/vue > @vue-solana/core > buffer/",
|
|
74
|
-
"@vue-solana/nuxt > @vue-solana/vue > @vue-solana/core > bs58",
|
|
75
|
-
"@vue-solana/nuxt > @vue-solana/vue > @vue-solana/core > tweetnacl",
|
|
76
|
-
"@vue-solana/nuxt > @vue-solana/vue > @vue-solana/core > tweetnacl/nacl-fast.js"
|
|
77
|
-
];
|
|
78
|
-
const VITE_NEEDS_INTEROP = [
|
|
79
|
-
"@vue-solana/nuxt > @vue-solana/vue > @vue-solana/core > tweetnacl",
|
|
80
|
-
"@vue-solana/nuxt > @vue-solana/vue > @vue-solana/core > tweetnacl/nacl-fast.js"
|
|
81
|
-
];
|
|
82
|
-
const module$1 = kit.defineNuxtModule({
|
|
83
|
-
meta: {
|
|
84
|
-
name: "@vue-solana/nuxt",
|
|
85
|
-
configKey: "solana",
|
|
86
|
-
compatibility: {
|
|
87
|
-
nuxt: "^3.0.0 || ^4.0.0"
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
defaults: {
|
|
91
|
-
cluster: "devnet",
|
|
92
|
-
autoConnect: false
|
|
93
|
-
},
|
|
94
|
-
setup(options, nuxt) {
|
|
95
|
-
const resolver = kit.createResolver((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('module.cjs', document.baseURI).href)));
|
|
96
|
-
const publicConfig = nuxt.options.runtimeConfig.public;
|
|
97
|
-
publicConfig.solana = toPublicSolanaConfig({
|
|
98
|
-
...typeof publicConfig.solana === "object" && publicConfig.solana !== null ? publicConfig.solana : {},
|
|
99
|
-
...options
|
|
100
|
-
});
|
|
101
|
-
mergeViteOptimizeDeps(nuxt.options.vite);
|
|
102
|
-
const vueDist = resolveVueDist();
|
|
103
|
-
nuxt.hook("vite:extendConfig", (config, { isClient }) => {
|
|
104
|
-
if (!isClient) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
mergeViteOptimizeDeps(config);
|
|
108
|
-
if (config.environments?.client) {
|
|
109
|
-
mergeViteOptimizeDeps(config.environments.client);
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
if (options.clientPlugin !== false) {
|
|
113
|
-
kit.addPlugin({
|
|
114
|
-
src: resolver.resolve("./runtime/plugin"),
|
|
115
|
-
mode: "client"
|
|
116
|
-
});
|
|
117
|
-
kit.addImports(solanaAutoImports(vueDist));
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
kit.addImports([...solanaAutoImports(vueDist), ...solanaSetupAutoImports(vueDist)]);
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
function toPublicSolanaConfig(options) {
|
|
124
|
-
const runtimeOptions = { ...options };
|
|
125
|
-
delete runtimeOptions.wallet;
|
|
126
|
-
delete runtimeOptions.payer;
|
|
127
|
-
delete runtimeOptions.payerSecretKey;
|
|
128
|
-
delete runtimeOptions.clientPlugin;
|
|
129
|
-
return runtimeOptions;
|
|
130
|
-
}
|
|
131
|
-
function mergeViteOptimizeDeps(target) {
|
|
132
|
-
target.optimizeDeps ??= {};
|
|
133
|
-
target.optimizeDeps.include = Array.from(
|
|
134
|
-
/* @__PURE__ */ new Set([...target.optimizeDeps.include ?? [], ...VITE_OPTIMIZE_DEPS])
|
|
135
|
-
);
|
|
136
|
-
target.optimizeDeps.needsInterop = Array.from(
|
|
137
|
-
/* @__PURE__ */ new Set([...target.optimizeDeps.needsInterop ?? [], ...VITE_NEEDS_INTEROP])
|
|
138
|
-
);
|
|
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
|
-
}
|
|
153
|
-
|
|
154
|
-
module.exports = module$1;
|
package/dist/module.d.cts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { defineNuxtModule } from '@nuxt/kit';
|
|
2
|
-
import { VueSolanaPluginOptions } from '@vue-solana/vue';
|
|
3
|
-
export * from '@vue-solana/vue';
|
|
4
|
-
|
|
5
|
-
type ModuleOptions = Omit<VueSolanaPluginOptions, "wallet" | "payer" | "payerSecretKey"> & {
|
|
6
|
-
/**
|
|
7
|
-
* Set to `false` to auto-import the composables without installing the Solana
|
|
8
|
-
* runtime plugin. Use it when the app installs `createSolanaPlugin` itself,
|
|
9
|
-
* e.g. to attach a client-only `payer` that module options cannot carry.
|
|
10
|
-
*/
|
|
11
|
-
clientPlugin?: boolean;
|
|
12
|
-
};
|
|
13
|
-
type DefinedNuxtModule = ReturnType<ReturnType<typeof defineNuxtModule<ModuleOptions>>["with"]>;
|
|
14
|
-
|
|
15
|
-
declare const module$1: DefinedNuxtModule;
|
|
16
|
-
|
|
17
|
-
export = module$1;
|
|
18
|
-
export type { ModuleOptions };
|
package/dist/runtime/kit.cjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const kit = require('@vue-solana/vue/kit');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
});
|
package/dist/runtime/kit.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@vue-solana/vue/kit';
|
package/dist/runtime/plugin.cjs
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const vue = require('@vue-solana/vue');
|
|
4
|
-
const _app = require('#app');
|
|
5
|
-
|
|
6
|
-
const plugin = _app.defineNuxtPlugin((nuxtApp) => {
|
|
7
|
-
const config = _app.useRuntimeConfig().public.solana;
|
|
8
|
-
const solanaPlugin = vue.createSolanaPlugin({
|
|
9
|
-
cluster: config.cluster,
|
|
10
|
-
endpoint: config.endpoint,
|
|
11
|
-
wsEndpoint: config.wsEndpoint,
|
|
12
|
-
commitment: config.commitment,
|
|
13
|
-
autoConnect: config.autoConnect,
|
|
14
|
-
mobileWallet: config.mobileWallet,
|
|
15
|
-
iosWallet: config.iosWallet
|
|
16
|
-
});
|
|
17
|
-
nuxtApp.vueApp.use(solanaPlugin);
|
|
18
|
-
const vueApp = nuxtApp.vueApp;
|
|
19
|
-
const context = vue.createSelectedWalletAccountContext({}, solanaPlugin.context);
|
|
20
|
-
vueApp.provide(vue.selectedWalletAccountInjectionKey, context);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
module.exports = plugin;
|