@seljs/checker 1.4.0-beta.27 → 1.4.0-beta.38
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/dist/_virtual/_rolldown/runtime.cjs +1 -1
- package/dist/checker/checker.cjs +0 -1
- package/dist/checker/checker.d.cts +1 -1
- package/dist/checker/checker.d.mts +1 -1
- package/dist/checker/index.cjs +4 -2
- package/dist/checker/index.d.cts +3 -0
- package/dist/checker/index.d.mts +2 -1
- package/dist/checker/index.mjs +3 -3
- package/dist/checker/type-compatibility.cjs +7 -7
- package/dist/checker/type-compatibility.mjs +7 -7
- package/dist/constants.cjs +2 -2
- package/dist/constants.mjs +2 -2
- package/dist/debug.cjs +1 -1
- package/dist/environment/codec-registry.cjs +0 -1
- package/dist/environment/codec-registry.d.cts +0 -1
- package/dist/environment/codec-registry.d.mts +0 -1
- package/dist/environment/hydrate.cjs +1 -1
- package/dist/environment/hydrate.d.cts +0 -1
- package/dist/environment/hydrate.d.mts +0 -1
- package/dist/environment/hydrate.mjs +1 -0
- package/dist/environment/index.cjs +12 -4
- package/dist/environment/index.d.cts +5 -0
- package/dist/environment/index.d.mts +2 -1
- package/dist/environment/index.mjs +5 -5
- package/dist/environment/register-types.cjs +0 -1
- package/dist/environment/register-types.d.cts +1 -2
- package/dist/environment/register-types.d.mts +1 -2
- package/dist/environment/value-wrappers.cjs +1 -5
- package/dist/environment/value-wrappers.mjs +1 -4
- package/dist/index.d.cts +3 -0
- package/dist/index.d.mts +3 -0
- package/dist/rules/defaults/deferred-call.cjs +0 -1
- package/dist/rules/defaults/expression-complexity.cjs +1 -2
- package/dist/rules/defaults/expression-complexity.d.cts +1 -0
- package/dist/rules/defaults/expression-complexity.d.mts +1 -0
- package/dist/rules/defaults/expression-complexity.mjs +1 -1
- package/dist/rules/defaults/index.cjs +14 -7
- package/dist/rules/defaults/index.mjs +8 -8
- package/dist/rules/defaults/no-self-comparison.cjs +2 -3
- package/dist/rules/defaults/no-self-comparison.mjs +2 -2
- package/dist/rules/facade.cjs +8 -0
- package/dist/rules/facade.d.cts +15 -8
- package/dist/rules/facade.d.mts +15 -8
- package/dist/rules/facade.mjs +8 -0
- package/dist/rules/index.cjs +4 -2
- package/dist/rules/index.d.cts +4 -0
- package/dist/rules/index.d.mts +2 -1
- package/dist/rules/index.mjs +3 -3
- package/dist/rules/runner.d.cts +1 -9
- package/dist/rules/runner.d.mts +1 -9
- package/dist/rules/types.d.cts +0 -1
- package/dist/rules/types.d.mts +0 -1
- package/dist/utils/ast-utils.cjs +1 -1
- package/dist/utils/ast-utils.mjs +1 -1
- package/package.json +5 -5
|
@@ -15,7 +15,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
}
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
19
19
|
value: mod,
|
|
20
20
|
enumerable: true
|
|
21
21
|
}) : target, mod));
|
package/dist/checker/checker.cjs
CHANGED
package/dist/checker/index.cjs
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
require("./type-compatibility.cjs");
|
|
2
|
-
require("./checker.cjs");
|
|
1
|
+
const require_type_compatibility = require("./type-compatibility.cjs");
|
|
2
|
+
const require_checker = require("./checker.cjs");
|
|
3
|
+
exports.SELChecker = require_checker.SELChecker;
|
|
4
|
+
exports.isTypeCompatible = require_type_compatibility.isTypeCompatible;
|
package/dist/checker/index.d.mts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { CompletionItem, SELChecker, SELCheckerOptions, SELDiagnostic } from "./checker.mjs";
|
|
2
|
-
import { isTypeCompatible } from "./type-compatibility.mjs";
|
|
2
|
+
import { isTypeCompatible } from "./type-compatibility.mjs";
|
|
3
|
+
export { CompletionItem, SELChecker, SELCheckerOptions, SELDiagnostic, isTypeCompatible };
|
package/dist/checker/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "./type-compatibility.mjs";
|
|
2
|
-
import "./checker.mjs";
|
|
3
|
-
export {};
|
|
1
|
+
import { isTypeCompatible } from "./type-compatibility.mjs";
|
|
2
|
+
import { SELChecker } from "./checker.mjs";
|
|
3
|
+
export { SELChecker, isTypeCompatible };
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
//#region src/checker/type-compatibility.ts
|
|
2
|
-
const LOGICAL_OPERATORS = new Set(["&&", "||"]);
|
|
3
|
-
const ARITHMETIC_OPERATORS = new Set([
|
|
2
|
+
const LOGICAL_OPERATORS = /* @__PURE__ */ new Set(["&&", "||"]);
|
|
3
|
+
const ARITHMETIC_OPERATORS = /* @__PURE__ */ new Set([
|
|
4
4
|
"+",
|
|
5
5
|
"-",
|
|
6
6
|
"*",
|
|
7
7
|
"/",
|
|
8
8
|
"%"
|
|
9
9
|
]);
|
|
10
|
-
const COMPARISON_OPERATORS = new Set([
|
|
10
|
+
const COMPARISON_OPERATORS = /* @__PURE__ */ new Set([
|
|
11
11
|
"<",
|
|
12
12
|
"<=",
|
|
13
13
|
">",
|
|
14
14
|
">="
|
|
15
15
|
]);
|
|
16
|
-
const EQUALITY_OPERATORS = new Set(["==", "!="]);
|
|
16
|
+
const EQUALITY_OPERATORS = /* @__PURE__ */ new Set(["==", "!="]);
|
|
17
17
|
/** Types that support arithmetic operators (same-type only). */
|
|
18
|
-
const ARITHMETIC_TYPES = new Set([
|
|
18
|
+
const ARITHMETIC_TYPES = /* @__PURE__ */ new Set([
|
|
19
19
|
"int",
|
|
20
20
|
"uint",
|
|
21
21
|
"double",
|
|
22
22
|
"sol_int"
|
|
23
23
|
]);
|
|
24
24
|
/** Types that support the + operator for concatenation. */
|
|
25
|
-
const CONCATENATION_TYPES = new Set([
|
|
25
|
+
const CONCATENATION_TYPES = /* @__PURE__ */ new Set([
|
|
26
26
|
"string",
|
|
27
27
|
"list",
|
|
28
28
|
"bytes"
|
|
29
29
|
]);
|
|
30
30
|
/** Types that support comparison operators (same-type only). */
|
|
31
|
-
const COMPARISON_TYPES = new Set([
|
|
31
|
+
const COMPARISON_TYPES = /* @__PURE__ */ new Set([
|
|
32
32
|
"int",
|
|
33
33
|
"uint",
|
|
34
34
|
"double",
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
//#region src/checker/type-compatibility.ts
|
|
2
|
-
const LOGICAL_OPERATORS = new Set(["&&", "||"]);
|
|
3
|
-
const ARITHMETIC_OPERATORS = new Set([
|
|
2
|
+
const LOGICAL_OPERATORS = /* @__PURE__ */ new Set(["&&", "||"]);
|
|
3
|
+
const ARITHMETIC_OPERATORS = /* @__PURE__ */ new Set([
|
|
4
4
|
"+",
|
|
5
5
|
"-",
|
|
6
6
|
"*",
|
|
7
7
|
"/",
|
|
8
8
|
"%"
|
|
9
9
|
]);
|
|
10
|
-
const COMPARISON_OPERATORS = new Set([
|
|
10
|
+
const COMPARISON_OPERATORS = /* @__PURE__ */ new Set([
|
|
11
11
|
"<",
|
|
12
12
|
"<=",
|
|
13
13
|
">",
|
|
14
14
|
">="
|
|
15
15
|
]);
|
|
16
|
-
const EQUALITY_OPERATORS = new Set(["==", "!="]);
|
|
16
|
+
const EQUALITY_OPERATORS = /* @__PURE__ */ new Set(["==", "!="]);
|
|
17
17
|
/** Types that support arithmetic operators (same-type only). */
|
|
18
|
-
const ARITHMETIC_TYPES = new Set([
|
|
18
|
+
const ARITHMETIC_TYPES = /* @__PURE__ */ new Set([
|
|
19
19
|
"int",
|
|
20
20
|
"uint",
|
|
21
21
|
"double",
|
|
22
22
|
"sol_int"
|
|
23
23
|
]);
|
|
24
24
|
/** Types that support the + operator for concatenation. */
|
|
25
|
-
const CONCATENATION_TYPES = new Set([
|
|
25
|
+
const CONCATENATION_TYPES = /* @__PURE__ */ new Set([
|
|
26
26
|
"string",
|
|
27
27
|
"list",
|
|
28
28
|
"bytes"
|
|
29
29
|
]);
|
|
30
30
|
/** Types that support comparison operators (same-type only). */
|
|
31
|
-
const COMPARISON_TYPES = new Set([
|
|
31
|
+
const COMPARISON_TYPES = /* @__PURE__ */ new Set([
|
|
32
32
|
"int",
|
|
33
33
|
"uint",
|
|
34
34
|
"double",
|
package/dist/constants.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/constants.ts
|
|
2
2
|
/** Comprehension macro names that introduce scoped iteration variables. */
|
|
3
|
-
const COMPREHENSION_MACROS = new Set([
|
|
3
|
+
const COMPREHENSION_MACROS = /* @__PURE__ */ new Set([
|
|
4
4
|
"map",
|
|
5
5
|
"filter",
|
|
6
6
|
"exists",
|
|
@@ -8,7 +8,7 @@ const COMPREHENSION_MACROS = new Set([
|
|
|
8
8
|
"exists_one"
|
|
9
9
|
]);
|
|
10
10
|
/** Solidity scalar wrapper functions (pass-through for arg classification). */
|
|
11
|
-
const SCALAR_WRAPPER_FUNCTIONS = new Set(["solInt", "solAddress"]);
|
|
11
|
+
const SCALAR_WRAPPER_FUNCTIONS = /* @__PURE__ */ new Set(["solInt", "solAddress"]);
|
|
12
12
|
//#endregion
|
|
13
13
|
exports.COMPREHENSION_MACROS = COMPREHENSION_MACROS;
|
|
14
14
|
exports.SCALAR_WRAPPER_FUNCTIONS = SCALAR_WRAPPER_FUNCTIONS;
|
package/dist/constants.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/constants.ts
|
|
2
2
|
/** Comprehension macro names that introduce scoped iteration variables. */
|
|
3
|
-
const COMPREHENSION_MACROS = new Set([
|
|
3
|
+
const COMPREHENSION_MACROS = /* @__PURE__ */ new Set([
|
|
4
4
|
"map",
|
|
5
5
|
"filter",
|
|
6
6
|
"exists",
|
|
@@ -8,6 +8,6 @@ const COMPREHENSION_MACROS = new Set([
|
|
|
8
8
|
"exists_one"
|
|
9
9
|
]);
|
|
10
10
|
/** Solidity scalar wrapper functions (pass-through for arg classification). */
|
|
11
|
-
const SCALAR_WRAPPER_FUNCTIONS = new Set(["solInt", "solAddress"]);
|
|
11
|
+
const SCALAR_WRAPPER_FUNCTIONS = /* @__PURE__ */ new Set(["solInt", "solAddress"]);
|
|
12
12
|
//#endregion
|
|
13
13
|
export { COMPREHENSION_MACROS, SCALAR_WRAPPER_FUNCTIONS };
|
package/dist/debug.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
let debug = require("debug");
|
|
3
|
-
debug = require_runtime.__toESM(debug);
|
|
3
|
+
debug = require_runtime.__toESM(debug, 1);
|
|
4
4
|
//#region src/debug.ts
|
|
5
5
|
const createLogger = (namespace) => (0, debug.default)(`sel:checker:${namespace}`);
|
|
6
6
|
//#endregion
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
require("../_virtual/_rolldown/runtime.cjs");
|
|
2
1
|
const require_debug = require("../debug.cjs");
|
|
3
2
|
const require_codec_registry = require("./codec-registry.cjs");
|
|
4
3
|
const require_register_types = require("./register-types.cjs");
|
|
@@ -37,6 +36,7 @@ const hydrateEnvironment = (env, schema, handler) => {
|
|
|
37
36
|
for (const contract of schema.contracts) {
|
|
38
37
|
const typeName = (0, _seljs_common.contractTypeName)(contract.name);
|
|
39
38
|
class ContractType {
|
|
39
|
+
name;
|
|
40
40
|
constructor(name) {
|
|
41
41
|
this.name = name;
|
|
42
42
|
}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
require("./codec-registry.cjs");
|
|
2
|
-
require("./register-types.cjs");
|
|
3
|
-
require("./value-wrappers.cjs");
|
|
4
|
-
require("./hydrate.cjs");
|
|
1
|
+
const require_codec_registry = require("./codec-registry.cjs");
|
|
2
|
+
const require_register_types = require("./register-types.cjs");
|
|
3
|
+
const require_value_wrappers = require("./value-wrappers.cjs");
|
|
4
|
+
const require_hydrate = require("./hydrate.cjs");
|
|
5
|
+
exports.CelCodecRegistry = require_codec_registry.CelCodecRegistry;
|
|
6
|
+
exports.createBaseEnvironment = require_hydrate.createBaseEnvironment;
|
|
7
|
+
exports.createCheckerEnvironment = require_hydrate.createCheckerEnvironment;
|
|
8
|
+
exports.createRuntimeEnvironment = require_hydrate.createRuntimeEnvironment;
|
|
9
|
+
exports.registerSolidityTypes = require_register_types.registerSolidityTypes;
|
|
10
|
+
exports.toCelLiteralType = require_value_wrappers.toCelLiteralType;
|
|
11
|
+
exports.wrapStructValue = require_value_wrappers.wrapStructValue;
|
|
12
|
+
exports.wrapValueForSel = require_value_wrappers.wrapValueForSel;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CelCodecRegistry, CelCodecRegistryOptions, StructCodecDescriptor } from "./codec-registry.cjs";
|
|
2
|
+
import { CelLimits, ContractCallHandler, RuntimeEnvironmentResult, createBaseEnvironment, createCheckerEnvironment, createRuntimeEnvironment } from "./hydrate.cjs";
|
|
3
|
+
import { registerSolidityTypes } from "./register-types.cjs";
|
|
4
|
+
import { StructInfo, toCelLiteralType, wrapStructValue, wrapValueForSel } from "./value-wrappers.cjs";
|
|
5
|
+
export { CelCodecRegistry, CelCodecRegistryOptions, CelLimits, ContractCallHandler, RuntimeEnvironmentResult, StructCodecDescriptor, StructInfo, createBaseEnvironment, createCheckerEnvironment, createRuntimeEnvironment, registerSolidityTypes, toCelLiteralType, wrapStructValue, wrapValueForSel };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CelCodecRegistry, CelCodecRegistryOptions, StructCodecDescriptor } from "./codec-registry.mjs";
|
|
2
2
|
import { CelLimits, ContractCallHandler, RuntimeEnvironmentResult, createBaseEnvironment, createCheckerEnvironment, createRuntimeEnvironment } from "./hydrate.mjs";
|
|
3
3
|
import { registerSolidityTypes } from "./register-types.mjs";
|
|
4
|
-
import { StructInfo, toCelLiteralType, wrapStructValue, wrapValueForSel } from "./value-wrappers.mjs";
|
|
4
|
+
import { StructInfo, toCelLiteralType, wrapStructValue, wrapValueForSel } from "./value-wrappers.mjs";
|
|
5
|
+
export { CelCodecRegistry, CelCodecRegistryOptions, CelLimits, ContractCallHandler, RuntimeEnvironmentResult, StructCodecDescriptor, StructInfo, createBaseEnvironment, createCheckerEnvironment, createRuntimeEnvironment, registerSolidityTypes, toCelLiteralType, wrapStructValue, wrapValueForSel };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./codec-registry.mjs";
|
|
2
|
-
import "./register-types.mjs";
|
|
3
|
-
import "./value-wrappers.mjs";
|
|
4
|
-
import "./hydrate.mjs";
|
|
5
|
-
export {};
|
|
1
|
+
import { CelCodecRegistry } from "./codec-registry.mjs";
|
|
2
|
+
import { registerSolidityTypes } from "./register-types.mjs";
|
|
3
|
+
import { toCelLiteralType, wrapStructValue, wrapValueForSel } from "./value-wrappers.mjs";
|
|
4
|
+
import { createBaseEnvironment, createCheckerEnvironment, createRuntimeEnvironment } from "./hydrate.mjs";
|
|
5
|
+
export { CelCodecRegistry, createBaseEnvironment, createCheckerEnvironment, createRuntimeEnvironment, registerSolidityTypes, toCelLiteralType, wrapStructValue, wrapValueForSel };
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { Environment } from "@marcbachmann/cel-js";
|
|
2
|
-
|
|
3
2
|
//#region src/environment/register-types.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Subset of the CEL Environment API needed for Solidity type registration.
|
|
6
5
|
* Mirrors the parameter signatures from Environment but drops the return type
|
|
7
6
|
* to void — registerSolidityTypes never chains the return value.
|
|
8
7
|
*/
|
|
9
|
-
type SolidityTypeHost = { [K in "registerType" | "registerOperator" | "registerFunction" | "registerConstant"]: (...args: Parameters<Environment[K]>) => void };
|
|
8
|
+
type SolidityTypeHost = { [K in "registerType" | "registerOperator" | "registerFunction" | "registerConstant"]: (...args: Parameters<Environment[K]>) => void; };
|
|
10
9
|
/**
|
|
11
10
|
* Register all Solidity primitive types on a CEL Environment.
|
|
12
11
|
*/
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { Environment } from "@marcbachmann/cel-js";
|
|
2
|
-
|
|
3
2
|
//#region src/environment/register-types.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Subset of the CEL Environment API needed for Solidity type registration.
|
|
6
5
|
* Mirrors the parameter signatures from Environment but drops the return type
|
|
7
6
|
* to void — registerSolidityTypes never chains the return value.
|
|
8
7
|
*/
|
|
9
|
-
type SolidityTypeHost = { [K in "registerType" | "registerOperator" | "registerFunction" | "registerConstant"]: (...args: Parameters<Environment[K]>) => void };
|
|
8
|
+
type SolidityTypeHost = { [K in "registerType" | "registerOperator" | "registerFunction" | "registerConstant"]: (...args: Parameters<Environment[K]>) => void; };
|
|
10
9
|
/**
|
|
11
10
|
* Register all Solidity primitive types on a CEL Environment.
|
|
12
11
|
*/
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
require("../_virtual/_rolldown/runtime.cjs");
|
|
2
1
|
let _seljs_types = require("@seljs/types");
|
|
3
2
|
//#region src/environment/value-wrappers.ts
|
|
4
3
|
const wrapFieldValue = (registry, celType, value) => {
|
|
@@ -32,10 +31,7 @@ const wrapStructValue = (registry, info, value) => {
|
|
|
32
31
|
const { ctor, fieldNames, fieldTypes } = info;
|
|
33
32
|
let data;
|
|
34
33
|
if (Array.isArray(value)) data = Object.fromEntries(fieldNames.map((name, i) => [name, wrapFieldValue(registry, fieldTypes[name] ?? "dyn", value[i])]));
|
|
35
|
-
else
|
|
36
|
-
const raw = value;
|
|
37
|
-
data = Object.fromEntries(Object.entries(raw).map(([name, val]) => [name, fieldTypes[name] ? wrapFieldValue(registry, fieldTypes[name], val) : val]));
|
|
38
|
-
}
|
|
34
|
+
else data = Object.fromEntries(Object.entries(value).map(([name, val]) => [name, fieldTypes[name] ? wrapFieldValue(registry, fieldTypes[name], val) : val]));
|
|
39
35
|
return Object.assign(new ctor(), data);
|
|
40
36
|
};
|
|
41
37
|
//#endregion
|
|
@@ -31,10 +31,7 @@ const wrapStructValue = (registry, info, value) => {
|
|
|
31
31
|
const { ctor, fieldNames, fieldTypes } = info;
|
|
32
32
|
let data;
|
|
33
33
|
if (Array.isArray(value)) data = Object.fromEntries(fieldNames.map((name, i) => [name, wrapFieldValue(registry, fieldTypes[name] ?? "dyn", value[i])]));
|
|
34
|
-
else
|
|
35
|
-
const raw = value;
|
|
36
|
-
data = Object.fromEntries(Object.entries(raw).map(([name, val]) => [name, fieldTypes[name] ? wrapFieldValue(registry, fieldTypes[name], val) : val]));
|
|
37
|
-
}
|
|
34
|
+
else data = Object.fromEntries(Object.entries(value).map(([name, val]) => [name, fieldTypes[name] ? wrapFieldValue(registry, fieldTypes[name], val) : val]));
|
|
38
35
|
return Object.assign(new ctor(), data);
|
|
39
36
|
};
|
|
40
37
|
//#endregion
|
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { RuleContext, RuleSeverity, RuleTier, SELRule } from "./rules/types.cjs";
|
|
2
2
|
import { rules } from "./rules/facade.cjs";
|
|
3
3
|
import { RunRulesOptions, runRules } from "./rules/runner.cjs";
|
|
4
|
+
import "./rules/index.cjs";
|
|
4
5
|
import { CompletionItem, SELChecker, SELCheckerOptions, SELDiagnostic } from "./checker/checker.cjs";
|
|
5
6
|
import { isTypeCompatible } from "./checker/type-compatibility.cjs";
|
|
7
|
+
import "./checker/index.cjs";
|
|
6
8
|
import { COMPREHENSION_MACROS, SCALAR_WRAPPER_FUNCTIONS } from "./constants.cjs";
|
|
7
9
|
import { CelCodecRegistry, CelCodecRegistryOptions, StructCodecDescriptor } from "./environment/codec-registry.cjs";
|
|
8
10
|
import { CelLimits, ContractCallHandler, RuntimeEnvironmentResult, createBaseEnvironment, createCheckerEnvironment, createRuntimeEnvironment } from "./environment/hydrate.cjs";
|
|
9
11
|
import { registerSolidityTypes } from "./environment/register-types.cjs";
|
|
10
12
|
import { StructInfo, toCelLiteralType, wrapStructValue, wrapValueForSel } from "./environment/value-wrappers.cjs";
|
|
13
|
+
import "./environment/index.cjs";
|
|
11
14
|
export { COMPREHENSION_MACROS, CelCodecRegistry, CelCodecRegistryOptions, CelLimits, CompletionItem, ContractCallHandler, RuleContext, RuleSeverity, RuleTier, RunRulesOptions, RuntimeEnvironmentResult, SCALAR_WRAPPER_FUNCTIONS, SELChecker, SELCheckerOptions, SELDiagnostic, SELRule, StructCodecDescriptor, StructInfo, createBaseEnvironment, createCheckerEnvironment, createRuntimeEnvironment, isTypeCompatible, registerSolidityTypes, rules, runRules, toCelLiteralType, wrapStructValue, wrapValueForSel };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { RuleContext, RuleSeverity, RuleTier, SELRule } from "./rules/types.mjs";
|
|
2
2
|
import { rules } from "./rules/facade.mjs";
|
|
3
3
|
import { RunRulesOptions, runRules } from "./rules/runner.mjs";
|
|
4
|
+
import "./rules/index.mjs";
|
|
4
5
|
import { CompletionItem, SELChecker, SELCheckerOptions, SELDiagnostic } from "./checker/checker.mjs";
|
|
5
6
|
import { isTypeCompatible } from "./checker/type-compatibility.mjs";
|
|
7
|
+
import "./checker/index.mjs";
|
|
6
8
|
import { COMPREHENSION_MACROS, SCALAR_WRAPPER_FUNCTIONS } from "./constants.mjs";
|
|
7
9
|
import { CelCodecRegistry, CelCodecRegistryOptions, StructCodecDescriptor } from "./environment/codec-registry.mjs";
|
|
8
10
|
import { CelLimits, ContractCallHandler, RuntimeEnvironmentResult, createBaseEnvironment, createCheckerEnvironment, createRuntimeEnvironment } from "./environment/hydrate.mjs";
|
|
9
11
|
import { registerSolidityTypes } from "./environment/register-types.mjs";
|
|
10
12
|
import { StructInfo, toCelLiteralType, wrapStructValue, wrapValueForSel } from "./environment/value-wrappers.mjs";
|
|
13
|
+
import "./environment/index.mjs";
|
|
11
14
|
export { COMPREHENSION_MACROS, CelCodecRegistry, CelCodecRegistryOptions, CelLimits, CompletionItem, ContractCallHandler, RuleContext, RuleSeverity, RuleTier, RunRulesOptions, RuntimeEnvironmentResult, SCALAR_WRAPPER_FUNCTIONS, SELChecker, SELCheckerOptions, SELDiagnostic, SELRule, StructCodecDescriptor, StructInfo, createBaseEnvironment, createCheckerEnvironment, createRuntimeEnvironment, isTypeCompatible, registerSolidityTypes, rules, runRules, toCelLiteralType, wrapStructValue, wrapValueForSel };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
1
|
const require_ast_utils = require("../../utils/ast-utils.cjs");
|
|
3
2
|
let _seljs_common = require("@seljs/common");
|
|
4
3
|
//#region src/rules/defaults/expression-complexity.ts
|
|
@@ -10,7 +9,7 @@ const DEFAULT_THRESHOLDS = {
|
|
|
10
9
|
maxBranches: 6
|
|
11
10
|
};
|
|
12
11
|
/** Binary ops that count toward the operators metric (excludes && and ||). */
|
|
13
|
-
const COUNTING_BINARY_OPS = new Set([
|
|
12
|
+
const COUNTING_BINARY_OPS = /* @__PURE__ */ new Set([
|
|
14
13
|
"==",
|
|
15
14
|
"!=",
|
|
16
15
|
"<",
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
require("./deferred-call.cjs");
|
|
2
|
-
require("./expression-complexity.cjs");
|
|
3
|
-
require("./no-constant-condition.cjs");
|
|
4
|
-
require("./no-mixed-operators.cjs");
|
|
5
|
-
require("./no-redundant-bool.cjs");
|
|
6
|
-
require("./no-self-comparison.cjs");
|
|
7
|
-
require("./require-type.cjs");
|
|
1
|
+
const require_deferred_call = require("./deferred-call.cjs");
|
|
2
|
+
const require_expression_complexity = require("./expression-complexity.cjs");
|
|
3
|
+
const require_no_constant_condition = require("./no-constant-condition.cjs");
|
|
4
|
+
const require_no_mixed_operators = require("./no-mixed-operators.cjs");
|
|
5
|
+
const require_no_redundant_bool = require("./no-redundant-bool.cjs");
|
|
6
|
+
const require_no_self_comparison = require("./no-self-comparison.cjs");
|
|
7
|
+
const require_require_type = require("./require-type.cjs");
|
|
8
|
+
exports.deferredCall = require_deferred_call.deferredCall;
|
|
9
|
+
exports.expressionComplexity = require_expression_complexity.expressionComplexity;
|
|
10
|
+
exports.noConstantCondition = require_no_constant_condition.noConstantCondition;
|
|
11
|
+
exports.noMixedOperators = require_no_mixed_operators.noMixedOperators;
|
|
12
|
+
exports.noRedundantBool = require_no_redundant_bool.noRedundantBool;
|
|
13
|
+
exports.noSelfComparison = require_no_self_comparison.noSelfComparison;
|
|
14
|
+
exports.requireType = require_require_type.requireType;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "./deferred-call.mjs";
|
|
2
|
-
import "./expression-complexity.mjs";
|
|
3
|
-
import "./no-constant-condition.mjs";
|
|
4
|
-
import "./no-mixed-operators.mjs";
|
|
5
|
-
import "./no-redundant-bool.mjs";
|
|
6
|
-
import "./no-self-comparison.mjs";
|
|
7
|
-
import "./require-type.mjs";
|
|
8
|
-
export {};
|
|
1
|
+
import { deferredCall } from "./deferred-call.mjs";
|
|
2
|
+
import { expressionComplexity } from "./expression-complexity.mjs";
|
|
3
|
+
import { noConstantCondition } from "./no-constant-condition.mjs";
|
|
4
|
+
import { noMixedOperators } from "./no-mixed-operators.mjs";
|
|
5
|
+
import { noRedundantBool } from "./no-redundant-bool.mjs";
|
|
6
|
+
import { noSelfComparison } from "./no-self-comparison.mjs";
|
|
7
|
+
import { requireType } from "./require-type.mjs";
|
|
8
|
+
export { deferredCall, expressionComplexity, noConstantCondition, noMixedOperators, noRedundantBool, noSelfComparison, requireType };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
1
|
const require_ast_utils = require("../../utils/ast-utils.cjs");
|
|
3
2
|
let _marcbachmann_cel_js = require("@marcbachmann/cel-js");
|
|
4
3
|
//#region src/rules/defaults/no-self-comparison.ts
|
|
5
|
-
const COMPARISON_OPS = new Set([
|
|
4
|
+
const COMPARISON_OPS = /* @__PURE__ */ new Set([
|
|
6
5
|
"==",
|
|
7
6
|
"!=",
|
|
8
7
|
"<",
|
|
@@ -10,7 +9,7 @@ const COMPARISON_OPS = new Set([
|
|
|
10
9
|
">",
|
|
11
10
|
">="
|
|
12
11
|
]);
|
|
13
|
-
const ALWAYS_TRUE_OPS = new Set([
|
|
12
|
+
const ALWAYS_TRUE_OPS = /* @__PURE__ */ new Set([
|
|
14
13
|
"==",
|
|
15
14
|
"<=",
|
|
16
15
|
">="
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { walkAST } from "../../utils/ast-utils.mjs";
|
|
2
2
|
import { serialize } from "@marcbachmann/cel-js";
|
|
3
3
|
//#region src/rules/defaults/no-self-comparison.ts
|
|
4
|
-
const COMPARISON_OPS = new Set([
|
|
4
|
+
const COMPARISON_OPS = /* @__PURE__ */ new Set([
|
|
5
5
|
"==",
|
|
6
6
|
"!=",
|
|
7
7
|
"<",
|
|
@@ -9,7 +9,7 @@ const COMPARISON_OPS = new Set([
|
|
|
9
9
|
">",
|
|
10
10
|
">="
|
|
11
11
|
]);
|
|
12
|
-
const ALWAYS_TRUE_OPS = new Set([
|
|
12
|
+
const ALWAYS_TRUE_OPS = /* @__PURE__ */ new Set([
|
|
13
13
|
"==",
|
|
14
14
|
"<=",
|
|
15
15
|
">="
|
package/dist/rules/facade.cjs
CHANGED
|
@@ -14,6 +14,7 @@ require("./defaults/index.cjs");
|
|
|
14
14
|
* built-in rules, and rule factories for custom enforcement.
|
|
15
15
|
*/
|
|
16
16
|
const rules = {
|
|
17
|
+
/** All built-in lint rules. */
|
|
17
18
|
builtIn: [
|
|
18
19
|
require_no_redundant_bool.noRedundantBool,
|
|
19
20
|
require_no_constant_condition.noConstantCondition,
|
|
@@ -21,12 +22,19 @@ const rules = {
|
|
|
21
22
|
require_no_self_comparison.noSelfComparison,
|
|
22
23
|
require_deferred_call.deferredCall
|
|
23
24
|
],
|
|
25
|
+
/** Flags redundant comparisons to boolean literals (true/false). */
|
|
24
26
|
noRedundantBool: require_no_redundant_bool.noRedundantBool,
|
|
27
|
+
/** Flags constant conditions (e.g. `true && x`, `1 == 1`). */
|
|
25
28
|
noConstantCondition: require_no_constant_condition.noConstantCondition,
|
|
29
|
+
/** Requires parentheses when mixing `&&` and `||`. */
|
|
26
30
|
noMixedOperators: require_no_mixed_operators.noMixedOperators,
|
|
31
|
+
/** Flags self-comparisons (e.g. `x == x`). */
|
|
27
32
|
noSelfComparison: require_no_self_comparison.noSelfComparison,
|
|
33
|
+
/** Flags contract calls with dynamic arguments that will execute as live RPC calls. */
|
|
28
34
|
deferredCall: require_deferred_call.deferredCall,
|
|
35
|
+
/** Rule factory that enforces an expression evaluates to the expected CEL type. */
|
|
29
36
|
requireType: require_require_type.requireType,
|
|
37
|
+
/** Factory that enforces expression complexity thresholds. */
|
|
30
38
|
expressionComplexity: require_expression_complexity.expressionComplexity
|
|
31
39
|
};
|
|
32
40
|
//#endregion
|
package/dist/rules/facade.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SELRule } from "./types.cjs";
|
|
2
2
|
import { ComplexityThresholds } from "./defaults/expression-complexity.cjs";
|
|
3
|
-
|
|
4
3
|
//#region src/rules/facade.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Unified export for rules.
|
|
@@ -9,13 +8,21 @@ import { ComplexityThresholds } from "./defaults/expression-complexity.cjs";
|
|
|
9
8
|
* built-in rules, and rule factories for custom enforcement.
|
|
10
9
|
*/
|
|
11
10
|
declare const rules: {
|
|
12
|
-
/** All built-in lint rules. */
|
|
13
|
-
readonly
|
|
14
|
-
|
|
15
|
-
readonly
|
|
16
|
-
|
|
17
|
-
readonly
|
|
18
|
-
|
|
11
|
+
/** All built-in lint rules. */
|
|
12
|
+
readonly builtIn: readonly [SELRule, SELRule, SELRule, SELRule, SELRule];
|
|
13
|
+
/** Flags redundant comparisons to boolean literals (true/false). */
|
|
14
|
+
readonly noRedundantBool: SELRule;
|
|
15
|
+
/** Flags constant conditions (e.g. `true && x`, `1 == 1`). */
|
|
16
|
+
readonly noConstantCondition: SELRule;
|
|
17
|
+
/** Requires parentheses when mixing `&&` and `||`. */
|
|
18
|
+
readonly noMixedOperators: SELRule;
|
|
19
|
+
/** Flags self-comparisons (e.g. `x == x`). */
|
|
20
|
+
readonly noSelfComparison: SELRule;
|
|
21
|
+
/** Flags contract calls with dynamic arguments that will execute as live RPC calls. */
|
|
22
|
+
readonly deferredCall: SELRule;
|
|
23
|
+
/** Rule factory that enforces an expression evaluates to the expected CEL type. */
|
|
24
|
+
readonly requireType: (expected: string) => SELRule;
|
|
25
|
+
/** Factory that enforces expression complexity thresholds. */
|
|
19
26
|
readonly expressionComplexity: (thresholds?: Partial<ComplexityThresholds>) => SELRule;
|
|
20
27
|
};
|
|
21
28
|
//#endregion
|
package/dist/rules/facade.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SELRule } from "./types.mjs";
|
|
2
2
|
import { ComplexityThresholds } from "./defaults/expression-complexity.mjs";
|
|
3
|
-
|
|
4
3
|
//#region src/rules/facade.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Unified export for rules.
|
|
@@ -9,13 +8,21 @@ import { ComplexityThresholds } from "./defaults/expression-complexity.mjs";
|
|
|
9
8
|
* built-in rules, and rule factories for custom enforcement.
|
|
10
9
|
*/
|
|
11
10
|
declare const rules: {
|
|
12
|
-
/** All built-in lint rules. */
|
|
13
|
-
readonly
|
|
14
|
-
|
|
15
|
-
readonly
|
|
16
|
-
|
|
17
|
-
readonly
|
|
18
|
-
|
|
11
|
+
/** All built-in lint rules. */
|
|
12
|
+
readonly builtIn: readonly [SELRule, SELRule, SELRule, SELRule, SELRule];
|
|
13
|
+
/** Flags redundant comparisons to boolean literals (true/false). */
|
|
14
|
+
readonly noRedundantBool: SELRule;
|
|
15
|
+
/** Flags constant conditions (e.g. `true && x`, `1 == 1`). */
|
|
16
|
+
readonly noConstantCondition: SELRule;
|
|
17
|
+
/** Requires parentheses when mixing `&&` and `||`. */
|
|
18
|
+
readonly noMixedOperators: SELRule;
|
|
19
|
+
/** Flags self-comparisons (e.g. `x == x`). */
|
|
20
|
+
readonly noSelfComparison: SELRule;
|
|
21
|
+
/** Flags contract calls with dynamic arguments that will execute as live RPC calls. */
|
|
22
|
+
readonly deferredCall: SELRule;
|
|
23
|
+
/** Rule factory that enforces an expression evaluates to the expected CEL type. */
|
|
24
|
+
readonly requireType: (expected: string) => SELRule;
|
|
25
|
+
/** Factory that enforces expression complexity thresholds. */
|
|
19
26
|
readonly expressionComplexity: (thresholds?: Partial<ComplexityThresholds>) => SELRule;
|
|
20
27
|
};
|
|
21
28
|
//#endregion
|
package/dist/rules/facade.mjs
CHANGED
|
@@ -14,6 +14,7 @@ import "./defaults/index.mjs";
|
|
|
14
14
|
* built-in rules, and rule factories for custom enforcement.
|
|
15
15
|
*/
|
|
16
16
|
const rules = {
|
|
17
|
+
/** All built-in lint rules. */
|
|
17
18
|
builtIn: [
|
|
18
19
|
noRedundantBool,
|
|
19
20
|
noConstantCondition,
|
|
@@ -21,12 +22,19 @@ const rules = {
|
|
|
21
22
|
noSelfComparison,
|
|
22
23
|
deferredCall
|
|
23
24
|
],
|
|
25
|
+
/** Flags redundant comparisons to boolean literals (true/false). */
|
|
24
26
|
noRedundantBool,
|
|
27
|
+
/** Flags constant conditions (e.g. `true && x`, `1 == 1`). */
|
|
25
28
|
noConstantCondition,
|
|
29
|
+
/** Requires parentheses when mixing `&&` and `||`. */
|
|
26
30
|
noMixedOperators,
|
|
31
|
+
/** Flags self-comparisons (e.g. `x == x`). */
|
|
27
32
|
noSelfComparison,
|
|
33
|
+
/** Flags contract calls with dynamic arguments that will execute as live RPC calls. */
|
|
28
34
|
deferredCall,
|
|
35
|
+
/** Rule factory that enforces an expression evaluates to the expected CEL type. */
|
|
29
36
|
requireType,
|
|
37
|
+
/** Factory that enforces expression complexity thresholds. */
|
|
30
38
|
expressionComplexity
|
|
31
39
|
};
|
|
32
40
|
//#endregion
|
package/dist/rules/index.cjs
CHANGED
package/dist/rules/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { RuleContext, RuleSeverity, RuleTier, SELRule } from "./types.mjs";
|
|
2
2
|
import { rules } from "./facade.mjs";
|
|
3
|
-
import { RunRulesOptions, runRules } from "./runner.mjs";
|
|
3
|
+
import { RunRulesOptions, runRules } from "./runner.mjs";
|
|
4
|
+
export { RuleContext, RuleSeverity, RuleTier, RunRulesOptions, SELRule, rules, runRules };
|
package/dist/rules/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "./facade.mjs";
|
|
2
|
-
import "./runner.mjs";
|
|
3
|
-
export {};
|
|
1
|
+
import { rules } from "./facade.mjs";
|
|
2
|
+
import { runRules } from "./runner.mjs";
|
|
3
|
+
export { rules, runRules };
|
package/dist/rules/runner.d.cts
CHANGED
|
@@ -2,7 +2,6 @@ import { RuleTier, SELRule } from "./types.cjs";
|
|
|
2
2
|
import { SELDiagnostic } from "../checker/checker.cjs";
|
|
3
3
|
import { ASTNode } from "@marcbachmann/cel-js";
|
|
4
4
|
import { SELSchema } from "@seljs/schema";
|
|
5
|
-
|
|
6
5
|
//#region src/rules/runner.d.ts
|
|
7
6
|
interface RunRulesOptions {
|
|
8
7
|
expression: string;
|
|
@@ -15,13 +14,6 @@ interface RunRulesOptions {
|
|
|
15
14
|
/**
|
|
16
15
|
* Run enabled rules of the specified tier against a parsed AST.
|
|
17
16
|
*/
|
|
18
|
-
declare const runRules: ({
|
|
19
|
-
expression,
|
|
20
|
-
ast,
|
|
21
|
-
schema,
|
|
22
|
-
rules,
|
|
23
|
-
tier,
|
|
24
|
-
resolvedType
|
|
25
|
-
}: RunRulesOptions) => SELDiagnostic[];
|
|
17
|
+
declare const runRules: ({ expression, ast, schema, rules, tier, resolvedType }: RunRulesOptions) => SELDiagnostic[];
|
|
26
18
|
//#endregion
|
|
27
19
|
export { RunRulesOptions, runRules };
|
package/dist/rules/runner.d.mts
CHANGED
|
@@ -2,7 +2,6 @@ import { RuleTier, SELRule } from "./types.mjs";
|
|
|
2
2
|
import { SELDiagnostic } from "../checker/checker.mjs";
|
|
3
3
|
import { ASTNode } from "@marcbachmann/cel-js";
|
|
4
4
|
import { SELSchema } from "@seljs/schema";
|
|
5
|
-
|
|
6
5
|
//#region src/rules/runner.d.ts
|
|
7
6
|
interface RunRulesOptions {
|
|
8
7
|
expression: string;
|
|
@@ -15,13 +14,6 @@ interface RunRulesOptions {
|
|
|
15
14
|
/**
|
|
16
15
|
* Run enabled rules of the specified tier against a parsed AST.
|
|
17
16
|
*/
|
|
18
|
-
declare const runRules: ({
|
|
19
|
-
expression,
|
|
20
|
-
ast,
|
|
21
|
-
schema,
|
|
22
|
-
rules,
|
|
23
|
-
tier,
|
|
24
|
-
resolvedType
|
|
25
|
-
}: RunRulesOptions) => SELDiagnostic[];
|
|
17
|
+
declare const runRules: ({ expression, ast, schema, rules, tier, resolvedType }: RunRulesOptions) => SELDiagnostic[];
|
|
26
18
|
//#endregion
|
|
27
19
|
export { RunRulesOptions, runRules };
|
package/dist/rules/types.d.cts
CHANGED
package/dist/rules/types.d.mts
CHANGED
package/dist/utils/ast-utils.cjs
CHANGED
package/dist/utils/ast-utils.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seljs/checker",
|
|
3
|
-
"version": "1.4.0-beta.
|
|
3
|
+
"version": "1.4.0-beta.38",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "https://github.com/abinnovision/seljs"
|
|
6
6
|
},
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@marcbachmann/cel-js": "^7.5.3",
|
|
53
|
-
"@seljs/common": "1.4.0-beta.
|
|
53
|
+
"@seljs/common": "1.4.0-beta.38",
|
|
54
54
|
"@seljs/schema": "1.3.0",
|
|
55
|
-
"@seljs/types": "1.4.0-beta.
|
|
55
|
+
"@seljs/types": "1.4.0-beta.38",
|
|
56
56
|
"debug": "^4.4.3",
|
|
57
57
|
"viem": "^2.47.6"
|
|
58
58
|
},
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"@types/debug": "^4.1.13",
|
|
64
64
|
"eslint": "^9.39.4",
|
|
65
65
|
"prettier": "^3.8.1",
|
|
66
|
-
"tsdown": "^0.
|
|
67
|
-
"typescript": "^
|
|
66
|
+
"tsdown": "^0.22.14",
|
|
67
|
+
"typescript": "^6.0.3",
|
|
68
68
|
"vitest": "^4.1.0",
|
|
69
69
|
"zod": "^4.3.6"
|
|
70
70
|
},
|