@tbela99/css-parser 1.4.5 → 1.4.6

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.
package/CHANGELOG.md CHANGED
@@ -1,14 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.4.6
4
+
5
+ - [x] Fix if syntax expansion regression bug #134
6
+
3
7
  ## v1.4.5
4
8
 
5
- - [x] Temporarily disable if syntax expansion
9
+ - [x] Temporarily disable if syntax expansion #131
6
10
 
7
11
  ## v1.4.4
8
12
 
9
13
  ### Validation changes
10
14
 
11
- - [x] Added the `state` and `errors` properties to nodes to expose their validation status and any associated validation errors.
15
+ - [x] Added the `state` and `errors` properties to nodes to expose their validation status and any associated validation errors. #127
12
16
  - [x] Nodes that fail validation are no longer discarded. Nodes are discarded only if they are invalid, unparsed, or malformed. Unknown nodes are discarded when lenient parsing is disabled.
13
17
 
14
18
  ### Color
package/README.md CHANGED
@@ -44,6 +44,7 @@ $ deno add @tbela99/css-parser
44
44
  ## Syntax lowering
45
45
  CSS-Parser can transform these modern CSS features into lower-level CSS syntax:
46
46
  * **Nested CSS transpilation** to legacy-compatible syntax.
47
+ * **`if()` function transpilation** for broader browser compatibility.
47
48
  * **`color-mix()` function conversion** convert new color-mix() syntax to any of the supported colors.
48
49
 
49
50
  ## Benchmark
@@ -12107,29 +12107,6 @@
12107
12107
  if (!doNotValidate && !result?.success && result.errors.length > 0) {
12108
12108
  errors.push(...result.errors);
12109
12109
  }
12110
- if (!doNotValidate && !(success || result.success)) {
12111
- return Object.defineProperties(Object.assign(name, {
12112
- typ: exports.EnumToken.DeclarationNodeType,
12113
- nam: name.val,
12114
- val: parseTokens(tokens),
12115
- }), {
12116
- state: {
12117
- ...definedPropertySettings,
12118
- value: exports.EnumAstNodeStatus.ValidationFailed,
12119
- },
12120
- errors: {
12121
- ...definedPropertySettings,
12122
- value: result?.errors ?? [],
12123
- },
12124
- loc: {
12125
- ...definedPropertySettings,
12126
- value: {
12127
- ...name.loc,
12128
- end: tokens[tokens.length - 1]?.loc.end ?? name.loc.end,
12129
- },
12130
- },
12131
- });
12132
- }
12133
12110
  }
12134
12111
  }
12135
12112
  for (i = 0; i < tokens.length; i++) {
@@ -30131,8 +30108,6 @@
30131
30108
  if (options.resolveImport) {
30132
30109
  options.resolveUrls = true;
30133
30110
  }
30134
- // turn off expandIfSyntax for now
30135
- options.expandIfSyntax = false;
30136
30111
  const startTime = performance.now();
30137
30112
  const errors = [];
30138
30113
  const src = options.src;
package/dist/index.cjs CHANGED
@@ -9211,29 +9211,6 @@ function parseDeclaration(tokens, parent, options, errors) {
9211
9211
  if (!doNotValidate && !result?.success && result.errors.length > 0) {
9212
9212
  errors.push(...result.errors);
9213
9213
  }
9214
- if (!doNotValidate && !(success || result.success)) {
9215
- return Object.defineProperties(Object.assign(name, {
9216
- typ: exports.EnumToken.DeclarationNodeType,
9217
- nam: name.val,
9218
- val: parseTokens(tokens),
9219
- }), {
9220
- state: {
9221
- ...definedPropertySettings,
9222
- value: exports.EnumAstNodeStatus.ValidationFailed,
9223
- },
9224
- errors: {
9225
- ...definedPropertySettings,
9226
- value: result?.errors ?? [],
9227
- },
9228
- loc: {
9229
- ...definedPropertySettings,
9230
- value: {
9231
- ...name.loc,
9232
- end: tokens[tokens.length - 1]?.loc.end ?? name.loc.end,
9233
- },
9234
- },
9235
- });
9236
- }
9237
9214
  }
9238
9215
  }
9239
9216
  for (i = 0; i < tokens.length; i++) {
@@ -29896,8 +29873,6 @@ async function doParse(iter, options = {}) {
29896
29873
  if (options.resolveImport) {
29897
29874
  options.resolveUrls = true;
29898
29875
  }
29899
- // turn off expandIfSyntax for now
29900
- options.expandIfSyntax = false;
29901
29876
  const startTime = performance.now();
29902
29877
  const errors = [];
29903
29878
  const src = options.src;
@@ -244,8 +244,6 @@ async function doParse(iter, options = {}) {
244
244
  if (options.resolveImport) {
245
245
  options.resolveUrls = true;
246
246
  }
247
- // turn off expandIfSyntax for now
248
- options.expandIfSyntax = false;
249
247
  const startTime = performance.now();
250
248
  const errors = [];
251
249
  const src = options.src;
@@ -8,7 +8,6 @@ import { walkValues } from '../../ast/walk.js';
8
8
  import { equalsIgnoreCase } from './text.js';
9
9
  import { buildExpression } from '../../ast/math/expression.js';
10
10
  import { splitTokenList } from '../../validation/utils/list.js';
11
- import { parseTokens } from '../parse.js';
12
11
 
13
12
  /**
14
13
  *
@@ -333,29 +332,6 @@ function parseDeclaration(tokens, parent, options, errors) {
333
332
  if (!doNotValidate && !result?.success && result.errors.length > 0) {
334
333
  errors.push(...result.errors);
335
334
  }
336
- if (!doNotValidate && !(success || result.success)) {
337
- return Object.defineProperties(Object.assign(name, {
338
- typ: EnumToken.DeclarationNodeType,
339
- nam: name.val,
340
- val: parseTokens(tokens),
341
- }), {
342
- state: {
343
- ...definedPropertySettings,
344
- value: EnumAstNodeStatus.ValidationFailed,
345
- },
346
- errors: {
347
- ...definedPropertySettings,
348
- value: result?.errors ?? [],
349
- },
350
- loc: {
351
- ...definedPropertySettings,
352
- value: {
353
- ...name.loc,
354
- end: tokens[tokens.length - 1]?.loc.end ?? name.loc.end,
355
- },
356
- },
357
- });
358
- }
359
335
  }
360
336
  }
361
337
  for (i = 0; i < tokens.length; i++) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tbela99/css-parser",
3
3
  "description": "CSS parser, minifier and validator for node and the browser",
4
- "version": "1.4.5",
4
+ "version": "1.4.6",
5
5
  "exports": {
6
6
  ".": "./dist/node.js",
7
7
  "./node": "./dist/node.js",