render-script 1.1.468 → 1.1.469
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/package.json +7 -17
- package/src/index.cjs +11 -0
- package/lib/index.cjs +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "render-script",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"main": "./
|
|
3
|
+
"version": "1.1.469",
|
|
4
|
+
"main": "./src/index.cjs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Renderapp",
|
|
@@ -14,40 +14,30 @@
|
|
|
14
14
|
"url": "git@github.com:sequencemedia/render-script.git"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
|
-
"lint": "eslint . --ext .mjs
|
|
17
|
+
"lint": "eslint . --ext .mjs,.cjs",
|
|
18
18
|
"lint:fix": "npm run lint -- --fix",
|
|
19
19
|
"test": "cross-env NODE_ENV=test mocha test --recursive --verbose --color",
|
|
20
|
-
"
|
|
21
|
-
"build": "npm run babel",
|
|
22
|
-
"babel": "babel src -d lib --out-file-extension .cjs",
|
|
23
|
-
"prepare": "husky install",
|
|
24
|
-
"prepublishOnly": "npm run build",
|
|
25
|
-
"prebuild": "npm run clean"
|
|
20
|
+
"prepare": "husky install"
|
|
26
21
|
},
|
|
27
22
|
"dependencies": {
|
|
28
23
|
"debug": "^4.3.4"
|
|
29
24
|
},
|
|
30
25
|
"devDependencies": {
|
|
31
|
-
"@babel/cli": "^7.22.5",
|
|
32
26
|
"@babel/core": "^7.22.5",
|
|
33
27
|
"@babel/eslint-parser": "^7.22.5",
|
|
34
28
|
"@babel/preset-env": "^7.22.5",
|
|
29
|
+
"@babel/register": "^7.22.5",
|
|
35
30
|
"@sequencemedia/hooks": "^1.0.435",
|
|
36
31
|
"chai": "^4.3.7",
|
|
37
32
|
"core-js": "^3.31.0",
|
|
38
33
|
"cross-env": "^7.0.3",
|
|
39
34
|
"eslint": "^8.43.0",
|
|
40
35
|
"eslint-config-standard": "^17.1.0",
|
|
41
|
-
"eslint-plugin-import": "^2.27.5",
|
|
42
|
-
"eslint-plugin-mocha": "^10.1.0",
|
|
43
|
-
"eslint-plugin-node": "^11.1.0",
|
|
44
|
-
"eslint-plugin-promise": "^6.1.1",
|
|
45
36
|
"husky": "^8.0.3",
|
|
46
|
-
"mocha": "^10.2.0"
|
|
47
|
-
"rimraf": "^5.0.1"
|
|
37
|
+
"mocha": "^10.2.0"
|
|
48
38
|
},
|
|
49
39
|
"exports": {
|
|
50
40
|
"import": "./src/index.mjs",
|
|
51
|
-
"require": "./
|
|
41
|
+
"require": "./src/index.cjs"
|
|
52
42
|
}
|
|
53
43
|
}
|
package/src/index.cjs
ADDED
package/lib/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;exports.evaluateRuleForConfiguration=evaluateRuleForConfiguration;exports.getConfigurationMap=getConfigurationMap;exports.getEvaluation=getEvaluation;exports.getRuleMap=getRuleMap;var _debug=_interopRequireDefault(require("debug"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const log=(0,_debug.default)('render-script');log('`render-script` is awake');const RULE_MAP=new Map();const isTruthy=v=>Boolean((v||'').trim());function evaluate(rule,configuration){function isSubRuleValid(subRule){return subRule.startsWith('!')?configuration.includes('+'+subRule.substring(1))!==true:configuration.includes('+'+subRule);}function isTopRuleValid(topRule){return topRule.split('/').filter(isTruthy).some(isSubRuleValid);}function isRuleSetValid(ruleSet){return ruleSet.split('+').filter(isTruthy).every(isTopRuleValid);}function evaluateRule(rule){return rule.split(';').filter(isTruthy).some(isRuleSetValid);}return evaluateRule(rule);}function evaluateRuleForConfiguration(rule='',configuration=''){return isTruthy(rule)?isTruthy(configuration)?evaluate(rule,configuration):false:false;}function getRuleMap(ruleMap=RULE_MAP){return ruleMap;}function getConfigurationMap(ruleMap=new Map(),rule=''){let configurationMap;if(ruleMap.has(rule)){configurationMap=ruleMap.get(rule);}else{ruleMap.set(rule,configurationMap=new Map());}return configurationMap;}function getEvaluation(configurationMap=new Map(),rule='',configuration=''){let evaluation;if(configurationMap.has(configuration)){evaluation=configurationMap.get(configuration);}else{configurationMap.set(configuration,evaluation=evaluateRuleForConfiguration(rule,configuration));}return evaluation;}var _default=(rule='',configuration='')=>isTruthy(rule)?isTruthy(configuration)?getEvaluation(getConfigurationMap(getRuleMap(),rule),rule,configuration):false:false;exports.default=_default;
|