8000 fix(build): update @nuxt/module-builder to 1.0.1 by mattmess1221 · Pull Request #362 · una-ui/una-ui · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix(build): update @nuxt/module-builder to 1.0.1 #362

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

Merged
merged 17 commits into from
May 1, 2025
Merged

Conversation

mattmess1221
Copy link
Collaborator
@mattmess1221 mattmess1221 commented Mar 24, 2025

This update fixes a bug that caused <script setup lang="ts"> SFCs to not be transformed during the build, so it would pass that work to the dev server.

Related upstream issues:

Note: Some components failed to generate .d.ts files without the @vue/runtime-core patches. This will need to be resolved upstream before merging. This has been fixed.

Summary by CodeRabbit

Summary by CodeRabbit

  • Chores
    • Updated module export settings and type definitions to fully embrace ES module standards by removing CommonJS entries.
    • Adjusted dependency versioning for increased flexibility, including support for newer TypeScript versions.
    • Introduced strict TypeScript configuration files to improve type-checking and module resolution across packages.
    • Enhanced type visibility by exporting key interface definitions for improved integration and usage.
    • Removed explicit CommonJS build emission from build configurations.

This update fixes a bug that caused <script setup> SFCs to not be transformed during the build.
@mattmess1221 mattmess1221 added c: bug 🐞 Something isn't working c: dependencies 📦 Pull requests that adds/updates a dependency c: performance 🏄‍♂️ Related to performance labels Mar 24, 2025
Copy link
vercel bot commented Mar 24, 2025

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

Name Status Preview Updated (UTC)
una-ui-docs ✅ Ready (Inspect) Visit Preview May 1, 2025 10:00pm

Copy link
coderabbitai bot commented Mar 24, 2025

Walkthrough

This pull request updates the configuration for several packages. In packages/nuxt/package.json, the exports have been modified by switching the TypeScript declaration file from a CommonJS format (.d.ts) to an ES module format (.d.mts), removing the require entry, and replacing the main property with a module property. The pnpm-workspace.yaml file now specifies updated dependency versions for @nuxt/module-builder and typescript. Additionally, new tsconfig.json files with similar TypeScript compiler options have been added to both the extractor-vue-script and preset packages. Several interfaces in packages/nuxt/src/runtime/types were changed from non-exported to exported, and an explicit TypeScript interface was added to ThemeSwitcher.vue for typing the useColorMode() return value. CommonJS export entries and main fields were removed from packages/extractor-vue-script and packages/preset package manifests. Rollup build configurations for extractor-vue-script and preset were updated to remove explicit CommonJS emission.

Changes

File(s) Change Summary
packages/nuxt/package.json Updated exports: changed types from ./dist/types.d.ts to ./dist/types.d.mts; removed "require" export entry; changed root-level "main" (./dist/module.cjs) to "module" (./dist/module.mjs); updated root "types" entry; removed typescript dependency.
pnpm-workspace.yaml Updated dependency versions: @nuxt/module-builder from ^0.8.4 to ^1.0.1; typescript from 5.6.3 to ^5.8.3.
packages/extractor-vue-script/tsconfig.json
packages/preset/tsconfig.json
Added new TypeScript configuration files with target set to "esnext", module set to "esnext", moduleResolution set to "bundler", and strict mode enabled.
packages/nuxt/src/runtime/components/misc/ThemeSwitcher.vue Added explicit ColorModeInstance interface and typed colorMode constant as ColorModeInstance for the result of useColorMode().
packages/nuxt/src/runtime/types/dropdown-menu.ts Changed NDropdownMenuUnaProps interface from non-exported to exported.
packages/nuxt/src/runtime/types/navigation-menu.ts Changed NNavigationMenuUnaProps interface from non-exported to exported.
packages/nuxt/src/runtime/types/pagination.ts Changed NPaginationUnaProps interface from non-exported to exported.
packages/nuxt/src/runtime/types/table.ts Changed NTableUnaProps interface from non-exported to exported.
packages/nuxt/src/runtime/types/tooltip.ts Changed NTooltipUnaProps interface from non-exported to exported.
packages/extractor-vue-script/build.config.ts Removed rollup.emitCJS option to stop emitting CommonJS modules explicitly.
packages/extractor-vue-script/package.json Removed "require" export entry and "main" field pointing to CommonJS build, leaving only ES module entries.
packages/preset/build.config.ts Removed rollup.emitCJS option to stop emitting CommonJS modules explicitly.
packages/preset/package.json Removed all "require" export entries and "main" field pointing to CommonJS builds, leaving only ES module entries.

Suggested reviewers

  • phojie

Poem

I’m a rabbit in a code garden so wide,
Hopping through updates on every side.
New modules and configs sprout like fresh spring blooms,
Dependencies updated to brighten the rooms.
With a twitch of my nose, I celebrate these tunes!
🐰🌸


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1576c63 and bab7f0e.

