Initial commit

This commit is contained in:
Developer
2025-04-21 16:03:20 +02:00
commit 2832896157
22874 changed files with 3092801 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2016 Alex Indigo
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,50 @@
# webpack-chunk-hash
Plugin to replace a standard webpack chunk hashing with custom (md5) one.
_Note: It's a clone of [webpack-md5-hash](https://www.npmjs.com/package/webpack-md5-hash) plugin, but without sorting provided chunks (unobtrusive),
and using native crypto module (performance)._
## Install
```
npm install --save-dev webpack-chunk-hash
```
## Example
Just add this plugin as usual.
```javascript
// webpack.config.js
var WebpackChunkHash = require('webpack-chunk-hash');
module.exports = {
// ...
output: {
filename: '[name].[chunkhash].js',
chunkFilename: '[name].[chunkhash].js',
},
plugins: [
new WebpackChunkHash({algorithm: 'md5'}) // 'md5' is default value
]
};
```
## Options
```
// a callback to add more content to the resulting hash
additionalHashContent: function(chunk) { return 'your additional content to hash'; }
// which algorithm to use (https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm)
algorithm: 'md5'
// which digest to use (https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding)
digest: 'hex'
```
## License
WebpackChunkHash plugin is released under the [MIT](License) license.

View File

@@ -0,0 +1,53 @@
var crypto = require('crypto');
module.exports = WebpackChunkHash;
function WebpackChunkHash(options)
{
options = options || {};
this.algorithm = options.algorithm || 'md5';
this.digest = options.digest || 'hex';
this.additionalHashContent = options.additionalHashContent || function() { return ''; };
}
WebpackChunkHash.prototype.apply = function(compiler)
{
var _plugin = this;
compiler.plugin('compilation', function(compilation)
{
compilation.plugin('chunk-hash', function(chunk, chunkHash)
{
var source = chunk.modules.map(getModuleSource).sort(sortById).reduce(concatenateSource, '')
, hash = crypto.createHash(_plugin.algorithm).update(source + _plugin.additionalHashContent(chunk))
;
chunkHash.digest = function(digest)
{
return hash.digest(digest || _plugin.digest);
};
});
});
};
// helpers
function sortById(a, b)
{
return a.id - b.id;
}
function getModuleSource(module)
{
return {
id : module.id,
source: (module._source || {})._value || '',
dependencies: (module.dependencies || []).map(function(d){ return d.module ? d.module.id : ''; })
};
}
function concatenateSource(result, module)
{
return result + '#' + module.id + ':' + module.source + '$' + (module.dependencies.join(','));
}

View File

@@ -0,0 +1,67 @@
{
"_from": "webpack-chunk-hash@^0.4.0",
"_id": "webpack-chunk-hash@0.4.0",
"_inBundle": false,
"_integrity": "sha1-a0DDBw+8n/DP4P54HHF0r2x8FqQ=",
"_location": "/webpack-chunk-hash",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "webpack-chunk-hash@^0.4.0",
"name": "webpack-chunk-hash",
"escapedName": "webpack-chunk-hash",
"rawSpec": "^0.4.0",
"saveSpec": null,
"fetchSpec": "^0.4.0"
},
"_requiredBy": [
"/laravel-mix"
],
"_resolved": "https://registry.npmjs.org/webpack-chunk-hash/-/webpack-chunk-hash-0.4.0.tgz",
"_shasum": "6b40c3070fbc9ff0cfe0fe781c7174af6c7c16a4",
"_spec": "webpack-chunk-hash@^0.4.0",
"_where": "D:\\developments\\teaser-inertia\\nova-components\\NovaLeader\\node_modules\\laravel-mix",
"author": {
"name": "Alex Indigo",
"email": "iam@alexindigo.com"
},
"bugs": {
"url": "https://github.com/alexindigo/webpack-chunk-hash/issues"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "Plugin to replace a standard webpack chunk hashing with custom (md5) one.",
"devDependencies": {
"argparse": "^1.0.4",
"jasmine-node": "^1.14.5",
"jshint": "^2.8.0",
"rimraf": "^2.5.4",
"webpack": "^1.13.3"
},
"homepage": "https://github.com/alexindigo/webpack-chunk-hash#readme",
"keywords": [
"webpack",
"hash",
"plugin",
"md5"
],
"license": "MIT",
"main": "index.js",
"name": "webpack-chunk-hash",
"pre-commit": [
"lint",
"test"
],
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/alexindigo/webpack-chunk-hash.git"
},
"scripts": {
"lint": "jshint",
"pretest": "rimraf dist",
"test": "jasmine-node --captureExceptions spec"
},
"version": "0.4.0"
}