@bubblelab/bubble-runtime 0.1.14 → 0.1.16
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/extraction/BubbleParser.d.ts +187 -8
- package/dist/extraction/BubbleParser.d.ts.map +1 -1
- package/dist/extraction/BubbleParser.js +2271 -117
- package/dist/extraction/BubbleParser.js.map +1 -1
- package/dist/extraction/index.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/injection/BubbleInjector.d.ts +27 -2
- package/dist/injection/BubbleInjector.d.ts.map +1 -1
- package/dist/injection/BubbleInjector.js +343 -35
- package/dist/injection/BubbleInjector.js.map +1 -1
- package/dist/injection/LoggerInjector.d.ts +12 -1
- package/dist/injection/LoggerInjector.d.ts.map +1 -1
- package/dist/injection/LoggerInjector.js +301 -13
- package/dist/injection/LoggerInjector.js.map +1 -1
- package/dist/injection/index.js +1 -0
- package/dist/parse/BubbleScript.d.ts +60 -3
- package/dist/parse/BubbleScript.d.ts.map +1 -1
- package/dist/parse/BubbleScript.js +133 -15
- package/dist/parse/BubbleScript.js.map +1 -1
- package/dist/parse/index.d.ts +0 -1
- package/dist/parse/index.d.ts.map +1 -1
- package/dist/parse/index.js +1 -1
- package/dist/parse/index.js.map +1 -1
- package/dist/runtime/BubbleRunner.d.ts +8 -2
- package/dist/runtime/BubbleRunner.d.ts.map +1 -1
- package/dist/runtime/BubbleRunner.js +41 -30
- package/dist/runtime/BubbleRunner.js.map +1 -1
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/types.js +1 -0
- package/dist/types/index.js +1 -0
- package/dist/utils/bubble-helper.d.ts +2 -2
- package/dist/utils/bubble-helper.d.ts.map +1 -1
- package/dist/utils/bubble-helper.js +6 -1
- package/dist/utils/bubble-helper.js.map +1 -1
- package/dist/utils/normalize-control-flow.d.ts +14 -0
- package/dist/utils/normalize-control-flow.d.ts.map +1 -0
- package/dist/utils/normalize-control-flow.js +179 -0
- package/dist/utils/normalize-control-flow.js.map +1 -0
- package/dist/utils/parameter-formatter.d.ts +14 -5
- package/dist/utils/parameter-formatter.d.ts.map +1 -1
- package/dist/utils/parameter-formatter.js +164 -45
- package/dist/utils/parameter-formatter.js.map +1 -1
- package/dist/utils/sanitize-script.d.ts +11 -0
- package/dist/utils/sanitize-script.d.ts.map +1 -0
- package/dist/utils/sanitize-script.js +43 -0
- package/dist/utils/sanitize-script.js.map +1 -0
- package/dist/validation/BubbleValidator.d.ts +15 -0
- package/dist/validation/BubbleValidator.d.ts.map +1 -1
- package/dist/validation/BubbleValidator.js +168 -1
- package/dist/validation/BubbleValidator.js.map +1 -1
- package/dist/validation/index.d.ts +6 -3
- package/dist/validation/index.d.ts.map +1 -1
- package/dist/validation/index.js +33 -9
- package/dist/validation/index.js.map +1 -1
- package/dist/validation/lint-rules.d.ts +91 -0
- package/dist/validation/lint-rules.d.ts.map +1 -0
- package/dist/validation/lint-rules.js +755 -0
- package/dist/validation/lint-rules.js.map +1 -0
- package/package.json +4 -4
- package/dist/parse/traceDependencies.d.ts +0 -18
- package/dist/parse/traceDependencies.d.ts.map +0 -1
- package/dist/parse/traceDependencies.js +0 -195
- package/dist/parse/traceDependencies.js.map +0 -1
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
/**
|
|
3
|
+
* Represents a lint error found during validation
|
|
4
|
+
*/
|
|
5
|
+
export interface LintError {
|
|
6
|
+
line: number;
|
|
7
|
+
column?: number;
|
|
8
|
+
message: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Context containing pre-parsed AST information for lint rules
|
|
12
|
+
* This allows rules to avoid redundant AST traversals
|
|
13
|
+
*/
|
|
14
|
+
export interface LintRuleContext {
|
|
15
|
+
sourceFile: ts.SourceFile;
|
|
16
|
+
bubbleFlowClass: ts.ClassDeclaration | null;
|
|
17
|
+
handleMethod: ts.MethodDeclaration | null;
|
|
18
|
+
handleMethodBody: ts.Block | null;
|
|
19
|
+
importedBubbleClasses: Set<string>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Interface for lint rules that can validate BubbleFlow code
|
|
23
|
+
*/
|
|
24
|
+
export interface LintRule {
|
|
25
|
+
name: string;
|
|
26
|
+
validate(context: LintRuleContext): LintError[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Registry that manages and executes all lint rules
|
|
30
|
+
*/
|
|
31
|
+
export declare class LintRuleRegistry {
|
|
32
|
+
private rules;
|
|
33
|
+
/**
|
|
34
|
+
* Register a lint rule
|
|
35
|
+
*/
|
|
36
|
+
register(rule: LintRule): void;
|
|
37
|
+
/**
|
|
38
|
+
* Execute all registered rules on the given code
|
|
39
|
+
* Traverses AST once and shares context with all rules for efficiency
|
|
40
|
+
*/
|
|
41
|
+
validateAll(sourceFile: ts.SourceFile): LintError[];
|
|
42
|
+
/**
|
|
43
|
+
* Get all registered rule names
|
|
44
|
+
*/
|
|
45
|
+
getRuleNames(): string[];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Lint rule that prevents throw statements directly in the handle method
|
|
49
|
+
*/
|
|
50
|
+
export declare const noThrowInHandleRule: LintRule;
|
|
51
|
+
/**
|
|
52
|
+
* Lint rule that prevents direct bubble instantiation in the handle method
|
|
53
|
+
*/
|
|
54
|
+
export declare const noDirectBubbleInstantiationInHandleRule: LintRule;
|
|
55
|
+
/**
|
|
56
|
+
* Lint rule that prevents credentials parameter from being used in bubble instantiations
|
|
57
|
+
*/
|
|
58
|
+
export declare const noCredentialsParameterRule: LintRule;
|
|
59
|
+
/**
|
|
60
|
+
* Lint rule that prevents usage of process.env
|
|
61
|
+
*/
|
|
62
|
+
export declare const noProcessEnvRule: LintRule;
|
|
63
|
+
/**
|
|
64
|
+
* Lint rule that prevents method invocations inside complex expressions
|
|
65
|
+
*/
|
|
66
|
+
export declare const noMethodInvocationInComplexExpressionRule: LintRule;
|
|
67
|
+
/**
|
|
68
|
+
* Lint rule that prevents try-catch statements in the handle method
|
|
69
|
+
* Try-catch blocks interfere with runtime instrumentation and error handling
|
|
70
|
+
*/
|
|
71
|
+
export declare const noTryCatchInHandleRule: LintRule;
|
|
72
|
+
/**
|
|
73
|
+
* Lint rule that prevents methods from calling other methods
|
|
74
|
+
* Methods should only be called from the handle method, not from other methods
|
|
75
|
+
*/
|
|
76
|
+
export declare const noMethodCallingMethodRule: LintRule;
|
|
77
|
+
/**
|
|
78
|
+
* Lint rule that prevents usage of 'any' type
|
|
79
|
+
* Using 'any' bypasses TypeScript's type checking and should be avoided
|
|
80
|
+
*/
|
|
81
|
+
export declare const noAnyTypeRule: LintRule;
|
|
82
|
+
/**
|
|
83
|
+
* Lint rule that prevents multiple BubbleFlow classes in a single file
|
|
84
|
+
* Only one class extending BubbleFlow is allowed per file for proper runtime instrumentation
|
|
85
|
+
*/
|
|
86
|
+
export declare const singleBubbleFlowClassRule: LintRule;
|
|
87
|
+
/**
|
|
88
|
+
* Default registry instance with all rules registered
|
|
89
|
+
*/
|
|
90
|
+
export declare const defaultLintRuleRegistry: LintRuleRegistry;
|
|
91
|
+
//# sourceMappingURL=lint-rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lint-rules.d.ts","sourceRoot":"","sources":["../../src/validation/lint-rules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC;IAC1B,eAAe,EAAE,E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