Comparing version 1.1.3 to 1.2.0
@@ -12,2 +12,6 @@ # Changelog | ||
## [1.2.0] - 2021-04-14 | ||
- Provide native ECMAScript module source files. | ||
## [1.1.3] - 2021-03-13 | ||
@@ -14,0 +18,0 @@ |
22
index.js
@@ -11,3 +11,3 @@ /** | ||
* @module shescape | ||
* @version 1.1.3 | ||
* @version 1.2.0 | ||
* @license MPL-2.0 | ||
@@ -17,5 +17,5 @@ * @author Eric Cornelissen <ericornelissen@gmail.com> | ||
const os = require("os"); | ||
import os from "os"; | ||
const main = require("./src/main.js"); | ||
import * as main from "./src/main.js"; | ||
@@ -32,6 +32,6 @@ /** | ||
*/ | ||
module.exports.escape = function (arg) { | ||
export function escape(arg) { | ||
const platform = os.platform(); | ||
return main.escapeShellArgByPlatform(arg, platform); | ||
}; | ||
} | ||
@@ -50,3 +50,3 @@ /** | ||
*/ | ||
module.exports.escapeAll = function (args) { | ||
export function escapeAll(args) { | ||
if (!Array.isArray(args)) args = [args]; | ||
@@ -62,3 +62,3 @@ | ||
return result; | ||
}; | ||
} | ||
@@ -76,6 +76,6 @@ /** | ||
*/ | ||
module.exports.quote = function (arg) { | ||
export function quote(arg) { | ||
const platform = os.platform(); | ||
return main.quoteShellArgByPlatform(arg, platform); | ||
}; | ||
} | ||
@@ -94,3 +94,3 @@ /** | ||
*/ | ||
module.exports.quoteAll = function (args) { | ||
export function quoteAll(args) { | ||
if (!Array.isArray(args)) args = [args]; | ||
@@ -106,2 +106,2 @@ | ||
return result; | ||
}; | ||
} |
{ | ||
"name": "shescape", | ||
"version": "1.1.3", | ||
"version": "1.2.0", | ||
"description": "simple shell escape library", | ||
"homepage": "https://ericcornelissen.github.io/shescape/", | ||
"license": "MPL-2.0", | ||
"main": "index.js", | ||
"type": "module", | ||
"main": "./index.cjs", | ||
"exports": { | ||
"import": "./index.js", | ||
"require": "./index.cjs" | ||
}, | ||
"scripts": { | ||
"clean": "rm -rf .corpus .nyc_output coverage crash-*", | ||
"format": "prettier --write ./**/*.{js,md,yml}", | ||
"fuzz": "jsfuzz ./test/index.fuzz.js ./.corpus", | ||
"fuzz:coverage": "nyc report --reporter=text", | ||
"clean": "rm -rf .corpus coverage crash-* index.cjs", | ||
"format": "prettier --write ./**/*.{cjs,js,md,yml}", | ||
"prefuzz": "npm run transpile", | ||
"fuzz": "jsfuzz ./test/index.fuzz.cjs ./.corpus", | ||
"lint": "prettier --check ./**/*.{js,md,yml}", | ||
"_postinstall": "is-ci || husky install", | ||
"prepublishOnly": "pinst --disable", | ||
"prepublishOnly": "pinst --disable && npm run transpile", | ||
"postpublish": "pinst --enable", | ||
"test": "mocha", | ||
"test:coverage": "nyc --reporter=lcov --reporter=text npm run test" | ||
"test": "mocha test/**/*.test.js", | ||
"test:coverage": "c8 --reporter=lcov --reporter=text npm run test", | ||
"transpile": "ncc build index.js && mv dist/index.js index.cjs && rm -rf dist" | ||
}, | ||
@@ -38,10 +44,11 @@ "repository": { | ||
"devDependencies": { | ||
"husky": "^5.0.4", | ||
"@vercel/ncc": "^0.28.3", | ||
"c8": "^7.7.1", | ||
"husky": "^6.0.0", | ||
"is-ci": "^3.0.0", | ||
"jsfuzz": "^1.0.14", | ||
"mocha": "^8.2.0", | ||
"nyc": "^15.1.0", | ||
"pinst": "^2.1.1", | ||
"prettier": "^2.1.2", | ||
"sinon": "^9.2.1" | ||
"sinon": "^10.0.0" | ||
}, | ||
@@ -48,0 +55,0 @@ "engines": { |
@@ -10,3 +10,3 @@ /** | ||
*/ | ||
module.exports.typeError = | ||
export const typeError = | ||
"Shescape requires strings or values that can be converted into a string using .toString()"; | ||
@@ -17,2 +17,2 @@ | ||
*/ | ||
module.exports.win32 = "win32"; | ||
export const win32 = "win32"; |
@@ -8,5 +8,5 @@ /** | ||
const { typeError, win32 } = require("./constants.js"); | ||
const unix = require("./unix.js"); | ||
const win = require("./win.js"); | ||
import { typeError, win32 } from "./constants.js"; | ||
import * as unix from "./unix.js"; | ||
import * as win from "./win.js"; | ||
@@ -37,3 +37,3 @@ /** | ||
*/ | ||
function escapeShellArgByPlatform(arg, platform) { | ||
export function escapeShellArgByPlatform(arg, platform) { | ||
let argAsString = arg; | ||
@@ -67,3 +67,3 @@ if (typeof arg !== "string") { | ||
*/ | ||
function quoteShellArgByPlatform(arg, platform) { | ||
export function quoteShellArgByPlatform(arg, platform) { | ||
const safeArg = escapeShellArgByPlatform(arg, platform); | ||
@@ -77,4 +77,1 @@ switch (platform) { | ||
} | ||
module.exports.escapeShellArgByPlatform = escapeShellArgByPlatform; | ||
module.exports.quoteShellArgByPlatform = quoteShellArgByPlatform; |
@@ -13,6 +13,4 @@ /** | ||
*/ | ||
function escapeShellArg(arg) { | ||
export function escapeShellArg(arg) { | ||
return arg.replace(/\u{0}/gu, "").replace(/'/g, `'\\''`); | ||
} | ||
module.exports.escapeShellArg = escapeShellArg; |
@@ -13,6 +13,4 @@ /** | ||
*/ | ||
function escapeShellArg(arg) { | ||
export function escapeShellArg(arg) { | ||
return arg.replace(/\u{0}/gu, "").replace(/"/g, `""`); | ||
} | ||
module.exports.escapeShellArg = escapeShellArg; |
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
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
37142
11
445
Yes
9
1