@tthr/vue 0.0.52 → 0.0.54
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 +6 -4
- package/nuxt/module.ts +5 -6
- package/package.json +1 -1
package/nuxt/module.js
CHANGED
|
@@ -120,6 +120,11 @@ export default defineNuxtModule({
|
|
|
120
120
|
// Ensure the runtime files are transpiled
|
|
121
121
|
nuxt.options.build.transpile = nuxt.options.build.transpile || [];
|
|
122
122
|
nuxt.options.build.transpile.push('@tthr/vue');
|
|
123
|
+
// Set up Nitro alias for user's tether functions BEFORE hooks run
|
|
124
|
+
// This must be set early so Nitro can resolve the import during bundling
|
|
125
|
+
nuxt.options.nitro = nuxt.options.nitro || {};
|
|
126
|
+
nuxt.options.nitro.alias = nuxt.options.nitro.alias || {};
|
|
127
|
+
nuxt.options.nitro.alias['tether-user-functions'] = `${nuxt.options.rootDir}/tether/functions`;
|
|
123
128
|
// Add Nitro plugin for cron WebSocket connection
|
|
124
129
|
// This auto-connects to Tether when the server starts
|
|
125
130
|
nuxt.hook('nitro:config', (nitroConfig) => {
|
|
@@ -130,9 +135,6 @@ export default defineNuxtModule({
|
|
|
130
135
|
nitroConfig.externals = nitroConfig.externals || {};
|
|
131
136
|
nitroConfig.externals.inline = nitroConfig.externals.inline || [];
|
|
132
137
|
nitroConfig.externals.inline.push('@tthr/vue');
|
|
133
|
-
// Add alias for user's tether functions so Nitro can resolve TypeScript
|
|
134
|
-
nitroConfig.alias = nitroConfig.alias || {};
|
|
135
|
-
nitroConfig.alias['#tether-functions'] = `${nuxt.options.rootDir}/tether/functions`;
|
|
136
138
|
});
|
|
137
139
|
// Generate a server plugin to auto-register cron handlers from tether/functions
|
|
138
140
|
// This runs at build time and creates a plugin that imports user's functions
|
|
@@ -149,7 +151,7 @@ import { defineNitroPlugin, registerCronHandler } from '@tthr/vue/nuxt/runtime/s
|
|
|
149
151
|
import { useTetherServer } from '@tthr/vue/nuxt/runtime/server/utils/tether.js';
|
|
150
152
|
|
|
151
153
|
// Import all functions from tether/functions using Nitro alias
|
|
152
|
-
import * as tetherFunctions from '
|
|
154
|
+
import * as tetherFunctions from 'tether-user-functions';
|
|
153
155
|
|
|
154
156
|
/**
|
|
155
157
|
* Create a simple logger for function execution
|
package/nuxt/module.ts
CHANGED
|
@@ -155,10 +155,8 @@ export default defineNuxtModule<TetherModuleOptions>({
|
|
|
155
155
|
nitroConfig.externals.inline = nitroConfig.externals.inline || [];
|
|
156
156
|
nitroConfig.externals.inline.push('@tthr/vue');
|
|
157
157
|
|
|
158
|
-
//
|
|
159
|
-
|
|
160
|
-
nitroConfig.alias = nitroConfig.alias || {};
|
|
161
|
-
nitroConfig.alias['tether-user-functions'] = `${nuxt.options.rootDir}/tether/functions`;
|
|
158
|
+
// Also inline the user's tether/functions directory so Nitro transpiles TypeScript
|
|
159
|
+
nitroConfig.externals.inline.push(`${nuxt.options.rootDir}/tether`);
|
|
162
160
|
});
|
|
163
161
|
|
|
164
162
|
// Generate a server plugin to auto-register cron handlers from tether/functions
|
|
@@ -175,8 +173,9 @@ export default defineNuxtModule<TetherModuleOptions>({
|
|
|
175
173
|
import { defineNitroPlugin, registerCronHandler } from '@tthr/vue/nuxt/runtime/server/plugins/cron.js';
|
|
176
174
|
import { useTetherServer } from '@tthr/vue/nuxt/runtime/server/utils/tether.js';
|
|
177
175
|
|
|
178
|
-
// Import all functions from tether/functions using
|
|
179
|
-
|
|
176
|
+
// Import all functions from tether/functions using relative path
|
|
177
|
+
// Generated plugin is at .nuxt/server/plugins/, so ../../../ gets to project root
|
|
178
|
+
import * as tetherFunctions from '../../../tether/functions/index';
|
|
180
179
|
|
|
181
180
|
/**
|
|
182
181
|
* Create a simple logger for function execution
|