- Add support for defining custom server functions. The configuration follows the same internal definition for the built-in server functions, and can be defined through the plugin integrations (e.g. Vite). Functions defined in the configuration must call one of the "internally-defined" functions for Thaler to recognize the function call.
// This is based on the unplugin integration
thaler.vite({
functions: [
{
// Name of the function
name: 'server$',
// Boolean check if the function needs to perform
// closure extraction
scoping: false,
// Target identifier (to be compiled)
target: {
// Name of the identifier
name: 'server$',
// Where it is imported
source: 'thaler',
// Kind of import (named or default)
kind: 'named',
},
// Compiled function for the client
client: {
// Compiled function identifier
name: '$$server',
// Where it is imported
source: 'thaler/client',
// Kind of import
kind: 'named',
},
// Compiled function for the server
server: {
// Compiled function identifier
name: '$$server',
// Where it is imported
source: 'thaler/server',
// Kind of import
kind: 'named',
},
}
],
});