@mondaydotcomorg/atp-compiler 0.18.4-rc.1 → 0.19.2
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/__tests__/unit/default-compiler.test.ts +2 -3
- package/__tests__/unit/plugin-system.test.ts +0 -1
- package/dist/atp-compiler/src/plugin-system/examples/timeout-plugin.d.ts.map +1 -1
- package/dist/atp-compiler/src/plugin-system/examples/timeout-plugin.js.map +1 -1
- package/dist/atp-compiler/src/plugin-system/pluggable-compiler.d.ts.map +1 -1
- package/dist/atp-compiler/src/plugin-system/pluggable-compiler.js +1 -3
- package/dist/atp-compiler/src/plugin-system/pluggable-compiler.js.map +1 -1
- package/dist/protocol/src/types.d.ts +1 -1
- package/dist/protocol/src/types.d.ts.map +1 -1
- package/dist/provenance/src/index.d.ts +6 -1
- package/dist/provenance/src/index.d.ts.map +1 -1
- package/dist/provenance/src/index.js +6 -1
- package/dist/provenance/src/index.js.map +1 -1
- package/dist/provenance/src/policies/builder.d.ts +36 -0
- package/dist/provenance/src/policies/builder.d.ts.map +1 -0
- package/dist/provenance/src/policies/builder.js +77 -0
- package/dist/provenance/src/policies/builder.js.map +1 -0
- package/dist/provenance/src/policies/declarative.d.ts +47 -0
- package/dist/provenance/src/policies/declarative.d.ts.map +1 -0
- package/dist/provenance/src/policies/declarative.js +170 -0
- package/dist/provenance/src/policies/declarative.js.map +1 -0
- package/dist/provenance/src/policies/dynamic.d.ts +39 -0
- package/dist/provenance/src/policies/dynamic.d.ts.map +1 -0
- package/dist/provenance/src/policies/dynamic.js +75 -0
- package/dist/provenance/src/policies/dynamic.js.map +1 -0
- package/dist/provenance/src/policies/schema.d.ts +270 -0
- package/dist/provenance/src/policies/schema.d.ts.map +1 -0
- package/dist/provenance/src/policies/schema.js +42 -0
- package/dist/provenance/src/policies/schema.js.map +1 -0
- package/dist/provenance/src/registry.d.ts +15 -0
- package/dist/provenance/src/registry.d.ts.map +1 -1
- package/dist/provenance/src/registry.js +73 -0
- package/dist/provenance/src/registry.js.map +1 -1
- package/dist/provenance/src/store.d.ts +53 -0
- package/dist/provenance/src/store.d.ts.map +1 -0
- package/dist/provenance/src/store.js +78 -0
- package/dist/provenance/src/store.js.map +1 -0
- package/dist/runtime/src/llm/replay.d.ts.map +1 -1
- package/dist/runtime/src/llm/replay.js +38 -26
- package/dist/runtime/src/llm/replay.js.map +1 -1
- package/package.json +5 -5
- package/src/plugin-system/create-default-compiler.ts +7 -8
- package/src/plugin-system/default-plugins/array-transformer-plugin.ts +0 -1
- package/src/plugin-system/default-plugins/detection-plugin.ts +0 -1
- package/src/plugin-system/default-plugins/index.ts +1 -2
- package/src/plugin-system/default-plugins/loop-transformer-plugin.ts +0 -1
- package/src/plugin-system/default-plugins/promise-transformer-plugin.ts +0 -1
- package/src/plugin-system/examples/loop-transformer-plugin.ts +2 -3
- package/src/plugin-system/examples/security-validator-plugin.ts +2 -3
- package/src/plugin-system/examples/timeout-plugin.ts +24 -30
- package/src/plugin-system/index.ts +3 -4
- package/src/plugin-system/pluggable-compiler.ts +17 -14
- package/src/plugin-system/plugin-api.ts +1 -2
- package/src/types/compiler-interface.ts +4 -5
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* check
|
|
3
|
-
*
|
|
2
|
+
* check
|
|
3
|
+
*
|
|
4
4
|
* ATP Compiler Plugin System
|
|
5
|
-
*
|
|
5
|
+
*
|
|
6
6
|
* Extensible plugin architecture for custom transformations
|
|
7
7
|
*/
|
|
8
8
|
|
|
@@ -16,4 +16,3 @@ export * from './default-plugins/index.js';
|
|
|
16
16
|
// Re-export examples for convenience
|
|
17
17
|
export * from './examples/timeout-plugin.js';
|
|
18
18
|
export * from './examples/security-validator-plugin.js';
|
|
19
|
-
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Plugin-based ATP Compiler
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* Extensible compiler that supports custom plugins for detection,
|
|
5
5
|
* transformation, optimization, and validation
|
|
6
6
|
*/
|
|
@@ -11,7 +11,12 @@ const traverse = (_traverse as any).default || _traverse;
|
|
|
11
11
|
import _generate from '@babel/generator';
|
|
12
12
|
const generate = (_generate as any).default || _generate;
|
|
13
13
|
import type * as t from '@babel/types';
|
|
14
|
-
import type {
|
|
14
|
+
import type {
|
|
15
|
+
TransformResult,
|
|
16
|
+
CompilerConfig,
|
|
17
|
+
TransformMetadata,
|
|
18
|
+
DetectionResult,
|
|
19
|
+
} from '../types.js';
|
|
15
20
|
import { DEFAULT_COMPILER_CONFIG } from '../types.js';
|
|
16
21
|
import { TransformationError } from '../runtime/errors.js';
|
|
17
22
|
import { resetIdCounter } from '../runtime/context.js';
|
|
@@ -20,16 +25,16 @@ import type { ICompiler } from '../types/compiler-interface.js';
|
|
|
20
25
|
|
|
21
26
|
/**
|
|
22
27
|
* Plugin-based ATP Compiler
|
|
23
|
-
*
|
|
28
|
+
*
|
|
24
29
|
* @example
|
|
25
30
|
* ```typescript
|
|
26
31
|
* const compiler = new PluggableCompiler({
|
|
27
32
|
* enableBatchParallel: true
|
|
28
33
|
* });
|
|
29
|
-
*
|
|
34
|
+
*
|
|
30
35
|
* // Register custom plugin
|
|
31
36
|
* compiler.use(myCustomPlugin);
|
|
32
|
-
*
|
|
37
|
+
*
|
|
33
38
|
* // Transform code
|
|
34
39
|
* const result = compiler.transform(code);
|
|
35
40
|
* ```
|
|
@@ -38,12 +43,12 @@ export class PluggableCompiler implements ICompiler {
|
|
|
38
43
|
private config: CompilerConfig;
|
|
39
44
|
private registry: PluginRegistry;
|
|
40
45
|
private initialized: boolean = false;
|
|
41
|
-
|
|
46
|
+
|
|
42
47
|
/**
|
|
43
48
|
* AST cache - maps code string to parsed AST
|
|
44
49
|
* This avoids re-parsing the same code multiple times
|
|
45
50
|
* (e.g., once in detect() and once in transform())
|
|
46
|
-
*
|
|
51
|
+
*
|
|
47
52
|
* Performance Impact: ~30% reduction in compile time
|
|
48
53
|
*/
|
|
49
54
|
private astCache: Map<string, t.File> = new Map();
|
|
@@ -160,7 +165,7 @@ export class PluggableCompiler implements ICompiler {
|
|
|
160
165
|
const visitors: any = {};
|
|
161
166
|
for (const transformer of transformers) {
|
|
162
167
|
const visitor = transformer.getVisitor(this.config);
|
|
163
|
-
|
|
168
|
+
|
|
164
169
|
// Merge visitors, combining multiple handlers for the same node type
|
|
165
170
|
for (const [nodeType, handler] of Object.entries(visitor)) {
|
|
166
171
|
if (!visitors[nodeType]) {
|
|
@@ -220,9 +225,8 @@ export class PluggableCompiler implements ICompiler {
|
|
|
220
225
|
} catch (error) {
|
|
221
226
|
const message = error instanceof Error ? error.message : String(error);
|
|
222
227
|
// Include context about which phase failed
|
|
223
|
-
const context =
|
|
224
|
-
? `[Plugin transformation] ${message}`
|
|
225
|
-
: message;
|
|
228
|
+
const context =
|
|
229
|
+
detection.patterns.length > 0 ? `[Plugin transformation] ${message}` : message;
|
|
226
230
|
throw new TransformationError(context, code, 'plugin-error');
|
|
227
231
|
}
|
|
228
232
|
}
|
|
@@ -252,7 +256,7 @@ export class PluggableCompiler implements ICompiler {
|
|
|
252
256
|
|
|
253
257
|
/**
|
|
254
258
|
* Parse code to AST with caching
|
|
255
|
-
*
|
|
259
|
+
*
|
|
256
260
|
* Caches parsed AST to avoid re-parsing the same code multiple times.
|
|
257
261
|
* This provides ~30% performance improvement when detect() and transform()
|
|
258
262
|
* are called on the same code.
|
|
@@ -278,7 +282,7 @@ export class PluggableCompiler implements ICompiler {
|
|
|
278
282
|
|
|
279
283
|
/**
|
|
280
284
|
* Clear AST cache
|
|
281
|
-
*
|
|
285
|
+
*
|
|
282
286
|
* Call this method to free memory if you've compiled many different code snippets.
|
|
283
287
|
* The cache is automatically managed and uses Map, so old entries don't leak memory.
|
|
284
288
|
*/
|
|
@@ -315,4 +319,3 @@ export class PluggableCompiler implements ICompiler {
|
|
|
315
319
|
}
|
|
316
320
|
}
|
|
317
321
|
}
|
|
318
|
-
|
|
@@ -7,21 +7,21 @@ import type { DetectionResult, TransformResult } from '../types.js';
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* ICompiler - The core interface that all ATP compilers must implement
|
|
10
|
-
*
|
|
10
|
+
*
|
|
11
11
|
* This interface defines the contract for any compiler in the ATP system,
|
|
12
12
|
* enabling dependency injection and easy extensibility.
|
|
13
|
-
*
|
|
13
|
+
*
|
|
14
14
|
* @example
|
|
15
15
|
* ```typescript
|
|
16
16
|
* class MyCustomCompiler implements ICompiler {
|
|
17
17
|
* detect(code: string): DetectionResult {
|
|
18
18
|
* // Detection logic
|
|
19
19
|
* }
|
|
20
|
-
*
|
|
20
|
+
*
|
|
21
21
|
* transform(code: string): TransformResult {
|
|
22
22
|
* // Transformation logic
|
|
23
23
|
* }
|
|
24
|
-
*
|
|
24
|
+
*
|
|
25
25
|
* getType(): string {
|
|
26
26
|
* return 'MyCustomCompiler';
|
|
27
27
|
* }
|
|
@@ -76,4 +76,3 @@ export function isCompiler(obj: unknown): obj is ICompiler {
|
|
|
76
76
|
typeof (obj as any).getType === 'function'
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
|
-
|