Replacement for Atmosphere Packages using NPM+SWC/Rspack #14089
awatson1978
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Following this discussion on Meteor forums, I asked Claude the following prompt:
Results are below:
Plan: NPM-Focused Commands for Meteor (SWC + Rspack)
Purpose: Implementation plan for adding npm compilation and publishing capabilities using SWC and Rspack.
Executive Summary
Four new commands to enable Meteor packages to be compiled to npm-compatible format using SWC + Rspack:
Build Stack:
Estimated Total: 2000-2900 lines of code
Why SWC + Rspack?
Current Architecture (For Context)
CLI Command System
Build System (Isobuild)
NPM Integration
Proposed File Structure
Files to Modify
ools/cli/main.js- Load new command filetools/cli/commands.js- Add --extra-npm-package flagstools/project-context.js- Support extra npm packagestools/isobuild/bundler.js- Include extra packages in bundleNew Dependencies
{ "@rspack/core": "^1.x", "@rspack/cli": "^1.x", "@swc/core": "^1.x" }Command 1: meteor npm-build packages/my-npm-pkg
Purpose
Compile a Meteor package to npm-compatible ES modules using Rspack + SWC.
CLI Interface
Options
Output Structure
Implementation Steps
Command 2: meteor npm-publish packages/my-npm-pkg
Purpose
Publish compiled Meteor package to npm registry.
CLI Interface
Options
Implementation Steps
Command 3: meteor run --extra-npm-package
Purpose
JIT addition of npm packages during development without modifying package.json.
CLI Interface
Use Cases
Implementation Steps
Comparison with Existing Approaches
Command 4: meteor deploy --extra-npm-package
Purpose
JIT addition of npm packages during deployment.
CLI Interface
Implementation Steps
Handling Meteor-Specific Code
Meteor.isClient / Meteor.isServer
Strategy: Build-time constants via Rspack DefinePlugin
This enables dead code elimination - code in if (Meteor.isServer) blocks gets removed from browser builds.
Meteor Package Imports
For import { X } from 'meteor/package-name':
Recommended: Mark as External + Peer Dependencies
Alternative: Bundled Minimal Shims
For packages that want to work outside Meteor:
Architectural Decisions
Decision 1: SWC + Rspack Installation
Recommendation: Auto-Install on First Use
Benefits:
Decision 2: Meteor Import Handling
Recommendation: Configurable via package.json
{ "meteor": { "npmBuild": { "meteorImports": "external" // or "shim" or "inline" } } }Decision 3: Configuration Format
Support both rspack.config.js AND package.json meteor section
Complexity Assessment
Implementation Phases
Phase 1: Foundation
├── Set up tools/npm-build/ directory structure
├── Implement Rspack configuration generator
├── Create basic meteor npm-build command
└── Handle simple packages (no Meteor imports)
Phase 2: Meteor Integration
├── Implement MeteorTransformPlugin for Rspack
├── Handle Meteor.isClient/isServer transforms
├── Add Meteor import handling (external/shim)
└── Generate proper npm package.json
Phase 3: npm-publish
├── Implement meteor npm-publish command
├── Integrate with npm authentication
├── Add dry-run and validation
└── Documentation for publishing workflow
Phase 4: JIT Features
├── Implement --extra-npm-package for meteor run
├── Extend to meteor deploy
├── Add caching for extra packages
└── Integration tests
Phase 5: Polish
├── Error handling and messages
├── Documentation
├── Example packages
└── Community testing
Questions for Community Discussion
Verification Plan
All reactions