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

@apeleghq/esbuild-plugin-inline-js

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apeleghq/esbuild-plugin-inline-js

esbuild plugin for inline scripts

  • 1.1.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
Maintainers
2
Weekly downloads
 
Created
Source

esbuild plugin for inline scripts

Reliability Rating Vulnerabilities Bugs Security Rating Maintainability Rating NPM Downloads

How to use

Installing

npm i -D @apeleghq/esbuild-plugin-inline-js

Configuring esbuild

In the file you have your configuration, first import this plugin

const inlineJs = require('@apeleghq/esbuild-plugin-inline-js');

Or using ES module syntax:

import inlineJs from '@apeleghq/esbuild-plugin-inline-js';

Then, in your esbuild configuration, add inlineJs() to the plugins list. inlineJs optionally takes an object that is passed to esbuild.build, with the exception of the following keys: entryPoints, outdir, outfile and write. Minimal example:

const esbuild = require('esbuild');
const responsiveImages = require('@apeleghq/esbuild-plugin-inline-js');

await esbuild
	.build({
		entryPoints: ['index.js'],
		outdir: 'build',
		bundle: true,
		format: 'cjs',
		plugins: [inlineJs()],
	});

Getting inline scripts

Import your inline scripts like this (the extensions supported are inline.js, inline.jsx, inline.ts and inline.tsx):

const inline = require('./foo.inline.js');
// import * as inline from './foo.inline.js';
Result

The import will return something like this:

{
	"contentBase64":
		"KGZ1bmN0aW9uKCl7cmV0dXJuIkhlbGxvLCBXb3JsZCEifSkoKTsK",
	"default":
		"(function(){return\"Hello, World!\"})();\n",
	"sri": "sha384-PKTF85dF3CsFYaS3tntysCSCAPJBKTcMWuzUmxBG0MTrEJMfMFeNSUo+KQGaqzp3"
}

Keywords

FAQs

Package last updated on 11 Sep 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