{"_id":"@codingame/rollup-import-meta-assets-plugin","name":"@codingame/rollup-import-meta-assets-plugin","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@codingame/rollup-import-meta-assets-plugin","version":"1.0.0","description":"Rollup plugin that detects assets references relative to modules using patterns such as new URL('./assets/my-img.png', import.meta.url).","scripts":{"build":"tsc"},"license":"MIT","main":"dist/plugin.js","module":"dist/plugin.js","types":"dist/plugin.d.ts","devDependencies":{"@codingame/tsconfig":"^1.1.1","@rollup/plugin-dynamic-import-vars":"^2.1.5","@rollup/pluginutils":"^5.2.0","@types/estree":"^1.0.8","rollup":"^4.49.0","typescript":"^5.9.2","@types/node":"^24.3.0"},"dependencies":{"acorn":"^8.15.0","estree-walker":"^3.0.3","globby":"^14.1.0","magic-string":"^0.30.18"},"_id":"@codingame/rollup-import-meta-assets-plugin@1.0.0","gitHead":"cbfbc0a0f8262f36cab1d068a49e3174a39bc04d","_nodeVersion":"22.17.1","_npmVersion":"10.3.0","dist":{"integrity":"sha512-kS7r1VQ4pNh6bUfqcLHWycSwvfcc1G8hYUYte+FfTG0MZDqgIPN2EE9A6DDf20Bjf7c/Q1W05CLc6Dw+BT+Smg==","shasum":"d74d68fcb0677f2fff638200ad3923604c978c91","tarball":"https://registry.npmjs.org/@codingame/rollup-import-meta-assets-plugin/-/rollup-import-meta-assets-plugin-1.0.0.tgz","fileCount":5,"unpackedSize":13772,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCiesu+Nj4EkJbUAoJvi5rcdyPKHDNsGQGUDXW1YfTyTQIhAMKbO3t/RUQgg/RpbQ5nVuNxCOoy1h1IvGdyd+eyE9Co"}]},"_npmUser":{"name":"nonofr","email":"loic@codingame.com"},"directories":{},"maintainers":[{"name":"nonofr","email":"loic@codingame.com"},{"name":"samuel.olivier","email":"samuel@coderpad.io"},{"name":"nantoniazzi","email":"nicolas@codingame.com"},{"name":"maximecg","email":"maxime@codingame.com"},{"name":"codingame_team","email":"developers@codingame.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/rollup-import-meta-assets-plugin_1.0.0_1756480762810_0.5155279809939166"},"_hasShrinkwrap":false}},"time":{"created":"2025-08-29T15:19:22.743Z","1.0.0":"2025-08-29T15:19:22.986Z","modified":"2025-08-29T15:19:23.255Z"},"maintainers":[{"name":"nonofr","email":"loic@codingame.com"},{"name":"samuel.olivier","email":"samuel@coderpad.io"},{"name":"nantoniazzi","email":"nicolas@codingame.com"},{"name":"maximecg","email":"maxime@codingame.com"},{"name":"codingame_team","email":"developers@codingame.com"}],"description":"Rollup plugin that detects assets references relative to modules using patterns such as new URL('./assets/my-img.png', import.meta.url).","license":"MIT","readme":"# Rollup Plugin import-meta-assets\n\nRollup plugin that detects assets references relative to modules using patterns such as `new URL('./assets/my-img.png', import.meta.url)`.\n\nThe referenced assets are added to the rollup pipeline, allowing them to be transformed and hash the filenames.\n\n## How it works\n\nA common pattern is to import an asset to get the URL of it after bundling:\n\n```js\nimport myImg from './assets/my-img.png';\n```\n\nThis doesn't work in the browser without transformation. This plugin makes it possible to use an identical pattern using `import.meta.url` which does work in the browser:\n\n```js\nconst myImg = new URL('./assets/my-img.png', import.meta.url);\n```\n\n### Dynamic variables\n\nYou can also use dynamic variables like so:\n\n```js\nconst myImg = new URL(`./assets/${myImg}.png`, import.meta.url);\n```\n\nPlease consult the [dynamic-import-vars plugin](https://github.com/rollup/plugins/blob/master/packages/dynamic-import-vars) documentation for options and limitations.\n\n## Install\n\nUsing npm:\n\n```\nnpm install @codingame/rollup-import-meta-assets-plugin --save-dev\n```\n\n## Usage\n\nCreate a rollup.config.js [configuration file](https://www.rollupjs.org/guide/en/#configuration-files) and import the plugin:\n\n```js\nimport importMetaAssets from '@codingame/rollup-import-meta-assets-plugin';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    dir: 'output',\n    format: 'es',\n  },\n  plugins: [importMetaAssets()],\n};\n```\n\nThen call `rollup` either via the [CLI](https://www.rollupjs.org/guide/en/#command-line-reference) or the [API](https://www.rollupjs.org/guide/en/#javascript-api).\n","readmeFilename":"README.md","_rev":"1-2a3badaa5a76b6ca41bdf2fdc3200add"}