pinets 0.9.14 → 0.9.15
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/pinets.min.browser.es.js +19 -19
- package/dist/pinets.min.browser.es.js.map +1 -1
- package/dist/pinets.min.browser.js +19 -19
- package/dist/pinets.min.browser.js.map +1 -1
- package/dist/pinets.min.cjs +19 -19
- package/dist/pinets.min.cjs.map +1 -1
- package/dist/pinets.min.es.js +19 -19
- package/dist/pinets.min.es.js.map +1 -1
- package/dist/types/Context.class.d.ts +13 -1
- package/dist/types/namespaces/Core.d.ts +1 -5
- package/dist/types/namespaces/PineTypeObject.d.ts +13 -1
- package/dist/types/namespaces/silentInSecondary.d.ts +31 -0
- package/dist/types/transpiler/analysis/ScopeManager.d.ts +8 -0
- package/dist/types/transpiler/pineToJS/lexer.d.ts +8 -0
- package/package.json +1 -1
|
@@ -150,6 +150,17 @@ export declare class Context {
|
|
|
150
150
|
*/
|
|
151
151
|
entries(source: any): IterableIterator<[number, any]>;
|
|
152
152
|
private _callStack;
|
|
153
|
+
/**
|
|
154
|
+
* Cumulative call-path stack. Each entry is the full path from the root to
|
|
155
|
+
* the current call, formed by joining the syntactic call-site ids with '|'.
|
|
156
|
+
*
|
|
157
|
+
* Pine semantics is per-call-PATH (not per-syntactic-call-site): a function
|
|
158
|
+
* with internal `var` state, called via two distinct paths through a wrapper,
|
|
159
|
+
* must keep state independent per path. Keying lctx by the path (rather than
|
|
160
|
+
* the immediate site id) makes `$$.var.*` slots and `$$.id + '_taN'` ta
|
|
161
|
+
* callsite ids correctly path-scoped without any transpiler changes.
|
|
162
|
+
*/
|
|
163
|
+
private _pathStack;
|
|
153
164
|
/**
|
|
154
165
|
* Pushes a call ID onto the stack
|
|
155
166
|
* @param id - The call ID
|
|
@@ -160,7 +171,8 @@ export declare class Context {
|
|
|
160
171
|
*/
|
|
161
172
|
popId(): void;
|
|
162
173
|
/**
|
|
163
|
-
* Returns the current call
|
|
174
|
+
* Returns the current call PATH (cumulative ids joined by '|') from the top
|
|
175
|
+
* of the stack. Used as the lctx key for the current function call.
|
|
164
176
|
*/
|
|
165
177
|
peekId(): string;
|
|
166
178
|
/**
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { PineTypeObject } from './PineTypeObject';
|
|
2
1
|
import type { IndicatorOptions } from '../types/PineTypes';
|
|
3
2
|
export declare function parseIndicatorOptions(args: any[]): Partial<IndicatorOptions>;
|
|
4
3
|
/**
|
|
@@ -84,8 +83,5 @@ export declare class Core {
|
|
|
84
83
|
int(series: any): number;
|
|
85
84
|
float(series: any): number;
|
|
86
85
|
string(series: any): any;
|
|
87
|
-
Type(definition: Record<string, string | [string, any]>):
|
|
88
|
-
new: (...args: any[]) => PineTypeObject;
|
|
89
|
-
copy: (object: PineTypeObject) => PineTypeObject;
|
|
90
|
-
};
|
|
86
|
+
Type(definition: Record<string, string | [string, any]>): any;
|
|
91
87
|
}
|
|
@@ -2,7 +2,19 @@ export declare class PineTypeObject {
|
|
|
2
2
|
private _definition;
|
|
3
3
|
context: any;
|
|
4
4
|
get __def__(): Record<string, string>;
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Back-reference to the UDT factory that produced this instance.
|
|
7
|
+
* Used by `request.security_lower_tf`'s pure-builtin fast path to
|
|
8
|
+
* detect UDTs whose field defaults are all bare price builtins
|
|
9
|
+
* (e.g. `type candle { float o = open; float h = high; … }`) — when
|
|
10
|
+
* detected, the secondary's per-LTF-bar values can be synthesised
|
|
11
|
+
* directly from the candle stream without running any user script.
|
|
12
|
+
* Optional and nullable: instances created outside `Type().new` (or
|
|
13
|
+
* for legacy / direct constructions) leave this undefined and the
|
|
14
|
+
* fast path simply doesn't engage.
|
|
15
|
+
*/
|
|
16
|
+
_udt?: any;
|
|
17
|
+
constructor(_definition: Record<string, string>, context: any, _udt?: any);
|
|
6
18
|
copy(): PineTypeObject;
|
|
7
19
|
toString(): string;
|
|
8
20
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@silentInSecondary` — method decorator.
|
|
3
|
+
*
|
|
4
|
+
* Marks a helper method as a no-op when invoked on a secondary context
|
|
5
|
+
* (i.e. the auxiliary PineTS instance that `request.security` /
|
|
6
|
+
* `request.security_lower_tf` spawns to compute the captured expression
|
|
7
|
+
* at another symbol/timeframe).
|
|
8
|
+
*
|
|
9
|
+
* Drawings, plots, alerts and similar side-effect-only operations are
|
|
10
|
+
* never observable from a secondary context — its sole job is to populate
|
|
11
|
+
* `secContext.params[expression_name]` with the value of the captured
|
|
12
|
+
* expression bar-by-bar. Silencing those operations on secondaries cuts
|
|
13
|
+
* the per-bar work substantially without changing the captured value
|
|
14
|
+
* (the only output that callers ever read).
|
|
15
|
+
*
|
|
16
|
+
* Constructor-style methods (e.g. `label.new`, `line.new`, `box.new`)
|
|
17
|
+
* return `null`; setters / mutators / deletes return `undefined`. The
|
|
18
|
+
* existing helper code is null-safe end-to-end:
|
|
19
|
+
* - `get_*` methods already return `NaN`/`""` when the receiver is null.
|
|
20
|
+
* - The transpiler emits method calls on UDT-typed receivers as
|
|
21
|
+
* `obj?.method?.(...)`, so `null?.set_x1?.(...)` short-circuits.
|
|
22
|
+
* - Built-in setters like `LineHelper.set_x1(id, x)` already guard
|
|
23
|
+
* `if (id && !id._deleted) ...` and no-op on null.
|
|
24
|
+
*
|
|
25
|
+
* Pre-condition: target classes use the conventional
|
|
26
|
+
* `constructor(private context: any) {}`
|
|
27
|
+
* shape, so `this.context.isSecondaryContext` is uniformly accessible.
|
|
28
|
+
* (`Core.ts` `AlertHelper`, `Plots.ts` `PlotHelper`/`HlineHelper`/
|
|
29
|
+
* `FillHelper`, and the drawing helpers all conform.)
|
|
30
|
+
*/
|
|
31
|
+
export declare function silentInSecondary(_target: any, _propertyKey: string, descriptor: PropertyDescriptor): PropertyDescriptor;
|
|
@@ -99,6 +99,14 @@ export declare class ScopeManager {
|
|
|
99
99
|
pushScope(type: string): void;
|
|
100
100
|
popScope(): void;
|
|
101
101
|
getCurrentScopeType(): string;
|
|
102
|
+
/**
|
|
103
|
+
* True when any active scope on the stack is a function scope.
|
|
104
|
+
* Different from `getCurrentScopeType() === 'fn'`, which only matches
|
|
105
|
+
* the immediate scope — code inside a nested `if`/`for`/`while` inside
|
|
106
|
+
* a function body still needs the function-scope context (e.g. for
|
|
107
|
+
* call-path-keyed param/ta-callsite ids).
|
|
108
|
+
*/
|
|
109
|
+
isInsideFunctionScope(): boolean;
|
|
102
110
|
getCurrentScopeCount(): number;
|
|
103
111
|
addLocalSeriesVar(name: string): void;
|
|
104
112
|
removeLocalSeriesVar(name: string): void;
|
|
@@ -14,6 +14,14 @@ export declare class Lexer {
|
|
|
14
14
|
tokenize(): Token[];
|
|
15
15
|
handleNewline(): void;
|
|
16
16
|
handleIndentation(): void;
|
|
17
|
+
/**
|
|
18
|
+
* True when the most recently emitted token (skipping NEWLINE / COMMENT
|
|
19
|
+
* — those are layout, not content) is a token that requires a right-
|
|
20
|
+
* hand-side and therefore implies the next non-blank line is a
|
|
21
|
+
* continuation, not a new block. Mirrors the set the parser's
|
|
22
|
+
* `peekOperatorEx` already crosses NEWLINE for.
|
|
23
|
+
*/
|
|
24
|
+
private isContinuationFromPrevToken;
|
|
17
25
|
readComment(): void;
|
|
18
26
|
readString(): void;
|
|
19
27
|
readColorLiteral(): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pinets",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.15",
|
|
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",
|