binary-base64-loader
Advanced tools
Comparing version 0.0.1-security to 1.0.0
{ | ||
"name": "binary-base64-loader", | ||
"version": "0.0.1-security", | ||
"description": "security holding package", | ||
"repository": "npm/security-holder", | ||
"dependencies": {} | ||
"version": "1.0.0", | ||
"description": "A loader for webpack that allows importing binary files as a String", | ||
"license": "MIT", | ||
"repository": "github:krakoi/binary-base64-loader", | ||
"author": "Gyula Kisrákói", | ||
"homepage": "https://github.com/krakoi/binary-base64-loader", | ||
"bugs": "https://github.com/krakoi/binary-base64-loader/issues", | ||
"main": "dist/index.js", | ||
"engines": { | ||
"node": ">=10.13.0" | ||
}, | ||
"scripts": { | ||
"build": "babel src --out-dir dist --copy-files", | ||
"security": "npm audit", | ||
"autoformat": "prettier --write .", | ||
"lint:prettier": "prettier --check .", | ||
"lint:js": "eslint --cache .", | ||
"lint": "npm run lint:js && npm run lint:prettier", | ||
"check-published": "npm publish --dry-run" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"peerDependencies": { | ||
"webpack": "^4.0.0 || ^5.0.0" | ||
}, | ||
"keywords": [ | ||
"webpack", | ||
"webpack-loader", | ||
"base64" | ||
], | ||
"dependencies": { | ||
"loader-utils": "^2.0.0", | ||
"schema-utils": "^2.7.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.10.5", | ||
"@babel/core": "^7.11.4", | ||
"@babel/preset-env": "^7.11.0", | ||
"@webpack-contrib/defaults": "^6.3.0", | ||
"@webpack-contrib/eslint-config-webpack": "^3.0.0", | ||
"eslint": "^7.7.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-import": "^2.22.0", | ||
"eslint-plugin-prettier": "^3.1.4", | ||
"prettier": "^2.0.5", | ||
"webpack": "^4.44.1" | ||
} | ||
} |
111
README.md
@@ -1,9 +0,106 @@ | ||
# Security holding package | ||
<div align="center"> | ||
<img width="150" height="200" | ||
src="https://www.iconfinder.com/icons/298769/download/svg/512"> | ||
<a href="https://github.com/webpack/webpack"> | ||
<img width="200" height="200" | ||
src="https://webpack.js.org/assets/icon-square-big.svg"> | ||
</a> | ||
</div> | ||
This package name is not currently in use, but was formerly occupied | ||
by another package. To avoid malicious use, npm is hanging on to the | ||
package name, but loosely, and we'll probably give it to you if you | ||
want it. | ||
# binary-base64-loader | ||
You may adopt this package by contacting support@npmjs.com and | ||
requesting the name. | ||
A webpack loader that allows loading binary files as Base64 encoded strings. | ||
Based on https://github.com/webpack-contrib/raw-loader | ||
## Getting Started | ||
Install `binary-base64-loader`: | ||
```console | ||
$ npm install binary-base64-loader --save-dev | ||
``` | ||
After that you can load files with specific extensions using webpack config as usual, for example: | ||
**webpack.config.js** | ||
```js | ||
// webpack.config.js | ||
module.exports = { | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.bin$/i, | ||
use: 'binary-base64-loader', | ||
}, | ||
], | ||
}, | ||
}; | ||
``` | ||
Then you can import the content of binary files with the given extension as Base64 encoded strings: | ||
```js | ||
import bigAsset from './asset.bin'; | ||
// bigAsset will equal to 'WW91IGp1c3QgbG9zdCBUSEUgR0FNRSE=... | ||
``` | ||
Most probably though you will want to use the loader inline, without registering specific extensions in the webpack config. For example: | ||
```js | ||
import fontBinary from '!!binary-base64-loader!./funkyicons.ttf'; | ||
``` | ||
(The `!!` prefix is not obligatory but probably you will need it to remove other loaders from the chain which could apply based on the webpack config) | ||
To make the inline use work under Typescript add this to a Typescript definition file in your project (`*.d.ts`, for example `shims-vue.d.ts`): | ||
```typescript | ||
declare module "!!binary-base64-loader!*" { | ||
const content: string; | ||
export default content; | ||
} | ||
``` | ||
## Options | ||
| Name | Type | Default | Description | | ||
| :-------------------------: | :---------: | :-----: | :--------------------- | | ||
| **[`esModule`](#esmodule)** | `{Boolean}` | `true` | Uses ES modules syntax | | ||
### `esModule` | ||
Type: `Boolean` | ||
Default: `true` | ||
By default, `binary-base64-loader` generates JS modules that use the ES modules syntax. | ||
There are some cases in which using ES modules is beneficial, like in the case of [module concatenation](https://webpack.js.org/plugins/module-concatenation-plugin/) and [tree shaking](https://webpack.js.org/guides/tree-shaking/). | ||
You can enable a CommonJS module syntax using: | ||
**webpack.config.js** | ||
```js | ||
module.exports = { | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.bin$/i, | ||
use: [ | ||
{ | ||
loader: 'binary-base64-loader', | ||
options: { | ||
esModule: false, | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}; | ||
``` | ||
## License | ||
[MIT](./LICENSE) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Known malware
Supply chain riskThis package is malware. We have asked the package registry to remove it.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
5941
5
0
23
1
0
107
0
3
11
+ Addedloader-utils@^2.0.0
+ Addedschema-utils@^2.7.0
+ Added@jridgewell/gen-mapping@0.3.8(transitive)
+ Added@jridgewell/resolve-uri@3.1.2(transitive)
+ Added@jridgewell/set-array@1.2.1(transitive)
+ Added@jridgewell/source-map@0.3.6(transitive)
+ Added@jridgewell/sourcemap-codec@1.5.0(transitive)
+ Added@jridgewell/trace-mapping@0.3.25(transitive)
+ Added@types/eslint@9.6.1(transitive)
+ Added@types/eslint-scope@3.7.7(transitive)
+ Added@types/estree@1.0.6(transitive)
+ Added@types/json-schema@7.0.15(transitive)
+ Added@types/node@22.10.2(transitive)
+ Added@webassemblyjs/ast@1.14.1(transitive)
+ Added@webassemblyjs/floating-point-hex-parser@1.13.2(transitive)
+ Added@webassemblyjs/helper-api-error@1.13.2(transitive)
+ Added@webassemblyjs/helper-buffer@1.14.1(transitive)
+ Added@webassemblyjs/helper-numbers@1.13.2(transitive)
+ Added@webassemblyjs/helper-wasm-bytecode@1.13.2(transitive)
+ Added@webassemblyjs/helper-wasm-section@1.14.1(transitive)
+ Added@webassemblyjs/ieee754@1.13.2(transitive)
+ Added@webassemblyjs/leb128@1.13.2(transitive)
+ Added@webassemblyjs/utf8@1.13.2(transitive)
+ Added@webassemblyjs/wasm-edit@1.14.1(transitive)
+ Added@webassemblyjs/wasm-gen@1.14.1(transitive)
+ Added@webassemblyjs/wasm-opt@1.14.1(transitive)
+ Added@webassemblyjs/wasm-parser@1.14.1(transitive)
+ Added@webassemblyjs/wast-printer@1.14.1(transitive)
+ Added@xtuc/ieee754@1.2.0(transitive)
+ Added@xtuc/long@4.2.2(transitive)
+ Addedacorn@8.14.0(transitive)
+ Addedajv@6.12.68.17.1(transitive)
+ Addedajv-formats@2.1.1(transitive)
+ Addedajv-keywords@3.5.25.1.0(transitive)
+ Addedbig.js@5.2.2(transitive)
+ Addedbrowserslist@4.24.3(transitive)
+ Addedbuffer-from@1.1.2(transitive)
+ Addedcaniuse-lite@1.0.30001688(transitive)
+ Addedchrome-trace-event@1.0.4(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addedelectron-to-chromium@1.5.73(transitive)
+ Addedemojis-list@3.0.0(transitive)
+ Addedenhanced-resolve@5.17.1(transitive)
+ Addedes-module-lexer@1.5.4(transitive)
+ Addedescalade@3.2.0(transitive)
+ Addedeslint-scope@5.1.1(transitive)
+ Addedesrecurse@4.3.0(transitive)
+ Addedestraverse@4.3.05.3.0(transitive)
+ Addedevents@3.3.0(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedfast-uri@3.0.3(transitive)
+ Addedglob-to-regexp@0.4.1(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhas-flag@4.0.0(transitive)
+ Addedjest-worker@27.5.1(transitive)
+ Addedjson-parse-even-better-errors@2.3.1(transitive)
+ Addedjson-schema-traverse@0.4.11.0.0(transitive)
+ Addedjson5@2.2.3(transitive)
+ Addedloader-runner@4.3.0(transitive)
+ Addedloader-utils@2.0.4(transitive)
+ Addedmerge-stream@2.0.0(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedneo-async@2.6.2(transitive)
+ Addednode-releases@2.0.19(transitive)
+ Addedpicocolors@1.1.1(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedrandombytes@2.1.0(transitive)
+ Addedrequire-from-string@2.0.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedschema-utils@2.7.13.3.04.3.0(transitive)
+ Addedserialize-javascript@6.0.2(transitive)
+ Addedsource-map@0.6.1(transitive)
+ Addedsource-map-support@0.5.21(transitive)
+ Addedsupports-color@8.1.1(transitive)
+ Addedtapable@2.2.1(transitive)
+ Addedterser@5.37.0(transitive)
+ Addedterser-webpack-plugin@5.3.11(transitive)
+ Addedundici-types@6.20.0(transitive)
+ Addedupdate-browserslist-db@1.1.1(transitive)
+ Addeduri-js@4.4.1(transitive)
+ Addedwatchpack@2.4.2(transitive)
+ Addedwebpack@5.97.1(transitive)
+ Addedwebpack-sources@3.2.3(transitive)