Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

inprint

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inprint

A very simple precompiler written in typescript. With it you can make a dynamically generated blocks in your code.

  • 1.0.10
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
34
increased by3300%
Maintainers
1
Weekly downloads
 
Created
Source

inprint

A very simple precompiler (written in typescript). With it you can make a dynamically generated blocks in your code.

Installation

npm i inprint --save-dev
yarn i inprint --save-dev
pnpm i inprint --save-dev

npm i -g inprint
yarn i -g inprint
pnpm i -g inprint

Usage

  1. Anywhere in your code add a block you want to generate like this
console.log("any code can be here");
// @INPRINT_START {my:"own params", json5:'is supported here!'}
// Anything here will be overwritten by generated code!
// @INPRINT_END
console.log("any code can be here");
  1. Now add inprint.cjs (or .js) to your project with the following contents:
module.exports = {
    files:['src/**/*.{ts,tsx,js,jsx}'],
    inprint: function inprint(paramsObject) {
        return "    // " + JSON.stringify(paramsObject);
    }
}
  1. Run inprint

  2. The returned content will be inprinted between @INPRINT tags:

console.log("any code can be here");
// @INPRINT_START {my:"own params", json5:'is supported here!'}
    // {my:"own params", json5:'is supported here!'}
// @INPRINT_END
console.log("any code can be here");

Details

inprint function will receive the following additional paramaters:

  • absolutePath - absolute file path with inprint block

  • content - current content of the block

Options:

  • inprint - required, the function used to generate inprinted content

  • files - optional, globby input patterns, default is ['src/**/*.{ts,tsx,js,jsx}']

  • skipNodeModules- optional, if true will skip all path containing /node_modules/, default is true

Limitations

  • @INPRINT tags can't be nested

Keywords

FAQs

Package last updated on 11 Apr 2021

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