@nextsparkjs/core 0.1.0-beta.152 → 0.1.0-beta.153

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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "generated": "2026-05-26T19:28:10.299Z",
2
+ "generated": "2026-05-26T20:11:15.518Z",
3
3
  "totalClasses": 1080,
4
4
  "classes": [
5
5
  "!text-2xl",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextsparkjs/core",
3
- "version": "0.1.0-beta.152",
3
+ "version": "0.1.0-beta.153",
4
4
  "description": "NextSpark - The complete SaaS framework for Next.js",
5
5
  "license": "MIT",
6
6
  "author": "NextSpark <hello@nextspark.dev>",
@@ -467,7 +467,7 @@
467
467
  "tailwind-merge": "^3.3.1",
468
468
  "uuid": "^13.0.0",
469
469
  "zod": "^4.1.5",
470
- "@nextsparkjs/testing": "0.1.0-beta.152"
470
+ "@nextsparkjs/testing": "0.1.0-beta.153"
471
471
  },
472
472
  "scripts": {
473
473
  "postinstall": "node scripts/postinstall.mjs || true",
@@ -40,13 +40,22 @@ function slugToIdentifier(slug) {
40
40
  }
41
41
 
42
42
  /**
43
- * Walk a directory and return its email entries (one per .ts/.tsx file at the
43
+ * Walk a directory and return its email entries (one per template file at the
44
44
  * top level — emails are not nested).
45
45
  *
46
+ * Source files are `.ts`/`.tsx` (monorepo mode + theme overrides). Compiled
47
+ * npm distributions ship `.js` + `.d.ts` only — the `.d.ts` carries the
48
+ * canonical slug list (one per template, paired with the `.js` runtime),
49
+ * so we accept `.d.ts` files as slug markers when `acceptCompiled` is true.
50
+ * The generator's import path stays the same (`@nextsparkjs/core/emails/<slug>`)
51
+ * and the bundler resolves to the `.js` runtime at build time.
52
+ *
46
53
  * @param {string} dir
54
+ * @param {{ acceptCompiled?: boolean }} [options]
47
55
  * @returns {Promise<Array<{ slug: string, fileName: string }>>}
48
56
  */
49
- async function listEmailFiles(dir) {
57
+ async function listEmailFiles(dir, options = {}) {
58
+ const { acceptCompiled = false } = options
50
59
  let entries
51
60
  try {
52
61
  entries = await readdir(dir, { withFileTypes: true })
@@ -55,17 +64,30 @@ async function listEmailFiles(dir) {
55
64
  return []
56
65
  }
57
66
 
67
+ const seen = new Set()
58
68
  const out = []
59
69
  for (const entry of entries) {
60
70
  if (!entry.isFile()) continue
61
- if (!entry.name.endsWith('.ts') && !entry.name.endsWith('.tsx')) continue
62
71
  // Skip barrel files and underscore-prefixed (README/notes)
63
- if (entry.name === 'index.ts' || entry.name === 'index.tsx') continue
64
72
  if (entry.name.startsWith('_')) continue
65
- if (entry.name.endsWith('.d.ts')) continue
73
+ if (entry.name === 'index.ts' || entry.name === 'index.tsx') continue
74
+ if (entry.name === 'index.js' || entry.name === 'index.d.ts') continue
66
75
  if (entry.name.endsWith('.test.ts') || entry.name.endsWith('.test.tsx')) continue
67
-
68
- const slug = entry.name.replace(/\.(tsx|ts)$/, '')
76
+ if (entry.name.endsWith('.d.ts.map')) continue
77
+
78
+ let slug = null
79
+ if (entry.name.endsWith('.tsx')) {
80
+ slug = entry.name.slice(0, -4)
81
+ } else if (entry.name.endsWith('.ts') && !entry.name.endsWith('.d.ts')) {
82
+ slug = entry.name.slice(0, -3)
83
+ } else if (acceptCompiled && entry.name.endsWith('.d.ts')) {
84
+ // Compiled dist directory — the .d.ts is the slug marker for the
85
+ // matching .js runtime that the bundler will resolve via the package
86
+ // exports field at consumer build time.
87
+ slug = entry.name.slice(0, -5)
88
+ }
89
+ if (!slug || seen.has(slug)) continue
90
+ seen.add(slug)
69
91
  out.push({ slug, fileName: entry.name })
70
92
  }
71
93
  return out
@@ -98,8 +120,12 @@ export async function discoverEmails(config = DEFAULT_CONFIG) {
98
120
  /** @type {Map<string, DiscoveredEmail>} */
99
121
  const merged = new Map()
100
122
 
101
- // Core defaults
102
- const coreFiles = await listEmailFiles(coreEmailsDir)
123
+ // Core defaults — in npm mode the package ships `.d.ts` + `.js` only, so
124
+ // accept `.d.ts` as slug markers there. Monorepo mode keeps the original
125
+ // `.ts`-only contract since the source tree has the uncompiled files.
126
+ const coreFiles = await listEmailFiles(coreEmailsDir, {
127
+ acceptCompiled: !!config.isNpmMode,
128
+ })
103
129
  if (coreFiles.length > 0) {
104
130
  verbose(`Found ${coreFiles.length} core email template(s) in: ${coreEmailsDir}`)
105
131
  for (const { slug } of coreFiles) {