Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 27 additions & 9 deletions sdk/@launchdarkly/observability/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
},
"scripts": {
"typegen": "tsc",
"build": "vite build"
"build": "yarn build:minimal && yarn build:full",
"build:minimal": "vite build --config vite.config.minimal.ts",
"build:full": "vite build",
"size": "size-limit"
},
"dependencies": {
"highlight.run": "workspace:*"
Expand All @@ -37,19 +40,34 @@
"vitest": "^3.1.2"
},
"type": "module",
"main": "./dist/observability.js",
"module": "./dist/observability.js",
"types": "./dist/index.d.ts",
"main": "./dist/index-minimal.js",
"module": "./dist/index-minimal.js",
"types": "./dist/index-minimal.d.ts",
"exports": {
".": {
"import": "./dist/index-minimal.js",
"require": "./dist/index-minimal.cjs",
"types": "./dist/index-minimal.d.ts"
},
"./full": {
"import": "./dist/observability.js",
"types": "./dist/index.d.ts"
}
},
"files": [
"dist"
],
"size-limit": [
{
"path": [
"dist/*.js",
"!dist/*.umd.js"
],
"limit": "256 kB",
"name": "Minimal Build",
"path": "dist/index-minimal.js",
"limit": "5 kB",
"brotli": true
},
{
"name": "Full Build",
"path": "dist/observability.js",
"limit": "100 kB",
"brotli": true
}
]
Expand Down
3 changes: 3 additions & 0 deletions sdk/@launchdarkly/observability/src/index-minimal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Re-export from the ultra-minimal build
export { Observe as default, LDObserve } from '../../highlight-run/src/sdk/ld-ultra-minimal'
export type { MinimalObserveOptions as ObserveOptions } from '../../highlight-run/src/sdk/ld-ultra-minimal'
61 changes: 61 additions & 0 deletions sdk/@launchdarkly/observability/vite.config.minimal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// vite.config.minimal.ts
import { resolve as resolvePath } from 'path'
import { defineConfig } from 'vite'

export default defineConfig({
build: {
target: 'es2020',
lib: {
formats: ['es', 'cjs'],
entry: resolvePath(__dirname, 'src/index-minimal.ts'),
fileName: (format) => `index-minimal.${format === 'es' ? 'js' : 'cjs'}`,
},
minify: 'terser',
terserOptions: {
ecma: 2020,
module: true,
toplevel: true,
compress: {
ecma: 2020,
module: true,
toplevel: true,
unsafe_arrows: true,
drop_console: true,
drop_debugger: true,
passes: 3,
pure_getters: true,
unsafe: true,
unsafe_comps: true,
unsafe_math: true,
unsafe_methods: true,
unsafe_proto: true,
unsafe_regexp: true,
unsafe_undefined: true,
unused: true,
dead_code: true,
inline: 3,
side_effects: false,
},
mangle: {
toplevel: true,
},
format: {
comments: false,
ecma: 2020,
},
},
rollupOptions: {
external: ['highlight.run'],
treeshake: {
moduleSideEffects: false,
propertyReadSideEffects: false,
tryCatchDeoptimization: false,
unknownGlobalSideEffects: false,
},
output: {
compact: true,
minifyInternalExports: true,
},
},
},
})
36 changes: 27 additions & 9 deletions sdk/@launchdarkly/session-replay/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
},
"scripts": {
"typegen": "tsc",
"build": "vite build"
"build": "yarn build:minimal && yarn build:full",
"build:minimal": "vite build --config vite.config.minimal.ts",
"build:full": "vite build",
"size": "size-limit"
},
"dependencies": {
"highlight.run": "workspace:*"
Expand All @@ -34,19 +37,34 @@
"vitest": "^3.1.2"
},
"type": "module",
"main": "./dist/session-replay.js",
"module": "./dist/session-replay.js",
"types": "./dist/index.d.ts",
"main": "./dist/index-minimal.js",
"module": "./dist/index-minimal.js",
"types": "./dist/index-minimal.d.ts",
"exports": {
".": {
"import": "./dist/index-minimal.js",
"require": "./dist/index-minimal.cjs",
"types": "./dist/index-minimal.d.ts"
},
"./full": {
"import": "./dist/session-replay.js",
"types": "./dist/index.d.ts"
}
},
"files": [
"dist"
],
"size-limit": [
{
"path": [
"dist/*.js",
"!dist/*.umd.js"
],
"limit": "256 kB",
"name": "Minimal Build",
"path": "dist/index-minimal.js",
"limit": "5 kB",
"brotli": true
},
{
"name": "Full Build",
"path": "dist/session-replay.js",
"limit": "100 kB",
"brotli": true
}
]
Expand Down
3 changes: 3 additions & 0 deletions sdk/@launchdarkly/session-replay/src/index-minimal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Re-export from the ultra-minimal build
export { Record as default, LDRecord } from '../../highlight-run/src/sdk/ld-ultra-minimal'
export type { MinimalRecordOptions as RecordOptions } from '../../highlight-run/src/sdk/ld-ultra-minimal'
61 changes: 61 additions & 0 deletions sdk/@launchdarkly/session-replay/vite.config.minimal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// vite.config.minimal.ts
import { resolve as resolvePath } from 'path'
import { defineConfig } from 'vite'

export default defineConfig({
build: {
target: 'es2020',
lib: {
formats: ['es', 'cjs'],
entry: resolvePath(__dirname, 'src/index-minimal.ts'),
fileName: (format) => `index-minimal.${format === 'es' ? 'js' : 'cjs'}`,
},
minify: 'terser',
terserOptions: {
ecma: 2020,
module: true,
toplevel: true,
compress: {
ecma: 2020,
module: true,
toplevel: true,
unsafe_arrows: true,
drop_console: true,
drop_debugger: true,
passes: 3,
pure_getters: true,
unsafe: true,
unsafe_comps: true,
unsafe_math: true,
unsafe_methods: true,
unsafe_proto: true,
unsafe_regexp: true,
unsafe_undefined: true,
unused: true,
dead_code: true,
inline: 3,
side_effects: false,
},
mangle: {
toplevel: true,
},
format: {
comments: false,
ecma: 2020,
},
},
rollupOptions: {
external: ['highlight.run'],
treeshake: {
moduleSideEffects: false,
propertyReadSideEffects: false,
tryCatchDeoptimization: false,
unknownGlobalSideEffects: false,
},
output: {
compact: true,
minifyInternalExports: true,
},
},
},
})
Loading
Loading