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

postcss-syntax

Package Overview
Dependencies
Maintainers
2
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-syntax - npm Package Compare versions

Comparing version 0.25.0 to 0.26.0

.npmignore

21

get-syntax.js
"use strict";
const path = require("path");
const reSyntaxCSS = /^(?:post)?css$/i;

@@ -9,2 +11,3 @@ function cssSyntax () {

}
function normalize (syntax) {

@@ -19,11 +22,13 @@ if (!syntax.parse) {

function requireSyntax (lang) {
if (/^css$/i.test(lang)) {
function requireSyntax (syntax) {
if (reSyntaxCSS.test(syntax)) {
return cssSyntax();
} else if (/^sugarss$/i.test(lang)) {
lang = "sugarss";
} else if (/^sugarss$/i.test(syntax)) {
syntax = "sugarss";
} else if (path.isAbsolute(syntax) || syntax.startsWith(".")) {
syntax = path.resolve(syntax);
} else {
lang = lang.toLowerCase().replace(/^(postcss-)?/i, "postcss-");
syntax = syntax.toLowerCase().replace(/^(?:postcss-)?(\w+)/i, "postcss-$1");
}
return normalize(require(lang));
return normalize(require(syntax));
}

@@ -44,3 +49,3 @@

}
} else if (/^css$/i.test(lang)) {
} else if (reSyntaxCSS.test(lang)) {
syntax = cssSyntax();

@@ -51,3 +56,3 @@ } else {

if (!syntax.stringify) {
if (/^css$/i.test(lang)) {
if (reSyntaxCSS.test(lang)) {
syntax.stringify = require("postcss/lib/stringify");

@@ -54,0 +59,0 @@ } else {

@@ -8,2 +8,9 @@ "use strict";

{
// WXSS(WeiXin Style Sheets) See: https://developers.weixin.qq.com/miniprogram/dev/framework/view/wxss.html
// acss(AntFinancial Style Sheet) See: https://docs.alipay.com/mini/framework/acss
// `*.pcss`, `*.postcss`
test: /\.(?:wx|\w*c)ss$/i,
lang: "css",
},
{
test: /\.less$/i,

@@ -29,9 +36,2 @@ lang: "less",

{
// WXSS(WeiXin Style Sheets) See: https://developers.weixin.qq.com/miniprogram/dev/framework/view/wxss.html
// acss(AntFinancial Style Sheet) See: https://docs.alipay.com/mini/framework/acss
// `*.pcss`, `*.postcss`
test: /\.(?:wx|\w*c)ss$/i,
lang: "css",
},
{
test: /\.(?:[sx]?html?|[sx]ht|vue|ux|markdown|md|php)$/i,

@@ -38,0 +38,0 @@ extract: "html",

{
"name": "postcss-syntax",
"version": "0.25.0",
"version": "0.26.0",
"description": "Automatically switch PostCSS syntax by file extensions",

@@ -42,6 +42,6 @@ "repository": {

"postcss": "^6.0.22",
"postcss-html": ">=0.25.0",
"postcss-jsx": ">=0.25.0",
"postcss-html": ">=0.26.0",
"postcss-jsx": ">=0.26.0",
"postcss-less": "^1.1.5",
"postcss-markdown": ">=0.25.0",
"postcss-markdown": ">=0.26.0",
"postcss-safe-parser": "^3.0.1",

@@ -48,0 +48,0 @@ "postcss-scss": "^1.0.5",

@@ -14,4 +14,5 @@ "use strict";

let rules = opts.syntax.config.rules;
const file = opts.from ? opts.from.replace(/^(\w+:\/\/.*?\.\w+)(?:[?#].*)?$/, "$1") : "";
rules = rules && rules.filter(
rule => rule.test.test(opts.from || "")
rule => rule.test.test(file)
);

@@ -18,0 +19,0 @@ source = source.toString();

@@ -42,3 +42,3 @@ PostCSS Syntax

const syntax = require('postcss-syntax')({
processors: [
rules: [
{

@@ -54,6 +54,6 @@ test: /\.(?:[sx]?html?|[sx]ht|vue|ux|php)$/i,

test: /\.(?:m?[jt]sx?|es\d*|pac)$/i,
extract: 'styled',
extract: 'jsx',
},
{
// custom file extension
// custom language for file extension
test: /\.postcss$/i,

@@ -63,3 +63,3 @@ lang: 'scss'

{
// custom syntax engine
// custom language for file extension
test: /\.customcss$/i,

@@ -69,8 +69,14 @@ lang: 'custom'

],
css: postcss,
// custom parser for CSS (using `postcss-safe-parser`)
css: 'postcss-safe-parser',
// custom parser for SASS (PostCSS-compatible syntax.)
sass: require('postcss-sass'),
scss: require('postcss-scss'),
less: require('postcss-less'),
// custom parser for SCSS (by module name)
scss: 'postcss-scss',
// custom parser for LESS (by module path)
less: './node_modules/postcss-less',
// custom parser for SugarSS
sugarss: require('sugarss'),
// custom syntax engine
// custom parser for custom language
custom: require('postcss-custom-syntax'),

@@ -77,0 +83,0 @@

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