string-extract-sass-vars 3.0.12 → 3.0.13

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/README.md CHANGED
@@ -26,7 +26,7 @@
26
26
 
27
27
  ## Install
28
28
 
29
- The latest version is **ESM only**: Node 12+ is needed to use it and it must be `import`ed instead of `require`d. If your project is not on ESM yet and you want to use `require`, use an older version of this program, `2.1.0`.
29
+ This package is [pure ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c). If you're not ready yet, install an older version of this program, 2.1.0 (`npm i string-extract-sass-vars@2.1.0`).
30
30
 
31
31
  ```bash
32
32
  npm i string-extract-sass-vars
@@ -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 3.0.12
4
+ * @version 3.0.13
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/string-extract-sass-vars/}
8
8
  */
9
9
 
10
- var h="3.0.12";var v=h,S="\\",f={throwIfEmpty:!1,cb:null};function w(e,n){if(typeof e!="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 u={...f,...n};if(u.cb&&typeof u.cb!="function")throw new Error(`string-extract-sass-vars: [THROW_ID_02] opts.cb should be function! But it was given as ${JSON.stringify(n,null,4)} (type ${typeof n})`);let g=e.length,o=null,l=null,a=null,i=null,r=null,c=null,s=!1,$=!1,m=!1,b={};for(let t=0;t<g;t++)!s&&r&&e[t]===r&&e[t-1]!==S?r=null:!r&&!s&&e[t-1]!==S&&`'"`.includes(e[t])&&(r=e[t]),$&&`\r
11
- `.includes(e[t])&&($=!1),!s&&e[t]==="/"&&e[t+1]==="/"&&($=!0),m&&e[t-2]==="*"&&e[t-1]==="/"&&(m=!1),!s&&e[t]==="/"&&e[t+1]==="*"&&(m=!0),s=$||m,!s&&e[t]==="$"&&o===null&&(o=t+1),!s&&l!==null&&!r&&e[t]===";"&&(i=e.slice(`"'`.includes(e[l])?l+1:l,(c||0)+1),/^-?\d*\.?\d*$/.test(i)&&(i=+i),b[a]=u.cb?u.cb(i):i,o=null,l=null,a=null,i=null),!s&&a!==null&&e[t]&&e[t].trim().length&&l===null&&(l=t),!s&&!a&&o!==null&&e[t]===":"&&!r&&(a=e.slice(o,t)),`'"`.includes(e[t])||(c=t);if(!Object.keys(b).length&&u.throwIfEmpty)throw new Error("string-extract-sass-vars: [THROW_ID_03] no keys extracted! (setting opts.originalOpts)");return b}export{f as defaults,w as extractVars,v as version};
10
+ var h="3.0.13";var y=h,g="\\",f={throwIfEmpty:!1,cb:null};function w(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 u={...f,...n};if(u.cb&&typeof u.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 S=t.length,o=null,l=null,a=null,i=null,r=null,c=null,s=!1,$=!1,m=!1,b={};for(let e=0;e<S;e++)!s&&r&&t[e]===r&&t[e-1]!==g?r=null:!r&&!s&&t[e-1]!==g&&`'"`.includes(t[e])&&(r=t[e]),$&&`\r
11
+ `.includes(t[e])&&($=!1),!s&&t[e]==="/"&&t[e+1]==="/"&&($=!0),m&&t[e-2]==="*"&&t[e-1]==="/"&&(m=!1),!s&&t[e]==="/"&&t[e+1]==="*"&&(m=!0),s=$||m,!s&&t[e]==="$"&&o===null&&(o=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[a]=u.cb?u.cb(i):i,o=null,l=null,a=null,i=null),!s&&a!==null&&t[e]&&t[e].trim().length&&l===null&&(l=e),!s&&!a&&o!==null&&t[e]===":"&&!r&&(a=t.slice(o,e)),`'"`.includes(t[e])||(c=e);if(!Object.keys(b).length&&u.throwIfEmpty)throw new Error("string-extract-sass-vars: [THROW_ID_03] no keys extracted! (setting resolvedOpts.opts)");return b}export{f as defaults,w as extractVars,y as version};
@@ -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 3.0.12
4
+ * @version 3.0.13
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/string-extract-sass-vars/}
8
8
  */
9
9
 