📒 Files selected for processing (4)
  • packages/extractor-vue-script/build.config.ts (0 hunks)
  • packages/extractor-vue-script/package.json (1 hunks)
  • packages/preset/build.config.ts (0 hunks)
  • packages/preset/package.json (1 hunks)
💤 Files with no reviewable changes (2)
  • packages/preset/build.config.ts
  • packages/extractor-vue-script/build.config.ts
✅ Files skipped from review due to trivial changes (2)
  • packages/extractor-vue-script/package.json
  • packages/preset/package.json
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Cloudflare Pages: play-una-ui
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of t 10000 he bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (4)
pnpm-workspace.yaml (1)

18-18: Clarify Pre-release Tag for @nuxt/module-builder
The dependency for @nuxt/module-builder is now specified as "alpha", which uses a pre-release tag. For better clarity and reproducibility, consider using an explicit version string (e.g., "1.0.0-alpha") if that is what is intended.

tsconfig.json (1)

2-7: Explicit Compiler Configuration in tsconfig.json
Removing the "extends" property and introducing explicit "compilerOptions" (with "module": "Preserve", "moduleResolution": "bundler", "strict": true, and "noEmit": true) creates a self-contained configuration. Verify that these settings fully capture the necessary compiler behavior from the previously inherited configuration. It might help to cross-check the old settings to avoid any unintended regressions.

packages/nuxt/package.json (2)

16-17: ES Module Export Changes
The update in the exports field now designates "types": "./dist/types.d.mts" and "import": "./dist/module.mjs". This aligns with the transition from CommonJS to ESM and the updated TypeScript declaration format. Consider adding documentation or migration notes for consumers that may depend on the legacy CommonJS entries.


33-34: Transition from "main" to "module"
Replacing the old "main" property with "module": "./dist/module.mjs" (and syncing the "types" field accordingly) reinforces the package’s commitment to ESM. Ensure that this breaking change is clearly communicated to end users who might be relying on the previous configuration.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7d6b5ef and 4db5b6b.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • packages/nuxt/package.json (2 hunks)
  • pnpm-workspace.yaml (2 hunks)
  • tsconfig.json (1 hunks)
🔇 Additional comments (1)
pnpm-workspace.yaml (1)

60-60: Updated TypeScript Version Range
The update for typescript to "^5.7.3" widens the version acceptance to include newer minor or patch releases. Please confirm that all project components are compatible with these updates and that this flexibility will not introduce unexpected breaking changes.

Copy link
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
tsconfig.json (1)

2-8: Explicit Compiler Options Set

The removal of the "extends" property and the introduction of an explicit "compilerOptions" block clearly signal a move toward a more self-contained configuration. The settings—"target": "ESNext", "module": "Preserve", and "moduleResolution": "bundler"—are oriented toward using modern JavaScript features and optimizing for your current build system (e.g., nuxt/module-builder). However, please ensure that:

  • These options align with your overall project requirements and do not omit any important shared configuration previously inherited.
  • Your build tooling (and any other integrated tools) fully supports "module": "Preserve" and "moduleResolution": "bundler".

Consider adding an inline comment documenting the rationale behind these changes to aid future maintainers.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4db5b6b and 9efb183.

📒 Files selected for processing (1)
  • tsconfig.json (1 hunks)

Copy link
cloudflare-workers-and-pages bot commented Apr 24, 2025

Deploying play-una-ui with  Cloudflare Pages  Cloudflare Pages

Latest commit: a9f8268
Status: ✅  Deploy successful!
Preview URL: https://88b95067.play-una-ui.pages.dev
Branch Preview URL: https://fix-precompile-sfcs.play-una-ui.pages.dev

View logs

@mattmess1221 mattmess1221 marked this pull request as ready for review April 24, 2025 18:13
@mattmess1221
Copy link
Collaborator Author

With the updated dependencies, all components can be compiled (+ .d.ts) without any dependency patches. However, generics are not being stripped from the script blocks.

I'd submit an upstream issue, but I can't figure out a reproduction. I also couldn't get it to strip the <script setup>, which is probably what I need to reproduce.

@mattmess1221 mattmess1221 changed the title fix(build): update @nuxt/module-builder to 1.0.0-alpha fix(build): update @nuxt/module-builder to 1.0.1 Apr 24, 2025
@una-ui una-ui deleted a comment from coderabbitai bot Apr 24, 2025
@mattmess1221
Copy link
Collaborator Author

Deduping dependencies appears to have fixed the generics issue.

@phojie phojie merged commit 94b4815 into main May 1, 2025
6 checks passed
@phojie phojie deleted the fix/precompile-sfcs branch May 1, 2025 22:09
@mattmess1221
Copy link
Collaborator Author

Random build failures are caused by nuxt-contrib/vue-sfc-transformer#40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: bug 🐞 Something isn't working c: dependencies 📦 Pull requests that adds/updates a dependency c: performance 🏄‍♂️ Related to performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0