-
-
Notifications
You must be signed in to change notification settings - Fork 349
feat: implement rslib with TypeScript declaration generation #3883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implement rslib with TypeScript declaration generation #3883
Conversation
- Configure rslib to generate TypeScript declaration files (.d.ts) - Add missing entry points (helpers, core, global) to rslib config - Update runtime-core package.json exports to use generated declarations - Fix import patterns in runtime package to use namespace imports - Exclude dist directories from TypeScript compilation to prevent conflicts - Add global variable definitions for build-time replacement - Update multiple package tsconfigs to prevent dual type resolution This enables proper TypeScript declaration generation via rslib while maintaining compatibility with existing build processes. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
|
✅ Deploy Preview for module-federation-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
The tools/scripts/publish.mjs file was not referenced anywhere in the codebase and appears to be legacy/template code that was never integrated into the actual publishing workflow. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Replace @nx/rollup executor with rslib for runtime-core package - Add @rslib/core as devDependency and create rslib.config.ts - Update package.json exports to match rslib output format (.js/.cjs) - Add TypeScript declaration generation with proper env.d.ts - Update tsconfig.lib.json for correct output paths - Remove duplicate global.d.ts file - Add build script to package.json for direct rslib execution This migration enables better TypeScript declaration generation and aligns with modern build tooling standards. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Move global declarations from src/global.ts to separate global-types.d.ts - This prevents conflicts between source and generated .d.ts files - Resolves TypeScript errors where packages saw both src and dist types - Enhanced package now builds successfully without type conflicts 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Configure project.json to use ../../tools/rslib-plugin:build executor - Fix rslib.config.ts import to use JSON import instead of fs.readFileSync - Add @rslib/core devDependency to package.json - Ensure proper rslib configuration for TypeScript declaration generation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Updated @nx dependencies from 21.0.3 to 21.2.3 in package.json - Updated runtime-core package.json version and export paths - Kept @rslib/core at 0.10.4 in apps/rslib-module - Fixed export type conflicts in runtime-core/src/index.ts - Regenerated pnpm-lock.yaml 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Add proper global type declarations in runtime/global.d.ts for Federation interfaces - Fix implicit any type errors in runtime/src/utils.ts by adding proper typing - Import Federation and RemoteEntryExports types from runtime-core - Remove type casting in favor of proper TypeScript declarations 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Fix rslib bundling configuration in runtime-core (bundle: true) - Add global type declarations for Federation interfaces - Fix TypeScript implicit any type errors in runtime-core - Correct package.json export conditions ordering in chrome-devtools - Add global.d.ts files to bridge packages for type safety 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Replace exec() calls with direct rslib build API - Use rslib's loadConfig function for TypeScript config loading - Improve reliability and performance in CI environments - Fix package.json exports to match actual rslib output files 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Add support for external dependencies with glob patterns - Support multiple output formats (esm, cjs, umd, iife) - Add additional entry points support - Implement proper TypeScript declaration generation - Add comprehensive test suite for rslib executor - Fix path resolution for Nx workspace conventions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
for (const ext of options.external) { | ||
if (ext.includes('*')) { | ||
// Handle glob patterns like "@module-federation/*" | ||
const pattern = ext.replace('*', '(.*)'); |
Check failure
Code scanning / CodeQL
Incomplete string escaping or encoding High
This autofix suggestion was applied.
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 2 days ago
To fix the issue, the replace
method should be updated to use a regular expression with the global flag (g
) to ensure that all occurrences of *
in the ext
string are replaced. This change will make the code handle cases where ext
contains multiple *
characters correctly.
The replacement involves modifying the ext.replace('*', '(.*)')
call to use a regular expression: ext.replace(/\*/g, '(.*)')
. This ensures that every *
in the string is replaced with (.*)
.
-
Copy modified line R146
@@ -145,3 +145,3 @@ | ||
// Handle glob patterns like "@module-federation/*" | ||
const pattern = ext.replace('*', '(.*)'); | ||
const pattern = ext.replace(/\*/g, '(.*)'); | ||
externals[pattern] = ext; |
…ping or encoding Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Summary
Key Changes
.d.ts
generation via rslibpnpm build
andnx run runtime-core:build
work correctlyTest plan
🤖 Generated with Claude Code