Alexandro.Net

Version 1.0.6

@stackline/loader-utils

Maintained, security-hardened fork compatible with loader-utils 2.0.4 consumers

Installation

npm install @stackline/loader-utils@1.0.6

Node.js: >=12.13.0. Read the compatibility and maintenance notes before migrating.

Usage and API

@stackline/loader-utils

Maintained, security-hardened fork compatible with loader-utils 2.0.4 consumers.

npm version license GitHub repository Docs Reddit community

Documentation | npm | Issues | Repository

Current package version: 1.0.6


Why this package?

Maintained, security-hardened utilities for webpack loaders. This package preserves the complete public API and behavior of loader-utils@2.0.4, including Webpack 4 option parsing and legacy deep imports.

Why This Fork Exists

The upstream webpack/loader-utils repository was archived in March 2025. Stackline maintains this fork so projects can retain the established API while using an actively tested package with:

This is an independent fork and is not affiliated with webpack or the JS Foundation.

Compatibility

Item Value
Package @stackline/loader-utils@1.0.6
Node.js runtime >=12.13.0
CommonJS / primary entry ./lib/index.js
Type declarations ./index.d.ts
Surface Support
Runtime Node.js 12.13+
Modules CommonJS, dynamic ESM import
TypeScript 3.9 and current
Baseline Complete loader-utils@2.0.4 API
Deep imports Preserved
Production dependencies emojis-list: npm:@stackline/emojis-list@1.0.0, json5: npm:@stackline/json5@1.0.0 (both leaf packages)

The scoped package uses its own 1.x release line. @stackline/loader-utils@1.0.3 is the first public release, validated against the complete 2.0.4 contract and real resolve-url-loader Webpack 4/5 builds.

Installation

Install

New projects can use the scoped name:

Usage

npm install @stackline/loader-utils
const loaderUtils = require("@stackline/loader-utils");

For an existing project that imports loader-utils, use an npm alias and keep every source import unchanged:

npm install loader-utils@npm:@stackline/loader-utils
const loaderUtils = require("loader-utils");

Features and Integrations

Documentation

Security

Review inputs and the package-specific compatibility limits before processing untrusted data. Report suspected vulnerabilities as described in the security policy.

API Surface

API

Loader context helpers

getOptions, parseQuery, stringifyRequest, getRemainingRequest, getCurrentRequest and parseString retain their loader-utils@2.0.4 signatures and behavior. Query parsing additionally ignores __proto__, prototype and constructor keys.

const options = loaderUtils.getOptions(this);
const request = loaderUtils.stringifyRequest(this, this.resourcePath);

isUrlRequest(url)

Returns whether a URL should be handled as a webpack request.

if (loaderUtils.isUrlRequest("images/logo.svg")) {
  // Handle the value as a module request.
}

urlToRequest(url, root?)

Converts a resource URL to a webpack module request.

loaderUtils.urlToRequest("styles/main.css");
// "./styles/main.css"

loaderUtils.urlToRequest("/images/logo.svg", "/public");
// "/public/images/logo.svg"

interpolateName(loaderContext, name?, options?)

Interpolates [ext], [name], [path], [folder], [query], [hash] and [contenthash] filename tokens.

const filename = loaderUtils.interpolateName(
  { resourcePath: "/src/logo.svg" },
  "assets/[name].[contenthash:8].[ext]",
  { content: Buffer.from("file contents") }
);

Supported digest templates include xxhash64, md4, native-md4, Node.js crypto algorithms, hex, base26, base32, base36, base49, base52, base58, base62, base64 and base64safe.

getHashDigest(buffer, hashType?, digestType?, maxLength?)

Creates a loader-compatible content digest.

loaderUtils.getHashDigest(
  Buffer.from("file contents"),
  "sha256",
  "base64safe",
  12
);

Local Development

git clone https://github.com/alexandroit/stackline-loader-utils.git
cd stackline-loader-utils
npm ci
npm run verify

Release tooling uses Node.js 24.20.0 and npm 11.19.0. The consumer runtime contract remains the one documented above.

Consumer Smoke Test

Run the repository's existing consumer/package check after installing development dependencies:

npm run test:smoke

Release Checklist

Verification

npm ci
npm run verify

