Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

template-tag code mod #1842

Draft
wants to merge 9 commits into
base: stable
Choose a base branch
from
Draft

template-tag code mod #1842

wants to merge 9 commits into from

Conversation

void-mAlex
Copy link
Collaborator

still WIP but sharing for progress tracking/early feedback
compatBuild alternative for running an app code through embroider… to get gjs/gts files

//ember-cli-build.js

const { templateTagCode } = require('@embroider/compat');

-return compatBuild(app, Webpack, opts);
+return templateTagCode(app, {shouldTransformPath: (component_path) => true});

builds upon base branch to get correct importable paths for 'builtIn' helpers/modifiers/components

@mansona mansona force-pushed the emit-imports-for-known-built-ins branch 3 times, most recently from 213f90f to 8bde7b9 Compare April 2, 2024 15:55
@ef4
Copy link
Contributor

ef4 commented Apr 2, 2024

Generally has the right shape.

It would be good not to need to know about the structure of #embroider_compat/ imports. Ideally all imports would be passed to the resolver to decide what to do with and based on the output path discovered the codemod would decide to inline that result or leave it unresolved.

Base automatically changed from emit-imports-for-known-built-ins to stable April 2, 2024 17:43
Copy link
Member

@mansona mansona left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is still draft but we tried it on a reasonably large app and came up with a few problems 🙈 I'll list them here but please ignore if you're not in the mode for feedback 👍

  • there are a few places where you're using __dirname to find the embroider build but it should be using process.cwd()
  • this whole system seems to break if you have a babel config file (i.e. for a vite run) so we need to figure out the babel config setup for running files
  • if you have a basic babel config file with just a typescript plugin this process fails because it needs to parse your app using your app's babel config e.g. ember-concurrency transform. We probably need to use the same process that embroider uses to load the config
  • we're missing an export from @embroider/compat
  • babel-plugin-ember-template-comilation is being looked for relative to the app rather than relative to @embroider/compat so we probably need to find it using require.resolve before passing it to babel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants