webpack-build-notifier
Advanced tools
Comparing version 3.0.0 to 3.1.0
@@ -1,42 +0,17 @@ | ||
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 }); | ||
}; | ||
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); | ||
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { | ||
get: (a, b) => (typeof require !== "undefined" ? require : a)[b] | ||
}) : x)(function(x) { | ||
if (typeof require !== "undefined") | ||
return require.apply(this, arguments); | ||
throw Error('Dynamic require of "' + x + '" is not supported'); | ||
}); | ||
// src/index.ts | ||
var src_exports = {}; | ||
__export(src_exports, { | ||
default: () => WebpackBuildNotifierPlugin | ||
}); | ||
module.exports = __toCommonJS(src_exports); | ||
var import_path = __toESM(require("path")); | ||
var import_process = __toESM(require("process")); | ||
var import_os = __toESM(require("os")); | ||
var import_node_notifier = __toESM(require("node-notifier")); | ||
var import_strip_ansi = __toESM(require("strip-ansi")); | ||
var import_child_process = require("child_process"); | ||
var DEFAULT_ICON_PATH = import_path.default.resolve(__dirname, "icons"); | ||
import path from "path"; | ||
import process from "process"; | ||
import os from "os"; | ||
import notifier from "node-notifier"; | ||
import stripAnsi from "strip-ansi"; | ||
import { exec, execFileSync } from "child_process"; | ||
var DEFAULT_ICON_PATH = path.resolve(__dirname, "icons"); | ||
var WebpackBuildNotifierPlugin = class { | ||
@@ -55,14 +30,14 @@ constructor(cfg) { | ||
this.showDuration = false; | ||
this.successIcon = import_path.default.join(DEFAULT_ICON_PATH, "success.png"); | ||
this.warningIcon = import_path.default.join(DEFAULT_ICON_PATH, "warning.png"); | ||
this.failureIcon = import_path.default.join(DEFAULT_ICON_PATH, "failure.png"); | ||
this.compileIcon = import_path.default.join(DEFAULT_ICON_PATH, "compile.png"); | ||
this.successIcon = path.join(DEFAULT_ICON_PATH, "success.png"); | ||
this.warningIcon = path.join(DEFAULT_ICON_PATH, "warning.png"); | ||
this.failureIcon = path.join(DEFAULT_ICON_PATH, "failure.png"); | ||
this.compileIcon = path.join(DEFAULT_ICON_PATH, "compile.png"); | ||
this.onClick = () => this.activateTerminalWindow; | ||
// eslint-disable-next-line class-methods-use-this | ||
this.activateTerminalWindow = () => { | ||
if (import_process.default.platform === "darwin") { | ||
(0, import_child_process.exec)( | ||
if (process.platform === "darwin") { | ||
exec( | ||
'TERM="$TERM_PROGRAM"; [[ "$TERM" == "Apple_Terminal" ]] && TERM="Terminal"; [[ "$TERM" == "vscode" ]] && TERM="Visual Studio Code"; osascript -e "tell application \\"$TERM\\" to activate"' | ||
); | ||
} else if (import_process.default.platform === "win32") { | ||
} else if (process.platform === "win32") { | ||
} | ||
@@ -78,3 +53,3 @@ }; | ||
if (message && error.module && error.module.resource) { | ||
message = `${filepath}${import_os.default.EOL}${message.replace( | ||
message = `${filepath}${os.EOL}${message.replace( | ||
error.module.resource, | ||
@@ -148,3 +123,3 @@ "" | ||
if (notify) { | ||
import_node_notifier.default.notify( | ||
notifier.notify( | ||
Object.assign(notifyOptions, { | ||
@@ -155,3 +130,3 @@ title, | ||
appName: this.appName, | ||
message: (0, import_strip_ansi.default)(msg), | ||
message: stripAnsi(msg), | ||
contentImage: this.logo, | ||
@@ -171,3 +146,3 @@ wait: !this.buildSuccessful | ||
this.onCompilationWatchRun = (compiler, callback) => { | ||
import_node_notifier.default.notify({ | ||
notifier.notify({ | ||
appName: this.appName, | ||
@@ -186,13 +161,13 @@ title: this.title, | ||
this.registerSnoreToast = () => { | ||
if (import_process.default.platform === "win32") { | ||
const versionParts = import_os.default.release().split("."); | ||
if (process.platform === "win32") { | ||
const versionParts = os.release().split("."); | ||
const winVer = +`${versionParts[0]}.${versionParts[1]}`; | ||
if (winVer >= 6.2) { | ||
const snoreToast = import_path.default.join( | ||
require.resolve("node-notifier"), | ||
const snoreToast = path.join( | ||
__require.resolve("node-notifier"), | ||
"../vendor/snoreToast", | ||
`snoretoast-${import_process.default.arch === "x64" ? "x64" : "x86"}.exe` | ||
`snoretoast-${process.arch === "x64" ? "x64" : "x86"}.exe` | ||
); | ||
try { | ||
(0, import_child_process.execFileSync)(snoreToast, [ | ||
execFileSync(snoreToast, [ | ||
"-appID", | ||
@@ -237,5 +212,5 @@ "Snore.DesktopToasts", | ||
this.registerSnoreToast(); | ||
import_node_notifier.default.on("click", this.onClick); | ||
notifier.on("click", this.onClick); | ||
if (this.onTimeout) { | ||
import_node_notifier.default.on("timeout", this.onTimeout); | ||
notifier.on("timeout", this.onTimeout); | ||
} | ||
@@ -253,1 +228,4 @@ } | ||
}; | ||
export { | ||
WebpackBuildNotifierPlugin as default | ||
}; |
{ | ||
"name": "webpack-build-notifier", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "A Webpack plugin that generates OS notifications for build steps using node-notifier.", | ||
"main": "dist/index.js", | ||
"main": "dist/index.cjs", | ||
"module": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"type": "commonjs", | ||
"type": "module", | ||
"files": [ | ||
@@ -12,3 +13,4 @@ "dist" | ||
"scripts": { | ||
"build": "npm run clean && tsup ./src/index.ts --legacy-output --dts && copyfiles -f src/icons/* dist/icons/", | ||
"build": "npm run clean && tsup && npm run build:types && copyfiles -f src/icons/* dist/icons/", | ||
"build:types": "tsup --dts --format esm", | ||
"clean": "rimraf dist tests/assets", | ||
@@ -59,3 +61,3 @@ "lint": "npx eslint src --ext .ts", | ||
"ts-jest": "^29.1.1", | ||
"tsup": "^7.2.0", | ||
"tsup": "^8.0.2", | ||
"typescript": "^5.2.2", | ||
@@ -62,0 +64,0 @@ "webpack": "^5.89.0" |
@@ -8,3 +8,3 @@ # webpack-build-notifier | ||
[![NPM version](https://img.shields.io/npm/v/webpack-build-notifier.svg)](https://www.npmjs.org/package/webpack-build-notifier) | ||
[![Build Status](https://travis-ci.com/RoccoC/webpack-build-notifier.svg?branch=master)](https://travis-ci.com/RoccoC/webpack-build-notifier) | ||
[![CircleCI](https://dl.circleci.com/status-badge/img/circleci/Ugqkid9syiME3NMb2MaHFB/BxoKm9ZTqWgWCg5MEBVENr/tree/master.svg?style=shield)](https://dl.circleci.com/status-badge/redirect/circleci/Ugqkid9syiME3NMb2MaHFB/BxoKm9ZTqWgWCg5MEBVENr/tree/master) | ||
[![Coverage Status](https://coveralls.io/repos/github/RoccoC/webpack-build-notifier/badge.svg?branch=master)](https://coveralls.io/github/RoccoC/webpack-build-notifier?branch=master) | ||
@@ -11,0 +11,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
116111
10
673
Yes
3