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

@csson/csson

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@csson/csson - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

tests/cjs-test.js

14

index.cjs.js

@@ -258,6 +258,12 @@ const parseCSS = require('./lib/parse-css/index.cjs.js')

(list, token) => {
const object = parseCSSON(token.toSource())
let json
try {
json = JSON.parse(
token.toSource()
)
} catch (error) {}
if (object !== undefined) {
list.push(object)
if (json !== undefined) {
list.push(json)
}

@@ -318,3 +324,3 @@

(obj, prop) => {
obj[prop.name] = parseCSSON(
obj[prop.name] = JSON.parse(
stringifyTokens(prop.value)

@@ -321,0 +327,0 @@ )

@@ -258,6 +258,12 @@ import * as parseCSS from './lib/parse-css/index.js'

(list, token) => {
const object = parseCSSON(token.toSource())
let json
try {
json = JSON.parse(
token.toSource()
)
} catch (error) {}
if (object !== undefined) {
list.push(object)
if (json !== undefined) {
list.push(json)
}

@@ -318,3 +324,3 @@

(obj, prop) => {
obj[prop.name] = parseCSSON(
obj[prop.name] = JSON.parse(
stringifyTokens(prop.value)

@@ -321,0 +327,0 @@ )

{
"name": "@csson/csson",
"version": "0.1.1",
"version": "0.1.2",
"description": "A JSON superset with additional types from CSS",

@@ -5,0 +5,0 @@ "main": "index.js",

# CSSON
A JSON superset with additional types from CSS
A JSON superset with additional types from CSS (and comments!)
## About
CSSON is a superset of [JSON](https://www.ecma-international.org/publications/standards/Ecma-404.htm) that is parsed according to [CSS syntax](https://drafts.csswg.org/css-syntax-3/).
CSSON is a superset of [JSON](https://www.ecma-international.org/publications/standards/Ecma-404.htm) that is parsed according to [CSS syntax](https://drafts.csswg.org/css-syntax-3/). All JSON can be handled as CSSON, though not every CSS style sheet can be parsed as CSSON.
All JSON can be handled as CSSON, though not every CSS style sheet can be parsed as CSSON.
It aims to be a more flexible and forgiving syntax for humans to work with compared to JSON, and also let developers encode common formats like fragment identifiers and urls.
<!--
Pros:
## Comments
- CSSON syntax is more expressive and forgiving than JSON syntax, making it friendlier to use
- CSSON includes more types than JSON, allowing your environment to handle the pieces of information in a smarter way
- Includes comments
Since CSSON is parsed according to CSS syntax, any [CSS comments](https://drafts.csswg.org/css-syntax-3/#comment-diagram) `/* */` will be safely ignored during parsing or conversion to JSON.
Cons:
```css
/* It's like JSON… */
{
/* but with comments… */
"demo": [1, 2, 3] /* that can go anywhere! */
}
```
- less built-in language support compared to JSON or XML
-->
## CSSON Objects

@@ -169,3 +169,3 @@

## Using as a CommonJS module with Node
### Using as a CommonJS module with Node

@@ -189,3 +189,3 @@ ```js

#### Expanding a string
#### Converting a string

@@ -206,5 +206,5 @@ To convert a string of CSSON to JSON, supply a string to the CLI script as the first argument:

#### Expanding a file
#### Converting a file
To expand a stylesheet, supply a pathname to the CLI script as the first argument:
To convert a CSSON file to JSON, supply a pathname to the CLI script as the first argument:

@@ -225,9 +225,9 @@ ```bash

## Building an Executable
### Building an Executable
It's possible to build self-contained executables from the files in this repository in a few different ways.
### Using the QuickJS Compiler
#### Using the QuickJS Compiler
The first way we can build this into an executable is to use the [QuickJS compiler](https://bellard.org/quickjs/quickjs.html#qjsc-compiler). This will compile [cli/quickjs.js] into C bytecode, and then compile that into a small self-contained executable:
The first way we can build this into an executable is to use the [QuickJS compiler](https://bellard.org/quickjs/quickjs.html#qjsc-compiler). This will compile [cli/quickjs.js](./cli/quickjs.js) into C bytecode, and then compile that into a small self-contained executable:

@@ -244,5 +244,5 @@ ```bash

### Using pkg
#### Using pkg
The second way to build executables from this repository is to use Node and the [pkg](https://www.npmjs.com/package/pkg) package to compile [cli/node.js] into a self-contained executable that can run even without Node installed:
The second way to build executables from this repository is to use Node and the [pkg](https://www.npmjs.com/package/pkg) package to compile [cli/node.js](./cli/node.js) into a self-contained executable that can run even without Node installed:

@@ -253,3 +253,3 @@ ```bash

> You may need to add a `--targets` argument, e.g. `--targets node12`, to build this with pkg if there are no build targets available for the latest node version
> You may need to supply a `--targets` argument, e.g. `--targets node12`, to build this with pkg if there are no build targets available for the latest node version

@@ -320,2 +320,6 @@ ## Options

## Online Conversion Tool
Check out the [CSSON to JSON converter](https://tomhodgins.github.io/CSSON/) online
## More Info

@@ -322,0 +326,0 @@

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