Script Modules: Allow scripts to depend on modules - #10
Closed
sirreal wants to merge 2 commits into
Closed
Conversation
sirrealforce-pushed
the
script-modules/allow-as-script-dependency
branch
from
October 10, 2024 10:24
13417a6 to
f9c245cCompareThis allows for script modules to be exposed in the import map regardless of being a dependency or enqueued. This will enable scripts to depend on script modules by requesting they be exposed.
sirrealforce-pushed
the
script-modules/allow-as-script-dependency
branch
from
October 10, 2024 10:26
f9c245c to
117fe60Comparegziolo
reviewed
Dec 16, 2024
| * | ||
| * @param string $id The identifier of the script module. | ||
| */ | ||
| public function expose( string $id ) { |
There was a problem hiding this comment.
This is a new concept in WordPress, so I wanted to share some alternatives to help find the final name:
add_to_import_mapinclude_in_import_map
Conceptually, the idea makes perfect sense to me. This method might also be useful when third-party code wants to ensure its dependency is listed in the import map, and they don't want to use all the tooling to generate dependencies for their script modules.
sirreal
commented
Dec 16, 2024
OwnerAuthor
Superseded by WordPress#8009. |
sirreal added a commit
that referenced
this pull request
Jun 10, 2026
Reviewer-1 #10 (class-value decode boundary): ReferenceMatcher::class_matches now folds NUL -> U+FFFD per class token, matching WP_HTML_Tag_Processor:: class_list(). Previously the reference left raw NUL, so it would have diverged from select() on a class value containing NUL (a reference gap, not a WP bug). Pinned by five deterministic decode-boundary cases in self-check.php (NUL->FFFD, trailing NUL, FF separator) that put the two independent class tokenizers against each other and against select(). Randomized document-side NUL injection is deliberately NOT added: a hot-path PRNG draw perturbs self-check.php's fixed seed space enough to surface the known Bug 3, which would first require decoupling self-check from the unfixed core bugs. Documented as a scoped future improvement in README 'Known oracle limitations', which also distinguishes the independent class-value path from the shared get_attribute() attribute path per the reviewer's sharpening. Reviewer-2 nitpick (fid sanitization asymmetric on match path): collect_matches now routes select() fids through TreeCapture::sanitize_fid, identical to the tree-row and lexbor sides, so a control-char fid can never produce a false lexbor-divergence (unreachable today; fids are integers). Reviewer-3 nitpick: minimize.php header docstring no longer implies --seed works universally. Validated: self-check OK (incl. new cases), unpatched detects the 3 bugs, patched 2000-seed run clean (927 lexbor comparisons), all 3 bugs still reproduce.
sirreal added a commit
that referenced
this pull request
Jun 10, 2026
A raw CR followed by a decoded renders as CR+LF in the WordPress tree while the DOM holds LF+LF: preprocessing maps the lone CR to LF before the character reference decodes to a second LF. The lockstep matcher consumed that pair through its CRLF-collapse rule, stranded the second DOM LF, and reported tree-mismatch for a spec-explainable difference — the same false-positive class the matcher exists to prevent. Found by adversarial review of the previous commit. WordPress CR+LF opposite DOM LF is genuinely ambiguous between a collapsed raw CRLF and a CR-to-LF substitution followed by an agreed LF, so that one site now branches: lockstep first, since it resolves the common case without backtracking, with dead ends memoized and a step budget that fails closed on adversarial inputs.
sirreal added a commit
that referenced
this pull request
Jun 12, 2026
Reviewer-1 #10 (class-value decode boundary): ReferenceMatcher::class_matches now folds NUL -> U+FFFD per class token, matching WP_HTML_Tag_Processor:: class_list(). Previously the reference left raw NUL, so it would have diverged from select() on a class value containing NUL (a reference gap, not a WP bug). Pinned by five deterministic decode-boundary cases in self-check.php (NUL->FFFD, trailing NUL, FF separator) that put the two independent class tokenizers against each other and against select(). Randomized document-side NUL injection is deliberately NOT added: a hot-path PRNG draw perturbs self-check.php's fixed seed space enough to surface the known Bug 3, which would first require decoupling self-check from the unfixed core bugs. Documented as a scoped future improvement in README 'Known oracle limitations', which also distinguishes the independent class-value path from the shared get_attribute() attribute path per the reviewer's sharpening. Reviewer-2 nitpick (fid sanitization asymmetric on match path): collect_matches now routes select() fids through TreeCapture::sanitize_fid, identical to the tree-row and lexbor sides, so a control-char fid can never produce a false lexbor-divergence (unreachable today; fids are integers). Reviewer-3 nitpick: minimize.php header docstring no longer implies --seed works universally. Validated: self-check OK (incl. new cases), unpatched detects the 3 bugs, patched 2000-seed run clean (927 lexbor comparisons), all 3 bugs still reproduce.
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 freeto 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.
Trac ticket:
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.