@@ -8,13 +8,13 @@ This bundler service creates IIFE (Immediately Invoked Function Expression) bund
88
99## Architecture
1010
11- ```
11+ ``` text
1212┌─────────────────────────────────────────────────────────┐
1313│ pie-elements-ng │
1414├─────────────────────────────────────────────────────────┤
1515│ │
1616│ ┌──────────────────────────────────────────────────┐ │
17- │ │ @pie-element/bundler-shared │ │
17+ │ │ @pie-element/element-bundler │ │
1818│ │ (Framework-agnostic bundler) │ │
1919│ │ │ │
2020│ │ • Webpack 5 configuration │ │
@@ -50,7 +50,8 @@ This bundler service creates IIFE (Immediately Invoked Function Expression) bund
5050## Created Files
5151
5252### Core Bundler Package
53- - ` packages/shared/bundler-shared/package.json ` - Package configuration
53+
54+ - ` packages/shared/bundler-shared/package.json ` - Package configuration for ` @pie-element/element-bundler `
5455- ` packages/shared/bundler-shared/src/index.ts ` - Main Bundler class
5556- ` packages/shared/bundler-shared/src/types.ts ` - TypeScript types
5657- ` packages/shared/bundler-shared/src/installer.ts ` - Package installer
@@ -61,6 +62,7 @@ This bundler service creates IIFE (Immediately Invoked Function Expression) bund
6162- ` packages/shared/bundler-shared/README.md ` - Documentation
6263
6364### SvelteKit Integration
65+
6466- ` apps/element-demo/src/routes/api/bundle/+server.ts ` - API endpoint
6567- ` apps/element-demo/src/routes/bundler/+page.svelte ` - Test UI
6668
@@ -74,11 +76,12 @@ bun run dev
7476
7577### 2. Navigate to the Bundler UI
7678
77- Open http://localhost:5173/bundler
79+ Open [ http://localhost:5173/bundler ] ( http://localhost:5173/bundler )
7880
7981### 3. Build a Bundle
8082
8183Enter an element name and version:
84+
8285- Element: ` @pie-element/multiple-choice `
8386- Version: ` 0.1.0 `
8487
@@ -87,6 +90,7 @@ Click "Build Bundle" and wait for the build to complete (~30-60 seconds).
8790### 4. Use the Bundle
8891
8992The bundles will be available at:
93+
9094- Player: ` /bundles/{hash}/player.js `
9195- Client Player: ` /bundles/{hash}/client-player.js `
9296- Editor: ` /bundles/{hash}/editor.js `
@@ -108,6 +112,7 @@ Load them in your HTML:
108112Build a bundle from dependencies.
109113
110114** Request:**
115+
111116``` json
112117{
113118 "dependencies" : [
@@ -120,6 +125,7 @@ Build a bundle from dependencies.
120125```
121126
122127** Response:**
128+
123129``` json
124130{
125131 "success" : true ,
@@ -139,6 +145,7 @@ Build a bundle from dependencies.
139145Check if a bundle exists.
140146
141147** Response:**
148+
142149``` json
143150{
144151 "exists" : true ,
@@ -148,7 +155,7 @@ Check if a bundle exists.
148155 "editor" : " /bundles/1234567890/editor.js"
149156 }
150157}
151- ```
158+ ```text
152159
153160## How It Works
154161
@@ -165,7 +172,7 @@ Check if a bundle exists.
165172
166173The bundler handles different versions of `@pie-lib` packages per element:
167174
168- ```
175+ ```text
169176Element A uses @pie-lib/math-rendering@4.0.0
170177Element B uses @pie-lib/math-rendering@4.1.0
171178```
@@ -175,20 +182,22 @@ The `NormalModuleReplacementPlugin` detects which element is importing and resol
175182## Benefits
176183
177184### vs pie-api-aws Bundler
185+
178186- ✅ ** Self-contained** - No Lambda, Temporal, SNS, or CloudWatch
179187- ✅ ** Open source** - Fully available in this repo
180188- ✅ ** Testable** - Easy to test locally
181189- ✅ ** Simpler** - ~ 600 lines vs ~ 5000 lines
182190- ✅ ** Framework agnostic** - Can be used in any Node.js environment
183191
184192### vs Pre-publishing IIFE Bundles
193+
185194- ✅ ** On-demand** - Build only what's needed
186195- ✅ ** Flexible** - Combine any elements and versions
187196- ✅ ** Space efficient** - Don't store all combinations
188197
189198## Reusability
190199
191- The ` @pie-element/bundler-shared ` package is framework-agnostic and can be used in:
200+ The ` @pie-element/element-bundler ` package is framework-agnostic and can be used in:
192201
193202- ✅ SvelteKit (current implementation)
194203- ✅ Express/Fastify/Hono
@@ -200,7 +209,7 @@ Example with Express:
200209
201210``` typescript
202211import express from ' express' ;
203- import { Bundler } from ' @pie-element/bundler-shared ' ;
212+ import { Bundler } from ' @pie-element/element-bundler ' ;
204213
205214const app = express ();
206215const bundler = new Bundler (' ./public/bundles' );
@@ -224,8 +233,8 @@ Potential additions:
224233
225234## Comparison with Upstream
226235
227- | Feature | pie-api-aws | bundler-shared |
228- | --------- | ------------- | ----------------|
236+ | Feature | pie-api-aws | element-bundler |
237+ | -------- | ----------- | ---------------- |
229238| ** Bundler** | Webpack 5 | Webpack 5 ✓ |
230239| ** Version resolution** | NormalModuleReplacementPlugin | Same ✓ |
231240| ** Entry generation** | code-generator.ts | Simplified ✓ |
@@ -237,6 +246,11 @@ Potential additions:
237246| ** Complexity** | ~ 5000 lines | ~ 600 lines |
238247| ** Open source** | No (private repo) | Yes ✓ |
239248
249+ ## Scope Clarification
250+
251+ - ` @pie-element/element-bundler ` currently produces IIFE bundles for the local IIFE runtime path.
252+ - ESM bundle workflows do not require this package.
253+
240254## License
241255
242256MIT
0 commit comments