feat: Support plugin, shortcode & helper files written in Typescript#170
feat: Support plugin, shortcode & helper files written in Typescript#170vhfmag wants to merge 1 commit intoElderjs:masterfrom
Conversation
|
This is great. I haven't written an Elder.js project in TS but I have a question. My initial though was to just have TS files output in a build directory, detect the build directory from the In my initial testing this worked. I setup the Contrast this to this PR which would allow Elder.js to consume TS directly. The thing I'm not clear on is when does the compilation happen? Is the user expected to run Maybe this is my naivety around TS. Any thoughts here? |
|
Here is a rough idea of how we were handling it in early versions before TS was dropped. Thinking about it further, couldn't the user just set their |
Firstly, thank y'all for this project. I had been daydreaming about something like partial hydration for quite a while, and to see this executed through the svelte ecosystem is a huge plus!
This PR has the same goals as #72: provide support for writing plugin, shortcode & helper files in Typescript.
To achieve that, I omitted the file extension when calling
requiredirectly, to be able to handle any extension that the environment supports. I also tried to userequire.resolvefor cases where the path had to be known (e.g. when passing a path tofs.existsSync), but since jest cannot mock it (as per jestjs/jest#9543), I had to recur to hardcoding.tsas a possible extension for those files.I got my own personal site to build with these changes, but I've just started migrating it to elder.js, so tests with larger codebases would be nice before considering merging.