single-file-core 1.5.53 → 1.5.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -66,6 +66,7 @@ const EMPTY_STRING = "";
66
66
  const CSS_IMPORTANCE_NOT_IMPORTANT = 0;
67
67
  const CSS_IMPORTANCE_IMPORTANT = 1;
68
68
  const INVALID_CSS_ESCAPE_TEST = /\\(?![0-9a-fA-F]{1,6}\s|[^0-9a-zA-Z])/;
69
+ const ANONYMOUS_LAYER_PLACEHOLDER = "\u0000";
69
70
 
70
71
  export {
71
72
  process
@@ -125,12 +126,6 @@ function minifyRules(stylesheets, docContext) {
125
126
  if (!stylesheetInfo.scoped && stylesheetInfo.stylesheet && !key.urlNode) {
126
127
  if (hasChildNodes(stylesheetInfo.stylesheet)) {
127
128
  const topConditionalStack = stylesheetInfo.mediaText ? [{ name: "media", prelude: stylesheetInfo.mediaText }] : [];
128
- if (stylesheetInfo.layerName !== undefined) {
129
- topConditionalStack.push({ name: "layer", prelude: stylesheetInfo.layerName });
130
- }
131
- if (stylesheetInfo.supportsCondition !== undefined) {
132
- topConditionalStack.push({ name: "supports", prelude: stylesheetInfo.supportsCondition });
133
- }
134
129
  minifyStylesheetRules(stylesheetInfo.stylesheet.children, stylesheets, {
135
130
  ancestorsSelectors: [],
136
131
  layerStack: [],
@@ -192,13 +187,11 @@ function buildConditionalStack(conditionalStack, ruleData, docContext) {
192
187
 
193
188
  function registerLayerDeclaration(layerStack, layerName, conditionalStack, docContext) {
194
189
  const fullLayerName = getFullLayerName([...layerStack, layerName]);
195
- if (fullLayerName) {
196
- docContext.layerDeclarations.push({
197
- name: fullLayerName,
198
- order: docContext.layerDeclarationCounter++,
199
- conditionalStack: conditionalStack.slice()
200
- });
201
- }
190
+ docContext.layerDeclarations.push({
191
+ name: fullLayerName,
192
+ order: docContext.layerDeclarationCounter++,
193
+ conditionalStack: conditionalStack.slice()
194
+ });
202
195
  }
203
196
 
204
197
  function minifyStylesheetRules(cssRules, stylesheets, processingContext, docContext) {
@@ -636,8 +629,8 @@ function compareDeclarations(declarationA, declarationB, docContext) {
636
629
  }
637
630
 
638
631
  function compareLayers(layersA, layersB, docContext) {
639
- const isUnlayeredA = layersA.length === 0 || layersA.every(layerName => layerName === EMPTY_STRING);
640
- const isUnlayeredB = layersB.length === 0 || layersB.every(layerName => layerName === EMPTY_STRING);
632
+ const isUnlayeredA = layersA.length === 0;
633
+ const isUnlayeredB = layersB.length === 0;
641
634
  if (isUnlayeredA && isUnlayeredB) {
642
635
  return 0;
643
636
  }
@@ -880,7 +873,7 @@ function getPreludeText(prelude, docContext) {
880
873
  }
881
874
 
882
875
  function getFullLayerName(layers) {
883
- return layers.filter(layerName => layerName !== EMPTY_STRING).join(LAYER_NAME_SEPARATOR);
876
+ return layers.map(layerName => layerName === EMPTY_STRING ? ANONYMOUS_LAYER_PLACEHOLDER : layerName).join(LAYER_NAME_SEPARATOR);
884
877
  }
885
878
 
886
879
  function parseCss(text, context = SELECTOR_CONTEXT) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "single-file-core",
3
- "version": "1.5.53",
3
+ "version": "1.5.55",
4
4
  "description": "SingleFile Core",
5
5
  "author": "Gildas Lormeau",
6
6
  "license": "AGPL-3.0-or-later",