Fixed table styles and panel variants
This commit is contained in:
@@ -29,7 +29,7 @@ if (fs.existsSync(tsconfig)) {
|
||||
// 2) Sass build (styles)
|
||||
runIfAvailable(
|
||||
'npx --no-install sass --version',
|
||||
'npx --no-install sass --no-source-map --style=compressed --load-path=node_modules src:dist',
|
||||
'npx --no-install sass --no-source-map --style=compressed --load-path=node_modules --quiet-deps --silence-deprecation=if-function,global-builtin,color-functions src:dist',
|
||||
'Sass styles build',
|
||||
)
|
||||
|
||||
@@ -68,3 +68,49 @@ try {
|
||||
} catch (e) {
|
||||
console.warn('Failed to generate per-subpath wrappers:', e && e.message)
|
||||
}
|
||||
|
||||
// Ensure a minimal `dist/types/index.d.ts` exists so consumers installing
|
||||
// from the packed tarball won't see a "could not find declaration file" error.
|
||||
try {
|
||||
const indexDts = path.join(cwd, 'dist', 'types', 'index.d.ts')
|
||||
if (!fs.existsSync(indexDts)) {
|
||||
const dir = path.dirname(indexDts)
|
||||
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true })
|
||||
const fallback = `/// <reference types="react" />
|
||||
export const Navbar: import('react').FC<any>;
|
||||
export const Footer: import('react').FC<any>;
|
||||
export const Layout: import('react').FC<any>;
|
||||
export const Split: import('react').FC<any> & { Panel: import('react').FC<any> };
|
||||
export default { Navbar, Footer, Layout, Split };
|
||||
`
|
||||
fs.writeFileSync(indexDts, fallback)
|
||||
console.log('Wrote fallback dist/types/index.d.ts')
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('Failed to write fallback index.d.ts:', e && e.message)
|
||||
}
|
||||
|
||||
// Write a small ESM wrapper that re-exports everything from the generated
|
||||
// `cyberduck.es.js` bundle. Some browser toolchains import the package
|
||||
// entry directly; having a tiny wrapper helps ensure named exports are
|
||||
// preserved and visible to native ESM loaders.
|
||||
try {
|
||||
const esmWrapperPath = path.join(cwd, 'dist', 'esm.js')
|
||||
// Re-export named bindings and build a local default object so we don't
|
||||
// need to import the bundle's default (some tools choke on that).
|
||||
const esmContent = `import { Navbar, Footer, Layout, Split } from './cyberduck.es.js';\nexport { Navbar, Footer, Layout, Split };\nconst __default = { Navbar, Footer, Layout, Split };\nexport default __default;\n`;
|
||||
fs.writeFileSync(esmWrapperPath, esmContent)
|
||||
console.log('Wrote dist/esm.js wrapper')
|
||||
} catch (e) {
|
||||
console.warn('Failed to write dist/esm.js wrapper:', e && e.message)
|
||||
}
|
||||
try {
|
||||
const indexPath = path.join(cwd, 'dist', 'index.js')
|
||||
// index.js mirrors esm.js to help environments that resolve package root
|
||||
// to an index file instead of reading package.json fields.
|
||||
const indexContent = `import { Navbar, Footer, Layout, Split } from './cyberduck.es.js';\nexport { Navbar, Footer, Layout, Split };\nconst __default = { Navbar, Footer, Layout, Split };\nexport default __default;\n`;
|
||||
fs.writeFileSync(indexPath, indexContent)
|
||||
console.log('Wrote dist/index.js wrapper')
|
||||
} catch (e) {
|
||||
console.warn('Failed to write dist/index.js wrapper:', e && e.message)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user