Skip to content

[pull] master from BYVoid:master#159

Merged
pull[bot] merged 2 commits into
backup999:masterfrom
BYVoid:master
Jun 14, 2026
Merged

[pull] master from BYVoid:master#159
pull[bot] merged 2 commits into
backup999:masterfrom
BYVoid:master

Conversation

@pull

@pull pull Bot commented Jun 14, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

frankslin and others added 2 commits June 14, 2026 06:15
* Add mmap-backed zip OpenCC resources

## Resource archive

- Add //data:opencc_resources_zip.

- Produce bazel-bin/data/opencc-resources.zip.

- Include standard config files and cleaned text dictionaries.

- Keep entries flat so the archive can replace share/opencc.

## Packaging

- Derive text-backed configs at build time.

- Rewrite dictionary type ocd2 to text.

- Rewrite .ocd2 file references to .txt.

- Reuse //data/dictionary:text_dictionaries.

- Include generated dictionaries such as TSCharactersExt.

- Strip blank lines and comment lines from text dictionaries.

- Write ZIP_STORED entries for dependency-free runtime reads.

- Stamp zip entries with the build-time local timestamp.

## Runtime loading

- Extend ResourceProvider with GetResource().

- Keep Resolve() for existing path-based loading.

- Add ZipResourceProvider for stored zip archives.

- mmap the zip once on POSIX platforms.

- Index the central directory and return entry memory views.

- Avoid extracting temporary files.

- On Windows, read the zip through UTF-8 to wide paths.

## Dictionary parsing

- Add Lexicon buffer parsing.

- Let TextDict load directly from ResourceProvider data.

- Preserve existing FILE*-based loaders for path resources.

- Preserve binary dictionary loading through existing paths.

## Entry points

- Add hidden native CLI flag --resource-zip <file>.

- Add Node binding support for resource zip loading.

- Add OpenCC({ resourceZip }) support.

- Add hidden npm CLI parsing for --resource-zip.

- Update TypeScript declarations.

## Tests

- Cover ZipResourceProvider in ConfigTest.

- Add a Bazel CLI test using opencc-resources.zip.

- The CLI test invokes command_line without resource --path args.

## Verification

- bazel test //src:config_test //src:text_dict_test

- bazel test //test:command_line_converter_test

- bazel build //src:opencc_lib

- bazel build //src/tools:command_line //data:opencc_resources_zip

- bazel build //node:opencc_node

- Native CLI smoke test for hidden --resource-zip

- Native and npm help output checks

- node --check node/cli.js node/opencc.js

- Checked opencc-resources.zip uses stored entries only

* Address resource zip review feedback

- Replace the zip provider raw internal pointer with a proper PIMPL.

- Disable accidental copies of zip-backed resource state.

- Cache text resources after building the final Marisa dictionary.

- Keep config file fallback behavior explicit when zip lookup misses.

- Allow the resource zip script to write to the current directory.

* Fix Windows resource provider build

- Include <cstdint> before using fixed-width integer types.

- Keep the fix isolated to the zip resource implementation.

* Fix resource provider edge cases

- Preserve provider-loaded config directories for relative plugin resources.

- Reject absolute resource names before zip basename fallback.

- Include file freshness in filesystem and zip resource cache keys.

- Add regression tests for absolute config paths and cache keys.

* Fix Windows config test path comparison

- Normalize path separators before comparing resource names.

- Build the legacy cache key check from the actual resource name.

* Fix Windows Unicode resource loading

- Read filesystem provider resources through wide-path file IO on Windows.

- Keep the POSIX provider path on the existing ifstream implementation.
@pull pull Bot locked and limited conversation to collaborators Jun 14, 2026
@pull pull Bot added the ⤵️ pull label Jun 14, 2026
@pull pull Bot merged commit c69190c into backup999:master Jun 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant