()
| 19865 | // rootParser |
| 19866 | // Note: this is some so far unavoidable tricky code. We need to eval the transpiled JS, in a NodeJS or browser environment. |
| 19867 | _compileAndReturnRootParser() { |
| 19868 | if (this._cache_rootParser) return this._cache_rootParser |
| 19869 | if (!this.isNodeJs()) { |
| 19870 | this._cache_rootParser = Utils.appendCodeAndReturnValueOnWindow(this.toBrowserJavascript(), this.rootParserId).rootParser |
| 19871 | return this._cache_rootParser |
| 19872 | } |
| 19873 | const path = require("path") |
| 19874 | const code = this.toNodeJsJavascript(__dirname) |
| 19875 | try { |
| 19876 | const rootParticle = this._requireInVmNodeJsRootParser(code) |
| 19877 | this._cache_rootParser = rootParticle.rootParser |
| 19878 | if (!this._cache_rootParser) throw new Error(`Failed to rootParser`) |
| 19879 | } catch (err) { |
| 19880 | // todo: figure out best error pattern here for debugging |
| 19881 | console.log(err) |
| 19882 | // console.log(`Error in code: `) |
| 19883 | // console.log(new Particle(code).toStringWithLineNumbers()) |
| 19884 | } |
| 19885 | return this._cache_rootParser |
| 19886 | } |
| 19887 | get cuePath() { |
| 19888 | return "" |
| 19889 | } |
no test coverage detected