Skip to content

Conversation

@Sec-ant
Copy link
Owner

@Sec-ant Sec-ant commented Mar 3, 2025

Attemp to fix #147

Summary by CodeRabbit

  • New Features

    • Allow explicit file extensions on relative import specifiers for the embedded formatting plugin.
  • Chores

    • Standardized module import specifiers across language integrations to include explicit file extensions.
    • Updated test imports and type declarations to match the new import specifier format.
    • Bumped dev tooling and build-related package versions.

✏️ Tip: You can customize this high-level summary in your review settings.

@changeset-bot
Copy link

changeset-bot bot commented Mar 3, 2025

🦋 Changeset detected

Latest commit: b93cb1a

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

@coderabbitai
Copy link

coderabbitai bot commented Mar 3, 2025

📝 Walkthrough

Walkthrough

Replace various Prettier module specifiers to include explicit file extensions (e.g., prettier/docprettier/doc.js, prettier/plugins/estree.mjsprettier/plugins/estree.js), add a changeset, and update a test import; no functional or control-flow changes.

Changes

Cohort / File(s) Change Summary
Changeset patch
\.changeset/pink-nails-reply.md
New patch file added to introduce explicit .js extensions for relevant imports.
Embedded embedders
src/embedded/*/embedder.ts (e.g. css,es,glsl,graphql,html,ini,java,json,jsonata,latex,markdown,nginx,pegjs,php,prisma,properties,pug,ruby,sh,sql,toml,ts,xml,yaml)
Replaced import { builders } from "prettier/doc"; with import { builders } from "prettier/doc.js";. No logic changes.
Shared utilities & types
src/embedded/utils.ts, src/utils.ts, src/types.ts
Updated Prettier imports to prettier/doc.js (builders, utils, type imports). No API or behavior changes.
Parsers & printers
src/parsers.ts, src/printers.ts
Switched parser imports to plugin variants and updated estree printer import to prettier/plugins/estree.js. Exported shapes unchanged.
Type declaration
src/patch-prettier.d.ts
Module declaration changed from "prettier/plugins/estree.mjs" to "prettier/plugins/estree.js".
Tests
tests/fixtures.spec.ts
Test import adjusted from import * as embed from "../src"; to import * as embed from "../src/index.js"; to use explicit file path resolution.
Repository metadata
package.json
Bumped dev tooling and other dependency versions; updated packageManager field.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

I'm a rabbit, quick and spry,
I hop through imports, add .js so they fly.
Small changes, neat and light,
Paths resolved — I twitch in delight. 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR introduces package.json dependency updates beyond the scope of fixing module specifier extensions, which are unrelated to resolving issue #147. Remove package.json dependency updates or move them to a separate PR focused on dependency maintenance.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding file extensions (.js) to relative path import specifiers throughout the codebase to fix module resolution errors.
Linked Issues check ✅ Passed The PR comprehensively addresses issue #147 by adding .js extensions to all import specifiers from prettier packages across 28+ files, directly resolving the reported module resolution error.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 3, 2025

Open in StackBlitz

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

commit: b93cb1a

Copilot AI review requested due to automatic review settings January 20, 2026 12:58
@Sec-ant Sec-ant force-pushed the fix/add-import-specifier-extension branch from 4766d54 to fcb2ac9 Compare January 20, 2026 12:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes issue #147 by adding explicit .js file extensions to relative path import specifiers throughout the codebase, ensuring proper ESM module resolution. The changes address TypeScript/Node.js ESM compatibility requirements where explicit extensions are needed for relative imports.

Changes:

  • Updated all prettier/doc imports to prettier/doc.js across 27 source files
  • Updated test import from ../src to ../src/index.js
  • Added changeset documentation for the patch release

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated no comments.

Show a summary per file
File Description
.changeset/pink-nails-reply.md Adds changeset entry documenting the fix as a patch release
tests/fixtures.spec.ts Updates test import to include explicit .js extension for ESM compatibility
src/utils.ts Updates prettier/doc import to prettier/doc.js
src/types.ts Updates prettier/doc type import to prettier/doc.js
src/embedded/*/embedder.ts (26 files) Updates all embedder imports from prettier/doc to prettier/doc.js for consistent ESM resolution
src/embedded/utils.ts Updates prettier/doc import to prettier/doc.js
src/embedded/html/embedder.ts Updates prettier/doc import to prettier/doc.js

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

Did you mean to import "prettier/doc.js"

1 participant