@hiscovega/vundle 0.0.14 → 0.0.15

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.15](https://github.com/griddo/griddo-bundler/compare/v0.0.14...v0.0.15) (2026-01-21)
4
+
5
+
6
+ ### Features
7
+
8
+ * add initial client configuration and test suite ([3c51477](https://github.com/griddo/griddo-bundler/commit/3c514775e98cba6384028db9787b596632369fe1))
9
+ * **vite:** enhance external handling and improve build resilience ([2acb47a](https://github.com/griddo/griddo-bundler/commit/2acb47a19d845f19c971242f7396642f02c75fba))
10
+
3
11
  ## [0.0.14](https://github.com/griddo/griddo-bundler/compare/v0.0.13...v0.0.14) (2026-01-21)
4
12
 
5
13
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hiscovega/vundle",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "description": "Master bundler configuration for Griddo Instance projects",
5
5
  "main": "vite.config.mjs",
6
6
  "module": "vite.config.mjs",
@@ -35,11 +35,14 @@
35
35
  ],
36
36
  "scripts": {
37
37
  "remote:build": "vite build --config ./vite.config.mjs",
38
+ "test": "vitest run --config ./vitest.config.mjs",
39
+ "test:watch": "vitest --config ./vitest.config.mjs",
40
+ "fixture:build": "cd fixtures/client && ../../node_modules/.bin/vite build --config ../../vite.config.mjs",
38
41
  "lint": "biome check .",
39
42
  "lint:fix": "biome check --write .",
40
43
  "format": "biome format --write .",
41
44
  "format:check": "biome format .",
42
- "prepublishOnly": "npm run lint && npm run format:check",
45
+ "prepublishOnly": "npm run lint && npm run format:check && npm test",
43
46
  "prepare": "npm run lint",
44
47
  "release": "release-it",
45
48
  "release:dry": "release-it --dry-run",
@@ -96,6 +99,7 @@
96
99
  "devDependencies": {
97
100
  "@biomejs/biome": "2.2.4",
98
101
  "@release-it/conventional-changelog": "^10.0.1",
99
- "release-it": "^19.0.4"
102
+ "release-it": "^19.0.4",
103
+ "vitest": "^4.0.17"
100
104
  }
101
105
  }
package/plugins/index.mjs CHANGED
@@ -18,6 +18,9 @@ export const plugins = [
18
18
  // }),
19
19
 
20
20
  viteStaticCopy({
21
+ // `static/` y `thumbnails/` no son obligatorios en todos los clientes.
22
+ // Si no existen/no hay archivos, no queremos que el build falle.
23
+ silent: true,
21
24
  targets: [
22
25
  { src: "static", dest: "" },
23
26
  { src: "thumbnails", dest: "" },
package/vite.config.mjs CHANGED
@@ -15,6 +15,20 @@ export default defineConfig(async ({ command, mode }) => {
15
15
  return "assets/[name]-[hash][extname]";
16
16
  };
17
17
 
18
+ const toExternalFn = (external) => {
19
+ if (!external) return () => false;
20
+ if (typeof external === "function") return external;
21
+
22
+ const externals = Array.isArray(external) ? external : [external];
23
+ return (id) => {
24
+ for (const ext of externals) {
25
+ if (typeof ext === "string" && (id === ext || id.startsWith(`${ext}/`))) return true;
26
+ if (ext instanceof RegExp && ext.test(id)) return true;
27
+ }
28
+ return false;
29
+ };
30
+ };
31
+
18
32
  // Usamos la función nativa de Vite para encontrar, cargar y transpilar
19
33
  // la configuración del cliente, soportando .ts, .js, .mjs, etc.
20
34
  try {
@@ -116,15 +130,18 @@ export default defineConfig(async ({ command, mode }) => {
116
130
  };
117
131
 
118
132
  // --- Fusión Final ---
119
- // Antes de fusionar, nos aseguramos de que la configuración `external` del
120
- // master nunca sea sobreescrita por el cliente. Esta es la clave para
121
- // evitar la duplicación de React.
122
- if (clientConfig.build?.rollupOptions?.external) {
123
- console.log(
124
- "WARN: The client-defined 'build.rollupOptions.external' property will be ignored. Use 'griddoOptions.customExternals' instead.",
125
- );
126
- delete clientConfig.build.rollupOptions.external;
127
- }
133
+ const merged = mergeConfig(masterConfig, clientConfig);
134
+
135
+ // Componemos externals: reglas del master (React/@griddo/core, etc.) + API declarativa
136
+ // `griddoOptions.customExternals` + `build.rollupOptions.external` estándar del cliente.
137
+ // Esto mantiene compatibilidad con Vite/Rollup sin permitir que el cliente "rebundee" React.
138
+ const clientExternal = toExternalFn(clientConfig.build?.rollupOptions?.external);
139
+ const masterExternal = toExternalFn(masterConfig.build?.rollupOptions?.external);
140
+
141
+ if (!merged.build) merged.build = {};
142
+ if (!merged.build.rollupOptions) merged.build.rollupOptions = {};
143
+
144
+ merged.build.rollupOptions.external = (id, ...args) => masterExternal(id, ...args) || clientExternal(id, ...args);
128
145
 
129
- return mergeConfig(masterConfig, clientConfig);
146
+ return merged;
130
147
  });