Sure - so, like most TypeScript modules, the entry point for this one is just JavaScript - it includes extracted typings in a .ts file, but given that no JavaScript runtimes support TypeScript, it doesnāt point to TypeScript. That said, the file that its package.json points to uses CommonJS - you can decipher this y going to https://unpkg.com/@creditkarma/thrift-parser@1.0.4/, checking the path in package.json, and then clicking to the file mentioned.
What Iāve found that works for this one is using bundle.run, though Iām pointing it to 1.0.3 rather than 1.0.4 - bundle.run had trouble bundling the newest revision:
Sweet! Iām not well versed in JS packaging, so all these magical wrapper sites are like secret incantations. I love how easy it is to learn with Observable ā once you get a library loaded it is the quickest and easiest way to experiment.
Minor update for any folks struggling with requiring packages: I just wrote a module require debugger that, for many modules, will quickly identify a working strategy:
Thatās the hardest pattern! And the one I punted on for the initial notebook
But I just implemented it - the notebook now identifies the āglobal leaks patternā, and correctly guides you to a working strategy for propel, and for other modules that follow its pattern.
This appears more to be a webpack issue when packaging for node, such that the bundle requires tty (which is node, not on npm) and utils. I re-packaged for web, and now I can just use a vanilla require:
Ah, yeah - thatās another variant in which our exposing require actually handicaps the module requiring, due to how lib-r-math is packagedā¦ will have to meditate on how to detect / import that style, and whether that style of bundled module will crop up in the future.
I am trying to require the p5.dom library for p5.js ā e.g. using the version on cloudflare. I tried the module require debugger notebook, which suggests:
require('p5@0.6.1/lib/addons/p5.dom.js')
ā¦but this results in undefined in the Observable notebook. Adding .catch() => .catch(() => window.p5dom also results in undefined.
@tom ā does this look the same as the libR.js issue above, or is this a different issue?
Thatās another issue - p5.dom doesnāt expose anything, it only augments the p5 module. Hereās a notebook that requires it: https://beta.observablehq.com/d/8f3f7067f7d32421 and the relevant code: