@hiscovega/vundle 0.0.14 → 0.0.16

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,15 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.16](https://github.com/griddo/vundle/compare/v0.0.15...v0.0.16) (2026-01-21)
4
+
5
+ ## [0.0.15](https://github.com/griddo/griddo-bundler/compare/v0.0.14...v0.0.15) (2026-01-21)
6
+
7
+
8
+ ### Features
9
+
10
+ * add initial client configuration and test suite ([3c51477](https://github.com/griddo/griddo-bundler/commit/3c514775e98cba6384028db9787b596632369fe1))
11
+ * **vite:** enhance external handling and improve build resilience ([2acb47a](https://github.com/griddo/griddo-bundler/commit/2acb47a19d845f19c971242f7396642f02c75fba))
12
+
3
13
  ## [0.0.14](https://github.com/griddo/griddo-bundler/compare/v0.0.13...v0.0.14) (2026-01-21)
4
14
 
5
15
 
package/README.md CHANGED
@@ -8,17 +8,21 @@ Griddo vite bundler configuration for Griddo Instance projects.
8
8
  npm install @hiscovega/vundle # at @hiscovega org for the beta testing
9
9
  ```
10
10
 
11
- ## 🚀 Publishing
11
+ ## 🚀 Usage
12
12
 
13
- ### Automated Releases with release-it
13
+ ### Build (from a client project)
14
14
 
15
- This package uses [release-it](https://github.com/release-it/release-it) for automated versioning and publishing.
15
+ Run Vite using this package config:
16
16
 
17
- ## 🚀 Usage
17
+ ```bash
18
+ vite build --config node_modules/@hiscovega/vundle/vite.config.mjs
19
+ ```
20
+
21
+ The bundler will look for the client `vite.config.*` in the current working directory and merge it on top of the master config.
18
22
 
19
- ### Client Configuration (vite.config.mjs)
23
+ ### Client Configuration (`vite.config.mjs`)
20
24
 
21
- The bundler automatically looks for a `vite.config.mjs` file in a Griddo project root. Create this file to customize the build configuration.
25
+ Create a `vite.config.mjs` (or `.ts/.js`) in your project root to customize the build configuration.
22
26
 
23
27
  ```javascript
24
28
  // vite.config.mjs (in your project root)
@@ -26,6 +30,10 @@ export default {
26
30
  plugins: [
27
31
  // Additional Vite plugins for your project
28
32
  ],
33
+
34
+ // Standard Vite/Rollup external (advanced). It will be COMPOSED with the bundler externals.
35
+ // build: { rollupOptions: { external: (id) => id === "my-heavy-dep" } },
36
+
29
37
  griddoOptions: {
30
38
  customExternals: [
31
39
  "some-heavy-package-foo", // Mark as external by exact name
@@ -35,21 +43,50 @@ export default {
35
43
  };
36
44
  ```
37
45
 
38
- ## Salida del bundle
46
+ ### Notes
47
+
48
+ - **Mandatory externals**: React, React DOM and `@griddo/core` are always externalized by the bundler.
49
+ - **Optional assets**: `static/` and `thumbnails/` are copied into `dist/` if they exist. If they don't exist, the build will not fail.
50
+
51
+ ## Bundle output
39
52
 
40
- El bundle exporta cuatro elementos:
53
+ The bundle exports four artifacts:
41
54
 
42
55
  ```
43
- dist/index.js # Antiguo src/index.js de la instancia: templates, modules, components, contextos, etc..
44
- dist/builder.js # Archivos relacionados con Gatsby: antiguos builder.browser.jsx, builder.ssr.jsx y builder.config.js
45
- dist/griddo.config.js # Antiguo griddo.config.ts
46
- dist/builder.css # Todo el css de la instancia empaquetado
56
+ dist/index.js # Legacy instance entry: templates, modules, components, contexts, etc.
57
+ dist/builder.js # Builder-related files (legacy): builder.browser.jsx, builder.ssr.jsx and builder.config.js
58
+ dist/griddo.config.js # Legacy griddo.config.ts
59
+ dist/builder.css # All instance CSS bundled
47
60
  ```
48
61
 
49
62
  ```
50
- Para importarlos en AX / CX
63
+ Importing in AX / CX:
51
64
  import { SiteProvider, bundle, components, formsTemplates, templates } from "<bundle>"
52
65
  import { browser, config, ssr } from "<bundle>/builder"
53
66
  import griddoConfig from "<bundle>/griddo.config"
54
67
  import "<bundle>/builder.css"
55
68
  ```
69
+
70
+ ## ✅ Testing
71
+
72
+ ```bash
73
+ npm test
74
+ ```
75
+
76
+ ## 🧪 Local fixture (simple client)
77
+
78
+ This repo includes a minimal client fixture under `fixtures/client/`:
79
+
80
+ ```bash
81
+ npm run fixture:build
82
+ ```
83
+
84
+ ## 🚀 Publishing
85
+
86
+ This package uses [release-it](https://github.com/release-it/release-it) for automated versioning and publishing.
87
+
88
+ Tip: if you run releases in a non-interactive environment (no TTY), use:
89
+
90
+ ```bash
91
+ npm run release:patch -- --ci
92
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hiscovega/vundle",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
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",
@@ -48,10 +51,10 @@
48
51
  "release:patch": "release-it patch"
49
52
  },
50
53
  "dependencies": {
51
- "@vitejs/plugin-react": "5.0.4",
52
- "vite": "7.1.10",
54
+ "@vitejs/plugin-react": "5.1.2",
55
+ "vite": "7.3.1",
53
56
  "vite-plugin-dts": "4.5.4",
54
- "vite-plugin-static-copy": "3.1.4"
57
+ "vite-plugin-static-copy": "3.1.5"
55
58
  },
56
59
  "peerDependencies": {
57
60
  "@griddo/core": "latest",
@@ -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
  });