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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@dataunlocker/script

v2.0.0

Published

A hook script installed to your website that enables DataUnlocker's proxy engine for scripts already present on the page.

Downloads

12

Readme

@dataunlocker/script

A sync "hook" script installed to your website that enables DataUnlocker's proxy engine synchronously (when page starts loading).

Installation

This package downloads a sync DataUnlocker's script that corresponds to your domain when being installed.

You will need to specify your DataUnlocker domain ID before installing the package. Follow the installation guide at admin.dataunlocker.com for more details.

Install with env variable

Available env variables:

# Required. ID of your DataUnlocker domain. This is a private information which must not be shared publicly.
DATAUNLOCKER_ID=000000000000000000000000

# Optional. When set, downloads DataUnlocker's legacy (v1) script which doesn't support Defender. Defaults to unset.
LEGACY_SCRIPT=1

.npmrc

Set the DATAUNLOCKER_ID environment variable before running npm install to define what domain should it download the script for. For instance with npm, you can set it globally in the .npmrc file.

# ...other contents of .npmrc file here...
DATAUNLOCKER_ID=000000000000000000000000

The script itself will be downloaded when you install the package.

npm install @dataunlocker/script

Manually set the env variable before npm install

Alternatively, set the variable in any way preferred but before running NPM install. For instance,

DATAUNLOCKER_ID=000000000000000000000000 npm install

Mind to change DATAUNLOCKER_ID respectively to the environment you're installing DataUnlocker script for, as it is domain-dependent.

Install for a single domain

If your web app has only one environment, you can also install this package for a single DataUnlocker ID by using an alias name:

npm install @dataunlocker/script~000000000000000000000000@npm:@dataunlocker/script

Incremental builds

Some app platforms (like Vercel) perform incremental builds, where each new deployment skips the module installation step if the module is installed. This makes it skip downloading the latest version of DataUnlocker's script as well.

To make your build re-fetch the new script on every new build, add the following to the postinstall script to your package.json:

{
  "scripts": {
    "postinstall": "dataunlocker-script fetch"
  }
}

Mind to also provide the DATAUNLOCKER_ID env variable, if needed.

Usage

After installing the package, import the plain javascript into your web application page template with:

import { plainSyncScript } from '@dataunlocker/script'; // If your bundler supports tree-shaking
import script from '@dataunlocker/script/lib/plain.module.js'; // Import a specific module

// Inject {plainSyncScript} into your HTML template (all HTML pages) as a sync inline script.
// The injection method depends on the technology stack you're using.

The plain JavaScript as a file (if needed) is available at node_modules/@dataunlocker/script/lib/plain.js.

Follow alternative guides for your front end stack if installing this package via the package manager doesn't work for you. Also try browsing issues here or add new for your stack.