Socket
Socket
Sign inDemoInstall

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.12.0 to 0.12.1

23

dist/index.js

@@ -267,11 +267,10 @@ import { parse } from '@astrojs/compiler/sync';

function getNextNode(path) {
var _a, _b, _c, _d;
const node = path.getNode();
if (node) {
const siblings = getSiblings(path);
if (((_a = node.position) === null || _a === void 0 ? void 0 : _a.start) === ((_b = siblings[siblings.length - 1].position) === null || _b === void 0 ? void 0 : _b.start))
if (node.position?.start === siblings[siblings.length - 1].position?.start)
return null;
for (let i = 0; i < siblings.length; i++) {
const sibling = siblings[i];
if (((_c = sibling.position) === null || _c === void 0 ? void 0 : _c.start) === ((_d = node.position) === null || _d === void 0 ? void 0 : _d.start) && i !== siblings.length - 1) {
if (sibling.position?.start === node.position?.start && i !== siblings.length - 1) {
return siblings[i + 1];

@@ -567,3 +566,2 @@ }

return async (textToDoc, print) => {
var _a;
const node = path.node;

@@ -592,6 +590,6 @@ if (!node)

if (typeof doc === 'string') {
doc = doc.replace(openingBracketReplace, '{');
doc = doc.replace(closingBracketReplace, '}');
doc = doc.replace(atSignReplace, '@');
doc = doc.replace(dotReplace, '.');
doc = doc.replaceAll(openingBracketReplace, '{');
doc = doc.replaceAll(closingBracketReplace, '}');
doc = doc.replaceAll(atSignReplace, '@');
doc = doc.replaceAll(dotReplace, '.');
}

@@ -629,3 +627,3 @@ return doc;

if (node.type === 'element' && node.name === 'script' && node.children.length) {
const typeAttribute = (_a = node.attributes.find((attr) => attr.name === 'type')) === null || _a === void 0 ? void 0 : _a.value;
const typeAttribute = node.attributes.find((attr) => attr.name === 'type')?.value;
let parser = 'babel-ts';

@@ -725,6 +723,6 @@ if (typeAttribute) {

if (attr.name.includes('@')) {
attr.name = attr.name.replace('@', atSignReplace);
attr.name = attr.name.replaceAll('@', atSignReplace);
}
if (attr.name.includes('.')) {
attr.name = attr.name.replace('.', dotReplace);
attr.name = attr.name.replaceAll('.', dotReplace);
}

@@ -735,3 +733,2 @@ return attr;

async function embedStyle(lang, content, path, print, textToDoc, options) {
var _a;
const isEmpty = /^\s*$/.test(content);

@@ -757,3 +754,3 @@ switch (lang) {

case 'sass': {
const lineEnding = ((_a = options === null || options === void 0 ? void 0 : options.endOfLine) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === 'CRLF' ? 'CRLF' : 'LF';
const lineEnding = options?.endOfLine?.toUpperCase() === 'CRLF' ? 'CRLF' : 'LF';
const sassOptions = {

@@ -760,0 +757,0 @@ tabSize: options.tabWidth,

{
"name": "prettier-plugin-astro",
"version": "0.12.0",
"version": "0.12.1",
"type": "module",

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

@@ -16,2 +16,3 @@ # [Prettier](https://prettier.io/) Plugin for [Astro](https://astro.build/)

```js
// .prettierrc.mjs
/** @type {import("prettier").Config} */

@@ -28,2 +29,3 @@ export default {

```js
// .prettierrc.mjs
/** @type {import("prettier").Config} */

@@ -30,0 +32,0 @@ export default {

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