@tthr/vue 0.0.34 → 0.0.35

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.
Files changed (2) hide show
  1. package/nuxt/module.ts +16 -3
  2. package/package.json +4 -1
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
- nitroConfig.plugins.push(resolver.resolve('./runtime/server/plugins/cron.js'));
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.34",
3
+ "version": "0.0.35",
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": [