From d09aa332135be2e918c8913e6897eb7a40d6831f Mon Sep 17 00:00:00 2001 From: dpilafian Date: Mon, 31 Jul 2023 11:35:12 -0700 Subject: [PATCH] Release v1.3.0 --- dist/rev-web-assets.d.ts | 3 +-- dist/rev-web-assets.js | 18 +++++------------- package.json | 8 ++++---- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/dist/rev-web-assets.d.ts b/dist/rev-web-assets.d.ts index 536a504..647d538 100644 --- a/dist/rev-web-assets.d.ts +++ b/dist/rev-web-assets.d.ts @@ -1,4 +1,4 @@ -//! rev-web-assets v1.2.0 ~~ https://github.com/center-key/rev-web-assets ~~ MIT License +//! rev-web-assets v1.3.0 ~~ https://github.com/center-key/rev-web-assets ~~ MIT License export type Settings = { cd: string | null; @@ -31,7 +31,6 @@ export type Results = { manifest: Manifest; }; declare const revWebAssets: { - readFolderRecursive(folder: string): string[]; manifest(source: string, target: string): ManifestDetail[]; hashFilename(filename: string, hash: string | null): string; calcAssetHash(detail: ManifestDetail): ManifestDetail; diff --git a/dist/rev-web-assets.js b/dist/rev-web-assets.js index 98e9626..d51a2ee 100644 --- a/dist/rev-web-assets.js +++ b/dist/rev-web-assets.js @@ -1,23 +1,15 @@ -//! rev-web-assets v1.2.0 ~~ https://github.com/center-key/rev-web-assets ~~ MIT License +//! rev-web-assets v1.3.0 ~~ https://github.com/center-key/rev-web-assets ~~ MIT License import crypto from 'crypto'; import fs from 'fs'; import path from 'path'; import slash from 'slash'; const revWebAssets = { - readFolderRecursive(folder) { - const files = []; - const process = (item) => { - if (fs.statSync(item).isFile()) - files.push(slash(item)); - else - fs.readdirSync(item).forEach((nestedItem) => process(path.join(item, nestedItem))); - }; - process(path.normalize(folder)); - return files.sort(); - }, manifest(source, target) { - const files = revWebAssets.readFolderRecursive(source); + const files = fs.readdirSync(source, { recursive: true }) + .map(file => path.join(source, file.toString())) + .filter(file => fs.statSync(file).isFile()) + .sort(); const process = (file) => { const fileExtension = path.extname(file).toLowerCase(); const isHtml = ['.html', '.htm', '.php'].includes(fileExtension); diff --git a/package.json b/package.json index a3e5900..fc0db01 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rev-web-assets", - "version": "1.2.0", + "version": "1.3.0", "description": "Revision web asset filenames with cache busting content hash fingerprints", "license": "MIT", "type": "module", @@ -82,12 +82,12 @@ "devDependencies": { "@types/fancy-log": "~2.0", "@types/node": "~20.4", - "@typescript-eslint/eslint-plugin": "~6.0", - "@typescript-eslint/parser": "~6.0", + "@typescript-eslint/eslint-plugin": "~6.2", + "@typescript-eslint/parser": "~6.2", "add-dist-header": "~1.1", "assert-deep-strict-equal": "~1.1", "copy-file-util": "~1.1", - "eslint": "~8.44", + "eslint": "~8.46", "jshint": "~2.13", "mocha": "~10.2", "rimraf": "~5.0",