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

prettier-plugin-astro

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prettier-plugin-astro - npm Package Compare versions

Comparing version 0.8.0 to 0.8.1

45

dist/index.js

@@ -6,2 +6,3 @@ 'use strict';

var _doc = require('prettier/doc');
var node_buffer = require('node:buffer');
var sassFormatter = require('sass-formatter');

@@ -596,7 +597,41 @@

if (node.type === 'frontmatter') {
const frontmatterContent = wrapParserTryCatch(textToDoc, node.value, {
const textContent = node.value.replace(/\breturn\b/g, '___astro_return;throw');
const frontmatterContent = wrapParserTryCatch(textToDoc, textContent, {
...opts,
parser: 'typescript',
});
return [group(['---', hardline, frontmatterContent, '---', hardline]), hardline];
const frontmatterDoc = mapDoc(frontmatterContent, (doc) => {
if (typeof doc === 'string') {
return doc.replace(/___astro_return;throw/g, 'return');
}
if (Array.isArray(doc)) {
const parts = [];
for (const p of doc) {
if (Array.isArray(p)) {
parts.push(...p);
}
else {
parts.push(p);
}
}
for (let i = parts.length - 1; i > 0; i--) {
if (parts[i] === 'throw') {
for (let j = i - 1; j >= 0; j--) {
if (parts[j] === '___astro_return') {
parts[i] = 'return';
parts.splice(j, i - j);
i = j;
break;
}
}
}
}
return parts;
}
if ('parts' in doc) {
return doc.parts;
}
return doc;
});
return [group(['---', hardline, frontmatterDoc, '---', hardline]), hardline];
}

@@ -647,3 +682,3 @@ if (node.type === 'element' && node.name === 'script') {

function expressionParser(text, parsers, options) {
const ast = parsers['babel-ts'](text, options);
const ast = parsers['babel-ts'](text, parsers, options);
return {

@@ -751,3 +786,5 @@ ...ast,

if (node) {
return options.originalText.slice(options.locStart(node), options.locEnd(node));
return node_buffer.Buffer.from(options.originalText)
.subarray(options.locStart(node), options.locEnd(node))
.toString();
}

@@ -754,0 +791,0 @@ return null;

2

package.json
{
"name": "prettier-plugin-astro",
"version": "0.8.0",
"version": "0.8.1",
"type": "commonjs",

@@ -5,0 +5,0 @@ "description": "A Prettier Plugin for formatting Astro files",

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