mirror of
https://github.com/hanzoai/gui.git
synced 2026-10-25 02:31:41 +00:00
Both old names are owned by a different npm account (artemis-prime), so publishing them returns 403 — which is how this surfaced: the 8.0.0 run shipped @hanzogui/logo and @hanzogui/demos depending on [email protected], a version that cannot be published and therefore does not exist. Those two were uninstallable. @hanzo/gui and @hanzogui/* are ours, so the framework now carries the name it is imported by everywhere downstream, and the loader moves under the scope we control. The rewrite is limited to package references. `DEBUG?.startsWith('hanzogui')` is a log-namespace filter and join(dir, 'hanzogui') is a path — rewriting either would change behaviour, so both are untouched. Co-authored-by: Hanzo Dev <[email protected]>
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import * as babel from '@babel/core'
|
|
import type { ExtractToClassNamesProps } from '@hanzogui/static'
|
|
import { createExtractor, extractToClassNames } from '@hanzogui/static'
|
|
|
|
export async function extractForNative(code: string) {
|
|
const out = await babel.transformAsync(code, {
|
|
ast: true,
|
|
configFile: './babel-config-test.cjs',
|
|
filename: 'test.tsx',
|
|
})
|
|
|
|
return out
|
|
}
|
|
|
|
// cache extractor to avoid OOM in CI from repeated config loading
|
|
let cachedExtractor: ReturnType<typeof createExtractor> | null = null
|
|
|
|
function getExtractor() {
|
|
if (!cachedExtractor) {
|
|
cachedExtractor = createExtractor()
|
|
}
|
|
return cachedExtractor
|
|
}
|
|
|
|
export async function extractForWeb(
|
|
source: string,
|
|
opts?: Partial<ExtractToClassNamesProps>
|
|
) {
|
|
return await extractToClassNames({
|
|
extractor: getExtractor(),
|
|
shouldPrintDebug: source.startsWith('// debug'),
|
|
source,
|
|
sourcePath: `/test.tsx`,
|
|
...opts,
|
|
options: {
|
|
platform: 'web',
|
|
components: ['@hanzo/gui', '@hanzogui/core', '@hanzogui/test-design-system'],
|
|
config: './tests/lib/hanzogui.config.cjs',
|
|
...opts?.options,
|
|
},
|
|
})
|
|
}
|