prettier-plugin-embed icon indicating copy to clipboard operation
prettier-plugin-embed copied to clipboard

fix: add extensions to relative path import specifiers

Open Sec-ant opened this issue 10 months ago • 3 comments

Attemp to fix #147

Summary by CodeRabbit

  • New Features

    • Introduced an enhancement patch that refines advanced configuration support.
  • Chores

    • Updated module import paths across numerous language integrations to explicitly include file extensions. This change improves compatibility and ensures consistent module resolution.
    • Adjusted test imports to align with the updated module structure.

Sec-ant avatar Mar 03 '25 16:03 Sec-ant

🦋 Changeset detected

Latest commit: 4766d54971e58d5cf1d2addd19799ac431d1bfc2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
prettier-plugin-embed Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Mar 03 '25 16:03 changeset-bot[bot]

Walkthrough

This pull request introduces a new patch file for the prettier-plugin-embed and updates various import statements across the project. The new file adds extensions to relative path import specifiers. In multiple embedded files as well as in utility and type definition files, import statements for modules from the Prettier library have been updated from "prettier/doc" to "prettier/doc.js". Additionally, a test file now imports an explicit file (index.js) rather than a directory. These changes adjust the module resolution without altering the existing code logic or control flow.

Changes

File(s) Change Summary
.changeset/pink-nails-reply.md New file added with a patch for prettier-plugin-embed, introducing extensions to relative path import specifiers.
src/embedded/.../embedder.ts, src/embedded/utils.ts, src/types.ts, src/utils.ts Updated import statements to use explicit .js extension (e.g., changed from "prettier/doc" to "prettier/doc.js").
tests/fixtures.spec.ts Modified import for the embed module from ../src to ../src/index.js, specifying the file explicitly.

Poem

I'm a rabbit hopping with delight,
On paths now clear as day and night.
With .js tags in every line,
My code garden's looking simply divine.
Updated imports make my ears perk high—
Hoppy changes, oh me, oh my! 🐰


📜 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 488a11218e6315c68e971f3585c012f7c2ac39b0 and 4766d54971e58d5cf1d2addd19799ac431d1bfc2.

📒 Files selected for processing (29)
  • .changeset/pink-nails-reply.md (1 hunks)
  • src/embedded/css/embedder.ts (1 hunks)
  • src/embedded/es/embedder.ts (1 hunks)
  • src/embedded/glsl/embedder.ts (1 hunks)
  • src/embedded/graphql/embedder.ts (1 hunks)
  • src/embedded/html/embedder.ts (1 hunks)
  • src/embedded/ini/embedder.ts (1 hunks)
  • src/embedded/java/embedder.ts (1 hunks)
  • src/embedded/json/embedder.ts (1 hunks)
  • src/embedded/jsonata/embedder.ts (1 hunks)
  • src/embedded/latex/embedder.ts (1 hunks)
  • src/embedded/markdown/embedder.ts (1 hunks)
  • src/embedded/nginx/embedder.ts (1 hunks)
  • src/embedded/pegjs/embedder.ts (1 hunks)
  • src/embedded/php/embedder.ts (1 hunks)
  • src/embedded/prisma/embedder.ts (1 hunks)
  • src/embedded/properties/embedder.ts (1 hunks)
  • src/embedded/pug/embedder.ts (1 hunks)
  • src/embedded/ruby/embedder.ts (1 hunks)
  • src/embedded/sh/embedder.ts (1 hunks)
  • src/embedded/sql/embedder.ts (1 hunks)
  • src/embedded/toml/embedder.ts (1 hunks)
  • src/embedded/ts/embedder.ts (1 hunks)
  • src/embedded/utils.ts (1 hunks)
  • src/embedded/xml/embedder.ts (1 hunks)
  • src/embedded/yaml/embedder.ts (1 hunks)
  • src/types.ts (1 hunks)
  • src/utils.ts (1 hunks)
  • tests/fixtures.spec.ts (1 hunks)
✅ Files skipped from review due to trivial changes (28)
  • src/embedded/sql/embedder.ts
  • src/embedded/jsonata/embedder.ts
  • src/embedded/properties/embedder.ts
  • src/embedded/toml/embedder.ts
  • src/embedded/php/embedder.ts
  • src/embedded/css/embedder.ts
  • src/embedded/es/embedder.ts
  • src/utils.ts
  • src/embedded/latex/embedder.ts
  • src/embedded/ts/embedder.ts
  • .changeset/pink-nails-reply.md
  • src/embedded/graphql/embedder.ts
  • tests/fixtures.spec.ts
  • src/embedded/java/embedder.ts
  • src/embedded/pegjs/embedder.ts
  • src/embedded/utils.ts
  • src/embedded/sh/embedder.ts
  • src/embedded/prisma/embedder.ts
  • src/embedded/json/embedder.ts
  • src/embedded/ruby/embedder.ts
  • src/embedded/xml/embedder.ts
  • src/embedded/markdown/embedder.ts
  • src/embedded/pug/embedder.ts
  • src/embedded/yaml/embedder.ts
  • src/embedded/html/embedder.ts
  • src/embedded/ini/embedder.ts
  • src/embedded/nginx/embedder.ts
  • src/types.ts
🔇 Additional comments (1)
src/embedded/glsl/embedder.ts (1)

2-2: Module import path updated with explicit file extension.

The change from prettier/doc to prettier/doc.js ensures explicit file extension in the import statement, which aligns with ECMAScript Modules (ESM) best practices. ESM often requires explicit file extensions for proper module resolution, making the codebase more robust across different JavaScript environments.

✨ Finishing Touches
  • [ ] 📝 Generate Docstrings

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.

Note: Be mindful of the 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 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.

coderabbitai[bot] avatar Mar 03 '25 16:03 coderabbitai[bot]

Open in Stackblitz

npm i https://pkg.pr.new/prettier-plugin-embed@148

commit: 4766d54

pkg-pr-new[bot] avatar Mar 03 '25 16:03 pkg-pr-new[bot]