Registry / testing / rollup-plugin-hypothetical

rollup-plugin-hypothetical

JSON →
library2.1.1jsnpmunverified

A Rollup plugin that provides a virtual file system for testing other plugins without actual disk I/O. Version 2.1.1 is stable, with infrequent releases. Unlike other virtual file plugins, it supports sourcemaps via { code, map } objects, configurable fallthrough behavior, implied extensions, and custom CWD. Ideal for unit testing Rollup plugins that depend on file resolution.

npm install rollup-plugin-hypothetical
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-HYPO
R
rollup-plugin-hypothetical
testingjavascriptv2.1.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import hypothetical from 'rollup-plugin-hypothetical'
const hypothetical = require('rollup-plugin-hypothetical').default
ESM-only; has default export.
hypothetical
import hypothetical from 'rollup-plugin-hypothetical'
import { hypothetical } from 'rollup-plugin-hypothetical'
Export is default, not named.
hypothetical
const hypothetical = require('rollup-plugin-hypothetical')
const { hypothetical } = require('rollup-plugin-hypothetical')
CJS require returns the default; destructuring fails.

Creates a Rollup config with hypothetical files for a simple greeting module.

// rollup.config.js import hypothetical from 'rollup-plugin-hypothetical'; export default { input: 'main.js', plugins: [ hypothetical({ files: { 'main.js': ` import { greet } from './greet.js'; console.log(greet('World')); `, 'greet.js': ` export function greet(name) { return 'Hello, ' + name + '!'; } ` } }) ], output: { file: 'out.js', format: 'esm' } }; // Then run: npx rollup -c
Debug
Known issues
gotchaOptions.files keys are resolved relative to process.cwd() by default, not rollup's input file directory.
fix
Use absolute paths or set options.cwd explicitly to match your project root.
affects: >=1.0.0
deprecatedUsing options.files with a plain object may cause issues with keys like __proto__.
fix
Use options.filesMap (Map) instead to avoid prototype pollution.
affects: >=2.0.0
gotchaExternal imports fall through by default (allowExternalFallthrough=true), which may cause silent errors if the import is not resolved.
fix
Set allowExternalFallthrough: false to force explicit definitions for external imports.
affects: >=1.0.0
breakingoptions.impliedExtensions default changed from ['.js'] to ['.js', '/'] in v2.0.0.
fix
If relying on the old default, explicitly set impliedExtensions: ['.js'].
affects: >=2.0.0 <2.1.0
Errors
Common errors & fixes
Error: Could not resolve './nonexistent.js' from 'main.js'
File not defined in options.files and allowFallthrough is false.
fix
Add the file to options.files or set allowFallthrough: true if you want Rollup to resolve it from disk.
Error: Cannot find module 'rollup-plugin-hypothetical'
Package not installed.
fix
Run `npm install --save-dev rollup-plugin-hypothetical`.
TypeError: hypothetical is not a function
Incorrect import: using named import instead of default.
fix
Use `import hypothetical from 'rollup-plugin-hypothetical'` (default import).
Upgrade
Version history
2.1.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Resources
rollup-plugin-hypothetical — npm install rollup-plugin-hypothetical · libregistry