-
Notifications
You must be signed in to change notification settings - Fork 15
feat: use jiti for plugin loading #1228
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
base: main
Are you sure you want to change the base?
Conversation
|
View your CI Pipeline Execution ↗ for commit d5125c3
☁️ Nx Cloud last updated this comment at |
|
View your CI Pipeline Execution ↗ for commit bbd8648 ☁️ Nx Cloud last updated this comment at |
@code-pushup/ci
@code-pushup/cli
@code-pushup/core
@code-pushup/create-cli
@code-pushup/models
@code-pushup/nx-plugin
@code-pushup/axe-plugin
@code-pushup/coverage-plugin
@code-pushup/eslint-plugin
@code-pushup/js-packages-plugin
@code-pushup/jsdocs-plugin
@code-pushup/lighthouse-plugin
@code-pushup/typescript-plugin
@code-pushup/utils
commit: |
Code PushUp🤨 Code PushUp report has both improvements and regressions – compared current commit 21d64a2 with previous commit d3230f1. 🕵️ See full comparison in Code PushUp portal 🔍 🏷️ Categories👍 2 groups improved, 👎 3 groups regressed, 👍 6 audits improved, 👎 6 audits regressed, 16 audits changed without impacting score🗃️ Groups
29 other groups are unchanged. 🛡️ Audits
651 other audits are unchanged. |
| const jitiInstance = await createTsJiti(import.meta.url, { | ||
| ...jitiOptions, | ||
| tsconfigPath: tsconfig, | ||
| }); | ||
|
|
||
| return (await jitiInstance.import(absoluteFilePath, { default: true })) as T; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's important to review in terms of path resolution.
Another option here would be to use
const jitiInstance = await createTsJiti(process.cwd(), {
...jitiOptions,
tsconfigPath: tsconfig,
});My reading told be using import.meta.url is more robust but where calling CLI it doent feel "natural" as you can't just pass relative paths. I resolved to path so the only edge case I found where usinf absolute path was in the print config e2e test.
Closes #1226
This PR includes switches from
bundleRequiretojiti. It includes:jitiwrapper code to resolve TS config paths and forward to jitiimportModulegot refactored to usejitijiti-tsclib to execute local sourcecodeErrors:
window.documentthrough 'axe-core' importError reproduction:
node --input-type=module -e "import('jiti').then(j=>j.default()( 'axe-core'))"The following is here just to make it working and will get refactored if the PR is interesting:
axe(accessdocumentas sinde effect)Related: https://github.com/push-based/ts-jiti