diff --git a/package.json b/package.json index dee6e19f..a3eae620 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nullstack", - "version": "0.16.1", + "version": "0.16.2", "description": "Full-stack Javascript Components for one-dev armies", "main": "nullstack.js", "author": "Mortaro", diff --git a/types/ServerContext.d.ts b/types/ServerContext.d.ts index 3732b50d..58b9fd2a 100644 --- a/types/ServerContext.d.ts +++ b/types/ServerContext.d.ts @@ -9,6 +9,11 @@ import { NullstackWorker } from './Worker'; * @see https://nullstack.app/context */ export type NullstackServerContext = TProps & { + /** + * Callback function that bootstrap the context for the application. + */ + start?: () => void; + /** * Information about the app manifest and some metatags. * diff --git a/types/index.d.ts b/types/index.d.ts index 1339b70e..dfc26037 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -23,7 +23,7 @@ export default class Nullstack { /** * @param App A Nullstack app root component */ - static start(App: Nullstack): NullstackClientContext | NullstackServerContext; + static start(App: typeof this): NullstackClientContext | NullstackServerContext; /** * Use a plugin diff --git a/webpack.config.js b/webpack.config.js index 7fbc2927..12cf09ca 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -128,6 +128,7 @@ const nullstackTypescript = { function server(env, argv) { const dir = argv.input ? path.join(__dirname, argv.input) : process.cwd(); + const entryExtension = fs.existsSync(path.join(dir, 'server.ts')) ? 'ts' : 'js'; const icons = {}; const publicFiles = readdirSync(path.join(dir, 'public')); for (const file of publicFiles) { @@ -155,7 +156,7 @@ function server(env, argv) { infrastructureLogging: { console: customConsole, }, - entry: './server.js', + entry: './server.' + entryExtension, output: { path: path.join(dir, folder), filename: 'server.js', @@ -265,6 +266,7 @@ function server(env, argv) { function client(env, argv) { const disk = !!argv.disk const dir = argv.input ? path.join(__dirname, argv.input) : process.cwd(); + const entryExtension = fs.existsSync(path.join(dir, 'client.ts')) ? 'ts' : 'js'; const isDev = argv.environment === 'development'; const folder = isDev ? '.development' : '.production'; const devtool = isDev ? 'inline-cheap-module-source-map' : false; @@ -287,7 +289,7 @@ function client(env, argv) { console: customConsole, }, mode: argv.environment, - entry: './client.js', + entry: './client.' + entryExtension, output: { publicPath: `/`, path: path.join(dir, folder),