mirror of
https://github.com/hanzoai/insights-js.git
synced 2026-10-30 18:34:19 +00:00
We own the ingestion server (hanzoai/insights: Django + rust/capture + nodejs plugin) AND this SDK, so there is no external wire contract to preserve. The server is already 100% posthog-free; this SDK was the last laggard. - $last_posthog_reset -> $last_insights_reset. This FIXES A LIVE MISMATCH: the server taxonomy (insights/taxonomy/taxonomy.py, insights/insightsql/ai.py) already expected the insights form while the SDK emitted the posthog form. - __PosthogExtensions__ -> __InsightsExtensions__; all PostHog/posthog/POSTHOG identifiers -> Insights/insights/INSIGHTS (src, tests, playground, playwright, scripts, rrweb subpackages, package.json keywords). - Hosts: DEFAULT_PLUGIN_HOST + DEFAULT_NUXT_HOST + the core host default pointed at PostHog's cloud (us.i.posthog.com) — a real bug. All -> insights.hanzo.ai. - Removed the us-assets/eu-assets CDN split in getRemoteConfig (PostHog-specific; Hanzo serves remote config from the same host) — it had degenerated to a no-op. - Fixed generate-docs writing to a stray references/@hanzo/ subdir. - Renamed the 3 posthog-named test files; dropped 58MB of stale reference snapshots named for upstream posthog versions we never shipped (they are generated output — references/ is now gitignored). Verified: typecheck errors 42 (HEAD) -> 18 (all pre-existing test-mock looseness); types package 0; every package.json valid with @hanzo/* names. Guard: grep -rioE 'posthog' packages ... | wc -l => 0
169 lines
3.7 KiB
JavaScript
169 lines
3.7 KiB
JavaScript
import { resolve, typescript, commonjs, dts } from '@hanzo/insights-tooling-rollup-utils'
|
|
import copy from 'rollup-plugin-copy'
|
|
|
|
const extensions = ['.js', '.jsx', '.ts', '.tsx']
|
|
|
|
const plugins = [
|
|
// Resolve modules from node_modules
|
|
resolve({
|
|
preferBuiltins: false,
|
|
mainFields: ['module', 'main', 'jsnext:main', 'browser'],
|
|
extensions,
|
|
}),
|
|
commonjs(),
|
|
// Compile typescript to javascript
|
|
typescript({
|
|
tsconfig: './tsconfig.json',
|
|
}),
|
|
]
|
|
|
|
/**
|
|
* Configuration for the ESM build
|
|
*/
|
|
const buildEsm = {
|
|
external: ['@hanzo/insights', 'react'],
|
|
input: [
|
|
// Split modules so they can be tree-shaken
|
|
'src/index.ts',
|
|
],
|
|
output: {
|
|
file: 'dist/esm/index.js',
|
|
format: 'esm',
|
|
sourcemap: true,
|
|
},
|
|
plugins,
|
|
}
|
|
|
|
/**
|
|
* Configuration for the UMD build
|
|
*/
|
|
const buildUmd = {
|
|
external: ['@hanzo/insights', 'react'],
|
|
input: './src/index.ts',
|
|
output: {
|
|
file: 'dist/umd/index.js',
|
|
name: 'InsightsReact',
|
|
format: 'umd',
|
|
sourcemap: true,
|
|
esModule: false,
|
|
globals: {
|
|
react: 'React',
|
|
'@hanzo/insights': 'insights',
|
|
},
|
|
},
|
|
plugins,
|
|
}
|
|
|
|
const buildTypes = {
|
|
external: ['@hanzo/insights', 'react'],
|
|
input: './src/index.ts',
|
|
output: {
|
|
file: 'dist/types/index.d.ts',
|
|
format: 'es',
|
|
},
|
|
plugins: [resolve(), dts()],
|
|
}
|
|
|
|
/**
|
|
* Configuration for the slim build (no insights-js runtime dependency)
|
|
*/
|
|
const buildSlimEsm = {
|
|
external: ['@hanzo/insights', 'react'],
|
|
input: 'src/slim.ts',
|
|
output: {
|
|
file: 'dist/esm/slim/index.js',
|
|
format: 'esm',
|
|
sourcemap: true,
|
|
},
|
|
plugins,
|
|
}
|
|
|
|
const buildSlimUmd = {
|
|
external: ['@hanzo/insights', 'react'],
|
|
input: 'src/slim.ts',
|
|
output: {
|
|
file: 'dist/umd/slim/index.js',
|
|
name: 'InsightsReactSlim',
|
|
format: 'umd',
|
|
sourcemap: true,
|
|
esModule: false,
|
|
globals: {
|
|
react: 'React',
|
|
'@hanzo/insights': 'insights',
|
|
},
|
|
},
|
|
plugins,
|
|
}
|
|
|
|
const buildSlimTypes = {
|
|
external: ['@hanzo/insights', 'react'],
|
|
input: 'src/slim.ts',
|
|
output: {
|
|
file: 'dist/types/slim/index.d.ts',
|
|
format: 'es',
|
|
},
|
|
plugins: [resolve(), dts()],
|
|
}
|
|
|
|
const buildSurveysEsm = {
|
|
external: ['@hanzo/insights', 'react'],
|
|
input: 'src/surveys/index.ts',
|
|
output: {
|
|
file: 'dist/esm/surveys/index.js',
|
|
format: 'esm',
|
|
sourcemap: true,
|
|
},
|
|
plugins,
|
|
}
|
|
|
|
const buildSurveysUmd = {
|
|
external: ['@hanzo/insights', 'react'],
|
|
input: 'src/surveys/index.ts',
|
|
output: {
|
|
file: 'dist/umd/surveys/index.js',
|
|
name: 'InsightsReactSurveys',
|
|
format: 'umd',
|
|
sourcemap: true,
|
|
esModule: false,
|
|
globals: {
|
|
react: 'React',
|
|
'@hanzo/insights': 'insights',
|
|
},
|
|
},
|
|
plugins,
|
|
}
|
|
|
|
const buildSurveysTypes = {
|
|
external: ['@hanzo/insights', 'react'],
|
|
input: 'src/surveys/index.ts',
|
|
output: {
|
|
file: 'dist/types/surveys/index.d.ts',
|
|
format: 'es',
|
|
},
|
|
plugins: [
|
|
resolve(),
|
|
dts(),
|
|
copy({
|
|
hook: 'writeBundle',
|
|
targets: [
|
|
{ src: 'dist/*', dest: '../browser/react/dist' },
|
|
{ src: 'src/*', dest: '../browser/react/src' },
|
|
{ src: 'surveys', dest: '../browser/react' },
|
|
{ src: 'slim', dest: '../browser/react' },
|
|
],
|
|
}),
|
|
],
|
|
}
|
|
|
|
export default [
|
|
buildEsm,
|
|
buildUmd,
|
|
buildTypes,
|
|
buildSlimEsm,
|
|
buildSlimUmd,
|
|
buildSlimTypes,
|
|
buildSurveysEsm,
|
|
buildSurveysUmd,
|
|
buildSurveysTypes,
|
|
]
|