fix: solution for issue #19 - #32
Open
adityawaghamare04 wants to merge 1 commit into
Open
Conversation
6 tasks
|
这个 PR 已经 7 天没有新提交、作者也没有回复,它关联任务上的托管因此一直被占着,既不结算也不释放。
PR 不会被关闭——这是你的工作,随时可以接着做。被释放的只是任务上的认领,任务重新开放给其他人。 如果你还在做,回一句就行。 No commits or author replies for 7 days. The claim is released; this PR stays open. |
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.
Fix & Proposed Solution
Closes #19
🛠️ Proposed Solution (by Aditya Waghamare)
Analysis
stripPrefixonly allows stripping a single leading directory prefix from destination paths. GeneralisingstripPrefixintoremapsupports multiple ordered prefix replacement rules ({ from, to }) so complex repo layouts (e.g. monorepos or repos with separate src, test, and config paths) can be remapped into a clean package structure.Fix
remapinKNOWN_KEYSinsrc/config.mjsand validate its structural syntax.stripPrefix: "prefix"as syntactic sugar forremap: [{ from: "prefix", to: "" }].fromandtovalues as well as resulting destination paths.fromrule matches zero files.MANIFEST.jsongeneration and pack templates to use post-remap paths.Implementation
1. Configuration Validation (
src/config.mjs)2. Path Remapping Logic (
src/remap.mjs)3. Update
sparepack initTemplate & DocumentationTesting
Run unit & end-to-end tests:
npm testTest Suite (
test/remap.test.mjs)stripPrefixcompatibility: Verifies legacystripPrefixoutputs byte-identical packs...infrom,to, and final destination path calculation.frompath with 0 matched files throws an explicit error.Attribution
Design by
@xusuxiang8(sparepack#3). Path traversal validation on configured prefix values carried forward from@rafaio1(sparepack#2).Submitted by Aditya Waghamare
💰 Payout Address (Base L2 / EVM):
0xb61dBcdBc3407F71EaCb64D4CBFAcf9FFfe2415C