string-extract-sass-vars 4.2.0 → 4.2.1

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
@@ -3,12 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 4.2.1 (2026-08-22)
7
+
8
+ ### Performance Improvements
9
+
10
+ - optimise package hot paths and JSON editing ([f3112bd](https://github.com/codsen/codsen/commit/f3112bd7fc0d7c9bc09312d3744c950691d72ca5))
11
+
6
12
  ## 4.2.0 (2026-08-19)
7
13
 
8
14
  ### Bug Fixes
9
15
 
10
16
  - make validation diagnostics safe ([7b01074](https://github.com/codsen/codsen/commit/7b0107476f12734aeb8e82852ba980b187280110))
11
- - resolve review findings REV-004 through REV-007 ([b60e9ee](https://github.com/codsen/codsen/commit/b60e9eeb499af94685cfb87b4970fe025be1fc10))
17
+ - resolve various review findings ([b60e9ee](https://github.com/codsen/codsen/commit/b60e9eeb499af94685cfb87b4970fe025be1fc10))
12
18
  - retire direct publish aliases ([f98e31e](https://github.com/codsen/codsen/commit/f98e31eb89bc185471225664e610b55f34fbf648))
13
19
  - standardise Sass extraction errs ([1233a89](https://github.com/codsen/codsen/commit/1233a8999b3413c569868e7a85101eeef68d2bfc))
14
20
 
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * @name string-extract-sass-vars
3
3
  * @fileoverview Parse SASS variables file into a plain object of CSS key-value pairs
4
- * @version 4.2.0
4
+ * @version 4.2.1
5
5
  * @author Roy Revelt
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/string-extract-sass-vars/}
8
8
  */
9
9
 
10
- import{formatDiagnosticValue as p}from"codsen-utils";var h="4.2.0";var V=h,g="\\",S={throwIfEmpty:!1,cb:null};function E(t,n){if(typeof t!="string")return{};if(n&&typeof n!="object")throw new Error(`string-extract-sass-vars/extractVars(): [THROW_ID_01] the second input argument should be a plain object but it was given as ${p(n,4)} (type ${typeof n})`);let r={...S,...n};if(r.cb&&typeof r.cb!="function")throw new Error(`string-extract-sass-vars/extractVars(): [THROW_ID_02] resolvedOpts.cb should be function! But it was given as ${p(n,4)} (type ${typeof n})`);let f=t.length,a=null,l=null,u=null,i=null,o=null,b=null,s=!1,m=!1,$=!1,c={};for(let e=0;e<f;e++)!s&&o&&t[e]===o&&t[e-1]!==g?o=null:!o&&!s&&t[e-1]!==g&&`'"`.includes(t[e])&&(o=t[e]),m&&`\r
10
+ import{formatDiagnosticValue as p}from"codsen-utils";var h="4.2.1";var V=h,g="\\",S={throwIfEmpty:!1,cb:null};function E(t,n){if(typeof t!="string")return{};if(n&&typeof n!="object")throw new Error(`string-extract-sass-vars/extractVars(): [THROW_ID_01] the second input argument should be a plain object but it was given as ${p(n,4)} (type ${typeof n})`);let r={...S,...n};if(r.cb&&typeof r.cb!="function")throw new Error(`string-extract-sass-vars/extractVars(): [THROW_ID_02] resolvedOpts.cb should be function! But it was given as ${p(n,4)} (type ${typeof n})`);let f=t.length,a=null,l=null,u=null,i=null,o=null,b=null,s=!1,m=!1,$=!1,c={};for(let e=0;e<f;e++)!s&&o&&t[e]===o&&t[e-1]!==g?o=null:!o&&!s&&t[e-1]!==g&&`'"`.includes(t[e])&&(o=t[e]),m&&`\r
11
11
  `.includes(t[e])&&(m=!1),!s&&t[e]==="/"&&t[e+1]==="/"&&(m=!0),$&&t[e-2]==="*"&&t[e-1]==="/"&&($=!1),!s&&t[e]==="/"&&t[e+1]==="*"&&($=!0),s=m||$,!s&&t[e]==="$"&&a===null&&(a=e+1),!s&&l!==null&&!o&&t[e]===";"&&(i=t.slice(`"'`.includes(t[l])?l+1:l,(b||0)+1),/^-?\d*\.?\d*$/.test(i)&&(i=+i),c[u]=r.cb?r.cb(i):i,a=null,l=null,u=null,i=null),!s&&u!==null&&t[e]?.trim()&&l===null&&(l=e),!s&&!u&&a!==null&&t[e]===":"&&!o&&(u=t.slice(a,e)),`'"`.includes(t[e])||(b=e);if(!Object.keys(c).length&&r.throwIfEmpty)throw new Error("string-extract-sass-vars/extractVars(): [THROW_ID_03] no keys extracted! (setting resolvedOpts.opts)");return c}export{S as defaults,E as extractVars,V as version};
@@ -1,17 +1,17 @@
1
1
  /**
2
2
  * @name string-extract-sass-vars
3
3
  * @fileoverview Parse SASS variables file into a plain object of CSS key-value pairs
4
- * @version 4.2.0
4
+ * @version 4.2.1
5
5
  * @author Roy Revelt
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/string-extract-sass-vars/}
8
8
  */
9
9
 
10
- "use strict";var stringExtractSassVars=(()=>{var S=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames,O=Object.getOwnPropertySymbols;var k=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable;var x=(e,n,t)=>n in e?S(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,A=(e,n)=>{for(var t in n||(n={}))k.call(n,t)&&x(e,t,n[t]);if(O)for(var t of O(n))M.call(n,t)&&x(e,t,n[t]);return e};var R=(e,n)=>{for(var t in n)S(e,t,{get:n[t],enumerable:!0})},T=(e,n,t,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of I(n))!k.call(e,o)&&o!==t&&S(e,o,{get:()=>n[o],enumerable:!(s=W(n,o))||s.enumerable});return e};var B=e=>T(S({},"__esModule",{value:!0}),e);var _={};R(_,{defaults:()=>N,extractVars:()=>J,version:()=>F});function L(){let e=[],n=0,t=!1;return{append(s){return t?!1:n+s.length>1999?(e.push("\u2026"),n+=1,t=!0,!1):(e.push(s),n+=s.length,!0)},result(){return e.join("")},stopped(){return t}}}function P(e){return"\\u".concat(e.toString(16).padStart(4,"0"))}function w(e,n){if(e.append('"')){for(let t=0;t<n.length&&!e.stopped();t+=1){let s=n.charCodeAt(t);s===34?e.append('\\"'):s===92?e.append("\\\\"):s===8?e.append("\\b"):s===9?e.append("\\t"):s===10?e.append("\\n"):s===12?e.append("\\f"):s===13?e.append("\\r"):s<32||s===8232||s===8233||s>=55296&&s<=57343?e.append(P(s)):e.append(n[t])}e.append('"')}}function U(e){return e.get&&e.set?"[Getter/Setter]":e.get?"[Getter]":e.set?"[Setter]":"[Accessor]"}function E(e,n){e.append("Symbol(");let t=String(n);t.length>8&&w(e,t.slice(7,-1)),e.append(")")}function D(e,n){typeof n=="symbol"?E(e,n):w(e,String(n))}function C(e,n=0){let t=L(),s=n===4?4:0,o=new WeakSet,u=0;function m(r){s&&t.append(" ".repeat(r*s))}function a(r,l){r&&t.append(","),s&&(t.append("\n"),m(l+1))}function p(r,l,i){s&&l&&(t.append("\n"),m(i)),t.append(r)}function v(r,l){Object.prototype.hasOwnProperty.call(r,"value")?$(r.value,l):t.append(U(r))}function c(r,l){let i;try{i=Reflect.getOwnPropertyDescriptor(r,"length")}catch(h){t.append("[Uninspectable]");return}let f=i==null?void 0:i.value;if(!Number.isSafeInteger(f)||f<0){t.append("[Uninspectable]");return}t.append("[");let g=!1;for(let h=0;h<f&&!t.stopped();h+=1){if(a(g,l),g=!0,u>=50){t.append("[MaxEntries]");break}u+=1;let y;try{y=Reflect.getOwnPropertyDescriptor(r,String(h))}catch(H){t.append("[Uninspectable]");continue}y!=null&&y.enumerable?v(y,l+1):t.append("[Empty]")}p("]",g,l)}function d(r,l){let i;try{i=Reflect.ownKeys(r)}catch(g){t.append("[Uninspectable]");return}t.append("{");let f=!1;for(let g of i){if(t.stopped())break;if(u>=50){a(f,l),f=!0,w(t,"\u2026"),t.append(s?": ":":"),t.append("[MaxEntries]");break}u+=1;let h;try{h=Reflect.getOwnPropertyDescriptor(r,g)}catch(y){a(f,l),f=!0,D(t,g),t.append(s?": ":":"),t.append("[Uninspectable]");continue}h!=null&&h.enumerable&&(a(f,l),f=!0,D(t,g),t.append(s?": ":":"),v(h,l+1))}p("}",f,l)}function b(r,l){if(o.has(r)){t.append("[Circular]");return}if(l>=5){t.append("[MaxDepth]");return}let i;try{i=Array.isArray(r)}catch(f){t.append("[Uninspectable]");return}o.add(r);try{i?c(r,l):d(r,l)}finally{o.delete(r)}}function $(r,l){r===null?t.append("null"):typeof r=="string"?w(t,r):typeof r=="number"?t.append(Object.is(r,-0)?"-0":String(r)):typeof r=="boolean"?t.append(r?"true":"false"):typeof r>"u"?t.append("undefined"):typeof r=="bigint"?t.append("".concat(r,"n")):typeof r=="symbol"?E(t,r):typeof r=="function"?t.append("[Function]"):b(r,l)}try{return $(e,0),t.result()}catch(r){return"[Uninspectable]"}}var G=new Set([..."\u060B$\u20BC\u17DB\xA5\u20A1\u20B1\xA3\u20AC\xA2\u20B9\uFDFC\u20AA\u20A9\u20AD\u20A8\u20AE\u20A6\u20BD\u20AB\u0E3F\u20A9\u20BA\u20B4","$U","$b","B/.","BZ$","Br","Bs","C$","CHF","Ft","Gs","J$","KM","K\u010D","L","MT","NT$","P","Q","R","R$","RD$","RM","Rp","S","S/.","TT$","Z$","kn","kr","lei","z\u0142","\u0192","\u0414\u0438\u043D.","\u0434\u0435\u043D","\u043B\u0432","\u062F.\u0625","Lek"]);var V="4.2.0";var F=V,j="\\",N={throwIfEmpty:!1,cb:null};function J(e,n){var l;if(typeof e!="string")return{};if(n&&typeof n!="object")throw new Error("string-extract-sass-vars/extractVars(): [THROW_ID_01] the second input argument should be a plain object but it was given as ".concat(C(n,4)," (type ").concat(typeof n,")"));let t=A(A({},N),n);if(t.cb&&typeof t.cb!="function")throw new Error("string-extract-sass-vars/extractVars(): [THROW_ID_02] resolvedOpts.cb should be function! But it was given as ".concat(C(n,4)," (type ").concat(typeof n,")"));let s=e.length,o=null,u=null,m=null,a=null,p=null,v=null,c=!1,d=!1,b=!1,$={};for(let i=0;i<s;i++)!c&&p&&e[i]===p&&e[i-1]!==j?p=null:!p&&!c&&e[i-1]!==j&&"'\"".includes(e[i])&&(p=e[i]),d&&"\r\n".includes(e[i])&&(d=!1),!c&&e[i]==="/"&&e[i+1]==="/"&&(d=!0),b&&e[i-2]==="*"&&e[i-1]==="/"&&(b=!1),!c&&e[i]==="/"&&e[i+1]==="*"&&(b=!0),c=d||b,!c&&e[i]==="$"&&o===null&&(o=i+1),!c&&u!==null&&!p&&e[i]===";"&&(a=e.slice("\"'".includes(e[u])?u+1:u,(v||0)+1),/^-?\d*\.?\d*$/.test(a)&&(a=+a),$[m]=t.cb?t.cb(a):a,o=null,u=null,m=null,a=null),!c&&m!==null&&((l=e[i])!=null&&l.trim())&&u===null&&(u=i),!c&&!m&&o!==null&&e[i]===":"&&!p&&(m=e.slice(o,i)),"'\"".includes(e[i])||(v=i);if(!Object.keys($).length&&t.throwIfEmpty)throw new Error("string-extract-sass-vars/extractVars(): [THROW_ID_03] no keys extracted! (setting resolvedOpts.opts)");return $}return B(_);})();
10
+ "use strict";var stringExtractSassVars=(()=>{var S=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames,O=Object.getOwnPropertySymbols;var k=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable;var x=(e,r,t)=>r in e?S(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,A=(e,r)=>{for(var t in r||(r={}))k.call(r,t)&&x(e,t,r[t]);if(O)for(var t of O(r))T.call(r,t)&&x(e,t,r[t]);return e};var B=(e,r)=>{for(var t in r)S(e,t,{get:r[t],enumerable:!0})},M=(e,r,t,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of I(r))!k.call(e,o)&&o!==t&&S(e,o,{get:()=>r[o],enumerable:!(l=W(r,o))||l.enumerable});return e};var L=e=>M(S({},"__esModule",{value:!0}),e);var H={};B(H,{defaults:()=>R,extractVars:()=>_,version:()=>J});function P(){let e=[],r=0,t=!1;return{append(l){return t?!1:r+l.length>1999?(e.push("\u2026"),r+=1,t=!0,!1):(e.push(l),r+=l.length,!0)},result(){return e.join("")},stopped(){return t}}}function U(e){return"\\u".concat(e.toString(16).padStart(4,"0"))}function w(e,r){if(e.append('"')){for(let t=0;t<r.length&&!e.stopped();t+=1){let l=r.charCodeAt(t);l===34?e.append('\\"'):l===92?e.append("\\\\"):l===8?e.append("\\b"):l===9?e.append("\\t"):l===10?e.append("\\n"):l===12?e.append("\\f"):l===13?e.append("\\r"):l<32||l===8232||l===8233||l>=55296&&l<=57343?e.append(U(l)):e.append(r[t])}e.append('"')}}function Q(e){return e.get&&e.set?"[Getter/Setter]":e.get?"[Getter]":e.set?"[Setter]":"[Accessor]"}function j(e,r){e.append("Symbol(");let t=String(r);t.length>8&&w(e,t.slice(7,-1)),e.append(")")}function D(e,r){typeof r=="symbol"?j(e,r):w(e,String(r))}function C(e,r=0){let t=P(),l=r===4?4:0,o=new WeakSet,u=0;function m(n){l&&t.append(" ".repeat(n*l))}function a(n,s){n&&t.append(","),l&&(t.append("\n"),m(s+1))}function p(n,s,i){l&&s&&(t.append("\n"),m(i)),t.append(n)}function v(n,s){Object.prototype.hasOwnProperty.call(n,"value")?$(n.value,s):t.append(Q(n))}function c(n,s){let i;try{i=Reflect.getOwnPropertyDescriptor(n,"length")}catch(h){t.append("[Uninspectable]");return}let f=i==null?void 0:i.value;if(!Number.isSafeInteger(f)||f<0){t.append("[Uninspectable]");return}t.append("[");let d=!1;for(let h=0;h<f&&!t.stopped();h+=1){if(a(d,s),d=!0,u>=50){t.append("[MaxEntries]");break}u+=1;let y;try{y=Reflect.getOwnPropertyDescriptor(n,String(h))}catch(K){t.append("[Uninspectable]");continue}y!=null&&y.enumerable?v(y,s+1):t.append("[Empty]")}p("]",d,s)}function g(n,s){let i;try{i=Reflect.ownKeys(n)}catch(d){t.append("[Uninspectable]");return}t.append("{");let f=!1;for(let d of i){if(t.stopped())break;if(u>=50){a(f,s),f=!0,w(t,"\u2026"),t.append(l?": ":":"),t.append("[MaxEntries]");break}u+=1;let h;try{h=Reflect.getOwnPropertyDescriptor(n,d)}catch(y){a(f,s),f=!0,D(t,d),t.append(l?": ":":"),t.append("[Uninspectable]");continue}h!=null&&h.enumerable&&(a(f,s),f=!0,D(t,d),t.append(l?": ":":"),v(h,s+1))}p("}",f,s)}function b(n,s){if(o.has(n)){t.append("[Circular]");return}if(s>=5){t.append("[MaxDepth]");return}let i;try{i=Array.isArray(n)}catch(f){t.append("[Uninspectable]");return}o.add(n);try{i?c(n,s):g(n,s)}finally{o.delete(n)}}function $(n,s){n===null?t.append("null"):typeof n=="string"?w(t,n):typeof n=="number"?t.append(Object.is(n,-0)?"-0":String(n)):typeof n=="boolean"?t.append(n?"true":"false"):typeof n>"u"?t.append("undefined"):typeof n=="bigint"?t.append("".concat(n,"n")):typeof n=="symbol"?j(t,n):typeof n=="function"?t.append("[Function]"):b(n,s)}try{return $(e,0),t.result()}catch(n){return"[Uninspectable]"}}var Z=new Set([..."\u060B$\u20BC\u17DB\xA5\u20A1\u20B1\xA3\u20AC\xA2\u20B9\uFDFC\u20AA\u20A9\u20AD\u20A8\u20AE\u20A6\u20BD\u20AB\u0E3F\u20A9\u20BA\u20B4","$U","$b","B/.","BZ$","Br","Bs","C$","CHF","Ft","Gs","J$","KM","K\u010D","L","MT","NT$","P","Q","R","R$","RD$","RM","Rp","S","S/.","TT$","Z$","kn","kr","lei","z\u0142","\u0192","\u0414\u0438\u043D.","\u0434\u0435\u043D","\u043B\u0432","\u062F.\u0625","Lek"]);var E,q=(E=Object.getOwnPropertyDescriptor(RegExp.prototype,"source"))==null?void 0:E.get;var Y=Date.prototype.getTime;var V="4.2.1";var J=V,N="\\",R={throwIfEmpty:!1,cb:null};function _(e,r){var s;if(typeof e!="string")return{};if(r&&typeof r!="object")throw new Error("string-extract-sass-vars/extractVars(): [THROW_ID_01] the second input argument should be a plain object but it was given as ".concat(C(r,4)," (type ").concat(typeof r,")"));let t=A(A({},R),r);if(t.cb&&typeof t.cb!="function")throw new Error("string-extract-sass-vars/extractVars(): [THROW_ID_02] resolvedOpts.cb should be function! But it was given as ".concat(C(r,4)," (type ").concat(typeof r,")"));let l=e.length,o=null,u=null,m=null,a=null,p=null,v=null,c=!1,g=!1,b=!1,$={};for(let i=0;i<l;i++)!c&&p&&e[i]===p&&e[i-1]!==N?p=null:!p&&!c&&e[i-1]!==N&&"'\"".includes(e[i])&&(p=e[i]),g&&"\r\n".includes(e[i])&&(g=!1),!c&&e[i]==="/"&&e[i+1]==="/"&&(g=!0),b&&e[i-2]==="*"&&e[i-1]==="/"&&(b=!1),!c&&e[i]==="/"&&e[i+1]==="*"&&(b=!0),c=g||b,!c&&e[i]==="$"&&o===null&&(o=i+1),!c&&u!==null&&!p&&e[i]===";"&&(a=e.slice("\"'".includes(e[u])?u+1:u,(v||0)+1),/^-?\d*\.?\d*$/.test(a)&&(a=+a),$[m]=t.cb?t.cb(a):a,o=null,u=null,m=null,a=null),!c&&m!==null&&((s=e[i])!=null&&s.trim())&&u===null&&(u=i),!c&&!m&&o!==null&&e[i]===":"&&!p&&(m=e.slice(o,i)),"'\"".includes(e[i])||(v=i);if(!Object.keys($).length&&t.throwIfEmpty)throw new Error("string-extract-sass-vars/extractVars(): [THROW_ID_03] no keys extracted! (setting resolvedOpts.opts)");return $}return L(H);})();
11
11
  /**
12
12
  * @name codsen-utils
13
13
  * @fileoverview Various utility functions
14
- * @version 1.8.0
14
+ * @version 1.9.0
15
15
  * @author Roy Revelt
16
16
  * @license MIT
17
17
  * {@link https://codsen.com/os/codsen-utils/}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "string-extract-sass-vars",
3
- "version": "4.2.0",
3
+ "version": "4.2.1",
4
4
  "description": "Parse SASS variables file into a plain object of CSS key-value pairs",
5
5
  "keywords": [
6
6
  "css",
@@ -69,10 +69,10 @@
69
69
  "various": {}
70
70
  },
71
71
  "dependencies": {
72
- "codsen-utils": "^1.8.0"
72
+ "codsen-utils": "^1.9.0"
73
73
  },
74
74
  "devDependencies": {
75
- "color-shorthand-hex-to-six-digit": "^5.2.0"
75
+ "color-shorthand-hex-to-six-digit": "^5.2.1"
76
76
  },
77
77
  "engines": {
78
78
  "node": ">=18.20.8"