{"id":13774579,"url":"https://github.com/lemmabit/rollup-plugin-hypothetical","last_synced_at":"2025-03-22T17:31:19.174Z","repository":{"id":47498517,"uuid":"58593675","full_name":"lemmabit/rollup-plugin-hypothetical","owner":"lemmabit","description":"gives Rollup an imaginary file system, e.g. for testing other plugins","archived":false,"fork":false,"pushed_at":"2023-05-25T12:10:50.000Z","size":97,"stargazers_count":42,"open_issues_count":2,"forks_count":14,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-05-18T20:42:03.030Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lemmabit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-12T00:31:26.000Z","updated_at":"2024-06-18T14:03:16.285Z","dependencies_parsed_at":"2024-06-18T14:03:04.132Z","dependency_job_id":"7a66e969-2281-4271-85a8-92756b83c5f8","html_url":"https://github.com/lemmabit/rollup-plugin-hypothetical","commit_stats":{"total_commits":74,"total_committers":4,"mean_commits":18.5,"dds":0.04054054054054057,"last_synced_commit":"aac293abbefabc3ce7bde6c79b9e01dab2098cb5"},"previous_names":["permutatrix/rollup-plugin-hypothetical"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemmabit%2Frollup-plugin-hypothetical","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemmabit%2Frollup-plugin-hypothetical/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemmabit%2Frollup-plugin-hypothetical/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemmabit%2Frollup-plugin-hypothetical/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lemmabit","download_url":"https://codeload.github.com/lemmabit/rollup-plugin-hypothetical/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244995109,"owners_count":20544287,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T17:01:28.172Z","updated_at":"2025-03-22T17:31:18.898Z","avatar_url":"https://github.com/lemmabit.png","language":"JavaScript","funding_links":[],"categories":["Plugins"],"sub_categories":["Other File Imports"],"readme":"# rollup-plugin-hypothetical [![npm][npm-image]][npm-url] [![Build Status][ghactions-image]][ghactions-url]\nThis allows [Rollup] modules to import hypothetical files passed in as options to the plugin.\n\n## Installation\n```bash\nnpm install --save-dev rollup-plugin-hypothetical\n```\n\n## Usage\n```js\n// rollup.config.js\nimport hypothetical from 'rollup-plugin-hypothetical';\n\nexport default {\n  entry: './dir/a.js',\n  plugins: [hypothetical({\n    files: {\n      './dir/a.js': `\n        import foo from './b.js';\n        foo();\n      `,\n      './dir/b.js': `\n        import message from 'external';\n        export default function foo() {\n          console.log(message);\n        }\n      `,\n      'external/': `\n        export default \"Hello, World!\";\n      `\n    }\n  })]\n};\n```\n\n## Sourcemaps\nTo attach a sourcemap to a hypothetical file, simply pass in a `{ code, map }` object instead of a string. The sourcemap can have its own `sources`, `sourcesContent`, etc.\n\n## Options\n### options.files\nAn object whose keys are paths, either relative to the current working directory or absolute, and whose values are the code within the hypothetical files at those paths.\n\n### options.filesMap\nRather than supplying a plain object to `options.files`, you may choose to supply a `Map` to `options.filesMap`. This will allow you to do things like naming your hypothetical files `__proto__`.\n\n### options.allowFallthrough\nDefaults to `false`. Set this to `true` to allow non-external imports to fall through. That way they can be handled either by Rollup's default behavior (reading from the filesystem) or by a plugin further down the chain if there is one.\n\n### options.allowExternalFallthrough\nDefaults to `true`. Set this to `false` to forbid external imports from falling through.\n\n### options.allowRelativeExternalFallthrough\nDefaults to `false`. Set this to `true` to allow relative imports from supplied external modules to fall through. For instance, suppose you have the following `options.files`:\n\n```js\n{\n  './main.js': `\n    import 'external/x.js';\n  `,\n  'external/x.js': `\n    import './y.js';\n  `\n}\n```\n\nThe supplied file `external/x.js` imports `external/y.js`, but `external/y.js` isn't supplied. This sort of thing is probably a mistake. If it isn't, set `options.allowRelativeExternalFallthrough` to `true` and **remember** to [include `external: ['external/y.js']` in the options you pass to `rollup.rollup`](https://rollupjs.org/#external-e-external-). If you forget that part, your build won't work, and weird things may happen instead!\n\n### options.leaveIdsAlone\nWhen this is set to `true`, the IDs in `import` statements won't be treated as paths and will instead be looked up directly in the `files` object. There will be no relative importing, path normalization, or restrictions on the contents of IDs.\n\n### options.impliedExtensions\nSet this to an array of file extensions to try appending to imports if an exact match isn't found. Defaults to `['.js', '/']`. If this is set to `false` or an empty array, file extensions and trailing slashes in imports will be treated as mandatory.\n\n### options.cwd\nWhen this is set to a directory name, relative file paths will be resolved relative to that directory rather than `process.cwd()`. When it's set to `false`, they will be resolved relative to an imaginary directory that cannot be expressed as an absolute path.\n\n\n## License\nMIT\n\n\n[npm-url]:       https://npmjs.org/package/rollup-plugin-hypothetical\n[ghactions-url]: https://github.com/lemmabit/rollup-plugin-hypothetical/actions/workflows/node.js.yml\n\n[npm-image]:       https://img.shields.io/npm/v/rollup-plugin-hypothetical.svg\n[ghactions-image]: https://github.com/lemmabit/rollup-plugin-hypothetical/actions/workflows/node.js.yml/badge.svg\n\n[Rollup]: https://www.npmjs.com/package/rollup\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flemmabit%2Frollup-plugin-hypothetical","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flemmabit%2Frollup-plugin-hypothetical","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flemmabit%2Frollup-plugin-hypothetical/lists"}