@posthog/browser-common
Advanced tools
+1
-1
@@ -29,3 +29,3 @@ "use strict"; | ||
| }); | ||
| const packageVersion = "0.2.0"; | ||
| const packageVersion = "0.2.1"; | ||
| const Config = { | ||
@@ -32,0 +32,0 @@ DEBUG: false, |
+1
-1
@@ -1,2 +0,2 @@ | ||
| const packageVersion = "0.2.0"; | ||
| const packageVersion = "0.2.1"; | ||
| const Config = { | ||
@@ -3,0 +3,0 @@ DEBUG: false, |
+13
-12
@@ -0,4 +1,6 @@ | ||
| /** Phantom brand carrying the capability type without emitting runtime code. */ | ||
| declare const extensionTokenType: unique symbol; | ||
| /** | ||
| * A typed, implementation-free key for resolving an extension that provides a | ||
| * capability. Declared as a shared `const` next to the providing extension's | ||
| * A typed, implementation-free string for resolving an extension that provides | ||
| * a capability. Declared as a shared `const` next to the providing extension's | ||
| * interface: | ||
@@ -8,15 +10,14 @@ * | ||
| * export interface FeatureFlagsExtension extends Extension { … } | ||
| * export const FeatureFlags: ExtensionToken<FeatureFlagsExtension> = { name: 'featureFlags' } | ||
| * export const FeatureFlags = 'posthog.featureFlags' as ExtensionToken<FeatureFlagsExtension> | ||
| * ``` | ||
| * | ||
| * A token holds no implementation, so importing one never pulls the provider's | ||
| * code into the consumer's bundle. The registry is keyed by token identity | ||
| * (the shared object reference), so provider and consumer must import the same | ||
| * exported token; `name` is for diagnostics only. | ||
| * code into the consumer's bundle. Its generic brand lets `getExtension` infer | ||
| * the provided type, while its runtime string value remains stable across | ||
| * independently compiled scripts. Token strings must be globally unique and | ||
| * stable for the lifetime of the capability contract. | ||
| */ | ||
| export interface ExtensionToken<T> { | ||
| /** Human-readable capability name used only for diagnostics. */ | ||
| readonly name: string; | ||
| /** Phantom: carries the provided type for inference; never present at runtime. */ | ||
| readonly __provides?: T; | ||
| } | ||
| export type ExtensionToken<T> = string & { | ||
| readonly [extensionTokenType]: T; | ||
| }; | ||
| export {}; |
+3
-3
| { | ||
| "name": "@posthog/browser-common", | ||
| "version": "0.2.0", | ||
| "version": "0.2.1", | ||
| "description": "Internal shared browser utilities and extension primitives for PostHog Browser SDKs", | ||
@@ -60,4 +60,4 @@ "license": "MIT", | ||
| "dependencies": { | ||
| "@posthog/core": "^1.44.0", | ||
| "@posthog/types": "^1.397.1" | ||
| "@posthog/types": "^1.398.0", | ||
| "@posthog/core": "^1.45.1" | ||
| }, | ||
@@ -64,0 +64,0 @@ "devDependencies": { |
+6
-4
@@ -99,6 +99,8 @@ # @posthog/browser-common | ||
| A token is implementation-free, so importing it never pulls the provider's code | ||
| into your bundle — each extension stays independently tree-shakable and lazily | ||
| loadable. An extension that provides a capability declares its token(s) in | ||
| `provides`. | ||
| A token is an implementation-free branded string, so importing it never pulls | ||
| the provider's code into your bundle — each extension stays independently | ||
| tree-shakable and lazily loadable. Use a package-qualified runtime string, such | ||
| as `posthog.featureFlags`, that is globally unique and stable so separately | ||
| compiled scripts resolve the same capability. An extension that provides a | ||
| capability declares its token(s) in `provides`. | ||
@@ -105,0 +107,0 @@ ## Utilities |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
204664
0.12%4606
0.02%134
1.52%11
-8.33%Updated
Updated