Skip to content
Open
Show file tree
Hide file tree
Changes from 86 commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
c190e28
feat: support async startup promise across formats
ScriptedAlchemy Oct 16, 2025
40c571a
Merge remote-tracking branch 'origin/main' into feature/async-startup…
ScriptedAlchemy Oct 16, 2025
241a46e
fix(runtime): avoid duplicate export for mf async startup
ScriptedAlchemy Oct 16, 2025
b22849c
fix(runtime): gate async startup and reuse default export
ScriptedAlchemy Oct 16, 2025
2ef62db
chore(binding): sync wasi generated exports
ScriptedAlchemy Oct 16, 2025
8b99fdd
chore: drop webpack hot-case bundles
ScriptedAlchemy Oct 17, 2025
36cd349
fix(runtime): adjust async startup promise flow
ScriptedAlchemy Oct 17, 2025
3a3b9c1
fix(runtime): prevent async startup wrapper for simple entries withou…
ScriptedAlchemy Oct 17, 2025
8ecf6e4
test: fix container tests and sync WASI bindings
ScriptedAlchemy Oct 18, 2025
be3302e
fix(runtime): preserve async chunk loading for non-MF projects
ScriptedAlchemy Oct 19, 2025
38b4c77
fix(runtime): await async chunk loaders
ScriptedAlchemy Oct 19, 2025
a8ce32c
chore: merge origin main
ScriptedAlchemy Oct 19, 2025
463e19b
fix(runtime): ensure async loaders await dependencies
ScriptedAlchemy Oct 19, 2025
d1c8a51
refactor(runtime): tidy async startup hash update
ScriptedAlchemy Oct 19, 2025
4cc4f4e
fix(runtime): gate mf async startup behind experiment
ScriptedAlchemy Oct 20, 2025
30b5d94
fix: honor explicit mfAsyncStartup for containers
ScriptedAlchemy Oct 20, 2025
a70265d
fix(mf): include runtime handlers in enhanced mode
ScriptedAlchemy Oct 20, 2025
23c719c
fix(mf): remove async startup wrapping from containers
ScriptedAlchemy Oct 20, 2025
d67e097
refactor(mf): improve HoistContainerReferencesPlugin runtime chunk ma…
ScriptedAlchemy Oct 20, 2025
5b23c61
fix(mf): restore runtime chunk detection in HoistContainerReferencesP…
ScriptedAlchemy Oct 21, 2025
0a9103f
fix(mf): keep bundler runtime helper in runtime chunk
ScriptedAlchemy Oct 21, 2025
7946cb0
test: update mf fixtures and watch expectations
ScriptedAlchemy Oct 21, 2025
d9882dd
Merge branch 'main' into feature/async-startup-runtime-promise
ScriptedAlchemy Oct 21, 2025
6d29968
fix: re-add mfAsyncStartup experiment after main merge
ScriptedAlchemy Oct 21, 2025
8990fac
fix: ignore ustr-fxhash transitive dependency in cargo-shear
ScriptedAlchemy Oct 21, 2025
1a9e85e
fix(mf): gate async wrapper by chunk_needs_mf_async_startup
ScriptedAlchemy Oct 21, 2025
d57e766
fix: update API extractor output to remove mfAsyncStartup references
ScriptedAlchemy Oct 21, 2025
6093ae3
test: update test snapshots and expectations after mf async startup fix
ScriptedAlchemy Oct 21, 2025
708b67c
fix: suppress dead code warnings for plugin hook structs and methods
ScriptedAlchemy Oct 21, 2025
dab2dc1
test: update Rust defaults snapshot for mf_async_startup field
ScriptedAlchemy Oct 21, 2025
f5a1dbf
fix: use module-level allow(dead_code) for plugin hook system
ScriptedAlchemy Oct 21, 2025
94711b2
fix(mf): re-enable hoist container hoisting
ScriptedAlchemy Oct 21, 2025
1e50a14
fix(binding): add mf async startup bindings
ScriptedAlchemy Oct 22, 2025
7796253
Merge remote-tracking branch 'origin/main' into feature/async-startup…
ScriptedAlchemy Oct 22, 2025
7fcf21e
perf(mf): skip hoist when federation deps missing
ScriptedAlchemy Oct 22, 2025
aee5d59
Remove library test directory (doesn't exist on main)
ScriptedAlchemy Oct 22, 2025
1582cbe
Remove split-chunks snapshot to match main branch
ScriptedAlchemy Oct 22, 2025
36da492
fix(tests): restore test files from main to fix defaults tests
ScriptedAlchemy Oct 22, 2025
3b6d207
fix(tests): update base.js snapshot to include mfAsyncStartup
ScriptedAlchemy Oct 22, 2025
fb2d020
refactor(mf): improve HoistContainerReferencesPlugin code quality
ScriptedAlchemy Oct 22, 2025
df7151b
revert: unrelated CSS test package.json formatting changes
ScriptedAlchemy Oct 22, 2025
fd00613
fix(mf): remove unused ustr dependency from Cargo.toml
ScriptedAlchemy Oct 22, 2025
0623ed8
chore: update Cargo.lock after removing ustr dependency
ScriptedAlchemy Oct 22, 2025
8994f30
fix: gate all MF async startup logic on experiment flag
ScriptedAlchemy Oct 22, 2025
28eba04
fix: properly gate MF async startup to preserve main branch behavior
ScriptedAlchemy Oct 22, 2025
29ac7d4
fix: update hot snapshot for MF share-plugin test
ScriptedAlchemy Oct 22, 2025
b3b3c5d
fix: suppress false positive 'this' unused warning in BuildInfo
ScriptedAlchemy Oct 22, 2025
8c3fcc4
chore: increase lint warning threshold to accommodate CI environment
ScriptedAlchemy Oct 22, 2025
4d77e07
Revert "chore: increase lint warning threshold to accommodate CI envi…
ScriptedAlchemy Oct 22, 2025
00cbb22
Merge remote-tracking branch 'origin/main' into feature/async-startup…
ScriptedAlchemy Oct 22, 2025
52fb979
fix(rspack): make build info inspect serializable
ScriptedAlchemy Oct 22, 2025
31da1bb
fix(incremental): avoid repeat full-hash warnings
ScriptedAlchemy Oct 22, 2025
3ba4253
test(container): align async startup expectations
ScriptedAlchemy Oct 22, 2025
fbd55b0
test(container): handle remote share versions
ScriptedAlchemy Oct 22, 2025
b5c3d9c
test(container): normalize async startup expectations
ScriptedAlchemy Oct 23, 2025
beddcde
fix(container): gate EntryFederationRuntimeModule by async startup flag
ScriptedAlchemy Oct 23, 2025
e030641
fix(mf): skip federation startup call in async mode
ScriptedAlchemy Oct 23, 2025
b7118da
Merge remote-tracking branch 'origin/main' into feature/async-startup…
ScriptedAlchemy Oct 23, 2025
420b7f6
fix(mf): guard embed runtime plugin behind async startup
ScriptedAlchemy Oct 23, 2025
3ebd6f3
fix(mf): ensure backwards compatibility for async startup feature
ScriptedAlchemy Oct 23, 2025
b395434
fix(tests): silence hot css logging and align externals
ScriptedAlchemy Oct 23, 2025
a34b4aa
fix(mf): gate all async startup changes behind experiment flag
ScriptedAlchemy Oct 24, 2025
1315c0a
fix(mf): restrict async startup to MF-participating chunks only (P0)
ScriptedAlchemy Oct 24, 2025
c3e1054
fix(tests): align library test configs with main branch
ScriptedAlchemy Oct 24, 2025
ed1c31a
Merge remote-tracking branch 'origin/main' into feature/async-startup…
ScriptedAlchemy Oct 24, 2025
3112141
Merge branch 'main' into feature/async-startup-runtime-promise
ScriptedAlchemy Oct 24, 2025
deca562
fix(ir): minimal async startup gating
ScriptedAlchemy Oct 25, 2025
5b238ab
fix(runtime): restore sync startup when mf async disabled
ScriptedAlchemy Oct 27, 2025
df01379
test(stats): restore snapshot baselines
ScriptedAlchemy Oct 27, 2025
7c7e021
fix(runtime): restore startup plugin wiring for async
ScriptedAlchemy Oct 27, 2025
e8a04f9
fix(resolver): avoid sharing alias caches across compilers
ScriptedAlchemy Oct 27, 2025
57c5905
Revert unrelated changes
ScriptedAlchemy Oct 27, 2025
9094974
Merge remote-tracking branch 'origin/main' into feature/async-startup…
ScriptedAlchemy Oct 27, 2025
ba884df
Merge branch 'main' into feature/async-startup-runtime-promise
ScriptedAlchemy Oct 27, 2025
bcde5e7
chore: revert HotSnapshot hottest test
ScriptedAlchemy Oct 27, 2025
ef5fe7f
chore: revert BuildInfo overrides
ScriptedAlchemy Oct 27, 2025
780c4ed
chore: revert module federation default runtime
ScriptedAlchemy Oct 27, 2025
c0e6cfa
refactor: parse startup exports with swc
ScriptedAlchemy Oct 27, 2025
7aded25
revert: drop async startup changes
ScriptedAlchemy Oct 27, 2025
d767978
chore: remove mf entry runtime shim
ScriptedAlchemy Oct 27, 2025
b452da3
chore: sync runtime cargo manifest
ScriptedAlchemy Oct 27, 2025
f8ec4f3
chore: snapshot current work
ScriptedAlchemy Oct 28, 2025
0f2d5f4
chore: snapshot current work
ScriptedAlchemy Oct 28, 2025
c7f5d5c
test: update default options snapshot
ScriptedAlchemy Oct 28, 2025
ab27f3a
chore: remove investigation markdown files
ScriptedAlchemy Oct 28, 2025
762e0ef
Merge branch 'main' into feature/async-startup-runtime-promise
ScriptedAlchemy Oct 28, 2025
a0926e8
chore: remove comprehensive research and analysis files related to ge…
ScriptedAlchemy Oct 28, 2025
689dab5
refactor(tests): simplify container test cases and update rspack conf…
ScriptedAlchemy Oct 28, 2025
5686be5
Merge remote-tracking branch 'origin/main' into feature/async-startup…
ScriptedAlchemy Oct 28, 2025
8016dd8
fix: correct container entry chunk handling for non-async startup
ScriptedAlchemy Oct 28, 2025
8ff2703
fix: resolve test failures for async startup and ESM output
ScriptedAlchemy Oct 28, 2025
023c30b
wip: add Promise-based wrapper for async federation startup (CJS work…
ScriptedAlchemy Oct 28, 2025
8a5a4b2
feat: implement async federation startup for entry chunks (1635/1636 …
ScriptedAlchemy Oct 28, 2025
b1f5b57
feat: implement ESM async startup with Promise.resolve().then() pattern
ScriptedAlchemy Oct 28, 2025
fb3b268
refine container entry detection for async startup
ScriptedAlchemy Oct 29, 2025
d30b7d9
Merge remote-tracking branch 'origin/main' into feature/async-startup…
ScriptedAlchemy Oct 29, 2025
44e0920
fix: align mf async startup defaults
ScriptedAlchemy Oct 29, 2025
9e622ce
Merge branch 'main' into feature/async-startup-runtime-promise
ScriptedAlchemy Oct 29, 2025
776c5a5
fix: avoid string conversion on source value
ScriptedAlchemy Oct 29, 2025
0ab50b4
test: update esm output snapshots
ScriptedAlchemy Oct 29, 2025
f3b0a0f
feat: support mf async startup in esm runtime
ScriptedAlchemy Oct 29, 2025
a6b8659
Revert "test: update esm output snapshots"
ScriptedAlchemy Oct 30, 2025
bb1f22a
fix: gate mf async startup runtime by experiment
ScriptedAlchemy Oct 30, 2025
1190bd9
chore: restore esm snapshot baselines
ScriptedAlchemy Oct 30, 2025
8aadb28
fix: gate mf async bootstrap and preserve imports
ScriptedAlchemy Oct 30, 2025
aacf919
fix: export EmbedFederationRuntimeModule to fix cacheable deserializa…
ScriptedAlchemy Oct 31, 2025
0be6e50
fix: restore accidentally removed exports from WASI binding files
ScriptedAlchemy Oct 31, 2025
9914305
Merge remote-tracking branch 'origin/main' into feature/async-startup…
ScriptedAlchemy Nov 1, 2025
2c08ac8
test: update stats exports snapshot
ScriptedAlchemy Nov 1, 2025
553915a
test: update stats exports snapshot for macOS build
ScriptedAlchemy Nov 2, 2025
ba6e99b
Merge remote-tracking branch 'origin/main' into feature/async-startup…
ScriptedAlchemy Nov 2, 2025
45b3afc
Merge remote-tracking branch 'origin/main' into feature/async-startup…
ScriptedAlchemy Nov 5, 2025
17ec896
Merge branch 'main' into feature/async-startup-runtime-promise
ScriptedAlchemy Nov 5, 2025
5037973
chore: format examples/basic config
ScriptedAlchemy Nov 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
231 changes: 231 additions & 0 deletions GENERATE_ENTRY_STARTUP_SUMMARY.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
================================================================================
COMPREHENSIVE RESEARCH: generate_entry_startup Function
================================================================================

RESEARCH COMPLETION SUMMARY

Three detailed research documents have been generated analyzing the
generate_entry_startup function in rspack_plugin_runtime/src/helpers.rs:

================================================================================
DOCUMENT 1: GENERATE_ENTRY_STARTUP_RESEARCH.md (Primary)
================================================================================

Comprehensive technical analysis covering:

1. FUNCTION SIGNATURE & PARAMETERS (Section 1)
- Complete parameter documentation
- Parameter types and purposes
- Parameter flow diagram

2. THE PASSIVE PARAMETER - IMPACT (Section 2)
- How passive=true uses ON_CHUNKS_LOADED (__webpack_require__.O)
- How passive=false uses STARTUP_ENTRYPOINT (__webpack_require__.X)
- Two-phase vs direct execution differences
- Code generation patterns for each mode
- Location: array_push_callback_chunk_format.rs:156 & common_js_chunk_format.rs:155

3. RUNTIME GLOBALS USED (Section 3)
- ENTRY_MODULE_ID (__webpack_require__.s): Stores entry module ID
- ON_CHUNKS_LOADED (__webpack_require__.O): Deferred callback queue
- STARTUP_ENTRYPOINT (__webpack_require__.X): Async entry executor
- Complete reference table with bit positions and JavaScript names

4. CALLING LOCATIONS (Section 4)
- ArrayPushCallbackChunkFormatPlugin: Line 156, sets passive based on mf_async_startup
- CommonJsChunkFormatPlugin: Line 155, always sets passive=false
- Detailed call stacks for both plugins

5. CODE GENERATION STRUCTURE (Section 5)
- Phase 1: Create __webpack_exec__ wrapper (lines 231-235)
- Phase 2: Extract module IDs (lines 190-206)
- Phase 3: Collect chunk dependencies (lines 208-228)
- Phase 4: Generate startup code (lines 242-270)
- Complete code generation example with input/output

6. EXTENSION & INJECTION POINTS (Section 6)
- JavascriptModulesRenderStartup hook definition
- Hook calling mechanism
- Example: AssignLibraryPlugin implementation
- Available hook implementations (6 plugins)
- Custom injection plugin template

7. KEY CODE SECTIONS - DETAILED BREAKDOWN (Section 7)
- Section 1: Module ID Extraction logic
- Section 2: Chunk Dependency Collection logic
- Section 3: Runtime Global Selection with decision tree

TOTAL LENGTH: ~5000 words, comprehensive technical reference

================================================================================
DOCUMENT 2: GENERATE_ENTRY_STARTUP_QUICK_REF.md (Quick Reference)
================================================================================

One-page quick lookup guide containing:

- File location & line numbers
- Function signature
- Parameter quick reference table
- passive parameter effect summary
- Code generation phases (4 phases)
- Runtime globals table
- Where it's called (2 locations)
- Extension points & hook implementations
- Example: Injecting custom code
- Key decision logic flowchart
- Helper functions used
- Return type documentation

IDEAL FOR: Quick lookups while coding or reading source code

================================================================================
DOCUMENT 3: GENERATE_ENTRY_STARTUP_CODE_SNIPPETS.md (Implementation Details)
================================================================================

Complete code implementations containing:

1. COMPLETE FUNCTION (helpers.rs:181-273)
- Full function source with comments for each phase

2. CALL SITE 1: ArrayPushCallbackChunkFormatPlugin (array_push_callback_chunk_format.rs:140-189)
- Full render_chunk implementation showing how generate_entry_startup is called
- Demonstrates passive parameter selection
- Shows render_startup hook invocation

3. CALL SITE 2: CommonJsChunkFormatPlugin (common_js_chunk_format.rs:135-182)
- Full render_chunk implementation
- Shows different calling pattern (passive=false always)
- IIFE wrapping of startup code

4. HOOK DEFINITION (drive.rs:10-52)
- JavascriptModulesRenderStartup hook definition
- RenderSource struct definition
- All 11 hook definitions in JavascriptModulesPluginHooks

5. EXAMPLE HOOK IMPLEMENTATION (assign_library_plugin.rs:245-280)
- Real implementation showing code injection pattern
- ConcatSource concatenation technique
- How to modify render_source.source

6. STRINGIFY_CHUNKS_TO_ARRAY HELPER (runtime.rs:370-380)
- Helper function that converts chunk IDs to JSON array
- Used by generate_entry_startup for chunk list generation

7. RUNTIME GLOBALS DEFINITION (runtime_globals.rs)
- Complete bitflags implementation
- ON_CHUNKS_LOADED constant definition with comments
- STARTUP_ENTRYPOINT constant
- ENTRY_MODULE_ID constant
- RuntimeGlobals::name() implementation

8. GENERATED OUTPUT EXAMPLES
- Example 1: Simple Entry (No Dependencies)
- Example 2: Entry with Dependencies (passive=true, ON_CHUNKS_LOADED)
- Example 3: Entry with Dependencies (passive=false, STARTUP_ENTRYPOINT)
- Example 4: With Library Plugin Extension (showing code injection result)

================================================================================
KEY FINDINGS SUMMARY
================================================================================

1. FUNCTION PURPOSE
Generate JavaScript startup code that:
- Identifies entry modules
- Resolves chunk dependencies
- Selects appropriate runtime global (ON_CHUNKS_LOADED vs STARTUP_ENTRYPOINT)
- Creates __webpack_exec__ wrapper for module execution

2. CRITICAL PARAMETER: passive
Controls which runtime method is generated:
- passive=true → ON_CHUNKS_LOADED (.O) - Two-phase: register + execute
- passive=false → STARTUP_ENTRYPOINT (.X) - Single direct call

3. CALLING CONTEXT
- ArrayPushCallbackChunkFormatPlugin: passive determined by !experiments.mf_async_startup
- CommonJsChunkFormatPlugin: Always passive=false

4. EXTENSION CAPABILITY
Via JavascriptModulesRenderStartup hook, plugins can:
- Wrap generated code with pre/post code
- Replace generated code entirely
- Inject library exports, module exports compatibility, etc.

5. CODE GENERATION PHASES (4 phases)
Phase 1: Create __webpack_exec__ wrapper function
Phase 2: Extract entry module IDs (filtering for JavaScript only)
Phase 3: Collect dependent chunk IDs
Phase 4: Generate final startup code based on:
- Whether chunks exist
- passive flag value

6. GENERATED CODE PATTERNS
Simple: var __webpack_exports__ = (__webpack_exec__(0));

Complex (passive=true):
__webpack_require__.O(0, [chunks], fn);
var __webpack_exports__ = __webpack_require__.O();

Complex (passive=false):
var __webpack_exports__ = __webpack_require__.X(0, [chunks], fn);

================================================================================
RESEARCH DOCUMENTS LOCATION
================================================================================

1. /Users/zackjackson/rspack/GENERATE_ENTRY_STARTUP_RESEARCH.md
Primary comprehensive document (7 sections, ~5000 words)

2. /Users/zackjackson/rspack/GENERATE_ENTRY_STARTUP_QUICK_REF.md
One-page quick reference (for desk reference)

3. /Users/zackjackson/rspack/GENERATE_ENTRY_STARTUP_CODE_SNIPPETS.md
Complete code implementations with examples

================================================================================
HOW TO USE THESE DOCUMENTS
================================================================================

For Complete Understanding:
→ Start with GENERATE_ENTRY_STARTUP_RESEARCH.md
→ Understand each section in order
→ Cross-reference with CODE_SNIPPETS for actual implementations

For Quick Lookup:
→ Use GENERATE_ENTRY_STARTUP_QUICK_REF.md
→ Jump to specific sections as needed

For Implementation Details:
→ Use GENERATE_ENTRY_STARTUP_CODE_SNIPPETS.md
→ Reference specific functions and plugins

For Custom Code Injection:
→ See Section 6 (Extension Points) in RESEARCH.md
→ Look at AssignLibraryPlugin example in CODE_SNIPPETS.md
→ Use template provided in QUICK_REF.md

================================================================================
QUESTIONS ANSWERED
================================================================================

1. What parameters does it accept and what do they control?
✓ Documented in Section 1 with detailed table and flow diagram

2. How does the passive parameter affect the generated code?
✓ Documented in Section 2 with code examples and decision tree

3. What runtime globals does it use (ON_CHUNKS_LOADED vs STARTUP_ENTRYPOINT)?
✓ Documented in Section 3 with complete reference table and usage examples

4. Where is this function called from?
✓ Documented in Section 4 with 2 call sites, full stack traces

5. How does it generate the actual startup code - what's the structure?
✓ Documented in Section 5 with 4 phases, code examples, decision logic

6. Can we modify it to inject custom code before/after entry execution?
✓ Documented in Section 6 with hook system, real examples, template code

7. Look at the actual code generation - show me the key parts
✓ Complete implementation in CODE_SNIPPETS.md with all phases

================================================================================
Loading
Loading