@dropi/ui 0.1.26 → 0.1.27
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 +1 -1
- package/scripts/setup.js +38 -2
package/package.json
CHANGED
package/scripts/setup.js
CHANGED
|
@@ -254,14 +254,50 @@ dropi-icon:not(.hydrated) {
|
|
|
254
254
|
const layoutPath = layoutCandidates.find(f => fs.existsSync(f));
|
|
255
255
|
if (layoutPath) {
|
|
256
256
|
let layout = fs.readFileSync(layoutPath, 'utf8');
|
|
257
|
+
let layoutChanged = false;
|
|
258
|
+
|
|
259
|
+
// Agregar suppressHydrationWarning al <body>
|
|
260
|
+
if (!layout.includes('suppressHydrationWarning')) {
|
|
261
|
+
layout = layout.replace(/<body(\s[^>]*)?>/, (_, attrs) => {
|
|
262
|
+
const existing = attrs || '';
|
|
263
|
+
return `<body${existing} suppressHydrationWarning>`;
|
|
264
|
+
});
|
|
265
|
+
layoutChanged = true;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// Agregar Lottie script antes del cierre de </body>
|
|
257
269
|
if (!layout.includes('lottie-player.js')) {
|
|
258
|
-
// Agregar script antes del cierre de </body>
|
|
259
270
|
layout = layout.replace(
|
|
260
271
|
/(<\/body>)/,
|
|
261
272
|
` {/* lottie-player: needed by DropiAlertModal animations */}\n <script src="https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js" async />\n $1`
|
|
262
273
|
);
|
|
274
|
+
layoutChanged = true;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
if (layoutChanged) {
|
|
263
278
|
fs.writeFileSync(layoutPath, layout);
|
|
264
|
-
log(`${path.relative(projectRoot, layoutPath)}:
|
|
279
|
+
log(`${path.relative(projectRoot, layoutPath)}: layout configurado.`, 'ok');
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// Agregar --webpack a scripts dev/build si Next.js >= 16 (Turbopack incompatible con @stencil/ssr)
|
|
284
|
+
if (isNextJsSsr) {
|
|
285
|
+
const nextVersion = pkg.dependencies?.['next'] || pkg.devDependencies?.['next'] || '';
|
|
286
|
+
const majorVersion = parseInt(nextVersion.replace(/[^0-9]/, ''), 10);
|
|
287
|
+
if (majorVersion >= 16) {
|
|
288
|
+
const pkgPath = path.join(projectRoot, 'package.json');
|
|
289
|
+
let projectPkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
290
|
+
let pkgChanged = false;
|
|
291
|
+
['dev', 'build'].forEach(script => {
|
|
292
|
+
if (projectPkg.scripts?.[script] && !projectPkg.scripts[script].includes('--webpack')) {
|
|
293
|
+
projectPkg.scripts[script] += ' --webpack';
|
|
294
|
+
pkgChanged = true;
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
if (pkgChanged) {
|
|
298
|
+
fs.writeFileSync(pkgPath, JSON.stringify(projectPkg, null, 2) + '\n');
|
|
299
|
+
log('package.json: --webpack agregado a scripts dev/build (Next.js 16+ requiere webpack con @stencil/ssr).', 'ok');
|
|
300
|
+
}
|
|
265
301
|
}
|
|
266
302
|
}
|
|
267
303
|
}
|