Repository navigation
docs(module): document the rest of module.parser.javascript - #8394
Merged
Merged
Conversation
An audit of schemas/WebpackOptions.json against the configuration pages found 26 of the 49 JavascriptParserOptions had no documentation, and that the Module Contexts section taught the deprecated spelling of twelve of them. Module Contexts now shows the options where they actually live, under module.parser.javascript, and says that setting them on module directly is deprecated and where each moved. Adds typescript, deferImport and sourceImport, which default from the matching experiments, and a table for the syntax toggles. The table states each default rather than implying one: requireJs and system are off until set to true, and requireInclude warns that it is deprecated unless set explicitly - read from AMDPlugin, CommonJsPlugin, SystemPlugin, RequireJsStuffPlugin, RequireIncludePlugin and defaults.js.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
Summary
Result of auditing
schemas/WebpackOptions.jsonagainst the configuration pages: I walked all 253 definitions, resolving$refchains into 974 option paths, and checked each against every form the docs use — dotted headings, bare-name headings, table cells, config-example keys, type signatures and prose lists.Coverage is good. All 38 top-level options are documented, and almost everything that looked missing turned out to be documented in a form a naive check misses:
resolveLoader.*by reference ("identical to theresolveproperty set above"),externalsPresets.*in a table of bare names,snapshot.*anddotenv.*as subsections,splitChunks.max*Sizein the split-chunks plugin page,stats.colors.*in a type signature,output.html.csp.noncein a bullet list,lazyCompilation.backendin a TS block,importMeta.dirnamein the prose listing the known keys.The problem it did turn up is in
module.mdx. Module Contexts introduces a config block with "Here are the available options with their defaults", and 11 of its 12 options are deprecated — each moved tomodule.parser.javascriptunder the same name — with onlystrictExportPresencecarrying a warning. Meanwhile the replacements were themselves undocumented: 26 of the 49JavascriptParserOptionshad no heading.So this PR:
module.parser.javascript, with a warning mapping each deprecatedmodule.*spelling to where it moved;typescript,deferImportandsourceImport, each defaulting from the matchingexperimentsoption;amd,browserify,commonjs,harmony,import,node,requireContext,requireEnsure,requireInclude,requireJs,system).The table states each default separately rather than implying a common one, because they differ and the asymmetry was documented nowhere: most are on unless set to
false, butrequireJsandsystemare off until set totrue, andrequireIncludewarns that it is deprecated unless set explicitly. That is read fromAMDPlugin,CommonJsPlugin,SystemPlugin,RequireJsStuffPlugin,RequireIncludePluginanddefaults.js, not inferred.Heading-level coverage of
JavascriptParserOptionsgoes from 23/49 to 48/49; the holdout is the deprecatedstrictExportPresence, which the deprecation note covers rather than giving it a section of its own.What kind of change does this PR introduce?
docs
Did you add tests for your changes?
No — documentation only. Verified with prettier, eslint, markdownlint and
npm run jest(25 suites / 99 tests / 23 snapshots); every anchor introduced was checked against the headings it points at.Does this PR introduce a breaking change?
No.
If relevant, what needs to be documented once your changes are merged or what have you already documented?
n/a — this is the documentation. One related finding belongs in webpack itself rather than here:
module.exprContextCriticalis the only one of the twelve siblings whose schema description carries noDeprecated:marker, althoughmodule.parser.javascript.exprContextCriticalexists and the other eleven are marked. I am opening that separately.Use of AI
Claude Code was used to write the audit that produced this, and the documentation itself. The defaults and the toggle semantics were read out of webpack's plugin sources and
defaults.jsrather than assumed, and each candidate gap was hand-verified against the page before being treated as one — most were false positives.🤖 Generated with Claude Code
https://claude.ai/code/session_01Cb4AP4BntRzji5vSqhzYWT
Generated by Claude Code