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.13.0 to 0.13.1

11

lib/index.d.ts
import { type Node, type Pos } from 'mvdan-sh';
import type { ParserOptions, Plugin } from 'prettier';
import type { File, Node as ShSyntaxNode, ShOptions } from 'sh-syntax';
export interface Processor {
(text: string, options?: ShOptions): File;
(text: string, options?: ShOptions & {
print: true;
}): string;
(ast: File, options?: ShOptions & {
originalText: string;
}): string;
}
import { type Node as ShSyntaxNode, type ShOptions } from 'sh-syntax';
export interface ShParserOptions extends Required<ParserOptions<Node | ShSyntaxNode>>, Required<ShOptions> {

@@ -14,0 +5,0 @@ experimentalWasm: boolean;

14

lib/index.js

@@ -1,11 +0,5 @@

import path from 'node:path';
import { fileURLToPath } from 'node:url';
import sh from 'mvdan-sh';
import { createSyncFn } from 'synckit';
import { processor, } from 'sh-syntax';
import { languages } from './languages.js';
const _dirname = typeof __dirname === 'undefined'
? path.dirname(fileURLToPath(import.meta.url))
: __dirname;
const { syntax } = sh;
const processor = createSyncFn(path.resolve(_dirname, 'worker.js'));
class ShParseError extends SyntaxError {

@@ -38,6 +32,6 @@ constructor(err) {

sh: {
parse: (text, { filepath, keepComments = true, stopAt, variant, experimentalWasm, }) => {
async parse(text, { filepath, keepComments = true, stopAt, variant, experimentalWasm, }) {
if (experimentalWasm) {
try {
return processor(text, {
return await processor(text, {
filepath,

@@ -74,3 +68,3 @@ keepComments,

sh: {
print: (path, { originalText, filepath, useTabs, tabWidth, 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) {

@@ -77,0 +71,0 @@ return processor(path.getNode(), {

@@ -171,2 +171,27 @@ export const languages = [

{
"name": "Nushell",
"aceMode": "sh",
"since": "0.1.0",
"parsers": [
"sh"
],
"linguistLanguageId": 446573572,
"vscodeLanguageIds": [
"shellscript"
],
"extensions": [
".nu"
],
"interpreters": [
"nu"
],
"aliases": [
"nu-script",
"nushell-script"
],
"tmScope": "source.nushell",
"codemirrorMode": "shell",
"codemirrorMimeType": "text/x-sh"
},
{
"name": "OpenRC runscript",

@@ -194,2 +219,26 @@ "aceMode": "sh",

{
"name": "Option List",
"aceMode": "sh",
"since": "0.1.0",
"parsers": [
"sh"
],
"linguistLanguageId": 723589315,
"vscodeLanguageIds": [
"shellscript"
],
"aliases": [
"opts",
"ackrc"
],
"filenames": [
".ackrc",
"ackrc",
"mocha.opts"
],
"tmScope": "source.opts",
"codemirrorMode": "shell",
"codemirrorMimeType": "text/x-sh"
},
{
"name": "Shell",

@@ -217,3 +266,2 @@ "aceMode": "sh",

".command",
".env",
".fcgi",

@@ -224,2 +272,3 @@ ".ksh",

".tool",
".trigger",
".zsh",

@@ -230,2 +279,3 @@ ".zsh-theme"

".bash_aliases",
".bash_functions",
".bash_history",

@@ -236,4 +286,2 @@ ".bash_logout",

".cshrc",
".env",
".env.example",
".flaskenv",

@@ -240,0 +288,0 @@ ".kshrc",

{
"name": "prettier-plugin-sh",
"version": "0.13.0",
"version": "0.13.1",
"type": "module",

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

"mvdan-sh": "^0.10.1",
"sh-syntax": "^0.4.1",
"synckit": "^0.8.5"
"sh-syntax": "^0.4.1"
},

@@ -45,0 +44,0 @@ "publishConfig": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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