oakscriptjs 0.13.2 → 0.14.1

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.
Files changed (119) hide show
  1. package/AGENTS.md +6 -1
  2. package/README.md +1 -1
  3. package/bin/oakscript.mjs +5 -0
  4. package/dist/cjs/check/checks.d.ts +78 -0
  5. package/dist/cjs/check/checks.d.ts.map +1 -0
  6. package/dist/cjs/check/checks.js +109 -0
  7. package/dist/cjs/check/checks.js.map +7 -0
  8. package/dist/cjs/check/format.d.ts +26 -0
  9. package/dist/cjs/check/format.d.ts.map +1 -0
  10. package/dist/cjs/check/format.js +106 -0
  11. package/dist/cjs/check/format.js.map +7 -0
  12. package/dist/cjs/check/harness.d.ts +94 -0
  13. package/dist/cjs/check/harness.d.ts.map +1 -0
  14. package/dist/cjs/check/harness.js +302 -0
  15. package/dist/cjs/check/harness.js.map +7 -0
  16. package/dist/cjs/check/index.d.ts +253 -0
  17. package/dist/cjs/check/index.d.ts.map +1 -0
  18. package/dist/cjs/check/index.js +466 -0
  19. package/dist/cjs/check/index.js.map +7 -0
  20. package/dist/cjs/check/node.d.ts +53 -0
  21. package/dist/cjs/check/node.d.ts.map +1 -0
  22. package/dist/cjs/check/node.js +318 -0
  23. package/dist/cjs/check/node.js.map +7 -0
  24. package/dist/cjs/check/spec.d.ts +44 -0
  25. package/dist/cjs/check/spec.d.ts.map +1 -0
  26. package/dist/cjs/check/spec.js +199 -0
  27. package/dist/cjs/check/spec.js.map +7 -0
  28. package/dist/cjs/index.d.ts +1 -1
  29. package/dist/cjs/index.js +1 -1
  30. package/dist/cjs/index.js.map +1 -1
  31. package/dist/cjs/runtime/series.d.ts +6 -0
  32. package/dist/cjs/runtime/series.d.ts.map +1 -1
  33. package/dist/cjs/runtime/series.js +15 -0
  34. package/dist/cjs/runtime/series.js.map +2 -2
  35. package/dist/cjs/script/constants.d.ts +200 -0
  36. package/dist/cjs/script/constants.d.ts.map +1 -0
  37. package/dist/cjs/script/constants.js +217 -0
  38. package/dist/cjs/script/constants.js.map +7 -0
  39. package/dist/cjs/script/drawing-args.d.ts +25 -0
  40. package/dist/cjs/script/drawing-args.d.ts.map +1 -0
  41. package/dist/cjs/script/drawing-args.js +203 -0
  42. package/dist/cjs/script/drawing-args.js.map +7 -0
  43. package/dist/cjs/script/globals.d.ts +127 -0
  44. package/dist/cjs/script/globals.d.ts.map +1 -0
  45. package/dist/cjs/script/globals.js +17 -0
  46. package/dist/cjs/script/globals.js.map +7 -0
  47. package/dist/cjs/script/index.d.ts +504 -166
  48. package/dist/cjs/script/index.d.ts.map +1 -1
  49. package/dist/cjs/script/index.js +236 -96
  50. package/dist/cjs/script/index.js.map +3 -3
  51. package/dist/esm/check/checks.d.ts +78 -0
  52. package/dist/esm/check/checks.d.ts.map +1 -0
  53. package/dist/esm/check/checks.js +95 -0
  54. package/dist/esm/check/checks.js.map +1 -0
  55. package/dist/esm/check/format.d.ts +26 -0
  56. package/dist/esm/check/format.d.ts.map +1 -0
  57. package/dist/esm/check/format.js +105 -0
  58. package/dist/esm/check/format.js.map +1 -0
  59. package/dist/esm/check/harness.d.ts +94 -0
  60. package/dist/esm/check/harness.d.ts.map +1 -0
  61. package/dist/esm/check/harness.js +317 -0
  62. package/dist/esm/check/harness.js.map +1 -0
  63. package/dist/esm/check/index.d.ts +253 -0
  64. package/dist/esm/check/index.d.ts.map +1 -0
  65. package/dist/esm/check/index.js +470 -0
  66. package/dist/esm/check/index.js.map +1 -0
  67. package/dist/esm/check/node.d.ts +53 -0
  68. package/dist/esm/check/node.d.ts.map +1 -0
  69. package/dist/esm/check/node.js +347 -0
  70. package/dist/esm/check/node.js.map +1 -0
  71. package/dist/esm/check/spec.d.ts +44 -0
  72. package/dist/esm/check/spec.d.ts.map +1 -0
  73. package/dist/esm/check/spec.js +198 -0
  74. package/dist/esm/check/spec.js.map +1 -0
  75. package/dist/esm/index.d.ts +1 -1
  76. package/dist/esm/index.js +1 -1
  77. package/dist/esm/runtime/series.d.ts +6 -0
  78. package/dist/esm/runtime/series.d.ts.map +1 -1
  79. package/dist/esm/runtime/series.js +14 -0
  80. package/dist/esm/runtime/series.js.map +1 -1
  81. package/dist/esm/script/constants.d.ts +200 -0
  82. package/dist/esm/script/constants.d.ts.map +1 -0
  83. package/dist/esm/script/constants.js +151 -0
  84. package/dist/esm/script/constants.js.map +1 -0
  85. package/dist/esm/script/drawing-args.d.ts +25 -0
  86. package/dist/esm/script/drawing-args.d.ts.map +1 -0
  87. package/dist/esm/script/drawing-args.js +171 -0
  88. package/dist/esm/script/drawing-args.js.map +1 -0
  89. package/dist/esm/script/globals.d.ts +127 -0
  90. package/dist/esm/script/globals.d.ts.map +1 -0
  91. package/dist/esm/script/globals.js +28 -0
  92. package/dist/esm/script/globals.js.map +1 -0
  93. package/dist/esm/script/index.d.ts +504 -166
  94. package/dist/esm/script/index.d.ts.map +1 -1
  95. package/dist/esm/script/index.js +256 -83
  96. package/dist/esm/script/index.js.map +1 -1
  97. package/package.json +31 -1
  98. package/skills/oakscript/SKILL.md +62 -26
  99. package/skills/oakscript/examples/ma-cross.js +2 -2
  100. package/skills/oakscript/examples/mtf-trend-filter.js +3 -3
  101. package/skills/oakscript/reference/check.md +150 -0
  102. package/skills/oakscript/reference/errors.md +31 -7
  103. package/skills/oakscript/reference/pine-differences.md +17 -16
  104. package/skills/oakscript/reference/plotting.md +25 -19
  105. package/skills/oakscript/reference/script-structure.md +34 -17
  106. package/skills/oakscript/reference/timeframes-symbols.md +5 -1
  107. package/skills/oakscript/spec.schema.json +199 -0
  108. package/src/check/checks.ts +175 -0
  109. package/src/check/format.ts +117 -0
  110. package/src/check/harness.ts +372 -0
  111. package/src/check/index.ts +708 -0
  112. package/src/check/node.ts +368 -0
  113. package/src/check/spec.ts +200 -0
  114. package/src/index.ts +1 -1
  115. package/src/runtime/series.ts +19 -0
  116. package/src/script/constants.ts +169 -0
  117. package/src/script/drawing-args.ts +179 -0
  118. package/src/script/globals.ts +129 -0
  119. package/src/script/index.ts +462 -81
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var globals_exports = {};
16
+ module.exports = __toCommonJS(globals_exports);
17
+ //# sourceMappingURL=globals.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/script/globals.ts"],
4
+ "sourcesContent": ["/**\n * @fileoverview Type declarations of the script globals, for type-checking a script source (plain JavaScript)\n * before it runs. A script body uses every value export of `oakscriptjs/script` but `executeScript` (the host\n * entry) as a global; these declarations give each global its type, so the TypeScript checker reports the\n * mistakes of a script with their line: `close - open` (operators on a Series), a misspelt name (`ta.smaa`), a\n * wrong argument or option, a bad shape or style string.\n *\n * In a project that runs scripts, a `tsconfig.json` next to the scripts, then `npx tsc -p .`:\n *\n * ```json\n * {\n * \"compilerOptions\": {\n * \"allowJs\": true, \"checkJs\": true, \"noEmit\": true, \"strict\": true, \"noImplicitAny\": false,\n * \"target\": \"ES2022\", \"module\": \"ESNext\", \"moduleResolution\": \"bundler\", \"moduleDetection\": \"force\",\n * \"lib\": [\"ES2022\"], \"types\": [\"oakscriptjs/script/globals\"]\n * },\n * \"include\": [\"*.js\"]\n * }\n * ```\n *\n * - `lib` leaves out `DOM`: its `open`, `close` and `alert` are other globals.\n * - `moduleDetection: \"force\"`: each script has its own top-level names (a script has no import or export).\n * - `noImplicitAny: false`: the parameters of a script's own functions have no types (plain JavaScript).\n *\n * @module script/globals\n */\n\nimport type * as S from './index.js';\n\ndeclare global {\n const executeIntrabar: typeof S.executeIntrabar;\n const varip: typeof S.varip;\n const indicator: typeof S.indicator;\n const fixnan: typeof S.fixnan;\n const fill: typeof S.fill;\n const plotshape: typeof S.plotshape;\n const plotchar: typeof S.plotchar;\n const plotarrow: typeof S.plotarrow;\n const bgcolor: typeof S.bgcolor;\n const barcolor: typeof S.barcolor;\n const plotcandle: typeof S.plotcandle;\n const plotbar: typeof S.plotbar;\n const eachBar: typeof S.eachBar;\n const timestamp: typeof S.timestamp;\n const inSession: typeof S.inSession;\n const seriesOf: typeof S.seriesOf;\n const alertcondition: typeof S.alertcondition;\n const holdDrawing: typeof S.holdDrawing;\n const releaseDrawing: typeof S.releaseDrawing;\n const varDrawing: typeof S.varDrawing;\n const StrategyRecorder: typeof S.StrategyRecorder;\n const input: typeof S.input;\n const open: typeof S.open;\n const high: typeof S.high;\n const low: typeof S.low;\n const close: typeof S.close;\n const volume: typeof S.volume;\n const hl2: typeof S.hl2;\n const hlc3: typeof S.hlc3;\n const ohlc4: typeof S.ohlc4;\n const hlcc4: typeof S.hlcc4;\n const ta: typeof S.ta;\n const color: typeof S.color;\n const DEFAULT_OUTPUT_TITLES: typeof S.DEFAULT_OUTPUT_TITLES;\n const plot: typeof S.plot;\n const hline: typeof S.hline;\n const DEFAULT_CANDLE_COLORS: typeof S.DEFAULT_CANDLE_COLORS;\n const strategy: typeof S.strategy;\n const MissingSymbolDataError: typeof S.MissingSymbolDataError;\n const timeframe: typeof S.timeframe;\n const syminfo: typeof S.syminfo;\n const year: typeof S.year;\n const month: typeof S.month;\n const weekofyear: typeof S.weekofyear;\n const dayofmonth: typeof S.dayofmonth;\n const dayofweek: typeof S.dayofweek;\n const hour: typeof S.hour;\n const minute: typeof S.minute;\n const second: typeof S.second;\n const str: typeof S.str;\n const timenow: typeof S.timenow;\n const time: typeof S.time;\n const time_close: typeof S.time_close;\n const time_tradingday: typeof S.time_tradingday;\n const barstate: typeof S.barstate;\n const session: typeof S.session;\n const barmerge: typeof S.barmerge;\n const ticker: typeof S.ticker;\n const request: typeof S.request;\n const line: typeof S.line;\n const label: typeof S.label;\n const box: typeof S.box;\n const linefill: typeof S.linefill;\n const polyline: typeof S.polyline;\n const table: typeof S.table;\n const position: typeof S.position;\n const text: typeof S.text;\n const chart: typeof S.chart;\n const alert: typeof S.alert;\n const Series: typeof S.Series;\n const BarData: typeof S.BarData;\n const na: typeof S.na;\n const nz: typeof S.nz;\n const STRATEGY_DEFAULTS: typeof S.STRATEGY_DEFAULTS;\n const math: typeof S.math;\n const bar_index: typeof S.bar_index;\n const last_bar_index: typeof S.last_bar_index;\n const shape: typeof S.shape;\n const location: typeof S.location;\n const size: typeof S.size;\n const xloc: typeof S.xloc;\n const yloc: typeof S.yloc;\n const extend: typeof S.extend;\n const display: typeof S.display;\n const format: typeof S.format;\n const font: typeof S.font;\n const scale: typeof S.scale;\n const order: typeof S.order;\n const currency: typeof S.currency;\n const adjustment: typeof S.adjustment;\n const compare: typeof S.compare;\n const isInputActive: typeof S.isInputActive;\n /** A Series of the script (`close`, the result of `ta.*`...), for JSDoc types: `@type {Series}`. */\n type Series = S.Series;\n /** The bar handed to an `eachBar()` callback, for JSDoc types. */\n type BarContext = S.BarContext;\n}\n\nexport {};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
6
+ "names": []
7
+ }