test(cli): 打开 web 构建集成测试 - #39
Conversation
WalkthroughAdds exclude patterns to multiple rstest.config.js files. Updates numerous rsmax-cli test fixtures: renumbered webpack module IDs, revised turbo-pages basic page wiring and React default import usage, vendor runtime option rename from history to navigate, runtime version strings updated, and introduces new multi-page and single-page web expected fixtures (HTML/CSS/JS/runtime). Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor App
participant Runtime as Runtime
participant PageMod as pages/index.js
participant NativeComp as NativeComponent
participant R as rsmax-runtime
App->>Runtime: Load bundle
Runtime->>PageMod: require(module 54)
Note over PageMod: Default export is a native component
PageMod->>NativeComp: createNativeComponent('native-component-index-...')
PageMod-->>Runtime: export default NativeComp
Runtime->>R: createPageConfig(NativeComp, 'pages/index')
R-->>Runtime: PageConfig
Runtime->>App: Page(PageConfig)
sequenceDiagram
autonumber
actor Dev
participant Vendors as rsmax-vendors.js
participant Consumer as Runtime consumer
Dev->>Vendors: Update defaultRuntimeOptions
Note over Vendors: history → navigate
Consumer->>Vendors: Read defaultRuntimeOptions
Vendors-->>Consumer: { navigate: {...}, ... }
Consumer->>Consumer: Merge acc.navigate = option.navigate ?? acc.navigate
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Pre-merge checks (3 passed)✅ Passed checks (3 passed)
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ast-grep (0.38.6)packages/rsmax-cli/src/__tests__/integration/fixtures/turbo-pages-basic/expected/rsmax-vendors.js✨ Finishing Touches
🧪 Generate unit tests
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
packages/rsmax-cli/src/__tests__/integration/fixtures/turbo-pages-basic/expected/rsmax-vendors.js (2)
983-990: Make lifecycle unsubscription robust (avoid splicing -1)When the disposer is called twice (or callback already removed),
indexOfreturns -1 and splices the last item. Guard against this.- return function() { - _this.lifecycleCallback[lifecycle].splice(_this.lifecycleCallback[lifecycle].indexOf(callback), 1); - }; + return function() { + var arr = _this.lifecycleCallback[lifecycle]; + var i = arr ? arr.indexOf(callback) : -1; + if (i >= 0) arr.splice(i, 1); + };
3163-3169: Same unsubscription issue in Page lifecycleDuplicate of the App-level issue: protect against
indexOfreturning -1 beforesplice.- return function() { - _this.lifecycleCallback[lifecycle].splice(_this.lifecycleCallback[lifecycle].indexOf(callback), 1); - }; + return function() { + var arr = _this.lifecycleCallback[lifecycle]; + var i = arr ? arr.indexOf(callback) : -1; + if (i >= 0) arr.splice(i, 1); + };
🧹 Nitpick comments (27)
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/b/index.js (1)
1-14: Reduce fixture churn from numeric IDsConsider normalizing chunk/module IDs in the test harness before comparison to avoid frequent fixture updates when bundler ordering changes.
I can provide a small normalizer (regex-based) for your integration harness if helpful.
packages/rsmax-cli/src/__tests__/integration/fixtures/turbo-pages-basic/expected/runtime.js (1)
104-108: Stabilize tests against runtime version churnInstead of pinning rv/ruid literals, normalize or assert via pattern (e.g., /^1.\d+.\d+$/) to reduce needless fixture diffs when upgrading the bundler.
I can draft a small serializer/normalizer for the runtime chunk.
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/common.css (1)
356-383: Minor duplication in .rsmax-button rulesborder-radius is declared twice (Lines 364 and 372). It’s harmless but noisy in an “expected” file and increases flake risk if upstream formatting changes again. If feasible, dedupe during generation.
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/common.css (1)
356-383: Same nit: duplicate border-radius in .rsmax-buttonMirror of the multi fixture; consider dedup to keep snapshots stable.
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/pages/index/index2.js (1)
20-46: Fixture OK, but avoid side effects in snapshotsconsole.log(props) can differ under minification/treeshaking strategies. It’s fine for now, but consider dropping logs in generated “expected” artifacts to reduce diffs when toolchains evolve.
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/runtime.js (1)
147-202: Optional: add crossorigin handling for script loadingIf chunks are hosted on a different origin/CDN, setting
script.crossOrigin = 'anonymous'(when appropriate) improves error reporting and avoids CORS issues. Fixture can remain as-is if not needed.packages/rsmax-cli/src/__tests__/integration/fixtures/turbo-pages-basic/expected/rsmax-vendors.js (1)
1429-1435: Nit: simplifyformatDisplayNamehyphen handlingThe two-step
replace(/-(.)/g, ...)thenreplace(/-/g, '')works but is redundant. A single callback that drops the hyphen and uppercases the next char is enough.-function formatDisplayName(name) { - return name.replace(/-(.)/g, function($1) { - return $1.toUpperCase(); - }).replace(/-/g, '').replace(/^(.)/, function($1) { - return $1.toUpperCase(); - }); -} +function formatDisplayName(name) { + return name + .replace(/-([a-z])/g, (_, ch) => ch.toUpperCase()) + .replace(/^(.)/, (_, ch) => ch.toUpperCase()); +}packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/index.css (4)
364-372: Duplicateborder-radiusdeclaration
.rsmax-buttondefinesborder-radius: 2PX;twice. Safe to remove the duplicate to keep the fixture concise..rsmax-button { /* prettier-ignore */ font-size: 18PX; /* prettier-ignore */ height: 47PX; /* prettier-ignore */ line-height: 47PX; /* prettier-ignore */ border-radius: 2PX; @@ text-align: center; - /* prettier-ignore */ - border-radius: 2PX; overflow: hidden;
520-523: Broaden anchor reset beyond WebKit
a:-webkit-any-linkis WebKit-specific. Add a standard:any-link(and/or plaina) fallback so the reset applies cross-browser.a:-webkit-any-link { -webkit-text-decoration: none; text-decoration: none; } +/* Cross-browser fallback */ +a:any-link, +a { + text-decoration: none; +}
471-487: Very high z-index on tab bar
z-index: 999999;can eclipse app overlays/modals. If not required by tests, consider a lower, conventional stacking context (e.g., 1000–2000).
356-382: Note on uppercase “PX” unitsUppercase
PXis valid CSS, but style tooling may flag it. It looks intentional here (to avoid unit plugins), just calling it out for future maintainability.packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/runtime.js (3)
85-93: CSP-unsafe global detection fallback
new Function('return this')()violates strict CSP. Prefer pure checks; only change if you own the runtime source (not an exact fixture).-__webpack_require__.g = (() => { - if (typeof globalThis === 'object') return globalThis; - try { - return this || new Function('return this')(); - } catch (e) { - if (typeof window === 'object') return window; - } -})(); +__webpack_require__.g = (() => { + if (typeof globalThis === 'object') return globalThis; + if (typeof self === 'object') return self; + if (typeof window === 'object') return window; + if (typeof global === 'object') return global; + return {}; +})();
184-187: Avoid directselffor chunk globalUsing
selfassumes a web worker/window global. For broader compatibility, source the global from__webpack_require__.g. Keep as-is if this must match exact rspack output.-var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || []; +var g = __webpack_require__.g; +var chunkLoadingGlobal = g["webpackChunk"] = g["webpackChunk"] || [];
146-147: Normalize pinned bundler version in fixtures
The integration fixtures underpackages/rsmax-cli/src/__tests__/integration/fixturesall hardcode rspack’s version (“1.5.2”) via__webpack_require__.rvand__webpack_require__.ruid, causing churn on every bump; consider normalizing or regex-replacing these values in your tests instead of updating the generated artifacts.packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/pages/index/index2.html (1)
2-8: HTML nit: readability and semantics (only if tests don’t assert exact bytes)Split resources onto separate lines, move CSS before JS to reduce FOUC, add
langand a<title>. Keep current form if fixtures must match exact output.-<html> +<html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"> - <script defer src="../../runtime.js"></script><script defer src="../../common.js"></script><script defer src="../../pages/index/index2.js"></script><link href="../../common.css" rel="stylesheet"></head> + <title>RSMax App</title> + <link rel="stylesheet" href="../../common.css"> + <script defer src="../../runtime.js"></script> + <script defer src="../../common.js"></script> + <script defer src="../../pages/index/index2.js"></script> +</head>packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/pages/index/index.html (1)
2-8: Mirror the small HTML improvements from index2 (if allowed by tests)Same readability/semantics nits:
lang,<title>, CSS before JS, multi-line tags.-<html> +<html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"> - <script defer src="../../runtime.js"></script><script defer src="../../common.js"></script><script defer src="../../pages/index/index.js"></script><link href="../../common.css" rel="stylesheet"></head> + <title>RSMax App</title> + <link rel="stylesheet" href="../../common.css"> + <script defer src="../../runtime.js"></script> + <script defer src="../../common.js"></script> + <script defer src="../../pages/index/index.js"></script> +</head>packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/index.html (2)
2-6: Add lang and title for accessibility/SEO (optional).Including a language hint and a title improves a11y and parity with other fixtures.
Apply:
-<html> +<html lang="zh-CN"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"> - <script defer src="/runtime.js"></script><script defer src="/index.js"></script><link href="/index.css" rel="stylesheet"></head> + <title>RSMax</title> + <link href="/index.css" rel="stylesheet"> + <script defer src="/runtime.js"></script> + <script defer src="/index.js"></script> +</head>Note: changing fixtures requires aligning the generator and expected outputs.
11-11: Missing trailing newline.EOF newline avoids tooling diffs.
-</body></html> +</body></html> +packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/pages/index/index2.html (1)
2-7: Mirror head structure: lang/title and load CSS before JS (optional).Keeps consistency with the root fixture and reduces FOUC.
-<html> +<html lang="zh-CN"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"> - <script defer src="../../runtime.js"></script><script defer src="../../common.js"></script><script defer src="../../pages/index/index2.js"></script><link href="../../common.css" rel="stylesheet"></head> + <title>RSMax - Index2</title> + <link href="../../common.css" rel="stylesheet"> + <script defer src="../../runtime.js"></script> + <script defer src="../../common.js"></script> + <script defer src="../../pages/index/index2.js"></script> +</head>packages/rsmax-cli/src/__tests__/integration/web.test.ts (1)
1-3: Increase Jest timeout to avoid flaky CI on full web builds.Web builds can exceed Jest’s default 5s.
import { testBuildApp } from './helpers/runTest'; import path from 'node:path'; +jest.setTimeout(120000);packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/pages/index/index.js (2)
61-62: Inconsistent class vs className usage on web components (verify generator intent).Compiled output mixes
class(here) andclassNameelsewhere; ensure the web runtime readsclasson RSMax.Swiper or adjust generator to emitclassNameuniformly.
94-131: Minor: unused parameter.
propsis unused in the default export. Safe to keep in compiled output, but if the generator can elide it, size gets a tiny win.packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/src/index.js (1)
3-3: LGTM: module-id reindex onlyOnly the inline module key and webpack_exec target changed (96→86). No functional impact on the fixture.
These fixtures are brittle against module-id churn. Consider normalizing numeric ids in test assertions to reduce maintenance. Example helper (apply before snapshot/compare):
function normalizeModuleIds(code) { return code // "87: (function" → "X: (function" .replace(/^\s*\d+\s*:\s*\(function\b/gm, 'X: (function') // "__webpack_exec__(87)" → "__webpack_exec__(X)" .replace(/__webpack_exec__\(\d+\)/g, '__webpack_exec__(X)') // chunk id strings ["11"] → ["X"] .replace(/\[\s*"\d+"\s*\]/g, '["X"]'); }Also applies to: 11-11
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/complex/index.js (1)
17-21: Make tests resilient to module-id renumberingId drift (exec 97→87) forces wide fixture edits. Prefer deterministic ids in build (optimization.moduleIds/chunkIds='deterministic') or snapshot normalization as suggested in the other comment.
Happy to add a per-target “normalizeBundle” in the test harness if you want.
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/npm/commonjs/index.js (1)
122-124: Future-proof tests against id churnEntry exec moved 89→94. Apply the module-id normalization approach to reduce fixture churn across bundler/version updates.
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/pages/index/index.js (1)
27-29: Nit:classvsclassNameprop consistencyYou use
classon Swiper butclassNameelsewhere. If RSMax Swiper acceptsclassNameon web, prefer being consistent; otherwise, ignore.- class: "demo-swiper", + className: "demo-swiper",Point me to the Swiper web prop API if
classis required; I’ll drop this nit.packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/rsmax-styles.js (1)
1-13: Reduce snapshot noise from numeric module/chunk idsConsider normalizing ids in this JS module too (same helper as earlier) to avoid future churn when adding/removing imports affects numbering.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (34)
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/a/index.js(2 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/b/index.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/c/index.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/complex/index.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/e/index.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/notInJSX/index.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/slot/index.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/src/index.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/npm/commonjs/index.js(4 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/npm/moduleB/index.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/turbo-pages-basic/expected/pages/index.js(5 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/turbo-pages-basic/expected/rsmax-vendors.js(63 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/turbo-pages-basic/expected/runtime.js(2 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/common.css(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/index.css(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/index.html(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/pages/index/index.html(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/pages/index/index.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/pages/index/index2.html(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/pages/index/index2.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/rsmax-styles.css(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/rsmax-styles.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/runtime.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/common.css(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/index.css(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/index.html(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/pages/index/index.html(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/pages/index/index.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/pages/index/index2.html(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/pages/index/index2.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/rsmax-styles.css(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/rsmax-styles.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/runtime.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/web.test.ts(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (28)
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/slot/index.js (3)
packages/rsmax-cli/src/build/webpack/plugins/ComponentAsset/index.ts (3)
apply(20-54)compilation(21-53)ComponentAssetPlugin(12-55)packages/rsmax-cli/src/build/webpack/config.miniComponent.ts (2)
webpackConfig(30-256)entry(178-182)packages/rsmax-cli/src/build/webpack/loaders/nativeComponent.ts (1)
nativeModule(16-66)
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/src/index.js (2)
packages/rsmax-cli/src/build/webpack/loaders/nativeComponent.ts (1)
nativeModule(16-66)packages/rsmax-cli/src/build/webpack/plugins/ComponentAsset/index.ts (2)
apply(20-54)compilation(21-53)
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/e/index.js (2)
packages/rsmax-cli/src/build/webpack/config.miniComponent.ts (2)
webpackConfig(30-256)e(39-42)packages/rsmax-cli/src/build/webpack/loaders/nativeComponent.ts (1)
nativeModule(16-66)
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/a/index.js (3)
packages/rsmax-cli/src/build/webpack/config.miniComponent.ts (2)
entry(178-182)webpackConfig(30-256)packages/rsmax-cli/src/build/webpack/config.mini.ts (1)
e(51-54)packages/rsmax-cli/src/build/webpack/plugins/OptimizeEntries.ts (1)
OptimizeEntriesPlugin(11-116)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/pages/index/index2.html (1)
packages/rsmax-cli/src/__tests__/integration/fixtures/hook-on-entries/rsmax.config.js (1)
entries(6-12)
packages/rsmax-cli/src/__tests__/integration/web.test.ts (1)
packages/rsmax-cli/src/__tests__/integration/helpers/build.ts (3)
buildApp(44-125)configWebpack(65-81)configWebpack(148-159)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/index.html (1)
packages/rsmax-cli/src/__tests__/integration/helpers/build.ts (1)
buildApp(44-125)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/index.css (4)
packages/rsmax-cli/src/__tests__/integration/fixtures/hybrid-app/rsmax.config.js (2)
addCSSRule(1-9)addCSSRule(2-8)packages/rsmax-cli/src/__tests__/integration/fixtures/config-add-css-rule/rsmax.config.js (1)
ctx(2-7)packages/rsmax-cli/src/build/webpack/config/css.ts (2)
addCSSRule(23-82)cssConfig(84-110)packages/rsmax-cli/src/build/webpack/webBaseConfig.ts (2)
ruleConfig(121-123)webBaseConfig(11-132)
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/notInJSX/index.js (1)
packages/rsmax-cli/src/build/webpack/plugins/NativeAsset.ts (1)
builder(33-39)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/common.css (5)
packages/rsmax-cli/src/__tests__/integration/fixtures/hybrid-app/rsmax.config.js (2)
addCSSRule(1-9)addCSSRule(2-8)packages/rsmax-cli/src/build/webpack/config/css.ts (2)
cssConfig(84-110)addCSSRule(23-82)packages/rsmax-cli/src/build/NativeAssets.ts (1)
findInCSS(133-170)packages/rsmax-cli/src/build/webpack/webBaseConfig.ts (1)
webBaseConfig(11-132)packages/rsmax-cli/src/build/webpack/plugins/OptimizeEntries.ts (1)
requireStyles(94-115)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/pages/index/index.html (1)
packages/rsmax-cli/src/__tests__/integration/helpers/build.ts (1)
buildApp(44-125)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/runtime.js (2)
packages/rsmax-cli/src/build/webpack/plugins/RuntimeOptions.ts (3)
compilation(24-40)RuntimeOptionsPlugin(16-113)createRuntimeOptions(43-58)packages/rsmax-cli/src/build/webpack/webBaseConfig.ts (1)
webBaseConfig(11-132)
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/c/index.js (2)
packages/rsmax-cli/src/build/webpack/config.miniComponent.ts (1)
webpackConfig(30-256)packages/rsmax-cli/src/build/webpack/plugins/OptimizeEntries.ts (1)
OptimizeEntriesPlugin(11-116)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/rsmax-styles.css (1)
packages/rsmax-cli/src/build/webpack/config/css.ts (2)
addCSSRule(23-82)cssConfig(84-110)
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/complex/index.js (2)
packages/rsmax-cli/src/build/webpack/config.miniComponent.ts (2)
webpackConfig(30-256)entry(178-182)packages/rsmax-cli/src/build/webpack/webBaseConfig.ts (1)
webBaseConfig(11-132)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/pages/index/index.js (1)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/rsmax-styles.js (1)
__WEBPACK_DEFAULT_EXPORT__(9-9)
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/npm/moduleB/index.js (3)
packages/rsmax-cli/src/build/webpack/config.miniComponent.ts (2)
webpackConfig(30-256)entry(178-182)packages/rsmax-cli/src/build/webpack/plugins/ComponentAsset/index.ts (2)
apply(20-54)compilation(21-53)packages/rsmax-cli/src/build/webpack/loaders/nativeComponent.ts (1)
nativeModule(16-66)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/pages/index/index.js (3)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/rsmax-styles.js (1)
__WEBPACK_DEFAULT_EXPORT__(9-9)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/rsmax-styles.js (1)
__WEBPACK_DEFAULT_EXPORT__(9-9)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/common.js (4)
__WEBPACK_DEFAULT_EXPORT__(9-9)__WEBPACK_DEFAULT_EXPORT__(537-537)__WEBPACK_DEFAULT_EXPORT__(41113-41113)__WEBPACK_DEFAULT_EXPORT__(41136-41136)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/common.css (5)
packages/rsmax-cli/src/__tests__/integration/fixtures/hybrid-app/rsmax.config.js (2)
addCSSRule(1-9)addCSSRule(2-8)packages/rsmax-cli/src/__tests__/integration/fixtures/config-add-css-rule/rsmax.config.js (1)
ctx(2-7)packages/rsmax-cli/src/build/webpack/config/css.ts (2)
cssConfig(84-110)addCSSRule(23-82)packages/rsmax-cli/src/build/webpack/webBaseConfig.ts (2)
webBaseConfig(11-132)ruleConfig(121-123)packages/rsmax-cli/src/build/NativeAssets.ts (1)
findInCSS(133-170)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/rsmax-styles.js (1)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/rsmax-styles.js (1)
__WEBPACK_DEFAULT_EXPORT__(9-9)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/rsmax-styles.js (2)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/rsmax-styles.js (1)
__WEBPACK_DEFAULT_EXPORT__(9-9)packages/rsmax-cli/src/build/webpack/config/css.ts (2)
addCSSRule(23-82)cssConfig(84-110)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/pages/index/index2.js (1)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/rsmax-styles.js (1)
__WEBPACK_DEFAULT_EXPORT__(9-9)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/index.css (2)
packages/rsmax-cli/src/build/webpack/config/css.ts (2)
addCSSRule(23-82)cssConfig(84-110)packages/postcss-rsmax-tag/index.js (1)
rule(12-26)
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/npm/commonjs/index.js (1)
packages/rsmax-cli/src/build/webpack/config.miniComponent.ts (1)
e(39-42)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/pages/index/index2.js (2)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/rsmax-styles.js (1)
__WEBPACK_DEFAULT_EXPORT__(9-9)packages/rsmax-cli/src/build/entries/MpaEntry.ts (2)
MpaEntry(3-38)outputSource(4-37)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/runtime.js (1)
packages/rsmax-cli/src/build/webpack/plugins/RuntimeOptions.ts (4)
compilation(24-40)page(65-84)createRuntimeOptions(43-58)apply(23-41)
packages/rsmax-cli/src/__tests__/integration/fixtures/turbo-pages-basic/expected/rsmax-vendors.js (4)
packages/rsmax-framework-shared/src/RuntimeOptions.ts (2)
get(59-61)reset(63-65)packages/rsmax-web/src/createApp.tsx (2)
navigate(27-73)RuntimeOptions(30-32)packages/rsmax-cli/src/build/webpack/plugins/RuntimeOptions.ts (7)
RuntimeOptionsPlugin(16-113)page(65-84)apply(23-41)acc(78-80)compilation(24-40)getPageEvents(60-87)createRuntimeOptions(43-58)packages/rsmax-types/src/index.ts (1)
RuntimePlugin(212-236)
packages/rsmax-cli/src/__tests__/integration/fixtures/turbo-pages-basic/expected/pages/index.js (4)
e2e/app/src/pages/turbo-page/index.js (4)
count(38-38)show(39-39)showPlainText(42-42)Index(37-103)packages/rsmax-cli/src/build/webpack/plugins/PageAsset/createTurboTemplate.ts (2)
createTurboTemplate(11-56)t(23-28)packages/rsmax-cli/src/build/webpack/plugins/PageAsset/index.ts (2)
page(50-69)apply(22-75)packages/rsmax-web/src/createApp.tsx (1)
default(20-21)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: build (ubuntu-latest, 18)
- GitHub Check: build (ubuntu-latest, 20)
🔇 Additional comments (23)
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/b/index.js (1)
3-3: LGTM: module-id reindex is internally consistentModule key 91 matches the webpack_exec(91) call; no functional changes.
Also applies to: 11-11
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/slot/index.js (1)
3-3: LGTM: reindexed to 92 correctlyModule map key and webpack_exec both use 92; structure unchanged.
Also applies to: 11-11
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/c/index.js (1)
3-3: LGTM: reindexed to 90IDs are consistent; no behavior change.
Also applies to: 11-11
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/notInJSX/index.js (1)
3-3: LGTM: reindexed to 85Map key and exec call match; safe change.
Also applies to: 11-11
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/npm/moduleB/index.js (1)
3-3: LGTM: reindexed to 93Internal ID and execution reference are aligned.
Also applies to: 11-11
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/e/index.js (1)
3-3: LGTM: reindexed to 83Consistent IDs; no logic changes.
Also applies to: 11-11
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/a/index.js (1)
4-4: LGTM: reindexed to 89 with ESM wiring intactDefault export wiring remains correct; IDs match.
Also applies to: 17-17
packages/rsmax-cli/src/__tests__/integration/fixtures/turbo-pages-basic/expected/runtime.js (1)
106-106: LGTM: runtime identity bumped to rspack 1.5.2rv/ruid updated to 1.5.2; aligns with other fixtures.
Also applies to: 151-151
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/index.css (1)
1-525: Comprehensive baseline CSS for web integration tests.The CSS combines Normalize.css v8.0.1 with RSMax component styles. The RSMax-specific classes (
.rsmax-*) provide proper defaults for button, input, textarea, image, and tab-bar components. Vendor prefixes and responsive units are appropriately applied.packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/index.html (1)
2-11: Normalize HTML fixture formatting and ensure trailing newline
Byte-for-byte tests break on a single-line<head>and missing final newline. Normalize whitespace/EOL in the fixture generator or relax assertions (e.g. trim or ignore line endings) to stabilize integrations.packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/rsmax-styles.js (1)
8-9: LGTM: CSS Modules mapping looks consistent with common.cssThe token map matches hashed classnames defined in the CSS fixtures. No issues.
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/pages/index/index.html (1)
6-6: All referenced assets exist in test fixtureruntime.js, common.js, pages/index/index.js, and common.css are present under packages/rsmax-cli/src/tests/integration/fixtures/web/expected; no missing assets or path issues detected.
packages/rsmax-cli/src/__tests__/integration/fixtures/turbo-pages-basic/expected/pages/index.js (2)
165-171: React.Children.map + cloneElement usage looks correctProps are spread as intended and keys are applied at call sites. No concerns.
13-14: Normalize and stabilize native component IDs
- The hash suffix in
native-component-index-f24c316is derived at build time—verify the loader’s hashing uses only a normalized, project-relative input (e.g. file content or path with consistent separators) so IDs remain stable across platforms and tool versions.- If true determinism can’t be guaranteed, relax the integration test to match
/native-component-index-[0-9a-f]{7,}/instead of hard-coding the full ID.packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/runtime.js (2)
252-254: Public path hardcoded to “/” — verify subpath deploymentsIf tests (or consumers) ever serve bundles from a subpath (e.g., /app/), a hardcoded public path may break chunk/CSS loading. Consider parameterizing
__webpack_require__.por adjusting the test harness to set__webpack_public_path__before runtime init.Would you like me to add a small prelude in the test HTML to set
__webpack_public_path__dynamically based on<base>or script src?
231-236: Suspicious constant in scheduler gating condition
(priority & (1 === 0) || notFulfilled >= priority)— the(1 === 0)part is always false, making the left side a no-op. Likely harmless as a fixture, but worth confirming this matches the intended Rspack runtime logic for__webpack_require__.O.I can diff against upstream Rspack/Webpack runtime to confirm parity. Want me to run that check?
packages/rsmax-cli/src/__tests__/integration/fixtures/turbo-pages-basic/expected/rsmax-vendors.js (1)
1210-1242: RuntimeOptions: renamehistory→navigatein source
Ensure no remainingruntimeOptions.historyreferences outside test fixtures—search withrg -nP 'runtimeOptions\.history' packages/rsmax-cli/srcand update any
.historyaccesses to.navigate.packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/runtime.js (1)
1-25: Bootstrap/module cache looks standardModule cache and require wrapper mirror webpack/rspack patterns; no concerns here.
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/complex/index.js (1)
3-15: LGTM: correct CSS-first require ordering retainedModule 87 requires 88 (CSS) before invoking Component({}), preserving side‑effect ordering. Only ids changed (98/97→88/87).
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/rsmax-styles.css (1)
1-44: LGTM: CSS modules output matches px→rem configRules and vendor-prefixed keyframes align with the configured css-loader/postcss pipeline.
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/npm/commonjs/index.js (1)
53-66: LGTM: commonjs/esm interop preservedfmtEvent and module-a/esmodule wiring unchanged; ids shifted (+5). No behavior change.
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/rsmax-styles.css (1)
1-44: LGTM: mirrors single-web CSS module tokensConsistent token set across single/multi fixtures; good for cross-target assertions.
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/rsmax-styles.js (1)
3-10: LGTM: CSS module token map matches loader configTokens reflect
[local]___[hash:base64:5]. Keep this in sync with css-loader options to avoid unexpected diffs.
| /* ESM import */var _rsmax_web_assets_normalize_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); | ||
| /* ESM import */var _rsmax_web_assets_app_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2); | ||
| /* ESM import */var _app__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3); | ||
| /* ESM import */var _Users_wangjue_WebstormProjects_rspack_rsmax_packages_rsmax_cli_src_tests_integration_fixtures_web_src_pages_index_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5); |
There was a problem hiding this comment.
Environment-specific absolute path leaked into bundle variable names — tests will be non-deterministic across machines.
The identifier derived from an absolute path (e.g., “Users_wangjue…index_js”) will differ on CI/other dev boxes, breaking fixture comparisons.
Two viable fixes:
- Prefer deterministic codegen in test builds:
// packages/rsmax-cli/src/__tests__/integration/helpers/build.ts
context.config
.mode('none')
.plugins.delete('rspackbar')
.end()
+ .output.pathinfo(false)
+ .end()
.resolve.alias.merge({...})
.end()
.end()
.externals([...(context.config.get('externals') || []), ...externals])
- .optimization.minimize(false);
+ .optimization
+ .minimize(true)
+ .moduleIds('deterministic')
+ .chunkIds('deterministic');- Or, normalize dynamic paths before asserting fixture equality (e.g., replace absolute paths with in the test harness).
I can draft the sanitizer if you prefer that route.
🤖 Prompt for AI Agents
In
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/pages/index/index.js
around line 8, the bundle contains an environment-specific absolute path in a
generated variable name (e.g., “_Users_wangjue_…index_js”) which makes test
fixtures non-deterministic; fix by normalizing or removing machine-specific
paths during test generation: either configure the test build to produce
deterministic identifiers (e.g., disable embedding absolute paths in names via
the bundler config / name templates or enable path-mangling options) or, more
simply and quickly, sanitize the produced bundle before asserting by replacing
any absolute workspace paths with a stable token like <ROOT> (implement a small
sanitizer in the test harness that canonicalizes backslashes/forward slashes and
replaces occurrences of project-root-prefixed paths with <ROOT> prior to
snapshot/fixture comparison).
| /* ESM import */var _Users_wangjue_WebstormProjects_rspack_rsmax_packages_rsmax_cli_src_tests_integration_fixtures_web_src_pages_index_index2_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(197); | ||
| /* ESM import */var _rsmax_web__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9); | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| (0,_rsmax_web__WEBPACK_IMPORTED_MODULE_4__.bootstrapMpa)({ | ||
| appComponent: _app__WEBPACK_IMPORTED_MODULE_2__["default"], | ||
| pageComponent: _Users_wangjue_WebstormProjects_rspack_rsmax_packages_rsmax_cli_src_tests_integration_fixtures_web_src_pages_index_index2_js__WEBPACK_IMPORTED_MODULE_3__["default"], | ||
| page: { |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Critical: absolute filesystem paths baked into emitted code make tests non-portable
The generated variable/import name embeds an absolute path (e.g., “Users_wangjue..._index2_js”), which will differ across machines/CI and break these fixtures.
Preferred fix: generate a stable import in MpaEntry so bundling never uses absolute paths. Based on your MpaEntry snippet, replace the absolute import with an alias-relative one.
Apply this diff in packages/rsmax-cli/src/build/entries/MpaEntry.ts:
@@
- import App from '@/app';
- import Page from '${this.filename}';
+ import App from '@/app';
+ // Import page via src alias to avoid absolute filesystem paths in output
+ import Page from '${this.builder.api.resolveAlias
+ ? this.builder.api.resolveAlias(this.filename, "@/")
+ : "@/"+require("path").posix
+ .relative(this.builder.projectPath.srcDir(), this.filename)
+ .replace(/\.(t|j)sx?$/, "")}';If resolveAlias isn’t available, add a small helper to compute posix-relative path from srcDir and prefix with "@/".
As an immediate workaround for the fixtures (if you can’t change the generator in this PR), mask absolute paths in tests before assertion.
I can raise a follow-up PR to update MpaEntry and refresh fixtures—want me to proceed?
🏁 Script executed:
#!/bin/bash
# Scan all web expected artifacts for absolute path patterns
set -euo pipefail
rg -nP '(?:^|[^a-z])(/Users/|[A-Za-z]:\\\\)' packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi || trueLength of output: 0
🏁 Script executed:
#!/bin/bash
# Scan expected artifacts for variable names containing absolute path segments with underscores
set -euo pipefail
rg -n '_Users_' packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi || trueLength of output: 1157
Replace absolute filesystem paths in MPA entry imports
Integration fixtures under packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi include imports like _Users_wangjue_… that vary per machine and break portability. Update packages/rsmax-cli/src/build/entries/MpaEntry.ts to emit alias-relative imports instead:
@@ packages/rsmax-cli/src/build/entries/MpaEntry.ts
- import Page from '${this.filename}';
+ // Import page via src alias to avoid absolute file paths
+ import Page from '${
+ this.builder.api.resolveAlias
+ ? this.builder.api.resolveAlias(this.filename, "@/")!
+ : "@/"+require("path").posix
+ .relative(this.builder.projectPath.srcDir(), this.filename)
+ .replace(/\.(t|j)sx?$/, "")
+ }';This guarantees stable import names across environments. As a stopgap, strip absolute path segments from fixture outputs before snapshot assertions.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /* ESM import */var _Users_wangjue_WebstormProjects_rspack_rsmax_packages_rsmax_cli_src_tests_integration_fixtures_web_src_pages_index_index2_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(197); | |
| /* ESM import */var _rsmax_web__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9); | |
| (0,_rsmax_web__WEBPACK_IMPORTED_MODULE_4__.bootstrapMpa)({ | |
| appComponent: _app__WEBPACK_IMPORTED_MODULE_2__["default"], | |
| pageComponent: _Users_wangjue_WebstormProjects_rspack_rsmax_packages_rsmax_cli_src_tests_integration_fixtures_web_src_pages_index_index2_js__WEBPACK_IMPORTED_MODULE_3__["default"], | |
| page: { | |
| @@ packages/rsmax-cli/src/build/entries/MpaEntry.ts | |
| // Import page via src alias to avoid absolute file paths | |
| import Page from `${ | |
| this.builder.api.resolveAlias | |
| ? this.builder.api.resolveAlias(this.filename, "@/")! | |
| : "@/"+require("path").posix | |
| .relative(this.builder.projectPath.srcDir(), this.filename) | |
| .replace(/\.(t|j)sx?$/, "") | |
| }'; |
🤖 Prompt for AI Agents
In
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/pages/index/index2.js
around lines 8 to 18 there are absolute filesystem paths embedded in the MPA
entry imports (e.g. _Users_wangjue_…) which break portability; update
packages/rsmax-cli/src/build/entries/MpaEntry.ts to emit alias-relative or
project-root-relative import identifiers (use your existing project alias or
compute a stable relative path from project root, normalize separators, and
strip user/drive segments) instead of embedding absolute paths so generated
fixtures are deterministic; as a short-term fallback, add a sanitizer in the
test snapshot step to strip or normalize absolute path segments from fixture
outputs before asserting.
| for (var j = 0; j < chunkIds.length; j++) { | ||
| if ( | ||
| (priority & (1 === 0) || notFulfilled >= priority) && | ||
| Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j]))) | ||
| ) { | ||
| chunkIds.splice(j--, 1); | ||
| } else { | ||
| fulfilled = false; | ||
| if (priority < notFulfilled) notFulfilled = priority; |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Likely precedence bug in deferred orchestration condition
priority & (1 === 0) always evaluates to 0. This likely intended ((priority & 1) === 0). If this runtime is meant to mirror rspack 1.5.2 output verbatim, please re-generate to avoid manual drift. Otherwise, fix as below.
- if (
- (priority & (1 === 0) || notFulfilled >= priority) &&
+ if (
+ (((priority & 1) === 0) || notFulfilled >= priority) &&
Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))
) {To verify occurrence across fixtures:
🏁 Script executed:
#!/bin/bash
# Find suspicious precedence across repo
rg -n "priority\s*&\s*\(1\s*===\s*0\)" -C2Length of output: 20526
Update runtime template to use ((priority & 1) === 0) instead of priority & (1 === 0) and regenerate fixtures. This incorrect bitwise check appears in every runtime.js under packages/rsmax-cli/src/__tests__/integration/fixtures/**/expected; fix the template or bundler runtime and rerun tests to regenerate all affected fixtures.
🤖 Prompt for AI Agents
In
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/runtime.js
around lines 123 to 131, the runtime contains an incorrect bitwise check written
as "priority & (1 === 0)" which always evaluates wrong; change the expression to
"((priority & 1) === 0)" in the runtime template or bundler runtime generator
and then regenerate the fixtures so all affected expected/runtime.js files under
packages/rsmax-cli/src/__tests__/integration/fixtures/**/expected use the
corrected check.
| className: _index_css_modules__WEBPACK_IMPORTED_MODULE_1__["default"].text, | ||
| children: [ | ||
| "\u7F16\u8F91", | ||
| /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(rsmax__WEBPACK_IMPORTED_MODULE_0__.Text, { | ||
| className: _index_css_modules__WEBPACK_IMPORTED_MODULE_1__["default"].path, | ||
| children: "src/pages/index/index.js" | ||
| }), | ||
| " \u5F00\u59CB" |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Verify: styles.path is referenced but not in the exported CSS module map
This fixture accesses default.path, but the provided CSS module mapping (module 194 in rsmax-styles.js) shows only app/logo/logo-spin/text/header. If 194 is indeed the imported stylesheet for this page, path will be undefined at runtime.
Run to confirm and locate a .path rule:
If missing, either add .path { … } to the source CSS used for this page (so it appears in the module map) or stop using styles.path here. Quick fix in the emitted fixture:
- className: _index_css_modules__WEBPACK_IMPORTED_MODULE_1__["default"].path,
+ className: _index_css_modules__WEBPACK_IMPORTED_MODULE_1__["default"].text,I can patch the source fixture and regenerate the expected outputs if you want.
🏁 Script executed:
#!/bin/bash
# Check CSS-module maps that back module 194
rg -n '"path"' packages/rsmax-cli/src/__tests__/integration/fixtures/web -g '**/rsmax-styles.js' -S
# Look for a `.path` class in web CSS fixtures
rg -nP '^\s*\.path\b' packages/rsmax-cli/src/__tests__/integration/fixtures/web -g '**/*.css'Length of output: 0
🏁 Script executed:
#!/bin/bash
# 1. Locate any rsmax-styles.js files in the web fixtures
echo "Locating rsmax-styles.js files..."
find packages/rsmax-cli/src/__tests__/integration/fixtures/web -type f -name 'rsmax-styles.js'
# 2. Search those files for a "path" property in the CSS module map
echo "Searching for 'path' in CSS module maps..."
for f in $(find packages/rsmax-cli/src/__tests__/integration/fixtures/web -type f -name 'rsmax-styles.js'); do
echo "-- In $f --"
rg -nP '"path"\s*:' "$f"
done
# 3. Look for a .path class definition in any CSS fixture
echo "Searching for '.path' class in CSS fixtures..."
rg -nP '^\s*\.path\b' packages/rsmax-cli/src/__tests__/integration/fixtures/web -g '**/*.css'Length of output: 485
Fix missing path CSS module export
packages/rsmax-cli/src/tests/integration/fixtures/web/expected/pages/index/index.js (lines 74–81) references styles.path, but neither of the generated rsmax-styles.js mappings nor any CSS fixture defines a .path export. Replace styles.path with styles.text or add a .path { … } rule to the source stylesheet to ensure the class exists at runtime.
🤖 Prompt for AI Agents
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/pages/index/index.js
around lines 74 to 81: the JSX uses styles.path but no CSS module export named
"path" exists in the generated rsmax-styles or fixtures, causing a missing class
at runtime; fix by either updating the JSX to use an existing export (e.g.,
replace styles.path with styles.text) or add a `.path { ... }` rule to the
source stylesheet so the CSS module generates a "path" export, then regenerate
fixtures to reflect the change.
| describe('build rsmax web app', () => { | ||
| testBuildApp('web', 'web'); | ||
| }); | ||
|
|
||
| describe.skip('build rsmax web app - multi page', () => { | ||
| describe('build rsmax web app - multi page', () => { | ||
| testBuildApp('web', 'web', path.resolve(__dirname, `./fixtures/web/expected-multi`), {}, { web: { mpa: true } }); | ||
| }); |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Confirm cwd reset between tests.
build.ts mutates process.cwd(), so ensure the test harness restores it to avoid cross-suite leakage.
Run:
Expected: either build helper restores cwd or tests wrap chdir with setup/teardown that resets it.
🏁 Script executed:
#!/bin/bash
rg -nC2 'process\.chdir\(' packages/rsmax-cli/src/__tests__/integration | cat
rg -nC2 'afterAll\(|beforeEach\(|afterEach\(' packages/rsmax-cli/src/__tests__/integration | catLength of output: 2205
Restore working directory between tests
Helpers in packages/rsmax-cli/src/__tests__/integration/helpers/build.ts and config.test.ts call process.chdir without restoring the original cwd, causing cross-suite leakage. Add an afterEach(() => process.chdir(startCwd)); (or have the helper restore cwd) in the integration tests.
🤖 Prompt for AI Agents
In packages/rsmax-cli/src/__tests__/integration/web.test.ts around lines 4 to
10, tests call helpers that change process.cwd() but do not restore it, causing
cross-suite leakage; add an afterEach hook that restores the original working
directory (capture const startCwd = process.cwd() at top of the file or before
tests run and then add afterEach(() => process.chdir(startCwd))); alternatively
update the helper functions in
packages/rsmax-cli/src/__tests__/integration/helpers/build.ts and config.test.ts
to save and restore the cwd internally so each test leaves cwd unchanged.
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (34)
packages/rsmax-wechat/rstest.config.js (1)
5-5: Confirm exclude semantics for @rstest/core.
- Verify exclude treats these as directory globs (vs regex) and paths are normalized to POSIX in CI.
- If regex is required, consider using something like
/^(?:cjs|esm|node_modules)\//.- If globbing, consider '/cjs/' style for OS-agnostic matching.
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/npm/moduleB/index.js (1)
3-3: Reduce fixture brittleness by normalizing numeric module IDs in assertions.Bundler upgrades often reshuffle internal numeric IDs and churn fixtures. Consider normalizing IDs before compare (e.g., replace digits after leading line-start module labels and inside webpack_exec(...) with placeholders). Example helper:
export function normalizeModuleIds(text) { return text // normalize " 123: (function" -> " <ID>: (function" .replace(/^\s*\d+:\s*\(/gm, m => m.replace(/\d+/, '<ID>')) // normalize "__webpack_exec__(123)" -> "__webpack_exec__(<ID>)" .replace(/__webpack_exec__\(\d+\)/g, '__webpack_exec__(<ID>)'); }Use this in your integration test diffing to compare normalized actual vs expected.
Also applies to: 11-11
packages/rsmax-ali/rstest.config.js (1)
5-5: Unify exclude patterns to recursive globs
rsmax-shared and rsmax-runtime already use recursive patterns (cjs/**/*,esm/**/*,node_modules/**/*), but others still use simple trailing-slash excludes. For consistency and to ensure all nested files/directories are excluded, update each rstest.config.js accordingly:- exclude: ['cjs/', 'esm/', 'node_modules/'], + exclude: ['cjs/**/*', 'esm/**/*', 'node_modules/**/*'],packages/rsmax-web/rstest.config.js (1)
6-6: Align exclude pattern style in packages/rsmax-web/rstest.config.js
Changeexclude: ['cjs/', 'esm/', 'node_modules/'],to
exclude: ['cjs/**/*', 'esm/**/*', 'node_modules/**/*'],packages/rsmax-toutiao/rstest.config.js (1)
5-5: Normalize exclude patterns for cross-platform matching
Switch theexcludearrays in allpackages/*/rstest.config.js(e.g. wechat, web, toutiao, one, ali) from['cjs/', 'esm/', 'node_modules/']to['cjs/**', 'esm/**', 'node_modules/**']to mirror shared/runtime and prevent drift.packages/rsmax-one/rstest.config.js (1)
5-5: Unify exclude patterns with the rest of the repoUse glob form if supported; standardize across packages to avoid accidental test collection in built outputs.
- exclude: ['cjs/', 'esm/', 'node_modules/'], + exclude: ['cjs/**', 'esm/**', 'node_modules/**'],packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/b/index.js (1)
3-3: Stabilize webpack module and chunk IDs
The build config doesn’t setoptimization.moduleIds('deterministic')oroptimization.chunkIds('deterministic'), so snapshot fixtures will flap; add those settings or normalize IDs in tests.packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/complex/index.js (1)
3-3: Same here: stabilize or normalize module IDs to prevent flaky fixturesIDs shifted (98→88, 97→87). Prefer deterministic ids in config or ID normalization during snapshot comparison to avoid churn on unrelated changes.
Refer to the config/test-harness snippets in my previous comment for concrete changes.
Also applies to: 10-11, 19-19
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/npm/commonjs/index.js (1)
3-3: Normalize or stabilize webpack module IDs in expected fixtures
Integration tests currently compare raw numeric IDs (e.g.__webpack_exec__(94), line prefixes like96:) in fixture files, causing churn whenever module IDs shift; either normalize these IDs in your test assertions (e.g. regex‐replace before compare) or configure webpack for deterministic IDs (e.g.moduleIds: "named") to keep fixtures stable.packages/rsmax-cli/src/__tests__/integration/fixtures/turbo-pages-basic/expected/runtime.js (2)
151-151: Same for ruid."bundler=rspack@1.5.2" should be normalized in tests (e.g., replace with bundler=rspack@X.Y.Z) to reduce churn.
I can draft a small normalize() helper to apply before snapshot comparisons.
106-106: Normalize runtime version in test fixtures
All integration fixtures under packages/rsmax-cli/src/tests/integration/fixtures/**/expected/runtime.js pin__webpack_require__.rvand__webpack_require__.ruidto"1.5.2", making snapshots brittle on future Rspack bumps. Strip or mask these values in tests—e.g. via a Jest snapshot serializer or a pre-comparison regex replace—instead of hard-coding.packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/rsmax-styles.js (1)
1-13: Stabilize snapshots against dynamic chunk/module IDs and CSS hashes
- Tests currently pin chunk ID “3” and module ID “194” (e.g. in
rsmax-styles.js) and CSS module hashes likeapp___R9oSFin fixtures.- Mitigations (pick one):
- In test webpack config, set
optimization.chunkIds: "named"(andmoduleIds: "named"if needed).- Normalize IDs/hash in snapshot comparisons via a custom Jest serializer or regex replacement.
- Fix
css-loader’smodules.localIdentHashSalt(and/orhashDigest) to a constant for test runs.packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/common.css (1)
1-570: Fixture looks good; consider deduplicating with expected-multi/common.css.Both files appear identical; a shared fixture (or symlink) would reduce maintenance surface.
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/rsmax-styles.css (1)
1-45: LGTM; ensure hash stability for CSS Modules.If flakes appear on CI, set modules.localIdentHashSalt for tests or normalize hashes in snapshots.
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/rsmax-styles.js (1)
1-13: Mirror of single-page mapping—apply the same snapshot hardening.Same advice: stabilize chunk/module IDs and class hashes for reliable tests.
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/pages/index/index2.js (2)
53-55: Drop dev-only logging in expected output.console.log in fixtures increases diff noise. If needed for local debugging, strip via build config for test runs.
8-18: Avoid absolute-path-derived module identifiers in compiled fixtures
The generated fixture atpackages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/pages/index/index2.js(lines 8, 17) includes identifiers built from your local filesystem path (e.g._Users_wangjue_…), which will differ per machine and break snapshot consistency. Disable named modules in test builds (e.g. production mode ornamedModules: false) or strip/normalize these names in your snapshots.packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/common.css (1)
1-570: Same content as single-page common.css—prefer a shared source.Consolidate to one canonical file to avoid drift.
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/rsmax-styles.css (1)
1-45: LGTM; mirror of single-page styles.Apply the same hash-stability strategy if CI flakes.
packages/rsmax-cli/src/__tests__/integration/fixtures/turbo-pages-basic/expected/rsmax-vendors.js (1)
1459-1479: Avoid re-registering page lifecycle on every renderusePageEvent uses useLayoutEffect without deps; it will register/unregister every render. Add dependencies to keep a stable subscription.
- (0,react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect)(function() { - return (0,_lifecycle__WEBPACK_IMPORTED_MODULE_4__.registerLifecycle)(pageInstance, lifeCycle, callback); - }); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect)(function () { + return (0,_lifecycle__WEBPACK_IMPORTED_MODULE_4__.registerLifecycle)(pageInstance, lifeCycle, callback); + }, [pageInstance, lifeCycle, callback]);packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/index.css (3)
356-383: Duplicate declarations in .rsmax-buttonborder-radius is declared twice; keep one for clarity.
.rsmax-button { /* prettier-ignore */ font-size: 18PX; /* prettier-ignore */ height: 47PX; /* prettier-ignore */ line-height: 47PX; - /* prettier-ignore */ - border-radius: 2PX; display: block; outline: 0; -webkit-appearance: none; box-sizing: border-box; padding: 0; text-align: center; /* prettier-ignore */ border-radius: 2PX; overflow: hidden;
446-450: Respect reduced motion preferences for transitionsConsider disabling the transition when the user prefers reduced motion.
+.rmc-pull-to-refresh-transition { + transition: transform 0.3s, -webkit-transform 0.3s; +} + +@media (prefers-reduced-motion: reduce) { + .rmc-pull-to-refresh-transition { + transition: none; + } +} - -.rmc-pull-to-refresh-transition { - transition: -webkit-transform 0.3s; - transition: transform 0.3s; - transition: transform 0.3s, -webkit-transform 0.3s; -}
520-523: Anchor global reset may impact accessibilitya:-webkit-any-link { text-decoration: none } removes link affordance globally. Consider scoping or preserving focus/hover states to maintain usability.
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/pages/index/index.js (2)
64-93: Add keys when mapping to SwiperItem to avoid React reconciliation warningsKeys improve runtime stability and avoid dev warnings.
- children: arr.map(function(it) { - return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(rsmax__WEBPACK_IMPORTED_MODULE_0__.SwiperItem, { + children: arr.map(function(it) { + return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(rsmax__WEBPACK_IMPORTED_MODULE_0__.SwiperItem, { + key: it, children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)(rsmax__WEBPACK_IMPORTED_MODULE_0__.View, {
61-61: Use className for consistencyIf the web host component expects React semantics, prefer className over class to avoid attribute mismatches. Confirm rsmax web aliases class correctly; otherwise switch at source.
- class: "demo-swiper", + className: "demo-swiper",packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/index.css (4)
356-383: .rsmax-button: duplicate and missing focus styles.
- border-radius is declared twice; keep one.
- outline: 0 removes focus ring without a replacement. Add a visible focus style to avoid a11y regressions.
Apply:
.rsmax-button { - /* prettier-ignore */ - border-radius: 2PX; display: block; outline: 0; @@ - /* prettier-ignore */ - border-radius: 2PX; + /* keep a single border-radius */ + /* prettier-ignore */ + border-radius: 2PX; } + +/* keyboard focus visibility */ +.rsmax-button:focus-visible { + outline: 2px solid #108ee9; + outline-offset: 2px; +}
356-383: Uppercase PX units: confirm transformer behavior.A number of declarations use “PX” instead of “px”. PostCSS parsers are case-insensitive, but custom plugins aren’t always. Given css.ts enables @rsmax/postcss-px2units for web, please confirm that the unit-conversion plugin won’t miss these. If uppercase is intentional to opt out of conversion, consider documenting this in the fixture to prevent future “fixes.”
456-464: Duplicate selector for .rmc-pull-to-refresh-indicator.Two blocks target the same selector; merge to one for clarity.
-.rmc-pull-to-refresh-indicator { - color: grey; - text-align: center; - height: 1rem; -} - -.rmc-pull-to-refresh-indicator { - margin-top: -1rem; -} +.rmc-pull-to-refresh-indicator { + color: grey; + text-align: center; + height: 1rem; + margin-top: -1rem; +}
520-523: WebKit-only anchor reset may miss non-WebKit engines.If the goal is removing underlines globally, broaden the selector; if not, scope it tighter to avoid surprising link styling.
-a:-webkit-any-link { - -webkit-text-decoration: none; - text-decoration: none; -} +/* Option A: cross-browser reset */ +a, a:link, a:visited { + text-decoration: none; +} + +/* Option B: scope to tab bar only (example) */ +/*.rsmax-tab-bar a { text-decoration: none; }*/packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/runtime.js (1)
144-147: Avoid brittleness: don’t assert exact bundler versions in fixtures.Hardcoding “1.5.2” and “bundler=rspack@1.5.2” will churn whenever rspack updates. Prefer normalizing these lines in test comparisons.
// In test compare step, before asserting: const scrub = s => s .replace(/__webpack_require__\.rv\s*=\s*\(.*?\);?/g, '__webpack_require__.rv = "<redacted>";') .replace(/__webpack_require__\.ruid\s*=\s*".*?";?/g, '__webpack_require__.ruid = "<redacted>";');I can wire this into the integration helpers so runtime.js is sanitized before diffing—say, via a per-file transform map.
Also applies to: 190-193
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/pages/index/index.html (2)
6-6: Load CSS before scripts to reduce FOUC and improve first paint.Reorder to link styles before deferred scripts and format for readability.
- <script defer src="../../runtime.js"></script><script defer src="../../common.js"></script><script defer src="../../pages/index/index.js"></script><link href="../../common.css" rel="stylesheet"></head> + <link href="../../common.css" rel="stylesheet"> + <script defer src="../../runtime.js"></script> + <script defer src="../../common.js"></script> + <script defer src="../../pages/index/index.js"></script> + </head>
2-5: Add lang and title for completeness (even in fixtures).Helps a11y and avoids validator warnings.
-<html> +<html lang="zh-CN"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"> + <title>RSMax Multi-Page Index</title>packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/index.html (1)
6-6: Consider linking CSS before JS to reduce FOUC (if template is under our control).If the HTML template is owned by us (not a snapshot of tool output), load CSS first.
Apply if applicable:
- <script defer src="/runtime.js"></script><script defer src="/index.js"></script><link href="/index.css" rel="stylesheet"></head> + <link href="/index.css" rel="stylesheet"><script defer src="/runtime.js"></script><script defer src="/index.js"></script></head>packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/pages/index/index.html (1)
6-6: Load CSS before JS for first paint consistency (if feasible).Only if we control HTML generation; otherwise ignore as this mirrors tool output.
- <script defer src="../../runtime.js"></script><script defer src="../../common.js"></script><script defer src="../../pages/index/index.js"></script><link href="../../common.css" rel="stylesheet"></head> + <link href="../../common.css" rel="stylesheet"><script defer src="../../runtime.js"></script><script defer src="../../common.js"></script><script defer src="../../pages/index/index.js"></script></head>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (38)
packages/rsmax-ali/rstest.config.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/a/index.js(2 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/b/index.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/c/index.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/complex/index.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/e/index.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/notInJSX/index.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/slot/index.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/src/index.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/npm/commonjs/index.js(4 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/npm/moduleB/index.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/turbo-pages-basic/expected/pages/index.js(5 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/turbo-pages-basic/expected/rsmax-vendors.js(63 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/turbo-pages-basic/expected/runtime.js(2 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/common.css(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/index.css(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/index.html(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/pages/index/index.html(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/pages/index/index.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/pages/index/index2.html(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/pages/index/index2.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/rsmax-styles.css(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/rsmax-styles.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/runtime.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/common.css(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/index.css(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/index.html(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/pages/index/index.html(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/pages/index/index.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/pages/index/index2.html(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/pages/index/index2.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/rsmax-styles.css(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/rsmax-styles.js(1 hunks)packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/runtime.js(1 hunks)packages/rsmax-one/rstest.config.js(1 hunks)packages/rsmax-toutiao/rstest.config.js(1 hunks)packages/rsmax-web/rstest.config.js(1 hunks)packages/rsmax-wechat/rstest.config.js(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (33)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/rsmax-styles.css (1)
packages/rsmax-cli/src/build/webpack/config/css.ts (3)
addCSSRule(23-82)cssConfig(84-110)RuleConfig(9-14)
packages/rsmax-one/rstest.config.js (1)
packages/rsmax-cli/src/__tests__/integration/helpers/build.ts (3)
Options(38-42)c(112-114)c(268-270)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/rsmax-styles.css (1)
packages/rsmax-cli/src/build/webpack/config/css.ts (3)
addCSSRule(23-82)cssConfig(84-110)applyLoaders(27-78)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/runtime.js (5)
packages/rsmax-cli/src/build/webpack/plugins/RuntimeOptions.ts (4)
compilation(24-40)RuntimeOptionsPlugin(16-113)createRuntimeOptions(43-58)page(65-84)packages/rsmax-cli/src/build/webpack/webBaseConfig.ts (1)
webBaseConfig(11-132)packages/rsmax-cli/src/build/webpack/config.mini.ts (1)
webpackConfig(42-289)packages/rsmax-cli/src/build/webpack/config.miniComponent.ts (1)
webpackConfig(30-256)packages/rsmax-cli/src/__tests__/integration/helpers/build.ts (3)
configWebpack(229-240)configWebpack(65-81)configWebpack(148-159)
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/e/index.js (2)
packages/rsmax-cli/src/build/webpack/plugins/OptimizeEntries.ts (1)
OptimizeEntriesPlugin(11-116)packages/rsmax-cli/src/build/webpack/config.miniComponent.ts (1)
webpackConfig(30-256)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/pages/index/index2.html (2)
packages/rsmax-cli/src/__tests__/integration/helpers/build.ts (1)
buildApp(44-125)packages/rsmax-cli/src/__tests__/integration/fixtures/hook-on-entries/rsmax.config.js (1)
entries(6-12)
packages/rsmax-web/rstest.config.js (1)
packages/rsmax-cli/src/__tests__/integration/helpers/build.ts (8)
Options(38-42)configWebpack(148-159)configWebpack(229-240)c(112-114)c(268-270)configWebpack(65-81)c(187-189)buildApp(44-125)
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/npm/moduleB/index.js (1)
packages/rsmax-cli/src/build/webpack/config.miniComponent.ts (2)
entry(178-182)webpackConfig(30-256)
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/notInJSX/index.js (3)
packages/rsmax-cli/src/build/webpack/loaders/nativeComponent.ts (1)
nativeModule(16-66)packages/rsmax-cli/src/build/webpack/plugins/NativeAsset.ts (1)
builder(33-39)packages/rsmax-cli/src/build/watch.ts (1)
entry(20-25)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/pages/index/index.html (1)
packages/rsmax-cli/src/__tests__/integration/helpers/build.ts (1)
buildApp(44-125)
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/c/index.js (1)
packages/rsmax-cli/src/build/webpack/plugins/OptimizeEntries.ts (2)
OptimizeEntriesPlugin(11-116)requireStyles(94-115)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/index.css (5)
packages/rsmax-cli/src/__tests__/integration/fixtures/hybrid-app/rsmax.config.js (2)
addCSSRule(2-8)addCSSRule(1-9)packages/rsmax-cli/src/__tests__/integration/fixtures/config-add-css-rule/rsmax.config.js (1)
ctx(2-7)packages/rsmax-cli/src/__tests__/integration/fixtures/hook-config-webpack/rsmax.config.js (2)
addCSSRule(2-8)addCSSRule(1-9)packages/rsmax-cli/src/build/webpack/config/css.ts (3)
addCSSRule(23-82)cssConfig(84-110)RuleConfig(9-14)packages/rsmax-cli/src/build/webpack/webBaseConfig.ts (2)
ruleConfig(121-123)webBaseConfig(11-132)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/rsmax-styles.js (4)
packages/rsmax-cli/src/build/webpack/plugins/OptimizeEntries.ts (1)
requireStyles(94-115)packages/rsmax-cli/src/build/webpack/config.miniComponent.ts (1)
webpackConfig(30-256)packages/rsmax-cli/src/build/webpack/config/css.ts (1)
cssConfig(84-110)packages/rsmax-cli/src/build/webpack/config.mini.ts (1)
webpackConfig(42-289)
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/b/index.js (2)
packages/rsmax-cli/src/build/webpack/config.miniComponent.ts (1)
entry(178-182)packages/rsmax-cli/src/build/webpack/plugins/RuntimeOptions.ts (1)
compilation(24-40)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/pages/index/index.html (1)
packages/rsmax-cli/src/__tests__/integration/helpers/build.ts (1)
buildApp(44-125)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/rsmax-styles.js (1)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/rsmax-styles.js (1)
__WEBPACK_DEFAULT_EXPORT__(9-9)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/pages/index/index.js (1)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/rsmax-styles.js (1)
__WEBPACK_DEFAULT_EXPORT__(9-9)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/index.html (1)
packages/rsmax-cli/src/__tests__/integration/helpers/build.ts (1)
buildApp(44-125)
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/complex/index.js (2)
packages/rsmax-cli/src/build/webpack/config.miniComponent.ts (1)
webpackConfig(30-256)packages/rsmax-cli/src/build/webpack/plugins/OptimizeEntries.ts (1)
OptimizeEntriesPlugin(11-116)
packages/rsmax-toutiao/rstest.config.js (1)
packages/rsmax-cli/src/__tests__/integration/helpers/build.ts (8)
Options(38-42)configWebpack(148-159)c(112-114)configWebpack(229-240)c(268-270)buildMiniPlugin(127-200)configWebpack(65-81)c(187-189)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/common.css (3)
packages/rsmax-cli/src/build/webpack/config/css.ts (2)
addCSSRule(23-82)cssConfig(84-110)packages/rsmax-cli/src/build/webpack/webBaseConfig.ts (2)
ruleConfig(121-123)webBaseConfig(11-132)packages/rsmax-cli/src/build/NativeAssets.ts (1)
findInCSS(133-170)
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/a/index.js (1)
packages/rsmax-cli/src/build/webpack/plugins/OptimizeEntries.ts (1)
OptimizeEntriesPlugin(11-116)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/pages/index/index2.js (2)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/rsmax-styles.js (1)
__WEBPACK_DEFAULT_EXPORT__(9-9)packages/rsmax-cli/src/build/entries/MpaEntry.ts (1)
MpaEntry(3-38)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/pages/index/index2.html (2)
packages/rsmax-cli/src/__tests__/integration/helpers/build.ts (1)
buildApp(44-125)packages/rsmax-cli/src/__tests__/integration/fixtures/hook-on-entries/rsmax.config.js (1)
entries(6-12)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/common.css (3)
packages/rsmax-cli/src/build/webpack/config/css.ts (2)
cssConfig(84-110)addCSSRule(23-82)packages/rsmax-cli/src/build/webpack/webBaseConfig.ts (1)
ruleConfig(121-123)packages/rsmax-cli/src/build/webpack/config.mini.ts (1)
ruleConfig(264-266)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/pages/index/index.js (3)
packages/rsmax-web/src/createApp.tsx (3)
pageComponents(19-22)createApp(11-91)default(20-21)packages/rsmax-cli/src/build/entries/MpaEntry.ts (1)
MpaEntry(3-38)packages/rsmax-web/src/bootstrapMpa.tsx (1)
createApp(12-33)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/runtime.js (1)
packages/rsmax-cli/src/build/webpack/webBaseConfig.ts (1)
webBaseConfig(11-132)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/index.css (2)
packages/rsmax-cli/src/build/webpack/config/css.ts (2)
addCSSRule(23-82)cssConfig(84-110)packages/postcss-rsmax-tag/index.js (1)
rule(12-26)
packages/rsmax-wechat/rstest.config.js (1)
packages/rsmax-cli/src/__tests__/integration/helpers/build.ts (4)
Options(38-42)c(112-114)c(187-189)c(268-270)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/pages/index/index2.js (1)
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/rsmax-styles.js (1)
__WEBPACK_DEFAULT_EXPORT__(9-9)
packages/rsmax-cli/src/__tests__/integration/fixtures/turbo-pages-basic/expected/rsmax-vendors.js (3)
packages/rsmax-framework-shared/src/RuntimeOptions.ts (2)
get(59-61)reset(63-65)packages/rsmax-web/src/createApp.tsx (2)
navigate(27-73)RuntimeOptions(30-32)packages/rsmax-cli/src/build/webpack/plugins/RuntimeOptions.ts (6)
RuntimeOptionsPlugin(16-113)compilation(24-40)createRuntimeOptions(43-58)apply(23-41)page(65-84)entry(31-35)
packages/rsmax-cli/src/__tests__/integration/fixtures/turbo-pages-basic/expected/pages/index.js (3)
packages/rsmax-cli/src/build/webpack/config.miniComponent.ts (1)
webpackConfig(30-256)packages/rsmax-cli/src/build/webpack/loaders/nativeComponent.ts (1)
nativeModule(16-66)packages/rsmax-cli/src/build/webpack/plugins/PageAsset/index.ts (1)
page(50-69)
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/npm/commonjs/index.js (2)
packages/rsmax-cli/src/build/webpack/config.miniComponent.ts (1)
entry(178-182)packages/rsmax-cli/src/build/webpack/plugins/RuntimeOptions.ts (2)
page(65-84)compilation(24-40)
🔇 Additional comments (24)
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/a/index.js (2)
4-4: Module ID renumbering is consistent.The module key (89) matches the webpack_exec entry (89). No functional change—LGTM.
Also applies to: 17-17
4-4: Validate module and exec IDs in nativeComponent fixtures
Add a guard in your test suite that iterates over everypackages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/**/index.js, extracts the leading module ID and the__webpack_exec__ID, and fails if they differ:for p in packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/**/index.js; do id=$(grep -Eo '^[[:space:]]*[0-9]+:' "$p" | sed 's/[^0-9]*\([0-9]\+\):.*/\1/') exec_id=$(grep -Eo '__webpack_exec__\([0-9]\+\)' "$p" | sed 's/.*__webpack_exec__(\([0-9]\+\)).*/\1/') [ "$id" = "$exec_id" ] || { echo "ID mismatch in $p" && exit 1; } doneEnsure all existing fixtures pass this check.
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/slot/index.js (1)
3-3: Consistent ID update.92 is used in both the module map and exec site. Looks good.
Also applies to: 11-11
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/c/index.js (1)
3-3: ID renumbering aligns.Module 90 matches webpack_exec(90). No issues.
Also applies to: 11-11
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/src/index.js (1)
3-3: Stable and correct.Module ID 86 is consistent across declaration and exec.
Also applies to: 11-11
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/npm/moduleB/index.js (1)
3-3: Consistent renumbering.93 is used at both declaration and exec. Good to go.
Also applies to: 11-11
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/notInJSX/index.js (1)
3-3: Looks good.ID 85 is consistent; no behavior change.
Also applies to: 11-11
packages/rsmax-cli/src/__tests__/integration/fixtures/nativeComponent/expected/ali/components/e/index.js (1)
3-3: LGTM.ID 83 matches in both places; fixture stays coherent.
Also applies to: 11-11
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/pages/index/index2.js (1)
15-33: MPA bootstrap wiring looks correct.Route, appConfig, and plugins shape align with the expected MPA flow.
packages/rsmax-cli/src/__tests__/integration/fixtures/turbo-pages-basic/expected/rsmax-vendors.js (1)
1208-1220: Verify no remaininghistoryreferences
Search didn’t scan any files—please manually confirm there are no stalehistoryusages (in runtime, plugins, tests, etc.) after renaming tonavigate.packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/index.css (1)
1-155: Normalize block looks good.Header retained and rules match v8.0.1 expectations.
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/runtime.js (2)
121-133: Sanity-check odd condition in chunk scheduler.The expression
priority & (1 === 0)effectively reduces to0and may be an artifact of codegen/minification. Since this is generated runtime code, no action here—just confirm the emitted runtime matches rspack output to avoid hand-edits.
183-188: Runtime hookup and chunk queueing look consistent with config.Matches the
runtimeChunk({ name: 'runtime' })strategy in web configs. No issues.packages/rsmax-cli/src/__tests__/integration/fixtures/turbo-pages-basic/expected/pages/index.js (3)
21-24: Absolute path baked into identifier; normalize in tests.The generated identifier includes a dev-machine absolute path segment. Please verify that test normalization/exclude patterns mask this to keep CI portable.
Use the script above; if missing, add a transform to replace absolute paths with <PROJECT_ROOT>.
165-169: LGTM: Children.map + cloneElement usage is correct.Keys are derived and props merged predictably.
244-254: LGTM: Mixed JSX/React.createElement block is well-keyed.Both array children have stable keys; no reconciliation hazards.
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/index.html (1)
8-8: Verify mount container ID. No code references mounting to#rsmax-app—confirm the web runtime actually targets<div id="rsmax-app">in the template, or update the template/runtime to stay in sync.packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/pages/index/index.html (1)
6-6: common.js and common.css chunk names are explicitly set in webpack config and thus stable.packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/index.html (1)
1-11: LGTM! The HTML structure follows standard patterns.The HTML document is well-formed with proper DOCTYPE, meta tags for charset and viewport, deferred script loading, and the expected rsmax-app container div.
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/pages/index/index2.html (1)
1-11: LGTM! The HTML structure is correct for a multi-page web test fixture.The file correctly loads the required runtime, common assets, and page-specific JavaScript with proper relative paths from the nested pages/index directory.
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/pages/index/index2.html (1)
1-11: LGTM! The HTML structure is consistent with the multi-page test pattern.The file correctly references the shared runtime and common assets with appropriate relative paths for the multi-page structure.
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/pages/index/index2.js (1)
1-51: LGTM! The webpack module structure is correct for an RSMax component.The module correctly implements a default-exported React component using RSMax UI components (View, Image, Text) with CSS modules for styling. The webpack module wrapper and imports are properly configured.
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/pages/index/index.js (1)
1-102: LGTM! The test fixture component structure is appropriate.The module correctly implements an RSMax component with various UI elements including Swiper, Checkbox, and proper CSS module styling. The webpack module structure follows the expected pattern for test fixtures.
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected/runtime.js (1)
1-479: LGTM! The webpack runtime implementation is comprehensive and correct.The runtime includes all necessary webpack/rspack functionality:
- Module loading and caching mechanisms
- Chunk loading with JSONP callbacks
- CSS chunk loading with proper error handling
- Prefetch capabilities
- Version metadata (rspack@1.5.2)
The implementation correctly handles async loading, error states, and includes appropriate timeouts for script loading.
| /* ESM default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_rsmax_runtime__WEBPACK_IMPORTED_MODULE_0__.createNativeComponent)('native-component-index-f24c316')); | ||
|
|
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Stabilize native component ID to avoid fixture flakiness.
The literal 'native-component-index-f24c316' can drift across OS/paths. Ensure the new rstest exclude/normalization covers this ID or add a sanitizer in the compare step.
Run to confirm coverage and spot other volatile IDs/paths:
🏁 Script executed:
#!/bin/bash
# Find volatile native-component IDs and absolute paths in fixtures
rg -nP "native-component-index-[a-f0-9]{6,}|/Users/|\\b[A-Za-z]:\\\\|/home/" packages/rsmax-cli/src/__tests__/integration/fixtures
# Inspect rstest config for exclude/normalize rules
fd rstest.config.js -a
rg -n "exclude|pattern|normalize" $(fd rstest.config.js -a)Length of output: 3504
Normalize native component ID in rsmax-cli rstest config
Add or update packages/rsmax-cli/rstest.config.js to include a normalization rule, for example:
module.exports = {
normalize: [
{
pattern: /native-component-index-[a-f0-9]+/g,
replacement: 'native-component-index',
},
],
};This ensures generated native-component-index-<hash> IDs in fixtures are replaced with a stable identifier across runs.
🤖 Prompt for AI Agents
In
packages/rsmax-cli/src/__tests__/integration/fixtures/turbo-pages-basic/expected/pages/index.js
around lines 13 to 14, the generated native component ID includes a
non-deterministic hash (native-component-index-<hash>) which breaks
deterministic test fixtures; update or add packages/rsmax-cli/rstest.config.js
to include a normalization rule that matches the pattern
/native-component-index-[a-f0-9]+/g and replaces it with a stable identifier
like "native-component-index" so test outputs are normalized across runs.
| /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(rsmax__WEBPACK_IMPORTED_MODULE_1__.Text, { | ||
| className: _index_css_modules__WEBPACK_IMPORTED_MODULE_2__["default"].path, | ||
| children: "src/pages/index/index.js" | ||
| }), |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Verify CSS Modules contains path class.
This component references styles.default.path; ensure the corresponding index.css defines .path (or adjust the class).
🏁 Script executed:
#!/bin/bash
# Verify `.path` exists in the source CSS for this page
fd -a index.css packages/rsmax-cli/src/__tests__/integration/fixtures | xargs -I{} rg -n '^\s*\.path\b' {}Length of output: 0
🏁 Script executed:
#!/bin/bash
# List all CSS files under the integration fixtures
fd -t f -e css packages/rsmax-cli/src/__tests__/integration/fixtures
# Search for “.path” class definitions in those CSS files
rg -n '\\.path\\b' packages/rsmax-cli/src/__tests__/integration/fixtures/**/*.css || echo "No .path class found"Length of output: 641
🏁 Script executed:
#!/bin/bash
# Locate all CSS files under the integration fixtures
find packages/rsmax-cli/src/__tests__/integration/fixtures -type f -name '*.css'
# Search for `.path` class definitions in those CSS files
find packages/rsmax-cli/src/__tests__/integration/fixtures -type f -name '*.css' -print0 \
| xargs -0 grep -n '\.path\b' || echo "No .path class found"Length of output: 2014
Add missing .path class to CSS Modules
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/index.css doesn’t define .path, yet index2.js references styles.path. Add the missing class or update the reference.
🤖 Prompt for AI Agents
In
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/pages/index/index2.js
around lines 70-73, the component references _index_css_modules_.default.path
but the CSS Module file
packages/rsmax-cli/src/__tests__/integration/fixtures/web/expected-multi/index.css
does not define a .path class; add a .path rule to that CSS file (even a minimal
placeholder) so the class is emitted in the CSS Module, or alternatively update
the JS to reference an existing class name instead of .path—pick one approach
and make the change consistently in the fixture so the compiled output matches
the test expectation.
Summary by CodeRabbit