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

feat: add new package with vue extractor #1578

Merged
merged 3 commits into from
Apr 21, 2023

Conversation

j4hr3n
Copy link
Contributor

@j4hr3n j4hr3n commented Mar 31, 2023

Description

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Fixes # (issue)

Checklist

  • I have read the CONTRIBUTING and CODE_OF_CONDUCT docs
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@vercel
Copy link

vercel bot commented Mar 31, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
js-lingui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 21, 2023 10:10am

@github-actions
Copy link

github-actions bot commented Mar 31, 2023

size-limit report 📦

Path Size
./packages/core/dist/index.mjs 1.44 KB (0%)
./packages/detect-locale/dist/index.mjs 721 B (0%)
./packages/react/dist/index.mjs 1.6 KB (0%)
./packages/remote-loader/dist/index.mjs 7.24 KB (0%)

packages/extractor-vue/src/vue-extractor.ts Outdated Show resolved Hide resolved
packages/extractor-vue/src/vue-extractor.ts Outdated Show resolved Hide resolved
packages/extractor-vue/src/vue-extractor.ts Outdated Show resolved Hide resolved
packages/extractor-vue/package.json Outdated Show resolved Hide resolved
packages/extractor-vue/src/vue-extractor.ts Outdated Show resolved Hide resolved
.gitignore Outdated Show resolved Hide resolved
@j4hr3n j4hr3n force-pushed the feat/vue-extractor branch 2 times, most recently from bc10f9d to f1ec5c1 Compare March 31, 2023 11:49
@codecov
Copy link

codecov bot commented Mar 31, 2023

Codecov Report

Patch coverage: 81.81% and project coverage change: +0.13 🎉

Comparison is base (e160ebc) 75.40% compared to head (f1915c4) 75.53%.

❗ Current head f1915c4 differs from pull request most recent head 74dee23. Consider uploading reports for the commit 74dee23 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #1578      +/-   ##
==========================================
+ Coverage   75.40%   75.53%   +0.13%     
==========================================
  Files          76       77       +1     
  Lines        1980     1991      +11     
  Branches      518      520       +2     
==========================================
+ Hits         1493     1504      +11     
+ Misses        375      374       -1     
- Partials      112      113       +1     
Impacted Files Coverage Δ
packages/extractor-vue/src/vue-extractor.ts 81.81% <81.81%> (ø)

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

packages/extractor-vue/package.json Outdated Show resolved Hide resolved
packages/extractor-vue/package.json Outdated Show resolved Hide resolved
packages/extractor-vue/package.json Outdated Show resolved Hide resolved
packages/extractor-vue/src/__test__/extractor.test.ts Outdated Show resolved Hide resolved
packages/extractor-vue/src/utils/regex-extractor.ts Outdated Show resolved Hide resolved
packages/extractor-vue/pnpm-lock.yaml Outdated Show resolved Hide resolved
packages/extractor-vue/src/index.ts Outdated Show resolved Hide resolved
@j4hr3n
Copy link
Contributor Author

j4hr3n commented Apr 20, 2023

@andrii-bodnar website page has been added now

@andrii-bodnar andrii-bodnar linked an issue Apr 21, 2023 that may be closed by this pull request
@andrii-bodnar
Copy link
Contributor

@j4hr3n please address my latest comments and then this PR will be merged

@j4hr3n j4hr3n force-pushed the feat/vue-extractor branch from e9a287b to f1915c4 Compare April 21, 2023 10:05
@j4hr3n
Copy link
Contributor Author

j4hr3n commented Apr 21, 2023

@j4hr3n please address my latest comments and then this PR will be merged

@andrii-bodnar done

@andrii-bodnar andrii-bodnar merged commit b0e2211 into lingui:next Apr 21, 2023
@Touffy
Copy link
Contributor

Touffy commented Apr 26, 2023

I managed to make this work on a poorly-maintained Vue 2.6 project by fixing two things :

adding . default when importing the base extractor

const babel = require('@lingui/cli/api/extractors/babel').default;

and handling the case of an SFC with no <template>

    const compiledTemplate = descriptor.template && compilerSfc.compileTemplate({
      source: descriptor.template.content,
      filename,
      inMap: descriptor.template.map,
      id: filename
    });

@timofei-iatsenko
Copy link
Collaborator

@Touffy Would you like to create a PR with these changes and fixture for the case where template is not presented?

@Touffy
Copy link
Contributor

Touffy commented Apr 27, 2023

Sure.

@Touffy
Copy link
Contributor

Touffy commented Apr 27, 2023

#1623

I don't know how to change how the import is transpiled to require.

@timofei-iatsenko
Copy link
Collaborator

you don't have to, the default export is painful, depending on the consumer environment it will give different result.

If you consuming from pure ESM or using transpiling with interop and etc.

In a newer code i'm avoiding default exports as much as possible, but this extractor is being there for a long time.

So if with additional .default it works for you, just leave it as it is in your code. No other changes needed.

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.

Lingui with vue project as vanilla js docs
4 participants