payload-plugin-newsletter 0.19.0 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +55 -0
- package/README.md +97 -0
- package/dist/collections.cjs +11 -2
- package/dist/collections.cjs.map +1 -1
- package/dist/collections.js +11 -2
- package/dist/collections.js.map +1 -1
- package/dist/components.cjs +148 -125
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +2 -0
- package/dist/components.d.ts +2 -0
- package/dist/components.js +85 -62
- package/dist/components.js.map +1 -1
- package/dist/index.cjs +35 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.js +32 -2
- package/dist/index.js.map +1 -1
- package/dist/types.d.cts +23 -0
- package/dist/types.d.ts +23 -0
- package/dist/utils.cjs +6 -0
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +5 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.js +6 -0
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/ESM_FIX_SUMMARY.md +0 -74
package/ESM_FIX_SUMMARY.md
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
# ESM/CJS Module Resolution Fix Summary
|
|
2
|
-
|
|
3
|
-
## Changes Made
|
|
4
|
-
|
|
5
|
-
### 1. **Added tsup Build Tool**
|
|
6
|
-
- Added `tsup` v8.3.5 to devDependencies for proper ESM/CJS dual package support
|
|
7
|
-
- Created `tsup.config.ts` with configuration for building both ESM and CJS outputs
|
|
8
|
-
|
|
9
|
-
### 2. **Updated package.json**
|
|
10
|
-
- Changed entry points from source files (`./src/`) to built files (`./dist/`)
|
|
11
|
-
- Added proper exports configuration with both ESM and CJS support:
|
|
12
|
-
- ESM files: `.js` extension with `.d.ts` types
|
|
13
|
-
- CJS files: `.cjs` extension with `.d.cts` types
|
|
14
|
-
- Updated build scripts to use tsup
|
|
15
|
-
- Added `module` field pointing to ESM entry
|
|
16
|
-
|
|
17
|
-
### 3. **Updated tsconfig.json**
|
|
18
|
-
- Changed `moduleResolution` from "bundler" to "node" for better compatibility
|
|
19
|
-
|
|
20
|
-
### 4. **Created Build Script**
|
|
21
|
-
- Added `build-and-commit.sh` for easy building and verification
|
|
22
|
-
|
|
23
|
-
## File Structure After Build
|
|
24
|
-
|
|
25
|
-
```
|
|
26
|
-
dist/
|
|
27
|
-
├── index.js # ESM main entry
|
|
28
|
-
├── index.cjs # CJS main entry
|
|
29
|
-
├── index.d.ts # TypeScript definitions
|
|
30
|
-
├── index.d.cts # CJS TypeScript definitions
|
|
31
|
-
├── client.js # ESM client export
|
|
32
|
-
├── client.cjs # CJS client export
|
|
33
|
-
├── client.d.ts # Client TypeScript definitions
|
|
34
|
-
├── client.d.cts # CJS Client TypeScript definitions
|
|
35
|
-
├── types.js # ESM types export
|
|
36
|
-
├── types.cjs # CJS types export
|
|
37
|
-
├── types.d.ts # Types TypeScript definitions
|
|
38
|
-
├── types.d.cts # CJS Types TypeScript definitions
|
|
39
|
-
├── components.js # ESM components export
|
|
40
|
-
├── components.cjs # CJS components export
|
|
41
|
-
├── components.d.ts # Components TypeScript definitions
|
|
42
|
-
└── components.d.cts # CJS Components TypeScript definitions
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## How to Build and Publish
|
|
46
|
-
|
|
47
|
-
1. **Install dependencies**: `bun install`
|
|
48
|
-
2. **Build the package**: `bun run build`
|
|
49
|
-
3. **Test locally**: Link the package to test in your project
|
|
50
|
-
4. **Publish**: `npm publish` (dist files will be included automatically)
|
|
51
|
-
|
|
52
|
-
## Benefits
|
|
53
|
-
|
|
54
|
-
1. **Proper ESM Support**: Next.js apps using `"type": "module"` can now import the package without issues
|
|
55
|
-
2. **CJS Compatibility**: Still works with CommonJS projects
|
|
56
|
-
3. **TypeScript Support**: Proper type definitions for both module systems
|
|
57
|
-
4. **Clean Exports**: Clear separation of server/client code with proper exports
|
|
58
|
-
5. **Future Proof**: Ready for the ESM-first ecosystem
|
|
59
|
-
|
|
60
|
-
## Testing the Fix
|
|
61
|
-
|
|
62
|
-
To test in your ContentQuant project:
|
|
63
|
-
1. Build the plugin: `bun run build`
|
|
64
|
-
2. Link locally: `npm link` in plugin directory
|
|
65
|
-
3. Link in project: `npm link payload-plugin-newsletter` in ContentQuant
|
|
66
|
-
4. Import and use normally
|
|
67
|
-
|
|
68
|
-
## Next Steps
|
|
69
|
-
|
|
70
|
-
1. Run `./build-and-commit.sh` to build the package
|
|
71
|
-
2. Test the built package locally
|
|
72
|
-
3. Commit changes with message: "fix: add tsup build system for proper ESM/CJS dual package support"
|
|
73
|
-
4. Push to repository
|
|
74
|
-
5. Publish new version to npm
|