string-extract-sass-vars 4.1.3 → 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,11 +3,30 @@
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.1.0 (2025-10-15)
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
+
12
+ ## 4.2.0 (2026-08-19)
13
+
14
+ ### Bug Fixes
15
+
16
+ - make validation diagnostics safe ([7b01074](https://github.com/codsen/codsen/commit/7b0107476f12734aeb8e82852ba980b187280110))
17
+ - resolve various review findings ([b60e9ee](https://github.com/codsen/codsen/commit/b60e9eeb499af94685cfb87b4970fe025be1fc10))
18
+ - retire direct publish aliases ([f98e31e](https://github.com/codsen/codsen/commit/f98e31eb89bc185471225664e610b55f34fbf648))
19
+ - standardise Sass extraction errs ([1233a89](https://github.com/codsen/codsen/commit/1233a8999b3413c569868e7a85101eeef68d2bfc))
7
20
 
8
21
  ### Features
9
22
 
10
- - if value to be added is a number, keep it as is, don't stringify ([ce3e1a5](https://github.com/codsen/codsen/commit/ce3e1a525998ca3c0abf0142affef95b14cd1990))
23
+ - add codsen-glob and migrate glob consumers ([5595a2b](https://github.com/codsen/codsen/commit/5595a2b267eaa6cb60072d037aef00b7a28edd42))
24
+ - refresh the tooling and generate with the latest dependencies ([781f802](https://github.com/codsen/codsen/commit/781f802911066a82a4533b0e5a3fcbd742d0dd83))
25
+
26
+ ### Reverts
27
+
28
+ - Revert "Merge pull request #128 from codsen/release/npm-32198404552-1" ([5baeeaa](https://github.com/codsen/codsen/commit/5baeeaaa677b86f1eaa6396cadf3aea32b06416e)), closes [#128](https://github.com/codsen/codsen/issues/128)
29
+ - Revert "Merge pull request #127 from codsen/release/npm-32194020886-1" ([5f1e94d](https://github.com/codsen/codsen/commit/5f1e94deef910ce735266b16aeee08a76de7a862)), closes [#127](https://github.com/codsen/codsen/issues/127)
11
30
 
12
31
  ## 4.0.0 (2022-12-01)
13
32
 
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright © 2010-2025 Roy Revelt and other contributors
3
+ Copyright © 2010-2026 Roy Revelt and other contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
package/README.md CHANGED
@@ -32,7 +32,7 @@ npm i string-extract-sass-vars
32
32
  ## Quick Take
33
33
 
34
34
  ```js
35
- import { strict as assert } from "assert";
35
+ import { strict as assert } from "node:assert";
36
36
 
37
37
  import { extractVars } from "string-extract-sass-vars";
38
38
 
@@ -64,9 +64,10 @@ $customValue3: 10;`),
64
64
  );
65
65
  ```
66
66
 
67
+
67
68
  ## Documentation
68
69
 
69
- Please [visit codsen.com](https://codsen.com/os/string-extract-sass-vars/) for a full description of the API.
70
+ Please [visit codsen.com](https://codsen.com/os/string-extract-sass-vars/) for a full description of the API. If you’re looking for the **Changelog**, it’s [here](https://github.com/codsen/codsen/blob/main/packages/string-extract-sass-vars/CHANGELOG.md).
70
71
 
71
72
  ## Contributing
72
73
 
@@ -76,6 +77,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
76
77
 
77
78
  MIT License
78
79
 
79
- Copyright © 2010-2025 Roy Revelt and other contributors
80
+ Copyright © 2010-2026 Roy Revelt and other contributors
80
81
 
81
82
  <p align="center"><img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center"></p>
@@ -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.1.3
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
- var h="4.1.3";var w=h,p="\\",f={throwIfEmpty:!1,cb:null};function y(t,n){if(typeof t!="string")return{};if(n&&typeof n!="object")throw new Error(`string-extract-sass-vars: [THROW_ID_01] the second input argument should be a plain object but it was given as ${JSON.stringify(n,null,4)} (type ${typeof n})`);let o={...f,...n};if(o.cb&&typeof o.cb!="function")throw new Error(`string-extract-sass-vars: [THROW_ID_02] resolvedOpts.cb should be function! But it was given as ${JSON.stringify(n,null,4)} (type ${typeof n})`);let g=t.length,u=null,l=null,$=null,i=null,r=null,c=null,s=!1,a=!1,m=!1,b={};for(let e=0;e<g;e++)!s&&r&&t[e]===r&&t[e-1]!==p?r=null:!r&&!s&&t[e-1]!==p&&`'"`.includes(t[e])&&(r=t[e]),a&&`\r
11
- `.includes(t[e])&&(a=!1),!s&&t[e]==="/"&&t[e+1]==="/"&&(a=!0),m&&t[e-2]==="*"&&t[e-1]==="/"&&(m=!1),!s&&t[e]==="/"&&t[e+1]==="*"&&(m=!0),s=a||m,!s&&t[e]==="$"&&u===null&&(u=e+1),!s&&l!==null&&!r&&t[e]===";"&&(i=t.slice(`"'`.includes(t[l])?l+1:l,(c||0)+1),/^-?\d*\.?\d*$/.test(i)&&(i=+i),b[$]=o.cb?o.cb(i):i,u=null,l=null,$=null,i=null),!s&&$!==null&&t[e]?.trim()&&l===null&&(l=e),!s&&!$&&u!==null&&t[e]===":"&&!r&&($=t.slice(u,e)),`'"`.includes(t[e])||(c=e);if(!Object.keys(b).length&&o.throwIfEmpty)throw new Error("string-extract-sass-vars: [THROW_ID_03] no keys extracted! (setting resolvedOpts.opts)");return b}export{f as defaults,y as extractVars,w as version};
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
+ `.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,10 +1,18 @@
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.1.3
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 c=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames,f=Object.getOwnPropertySymbols;var v=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var d=(e,t,n)=>t in e?c(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,p=(e,t)=>{for(var n in t||(t={}))v.call(t,n)&&d(e,n,t[n]);if(f)for(var n of f(t))N.call(t,n)&&d(e,n,t[n]);return e};var x=(e,t)=>{for(var n in t)c(e,n,{get:t[n],enumerable:!0})},D=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of O(t))!v.call(e,l)&&l!==n&&c(e,l,{get:()=>t[l],enumerable:!(a=V(t,l))||a.enumerable});return e};var C=e=>D(c({},"__esModule",{value:!0}),e);var J={};x(J,{defaults:()=>E,extractVars:()=>j,version:()=>k});var w="4.1.3";var k=w,y="\\",E={throwIfEmpty:!1,cb:null};function j(e,t){var S;if(typeof e!="string")return{};if(t&&typeof t!="object")throw new Error("string-extract-sass-vars: [THROW_ID_01] the second input argument should be a plain object but it was given as ".concat(JSON.stringify(t,null,4)," (type ").concat(typeof t,")"));let n=p(p({},E),t);if(n.cb&&typeof n.cb!="function")throw new Error("string-extract-sass-vars: [THROW_ID_02] resolvedOpts.cb should be function! But it was given as ".concat(JSON.stringify(t,null,4)," (type ").concat(typeof t,")"));let a=e.length,l=null,r=null,$=null,o=null,u=null,g=null,i=!1,m=!1,b=!1,h={};for(let s=0;s<a;s++)!i&&u&&e[s]===u&&e[s-1]!==y?u=null:!u&&!i&&e[s-1]!==y&&"'\"".includes(e[s])&&(u=e[s]),m&&"\r\n".includes(e[s])&&(m=!1),!i&&e[s]==="/"&&e[s+1]==="/"&&(m=!0),b&&e[s-2]==="*"&&e[s-1]==="/"&&(b=!1),!i&&e[s]==="/"&&e[s+1]==="*"&&(b=!0),i=m||b,!i&&e[s]==="$"&&l===null&&(l=s+1),!i&&r!==null&&!u&&e[s]===";"&&(o=e.slice("\"'".includes(e[r])?r+1:r,(g||0)+1),/^-?\d*\.?\d*$/.test(o)&&(o=+o),h[$]=n.cb?n.cb(o):o,l=null,r=null,$=null,o=null),!i&&$!==null&&((S=e[s])!=null&&S.trim())&&r===null&&(r=s),!i&&!$&&l!==null&&e[s]===":"&&!u&&($=e.slice(l,s)),"'\"".includes(e[s])||(g=s);if(!Object.keys(h).length&&n.throwIfEmpty)throw new Error("string-extract-sass-vars: [THROW_ID_03] no keys extracted! (setting resolvedOpts.opts)");return h}return C(J);})();
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
+ /**
12
+ * @name codsen-utils
13
+ * @fileoverview Various utility functions
14
+ * @version 1.9.0
15
+ * @author Roy Revelt
16
+ * @license MIT
17
+ * {@link https://codsen.com/os/codsen-utils/}
18
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "string-extract-sass-vars",
3
- "version": "4.1.3",
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",
@@ -36,44 +36,46 @@
36
36
  },
37
37
  "types": "types/index.d.ts",
38
38
  "scripts": {
39
- "build": "node '../../ops/scripts/esbuild.js' && npm run dts",
40
- "cjs-off": "exit 0",
41
- "cjs-on": "exit 0",
42
- "dev": "DEV=true node '../../ops/scripts/esbuild.js' && npm run dts",
39
+ "build": "node ../../ops/scripts/esbuild.js && npm run dts",
40
+ "coverage": "c8 uvu test",
41
+ "dev": "node ../../ops/scripts/esbuild.js --dev && npm run dts",
43
42
  "devtest": "c8 npm run unit && npm run examples && npm run lint",
44
- "dts": "rollup -c && npm run prettier -- 'types/index.d.ts' --write --log-level 'silent'",
43
+ "dts": "rollup -c && biome format --write --config-path=../../biome.json --vcs-enabled=false --use-editorconfig=false types/index.d.ts",
45
44
  "examples": "node '../../ops/scripts/run-examples.js'",
46
- "lect": "node '../../ops/lect/lect.js' && npm run prettier -- 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
47
- "letspublish": "npm publish --provenance || :",
48
- "lint": "eslint . --fix --concurrency=auto --cache",
45
+ "lect": "node '../../ops/lect/lect.js'",
46
+ "lect:check": "node '../../ops/lect/lect.js' --check",
47
+ "lint": "biome lint --error-on-warnings . && npm run typecheck",
48
+ "lint:fix": "biome lint --write --error-on-warnings . && npm run typecheck",
49
49
  "perf": "node perf/check.js",
50
50
  "prep": "echo 'ready'",
51
- "prettier": "prettier",
52
- "prettier:format": "npm run prettier -- --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern --log-level 'silent'",
53
- "pretest": "npm run lect && npm run build",
51
+ "prettier": "biome format",
52
+ "prettier:format": "biome format --write .",
53
+ "pretest": "npm run lect:check && npm run build",
54
54
  "test": "npm run devtest",
55
+ "typecheck": "tsc --noEmit --pretty false --project tsconfig.json",
55
56
  "unit": "uvu test"
56
57
  },
57
- "engines": {
58
- "node": ">=14.18.0"
59
- },
60
58
  "c8": {
59
+ "all": true,
61
60
  "check-coverage": true,
62
- "exclude": [
63
- "**/test/**/*.*"
64
- ],
61
+ "exclude": ["**/test/**/*.*"],
62
+ "include": ["dist/*.esm.js"],
65
63
  "lines": 100
66
64
  },
67
65
  "lect": {
68
66
  "licence": {
69
- "extras": [
70
- ""
71
- ]
67
+ "extras": [""]
72
68
  },
73
69
  "various": {}
74
70
  },
71
+ "dependencies": {
72
+ "codsen-utils": "^1.9.0"
73
+ },
75
74
  "devDependencies": {
76
- "color-shorthand-hex-to-six-digit": "^5.1.3"
75
+ "color-shorthand-hex-to-six-digit": "^5.2.1"
76
+ },
77
+ "engines": {
78
+ "node": ">=18.20.8"
77
79
  },
78
80
  "publishConfig": {
79
81
  "registry": "https://registry.npmjs.org/"