[book] massive rewrite - #223
Conversation
There was a problem hiding this comment.
Pull request overview
This PR is a broad refresh of the Move Book’s content and its accompanying sample code, modernizing examples (notably around string literals), adding new sample modules/tests, and improving code-include rendering in the Docusaurus site build.
Changes:
- Added Prism support for plain quoted string literals and improved snippet rendering by dedenting anchored code includes.
- Updated many Move samples/docs to use
"..."string literals and expanded examples/tests across storage/programmability/basics. - Adjusted the site production build output directory to avoid clobbering dev-server generated files.
Reviewed changes
Copilot reviewed 156 out of 157 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| site/src/theme/prism-move.js | Add Prism token for plain quoted string literals in Move highlighting. |
| site/src/plugins/mdbook-anchor-code.ts | Dedent anchored code snippets extracted from files for better rendering. |
| site/src/plugins/llms-txt.ts | Mirror snippet extraction + dedent behavior for llms.txt generation. |
| site/package.json | Set Docusaurus generated-files dir name for production builds. |
| site/.gitignore | Ignore the separate production build generated-files directory. |
| reference/index.md | Add contributor attribution line to reference landing page. |
| packages/samples/sources/your-first-move/hello_world.move | Switch sample “Hello, World!” to "..." string literal usage. |
| packages/samples/sources/your-first-move/hello_world_docs.move | Update documented sample to "..." string literal usage. |
| packages/samples/sources/your-first-move/hello_world_debug.move | Update debug sample to "..." string literal usage. |
| packages/samples/sources/testing/testing-basics.move | New sample demonstrating expected failures with foreign abort codes. |
| packages/samples/sources/testing/builder_pattern_builder.move | Update string construction to "..." literals in builder examples. |
| packages/samples/sources/storage/uid-and-id.move | New storage sample covering UID lifecycle, derivation, and conversions. |
| packages/samples/sources/storage/store-ability.move | Rewrite store-ability sample using label syntax + richer example. |
| packages/samples/sources/storage/storage-functions.move | New sample covering transfer/share/freeze patterns and tests. |
| packages/samples/sources/storage/key-ability.move | New sample introducing key objects and a basic constructor test. |
| packages/samples/sources/storage/internal-constraint.move | New sample illustrating the internal constraint via event::emit. |
| packages/samples/sources/programmability/witness-pattern.move | Add test coverage for the regulated-coin witness pattern sample. |
| packages/samples/sources/programmability/witness-pattern-2.move | New minimal witness pattern “definition” module. |
| packages/samples/sources/programmability/witness-pattern-3.move | New “witness source” module showing witness construction and usage. |
| packages/samples/sources/programmability/transaction-context.move | Expand TxContext field reads demonstrated in sample snippet. |
| packages/samples/sources/programmability/randomness.move | New randomness sample + unit/scenario tests demonstrating generators. |
| packages/samples/sources/programmability/package-upgrades.move | Add version-gated state example + tests for migration/mismatch. |
| packages/samples/sources/programmability/package-upgrades-2.move | New lazy dynamic-field migration example with tests. |
| packages/samples/sources/programmability/module-initializer.move | Add test snippet for init behavior (ids created). |
| packages/samples/sources/programmability/events.move | Add event emission test snippet (read back events). |
| packages/samples/sources/programmability/dynamic-object-fields.move | Update example string value to "..." literal. |
| packages/samples/sources/programmability/dynamic-fields.move | Update dynamic-field examples to "..." literals + clarify types. |
| packages/samples/sources/programmability/dynamic-collections.move | Update dynamic-collection examples to "..." literals. |
| packages/samples/sources/programmability/display.move | Update display example to use display registry + migration helper. |
| packages/samples/sources/programmability/collections-3.move | Clarify VecMap type + update inserted string values to literals. |
| packages/samples/sources/programmability/capability.move | Remove unrelated event example; clarify capability narrative. |
| packages/samples/sources/programmability/capability-4.move | Make AdminCap an object (has key { id: UID }) in capability example. |
| packages/samples/sources/programmability/balance-and-coin.move | New tests demonstrating Balance and Coin operations. |
| packages/samples/sources/programmability/balance-and-coin-2.move | New OTW-based currency creation example + test. |
| packages/samples/sources/programmability/balance-and-coin-3.move | New dynamic currency creation + mint/burn examples + tests. |
| packages/samples/sources/programmability/balance-and-coin-4.move | New “whole units” currency reader utility example. |
| packages/samples/sources/programmability/address-balances.move | New examples for address-balance deposit/redeem/withdraw flows. |
| packages/samples/sources/move-basics/vector.move | Expand vector section with access/methods/macros examples + tests. |
| packages/samples/sources/move-basics/type-reflection.move | Update type-reflection assertions to use "..." literal. |
| packages/samples/sources/move-basics/struct.move | Expand struct section with positional structs + getters/setters + tests. |
| packages/samples/sources/move-basics/struct-methods-3.move | Replace old placeholder with a concrete external-type method alias demo. |
| packages/samples/sources/move-basics/references.move | Add getter/deref examples and tests. |
| packages/samples/sources/move-basics/primitive-types.move | Rewrite into smaller focused tests + add comparisons/overflow examples. |
| packages/samples/sources/move-basics/ownership-and-scope.move | New ownership/scope examples illustrating move vs copy + blocks. |
| packages/samples/sources/move-basics/option.move | Expand option section with richer examples and option macro coverage. |
| packages/samples/sources/move-basics/module-members.move | Simplify module member example; clarify commentary. |
| packages/samples/sources/move-basics/function.move | Update tuple-return example to use "..." literal in context. |
| packages/samples/sources/move-basics/expression.move | Add "..." string literal example and refine narrative. |
| packages/samples/sources/move-basics/enum-and-match.move | Update examples to "..." literals and adjust encoding commentary. |
| packages/samples/sources/move-basics/enum-and-match-2.move | Update enum test to "..." literals + explicit accumulator typing. |
| packages/samples/sources/move-basics/copy-ability.move | Update copy example to demonstrate copy keyword and clarify narrative. |
| packages/samples/sources/move-basics/control-flow.move | Add else-if and labeled-loop/block examples; refine string handling. |
| packages/samples/sources/move-basics/assert-and-abort.move | Add “clean abort” test + update error constants to "..." literals. |
| packages/samples/sources/move-basics/abilities-introduction.move | New “abilities introduction” sample with test demonstrating copy/drop. |
| packages/samples/sources/move-basics/macros.move | New macro functions section with tests/examples. |
| packages/samples/sources/move-basics/internal-permit.move | New internal-permit “registry” sample module. |
| packages/samples/sources/move-basics/internal-permit-2.move | New sample showing how to use internal permits across modules + test. |
| packages/samples/sources/move-basics/generics.move | Add tests demonstrating generic struct instantiation and methods. |
| packages/samples/Move.lock | Bump pinned Sui framework/stdlib revisions for testnet. |
| packages/hello_world/tests/hello_world_tests.move | Update hello world test to compare against "..." literal. |
| packages/hello_world/sources/hello_world.move | Update hello world function body to return "..." literal. |
| book/testing/using-system-objects.md | Update randomness/test-scenario guidance and sample snippets. |
| book/testing/transaction-context.md | Update created-object tracking section and cleanup guidance. |
| book/testing/testing-basics.md | Add foreign abort code guidance + improve naming guidance for test-only. |
| book/testing/test-utilities.md | Clarify assertions, add #[test_only] import examples, refine destroy docs. |
| book/testing/test-scenario.md | Update scenario flow guidance and effects assertions. |
| book/testing/random-test.md | Update max-value macro usage and reproduction instruction formatting. |
| book/testing/good-tests.md | Add full readable test example and update max-value references. |
| book/testing/gas-profiling.md | Update sample outputs/CSV format/limits and clarify base gas cost. |
| book/testing/extend-foreign-module.md | Update edition requirement text and remove a deprecated link. |
| book/testing/coverage.md | Update coverage output paths and full-address display notes. |
| book/testing/builder-pattern.md | Update validator-builder usage and TxContextBuilder example. |
| book/storage/transfer-to-object.md | Rewrite/clarify TTO narrative, restructure sections, fix/modernize links. |
| book/storage/transfer-restrictions.md | Remove deprecated page content. |
| book/storage/store-ability.md | Rewrite store-ability explanation and link structure; reference code include. |
| book/storage/internal-constraint.md | Rewrite internal-constraint narrative and reference code include. |
| book/storage/index.md | Rewrite chapter intro and reading order; add contextual note on UID/TxContext. |
| book/sidebar.yml | Reorder/add sidebar entries (functions/macros/internal permit, new sections). |
| book/programmability/wrapper-type-pattern.md | Title casing + punctuation/style cleanup. |
| book/programmability/witness-pattern.md | Rewrite witness section and switch to code-includes + expanded narrative. |
| book/programmability/publisher.md | Rewrite publisher intro/usage and add claim-and-keep note. |
| book/programmability/module-initializer.md | Clarify init rules, security notes, and add testing guidance. |
| book/programmability/index.md | Rewrite chapter overview with thematic reading paths. |
| book/programmability/hot-potato-pattern.md | Clarify examples, add entry/hot-potato boundary note, update links. |
| book/programmability/epoch-and-time.md | Rewrite epoch/clock narrative and add further reading. |
| book/programmability/dynamic-collections.md | Clarify Bag/LinkedTable text and add decision guide. |
| book/programmability/collections.md | Clarify vector/VecSet/VecMap limitations and ordering/equality behavior. |
| book/programmability/capability.md | Expand capability discussion, add framework examples and tradeoffs narrative. |
| book/object/object-model.md | Rewrite object definition narrative with struct example and expanded properties. |
| book/object/index.md | Rewrite object chapter intro with ordered reading path. |
| book/object/fast-path-and-consensus.md | Rewrite fast/consensus path narrative, add per-object ordering detail. |
| book/object/evolution-of-move.md | Rewrite history of storage model to object-based explanation. |
| book/object/digital-assets.md | Clarify asset representation and map properties to language features. |
| book/move-basics/visibility.md | Improve frontmatter formatting and expand entry modifier explanation. |
| book/move-basics/type-reflection.md | Clarify main APIs and improve prose/casing. |
| book/move-basics/testing.md | Expand testing intro, explain #[test_only], and add “what’s next” section. |
| book/move-basics/struct-methods.md | Rewrite receiver syntax explanation; add external-type alias example. |
| book/move-basics/standard-library.md | Update module list (add internal/unit_test), fix-point updates, clarify notes. |
| book/move-basics/module.md | Rewrite module intro and add clearer member explanations. |
| book/move-basics/index.md | Rewrite Move Basics intro with structured reading plan and pointers. |
| book/move-basics/importing-modules.md | Clean up narrative and add further reading link to reference. |
| book/move-basics/function.md | Clarify function basics and add cross-links to visibility/imports. |
| book/move-basics/expression.md | Clarify literals (incl. strings), blocks/scope, and add further reading links. |
| book/move-basics/enum-and-match.md | Rewrite narrative, improve links, and clarify match semantics. |
| book/move-basics/drop-ability.md | Rewrite drop section to connect to assets/obligations and container behavior. |
| book/move-basics/copy-ability.md | Rewrite copy section to connect to ownership semantics and references. |
| book/move-basics/constants.md | Clean up narrative, clarify privacy + config pattern, update links. |
| book/move-basics/comments.md | Remove internal TODOs and clarify doc-comment purpose. |
| book/move-basics/address.md | Rewrite address intro and add reserved-address pointer and context notes. |
| book/move-advanced/modes.md | Update debug print examples to use string literals + String type. |
| book/move-advanced/index.md | Improve frontmatter formatting and add section list. |
| book/index.md | Add authorship attribution and update “active development” notice. |
| book/guides/upgradeability-practices.md | Add link to package-upgrades section and refine upgrade rules text. |
| book/guides/code-quality-checklist.md | Modernize string literal guidance and fix headings/punctuation. |
| book/concepts/what-is-an-account.md | Rewrite account concept, add “no registration” + supported schemes info. |
| book/concepts/what-is-a-transaction.md | Rewrite intro and clarify inputs/commands; add public vs entry explanation. |
| book/concepts/packages.md | Rewrite intro and add upgradeability pointers. |
| book/concepts/manifest.md | Add frontmatter and expand on edition/published-at/addresses guidance. |
| book/concepts/index.md | Rewrite concepts intro for clarity and concision. |
| book/concepts/address.md | Remove verbose TODOs and refine reserved-address descriptions. |
| book/before-we-begin/install-move-registry-cli.md | Add pointer to new “Using Move Registry” guide. |
| book/appendix/reserved-addresses.md | Expand reserved address list + update links to new sections. |
| book/appendix/acknowledgements.md | Add Move community acknowledgements section. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This comment was marked as resolved.
This comment was marked as resolved.
|
|
||
| <!-- published-at --> | ||
| - `edition` - the edition of the Move language; currently, the only valid value is `2024`; | ||
| - `published-at` - the address the package was published at; set after publishing, it lets |
There was a problem hiding this comment.
this is deprecated / not recommended, do we want to include this here?
There was a problem hiding this comment.
Yeah, one step ahead of you, was collecting other things before pushing.
| `bridge`, and `deepbook`) are automatically added as dependencies if none of them are explicitly | ||
| listed. | ||
|
|
||
| ### Addresses |
There was a problem hiding this comment.
ditto (removed from latest pkg manager)
There was a problem hiding this comment.
Also already removed.
| making a function `public` is all it takes for users to call it in a transaction, and it is the | ||
| default way to expose functionality in Move. (There is also the | ||
| [`entry`](../move-basics/visibility#entry-modifier) modifier, which creates functions callable | ||
| _only_ as transaction commands - a deliberately restricted option, covered later in the book.) |
No description provided.