@master/css-compiler 2.0.0-rc.72 → 2.0.0-rc.74

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.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/dist/browser.d.ts +23 -19
  3. package/dist/browser.js +42 -0
  4. package/dist/core.d.ts +43 -41
  5. package/dist/core.js +1639 -0
  6. package/dist/css-transform.d.ts +10 -6
  7. package/dist/css-transform.js +17 -0
  8. package/dist/diagnostics.d.ts +11 -0
  9. package/dist/diagnostics.js +12 -0
  10. package/dist/index.d.ts +41 -38
  11. package/dist/index.js +330 -0
  12. package/dist/lexer/imports.d.ts +16 -12
  13. package/dist/lexer/imports.js +38 -0
  14. package/dist/lexer/source.d.ts +6 -3
  15. package/dist/lexer/source.js +8 -0
  16. package/dist/lexer/standalone-master.d.ts +23 -19
  17. package/dist/lexer/standalone-master.js +219 -0
  18. package/dist/lower-css-directives.d.ts +18 -13
  19. package/dist/lower-css-directives.js +753 -0
  20. package/dist/master-css-manifest.d.ts +18 -12
  21. package/dist/master-css-manifest.js +546 -0
  22. package/dist/native-declaration.d.ts +6 -2
  23. package/dist/native-declaration.js +23 -0
  24. package/dist/utils/selectors.d.ts +6 -3
  25. package/dist/utils/selectors.js +49 -0
  26. package/dist/utils/unquote.d.ts +4 -1
  27. package/dist/utils/unquote.js +9 -0
  28. package/dist/utils/wrap-at-rules.d.ts +4 -1
  29. package/dist/utils/wrap-at-rules.js +11 -0
  30. package/package.json +69 -1
  31. package/dist/browser.mjs +0 -47
  32. package/dist/core.mjs +0 -2146
  33. package/dist/css-transform.mjs +0 -18
  34. package/dist/index.mjs +0 -395
  35. package/dist/lexer/imports.mjs +0 -44
  36. package/dist/lexer/source.mjs +0 -9
  37. package/dist/lexer/standalone-master.mjs +0 -233
  38. package/dist/lower-css-directives.mjs +0 -969
  39. package/dist/master-css-manifest.mjs +0 -760
  40. package/dist/native-declaration.mjs +0 -25
  41. package/dist/utils/selectors.mjs +0 -55
  42. package/dist/utils/unquote.mjs +0 -10
  43. package/dist/utils/wrap-at-rules.mjs +0 -10
@@ -1,25 +0,0 @@
1
- import { property, parse, lexer } from 'css-tree';
2
-
3
- const matches = new Map();
4
- function isTargetError(error) {
5
- return error && typeof error === 'object' && 'name' in error && (error.name === 'SyntaxError' || error.name === 'SyntaxMatchError' || error.name === 'SyntaxReferenceError');
6
- }
7
- const cssTreeNativeDeclarationMatcher = ({ property: property$1, value })=>{
8
- if (property(property$1).custom) return true;
9
- const cacheKey = property$1 + '\0' + value;
10
- const cached = matches.get(cacheKey);
11
- if (cached !== undefined) return cached;
12
- let matched = false;
13
- try {
14
- const ast = parse(value, {
15
- context: 'value'
16
- });
17
- matched = !isTargetError(lexer.checkPropertyName(property$1)) && !isTargetError(lexer.matchProperty(property$1, ast).error);
18
- } catch {
19
- matched = false;
20
- }
21
- matches.set(cacheKey, matched);
22
- return matched;
23
- };
24
-
25
- export { cssTreeNativeDeclarationMatcher };
@@ -1,55 +0,0 @@
1
- function splitSelectorList(selectorText) {
2
- const selectors = [];
3
- let current = '';
4
- let depth = 0;
5
- let quote = '';
6
- for(let index = 0; index < selectorText.length; index++){
7
- const char = selectorText[index];
8
- if (quote) {
9
- current += char;
10
- if (char === '\\') {
11
- current += selectorText[++index] || '';
12
- } else if (char === quote) {
13
- quote = '';
14
- }
15
- continue;
16
- }
17
- if (char === '"' || char === '\'') {
18
- quote = char;
19
- current += char;
20
- continue;
21
- }
22
- if (char === '(' || char === '[') {
23
- depth++;
24
- current += char;
25
- continue;
26
- }
27
- if (char === ')' || char === ']') {
28
- depth--;
29
- current += char;
30
- continue;
31
- }
32
- if (char === ',' && depth === 0) {
33
- selectors.push(current.trim());
34
- current = '';
35
- continue;
36
- }
37
- current += char;
38
- }
39
- if (current.trim()) selectors.push(current.trim());
40
- return selectors;
41
- }
42
- function combineSelectorLists(parentSelectors, childSelectors) {
43
- const selectors = [];
44
- for (const child of childSelectors){
45
- for (const parent of parentSelectors){
46
- selectors.push(child.includes('&') ? child.replace(/&/g, parent) : `${parent} ${child}`);
47
- }
48
- }
49
- return selectors;
50
- }
51
- function combineStyleSelectors(parentSelector, childSelector) {
52
- return combineSelectorLists(splitSelectorList(parentSelector), splitSelectorList(childSelector)).join(',');
53
- }
54
-
55
- export { combineSelectorLists, combineStyleSelectors, splitSelectorList };
@@ -1,10 +0,0 @@
1
- function unquote(value) {
2
- const trimmed = value.trim();
3
- const quote = trimmed[0];
4
- if ((quote === '"' || quote === '\'') && trimmed.endsWith(quote)) {
5
- return trimmed.slice(1, -1).replace(/\\(["'\\])/g, '$1');
6
- }
7
- return trimmed;
8
- }
9
-
10
- export { unquote as default };
@@ -1,10 +0,0 @@
1
- function wrapAtRules(text, atRules) {
2
- if (!atRules?.length) return text;
3
- for(let index = atRules.length - 1; index >= 0; index--){
4
- const atRule = atRules[index]?.trim();
5
- if (atRule) text = `${atRule}{${text}}`;
6
- }
7
- return text;
8
- }
9
-
10
- export { wrapAtRules as default };