@ecomiq/storefront 2.0.1 → 2.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecomiq/storefront",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "Micro framework SSR de Ecomiq para storefronts. Páginas, datos y deploy sin configurar nada.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/codegen.mjs CHANGED
@@ -631,7 +631,7 @@ function resolvePackageDir(packageName, fromFiles) {
631
631
  try {
632
632
  const require = createRequire(fromFile)
633
633
  try {
634
- return dirname(realpathSync(require.resolve(`${packageName}/package.json`)))
634
+ return dirname(require.resolve(`${packageName}/package.json`))
635
635
  } catch {
636
636
  const entry = require.resolve(packageName)
637
637
  return findPackageRoot(entry, packageName)
@@ -650,7 +650,7 @@ function findPackageRoot(startPath, packageName) {
650
650
  if (existsSync(pkgPath)) {
651
651
  try {
652
652
  const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'))
653
- if (pkg.name === packageName) return realpathSync(dir)
653
+ if (pkg.name === packageName) return dir
654
654
  } catch {
655
655
  /* ignore */
656
656
  }
@@ -664,12 +664,16 @@ function findPackageRoot(startPath, packageName) {
664
664
  function linkInto(dir, name, targetPath) {
665
665
  mkdirSync(dir, { recursive: true })
666
666
  const linkPath = join(dir, name)
667
- let desired
667
+
668
+ // Target absoluto y ya resuelto: los symlinks relativos se rompen cuando un
669
+ // directorio padre es a su vez un symlink (p. ej. /var → /private/var en macOS).
670
+ let destination
668
671
  try {
669
- desired = realpathSync(targetPath)
672
+ destination = realpathSync(targetPath)
670
673
  } catch {
671
- desired = resolve(targetPath)
674
+ destination = resolve(targetPath)
672
675
  }
676
+
673
677
  try {
674
678
  const current = lstatSync(linkPath)
675
679
  if (current.isSymbolicLink()) {
@@ -679,7 +683,7 @@ function linkInto(dir, name, targetPath) {
679
683
  } catch {
680
684
  resolved = resolve(dir, readlinkSync(linkPath))
681
685
  }
682
- if (resolved === desired) return
686
+ if (resolved === destination) return
683
687
  unlinkSync(linkPath)
684
688
  } else if (current.isDirectory() || current.isFile()) {
685
689
  return
@@ -688,7 +692,7 @@ function linkInto(dir, name, targetPath) {
688
692
  /* no existe aún */
689
693
  }
690
694
  try {
691
- symlinkSync(desired, linkPath, 'junction')
695
+ symlinkSync(destination, linkPath, 'junction')
692
696
  } catch {
693
697
  /* FS sin symlinks: la resolución cae al hoisting */
694
698
  }
@@ -4,7 +4,6 @@
4
4
  * los plugins se importan aquí (contexto del framework) y se pasan como
5
5
  * instancias, así la resolución de módulos nunca depende del proyecto.
6
6
  */
7
- import { createRequire } from 'node:module'
8
7
  import { dirname, resolve } from 'node:path'
9
8
  import { fileURLToPath } from 'node:url'
10
9
  import { tanstackStart } from '@tanstack/react-start/plugin/vite'
@@ -53,26 +52,15 @@ function sanitizeHtmlClientBoundary() {
53
52
  }
54
53
  }
55
54
 
56
- function resolveFrameworkPackage(name) {
57
- try {
58
- const require = createRequire(resolve(frameworkRoot, 'package.json'))
59
- return dirname(require.resolve(`${name}/package.json`))
60
- } catch {
61
- return null
62
- }
63
- }
64
-
65
55
  export function createViteConfig({ appDir, config, projectRoot }) {
66
56
  const root = projectRoot ?? resolve(appDir, '..')
67
- const reactStartRoot = resolveFrameworkPackage('@tanstack/react-start')
68
- const allow = new Set([
57
+ const allow = [
69
58
  '..',
70
59
  root,
71
60
  frameworkRoot,
72
61
  resolve(appDir, 'node_modules'),
73
62
  resolve(root, 'node_modules'),
74
- ])
75
- if (reactStartRoot) allow.add(reactStartRoot)
63
+ ]
76
64
 
77
65
  return {
78
66
  root: appDir,
@@ -86,14 +74,26 @@ export function createViteConfig({ appDir, config, projectRoot }) {
86
74
  '@tanstack/react-start',
87
75
  '@tanstack/react-query',
88
76
  ],
89
- ...(reactStartRoot
90
- ? {
91
- alias: {
92
- // Asegura subpaths (`/server-entry`) cuando workerd no hereda el hoisting.
93
- '@tanstack/react-start': reactStartRoot,
94
- },
95
- }
96
- : {}),
77
+ },
78
+ // Evita que Vite externalice TanStack como file:// absoluto (rompe workerd/pnpm).
79
+ ssr: {
80
+ noExternal: [
81
+ '@tanstack/react-start',
82
+ '@tanstack/react-router',
83
+ '@tanstack/react-query',
84
+ '@tanstack/router-core',
85
+ '@tanstack/history',
86
+ '@tanstack/react-store',
87
+ '@ecomiq/storefront',
88
+ '@ecomiq/core',
89
+ ],
90
+ },
91
+ optimizeDeps: {
92
+ include: [
93
+ '@tanstack/react-start',
94
+ '@tanstack/react-router',
95
+ '@tanstack/react-query',
96
+ ],
97
97
  },
98
98
  plugins: [
99
99
  tailwindcss(),
@@ -128,7 +128,7 @@ export function createViteConfig({ appDir, config, projectRoot }) {
128
128
  server: {
129
129
  fs: {
130
130
  // pages/, lib/ y public/ del usuario viven un nivel arriba de .ecomiq
131
- allow: [...allow],
131
+ allow,
132
132
  },
133
133
  },
134
134
  }