Comparing version 2.4.0 to 2.4.1
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
const picocolors_1 = __importDefault(require("picocolors")); | ||
const time_stamp_1 = __importDefault(require("time-stamp")); | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
// If the importer is in node compatibility mode or this is not an ESM | ||
// file that has been converted to a CommonJS file using a Babel- | ||
// compatible transform (i.e. "__esModule" has not been set), then set | ||
// "default" to the CommonJS "module.exports" for node compatibility. | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
mod | ||
)); | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
// index.ts | ||
var diy_log_exports = {}; | ||
__export(diy_log_exports, { | ||
colors: () => import_picocolors.default, | ||
default: () => diy_log_default, | ||
error: () => error, | ||
info: () => info, | ||
log: () => log, | ||
success: () => success, | ||
symbols: () => symbols, | ||
time: () => time, | ||
timestamp: () => import_time_stamp.default, | ||
warn: () => warn | ||
}); | ||
module.exports = __toCommonJS(diy_log_exports); | ||
var import_picocolors = __toESM(require("picocolors")); | ||
var import_time_stamp = __toESM(require("time-stamp")); | ||
function isUnicodeSupported() { | ||
if (process.platform !== 'win32') { | ||
return process.env.TERM !== 'linux'; | ||
} | ||
return (Boolean(process.env.CI) || | ||
Boolean(process.env.WT_SESSION) || | ||
Boolean(process.env.TERMINUS_SUBLIME) || | ||
process.env.ConEmuTask === '{cmd::Cmder}' || | ||
process.env.TERM_PROGRAM === 'Terminus-Sublime' || | ||
process.env.TERM_PROGRAM === 'vscode' || | ||
process.env.TERM === 'xterm-256color' || | ||
process.env.TERM === 'alacritty' || | ||
process.env.TERMINAL_EMULATOR === 'JetBrains-JediTerm'); | ||
if (process.platform !== "win32") { | ||
return process.env.TERM !== "linux"; | ||
} | ||
return Boolean(process.env.CI) || Boolean(process.env.WT_SESSION) || // Windows Terminal | ||
Boolean(process.env.TERMINUS_SUBLIME) || // Terminus (<0.2.27) | ||
process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder | ||
process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm"; | ||
} | ||
const symbols = (function () { | ||
const main = { | ||
info: picocolors_1.default.blue('ℹ'), | ||
success: picocolors_1.default.green('✔'), | ||
warn: picocolors_1.default.yellow('⚠'), | ||
error: picocolors_1.default.red('✖') | ||
}; | ||
const fallbacks = { | ||
info: picocolors_1.default.blue('i'), | ||
success: picocolors_1.default.green('√'), | ||
warn: picocolors_1.default.yellow('‼'), | ||
error: picocolors_1.default.red('×') | ||
}; | ||
return isUnicodeSupported() ? main : fallbacks; | ||
})(); | ||
var symbols = function() { | ||
const main = { | ||
info: import_picocolors.default.blue("\u2139"), | ||
success: import_picocolors.default.green("\u2714"), | ||
warn: import_picocolors.default.yellow("\u26A0"), | ||
error: import_picocolors.default.red("\u2716") | ||
}; | ||
const fallbacks = { | ||
info: import_picocolors.default.blue("i"), | ||
success: import_picocolors.default.green("\u221A"), | ||
warn: import_picocolors.default.yellow("\u203C"), | ||
error: import_picocolors.default.red("\xD7") | ||
}; | ||
return isUnicodeSupported() ? main : fallbacks; | ||
}(); | ||
function logFn(fn, args, prefix) { | ||
if (prefix) { | ||
process.stdout.write(prefix + ' '); | ||
} | ||
fn.apply(console, args); | ||
if (prefix) { | ||
process.stdout.write(prefix + " "); | ||
} | ||
fn.apply(console, args); | ||
} | ||
const log = (...args) => logFn(console.log, args); | ||
const time = (...args) => { | ||
const times = (0, time_stamp_1.default)('HH:mm:ss'); | ||
logFn(console.log, args, '[' + picocolors_1.default.gray(times) + ']'); | ||
var log = (...args) => logFn(console.log, args); | ||
var time = (...args) => { | ||
const times = (0, import_time_stamp.default)("HH:mm:ss"); | ||
logFn(console.log, args, "[" + import_picocolors.default.gray(times) + "]"); | ||
}; | ||
const info = (...args) => logFn(console.info, args, symbols.info); | ||
const error = (...args) => logFn(console.error, args, symbols.error); | ||
const success = (...args) => logFn(console.log, args, symbols.success); | ||
const warn = (...args) => logFn(console.warn, args, symbols.warn); | ||
module.exports = { log, time, info, error, success, warn, symbols, colors: picocolors_1.default, timestamp: time_stamp_1.default }; | ||
var info = (...args) => logFn(console.info, args, symbols.info); | ||
var error = (...args) => logFn(console.error, args, symbols.error); | ||
var success = (...args) => logFn(console.log, args, symbols.success); | ||
var warn = (...args) => logFn(console.warn, args, symbols.warn); | ||
var diy_log_default = { log, time, info, error, success, warn, symbols, colors: import_picocolors.default, timestamp: import_time_stamp.default }; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
colors, | ||
error, | ||
info, | ||
log, | ||
success, | ||
symbols, | ||
time, | ||
timestamp, | ||
warn | ||
}); |
{ | ||
"name": "diy-log", | ||
"version": "2.4.0", | ||
"version": "2.4.1", | ||
"description": "Log things, prefixed with a symbols or timestamp.", | ||
@@ -16,3 +16,4 @@ "keywords": [ | ||
"main": "dist/index.js", | ||
"types": "types/index.d.ts", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
@@ -26,3 +27,4 @@ "dist", | ||
"scripts": { | ||
"build": "tsc", | ||
"tsc": "tsc", | ||
"build": "rm -rf dist && tsup ./index.ts --dts --format cjs,esm", | ||
"demo": "node ./example/index.js" | ||
@@ -46,4 +48,5 @@ }, | ||
"@types/node": "^18.7.18", | ||
"tsup": "^6.7.0", | ||
"typescript": "^4.8.3" | ||
} | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
8791
5
184
3
20
1