{"id":22062,"library":"rollup-plugin-hypothetical","title":"rollup-plugin-hypothetical","description":"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.","status":"active","version":"2.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/Permutatrix/rollup-plugin-hypothetical","tags":["javascript","rollup-plugin"],"install":[{"cmd":"npm install rollup-plugin-hypothetical","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-hypothetical","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-hypothetical","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only; has default export.","wrong":"const hypothetical = require('rollup-plugin-hypothetical').default","symbol":"default","correct":"import hypothetical from 'rollup-plugin-hypothetical'"},{"note":"Export is default, not named.","wrong":"import { hypothetical } from 'rollup-plugin-hypothetical'","symbol":"hypothetical","correct":"import hypothetical from 'rollup-plugin-hypothetical'"},{"note":"CJS require returns the default; destructuring fails.","wrong":"const { hypothetical } = require('rollup-plugin-hypothetical')","symbol":"hypothetical","correct":"const hypothetical = require('rollup-plugin-hypothetical')"}],"quickstart":{"code":"// rollup.config.js\nimport hypothetical from 'rollup-plugin-hypothetical';\n\nexport default {\n  input: 'main.js',\n  plugins: [\n    hypothetical({\n      files: {\n        'main.js': `\n          import { greet } from './greet.js';\n          console.log(greet('World'));\n        `,\n        'greet.js': `\n          export function greet(name) {\n            return 'Hello, ' + name + '!';\n          }\n        `\n      }\n    })\n  ],\n  output: { file: 'out.js', format: 'esm' }\n};\n\n// Then run: npx rollup -c","lang":"typescript","description":"Creates a Rollup config with hypothetical files for a simple greeting module."},"warnings":[{"fix":"Use absolute paths or set options.cwd explicitly to match your project root.","message":"Options.files keys are resolved relative to process.cwd() by default, not rollup's input file directory.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use options.filesMap (Map) instead to avoid prototype pollution.","message":"Using options.files with a plain object may cause issues with keys like __proto__.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Set allowExternalFallthrough: false to force explicit definitions for external imports.","message":"External imports fall through by default (allowExternalFallthrough=true), which may cause silent errors if the import is not resolved.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"If relying on the old default, explicitly set impliedExtensions: ['.js'].","message":"options.impliedExtensions default changed from ['.js'] to ['.js', '/'] in v2.0.0.","severity":"breaking","affected_versions":">=2.0.0 <2.1.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Add the file to options.files or set allowFallthrough: true if you want Rollup to resolve it from disk.","cause":"File not defined in options.files and allowFallthrough is false.","error":"Error: Could not resolve './nonexistent.js' from 'main.js'"},{"fix":"Run `npm install --save-dev rollup-plugin-hypothetical`.","cause":"Package not installed.","error":"Error: Cannot find module 'rollup-plugin-hypothetical'"},{"fix":"Use `import hypothetical from 'rollup-plugin-hypothetical'` (default import).","cause":"Incorrect import: using named import instead of default.","error":"TypeError: hypothetical is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}