The release gate runs linting, the complete upstream suite, differential compatibility tests, security regressions, TypeScript 3.9/current checks, coverage thresholds, direct and alias installation smoke tests, package validation and full/prod npm audits.

Run npm run verify and inspect the package contents before release. Publish a new version through the GitHub Actions publishing workflow, using the SHA-512 digest of the reviewed tarball. Verify the exact published version, tarball integrity, and npm provenance after the run.

License

License and Attribution

MIT. The original copyright and license are preserved in LICENSE. See NOTICE and THIRD_PARTY_LICENSES.md for provenance and attribution.

Dependency maintenance for this release is documented in DEPENDENCY_UPDATES.md.

Credits and original authors

Original copyright, license notices and contributor acknowledgements remain part of this distribution. Stackline maintenance does not replace authorship of the original work.

Community and Links

Use this repository's issue tracker for reproducible bugs and feature requests. Join r/Stackline for examples, usage questions and release discussions.

Migration

Migration

Keep Existing Imports

Replace the registry dependency with an npm alias:

{
  "dependencies": {
    "loader-utils": "npm:@stackline/loader-utils@1.0.2"
  }
}

No JavaScript or TypeScript import changes are required:

const loaderUtils = require("loader-utils");

Use the Scoped Name

New code can depend directly on the maintained package:

{
  "dependencies": {
    "@stackline/loader-utils": "1.0.2"
  }
}
const loaderUtils = require("@stackline/loader-utils");

Compatibility Baseline

The 1.0.x Stackline line targets the complete loader-utils@2.0.4 contract: all ten root exports, export order, overlapping URL/hash behavior, JSON5 query parsing, emoji interpolation and deep imports. This allows existing Webpack 4 loader paths to migrate without source changes.

Lockfile Verification

After changing the dependency, regenerate the lockfile and verify the complete installed tree:

npm install
npm ls --all
npm audit --omit=dev --audit-level=low

Compatibility

Compatibility Policy

@stackline/loader-utils is a maintained, security-hardened fork of loader-utils@2.0.4.

Preserved Contract

Version Mapping

Stackline release Upstream behavior baseline
1.0.0 Verdaccio-only 3.3.1 preflight; never promote
1.0.1 Verdaccio-only mixed-semantics preflight; never promote
1.0.2+ Complete loader-utils@2.0.4 contract with security hardening

Patch releases may add tests, documentation, declarations and security hardening that does not intentionally change the public contract. Any intentional breaking change requires a new major version.

Continuous Evidence

The suite executes a broad differential matrix against an independently installed loader-utils@2.0.4, including hash algorithms, every custom base, truncation, URL roots, query forms, request serialization and deterministic emoji interpolation. The package is also installed under both its scoped name and the legacy loader-utils key before release, then exercised by real Webpack 4 and 5 builds in @stackline/resolve-url-loader.

Release changes

Changelog

1.0.4 - 2026-09-28

[1.0.3] - 2026-09-28

All notable changes to this project will be documented in this file.

[1.0.2] - 2026-08-30

Fixed

Security

Compatibility

[1.0.1] - 2026-08-30

Added

Changed

[1.0.0] - 2026-08-30

Added

Preserved

3.3.1 (2024-06-05)

Bug Fixes

3.3.0 (2024-06-04)

Features

3.2.2 (2024-05-29)

Bug Fixes

3.2.1 (2022-11-11)

Bug Fixes

3.2.0 (2021-11-11)

Features

3.1.3 (2021-11-04)

Bug Fixes

3.1.2 (2021-11-04)

Bug Fixes

3.1.1 (2021-11-04)

Bug Fixes

3.1.0 (2021-10-29)

Features

3.0.0 (2021-10-20)

⚠ BREAKING CHANGES

Bug Fixes

2.0.0 (2020-03-17)

⚠ BREAKING CHANGES

1.4.0 (2020-02-19)

Features

1.3.0 (2020-02-19)

Features

1.2.3 (2018-12-27)

Bug Fixes

1.2.2 (2018-12-27)

Bug Fixes

1.2.1 (2018-12-25)

Bug Fixes

Reverts

1.2.0 (2018-12-24)

Features

Fixes

1.1.0 (2017-03-16)

Features

Release files and references

Package bytes, npm provenance and the immutable GitHub release were verified for this version. Security checks describe the reviewed release; documented compatibility risks and upstream reports are not blanket claims of resolution.