@tthr/vue 0.0.34 → 0.0.36
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/nuxt/module.js +15 -4
- package/nuxt/module.ts +16 -3
- package/package.json +5 -2
package/nuxt/module.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* Environment variables (in .env):
|
|
19
19
|
* - TETHER_API_KEY: Your project's API key (required, kept server-side)
|
|
20
20
|
*/
|
|
21
|
-
import { defineNuxtModule, addPlugin, createResolver, addImports, addComponent, addServerHandler, addServerImports } from '@nuxt/kit';
|
|
21
|
+
import { defineNuxtModule, addPlugin, createResolver, addImports, addComponent, addServerHandler, addServerImports, addTemplate } from '@nuxt/kit';
|
|
22
22
|
export default defineNuxtModule({
|
|
23
23
|
meta: {
|
|
24
24
|
name: '@tthr/vue',
|
|
@@ -117,12 +117,24 @@ export default defineNuxtModule({
|
|
|
117
117
|
// Ensure the runtime files are transpiled
|
|
118
118
|
nuxt.options.build.transpile = nuxt.options.build.transpile || [];
|
|
119
119
|
nuxt.options.build.transpile.push('@tthr/vue');
|
|
120
|
+
// Create a virtual wrapper for the cron plugin to avoid absolute path issues in production
|
|
121
|
+
// The wrapper imports from the package export which gets resolved correctly at build time
|
|
122
|
+
const cronPluginWrapper = addTemplate({
|
|
123
|
+
filename: 'tether/cron-plugin.mjs',
|
|
124
|
+
write: true,
|
|
125
|
+
getContents: () => `
|
|
126
|
+
// Virtual wrapper for Tether cron plugin
|
|
127
|
+
// This ensures the import path is resolved correctly in production builds
|
|
128
|
+
import cronPlugin from '@tthr/vue/nuxt/cron-plugin';
|
|
129
|
+
export default cronPlugin;
|
|
130
|
+
`.trim(),
|
|
131
|
+
});
|
|
120
132
|
// Add Nitro plugin for cron WebSocket connection
|
|
121
133
|
// This auto-connects to Tether when the server starts
|
|
122
|
-
// Use .js extension to ensure the pre-built file is used
|
|
123
134
|
nuxt.hook('nitro:config', (nitroConfig) => {
|
|
124
135
|
nitroConfig.plugins = nitroConfig.plugins || [];
|
|
125
|
-
|
|
136
|
+
// Use the generated wrapper file instead of direct path
|
|
137
|
+
nitroConfig.plugins.push(cronPluginWrapper.dst);
|
|
126
138
|
// Ensure Nitro inlines and transpiles the plugin from node_modules
|
|
127
139
|
nitroConfig.externals = nitroConfig.externals || {};
|
|
128
140
|
nitroConfig.externals.inline = nitroConfig.externals.inline || [];
|
|
@@ -130,4 +142,3 @@ export default defineNuxtModule({
|
|
|
130
142
|
});
|
|
131
143
|
},
|
|
132
144
|
});
|
|
133
|
-
//# sourceMappingURL=module.js.map
|
package/nuxt/module.ts
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* - TETHER_API_KEY: Your project's API key (required, kept server-side)
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
import { defineNuxtModule, addPlugin, createResolver, addImports, addComponent, addServerHandler, addServerImports } from '@nuxt/kit';
|
|
22
|
+
import { defineNuxtModule, addPlugin, createResolver, addImports, addComponent, addServerHandler, addServerImports, addTemplate } from '@nuxt/kit';
|
|
23
23
|
|
|
24
24
|
export interface TetherModuleOptions {
|
|
25
25
|
/** Project ID from Tether dashboard */
|
|
@@ -138,12 +138,25 @@ export default defineNuxtModule<TetherModuleOptions>({
|
|
|
138
138
|
nuxt.options.build.transpile = nuxt.options.build.transpile || [];
|
|
139
139
|
nuxt.options.build.transpile.push('@tthr/vue');
|
|
140
140
|
|
|
141
|
+
// Create a virtual wrapper for the cron plugin to avoid absolute path issues in production
|
|
142
|
+
// The wrapper imports from the package export which gets resolved correctly at build time
|
|
143
|
+
const cronPluginWrapper = addTemplate({
|
|
144
|
+
filename: 'tether/cron-plugin.mjs',
|
|
145
|
+
write: true,
|
|
146
|
+
getContents: () => `
|
|
147
|
+
// Virtual wrapper for Tether cron plugin
|
|
148
|
+
// This ensures the import path is resolved correctly in production builds
|
|
149
|
+
import cronPlugin from '@tthr/vue/nuxt/cron-plugin';
|
|
150
|
+
export default cronPlugin;
|
|
151
|
+
`.trim(),
|
|
152
|
+
});
|
|
153
|
+
|
|
141
154
|
// Add Nitro plugin for cron WebSocket connection
|
|
142
155
|
// This auto-connects to Tether when the server starts
|
|
143
|
-
// Use .js extension to ensure the pre-built file is used
|
|
144
156
|
nuxt.hook('nitro:config', (nitroConfig) => {
|
|
145
157
|
nitroConfig.plugins = nitroConfig.plugins || [];
|
|
146
|
-
|
|
158
|
+
// Use the generated wrapper file instead of direct path
|
|
159
|
+
nitroConfig.plugins.push(cronPluginWrapper.dst);
|
|
147
160
|
|
|
148
161
|
// Ensure Nitro inlines and transpiles the plugin from node_modules
|
|
149
162
|
nitroConfig.externals = nitroConfig.externals || {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tthr/vue",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.36",
|
|
4
4
|
"description": "Tether Vue/Nuxt SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
},
|
|
17
17
|
"./nuxt": {
|
|
18
18
|
"import": "./nuxt/module.ts"
|
|
19
|
+
},
|
|
20
|
+
"./nuxt/cron-plugin": {
|
|
21
|
+
"import": "./nuxt/runtime/server/plugins/cron.js"
|
|
19
22
|
}
|
|
20
23
|
},
|
|
21
24
|
"files": [
|
|
@@ -43,7 +46,7 @@
|
|
|
43
46
|
"vue": "^3.0.0"
|
|
44
47
|
},
|
|
45
48
|
"scripts": {
|
|
46
|
-
"build": "tsc",
|
|
49
|
+
"build": "tsc && tsc -p nuxt/tsconfig.json",
|
|
47
50
|
"dev": "tsc --watch",
|
|
48
51
|
"typecheck": "tsc --noEmit"
|
|
49
52
|
}
|