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

chore(headless,atomic): add type "module" to atomic, atomic-react and headless #4442

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

louis-bompart
Copy link
Collaborator

@louis-bompart louis-bompart commented Sep 19, 2024

https://coveord.atlassian.net/browse/KIT-3580

Publint status

  • atomic : no errors
  • headless: no errors
  • atomic-react: no errors

Are the types wrong status

  • atomic : errors Internal resolution in node16 (Do we need to address this ?) + cjs type warnings
  • headless: errors Internal resolution in node16 (addressed here) + cjs type warnings
  • atomic-react: cjs type warnings

Comment on lines -13 to -18
"es2015": "dist/esm/index.mjs",
"es2017": "dist/esm/index.mjs",
"types": "dist/types/index.d.ts",
"collection": "collection-manifest.json",
"collection:main": "dist/index.js",
"unpkg": "dist/atomic/atomic.esm.js",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Clean up non-standard.

@@ -66,7 +85,7 @@
"devDependencies": {
"@axe-core/playwright": "4.9.1",
"@babel/core": "7.24.9",
"@coveo/atomic": "file:.",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We don't want to have the storybook utils in our "official" exports, so let's tweak this like so

Copy link

github-actions bot commented Sep 19, 2024

Pull Request Report

PR Title

✅ Title follows the conventional commit spec.

Live demo links

Bundle Size

File Old (kb) New (kb) Change (%)
case-assist 239.2 239.2 0
commerce 338 338 0
search 407.7 407.7 0
insight 392.7 392.7 0
recommendation 250 250.1 0
ssr 401.6 401.6 0
ssr-commerce 350.2 350.2 0

SSR Progress

Use case SSR (#) CSR (#) Progress (%)
search 39 44 89
recommendation 0 4 0
case-assist 0 6 0
insight 0 27 0
commerce 0 15 0
Detailed logs search : buildInteractiveResult
search : buildInteractiveInstantResult
search : buildInteractiveRecentResult
search : buildInteractiveCitation
search : buildGeneratedAnswer
recommendation : missing SSR support
case-assist : missing SSR support
insight : missing SSR support
commerce : missing SSR support

Copy link
Contributor

@alexprudhomme alexprudhomme left a comment

Choose a reason for hiding this comment

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

Great, working on a patch that fixes error for atomic/headless/atomic-react on these tools.

publint.dev
arethetypeswrong

packages/atomic/.storybook/main.mts Outdated Show resolved Hide resolved
packages/headless/doc-parser/package.json Show resolved Hide resolved
Co-authored-by: Alex Prudhomme <78121423+alexprudhomme@users.noreply.github.com>
All errors are fixed.

Warnings left that I cant fix : 
1. The types errors for commonJS are not urgent
2. I can't find how to tell stencil to generate commonjs files as .cjs
instead of .js

```
 npx publint ./node_modules/@coveo/atomic-react
@coveo/atomic-react lint results:
Warnings:
1. pkg.exports["."].types types is interpreted as ESM when resolving with the "require" condition. This causes the types to only work when dynamically importing the package, even though the package exports CJS. Consider splitting out two "types" conditions for "import" and "require", and use the .cts extension, e.g. pkg.exports["."].require.types: "./dist/index.d.cts"


 npx publint ./node_modules/@coveo/atomic
@coveo/atomic lint results:
Warnings:
1. pkg.main is dist/index.cjs.js and is written in CJS, but is interpreted as ESM. Consider using the .cjs extension, e.g. dist/index.cjs.cjs
3. pkg.exports["."].require is ./dist/index.cjs.js and is written in CJS, but is interpreted as ESM. Consider using the .cjs extension, e.g. ./dist/index.cjs.cjs
4. pkg.exports["."].types types is interpreted as ESM when resolving with the "require" condition. This causes the types to only work when dynamically importing the package, even though the package exports CJS. Consider splitting out two "types" conditions for "import" and "require", and use the .cts extension, e.g. pkg.exports["."].require.types: "./dist/types/index.d.cts"
5. pkg.exports["./loader"].import is ./loader/index.js and is written in ESM, but is interpreted as CJS. Consider using the .mjs extension, e.g. ./loader/index.mjs


npx publint ./node_modules/@coveo/headless
@coveo/headless lint results:
Warnings:
1. pkg.exports["."].types types is interpreted as ESM when resolving with the "require" condition. This causes the types to only work when dynamically importing the package, even though the package exports CJS. Consider splitting out two "types" conditions for "import" and "require", and use the .cts extension, e.g. pkg.exports["."].require.types: "./dist/definitions/index.d.cts"
```
@alexprudhomme alexprudhomme changed the title type module everywhere chore(headless,atomic): add type "module" to atomic, atomic-react and headless Sep 20, 2024
@alexprudhomme alexprudhomme marked this pull request as ready for review September 20, 2024 16:23
@alexprudhomme alexprudhomme requested review from a team as code owners September 20, 2024 16:23
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.

3 participants