Gathering detailed insights and metrics for @visulima/packem-share
Gathering detailed insights and metrics for @visulima/packem-share
Gathering detailed insights and metrics for @visulima/packem-share
Gathering detailed insights and metrics for @visulima/packem-share
A fast and modern bundler for Node.js and TypeScript.
npm install @visulima/packem-share
Typescript
Module System
Min. Node Version
Node Version
NPM Version
@visulima/packem@2.0.0-alpha.2
Updated on Jul 02, 2025
@visulima/packem@2.0.0-alpha.1
Updated on Jul 02, 2025
@visulima/rollup-css-plugin@1.0.0-alpha.2
Updated on Jul 02, 2025
@visulima/packem-rollup@1.0.0-alpha.2
Updated on Jul 02, 2025
@visulima/packem-share@1.0.0-alpha.2
Updated on Jul 02, 2025
@visulima/css-style-inject@1.0.0-alpha.2
Updated on Jul 02, 2025
TypeScript (97.95%)
JavaScript (0.75%)
Handlebars (0.71%)
Shell (0.22%)
SCSS (0.14%)
CSS (0.13%)
Less (0.04%)
SugarSS (0.03%)
Stylus (0.02%)
Sass (0.01%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
5 Stars
314 Commits
1 Forks
1 Watchers
14 Branches
1 Contributors
Updated on Jun 30, 2025
Latest Version
1.0.0-alpha.1
Package Id
@visulima/packem-share@1.0.0-alpha.1
Unpacked Size
202.53 kB
Size
50.37 kB
File Count
31
NPM Version
10.9.3
Node Version
20.19.2
Published on
Jul 02, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
Shared utilities, constants, and types for the Packem ecosystem
Daniel Bannert's open source work is supported by the community on GitHub Sponsors
@visulima/packem-share
is a shared utility library that provides common functionality used across the Packem ecosystem. It eliminates code duplication by centralizing frequently used utilities, constants, and TypeScript types.
This package was created as part of a code deduplication effort that eliminated ~20KB of duplicate code across multiple Packem packages while maintaining full backward compatibility.
1npm install @visulima/packem-share
1yarn add @visulima/packem-share
1pnpm add @visulima/packem-share
The package provides multiple import patterns for maximum flexibility:
1import { arrayify, getHash, FileCache, Environment, Mode } from "@visulima/packem-share"; 2 3// Use utilities directly 4const result = arrayify("single-value"); // ["single-value"] 5const hash = getHash("content"); 6const cache = new FileCache("/path", "/cache", "key", logger);
1import { constants, types, utils } from "@visulima/packem-share"; 2 3// Access grouped exports 4const extensions = constants.DEFAULT_EXTENSIONS; 5const mode: types.Mode = "build"; 6const normalized = utils.arrayify([1, 2, 3]);
1import * as PackemShare from "@visulima/packem-share"; 2 3// Access everything through namespace 4const result = PackemShare.arrayify("value"); 5const hash = PackemShare.getHash("content");
1import * as constants from "@visulima/packem-share/constants"; 2import * as types from "@visulima/packem-share/types"; 3import * as utils from "@visulima/packem-share/utils"; 4 5// Import specific modules 6const extensions = constants.DEFAULT_EXTENSIONS; 7const normalized = utils.arrayify("value");
Core constants used throughout the Packem ecosystem:
1import { 2 DEFAULT_EXTENSIONS, 3 DEFAULT_LOADERS, 4 PRODUCTION_ENV, 5 DEVELOPMENT_ENV, 6 RUNTIME_EXPORT_CONVENTIONS, 7 SPECIAL_EXPORT_CONVENTIONS, 8 EXCLUDE_REGEXP, 9 ENDING_REGEX, 10 CHUNKS_PACKEM_FOLDER, 11 SHARED_PACKEM_FOLDER, 12 ALLOWED_TRANSFORM_EXTENSIONS_REGEX 13} from "@visulima/packem-share";
TypeScript type definitions for the Packem ecosystem:
1import type { Environment, Mode, Format, Runtime } from "@visulima/packem-share"; 2 3type Environment = "production" | "development" | undefined; 4type Mode = "build" | "jit" | "watch"; 5type Format = "cjs" | "esm"; 6type Runtime = "browser" | "bun" | "deno" | "edge-light" | "electron" | "node" | "react-native" | "react-server" | "workerd" | undefined;
1import { arrayify, arrayIncludes } from "@visulima/packem-share"; 2 3// Convert single values to arrays 4arrayify("single") // ["single"] 5arrayify(["already", "array"]) // ["already", "array"] 6arrayify(null) // [] 7 8// Array search with RegExp support 9arrayIncludes(["test.js", "test.ts"], /\.ts$/) // true
1import { 2 FileCache, 3 getChunkFilename, 4 getEntryFileNames, 5 getHash 6} from "@visulima/packem-share"; 7 8// File caching 9const cache = new FileCache(cwd, cachePath, hashKey, logger); 10cache.set("key", data); 11const cached = cache.get("key"); 12 13// Filename generation 14const chunkName = getChunkFilename("chunk", hash, format); 15const entryNames = getEntryFileNames(entries, format); 16 17// Content hashing 18const hash = getHash("file content");
1import { 2 getPackageName, 3 getRegexMatches, 4 replaceContentWithinMarker, 5 svgEncoder, 6 warn 7} from "@visulima/packem-share"; 8 9// Package name extraction 10getPackageName("@scope/package/path") // "@scope/package" 11getPackageName("package/path") // "package" 12 13// Regex utilities 14const matches = getRegexMatches(/pattern/g, "text"); 15 16// Content replacement 17const updated = replaceContentWithinMarker(content, "marker", newContent); 18 19// SVG encoding 20const encoded = svgEncoder(svgContent); 21 22// Warning utilities 23warn(logger, "Warning message", "prefix");
1import { memoize, memoizeByKey } from "@visulima/packem-share"; 2 3// Function memoization 4const memoized = memoize(expensiveFunction); 5const keyMemoized = memoizeByKey(expensiveFunction)("cache-key");
1import { 2 enhanceRollupError, 3 sortUserPlugins 4} from "@visulima/packem-share"; 5 6// Error enhancement 7const enhanced = enhanceRollupError(error, context); 8 9// Plugin sorting 10const [pre, normal, post] = sortUserPlugins(plugins, hookName);
If you were previously importing utilities from @visulima/packem
or @visulima/packem-rollup
, you can now import them directly from this shared package:
1// Before 2import { arrayify } from "@visulima/packem/utils"; 3import { getHash } from "@visulima/packem-rollup/utils"; 4 5// After 6import { arrayify, getHash } from "@visulima/packem-share";
Note: The original packages still re-export these utilities for backward compatibility.
Libraries in this ecosystem make the best effort to track Node.js' release schedule. Here's a post on why we think this is important.
If you would like to help take a look at the list of issues and check our Contributing guidelines.
Note: please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
The @visulima/packem-share is open-sourced software licensed under the MIT
No vulnerabilities found.
Reason
update tool detected
Details
Reason
security policy file detected
Details
Reason
no dangerous workflow patterns detected
Reason
30 commit(s) and 3 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
SAST tool is run on all commits
Details
Reason
1 out of 1 merged PRs checked by a CI test -- score normalized to 10
Reason
project has 4 contributing companies or organizations
Details
Reason
0 existing vulnerabilities detected
Reason
dependency not pinned by hash detected -- score normalized to 8
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-08T07:34:44Z
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More