npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

webpack-plugin-conceal

v1.4.2

Published

Webpack plugin to conceal structured data; transforms default-exported JavaScript object arrays into Base64 at build time, and decodes them at runtime. Helps obscure sensitive or business-critical data in your frontend bundle.

Downloads

9

Readme

Webpack Plugin Conceal

webpack-plugin-conceal is a Webpack loader that helps obscure JavaScript object arrays in your source code. At build time, it transforms your data into Base64-encoded strings, reducing the visibility of raw values in the final bundle. At runtime, it seamlessly decodes the data back into usable JavaScript objects.

NPM version License: ISC


What It Does

Imagine this source file:

// users.conceal.ts
export default [
  { name: 'Alice', age: 30 },
  { name: 'Bob', age: 25 }
];

Instead of including the raw names "Alice" and "Bob" directly in your production bundle, the plugin will transform it during build into:

import { decode } from 'webpack-plugin-conceal';

export default decode([
  { name: "\"QWxpY2U=\"", age: "MzA=" },
  { name: "\"Qm9i\"", age: "MjU=" }
]);

Then, at runtime, the decode() function will automatically decode the Base64 strings and parse them back to their original values:

[
  { name: 'Alice', age: 30 },
  { name: 'Bob', age: 25 }
]

This makes it harder for tools or users inspecting your production JavaScript to directly read your raw data.


Features

  • Transform any pattern of files (e.g.: .conceal.js, .conceal.ts, .conceal.jsx, .conceal.tsx)
  • Encodes JavaScript object arrays using Base64-encoded JSON
  • Automatically decodes data at runtime
  • Lightweight and easy to configure

Installation

npm install webpack-plugin-conceal
# or
yarn add webpack-plugin-conceal

Usage

1. Add the loader to Webpack config

module.exports = {
  module: {
    rules: [
      {
        test: /\.conceal\.(js | ts)$/,
        use: [
          {
            loader: 'webpack-plugin-conceal',
          }
        ]
      }
    ]
  }
};

2. Create a .conceal.ts or .conceal.js file

// data.conceal.ts
export default [
  { name: 'Alice', age: 30 },
  { name: 'Bob', age: 25 }
];

3. Import created before file(s) somewhere in the application.

import usersData from './users.conceal';

console.log(usersData);

How It Works

  1. The plugin identifies files matching the configured pattern.
  2. It evaluates the file content to extract the default export (must be an array of objects).
  3. Each object is encoded by:
  • Serializing each value to JSON
  • Encoding each JSON string using Base64
  1. A transformed module is generated that decodes the data at runtime.

API

encode(data: any[]): Record<string, string>[]

Encodes an array of objects into Base64-encoded strings.

decode(source: any[]): any[]

Decodes an array of Base64-encoded object properties back to JavaScript values.


Caveats

  • Only supports CommonJS modules with a module.exports assignment to an array
  • Input file must export a variable named base64data
  • Intended for basic obfuscation, not for secure encryption

License

ISC © 2025 Dmitrii Zakharov