@plumeria/utils 18.3.6 → 18.3.7

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 (2) hide show
  1. package/dist/parser.js +3 -17
  2. package/package.json +1 -1
package/dist/parser.js CHANGED
@@ -1837,6 +1837,7 @@ function resolveExport(filePath, exportName, visited = new Set()) {
1837
1837
  return null;
1838
1838
  }
1839
1839
  const REFERENCE_MARKER = /(kf|vt|cr)-([0-9a-z]+)/g;
1840
+ const CUSTOM_PROPERTY = /var\(\s*(--[^\s,)]+)/g;
1840
1841
  function extractOndemandStyles(obj, extractedSheets, t) {
1841
1842
  if (!obj || typeof obj !== 'object')
1842
1843
  return;
@@ -1870,23 +1871,8 @@ function extractOndemandStyles(obj, extractedSheets, t) {
1870
1871
  walk(t.createObjectTable[hash]);
1871
1872
  }
1872
1873
  }
1873
- if (val.includes('var(--')) {
1874
- let startIdx = 0;
1875
- while ((startIdx = val.indexOf('var(--', startIdx)) !== -1) {
1876
- startIdx += 4;
1877
- const endIdx = val.indexOf(')', startIdx);
1878
- if (endIdx !== -1) {
1879
- const content = val.slice(startIdx, endIdx);
1880
- const varName = content.trim();
1881
- if (varName.startsWith('--')) {
1882
- usedVariables.add(varName);
1883
- }
1884
- startIdx = endIdx + 1;
1885
- }
1886
- else {
1887
- break;
1888
- }
1889
- }
1874
+ for (const [, varName] of val.matchAll(CUSTOM_PROPERTY)) {
1875
+ usedVariables.add(varName);
1890
1876
  }
1891
1877
  }
1892
1878
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/utils",
3
- "version": "18.3.6",
3
+ "version": "18.3.7",
4
4
  "description": "Internal helpers shared by the Plumeria compiler and bundler plugins.",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",