@backtest-kit/cli 3.4.1 → 3.4.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/build/index.cjs CHANGED
@@ -240,10 +240,10 @@ const entrySubject = new functoolsKit.BehaviorSubject();
240
240
 
241
241
  const __filename$2 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
242
242
  const __dirname$2 = path.dirname(__filename$2);
243
- const require$3 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
243
+ const require$2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
244
244
  const REQUIRE_ENTRY_FACTORY = (filePath) => {
245
245
  try {
246
- require$3(filePath);
246
+ require$2(filePath);
247
247
  return true;
248
248
  }
249
249
  catch {
@@ -1634,7 +1634,7 @@ class TelegramTemplateService {
1634
1634
  }
1635
1635
  }
1636
1636
 
1637
- const require$2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
1637
+ const require$1 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
1638
1638
  const getExtVariants = (fileName) => {
1639
1639
  const ext = path.extname(fileName);
1640
1640
  const base = ext ? fileName.slice(0, -ext.length) : fileName;
@@ -1650,7 +1650,7 @@ const getExtVariants = (fileName) => {
1650
1650
  const REQUIRE_MODULE_FACTORY = (fileName) => {
1651
1651
  for (const variant of getExtVariants(fileName)) {
1652
1652
  try {
1653
- return require$2(variant);
1653
+ return require$1(variant);
1654
1654
  }
1655
1655
  catch {
1656
1656
  continue;
@@ -1899,7 +1899,6 @@ class LiveProviderService {
1899
1899
  }
1900
1900
 
1901
1901
  standalone.registerPlugin("plugin-transform-modules-umd", pluginUMD);
1902
- const require$1 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
1903
1902
  const __filename$1 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
1904
1903
  const __dirname$1 = path.dirname(__filename$1);
1905
1904
  const BacktestKitCli = new Proxy({}, {
@@ -1910,6 +1909,7 @@ const BacktestKitCli = new Proxy({}, {
1910
1909
  class BabelService {
1911
1910
  constructor() {
1912
1911
  this.loggerService = inject(TYPES.loggerService);
1912
+ this._require = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
1913
1913
  this.transpile = (code) => {
1914
1914
  this.loggerService.log("babelService transpile", { codeLen: code.length });
1915
1915
  const { values } = getArgs();
@@ -1917,14 +1917,15 @@ class BabelService {
1917
1917
  filename: "index.ts",
1918
1918
  presets: ["env", "typescript"],
1919
1919
  plugins: [
1920
- "plugin-transform-modules-umd",
1921
- {
1922
- globals: {
1923
- "backtest-kit": "BacktestKit",
1924
- "@backtest-kit/cli": "BacktestKitCli",
1920
+ [
1921
+ "plugin-transform-modules-umd",
1922
+ {
1923
+ globals: {
1924
+ "backtest-kit": "BacktestKit",
1925
+ },
1926
+ moduleId: "Executor",
1925
1927
  },
1926
- moduleId: "Executor",
1927
- },
1928
+ ],
1928
1929
  ],
1929
1930
  parserOpts: { strictMode: false },
1930
1931
  });
@@ -1942,9 +1943,18 @@ class BabelService {
1942
1943
  });
1943
1944
  const module = { exports: {} };
1944
1945
  const exports = module.exports;
1946
+ const require = (id) => {
1947
+ if (id === "backtest-kit") {
1948
+ return globalThis.BacktestKit;
1949
+ }
1950
+ if (id === "@backtest-kit/cli") {
1951
+ return globalThis.BacktestKitCli;
1952
+ }
1953
+ return this._require(id);
1954
+ };
1945
1955
  eval(this.transpile(code));
1946
1956
  return {
1947
- require: require$1,
1957
+ require,
1948
1958
  __filename: __filename$1,
1949
1959
  __dirname: __dirname$1,
1950
1960
  exports,
package/build/index.mjs CHANGED
@@ -1877,7 +1877,6 @@ class LiveProviderService {
1877
1877
  }
1878
1878
 
1879
1879
  registerPlugin("plugin-transform-modules-umd", pluginUMD);
1880
- const require = createRequire(import.meta.url);
1881
1880
  const __filename = fileURLToPath(import.meta.url);
1882
1881
  const __dirname = path.dirname(__filename);
1883
1882
  const BacktestKitCli = new Proxy({}, {
@@ -1888,6 +1887,7 @@ const BacktestKitCli = new Proxy({}, {
1888
1887
  class BabelService {
1889
1888
  constructor() {
1890
1889
  this.loggerService = inject(TYPES.loggerService);
1890
+ this._require = createRequire(import.meta.url);
1891
1891
  this.transpile = (code) => {
1892
1892
  this.loggerService.log("babelService transpile", { codeLen: code.length });
1893
1893
  const { values } = getArgs();
@@ -1895,14 +1895,15 @@ class BabelService {
1895
1895
  filename: "index.ts",
1896
1896
  presets: ["env", "typescript"],
1897
1897
  plugins: [
1898
- "plugin-transform-modules-umd",
1899
- {
1900
- globals: {
1901
- "backtest-kit": "BacktestKit",
1902
- "@backtest-kit/cli": "BacktestKitCli",
1898
+ [
1899
+ "plugin-transform-modules-umd",
1900
+ {
1901
+ globals: {
1902
+ "backtest-kit": "BacktestKit",
1903
+ },
1904
+ moduleId: "Executor",
1903
1905
  },
1904
- moduleId: "Executor",
1905
- },
1906
+ ],
1906
1907
  ],
1907
1908
  parserOpts: { strictMode: false },
1908
1909
  });
@@ -1920,6 +1921,15 @@ class BabelService {
1920
1921
  });
1921
1922
  const module = { exports: {} };
1922
1923
  const exports = module.exports;
1924
+ const require = (id) => {
1925
+ if (id === "backtest-kit") {
1926
+ return globalThis.BacktestKit;
1927
+ }
1928
+ if (id === "@backtest-kit/cli") {
1929
+ return globalThis.BacktestKitCli;
1930
+ }
1931
+ return this._require(id);
1932
+ };
1923
1933
  eval(this.transpile(code));
1924
1934
  return {
1925
1935
  require,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backtest-kit/cli",
3
- "version": "3.4.1",
3
+ "version": "3.4.2",
4
4
  "description": "Zero-boilerplate CLI runner for backtest-kit strategies. Run backtests, paper trading, and live bots with candle cache warming, web dashboard, and Telegram notifications — no setup code required.",
5
5
  "author": {
6
6
  "name": "Petr Tripolsky",
package/types.d.ts CHANGED
@@ -95,9 +95,10 @@ declare global {
95
95
  }
96
96
  declare class BabelService {
97
97
  readonly loggerService: LoggerService;
98
+ readonly _require: NodeRequire;
98
99
  transpile: (code: string) => any;
99
100
  transpileAndRun: (code: string) => {
100
- require: NodeRequire;
101
+ require: (id: string) => any;
101
102
  __filename: string;
102
103
  __dirname: string;
103
104
  exports: Record<string, unknown>;