Skip to content

Commit

Permalink
Release v1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilafian committed Jun 19, 2023
1 parent 97185c3 commit ec91ffa
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
3 changes: 2 additions & 1 deletion dist/rev-web-assets.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! rev-web-assets v1.1.0 ~~ https://github.com/center-key/rev-web-assets ~~ MIT License
//! rev-web-assets v1.1.1 ~~ https://github.com/center-key/rev-web-assets ~~ MIT License

export type Settings = {
cd: string | null;
Expand All @@ -14,6 +14,7 @@ export type ManifestDetail = {
canonicalFolder: string;
isHtml: boolean;
isCss: boolean;
bytes: number | null;
hash: string | null;
hashedFilename: string | null;
destFolder: string;
Expand Down
7 changes: 5 additions & 2 deletions dist/rev-web-assets.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! rev-web-assets v1.1.0 ~~ https://github.com/center-key/rev-web-assets ~~ MIT License
//! rev-web-assets v1.1.1 ~~ https://github.com/center-key/rev-web-assets ~~ MIT License

import crypto from 'crypto';
import fs from 'fs';
Expand Down Expand Up @@ -30,6 +30,7 @@ const revWebAssets = {
filename: path.basename(file),
canonicalFolder: canonicalFolder,
canonical: canonical,
bytes: null,
isHtml: isHtml,
isCss: isCss,
hash: null,
Expand All @@ -49,8 +50,10 @@ const revWebAssets = {
},
calcAssetHash(detail) {
const hashLen = 8;
const contents = fs.readFileSync(detail.origin).toString();
const brokenWindows = /$\r\n/gm;
const contents = fs.readFileSync(detail.origin).toString().replace(brokenWindows, '\n');
const hash = crypto.createHash('md5').update(contents).digest('hex');
detail.bytes = contents.length;
detail.hash = hash.substring(0, hashLen);
detail.hashedFilename = revWebAssets.hashFilename(detail.filename, detail.hash);
return detail;
Expand Down
7 changes: 5 additions & 2 deletions dist/rev-web-assets.umd.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! rev-web-assets v1.1.0 ~~ https://github.com/center-key/rev-web-assets ~~ MIT License
//! rev-web-assets v1.1.1 ~~ https://github.com/center-key/rev-web-assets ~~ MIT License

var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
Expand Down Expand Up @@ -45,6 +45,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
filename: path_1.default.basename(file),
canonicalFolder: canonicalFolder,
canonical: canonical,
bytes: null,
isHtml: isHtml,
isCss: isCss,
hash: null,
Expand All @@ -64,8 +65,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
},
calcAssetHash(detail) {
const hashLen = 8;
const contents = fs_1.default.readFileSync(detail.origin).toString();
const brokenWindows = /$\r\n/gm;
const contents = fs_1.default.readFileSync(detail.origin).toString().replace(brokenWindows, '\n');
const hash = crypto_1.default.createHash('md5').update(contents).digest('hex');
detail.bytes = contents.length;
detail.hash = hash.substring(0, hashLen);
detail.hashedFilename = revWebAssets.hashFilename(detail.filename, detail.hash);
return detail;
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rev-web-assets",
"version": "1.1.0",
"version": "1.1.1",
"description": "Revision web asset filenames with cache busting content hash fingerprints",
"license": "MIT",
"type": "module",
Expand Down Expand Up @@ -90,7 +90,7 @@
"add-dist-header": "~1.0",
"assert-deep-strict-equal": "~1.0",
"copy-file-util": "~1.0",
"eslint": "~8.42",
"eslint": "~8.43",
"jshint": "~2.13",
"mocha": "~10.2",
"rimraf": "~5.0",
Expand Down

0 comments on commit ec91ffa

Please sign in to comment.