diff --git a/pkgs/create-neon/data/templates/ts/index.cts.hbs b/pkgs/create-neon/data/templates/ts/index.cts.hbs index 5eebd6c84..001e42082 100644 --- a/pkgs/create-neon/data/templates/ts/index.cts.hbs +++ b/pkgs/create-neon/data/templates/ts/index.cts.hbs @@ -1,5 +1,10 @@ +// This module is the CJS entry point for the library. + +// The Rust addon. import * as addon from './load.cjs'; +// Use this declaration to assign types to the addon's exports, +// which otherwise by default are `any`. declare module "./load.cjs" { function hello(): string; } diff --git a/pkgs/create-neon/data/templates/ts/index.mts.hbs b/pkgs/create-neon/data/templates/ts/index.mts.hbs index 147a58772..5e1ab260f 100644 --- a/pkgs/create-neon/data/templates/ts/index.mts.hbs +++ b/pkgs/create-neon/data/templates/ts/index.mts.hbs @@ -1 +1,3 @@ +// This module is the ESM entry point for the library. + export * from './index.cjs'; diff --git a/pkgs/create-neon/data/templates/ts/load.cts.hbs b/pkgs/create-neon/data/templates/ts/load.cts.hbs index 3b579437f..5e38bc764 100644 --- a/pkgs/create-neon/data/templates/ts/load.cts.hbs +++ b/pkgs/create-neon/data/templates/ts/load.cts.hbs @@ -1,3 +1,10 @@ +// This module loads the platform-specific build of the addon on +// the current system. The supported platforms are registered in +// the `platforms` object below, whose entries can be managed by +// by the Neon CLI: +// +// https://www.npmjs.com/package/@neon-rs/cli + module.exports = require('@neon-rs/load').proxy({ platforms: {}, debug: () => require('../index.node')