@tthr/vue 0.0.51 → 0.0.53
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 +7 -5
- package/package.json +1 -1
package/nuxt/module.js
CHANGED
|
@@ -130,9 +130,11 @@ export default defineNuxtModule({
|
|
|
130
130
|
nitroConfig.externals = nitroConfig.externals || {};
|
|
131
131
|
nitroConfig.externals.inline = nitroConfig.externals.inline || [];
|
|
132
132
|
nitroConfig.externals.inline.push('@tthr/vue');
|
|
133
|
+
// Add alias for user's tether functions so Nitro can resolve them
|
|
134
|
+
// Using bare module name (not # prefix which triggers Node subpath imports)
|
|
135
|
+
nitroConfig.alias = nitroConfig.alias || {};
|
|
136
|
+
nitroConfig.alias['tether-user-functions'] = `${nuxt.options.rootDir}/tether/functions`;
|
|
133
137
|
});
|
|
134
|
-
// Get the absolute path to user's tether/functions/index file
|
|
135
|
-
const tetherFunctionsPath = `${nuxt.options.rootDir}/tether/functions/index`;
|
|
136
138
|
// Generate a server plugin to auto-register cron handlers from tether/functions
|
|
137
139
|
// This runs at build time and creates a plugin that imports user's functions
|
|
138
140
|
// NOTE: Must be .js file (not .ts) to avoid Rollup parse errors during Nitro build
|
|
@@ -147,8 +149,8 @@ export default defineNuxtModule({
|
|
|
147
149
|
import { defineNitroPlugin, registerCronHandler } from '@tthr/vue/nuxt/runtime/server/plugins/cron.js';
|
|
148
150
|
import { useTetherServer } from '@tthr/vue/nuxt/runtime/server/utils/tether.js';
|
|
149
151
|
|
|
150
|
-
// Import all functions from tether/functions
|
|
151
|
-
import * as tetherFunctions from '
|
|
152
|
+
// Import all functions from tether/functions using Nitro alias
|
|
153
|
+
import * as tetherFunctions from 'tether-user-functions';
|
|
152
154
|
|
|
153
155
|
/**
|
|
154
156
|
* Create a simple logger for function execution
|
package/nuxt/module.ts
CHANGED
|
@@ -143,6 +143,12 @@ export default defineNuxtModule<TetherModuleOptions>({
|
|
|
143
143
|
nuxt.options.build.transpile = nuxt.options.build.transpile || [];
|
|
144
144
|
nuxt.options.build.transpile.push('@tthr/vue');
|
|
145
145
|
|
|
146
|
+
// Set up Nitro alias for user's tether functions BEFORE hooks run
|
|
147
|
+
// This must be set early so Nitro can resolve the import during bundling
|
|
148
|
+
nuxt.options.nitro = nuxt.options.nitro || {};
|
|
149
|
+
nuxt.options.nitro.alias = nuxt.options.nitro.alias || {};
|
|
150
|
+
nuxt.options.nitro.alias['tether-user-functions'] = `${nuxt.options.rootDir}/tether/functions`;
|
|
151
|
+
|
|
146
152
|
// Add Nitro plugin for cron WebSocket connection
|
|
147
153
|
// This auto-connects to Tether when the server starts
|
|
148
154
|
nuxt.hook('nitro:config' as any, (nitroConfig: any) => {
|
|
@@ -154,10 +160,6 @@ export default defineNuxtModule<TetherModuleOptions>({
|
|
|
154
160
|
nitroConfig.externals = nitroConfig.externals || {};
|
|
155
161
|
nitroConfig.externals.inline = nitroConfig.externals.inline || [];
|
|
156
162
|
nitroConfig.externals.inline.push('@tthr/vue');
|
|
157
|
-
|
|
158
|
-
// Add alias for user's tether functions so Nitro can resolve TypeScript
|
|
159
|
-
nitroConfig.alias = nitroConfig.alias || {};
|
|
160
|
-
nitroConfig.alias['#tether-functions'] = `${nuxt.options.rootDir}/tether/functions`;
|
|
161
163
|
});
|
|
162
164
|
|
|
163
165
|
// Generate a server plugin to auto-register cron handlers from tether/functions
|
|
@@ -175,7 +177,7 @@ import { defineNitroPlugin, registerCronHandler } from '@tthr/vue/nuxt/runtime/s
|
|
|
175
177
|
import { useTetherServer } from '@tthr/vue/nuxt/runtime/server/utils/tether.js';
|
|
176
178
|
|
|
177
179
|
// Import all functions from tether/functions using Nitro alias
|
|
178
|
-
import * as tetherFunctions from '
|
|
180
|
+
import * as tetherFunctions from 'tether-user-functions';
|
|
179
181
|
|
|
180
182
|
/**
|
|
181
183
|
* Create a simple logger for function execution
|