diff --git a/.swcrc b/.swcrc index 168e80c..231fa43 100644 --- a/.swcrc +++ b/.swcrc @@ -2,7 +2,7 @@ "$schema": "https://swc.rs/schema.json", "sourceMaps": "inline", "module": { - "type": "commonjs", + "type": "es6", "strictMode": true, "noInterop": false }, diff --git a/package.json b/package.json index 83766b6..a2cafba 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,12 @@ { "name": "lightning-flow-scanner-core", "version": "4.11.3", - "main": "out/index.js", + "main": "index.js", "types": "index.d.ts", "engines": { "node": "^20 || ^22 || ^23" }, + "type":"module", "scripts": { "test": "jest", "test:cov": "jest --coverage", diff --git a/src/index.ts b/src/index.ts index c412b3b..34a4f90 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,9 +12,9 @@ import { FlowVariable, } from "./main/models"; import { FixFlows, GetRuleDefinitions, ParseFlows, ScanFlows, Compiler } from "./main/libs"; -import { IRulesConfig, IRuleDefinition } from "./main/interfaces"; +import * as interfaces from "./main/interfaces"; -function getRules(ruleNames?: string[]): IRuleDefinition[] { +function getRules(ruleNames?: string[]): interfaces.IRuleDefinition[] { if (ruleNames && ruleNames.length > 0) { const ruleSeverityMap = new Map(ruleNames.map((name) => [name, "error"])); return GetRuleDefinitions(ruleSeverityMap); @@ -28,7 +28,7 @@ function parse(selectedUris: any): Promise { return ParseFlows(selectedUris); } -function scan(parsedFlows: ParsedFlow[], ruleOptions?: IRulesConfig): ScanResult[] { +function scan(parsedFlows: ParsedFlow[], ruleOptions?: interfaces.IRulesConfig): ScanResult[] { const flows: Flow[] = []; for (const flow of parsedFlows) { if (!flow.errorMessage && flow.flow) { @@ -84,6 +84,7 @@ function fix(results: ScanResult[]): ScanResult[] { return newResults; } +export import IRuleDefinition = interfaces.IRuleDefinition; export { Flow, ParsedFlow, @@ -101,5 +102,4 @@ export { parse, scan, fix, - IRuleDefinition, };