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 Nov 10, 2023
1 parent 0b09fb8 commit e17c9dc
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 11 deletions.
9 changes: 6 additions & 3 deletions dist/img-src-placeholder.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
//! img-src-placeholder v1.1.0 ~~ https://github.com/center-key/img-src-placeholder ~~ MIT License
//! img-src-placeholder v1.1.1 ~~ https://github.com/center-key/img-src-placeholder ~~ MIT License

import { Results } from 'replacer-util';
export type Settings = {
cd: string | null;
extensions: string[];
filename: string | null;
};
export type Options = Partial<Settings>;
export type ReporterSettings = {
summaryOnly: boolean;
};
declare const imgSrcPlaceholder: {
htmlExts: string[];
transform(sourceFolder: string, targetFolder: string, options?: Options): Results;
transform(sourceFolder: string, targetFolder: string, options?: Partial<Settings>): Results;
reporter(results: Results, options?: Partial<ReporterSettings>): Results;
};
export { imgSrcPlaceholder };
21 changes: 20 additions & 1 deletion dist/img-src-placeholder.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//! img-src-placeholder v1.1.0 ~~ https://github.com/center-key/img-src-placeholder ~~ MIT License
//! img-src-placeholder v1.1.1 ~~ https://github.com/center-key/img-src-placeholder ~~ MIT License

import { replacer } from 'replacer-util';
import chalk from 'chalk';
import log from 'fancy-log';
const imgSrcPlaceholder = {
htmlExts: ['.html', '.htm', '.php', '.aspx', '.asp', '.jsp'],
transform(sourceFolder, targetFolder, options) {
Expand All @@ -20,5 +22,22 @@ const imgSrcPlaceholder = {
};
return replacer.transform(sourceFolder, targetFolder, replacerSettings);
},
reporter(results, options) {
const defaults = {
summaryOnly: false,
};
const settings = { ...defaults, ...options };
const name = chalk.gray('img-src-placeholder');
const source = chalk.blue.bold(results.source);
const target = chalk.magenta(results.target);
const arrow = { big: chalk.gray.bold(' ⟹ '), little: chalk.gray.bold('→') };
const infoColor = results.count ? chalk.white : chalk.red.bold;
const info = infoColor(`(files: ${results.count}, ${results.duration}ms)`);
log(name, source, arrow.big, target, info);
const logFile = (file) => log(name, chalk.white(file.origin), arrow.little, chalk.green(file.dest));
if (!settings.summaryOnly)
results.files.forEach(logFile);
return results;
},
};
export { imgSrcPlaceholder };
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "img-src-placeholder",
"version": "1.1.0",
"version": "1.1.1",
"description": "Replace src=# in <img> tags of HTML files with an inline data URL of a transparent 1 pixel image (CLI tool designed for use in npm scripts)",
"license": "MIT",
"type": "module",
Expand Down Expand Up @@ -87,24 +87,24 @@
"chalk": "~5.3",
"cli-argv-util": "~1.2",
"fancy-log": "~2.0",
"istextorbinary": "~6.0",
"istextorbinary": "~7.0",
"replacer-util": "~1.2",
"slash": "~5.1"
},
"devDependencies": {
"@types/fancy-log": "~2.0",
"@types/node": "~20.8",
"@typescript-eslint/eslint-plugin": "~6.7",
"@typescript-eslint/parser": "~6.7",
"@types/node": "~20.9",
"@typescript-eslint/eslint-plugin": "~6.10",
"@typescript-eslint/parser": "~6.10",
"add-dist-header": "~1.3",
"assert-deep-strict-equal": "~1.1",
"copy-file-util": "~1.1",
"eslint": "~8.51",
"eslint": "~8.53",
"jshint": "~2.13",
"mocha": "~10.2",
"rimraf": "~5.0",
"run-scripts-util": "~1.2",
"typescript": "~5.2",
"w3c-html-validator": "~1.5"
"w3c-html-validator": "~1.6"
}
}

0 comments on commit e17c9dc

Please sign in to comment.