Repository navigation
refactor: split the shared building blocks into packages/core - #564
Merged
Merged
Conversation
Adds packages/core/package.json and README.md, following the packages/fixtures and packages/schemas scaffold precedent (private and version 0.0.0 until the publish switch flips). The pnpm workspace globs already cover packages/*, so only the lockfile picks up the new project. Co-Authored-By: Claude Fable 5 <[email protected]>
…ckages/core (pure git mv) Pure file moves, zero edits: SplitDataView, BufferStream, log, the DICOM constants, the charset decoders, normalizeSyntax, and the leaf utilities (toFloat, toInt, addAccessors, dicomJson, deepEqual, DicomMetadataListener). Relative structure under src/ is preserved, so every intra-group import still resolves. The rewiring commit in this PR adds shims at the old paths. Co-Authored-By: Claude Fable 5 <[email protected]>
…ore (pure git mv) Pure file moves, zero edits: ValueRepresentation, Tag, DicomMetaDictionary, and the runtime dictionary modules (dictionary.fast, dicom.lookup, dicom.packed, dictionary.ranges.data, dictionary.private.data). Together with the previous commit this is the complete @dcmjs/core closure; every import between the moved files is relative and structure-preserving, so none of them needed editing. Co-Authored-By: Claude Fable 5 <[email protected]>
Hand-written rewiring for the two pure-move commits before it: - a shim at every old path under src/ re-exporting from the new packages/core location, matching each module's export shape (default vs named), so every existing import in src/, test/, and the root index keeps working unchanged - packages/core/src/index.js exporting the package's public surface - the relative .babelrc becomes a root babel.config.js with the same preset: relative Babel configs stop applying at package.json boundaries, so Jest could not transform files under packages/core - the lint and format globs in package.json now cover packages/*/src No import inside packages/core needed editing: the moves preserve the relative structure, so the whole closure resolves as before. The package's only external imports are pako and loglevel. Co-Authored-By: Claude Fable 5 <[email protected]>
This was referenced Oct 2, 2026
|
🎉 This PR is included in version 1.0.0-beta.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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.
This PR starts the
@dcmjs/corepackage. It's the first half of the package-folder split that section 3 of RELEASE_PLAN.md promised: the four engines migrated together on this staging branch, and now the shared building blocks split out into their package folder. A second PR forpackages/legacyfollows right behind it.The commits are separable the same way the fixtures move (#521) was:
packages/core/package.jsonand a README, following the fixtures/schemas precedent (private, version 0.0.0, until the publish switch flips for everything at once).git mv, zero edits — git records them all as R100 renames. The second moves the buffer machinery and shared leaf utilities (SplitDataView,BufferStream,log, the constants, the charset decoders,normalizeSyntax,toFloat,toInt,addAccessors,dicomJson,deepEqual,DicomMetadataListener); the third moves the value types and runtime dictionary (ValueRepresentation,Tag,DicomMetaDictionary,dictionary.fast,dicom.lookup,dicom.packed,dictionary.ranges.data,dictionary.private.data). Everything lands underpackages/core/src/with its relative structure preserved, which is why not one import inside the moved closure needed editing.src/re-exporting from the new location (matched one by one to each module's default-vs-named export shape), apackages/core/src/index.jswith the public surface, and two small config consequences — the relative.babelrcbecame a rootbabel.config.jswith the identical preset (relative Babel configs stop applying atpackage.jsonboundaries, so Jest couldn't transform files underpackages/core), and the lint/format globs now coverpackages/*/src. Tests stay rooted and unmoved, as with the schemas package.Where
DicomMetaDictionarylives. The plan's package table left this open and asked reviewers to confirm — objections welcome before GA. It goes in core, and here's the dependency-graph argument:ValueRepresentationandDicomMetaDictionarypoint at each other (VR resolves naturalized names throughDicomMetaDictionary.nameMap, wired by late-binding injection), its consumers span the legacy engines, the streaming reader, and the wrapper surface alike, and its own imports — the dictionary modules,log,addAccessors, VR — are all core. Putting it anywhere else would force an edge into that package from everything.@dcmjs/legacywill re-export it unchanged, so nothing on today's surface moves.One deviation from the plan's table, on purpose:
BufferStream(andSplitDataView) go to core, not legacy. The table lists BufferStream under legacy, but the event stream uses this machinery too —fromPart10Stream's backpressure relay reads throughReadBufferStream, and the streaming writers write throughWriteBufferStream. The rule we're protecting is that neither core nor the new engines ever depend on legacy, so the sync reader can one day be deprecated and removed without touching anything else. Listing BufferStream under legacy would force exactly that forbidden edge. Legacy re-exports both names, so its surface is unaffected.Two smaller placement calls worth flagging:
normalizeSyntaxrides in core (it's a pure function over the constants, and the streaming reader imports it), whiledecodeCorestays insrc/for now — it still importsDicomMessagefor tag lookup, so it can't enter core without dragging the legacy reader in; breaking that edge belongs to the parser-wave split, not a move PR. AnddeepEqualplusDicomMetadataListenermoved as shared leaves (each used from both sides of the future package boundary; both import nothing outside core).The hand-written total is about 145 changed lines (scaffold 38, shims 46, index 45, config 16), well under the 500 budget; the pure moves are exempt and declared above. After each commit group: the full suite is 844 passed / 12 skipped / 856,
pnpm run buildproduces the same bundle surface (checked the UMD export names against the previous build), and lint and format pass over the new globs.🤖 Generated with Claude Code