New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@matthiesenxyz/astrodtsbuilder

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@matthiesenxyz/astrodtsbuilder

A utility function is used to build declaration files for use with Astro's `injectTypes` function added in the `astro:config:done` Integration Hook in `Astro 4.14.0`.

  • 0.2.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

Build a declaration file for Astro Integrations

This utility function is used to build a declaration file for use with Astro's injectTypes function added in the astro:config:done Integration Hook in Astro 4.14.0. This function is useful for generating TypeScript declaration files for Astro Integrations.

Example Usage

// Import and use the function
import buildDeclarationFile from '@matthiesenxyz/astrodtsbuilder';
const dts = buildDeclarationFile();

// Add a note to the file
dts.addSingleLineNote(`This file was generated by '@my-example/module'`);

// Add a Multi-line Note to the file
dts.addMultiLineNote(['It does some cool and helpful stuff', 'It also does some other cool stuff']);

// Add a module with a default export and single line description
dts.addModule("example:module", {
  defaultExport: {
    typeDef: "import('@my-example/module').ExampleModule",
    singleLineDescription: "This is the default Module",
  }
});

// Write the file
const dtsFile = dts.makeFile();

// Output the file
console.log(dtsFile);

Example Output

// This file was generated by '@my-example/module'

// It does some cool and helpful stuff
// It also does some other cool stuff

declare module 'example:module' {
    //** This is the default Module * /
    const defaultExport: import('@my-example/module').ExampleModule;
    export default defaultExport;

}

Licensing

MIT Licensed. Made with ❤️ by Adam Matthiesen.

Keywords

FAQs

Package last updated on 04 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc