Skip to content

feat(plugin-react): use @lynx-js/type-config for lynx config#1983

Closed
upupming wants to merge 19 commits intolynx-family:mainfrom
upupming:feat/adopt-type-config
Closed

feat(plugin-react): use @lynx-js/type-config for lynx config#1983
upupming wants to merge 19 commits intolynx-family:mainfrom
upupming:feat/adopt-type-config

Conversation

@upupming
Copy link
Copy Markdown
Collaborator

@upupming upupming commented Dec 4, 2025

Summary by CodeRabbit

  • New Features

    • Added type-safe, autocomplete-friendly configuration support for plugin options using dedicated configuration types.
  • Refactor

    • Reorganized configuration structure with separated default compiler options and Lynx config types for improved type safety.
    • Expanded public API with new type exports (LynxCompilerOptions, LynxConfig, ReactLynxOptions, ResolvedLynxTemplatePluginOptions).
    • Streamlined public configuration surface by restructuring option composition.

✏️ Tip: You can customize this high-level summary in your review settings.

This PR refactors PluginReactLynxOptions to adopt the @lynx-js/type-config approach.

Key points:

Three-layer merge: LynxCompilerOptions/LynxConfig (base) + ReactLynxDefaultCompilerOptions / ReactLynxDefaultLynxConfig (defaults) + ReactLynxOptions (plugin-specific).

  • Omit + merge: Avoids duplicate keys and preserves TSDoc.
  • Resolved type: Marks all defaulted fields as required, ensuring safe runtime usage without undefined checks.
  • This aligns ReactLynx options handling with type-config’s structured approach.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).
  • Changeset added, and when a BREAKING CHANGE occurs, it needs to be clearly marked (or not required).

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Dec 4, 2025

🦋 Changeset detected

Latest commit: 57ae232

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@lynx-js/template-webpack-plugin Minor
@lynx-js/react-rsbuild-plugin Minor
@lynx-js/react-alias-rsbuild-plugin Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Dec 4, 2025

📝 Walkthrough

Walkthrough

Restructures public API types for React plugin Lynx configuration by introducing layered type composition (ReactLynxDefaultCompilerOptions, ReactLynxDefaultLynxConfig, ReactLynxOptions) and adding new packages (@upupming/type-config, object.pick) to enable type-safe configurations. Updates function signatures across multiple modules to use ResolvedPluginReactLynxOptions. Expands public type exports in both rspeedy and webpack template plugins.

Changes

