@hiscovega/vundle 0.0.13 → 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,20 @@
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
+
11
+ ## [0.0.14](https://github.com/griddo/griddo-bundler/compare/v0.0.13...v0.0.14) (2026-01-21)
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * **vite:** remove build warnings and harden externals ([1b95862](https://github.com/griddo/griddo-bundler/commit/1b9586219354627837e8fd8165151ce62960ebfe))
17
+
3
18
  ## [0.0.13](https://github.com/griddo/griddo-bundler/compare/v0.0.12...v0.0.13) (2025-11-10)
4
19
 
5
20
  ## [0.0.12](https://github.com/griddo/griddo-bundler/compare/v0.0.11...v0.0.12) (2025-10-16)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hiscovega/vundle",
3
- "version": "0.0.13",
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",
@@ -8,11 +8,11 @@
8
8
  "type": "module",
9
9
  "exports": {
10
10
  ".": {
11
- "types": "./vite.config.mjs",
11
+ "types": "./types/client-config.d.ts",
12
12
  "import": "./vite.config.mjs"
13
13
  },
14
14
  "./vite.config": {
15
- "types": "./vite.config.mjs",
15
+ "types": "./types/client-config.d.ts",
16
16
  "import": "./vite.config.mjs"
17
17
  },
18
18
  "./plugins": {
@@ -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
@@ -5,6 +5,30 @@ import { plugins as masterPlugins } from "./plugins/index.mjs";
5
5
  export default defineConfig(async ({ command, mode }) => {
6
6
  let clientConfig = {};
7
7
 
8
+ const sharedAssetFileNames = (assetInfo) => {
9
+ if (assetInfo.name?.endsWith(".css")) {
10
+ return "builder.css";
11
+ }
12
+ if (assetInfo.name?.match(/\.(png|jpe?g|gif|webp)$/)) {
13
+ return "assets/[name]-[hash][extname]";
14
+ }
15
+ return "assets/[name]-[hash][extname]";
16
+ };
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
+
8
32
  // Usamos la función nativa de Vite para encontrar, cargar y transpilar
9
33
  // la configuración del cliente, soportando .ts, .js, .mjs, etc.
10
34
  try {
@@ -35,7 +59,10 @@ export default defineConfig(async ({ command, mode }) => {
35
59
  // --- Configuración Base del Master ---
36
60
  const masterConfig = {
37
61
  logLevel: "warn",
38
- publicDir: "static",
62
+ // El copiado de assets lo gestiona `vite-plugin-static-copy` y además
63
+ // `copyPublicDir` está desactivado; evitamos confusiones deshabilitando
64
+ // `publicDir` explícitamente.
65
+ publicDir: false,
39
66
  define: { global: "globalThis" },
40
67
  plugins: masterPlugins,
41
68
  build: {
@@ -46,14 +73,20 @@ export default defineConfig(async ({ command, mode }) => {
46
73
  builder: resolve(process.cwd(), "src/builder.jsx"),
47
74
  "griddo.config": resolve(process.cwd(), "src/griddo.config.ts"),
48
75
  },
49
- formats: ["es", "cjs"],
50
76
  name: "GriddoInstance",
51
77
  },
52
78
  rollupOptions: {
53
79
  preserveEntrySignatures: "strict",
54
80
  external: (id) => {
55
81
  // 1. Reglas 'external' del master (no se pueden sobreescribir)
56
- const masterRules = ["@griddo/core", "react", "react-dom", "react/jsx-runtime", "prop-types"];
82
+ const masterRules = [
83
+ "@griddo/core",
84
+ "react",
85
+ "react-dom",
86
+ "react/jsx-runtime",
87
+ "react/jsx-dev-runtime",
88
+ "prop-types",
89
+ ];
57
90
  if (masterRules.some((pkg) => id === pkg || id.startsWith(`${pkg}/`))) {
58
91
  return true;
59
92
  }
@@ -79,30 +112,14 @@ export default defineConfig(async ({ command, mode }) => {
79
112
  dir: "dist",
80
113
  format: "es",
81
114
  entryFileNames: "[name].js",
82
- assetFileNames: (assetInfo) => {
83
- if (assetInfo.name?.endsWith(".css")) {
84
- return "builder.css";
85
- }
86
- if (assetInfo.name?.match(/\.(png|jpe?g|gif|webp)$/)) {
87
- return "assets/[name]-[hash][extname]";
88
- }
89
- return "assets/[name]-[hash][extname]";
90
- },
115
+ assetFileNames: sharedAssetFileNames,
91
116
  },
92
117
  {
93
118
  dir: "dist",
94
119
  format: "cjs",
95
120
  entryFileNames: "[name].cjs",
96
121
  exports: "named",
97
- assetFileNames: (assetInfo) => {
98
- if (assetInfo.name?.endsWith(".css")) {
99
- return "builder.css";
100
- }
101
- if (assetInfo.name?.match(/\.(png|jpe?g|gif|webp)$/)) {
102
- return "assets/[name]-[hash][extname]";
103
- }
104
- return "assets/[name]-[hash][extname]";
105
- },
122
+ assetFileNames: sharedAssetFileNames,
106
123
  },
107
124
  ],
108
125
  },
@@ -113,15 +130,18 @@ export default defineConfig(async ({ command, mode }) => {
113
130
  };
114
131
 
115
132
  // --- Fusión Final ---
116
- // Antes de fusionar, nos aseguramos de que la configuración `external` del
117
- // master nunca sea sobreescrita por el cliente. Esta es la clave para
118
- // evitar la duplicación de React.
119
- if (clientConfig.build?.rollupOptions?.external) {
120
- console.log(
121
- "WARN: The client-defined 'build.rollupOptions.external' property will be ignored. Use 'griddoOptions.customExternals' instead.",
122
- );
123
- delete clientConfig.build.rollupOptions.external;
124
- }
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);
125
145
 
126
- return mergeConfig(masterConfig, clientConfig);
146
+ return merged;
127
147
  });