string-extract-sass-vars 3.0.10 → 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/LICENSE +1 -1
- package/README.md +2 -6
- package/dist/string-extract-sass-vars.esm.js +3 -3
- package/dist/string-extract-sass-vars.umd.js +3 -3
- package/package.json +8 -5
- package/types/index.d.ts +7 -4
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2010-
|
|
3
|
+
Copyright (c) 2010-2022 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
|
@@ -26,14 +26,12 @@
|
|
|
26
26
|
|
|
27
27
|
## Install
|
|
28
28
|
|
|
29
|
-
This package is ESM
|
|
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
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
If you need a legacy version which works with `require`, use version 2.1.0
|
|
36
|
-
|
|
37
35
|
## Quick Take
|
|
38
36
|
|
|
39
37
|
```js
|
|
@@ -81,8 +79,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
|
|
|
81
79
|
|
|
82
80
|
MIT License
|
|
83
81
|
|
|
84
|
-
Copyright (c) 2010-
|
|
85
|
-
|
|
82
|
+
Copyright (c) 2010-2022 Roy Revelt and other contributors
|
|
86
83
|
|
|
87
84
|
<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">
|
|
88
|
-
|
|
@@ -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.
|
|
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.
|
|
11
|
-
`.includes(t[e])&&(
|
|
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.
|
|
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,
|
|
11
|
-
`.includes(e[
|
|
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.
|
|
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",
|
|
@@ -37,15 +37,18 @@
|
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "node '../../ops/scripts/esbuild.js' && yarn run dts",
|
|
39
39
|
"dev": "DEV=true node '../../ops/scripts/esbuild.js' && yarn run dts",
|
|
40
|
-
"
|
|
40
|
+
"devtest": "c8 yarn run unit && yarn run examples && yarn run lint",
|
|
41
|
+
"dts": "rollup -c && yarn run prettier 'types/index.d.ts' --write",
|
|
41
42
|
"examples": "node '../../ops/scripts/run-examples.js'",
|
|
42
|
-
"lect": "node '../../ops/lect/lect.js'",
|
|
43
|
+
"lect": "node '../../ops/lect/lect.js' && yarn run prettier 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
|
|
43
44
|
"letspublish": "yarn publish || :",
|
|
44
45
|
"lint": "eslint . --fix",
|
|
45
46
|
"perf": "node perf/check.js",
|
|
46
47
|
"prepare": "echo 'ready'",
|
|
48
|
+
"prettier": "prettier",
|
|
49
|
+
"prettier:format": "prettier --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern",
|
|
47
50
|
"pretest": "yarn run lect && yarn run build",
|
|
48
|
-
"test": "
|
|
51
|
+
"test": "yarn run devtest",
|
|
49
52
|
"unit": "uvu test"
|
|
50
53
|
},
|
|
51
54
|
"engines": {
|
|
@@ -67,6 +70,6 @@
|
|
|
67
70
|
"various": {}
|
|
68
71
|
},
|
|
69
72
|
"devDependencies": {
|
|
70
|
-
"color-shorthand-hex-to-six-digit": "^4.0.
|
|
73
|
+
"color-shorthand-hex-to-six-digit": "^4.0.12"
|
|
71
74
|
}
|
|
72
75
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
declare const version: string;
|
|
2
2
|
interface UnknownValueObj {
|
|
3
|
-
|
|
3
|
+
[key: string]: any;
|
|
4
4
|
}
|
|
5
5
|
interface Opts {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
throwIfEmpty?: boolean;
|
|
7
|
+
cb?: null | ((varValue: string) => any);
|
|
8
8
|
}
|
|
9
9
|
declare const defaults: Opts;
|
|
10
|
-
declare function extractVars(
|
|
10
|
+
declare function extractVars(
|
|
11
|
+
str: string,
|
|
12
|
+
opts?: Partial<Opts>
|
|
13
|
+
): UnknownValueObj;
|
|
11
14
|
|
|
12
15
|
export { defaults, extractVars, version };
|