Project Init

This commit is contained in:
Muluhabt
2026-05-29 15:23:46 +03:00
commit 2fbc557aac
67387 changed files with 6063341 additions and 0 deletions

91
node_modules/@rollup/plugin-image/README.md generated vendored Executable file
View File

@@ -0,0 +1,91 @@
[npm]: https://img.shields.io/npm/v/@rollup/plugin-image
[npm-url]: https://www.npmjs.com/package/@rollup/plugin-image
[size]: https://packagephobia.now.sh/badge?p=@rollup/plugin-image
[size-url]: https://packagephobia.now.sh/result?p=@rollup/plugin-image
[![npm][npm]][npm-url]
[![size][size]][size-url]
[![libera manifesto](https://img.shields.io/badge/libera-manifesto-lightgrey.svg)](https://liberamanifesto.com)
# @rollup/plugin-image
🍣 A Rollup plugin which imports JPG, PNG, GIF, SVG, and WebP files.
Images are encoded using base64, which means they will be 33% larger than the size on disk. You should therefore only use this for small images where the convenience of having them available on startup (e.g. rendering immediately to a canvas without co-ordinating asynchronous loading of several images) outweighs the cost.
## Requirements
This plugin requires an [LTS](https://github.com/nodejs/Release) Node version (v14.0.0+) and Rollup v1.20.0+.
## Install
Using npm:
```console
npm install @rollup/plugin-image --save-dev
```
## Usage
Assuming a `src/index.js` exists and contains code like the following:
```js
import logo from './rollup.png';
console.log(logo);
```
Create a `rollup.config.js` [configuration file](https://www.rollupjs.org/guide/en/#configuration-files) and import the plugin:
```js
import image from '@rollup/plugin-image';
export default {
input: 'src/index.js',
output: {
dir: 'output',
format: 'cjs'
},
plugins: [image()]
};
```
Then 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).
Once the bundle is executed, the `console.log` will display the Base64 encoded representation of the image.
## Options
### `dom`
Type: `Boolean`<br>
Default: `false`
If `true`, instructs the plugin to generate an ES Module which exports a DOM `Image` which can be used with a browser's DOM. Otherwise, the plugin generates an ES Module which exports a `default const` containing the Base64 representation of the image.
Using this option set to `true`, the export can be used as such:
```js
import logo from './rollup.png';
document.body.appendChild(logo);
```
### `exclude`
Type: `String` | `Array[...String]`<br>
Default: `null`
A [picomatch pattern](https://github.com/micromatch/picomatch), or array of patterns, which specifies the files in the build the plugin should _ignore_. By default no files are ignored.
### `include`
Type: `String` | `Array[...String]`<br>
Default: `null`
A [picomatch pattern](https://github.com/micromatch/picomatch), or array of patterns, which specifies the files in the build the plugin should operate on. By default all files are targeted.
## Meta
[CONTRIBUTING](/.github/CONTRIBUTING.md)
[LICENSE (MIT)](/LICENSE)

80
node_modules/@rollup/plugin-image/dist/cjs/index.js generated vendored Normal file
View File

@@ -0,0 +1,80 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var fs = require('fs');
var path = require('path');
var pluginutils = require('@rollup/pluginutils');
var svgToMiniDataURI = require('mini-svg-data-uri');
var defaults = {
dom: false,
exclude: null,
include: null
};
var mimeTypes = {
'.jpg': 'image/jpeg',
'.jpeg': 'image/jpeg',
'.png': 'image/png',
'.gif': 'image/gif',
'.svg': 'image/svg+xml',
'.webp': 'image/webp'
};
var domTemplate = function (ref) {
var dataUri = ref.dataUri;
return ("\n var img = new Image();\n img.src = \"" + dataUri + "\";\n export default img;\n");
};
var constTemplate = function (ref) {
var dataUri = ref.dataUri;
return ("\n var img = \"" + dataUri + "\";\n export default img;\n");
};
var getDataUri = function (ref) {
var format = ref.format;
var isSvg = ref.isSvg;
var mime = ref.mime;
var source = ref.source;
return isSvg ? svgToMiniDataURI(source) : ("data:" + mime + ";" + format + "," + source);
};
function image(opts) {
if ( opts === void 0 ) opts = {};
var options = Object.assign({}, defaults, opts);
var filter = pluginutils.createFilter(options.include, options.exclude);
return {
name: 'image',
load: function load(id) {
if (!filter(id)) {
return null;
}
var mime = mimeTypes[path.extname(id)];
if (!mime) {
// not an image
return null;
}
this.addWatchFile(id);
var isSvg = mime === mimeTypes['.svg'];
var format = isSvg ? 'utf-8' : 'base64';
var source = fs.readFileSync(id, format).replace(/[\r\n]+/gm, '');
var dataUri = getDataUri({ format: format, isSvg: isSvg, mime: mime, source: source });
var code = options.dom ? domTemplate({ dataUri: dataUri }) : constTemplate({ dataUri: dataUri });
return code.trim();
}
};
}
exports.default = image;
module.exports = Object.assign(exports.default, exports);
//# sourceMappingURL=index.js.map

75
node_modules/@rollup/plugin-image/dist/es/index.js generated vendored Normal file
View File

@@ -0,0 +1,75 @@
import { readFileSync } from 'fs';
import { extname } from 'path';
import { createFilter } from '@rollup/pluginutils';
import svgToMiniDataURI from 'mini-svg-data-uri';
var defaults = {
dom: false,
exclude: null,
include: null
};
var mimeTypes = {
'.jpg': 'image/jpeg',
'.jpeg': 'image/jpeg',
'.png': 'image/png',
'.gif': 'image/gif',
'.svg': 'image/svg+xml',
'.webp': 'image/webp'
};
var domTemplate = function (ref) {
var dataUri = ref.dataUri;
return ("\n var img = new Image();\n img.src = \"" + dataUri + "\";\n export default img;\n");
};
var constTemplate = function (ref) {
var dataUri = ref.dataUri;
return ("\n var img = \"" + dataUri + "\";\n export default img;\n");
};
var getDataUri = function (ref) {
var format = ref.format;
var isSvg = ref.isSvg;
var mime = ref.mime;
var source = ref.source;
return isSvg ? svgToMiniDataURI(source) : ("data:" + mime + ";" + format + "," + source);
};
function image(opts) {
if ( opts === void 0 ) opts = {};
var options = Object.assign({}, defaults, opts);
var filter = createFilter(options.include, options.exclude);
return {
name: 'image',
load: function load(id) {
if (!filter(id)) {
return null;
}
var mime = mimeTypes[extname(id)];
if (!mime) {
// not an image
return null;
}
this.addWatchFile(id);
var isSvg = mime === mimeTypes['.svg'];
var format = isSvg ? 'utf-8' : 'base64';
var source = readFileSync(id, format).replace(/[\r\n]+/gm, '');
var dataUri = getDataUri({ format: format, isSvg: isSvg, mime: mime, source: source });
var code = options.dom ? domTemplate({ dataUri: dataUri }) : constTemplate({ dataUri: dataUri });
return code.trim();
}
};
}
export { image as default };
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"type":"module"}

78
node_modules/@rollup/plugin-image/package.json generated vendored Normal file
View File

@@ -0,0 +1,78 @@
{
"name": "@rollup/plugin-image",
"version": "3.0.3",
"publishConfig": {
"access": "public"
},
"description": "Import JPG, PNG, GIF, SVG, and WebP files",
"license": "MIT",
"repository": {
"url": "rollup/plugins",
"directory": "packages/image"
},
"author": "Rich Harris",
"homepage": "https://github.com/rollup/plugins/tree/master/packages/image/#readme",
"bugs": "https://github.com/rollup/plugins/issues",
"main": "./dist/cjs/index.js",
"module": "./dist/es/index.js",
"exports": {
"types": "./types/index.d.ts",
"import": "./dist/es/index.js",
"default": "./dist/cjs/index.js"
},
"engines": {
"node": ">=14.0.0"
},
"scripts": {
"build": "rollup -c",
"ci:coverage": "nyc pnpm test && nyc report --reporter=text-lcov > coverage.lcov",
"ci:lint": "pnpm build && pnpm lint",
"ci:lint:commits": "commitlint --from=${CIRCLE_BRANCH} --to=${CIRCLE_SHA1}",
"ci:test": "pnpm test -- --verbose",
"prebuild": "del-cli dist",
"prepare": "if [ ! -d 'dist' ]; then pnpm build; fi",
"prerelease": "pnpm build",
"pretest": "pnpm build",
"release": "pnpm --workspace-root plugin:release --pkg $npm_package_name",
"test": "ava"
},
"files": [
"dist",
"!dist/**/*.map",
"types",
"README.md",
"LICENSE"
],
"keywords": [
"rollup",
"plugin",
"images",
"modules"
],
"peerDependencies": {
"rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
},
"peerDependenciesMeta": {
"rollup": {
"optional": true
}
},
"dependencies": {
"@rollup/pluginutils": "^5.0.1",
"mini-svg-data-uri": "^1.4.4"
},
"devDependencies": {
"@rollup/plugin-buble": "^1.0.0",
"rollup": "^4.0.0-24"
},
"types": "./types/index.d.ts",
"ava": {
"workerThreads": false,
"files": [
"!**/fixtures/**",
"!**/helpers/**",
"!**/recipes/**",
"!**/types.ts"
]
}
}

34
node_modules/@rollup/plugin-image/types/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,34 @@
import type { FilterPattern } from '@rollup/pluginutils';
import type { Plugin } from 'rollup';
interface RollupImageOptions {
/**
* A picomatch pattern, or array of patterns, which specifies the files in the build the plugin
* should operate on.
* By default all files are targeted.
*/
include?: FilterPattern;
/**
* A picomatch pattern, or array of patterns, which specifies the files in the build the plugin
* should _ignore_.
* By default no files are ignored.
*/
exclude?: FilterPattern;
/**
* If `true`, instructs the plugin to generate an ES Module which exports a DOM `Image` which can
* be used with a browser's DOM.
* Otherwise, the plugin generates an ES Module which exports a `default const` containing the
* Base64 representation of the image.
*
* Using this option set to `true`, the export can be used as such:
*
* @example
* import logo from './rollup.png';
* document.body.appendChild(logo);
*
* @default false
*/
dom?: boolean;
}
export default function image(options?: RollupImageOptions): Plugin;