@invinite-org/chartlang-compiler 1.2.1 → 1.4.0
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/CHANGELOG.md +310 -0
- package/dist/analysis/extractDependencyGraph.d.ts.map +1 -1
- package/dist/analysis/extractDependencyGraph.js +9 -1
- package/dist/analysis/extractDependencyGraph.js.map +1 -1
- package/dist/analysis/extractInputs.d.ts.map +1 -1
- package/dist/analysis/extractInputs.js +2 -0
- package/dist/analysis/extractInputs.js.map +1 -1
- package/dist/analysis/extractMaxLookback.d.ts +2 -1
- package/dist/analysis/extractMaxLookback.d.ts.map +1 -1
- package/dist/analysis/extractMaxLookback.js +90 -6
- package/dist/analysis/extractMaxLookback.js.map +1 -1
- package/dist/analysis/extractRequestedIntervals.d.ts +63 -1
- package/dist/analysis/extractRequestedIntervals.d.ts.map +1 -1
- package/dist/analysis/extractRequestedIntervals.js +245 -29
- package/dist/analysis/extractRequestedIntervals.js.map +1 -1
- package/dist/analysis/forbiddenConstructs.d.ts.map +1 -1
- package/dist/analysis/forbiddenConstructs.js +2 -41
- package/dist/analysis/forbiddenConstructs.js.map +1 -1
- package/dist/analysis/index.d.ts +4 -1
- package/dist/analysis/index.d.ts.map +1 -1
- package/dist/analysis/index.js +3 -1
- package/dist/analysis/index.js.map +1 -1
- package/dist/analysis/loopBounds.d.ts +91 -0
- package/dist/analysis/loopBounds.d.ts.map +1 -0
- package/dist/analysis/loopBounds.js +132 -0
- package/dist/analysis/loopBounds.js.map +1 -0
- package/dist/analysis/resolveIndexBound.d.ts +73 -0
- package/dist/analysis/resolveIndexBound.d.ts.map +1 -0
- package/dist/analysis/resolveIndexBound.js +336 -0
- package/dist/analysis/resolveIndexBound.js.map +1 -0
- package/dist/analysis/stateArrayCapacity.d.ts +58 -0
- package/dist/analysis/stateArrayCapacity.d.ts.map +1 -0
- package/dist/analysis/stateArrayCapacity.js +108 -0
- package/dist/analysis/stateArrayCapacity.js.map +1 -0
- package/dist/analysis/validateSecurityExpr.d.ts +25 -0
- package/dist/analysis/validateSecurityExpr.d.ts.map +1 -0
- package/dist/analysis/validateSecurityExpr.js +154 -0
- package/dist/analysis/validateSecurityExpr.js.map +1 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +22 -3
- package/dist/api.js.map +1 -1
- package/dist/diagnostics.d.ts +8 -2
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/diagnostics.js.map +1 -1
- package/dist/manifest.d.ts +3 -1
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +11 -0
- package/dist/manifest.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +148 -15
- package/dist/program.js.map +1 -1
- package/dist/transformers/callsiteIdInjection.d.ts +21 -0
- package/dist/transformers/callsiteIdInjection.d.ts.map +1 -1
- package/dist/transformers/callsiteIdInjection.js +34 -4
- package/dist/transformers/callsiteIdInjection.js.map +1 -1
- package/dist/transformers/plotKindFromCallsite.d.ts +3 -0
- package/dist/transformers/plotKindFromCallsite.d.ts.map +1 -1
- package/dist/transformers/plotKindFromCallsite.js +7 -0
- package/dist/transformers/plotKindFromCallsite.js.map +1 -1
- package/dist/transformers/resolveCallee.d.ts +21 -0
- package/dist/transformers/resolveCallee.d.ts.map +1 -1
- package/dist/transformers/resolveCallee.js +14 -1
- package/dist/transformers/resolveCallee.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,315 @@
|
|
|
1
1
|
# @invinite-org/chartlang-compiler
|
|
2
2
|
|
|
3
|
+
## 1.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- e620ba8: Add `bgcolor(color, opts?)` and `barcolor(color, opts?)` — Pine-ergonomic
|
|
8
|
+
top-level aliases for the `bg-color` / `bar-color` plot styles. One call
|
|
9
|
+
(`bgcolor(close > open ? "#16a34a" : "#dc2626", { transp: 80 })`) replaces
|
|
10
|
+
the verbose `plot(NaN, { style: { kind: "bg-color", … } })`. Surfaced in the
|
|
11
|
+
generated primitive reference and taught in the chartlang-coding skill.
|
|
12
|
+
|
|
13
|
+
Deliverable 2 (per-bar dynamic color): `PlotEmission` gains an optional
|
|
14
|
+
`colorValue: Color | null` channel; the runtime resolves the `bgcolor` /
|
|
15
|
+
`barcolor` per-bar color into it (omitted on the static `plot` path → wire
|
|
16
|
+
byte-identical, every pinned `plot-hash` untouched), validates it
|
|
17
|
+
(non-empty color string or `null`), and dedups it last-write-wins per
|
|
18
|
+
`(slotId, bar)` like `value`. Adapters prefer `colorValue` over the static
|
|
19
|
+
`style.color` at render time — this precedence is now the normative
|
|
20
|
+
adapter-kit contract (`PlotEmission.colorValue` JSDoc) and is implemented in
|
|
21
|
+
the canvas2d reference renderer (`null` ⇒ paint-nothing gap; omitted ⇒ static
|
|
22
|
+
fallback). The Pine converter emits the real per-bar dynamic color
|
|
23
|
+
(`bgcolor(close > open ? "#16a34a" : "#dc2626")`) instead of a static
|
|
24
|
+
`plot(NaN, …)`, so `bgcolor`/`barcolor` round-trip with per-bar semantics
|
|
25
|
+
intact.
|
|
26
|
+
|
|
27
|
+
- 08cba38: Add `time.*` calendar accessors (`time.year/month/dayofmonth/dayofweek/hour/
|
|
28
|
+
minute/second/timestamp`), a `time.timeClose(t, tz?)` bar-close accessor
|
|
29
|
+
(Pine's `time_close()` = bar start + interval), a `session.isOpen(t, spec, tz?)`
|
|
30
|
+
helper, and an `input.session` kind. Calendar fields are derived from a `Time`
|
|
31
|
+
epoch via the host (authors stay sandboxed — `Date`/`Intl` remain banned). v1
|
|
32
|
+
is UTC + fixed-offset only; exchange-tz/DST is a scoped follow-up. The Pine
|
|
33
|
+
converter lowers `dayofweek` / `time()` / `time_close()` / `input.session`.
|
|
34
|
+
- 1efb49c: Add multi-symbol support to `request.security`. `request.security({ symbol,
|
|
35
|
+
interval })` now reads a **different instrument** (not just a higher
|
|
36
|
+
timeframe), e.g. `request.security({ symbol: "AMEX:SPY", interval: "1D" })`.
|
|
37
|
+
`symbol` is optional (defaults to the chart symbol) and must be a compile-time
|
|
38
|
+
literal (`input.symbol` / `input.enum` resolved). A new `multiSymbol` adapter
|
|
39
|
+
capability gates non-chart-symbol requests: a different-symbol request against
|
|
40
|
+
an adapter declaring `multiSymbol: false` degrades to an all-NaN
|
|
41
|
+
bar/series with a single deduped `multi-symbol-not-supported` diagnostic,
|
|
42
|
+
mirroring `multi-timeframe-not-supported` (the symbol gate precedes the
|
|
43
|
+
timeframe gate, so a both-different request emits only the symbol diagnostic).
|
|
44
|
+
The Pine converter now lowers `request.security("OTHER", tf, expr)`, and the
|
|
45
|
+
`chartlang scaffold-adapter` template advertises `multiSymbol`.
|
|
46
|
+
- 1efb49c: Add `state.array<T>(capacity)` — a persistent, bounded FIFO collection. Push
|
|
47
|
+
many values across bars (`a.push(v)`) into a fixed-capacity ring and read
|
|
48
|
+
them back by element (`a.get(0)` = newest, `a.last()`, `a.size`,
|
|
49
|
+
`a.capacity`, `a.clear()`). Bounded literal capacity keeps it
|
|
50
|
+
serialization-clean. The Pine converter lowers a bounded numeric
|
|
51
|
+
`var array<…>` Camp B ring to it.
|
|
52
|
+
|
|
53
|
+
The compiler guards the capacity: it must be a compile-time numeric literal
|
|
54
|
+
(a `const` numeric binding is accepted) that is a positive integer within
|
|
55
|
+
`MAX_STATE_ARRAY_CAPACITY` (100_000). A non-literal capacity errors
|
|
56
|
+
`state-array-capacity-not-literal`; an out-of-range / non-integer literal
|
|
57
|
+
errors `state-array-capacity-exceeds-max`.
|
|
58
|
+
|
|
59
|
+
### Patch Changes
|
|
60
|
+
|
|
61
|
+
- Updated dependencies [e620ba8]
|
|
62
|
+
- Updated dependencies [08cba38]
|
|
63
|
+
- Updated dependencies [1efb49c]
|
|
64
|
+
- Updated dependencies [1efb49c]
|
|
65
|
+
- @invinite-org/chartlang-core@1.3.0
|
|
66
|
+
|
|
67
|
+
## 1.3.0
|
|
68
|
+
|
|
69
|
+
### Minor Changes
|
|
70
|
+
|
|
71
|
+
- 850ae21: Add `bar.point(offset, price)` — index authoring sugar for anchoring drawings
|
|
72
|
+
by bar offset instead of an absolute timestamp.
|
|
73
|
+
|
|
74
|
+
`bar.point` resolves the offset to the existing time-based `WorldPoint`
|
|
75
|
+
(`{ time, price }`) at compute time, so it composes directly with every
|
|
76
|
+
`draw.*` anchor argument and introduces no new wire format or anchor union:
|
|
77
|
+
|
|
78
|
+
- `bar.point(0, price)` — the current bar.
|
|
79
|
+
- `bar.point(-n, price)` — `n` bars back, using the real historical timestamp
|
|
80
|
+
from the runtime's time ring buffer (`NaN` time past retained history; never
|
|
81
|
+
throws).
|
|
82
|
+
- `bar.point(n, price)` — a future bar, with the time extrapolated from the
|
|
83
|
+
median recent bar spacing (falling back to the parsed bar interval when
|
|
84
|
+
fewer than two bars are retained).
|
|
85
|
+
|
|
86
|
+
The compiler's max-lookback analysis now counts a negative integer-literal
|
|
87
|
+
`bar.point(-n, …)` offset toward `maxLookback` exactly like a `series[n]`
|
|
88
|
+
lookback, so the runtime sizes the time buffer deeply enough; positive (future)
|
|
89
|
+
offsets and dynamic offsets contribute no extra depth. The recogniser peels
|
|
90
|
+
parentheses, so the converter's emitted form `bar.point(-(n), …)` is sized
|
|
91
|
+
identically to a hand-written `bar.point(-n, …)` (without it, a converted
|
|
92
|
+
historical tracking line sized its buffer to 0 and resolved to a NaN anchor).
|
|
93
|
+
|
|
94
|
+
The Pine v6 converter now lowers `bar_index` drawing anchors to
|
|
95
|
+
`bar.point(<signed offset>, <price>)` and drops the dead `__BAR_INTERVAL_MS`
|
|
96
|
+
sentinel and its `bar.time ± (N * __BAR_INTERVAL_MS)` arithmetic — future
|
|
97
|
+
anchors resolve at runtime instead of needing a host-supplied bar interval.
|
|
98
|
+
|
|
99
|
+
- ca19e20: Bidirectional plot `offset` — negative offsets shift a plotted series left.
|
|
100
|
+
|
|
101
|
+
`offset` becomes a presentation-only **display shift** in bars with the
|
|
102
|
+
fixed sign convention `+n` = right (future), `−n` = left (past); the
|
|
103
|
+
numeric series value is unshifted. This replaces the old value-read model
|
|
104
|
+
(where a positive offset made `series.current` read the value N bars ago
|
|
105
|
+
and a negative offset resolved to `NaN`). The `*Opts` `offset` JSDoc (and
|
|
106
|
+
ALMA's `barShift`) now describe both directions and drop the old
|
|
107
|
+
"negative ⇒ NaN" wording (`AlmaOpts.offset`, the Gaussian-centre
|
|
108
|
+
position, is unchanged).
|
|
109
|
+
|
|
110
|
+
`PlotEmission` gains an optional presentation field `xShift?: number`
|
|
111
|
+
(signed integer bars; omitted/`0` ≡ no shift, so a no-shift emission is
|
|
112
|
+
byte-identical to today). `validateEmission` rejects a non-integer
|
|
113
|
+
`xShift`. The compiler no longer counts `offset` toward `maxLookback`
|
|
114
|
+
(the value is no longer read from a deeper slot). The runtime threads the
|
|
115
|
+
declared offset onto the emission as `xShift` (reading a
|
|
116
|
+
`WeakMap<Series, number>` offset tag set by `makeShiftedSeriesView`; ALMA
|
|
117
|
+
tags `opts.barShift`) and stops the old value-read shift so
|
|
118
|
+
`series.current` is unshifted; the reference adapter renders it by
|
|
119
|
+
projecting `xShift` onto the x-axis (extending the viewport for
|
|
120
|
+
future-shifted points).
|
|
121
|
+
|
|
122
|
+
The Pine converter now maps `plot(<ta.* call>, offset=N)` onto the
|
|
123
|
+
emitted `ta.*` call's `offset` opt (signed, both directions); a plot
|
|
124
|
+
whose value is not a direct `ta.*` call drops the offset and emits the
|
|
125
|
+
new `plot-offset-needs-ta-call` warning, and a plot-level offset
|
|
126
|
+
replacing the ta call's own `offset=` emits `plot-offset-overrides-ta-offset`.
|
|
127
|
+
|
|
128
|
+
The conformance harness's `plot-field` assertion gains an `xShift` field,
|
|
129
|
+
and a new scenario pins both shift directions plus the unshifted value
|
|
130
|
+
series.
|
|
131
|
+
|
|
132
|
+
- 3541445: Size series-index buffers precisely for provably-bounded indices.
|
|
133
|
+
|
|
134
|
+
`extractMaxLookback` now resolves a series read at a literal, a
|
|
135
|
+
bounded-`for` induction variable (`for (let i = 0; i < N; i++) src[i]`),
|
|
136
|
+
a `const` numeric literal, or an affine combination of those
|
|
137
|
+
(`src[i + 1]`, `src[K - i]`, `src[2 * i]`) to its exact `maxLookback`
|
|
138
|
+
contribution via a new compile-time interval resolver
|
|
139
|
+
(`resolveIndexUpperBound`) sharing one `parseBoundedForLoop` helper with
|
|
140
|
+
`forbiddenConstructs`. These indices no longer emit the
|
|
141
|
+
`dynamic-series-index` warning or force the 5000-slot `dynamicFallback`
|
|
142
|
+
buffer — they size the ring buffer exactly like a literal lookback. The
|
|
143
|
+
resolver over-approximates (never under-sizes); genuinely dynamic indices
|
|
144
|
+
(unbounded variables, unsupported operators, non-terminating loops,
|
|
145
|
+
reassigned loop variables) keep the warning + fallback. A new
|
|
146
|
+
`loop-sma` conformance scenario pins a `for`-loop SMA as bar-for-bar
|
|
147
|
+
identical to `ta.sma(close, 5)`.
|
|
148
|
+
|
|
149
|
+
- 6235ad7: Make the compute bar's OHLCV + derived fields directly indexable as a series.
|
|
150
|
+
|
|
151
|
+
`bar.close`, `bar.open`, `bar.high`, `bar.low`, `bar.volume`, and the derived
|
|
152
|
+
`bar.hl2` / `bar.hlc3` / `bar.ohlc4` / `bar.hlcc4` are now `PriceSeries` /
|
|
153
|
+
`VolumeSeries` (`number & Series<number>`) on the bar passed to `compute`
|
|
154
|
+
(`ComputeContext.bar`, typed as the new `BarSeries`). Each field is **both** a
|
|
155
|
+
scalar — `bar.close * 2`, `plot(bar.close)`, `ta.ema(bar.close, 20)` keep
|
|
156
|
+
working unchanged — **and** an indexable series, so a script can read prior
|
|
157
|
+
bars directly:
|
|
158
|
+
|
|
159
|
+
```ts
|
|
160
|
+
const sma5 =
|
|
161
|
+
(bar.close[0] + bar.close[1] + bar.close[2] + bar.close[3] + bar.close[4]) /
|
|
162
|
+
5;
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
This removes the `ta.ema(bar.close, 1)` identity-trick that scripts previously
|
|
166
|
+
needed to "republish" a scalar price as an indexable `Series`.
|
|
167
|
+
|
|
168
|
+
The adapter-supplied candle type `Bar` (and `request.lowerTf` intrabar bars) is
|
|
169
|
+
unchanged — it stays scalar OHLCV; only the streaming `compute` bar gains the
|
|
170
|
+
series shape. `request.security`'s higher-timeframe bar remains the separate
|
|
171
|
+
`SecurityBar`.
|
|
172
|
+
|
|
173
|
+
Migration note: because the field is now an object, `Number.isFinite(bar.close)`
|
|
174
|
+
is always `false` (it does not coerce) and `bar.close === 42` is `false` (object
|
|
175
|
+
vs number). Use `bar.close.current` or `+bar.close` in those raw-number
|
|
176
|
+
contexts. `bar.point(0, bar.close)` continues to work — the runtime coerces the
|
|
177
|
+
anchor price to a scalar.
|
|
178
|
+
|
|
179
|
+
- 3bf391a: Add the `draw.fillBetween(edgeA, edgeB, opts?)` drawing primitive — a
|
|
180
|
+
native filled ribbon between two edges (the closed polygon `edgeA`
|
|
181
|
+
forward then `edgeB` reversed). It is the chartlang equivalent of Pine's
|
|
182
|
+
`linefill.new(line1, line2, color)` / `fill(plot1, plot2)`. The
|
|
183
|
+
pine-converter now lowers static two-line `linefill.new` to it instead of
|
|
184
|
+
approximating with `draw.rotatedRectangle`, retiring the
|
|
185
|
+
`linefill-rotatedrect-approximated` diagnostic.
|
|
186
|
+
- 8086003: Add an optional presentation-only `z` (render-order / z-index) option to
|
|
187
|
+
`plot()` and every `draw.*` primitive. Default `0`; higher renders on
|
|
188
|
+
top, ties fall back to the existing group + declaration order. Finite
|
|
189
|
+
numbers only. Affects stacking only — values, alerts, and `state.*` are
|
|
190
|
+
unchanged.
|
|
191
|
+
|
|
192
|
+
Adapter kit: `PlotEmission` and `DrawingEmission` gain the matching
|
|
193
|
+
presentation-only `z?: number` wire field, validated by
|
|
194
|
+
`validateEmission` as a finite number (NaN / ±Infinity rejected;
|
|
195
|
+
fractional and negative allowed). Omitted/`0` stays byte-identical to a
|
|
196
|
+
pre-feature emission, so existing goldens and conformance hashes are
|
|
197
|
+
untouched.
|
|
198
|
+
|
|
199
|
+
Runtime: `plotImpl` reads `opts.z`, and the drawing-emit path
|
|
200
|
+
(`createDrawingHandle`) lifts `z` out of `state.style` — into a shallow
|
|
201
|
+
clone with `z` removed, where the per-kind `draw.*` impls fold the opts
|
|
202
|
+
bag — and threads it onto the top-level `PlotEmission.z` /
|
|
203
|
+
`DrawingEmission.z` with the same omit-when-`0` conditional spread used
|
|
204
|
+
for `xShift`. `z` is persisted **beside** the drawing slot's `state`
|
|
205
|
+
(never inside `DrawingState`), so an `update` retains the last value. A
|
|
206
|
+
no-`z` plot or drawing emits no `z` key — byte-identical to the
|
|
207
|
+
pre-feature baseline. `draw.table` / `draw.group` do not carry `z` in
|
|
208
|
+
v1.
|
|
209
|
+
|
|
210
|
+
Pine converter: `explicit_plot_zorder` is now a recognized no-op instead
|
|
211
|
+
of an unmapped warning. chartlang already layers marks by declaration
|
|
212
|
+
order within their group (the normative ordering contract), which is
|
|
213
|
+
exactly what Pine's `explicit_plot_zorder=true` makes authoritative — so
|
|
214
|
+
the flag is satisfied by default and needs no chartlang option.
|
|
215
|
+
`mapDeclarationArgs` no longer raises `indicator-arg-not-mapped` for it;
|
|
216
|
+
instead it emits a single `explicit-plot-zorder-default` info note
|
|
217
|
+
(covering both `explicit_plot_zorder=true` and the Pine-default
|
|
218
|
+
`=false`). The converter still never _emits_ a numeric `z` — Pine has no
|
|
219
|
+
per-element z source construct. Other unmapped `indicator(...)` args
|
|
220
|
+
(`timeframe`, etc.) keep warning.
|
|
221
|
+
|
|
222
|
+
Compiler: the ambient `@invinite-org/chartlang-core` `.d.ts` shim gains a
|
|
223
|
+
`ZOrdered { z?: number }` mixin intersected into `PlotOpts` and every
|
|
224
|
+
`draw.*` option type (mirroring core's `drawingStyle.ts`), so a compiled
|
|
225
|
+
script's `plot(value, { z })` **and** `draw.*(…, { z })` type-check (the
|
|
226
|
+
shim stays in lockstep with core).
|
|
227
|
+
|
|
228
|
+
Conformance: a new `z-order` scenario pins the plot `z` →
|
|
229
|
+
`PlotEmission.z` wire contract — a `plot(value, { z: -1 })` emits
|
|
230
|
+
`z: -1`, a no-`z` plot omits the field (omit-when-`0` byte-identity), and
|
|
231
|
+
a value-hash proves `z` never transforms the series. The `plot-field`
|
|
232
|
+
assertion's `field` union widens to also accept `"z"`.
|
|
233
|
+
|
|
234
|
+
- 073f41b: Add the higher-timeframe expression/callback overload to `request.security`.
|
|
235
|
+
Alongside the existing data form `request.security({ interval })` →
|
|
236
|
+
`SecurityBar`, scripts can now write `request.security({ interval }, (bar) =>
|
|
237
|
+
…)` → `Series<number>`, where the callback runs on the **higher-timeframe
|
|
238
|
+
clock** — `request.security({ interval: "1W" }, (bar) => ta.ema(bar.close, 20))`
|
|
239
|
+
is a true weekly EMA(20) (20 weekly bars), not 20 main bars of a weekly-stepped
|
|
240
|
+
series. The result is aligned no-lookahead down to the main timeline.
|
|
241
|
+
|
|
242
|
+
- **core** — the `SecurityExpr` callback type (re-exported from the package
|
|
243
|
+
root), the second `security` overload, and the shared `statefulPrimitives`
|
|
244
|
+
entry annotated as covering both arities.
|
|
245
|
+
- **compiler** — records one `SecurityExpressionDescriptor { slotId, interval,
|
|
246
|
+
paramName }` per expression callsite in `manifest.securityExpressions`
|
|
247
|
+
(sorted by `slotId`, omitted for the data-only form), and validates each
|
|
248
|
+
callback against the allowed subset — its `bar` parameter and body locals,
|
|
249
|
+
the ambient `ta` / `inputs`, safe `Math.*` globals, and literals — rejecting
|
|
250
|
+
any captured outer binding with the new
|
|
251
|
+
`request-security-expr-captures-local` diagnostic.
|
|
252
|
+
- **runtime** — mounts one `SecurityExprRunner` per manifest entry: the
|
|
253
|
+
callback is captured lazily on the first main compute, driven once per HTF bar
|
|
254
|
+
close through a dedicated fold `StreamState` so `ta.*` accumulate on the HTF
|
|
255
|
+
clock, and one sampled value per HTF bar feeds a per-slot output buffer that
|
|
256
|
+
`request.security(opts, expr)` returns aligned no-lookahead to the main
|
|
257
|
+
timeline. Capability / interval / stream fallbacks return an all-NaN series
|
|
258
|
+
with a deduped diagnostic.
|
|
259
|
+
- **host-worker / host-quickjs** — boot the expression form unchanged; the
|
|
260
|
+
`__manifest` sidecar already carries `securityExpressions`.
|
|
261
|
+
- **pine-converter** — Pine's `request.security(sym, "D", ta.ema(close, 9))`
|
|
262
|
+
now lowers to the chartlang callback form
|
|
263
|
+
`request.security({ interval: "1d" }, (bar) => ta.ema(bar.close, 9))` (a bare
|
|
264
|
+
OHLCV third arg keeps lowering to the data form).
|
|
265
|
+
- **conformance** — new scenarios prove the weekly expression value differs
|
|
266
|
+
from a same-length main-timeframe EMA, plus the `multiTimeframe: false` NaN
|
|
267
|
+
fallback.
|
|
268
|
+
|
|
269
|
+
- 5a9c24d: Add `state.series(init)` — a writable, indexable user series. Store an
|
|
270
|
+
arbitrary value each bar (`s.value = expr`) and read its history N bars
|
|
271
|
+
back (`s[1]`). Number-coercible (`+s`, `s.current`) and usable as a `ta.*`
|
|
272
|
+
source. The Pine converter lowers a history-indexed `var` to it.
|
|
273
|
+
- 08c536c: Add the `ta.highestbars` / `ta.lowestbars` primitives plus the cross-package
|
|
274
|
+
wiring that makes them usable as drawing anchors and Pine-converter targets.
|
|
275
|
+
|
|
276
|
+
- **core / runtime:** `ta.highestbars(source, length, opts?)` and
|
|
277
|
+
`ta.lowestbars(source, length, opts?)` return the bar OFFSET (≤ 0) to the
|
|
278
|
+
highest / lowest `source` value over the trailing `length` bars (window
|
|
279
|
+
INCLUDES the current bar). `0` → current bar is the extreme; `-k` → the
|
|
280
|
+
extreme occurred `k` bars ago. Ties resolve to the most recent bar; NaN
|
|
281
|
+
inputs are skipped; warmup is `length − 1` bars; tick-mode replays the
|
|
282
|
+
in-progress head as the offset-0 candidate. Registered in
|
|
283
|
+
`STATEFUL_PRIMITIVES` (now 174 entries) and `TA_REGISTRY` (now 96 entries).
|
|
284
|
+
- **compiler:** a literal-length `ta.highestbars` / `ta.lowestbars` call
|
|
285
|
+
contributes `length − 1` toward `maxLookback`, so the runtime sizes the time
|
|
286
|
+
ring buffer deep enough for a `bar.point(<that offset>, …)` anchor to resolve.
|
|
287
|
+
A non-literal length contributes 0.
|
|
288
|
+
- **pine-converter:** `ta.highestbars` / `ta.lowestbars` now map to the real
|
|
289
|
+
chartlang primitives (previously lossy passthroughs to `ta.highest` /
|
|
290
|
+
`ta.lowest`). **Behavior change:** a DYNAMIC `bar_index + <non-literal>`
|
|
291
|
+
drawing-x anchor no longer raises the hard `requires-bar-interval` error —
|
|
292
|
+
the offset is resolved by `bar.point` at runtime sign-agnostically (a
|
|
293
|
+
negative runtime offset, e.g. what `ta.highestbars` returns, resolves to the
|
|
294
|
+
historical timestamp via the time buffer). Only the literal `bar_index + N`
|
|
295
|
+
future case still requires a bar interval.
|
|
296
|
+
- **conformance:** new `TA_HIGHEST_LOWEST_BARS_SCENARIO` export pins both
|
|
297
|
+
primitives end-to-end through the compiler + runtime over the bundled
|
|
298
|
+
`goldenBars.json` fixture, and is added to `ALL_SCENARIOS`.
|
|
299
|
+
|
|
300
|
+
### Patch Changes
|
|
301
|
+
|
|
302
|
+
- Updated dependencies [850ae21]
|
|
303
|
+
- Updated dependencies [ca19e20]
|
|
304
|
+
- Updated dependencies [6235ad7]
|
|
305
|
+
- Updated dependencies [3bf391a]
|
|
306
|
+
- Updated dependencies [8086003]
|
|
307
|
+
- Updated dependencies [850ae21]
|
|
308
|
+
- Updated dependencies [073f41b]
|
|
309
|
+
- Updated dependencies [5a9c24d]
|
|
310
|
+
- Updated dependencies [08c536c]
|
|
311
|
+
- @invinite-org/chartlang-core@1.2.0
|
|
312
|
+
|
|
3
313
|
## 1.2.1
|
|
4
314
|
|
|
5
315
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractDependencyGraph.d.ts","sourceRoot":"","sources":["../../src/analysis/extractDependencyGraph.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjF,OAAO,EAAE,MAAM,YAAY,CAAC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E,eAAe,GACjC,QAAQ,CAsUV"}
|
|
@@ -70,7 +70,15 @@ function extractBindingOutputs(binding, sourceFile, checker, sourcePath, diagnos
|
|
|
70
70
|
const visit = (node) => {
|
|
71
71
|
if (ts.isCallExpression(node)) {
|
|
72
72
|
const callee = resolveCalleeName(node, checker);
|
|
73
|
-
|
|
73
|
+
// `bgcolor`/`barcolor` are plot-producing callees, so a binding
|
|
74
|
+
// that only paints a background still counts as "produces plots"
|
|
75
|
+
// (drives the `dep-output-not-titled` guard). Their `title` opt is
|
|
76
|
+
// a plot label, NOT a `.output()`-referenceable series-number, so
|
|
77
|
+
// they never add a titled output nor trip `duplicate-output-title`.
|
|
78
|
+
if (callee === "bgcolor" || callee === "barcolor") {
|
|
79
|
+
hasUntitledPlot = true;
|
|
80
|
+
}
|
|
81
|
+
else if (callee === "plot") {
|
|
74
82
|
const optsArg = node.arguments[1];
|
|
75
83
|
let title;
|
|
76
84
|
if (optsArg !== undefined && ts.isObjectLiteralExpression(optsArg)) {
|