Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

prettier-plugin-sh

Package Overview
Dependencies
Maintainers
2
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prettier-plugin-sh - npm Package Compare versions

Comparing version 0.12.8 to 0.13.0-alpha.0

./lib/index.cjs

33

lib/index.js

@@ -6,3 +6,2 @@ import path from 'node:path';

import { languages } from './languages.js';
/* c8 ignore next 4 */
const _dirname = typeof __dirname === 'undefined'

@@ -28,5 +27,4 @@ ? path.dirname(fileURLToPath(import.meta.url))

const error = err;
super(/* c8 ignore next */ ('Text' in error && error.Text) || error.message);
super(('Text' in error && error.Text) || error.message);
this.cause = err;
// `error instanceof ParseError` won't not work because the error is thrown wrapped by `synckit`
if ('Pos' in error && error.Pos != null && typeof error.Pos === 'object') {

@@ -37,3 +35,2 @@ this.loc = { start: { column: error.Pos.Col, line: error.Pos.Line } };

}
// eslint-disable-next-line @typescript-eslint/ban-types
const isFunction = (val) => typeof val === 'function';

@@ -44,3 +41,3 @@ const ShPlugin = {

sh: {
parse: (text, _parsers, { filepath, keepComments = true, stopAt, variant, experimentalWasm, }) => {
parse: (text, { filepath, keepComments = true, stopAt, variant, experimentalWasm, }) => {
if (experimentalWasm) {

@@ -60,3 +57,2 @@ try {

const parserOptions = [syntax.KeepComments(keepComments)];
/* c8 ignore next 8 */
if (stopAt != null) {

@@ -76,8 +72,4 @@ parserOptions.push(syntax.StopAt(stopAt));

astFormat: 'sh',
locStart: node =>
/* c8 ignore next */
isFunction(node.Pos) ? node.Pos().Offset() : node.Pos.Offset,
locEnd: node =>
/* c8 ignore next */
isFunction(node.End) ? node.End().Offset() : node.End.Offset,
locStart: node => isFunction(node.Pos) ? node.Pos().Offset() : node.Pos.Offset,
locEnd: node => isFunction(node.End) ? node.End().Offset() : node.End.Offset,
},

@@ -87,5 +79,3 @@ },

sh: {
print: (path, { originalText, filepath, useTabs, tabWidth,
/* c8 ignore next */
indent = useTabs ? 0 : tabWidth, binaryNextLine = true, switchCaseIndent = true, spaceRedirects = true, keepPadding, minify, functionNextLine, experimentalWasm, }) => {
print: (path, { originalText, filepath, useTabs, tabWidth, indent = useTabs ? 0 : tabWidth, binaryNextLine = true, switchCaseIndent = true, spaceRedirects = true, keepPadding, minify, functionNextLine, experimentalWasm, }) => {
if (experimentalWasm) {

@@ -108,3 +98,3 @@ return processor(path.getNode(), {

.NewPrinter(syntax.Indent(indent), syntax.BinaryNextLine(binaryNextLine), syntax.SwitchCaseIndent(switchCaseIndent), syntax.SpaceRedirects(spaceRedirects), syntax.KeepPadding(keepPadding), syntax.Minify(minify), syntax.FunctionNextLine(functionNextLine))
.Print(path.getValue());
.Print(path.node);
},

@@ -115,3 +105,2 @@ },

keepComments: {
since: '0.1.0',
category: 'Output',

@@ -123,3 +112,2 @@ type: 'boolean',

stopAt: {
since: '0.1.0',
category: 'Config',

@@ -135,3 +123,2 @@ type: 'path',

variant: {
since: '0.1.0',
category: 'Config',

@@ -161,3 +148,2 @@ type: 'choice',

indent: {
since: '0.1.0',
category: 'Format',

@@ -168,3 +154,2 @@ type: 'int',

binaryNextLine: {
since: '0.1.0',
category: 'Output',

@@ -176,3 +161,2 @@ type: 'boolean',

switchCaseIndent: {
since: '0.1.0',
category: 'Format',

@@ -184,3 +168,2 @@ type: 'boolean',

spaceRedirects: {
since: '0.1.0',
category: 'Format',

@@ -192,3 +175,2 @@ type: 'boolean',

keepPadding: {
since: '0.1.0',
category: 'Format',

@@ -203,3 +185,2 @@ type: 'boolean',

minify: {
since: '0.1.0',
category: 'Output',

@@ -211,3 +192,2 @@ type: 'boolean',

functionNextLine: {
since: '0.1.0',
category: 'Format',

@@ -219,3 +199,2 @@ type: 'boolean',

experimentalWasm: {
since: '0.13.0',
category: 'config',

@@ -222,0 +201,0 @@ type: 'boolean',

{
"name": "prettier-plugin-sh",
"version": "0.12.8",
"version": "0.13.0-alpha.0",
"type": "module",

@@ -9,37 +9,6 @@ "description": "An opinionated `shellscript` formatter plugin for Prettier, also support simple format of `Dockerfile`, `properties`, `gitignore`, `dotenv`, `hosts`, `jvmoptions`...",

"author": "JounQin (https://www.1stG.me) <admin@1stg.me>",
"donate": {
"recipients": [
{
"name": "unts",
"platform": "opencollective",
"address": "https://opencollective.com/unts",
"weight": 60
},
{
"name": "rxts",
"platform": "opencollective",
"address": "https://opencollective.com/rxts",
"weight": 20
},
{
"name": "1stG",
"email": "i@1stg.me",
"weight": 20,
"platforms": [
{
"platform": "opencollective",
"address": "https://opencollective.com/1stG"
},
{
"platform": "patreon",
"address": "https://www.patreon.com/1stG"
}
]
}
]
},
"funding": "https://opencollective.com/unts",
"license": "MIT",
"engines": {
"node": "^12.20.0 || ^14.18.0 || >=16.0.0"
"node": "^14.18.0 || >=16.0.0"
},

@@ -69,8 +38,8 @@ "main": "./lib/index.cjs",

"peerDependencies": {
"prettier": "^2.0.0"
"prettier": "^3.0.0-alpha.0"
},
"dependencies": {
"mvdan-sh": "^0.10.1",
"sh-syntax": "^0.3.6",
"synckit": "^0.8.1"
"sh-syntax": "^0.3.7",
"synckit": "^0.8.5"
},

@@ -77,0 +46,0 @@ "publishConfig": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc