pinets 0.9.4 → 0.9.6

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.
@@ -15,6 +15,7 @@ export declare class ScopeManager {
15
15
  private taCallIdCounter;
16
16
  private userCallIdCounter;
17
17
  private plotCallIdCounter;
18
+ private loopGuardCounter;
18
19
  private hoistingStack;
19
20
  private suppressHoisting;
20
21
  private reservedNames;
@@ -25,6 +26,7 @@ export declare class ScopeManager {
25
26
  getNextTACallId(): any;
26
27
  getNextUserCallId(): any;
27
28
  getNextPlotCallId(): any;
29
+ getNextLoopGuardName(): string;
28
30
  constructor();
29
31
  pushScope(type: string): void;
30
32
  popScope(): void;
@@ -57,5 +57,5 @@ export declare class CodeGenerator {
57
57
  generateSwitchAsIfElse(node: any): void;
58
58
  generateLoopAsExpression(node: any, loopType: any): void;
59
59
  generateSequenceExpression(node: any): void;
60
- getPrecedence(node: any): 0 | 10 | 1 | 2 | 3 | 4 | 5 | 9 | 12 | 13 | 15 | 20 | 19;
60
+ getPrecedence(node: any): 3 | 5 | 15 | 2 | 4 | 1 | 10 | 0 | 9 | 12 | 13 | 20 | 19;
61
61
  }
@@ -1,4 +1,14 @@
1
1
  import ScopeManager from '../analysis/ScopeManager';
2
+ /**
3
+ * Creates the AST nodes for a loop guard:
4
+ * 1. A counter declaration: `let __lgN = 0;` (to be hoisted before the loop)
5
+ * 2. A guard check: `if (++__lgN > __maxLoops) throw new Error("Loop exceeded maximum iterations (__lgN)");`
6
+ * (to be prepended to the loop body)
7
+ */
8
+ export declare function createLoopGuardNodes(guardName: string): {
9
+ counterDecl: any;
10
+ guardCheck: any;
11
+ };
2
12
  export declare function transformAssignmentExpression(node: any, scopeManager: ScopeManager): void;
3
13
  export declare function transformVariableDeclaration(varNode: any, scopeManager: ScopeManager): void;
4
14
  export declare function transformForStatement(node: any, scopeManager: ScopeManager, c: any): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinets",
3
- "version": "0.9.4",
3
+ "version": "0.9.6",
4
4
  "description": "Run Pine Script anywhere. PineTS is an open-source transpiler and runtime that brings Pine Script logic to Node.js and the browser with 1:1 syntax compatibility. Reliably write, port, and run indicators or strategies on your own infrastructure.",
5
5
  "keywords": [
6
6
  "Pine Script",
@@ -81,14 +81,13 @@
81
81
  "astring": "^1.9.0"
82
82
  },
83
83
  "devDependencies": {
84
- "typescript": "~5.9.3",
85
84
  "@rollup/plugin-commonjs": "^29.0.0",
86
85
  "@rollup/plugin-json": "^6.1.0",
87
86
  "@rollup/plugin-node-resolve": "^16.0.3",
88
87
  "@types/react": "^19.2.10",
89
88
  "@types/react-dom": "^19.2.3",
90
89
  "@vitejs/plugin-react": "^5.1.2",
91
- "@vitest/coverage-v8": "^2.0.0",
90
+ "@vitest/coverage-v8": "^4.1.0",
92
91
  "autoprefixer": "^10.4.23",
93
92
  "badgen": "^3.2.3",
94
93
  "cross-env": "^7.0.3",
@@ -99,9 +98,10 @@
99
98
  "rollup-plugin-typescript-paths": "^1.5.0",
100
99
  "tailwindcss": "^4.1.18",
101
100
  "tsx": "^4.21.0",
101
+ "typescript": "~5.9.3",
102
102
  "vite": "^7.3.1",
103
103
  "vite-tsconfig-paths": "^4.3.2",
104
- "vitest": "^2.0.0"
104
+ "vitest": "^4.1.0"
105
105
  },
106
106
  "repository": {
107
107
  "type": "git",