From a387389ee8285b7464f5c9bf2a6142428890a4e1 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 9 Apr 2019 12:51:26 +0300 Subject: [PATCH] 2.6.0.beta1: trailing colons fix. --- dist/bundle.esm.js | 2 +- dist/bundle.js | 2 +- package.json | 4 ++-- src/css-lit.ts | 2 +- test/specs/lit.ts | 12 ++++++++++++ 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/dist/bundle.esm.js b/dist/bundle.esm.js index 1891b6c..16433c7 100644 --- a/dist/bundle.esm.js +++ b/dist/bundle.esm.js @@ -1 +1 @@ -import{createRenderer as e,combineRules as r}from"fela";import{renderToMarkup as n,rehydrate as t,render as o}from"fela-dom";import i from"fela-plugin-embedded";import u from"fela-plugin-prefixer";import c from"fela-plugin-fallback-value";import f from"fela-plugin-unit";var a=function(){return(a=Object.assign||function(e){for(var r,n=1,t=arguments.length;n\*\.:&\(\)\^="\-\[\]]+).*[ ,]*)+:?$/,l=/\s*,\s*/g,h=/(.*):[\n\r]/g,function(e,r,n){var t,o,i=(o=e)[o.length-1];switch(!0){case"{"==r:var u={};n.forEach(function(e){return i[e]=u}),e.push(u);break;case"}"==r:e.pop();break;case null!=(t=s.exec(r)):i[m(t[1])]=isNaN(t[3])?t[3]:+t[3];break;case null!=(t=p.exec(r)):n.splice(0),n.push.apply(n,r.split(l).map(function(r){return"."==(r=r.replace(h,"$1"))[0]&&(r=e.length>1?"& "+r:r.slice(1)),r}))}}),b=function(){var e=["\n","\r",";"],r=function(r){return e.includes(r)},n=new RegExp("["+e.join("")+"]","g");return function(e){for(var t=[],o=1;o\*\.:&\(\)\^="\-\[\]]+).*[ ,]*)+:?$/,l=/\s*,\s*/g,h=/(.*):$/,function(e,r,n){var t,o,i=(o=e)[o.length-1];switch(!0){case"{"==r:var u={};n.forEach(function(e){return i[e]=u}),e.push(u);break;case"}"==r:e.pop();break;case null!=(t=s.exec(r)):i[m(t[1])]=isNaN(t[3])?t[3]:+t[3];break;case null!=(t=p.exec(r)):n.splice(0),n.push.apply(n,r.split(l).map(function(r){return"."==(r=r.replace(h,"$1"))[0]&&(r=e.length>1?"& "+r:r.slice(1)),r}))}}),b=function(){var e=["\n","\r",";"],r=function(r){return e.includes(r)},n=new RegExp("["+e.join("")+"]","g");return function(e){for(var t=[],o=1;o\*\.:&\(\)\^="\-\[\]]+).*[ ,]*)+:?$/,t=/\s*,\s*/g,n=/(.*):[\n\r]/g;return function(i,u,a){var o,s=last(i);switch(!0){case"{"==u:var f={};a.forEach(function(e){return s[e]=f}),i.push(f);break;case"}"==u:i.pop();break;case null!=(o=e.exec(u)):s[camelify(o[1])]=isNaN(o[3])?o[3]:+o[3];break;case null!=(o=r.exec(u)):a.splice(0),a.push.apply(a,u.split(t).map(function(e){return"."==(e=e.replace(n,"$1"))[0]&&(e=i.length>1?"& "+e:e.slice(1)),e}))}}}(),css=function(){var e=["\n","\r",";"],r=function(r){return e.includes(r)},t=new RegExp("["+e.join("")+"]","g");return function(e){for(var n=[],i=1;i\*\.:&\(\)\^="\-\[\]]+).*[ ,]*)+:?$/,t=/\s*,\s*/g,n=/(.*):$/;return function(i,u,a){var o,s=last(i);switch(!0){case"{"==u:var f={};a.forEach(function(e){return s[e]=f}),i.push(f);break;case"}"==u:i.pop();break;case null!=(o=e.exec(u)):s[camelify(o[1])]=isNaN(o[3])?o[3]:+o[3];break;case null!=(o=r.exec(u)):a.splice(0),a.push.apply(a,u.split(t).map(function(e){return"."==(e=e.replace(n,"$1"))[0]&&(e=i.length>1?"& "+e:e.slice(1)),e}))}}}(),css=function(){var e=["\n","\r",";"],r=function(r){return e.includes(r)},t=new RegExp("["+e.join("")+"]","g");return function(e){for(var n=[],i=1;i coverage.lcov && codecov", "test:lazy": "ava", "gentypes": "dts-bundle-generator -o dist/bundle.d.ts src/main.ts", - "dev": "cross-env NODE_ENV=development rollup -c", + "dev": "cross-env NODE_ENV=development BUILD=es rollup -c", "prod:cjs": "cross-env NODE_ENV=production BUILD=cjs rollup -c", "prod:es": "cross-env NODE_ENV=production BUILD=es rollup -c", "prod": "npm run gentypes && npm run prod:es && npm run prod:cjs" }, - "version": "2.6.0beta.0", + "version": "2.6.0beta.1", "ava": { "files": [ "./test/specs/*.ts" diff --git a/src/css-lit.ts b/src/css-lit.ts index 2f9653d..bea6b55 100644 --- a/src/css-lit.ts +++ b/src/css-lit.ts @@ -14,7 +14,7 @@ const analyseLine = (() => { const ruleRE = /^([\w-]+)(: *| +)(.*)$/ const selectorRE = /^(([@>\*\.:&\(\)\^="\-\[\]]+).*[ ,]*)+:?$/ const delimRE = /\s*,\s*/g - const trailingColonRE = /(.*):[\n\r]/g + const trailingColonRE = /(.*):$/ return (levels: AnyObject[], line: string, names: string[]) => { let groups: string[] const current = last(levels) diff --git a/test/specs/lit.ts b/test/specs/lit.ts index bfe0cb9..256b375 100644 --- a/test/specs/lit.ts +++ b/test/specs/lit.ts @@ -18,6 +18,14 @@ test('lit-css', (t) => { '& .inner': { left: 42 } + }, + cls: { + '& .red': { + padding: 5 + }, + '& .green': { + padding: 5 + } } } const rule = () => css` @@ -31,6 +39,10 @@ test('lit-css', (t) => { left: 42 } } + .cls: { + .red, .green: { + padding: 5 + } ` ff(t.deepEqual(rule(), obj))