10
- var stringExtractSassVars=(()=>{var c=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames,p=Object.getOwnPropertySymbols;var f=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var d=(t,e,s)=>e in t?c(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,S=(t,e)=>{for(var s in e||(e={}))f.call(e,s)&&d(t,s,e[s]);if(p)for(var s of p(e))N.call(e,s)&&d(t,s,e[s]);return t};var D=t=>c(t,"__esModule",{value:!0});var C=(t,e)=>{for(var s in e)c(t,s,{get:e[s],enumerable:!0})},A=(t,e,s,$)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of V(e))!f.call(t,l)&&(s||l!=="default")&&c(t,l,{get:()=>e[l],enumerable:!($=E(e,l))||$.enumerable});return t};var x=(t=>(e,s)=>t&&t.get(e)||(s=A(D({}),e,1),t&&t.set(e,s),s))(typeof WeakMap!="undefined"?new WeakMap:0);var j={};C(j,{defaults:()=>w,extractVars:()=>J,version:()=>k});var y="3.0.12";var k=y,v="\\",w={throwIfEmpty:!1,cb:null};function J(t,e){var T;if(typeof t!="string")return{};if(e&&typeof e!="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(e,null,4)} (type ${typeof e})`);let s=S(S({},w),e);if(s.cb&&typeof s.cb!="function")throw new Error(`string-extract-sass-vars: [THROW_ID_02] opts.cb should be function! But it was given as ${JSON.stringify(e,null,4)} (type ${typeof e})`);let $=t.length,l=null,r=null,a=null,u=null,o=null,g=null,i=!1,m=!1,b=!1,h={};for(let n=0;n<$;n++)!i&&o&&t[n]===o&&t[n-1]!==v?o=null:!o&&!i&&t[n-1]!==v&&`'"`.includes(t[n])&&(o=t[n]),m&&`\r
11
- `.includes(t[n])&&(m=!1),!i&&t[n]==="/"&&t[n+1]==="/"&&(m=!0),b&&t[n-2]==="*"&&t[n-1]==="/"&&(b=!1),!i&&t[n]==="/"&&t[n+1]==="*"&&(b=!0),i=m||b,!i&&t[n]==="$"&&l===null&&(l=n+1),!i&&r!==null&&!o&&t[n]===";"&&(u=t.slice(`"'`.includes(t[r])?r+1:r,(g||0)+1),/^-?\d*\.?\d*$/.test(u)&&(u=+u),h[a]=s.cb?s.cb(u):u,l=null,r=null,a=null,u=null),!i&&a!==null&&t[n]&&t[n].trim().length&&r===null&&(r=n),!i&&!a&&l!==null&&t[n]===":"&&!o&&(a=t.slice(l,n)),`'"`.includes(t[n])||(g=n);if(!Object.keys(h).length&&s.throwIfEmpty)throw new Error("string-extract-sass-vars: [THROW_ID_03] no keys extracted! (setting opts.originalOpts)");return h}return x(j);})();
10
+ var stringExtractSassVars=(()=>{var c=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames,p=Object.getOwnPropertySymbols;var d=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var f=(e,t,n)=>t in e?c(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,g=(e,t)=>{for(var n in t||(t={}))d.call(t,n)&&f(e,n,t[n]);if(p)for(var n of p(t))O.call(t,n)&&f(e,n,t[n]);return e};var N=(e,t)=>{for(var n in t)c(e,n,{get:t[n],enumerable:!0})},D=(e,t,n,$)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of V(t))!d.call(e,l)&&l!==n&&c(e,l,{get:()=>t[l],enumerable:!($=E(t,l))||$.enumerable});return e};var C=e=>D(c({},"__esModule",{value:!0}),e);var J={};N(J,{defaults:()=>w,extractVars:()=>k,version:()=>x});var v="3.0.13";var x=v,y="\\",w={throwIfEmpty:!1,cb:null};function k(e,t){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 ${JSON.stringify(t,null,4)} (type ${typeof t})`);let n=g(g({},w),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 ${JSON.stringify(t,null,4)} (type ${typeof t})`);let $=e.length,l=null,r=null,a=null,u=null,o=null,S=null,i=!1,m=!1,b=!1,h={};for(let s=0;s<$;s++)!i&&o&&e[s]===o&&e[s-1]!==y?o=null:!o&&!i&&e[s-1]!==y&&`'"`.includes(e[s])&&(o=e[s]),m&&`\r
11
+ `.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&&!o&&e[s]===";"&&(u=e.slice(`"'`.includes(e[r])?r+1:r,(S||0)+1),/^-?\d*\.?\d*$/.test(u)&&(u=+u),h[a]=n.cb?n.cb(u):u,l=null,r=null,a=null,u=null),!i&&a!==null&&e[s]&&e[s].trim().length&&r===null&&(r=s),!i&&!a&&l!==null&&e[s]===":"&&!o&&(a=e.slice(l,s)),`'"`.includes(e[s])||(S=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);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "string-extract-sass-vars",
3
- "version": "3.0.12",
3
+ "version": "3.0.13",
4
4
  "description": "Parse SASS variables file into a plain object of CSS key-value pairs",
5
5
  "keywords": [
6
6
  "css",
package/types/index.d.ts CHANGED
@@ -9,7 +9,7 @@ interface Opts {
9
9
  declare const defaults: Opts;
10
10
  declare function extractVars(
11
11
  str: string,
12
- originalOpts?: Partial<Opts>
12
+ opts?: Partial<Opts>
13
13
  ): UnknownValueObj;
14
14
 
15
15
  export { defaults, extractVars, version };