WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@just-boris
Copy link
Member

@just-boris just-boris commented Feb 1, 2025

Issue #, if available:

Notes

make this package a proper ESM module

  • added type: "module" (which requires .js extension everywhere)
  • enabled isolatedModules and verbatimModuleSyntax (require import type for all type imports)

Testing

Dry-runs: 7218081746, 7218084211


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov
Copy link

codecov bot commented Feb 1, 2025

Codecov Report

Attention: Patch coverage is 97.64706% with 2 lines in your changes missing coverage. Please review.

Project coverage is 97.38%. Comparing base (ef42b4e) to head (05f592a).

Files with missing lines Patch % Lines
src/build/index.ts 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #102      +/-   ##
==========================================
+ Coverage   96.30%   97.38%   +1.07%     
==========================================
  Files          46       46              
  Lines        2163     2138      -25     
  Branches      406      403       -3     
==========================================
- Hits         2083     2082       -1     
+ Misses         79       56      -23     
+ Partials        1        0       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

"lint-staged": "^12.5.0",
"loader-utils": "^3.2.1",
"lodash": "^4.17.21",
"merge": "^2.1.1",
Copy link
Member Author

Choose a reason for hiding this comment

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

Found an unused dependency while doing it

Comment on lines 20 to 29
'.': {
import: './build/index.js',
require: './build/index.cjs',
},
'./internal': {
import: './build/internal.js',
require: './build/internal.cjs',
},
Copy link
Member Author

Choose a reason for hiding this comment

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

Compatibility for require() use-case is still supported

Comment on lines 1 to 4
const buildThemedComponents = async (...args) => {
const esmAPI = await import('./index.js');
return esmAPI.buildThemedComponents(...args);
};
Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks to webdriverio for this idea how to support compatibility without code duplication:

https://github.com/webdriverio/webdriverio/blob/63ac0e07bef1ac9e9075bbef24bd9c9340085bdc/packages/webdriverio/src/index.cts#L114-L120

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.

1 participant