feat(loader): add webpack and Rspack loader#6
Merged
Merged
Conversation
Coverage Report for CI Build 29859223679Coverage decreased (-2.0%) to 87.201%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
There was a problem hiding this comment.
Pull request overview
This PR introduces a new @srcset/loader package that integrates the existing @srcset/* image generation pipeline with webpack and Rspack, turning image imports into tree-shakable ES modules exporting url, src, srcSet, srcMap, and placeholder, with configurable filename templating and path resolution.
Changes:
- Added
packages/loaderwith loader implementation, option types, filename templating, path/publicPath resolvers, and shared concurrency limiting. - Added unit tests that exercise webpack + Rspack integration, including tree-shaking behavior and placeholder export behavior.
- Added package metadata/config (package.json, tsconfigs, vitest config, oxlint config) and lockfile updates for new dependencies.
Reviewed changes
Copilot reviewed 16 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Adds dependencies required by the new loader package (webpack, rspack, memfs, etc.). |
| packages/loader/vite.config.js | Vitest configuration for the loader package. |
| packages/loader/tsconfig.json | Typechecking config for loader sources/tests. |
| packages/loader/tsconfig.build.json | Build-time TS config for emitting dist. |
| packages/loader/test/loader.shim.mjs | Shim to allow bundlers to load the loader during tests. |
| packages/loader/test/bundler.mock.ts | Test harness to compile/bundle with webpack/rspack in-memory FS. |
| packages/loader/src/types.ts | Public loader option types and path resolver type. |
| packages/loader/src/template.ts | Filename templating ([path], [name], [postfix], [hash], etc.). |
| packages/loader/src/template.spec.ts | Unit tests for filename templating behavior. |
| packages/loader/src/paths.ts | Output/public path resolution helpers. |
| packages/loader/src/loader.ts | Webpack/Rspack loader entry that generates the image module + emits files. |
| packages/loader/src/loader.spec.ts | Integration tests for webpack/rspack behavior and tree-shaking. |
| packages/loader/src/limit.ts | Shared concurrency limiter for loader runs. |
| packages/loader/src/index.ts | Package entry exports for loader and re-exported types. |
| packages/loader/README.md | Usage docs and integration overview for consumers. |
| packages/loader/package.json | New package definition, scripts, exports, deps/peers. |
| packages/loader/oxlint.config.ts | Lint configuration for the new package. |
| packages/loader/client.d.ts | Ambient client-side typings for image imports. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
@srcset/loader: image imports become ES modules with url, src, srcSet, srcMap and placeholder exports. Name templates with content hashes, output/public path resolvers, import queries, tree-shakable codegen and thebackendoption; client type declarations via@srcset/loader/client. Tested against both webpack and Rspack, including tree-shaking specs.