Cohort / File(s) Summary
Changelog entry
.changeset/dirty-paws-train.md
Added changelog announcement documenting use of @upupming/type-config for type-safe Lynx configurations in pluginReactLynx with usage examples.
JSDoc reference updates
packages/react/transform/index.d.ts
Updated @inheritdoc tags in visitor config interfaces to reference ReactLynxOptions instead of PluginReactLynxOptions.
Core type restructuring (rspeedy)
packages/rspeedy/plugin-react/etc/react-rsbuild-plugin.api.md, packages/rspeedy/plugin-react/src/pluginReactLynx.ts
Introduced layered type composition: new interfaces ReactLynxDefaultCompilerOptions, ReactLynxDefaultLynxConfig, ReactLynxOptions; replaced PluginReactLynxOptions export from interface to composite type; added ResolvedPluginReactLynxOptions for fully resolved options; added LynxCompilerOptions and LynxConfig exports.
Type usage updates (rspeedy functions)
packages/rspeedy/plugin-react/src/css.ts, packages/rspeedy/plugin-react/src/entry.ts, packages/rspeedy/plugin-react/src/generator.ts, packages/rspeedy/plugin-react/src/loaders.ts
Updated function signatures to accept ResolvedPluginReactLynxOptions instead of Required; entry.ts now uses object.pick for selective option passing.
Public API exports (rspeedy)
packages/rspeedy/plugin-react/src/index.ts
Expanded re-exports to include ResolvedPluginReactLynxOptions, LynxCompilerOptions, ReactLynxDefaultCompilerOptions, LynxConfig, ReactLynxDefaultLynxConfig, ReactLynxOptions alongside existing PluginReactLynxOptions.
Dependencies
packages/rspeedy/plugin-react/package.json, packages/webpack/template-webpack-plugin/package.json
Added @upupming/type-config (0.0.1), object.pick (^1.3.0), and @types/object.pick (^1.3.4); template-webpack-plugin also adds @upupming/type-config as peer dependency.
Core type restructuring (webpack)
packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md, packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
Restructured LynxTemplatePluginOptions to extend LynxCompilerOptions and LynxConfig; introduced ResolvedLynxTemplatePluginOptions; changed EncodeOptions.compilerOptions from Record type to LynxCompilerOptions; added convertCSSChunksToMap static method; removed legacy option fields.
Public API exports (webpack)
packages/webpack/template-webpack-plugin/src/index.ts
Added exports for LynxCompilerOptions, LynxConfig, LynxTemplateOptions, ResolvedLynxTemplatePluginOptions.
Peer dependency update
packages/webpack/react-webpack-plugin/package.json
Extended @lynx-js/template-webpack-plugin peer dependency to include ^0.10.0.
Test type checking
packages/rspeedy/plugin-react/test/config.test-d.ts, packages/rspeedy/plugin-react/test/config.test.ts, packages/rspeedy/plugin-react/test/validate.test.ts
Added TypeScript declaration test file validating type exports; updated runtime tests for LynxTemplatePlugin options customization; added compilerOptionsKeys and configKeys validation tests.
Test config
packages/rspeedy/plugin-react/tsconfig.typecheck.json, packages/rspeedy/plugin-react/vitest.config.ts
Added dedicated TypeScript type-checking configuration and Vitest typecheck configuration.
Snapshot updates (webpack)
packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts, packages/webpack/css-extract-webpack-plugin/test/hotCases/**/__snapshot__/rspack/*.snap.txt
Changed enableCSSSelector access from bracket notation to dot notation; updated multiple CSS hot-update JSON content hashes across test snapshots reflecting changes in compiled output.
Documentation
website/docs/en/guide/code-splitting.md, website/docs/zh/guide/code-splitting.md
Updated documentation link references from pluginReactLynxOptions.experimental_islazybundle to ReactLynxOptions.experimental_islazybundle.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

  • Core type restructuring: The new three-layer type composition (default options → user options → resolved options) in both pluginReactLynx.ts and LynxTemplatePlugin.ts requires careful review to ensure type correctness and clarity of intent
  • Public API surface changes: Multiple exported types added/modified; impacts consumers relying on plugin configuration types
  • Option composition logic: Introduction of object.pick for selective option passing in entry.ts and throughout changes requires verification of which options are correctly passed
  • Snapshot heterogeneity: While many snapshots are repetitive hash changes, the underlying cause (changes to how options are processed and passed) needs validation
  • Cross-module dependencies: Type changes in pluginReactLynx affect multiple files; webpack template plugin changes are largely parallel but independent

Areas requiring extra attention:

  • The layered type composition logic in pluginReactLynx.ts and LynxTemplatePlugin.ts — verify RequiredNotUndefined utility and SetRequired composition are correct
  • Option field removals from public API — ensure deprecated/removed fields are handled correctly in backward compatibility
  • The object.pick usage in entry.ts with compilerOptionsKeys and configKeys — verify correct subset of options are passed
  • CSS snapshot changes — validate they reflect intended output changes, not regressions

Possibly related PRs

Suggested labels

framework:React

Suggested reviewers

  • colinaaa
  • gaoachao

Poem

🐰 A rabbit's opus, types so neat and clean,
Layering options like carrots unseen,
From defaults to resolved, the structure refined,
With @upupming/type-config in mind,
Type-safe configurations, hop hop hooray!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and specifically describes the main change: adopting @upupming/type-config (or @lynx-js/type-config) for lynx configuration in the plugin-react package, which aligns with the substantial refactoring of PluginReactLynxOptions throughout the codebase.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov bot commented Dec 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@upupming upupming force-pushed the feat/adopt-type-config branch from c9924c6 to 2cbab2b Compare December 5, 2025 05:44
@upupming upupming force-pushed the feat/adopt-type-config branch from 2cbab2b to c96605f Compare December 5, 2025 05:53
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Dec 5, 2025

CodSpeed Performance Report

Merging #1983 will degrade performances by 5.53%

Comparing upupming:feat/adopt-type-config (57ae232) with main (6400f87)1

Summary

❌ 1 regression
✅ 62 untouched
⏩ 3 skipped2

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
transform 1000 view elements 44 ms 46.6 ms -5.53%

Footnotes

  1. No successful run was found on main (8cdb69d) during the generation of this report, so 6400f87 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@relativeci
Copy link
Copy Markdown

relativeci bot commented Dec 5, 2025

React Example

#6392 Bundle Size — 236.9KiB (0%).

57ae232(current) vs 6400f87 main#6360(baseline)

Bundle metrics  no changes
                 Current
#6392
     Baseline
#6360
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
No change  Cache Invalidation 0% 0%
No change  Chunks 0 0
No change  Assets 4 4
No change  Modules 162 162
No change  Duplicate Modules 65 65
No change  Duplicate Code 46.75% 46.75%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#6392
     Baseline
#6360
No change  IMG 145.76KiB 145.76KiB
No change  Other 91.14KiB 91.14KiB

Bundle analysis reportBranch upupming:feat/adopt-type-configProject dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci bot commented Dec 5, 2025

Web Explorer

#6552 Bundle Size — 372.73KiB (0%).

57ae232(current) vs 6400f87 main#6520(baseline)

Bundle metrics  no changes
                 Current
#6552
     Baseline
#6520
No change  Initial JS 146.31KiB 146.31KiB
No change  Initial CSS 32.4KiB 32.4KiB
Change  Cache Invalidation 0% 11.74%
No change  Chunks 8 8
No change  Assets 8 8
No change  Modules 230 230
No change  Duplicate Modules 16 16
No change  Duplicate Code 2.97% 2.97%
No change  Packages 4 4
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#6552
     Baseline
#6520
No change  JS 243.35KiB 243.35KiB
No change  Other 96.98KiB 96.98KiB
No change  CSS 32.4KiB 32.4KiB

Bundle analysis reportBranch upupming:feat/adopt-type-configProject dashboard


Generated by RelativeCIDocumentationReport issue

@upupming upupming force-pushed the feat/adopt-type-config branch from cd43382 to 3aa8186 Compare December 5, 2025 11:08
@upupming upupming force-pushed the feat/adopt-type-config branch from 3aa8186 to 18d3c02 Compare December 5, 2025 11:11
@cla-assistant
Copy link
Copy Markdown

cla-assistant bot commented Dec 5, 2025

CLA assistant check
All committers have signed the CLA.


```json
{"content":"eyJjb21waWxlck9wdGlvbnMiOnsiZW5hYmxlRmliZXJBcmNoIjp0cnVlLCJ1c2VMZXB1c05HIjp0cnVlLCJlbmFibGVSZXVzZUNvbnRleHQiOnRydWUsImJ1bmRsZU1vZHVsZU1vZGUiOiJSZXR1cm5CeUZ1bmN0aW9uIiwiZGVidWdJbmZvT3V0c2lkZSI6dHJ1ZSwiZGVmYXVsdERpc3BsYXlMaW5lYXIiOnRydWUsImVuYWJsZUNTU0ludmFsaWRhdGlvbiI6ZmFsc2UsImVuYWJsZUNTU1NlbGVjdG9yIjp0cnVlLCJlbmFibGVMZXB1c0RlYnVnIjp0cnVlLCJlbmFibGVSZW1vdmVDU1NTY29wZSI6ZmFsc2UsInRhcmdldFNka1ZlcnNpb24iOiIzLjIiLCJkZWZhdWx0T3ZlcmZsb3dWaXNpYmxlIjp0cnVlfSwic291cmNlQ29udGVudCI6eyJkc2wiOiJyZWFjdF9ub2RpZmYiLCJhcHBUeXBlIjoiY2FyZCIsImNvbmZpZyI6eyJsZXB1c1N0cmljdCI6dHJ1ZSwidXNlTmV3U3dpcGVyIjp0cnVlLCJlbmFibGVOZXdJbnRlcnNlY3Rpb25PYnNlcnZlciI6dHJ1ZSwiZW5hYmxlTmF0aXZlTGlzdCI6dHJ1ZSwiZW5hYmxlQTExeSI6dHJ1ZSwiZW5hYmxlQWNjZXNzaWJpbGl0eUVsZW1lbnQiOmZhbHNlLCJlbmFibGVDU1NJbmhlcml0YW5jZSI6ZmFsc2UsImVuYWJsZU5ld0dlc3R1cmUiOmZhbHNlLCJyZW1vdmVEZXNjZW5kYW50U2VsZWN0b3JTY29wZSI6ZmFsc2V9fSwiY3NzIjp7ImNzc01hcCI6eyIwIjpbeyJ0eXBlIjoiU3R5bGVSdWxlIiwic3R5bGUiOlt7Im5hbWUiOiJjb2xvciIsInZhbHVlIjoiXCJibHVlXCIiLCJrZXlMb2MiOnsibGluZSI6MSwiYXsdW1uIjoxMXXsInZhbExvYyI6eyJsaW5lIjoxLCJjb2x1bW4iOjE5fX1dLCJzZWxlY3RvclRleHQiOnsidmFsdWUiOiIuZm9vIiwibG9jIjp7ImxpbmUiOjEsImNvbHVtbiI6NX19LCJ2YXJpYWJsZXMiOnt9fV19LCJjc3NTb3VyY2UiOnsiMCI6Ii9jc3NJZC8wLmNzcyJ9LCJjb250ZW50TWFwIjp7fXXsImxlcHVzQ29kZSI6eyJsZXB1c0NodW5rIjp7fXXsIm1hbmlmZXN0Ijp7fSwiY3VzdG9tU2VjdGlvbnMiOnt9fQ==","deps":{"0":[]}}
{"content":"eyJjb21waWxlck9wdGlvbnMiOnsiZW5hYmxlRmliZXJBcmNoIjp0cnVlLCJ1c2VMZXB1c05HIjp0cnVlLCJlbmFibGVSZXVzZUNvbnRleHQiOnRydWUsImJ1bmRsZU1vZHVsZU1vZGUiOiJSZXR1cm5CeUZ1bmN0aW9uIiwiZW5hYmxlTGVwdXNEZWJ1ZyI6dHJ1ZSwiZGVidWdJbmZvT3V0c2lkZSI6dHJ1ZSwiZGVmYXVsdERpc3BsYXlMaW5lYXIiOnRydWUsImRlZmF1bHRPdmVyZmxvd1Zpc2libGUiOnRydWUsImVuYWJsZUNTU0ludmFsaWRhdGlvbiI6ZmFsc2UsImVuYWJsZUNTU1NlbGVjdG9yIjp0cnVlLCJlbmFibGVSZW1vdmVDU1NTY29wZSI6ZmFsc2UsInRhcmdldFNka1ZlcnNpb24iOiIzLjIifSwic291cmNlQ29udGVudCI6eyJkc2wiOiJyZWFjdF9ub2RpZmYiLCJhcHBUeXBlIjoiY2FyZCIsImNvbmZpZyI6eyJsZXB1c1N0cmljdCI6dHJ1ZSwidXNlTmV3U3dpcGVyIjp0cnVlLCJlbmFibGVOZXdJbnRlcnNlY3Rpb25PYnNlcnZlciI6dHJ1ZSwiZW5hYmxlTmF0aXZlTGlzdCI6dHJ1ZSwiZW5hYmxlQTExeSI6dHJ1ZSwiZW5hYmxlQWNjZXNzaWJpbGl0eUVsZW1lbnQiOmZhbHNlLCJlbmFibGVDU1NJbmhlcml0YW5jZSI6ZmFsc2UsImVuYWJsZU5ld0dlc3R1cmUiOmZhbHNlLCJyZW1vdmVEZXNjZW5kYW50U2VsZWN0b3JTY29wZSI6ZmFsc2V9fSwiY3NzIjp7ImNzc01hcCI6eyIwIjpbeyJ0eXBlIjoiU3R5bGVSdWxlIiwic3R5bGUiOlt7Im5hbWUiOiJjb2xvciIsInZhbHVlIjoiXCJibHVlXCIiLCJrZXlMb2MiOnsibGluZSI6MSwiYXsdW1uIjoxMXXsInZhbExvYyI6eyJsaW5lIjoxLCJjb2x1bW4iOjE5fX1dLCJzZWxlY3RvclRleHQiOnsidmFsdWUiOiIuZm9vIiwibG9jIjp7ImxpbmUiOjEsImNvbHVtbiI6NX19LCJ2YXJpYWJsZXMiOnt9fV19LCJjc3NTb3VyY2UiOnsiMCI6Ii9jc3NJZC8wLmNzcyJ9LCJjb250ZW50TWFwIjp7fXXsImxlcHVzQ29kZSI6eyJsZXB1c0NodW5rIjp7fXXsIm1hbmlmZXN0Ijp7fSwiY3VzdG9tU2VjdGlvbnMiOnt9fQ==","deps":{"0":[]}}
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is updated just because config order is changed, no value is changed/added/deleted.

@upupming upupming force-pushed the feat/adopt-type-config branch from a69fed2 to 816ad5b Compare December 5, 2025 12:23
"@lynx-js/react-webpack-plugin": "workspace:*",
"@lynx-js/runtime-wrapper-webpack-plugin": "workspace:*",
"@lynx-js/template-webpack-plugin": "workspace:*",
"@lynx-js/type-config": "npm:@upupming/type-config@0.0.1",
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: update this to official release

@upupming upupming force-pushed the feat/adopt-type-config branch from 44dfbf3 to 37eee82 Compare December 5, 2025 12:36
@upupming upupming force-pushed the feat/adopt-type-config branch from 8366de2 to ff5b697 Compare December 5, 2025 15:14
@upupming upupming marked this pull request as ready for review December 8, 2025 10:23
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (2)
packages/webpack/css-extract-webpack-plugin/test/hotCases/css/basic/__snapshot__/rspack/1.snap.txt (1)

17-17: Snapshot content update is consistent with regenerated output

Only the JSON content base64 payload changed; structure and deps are untouched. For this auto-generated snapshot, updating it to reflect new output (e.g., config order changes) is correct and needs no further action. Based on learnings, these snapshots should be kept in sync with the generator, not hand-edited.

packages/rspeedy/plugin-react/package.json (1)

47-47: Remove or replace @upupming/type-config — package not found on npm.

The dependency @upupming/type-config: "0.0.1" does not appear to exist on the public npm registry. Installation will fail unless this is a local workspace package or private registry entry.

Confirm whether this should be:

  • A local workspace reference (workspace:* or path)
  • Removed entirely if no longer needed
  • Replaced with an alternative package
  • Published to npm if intended as a scoped package
🧹 Nitpick comments (6)
packages/rspeedy/plugin-react/test/validate.test.ts (1)

188-199: Consider using inline snapshots for consistency.

The new test loops use .toThrowErrorMatchingSnapshot() while all other tests in this file use .toThrowErrorMatchingInlineSnapshot(). Inline snapshots make the expected error messages immediately visible during code review and maintain consistency with the existing test style.

Example refactor for one test:

  compilerOptionsKeys.forEach((compilerOptionsKey: string) => {
    test(compilerOptionsKey, () => {
-     expect(() => validateConfig({ [compilerOptionsKey]: Symbol.for('test') }))
-       .toThrowErrorMatchingSnapshot()
+     expect(() => validateConfig({ [compilerOptionsKey]: Symbol.for('test') }))
+       .toThrowErrorMatchingInlineSnapshot()
    })
  })

After running the tests once, Vitest will automatically populate the inline snapshot with the actual error message.

packages/rspeedy/plugin-react/test/config.test-d.ts (1)

90-102: Consider the maintainability of hard-coded length checks.

The hard-coded type length assertions (38, 130, 174) will fail whenever the upstream @upupming/type-config package adds or removes config options, even for non-breaking additions. This creates maintenance burden and may generate false positives.

Consider whether these specific length checks provide sufficient value to justify the maintenance cost, or if the other type-level tests (extension checks, intersection checks, default field checks) already provide adequate type safety guarantees.

packages/rspeedy/plugin-react/etc/react-rsbuild-plugin.api.md (1)

8-9: New public option surfaces look aligned, but address new API Extractor warnings in source.

  • The new PluginReactLynxOptions / ReactLynxDefault* / ResolvedPluginReactLynxOptions composition and the LynxCompilerOptions / LynxConfig re‑exports match the PR’s “three‑layer merge” design and look consistent.
  • API Extractor now reports:
    • RequiredNotUndefined as a forgotten export.
    • ResolvedPluginReactLynxOptions missing a release tag.
      To keep the public surface clean, please adjust the TS sources so that either:
  • RequiredNotUndefined is exported from the entry point (if it’s intended to be part of the public type toolbox), or it’s no longer referenced from a public alias; and
  • ResolvedPluginReactLynxOptions is annotated with an explicit release tag (@public, @alpha, etc.), or marked @internal if you don’t want it public.

Then re‑run pnpm turbo api-extractor -- --local and commit the regenerated report rather than editing this file directly.

As per coding guidelines, API report files should only be updated via API Extractor output.

Also applies to: 51-54, 59-80, 82-83, 97-101

packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md (2)

134-139: Address the ae-forgotten-export warning for SetRequired.

The API report shows a warning that SetRequired needs to be exported by the entry point. While this is an internal utility type, consumers may need it to understand the ResolvedLynxTemplatePluginOptions type fully.

Consider either:

  1. Exporting SetRequired from the entry point, or
  2. Documenting that ResolvedLynxTemplatePluginOptions uses type-fest's SetRequired utility

103-116: New LynxTemplateOptions interface needs release tag.

The API report shows ae-missing-release-tag warning. Consider adding @public or @alpha tag to the TSDoc for LynxTemplateOptions interface in the source file.

packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts (1)

228-232: Consider simplifying SetRequired utility type.

The current implementation includes a redundant mapping. A simpler version achieves the same result:

-type SetRequired<T, K extends keyof T> =
-  & {
-    [P in keyof T]: T[P];
-  }
-  & { [P in K]-?: T[P] };
+type SetRequired<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;

Comment on lines +44 to +60
"object.groupby": "^1.0.3",
"object.pick": "^1.3.0"
},
"devDependencies": {
"@lynx-js/test-tools": "workspace:*",
"@lynx-js/vitest-setup": "workspace:*",
"@microsoft/api-extractor": "catalog:",
"@types/css-tree": "^2.3.11",
"@types/object.groupby": "^1.0.4",
"@types/object.pick": "^1.3.4",
"@upupming/type-config": "0.0.1",
"css-loader": "^7.1.2",
"webpack": "^5.102.0"
},
"peerDependencies": {
"@upupming/type-config": ">=0.0.1"
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if @upupming/type-config is published on npm
npm view @upupming/type-config@0.0.1 2>&1 | head -20

echo "---"

# Search for all usages of @upupming/type-config in the monorepo
rg "@upupming/type-config" --type json -A 1

echo "---"

# Check the package structure to understand the scope
git ls-files | grep -E "(package\.json|tsconfig)" | head -20

Repository: lynx-family/lynx-stack

Length of output: 188


🌐 Web query:

@upupming/type-config npm package 0.0.1

💡 Result:

I couldn't find an npm package named @upupming/type-config (v0.0.1) on the public registry. I did find other @upupming scoped packages (e.g. @upupming/hexo-renderer-markdown-it-plus), which shows the scope exists. [1][2]

If you want to verify locally, run:

  • npm view @upupming/type-config@0.0.1
    If the package/version doesn't exist you'll get a "404 Not Found" (or no output). For general npm registry usage see the npm config/docs. [2]

Sources:

Citations:


@upupming/type-config@0.0.1 does not exist on the public npm registry.

The package added as both a devDependency and peerDependency is not published on npm. If this is an external package, it must be published before the peer dependency can work. If it's an internal package, it should use the @lynx-js scope and the workspace:* protocol instead.

Verify:

  1. Whether @upupming/type-config is published to npm (check version 0.0.1 specifically)
  2. If internal to the monorepo, move it under @lynx-js scope and update references to use workspace protocol
  3. If the peer dependency pattern is necessary or if the package should be a regular dependency

@upupming upupming requested review from HuJean and luhc228 December 8, 2025 11:05
"@lynx-js/react-rsbuild-plugin": minor
---

Use `@upupming/type-config` for Lynx configuration types. Now you can configure Lynx configurations with type safety and autocompletion in `pluginReactLynx`.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lynx-js/type-config ?

@upupming upupming marked this pull request as draft December 10, 2025 02:55
@upupming
Copy link
Copy Markdown
Collaborator Author

Closed, we use #2052 instead

@upupming upupming closed this Dec 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants